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