diff options
Diffstat (limited to 'svx')
38 files changed, 1457 insertions, 2875 deletions
diff --git a/svx/inc/extrusioncontrols.hxx b/svx/inc/extrusioncontrols.hxx deleted file mode 100644 index 4560c7463bc9..000000000000 --- a/svx/inc/extrusioncontrols.hxx +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_EXTRUSION_CONTROLS_HXX -#define _SVX_EXTRUSION_CONTROLS_HXX - -#include <svtools/valueset.hxx> -#include <svl/lstner.hxx> -#include <sfx2/tbxctrl.hxx> -#include <svtools/svtreebx.hxx> -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif -#include <vcl/dialog.hxx> -#include <vcl/field.hxx> -#include <com/sun/star/frame/XFrame.hpp> -#include "svx/svxdllapi.h" - -class SfxBindings; -class ToolbarMenu; -class SfxStatusForwarder; - -//======================================================================== - -namespace svx -{ -class ToolboxButtonColorUpdater; - -class ExtrusionDirectionWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; - -private: - ToolbarMenu* mpMenu; - ValueSet* mpDirectionSet; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - SfxStatusForwarder* mpDirectionForewarder; - SfxStatusForwarder* mpProjectionForewarder; - - Image maImgDirection[9]; - Image maImgDirectionH[9]; - - Image maImgPerspective; - Image maImgPerspectiveH; - Image maImgParallel; - Image maImgParallelH; - - bool mbPopupMode; - - DECL_LINK( SelectHdl, void * ); - void FillValueSet(); - - void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); - void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); - void implInit(); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDirectionWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ExtrusionDirectionWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDirectionWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDirectionControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDirectionControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDirectionControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; - -private: - ToolbarMenu* mpMenu; - - Image maImgDepth0; - Image maImgDepth1; - Image maImgDepth2; - Image maImgDepth3; - Image maImgDepth4; - Image maImgDepthInfinity; - - Image maImgDepth0h; - Image maImgDepth1h; - Image maImgDepth2h; - Image maImgDepth3h; - Image maImgDepth4h; - Image maImgDepthInfinityh; - - SfxStatusForwarder* mpDepthForewarder; - SfxStatusForwarder* mpMetricForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - bool mbPopupMode; - FieldUnit meUnit; - double mfDepth; - bool mbEnabled; - - DECL_LINK( SelectHdl, void * ); - - void implFillStrings( FieldUnit eUnit ); - void implSetDepth( double fDepth, bool bEnabled ); - void implInit(); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDepthWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDepthControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDepthControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDepthControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionLightingWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; - -private: - ToolbarMenu* mpMenu; - ValueSet* mpLightingSet; - - Image maImgLightingOff[9]; - Image maImgLightingOn[9]; - Image maImgLightingPreview[9]; - - Image maImgLightingOffh[9]; - Image maImgLightingOnh[9]; - Image maImgLightingPreviewh[9]; - - Image maImgBright; - Image maImgNormal; - Image maImgDim; - Image maImgBrighth; - Image maImgNormalh; - Image maImgDimh; - - SfxStatusForwarder* mpLightingDirectionForewarder; - SfxStatusForwarder* mpLightingIntensityForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - bool mbPopupMode; - int mnLevel; - bool mbLevelEnabled; - int mnDirection; - bool mbDirectionEnabled; - - void implSetIntensity( int nLevel, bool bEnabled ); - void implSetDirection( int nDirection, bool bEnabled ); - void implInit(); - - DECL_LINK( SelectHdl, void * ); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionLightingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ExtrusionLightingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionLightingWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionLightingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionLightingControl( USHORT nSlotid, USHORT nId, ToolBox& rTbx ); - ~ExtrusionLightingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionSurfaceWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; -private: - ToolbarMenu* mpMenu; - - Image maImgSurface1; - Image maImgSurface2; - Image maImgSurface3; - Image maImgSurface4; - Image maImgSurface1h; - Image maImgSurface2h; - Image maImgSurface3h; - Image maImgSurface4h; - - SfxStatusForwarder* mpSurfaceForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - bool mbPopupMode; - - DECL_LINK( SelectHdl, void * ); - - void implSetSurface( int nSurface, bool bEnabled ); - void implInit(); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionSurfaceWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ExtrusionSurfaceWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionSurfaceWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionSurfaceControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionSurfaceControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionSurfaceControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl -{ -private: - ToolboxButtonColorUpdater* mpBtnUpdater; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionColorControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthDialog : public ModalDialog -{ - FixedText maFLDepth; - MetricField maMtrDepth; - OKButton maOKButton; - CancelButton maCancelButton; - HelpButton maHelpButton; - - FieldUnit meDefaultUnit; - -public: - ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); - ~ExtrusionDepthDialog(); - - double getDepth() const; -}; - -} -#endif - diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx new file mode 100644 index 000000000000..600e646e8cb6 --- /dev/null +++ b/svx/inc/extrusiondepthdialog.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_EXTRUSIONDEPTHDIALOG_HXX +#define _SVX_EXTRUSIONDEPTHDIALOG_HXX + +#include "svx/svxdllapi.h" + +#include <vcl/fixed.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> + +namespace svx { + +class ExtrusionDepthDialog : public ModalDialog +{ + FixedText maFLDepth; + MetricField maMtrDepth; + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + + FieldUnit meDefaultUnit; + +public: + ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); + ~ExtrusionDepthDialog(); + + double getDepth() const; +}; + +} + +#endif // _SVX_EXTRUSIONDEPTHDIALOG_HXX + diff --git a/svx/inc/fontworkgallery.hxx b/svx/inc/fontworkgallery.hxx index 9f6b1f9f4b2f..40ac3cef966a 100644 --- a/svx/inc/fontworkgallery.hxx +++ b/svx/inc/fontworkgallery.hxx @@ -29,16 +29,16 @@ #ifndef _SVX_FONTWORK_GALLERY_DIALOG_HXX #define _SVX_FONTWORK_GALLERY_DIALOG_HXX -#ifndef _FIXED_HXX //autogen +#include "svx/svxdllapi.h" + #include <vcl/fixed.hxx> -#endif -#include <svtools/valueset.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/dialog.hxx> +#include <vcl/field.hxx> + +#include <svtools/valueset.hxx> + #include <sfx2/tbxctrl.hxx> -#include "svx/svxdllapi.h" #include <vector> @@ -50,7 +50,6 @@ class SdrObject; class SdrModel; class SfxBindings; -class ToolbarMenu; class SfxStatusForwarder; //------------------------------------------------------------------------ @@ -58,130 +57,6 @@ class SfxStatusForwarder; namespace svx { -class FontWorkAlignmentWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; -private: - ToolbarMenu* mpMenu; - - Image maImgAlgin1; - Image maImgAlgin2; - Image maImgAlgin3; - Image maImgAlgin4; - Image maImgAlgin5; - Image maImgAlgin1h; - Image maImgAlgin2h; - Image maImgAlgin3h; - Image maImgAlgin4h; - Image maImgAlgin5h; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - bool mbPopupMode; - - DECL_LINK( SelectHdl, void * ); - - void implSetAlignment( int nAlignmentMode, bool bEnabled ); - void implInit(); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkAlignmentWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - FontWorkAlignmentWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkAlignmentWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkAlignmentControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkAlignmentControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkAlignmentControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - -class FontWorkCharacterSpacingWindow : public SfxPopupWindow -{ - using FloatingWindow::StateChanged; -private: - ToolbarMenu* mpMenu; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - bool mbPopupMode; - - DECL_LINK( SelectHdl, void * ); - - void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); - void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); - void implInit(); - -protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkCharacterSpacingWindow(); - - void StartSelection(); - - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkCharacterSpacingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkCharacterSpacingControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkCharacterSpacingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - class SVX_DLLPUBLIC FontWorkShapeTypeControl : public SfxToolBoxControl { using SfxToolBoxControl::Select; @@ -192,8 +67,6 @@ public: ~FontWorkShapeTypeControl(); virtual void Select( BOOL bMod1 = FALSE ); - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); virtual SfxPopupWindowType GetPopupWindowType() const; virtual SfxPopupWindow* CreatePopupWindow(); }; diff --git a/svx/inc/svx/extrusioncolorcontrol.hxx b/svx/inc/svx/extrusioncolorcontrol.hxx new file mode 100644 index 000000000000..ff4a53e65a41 --- /dev/null +++ b/svx/inc/svx/extrusioncolorcontrol.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_EXTRUSIONCOLORCONTROL_HXX +#define _SVX_EXTRUSIONCOLORCONTROL_HXX + +#include <sfx2/tbxctrl.hxx> +#include "svx/svxdllapi.h" +#include "svx/tbxcolorupdate.hxx" + +namespace svx { + +class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl +{ +private: + ToolboxButtonColorUpdater* mpBtnUpdater; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~ExtrusionColorControl(); + + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual SfxPopupWindowType GetPopupWindowType() const; + virtual SfxPopupWindow* CreatePopupWindow(); +}; + +} + +#endif // _SVX_EXTRUSIONCOLORCONTROL_HXX + diff --git a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx index aa52efd03c41..1fbf0b6add3d 100644 --- a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx +++ b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx @@ -47,13 +47,16 @@ namespace sdr sal_uInt16 mnCenterX; sal_uInt16 mnCenterY; + // optional transparency + double mfAlpha; + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayBitmapEx( const basegfx::B2DPoint& rBasePos, const BitmapEx& rBitmapEx, - sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0); + sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0, double fAlpha = 0.0 ); virtual ~OverlayBitmapEx(); const BitmapEx& getBitmapEx() const { return maBitmapEx; } diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index d4b4d5d3369e..f96b650d2be4 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -55,6 +55,7 @@ class SdrHdlList; class SdrMarkView; class SdrObject; class SdrPageView; +class MouseEvent; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -184,6 +185,9 @@ protected: // cleanup marker if one exists void GetRidOfIAObject(); +private: + bool mbMouseOver; // is true if the mouse is over this handle + protected: ::sdr::overlay::OverlayObject* CreateOverlayObject( const basegfx::B2DPoint& rPos, @@ -241,6 +245,16 @@ public: virtual BOOL IsFocusHdl() const; void SetMoveOutside( bool bMoveOutside ); + + /** is called when the mouse enters the area of this handle. If the handle changes his + visualisation during mouse over it must override this method and call Touch(). */ + virtual void onMouseEnter(const MouseEvent& rMEvt); + + /** is called when the mouse leaves the area of this handle. If the handle changes his + visualisation during mouse over it must override this method and call Touch(). */ + virtual void onMouseLeave(); + + bool isMouseOver() const; }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx index eecbc1f2c4f3..fc136b8e5a3c 100644 --- a/svx/inc/svx/svdmrkv.hxx +++ b/svx/inc/svx/svdmrkv.hxx @@ -169,6 +169,7 @@ protected: virtual void SetMarkRects(); // Rects an den PageViews virtual void CheckMarked(); // MarkList nach Del und Lock Layer durchsuchen... virtual void AddDragModeHdl(SdrDragMode eMode); + virtual BOOL MouseMove(const MouseEvent& rMEvt, Window* pWin); // add custom handles (used by other apps, e.g. AnchorPos) virtual void AddCustomHdl(); diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 7acc69ab5b9f..cf7ca2eda5ee 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -810,6 +810,14 @@ public: virtual void SetLogicRect(const Rectangle& rRect); virtual void NbcSetLogicRect(const Rectangle& rRect); + /** the defaul is to set the logic rect to the given rectangle rMaxRect. If the shape + has an intrinsic aspect ratio it may set the logic rect so the aspect + ratio is kept but still inside the rectangle rMaxRect. + + If bShrinkOnly is set to true, the size of the current logic rect will not + be changed if it is smaller than the given rectangle rMaxRect. */ + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); + // Drehwinkel und Shear virtual long GetRotateAngle() const; virtual long GetShearAngle(FASTBOOL bVertical=FALSE) const; diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 89e2d35c9220..23d9204ca891 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -202,7 +202,7 @@ public: virtual SdrObject* DoConvertToPolyObj(BOOL bBezier) const; - void AdjustToMaxRect( const Rectangle& rMaxRect, BOOL bShrinkOnly ); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index b572bb989451..5b0980d8bb30 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -63,6 +63,8 @@ public: virtual void operator=(const SdrObject& rObj); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); + public: void setURL( const ::rtl::OUString& rURL ); diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a40b33c3ad18..02044f0dbc25 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -234,6 +234,7 @@ public: virtual const Rectangle& GetLogicRect() const; virtual void NbcSetLogicRect(const Rectangle& rRect); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); virtual sal_uInt32 GetSnapPointCount() const; virtual Point GetSnapPoint(sal_uInt32 i) const; diff --git a/svx/inc/tbunocontroller.hxx b/svx/inc/tbunocontroller.hxx index fa7329a525e1..266dc917f33e 100644 --- a/svx/inc/tbunocontroller.hxx +++ b/svx/inc/tbunocontroller.hxx @@ -75,6 +75,7 @@ class FontHeightToolBoxControl : public svt::ToolboxController, virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); void dispatchCommand( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + using svt::ToolboxController::dispatchCommand; private: SvxFontSizeBox_Impl* m_pBox; diff --git a/svx/prj/build.lst b/svx/prj/build.lst index 7fe1114e7e66..9f7597488644 100644 --- a/svx/prj/build.lst +++ b/svx/prj/build.lst @@ -30,9 +30,10 @@ sx svx\source\unodraw nmake - all sx_undrw sx_inc NULL sx svx\source\unogallery nmake - all sx_ungal sx_inc NULL sx svx\source\gallery2 nmake - all sx_gall sx_inc NULL sx svx\source\xml nmake - all sx_xml sx_inc NULL +sx svx\source\core nmake - all sx_core sx_inc NULL sx svx\source\accessibility nmake - all sx_accessibility sx_inc NULL sx svx\source\customshapes nmake - all sx_customshapes sx_inc NULL sx svx\source\toolbars nmake - all sx_toolbars sx_inc NULL -sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL +sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_core sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL sx svx\source\gengal nmake - all sx_gengal sx_util NULL sx svx\qa\unoapi nmake - all sx_qa_unoapi NULL diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 7d2f508d9d21..d4201f0caf34 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -69,7 +69,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\editstat.hxx %_DEST%\inc%_EXT%\svx\editstat.hxx ..\inc\editund2.hxx %_DEST%\inc%_EXT%\svx\editund2.hxx ..\inc\eerdll.hxx %_DEST%\inc%_EXT%\svx\editdll.hxx -..\inc\extrusioncontrols.hxx %_DEST%\inc%_EXT%\svx\extrusioncontrols.hxx ..\inc\flstitem.hxx %_DEST%\inc%_EXT%\svx\flstitem.hxx ..\inc\fmgridif.hxx %_DEST%\inc%_EXT%\svx\fmgridif.hxx ..\inc\fmobjfac.hxx %_DEST%\inc%_EXT%\svx\fmobjfac.hxx @@ -484,7 +483,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\viewlayoutitem.hxx %_DEST%\inc%_EXT%\svx\viewlayoutitem.hxx ..\inc\svx\zoomslideritem.hxx %_DEST%\inc%_EXT%\svx\zoomslideritem.hxx ..\inc\svx\zoomsliderctrl.hxx %_DEST%\inc%_EXT%\svx\zoomsliderctrl.hxx - +..\inc\svx\extrusioncolorcontrol.hxx %_DEST%\inc%_EXT%\svx\extrusioncolorcontrol.hxx ..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx ..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx diff --git a/svx/source/core/coreservices.cxx b/svx/source/core/coreservices.cxx new file mode 100644 index 000000000000..1f1d69781756 --- /dev/null +++ b/svx/source/core/coreservices.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/** this file contains the uno service registrations for all services in the svxcore lib */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include "sal/types.h" +#include "osl/diagnose.h" +#include "cppuhelper/factory.hxx" +#include "uno/lbnames.h" + +using rtl::OUString; + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; + +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDepthController_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionDirectionControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDirectionControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionLightingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionLightingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionSurfaceControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkAlignmentControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkAlignmentControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkCharacterSpacingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ); +} + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +static void writeInfo ( + XRegistryKey * pRegistryKey, + const OUString& rImplementationName, + const Sequence< OUString >& rServices) +{ + Reference< XRegistryKey > xNewKey( + pRegistryKey->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); + + for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) + xNewKey->createKey( rServices.getConstArray()[i]); +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * , void * pRegistryKey) +{ + if( pRegistryKey ) + { + try + { + XRegistryKey *pKey = reinterpret_cast< XRegistryKey * >( pRegistryKey ); + + writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionDirectionControl_getImplementationName(),::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionLightingControl_getImplementationName(),::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionSurfaceControl_getImplementationName(),::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkAlignmentControl_getImplementationName(),::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkCharacterSpacingControl_getImplementationName(),::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } + catch (InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return sal_True; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplName, void * pServiceManager, void * ) +{ + void * pRet = 0; + if( pServiceManager ) + { + Reference< XSingleServiceFactory > xFactory; + + if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionDirectionControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDirectionControl_getImplementationName(), + ::svx::ExtrusionDirectionControl_createInstance, + ::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionLightingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionLightingControl_getImplementationName(), + ::svx::ExtrusionLightingControl_createInstance, + ::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionSurfaceControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionSurfaceControl_getImplementationName(), + ::svx::ExtrusionSurfaceControl_createInstance, + ::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkAlignmentControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkAlignmentControl_getImplementationName(), + ::svx::FontWorkAlignmentControl_createInstance, + ::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkCharacterSpacingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkCharacterSpacingControl_getImplementationName(), + ::svx::FontWorkCharacterSpacingControl_createInstance, + ::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } if( xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} diff --git a/svx/source/core/makefile.mk b/svx/source/core/makefile.mk new file mode 100644 index 000000000000..da874894bae6 --- /dev/null +++ b/svx/source/core/makefile.mk @@ -0,0 +1,47 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svx +TARGET=core +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/coreservices.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index fd7da1f7eb8f..922d3f05ddff 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -339,7 +339,7 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync ) //------------------------------------------------------------------------ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) { - OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); +// OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); SdrPageView* pPV = E3dView::ShowSdrPage(pPage); @@ -377,7 +377,7 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) //------------------------------------------------------------------------ void FmFormView::HideSdrPage() { - OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); +// OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); // --- 1. deactivate controls if ( !IsDesignMode() ) diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx index ac1e5aa4ef1c..2a3a00b25b99 100644 --- a/svx/source/sdr/overlay/overlaybitmapex.cxx +++ b/svx/source/sdr/overlay/overlaybitmapex.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> #include <svx/sdr/overlay/overlaybitmapex.hxx> #include <vcl/salbtype.hxx> #include <vcl/outdev.hxx> @@ -41,24 +42,32 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence() { - const drawinglayer::primitive2d::Primitive2DReference aReference( + drawinglayer::primitive2d::Primitive2DReference aReference( new drawinglayer::primitive2d::OverlayBitmapExPrimitive( getBitmapEx(), getBasePosition(), getCenterX(), getCenterY())); + if(basegfx::fTools::more(mfAlpha, 0.0)) + { + const drawinglayer::primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&aReference, 1L); + aReference = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, mfAlpha)); + } + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } OverlayBitmapEx::OverlayBitmapEx( const basegfx::B2DPoint& rBasePos, const BitmapEx& rBitmapEx, - sal_uInt16 nCenX, sal_uInt16 nCenY) + sal_uInt16 nCenX, sal_uInt16 nCenY, double fAlpha) : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)), maBitmapEx(rBitmapEx), mnCenterX(nCenX), - mnCenterY(nCenY) + mnCenterY(nCenY), + mfAlpha(fAlpha) { } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 76bcb828bb24..7235310def0b 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1164,7 +1164,7 @@ BOOL SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin) #endif if (pTextEditOutlinerView->PostKeyEvent(rKEvt)) { - if( pMod && !pMod->IsChanged() ) + if( pMod /* && !pMod->IsChanged() */ ) { if( pTextEditOutliner && pTextEditOutliner->IsModified() ) pMod->SetChanged( sal_True ); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 3d90eae6d68c..47a04241e5bb 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -306,7 +306,8 @@ SdrHdl::SdrHdl(): bSelect(FALSE), b1PixMore(FALSE), bPlusHdl(FALSE), - mbMoveOutside(false) + mbMoveOutside(false), + mbMouseOver(false) { } @@ -324,7 +325,8 @@ SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind): bSelect(FALSE), b1PixMore(FALSE), bPlusHdl(FALSE), - mbMoveOutside(false) + mbMoveOutside(false), + mbMouseOver(false) { } @@ -946,6 +948,19 @@ BOOL SdrHdl::IsFocusHdl() const } } +void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/) +{ +} + +void SdrHdl::onMouseLeave() +{ +} + +bool SdrHdl::isMouseOver() const +{ + return mbMouseOver; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrHdlColor diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index b9598cef4ceb..a15cf8c8b2ac 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1060,6 +1060,44 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) } } +/** handle mouse over effects for handles */ +BOOL SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin) +{ + const ULONG nHdlCount = aHdl.GetHdlCount(); + if( nHdlCount ) + { + SdrHdl* pMouseOverHdl = 0; + if( !rMEvt.IsLeaveWindow() && pWin ) + { + Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) ); + pMouseOverHdl = PickHandle(aMDPos); + } + + // notify last mouse over handle that he lost the mouse + for(ULONG nHdl = 0; nHdl < nHdlCount; nHdl++ ) + { + SdrHdl* pCurrentHdl = GetHdl(nHdl); + if( pCurrentHdl->mbMouseOver ) + { + if( pCurrentHdl != pMouseOverHdl ) + { + pCurrentHdl->mbMouseOver = false; + pCurrentHdl->onMouseLeave(); + } + break; + } + } + + // notify current mouse over handle + if( pMouseOverHdl /* && !pMouseOverHdl->mbMouseOver */ ) + { + pMouseOverHdl->mbMouseOver = true; + pMouseOverHdl->onMouseEnter(rMEvt); + } + } + return SdrSnapView::MouseMove(rMEvt, pWin); +} + void SdrMarkView::ForceRefToMarked() { switch(eDragMode) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 1c534fbcbe98..0ea8413f98a1 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1686,6 +1686,11 @@ void SdrObject::NbcSetLogicRect(const Rectangle& rRect) NbcSetSnapRect(rRect); } +void SdrObject::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ ) +{ + SetLogicRect( rMaxRect ); +} + void SdrObject::SetSnapRect(const Rectangle& rRect) { Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 1924235e7003..d1f65c30050d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1025,7 +1025,7 @@ void SdrGrafObj::ImpSetGrafInfoToAttr() // ----------------------------------------------------------------------------- -void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, BOOL bShrinkOnly ) +void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly ) { Size aSize; Size aMaxSize( rMaxRect.GetSize() ); diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 4008e9494f2e..9dd615490f9e 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include <vcl/svapp.hxx> + #include <svx/svdomedia.hxx> #include "svdglob.hxx" #include "svdstr.hrc" @@ -147,6 +149,53 @@ void SdrMediaObj::operator=(const SdrObject& rObj) // ------------------------------------------------------------------------------ +void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /* = false */ ) +{ + Size aSize( Application::GetDefaultDevice()->PixelToLogic( getPreferredSize(), MAP_100TH_MM ) ); + Size aMaxSize( rMaxRect.GetSize() ); + + if( aSize.Height() != 0 && aSize.Width() != 0 ) + { + Point aPos( rMaxRect.TopLeft() ); + + // Falls Grafik zu gross, wird die Grafik + // in die Seite eingepasst + if ( (!bShrinkOnly || + ( aSize.Height() > aMaxSize.Height() ) || + ( aSize.Width() > aMaxSize.Width() ) )&& + aSize.Height() && aMaxSize.Height() ) + { + float fGrfWH = (float)aSize.Width() / + (float)aSize.Height(); + float fWinWH = (float)aMaxSize.Width() / + (float)aMaxSize.Height(); + + // Grafik an Pagesize anpassen (skaliert) + if ( fGrfWH < fWinWH ) + { + aSize.Width() = (long)(aMaxSize.Height() * fGrfWH); + aSize.Height()= aMaxSize.Height(); + } + else if ( fGrfWH > 0.F ) + { + aSize.Width() = aMaxSize.Width(); + aSize.Height()= (long)(aMaxSize.Width() / fGrfWH); + } + + aPos = rMaxRect.Center(); + } + + if( bShrinkOnly ) + aPos = aRect.TopLeft(); + + aPos.X() -= aSize.Width() / 2; + aPos.Y() -= aSize.Height() / 2; + SetLogicRect( Rectangle( aPos, aSize ) ); + } +} + +// ------------------------------------------------------------------------------ + void SdrMediaObj::setURL( const ::rtl::OUString& rURL ) { ::avmedia::MediaItem aURLItem; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 856820b6d864..7a4305b9581f 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -1358,6 +1358,10 @@ SdrViewContext SdrView::GetContext() const for( ULONG nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ ) { const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum ); + DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" ); + + if( !pMarkObj ) + continue; if( !pMarkObj->ISA( SdrGrafObj ) ) bGraf = FALSE; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index d7f16cd15d3c..e928f94d88ec 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2178,6 +2178,16 @@ void SdrTableObj::NbcSetLogicRect(const Rectangle& rRect) SetRectsDirty(); } + +// -------------------------------------------------------------------- + +void SdrTableObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ ) +{ + Rectangle aAdjustRect( rMaxRect ); + aAdjustRect.setHeight( GetLogicRect().getHeight() ); + SetLogicRect( aAdjustRect ); +} + // -------------------------------------------------------------------- void SdrTableObj::NbcMove(const Size& rSiz) diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index a4cab5f3ef16..f98fd57a0480 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -32,9 +32,14 @@ #include <string> // HACK: prevent conflict between STLPORT and Workshop headers -#ifndef _TOOLBOX_HXX //autogen +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/awt/MenuItemStyle.hpp> +#include <com/sun/star/awt/XPopupMenuExtended.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> + +#include <vos/mutex.hxx> + #include <vcl/toolbox.hxx> -#endif #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -42,30 +47,35 @@ #include <vcl/settings.hxx> #include <svl/intitem.hxx> #include <editeng/colritem.hxx> -#include "chrtitem.hxx" #include <tools/urlobj.hxx> #include <svx/dialogs.hrc> -#include "helpid.hrc" - #include <svx/svdtrans.hxx> +#include <svx/sdasitm.hxx> #include <svx/dialmgr.hxx> +#include "svx/extrusioncolorcontrol.hxx" + +//#include "chrtitem.hxx" +#include "helpid.hrc" #include "extrusioncontrols.hxx" #include "extrusioncontrols.hrc" -#include <svx/sdasitm.hxx> -#include "toolbarmenu.hxx" #include "colorwindow.hxx" - -#include <svx/tbxcolorupdate.hxx> +#include "extrusiondepthdialog.hxx" //////////// -using namespace svx; +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::graphic; -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); +namespace svx +{ /************************************************************************* |* @@ -75,43 +85,17 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; -ExtrusionDirectionWindow::ExtrusionDirectionWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )), - mxFrame( rFrame ), - maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ), - maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ), - maImgParallel( SVX_RES( IMG_PARALLEL ) ), - maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ), - mbPopupMode ( TRUE ) +ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) +, mrController( rController ) +, maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ) +, maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ) +, maImgParallel( SVX_RES( IMG_PARALLEL ) ) +, maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ) +, msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) ) +, msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) ) { - implInit(); -} - -ExtrusionDirectionWindow::ExtrusionDirectionWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - SfxPopupWindow( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )), - mxFrame( rFrame ), - maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ), - maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ), - maImgParallel( SVX_RES( IMG_PARALLEL ) ), - maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ), - mbPopupMode ( TRUE ) -{ - implInit(); -} - -void ExtrusionDirectionWindow::implInit() -{ - SetHelpId( HID_POPUP_EXTRUSION_DIRECTION ); + SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); USHORT i; for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) @@ -120,16 +104,10 @@ void ExtrusionDirectionWindow::implInit() maImgDirectionH[i] = Image( SVX_RES( IMG_DIRECTION_H + i ) ); } -// mpDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_DIRECTION, *this ); -// mpProjectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_PROJECTION, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); - mpDirectionSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); + mpDirectionSet = createEmptyValueSetControl(); mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION ); - mpDirectionSet->SetHelpId( HID_POPUP_LINEEND_CTRL ); mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); mpDirectionSet->SetColCount( 3 ); mpDirectionSet->EnableFullItemMode( FALSE ); @@ -144,55 +122,39 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); - mpMenu->appendEntry( 2, mpDirectionSet ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); - - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 2, mpDirectionSet ); + appendSeparator(); + appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); + appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ))); -} - -SfxPopupWindow* ExtrusionDirectionWindow::Clone() const -{ - return new ExtrusionDirectionWindow( GetId(), mxFrame ); + AddStatusListener( msExtrusionDirection ); + AddStatusListener( msExtrusionProjection ); } void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - USHORT i; - for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) + for( USHORT i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) { mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] ); } - mpMenu->setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); + setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); + setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); } } // ----------------------------------------------------------------------- -ExtrusionDirectionWindow::~ExtrusionDirectionWindow() -{ - delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled ) { if( mpDirectionSet ) @@ -213,58 +175,47 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled mpDirectionSet->SetNoSelection(); } } - if( mpMenu ) - { - mpMenu->enableEntry( 2, bEnabled ); - } + enableEntry( 2, bEnabled ); } // ----------------------------------------------------------------------- void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) { - if( mpMenu ) - { - mpMenu->checkEntry( 0, (nProjection == 0) && bEnabled ); - mpMenu->checkEntry( 1, (nProjection == 1 ) && bEnabled ); - mpMenu->enableEntry( 0, bEnabled ); - mpMenu->enableEntry( 1, bEnabled ); - } + checkEntry( 0, (nProjection == 0) && bEnabled ); + checkEntry( 1, (nProjection == 1 ) && bEnabled ); + enableEntry( 0, bEnabled ); + enableEntry( 1, bEnabled ); } // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msExtrusionDirection ) ) { - case SID_EXTRUSION_DIRECTION: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDirection( -1, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetDirection( pStateItem->GetValue(), true ); - } - break; + implSetDirection( -1, false ); } - case SID_EXTRUSION_PROJECTION: + else { - if( eState == SFX_ITEM_DISABLED ) - { - implSetProjection( -1, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetProjection( pStateItem->GetValue(), true ); - } - break; + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetDirection( nValue, true ); + } + } + else if( Event.FeatureURL.Main.equals( msExtrusionProjection ) ) + { + if( !Event.IsEnabled ) + { + implSetProjection( -1, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetProjection( nValue, true ); } } } @@ -276,48 +227,24 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - if( pControl == mpDirectionSet ) { - sal_Int32 nSkew = gSkewList[mpDirectionSet->GetSelectItemId()-1]; - - SfxInt32Item aItem( SID_EXTRUSION_DIRECTION, nSkew ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1]; -// pDisp->Execute( SID_EXTRUSION_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); + mrController.dispatchCommand( msExtrusionDirection, aArgs ); } else { - int nProjection = mpMenu->getSelectedEntryId(); + int nProjection = getSelectedEntryId(); if( (nProjection >= 0) && (nProjection < 2 ) ) { - SfxInt32Item aItem( SID_EXTRUSION_PROJECTION, nProjection ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionProjection.copy(5); + aArgs[0].Value <<= (sal_Int32)nProjection; + + mrController.dispatchCommand( msExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); } } @@ -325,94 +252,59 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================= +// ExtrusionDirectionControl +// ======================================================================= -void ExtrusionDirectionWindow::FillValueSet() +ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::StartSelection() +::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent ) { - mpDirectionSet->StartSelection(); + return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- - -BOOL ExtrusionDirectionWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionDirectionWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - +// XServiceInfo // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::GetFocus (void) -{ - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpDirectionSet ) - mpDirectionSet->GrabFocus(); -} - -/************************************************************************* -|* -|* SvxLineEndToolBoxControl -|* -\************************************************************************/ - -ExtrusionDirectionControl::ExtrusionDirectionControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionDirectionControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionDirectionControl::~ExtrusionDirectionControl() +Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionDirectionControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionDirectionControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionDirectionControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionDirectionWindow* pWin = new ExtrusionDirectionWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return ExtrusionDirectionControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionDirectionControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionDirectionControl_getSupportedServiceNames(); } // #################################################################### @@ -444,135 +336,66 @@ double ExtrusionDepthDialog::getDepth() const // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl, SfxBoolItem ); - -ExtrusionDepthWindow::ExtrusionDepthWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), - maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), - maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), - maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), - maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ), - maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ), - maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ), - maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ), - maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ), - maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ), - maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ), - maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), - maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), - mxFrame( rFrame ), - mbPopupMode ( true ), - mfDepth( -1.0 ), - mbEnabled( false ) -{ - implInit(); -} - -ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - SfxPopupWindow( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), - maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), - maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), - maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), - maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ), - maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ), - maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ), - maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ), - maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ), - maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ), - maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ), - maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), - maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), - mxFrame( rFrame ), - mbPopupMode ( true ), - mfDepth( -1.0 ), - mbEnabled( false ) -{ - implInit(); -} - -void ExtrusionDepthWindow::implInit() -{ - SetHelpId( HID_POPUP_EXTRUSION_DEPTH ); - -// mpDepthForewarder = new SfxStatusForwarder( SID_EXTRUSION_DEPTH, *this ); -// mpMetricForewarder = new SfxStatusForwarder( SID_ATTR_METRIC, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_DEPTH ); +double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; +double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; - mpMenu->SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); +ExtrusionDepthWindow::ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )) +, mrController( rController ) +, maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ) +, maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ) +, maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ) +, maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ) +, maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ) +, maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ) +, maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ) +, maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ) +, maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ) +, maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ) +, maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ) +, maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ) +, mfDepth( -1.0 ) +, msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ) +, msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) +{ + SetHelpId( HID_MENU_EXTRUSION_DEPTH ); + + SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); String aEmpty; - mpMenu->appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); - mpMenu->appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); - mpMenu->appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); - mpMenu->appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); - mpMenu->appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); + appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); + appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); + appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); + appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); + appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); + appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ))); -// rBindings.Update( SID_ATTR_METRIC ); -// rBindings.Update( SID_EXTRUSION_DEPTH ); -} - -SfxPopupWindow* ExtrusionDepthWindow::Clone() const -{ - return new ExtrusionDepthWindow( GetId(), mxFrame ); + AddStatusListener( msExtrusionDepth ); + AddStatusListener( msMetricUnit ); } // ----------------------------------------------------------------------- -ExtrusionDepthWindow::~ExtrusionDepthWindow() +void ExtrusionDepthWindow::implSetDepth( double fDepth ) { -// delete mpDepthForewarder; -// delete mpMetricForewarder; - - delete mpMenu; -} - -// ----------------------------------------------------------------------- - -double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; -double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; - -void ExtrusionDepthWindow::implSetDepth( double fDepth, bool bEnabled ) -{ - mbEnabled = bEnabled; mfDepth = fDepth; - if( mpMenu ) + int i; + for( i = 0; i < 7; i++ ) { - int i; - for( i = 0; i < 7; i++ ) + if( i == 5 ) { - if( i == 5 ) - { - mpMenu->checkEntry( i, (fDepth >= 338666) && bEnabled ); - } - else if( i != 6 ) - { - mpMenu->checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) && bEnabled ) ); - } - mpMenu->enableEntry( i, bEnabled ); + checkEntry( i, fDepth >= 338666 ); + } + else if( i != 6 ) + { + checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) ); } } } @@ -587,38 +410,37 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) for( int i = 0; i < 5; i++ ) { String aStr( SVX_RES( nResource + i ) ); - mpMenu->setEntryText( i, aStr ); + setEntryText( i, aStr ); }; } // ----------------------------------------------------------------------- -void ExtrusionDepthWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msExtrusionDepth ) ) { - case SID_EXTRUSION_DEPTH: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDepth( 0, false ); - } - else - { - const SvxDoubleItem* pStateItem = PTR_CAST( SvxDoubleItem, pState ); - if( pStateItem ) - implSetDepth( pStateItem->GetValue(), true ); - } - break; + implSetDepth( 0 ); } - case SID_ATTR_METRIC: + else + { + double fValue = 0.0; + if( Event.State >>= fValue ) + implSetDepth( fValue ); + } + } + else if( Event.FeatureURL.Main.equals( msMetricUnit ) ) + { + if( Event.IsEnabled ) { - const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pState ); - if( pStateItem ) + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) { - implFillStrings( (FieldUnit)pStateItem->GetValue() ); + implFillStrings( static_cast<FieldUnit>(nValue) ); if( mfDepth >= 0.0 ) - implSetDepth( mfDepth, mbEnabled ); + implSetDepth( mfDepth ); } } } @@ -628,18 +450,18 @@ void ExtrusionDepthWindow::StateChanged( USHORT nSID, SfxItemState eState, const void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); - mpMenu->setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); - mpMenu->setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); - mpMenu->setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); - mpMenu->setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); + setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); + setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); + setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); + setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); + setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); } } @@ -648,9 +470,7 @@ void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) { -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - int nSelected = mpMenu->getSelectedEntryId(); + int nSelected = getSelectedEntryId(); if( nSelected != -1 ) { if( nSelected == 6 ) @@ -658,24 +478,16 @@ IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); - SvxDoubleItem aDepthItem( mfDepth, SID_EXTRUSION_DEPTH ); - SfxUInt16Item aMetricItem( - SID_ATTR_METRIC, sal::static_int_cast< UINT16 >( meUnit ) ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); + const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); Any a; Sequence< PropertyValue > aArgs( 2 ); aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" )); - aDepthItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Value <<= mfDepth; aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" )); - aMetricItem.QueryValue( a ); - aArgs[1].Value = a; + aArgs[1].Value <<= static_cast<sal_Int32>( meUnit ); - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( aCommand, aArgs ); } else { @@ -690,21 +502,12 @@ IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; } - SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionDepth.copy(5); + aArgs[0].Value <<= fDepth; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - implSetDepth( fDepth, true ); + mrController.dispatchCommand( msExtrusionDepth, aArgs ); + implSetDepth( fDepth ); if ( IsInPopupMode() ) EndPopupMode(); @@ -713,143 +516,83 @@ IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================= +// ExtrusionDirectionControl +// ======================================================================= -void ExtrusionDepthWindow::StartSelection() +ExtrusionDepthController::ExtrusionDepthController( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthFloater" ) ) ) { } // ----------------------------------------------------------------------- -BOOL ExtrusionDepthWindow::Close() +::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent ) { - return SfxPopupWindow::Close(); + return new ExtrusionDepthWindow( *this, m_xFrame, pParent ); } -// ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} // ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::GetFocus (void) -{ - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); -} - -// ======================================================================== - -ExtrusionDepthControl::ExtrusionDepthControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); -} - +// XServiceInfo // ----------------------------------------------------------------------- -ExtrusionDepthControl::~ExtrusionDepthControl() +OUString SAL_CALL ExtrusionDepthController_getImplementationName() { + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionDepthControl::GetPopupWindowType() const +Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionDepthControl::CreatePopupWindow() +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - ExtrusionDepthWindow* pWin = new ExtrusionDepthWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return *new ExtrusionDepthController( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionDepthControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionDepthController_getImplementationName(); } -// #################################################################### +// -------------------------------------------------------------------- -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl, SfxBoolItem ); - -ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), - maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), - maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), - maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), - maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ), - maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), - maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ), - mnLevel( 0 ), - mbLevelEnabled( false ), - mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ) +Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException) { - implInit(); + return ExtrusionDepthController_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- -ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - SfxPopupWindow( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), - maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), - maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), - maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), - maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ), - maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), - maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ), - mnLevel( 0 ), - mbLevelEnabled( false ), - mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ) -{ - implInit(); -} - -// ----------------------------------------------------------------------- +// #################################################################### -void ExtrusionLightingWindow::implInit() +// ------------------------------------------------------------------------- + +ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING )) +, mrController( rController ) +, maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ) +, maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ) +, maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ) +, maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ) +, maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ) +, maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ) +, mnLevel( 0 ) +, mbLevelEnabled( false ) +, mnDirection( FROM_FRONT ) +, mbDirectionEnabled( false ) +, msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )) +, msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) { - SetHelpId( HID_POPUP_EXTRUSION_LIGHTING ); - USHORT i; for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ ) { @@ -864,17 +607,12 @@ void ExtrusionLightingWindow::implInit() maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) ); } -// mpLightingDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_DIRECTION, *this ); -// mpLightingIntensityForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_INTENSITY, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); + SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); + SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); - mpLightingSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLightingSet = createEmptyValueSetControl(); mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); - mpLightingSet->SetHelpId( HID_POPUP_LINEEND_CTRL ); mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); mpLightingSet->SetColCount( 3 ); mpLightingSet->EnableFullItemMode( FALSE ); @@ -894,35 +632,18 @@ void ExtrusionLightingWindow::implInit() } mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); - mpMenu->appendEntry( 3, mpLightingSet ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 3, mpLightingSet ); + appendSeparator(); + appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); + appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); + appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ))); -} - -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionLightingWindow::Clone() const -{ - return new ExtrusionLightingWindow( GetId(), mxFrame ); -} - -// ----------------------------------------------------------------------- - -ExtrusionLightingWindow::~ExtrusionLightingWindow() -{ - delete mpMenu; + AddStatusListener( msExtrusionLightingDirection ); + AddStatusListener( msExtrusionLightingIntensity ); } // ----------------------------------------------------------------------- @@ -934,8 +655,8 @@ void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) int i = 0; for( i = 0; i < 3; i++ ) { - mpMenu->checkEntry( i, (i == nLevel) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); + checkEntry( i, (i == nLevel) && bEnabled ); + enableEntry( i, bEnabled ); } } @@ -971,42 +692,37 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) } } - mpMenu->enableEntry( 3, bEnabled ); + enableEntry( 3, bEnabled ); } // ----------------------------------------------------------------------- -void ExtrusionLightingWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msExtrusionLightingIntensity ) ) { - case SID_EXTRUSION_LIGHTING_INTENSITY: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetIntensity( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetIntensity( pStateItem->GetValue(), true ); - } - break; + implSetIntensity( 0, false ); } - case SID_EXTRUSION_LIGHTING_DIRECTION: + else { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDirection( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetDirection( pStateItem->GetValue(), true ); - } - break; + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetIntensity( nValue, true ); + } + } + else if( Event.FeatureURL.Main.equals( msExtrusionLightingDirection ) ) + { + if( !Event.IsEnabled ) + { + implSetDirection( 0, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetDirection( nValue, true ); } } } @@ -1015,16 +731,16 @@ void ExtrusionLightingWindow::StateChanged( USHORT nSID, SfxItemState eState, co void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); implSetDirection( mnDirection, mbDirectionEnabled ); - mpMenu->setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); - mpMenu->setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); + setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); + setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); + setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); } } @@ -1035,31 +751,19 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - if( pControl == mpMenu ) + if( pControl == this ) { - int nLevel = mpMenu->getSelectedEntryId(); + int nLevel = getSelectedEntryId(); if( nLevel >= 0 ) { if( nLevel != 3 ) { - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_INTENSITY, nLevel ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingIntensity.copy(5); + aArgs[0].Value <<= (sal_Int32)nLevel; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs ); -// pDisp->Execute( SID_EXTRUSION_LIGHTING_INTENSITY, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); implSetIntensity( nLevel, true ); } } @@ -1072,21 +776,11 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) { nDirection--; - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_DIRECTION, nDirection ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)nDirection; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); -// pDisp->Execute( SID_EXTRUSION_LIGHTING_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); + mrController.dispatchCommand( msExtrusionLightingDirection, aArgs ); implSetDirection( nDirection, true ); } @@ -1096,229 +790,122 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionLightingWindow::StartSelection() +ExtrusionLightingControl::ExtrusionLightingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -BOOL ExtrusionLightingWindow::Close() +::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent ) { - return SfxPopupWindow::Close(); + return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - +// XServiceInfo // ----------------------------------------------------------------------- -void ExtrusionLightingWindow::GetFocus (void) -{ - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); -} - -// ======================================================================== - -ExtrusionLightingControl::ExtrusionLightingControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionLightingControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionLightingControl::~ExtrusionLightingControl() +Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionLightingControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionLightingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionLightingControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionLightingControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionLightingWindow* pWin = new ExtrusionLightingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return ExtrusionLightingControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionLightingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionLightingControl_getSupportedServiceNames(); } // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl, SfxBoolItem ); - -ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), - maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), - maImgSurface2( SVX_RES( IMG_MATTE ) ), - maImgSurface3( SVX_RES( IMG_PLASTIC ) ), - maImgSurface4( SVX_RES( IMG_METAL ) ), - maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ), - maImgSurface2h( SVX_RES( IMG_MATTE_H ) ), - maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), - maImgSurface4h( SVX_RES( IMG_METAL_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) +ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )) +, mrController( rController ) +, maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ) +, maImgSurface2( SVX_RES( IMG_MATTE ) ) +, maImgSurface3( SVX_RES( IMG_PLASTIC ) ) +, maImgSurface4( SVX_RES( IMG_METAL ) ) +, maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ) +, maImgSurface2h( SVX_RES( IMG_MATTE_H ) ) +, maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ) +, maImgSurface4h( SVX_RES( IMG_METAL_H ) ) +, msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) { - implInit(); -} - -ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - - SfxPopupWindow( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), - maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), - maImgSurface2( SVX_RES( IMG_MATTE ) ), - maImgSurface3( SVX_RES( IMG_PLASTIC ) ), - maImgSurface4( SVX_RES( IMG_METAL ) ), - maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ), - maImgSurface2h( SVX_RES( IMG_MATTE_H ) ), - maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), - maImgSurface4h( SVX_RES( IMG_METAL_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - implInit(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::implInit() -{ - SetHelpId( HID_POPUP_EXTRUSION_SURFACE ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); -// mpSurfaceForewarder = new SfxStatusForwarder( SID_EXTRUSION_SURFACE, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_SURFACE ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); + SetHelpId( HID_MENU_EXTRUSION_SURFACE ); + SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - mpMenu->appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); + appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); + appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); + appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); + appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ))); -// rBindings.Update( SID_EXTRUSION_SURFACE ); -} - -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionSurfaceWindow::Clone() const -{ - return new ExtrusionSurfaceWindow( GetId(), mxFrame ); -} - -// ----------------------------------------------------------------------- - -ExtrusionSurfaceWindow::~ExtrusionSurfaceWindow() -{ -// delete mpSurfaceForewarder; - delete mpMenu; + AddStatusListener( msExtrusionSurface ); } // ----------------------------------------------------------------------- void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) { - if( mpMenu ) +// if( mpMenu ) { int i; for( i = 0; i < 4; i++ ) { - mpMenu->checkEntry( i, (i == nSurface) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); + checkEntry( i, (i == nSurface) && bEnabled ); + enableEntry( i, bEnabled ); } } } // ----------------------------------------------------------------------- -void ExtrusionSurfaceWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msExtrusionSurface ) ) { - case SID_EXTRUSION_SURFACE: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetSurface( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetSurface( pStateItem->GetValue(), true ); - } - break; + implSetSurface( 0, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetSurface( nValue, true ); } - } -} - -// ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxPopupWindow::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - mpMenu->appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); } } @@ -1329,26 +916,14 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - sal_Int32 nSurface = mpMenu->getSelectedEntryId(); + sal_Int32 nSurface = getSelectedEntryId(); if( nSurface >= 0 ) { - SfxInt32Item aItem( SID_EXTRUSION_SURFACE, nSurface ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionSurface.copy(5); + aArgs[0].Value <<= (sal_Int32)nSurface; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); -// pDisp->Execute( SID_EXTRUSION_SURFACE, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); + mrController.dispatchCommand( msExtrusionSurface, aArgs ); implSetSurface( nSurface, true ); } @@ -1356,83 +931,57 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionSurfaceWindow::StartSelection() +ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) ) ) { } // ----------------------------------------------------------------------- -BOOL ExtrusionSurfaceWindow::Close() +::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent ) { - return SfxPopupWindow::Close(); + return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - +// XServiceInfo // ----------------------------------------------------------------------- -void ExtrusionSurfaceWindow::GetFocus (void) +OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName() { - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" )); } -// ======================================================================== +// -------------------------------------------------------------------- -ExtrusionSurfaceControl::ExtrusionSurfaceControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ) { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionSurfaceControl::~ExtrusionSurfaceControl() +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { + return *new ExtrusionSurfaceControl( rSMgr ); } -// ----------------------------------------------------------------------- - -SfxPopupWindowType ExtrusionSurfaceControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionSurfaceControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionSurfaceWindow* pWin = new ExtrusionSurfaceWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return ExtrusionSurfaceControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionSurfaceControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionSurfaceControl_getSupportedServiceNames(); } //======================================================================== @@ -1498,3 +1047,5 @@ void ExtrusionColorControl::StateChanged( USHORT nSID, SfxItemState eState, cons rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } + +} diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx new file mode 100644 index 000000000000..3dd8272b6940 --- /dev/null +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_EXTRUSION_CONTROLS_HXX +#define _SVX_EXTRUSION_CONTROLS_HXX + +#include "svx/svxdllapi.h" + +#include <svtools/valueset.hxx> +#include <svtools/svtreebx.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> + +#include <svtools/toolbarmenu.hxx> +#include <svtools/popupwindowcontroller.hxx> +#include <svtools/popupmenucontrollerbase.hxx> + +class SfxBindings; +class SfxStatusForwarder; + +//======================================================================== + +namespace svx +{ +class ToolboxButtonColorUpdater; + +class ExtrusionDirectionWindow : public svtools::ToolbarMenu +{ +public: + ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + ValueSet* mpDirectionSet; + + Image maImgDirection[9]; + Image maImgDirectionH[9]; + + Image maImgPerspective; + Image maImgPerspectiveH; + Image maImgParallel; + Image maImgParallelH; + + const rtl::OUString msExtrusionDirection; + const rtl::OUString msExtrusionProjection; + + DECL_LINK( SelectHdl, void * ); + void FillValueSet(); + + void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); + void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); + +}; + +//======================================================================== + +class ExtrusionDirectionControl : public svt::PopupWindowController +{ +public: + ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + using svt::PopupWindowController::createPopupWindow; +}; + +//======================================================================== + +class ExtrusionDepthWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + + Image maImgDepth0; + Image maImgDepth1; + Image maImgDepth2; + Image maImgDepth3; + Image maImgDepth4; + Image maImgDepthInfinity; + + Image maImgDepth0h; + Image maImgDepth1h; + Image maImgDepth2h; + Image maImgDepth3h; + Image maImgDepth4h; + Image maImgDepthInfinityh; + + FieldUnit meUnit; + double mfDepth; + + const rtl::OUString msExtrusionDepth; + const rtl::OUString msMetricUnit; + + DECL_LINK( SelectHdl, void * ); + + void implFillStrings( FieldUnit eUnit ); + void implSetDepth( double fDepth ); + +public: + ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +//======================================================================== + +class ExtrusionDepthController : public svt::PopupWindowController +{ +public: + ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + using svt::PopupWindowController::createPopupWindow; +}; + +//======================================================================== + +class ExtrusionLightingWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + ValueSet* mpLightingSet; + + Image maImgLightingOff[9]; + Image maImgLightingOn[9]; + Image maImgLightingPreview[9]; + + Image maImgLightingOffh[9]; + Image maImgLightingOnh[9]; + Image maImgLightingPreviewh[9]; + + Image maImgBright; + Image maImgNormal; + Image maImgDim; + Image maImgBrighth; + Image maImgNormalh; + Image maImgDimh; + + int mnLevel; + bool mbLevelEnabled; + int mnDirection; + bool mbDirectionEnabled; + + const rtl::OUString msExtrusionLightingDirection; + const rtl::OUString msExtrusionLightingIntensity; + + void implSetIntensity( int nLevel, bool bEnabled ); + void implSetDirection( int nDirection, bool bEnabled ); + + DECL_LINK( SelectHdl, void * ); +public: + ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +//======================================================================== + +class ExtrusionLightingControl : public svt::PopupWindowController +{ +public: + ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + using svt::PopupWindowController::createPopupWindow; +}; + +//======================================================================== + +class ExtrusionSurfaceWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + + Image maImgSurface1; + Image maImgSurface2; + Image maImgSurface3; + Image maImgSurface4; + Image maImgSurface1h; + Image maImgSurface2h; + Image maImgSurface3h; + Image maImgSurface4h; + + const rtl::OUString msExtrusionSurface; + + DECL_LINK( SelectHdl, void * ); + + void implSetSurface( int nSurface, bool bEnabled ); + +public: + ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +class ExtrusionSurfaceControl : public svt::PopupWindowController +{ +public: + ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + using svt::PopupWindowController::createPopupWindow; +}; + +//======================================================================== + +} +#endif + diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 0cf4cafdc58c..084606439cc3 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -30,9 +30,9 @@ #define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION +DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -200,9 +200,9 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH +DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -289,9 +289,10 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING + +DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -605,9 +606,9 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_SURFACE +DockingWindow RID_SVXFLOAT_EXTRUSION_SURFACE { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -703,7 +704,7 @@ ModalDialog RID_SVX_MDLG_EXTRUSION_DEPTH MetricField MTR_DEPTH { //HelpId = HID_SD_CTL_FAVORITES ; - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 3 , 14 ) ; Size = MAP_APPFONT ( WIDTH - 50 - 12, 12 ) ; TabStop = TRUE ; diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 1b4f89ca1e8c..1216a7863b79 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -27,40 +27,53 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include <com/sun/star/text/WritingMode.hpp> -#include <sfx2/app.hxx> + +#include <vcl/toolbox.hxx> + #include <svl/itempool.hxx> -#include <svx/fmmodel.hxx> + +#include <svtools/toolbarmenu.hxx> +#include <svtools/popupwindowcontroller.hxx> +#include <svtools/popupmenucontrollerbase.hxx> + +#include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> -#include <dlgutil.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/frmdiritem.hxx> + +#include <svx/fmmodel.hxx> #include <svx/svxids.hrc> #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> -#include "gallery.hxx" #include <svx/svdpage.hxx> #include <svx/svdobj.hxx> #include <svx/svdview.hxx> #include <svx/svdoutl.hxx> -#include <editeng/eeitem.hxx> -#include <editeng/frmdiritem.hxx> -#include "toolbarmenu.hxx" + +#include "gallery.hxx" +#include <dlgutil.hxx> #include "fontworkgallery.hxx" #include "fontworkgallery.hrc" #include <algorithm> -#ifndef _TOOLBOX_HXX //autogen -#include <vcl/toolbox.hxx> -#endif -#ifndef _SVX_HELPID_HRC #include "helpid.hrc" -#endif -using namespace svx; + +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; + +namespace svx +{ const int nColCount = 4; const int nLineCount = 4; @@ -291,7 +304,7 @@ IMPL_LINK( FontWorkGalleryDialog, DoubleClickFavoriteHdl, void*, EMPTYARG ) return( 0L ); } -// ----------------------------------------------------------------------- +//------------------------------------------------------------------------ SFX_IMPL_TOOLBOX_CONTROL( FontWorkShapeTypeControl, SfxStringItem ); FontWorkShapeTypeControl::FontWorkShapeTypeControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) @@ -325,143 +338,104 @@ SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow() // ----------------------------------------------------------------------- -void FontWorkShapeTypeControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - -// ----------------------------------------------------------------------- - void FontWorkShapeTypeControl::Select( BOOL ) { } -// #################################################################### +// ======================================================================== +// FontWorkAlignmentWindow +// ======================================================================== -SFX_IMPL_TOOLBOX_CONTROL( FontWorkAlignmentControl, SfxBoolItem ); - -FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), - maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), - maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), - maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), - maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ), - maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ), - maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ), - maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ), - maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ), - maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), - maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - SetHelpId( HID_WIN_FONTWORK_ALIGN ); - implInit(); -} - -FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* /*pParentWindow*/ ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), - maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), - maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), - maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), - maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ), - maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ), - maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ), - maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ), - maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ), - maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), - maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - SetHelpId( HID_WIN_FONTWORK_ALIGN ); - implInit(); -} - -void FontWorkAlignmentWindow::implInit() +class FontWorkAlignmentWindow : public ToolbarMenu +{ +public: + FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + + Image maImgAlgin1; + Image maImgAlgin2; + Image maImgAlgin3; + Image maImgAlgin4; + Image maImgAlgin5; + Image maImgAlgin1h; + Image maImgAlgin2h; + Image maImgAlgin3h; + Image maImgAlgin4h; + Image maImgAlgin5h; + + const rtl::OUString msFontworkAlignment; + + DECL_LINK( SelectHdl, void * ); + + void implSetAlignment( int nAlignmentMode, bool bEnabled ); +}; + +FontWorkAlignmentWindow::FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )) +, mrController( rController ) +, maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ) +, maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ) +, maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ) +, maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ) +, maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ) +, maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ) +, maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ) +, maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ) +, maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ) +, maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ) +, msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) { - SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - mpMenu->SetSelectHdl( LINK( this, FontWorkAlignmentWindow, SelectHdl ) ); - - mpMenu->appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); + SetHelpId( HID_POPUP_FONTWORK_ALIGN ); + SetSelectHdl( LINK( this, FontWorkAlignmentWindow, SelectHdl ) ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); + appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); + appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); + appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); + appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ))); -} - -SfxPopupWindow* FontWorkAlignmentWindow::Clone() const -{ - return new FontWorkAlignmentWindow( GetId(), mxFrame ); -} - -// ----------------------------------------------------------------------- - -FontWorkAlignmentWindow::~FontWorkAlignmentWindow() -{ - delete mpMenu; + AddStatusListener( msFontworkAlignment ); } // ----------------------------------------------------------------------- void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) { - if( mpMenu ) + int i; + for( i = 0; i < 5; i++ ) { - int i; - for( i = 0; i < 5; i++ ) - { - mpMenu->checkEntry( i, (i == nSurface) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); - } + checkEntry( i, (i == nSurface) && bEnabled ); + enableEntry( i, bEnabled ); } } // ----------------------------------------------------------------------- -void FontWorkAlignmentWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL FontWorkAlignmentWindow::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msFontworkAlignment ) ) { - case SID_FONTWORK_ALIGNMENT: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetAlignment( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetAlignment( pStateItem->GetValue(), true ); - } - break; + implSetAlignment( 0, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetAlignment( nValue, true ); } } } @@ -470,17 +444,17 @@ void FontWorkAlignmentWindow::StateChanged( USHORT nSID, SfxItemState eState, co void FontWorkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); + appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); + appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); + appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); + appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); + appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); } } @@ -491,25 +465,14 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - sal_Int32 nAlignment = mpMenu->getSelectedEntryId(); + sal_Int32 nAlignment = getSelectedEntryId(); if( nAlignment >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_ALIGNMENT, nAlignment ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkAlignment.copy(5); + aArgs[0].Value <<= (sal_Int32)nAlignment; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkAlignment, aArgs ); implSetAlignment( nAlignment, true ); } @@ -517,250 +480,191 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== +// FontWorkAlignmentControl +// ======================================================================== -void FontWorkAlignmentWindow::StartSelection() +class FontWorkAlignmentControl : public svt::PopupWindowController { -} +public: + FontWorkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); -// ----------------------------------------------------------------------- + virtual ::Window* createPopupWindow( ::Window* pParent ); -BOOL FontWorkAlignmentWindow::Close() -{ - return SfxPopupWindow::Close(); -} + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); -// ----------------------------------------------------------------------- + using svt::PopupWindowController::createPopupWindow; +}; -void FontWorkAlignmentWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} // ----------------------------------------------------------------------- -void FontWorkAlignmentWindow::GetFocus (void) +FontWorkAlignmentControl::FontWorkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) ) { - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); } -// ======================================================================== +// ----------------------------------------------------------------------- -FontWorkAlignmentControl::FontWorkAlignmentControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +::Window* FontWorkAlignmentControl::createPopupWindow( ::Window* pParent ) { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return new FontWorkAlignmentWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkAlignmentControl::~FontWorkAlignmentControl() +OUString SAL_CALL FontWorkAlignmentControl_getImplementationName() { + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkAlignmentController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkAlignmentControl::GetPopupWindowType() const +Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkAlignmentControl::CreatePopupWindow() +Reference< XInterface > SAL_CALL SAL_CALL FontWorkAlignmentControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - FontWorkAlignmentWindow* pWin = new FontWorkAlignmentWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return *new FontWorkAlignmentControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ ) +OUString SAL_CALL FontWorkAlignmentControl::getImplementationName( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return FontWorkAlignmentControl_getImplementationName(); } -// #################################################################### - -SFX_IMPL_TOOLBOX_CONTROL( FontWorkCharacterSpacingControl, SfxBoolItem ); +// -------------------------------------------------------------------- -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )), - mxFrame( rFrame ), - mbPopupMode( true ) +Sequence< OUString > SAL_CALL FontWorkAlignmentControl::getSupportedServiceNames( ) throw (RuntimeException) { - SetHelpId( HID_WIN_FONTWORK_CHARSPACE ); - implInit(); + return FontWorkAlignmentControl_getSupportedServiceNames(); } -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - SfxPopupWindow( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - SetHelpId( HID_WIN_FONTWORK_CHARSPACE ); - implInit(); -} +// #################################################################### -void FontWorkCharacterSpacingWindow::implInit() +class FontWorkCharacterSpacingWindow : public ToolbarMenu { - SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); +public: + FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +private: + svt::ToolboxController& mrController; - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); - mpMenu->SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); + const rtl::OUString msFontworkCharacterSpacing; + const rtl::OUString msFontworkKernCharacterPairs; - mpMenu->appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); + DECL_LINK( SelectHdl, void * ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); + void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); - mpMenu->Show(); - - FreeResource(); +}; - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ))); -} +// ----------------------------------------------------------------------- -SfxPopupWindow* FontWorkCharacterSpacingWindow::Clone() const +FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) +, mrController( rController ) +, msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) ) +, msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) ) { - return new FontWorkCharacterSpacingWindow( GetId(), mxFrame ); -} + SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); + SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); -// ----------------------------------------------------------------------- + appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); + appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK ); + appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK ); + appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK ); + appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK ); + appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK ); + appendSeparator(); + appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); -FontWorkCharacterSpacingWindow::~FontWorkCharacterSpacingWindow() -{ - delete mpMenu; + SetOutputSizePixel( getMenuSize() ); + + FreeResource(); + + AddStatusListener( msFontworkCharacterSpacing ); + AddStatusListener( msFontworkKernCharacterPairs ); } // ----------------------------------------------------------------------- void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ) { - if( mpMenu ) + sal_Int32 i; + for ( i = 0; i < 6; i++ ) { - sal_Int32 i; - for ( i = 0; i < 6; i++ ) - { - mpMenu->checkEntry( i, sal_False ); - mpMenu->enableEntry( i, bEnabled ); - } - if ( nCharacterSpacing != -1 ) + checkEntry( i, sal_False ); + enableEntry( i, bEnabled ); + } + if ( nCharacterSpacing != -1 ) + { + sal_Int32 nEntry; + switch( nCharacterSpacing ) { - sal_Int32 nEntry; - switch( nCharacterSpacing ) - { - case 80 : nEntry = 0; break; - case 90 : nEntry = 1; break; - case 100 : nEntry = 2; break; - case 120 : nEntry = 3; break; - case 150 : nEntry = 4; break; - default : nEntry = 5; break; - } - mpMenu->checkEntry( nEntry, bEnabled ); + case 80 : nEntry = 0; break; + case 90 : nEntry = 1; break; + case 100 : nEntry = 2; break; + case 120 : nEntry = 3; break; + case 150 : nEntry = 4; break; + default : nEntry = 5; break; } + checkEntry( nEntry, bEnabled ); } } +// ----------------------------------------------------------------------- + void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool bEnabled ) { - if( mpMenu ) - { - mpMenu->enableEntry( 6, bEnabled ); - mpMenu->checkEntry( 6, bEnabled ); - } + enableEntry( 6, bEnabled ); + checkEntry( 6, bEnabled ); } // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Main.equals( msFontworkCharacterSpacing ) ) { - case SID_FONTWORK_CHARACTER_SPACING: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - implSetCharacterSpacing( 0, false ); - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetCharacterSpacing( pStateItem->GetValue(), true ); - } + implSetCharacterSpacing( 0, false ); } - break; - - case SID_FONTWORK_KERN_CHARACTER_PAIRS : + else { - if( eState == SFX_ITEM_DISABLED ) - implSetKernCharacterPairs( 0, false ); - else - { - const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pState ); - if( pStateItem ) - implSetKernCharacterPairs( pStateItem->GetValue(), true ); - } + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetCharacterSpacing( nValue, true ); } - break; } -} - -// ----------------------------------------------------------------------- - -void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxPopupWindow::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) + else if( Event.FeatureURL.Main.equals( msFontworkKernCharacterPairs ) ) { -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - mpMenu->appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_CHECKABLE ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); + if( !Event.IsEnabled ) + { + implSetKernCharacterPairs( 0, false ); + } + else + { + sal_Bool bValue = sal_False; + if( Event.State >>= bValue ) + implSetKernCharacterPairs( bValue, true ); + } } } @@ -771,7 +675,7 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); - sal_Int32 nSelection = mpMenu->getSelectedEntryId(); + sal_Int32 nSelection = getSelectedEntryId(); sal_Int32 nCharacterSpacing; switch( nSelection ) { @@ -784,53 +688,31 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) } if ( nSelection == 5 ) // custom spacing { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )); - - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkCharacterSpacing" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<= (sal_Int32)nCharacterSpacing; + + mrController.dispatchCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )), aArgs ); } else if ( nSelection == 6 ) // KernCharacterPairs { - sal_Bool bOnOff = sal_True; - SfxBoolItem aItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bOnOff ); rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" )); - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkKernCharacterPairs" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - - implSetKernCharacterPairs( bOnOff, true ); + aArgs[0].Name = msFontworkKernCharacterPairs.copy(5); + aArgs[0].Value <<= (sal_Bool) sal_True; + + mrController.dispatchCommand( msFontworkKernCharacterPairs, aArgs ); + + implSetKernCharacterPairs( sal_True, true ); } else if( nSelection >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<=( sal_Int32)nCharacterSpacing; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkCharacterSpacing, aArgs ); implSetCharacterSpacing( nCharacterSpacing, true ); } @@ -838,86 +720,79 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== +// FontWorkCharacterSpacingControl +// ======================================================================== -void FontWorkCharacterSpacingWindow::StartSelection() +class FontWorkCharacterSpacingControl : public svt::PopupWindowController { -} +public: + FontWorkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); -// ----------------------------------------------------------------------- + virtual ::Window* createPopupWindow( ::Window* pParent ); -BOOL FontWorkCharacterSpacingWindow::Close() -{ - return SfxPopupWindow::Close(); -} + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + using svt::PopupWindowController::createPopupWindow; +}; -// ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::PopupModeEnd() +FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingFloater" ) ) ) { - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); } // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::GetFocus (void) +::Window* FontWorkCharacterSpacingControl::createPopupWindow( ::Window* pParent ) { - SfxPopupWindow::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + return new FontWorkCharacterSpacingWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkCharacterSpacingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -FontWorkCharacterSpacingControl::~FontWorkCharacterSpacingControl() +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkCharacterSpacingControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL FontWorkCharacterSpacingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new FontWorkCharacterSpacingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkCharacterSpacingControl::CreatePopupWindow() +OUString SAL_CALL FontWorkCharacterSpacingControl::getImplementationName( ) throw (RuntimeException) { - FontWorkCharacterSpacingWindow* pWin = new FontWorkCharacterSpacingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + return FontWorkCharacterSpacingControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return FontWorkCharacterSpacingControl_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- +// ======================================================================== +// FontworkCharacterSpacingDialog +// ======================================================================== FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( Window* pParent, sal_Int32 nScale ) : ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_CHARSPACING ) ), @@ -939,3 +814,5 @@ sal_Int32 FontworkCharacterSpacingDialog::getScale() const { return (sal_Int32)maMtrScale.GetValue(); } + +} diff --git a/svx/source/tbxctrls/fontworkgallery.src b/svx/source/tbxctrls/fontworkgallery.src index 88c294407860..e5f52158b4b6 100644 --- a/svx/source/tbxctrls/fontworkgallery.src +++ b/svx/source/tbxctrls/fontworkgallery.src @@ -55,7 +55,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY Control CTL_FAVORITES { HelpId = HID_CTL_FONTWORK_FAVORITES ; - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 3 , 14 ) ; Size = MAP_APPFONT ( WIDTH - 6, HEIGHT - RSC_CD_PUSHBUTTON_HEIGHT - @@ -92,9 +92,9 @@ ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY }; }; -FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT +DockingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -227,9 +227,9 @@ FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT }; }; -FloatingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING +DockingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -306,7 +306,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_CHARSPACING }; MetricField MF_VALUE { - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 6 , 17 ) ; Size = MAP_APPFONT ( 32 , 12 ) ; TabStop = TRUE ; diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk index 47da008e87a3..9b08caa587aa 100644 --- a/svx/source/tbxctrls/makefile.mk +++ b/svx/source/tbxctrls/makefile.mk @@ -44,7 +44,6 @@ LIB1OBJFILES= \ $(SLO)$/fontworkgallery.obj\ $(SLO)$/extrusioncontrols.obj \ $(SLO)$/tbcontrl.obj \ - $(SLO)$/toolbarmenu.obj \ $(SLO)$/tbxcolorupdate.obj LIB2TARGET= $(SLB)$/$(TARGET).lib diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx deleted file mode 100644 index 3875e0471c7d..000000000000 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ /dev/null @@ -1,1029 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" -#include <vcl/menu.hxx> -#include <vcl/decoview.hxx> -#include <vcl/image.hxx> - -#include "toolbarmenu.hxx" - -const int EXTRAITEMHEIGHT = 4; -const int SEPARATOR_HEIGHT = 8; - -class ToolbarMenuEntry -{ -public: - int mnEntryId; - MenuItemBits mnBits; - Size maSize; - - bool mbHasText; - bool mbHasImage; - bool mbHasControl; - bool mbChecked; - bool mbEnabled; - - String maText; - Image maImage; - Control* mpControl; - -public: - ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ); - ~ToolbarMenuEntry(); - - void init( int nEntryId, MenuItemBits nBits ); -}; - -void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits ) -{ - mnEntryId = nEntryId; - mnBits = nBits; - - mbHasText = false; - mbHasImage = false; - mbHasControl = false; - mbChecked = false; - mbEnabled = true; - - mpControl = NULL; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::~ToolbarMenuEntry() -{ - delete mpControl; -} - -ToolbarMenu::ToolbarMenu( Window* pParent, WinBits nStyle ) : - Control( pParent, nStyle ) -{ - mnCheckPos = 0; - mnImagePos = 0; - mnTextPos = 0; - - mnHighlightedEntry = -1; - mnSelectedEntry = -1; - initWindow(); -} - -ToolbarMenu::~ToolbarMenu() -{ - // delete all menu entries - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - delete maEntryVector[nEntry]; - } -} - -int ToolbarMenu::getSelectedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnSelectedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -int ToolbarMenu::getHighlightedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -void ToolbarMenu::checkEntry( int nEntryId, bool bChecked ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbChecked != bChecked ) - { - pEntry->mbChecked = bChecked; - Invalidate(); - } -} - -bool ToolbarMenu::isEntryChecked( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbChecked; -} - -void ToolbarMenu::enableEntry( int nEntryId, bool bEnable ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbEnabled != bEnable ) - { - pEntry->mbEnabled = bEnable; - if( pEntry->mpControl ) - { - pEntry->mpControl->Enable( bEnable ); - - // hack for the valueset to make it paint itself anew - pEntry->mpControl->Resize(); - } - Invalidate(); - } -} - -bool ToolbarMenu::isEntryEnabled( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbEnabled; -} - -void ToolbarMenu::setEntryText( int nEntryId, const String& rStr ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maText != rStr ) - { - pEntry->maText = rStr; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const String& ToolbarMenu::getEntryText( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maText; - else - { - static String aEmptyStr; - return aEmptyStr; - } -} - -void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maImage != rImage ) - { - pEntry->maImage = rImage; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const Image& ToolbarMenu::getEntryImage( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maImage; - else - { - static Image aEmptyImage; - return aEmptyImage; - } -} - -void ToolbarMenu::initWindow() -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - SetPointFont( rStyleSettings.GetMenuFont() ); - SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) ); - SetTextColor( rStyleSettings.GetMenuTextColor() ); - SetTextFillColor(); - SetLineColor(); - - maSize = implCalcSize(); -} - -Size ToolbarMenu::implCalcSize() -{ - const long nFontHeight = GetTextHeight(); - long nExtra = nFontHeight/4; - - Size aSz; - Size aMaxImgSz; - long nMaxTextWidth = 0; - long nMinMenuItemHeight = nFontHeight; - sal_Bool bCheckable = sal_False; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - if ( rSettings.GetUseImagesInMenus() ) - { - nMinMenuItemHeight = 16; - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry && pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( aImgSz.Height() > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height(); - if ( aImgSz.Height() > nMinMenuItemHeight ) - nMinMenuItemHeight = aImgSz.Height(); - break; - } - } - } - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - pEntry->maSize.Height() = 0; - pEntry->maSize.Width() = 0; - - - if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) - bCheckable = sal_True; - - // Image: - if( pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( (aImgSz.Width() + 4) > aMaxImgSz.Width() ) - aMaxImgSz.Width() = aImgSz.Width() + 4; - if ( (aImgSz.Height() + 4) > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height() + 4; - if ( (aImgSz.Height() + 4) > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aImgSz.Height() + 4; - } - } - } - - int gfxExtra = Max( nExtra, 7L ); - - mnCheckPos = nExtra; -// mnImagePos = mnCheckPos + nFontHeight/2 + gfxExtra; - mnImagePos = nExtra; - mnTextPos = mnImagePos + aMaxImgSz.Width(); - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - // Text: - if( pEntry->mbHasText ) - { - long nTextWidth = GetCtrlTextWidth( pEntry->maText ); - if ( nTextWidth > nMaxTextWidth ) - nMaxTextWidth = nTextWidth; - long nTextHeight = GetTextHeight(); - - pEntry->maSize.Height() = Max( Max( nTextHeight, pEntry->maSize.Height() ), nMinMenuItemHeight ); - } - - // Control: - if( pEntry->mpControl ) - { - long nTextWidth = pEntry->mbHasText ? GetCtrlTextWidth( pEntry->maText ) : -mnTextPos; - - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - - if( nTextWidth ) - nTextWidth += nExtra; - - nTextWidth += aControlSize.Width(); - - if ( nTextWidth > nMaxTextWidth ) - nMaxTextWidth = nTextWidth; - - if ( aControlSize.Height() > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aControlSize.Height(); - } - - pEntry->maSize.Height() += EXTRAITEMHEIGHT; - - aSz.Height() += pEntry->maSize.Height(); - } - else - { - aSz.Height() += SEPARATOR_HEIGHT; - } - } - - if ( aMaxImgSz.Width() ) - mnTextPos += gfxExtra; - if ( bCheckable ) - mnTextPos += 16; - - - aSz.Width() = mnTextPos + nMaxTextWidth; - aSz.Width() += 2*nExtra; - - // positionate controls - int nY = 0; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - if( pEntry->mpControl ) - { - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - Point aControlPos( pEntry->mbHasText ? mnTextPos : ( aSz.Width() - aControlSize.Width() ) / 2, nY); - if( pEntry->mbHasText ) - aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; - - pEntry->mpControl->SetPosPixel( aControlPos ); - } - - nY += pEntry->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - - return aSz; -} - -void ToolbarMenu::GetFocus() -{ -/* - if( mnHighlightedEntry == -1 ) - { - implChangeHighlightEntry( 0 ); - } -*/ - Control::GetFocus(); -} - -void ToolbarMenu::LoseFocus() -{ - if( mnHighlightedEntry != -1 ) - { - implChangeHighlightEntry( -1 ); - } - Control::LoseFocus(); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, pControl, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, pControl, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry ) -{ - maEntryVector.push_back( pEntry ); - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); -} - -void ToolbarMenu::appendSeparator() -{ - appendEntry( 0 ); -} - -void ToolbarMenu::Resize() -{ - Window::Resize(); -} - -ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const -{ - if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) ) - return NULL; - - return maEntryVector[nEntry]; -} - -ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const -{ - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p && p->mnEntryId == nEntryId ) - { - return p; - } - } - - return NULL; -} - -void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) -{ - Size aSz = GetOutputSizePixel(); - long nY = 0; - long nX = 0; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p ) - { - if(nEntry == nHighlightEntry) - { -// bool bRestoreLineColor = false; - Color oldLineColor; -/* - if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) - { - if( p->mbEnabled ) - { - SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); - } - else - { - SetFillColor(); - oldLineColor = GetLineColor(); - SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); - bRestoreLineColor = true; - } - } - else -*/ - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - - Rectangle aRect( Point( nX, nY ), Size( aSz.Width(), p->maSize.Height() ) ); - if( p->mnBits & MIB_POPUPSELECT ) - { - long nFontHeight = GetTextHeight(); - aRect.Right() -= nFontHeight + nFontHeight/4; - } - DrawRect( aRect ); - implPaint( p, bHighlight ); - - if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) - { - aRect.nLeft += 1; - aRect.nTop += 1; - aRect.nBottom -= 1; - aRect.nRight -= 1; - DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); - } -/* - if( bRestoreLineColor ) - SetLineColor( oldLineColor ); -*/ - maHighlightHdl.Call( this ); - break; - } - - nY += p->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } -} - -void ToolbarMenu::implSelectEntry( int nSelectedEntry ) -{ - mnSelectedEntry = nSelectedEntry; - - ToolbarMenuEntry* pEntry = NULL; - if( nSelectedEntry != -1 ) - pEntry = maEntryVector[ nSelectedEntry ]; - - if( pEntry ) - maSelectHdl.Call( this ); -} - -void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt ) -{ - implHighlightEntry( rMEvt, true ); - - implSelectEntry( mnHighlightedEntry ); -} - -void ToolbarMenu::MouseButtonUp( const MouseEvent& ) -{ -} - -void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) -{ - if ( !IsVisible() ) - return; - - implHighlightEntry( rMEvt, false ); -} - -void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) -{ - long nY = 0; - long nMouseY = rMEvt.GetPosPixel().Y(); - Size aOutSz = GetOutputSizePixel(); - if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) - { - bool bHighlighted = FALSE; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry ) - { - long nOldY = nY; - nY += pEntry->maSize.Height(); - if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) - { - if( bMBDown ) - { - if( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - else - { - if ( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - bHighlighted = true; - } - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - if ( !bHighlighted ) - implChangeHighlightEntry( -1 ); - } - else - { - implChangeHighlightEntry( -1 ); - } -} - -void ToolbarMenu::implChangeHighlightEntry( int nEntry ) -{ - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, false ); - } - - mnHighlightedEntry = nEntry; - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, true ); - } -} - -ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) -{ - int n = mnHighlightedEntry; - if( n == -1 ) - { - if( bUp ) - n = 0; - else - n = maEntryVector.size()-1; - } - - int nLoop = n; - - if( bHomeEnd ) - { - // absolute positioning - if( bUp ) - { - n = maEntryVector.size(); - nLoop = n-1; - } - else - { - n = -1; - nLoop = n+1; - } - } - - do - { - if( bUp ) - { - if ( n ) - n--; - else - if( mnHighlightedEntry == -1 ) - n = maEntryVector.size()-1; -// else -// break; - } - else - { - if( n < ((int)maEntryVector.size()-1) ) - n++; - else - if( mnHighlightedEntry == -1 ) - n = 0; -// else -// break; - } - - ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData ) - { - implChangeHighlightEntry( n ); - return pData; - } - } while ( n != nLoop ); - - return 0; -} - -void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) -{ - USHORT nCode = rKEvent.GetKeyCode().GetCode(); - switch ( nCode ) - { - case KEY_UP: - case KEY_DOWN: - { - int nOldEntry = mnHighlightedEntry; - ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false ); - if( p && p->mpControl && !p->mbHasText ) - { - p->mpControl->GrabFocus(); - if( nOldEntry != mnHighlightedEntry ) - { - KeyCode aKeyCode( (nCode == KEY_UP) ? KEY_END : KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - } - } - } - break; - case KEY_END: - case KEY_HOME: - { - ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); - if( p && p->mpControl && !p->mbHasText ) - { - p->mpControl->GrabFocus(); - KeyCode aKeyCode( KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - } - } - break; - case KEY_F6: - case KEY_ESCAPE: - { - // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document - if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) - break; - - implSelectEntry( -1 ); -/* - if ( !pMenu->pStartedFrom ) - { - StopExecute(); - KillActivePopup(); - } - else if ( pMenu->pStartedFrom->bIsMenuBar ) - { - // Forward... - ((MenuBarWindow*)((MenuBar*)pMenu->pStartedFrom)->ImplGetWindow())->KeyInput( rKEvent ); - } - else - { - StopExecute(); - ToolbarMenu* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow(); - pFloat->GrabFocus(); - pFloat->KillActivePopup(); - } -*/ - } - break; - - case KEY_RETURN: - { - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled ) - { - if( pEntry->mpControl ) - { - pEntry->mpControl->GrabFocus(); - } - else - { - implSelectEntry( mnHighlightedEntry ); - } - } - // else - // StopExecute(); - } - break; - default: - { -/* - xub_Unicode nCharCode = rKEvent.GetCharCode(); - USHORT nPos; - USHORT nDuplicates = 0; - MenuItemData* pData = nCharCode ? pMenu->GetItemList()->SearchItem( nCharCode, nPos, nDuplicates, nHighlightedItem ) : NULL; - if ( pData ) - { - if ( pData->pSubMenu || nDuplicates > 1 ) - { - implChangeHighlightEntry( nPos ); - HighlightChanged( 0 ); - } - else - { - nHighlightedItem = nPos; - EndExecute(); - } - } - else - { - // Bei ungueltigen Tasten Beepen, aber nicht bei HELP und F-Tasten - if ( !rKEvent.GetKeyCode().IsControlMod() && ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) ) - Sound::Beep(); - FloatingWindow::KeyInput( rKEvent ); - } - */ - } - } -} - -void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) -{ - const long nFontHeight = GetTextHeight(); - const long nExtra = nFontHeight/4; - - DecorationView aDecoView( this ); - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - - const Size aOutSz( GetOutputSizePixel() ); -// const long nMaxY = aOutSz.Height(); - - Point aTopLeft, aTmpPos; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - Point aPos( aTopLeft ); - - USHORT nTextStyle = 0; - USHORT nSymbolStyle = 0; - USHORT nImageStyle = 0; - if( pEntry && !pEntry->mbEnabled ) - { - nTextStyle |= TEXT_DRAW_DISABLE; - nSymbolStyle |= SYMBOL_DRAW_DISABLE; - nImageStyle |= IMAGE_DRAW_DISABLE; - } - - // Separator - if( pEntry == NULL ) - { - if( pThisOnly == NULL ) - { - aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); - aTmpPos.X() = aPos.X() + 2; - - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - aTmpPos.Y()++; - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - SetLineColor(); - } - - aTopLeft.Y() += SEPARATOR_HEIGHT; - } - else - { - if( !pThisOnly || ( pEntry == pThisOnly ) ) - { - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuHighlightTextColor() ); - - long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); - - // Image - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); - } - // Text: - if( pEntry->mbHasText ) - { - aTmpPos.X() = aPos.X() + mnTextPos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nTextOffsetY; - USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; - - DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); - } - // CheckMark - if( pEntry->mbChecked ) - { - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - - Rectangle aRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aRect.nLeft -= 2; - aRect.nTop -= 2; - aRect.nRight += 2; - aRect.nBottom += 2; - DrawSelectionBackground( aRect, false, true, TRUE, TRUE ); - } - else - { - Rectangle aRect; - SymbolType eSymbol; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += pEntry->maSize.Height() / 2; - if ( pEntry->mnBits & MIB_RADIOCHECK ) - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_RADIOCHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); - } - else - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_CHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); - } - aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle ); - } - } - - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuTextColor() ); - } - - aTopLeft.Y() += pEntry->maSize.Height(); - } - } -} - -void ToolbarMenu::Paint( const Rectangle& ) -{ - implPaint(); - - if( mnHighlightedEntry != -1 ) - implHighlightEntry( mnHighlightedEntry, true ); -} - -void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) -{ - Window::RequestHelp( rHEvt ); -} - -void ToolbarMenu::StateChanged( StateChangedType nType ) -{ - Control::StateChanged( nType ); - - if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Control::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || - (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || - ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::Command( const CommandEvent& rCEvt ) -{ - if ( rCEvt.GetCommand() == COMMAND_WHEEL ) - { - const CommandWheelData* pData = rCEvt.GetWheelData(); - if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) - { - implCursorUpDown( pData->GetDelta() > 0L, false ); - } - } -} diff --git a/svx/source/tbxctrls/toolbarmenu.hxx b/svx/source/tbxctrls/toolbarmenu.hxx deleted file mode 100644 index 30f56c92b943..000000000000 --- a/svx/source/tbxctrls/toolbarmenu.hxx +++ /dev/null @@ -1,90 +0,0 @@ -#include <vcl/ctrl.hxx> - -#include <vector> - -class ToolbarMenuEntry; -typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; - -class ToolbarMenu : public Control -{ -private: - ToolbarMenuEntryVector maEntryVector; - - int mnCheckPos; - int mnImagePos; - int mnTextPos; - - int mnHighlightedEntry; - int mnSelectedEntry; - - Size maSize; - - Link maHighlightHdl; - Link maSelectHdl; - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); - - void initWindow(); - - Size implCalcSize(); - - void appendEntry( ToolbarMenuEntry* pEntry ); - - void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); - - void implHighlightEntry( int nHighlightEntry, bool bHighlight ); - void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); - - void implChangeHighlightEntry( int nEntry ); - void implSelectEntry( int nSelectedEntry ); - - ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); - ToolbarMenuEntry* implGetEntry( int nEntry ) const; - ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; - -public: - ToolbarMenu( Window* pParent, WinBits nStyle ); - ~ToolbarMenu(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - - void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendSeparator(); - - void checkEntry( int nEntryId, bool bCheck = true ); - bool isEntryChecked( int nEntryId ) const; - - void enableEntry( int nEntryId, bool bEnable = true ); - bool isEntryEnabled( int nEntryId ) const; - - void setEntryText( int nEntryId, const String& rStr ); - const String& getEntryText( int nEntryId ) const; - - void setEntryImage( int nEntryId, const Image& rImage ); - const Image& getEntryImage( int nEntryId ) const; - - const Size& getMenuSize() const { return maSize; } - - void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } - const Link& GetHighlightHdl() const { return maHighlightHdl; } - - void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } - const Link& GetSelectHdl() const { return maSelectHdl; } - - int getSelectedEntryId() const; - int getHighlightedEntryId() const; -}; diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index daf1f23d4442..3005289268b9 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -53,7 +53,8 @@ #include "chrtitem.hxx" #include <svx/extrusionbar.hxx> -#include "extrusioncontrols.hxx" +#include "extrusiondepthdialog.hxx" + using namespace ::svx; using namespace ::rtl; diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 5dd4814c6ab5..8b4351cc8df0 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -233,9 +233,7 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con // export this service // -#ifndef SVX_LIGHT #include "UnoGraphicExporter.hxx" -#endif #include "unogalthemeprovider.hxx" #include <com/sun/star/registry/XRegistryKey.hpp> #include "sal/types.h" @@ -244,6 +242,15 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con #include "uno/lbnames.h" #include <svx/sdr/primitive2d/primitiveFactory2d.hxx> +/* +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern uno::Reference< uno::XInterface > SAL_CALL ExtrusionDepthController_createInstance(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( uno::RuntimeException ); +} +*/ + extern "C" { @@ -279,9 +286,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, SvxUnoColorTable::getImplementationName_Static(), SvxUnoColorTable::getSupportedServiceNames_Static() ); writeInfo( pKey, EnhancedCustomShapeEngine_getImplementationName(), EnhancedCustomShapeEngine_getSupportedServiceNames() ); writeInfo( pKey, svx::RecoveryUI::st_getImplementationName(), svx::RecoveryUI::st_getSupportedServiceNames() ); -#ifndef SVX_LIGHT writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() ); -#endif writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); @@ -292,6 +297,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, ::svx::SvXMLGraphicImportHelper_getImplementationName(),::svx::SvXMLGraphicImportHelper_getSupportedServiceNames() ); writeInfo( pKey, ::svx::SvXMLGraphicExportHelper_getImplementationName(),::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); +// writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); } catch (registry::InvalidRegistryException &) { @@ -338,7 +344,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::RecoveryUI::st_createInstance, svx::RecoveryUI::st_getSupportedServiceNames() ); } -#ifndef SVX_LIGHT else if( svx::GraphicExporter_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -346,7 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::GraphicExporter_createInstance, svx::GraphicExporter_getSupportedServiceNames() ); } -#endif else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) ) { xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -385,7 +389,16 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( ::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); } - +/* + else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } +*/ if( xFactory.is()) { xFactory->acquire(); diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 9fea6a6fda5d..9d5e1695c5cb 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -654,11 +654,17 @@ void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, if( nTempType == UHASHMAP_NOTFOUND ) { - if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) ) + if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TableShape")) ) { rInventor = SdrInventor; rType = OBJ_TABLE; } + else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.MediaShape" )) ) + { + rInventor = SdrInventor; + rType = OBJ_MEDIA; + } } else if(nTempType & E3D_INVENTOR_FLAG) { diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 0006fa2ff5fe..050decc8d4f5 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -45,6 +45,10 @@ SHL1TARGET= svxcore$(DLLPOSTFIX) SHL1IMPLIB= isvxcore SHL1USE_EXPORTS=name +SHL1OBJS= \ + $(SLO)$/coreservices.obj + + SHL1LIBS= \ $(SLB)$/animation.lib \ $(SLB)$/attribute.lib \ |