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 #ifndef _SVX_EXTRUSION_CONTROLS_HXX
28 #define _SVX_EXTRUSION_CONTROLS_HXX
29 
30 #include "svx/svxdllapi.h"
31 
32 #include <svtools/valueset.hxx>
33 #include <svtools/svtreebx.hxx>
34 #include <vcl/button.hxx>
35 #include <vcl/dialog.hxx>
36 #include <vcl/field.hxx>
37 #include <vcl/fixed.hxx>
38 
39 #include <svtools/toolbarmenu.hxx>
40 #include <svtools/popupwindowcontroller.hxx>
41 #include <svtools/popupmenucontrollerbase.hxx>
42 
43 class SfxBindings;
44 class SfxStatusForwarder;
45 
46 //========================================================================
47 
48 namespace svx
49 {
50 class ToolboxButtonColorUpdater;
51 
52 class ExtrusionDirectionWindow : public svtools::ToolbarMenu
53 {
54 public:
55 	ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
56 
57 	virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
58 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
59 
60 private:
61 	svt::ToolboxController& mrController;
62 	ValueSet* mpDirectionSet;
63 
64 	Image		maImgDirection[9];
65 	Image		maImgDirectionH[9];
66 
67 	Image		maImgPerspective;
68 	Image		maImgPerspectiveH;
69 	Image		maImgParallel;
70 	Image		maImgParallelH;
71 
72 	const rtl::OUString msExtrusionDirection;
73 	const rtl::OUString msExtrusionProjection;
74 
75 	DECL_LINK( SelectHdl, void * );
76 	void			FillValueSet();
77 
78 	void implSetDirection( sal_Int32 nSkew, bool bEnabled = true );
79 	void implSetProjection( sal_Int32 nProjection, bool bEnabled = true );
80 
81 };
82 
83 //========================================================================
84 
85 class ExtrusionDirectionControl : public svt::PopupWindowController
86 {
87 public:
88 	ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
89 
90 	virtual ::Window* createPopupWindow( ::Window* pParent );
91 
92     // XServiceInfo
93     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
94     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
95 
96 	using svt::PopupWindowController::createPopupWindow;
97 };
98 
99 //========================================================================
100 
101 class ExtrusionDepthWindow : public svtools::ToolbarMenu
102 {
103 private:
104 	svt::ToolboxController& mrController;
105 
106 	Image maImgDepth0;
107 	Image maImgDepth1;
108 	Image maImgDepth2;
109 	Image maImgDepth3;
110 	Image maImgDepth4;
111 	Image maImgDepthInfinity;
112 
113 	Image maImgDepth0h;
114 	Image maImgDepth1h;
115 	Image maImgDepth2h;
116 	Image maImgDepth3h;
117 	Image maImgDepth4h;
118 	Image maImgDepthInfinityh;
119 
120 	FieldUnit	meUnit;
121 	double		mfDepth;
122 
123 	const rtl::OUString msExtrusionDepth;
124 	const rtl::OUString msMetricUnit;
125 
126 	DECL_LINK( SelectHdl, void * );
127 
128 	void	implFillStrings( FieldUnit eUnit );
129 	void	implSetDepth( double fDepth );
130 
131 public:
132 	ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
133 
134 	virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
135 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
136 };
137 
138 //========================================================================
139 
140 class ExtrusionDepthController : public svt::PopupWindowController
141 {
142 public:
143 	ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
144 
145 	virtual ::Window* createPopupWindow( ::Window* pParent );
146 
147     // XServiceInfo
148     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
149     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
150 
151 	using svt::PopupWindowController::createPopupWindow;
152 };
153 
154 //========================================================================
155 
156 class ExtrusionLightingWindow : public svtools::ToolbarMenu
157 {
158 private:
159 	svt::ToolboxController& mrController;
160 	ValueSet*	 mpLightingSet;
161 
162 	Image maImgLightingOff[9];
163 	Image maImgLightingOn[9];
164 	Image maImgLightingPreview[9];
165 
166 	Image maImgLightingOffh[9];
167 	Image maImgLightingOnh[9];
168 	Image maImgLightingPreviewh[9];
169 
170 	Image maImgBright;
171 	Image maImgNormal;
172 	Image maImgDim;
173 	Image maImgBrighth;
174 	Image maImgNormalh;
175 	Image maImgDimh;
176 
177 	int		mnLevel;
178 	bool	mbLevelEnabled;
179 	int		mnDirection;
180 	bool	mbDirectionEnabled;
181 
182 	const rtl::OUString msExtrusionLightingDirection;
183 	const rtl::OUString msExtrusionLightingIntensity;
184 
185 	void	implSetIntensity( int nLevel, bool bEnabled );
186 	void	implSetDirection( int nDirection, bool bEnabled );
187 
188 	DECL_LINK( SelectHdl, void * );
189 public:
190 	ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
191 
192 	virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
193 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
194 };
195 
196 //========================================================================
197 
198 class ExtrusionLightingControl : public svt::PopupWindowController
199 {
200 public:
201 	ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
202 
203 	virtual ::Window* createPopupWindow( ::Window* pParent );
204 
205     // XServiceInfo
206     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
207     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
208 
209 	using svt::PopupWindowController::createPopupWindow;
210 };
211 
212 //========================================================================
213 
214 class ExtrusionSurfaceWindow : public svtools::ToolbarMenu
215 {
216 private:
217 	svt::ToolboxController& mrController;
218 
219 	Image maImgSurface1;
220 	Image maImgSurface2;
221 	Image maImgSurface3;
222 	Image maImgSurface4;
223 	Image maImgSurface1h;
224 	Image maImgSurface2h;
225 	Image maImgSurface3h;
226 	Image maImgSurface4h;
227 
228 	const rtl::OUString msExtrusionSurface;
229 
230 	DECL_LINK( SelectHdl, void * );
231 
232 	void	implSetSurface( int nSurface, bool bEnabled );
233 
234 public:
235 	ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
236 
237 	virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
238 };
239 
240 //========================================================================
241 
242 class ExtrusionSurfaceControl : public svt::PopupWindowController
243 {
244 public:
245 	ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
246 
247 	virtual ::Window* createPopupWindow( ::Window* pParent );
248 
249     // XServiceInfo
250     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
251     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
252 
253 	using svt::PopupWindowController::createPopupWindow;
254 };
255 
256 //========================================================================
257 
258 }
259 #endif
260 
261