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