1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: extrusioncontrols.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
36 #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
38 #ifndef _TOOLBOX_HXX //autogen
39 #include <vcl/toolbox.hxx>
41 #include <sfx2/app.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <sfx2/objsh.hxx>
44 #include <svtools/eitem.hxx>
45 #include <vcl/settings.hxx>
46 #include <svtools/intitem.hxx>
47 #include <svx/colritem.hxx>
48 #include "chrtitem.hxx"
49 #include <tools/urlobj.hxx>
51 #include <svx/dialogs.hrc>
54 #include <svx/svdtrans.hxx>
55 #include <svx/dialmgr.hxx>
56 #include "extrusioncontrols.hxx"
57 #include "extrusioncontrols.hrc"
58 #include <svx/sdasitm.hxx>
59 #include "toolbarmenu.hxx"
60 #include "colorwindow.hxx"
62 #include <svx/tbxcolorupdate.hxx>
67 using namespace ::com::sun::star::uno
;
68 using namespace ::com::sun::star::lang
;
69 using namespace ::com::sun::star::beans
;
71 SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl
, SfxBoolItem
);
73 /*************************************************************************
75 |* ExtrusionDirectionWindow
77 \************************************************************************/
79 static sal_Int32 gSkewList
[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 };
81 ExtrusionDirectionWindow::ExtrusionDirectionWindow(
83 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
) :
86 SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION
)),
88 maImgPerspective( SVX_RES( IMG_PERSPECTIVE
) ),
89 maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H
) ),
90 maImgParallel( SVX_RES( IMG_PARALLEL
) ),
91 maImgParallelH( SVX_RES( IMG_PARALLEL_H
) ),
97 ExtrusionDirectionWindow::ExtrusionDirectionWindow(
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
,
100 Window
* pParentWindow
) :
104 SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION
)),
106 maImgPerspective( SVX_RES( IMG_PERSPECTIVE
) ),
107 maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H
) ),
108 maImgParallel( SVX_RES( IMG_PARALLEL
) ),
109 maImgParallelH( SVX_RES( IMG_PARALLEL_H
) ),
115 void ExtrusionDirectionWindow::implInit()
117 SetHelpId( HID_POPUP_EXTRUSION_DIRECTION
);
120 for( i
= DIRECTION_NW
; i
<= DIRECTION_SE
; i
++ )
122 maImgDirection
[i
] = Image( SVX_RES( IMG_DIRECTION
+ i
) );
123 maImgDirectionH
[i
] = Image( SVX_RES( IMG_DIRECTION_H
+ i
) );
126 // mpDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_DIRECTION, *this );
127 // mpProjectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_PROJECTION, *this );
129 mpMenu
= new ToolbarMenu( this, WB_CLIPCHILDREN
);
130 mpMenu
->SetHelpId( HID_MENU_EXTRUSION_DIRECTION
);
131 mpMenu
->SetSelectHdl( LINK( this, ExtrusionDirectionWindow
, SelectHdl
) );
132 mpDirectionSet
= new ValueSet( mpMenu
, WB_TABSTOP
| WB_MENUSTYLEVALUESET
| WB_FLATVALUESET
| WB_NOBORDER
| WB_NO_DIRECTSELECT
);
133 mpDirectionSet
->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION
);
135 mpDirectionSet
->SetHelpId( HID_POPUP_LINEEND_CTRL
);
136 mpDirectionSet
->SetSelectHdl( LINK( this, ExtrusionDirectionWindow
, SelectHdl
) );
137 mpDirectionSet
->SetColCount( 3 );
138 mpDirectionSet
->EnableFullItemMode( FALSE
);
140 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
142 for( i
= DIRECTION_NW
; i
<= DIRECTION_SE
; i
++ )
144 String
aText( SVX_RES( STR_DIRECTION
+ i
) );
145 mpDirectionSet
->InsertItem( i
+1, bHighContrast
? maImgDirectionH
[ i
] : maImgDirection
[ i
], aText
);
148 mpDirectionSet
->SetOutputSizePixel( Size( 72, 72 ) );
150 mpMenu
->appendEntry( 2, mpDirectionSet
);
151 mpMenu
->appendSeparator();
152 mpMenu
->appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE
) ), bHighContrast
? maImgPerspectiveH
: maImgPerspective
);
153 mpMenu
->appendEntry( 1, String( SVX_RES( STR_PARALLEL
) ), bHighContrast
? maImgParallelH
: maImgParallel
);
155 SetOutputSizePixel( mpMenu
->getMenuSize() );
156 mpMenu
->SetOutputSizePixel( GetOutputSizePixel() );
162 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" )));
163 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" )));
166 SfxPopupWindow
* ExtrusionDirectionWindow::Clone() const
168 return new ExtrusionDirectionWindow( GetId(), mxFrame
);
171 void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent
& rDCEvt
)
173 SfxPopupWindow::DataChanged( rDCEvt
);
175 if( ( rDCEvt
.GetType() == DATACHANGED_SETTINGS
) && ( rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
177 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
180 for( i
= DIRECTION_NW
; i
<= DIRECTION_SE
; i
++ )
182 mpDirectionSet
->SetItemImage( i
+1, bHighContrast
? maImgDirectionH
[ i
] : maImgDirection
[ i
] );
185 mpMenu
->setEntryImage( 0, bHighContrast
? maImgPerspectiveH
: maImgPerspective
);
186 mpMenu
->setEntryImage( 1, bHighContrast
? maImgParallelH
: maImgParallel
);
190 // -----------------------------------------------------------------------
192 ExtrusionDirectionWindow::~ExtrusionDirectionWindow()
197 // -----------------------------------------------------------------------
199 void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew
, bool bEnabled
)
204 for( nItemId
= DIRECTION_NW
; nItemId
<= DIRECTION_SE
; nItemId
++ )
206 if( gSkewList
[nItemId
] == nSkew
)
210 if( nItemId
<= DIRECTION_SE
)
212 mpDirectionSet
->SelectItem( nItemId
+1 );
216 mpDirectionSet
->SetNoSelection();
221 mpMenu
->enableEntry( 2, bEnabled
);
225 // -----------------------------------------------------------------------
227 void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection
, bool bEnabled
)
231 mpMenu
->checkEntry( 0, (nProjection
== 0) && bEnabled
);
232 mpMenu
->checkEntry( 1, (nProjection
== 1 ) && bEnabled
);
233 mpMenu
->enableEntry( 0, bEnabled
);
234 mpMenu
->enableEntry( 1, bEnabled
);
238 // -----------------------------------------------------------------------
240 void ExtrusionDirectionWindow::StateChanged( USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* pState
)
244 case SID_EXTRUSION_DIRECTION
:
246 if( eState
== SFX_ITEM_DISABLED
)
248 implSetDirection( -1, false );
252 const SfxInt32Item
* pStateItem
= PTR_CAST( SfxInt32Item
, pState
);
254 implSetDirection( pStateItem
->GetValue(), true );
258 case SID_EXTRUSION_PROJECTION
:
260 if( eState
== SFX_ITEM_DISABLED
)
262 implSetProjection( -1, false );
266 const SfxInt32Item
* pStateItem
= PTR_CAST( SfxInt32Item
, pState
);
268 implSetProjection( pStateItem
->GetValue(), true );
275 // -----------------------------------------------------------------------
277 IMPL_LINK( ExtrusionDirectionWindow
, SelectHdl
, void *, pControl
)
279 if ( IsInPopupMode() )
282 // SfxDispatcher* pDisp = GetBindings().GetDispatcher();
284 if( pControl
== mpDirectionSet
)
286 sal_Int32 nSkew
= gSkewList
[mpDirectionSet
->GetSelectItemId()-1];
288 SfxInt32Item
aItem( SID_EXTRUSION_DIRECTION
, nSkew
);
289 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ));
292 INetURLObject
aObj( aCommand
);
293 Sequence
< PropertyValue
> aArgs( 1 );
294 aArgs
[0].Name
= aObj
.GetURLPath();
295 aItem
.QueryValue( a
);
298 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
299 mxFrame
->getController(), UNO_QUERY
),
303 // pDisp->Execute( SID_EXTRUSION_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L );
307 int nProjection
= mpMenu
->getSelectedEntryId();
308 if( (nProjection
>= 0) && (nProjection
< 2 ) )
310 SfxInt32Item
aItem( SID_EXTRUSION_PROJECTION
, nProjection
);
311 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ));
314 INetURLObject
aObj( aCommand
);
315 Sequence
< PropertyValue
> aArgs( 1 );
316 aArgs
[0].Name
= aObj
.GetURLPath();
317 aItem
.QueryValue( a
);
320 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
321 mxFrame
->getController(), UNO_QUERY
),
324 implSetProjection( nProjection
, true );
331 // -----------------------------------------------------------------------
333 void ExtrusionDirectionWindow::FillValueSet()
337 // -----------------------------------------------------------------------
339 void ExtrusionDirectionWindow::StartSelection()
341 mpDirectionSet
->StartSelection();
344 // -----------------------------------------------------------------------
346 BOOL
ExtrusionDirectionWindow::Close()
348 return SfxPopupWindow::Close();
351 // -----------------------------------------------------------------------
353 void ExtrusionDirectionWindow::PopupModeEnd()
359 SfxPopupWindow::PopupModeEnd();
362 // -----------------------------------------------------------------------
364 void ExtrusionDirectionWindow::GetFocus (void)
366 SfxPopupWindow::GetFocus();
367 // Grab the focus to the line ends value set so that it can be controlled
368 // with the keyboard.
370 mpDirectionSet
->GrabFocus();
373 /*************************************************************************
375 |* SvxLineEndToolBoxControl
377 \************************************************************************/
379 ExtrusionDirectionControl::ExtrusionDirectionControl(
380 USHORT nSlotId
, USHORT nId
, ToolBox
&rTbx
)
381 : SfxToolBoxControl( nSlotId
, nId
, rTbx
)
383 rTbx
.SetItemBits( nId
, TIB_DROPDOWNONLY
| rTbx
.GetItemBits( nId
) );
386 // -----------------------------------------------------------------------
388 ExtrusionDirectionControl::~ExtrusionDirectionControl()
392 // -----------------------------------------------------------------------
394 SfxPopupWindowType
ExtrusionDirectionControl::GetPopupWindowType() const
396 return SFX_POPUPWINDOW_ONCLICK
;
399 // -----------------------------------------------------------------------
401 SfxPopupWindow
* ExtrusionDirectionControl::CreatePopupWindow()
403 ExtrusionDirectionWindow
* pWin
= new ExtrusionDirectionWindow( GetId(), m_xFrame
, &GetToolBox() );
404 pWin
->StartPopupMode( &GetToolBox(), TRUE
);
405 pWin
->StartSelection();
406 SetPopupWindow( pWin
);
410 // -----------------------------------------------------------------------
412 void ExtrusionDirectionControl::StateChanged( USHORT
, SfxItemState eState
, const SfxPoolItem
* )
414 USHORT nId
= GetId();
415 ToolBox
& rTbx
= GetToolBox();
417 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
418 rTbx
.SetItemState( nId
, ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);
421 // ####################################################################
423 ExtrusionDepthDialog::ExtrusionDepthDialog( Window
* pParent
, double fDepth
, FieldUnit eDefaultUnit
)
424 : ModalDialog( pParent
, SVX_RES( RID_SVX_MDLG_EXTRUSION_DEPTH
) ),
425 maFLDepth( this, SVX_RES( FL_DEPTH
) ),
426 maMtrDepth( this, SVX_RES( MTR_DEPTH
) ),
427 maOKButton( this, SVX_RES( BTN_OK
) ),
428 maCancelButton( this, SVX_RES( BTN_CANCEL
) ),
429 maHelpButton( this, SVX_RES( BTN_HELP
) )
431 bool bMetric
= IsMetric( eDefaultUnit
);
432 maMtrDepth
.SetUnit( bMetric
? FUNIT_CM
: FUNIT_INCH
);
433 maMtrDepth
.SetValue( (int) fDepth
* 100, FUNIT_100TH_MM
);
438 ExtrusionDepthDialog::~ExtrusionDepthDialog()
442 double ExtrusionDepthDialog::getDepth() const
444 // bool bMetric = IsMetric( meDefaultUnit );
445 return (double)( maMtrDepth
.GetValue( FUNIT_100TH_MM
) ) / 100.0;
448 // ####################################################################
450 SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl
, SfxBoolItem
);
452 ExtrusionDepthWindow::ExtrusionDepthWindow(
454 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
) :
457 SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH
)),
458 maImgDepth0( SVX_RES( IMG_DEPTH_0
) ),
459 maImgDepth1( SVX_RES( IMG_DEPTH_1
) ),
460 maImgDepth2( SVX_RES( IMG_DEPTH_2
) ),
461 maImgDepth3( SVX_RES( IMG_DEPTH_3
) ),
462 maImgDepth4( SVX_RES( IMG_DEPTH_4
) ),
463 maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY
) ),
464 maImgDepth0h( SVX_RES( IMG_DEPTH_0_H
) ),
465 maImgDepth1h( SVX_RES( IMG_DEPTH_1_H
) ),
466 maImgDepth2h( SVX_RES( IMG_DEPTH_2_H
) ),
467 maImgDepth3h( SVX_RES( IMG_DEPTH_3_H
) ),
468 maImgDepth4h( SVX_RES( IMG_DEPTH_4_H
) ),
469 maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H
) ),
471 mbPopupMode ( true ),
478 ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT nId
,
479 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
,
480 Window
* pParentWindow
) :
484 SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH
)),
485 maImgDepth0( SVX_RES( IMG_DEPTH_0
) ),
486 maImgDepth1( SVX_RES( IMG_DEPTH_1
) ),
487 maImgDepth2( SVX_RES( IMG_DEPTH_2
) ),
488 maImgDepth3( SVX_RES( IMG_DEPTH_3
) ),
489 maImgDepth4( SVX_RES( IMG_DEPTH_4
) ),
490 maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY
) ),
491 maImgDepth0h( SVX_RES( IMG_DEPTH_0_H
) ),
492 maImgDepth1h( SVX_RES( IMG_DEPTH_1_H
) ),
493 maImgDepth2h( SVX_RES( IMG_DEPTH_2_H
) ),
494 maImgDepth3h( SVX_RES( IMG_DEPTH_3_H
) ),
495 maImgDepth4h( SVX_RES( IMG_DEPTH_4_H
) ),
496 maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H
) ),
498 mbPopupMode ( true ),
505 void ExtrusionDepthWindow::implInit()
507 SetHelpId( HID_POPUP_EXTRUSION_DEPTH
);
509 // mpDepthForewarder = new SfxStatusForwarder( SID_EXTRUSION_DEPTH, *this );
510 // mpMetricForewarder = new SfxStatusForwarder( SID_ATTR_METRIC, *this );
512 mpMenu
= new ToolbarMenu( this, WB_CLIPCHILDREN
);
513 mpMenu
->SetHelpId( HID_MENU_EXTRUSION_DEPTH
);
515 mpMenu
->SetSelectHdl( LINK( this, ExtrusionDepthWindow
, SelectHdl
) );
517 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
520 mpMenu
->appendEntry( 0, aEmpty
, bHighContrast
? maImgDepth0h
: maImgDepth0
);
521 mpMenu
->appendEntry( 1, aEmpty
, bHighContrast
? maImgDepth1h
: maImgDepth1
);
522 mpMenu
->appendEntry( 2, aEmpty
, bHighContrast
? maImgDepth2h
: maImgDepth2
);
523 mpMenu
->appendEntry( 3, aEmpty
, bHighContrast
? maImgDepth3h
: maImgDepth3
);
524 mpMenu
->appendEntry( 4, aEmpty
, bHighContrast
? maImgDepth4h
: maImgDepth4
);
525 mpMenu
->appendEntry( 5, String( SVX_RES( STR_INFINITY
) ), bHighContrast
? maImgDepthInfinityh
: maImgDepthInfinity
);
526 mpMenu
->appendEntry( 6, String( SVX_RES( STR_CUSTOM
) ) );
528 SetOutputSizePixel( mpMenu
->getMenuSize() );
529 mpMenu
->SetOutputSizePixel( GetOutputSizePixel() );
535 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" )));
536 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" )));
537 // rBindings.Update( SID_ATTR_METRIC );
538 // rBindings.Update( SID_EXTRUSION_DEPTH );
541 SfxPopupWindow
* ExtrusionDepthWindow::Clone() const
543 return new ExtrusionDepthWindow( GetId(), mxFrame
);
546 // -----------------------------------------------------------------------
548 ExtrusionDepthWindow::~ExtrusionDepthWindow()
550 // delete mpDepthForewarder;
551 // delete mpMetricForewarder;
556 // -----------------------------------------------------------------------
558 double aDepthListInch
[] = { 0, 1270,2540,5080,10160 };
559 double aDepthListMM
[] = { 0, 1000, 2500, 5000, 10000 };
561 void ExtrusionDepthWindow::implSetDepth( double fDepth
, bool bEnabled
)
563 mbEnabled
= bEnabled
;
568 for( i
= 0; i
< 7; i
++ )
572 mpMenu
->checkEntry( i
, (fDepth
>= 338666) && bEnabled
);
576 mpMenu
->checkEntry( i
, (fDepth
== (IsMetric( meUnit
) ? aDepthListMM
[i
] : aDepthListInch
[i
]) && bEnabled
) );
578 mpMenu
->enableEntry( i
, bEnabled
);
583 // -----------------------------------------------------------------------
585 void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit
)
588 USHORT nResource
= IsMetric( eUnit
) ? RID_SVXSTR_DEPTH_0
: RID_SVXSTR_DEPTH_0_INCH
;
590 for( int i
= 0; i
< 5; i
++ )
592 String
aStr( SVX_RES( nResource
+ i
) );
593 mpMenu
->setEntryText( i
, aStr
);
597 // -----------------------------------------------------------------------
599 void ExtrusionDepthWindow::StateChanged( USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* pState
)
603 case SID_EXTRUSION_DEPTH
:
605 if( eState
== SFX_ITEM_DISABLED
)
607 implSetDepth( 0, false );
611 const SvxDoubleItem
* pStateItem
= PTR_CAST( SvxDoubleItem
, pState
);
613 implSetDepth( pStateItem
->GetValue(), true );
617 case SID_ATTR_METRIC
:
619 const SfxUInt16Item
* pStateItem
= PTR_CAST( SfxUInt16Item
, pState
);
622 implFillStrings( (FieldUnit
)pStateItem
->GetValue() );
624 implSetDepth( mfDepth
, mbEnabled
);
630 // -----------------------------------------------------------------------
632 void ExtrusionDepthWindow::DataChanged( const DataChangedEvent
& rDCEvt
)
634 SfxPopupWindow::DataChanged( rDCEvt
);
636 if( ( rDCEvt
.GetType() == DATACHANGED_SETTINGS
) && ( rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
638 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
640 mpMenu
->setEntryImage( 0, bHighContrast
? maImgDepth0h
: maImgDepth0
);
641 mpMenu
->setEntryImage( 1, bHighContrast
? maImgDepth1h
: maImgDepth1
);
642 mpMenu
->setEntryImage( 2, bHighContrast
? maImgDepth2h
: maImgDepth2
);
643 mpMenu
->setEntryImage( 3, bHighContrast
? maImgDepth3h
: maImgDepth3
);
644 mpMenu
->setEntryImage( 4, bHighContrast
? maImgDepth4h
: maImgDepth4
);
645 mpMenu
->setEntryImage( 5, bHighContrast
? maImgDepthInfinityh
: maImgDepthInfinity
);
650 // -----------------------------------------------------------------------
652 IMPL_LINK( ExtrusionDepthWindow
, SelectHdl
, void *, EMPTYARG
)
654 // SfxDispatcher* pDisp = GetBindings().GetDispatcher();
656 int nSelected
= mpMenu
->getSelectedEntryId();
657 if( nSelected
!= -1 )
661 if ( IsInPopupMode() )
664 SvxDoubleItem
aDepthItem( mfDepth
, SID_EXTRUSION_DEPTH
);
665 SfxUInt16Item
aMetricItem(
666 SID_ATTR_METRIC
, sal::static_int_cast
< UINT16
>( meUnit
) );
667 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" ));
670 Sequence
< PropertyValue
> aArgs( 2 );
671 aArgs
[0].Name
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" ));
672 aDepthItem
.QueryValue( a
);
674 aArgs
[1].Name
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ));
675 aMetricItem
.QueryValue( a
);
678 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
679 mxFrame
->getController(), UNO_QUERY
),
693 fDepth
= IsMetric( meUnit
) ? aDepthListMM
[nSelected
] : aDepthListInch
[nSelected
];
696 SvxDoubleItem
aItem( fDepth
, SID_EXTRUSION_DEPTH
);
697 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ));
700 INetURLObject
aObj( aCommand
);
701 Sequence
< PropertyValue
> aArgs( 1 );
702 aArgs
[0].Name
= aObj
.GetURLPath();
703 aItem
.QueryValue( a
);
706 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
707 mxFrame
->getController(), UNO_QUERY
),
710 implSetDepth( fDepth
, true );
712 if ( IsInPopupMode() )
719 // -----------------------------------------------------------------------
721 void ExtrusionDepthWindow::StartSelection()
725 // -----------------------------------------------------------------------
727 BOOL
ExtrusionDepthWindow::Close()
729 return SfxPopupWindow::Close();
732 // -----------------------------------------------------------------------
734 void ExtrusionDepthWindow::PopupModeEnd()
740 SfxPopupWindow::PopupModeEnd();
743 // -----------------------------------------------------------------------
745 void ExtrusionDepthWindow::GetFocus (void)
747 SfxPopupWindow::GetFocus();
748 // Grab the focus to the line ends value set so that it can be controlled
749 // with the keyboard.
754 // ========================================================================
756 ExtrusionDepthControl::ExtrusionDepthControl(
757 USHORT nSlotId
, USHORT nId
, ToolBox
&rTbx
)
758 : SfxToolBoxControl( nSlotId
, nId
, rTbx
)
760 rTbx
.SetItemBits( nId
, TIB_DROPDOWNONLY
| rTbx
.GetItemBits( nId
) );
763 // -----------------------------------------------------------------------
765 ExtrusionDepthControl::~ExtrusionDepthControl()
769 // -----------------------------------------------------------------------
771 SfxPopupWindowType
ExtrusionDepthControl::GetPopupWindowType() const
773 return SFX_POPUPWINDOW_ONCLICK
;
776 // -----------------------------------------------------------------------
778 SfxPopupWindow
* ExtrusionDepthControl::CreatePopupWindow()
780 ExtrusionDepthWindow
* pWin
= new ExtrusionDepthWindow( GetId(), m_xFrame
, &GetToolBox() );
781 pWin
->StartPopupMode( &GetToolBox(), TRUE
);
782 pWin
->StartSelection();
783 SetPopupWindow( pWin
);
787 // -----------------------------------------------------------------------
789 void ExtrusionDepthControl::StateChanged( USHORT
, SfxItemState eState
, const SfxPoolItem
* )
791 USHORT nId
= GetId();
792 ToolBox
& rTbx
= GetToolBox();
794 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
795 rTbx
.SetItemState( nId
, ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);
798 // ####################################################################
800 SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl
, SfxBoolItem
);
802 ExtrusionLightingWindow::ExtrusionLightingWindow(
804 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
) :
807 SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING
) ),
808 maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT
) ),
809 maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL
) ),
810 maImgDim( SVX_RES( IMG_LIGHTING_DIM
) ),
811 maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H
) ),
812 maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H
) ),
813 maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H
) ),
817 mbLevelEnabled( false ),
818 mnDirection( FROM_FRONT
),
819 mbDirectionEnabled( false )
824 // -----------------------------------------------------------------------
826 ExtrusionLightingWindow::ExtrusionLightingWindow(
828 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
,
829 Window
* pParentWindow
) :
833 SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING
) ),
834 maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT
) ),
835 maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL
) ),
836 maImgDim( SVX_RES( IMG_LIGHTING_DIM
) ),
837 maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H
) ),
838 maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H
) ),
839 maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H
) ),
843 mbLevelEnabled( false ),
844 mnDirection( FROM_FRONT
),
845 mbDirectionEnabled( false )
850 // -----------------------------------------------------------------------
852 void ExtrusionLightingWindow::implInit()
854 SetHelpId( HID_POPUP_EXTRUSION_LIGHTING
);
857 for( i
= FROM_TOP_LEFT
; i
<= FROM_BOTTOM_RIGHT
; i
++ )
859 if( i
!= FROM_FRONT
)
861 maImgLightingOff
[i
] = Image( SVX_RES( IMG_LIGHT_OFF
+ i
) );
862 maImgLightingOn
[i
] = Image( SVX_RES( IMG_LIGHT_ON
+ i
) );
863 maImgLightingOffh
[i
] = Image( SVX_RES( IMG_LIGHT_OFF_H
+ i
) );
864 maImgLightingOnh
[i
] = Image( SVX_RES( IMG_LIGHT_ON_H
+ i
) );
866 maImgLightingPreview
[i
] = Image( SVX_RES( IMG_LIGHT_PREVIEW
+ i
) );
867 maImgLightingPreviewh
[i
] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H
+ i
) );
870 // mpLightingDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_DIRECTION, *this );
871 // mpLightingIntensityForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_INTENSITY, *this );
873 mpMenu
= new ToolbarMenu( this, WB_CLIPCHILDREN
);
874 mpMenu
->SetHelpId( HID_MENU_EXTRUSION_LIGHTING
);
875 mpMenu
->SetSelectHdl( LINK( this, ExtrusionLightingWindow
, SelectHdl
) );
877 mpLightingSet
= new ValueSet( mpMenu
, WB_TABSTOP
| WB_MENUSTYLEVALUESET
| WB_FLATVALUESET
| WB_NOBORDER
| WB_NO_DIRECTSELECT
);
878 mpLightingSet
->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING
);
880 mpLightingSet
->SetHelpId( HID_POPUP_LINEEND_CTRL
);
881 mpLightingSet
->SetSelectHdl( LINK( this, ExtrusionLightingWindow
, SelectHdl
) );
882 mpLightingSet
->SetColCount( 3 );
883 mpLightingSet
->EnableFullItemMode( FALSE
);
885 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
887 for( i
= FROM_TOP_LEFT
; i
<= FROM_BOTTOM_RIGHT
; i
++ )
889 if( i
!= FROM_FRONT
)
891 mpLightingSet
->InsertItem( i
+1, bHighContrast
? maImgLightingOffh
[i
] : maImgLightingOff
[i
] );
895 mpLightingSet
->InsertItem( 5, bHighContrast
? maImgLightingPreviewh
[FROM_FRONT
] : maImgLightingPreview
[FROM_FRONT
] );
898 mpLightingSet
->SetOutputSizePixel( Size( 72, 72 ) );
900 mpMenu
->appendEntry( 3, mpLightingSet
);
901 mpMenu
->appendSeparator();
902 mpMenu
->appendEntry( 0, String( SVX_RES( STR_BRIGHT
) ), bHighContrast
? maImgBrighth
: maImgBright
);
903 mpMenu
->appendEntry( 1, String( SVX_RES( STR_NORMAL
) ), bHighContrast
? maImgNormalh
: maImgNormal
);
904 mpMenu
->appendEntry( 2, String( SVX_RES( STR_DIM
) ), bHighContrast
? maImgDimh
: maImgDim
);
906 SetOutputSizePixel( mpMenu
->getMenuSize() );
907 mpMenu
->SetOutputSizePixel( GetOutputSizePixel() );
913 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )));
914 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )));
917 // -----------------------------------------------------------------------
919 SfxPopupWindow
* ExtrusionLightingWindow::Clone() const
921 return new ExtrusionLightingWindow( GetId(), mxFrame
);
924 // -----------------------------------------------------------------------
926 ExtrusionLightingWindow::~ExtrusionLightingWindow()
931 // -----------------------------------------------------------------------
933 void ExtrusionLightingWindow::implSetIntensity( int nLevel
, bool bEnabled
)
936 mbLevelEnabled
= bEnabled
;
938 for( i
= 0; i
< 3; i
++ )
940 mpMenu
->checkEntry( i
, (i
== nLevel
) && bEnabled
);
941 mpMenu
->enableEntry( i
, bEnabled
);
945 // -----------------------------------------------------------------------
947 void ExtrusionLightingWindow::implSetDirection( int nDirection
, bool bEnabled
)
949 mnDirection
= nDirection
;
950 mbDirectionEnabled
= bEnabled
;
952 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
955 nDirection
= FROM_FRONT
;
958 for( nItemId
= FROM_TOP_LEFT
; nItemId
<= FROM_BOTTOM_RIGHT
; nItemId
++ )
960 if( nItemId
== FROM_FRONT
)
962 mpLightingSet
->SetItemImage( nItemId
+ 1, bHighContrast
? maImgLightingPreviewh
[ nDirection
] : maImgLightingPreview
[ nDirection
] );
968 mpLightingSet
->SetItemImage( nItemId
+ 1, (USHORT
)nDirection
== nItemId
? maImgLightingOnh
[nItemId
] : maImgLightingOffh
[nItemId
] );
972 mpLightingSet
->SetItemImage( nItemId
+ 1, (USHORT
)nDirection
== nItemId
? maImgLightingOn
[nItemId
] : maImgLightingOff
[nItemId
] );
977 mpMenu
->enableEntry( 3, bEnabled
);
980 // -----------------------------------------------------------------------
982 void ExtrusionLightingWindow::StateChanged( USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* pState
)
986 case SID_EXTRUSION_LIGHTING_INTENSITY
:
988 if( eState
== SFX_ITEM_DISABLED
)
990 implSetIntensity( 0, false );
994 const SfxInt32Item
* pStateItem
= PTR_CAST( SfxInt32Item
, pState
);
996 implSetIntensity( pStateItem
->GetValue(), true );
1000 case SID_EXTRUSION_LIGHTING_DIRECTION
:
1002 if( eState
== SFX_ITEM_DISABLED
)
1004 implSetDirection( 0, false );
1008 const SfxInt32Item
* pStateItem
= PTR_CAST( SfxInt32Item
, pState
);
1010 implSetDirection( pStateItem
->GetValue(), true );
1017 // -----------------------------------------------------------------------
1019 void ExtrusionLightingWindow::DataChanged( const DataChangedEvent
& rDCEvt
)
1021 SfxPopupWindow::DataChanged( rDCEvt
);
1023 if( ( rDCEvt
.GetType() == DATACHANGED_SETTINGS
) && ( rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
1025 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
1027 implSetDirection( mnDirection
, mbDirectionEnabled
);
1028 mpMenu
->setEntryImage( 0, bHighContrast
? maImgBrighth
: maImgBright
);
1029 mpMenu
->setEntryImage( 1, bHighContrast
? maImgNormalh
: maImgNormal
);
1030 mpMenu
->setEntryImage( 2, bHighContrast
? maImgDimh
: maImgDim
);
1034 // -----------------------------------------------------------------------
1036 IMPL_LINK( ExtrusionLightingWindow
, SelectHdl
, void *, pControl
)
1038 if ( IsInPopupMode() )
1041 // SfxDispatcher* pDisp = GetBindings().GetDispatcher();
1043 if( pControl
== mpMenu
)
1045 int nLevel
= mpMenu
->getSelectedEntryId();
1050 SfxInt32Item
aItem( SID_EXTRUSION_LIGHTING_INTENSITY
, nLevel
);
1051 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ));
1054 INetURLObject
aObj( aCommand
);
1055 Sequence
< PropertyValue
> aArgs( 1 );
1056 aArgs
[0].Name
= aObj
.GetURLPath();
1057 aItem
.QueryValue( a
);
1060 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
1061 mxFrame
->getController(), UNO_QUERY
),
1065 // pDisp->Execute( SID_EXTRUSION_LIGHTING_INTENSITY, SFX_CALLMODE_RECORD, &aItem, 0L , 0L );
1066 implSetIntensity( nLevel
, true );
1072 sal_Int32 nDirection
= mpLightingSet
->GetSelectItemId();
1074 if( (nDirection
> 0) && (nDirection
< 10) )
1078 SfxInt32Item
aItem( SID_EXTRUSION_LIGHTING_DIRECTION
, nDirection
);
1079 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ));
1082 INetURLObject
aObj( aCommand
);
1083 Sequence
< PropertyValue
> aArgs( 1 );
1084 aArgs
[0].Name
= aObj
.GetURLPath();
1085 aItem
.QueryValue( a
);
1088 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
1089 mxFrame
->getController(), UNO_QUERY
),
1092 // pDisp->Execute( SID_EXTRUSION_LIGHTING_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L );
1094 implSetDirection( nDirection
, true );
1102 // -----------------------------------------------------------------------
1104 void ExtrusionLightingWindow::StartSelection()
1108 // -----------------------------------------------------------------------
1110 BOOL
ExtrusionLightingWindow::Close()
1112 return SfxPopupWindow::Close();
1115 // -----------------------------------------------------------------------
1117 void ExtrusionLightingWindow::PopupModeEnd()
1121 mbPopupMode
= FALSE
;
1123 SfxPopupWindow::PopupModeEnd();
1126 // -----------------------------------------------------------------------
1128 void ExtrusionLightingWindow::GetFocus (void)
1130 SfxPopupWindow::GetFocus();
1131 // Grab the focus to the line ends value set so that it can be controlled
1132 // with the keyboard.
1134 mpMenu
->GrabFocus();
1137 // ========================================================================
1139 ExtrusionLightingControl::ExtrusionLightingControl( USHORT nSlotId
, USHORT nId
, ToolBox
&rTbx
)
1140 : SfxToolBoxControl( nSlotId
, nId
, rTbx
)
1142 rTbx
.SetItemBits( nId
, TIB_DROPDOWNONLY
| rTbx
.GetItemBits( nId
) );
1145 // -----------------------------------------------------------------------
1147 ExtrusionLightingControl::~ExtrusionLightingControl()
1151 // -----------------------------------------------------------------------
1153 SfxPopupWindowType
ExtrusionLightingControl::GetPopupWindowType() const
1155 return SFX_POPUPWINDOW_ONCLICK
;
1158 // -----------------------------------------------------------------------
1160 SfxPopupWindow
* ExtrusionLightingControl::CreatePopupWindow()
1162 ExtrusionLightingWindow
* pWin
= new ExtrusionLightingWindow( GetId(), m_xFrame
, &GetToolBox() );
1163 pWin
->StartPopupMode( &GetToolBox(), TRUE
);
1164 pWin
->StartSelection();
1165 SetPopupWindow( pWin
);
1169 // -----------------------------------------------------------------------
1171 void ExtrusionLightingControl::StateChanged( USHORT
, SfxItemState eState
, const SfxPoolItem
* )
1173 USHORT nId
= GetId();
1174 ToolBox
& rTbx
= GetToolBox();
1176 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
1177 rTbx
.SetItemState( nId
, ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);
1180 // ####################################################################
1182 SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl
, SfxBoolItem
);
1184 ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(
1186 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
) :
1188 SfxPopupWindow( nId
,
1190 SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE
)),
1191 maImgSurface1( SVX_RES( IMG_WIRE_FRAME
) ),
1192 maImgSurface2( SVX_RES( IMG_MATTE
) ),
1193 maImgSurface3( SVX_RES( IMG_PLASTIC
) ),
1194 maImgSurface4( SVX_RES( IMG_METAL
) ),
1195 maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H
) ),
1196 maImgSurface2h( SVX_RES( IMG_MATTE_H
) ),
1197 maImgSurface3h( SVX_RES( IMG_PLASTIC_H
) ),
1198 maImgSurface4h( SVX_RES( IMG_METAL_H
) ),
1205 ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(
1207 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rFrame
,
1208 Window
* pParentWindow
) :
1210 SfxPopupWindow( nId
,
1213 SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE
)),
1214 maImgSurface1( SVX_RES( IMG_WIRE_FRAME
) ),
1215 maImgSurface2( SVX_RES( IMG_MATTE
) ),
1216 maImgSurface3( SVX_RES( IMG_PLASTIC
) ),
1217 maImgSurface4( SVX_RES( IMG_METAL
) ),
1218 maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H
) ),
1219 maImgSurface2h( SVX_RES( IMG_MATTE_H
) ),
1220 maImgSurface3h( SVX_RES( IMG_PLASTIC_H
) ),
1221 maImgSurface4h( SVX_RES( IMG_METAL_H
) ),
1228 // -----------------------------------------------------------------------
1230 void ExtrusionSurfaceWindow::implInit()
1232 SetHelpId( HID_POPUP_EXTRUSION_SURFACE
);
1234 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
1236 // mpSurfaceForewarder = new SfxStatusForwarder( SID_EXTRUSION_SURFACE, *this );
1238 mpMenu
= new ToolbarMenu( this, WB_CLIPCHILDREN
);
1239 mpMenu
->SetHelpId( HID_MENU_EXTRUSION_SURFACE
);
1240 mpMenu
->SetSelectHdl( LINK( this, ExtrusionSurfaceWindow
, SelectHdl
) );
1242 mpMenu
->appendEntry( 0, String( SVX_RES( STR_WIREFRAME
) ), bHighContrast
? maImgSurface1h
: maImgSurface1
);
1243 mpMenu
->appendEntry( 1, String( SVX_RES( STR_MATTE
) ), bHighContrast
? maImgSurface2h
: maImgSurface2
);
1244 mpMenu
->appendEntry( 2, String( SVX_RES( STR_PLASTIC
) ), bHighContrast
? maImgSurface3h
: maImgSurface3
);
1245 mpMenu
->appendEntry( 3, String( SVX_RES( STR_METAL
) ), bHighContrast
? maImgSurface4h
: maImgSurface4
);
1247 SetOutputSizePixel( mpMenu
->getMenuSize() );
1248 mpMenu
->SetOutputSizePixel( GetOutputSizePixel() );
1254 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )));
1255 // rBindings.Update( SID_EXTRUSION_SURFACE );
1258 // -----------------------------------------------------------------------
1260 SfxPopupWindow
* ExtrusionSurfaceWindow::Clone() const
1262 return new ExtrusionSurfaceWindow( GetId(), mxFrame
);
1265 // -----------------------------------------------------------------------
1267 ExtrusionSurfaceWindow::~ExtrusionSurfaceWindow()
1269 // delete mpSurfaceForewarder;
1273 // -----------------------------------------------------------------------
1275 void ExtrusionSurfaceWindow::implSetSurface( int nSurface
, bool bEnabled
)
1280 for( i
= 0; i
< 4; i
++ )
1282 mpMenu
->checkEntry( i
, (i
== nSurface
) && bEnabled
);
1283 mpMenu
->enableEntry( i
, bEnabled
);
1288 // -----------------------------------------------------------------------
1290 void ExtrusionSurfaceWindow::StateChanged( USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* pState
)
1294 case SID_EXTRUSION_SURFACE
:
1296 if( eState
== SFX_ITEM_DISABLED
)
1298 implSetSurface( 0, false );
1302 const SfxInt32Item
* pStateItem
= PTR_CAST( SfxInt32Item
, pState
);
1304 implSetSurface( pStateItem
->GetValue(), true );
1311 // -----------------------------------------------------------------------
1313 void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent
& rDCEvt
)
1315 SfxPopupWindow::DataChanged( rDCEvt
);
1317 if( ( rDCEvt
.GetType() == DATACHANGED_SETTINGS
) && ( rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
1319 bool bHighContrast
= GetDisplayBackground().GetColor().IsDark();
1321 mpMenu
->appendEntry( 0, String( SVX_RES( STR_WIREFRAME
) ), bHighContrast
? maImgSurface1h
: maImgSurface1
);
1322 mpMenu
->appendEntry( 1, String( SVX_RES( STR_MATTE
) ), bHighContrast
? maImgSurface2h
: maImgSurface2
);
1323 mpMenu
->appendEntry( 2, String( SVX_RES( STR_PLASTIC
) ), bHighContrast
? maImgSurface3h
: maImgSurface3
);
1324 mpMenu
->appendEntry( 3, String( SVX_RES( STR_METAL
) ), bHighContrast
? maImgSurface4h
: maImgSurface4
);
1328 // -----------------------------------------------------------------------
1330 IMPL_LINK( ExtrusionSurfaceWindow
, SelectHdl
, void *, EMPTYARG
)
1332 if ( IsInPopupMode() )
1335 // SfxDispatcher* pDisp = GetBindings().GetDispatcher();
1337 sal_Int32 nSurface
= mpMenu
->getSelectedEntryId();
1340 SfxInt32Item
aItem( SID_EXTRUSION_SURFACE
, nSurface
);
1341 rtl::OUString
aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ));
1344 INetURLObject
aObj( aCommand
);
1345 Sequence
< PropertyValue
> aArgs( 1 );
1346 aArgs
[0].Name
= aObj
.GetURLPath();
1347 aItem
.QueryValue( a
);
1350 SfxToolBoxControl::Dispatch( Reference
< ::com::sun::star::frame::XDispatchProvider
>(
1351 mxFrame
->getController(), UNO_QUERY
),
1354 // pDisp->Execute( SID_EXTRUSION_SURFACE, SFX_CALLMODE_RECORD, &aItem, 0L , 0L );
1356 implSetSurface( nSurface
, true );
1362 // -----------------------------------------------------------------------
1364 void ExtrusionSurfaceWindow::StartSelection()
1368 // -----------------------------------------------------------------------
1370 BOOL
ExtrusionSurfaceWindow::Close()
1372 return SfxPopupWindow::Close();
1375 // -----------------------------------------------------------------------
1377 void ExtrusionSurfaceWindow::PopupModeEnd()
1381 mbPopupMode
= FALSE
;
1383 SfxPopupWindow::PopupModeEnd();
1386 // -----------------------------------------------------------------------
1388 void ExtrusionSurfaceWindow::GetFocus (void)
1390 SfxPopupWindow::GetFocus();
1391 // Grab the focus to the line ends value set so that it can be controlled
1392 // with the keyboard.
1394 mpMenu
->GrabFocus();
1397 // ========================================================================
1399 ExtrusionSurfaceControl::ExtrusionSurfaceControl(
1400 USHORT nSlotId
, USHORT nId
, ToolBox
&rTbx
)
1401 : SfxToolBoxControl( nSlotId
, nId
, rTbx
)
1403 rTbx
.SetItemBits( nId
, TIB_DROPDOWNONLY
| rTbx
.GetItemBits( nId
) );
1406 // -----------------------------------------------------------------------
1408 ExtrusionSurfaceControl::~ExtrusionSurfaceControl()
1412 // -----------------------------------------------------------------------
1414 SfxPopupWindowType
ExtrusionSurfaceControl::GetPopupWindowType() const
1416 return SFX_POPUPWINDOW_ONCLICK
;
1419 // -----------------------------------------------------------------------
1421 SfxPopupWindow
* ExtrusionSurfaceControl::CreatePopupWindow()
1423 ExtrusionSurfaceWindow
* pWin
= new ExtrusionSurfaceWindow( GetId(), m_xFrame
, &GetToolBox() );
1424 pWin
->StartPopupMode( &GetToolBox(), TRUE
);
1425 pWin
->StartSelection();
1426 SetPopupWindow( pWin
);
1430 // -----------------------------------------------------------------------
1432 void ExtrusionSurfaceControl::StateChanged( USHORT
, SfxItemState eState
, const SfxPoolItem
* )
1434 USHORT nId
= GetId();
1435 ToolBox
& rTbx
= GetToolBox();
1437 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
1438 rTbx
.SetItemState( nId
, ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);
1441 //========================================================================
1443 SFX_IMPL_TOOLBOX_CONTROL( ExtrusionColorControl
, SvxColorItem
);
1445 ExtrusionColorControl::ExtrusionColorControl(
1446 USHORT nSlotId
, USHORT nId
, ToolBox
& rTbx
)
1447 : SfxToolBoxControl ( nSlotId
, nId
, rTbx
)
1449 rTbx
.SetItemBits( nId
, TIB_DROPDOWNONLY
| rTbx
.GetItemBits( nId
) );
1450 mpBtnUpdater
= new ToolboxButtonColorUpdater( nSlotId
, nId
, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW
);
1453 // -----------------------------------------------------------------------
1455 ExtrusionColorControl::~ExtrusionColorControl()
1457 delete mpBtnUpdater
;
1460 // -----------------------------------------------------------------------
1462 SfxPopupWindowType
ExtrusionColorControl::GetPopupWindowType() const
1464 return SFX_POPUPWINDOW_ONCLICK
;
1467 // -----------------------------------------------------------------------
1469 SfxPopupWindow
* ExtrusionColorControl::CreatePopupWindow()
1471 SvxColorWindow_Impl
* pColorWin
= new SvxColorWindow_Impl(
1472 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Extrusion3DColor" )),
1473 SID_EXTRUSION_3D_COLOR
,
1475 SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR
),
1477 pColorWin
->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS
|FLOATWIN_POPUPMODE_ALLOWTEAROFF
);
1478 pColorWin
->StartSelection();
1479 SetPopupWindow( pColorWin
);
1483 // -----------------------------------------------------------------------
1485 void ExtrusionColorControl::StateChanged( USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* pState
)
1487 USHORT nId
= GetId();
1488 ToolBox
& rTbx
= GetToolBox();
1490 if( nSID
== SID_EXTRUSION_3D_COLOR
)
1492 const SvxColorItem
* pItem
= 0;
1494 if( SFX_ITEM_DONTCARE
!= eState
)
1495 pItem
= PTR_CAST( SvxColorItem
, pState
);
1498 mpBtnUpdater
->Update( pItem
->GetValue());
1501 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
1502 rTbx
.SetItemState( nId
, ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);