xref: /AOO41X/main/svx/inc/svx/float3d.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_FLOAT3D_HXX
25 #define _SVX_FLOAT3D_HXX
26 
27 #include <sfx2/ctrlitem.hxx>
28 #ifndef _FIXED_HXX //autogen
29 #include <vcl/fixed.hxx>
30 #endif
31 #ifndef _FIELD_HXX //autogen
32 #include <vcl/field.hxx>
33 #endif
34 #include <sfx2/dockwin.hxx>
35 #ifndef _IMAGEBTN_HXX //autogen
36 #include <vcl/button.hxx>
37 #endif
38 #include <svtools/valueset.hxx>
39 #include <svtools/stdctrl.hxx>
40 #include "svx/svxdllapi.h"
41 
42 #include <svx/f3dchild.hxx>
43 #include <svx/dlgctl3d.hxx>
44 #include <svx/dlgctrl.hxx>
45 #include <svx/svdmodel.hxx>
46 
47 enum ViewType3D
48 {
49     VIEWTYPE_GEO = 1,
50     VIEWTYPE_REPRESENTATION,
51     VIEWTYPE_LIGHT,
52     VIEWTYPE_TEXTURE,
53     VIEWTYPE_MATERIAL
54 };
55 
56 class SdrModel;
57 class FmFormModel;
58 class FmFormPage;
59 class VirtualDevice;
60 class E3dView;
61 class SdrPageView;
62 class Svx3DCtrlItem;
63 class SvxConvertTo3DItem;
64 
65 //------------------------------------------------------------------------
66 struct Svx3DWinImpl;
67 
68 class SVX_DLLPUBLIC Svx3DWin : public SfxDockingWindow
69 {
70     friend class        Svx3DChildWindow;
71     friend class        Svx3DCtrlItem;
72     using Window::Update;
73 
74 private:
75     ImageButton         aBtnGeo;
76     ImageButton         aBtnRepresentation;
77     ImageButton         aBtnLight;
78     ImageButton         aBtnTexture;
79     ImageButton         aBtnMaterial;
80     ImageButton         aBtnUpdate;
81     ImageButton         aBtnAssign;
82 
83     FixedLine           aFLGeometrie;
84 // Geometrie
85     FixedText           aFtPercentDiagonal;
86     MetricField         aMtrPercentDiagonal;
87     FixedText           aFtBackscale;
88     MetricField         aMtrBackscale;
89     FixedText           aFtEndAngle;
90     MetricField         aMtrEndAngle;
91     FixedText           aFtDepth;
92     MetricField         aMtrDepth;
93       FixedLine           aFLSegments;
94 
95     FixedText           aFtHorizontal;
96     NumericField        aNumHorizontal;
97     FixedText           aFtVertical;
98     NumericField        aNumVertical;
99        FixedLine           aFLNormals;
100 
101     ImageButton         aBtnNormalsObj;
102     ImageButton         aBtnNormalsFlat;
103     ImageButton         aBtnNormalsSphere;
104     ImageButton         aBtnNormalsInvert;
105     ImageButton         aBtnTwoSidedLighting;
106 
107     ImageButton         aBtnDoubleSided;
108     FixedLine           aFLRepresentation;
109 // Darstellung
110     FixedText           aFtShademode;
111     ListBox             aLbShademode;
112     FixedLine           aFLShadow;
113     ImageButton         aBtnShadow3d;
114     FixedText           aFtSlant;
115     MetricField         aMtrSlant;
116     FixedText           aFtDistance;
117     MetricField         aMtrDistance;
118     FixedText           aFtFocalLeng;
119     MetricField         aMtrFocalLength;
120     FixedLine           aFLCamera;
121     FixedLine           aFLLight;
122 
123 // Beleuchtung
124     ImageButton         aBtnLight1;
125     ImageButton         aBtnLight2;
126     ImageButton         aBtnLight3;
127     ImageButton         aBtnLight4;
128     ImageButton         aBtnLight5;
129     ImageButton         aBtnLight6;
130     ImageButton         aBtnLight7;
131     ImageButton         aBtnLight8;
132     FixedText           aFTLightsource;
133     ColorLB             aLbLight1;
134     ColorLB             aLbLight2;
135     ColorLB             aLbLight3;
136     ColorLB             aLbLight4;
137     ColorLB             aLbLight5;
138     ColorLB             aLbLight6;
139     ColorLB             aLbLight7;
140     ColorLB             aLbLight8;
141 
142     ImageButton         aBtnLightColor;
143 
144     // #99694# Keyboard shortcuts activate the next control, so the
145     // order needed to be changed here
146     FixedText           aFTAmbientlight;    // Text label
147     ColorLB             aLbAmbientlight;    // ListBox
148     ImageButton         aBtnAmbientColor;   // color button
149 
150        FixedLine           aFLTexture;
151 
152 // Texturen
153     FixedText           aFtTexKind;
154     ImageButton         aBtnTexLuminance;
155     ImageButton         aBtnTexColor;
156     FixedText           aFtTexMode;
157     ImageButton         aBtnTexReplace;
158     ImageButton         aBtnTexModulate;
159     ImageButton         aBtnTexBlend;
160     FixedText           aFtTexProjectionX;
161     ImageButton         aBtnTexObjectX;
162     ImageButton         aBtnTexParallelX;
163     ImageButton         aBtnTexCircleX;
164     FixedText           aFtTexProjectionY;
165     ImageButton         aBtnTexObjectY;
166     ImageButton         aBtnTexParallelY;
167     ImageButton         aBtnTexCircleY;
168     FixedText           aFtTexFilter;
169     ImageButton         aBtnTexFilter;
170 
171 // Material
172        FixedLine           aFLMaterial;
173 // Materialeditor
174     FixedText           aFtMatFavorites;
175     ListBox             aLbMatFavorites;
176     FixedText           aFtMatColor;
177     ColorLB             aLbMatColor;
178     ImageButton         aBtnMatColor;
179     FixedText           aFtMatEmission;
180     ColorLB             aLbMatEmission;
181     ImageButton         aBtnEmissionColor;
182        FixedLine           aFLMatSpecular;
183     FixedText           aFtMatSpecular;
184     ColorLB             aLbMatSpecular;
185     ImageButton         aBtnSpecularColor;
186     FixedText           aFtMatSpecularIntensity;
187     MetricField         aMtrMatSpecularIntensity;
188 
189     Svx3DPreviewControl aCtlPreview;
190     SvxLightCtl3D       aCtlLightPreview;
191 
192 // Unterer Teil
193     ImageButton         aBtnConvertTo3D;
194     ImageButton         aBtnLatheObject;
195     ImageButton         aBtnPerspective;
196 
197 // der Rest ...
198     Image               aImgLightOn;
199     Image               aImgLightOff;
200     sal_Bool                bUpdate;
201     ViewType3D          eViewType;
202     Size                aSize;
203 
204     // Model, Page, View etc. fuer Favoriten
205     FmFormModel*        pModel;
206     FmFormPage*         pFmPage;
207     VirtualDevice*      pVDev;
208     E3dView*            p3DView;
209     List*               pFavorSetList;
210     List*               pMatFavSetList;
211 
212     SfxBindings*                pBindings;
213     Svx3DCtrlItem*              pControllerItem;
214 
215     SvxConvertTo3DItem*         pConvertTo3DItem;
216     SvxConvertTo3DItem*         pConvertTo3DLatheItem;
217 
218     Svx3DWinImpl*       mpImpl;
219     SfxMapUnit          ePoolUnit;
220     FieldUnit           eFUnit;
221 
222     // ItemSet used to remember set 2d attributes
223     SfxItemSet*         mpRemember2DAttributes;
224 
225     sal_Bool                bOnly3DChanged;
226 
227     //------------------------------------
228 
229     DECL_LINK( ClickViewTypeHdl, void * );
230     DECL_LINK( ClickUpdateHdl, void * );
231     DECL_LINK( ClickAssignHdl, void * );
232     DECL_LINK( ClickHdl, PushButton * );
233     DECL_LINK( ClickColorHdl, PushButton * );
234     DECL_LINK( SelectHdl, void * );
235     DECL_LINK( ModifyHdl, void * );
236     DECL_LINK( ClickLightHdl, PushButton * );
237 
238     DECL_LINK( DoubleClickHdl, void * );
239 
240     DECL_LINK( ChangeLightCallbackHdl, void * );
241     DECL_LINK( ChangeSelectionCallbackHdl, void * );
242 
243     SVX_DLLPRIVATE void         Construct();
244     SVX_DLLPRIVATE void         Reset();
245 
246     SVX_DLLPRIVATE sal_Bool         LBSelectColor( ColorLB* pLb, const Color& rColor );
247     SVX_DLLPRIVATE sal_uInt16           GetLightSource( const PushButton* pBtn = NULL );
248     SVX_DLLPRIVATE ColorLB*     GetLbByButton( const PushButton* pBtn = NULL );
249 
250     SVX_DLLPRIVATE bool         GetUILightState( ImageButton& aBtn ) const;
251     SVX_DLLPRIVATE void         SetUILightState( ImageButton& aBtn, bool bState );
252 
253 protected:
254     virtual void    Resize();
255 
256 public:
257             Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW,
258                         Window* pParent );
259             ~Svx3DWin();
260 
261     void    InitColorLB( const SdrModel* pDoc );
IsUpdateMode() const262     sal_Bool    IsUpdateMode() const { return bUpdate; }
263 
264     void    Update( SfxItemSet& rSet );
265     void    GetAttr( SfxItemSet& rSet );
266 
267     void UpdatePreview(); // nach oben (private)
268     void DocumentReload(); // #83951#
269 };
270 
271 /*************************************************************************
272 |*
273 |* ControllerItem fuer 3D-Window (Floating/Docking)
274 |*
275 \************************************************************************/
276 
277 class Svx3DCtrlItem : public SfxControllerItem
278 {
279     Svx3DWin* p3DWin;
280 
281  protected:
282     virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
283                                 const SfxPoolItem* pState );
284 
285  public:
286     Svx3DCtrlItem( sal_uInt16, Svx3DWin*, SfxBindings* );
287 };
288 
289 /*************************************************************************
290 |*
291 |* ControllerItem fuer Status eines Slots
292 |* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
293 |*
294 \************************************************************************/
295 
296 class SvxConvertTo3DItem : public SfxControllerItem
297 {
298     sal_Bool                        bState;
299 
300 protected:
301     virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState);
302 
303 public:
304     SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings* pBindings);
GetState() const305     sal_Bool GetState() const { return bState; }
306 };
307 
308 #endif      // _SVX_FLOAT3D_HXX
309 
310