1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10f6e50924SAndrew Rist *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19f6e50924SAndrew Rist *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <vos/mutex.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include <svtools/toolbarmenu.hxx>
34cdf0e10cSrcweir #include <vcl/toolbox.hxx>
35cdf0e10cSrcweir #include <sfx2/app.hxx>
36cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
37cdf0e10cSrcweir #include <sfx2/objsh.hxx>
38cdf0e10cSrcweir #include <svl/eitem.hxx>
39cdf0e10cSrcweir #include <vcl/settings.hxx>
40cdf0e10cSrcweir #include <svl/intitem.hxx>
41cdf0e10cSrcweir #include <editeng/colritem.hxx>
42cdf0e10cSrcweir #include <tools/urlobj.hxx>
43cdf0e10cSrcweir
44cdf0e10cSrcweir #include <svx/dialogs.hrc>
45cdf0e10cSrcweir #include <svx/svdtrans.hxx>
46cdf0e10cSrcweir #include <svx/sdasitm.hxx>
47cdf0e10cSrcweir #include <svx/dialmgr.hxx>
48cdf0e10cSrcweir #include "svx/extrusioncolorcontrol.hxx"
49cdf0e10cSrcweir
50cdf0e10cSrcweir //#include "chrtitem.hxx"
51cdf0e10cSrcweir #include "helpid.hrc"
52cdf0e10cSrcweir #include "extrusioncontrols.hxx"
53cdf0e10cSrcweir #include "extrusioncontrols.hrc"
54cdf0e10cSrcweir #include "colorwindow.hxx"
55cdf0e10cSrcweir #include "extrusiondepthdialog.hxx"
56cdf0e10cSrcweir
57cdf0e10cSrcweir ////////////
58cdf0e10cSrcweir
59cdf0e10cSrcweir using ::rtl::OUString;
60cdf0e10cSrcweir //using ::svtools::ToolbarMenu;
61cdf0e10cSrcweir
62cdf0e10cSrcweir using namespace ::com::sun::star;
63cdf0e10cSrcweir using namespace ::com::sun::star::uno;
64cdf0e10cSrcweir using namespace ::com::sun::star::lang;
65cdf0e10cSrcweir using namespace ::com::sun::star::beans;
66cdf0e10cSrcweir using namespace ::com::sun::star::util;
67cdf0e10cSrcweir using namespace ::com::sun::star::graphic;
68cdf0e10cSrcweir
69cdf0e10cSrcweir namespace svx
70cdf0e10cSrcweir {
71cdf0e10cSrcweir
72cdf0e10cSrcweir /*************************************************************************
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir |* ExtrusionDirectionWindow
75cdf0e10cSrcweir |*
76cdf0e10cSrcweir \************************************************************************/
77cdf0e10cSrcweir
78cdf0e10cSrcweir static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 };
79cdf0e10cSrcweir
ExtrusionDirectionWindow(svt::ToolboxController & rController,const::com::sun::star::uno::Reference<::com::sun::star::frame::XFrame> & rFrame,Window * pParentWindow)80cdf0e10cSrcweir ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
81cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION ))
82cdf0e10cSrcweir , mrController( rController )
83cdf0e10cSrcweir , maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) )
84cdf0e10cSrcweir , maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) )
85cdf0e10cSrcweir , maImgParallel( SVX_RES( IMG_PARALLEL ) )
86cdf0e10cSrcweir , maImgParallelH( SVX_RES( IMG_PARALLEL_H ) )
87cdf0e10cSrcweir , msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) )
88cdf0e10cSrcweir , msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir SetHelpId( HID_MENU_EXTRUSION_DIRECTION );
91cdf0e10cSrcweir
92cdf0e10cSrcweir sal_uInt16 i;
93cdf0e10cSrcweir for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir maImgDirection[i] = Image( SVX_RES( IMG_DIRECTION + i ) );
96cdf0e10cSrcweir maImgDirectionH[i] = Image( SVX_RES( IMG_DIRECTION_H + i ) );
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
99cdf0e10cSrcweir SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
100cdf0e10cSrcweir mpDirectionSet = createEmptyValueSetControl();
101cdf0e10cSrcweir mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION );
102cdf0e10cSrcweir
103cdf0e10cSrcweir mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
104cdf0e10cSrcweir mpDirectionSet->SetColCount( 3 );
105cdf0e10cSrcweir mpDirectionSet->EnableFullItemMode( sal_False );
106cdf0e10cSrcweir
107cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
108cdf0e10cSrcweir
109cdf0e10cSrcweir for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir String aText( SVX_RES( STR_DIRECTION + i ) );
112cdf0e10cSrcweir mpDirectionSet->InsertItem( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ], aText );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) );
116cdf0e10cSrcweir
117cdf0e10cSrcweir appendEntry( 2, mpDirectionSet );
118cdf0e10cSrcweir appendSeparator();
119cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective );
120cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel );
121cdf0e10cSrcweir
122cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() );
123cdf0e10cSrcweir
124cdf0e10cSrcweir FreeResource();
125cdf0e10cSrcweir
126cdf0e10cSrcweir AddStatusListener( msExtrusionDirection );
127cdf0e10cSrcweir AddStatusListener( msExtrusionProjection );
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)130cdf0e10cSrcweir void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir ToolbarMenu::DataChanged( rDCEvt );
133cdf0e10cSrcweir
134cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
135cdf0e10cSrcweir {
136cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
137cdf0e10cSrcweir
138cdf0e10cSrcweir for( sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] );
141cdf0e10cSrcweir }
142cdf0e10cSrcweir
143cdf0e10cSrcweir setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective );
144cdf0e10cSrcweir setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel );
145cdf0e10cSrcweir }
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
148cdf0e10cSrcweir // -----------------------------------------------------------------------
149cdf0e10cSrcweir
implSetDirection(sal_Int32 nSkew,bool bEnabled)150cdf0e10cSrcweir void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir if( mpDirectionSet )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir sal_uInt16 nItemId;
155cdf0e10cSrcweir for( nItemId = DIRECTION_NW; nItemId <= DIRECTION_SE; nItemId++ )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir if( gSkewList[nItemId] == nSkew )
158cdf0e10cSrcweir break;
159cdf0e10cSrcweir }
160cdf0e10cSrcweir
161cdf0e10cSrcweir if( nItemId <= DIRECTION_SE )
162cdf0e10cSrcweir {
163cdf0e10cSrcweir mpDirectionSet->SelectItem( nItemId+1 );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir else
166cdf0e10cSrcweir {
167cdf0e10cSrcweir mpDirectionSet->SetNoSelection();
168cdf0e10cSrcweir }
169cdf0e10cSrcweir }
170cdf0e10cSrcweir enableEntry( 2, bEnabled );
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir // -----------------------------------------------------------------------
174cdf0e10cSrcweir
implSetProjection(sal_Int32 nProjection,bool bEnabled)175cdf0e10cSrcweir void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir checkEntry( 0, (nProjection == 0) && bEnabled );
178cdf0e10cSrcweir checkEntry( 1, (nProjection == 1 ) && bEnabled );
179cdf0e10cSrcweir enableEntry( 0, bEnabled );
180cdf0e10cSrcweir enableEntry( 1, bEnabled );
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir // -----------------------------------------------------------------------
184cdf0e10cSrcweir
statusChanged(const::com::sun::star::frame::FeatureStateEvent & Event)185cdf0e10cSrcweir void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msExtrusionDirection ) )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir if( !Event.IsEnabled )
190cdf0e10cSrcweir {
191cdf0e10cSrcweir implSetDirection( -1, false );
192cdf0e10cSrcweir }
193cdf0e10cSrcweir else
194cdf0e10cSrcweir {
195cdf0e10cSrcweir sal_Int32 nValue = 0;
196cdf0e10cSrcweir if( Event.State >>= nValue )
197cdf0e10cSrcweir implSetDirection( nValue, true );
198cdf0e10cSrcweir }
199cdf0e10cSrcweir }
200cdf0e10cSrcweir else if( Event.FeatureURL.Main.equals( msExtrusionProjection ) )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir if( !Event.IsEnabled )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir implSetProjection( -1, false );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir else
207cdf0e10cSrcweir {
208cdf0e10cSrcweir sal_Int32 nValue = 0;
209cdf0e10cSrcweir if( Event.State >>= nValue )
210cdf0e10cSrcweir implSetProjection( nValue, true );
211cdf0e10cSrcweir }
212cdf0e10cSrcweir }
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
215cdf0e10cSrcweir // -----------------------------------------------------------------------
216cdf0e10cSrcweir
IMPL_LINK(ExtrusionDirectionWindow,SelectHdl,void *,pControl)217cdf0e10cSrcweir IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir if ( IsInPopupMode() )
220cdf0e10cSrcweir EndPopupMode();
221cdf0e10cSrcweir
222cdf0e10cSrcweir if( pControl == mpDirectionSet )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
225cdf0e10cSrcweir aArgs[0].Name = msExtrusionDirection.copy(5);
226cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1];
227cdf0e10cSrcweir
228cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionDirection, aArgs );
229cdf0e10cSrcweir }
230cdf0e10cSrcweir else
231cdf0e10cSrcweir {
232cdf0e10cSrcweir int nProjection = getSelectedEntryId();
233cdf0e10cSrcweir if( (nProjection >= 0) && (nProjection < 2 ) )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
236cdf0e10cSrcweir aArgs[0].Name = msExtrusionProjection.copy(5);
237cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nProjection;
238cdf0e10cSrcweir
239cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionProjection, aArgs );
240cdf0e10cSrcweir implSetProjection( nProjection, true );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir return 0;
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir // =======================================================================
248cdf0e10cSrcweir // ExtrusionDirectionControl
249cdf0e10cSrcweir // =======================================================================
250cdf0e10cSrcweir
ExtrusionDirectionControl(const Reference<lang::XMultiServiceFactory> & rServiceManager)251cdf0e10cSrcweir ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
252cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir }
255cdf0e10cSrcweir
256cdf0e10cSrcweir // -----------------------------------------------------------------------
257cdf0e10cSrcweir
createPopupWindow(::Window * pParent)258cdf0e10cSrcweir ::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir return new ExtrusionDirectionWindow( *this, m_xFrame, pParent );
261cdf0e10cSrcweir }
262cdf0e10cSrcweir
263cdf0e10cSrcweir // -----------------------------------------------------------------------
264cdf0e10cSrcweir // XServiceInfo
265cdf0e10cSrcweir // -----------------------------------------------------------------------
266cdf0e10cSrcweir
ExtrusionDirectionControl_getImplementationName()267cdf0e10cSrcweir OUString SAL_CALL ExtrusionDirectionControl_getImplementationName()
268cdf0e10cSrcweir {
269cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" ));
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir // --------------------------------------------------------------------
273cdf0e10cSrcweir
ExtrusionDirectionControl_getSupportedServiceNames()274cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException )
275cdf0e10cSrcweir {
276cdf0e10cSrcweir Sequence< OUString > aSNS( 1 );
277cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
278cdf0e10cSrcweir return aSNS;
279cdf0e10cSrcweir }
280cdf0e10cSrcweir
281cdf0e10cSrcweir // --------------------------------------------------------------------
282cdf0e10cSrcweir
ExtrusionDirectionControl_createInstance(const Reference<XMultiServiceFactory> & rSMgr)283cdf0e10cSrcweir Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir return *new ExtrusionDirectionControl( rSMgr );
286cdf0e10cSrcweir }
287cdf0e10cSrcweir
288cdf0e10cSrcweir // --------------------------------------------------------------------
289cdf0e10cSrcweir
getImplementationName()290cdf0e10cSrcweir OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( ) throw (RuntimeException)
291cdf0e10cSrcweir {
292cdf0e10cSrcweir return ExtrusionDirectionControl_getImplementationName();
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir // --------------------------------------------------------------------
296cdf0e10cSrcweir
getSupportedServiceNames()297cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( ) throw (RuntimeException)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir return ExtrusionDirectionControl_getSupportedServiceNames();
300cdf0e10cSrcweir }
301cdf0e10cSrcweir
302cdf0e10cSrcweir // ####################################################################
303cdf0e10cSrcweir
ExtrusionDepthDialog(Window * pParent,double fDepth,FieldUnit eDefaultUnit)304cdf0e10cSrcweir ExtrusionDepthDialog::ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit )
305cdf0e10cSrcweir : ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_EXTRUSION_DEPTH ) ),
306cdf0e10cSrcweir maFLDepth( this, SVX_RES( FL_DEPTH ) ),
307cdf0e10cSrcweir maMtrDepth( this, SVX_RES( MTR_DEPTH ) ),
308cdf0e10cSrcweir maOKButton( this, SVX_RES( BTN_OK ) ),
309cdf0e10cSrcweir maCancelButton( this, SVX_RES( BTN_CANCEL ) ),
310cdf0e10cSrcweir maHelpButton( this, SVX_RES( BTN_HELP ) )
311cdf0e10cSrcweir {
312cdf0e10cSrcweir bool bMetric = IsMetric( eDefaultUnit );
313cdf0e10cSrcweir maMtrDepth.SetUnit( bMetric ? FUNIT_CM : FUNIT_INCH );
314cdf0e10cSrcweir maMtrDepth.SetValue( (int) fDepth * 100, FUNIT_100TH_MM );
315cdf0e10cSrcweir
316cdf0e10cSrcweir FreeResource();
317cdf0e10cSrcweir }
318cdf0e10cSrcweir
~ExtrusionDepthDialog()319cdf0e10cSrcweir ExtrusionDepthDialog::~ExtrusionDepthDialog()
320cdf0e10cSrcweir {
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
getDepth() const323cdf0e10cSrcweir double ExtrusionDepthDialog::getDepth() const
324cdf0e10cSrcweir {
325cdf0e10cSrcweir // bool bMetric = IsMetric( meDefaultUnit );
326cdf0e10cSrcweir return (double)( maMtrDepth.GetValue( FUNIT_100TH_MM ) ) / 100.0;
327cdf0e10cSrcweir }
328cdf0e10cSrcweir
329cdf0e10cSrcweir // ####################################################################
330cdf0e10cSrcweir
331cdf0e10cSrcweir double aDepthListInch[] = { 0, 1270,2540,5080,10160 };
332cdf0e10cSrcweir double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 };
333cdf0e10cSrcweir
ExtrusionDepthWindow(svt::ToolboxController & rController,const::com::sun::star::uno::Reference<::com::sun::star::frame::XFrame> & rFrame,Window * pParentWindow)334cdf0e10cSrcweir ExtrusionDepthWindow::ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
335cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH ))
336cdf0e10cSrcweir , mrController( rController )
337cdf0e10cSrcweir , maImgDepth0( SVX_RES( IMG_DEPTH_0 ) )
338cdf0e10cSrcweir , maImgDepth1( SVX_RES( IMG_DEPTH_1 ) )
339cdf0e10cSrcweir , maImgDepth2( SVX_RES( IMG_DEPTH_2 ) )
340cdf0e10cSrcweir , maImgDepth3( SVX_RES( IMG_DEPTH_3 ) )
341cdf0e10cSrcweir , maImgDepth4( SVX_RES( IMG_DEPTH_4 ) )
342cdf0e10cSrcweir , maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) )
343cdf0e10cSrcweir , maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) )
344cdf0e10cSrcweir , maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) )
345cdf0e10cSrcweir , maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) )
346cdf0e10cSrcweir , maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) )
347cdf0e10cSrcweir , maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) )
348cdf0e10cSrcweir , maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) )
349cdf0e10cSrcweir , mfDepth( -1.0 )
350cdf0e10cSrcweir , msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) )
351cdf0e10cSrcweir , msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir SetHelpId( HID_MENU_EXTRUSION_DEPTH );
354cdf0e10cSrcweir
355cdf0e10cSrcweir SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) );
356cdf0e10cSrcweir
357cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
358cdf0e10cSrcweir
359cdf0e10cSrcweir String aEmpty;
360cdf0e10cSrcweir appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 );
361cdf0e10cSrcweir appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 );
362cdf0e10cSrcweir appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 );
363cdf0e10cSrcweir appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 );
364cdf0e10cSrcweir appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 );
365cdf0e10cSrcweir appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity );
366cdf0e10cSrcweir appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) );
367cdf0e10cSrcweir
368cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() );
369cdf0e10cSrcweir
370cdf0e10cSrcweir FreeResource();
371cdf0e10cSrcweir
372cdf0e10cSrcweir AddStatusListener( msExtrusionDepth );
373cdf0e10cSrcweir AddStatusListener( msMetricUnit );
374cdf0e10cSrcweir }
375cdf0e10cSrcweir
376cdf0e10cSrcweir // -----------------------------------------------------------------------
377cdf0e10cSrcweir
implSetDepth(double fDepth)378cdf0e10cSrcweir void ExtrusionDepthWindow::implSetDepth( double fDepth )
379cdf0e10cSrcweir {
380cdf0e10cSrcweir mfDepth = fDepth;
381cdf0e10cSrcweir int i;
382cdf0e10cSrcweir for( i = 0; i < 7; i++ )
383cdf0e10cSrcweir {
384cdf0e10cSrcweir if( i == 5 )
385cdf0e10cSrcweir {
386cdf0e10cSrcweir checkEntry( i, fDepth >= 338666 );
387cdf0e10cSrcweir }
388cdf0e10cSrcweir else if( i != 6 )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) );
391cdf0e10cSrcweir }
392cdf0e10cSrcweir }
393cdf0e10cSrcweir }
394cdf0e10cSrcweir
395cdf0e10cSrcweir // -----------------------------------------------------------------------
396cdf0e10cSrcweir
implFillStrings(FieldUnit eUnit)397cdf0e10cSrcweir void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit )
398cdf0e10cSrcweir {
399cdf0e10cSrcweir meUnit = eUnit;
400cdf0e10cSrcweir sal_uInt16 nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH;
401cdf0e10cSrcweir
402cdf0e10cSrcweir for( int i = 0; i < 5; i++ )
403cdf0e10cSrcweir {
404cdf0e10cSrcweir String aStr( SVX_RES( nResource + i ) );
405cdf0e10cSrcweir setEntryText( i, aStr );
406cdf0e10cSrcweir };
407cdf0e10cSrcweir }
408cdf0e10cSrcweir
409cdf0e10cSrcweir // -----------------------------------------------------------------------
410cdf0e10cSrcweir
statusChanged(const::com::sun::star::frame::FeatureStateEvent & Event)411cdf0e10cSrcweir void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msExtrusionDepth ) )
414cdf0e10cSrcweir {
415cdf0e10cSrcweir if( !Event.IsEnabled )
416cdf0e10cSrcweir {
417cdf0e10cSrcweir implSetDepth( 0 );
418cdf0e10cSrcweir }
419cdf0e10cSrcweir else
420cdf0e10cSrcweir {
421cdf0e10cSrcweir double fValue = 0.0;
422cdf0e10cSrcweir if( Event.State >>= fValue )
423cdf0e10cSrcweir implSetDepth( fValue );
424cdf0e10cSrcweir }
425cdf0e10cSrcweir }
426cdf0e10cSrcweir else if( Event.FeatureURL.Main.equals( msMetricUnit ) )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir if( Event.IsEnabled )
429cdf0e10cSrcweir {
430cdf0e10cSrcweir sal_Int32 nValue = 0;
431cdf0e10cSrcweir if( Event.State >>= nValue )
432cdf0e10cSrcweir {
433cdf0e10cSrcweir implFillStrings( static_cast<FieldUnit>(nValue) );
434cdf0e10cSrcweir if( mfDepth >= 0.0 )
435cdf0e10cSrcweir implSetDepth( mfDepth );
436cdf0e10cSrcweir }
437cdf0e10cSrcweir }
438cdf0e10cSrcweir }
439cdf0e10cSrcweir }
440cdf0e10cSrcweir
441cdf0e10cSrcweir // -----------------------------------------------------------------------
442cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)443cdf0e10cSrcweir void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt )
444cdf0e10cSrcweir {
445cdf0e10cSrcweir ToolbarMenu::DataChanged( rDCEvt );
446cdf0e10cSrcweir
447cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
448cdf0e10cSrcweir {
449cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
450cdf0e10cSrcweir
451cdf0e10cSrcweir setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 );
452cdf0e10cSrcweir setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 );
453cdf0e10cSrcweir setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 );
454cdf0e10cSrcweir setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 );
455cdf0e10cSrcweir setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 );
456cdf0e10cSrcweir setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity );
457cdf0e10cSrcweir }
458cdf0e10cSrcweir }
459cdf0e10cSrcweir
460cdf0e10cSrcweir
461cdf0e10cSrcweir // -----------------------------------------------------------------------
462cdf0e10cSrcweir
IMPL_LINK(ExtrusionDepthWindow,SelectHdl,void *,EMPTYARG)463cdf0e10cSrcweir IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG )
464cdf0e10cSrcweir {
465cdf0e10cSrcweir int nSelected = getSelectedEntryId();
466cdf0e10cSrcweir if( nSelected != -1 )
467cdf0e10cSrcweir {
468cdf0e10cSrcweir if( nSelected == 6 )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir if ( IsInPopupMode() )
471cdf0e10cSrcweir EndPopupMode();
472cdf0e10cSrcweir
473cdf0e10cSrcweir const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" ));
474cdf0e10cSrcweir
475cdf0e10cSrcweir Any a;
476cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 2 );
477cdf0e10cSrcweir aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" ));
478cdf0e10cSrcweir aArgs[0].Value <<= mfDepth;
479cdf0e10cSrcweir aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ));
480cdf0e10cSrcweir aArgs[1].Value <<= static_cast<sal_Int32>( meUnit );
481cdf0e10cSrcweir
482cdf0e10cSrcweir mrController.dispatchCommand( aCommand, aArgs );
483cdf0e10cSrcweir }
484cdf0e10cSrcweir else
485cdf0e10cSrcweir {
486cdf0e10cSrcweir double fDepth;
487cdf0e10cSrcweir
488cdf0e10cSrcweir if( nSelected == 5 )
489cdf0e10cSrcweir {
490cdf0e10cSrcweir fDepth = 338666.6;
491cdf0e10cSrcweir }
492cdf0e10cSrcweir else
493cdf0e10cSrcweir {
494cdf0e10cSrcweir fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected];
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
498cdf0e10cSrcweir aArgs[0].Name = msExtrusionDepth.copy(5);
499cdf0e10cSrcweir aArgs[0].Value <<= fDepth;
500cdf0e10cSrcweir
501cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionDepth, aArgs );
502cdf0e10cSrcweir implSetDepth( fDepth );
503cdf0e10cSrcweir
504cdf0e10cSrcweir if ( IsInPopupMode() )
505cdf0e10cSrcweir EndPopupMode();
506cdf0e10cSrcweir }
507cdf0e10cSrcweir }
508cdf0e10cSrcweir return 0;
509cdf0e10cSrcweir }
510cdf0e10cSrcweir
511cdf0e10cSrcweir // =======================================================================
512cdf0e10cSrcweir // ExtrusionDirectionControl
513cdf0e10cSrcweir // =======================================================================
514cdf0e10cSrcweir
ExtrusionDepthController(const Reference<lang::XMultiServiceFactory> & rServiceManager)515cdf0e10cSrcweir ExtrusionDepthController::ExtrusionDepthController( const Reference< lang::XMultiServiceFactory >& rServiceManager )
516cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthFloater" ) ) )
517cdf0e10cSrcweir {
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
520cdf0e10cSrcweir // -----------------------------------------------------------------------
521cdf0e10cSrcweir
createPopupWindow(::Window * pParent)522cdf0e10cSrcweir ::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent )
523cdf0e10cSrcweir {
524cdf0e10cSrcweir return new ExtrusionDepthWindow( *this, m_xFrame, pParent );
525cdf0e10cSrcweir }
526cdf0e10cSrcweir
527cdf0e10cSrcweir
528cdf0e10cSrcweir // -----------------------------------------------------------------------
529cdf0e10cSrcweir // XServiceInfo
530cdf0e10cSrcweir // -----------------------------------------------------------------------
531cdf0e10cSrcweir
ExtrusionDepthController_getImplementationName()532cdf0e10cSrcweir OUString SAL_CALL ExtrusionDepthController_getImplementationName()
533cdf0e10cSrcweir {
534cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" ));
535cdf0e10cSrcweir }
536cdf0e10cSrcweir
537cdf0e10cSrcweir // --------------------------------------------------------------------
538cdf0e10cSrcweir
ExtrusionDepthController_getSupportedServiceNames()539cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException )
540cdf0e10cSrcweir {
541cdf0e10cSrcweir Sequence< OUString > aSNS( 1 );
542*7b652b49SAriel Constenla-Haile aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
543cdf0e10cSrcweir return aSNS;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir
546cdf0e10cSrcweir // --------------------------------------------------------------------
547cdf0e10cSrcweir
ExtrusionDepthController_createInstance(const Reference<XMultiServiceFactory> & rSMgr)548cdf0e10cSrcweir Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
549cdf0e10cSrcweir {
550cdf0e10cSrcweir return *new ExtrusionDepthController( rSMgr );
551cdf0e10cSrcweir }
552cdf0e10cSrcweir
553cdf0e10cSrcweir // --------------------------------------------------------------------
554cdf0e10cSrcweir
getImplementationName()555cdf0e10cSrcweir OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException)
556cdf0e10cSrcweir {
557cdf0e10cSrcweir return ExtrusionDepthController_getImplementationName();
558cdf0e10cSrcweir }
559cdf0e10cSrcweir
560cdf0e10cSrcweir // --------------------------------------------------------------------
561cdf0e10cSrcweir
getSupportedServiceNames()562cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException)
563cdf0e10cSrcweir {
564cdf0e10cSrcweir return ExtrusionDepthController_getSupportedServiceNames();
565cdf0e10cSrcweir }
566cdf0e10cSrcweir
567cdf0e10cSrcweir
568cdf0e10cSrcweir // ####################################################################
569cdf0e10cSrcweir
570cdf0e10cSrcweir // -------------------------------------------------------------------------
571cdf0e10cSrcweir
ExtrusionLightingWindow(svt::ToolboxController & rController,const::com::sun::star::uno::Reference<::com::sun::star::frame::XFrame> & rFrame,Window * pParentWindow)572cdf0e10cSrcweir ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
573cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ))
574cdf0e10cSrcweir , mrController( rController )
575cdf0e10cSrcweir , maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) )
576cdf0e10cSrcweir , maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) )
577cdf0e10cSrcweir , maImgDim( SVX_RES( IMG_LIGHTING_DIM ) )
578cdf0e10cSrcweir , maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) )
579cdf0e10cSrcweir , maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) )
580cdf0e10cSrcweir , maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) )
581cdf0e10cSrcweir , mnLevel( 0 )
582cdf0e10cSrcweir , mbLevelEnabled( false )
583cdf0e10cSrcweir , mnDirection( FROM_FRONT )
584cdf0e10cSrcweir , mbDirectionEnabled( false )
585cdf0e10cSrcweir , msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ))
586cdf0e10cSrcweir , msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ))
587cdf0e10cSrcweir {
588cdf0e10cSrcweir sal_uInt16 i;
589cdf0e10cSrcweir for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
590cdf0e10cSrcweir {
591cdf0e10cSrcweir if( i != FROM_FRONT )
592cdf0e10cSrcweir {
593cdf0e10cSrcweir maImgLightingOff[i] = Image( SVX_RES( IMG_LIGHT_OFF + i ) );
594cdf0e10cSrcweir maImgLightingOn[i] = Image( SVX_RES( IMG_LIGHT_ON + i ) );
595cdf0e10cSrcweir maImgLightingOffh[i] = Image( SVX_RES( IMG_LIGHT_OFF_H + i ) );
596cdf0e10cSrcweir maImgLightingOnh[i] = Image( SVX_RES( IMG_LIGHT_ON_H + i ) );
597cdf0e10cSrcweir }
598cdf0e10cSrcweir maImgLightingPreview[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW + i ) );
599cdf0e10cSrcweir maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) );
600cdf0e10cSrcweir }
601cdf0e10cSrcweir
602cdf0e10cSrcweir SetHelpId( HID_MENU_EXTRUSION_LIGHTING );
603cdf0e10cSrcweir SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
604cdf0e10cSrcweir
605cdf0e10cSrcweir mpLightingSet = createEmptyValueSetControl();
606cdf0e10cSrcweir mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING );
607cdf0e10cSrcweir
608cdf0e10cSrcweir mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
609cdf0e10cSrcweir mpLightingSet->SetColCount( 3 );
610cdf0e10cSrcweir mpLightingSet->EnableFullItemMode( sal_False );
611cdf0e10cSrcweir
612cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
613cdf0e10cSrcweir
614cdf0e10cSrcweir for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
615cdf0e10cSrcweir {
616cdf0e10cSrcweir if( i != FROM_FRONT )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir mpLightingSet->InsertItem( i+1, bHighContrast ? maImgLightingOffh[i] : maImgLightingOff[i] );
619cdf0e10cSrcweir }
620cdf0e10cSrcweir else
621cdf0e10cSrcweir {
622cdf0e10cSrcweir mpLightingSet->InsertItem( 5, bHighContrast ? maImgLightingPreviewh[FROM_FRONT] : maImgLightingPreview[FROM_FRONT] );
623cdf0e10cSrcweir }
624cdf0e10cSrcweir }
625cdf0e10cSrcweir mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) );
626cdf0e10cSrcweir
627cdf0e10cSrcweir appendEntry( 3, mpLightingSet );
628cdf0e10cSrcweir appendSeparator();
629cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright );
630cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal );
631cdf0e10cSrcweir appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim );
632cdf0e10cSrcweir
633cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() );
634cdf0e10cSrcweir
635cdf0e10cSrcweir FreeResource();
636cdf0e10cSrcweir
637cdf0e10cSrcweir AddStatusListener( msExtrusionLightingDirection );
638cdf0e10cSrcweir AddStatusListener( msExtrusionLightingIntensity );
639cdf0e10cSrcweir }
640cdf0e10cSrcweir
641cdf0e10cSrcweir // -----------------------------------------------------------------------
642cdf0e10cSrcweir
implSetIntensity(int nLevel,bool bEnabled)643cdf0e10cSrcweir void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled )
644cdf0e10cSrcweir {
645cdf0e10cSrcweir mnLevel = nLevel;
646cdf0e10cSrcweir mbLevelEnabled = bEnabled;
647cdf0e10cSrcweir int i = 0;
648cdf0e10cSrcweir for( i = 0; i < 3; i++ )
649cdf0e10cSrcweir {
650cdf0e10cSrcweir checkEntry( i, (i == nLevel) && bEnabled );
651cdf0e10cSrcweir enableEntry( i, bEnabled );
652cdf0e10cSrcweir }
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir // -----------------------------------------------------------------------
656cdf0e10cSrcweir
implSetDirection(int nDirection,bool bEnabled)657cdf0e10cSrcweir void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled )
658cdf0e10cSrcweir {
659cdf0e10cSrcweir mnDirection = nDirection;
660cdf0e10cSrcweir mbDirectionEnabled = bEnabled;
661cdf0e10cSrcweir
662cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
663cdf0e10cSrcweir
664cdf0e10cSrcweir if( !bEnabled )
665cdf0e10cSrcweir nDirection = FROM_FRONT;
666cdf0e10cSrcweir
667cdf0e10cSrcweir sal_uInt16 nItemId;
668cdf0e10cSrcweir for( nItemId = FROM_TOP_LEFT; nItemId <= FROM_BOTTOM_RIGHT; nItemId++ )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir if( nItemId == FROM_FRONT )
671cdf0e10cSrcweir {
672cdf0e10cSrcweir mpLightingSet->SetItemImage( nItemId + 1, bHighContrast ? maImgLightingPreviewh[ nDirection ] : maImgLightingPreview[ nDirection ] );
673cdf0e10cSrcweir }
674cdf0e10cSrcweir else
675cdf0e10cSrcweir {
676cdf0e10cSrcweir if( bHighContrast )
677cdf0e10cSrcweir {
678cdf0e10cSrcweir mpLightingSet->SetItemImage( nItemId + 1, (sal_uInt16)nDirection == nItemId ? maImgLightingOnh[nItemId] : maImgLightingOffh[nItemId] );
679cdf0e10cSrcweir }
680cdf0e10cSrcweir else
681cdf0e10cSrcweir {
682cdf0e10cSrcweir mpLightingSet->SetItemImage( nItemId + 1, (sal_uInt16)nDirection == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] );
683cdf0e10cSrcweir }
684cdf0e10cSrcweir }
685cdf0e10cSrcweir }
686cdf0e10cSrcweir
687cdf0e10cSrcweir enableEntry( 3, bEnabled );
688cdf0e10cSrcweir }
689cdf0e10cSrcweir
690cdf0e10cSrcweir // -----------------------------------------------------------------------
691cdf0e10cSrcweir
statusChanged(const::com::sun::star::frame::FeatureStateEvent & Event)692cdf0e10cSrcweir void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
693cdf0e10cSrcweir {
694cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msExtrusionLightingIntensity ) )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir if( !Event.IsEnabled )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir implSetIntensity( 0, false );
699cdf0e10cSrcweir }
700cdf0e10cSrcweir else
701cdf0e10cSrcweir {
702cdf0e10cSrcweir sal_Int32 nValue = 0;
703cdf0e10cSrcweir if( Event.State >>= nValue )
704cdf0e10cSrcweir implSetIntensity( nValue, true );
705cdf0e10cSrcweir }
706cdf0e10cSrcweir }
707cdf0e10cSrcweir else if( Event.FeatureURL.Main.equals( msExtrusionLightingDirection ) )
708cdf0e10cSrcweir {
709cdf0e10cSrcweir if( !Event.IsEnabled )
710cdf0e10cSrcweir {
711cdf0e10cSrcweir implSetDirection( 0, false );
712cdf0e10cSrcweir }
713cdf0e10cSrcweir else
714cdf0e10cSrcweir {
715cdf0e10cSrcweir sal_Int32 nValue = 0;
716cdf0e10cSrcweir if( Event.State >>= nValue )
717cdf0e10cSrcweir implSetDirection( nValue, true );
718cdf0e10cSrcweir }
719cdf0e10cSrcweir }
720cdf0e10cSrcweir }
721cdf0e10cSrcweir
722cdf0e10cSrcweir // -----------------------------------------------------------------------
723cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)724cdf0e10cSrcweir void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt )
725cdf0e10cSrcweir {
726cdf0e10cSrcweir ToolbarMenu::DataChanged( rDCEvt );
727cdf0e10cSrcweir
728cdf0e10cSrcweir if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
729cdf0e10cSrcweir {
730cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
731cdf0e10cSrcweir
732cdf0e10cSrcweir implSetDirection( mnDirection, mbDirectionEnabled );
733cdf0e10cSrcweir setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright );
734cdf0e10cSrcweir setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal );
735cdf0e10cSrcweir setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim );
736cdf0e10cSrcweir }
737cdf0e10cSrcweir }
738cdf0e10cSrcweir
739cdf0e10cSrcweir // -----------------------------------------------------------------------
740cdf0e10cSrcweir
IMPL_LINK(ExtrusionLightingWindow,SelectHdl,void *,pControl)741cdf0e10cSrcweir IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir if ( IsInPopupMode() )
744cdf0e10cSrcweir EndPopupMode();
745cdf0e10cSrcweir
746cdf0e10cSrcweir if( pControl == this )
747cdf0e10cSrcweir {
748cdf0e10cSrcweir int nLevel = getSelectedEntryId();
749cdf0e10cSrcweir if( nLevel >= 0 )
750cdf0e10cSrcweir {
751cdf0e10cSrcweir if( nLevel != 3 )
752cdf0e10cSrcweir {
753cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
754cdf0e10cSrcweir aArgs[0].Name = msExtrusionLightingIntensity.copy(5);
755cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nLevel;
756cdf0e10cSrcweir
757cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs );
758cdf0e10cSrcweir
759cdf0e10cSrcweir implSetIntensity( nLevel, true );
760cdf0e10cSrcweir }
761cdf0e10cSrcweir }
762cdf0e10cSrcweir }
763cdf0e10cSrcweir else
764cdf0e10cSrcweir {
765cdf0e10cSrcweir sal_Int32 nDirection = mpLightingSet->GetSelectItemId();
766cdf0e10cSrcweir
767cdf0e10cSrcweir if( (nDirection > 0) && (nDirection < 10) )
768cdf0e10cSrcweir {
769cdf0e10cSrcweir nDirection--;
770cdf0e10cSrcweir
771cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
772cdf0e10cSrcweir aArgs[0].Name = msExtrusionLightingDirection.copy(5);
773cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nDirection;
774cdf0e10cSrcweir
775cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionLightingDirection, aArgs );
776cdf0e10cSrcweir
777cdf0e10cSrcweir implSetDirection( nDirection, true );
778cdf0e10cSrcweir }
779cdf0e10cSrcweir
780cdf0e10cSrcweir }
781cdf0e10cSrcweir
782cdf0e10cSrcweir return 0;
783cdf0e10cSrcweir }
784cdf0e10cSrcweir
785cdf0e10cSrcweir // ========================================================================
786cdf0e10cSrcweir
ExtrusionLightingControl(const Reference<lang::XMultiServiceFactory> & rServiceManager)787cdf0e10cSrcweir ExtrusionLightingControl::ExtrusionLightingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
788cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir }
791cdf0e10cSrcweir
792cdf0e10cSrcweir // -----------------------------------------------------------------------
793cdf0e10cSrcweir
createPopupWindow(::Window * pParent)794cdf0e10cSrcweir ::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent )
795cdf0e10cSrcweir {
796cdf0e10cSrcweir return new ExtrusionLightingWindow( *this, m_xFrame, pParent );
797cdf0e10cSrcweir }
798cdf0e10cSrcweir
799cdf0e10cSrcweir // -----------------------------------------------------------------------
800cdf0e10cSrcweir // XServiceInfo
801cdf0e10cSrcweir // -----------------------------------------------------------------------
802cdf0e10cSrcweir
ExtrusionLightingControl_getImplementationName()803cdf0e10cSrcweir OUString SAL_CALL ExtrusionLightingControl_getImplementationName()
804cdf0e10cSrcweir {
805cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" ));
806cdf0e10cSrcweir }
807cdf0e10cSrcweir
808cdf0e10cSrcweir // --------------------------------------------------------------------
809cdf0e10cSrcweir
ExtrusionLightingControl_getSupportedServiceNames()810cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException )
811cdf0e10cSrcweir {
812cdf0e10cSrcweir Sequence< OUString > aSNS( 1 );
813cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
814cdf0e10cSrcweir return aSNS;
815cdf0e10cSrcweir }
816cdf0e10cSrcweir
817cdf0e10cSrcweir // --------------------------------------------------------------------
818cdf0e10cSrcweir
ExtrusionLightingControl_createInstance(const Reference<XMultiServiceFactory> & rSMgr)819cdf0e10cSrcweir Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
820cdf0e10cSrcweir {
821cdf0e10cSrcweir return *new ExtrusionLightingControl( rSMgr );
822cdf0e10cSrcweir }
823cdf0e10cSrcweir
824cdf0e10cSrcweir // --------------------------------------------------------------------
825cdf0e10cSrcweir
getImplementationName()826cdf0e10cSrcweir OUString SAL_CALL ExtrusionLightingControl::getImplementationName( ) throw (RuntimeException)
827cdf0e10cSrcweir {
828cdf0e10cSrcweir return ExtrusionLightingControl_getImplementationName();
829cdf0e10cSrcweir }
830cdf0e10cSrcweir
831cdf0e10cSrcweir // --------------------------------------------------------------------
832cdf0e10cSrcweir
getSupportedServiceNames()833cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames( ) throw (RuntimeException)
834cdf0e10cSrcweir {
835cdf0e10cSrcweir return ExtrusionLightingControl_getSupportedServiceNames();
836cdf0e10cSrcweir }
837cdf0e10cSrcweir
838cdf0e10cSrcweir // ####################################################################
839cdf0e10cSrcweir
ExtrusionSurfaceWindow(svt::ToolboxController & rController,const::com::sun::star::uno::Reference<::com::sun::star::frame::XFrame> & rFrame,Window * pParentWindow)840cdf0e10cSrcweir ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
841cdf0e10cSrcweir : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE ))
842cdf0e10cSrcweir , mrController( rController )
843cdf0e10cSrcweir , maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) )
844cdf0e10cSrcweir , maImgSurface2( SVX_RES( IMG_MATTE ) )
845cdf0e10cSrcweir , maImgSurface3( SVX_RES( IMG_PLASTIC ) )
846cdf0e10cSrcweir , maImgSurface4( SVX_RES( IMG_METAL ) )
847cdf0e10cSrcweir , maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) )
848cdf0e10cSrcweir , maImgSurface2h( SVX_RES( IMG_MATTE_H ) )
849cdf0e10cSrcweir , maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) )
850cdf0e10cSrcweir , maImgSurface4h( SVX_RES( IMG_METAL_H ) )
851cdf0e10cSrcweir , msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ))
852cdf0e10cSrcweir {
853cdf0e10cSrcweir bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
854cdf0e10cSrcweir
855cdf0e10cSrcweir SetHelpId( HID_MENU_EXTRUSION_SURFACE );
856cdf0e10cSrcweir SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) );
857cdf0e10cSrcweir
858cdf0e10cSrcweir appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 );
859cdf0e10cSrcweir appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 );
860cdf0e10cSrcweir appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 );
861cdf0e10cSrcweir appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 );
862cdf0e10cSrcweir
863cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() );
864cdf0e10cSrcweir
865cdf0e10cSrcweir FreeResource();
866cdf0e10cSrcweir
867cdf0e10cSrcweir AddStatusListener( msExtrusionSurface );
868cdf0e10cSrcweir }
869cdf0e10cSrcweir
870cdf0e10cSrcweir // -----------------------------------------------------------------------
871cdf0e10cSrcweir
implSetSurface(int nSurface,bool bEnabled)872cdf0e10cSrcweir void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled )
873cdf0e10cSrcweir {
874cdf0e10cSrcweir // if( mpMenu )
875cdf0e10cSrcweir {
876cdf0e10cSrcweir int i;
877cdf0e10cSrcweir for( i = 0; i < 4; i++ )
878cdf0e10cSrcweir {
879cdf0e10cSrcweir checkEntry( i, (i == nSurface) && bEnabled );
880cdf0e10cSrcweir enableEntry( i, bEnabled );
881cdf0e10cSrcweir }
882cdf0e10cSrcweir }
883cdf0e10cSrcweir }
884cdf0e10cSrcweir
885cdf0e10cSrcweir // -----------------------------------------------------------------------
886cdf0e10cSrcweir
statusChanged(const::com::sun::star::frame::FeatureStateEvent & Event)887cdf0e10cSrcweir void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
888cdf0e10cSrcweir {
889cdf0e10cSrcweir if( Event.FeatureURL.Main.equals( msExtrusionSurface ) )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir if( !Event.IsEnabled )
892cdf0e10cSrcweir {
893cdf0e10cSrcweir implSetSurface( 0, false );
894cdf0e10cSrcweir }
895cdf0e10cSrcweir else
896cdf0e10cSrcweir {
897cdf0e10cSrcweir sal_Int32 nValue = 0;
898cdf0e10cSrcweir if( Event.State >>= nValue )
899cdf0e10cSrcweir implSetSurface( nValue, true );
900cdf0e10cSrcweir }
901cdf0e10cSrcweir }
902cdf0e10cSrcweir }
903cdf0e10cSrcweir
904cdf0e10cSrcweir // -----------------------------------------------------------------------
905cdf0e10cSrcweir
IMPL_LINK(ExtrusionSurfaceWindow,SelectHdl,void *,EMPTYARG)906cdf0e10cSrcweir IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG )
907cdf0e10cSrcweir {
908cdf0e10cSrcweir if ( IsInPopupMode() )
909cdf0e10cSrcweir EndPopupMode();
910cdf0e10cSrcweir
911cdf0e10cSrcweir sal_Int32 nSurface = getSelectedEntryId();
912cdf0e10cSrcweir if( nSurface >= 0 )
913cdf0e10cSrcweir {
914cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
915cdf0e10cSrcweir aArgs[0].Name = msExtrusionSurface.copy(5);
916cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)nSurface;
917cdf0e10cSrcweir
918cdf0e10cSrcweir mrController.dispatchCommand( msExtrusionSurface, aArgs );
919cdf0e10cSrcweir
920cdf0e10cSrcweir implSetSurface( nSurface, true );
921cdf0e10cSrcweir }
922cdf0e10cSrcweir
923cdf0e10cSrcweir return 0;
924cdf0e10cSrcweir }
925cdf0e10cSrcweir
926cdf0e10cSrcweir // ========================================================================
927cdf0e10cSrcweir
ExtrusionSurfaceControl(const Reference<lang::XMultiServiceFactory> & rServiceManager)928cdf0e10cSrcweir ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
929cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) ) )
930cdf0e10cSrcweir {
931cdf0e10cSrcweir }
932cdf0e10cSrcweir
933cdf0e10cSrcweir // -----------------------------------------------------------------------
934cdf0e10cSrcweir
createPopupWindow(::Window * pParent)935cdf0e10cSrcweir ::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent )
936cdf0e10cSrcweir {
937cdf0e10cSrcweir return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent );
938cdf0e10cSrcweir }
939cdf0e10cSrcweir
940cdf0e10cSrcweir // -----------------------------------------------------------------------
941cdf0e10cSrcweir // XServiceInfo
942cdf0e10cSrcweir // -----------------------------------------------------------------------
943cdf0e10cSrcweir
ExtrusionSurfaceControl_getImplementationName()944cdf0e10cSrcweir OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName()
945cdf0e10cSrcweir {
946cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" ));
947cdf0e10cSrcweir }
948cdf0e10cSrcweir
949cdf0e10cSrcweir // --------------------------------------------------------------------
950cdf0e10cSrcweir
ExtrusionSurfaceControl_getSupportedServiceNames()951cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir Sequence< OUString > aSNS( 1 );
954cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
955cdf0e10cSrcweir return aSNS;
956cdf0e10cSrcweir }
957cdf0e10cSrcweir
958cdf0e10cSrcweir // --------------------------------------------------------------------
959cdf0e10cSrcweir
ExtrusionSurfaceControl_createInstance(const Reference<XMultiServiceFactory> & rSMgr)960cdf0e10cSrcweir Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
961cdf0e10cSrcweir {
962cdf0e10cSrcweir return *new ExtrusionSurfaceControl( rSMgr );
963cdf0e10cSrcweir }
964cdf0e10cSrcweir
965cdf0e10cSrcweir // --------------------------------------------------------------------
966cdf0e10cSrcweir
getImplementationName()967cdf0e10cSrcweir OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName( ) throw (RuntimeException)
968cdf0e10cSrcweir {
969cdf0e10cSrcweir return ExtrusionSurfaceControl_getImplementationName();
970cdf0e10cSrcweir }
971cdf0e10cSrcweir
972cdf0e10cSrcweir // --------------------------------------------------------------------
973cdf0e10cSrcweir
getSupportedServiceNames()974cdf0e10cSrcweir Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( ) throw (RuntimeException)
975cdf0e10cSrcweir {
976cdf0e10cSrcweir return ExtrusionSurfaceControl_getSupportedServiceNames();
977cdf0e10cSrcweir }
978cdf0e10cSrcweir
979cdf0e10cSrcweir //========================================================================
980cdf0e10cSrcweir
981cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( ExtrusionColorControl, SvxColorItem );
982cdf0e10cSrcweir
ExtrusionColorControl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)983cdf0e10cSrcweir ExtrusionColorControl::ExtrusionColorControl(
984cdf0e10cSrcweir sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
985cdf0e10cSrcweir : SfxToolBoxControl ( nSlotId, nId, rTbx )
986cdf0e10cSrcweir {
987cdf0e10cSrcweir rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
988cdf0e10cSrcweir mpBtnUpdater = new ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW );
989cdf0e10cSrcweir }
990cdf0e10cSrcweir
991cdf0e10cSrcweir // -----------------------------------------------------------------------
992cdf0e10cSrcweir
~ExtrusionColorControl()993cdf0e10cSrcweir ExtrusionColorControl::~ExtrusionColorControl()
994cdf0e10cSrcweir {
995cdf0e10cSrcweir delete mpBtnUpdater;
996cdf0e10cSrcweir }
997cdf0e10cSrcweir
998cdf0e10cSrcweir // -----------------------------------------------------------------------
999cdf0e10cSrcweir
GetPopupWindowType() const1000cdf0e10cSrcweir SfxPopupWindowType ExtrusionColorControl::GetPopupWindowType() const
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir return SFX_POPUPWINDOW_ONCLICK;
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir
1005cdf0e10cSrcweir // -----------------------------------------------------------------------
1006cdf0e10cSrcweir
CreatePopupWindow()1007cdf0e10cSrcweir SfxPopupWindow* ExtrusionColorControl::CreatePopupWindow()
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
1010cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Extrusion3DColor" )),
1011cdf0e10cSrcweir SID_EXTRUSION_3D_COLOR,
1012cdf0e10cSrcweir m_xFrame,
1013cdf0e10cSrcweir SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ),
1014cdf0e10cSrcweir &GetToolBox() );
1015cdf0e10cSrcweir pColorWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
1016cdf0e10cSrcweir pColorWin->StartSelection();
1017cdf0e10cSrcweir SetPopupWindow( pColorWin );
1018cdf0e10cSrcweir return pColorWin;
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir
1021cdf0e10cSrcweir // -----------------------------------------------------------------------
1022cdf0e10cSrcweir
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1023cdf0e10cSrcweir void ExtrusionColorControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir sal_uInt16 nId = GetId();
1026cdf0e10cSrcweir ToolBox& rTbx = GetToolBox();
1027cdf0e10cSrcweir
1028cdf0e10cSrcweir if( nSID == SID_EXTRUSION_3D_COLOR )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir const SvxColorItem* pItem = 0;
1031cdf0e10cSrcweir
1032cdf0e10cSrcweir if( SFX_ITEM_DONTCARE != eState )
1033cdf0e10cSrcweir pItem = PTR_CAST( SvxColorItem, pState );
1034cdf0e10cSrcweir
1035cdf0e10cSrcweir if ( pItem )
1036cdf0e10cSrcweir mpBtnUpdater->Update( pItem->GetValue());
1037cdf0e10cSrcweir }
1038cdf0e10cSrcweir
1039cdf0e10cSrcweir rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
1040cdf0e10cSrcweir rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
1041cdf0e10cSrcweir }
1042cdf0e10cSrcweir
1043cdf0e10cSrcweir }
1044