diff options
Diffstat (limited to 'svx')
131 files changed, 4251 insertions, 3834 deletions
diff --git a/svx/source/svdraw/svdscrol.cxx b/svx/inc/extrusiondepthdialog.hxx index ce1d4e32bf32..600e646e8cb6 100644 --- a/svx/source/svdraw/svdscrol.cxx +++ b/svx/inc/extrusiondepthdialog.hxx @@ -25,9 +25,36 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" +#ifndef _SVX_EXTRUSIONDEPTHDIALOG_HXX +#define _SVX_EXTRUSIONDEPTHDIALOG_HXX -#include "svdscrol.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 -// eof diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index e328a39a0707..be037a1ca3cc 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1332,17 +1332,38 @@ {\ MenuItem\ {\ - Identifier = SID_TRANSLITERATE_UPPER ; \ - Command = ".uno:ChangeCaseToUpper" ; \ - HelpID = SID_TRANSLITERATE_UPPER ; \ - Text [ en-US ] = "~Uppercase";\ + Identifier = SID_TRANSLITERATE_SENTENCE_CASE; \ + Command = ".uno:ChangeCaseToSentenceCase" ; \ + HelpID = SID_TRANSLITERATE_SENTENCE_CASE; \ + Text [ en-US ] = "~Sentence case";\ };\ MenuItem\ {\ Identifier = SID_TRANSLITERATE_LOWER; \ Command = ".uno:ChangeCaseToLower" ; \ HelpID = SID_TRANSLITERATE_LOWER; \ - Text [ en-US ] = "~Lowercase";\ + Text [ en-US ] = "~lowercase";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_UPPER ; \ + Command = ".uno:ChangeCaseToUpper" ; \ + HelpID = SID_TRANSLITERATE_UPPER ; \ + Text [ en-US ] = "~UPPERCASE";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TITLE_CASE; \ + Command = ".uno:ChangeCaseToTitleCase" ; \ + HelpID = SID_TRANSLITERATE_TITLE_CASE; \ + Text [ en-US ] = "~Capitalize Every Word";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TOGGLE_CASE; \ + Command = ".uno:ChangeCaseToToggleCase" ; \ + HelpID = SID_TRANSLITERATE_TOGGLE_CASE; \ + Text [ en-US ] = "~tOGGLE cASE";\ };\ MenuItem\ {\ diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 6d9153818cde..1f6fe1538a85 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -278,6 +278,7 @@ #define HID_SVX_SENDMENU_SIGNANDENCRYPT (HID_SVX_START + 245) #define HID_SVX_TP_APPEARANCE (HID_SVX_START + 246) #define HID_SVX_TP_DESKTOP (HID_SVX_START + 247) +#define HID_CT_THES_ALTERNATIVES (HID_SVX_START + 248) // please adjust ACT_SVX_HID_END2 below if you add entries here! @@ -285,7 +286,7 @@ // Overrun check --------------------------------------------------------- // ----------------------------------------------------------------------- -#define ACT_SVX_HID_END (HID_SVX_START+247) +#define ACT_SVX_HID_END (HID_SVX_START+248) #if ACT_SVX_HID_END > HID_SVX_END #error Resource-Ueberlauf in #line, #file #endif diff --git a/svx/inc/svx/EnhancedCustomShape2d.hxx b/svx/inc/svx/EnhancedCustomShape2d.hxx index 00df4b04f389..b3b944513e60 100644 --- a/svx/inc/svx/EnhancedCustomShape2d.hxx +++ b/svx/inc/svx/EnhancedCustomShape2d.hxx @@ -67,6 +67,10 @@ class SvxMSDffAdjustmentHandle; #define HANDLE_FLAGS_RANGE_Y_MAXIMUM 0x0100 #define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM 0x0200 #define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM 0x0400 +#define HANDLE_FLAGS_REFX 0x0800 +#define HANDLE_FLAGS_REFY 0x1000 +#define HANDLE_FLAGS_REFANGLE 0x2000 +#define HANDLE_FLAGS_REFR 0x4000 // MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in // escher, but we are using it internally in to differentiate @@ -145,12 +149,20 @@ class EnhancedCustomShape2d : public SfxItemSet com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition; com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar; + sal_Int32 nRefX; + sal_Int32 nRefY; + sal_Int32 nRefAngle; + sal_Int32 nRefR; + com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum; com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum; + + Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ), + nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {}; }; sal_Bool IsFlipVert() { return bFlipV; }; diff --git a/svx/inc/svx/SpellDialogChildWindow.hxx b/svx/inc/svx/SpellDialogChildWindow.hxx index 034b6372f6f1..3702b643e17e 100644 --- a/svx/inc/svx/SpellDialogChildWindow.hxx +++ b/svx/inc/svx/SpellDialogChildWindow.hxx @@ -69,15 +69,19 @@ protected: @return returns an empty vector if no error could be found */ - virtual SpellPortions GetNextWrongSentence (void) = 0; + virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0; /** This abstract method applies the changes made in the spelling dialog to the document. The dialog always updates its settings when it gets the focus. The document can rely on the fact that the methods ApplyChangedSentence() is called for the position that the last GetNextWrongSentence() returned. + If 'bRecheck' is set to true then the same sentence should be rechecked once from + the start. This should be used too find errors that the user has introduced by + manual changes in the edit field, and in order to not miss the still following errors + in that sentence. */ - virtual void ApplyChangedSentence(const SpellPortions& rChanged) = 0; + virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0; /** This methods determines whether the application supports AutoCorrection */ virtual bool HasAutoCorrection(); diff --git a/svx/source/svdraw/svdcrtmt.hxx b/svx/inc/svx/extrusioncolorcontrol.hxx index 0cf7642bf110..ff4a53e65a41 100644 --- a/svx/source/svdraw/svdcrtmt.hxx +++ b/svx/inc/svx/extrusioncolorcontrol.hxx @@ -25,8 +25,32 @@ * ************************************************************************/ -#ifndef _SVDCRTMT_HXX -#define _SVDCRTMT_HXX +#ifndef _SVX_EXTRUSIONCOLORCONTROL_HXX +#define _SVX_EXTRUSIONCOLORCONTROL_HXX -#endif //_SVDCRTMT_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/extrusioncontrols.hxx b/svx/inc/svx/extrusioncontrols.hxx deleted file mode 100644 index 4560c7463bc9..000000000000 --- a/svx/inc/svx/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/svx/fmshell.hxx b/svx/inc/svx/fmshell.hxx index 0688beec65b3..f37eeab8c5e6 100644 --- a/svx/inc/svx/fmshell.hxx +++ b/svx/inc/svx/fmshell.hxx @@ -60,6 +60,11 @@ namespace com { namespace sun { namespace star { namespace form { } } } } } +namespace svx +{ + class ISdrObjectFilter; +} + //======================================================================== class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint { @@ -146,11 +151,28 @@ public: const OutputDevice& _rDevice, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const; + + /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus + to the control belonging to the given SdrUnoObj. + */ + void ToggleControlFocus( + const SdrUnoObj& i_rNextCandidate, + const SdrView& i_rView, + OutputDevice& i_rDevice + ) const; + + ::std::auto_ptr< ::svx::ISdrObjectFilter > + CreateFocusableControlFilter( + const SdrView& i_rView, + const OutputDevice& i_rDevice + ) const; + sal_Bool IsDesignMode() const { return m_bDesignMode; } void SetDesignMode( sal_Bool _bDesignMode ); diff --git a/svx/inc/svx/fmtools.hxx b/svx/inc/svx/fmtools.hxx index 36fa180fa348..b39f46e85d14 100644 --- a/svx/inc/svx/fmtools.hxx +++ b/svx/inc/svx/fmtools.hxx @@ -76,6 +76,7 @@ #include <comphelper/uno3.hxx> #include <comphelper/stl_types.hxx> #include <cppuhelper/implbase1.hxx> +#include <svl/svstdarr.hxx> #include <set> diff --git a/svx/inc/svx/fontworkgallery.hxx b/svx/inc/svx/fontworkgallery.hxx index 9f6b1f9f4b2f..40ac3cef966a 100644 --- a/svx/inc/svx/fontworkgallery.hxx +++ b/svx/inc/svx/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/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx index 6334137bc221..445d986b2c5e 100644 --- a/svx/inc/svx/gridctrl.hxx +++ b/svx/inc/svx/gridctrl.hxx @@ -29,6 +29,8 @@ #include <tools/list.hxx> #include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/sdbc/XRowSetListener.hpp> +#include <com/sun/star/sdb/XRowsChangeListener.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/util/XNumberFormatter.hpp> #include <com/sun/star/util/Date.hpp> @@ -247,6 +249,8 @@ private: // For that reason we have to listen to some properties of our data source. ::comphelper::OPropertyChangeMultiplexer* m_pDataSourcePropMultiplexer; FmXGridSourcePropListener* m_pDataSourcePropListener; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener> + m_xRowSetListener; // get notification when rows were changed void* m_pFieldListeners; // property listeners for field values @@ -523,15 +527,20 @@ public: void setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; } // helper class to grant access to selected methods from within the DbCellControl class - struct GrantCellControlAccess + struct GrantControlAccess { friend class DbCellControl; + friend class RowSetEventListener; protected: - GrantCellControlAccess() { } + GrantControlAccess() { } }; /// called when a controller needs to be re-initialized - void refreshController(sal_uInt16 _nColId, GrantCellControlAccess _aAccess); + void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess); + + CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const { return m_pSeekCursor; } + const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const { return m_xSeekRow; } + void SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;} /** @return @@ -586,6 +595,7 @@ protected: const DbGridRowRef& GetPaintRow() const { return m_xPaintRow; } CursorWrapper* GetSeekCursor() const { return m_pSeekCursor; } + void ConnectToFields(); void DisconnectFromFields(); diff --git a/svx/inc/svx/htmlmode.hxx b/svx/inc/svx/htmlmode.hxx index a1c5bf0cdf11..dab1b5b1db70 100644 --- a/svx/inc/svx/htmlmode.hxx +++ b/svx/inc/svx/htmlmode.hxx @@ -27,28 +27,7 @@ #ifndef _SVX_HTMLMODE_HXX #define _SVX_HTMLMODE_HXX -// include --------------------------------------------------------------- - -// define ---------------------------------------------------------------- - -#define HTMLMODE_ON 0x0001 -#define HTMLMODE_PARA_BORDER 0x0002 /* Absatzumrandungen */ -#define HTMLMODE_PARA_DISTANCE 0x0004 /* bestimmte Absatzabstaende */ -#define HTMLMODE_SMALL_CAPS 0x0008 /* Kapitaelchen */ -#define HTMLMODE_FRM_COLUMNS 0x0010 /* spaltige Rahmen */ -#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */ -#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */ -#define HTMLMODE_BLINK 0x0080 /* blinkende Zeichen*/ -#define HTMLMODE_PARA_BLOCK 0x0100 /* Blocksatz */ -#define HTMLMODE_DROPCAPS 0x0200 /* Initialen*/ -#define HTMLMODE_FIRSTLINE 0x0400 /* Erstzeileneinzug mit Spacer == NS 3.0 */ -#define HTMLMODE_GRAPH_POS 0x0800 /* Grafikpositionen Hintergrund */ -#define HTMLMODE_FULL_ABS_POS 0x1000 /* abs. Rahmenpositionierung */ -#define HTMLMODE_SOME_ABS_POS 0x2000 /* abs. Rahmenpositionierung vollst.*/ -#define HTMLMODE_RESERVED1 0x4000 -#define HTMLMODE_RESERVED0 0x8000 - - +#include <sfx2/htmlmode.hxx> #endif 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/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 8325d2a57fa1..612f2ab927ec 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -89,8 +89,6 @@ namespace sdr // operators sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; - - const SfxItemSet& getCorrectFillAttributes() const; }; } // end of namespace sdr diff --git a/svx/inc/svx/sdrobjectfilter.hxx b/svx/inc/svx/sdrobjectfilter.hxx new file mode 100644 index 000000000000..55eda09c99af --- /dev/null +++ b/svx/inc/svx/sdrobjectfilter.hxx @@ -0,0 +1,58 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 SDROBJECTFILTER_HXX +#define SDROBJECTFILTER_HXX + +#include "svx/svxdllapi.h" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +class SdrObject; + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= SdrObjectFilter + //==================================================================== + /** specifies a boolean predicate on the set of all SdrObjects - vulgo a filter. + */ + class SVX_DLLPUBLIC SAL_NO_VTABLE ISdrObjectFilter + { + public: + virtual bool includeObject( const SdrObject& i_rObject ) const = 0; + + virtual ~ISdrObjectFilter() = 0; + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SDROBJECTFILTER_HXX diff --git a/svx/inc/svx/svddef.hxx b/svx/inc/svx/svddef.hxx index a758e9c1dba7..a9e5d175680c 100644 --- a/svx/inc/svx/svddef.hxx +++ b/svx/inc/svx/svddef.hxx @@ -203,7 +203,8 @@ #define SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32) /* 1212 long, def=0 */ #define SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33) /* 1213 long, def=0 */ #define SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34) /* 1214 V4+++ long, def=0 */ -#define SDRATTR_NOTPERSIST_LAST (SDRATTR_TEXTDIRECTION) /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */ +#define SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35) +#define SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE) /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */ // kein SetItem hierfuer #define SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1) /* 1229 V4+++*/ 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..40cc992e96d9 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -283,6 +283,7 @@ public: BOOL bSizProt; BOOL bNoPrint; BOOL bClosedObj; + bool mbVisible; SdrLayerID mnLayerID; public: @@ -469,10 +470,10 @@ protected: unsigned bGrouped : 1; // Member eines GroupObjektes? // Die folgende Flags werden gestreamt - unsigned bMovProt : 1; // Position geschuetzt - unsigned bSizProt : 1; // Groesse geschuetzt - unsigned bNoPrint : 1; // Nicht drucken - + unsigned bMovProt : 1; // If true, the position is protected + unsigned bSizProt : 1; // If true, the size is protected + unsigned bNoPrint : 1; // If true, the object is not printed. + unsigned mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint // Wenn bEmptyPresObj TRUE ist, handelt es sich um ein // Praesentationsobjekt, dem noch kein Inhalt zugewiesen // wurde. Default ist das Flag auf FALSE. Die Verwaltung @@ -810,6 +811,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; @@ -1012,6 +1021,8 @@ public: sal_Bool IsResizeProtect() const { return bSizProt; } void SetPrintable(sal_Bool bPrn); sal_Bool IsPrintable() const { return !bNoPrint; } + void SetVisible(sal_Bool bVisible); + sal_Bool IsVisible() const { return mbVisible; } void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; } sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; } void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; } 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/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 29cf17ec9180..c601fddef181 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -376,7 +376,6 @@ private: public: // construct/destruct SdrPageProperties(SdrPage& rSdrPage); - SdrPageProperties(const SdrPageProperties& rCandidate); virtual ~SdrPageProperties(); // Notify(...) from baseclass SfxListener diff --git a/svx/inc/svx/svdstr.hrc b/svx/inc/svx/svdstr.hrc index f1c19b4e0895..f1bc8cfdae19 100644 --- a/svx/inc/svx/svdstr.hrc +++ b/svx/inc/svx/svdstr.hrc @@ -674,7 +674,7 @@ #define SIP_SA_CIRCRESERVE1 (SIP_Begin + 177) #define SIP_SA_CIRCRESERVE2 (SIP_Begin + 178) #define SIP_SA_CIRCRESERVE3 (SIP_Begin + 179) -//BFS01#define SIP_SDRATTRSET_CIRC (SIP_Begin + 180) +#define SIP_SA_OBJVISIBLE (SIP_Begin + 180) #define SIP_SA_OBJMOVEPROTECT (SIP_Begin + 181) #define SIP_SA_OBJSIZEPROTECT (SIP_Begin + 182) #define SIP_SA_OBJPRINTABLE (SIP_Begin + 183) diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index b53b5f6dac26..1cdfc9fb2b9e 100644..100755 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -342,18 +342,19 @@ // Calc-Id's // -------------------------------------------------------------------------- -#ifndef SC_FUNCTION_START -#define SC_FUNCTION_START (SID_SC_START + 200) -#endif -#ifndef FILE_MENU_END -#define FILE_MENU_END (SC_FUNCTION_START + 20) -#endif -#ifndef EDIT_MENU_START -#define EDIT_MENU_START (FILE_MENU_END) -#endif -#ifndef SC_VIEW_START -#define SC_VIEW_START (SID_SC_START) -#endif +//! moved to sfx2, still in use: +//#ifndef SC_FUNCTION_START +//#define SC_FUNCTION_START (SID_SC_START + 200) +//#endif +//#ifndef FILE_MENU_END +//#define FILE_MENU_END (SC_FUNCTION_START + 20) +//#endif +//#ifndef EDIT_MENU_START +//#define EDIT_MENU_START (FILE_MENU_END) +//#endif +//#ifndef SC_VIEW_START +//#define SC_VIEW_START (SID_SC_START) +//#endif #define SID_OUTLINE_HIDE (SID_SC_START + 329) #define SID_OUTLINE_SHOW (SID_SC_START + 330) @@ -365,8 +366,9 @@ #define SID_ATTR_SECIALCHAR (SID_SC_START + 581) #define SID_ATTR_SPECIALCHAR (SID_SC_START + 581) -#define FID_CHG_RECORD (EDIT_MENU_START + 18) -#define SID_CHG_PROTECT (SC_VIEW_START + 84) +//! moved to sfx2, still in use: +//#define FID_CHG_RECORD (EDIT_MENU_START + 18) +//#define SID_CHG_PROTECT (SC_VIEW_START + 84) // -------------------------------------------------------------------------- // Writer-Id's @@ -383,6 +385,7 @@ #define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hard space */ #define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* hyphen withou break*/ +//!! be aware to not overwrite something that is used in sw/inc/cmdid.h already !! #define FN_FORMAT (SID_SW_START + 400) #define FN_SET_JUSTIFY_PARA (FN_FORMAT + 21) #define FN_FORMAT_RESET (FN_FORMAT + 69) @@ -401,9 +404,10 @@ #define FN_PGPREVIEW (SID_SW_START + 1250) #define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2) -#define FN_EDIT2 (SID_SW_START + 1800) -#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) -#define FN_REDLINE_ON (FN_EDIT2 + 25) +//! moved to sfx2, still in use: +//#define FN_EDIT2 (SID_SW_START + 1800) +//#define FN_REDLINE_PROTECT (FN_EDIT2 + 23) +//#define FN_REDLINE_ON (FN_EDIT2 + 25) // -------------------------------------------------------------------------- // Svx-Id's @@ -706,6 +710,7 @@ #define SID_ATTR_TEXT_FITTOSIZE ( SID_SVX_START + 367 ) #define SID_ATTR_BRUSH_ROW ( SID_SVX_START + 368 ) #define SID_OPTFILTER_MSOFFICE ( SID_SVX_START + 369 ) +//#define SID_TASKPANE ( SID_SVX_START + 370 ) -> sfxsids.hrc #define SID_IMAP ( SID_SVX_START + 371 ) #define SID_IMAP_DLG ( SID_SVX_START + 372 ) #define SID_IMAP_SELECT ( SID_SVX_START + 373 ) @@ -747,7 +752,10 @@ #define SID_ATTR_3D_AMBIENTINTENSITY ( SID_SVX_START + 410 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */ #define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 ) #define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 ) -#define SID_HTML_MODE ( SID_SVX_START + 414 ) + +//! moved to sfx2, still in use: +//#define SID_HTML_MODE ( SID_SVX_START + 414 ) + #define SID_RULER_PROTECT ( SID_SVX_START + 415 ) //#define SID_INET_DLG ( SID_SVX_START + 416 ) -> sfxsids.hrc #define SID_COLOR_CONTROL ( SID_SVX_START + 417 ) @@ -1026,7 +1034,7 @@ #define SID_DSBROWSER_EXPLORER ( SID_SVX_START + 764 ) #define SID_FM_CREATE_FIELDCONTROL ( SID_SVX_START + 765 ) #define SID_FM_DATACCESS_DESCRIPTOR ( SID_SVX_START + 766 ) -#define SID_FM_GRABCONTROLFOCUS ( SID_SVX_START + 767 ) +#define SID_FM_TOGGLECONTROLFOCUS ( SID_SVX_START + 767 ) #define SID_FM_SCROLLBAR ( SID_SVX_START + 768 ) #define SID_FM_SPINBUTTON ( SID_SVX_START + 769 ) #define SID_FM_CONVERTTO_SCROLLBAR ( SID_SVX_START + 770 ) @@ -1238,6 +1246,7 @@ #define SID_TABLE_STYLE_SETTINGS (SID_SVX_START+1089) #define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090) #define SID_RECHECK_DOCUMENT (SID_SVX_START+1091) + #define SID_OBJECT_MIRROR (SID_SVX_START+1093) #define SID_DELETE_POSTIT (SID_SVX_START+1094) @@ -1249,8 +1258,12 @@ #define SID_DELETEALLBYAUTHOR_POSTIT (SID_SVX_START+1100) #define SID_INSERT_POSTIT (SID_SVX_START+1101) +#define SID_TRANSLITERATE_SENTENCE_CASE (SID_SVX_START+1102) +#define SID_TRANSLITERATE_TITLE_CASE (SID_SVX_START+1103) +#define SID_TRANSLITERATE_TOGGLE_CASE (SID_SVX_START+1104) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE SID_INSERT_POSTIT + 1 +#define SID_SVX_FIRSTFREE (SID_TRANSLITERATE_TOGGLE_CASE + 1) // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/svx/inc/svx/sxopitm.hxx b/svx/inc/svx/sxopitm.hxx index 947660e71cc0..dd402c3a0915 100644 --- a/svx/inc/svx/sxopitm.hxx +++ b/svx/inc/svx/sxopitm.hxx @@ -39,4 +39,10 @@ public: SdrObjPrintableItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJPRINTABLE,rIn) {} }; +class SdrObjVisibleItem: public SdrYesNoItem { +public: + SdrObjVisibleItem(bool bOn=true): SdrYesNoItem(SDRATTR_OBJVISIBLE,bOn) {} + SdrObjVisibleItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJVISIBLE,rIn) {} +}; + #endif diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx index 27196079db07..232708d9a14a 100644 --- a/svx/inc/svx/unoshprp.hxx +++ b/svx/inc/svx/unoshprp.hxx @@ -160,7 +160,7 @@ #define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65) #define OWN_ATTR_THUMBNAIL (OWN_ATTR_VALUE_START+66) #define OWN_ATTR_PERSISTNAME (OWN_ATTR_VALUE_START+67) -//#define OWN_ATTR_HASLEVELS (OWN_ATTR_VALUE_START+68) +#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT (OWN_ATTR_VALUE_START+68) #define OWN_ATTR_MEDIA_URL (OWN_ATTR_VALUE_START+69) #define OWN_ATTR_MEDIA_PREFERREDSIZE (OWN_ATTR_VALUE_START+70) #define OWN_ATTR_MEDIA_LOOP (OWN_ATTR_VALUE_START+71) @@ -325,6 +325,7 @@ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT , &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME), SDRATTR_OBJECTNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_PRINTABLE), SDRATTR_OBJPRINTABLE , &::getBooleanCppuType(), 0, 0}, \ + { MAP_CHAR_LEN("Visible"), SDRATTR_OBJVISIBLE , &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT , &::getBooleanCppuType(), 0, 0},\ { MAP_CHAR_LEN("UINameSingular"), OWN_ATTR_UINAME_SINGULAR , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \ { MAP_CHAR_LEN("UINamePlural"), OWN_ATTR_UINAME_PLURAL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \ 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/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx new file mode 100644 index 000000000000..aec07042e1fc --- /dev/null +++ b/svx/inc/tbunosearchcontrollers.hxx @@ -0,0 +1,282 @@ +/************************************************************************* + * + * 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 __TBUNOSEARCHCONTROLLERS_HXX_ +#define __TBUNOSEARCHCONTROLLERS_HXX_ + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <comphelper/sequenceasvector.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weak.hxx> +#include <svtools/toolboxcontroller.hxx> +#include <vcl/combobox.hxx> +#include <vcl/window.hxx> + +#include <map> + +namespace css = ::com::sun::star ; +namespace svx +{ + +class FindTextFieldControl : public ComboBox +{ +public: + FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FindTextFieldControl(); + + virtual void Modify(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void InitControls_Impl(); + void Remember_Impl(const String& rStr); + +private: + + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; + sal_Bool m_bToClearTextField; + +}; + +class SearchToolbarControllersManager +{ +public: + + SearchToolbarControllersManager(); + ~SearchToolbarControllersManager(); + + static SearchToolbarControllersManager* createControllersManager(); + + void registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ); + +private: + + static SearchToolbarControllersManager* m_pInstance; + + typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec; + typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap; + SearchToolbarControllersMap aSearchToolbarControllersMap; + +}; + +class FindTextToolbarController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~FindTextToolbarController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FindTextToolboxController" )); + } + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException ); + + DECL_LINK(EditModifyHdl, void*); + +private: + + FindTextFieldControl* m_pFindTextFieldControl; + + USHORT m_nDownSearchId; // item position of findbar + USHORT m_nUpSearchId; // item position of findbar + +}; + +class DownSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + DownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~DownSearchToolboxController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.DownSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + +}; + +class UpSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ); + ~UpSearchToolboxController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.UpSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + +}; + +// protocol handler for "vnd.sun.star.findbar:*" URLs +// The dispatch object will be used for shortcut commands for findbar +class FindbarDispatcher : public css::lang::XServiceInfo, + public css::lang::XInitialization, + public css::frame::XDispatchProvider, + public css::frame::XDispatch, + public ::cppu::OWeakObject +{ +public: + + FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~FindbarDispatcher(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.Impl.FindbarDispatcher" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + +private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::frame::XFrame > m_xFrame; + +}; + +// createInstance +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); + +} + +#endif // __TBUNOSEARCHCONTROLLERS_HXX_ diff --git a/svx/prj/build.lst b/svx/prj/build.lst index 5b99711edaa2..9f7597488644 100644 --- a/svx/prj/build.lst +++ b/svx/prj/build.lst @@ -30,8 +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/qa/unoapi/Test.java b/svx/qa/unoapi/Test.java new file mode 100644 index 000000000000..90abd12776d0 --- /dev/null +++ b/svx/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* 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. +************************************************************************/ + +package org.openoffice.svx.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "svx.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/svx/qa/unoapi/knownissues.xcl b/svx/qa/unoapi/knownissues.xcl index 6d59511b75e0..89369160bb45 100644 --- a/svx/qa/unoapi/knownissues.xcl +++ b/svx/qa/unoapi/knownissues.xcl @@ -78,4 +78,10 @@ svx.GraphicExporter ### i98339 ### svx.AccessibleControlShape -# -> disbaled in svx.sce
\ No newline at end of file +# -> disbaled in svx.sce + +### i111114 ### +svx.AccessiblePresentationOLEShape::com::sun::star::accessibility::XAccessibleComponent + +### i111169 ### +svx.AccessiblePageShape::com::sun::star::accessibility::XAccessibleComponent diff --git a/svx/qa/unoapi/makefile.mk b/svx/qa/unoapi/makefile.mk index a64401995a51..133e9a3458e4 100644 --- a/svx/qa/unoapi/makefile.mk +++ b/svx/qa/unoapi/makefile.mk @@ -1,7 +1,6 @@ #************************************************************************* -# # 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 @@ -22,19 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=svx -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = svx +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/svx/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce svx.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/svx/qa/unoapi/svx.sce b/svx/qa/unoapi/svx.sce index 84237f3c6f4b..82ee2ea6b193 100644 --- a/svx/qa/unoapi/svx.sce +++ b/svx/qa/unoapi/svx.sce @@ -1,11 +1,11 @@ #i98339 -o svx.AccessibleControlShape --o svx.AccessibleEditableTextPara --o svx.AccessibleGraphicShape +#i111278 -o svx.AccessibleEditableTextPara +#i111252 -o svx.AccessibleGraphicShape #i46736 -o svx.AccessibleImageBullet --o svx.AccessibleOLEShape --o svx.AccessiblePageShape --o svx.AccessiblePresentationGraphicShape --o svx.AccessiblePresentationOLEShape +#i111252 -o svx.AccessibleOLEShape +#i111252 -o svx.AccessiblePageShape +#i111216 -o svx.AccessiblePresentationGraphicShape +#i111216 -o svx.AccessiblePresentationOLEShape #i85539 -o svx.AccessiblePresentationShape -o svx.AccessibleShape #i90294 -o svx.GraphicExporter diff --git a/svx/sdi/fmslots.sdi b/svx/sdi/fmslots.sdi index 83803b2bdaf6..1a368920ab9a 100644 --- a/svx/sdi/fmslots.sdi +++ b/svx/sdi/fmslots.sdi @@ -657,7 +657,7 @@ shell FmFormShell [ ExecMethod = Execute ; ] - SID_FM_GRABCONTROLFOCUS + SID_FM_TOGGLECONTROLFOCUS [ ExecMethod = Execute ; ] diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 5f243b90067d..240ca9cbd4e1 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1455,6 +1455,81 @@ SfxVoidItem ChangeCaseToKatakana SID_TRANSLITERATE_KATAGANA ] //-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToSentenceCase SID_TRANSLITERATE_SENTENCE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToTitleCase SID_TRANSLITERATE_TITLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER () [ @@ -10834,7 +10909,7 @@ SdrTextFitToSizeTypeItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE ] //-------------------------------------------------------------------------- -SfxVoidItem Thesaurus SID_THESAURUS +SfxVoidItem ThesaurusDialog SID_THESAURUS () [ /* flags: */ @@ -10843,7 +10918,7 @@ SfxVoidItem Thesaurus SID_THESAURUS FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, @@ -11700,7 +11775,7 @@ SfxVoidItem ZoomVisArea SID_SIZE_VISAREA ] //-------------------------------------------------------------------------- -SfxVoidItem GrabControlFocus SID_FM_GRABCONTROLFOCUS +SfxVoidItem ToggleControlFocus SID_FM_TOGGLECONTROLFOCUS () [ /* flags: */ 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/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 9ae86971a432..6224373f9a15 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -468,6 +468,10 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle( const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) ); const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) ); // const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) ); + const rtl::OUString sRefX ( RTL_CONSTASCII_USTRINGPARAM( "RefX" ) ); + const rtl::OUString sRefY ( RTL_CONSTASCII_USTRINGPARAM( "RefY" ) ); + const rtl::OUString sRefAngle ( RTL_CONSTASCII_USTRINGPARAM( "RefAngle" ) ); + const rtl::OUString sRefR ( RTL_CONSTASCII_USTRINGPARAM( "RefR" ) ); const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) ); const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) ); const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) ); @@ -526,6 +530,26 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle( } } */ + else if ( rPropVal.Name.equals( sRefX ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefX ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFX; + } + else if ( rPropVal.Name.equals( sRefY ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefY ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFY; + } + else if ( rPropVal.Name.equals( sRefAngle ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefAngle ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFANGLE; + } + else if ( rPropVal.Name.equals( sRefR ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefR ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFR; + } else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) ) { if ( rPropVal.Value >>= rDestinationHandle.aRadiusRangeMinimum ) @@ -1182,131 +1206,141 @@ sal_Bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nI Handle aHandle; if ( ConvertSequenceToEnhancedCustomShape2dHandle( seqHandles[ nIndex ], aHandle ) ) { - sal_Bool bAdjFirst = aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT; - sal_Bool bAdjSecond= aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT; - if ( bAdjFirst || bAdjSecond ) + Point aP( rPosition.X, rPosition.Y ); + // apply the negative object rotation to the controller position + + aP.Move( -aLogicRect.Left(), -aLogicRect.Top() ); + if ( bFlipH ) + aP.X() = aLogicRect.GetWidth() - aP.X(); + if ( bFlipV ) + aP.Y() = aLogicRect.GetHeight() - aP.Y(); + if ( nRotateAngle ) { - Point aP( rPosition.X, rPosition.Y ); - // apply the negative object rotation to the controller position - - aP.Move( -aLogicRect.Left(), -aLogicRect.Top() ); - if ( bFlipH ) - aP.X() = aLogicRect.GetWidth() - aP.X(); - if ( bFlipV ) - aP.Y() = aLogicRect.GetHeight() - aP.Y(); - if ( nRotateAngle ) - { - double a = -nRotateAngle * F_PI18000; - RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) ); - } - const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() ); - if ( aGeoStat.nShearWink ) - { - double nTan = -aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) - nTan = -nTan; - ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); - } + double a = -nRotateAngle * F_PI18000; + RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) ); + } + const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() ); + if ( aGeoStat.nShearWink ) + { + double nTan = -aGeoStat.nTan; + if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + nTan = -nTan; + ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); + } - double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X(); - double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y(); - fPos1 /= fXScale; - fPos2 /= fYScale; + double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X(); + double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y(); + fPos1 /= fXScale; + fPos2 /= fYScale; - if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED ) + if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED ) + { + if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() ) { - if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() ) - { - double fX = fPos1; - double fY = fPos2; - fPos1 = fY; - fPos2 = fX; - } + double fX = fPos1; + double fY = fPos2; + fPos1 = fY; + fPos2 = fX; } + } - sal_Int32 nFirstAdjustmentValue = 0, nSecondAdjustmentValue = 0; + sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1; + + if ( aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT ) aHandle.aPosition.First.Value >>= nFirstAdjustmentValue; + if ( aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT ) aHandle.aPosition.Second.Value>>= nSecondAdjustmentValue; - if ( aHandle.nFlags & HANDLE_FLAGS_POLAR ) + if ( aHandle.nFlags & HANDLE_FLAGS_POLAR ) + { + double fXRef, fYRef, fAngle; + GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False ); + GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False ); + const double fDX = fPos1 - fXRef; + fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 ); + double fX = ( fPos1 - fXRef ); + double fY = ( fPos2 - fYRef ); + double fRadius = sqrt( fX * fX + fY * fY ); + if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM ) + { + double fMin; + GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False ); + if ( fRadius < fMin ) + fRadius = fMin; + } + if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM ) + { + double fMax; + GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False ); + if ( fRadius > fMax ) + fRadius = fMax; + } + if ( nFirstAdjustmentValue >= 0 ) + SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue ); + if ( nSecondAdjustmentValue >= 0 ) + SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue ); + } + else + { + if ( aHandle.nFlags & HANDLE_FLAGS_REFX ) + { + nFirstAdjustmentValue = aHandle.nRefX; + fPos1 *= 100000.0; + fPos1 /= nCoordWidth; + } + if ( aHandle.nFlags & HANDLE_FLAGS_REFY ) { - double fXRef, fYRef, fAngle; - GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False ); - GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False ); - const double fDX = fPos1 - fXRef; - fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 ); - double fX = ( fPos1 - fXRef ); - double fY = ( fPos2 - fYRef ); - double fRadius = sqrt( fX * fX + fY * fY ); - if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM ) + nSecondAdjustmentValue = aHandle.nRefY; + fPos2 *= 100000.0; + fPos2 /= nCoordHeight; + } + if ( nFirstAdjustmentValue >= 0 ) + { + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range { - double fMin; - GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False ); - if ( fRadius < fMin ) - fRadius = fMin; + double fXMin; + GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False ); + if ( fPos1 < fXMin ) + fPos1 = fXMin; } - if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range { - double fMax; - GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False ); - if ( fRadius > fMax ) - fRadius = fMax; + double fXMax; + GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False ); + if ( fPos1 > fXMax ) + fPos1 = fXMax; } - if ( bAdjFirst ) - SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue ); - if ( bAdjSecond ) - SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue ); + SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue ); } - else + if ( nSecondAdjustmentValue >= 0 ) { - if ( bAdjFirst ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range { - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range - { - double fXMin; - GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False ); - if ( fPos1 < fXMin ) - fPos1 = fXMin; - } - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range - { - double fXMax; - GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False ); - if ( fPos1 > fXMax ) - fPos1 = fXMax; - } - SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue ); + double fYMin; + GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False ); + if ( fPos2 < fYMin ) + fPos2 = fYMin; } - if ( bAdjSecond ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range { - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range - { - double fYMin; - GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False ); - if ( fPos2 < fYMin ) - fPos2 = fYMin; - } - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range - { - double fYMax; - GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False ); - if ( fPos2 > fYMax ) - fPos2 = fYMax; - } - SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue ); + double fYMax; + GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False ); + if ( fPos2 > fYMax ) + fPos2 = fYMax; } + SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue ); } - // and writing them back into the GeometryItem - SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&) - (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); - const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); - com::sun::star::beans::PropertyValue aPropVal; - aPropVal.Name = sAdjustmentValues; - aPropVal.Value <<= seqAdjustmentValues; - aGeometryItem.SetPropertyValue( aPropVal ); - pCustomShapeObj->SetMergedItem( aGeometryItem ); - bRetValue = sal_True; } + // and writing them back into the GeometryItem + SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&) + (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); + const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); + com::sun::star::beans::PropertyValue aPropVal; + aPropVal.Name = sAdjustmentValues; + aPropVal.Value <<= seqAdjustmentValues; + aGeometryItem.SetPropertyValue( aPropVal ); + pCustomShapeObj->SetMergedItem( aGeometryItem ); + bRetValue = sal_True; } } return bRetValue; diff --git a/svx/source/dialog/docrecovery.src b/svx/source/dialog/docrecovery.src index 5bcde8bdf071..7c1532b71b55 100644 --- a/svx/source/dialog/docrecovery.src +++ b/svx/source/dialog/docrecovery.src @@ -370,7 +370,7 @@ TabPage RID_SVXPAGE_ERR_REP_WELCOME Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW2 ); Size = MAP_APPFONT( RECOV_CONTROLWIDTH, (RECOV_ROW7-RECOV_ROW2-RSC_SP_CTRL_Y) ); WordBreak = TRUE; - Text[ en-US ] = "This error report tool gathers information about how %PRODUCTNAME is working and sends it to Sun Microsystems to help improve future versions.\n\nIt's easy - just send the report without any further effort on your part by clicking 'Send' in the next dialog, or you can briefly describe how the error occurred and then click 'Send'. If you want to see the report, click the 'Show Report' button. No data will be sent if you click 'Do Not Send'.\n\nCustomer Privacy\nThe information gathered is limited to data concerning the state of %PRODUCTNAME %PRODUCTVERSION when the error occurred. Other information about passwords or document contents is not collected.\n\nThe information will only be used to improve the quality of %PRODUCTNAME and will not be shared with third parties.\nFor more information on Sun Microsystems' privacy policy, visit\nhttp://www.sun.com/privacy/"; + Text[ en-US ] = "This error report tool gathers information about how %PRODUCTNAME is working and sends it to Oracle to help improve future versions.\n\nIt's easy - just send the report without any further effort on your part by clicking 'Send' in the next dialog, or you can briefly describe how the error occurred and then click 'Send'. If you want to see the report, click the 'Show Report' button. No data will be sent if you click 'Do Not Send'.\n\nCustomer Privacy\nThe information gathered is limited to data concerning the state of %PRODUCTNAME %PRODUCTVERSION when the error occurred. Other information about passwords or document contents is not collected.\n\nThe information will only be used to improve the quality of %PRODUCTNAME and will not be shared with third parties.\nFor more information on Oracle's privacy policy, visit\nwww.oracle.com/html/services-privacy-policy.html"; }; FixedLine FL_RECOV_BOTTOM { @@ -472,7 +472,7 @@ TabPage RID_SVXPAGE_ERR_REP_SEND Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW12 ); Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_CHECKBOX_HEIGHT ); Check = FALSE; - Text[ en-US ] = "~I allow Sun Microsystems to contact me regarding this report."; + Text[ en-US ] = "~I allow Oracle to contact me regarding this report."; }; FixedText FT_ERRSEND_EMAILADDR { diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index de6924c3147b..2da5df325dfa 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -37,6 +37,8 @@ #include <vcl/msgbox.hxx> #include <vcl/graph.hxx> +#include <sfx2/sfxsids.hrc> +#include <svx/svxids.hrc> #include <svx/dialogs.hrc> #include "hdft.hrc" #include <svl/intitem.hxx> diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk index 01951caa1471..ac608fae8ec8 100644 --- a/svx/source/dialog/makefile.mk +++ b/svx/source/dialog/makefile.mk @@ -74,6 +74,7 @@ SRC2FILES = \ LIB1TARGET=$(SLB)$/$(TARGET)-core.lib LIB1OBJFILES= \ + $(SLO)$/checklbx.obj \ $(SLO)$/dialmgr.obj\ $(SLO)$/dlgutil.obj \ $(SLO)$/framelink.obj\ @@ -86,7 +87,6 @@ LIB2TARGET=$(SLB)$/$(TARGET).lib LIB2OBJFILES= \ $(SLO)$/charmap.obj \ - $(SLO)$/checklbx.obj \ $(SLO)$/connctrl.obj \ $(SLO)$/contwnd.obj \ $(SLO)$/ctredlin.obj \ diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index ccf326ca77b1..67a50363e6c3 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -831,6 +831,18 @@ void SvxSearchDialog::CalculateDelta_Impl() pMoreBtn->AddWindow( &aNoFormatBtn ); } + if (bDrawApp || bImpressApp) + { + // "Find All" button is hidden--align "Find" vertically to the + // search listbox + Point aNewPt(aSearchBtn.GetPosPixel()); + const Size aBtnSz(aSearchBtn.GetSizePixel()); + const Size aLBSz(aSearchLB.GetSizePixel()); + const int nOff((aLBSz.Height() - aBtnSz.Height()) / 2); + aNewPt.Y() = aSearchLB.GetPosPixel().Y() + nOff; + aSearchBtn.SetPosPixel(aNewPt); + } + if ( bDrawApp ) { // Draw App: "Regular expressions" and "Search for Styles" check boxes are hidden @@ -1016,6 +1028,8 @@ void SvxSearchDialog::Init_Impl( int bSearchPattern ) if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW ) { + aSearchAllBtn.Hide(); + aRegExpBtn.Hide(); aLayoutBtn.Hide(); diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 36067cc78221..2e1a68723f67 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -1214,9 +1214,7 @@ void SvxRuler::UpdateTabs() long nRightFrameMargin = GetRightFrameMargin(); //#i24363# tab stops relative to indent - const long nParaItemTxtLeft = pRuler_Imp->bIsTabsRelativeToIndent ? - pParaItem->GetTxtLeft() : - 0; + const long nParaItemTxtLeft = pParaItem->GetTxtLeft(); const long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft; @@ -1253,7 +1251,7 @@ void SvxRuler::UpdateTabs() const SvxTabStop *pTab = &(*pTabStopItem)[j]; pTabs[nTabCount+TAB_GAP].nPos = ConvertHPosPixel( - lParaIndent + pTab->GetTabPos() + lAppNullOffset); + (pRuler_Imp->bIsTabsRelativeToIndent ? lParaIndent : 0 ) + pTab->GetTabPos() + lAppNullOffset); if(bRTL) { pTabs[nTabCount+TAB_GAP].nPos = lParaIndentPix + lRightPixMargin - pTabs[nTabCount+TAB_GAP].nPos; @@ -1286,13 +1284,37 @@ void SvxRuler::UpdateTabs() { for(j = 0; j < nDefTabBuf; ++j) { - pTabs[nTabCount + TAB_GAP].nPos = + if( j == 0 ) + { + //set the first default tab stop + if(pRuler_Imp->bIsTabsRelativeToIndent) + { + pTabs[nTabCount + TAB_GAP].nPos = + (pTabs[nTabCount].nPos + nDefTabDist); + pTabs[nTabCount + TAB_GAP].nPos -= + ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix) + % nDefTabDist ); + } + else + { + if( pTabs[nTabCount].nPos < 0 ) + { + pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist ) * nDefTabDist; + } + else + { + pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist + 1 ) * nDefTabDist; + } + } + + } + else + { + //simply add the default distance to the last position + pTabs[nTabCount + TAB_GAP].nPos = pTabs[nTabCount].nPos + nDefTabDist; + } - if(j == 0 ) - pTabs[nTabCount + TAB_GAP].nPos -= - ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix) - % nDefTabDist ); if(pTabs[nTabCount+TAB_GAP].nPos >= lRightIndent) break; pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT; diff --git a/svx/source/engine3d/makefile.mk b/svx/source/engine3d/makefile.mk index 6e6e3f97c550..71916df4a83c 100644 --- a/svx/source/engine3d/makefile.mk +++ b/svx/source/engine3d/makefile.mk @@ -64,18 +64,10 @@ LIB1OBJFILES= \ LIB2TARGET= $(SLB)$/$(TARGET).lib LIB2OBJFILES= \ - $(SLO)$/volume3d.obj \ - $(SLO)$/viewpt3d.obj \ $(SLO)$/float3d.obj SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) -#disable optimizer for MSCompiler and ICC -.IF "$(COM)"=="ICC" || "$(COM)"=="MSC" -NOOPTFILES=\ - $(SLO)$/viewpt3d.obj -.ENDIF - SRS1NAME=engine3d SRC1FILES=\ string3d.src \ diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index ae81680ca5be..480d49171eb5 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -336,8 +336,18 @@ UINT16 E3dScene::GetObjIdentifier() const void E3dScene::SetBoundRectDirty() { - // avoid resetting aOutRect which in case of this object is model data, - // not re-creatable view data + E3dScene* pScene = GetScene(); + + if(pScene == this) + { + // avoid resetting aOutRect which in case of a 3D scene used as 2d object + // is model data,not re-creatable view data + } + else + { + // if not the outmost scene it is used as group in 3d, call parent + E3dObject::SetBoundRectDirty(); + } } /************************************************************************* diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index cb1165267739..c69abb362754 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -75,6 +75,7 @@ #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() @@ -1066,77 +1067,39 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg struct E3dDepthNeighbour { - E3dDepthNeighbour* pNext; - E3dExtrudeObj* pObj; - - E3dDepthNeighbour() { pNext = NULL; pObj = NULL; } + E3dDepthNeighbour* mpNext; + E3dExtrudeObj* mpObj; + basegfx::B2DPolyPolygon maPreparedPolyPolygon; + + E3dDepthNeighbour() + : mpNext(0), + mpObj(0), + maPreparedPolyPolygon() + { + } }; struct E3dDepthLayer { - E3dDepthLayer* pDown; - E3dDepthNeighbour* pNext; - - E3dDepthLayer() { pDown = NULL; pNext = NULL; } - ~E3dDepthLayer() { while(pNext) { E3dDepthNeighbour* pSucc = pNext->pNext; delete pNext; pNext = pSucc; }} -}; - -bool ImpDoesOverlap(const basegfx::B2DPolygon& rPolygonA, const basegfx::B2DPolygon& rPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolygonB)); + E3dDepthLayer* mpDown; + E3dDepthNeighbour* mpNext; - if(aRangeA.overlaps(aRangeB)) + E3dDepthLayer() + : mpDown(0), + mpNext(0) { - // A in B ? - if(basegfx::tools::isInside(rPolygonA, rPolygonB)) - return true; - - // B in A ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA)) - return true; - - // A and B the same ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA, true)) - return true; } - return bRetval; -} - -bool ImpDoesOverlap(const basegfx::B2DPolyPolygon& rPolyPolygonA, const basegfx::B2DPolyPolygon& rPolyPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolyPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolyPolygonB)); - - if(aRangeA.overlaps(aRangeB)) + ~E3dDepthLayer() { - const sal_uInt32 nCntA(rPolyPolygonA.count()); - const sal_uInt32 nCntB(rPolyPolygonB.count()); - - for(sal_uInt32 a(0L); !bRetval && a < nCntA; a++) + while(mpNext) { - const basegfx::B2DPolygon aPolygonA(rPolyPolygonA.getB2DPolygon(a)); - - if(aPolygonA.isClosed()) - { - for(sal_uInt32 b(0L); !bRetval && b < nCntB; b++) - { - const basegfx::B2DPolygon aPolygonB(rPolyPolygonB.getB2DPolygon(b)); - - if(aPolygonB.isClosed()) - { - bRetval = ImpDoesOverlap(aPolygonA, aPolygonB); - } - } - } + E3dDepthNeighbour* pSucc = mpNext->mpNext; + delete mpNext; + mpNext = pSucc; } } - - return bRetval; -} +}; void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) { @@ -1147,39 +1110,41 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) E3dDepthLayer* pBaseLayer = NULL; E3dDepthLayer* pLayer = NULL; INT32 nNumLayers = 0; - //SfxItemPool& rPool = pMod->GetItemPool(); while(aIter.IsMore()) { - E3dObject* pSubObj = (E3dObject*)aIter.Next(); + E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next()); - if(pSubObj && pSubObj->ISA(E3dExtrudeObj)) + if(pExtrudeObj) { - E3dExtrudeObj* pExtrudeObj = (E3dExtrudeObj*)pSubObj; - const basegfx::B2DPolyPolygon aExtrudePoly(pExtrudeObj->GetExtrudePolygon()); - + const basegfx::B2DPolyPolygon aExtrudePoly( + basegfx::tools::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon())); const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet(); - XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); - Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); + const XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); + const Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); - // ExtrudeObj einordnen + // sort in ExtrudeObj if(pLayer) { - // Gibt es eine Ueberschneidung mit einem Objekt dieses - // Layers? - BOOL bOverlap(FALSE); - E3dDepthNeighbour* pAct = pLayer->pNext; + // do we have overlap with an object of this layer? + bool bOverlap(false); + E3dDepthNeighbour* pAct = pLayer->mpNext; while(!bOverlap && pAct) { - // ueberlappen sich pAct->pObj und pExtrudeObj ? - const basegfx::B2DPolyPolygon aActPoly(pAct->pObj->GetExtrudePolygon()); - bOverlap = ImpDoesOverlap(aExtrudePoly, aActPoly); + // do pAct->mpObj and pExtrudeObj overlap? Check by + // using logical AND clipping + const basegfx::B2DPolyPolygon aAndPolyPolygon( + basegfx::tools::solvePolygonOperationAnd( + aExtrudePoly, + pAct->maPreparedPolyPolygon)); + + bOverlap = (0 != aAndPolyPolygon.count()); if(bOverlap) { // second ciriteria: is another fillstyle or color used? - const SfxItemSet& rCompareSet = pAct->pObj->GetMergedItemSet(); + const SfxItemSet& rCompareSet = pAct->mpObj->GetMergedItemSet(); XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem); @@ -1201,71 +1166,74 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) } } - pAct = pAct->pNext; + pAct = pAct->mpNext; } if(bOverlap) { - // ja, beginne einen neuen Layer - pLayer->pDown = new E3dDepthLayer; - pLayer = pLayer->pDown; + // yes, start a new layer + pLayer->mpDown = new E3dDepthLayer; + pLayer = pLayer->mpDown; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } else { - // nein, Objekt kann in aktuellen Layer + // no, add to current layer E3dDepthNeighbour* pNewNext = new E3dDepthNeighbour; - pNewNext->pObj = pExtrudeObj; - pNewNext->pNext = pLayer->pNext; - pLayer->pNext = pNewNext; + pNewNext->mpObj = pExtrudeObj; + pNewNext->maPreparedPolyPolygon = aExtrudePoly; + pNewNext->mpNext = pLayer->mpNext; + pLayer->mpNext = pNewNext; } } else { - // erster Layer ueberhaupt + // first layer ever pBaseLayer = new E3dDepthLayer; pLayer = pBaseLayer; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } } } - // Anzahl Layer steht fest + // number of layers is done if(nNumLayers > 1) { - // Arrangement ist notwendig + // need to be arranged double fMinDepth = fDepth * 0.8; double fStep = (fDepth - fMinDepth) / (double)nNumLayers; pLayer = pBaseLayer; while(pLayer) { - // an pLayer entlangspazieren - E3dDepthNeighbour* pAct = pLayer->pNext; + // move along layer + E3dDepthNeighbour* pAct = pLayer->mpNext; while(pAct) { - // Anpassen - pAct->pObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); + // adapt extrude value + pAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); - // Naechster Eintrag - pAct = pAct->pNext; + // next + pAct = pAct->mpNext; } - // naechster Layer - pLayer = pLayer->pDown; + // next layer + pLayer = pLayer->mpDown; fMinDepth += fStep; } } - // angelegte Strukturen aufraeumen + // cleanup while(pBaseLayer) { - pLayer = pBaseLayer->pDown; + pLayer = pBaseLayer->mpDown; delete pBaseLayer; pBaseLayer = pLayer; } diff --git a/svx/source/engine3d/viewpt3d.cxx b/svx/source/engine3d/viewpt3d.cxx deleted file mode 100644 index ef9750781a2e..000000000000 --- a/svx/source/engine3d/viewpt3d.cxx +++ /dev/null @@ -1,32 +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 <svx/viewpt3d.hxx> - -// eof diff --git a/svx/source/engine3d/volume3d.cxx b/svx/source/engine3d/volume3d.cxx deleted file mode 100644 index 04a94b1705f5..000000000000 --- a/svx/source/engine3d/volume3d.cxx +++ /dev/null @@ -1,32 +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 <svx/volume3d.hxx> - -// eof diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index 672dd32d28b5..0a6e36219ed3 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -135,30 +135,19 @@ namespace svx { try { - // need a query composer for this - Reference< XSQLQueryComposerFactory > xComposerFac; - _rxForm->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) >>= xComposerFac; - Reference< XSQLQueryComposer > xComposer; - if (xComposerFac.is()) - xComposer = xComposerFac->createQueryComposer(); - - if (xComposer.is()) + Reference< XTablesSupplier > xSupTab; + _rxForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab; + + if(xSupTab.is()) { - ::rtl::OUString sActiveCommand; - _rxForm->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sActiveCommand; - xComposer->setQuery(sActiveCommand); - Reference< XTablesSupplier > xSupTab(xComposer, UNO_QUERY); - if(xSupTab.is()) + Reference< XNameAccess > xNames = xSupTab->getTables(); + if (xNames.is()) { - Reference< XNameAccess > xNames = xSupTab->getTables(); - if (xNames.is()) + Sequence< ::rtl::OUString > aTables = xNames->getElementNames(); + if (1 == aTables.getLength()) { - Sequence< ::rtl::OUString > aTables = xNames->getElementNames(); - if (1 == aTables.getLength()) - { - sCommand = aTables[0]; - nCommandType = CommandType::TABLE; - } + sCommand = aTables[0]; + nCommandType = CommandType::TABLE; } } } @@ -457,34 +446,10 @@ namespace svx String sObjectKind = (CommandType::TABLE == nObjectType) ? String('1') : String('0'); // check if the SQL-statement is modified - sal_Bool bHasFilterOrSort(sal_False); ::rtl::OUString sCompleteStatement; try { - ::rtl::OUString sFilter, sSort; - if (::cppu::any2bool(_rxLivingForm->getPropertyValue(FM_PROP_APPLYFILTER))) - _rxLivingForm->getPropertyValue(FM_PROP_FILTER) >>= sFilter; - _rxLivingForm->getPropertyValue(FM_PROP_SORT) >>= sSort; - bHasFilterOrSort = (sFilter.getLength()>0) || (sSort.getLength()>0); - _rxLivingForm->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sCompleteStatement; - - // create a composer - Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY ); - Reference< XSQLQueryComposer > xComposer; - if (xFactory.is()) - xComposer = xFactory->createQueryComposer(); - - // let the composer compose - if (xComposer.is()) - { - xComposer->setQuery(sCompleteStatement); - xComposer->setFilter(sFilter); - xComposer->setOrder(sSort); - sCompleteStatement = xComposer->getComposedQuery(); - } - // Usually, I would expect the result of the composing to be the same as the ActiveCommand property - // But this code here is pretty old, and I don't know wha the side effects are if I remove it now ... } catch(Exception&) { @@ -496,7 +461,7 @@ namespace svx ,sConnectionResource ,nObjectType ,sObjectName,xConnection - ,!((CommandType::QUERY == nObjectType) && !bHasFilterOrSort) + ,!((CommandType::QUERY == nObjectType)) ,sCompleteStatement); } diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 82d0b538ce38..618c2135652a 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -210,10 +210,11 @@ void FmGridHeader::RequestHelp( const HelpEvent& rHEvt ) Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns()); try { - Reference< ::com::sun::star::beans::XPropertySet > xColumn; - ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos)); + Reference< ::com::sun::star::beans::XPropertySet > xColumn(xColumns->getByIndex(nPos),UNO_QUERY); ::rtl::OUString aHelpText; xColumn->getPropertyValue(FM_PROP_HELPTEXT) >>= aHelpText; + if ( !aHelpText.getLength() ) + xColumn->getPropertyValue(FM_PROP_DESCRIPTION) >>= aHelpText; if ( aHelpText.getLength() ) { if ( rHEvt.GetMode() & HELPMODE_BALLOON ) @@ -1737,11 +1738,12 @@ void FmGridControl::InitColumnByField( _pColumn->SetObject( (sal_Int16)nFieldPos ); return; } - +/* // handle readonly columns sal_Bool bReadOnly = sal_True; xField->getPropertyValue( FM_PROP_ISREADONLY ) >>= bReadOnly; _pColumn->SetReadOnly( bReadOnly ); +*/ } // the control type is determined by the ColumnServiceName @@ -1999,7 +2001,11 @@ namespace { Reference<XPropertySet> xProp(GetPeer()->getColumns(),UNO_QUERY); if ( xProp.is() ) + { xProp->getPropertyValue(FM_PROP_HELPTEXT) >>= sRetText; + if ( !sRetText.getLength() ) + xProp->getPropertyValue(FM_PROP_DESCRIPTION) >>= sRetText; + } } break; case ::svt::BBTYPE_COLUMNHEADERCELL: @@ -2008,6 +2014,13 @@ namespace GetModelColumnPos( sal::static_int_cast< sal_uInt16 >(_nPosition)), FM_PROP_HELPTEXT); + if ( !sRetText.getLength() ) + sRetText = getColumnPropertyFromPeer( + GetPeer(), + GetModelColumnPos( + sal::static_int_cast< sal_uInt16 >(_nPosition)), + FM_PROP_DESCRIPTION); + break; default: sRetText = DbGridControl::GetAccessibleObjectDescription(_eObjType,_nPosition); @@ -2029,7 +2042,7 @@ void FmGridControl::Select() // die HandleColumn wird nicht selektiert switch (nSelectedColumn) { - case -1 : break; // no selection + case SAL_MAX_UINT16: break; // no selection case 0 : nSelectedColumn = SAL_MAX_UINT16; break; // handle col can't be seledted default : diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index debc0c8da2b1..809f618b628d 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -45,6 +45,8 @@ #include <com/sun/star/form/XBoundComponent.hpp> #include <com/sun/star/script/XEventAttacherManager.hpp> #include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/XStatement.hpp> @@ -82,6 +84,7 @@ using namespace ::svt; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::form; @@ -551,6 +554,7 @@ TYPEINIT1( DbFilterField, DbCellControl ) //------------------------------------------------------------------------------ DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ ) :OPropertyChangeListener(m_aMutex) + ,m_pFieldChangeBroadcaster(NULL) ,m_bTransparent( sal_False ) ,m_bAlignedController( sal_True ) ,m_bAccessingValueProperty( sal_False ) @@ -574,6 +578,27 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ ) implDoPropertyListening( FM_PROP_STATE, sal_False ); implDoPropertyListening( FM_PROP_TEXT, sal_False ); implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, sal_False ); + + // be listener at the bound field as well + try + { + Reference< XPropertySetInfo > xPSI( xColModelProps->getPropertySetInfo(), UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) ) + { + Reference< XPropertySet > xField; + xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField; + if ( xField.is() ) + { + m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField); + m_pFieldChangeBroadcaster->acquire(); + m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY ); + } + } + } + catch( const Exception& ) + { + DBG_ERROR( "DbCellControl::doPropertyListening: caught an exception!" ); + } } } @@ -605,17 +630,22 @@ void DbCellControl::doPropertyListening( const ::rtl::OUString& _rPropertyName ) { implDoPropertyListening( _rPropertyName ); } - //------------------------------------------------------------------------------ -DbCellControl::~DbCellControl() +void lcl_clearBroadCaster(::comphelper::OPropertyChangeMultiplexer*& _pBroadcaster) { - if ( m_pModelChangeBroadcaster ) + if ( _pBroadcaster ) { - m_pModelChangeBroadcaster->dispose(); - m_pModelChangeBroadcaster->release(); - m_pModelChangeBroadcaster = NULL; + _pBroadcaster->dispose(); + _pBroadcaster->release(); + _pBroadcaster = NULL; // no delete, this is done implicitly } +} +//------------------------------------------------------------------------------ +DbCellControl::~DbCellControl() +{ + lcl_clearBroadCaster(m_pModelChangeBroadcaster); + lcl_clearBroadCaster(m_pFieldChangeBroadcaster); delete m_pWindow; delete m_pPainter; @@ -660,7 +690,14 @@ void DbCellControl::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(R } else if ( _rEvent.PropertyName.equals( FM_PROP_READONLY ) ) { - implAdjustReadOnly( xSourceProps ); + implAdjustReadOnly( xSourceProps, true); + } + else if ( _rEvent.PropertyName.equals( FM_PROP_ISREADONLY ) ) + { + sal_Bool bReadOnly = sal_True; + _rEvent.NewValue >>= bReadOnly; + m_rColumn.SetReadOnly(bReadOnly); + implAdjustReadOnly( xSourceProps, false); } else if ( _rEvent.PropertyName.equals( FM_PROP_ENABLED ) ) { @@ -798,7 +835,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni } //------------------------------------------------------------------------------ -void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxModel ) +void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxModel,bool i_bReadOnly ) { DBG_ASSERT( m_pWindow, "DbCellControl::implAdjustReadOnly: not to be called without window!" ); DBG_ASSERT( _rxModel.is(), "DbCellControl::implAdjustReadOnly: invalid model!" ); @@ -807,9 +844,12 @@ void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxMode Edit* pEditWindow = dynamic_cast< Edit* >( m_pWindow ); if ( pEditWindow ) { - sal_Bool bReadOnly = sal_True; - _rxModel->getPropertyValue( FM_PROP_READONLY ) >>= bReadOnly; - static_cast< Edit* >( m_pWindow )->SetReadOnly( m_rColumn.IsReadOnly() || bReadOnly ); + sal_Bool bReadOnly = m_rColumn.IsReadOnly(); + if ( !bReadOnly ) + { + _rxModel->getPropertyValue( i_bReadOnly ? FM_PROP_READONLY : FM_PROP_ISREADONLY) >>= bReadOnly; + } + static_cast< Edit* >( m_pWindow )->SetReadOnly( bReadOnly ); } } } @@ -846,7 +886,7 @@ void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor if ( xModelPSI->hasPropertyByName( FM_PROP_READONLY ) ) { - implAdjustReadOnly( xModel ); + implAdjustReadOnly( xModel,true ); } if ( xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) ) @@ -1003,7 +1043,7 @@ double DbCellControl::GetValue(const Reference< ::com::sun::star::sdb::XColumn > //------------------------------------------------------------------------------ void DbCellControl::invalidatedController() { - m_rColumn.GetParent().refreshController(m_rColumn.GetId(), DbGridControl::GrantCellControlAccess()); + m_rColumn.GetParent().refreshController(m_rColumn.GetId(), DbGridControl::GrantControlAccess()); } /*************************************************************************/ @@ -3039,43 +3079,22 @@ void DbFilterField::Update() if (!xForm.is()) return; - Reference< XConnection > xConnection(getRowSetConnection(xForm)); - if (!xConnection.is()) - return; - - Reference< ::com::sun::star::sdb::XSQLQueryComposerFactory > xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - { - DBG_ERROR("DbFilterField::Update : used the right place to request the ::com::sun::star::sdb::XSQLQueryComposerFactory interface ?"); - return; - } - - Reference< ::com::sun::star::sdb::XSQLQueryComposer > xComposer = xFactory->createQueryComposer(); - try - { - Reference< ::com::sun::star::beans::XPropertySet > xFormAsSet(xForm, UNO_QUERY); - ::rtl::OUString sStatement; - xFormAsSet->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sStatement; - xComposer->setQuery(sStatement); - } - catch(const Exception&) - { - ::comphelper::disposeComponent(xComposer); - return; - } + Reference<XPropertySet> xFormProp(xForm,UNO_QUERY); + Reference< XTablesSupplier > xSupTab; + xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab; - Reference< ::com::sun::star::beans::XPropertySet > xComposerAsSet(xComposer, UNO_QUERY); - if (!xComposerAsSet.is()) + Reference< XConnection > xConnection(getRowSetConnection(xForm)); + if (!xSupTab.is()) return; // search the field - Reference< ::com::sun::star::container::XNameAccess > xFieldNames; - Reference< ::com::sun::star::container::XNameAccess > xTablesNames; - Reference< ::com::sun::star::beans::XPropertySet > xComposerFieldAsSet; + Reference< XColumnsSupplier > xSupCol(xSupTab,UNO_QUERY); + Reference< ::com::sun::star::container::XNameAccess > xFieldNames = xSupCol->getColumns(); + if (!xFieldNames->hasByName(aName)) + return; - ::cppu::extractInterface(xFieldNames, xComposerAsSet->getPropertyValue(FM_PROP_SELECTED_FIELDS)); - ::cppu::extractInterface(xTablesNames, xComposerAsSet->getPropertyValue(FM_PROP_SELECTED_TABLES)); - ::cppu::extractInterface(xComposerFieldAsSet, xFieldNames->getByName(aName)); + Reference< ::com::sun::star::container::XNameAccess > xTablesNames = xSupTab->getTables(); + Reference< ::com::sun::star::beans::XPropertySet > xComposerFieldAsSet(xFieldNames->getByName(aName),UNO_QUERY); if (xComposerFieldAsSet.is() && ::comphelper::hasProperty(FM_PROP_TABLENAME, xComposerFieldAsSet) && ::comphelper::hasProperty(FM_PROP_FIELDSOURCE, xComposerFieldAsSet)) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index fa5a407f76dc..d54b091c6bd2 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -44,6 +44,8 @@ #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/sdb/XResultSetAccess.hpp> +#include <com/sun/star/sdb/RowChangeAction.hpp> +#include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp> #include <com/sun/star/sdbc/XResultSetUpdate.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/container/XChild.hpp> @@ -102,6 +104,39 @@ using namespace com::sun::star::accessibility; | BROWSER_VLINESFULL \ | BROWSER_HEADERBAR_NEW \ +class RowSetEventListener : public ::cppu::WeakImplHelper1<XRowsChangeListener> +{ + DbGridControl* m_pControl; +public: + RowSetEventListener(DbGridControl* i_pControl) : m_pControl(i_pControl) + { + } +private: + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*i_aEvt*/) throw ( RuntimeException ) + { + } + virtual void SAL_CALL rowsChanged(const ::com::sun::star::sdb::RowsChangeEvent& i_aEvt) throw ( RuntimeException ) + { + if ( i_aEvt.Action == RowChangeAction::UPDATE ) + { + ::DbGridControl::GrantControlAccess aAccess; + CursorWrapper* pSeek = m_pControl->GetSeekCursor(aAccess); + const DbGridRowRef& rSeekRow = m_pControl->GetSeekRow(aAccess); + const Any* pIter = i_aEvt.Bookmarks.getConstArray(); + const Any* pEnd = pIter + i_aEvt.Bookmarks.getLength(); + for(;pIter != pEnd;++pIter) + { + pSeek->moveToBookmark(*pIter); + // get the data + rSeekRow->SetState(pSeek, sal_True); + sal_Int32 nSeekPos = pSeek->getRow() - 1; + m_pControl->SetSeekPos(nSeekPos,aAccess); + m_pControl->RowModified(nSeekPos); + } + } + } +}; //============================================================================== class GridFieldValueListener; @@ -987,6 +1022,7 @@ DbGridControl::~DbGridControl() m_pDataSourcePropMultiplexer = NULL; m_pDataSourcePropListener = NULL; } + m_xRowSetListener.clear(); delete m_pDataCursor; delete m_pSeekCursor; @@ -1377,7 +1413,7 @@ sal_Bool DbGridControl::IsPermanentCursorEnabled() const } //------------------------------------------------------------------------------ -void DbGridControl::refreshController(sal_uInt16 _nColId, GrantCellControlAccess /*_aAccess*/) +void DbGridControl::refreshController(sal_uInt16 _nColId, GrantControlAccess /*_aAccess*/) { if ((GetCurColumnId() == _nColId) && IsEditing()) { // the controller which is currently active needs to be refreshed @@ -1412,6 +1448,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt m_pDataSourcePropMultiplexer = NULL; m_pDataSourcePropListener = NULL; } + m_xRowSetListener.clear(); // is the new cursor valid ? // the cursor is only valid if it contains some columns @@ -1503,7 +1540,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt Reference< XPropertySet > xSet(_xCursor, UNO_QUERY); if (xSet.is()) { - // feststellen welche Updatem�glichkeiten bestehen + // feststellen welche Updatemoeglichkeiten bestehen sal_Int32 nConcurrency = ResultSetConcurrency::READ_ONLY; xSet->getPropertyValue(FM_PROP_RESULTSET_CONCURRENCY) >>= nConcurrency; @@ -1565,6 +1602,12 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount; m_bRecordCountFinal = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ROWCOUNTFINAL)); + m_xRowSetListener = new RowSetEventListener(this); + Reference< XRowsChangeBroadcaster> xChangeBroad(xSet,UNO_QUERY); + if ( xChangeBroad.is( ) ) + xChangeBroad->addRowsChangeListener(m_xRowSetListener); + + // insert the currently known rows // and one row if we are able to insert rows if (m_nOptions & OPT_INSERT) diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 015d19407cc0..47a1436edf26 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -43,7 +43,7 @@ #include <svtools/miscopt.hxx> #include <unotools/pathoptions.hxx> #include <unotools/viewoptions.hxx> -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #include <sfx2/app.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/objitem.hxx> @@ -3683,11 +3683,8 @@ namespace svxform m_aURLED.DisableHistory(); m_aFilePickerBtn.SetClickHdl( LINK( this, AddInstanceDialog, FilePickerHdl ) ); - // load the filter name from svtools resource - ByteString aResMgrName( "svt" ); - ResMgr* pSvtResMgr = ResMgr::CreateResMgr( - aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - m_sAllFilterName = String( ResId( STR_FILTERNAME_ALL, *pSvtResMgr ) ); + // load the filter name from fps_office resource + m_sAllFilterName = String( ResId( STR_FILTERNAME_ALL, *CREATEVERSIONRESMGR(fps_office) ) ); } AddInstanceDialog::~AddInstanceDialog() diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index e554a4dbf611..e767f7c0b112 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -78,6 +78,7 @@ #include <svx/fmglob.hxx> #include <svl/eitem.hxx> #include <tools/shl.hxx> +#include <tools/diagnose_ex.h> #include <svx/svdpage.hxx> #include <svx/fmmodel.hxx> #include <svx/dialmgr.hxx> @@ -98,6 +99,8 @@ #include <svx/svxdlg.hxx> //CHINA001 #include <svx/dialogs.hrc> //CHINA001 +#include "svx/sdrobjectfilter.hxx" + #define HANDLE_SQL_ERRORS( action, successflag, context, message ) \ try \ { \ @@ -540,7 +543,7 @@ void FmFormShell::Execute(SfxRequest &rReq) case SID_FM_SCROLLBAR: case SID_FM_SPINBUTTON: { - SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_GRABCONTROLFOCUS, sal_False ); + SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False ); if ( pGrabFocusItem && pGrabFocusItem->GetValue() ) { // see below SfxViewShell* pShell = GetViewShell(); @@ -568,9 +571,9 @@ void FmFormShell::Execute(SfxRequest &rReq) { // #99013# if selected with control key, return focus to current view // do this asynchron, so that the creation can be finished first - // reusing the SID_FM_GRABCONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another + // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another // name, so I do not really have a big problem with this .... - SfxBoolItem aGrabFocusIndicatorItem( SID_FM_GRABCONTROLFOCUS, sal_True ); + SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True ); GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON, &aGrabFocusIndicatorItem, NULL ); } @@ -591,11 +594,27 @@ void FmFormShell::Execute(SfxRequest &rReq) } break; - case SID_FM_GRABCONTROLFOCUS: + case SID_FM_TOGGLECONTROLFOCUS: { FmFormView* pFormView = GetFormView(); - if ( pFormView ) + if ( !pFormView ) + break; + + // if we execute this ourself, then either the application does not implement an own handling for this, + // of we're on the top of the dispatcher stack, which means a control has the focus. + // In the latter case, we put the focus to the document window, otherwise, we focus the first control + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + if ( bHasControlFocus ) + { + const OutputDevice* pDevice = GetCurrentViewDevice(); + Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { pFormView->GrabFirstControlFocus( ); + } } break; @@ -1349,6 +1368,78 @@ namespace } //------------------------------------------------------------------------ +void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const +{ + try + { + // check if the focus currently is in a control + // Well, okay, do it the other way 'round: Check whether the current control of the active controller + // actually has the focus. This should be equivalent. + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + + if ( bHasControlFocus ) + { + Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) ); + OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { + Reference< XControl > xControl; + GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl ); + Reference< XWindow > xControlWindow( xControl, UNO_QUERY ); + if ( xControlWindow.is() ) + xControlWindow->setFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------ +namespace +{ + class FocusableControlsFilter : public ::svx::ISdrObjectFilter + { + public: + FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) + :m_rView( i_rView ) + ,m_rDevice( i_rDevice ) + { + } + + public: + virtual bool includeObject( const SdrObject& i_rObject ) const + { + const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject ); + if ( !pUnoObj ) + return false; + + Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice ); + return FmXFormView::isFocusable( xControl ); + } + + private: + const SdrView& m_rView; + const OutputDevice& m_rDevice; + }; +} + +//------------------------------------------------------------------------ +::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const +{ + ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter; + + if ( !i_rView.IsDesignMode() ) + pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) ); + + return pFilter; +} + +//------------------------------------------------------------------------ SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const { if ( !_rxModel.is() ) diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 888c30969f6b..95ce818c4a86 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -56,6 +56,7 @@ #include "svx/svxids.hrc" /** === begin UNO includes === **/ +#include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XCheckBox.hpp> #include <com/sun/star/awt/XListBox.hpp> #include <com/sun/star/awt/XTextComponent.hpp> @@ -941,7 +942,6 @@ void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( Ru void FmXFormShell::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::disposing" ); - OSL_TRACE( "--- FmXFormShell::disposing : %p, ........, ........", this ); impl_checkDisposed(); FmXFormShell_BASE::disposing(); @@ -1579,22 +1579,25 @@ void FmXFormShell::ExecuteSearch() return; // filter out the forms which do not contain valid controls at all - FmFormArray::reverse_iterator form = m_aSearchForms.rbegin(); - ::std::vector< String >::reverse_iterator contextName = aContextNames.rbegin(); - sal_Int32 i = m_aSearchForms.size(); - for ( ; - form != m_aSearchForms.rend(); - ++form, ++contextName, --i - ) { - FmSearchContext aTestContext; - aTestContext.nContext = static_cast< sal_Int16 >( i-1 ); - sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext ); - if ( nValidControls == 0 ) + FmFormArray aValidForms; + ::std::vector< String > aValidContexts; + FmFormArray::const_iterator form = m_aSearchForms.begin(); + ::std::vector< String >::const_iterator contextName = aContextNames.begin(); + for ( ; form != m_aSearchForms.end(); ++form, ++contextName ) { - m_aSearchForms.erase( form.base() - 1 ); - aContextNames.erase( contextName.base() - 1 ); + FmSearchContext aTestContext; + aTestContext.nContext = static_cast< sal_Int16 >( form - m_aSearchForms.begin() ); + sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext ); + if ( nValidControls > 0 ) + { + aValidForms.push_back( *form ); + aValidContexts.push_back( *contextName ); + } } + + m_aSearchForms.swap( aValidForms ); + aContextNames.swap( aValidContexts ); } if (m_aSearchForms.size() == 0) @@ -1606,7 +1609,7 @@ void FmXFormShell::ExecuteSearch() // jetzt brauche ich noch einen 'initial context' sal_Int16 nInitialContext = 0; Reference< XForm> xActiveForm( getActiveForm()); - for (i=0; i<(sal_Int32)m_aSearchForms.size(); ++i) + for ( size_t i=0; i<m_aSearchForms.size(); ++i ) { if (m_aSearchForms.at(i) == xActiveForm) { @@ -2373,6 +2376,8 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject ); Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() ); DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" ); + if ( !xControlModel.is() ) + return 0; // disable the permanent cursor for the last grid we found a record if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel)) @@ -2390,7 +2395,7 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) sal_Int32 nGridColumn = m_arrRelativeGridColumn.GetObject(pfriWhere->nFieldPos); if (nGridColumn != -1) { // dummer weise muss ich mir das Control erst wieder besorgen - Reference< XControl> xControl( GetControlFromModel(xControlModel)); + Reference< XControl> xControl( impl_getControl( xControlModel, *pFormObject ) ); Reference< XGrid> xGrid(xControl, UNO_QUERY); DBG_ASSERT(xGrid.is(), "FmXFormShell::OnFoundData : ungueltiges Control !"); // wenn eine der Asserts anschlaegt, habe ich beim Aufbauen von m_arrSearchedControls wohl was falsch gemacht @@ -2402,7 +2407,8 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, makeAny( sal_Int32( COL_LIGHTRED ) ) ); m_xLastGridFound = xControlModel; - xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn); + if ( xGrid.is() ) + xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn); } // als der Cursor neu positioniert wurde, habe ich (in positioned) meine Formularleisten-Slots invalidiert, aber das greift @@ -2510,7 +2516,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn // ... nach der ControlSource-Eigenschaft fragen SearchableControlIterator iter( xCurrentFormComponent ); - Reference< XControl> xControlBehindModel; + Reference< XControl> xControl; // das Control, das als Model xControlModel hat // (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss // ich nicht jedesmal neu suchen) @@ -2522,10 +2528,12 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn if ( sControlSource.getLength() == 0 ) { // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was // der SearchableControlIterator noch zulaesst) - xControlBehindModel = GetControlFromModel(xControlModel); - DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); + xControl = impl_getControl( xControlModel, *pFormObject ); + DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); - Reference< XGridPeer> xGridPeer(xControlBehindModel->getPeer(), UNO_QUERY); + Reference< XGridPeer> xGridPeer; + if ( xControl.is() ) + xGridPeer.set( xControl->getPeer(), UNO_QUERY ); do { if (!xGridPeer.is()) @@ -2579,13 +2587,13 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource)) { // jetzt brauche ich das Control zum SdrObject - if (!xControlBehindModel.is()) + if (!xControl.is()) { - xControlBehindModel = GetControlFromModel(xControlModel); - DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); + xControl = impl_getControl( xControlModel, *pFormObject ); + DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !"); } - if (IsSearchableControl(xControlBehindModel)) + if (IsSearchableControl(xControl)) { // alle Tests ueberstanden -> in die Liste mit aufnehmen strFieldList += sControlSource.getStr(); strFieldList += ';'; @@ -2601,7 +2609,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count()); // und fuer die formatierte Suche ... - pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControlBehindModel, UNO_QUERY)); + pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControl, UNO_QUERY)); } } } @@ -2975,24 +2983,48 @@ void FmXFormShell::SetDesignMode(sal_Bool bDesign) } //------------------------------------------------------------------------------ -Reference< XControl> FmXFormShell::GetControlFromModel(const Reference< XControlModel>& xModel) +Reference< XControl> FmXFormShell::impl_getControl( const Reference< XControlModel >& i_rxModel, const FmFormObj& i_rKnownFormObj ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::GetControlFromModel" ); if ( impl_checkDisposed() ) return NULL; - Reference< XControlContainer> xControlContainer( getControlContainerForView() ); + Reference< XControl > xControl; + try + { + Reference< XControlContainer> xControlContainer( getControlContainerForView(), UNO_SET_THROW ); + + Sequence< Reference< XControl > > seqControls( xControlContainer->getControls() ); + const Reference< XControl >* pControls = seqControls.getArray(); + // ... die ich dann durchsuchen kann + for (sal_Int32 i=0; i<seqControls.getLength(); ++i) + { + xControl.set( pControls[i], UNO_SET_THROW ); + Reference< XControlModel > xCurrentModel( xControl->getModel() ); + if ( xCurrentModel == i_rxModel ) + break; + xControl.clear(); + } + + if ( !xControl.is() ) + { + // fallabck (some controls might not have been created, yet, since they were never visible so far) + Reference< XControl > xContainerControl( xControlContainer, UNO_QUERY_THROW ); + const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerControl->getPeer() ); + ENSURE_OR_THROW( pContainerWindow, "unexpected control container implementation" ); + + const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : NULL; + ENSURE_OR_THROW( pSdrView, "no current view" ); - Sequence< Reference< XControl> > seqControls( xControlContainer->getControls() ); - Reference< XControl>* pControls = seqControls.getArray(); - // ... die ich dann durchsuchen kann - for (int i=0; i<seqControls.getLength(); ++i) + xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_QUERY_THROW ); + } + } + catch( const Exception& ) { - Reference< XControlModel> xSearchLoopModel( pControls[i]->getModel()); - if ((XControlModel*)xSearchLoopModel.get() == (XControlModel*)xModel.get()) - return pControls[i]; + DBG_UNHANDLED_EXCEPTION(); } - return Reference< XControl>(NULL); + + OSL_ENSURE( xControl.is(), "FmXFormShell::impl_getControl: no control found!" ); + return xControl; } //------------------------------------------------------------------------------ @@ -3761,7 +3793,6 @@ void FmXFormShell::SetWizardUsing(sal_Bool _bUseThem) void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController /* = sal_True */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewDeactivated" ); - OSL_TRACE( "--- FmXFormShell::viewDeactivated: %p, %p, ........", this, &_rCurrentView ); if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() ) { @@ -3796,7 +3827,6 @@ void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeacti // remove callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::resetHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( Link() ); } UpdateForms( sal_True ); @@ -3835,7 +3865,6 @@ IMPL_LINK( FmXFormShell, OnFormsCreated, FmFormPage*, /*_pPage*/ ) void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction /* = sal_False */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewActivated" ); - OSL_TRACE( "--- FmXFormShell::viewActivated : %p, %p, ........", this, &_rCurrentView ); FmFormPage* pPage = _rCurrentView.GetCurPage(); @@ -3865,7 +3894,6 @@ void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncActi // set callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::setHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( LINK( this, FmXFormShell, OnFormsCreated ) ); } @@ -4156,6 +4184,31 @@ void FmXFormShell::handleMouseButtonDown( const SdrViewEvent& _rViewEvent ) } } +//------------------------------------------------------------------------------ +bool FmXFormShell::HasControlFocus() const +{ + bool bHasControlFocus = false; + + try + { + Reference< XFormController > xController( getActiveController() ); + Reference< XControl > xCurrentControl; + if ( xController.is() ) + xCurrentControl.set( xController->getCurrentControl() ); + if ( xCurrentControl.is() ) + { + Reference< XWindow2 > xPeerWindow( xCurrentControl->getPeer(), UNO_QUERY_THROW ); + bHasControlFocus = xPeerWindow->hasFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return bHasControlFocus; +} + //============================================================================== //============================================================================== SearchableControlIterator::SearchableControlIterator(Reference< XInterface> xStartingPoint) diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 98eeb3927e69..19ca20dd7983 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -130,7 +130,6 @@ namespace svx SID_ATTR_LRSPACE, /* 48 */ SID_ATTR_ULSPACE, /* 49 */ SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_OVERLINE, SID_SET_SUPER_SCRIPT, SID_SET_SUB_SCRIPT, SID_CHAR_DLG, @@ -141,6 +140,7 @@ namespace svx SID_ATTR_CHAR_RELIEF, SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */ SID_ATTR_PARA_RIGHT_TO_LEFT, + SID_ATTR_CHAR_OVERLINE, 0 }; diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index 068f4aa8a029..460d2e1cd787 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -72,6 +72,8 @@ /** === end UNO includes === **/ #include <basic/sbxvar.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <comphelper/container.hxx> #include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index c777fe4da28e..e63325f710e9 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -90,25 +90,7 @@ class ScriptEventListenerWrapper : public ScriptEventListener_BASE public: ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel) { - Reference < XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - if ( xProps.is() ) - { - Reference< XComponentContext > xCtx( xProps->getPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY ); - if ( xCtx.is() ) - { - Reference< XMultiComponentFactory > xMFac( - xCtx->getServiceManager(), UNO_QUERY ); - if ( xMFac.is() ) - { - m_vbaListener.set( xMFac->createInstanceWithContext( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "ooo.vba.EventListener" ) ), xCtx ), - UNO_QUERY_THROW ); - } - } - } + } // XEventListener virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){} @@ -136,6 +118,33 @@ public: private: void setModel() { + if ( !m_vbaListener.is() ) + { + Reference < XPropertySet > xProps( + ::comphelper::getProcessServiceFactory(), UNO_QUERY ); + if ( xProps.is() ) + { + Reference< XComponentContext > xCtx( xProps->getPropertyValue( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY ); + if ( xCtx.is() ) + { + Reference< XMultiComponentFactory > xMFac( + xCtx->getServiceManager(), UNO_QUERY ); + SfxObjectShellRef xObjSh = pModel->GetObjectShell(); + Reference< XMultiServiceFactory > xDocFac; + if ( xObjSh.Is() ) + xDocFac.set( xObjSh->GetModel(), UNO_QUERY ); + + if ( xMFac.is() ) + { + m_vbaListener.set( xMFac->createInstanceWithContext( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "ooo.vba.EventListener" ) ), xCtx ), + UNO_QUERY_THROW ); + } + } + } + } Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY ); if ( xProps.is() ) { diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 462e95d38514..6804e838e602 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -339,8 +339,6 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync ) //------------------------------------------------------------------------ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) { - OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); - SdrPageView* pPV = E3dView::ShowSdrPage(pPage); if (pPage) @@ -377,8 +375,6 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) //------------------------------------------------------------------------ void FmFormView::HideSdrPage() { - OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); - // --- 1. deactivate controls if ( !IsDesignMode() ) DeactivateControls(GetSdrPageView()); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index dae216753d22..31918073d669 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -823,6 +823,48 @@ void FmXFormView::AutoFocus( sal_Bool _bSync ) else m_nAutoFocusEvent = Application::PostUserEvent(LINK(this, FmXFormView, OnAutoFocus)); } + +// ----------------------------------------------------------------------------- +bool FmXFormView::isFocusable( const Reference< XControl >& i_rControl ) +{ + if ( !i_rControl.is() ) + return false; + + try + { + Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW ); + + // only enabled controls are allowed to participate + sal_Bool bEnabled = sal_False; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); + if ( !bEnabled ) + return false; + + // check the class id of the control model + sal_Int16 nClassId = FormComponentType::CONTROL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); + + // controls which are not focussable + if ( ( FormComponentType::CONTROL != nClassId ) + && ( FormComponentType::IMAGEBUTTON != nClassId ) + && ( FormComponentType::GROUPBOX != nClassId ) + && ( FormComponentType::FIXEDTEXT != nClassId ) + && ( FormComponentType::HIDDENCONTROL != nClassId ) + && ( FormComponentType::IMAGECONTROL != nClassId ) + && ( FormComponentType::SCROLLBAR != nClassId ) + && ( FormComponentType::SPINBUTTON!= nClassId ) + ) + { + return true; + } + } + catch( const Exception& e ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; +} + // ----------------------------------------------------------------------------- static Reference< XControl > lcl_firstFocussableControl( const Sequence< Reference< XControl > >& _rControls ) { @@ -833,47 +875,19 @@ static Reference< XControl > lcl_firstFocussableControl( const Sequence< Referen const Reference< XControl >* pControlsEnd = _rControls.getConstArray() + _rControls.getLength(); for ( ; pControls != pControlsEnd; ++pControls ) { - try - { - if ( !pControls->is() ) - continue; - - Reference< XPropertySet > xModelProps( (*pControls)->getModel(), UNO_QUERY_THROW ); - - // only enabled controls are allowed to participate - sal_Bool bEnabled = sal_False; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); - if ( !bEnabled ) - continue; - - // check the class id of the control model - sal_Int16 nClassId = FormComponentType::CONTROL; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); - - // controls which are not focussable - if ( ( FormComponentType::CONTROL != nClassId ) - && ( FormComponentType::IMAGEBUTTON != nClassId ) - && ( FormComponentType::GROUPBOX != nClassId ) - && ( FormComponentType::FIXEDTEXT != nClassId ) - && ( FormComponentType::HIDDENCONTROL != nClassId ) - && ( FormComponentType::IMAGECONTROL != nClassId ) - && ( FormComponentType::SCROLLBAR != nClassId ) - && ( FormComponentType::SPINBUTTON!= nClassId ) - ) - { - xReturn = *pControls; - break; - } - } - catch( const Exception& e ) + if ( !pControls->is() ) + continue; + + if ( FmXFormView::isFocusable( *pControls ) ) { - (void)e; // make compiler happy + xReturn = *pControls; + break; } - - if ( !xReturn.is() && _rControls.getLength() ) - xReturn = _rControls[0]; } + if ( !xReturn.is() && _rControls.getLength() ) + xReturn = _rControls[0]; + return xReturn; } @@ -1008,11 +1022,6 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) } // ----------------------------------------------------------------------------- -namespace -{ -} - -// ----------------------------------------------------------------------------- void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::onCreatedFormObject" ); @@ -1590,7 +1599,13 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& xLabelModel.set( pLabel->GetUnoControlModel(), UNO_QUERY ); if ( xLabelModel.is() ) { - xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sFieldName + _rFieldPostfix ) ); + ::rtl::OUString sLabel; + if ( _rxField.is() && _rxField->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) ) + _rxField->getPropertyValue(FM_PROP_LABEL) >>= sLabel; + if ( !sLabel.getLength() ) + sLabel = sFieldName; + + xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel + _rFieldPostfix ) ); String sObjectLabel( SVX_RES( RID_STR_OBJECT_LABEL ) ); sObjectLabel.SearchAndReplaceAllAscii( "#object#", sFieldName ); xLabelModel->setPropertyValue( FM_PROP_NAME, makeAny( ::rtl::OUString( sObjectLabel ) ) ); diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 32a234396c54..857bdc1b2647 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/form/XFormComponent.hpp> #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/awt/ScrollBarOrientation.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> @@ -97,6 +98,7 @@ namespace svxform /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; + namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; namespace LineEndFormat = ::com::sun::star::awt::LineEndFormat; namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; namespace DataType = ::com::sun::star::sdbc::DataType; @@ -506,6 +508,12 @@ namespace svxform _rxControlModel->setPropertyValue( FM_PROP_STRICTFORMAT, makeAny( sal_Bool( sal_True ) ) ); } + // mouse wheel: don't use it for scrolling by default (i110036) + if ( xPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) ) + { + _rxControlModel->setPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); + } + if ( xPSI->hasPropertyByName( FM_PROP_WRITING_MODE ) ) _rxControlModel->setPropertyValue( FM_PROP_WRITING_MODE, makeAny( WritingMode2::CONTEXT ) ); } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index d4249e5fa4ec..78bbc7a533d9 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -2232,7 +2232,7 @@ namespace svxform { SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i ); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) + if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() ) { pFormView->MakeVisible( aMarkRect, (Window&)rOutDev ); } diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx index aeb62d79f3f7..37c102cb1954 100644 --- a/svx/source/form/tabwin.cxx +++ b/svx/source/form/tabwin.cxx @@ -91,9 +91,46 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::form; using namespace ::com::sun::star::container; +using namespace ::com::sun::star; using namespace ::svxform; using namespace ::svx; + +struct ColumnInfo +{ + ::rtl::OUString sColumnName; + ::rtl::OUString sLabel; + bool bColumn; + ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel) + : sColumnName(i_sColumnName) + , sLabel(i_sLabel) + , bColumn(true) + { + } + ColumnInfo(const ::rtl::OUString& i_sColumnName) + : sColumnName(i_sColumnName) + , bColumn(false) + { + } +}; + +void lcl_addToList( SvTreeListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns ) +{ + uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames(); + const ::rtl::OUString* pEntries = aEntries.getConstArray(); + sal_Int32 nEntries = aEntries.getLength(); + for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + { + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) ) + xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel; + if ( sLabel.getLength() ) + _rListBox.InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + else + _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + } +} //================================================================== // class FmFieldWinListBox //================================================================== @@ -149,7 +186,8 @@ void FmFieldWinListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPi aDescriptor[ daConnection ] <<= pTabWin->GetConnection().getTyped(); aDescriptor[ daCommand ] <<= pTabWin->GetObjectName(); aDescriptor[ daCommandType ]<<= pTabWin->GetObjectType(); - aDescriptor[ daColumnName ] <<= ::rtl::OUString( GetEntryText( pSelected ) ); + ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData()); + aDescriptor[ daColumnName ] <<= pInfo->sColumnName; TransferableHelper* pTransferColumn = new OColumnTransferable( aDescriptor, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR @@ -238,7 +276,8 @@ sal_Bool FmFieldWin::createSelectionControls( ) aDescr[ daCommand ] <<= GetObjectName(); aDescr[ daCommandType ] <<= GetObjectType(); - aDescr[ daColumnName ] <<= ::rtl::OUString( pListBox->GetEntryText( pSelected) ); + ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData()); + aDescr[ daColumnName ] <<= pInfo->sColumnName;//::rtl::OUString( pListBox->GetEntryText( pSelected) ); // transfer this to the SFX world SfxUnoAnyItem aDescriptorItem( SID_FM_DATACCESS_DESCRIPTOR, makeAny( aDescr.createPropertyValueSequence() ) ); @@ -344,15 +383,14 @@ void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::su // the place, and connectRowset should be replaced with ensureRowSetConnection // get the fields of the object - Sequence< ::rtl::OUString> aFieldNames; - if ( m_aConnection.is() && m_aObjectName.getLength() ) - aFieldNames = getFieldNamesByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName ); - // put them into the list - const ::rtl::OUString* pFieldNames = aFieldNames.getConstArray(); - sal_Int32 nFieldsCount = aFieldNames.getLength(); - for ( sal_Int32 i = 0; i < nFieldsCount; ++i, ++pFieldNames) - pListBox->InsertEntry( * pFieldNames); + if ( m_aConnection.is() && m_aObjectName.getLength() ) + { + Reference< XComponent > xKeepFieldsAlive; + Reference< XNameAccess > xColumns = getFieldsByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName,xKeepFieldsAlive ); + if ( xColumns.is() ) + lcl_addToList(*pListBox,xColumns); + } // Prefix setzen UniString aPrefix; diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc index 72758a4cac4e..a0592c80b90b 100644 --- a/svx/source/inc/fmprop.hrc +++ b/svx/source/inc/fmprop.hrc @@ -174,5 +174,6 @@ #define FM_PROP_INPUT_REQUIRED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputRequired" ) ) #define FM_PROP_WRITING_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ) #define FM_PROP_MOUSE_WHEEL_BEHAVIOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MouseWheelBehavior" ) ) +#define FM_PROP_DESCRIPTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Description" ) ) #endif // _SVX_FMPROP_HRC diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index a97793a64ea9..e56f9fd64a36 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -163,6 +163,7 @@ typedef ::utl::ConfigItem FmXFormShell_CFGBASE; struct SdrViewEvent; class FmFormShell; class FmFormView; +class FmFormObj; class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE ,public FmXFormShell_CFGBASE ,public ::svxform::OStaticDataAccessTools @@ -349,8 +350,11 @@ protected: void startListening(); void stopListening(); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> GetControlFromModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xModel); - // liefert das Control, welches das angegebene Model hat + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > + impl_getControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& i_rxModel, + const FmFormObj& i_rKnownFormObj + ); // sammelt in strNames die Namen aller Formulare static void impl_collectFormSearchContexts_nothrow( @@ -477,6 +481,9 @@ public: // if the form belongs to the controller (extern) displaying a grid, the according internal form will // be displayed, _xForm else + // check if the current control of the active controler has the focus + bool HasControlFocus() const; + private: DECL_LINK(OnFoundData, FmFoundRecordInformation*); DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index d643fc4dc403..1131209a384a 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -240,6 +240,11 @@ public: void onCreatedFormObject( FmFormObj& _rFormObject ); + static bool + isFocusable( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& i_rControl + ); + private: FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ); //void addWindow(const SdrPageViewWinRec*); diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index c72a59294d6c..acead19ba9ee 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -219,6 +219,7 @@ class DbCellControl { private: ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster; + ::comphelper::OPropertyChangeMultiplexer* m_pFieldChangeBroadcaster; private: sal_Bool m_bTransparent : 1; @@ -348,7 +349,7 @@ private: void implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent = sal_True ); /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model - void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel,bool i_bReadOnly ); /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model void implAdjustEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); diff --git a/svx/source/intro/iso.src b/svx/source/intro/iso.src index f963d95721fc..ecadfd9d4c6a 100644 --- a/svx/source/intro/iso.src +++ b/svx/source/intro/iso.src @@ -30,7 +30,7 @@ #endif #ifndef _SVTOOLS_HRC -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #endif #include "intro.hrc" diff --git a/svx/source/intro/makefile.mk b/svx/source/intro/makefile.mk index 3ed86b3bcda3..4d0686baac04 100644 --- a/svx/source/intro/makefile.mk +++ b/svx/source/intro/makefile.mk @@ -36,10 +36,6 @@ TARGET=intro RSCLOCINC!:=$(RSCLOCINC);$(PRJ)$/RES -# setting the compiled by $user$ string in the About box -OOO_VENDOR*=$(USER)$(USERNAME) -RSCDEFS+=-DOOO_VENDOR="$(OOO_VENDOR)" - # --- Allgemein ----------------------------------------------------------- LOCALIZE_ME=intro_tmpl.hrc diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index b29f3894c0c5..49f6f68fd7e4 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #endif #ifndef _SVTOOLS_IMAGEMGR_HRC @@ -93,7 +93,7 @@ ModalDialog RID_DEFAULTABOUT }; String ABOUT_STR_COPYRIGHT { - Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; + Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; }; StringArray ABOUT_STR_DEVELOPER_ARY { diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index ba260e79bba9..cbe9c4a9c615 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -61,11 +61,30 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::attribute::SdrFillAttribute aFill; + const SdrPage* pCorrectPage = &GetMasterPageDescriptor().GetOwnerPage(); + const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties(); - // build primitive from page fill attributes - const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) + { + pCorrectPage = &GetMasterPageDescriptor().GetUsedPage(); + pCorrectProperties = &pCorrectPage->getSdrPageProperties(); + } + + if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet()) + { + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + pCorrectProperties = 0; + } + + if(pCorrectProperties) + { + // create page fill attributes when correct properties were identified + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index e486f978fafb..b80b6fcbba88 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -203,10 +203,18 @@ namespace sdr } else { - // build primitive from pObject's attributes - const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + drawinglayer::attribute::SdrFillAttribute aFill; + + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + if(rPage.getSdrPageProperties().GetStyleSheet()) + { + // create page fill attributes with correct properties + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute( + rPage.getSdrPageProperties().GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 47c2cccbd02d..392b8e923212 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -57,51 +57,56 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { - const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); + drawinglayer::primitive2d::Primitive2DSequence xRetval; - if(nSubHierarchyCount) + // check model-view visibility + if(isPrimitiveVisible(rDisplayInfo)) { - const sal_Bool bDoGhostedDisplaying( - GetObjectContact().DoVisualizeEnteredGroup() - && !GetObjectContact().isOutputToPrinter() - && GetObjectContact().getActiveViewContact() == &GetViewContact()); + const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); - if(bDoGhostedDisplaying) + if(nSubHierarchyCount) { - rDisplayInfo.ClearGhostedDrawMode(); - } + const sal_Bool bDoGhostedDisplaying( + GetObjectContact().DoVisualizeEnteredGroup() + && !GetObjectContact().isOutputToPrinter() + && GetObjectContact().getActiveViewContact() == &GetViewContact()); - // create object hierarchy - drawinglayer::primitive2d::Primitive2DSequence xRetval(getPrimitive2DSequenceSubHierarchy(rDisplayInfo)); + if(bDoGhostedDisplaying) + { + rDisplayInfo.ClearGhostedDrawMode(); + } - if(xRetval.hasElements()) - { - // get ranges - const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); - const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); - const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); + // create object hierarchy + xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo); - // check geometrical visibility - if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) + if(xRetval.hasElements()) { - // not visible, release - xRetval.realloc(0); + // get ranges + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); + const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); + const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); + + // check geometrical visibility + if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) + { + // not visible, release + xRetval.realloc(0); + } } - } - if(bDoGhostedDisplaying) + if(bDoGhostedDisplaying) + { + rDisplayInfo.SetGhostedDrawMode(); + } + } + else { - rDisplayInfo.SetGhostedDrawMode(); + // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence + // which creates the replacement primitives for an empty group + xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo); } - - return xRetval; - } - else - { - // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence - // which creates the replacement primitives for an empty group - return ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo); } + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx index 8447fe639a28..485afe35f9c1 100755 --- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx @@ -68,10 +68,17 @@ namespace sdr return false; } - // Test if print output but not printable - if(GetObjectContact().isOutputToPrinter() && !rObject.IsPrintable()) + if(GetObjectContact().isOutputToPrinter() ) { - return false; + // Test if print output but not printable + if( !rObject.IsPrintable()) + return false; + } + else + { + // test is object is not visible on screen + if( !rObject.IsVisible() ) + return false; } // Test for hidden object on MasterPage diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 81450d42a50a..3f849e92b462 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -299,10 +299,14 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- void ControlHolder::invalidate() const { - Window* pWindow = VCLUnoHelper::GetWindow( m_xControl->getPeer() ); - OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" ); - if ( pWindow ) - pWindow->Invalidate(); + Reference< XWindowPeer > xPeer( m_xControl->getPeer() ); + if ( xPeer.is() ) + { + Window* pWindow = VCLUnoHelper::GetWindow( xPeer ); + OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" ); + if ( pWindow ) + pWindow->Invalidate(); + } } //-------------------------------------------------------------------- @@ -1310,12 +1314,12 @@ namespace sdr { namespace contact { { // the layer of our object SdrLayerID nObjectLayer = _rUnoObject.GetLayer(); - // is the layer we're residing in visible in this view? - bool bIsObjectLayerVisible = _rPageView.isLayerVisible( nObjectLayer ); + // is the object we're residing in visible in this view? + bool bIsObjectVisible = _rUnoObject.IsVisible() && _rPageView.isLayerVisible( nObjectLayer ); - if ( _bForce || ( bIsObjectLayerVisible != _bIsCurrentlyVisible ) ) + if ( _bForce || ( bIsObjectVisible != _bIsCurrentlyVisible ) ) { - _rControl.setVisible( bIsObjectLayerVisible ); + _rControl.setVisible( bIsObjectVisible ); } } } @@ -1689,6 +1693,9 @@ namespace sdr { namespace contact { if ( !bHadControl && rControl.is() && rControl.isVisible() ) rControl.invalidate(); + if ( !bHadControl && rControl.is() && rControl.isVisible() ) + rControl.invalidate(); + // check if we already have an XControl. if ( !xControlModel.is() || !rControl.is() ) // use the default mechanism. This will create a ControlPrimitive2D without @@ -1863,7 +1870,8 @@ namespace sdr { namespace contact { if(pSdrPageView) { - const bool bIsLayerVisible(pSdrPageView->GetVisibleLayers().IsSet(getSdrObject().GetLayer())); + const SdrObject& rObject = getSdrObject(); + const bool bIsLayerVisible( rObject.IsVisible() && pSdrPageView->GetVisibleLayers().IsSet(rObject.GetLayer())); if(rControl.isVisible() != bIsLayerVisible) { 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/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index ac9b6307dd05..2ceea2c69b7d 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -51,13 +51,11 @@ namespace drawinglayer if(!getSdrLFSTAttribute().getFill().isDefault() && getUnitPolyPolygon().isClosed()) { - // take care for orientations - const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( - basegfx::tools::correctOrientations(getUnitPolyPolygon())); - + // #i108255# no need to use correctOrientations here; target is + // straight visualisation appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aOrientedUnitPolyPolygon, + getUnitPolyPolygon(), getTransform(), getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 15142a86b9cf..0f3325a0027e 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -259,6 +259,8 @@ namespace sdr void AttributeProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) { + OSL_ASSERT(pNewModel!=NULL); + if(pSrcPool && pDestPool && (pSrcPool != pDestPool)) { if(mpItemSet) @@ -281,7 +283,35 @@ namespace sdr // set stylesheet (if used) if(pStySheet) { - ImpAddStyleSheet(pStySheet, sal_True); + // #i109515# + SfxItemPool* pStyleSheetPool = &pStySheet->GetPool().GetPool(); + + if(pStyleSheetPool == pDestPool) + { + // just re-set stylesheet + ImpAddStyleSheet(pStySheet, sal_True); + } + else + { + // StyleSheet is NOT from the correct pool. + // Look one up in the right pool with the same + // name or use the default. + + // Look up the style in the new document. + OSL_ASSERT(pNewModel->GetStyleSheetPool() != NULL); + SfxStyleSheet* pNewStyleSheet = dynamic_cast<SfxStyleSheet*>( + pNewModel->GetStyleSheetPool()->Find( + pStySheet->GetName(), + SFX_STYLE_FAMILY_ALL)); + if (pNewStyleSheet == NULL + || &pNewStyleSheet->GetPool().GetPool() != pDestPool) + { + // There is no copy of the style in the new + // document. Use the default as a fallback. + pNewStyleSheet = pNewModel->GetDefaultStyleSheet(); + } + ImpAddStyleSheet(pNewStyleSheet, sal_True); + } } delete pOldSet; diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index b3a19ecc65bd..0070646b3330 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -35,8 +35,7 @@ #include <vcl/svapp.hxx> #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp> #include <com/sun/star/smarttags/XSmartTagAction.hpp> -#include <com/sun/star/deployment/XPackageManagerFactory.hpp> -#include <com/sun/star/deployment/thePackageManagerFactory.hpp> +#include <com/sun/star/deployment/ExtensionManager.hpp> #include <com/sun/star/text/XTextMarkup.hpp> #include <com/sun/star/smarttags/SmartTagRecognizerMode.hpp> #include <com/sun/star/i18n/XBreakIterator.hpp> @@ -472,11 +471,9 @@ void SmartTagMgr::RegisterListener() // register as listener at package manager try { - Reference<deployment::XPackageManagerFactory> xPackageManagerFactory( - deployment::thePackageManagerFactory::get( mxContext ) ); - Reference<deployment::XPackageManager> xPackageManager( - xPackageManagerFactory->getPackageManager( C2U("user" ) ) ); - Reference< util::XModifyBroadcaster > xMB ( xPackageManager, UNO_QUERY_THROW ); + Reference<deployment::XExtensionManager> xExtensionManager( + deployment::ExtensionManager::get( mxContext ) ); + Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW ); Reference< util::XModifyListener > xListener( this ); xMB->addModifyListener( xListener ); diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src index 4d6b94dd7fc0..004885c45150 100644 --- a/svx/source/src/errtxt.src +++ b/svx/source/src/errtxt.src @@ -26,7 +26,7 @@ ************************************************************************/ #define __RSC -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #include <svtools/sfxecode.hxx> // pragma ---------------------------------------------------------------- diff --git a/svx/source/svdraw/makefile.mk b/svx/source/svdraw/makefile.mk index 0108615b10dd..514c5b6d2cbc 100644 --- a/svx/source/svdraw/makefile.mk +++ b/svx/source/svdraw/makefile.mk @@ -113,8 +113,6 @@ LIB1OBJFILES= \ LIB2TARGET= $(SLB)$/$(TARGET).lib LIB2OBJFILES= \ - $(SLO)$/svdoimp.obj \ - $(SLO)$/svdscrol.obj \ $(SLO)$/ActionDescriptionProvider.obj \ $(SLO)$/impgrfll.obj diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx index 473c09b10f5d..58eef58a9fd6 100644 --- a/svx/source/svdraw/sdrhittesthelper.cxx +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -60,7 +60,7 @@ SdrObject* SdrObjectPrimitiveHit( } else { - if(!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer())) + if( rObject.IsVisible() && (!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer()))) { // single object, 3d object, empty scene or empty group. Check if // it's a single 3D object diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 6bcdd8f55856..67b2de8b693c 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -113,18 +113,6 @@ namespace sdr || &maUsedPage != &rCandidate.maUsedPage || maVisibleLayers != rCandidate.maVisibleLayers); } - - const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const - { - const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); - - if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) - { - return rOwnerPageAtributes; - } - - return GetUsedPage().getSdrPageProperties().GetItemSet(); - } } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index b81e1c0db009..1adddfc29b2b 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -189,6 +189,7 @@ SdrItemPool::SdrItemPool( mppLocalPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrObjMoveProtectItem; mppLocalPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrObjSizeProtectItem; mppLocalPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem; + mppLocalPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem; mppLocalPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem; mppLocalPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; mppLocalPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SdrObjectNameItem; @@ -546,6 +547,7 @@ void SdrItemPool::TakeItemName(sal_uInt16 nWhich, String& rItemName) case SDRATTR_OBJMOVEPROTECT : nResId = SIP_SA_OBJMOVEPROTECT;break; case SDRATTR_OBJSIZEPROTECT : nResId = SIP_SA_OBJSIZEPROTECT;break; case SDRATTR_OBJPRINTABLE : nResId = SIP_SA_OBJPRINTABLE;break; + case SDRATTR_OBJVISIBLE : nResId = SIP_SA_OBJVISIBLE;break; case SDRATTR_LAYERID : nResId = SIP_SA_LAYERID;break; case SDRATTR_LAYERNAME : nResId = SIP_SA_LAYERNAME;break; case SDRATTR_OBJECTNAME : nResId = SIP_SA_OBJECTNAME;break; diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 5e89bfbdb8f5..bc29247891d2 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -805,6 +805,12 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { + // #i110981# return when nothing is to be done at all + if(!GetMarkedObjectCount()) + { + return; + } + // moved breaking action and undo start outside loop BrkAction(); BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 30af84a1aebe..9e149bd8e42d 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -760,6 +760,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH BOOL bMovProtect=FALSE,bMovProtectDC=FALSE; BOOL bSizProtect=FALSE,bSizProtectDC=FALSE; BOOL bPrintable =TRUE ,bPrintableDC=FALSE; + BOOL bVisible = TRUE, bVisibleDC=FALSE; SdrLayerID nLayerId=0; BOOL bLayerDC=FALSE; XubString aObjName; BOOL bObjNameDC=FALSE,bObjNameSet=FALSE; long nSnapPosX=0; BOOL bSnapPosXDC=FALSE; @@ -781,6 +782,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH bMovProtect=pObj->IsMoveProtect(); bSizProtect=pObj->IsResizeProtect(); bPrintable =pObj->IsPrintable(); + bVisible = pObj->IsVisible(); Rectangle aSnapRect2(pObj->GetSnapRect()); Rectangle aLogicRect2(pObj->GetLogicRect()); nSnapPosX=aSnapRect2.Left(); @@ -798,6 +800,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH if (!bMovProtectDC && bMovProtect!=pObj->IsMoveProtect()) bMovProtectDC=TRUE; if (!bSizProtectDC && bSizProtect!=pObj->IsResizeProtect()) bSizProtectDC=TRUE; if (!bPrintableDC && bPrintable !=pObj->IsPrintable()) bPrintableDC=TRUE; + if (!bVisibleDC && bVisible !=pObj->IsVisible()) bVisibleDC=TRUE; if (!bRotAngleDC && nRotAngle !=pObj->GetRotateAngle()) bRotAngleDC=TRUE; if (!bShrAngleDC && nShrAngle !=pObj->GetShearAngle()) bShrAngleDC=TRUE; if (!bSnapWdtDC || !bSnapHgtDC || !bSnapPosXDC || !bSnapPosYDC || !bLogicWdtDiff || !bLogicHgtDiff) { @@ -837,6 +840,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH rAttr.Put(SdrRotateOneItem()); rAttr.Put(SdrHorzShearOneItem()); rAttr.Put(SdrVertShearOneItem()); + if (nMarkAnz>1) { rAttr.Put(SdrResizeXAllItem()); rAttr.Put(SdrResizeYAllItem()); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index c49b0a8aa68f..afb81b5bc6c2 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1090,7 +1090,16 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) if(!bFirstObjectComplete) { - aMergePolyPolygonA = aTmpPoly; + // #i111987# Also need to collect ORed source shape when more than + // a single polygon is involved + if(aMergePolyPolygonA.count()) + { + aMergePolyPolygonA = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonA, aTmpPoly); + } + else + { + aMergePolyPolygonA = aTmpPoly; + } } else { diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 9744e9764488..961c860567f9 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/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 633d82d67816..f10610317578 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -85,6 +85,11 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): bLastObjWasPolyWithoutLine(FALSE),bNoLine(FALSE),bNoFill(FALSE),bLastObjWasLine(FALSE) { aVD.EnableOutput(FALSE); + + // #i111954# init to no fill and no line initially + aVD.SetLineColor(); + aVD.SetFillColor(); + aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST); pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); @@ -380,17 +385,61 @@ void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale ) pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) ); } - aTmpList.InsertObject( pObj ); - if ( HAS_BASE( SdrPathObj, pObj ) ) + // #i111954# check object for visibility + // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj + bool bVisible(false); + + if(pObj->HasLineStyle()) + { + bVisible = true; + } + + if(!bVisible && pObj->HasFillStyle()) + { + bVisible = true; + } + + if(!bVisible) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj); + + if(pTextObj && pTextObj->HasText()) + { + bVisible = true; + } + } + + if(!bVisible) { - FASTBOOL bClosed=pObj->IsClosedObj(); - bLastObjWasPolyWithoutLine=bNoLine && bClosed; - bLastObjWasLine=!bClosed; + SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj); + + if(pGrafObj) + { + // this may be refined to check if the graphic really is visible. It + // is here to ensure that graphic objects without fill, line and text + // get created + bVisible = true; + } + } + + if(!bVisible) + { + SdrObject::Free(pObj); } else { - bLastObjWasPolyWithoutLine = FALSE; - bLastObjWasLine = FALSE; + aTmpList.InsertObject( pObj ); + if ( HAS_BASE( SdrPathObj, pObj ) ) + { + FASTBOOL bClosed=pObj->IsClosedObj(); + bLastObjWasPolyWithoutLine=bNoLine && bClosed; + bLastObjWasLine=!bClosed; + } + else + { + bLastObjWasPolyWithoutLine = FALSE; + bLastObjWasLine = FALSE; + } } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 271c466017d0..791d0f5ca8e7 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 0c29815584c0..bff815a7feb6 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) @@ -1188,6 +1226,10 @@ void SdrMarkView::CheckMarked() } bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) || // Layer gesperrt? !pPV->GetVisibleLayers().IsSet(nLay); // Layer nicht sichtbar? + + if( !bRaus ) + bRaus = !pObj->IsVisible(); // not visible objects can not be marked + if (!bRaus) { // Joe am 9.3.1997: Gruppierte Objekten koennen nun auch // markiert werden. Nach EnterGroup muessen aber die Objekte @@ -1591,7 +1633,7 @@ void SdrMarkView::SetMarkHdlSizePixel(USHORT nSiz) #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const { - if((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) + if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible())) { return NULL; } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 2f255850e811..6a8221136f7c 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -700,7 +700,10 @@ void SdrObjCustomShape::MergeDefaultAttributes( const rtl::OUString* pType ) for ( i = 0; i < nCount; i++ ) { if ( seqAdjustmentValues[ i ].State != com::sun::star::beans::PropertyState_DIRECT_VALUE ) + { seqAdjustmentValues[ i ].Value <<= pDefData[ i ]; + seqAdjustmentValues[ i ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; + } } } aPropVal.Name = sAdjustmentValues; @@ -2075,7 +2078,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() sal_Int32 nXDiff = aBoundRect.Left() - aRect.Left(); sal_Int32 nYDiff = aBoundRect.Top() - aRect.Top(); - if (nShearWink&&(bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX)) + if (nShearWink&&((bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX))) { nShearWink = -nShearWink; fTan = -fTan; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 6e1660761dc0..0a0c35aec524 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -47,9 +47,8 @@ #include <svx/svdpage.hxx> #include <svx/svdovirt.hxx> // Fuer Add/Del Ref #include <svx/svdview.hxx> // fuer Dragging (Ortho abfragen) -#include "svdscrol.hxx" #include "svx/svdglob.hxx" // StringCache -#include "svx/svdstr.hrc" // Objektname +#include <svx/svdstr.hrc> // Objektname #include <svx/svdogrp.hxx> // Factory #include <svx/svdopath.hxx> // Factory #include <svx/svdoedge.hxx> // Factory @@ -75,7 +74,7 @@ #include <svx/xlndsit.hxx> #include <svx/xlnclit.hxx> #include <svx/xflclit.hxx> -#include "svx/svditer.hxx" +#include <svx/svditer.hxx> #include <svx/xlntrit.hxx> #include <svx/xfltrit.hxx> #include <svx/xfltrit.hxx> @@ -121,6 +120,7 @@ #include <svx/sdrhittesthelper.hxx> #include <svx/svdundo.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <svx/sdrobjectfilter.hxx> using namespace ::com::sun::star; @@ -235,6 +235,7 @@ SdrObjGeoData::SdrObjGeoData(): bSizProt(FALSE), bNoPrint(FALSE), bClosedObj(FALSE), + mbVisible(true), mnLayerID(0) { DBG_CTOR(SdrObjGeoData,NULL); @@ -414,6 +415,7 @@ SdrObject::SdrObject() bEmptyPresObj =FALSE; bNotVisibleAsMaster=FALSE; bClosedObj =FALSE; + mbVisible = true; // #i25616# mbLineIsOutsideGeometry = sal_False; @@ -1049,6 +1051,7 @@ void SdrObject::operator=(const SdrObject& rObj) bSizProt=rObj.bSizProt; bMovProt=rObj.bMovProt; bNoPrint=rObj.bNoPrint; + mbVisible=rObj.mbVisible; bMarkProt=rObj.bMarkProt; //EmptyPresObj wird nicht kopiert: nun doch! (25-07-1995, Joe) bEmptyPresObj =rObj.bEmptyPresObj; @@ -1687,6 +1690,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(); @@ -1915,6 +1923,7 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const rGeo.bMovProt =bMovProt ; rGeo.bSizProt =bSizProt ; rGeo.bNoPrint =bNoPrint ; + rGeo.mbVisible =mbVisible ; rGeo.bClosedObj =bClosedObj ; rGeo.mnLayerID = mnLayerID; @@ -1941,6 +1950,7 @@ void SdrObject::RestGeoData(const SdrObjGeoData& rGeo) bMovProt =rGeo.bMovProt ; bSizProt =rGeo.bSizProt ; bNoPrint =rGeo.bNoPrint ; + mbVisible =rGeo.mbVisible ; bClosedObj =rGeo.bClosedObj ; mnLayerID = rGeo.mnLayerID; @@ -2148,6 +2158,11 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr) SetPrintable(b); } + if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,TRUE,&pPoolItem)==SFX_ITEM_SET) { + bool b=((const SdrObjVisibleItem*)pPoolItem)->GetValue(); + SetVisible(b); + } + SdrLayerID nLayer=SDRLAYER_NOTFOUND; if (rAttr.GetItemState(SDRATTR_LAYERID,TRUE,&pPoolItem)==SFX_ITEM_SET) { nLayer=((const SdrLayerIdItem*)pPoolItem)->GetValue(); @@ -2209,6 +2224,7 @@ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const lcl_SetItem(rAttr,bMerge,SdrObjMoveProtectItem(IsMoveProtect())); lcl_SetItem(rAttr,bMerge,SdrObjSizeProtectItem(IsResizeProtect())); lcl_SetItem(rAttr,bMerge,SdrObjPrintableItem(IsPrintable())); + lcl_SetItem(rAttr,bMerge,SdrObjVisibleItem(IsVisible())); lcl_SetItem(rAttr,bMerge,SdrRotateAngleItem(GetRotateAngle())); lcl_SetItem(rAttr,bMerge,SdrShearAngleItem(GetShearAngle())); lcl_SetItem(rAttr,bMerge,SdrOneSizeWidthItem(rSnap.GetWidth()-1)); @@ -2687,11 +2703,29 @@ void SdrObject::SetResizeProtect(sal_Bool bProt) void SdrObject::SetPrintable(sal_Bool bPrn) { - bNoPrint=!bPrn; - SetChanged(); - if (IsInserted() && pModel!=NULL) { - SdrHint aHint(*this); - pModel->Broadcast(aHint); + if( bPrn == bNoPrint ) + { + bNoPrint=!bPrn; + SetChanged(); + if (IsInserted() && pModel!=NULL) + { + SdrHint aHint(*this); + pModel->Broadcast(aHint); + } + } +} + +void SdrObject::SetVisible(sal_Bool bVisible) +{ + if( bVisible != mbVisible ) + { + mbVisible = bVisible; + SetChanged(); + if (IsInserted() && pModel!=NULL) + { + SdrHint aHint(*this); + pModel->Broadcast(aHint); + } } } @@ -3266,4 +3300,11 @@ void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink) rLL.RemoveLink(rLink); } +namespace svx +{ + ISdrObjectFilter::~ISdrObjectFilter() + { + } +} + // eof diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 67d01159a72d..ba300c74da6d 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -239,8 +239,9 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c else { // mirror start, end for geometry creation since model coordinate system is mirrored in Y - const double fStart(((36000 - nEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nStart) % 36000) * F_PI18000); + // #i111715# increase numerical correctness by first dividing and not using F_PI1800 + const double fStart((((36000 - nEnd) % 36000) / 18000.0) * F_PI); + const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI); // create circle segment. This is not closed by default aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment( diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 027cca425437..c7bbc5fab761 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1674,6 +1674,11 @@ void SdrEdgeObj::SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly ) *pEdgeTrack = XPolygon( rPoly.getB2DPolygon( 0 ) ); bEdgeTrackDirty = sal_False; bEdgeTrackUserDefined = sal_True; + + // #i110629# also set aRect and maSnapeRect dependent from pEdgeTrack + const Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect()); + aRect = aPolygonBounds; + maSnapRect = aPolygonBounds; } } @@ -2100,7 +2105,7 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, // Problem: Gruppenobjekt mit verschiedenen Layern liefert LayerID 0 !!!! no--; SdrObject* pObj=pOL->GetObj(no); - if (rVisLayer.IsSet(pObj->GetLayer()) && // nur sichtbare Objekte + if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() && // only visible objects (pThis==NULL || pObj!=(SdrObject*)pThis) && // nicht an mich selbst connecten pObj->IsNode()) { @@ -2206,17 +2211,31 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect) { - Rectangle aOld(GetSnapRect()); - long nMulX = rRect.Right() - rRect.Left(); - long nDivX = aOld.Right() - aOld.Left(); - long nMulY = rRect.Bottom() - rRect.Top(); - long nDivY = aOld.Bottom() - aOld.Top(); - if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } - if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } - Fraction aX(nMulX, nDivX); - Fraction aY(nMulY, nDivY); - NbcResize(aOld.TopLeft(), aX, aY); - NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + const Rectangle aOld(GetSnapRect()); + + if(aOld != rRect) + { + if(aRect.IsEmpty() && 0 == pEdgeTrack->GetPointCount()) + { + // #i110629# When initializing, do not scale on empty Rectangle; this + // will mirror the underlying text object (!) + aRect = rRect; + maSnapRect = rRect; + } + else + { + long nMulX = rRect.Right() - rRect.Left(); + long nDivX = aOld.Right() - aOld.Left(); + long nMulY = rRect.Bottom() - rRect.Top(); + long nDivY = aOld.Bottom() - aOld.Top(); + if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } + if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } + Fraction aX(nMulX, nDivX); + Fraction aY(nMulY, nDivY); + NbcResize(aOld.TopLeft(), aX, aY); + NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + } + } } void SdrEdgeObj::NbcMove(const Size& rSiz) diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index c9686eecb7db..e341a99d656b 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/svdoimp.cxx b/svx/source/svdraw/svdoimp.cxx deleted file mode 100644 index 7b7fa2652017..000000000000 --- a/svx/source/svdraw/svdoimp.cxx +++ /dev/null @@ -1,33 +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 <svdoimp.hxx> - -/////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index fbce08fdfaa8..8d360e67bed0 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 "svx/svdglob.hxx" #include "svx/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/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 4973388ea6d4..216783663603 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1714,8 +1714,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() if ( pClient || bHasOwnClient ) { // TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA) - if ( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && - svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) + if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) && + svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() )) || xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE ) { @@ -1832,11 +1832,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract // if the object needs recompose on resize // the client site should be created before the resize will take place // check whether there is no client site and create it if necessary - if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() ) - && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) - { - AddOwnLightClient(); - } + AddOwnLightClient(); } } @@ -2197,26 +2193,32 @@ sal_Bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScal sal_Bool SdrOle2Obj::AddOwnLightClient() { // The Own Light Client must be registered in object only using this method! - Connect(); - - if ( xObjRef.is() && mpImpl->pLightClient ) + if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() ) + && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) { - Fraction aScaleWidth; - Fraction aScaleHeight; - Size aObjAreaSize; - if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) + Connect(); + + if ( xObjRef.is() && mpImpl->pLightClient ) { - mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); - try { - xObjRef->setClientSite( mpImpl->pLightClient ); - return sal_True; - } catch( uno::Exception& ) - {} + Fraction aScaleWidth; + Fraction aScaleHeight; + Size aObjAreaSize; + if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) ) + { + mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight ); + try { + xObjRef->setClientSite( mpImpl->pLightClient ); + return sal_True; + } catch( uno::Exception& ) + {} + } + } + return sal_False; } - return sal_False; + return sal_True; } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index dad8c1f205e3..7b9185ca7d3b 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -35,7 +35,6 @@ #include <svx/svdpage.hxx> // und fuer AnimationHandler (Laufschrift) #include <svx/svdetc.hxx> #include <svx/svdoutl.hxx> -#include "svdscrol.hxx" // fuer Laufschrift #include <svx/svdmodel.hxx> // OutlinerDefaults #include "svx/svdglob.hxx" // Stringcache #include "svx/svdstr.hrc" // Objektname diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 639f4382a572..178af85d2cf4 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -107,15 +107,13 @@ namespace maLocale(rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale()), mbRTL(rInfo.mrFont.IsVertical() ? false : rInfo.IsRTL()) { - if(mnTextLength) + if(mnTextLength && rInfo.mpDXArray) { maDblDXArray.reserve(mnTextLength); - const sal_Int32 nFontWidth(0L == maFont.GetWidth() ? maFont.GetHeight() : maFont.GetWidth()); - const double fScaleFactor(0L != nFontWidth ? 1.0 / (double)nFontWidth : 1.0); for(xub_StrLen a(0); a < mnTextLength; a++) { - maDblDXArray.push_back((double)rInfo.mpDXArray[a] * fScaleFactor); + maDblDXArray.push_back((double)rInfo.mpDXArray[a]); } } } @@ -291,7 +289,8 @@ namespace const double fPolyLength(basegfx::tools::getLength(aPolygonCandidate)); double fPolyEnd(fPolyLength); double fPolyStart(0.0); - double fScaleFactor(1.0); + double fAutosizeScaleFactor(1.0); + bool bAutosizeScale(false); if(maSdrFormTextAttribute.getFormTextMirror()) { @@ -352,7 +351,8 @@ namespace // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) { - fScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + fAutosizeScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + bAutosizeScale = true; } } } @@ -382,10 +382,10 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand portion length - fPortionLength *= fScaleFactor; + // when autosize scaling, expand portion length + fPortionLength *= fAutosizeScaleFactor; } // create transformation @@ -397,10 +397,10 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand text primitive scaling - aNewTransformA.scale(fScaleFactor, fScaleFactor); + // when autosize scaling, expand text primitive scaling to it + aNewTransformA.scale(fAutosizeScaleFactor, fAutosizeScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition @@ -497,17 +497,42 @@ namespace aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } - // shadow primitive creation - if(bShadow) + if(pCandidate->getText().Len() && nNextGlyphLen) { - if(pCandidate->getText().Len() && nNextGlyphLen) + const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); + ::std::vector< double > aNewDXArray; + + if(nNextGlyphLen > 1 && pCandidate->getDoubleDXArray().size()) { + // copy DXArray for portion + aNewDXArray.insert( + aNewDXArray.begin(), + pCandidate->getDoubleDXArray().begin() + nPortionIndex, + pCandidate->getDoubleDXArray().begin() + (nPortionIndex + nNextGlyphLen)); + + if(nPortionIndex > 0) + { + // adapt to portion start + double fDXOffset= *(pCandidate->getDoubleDXArray().begin() + (nPortionIndex - 1)); + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::minus<double>(), fDXOffset)); + } + + if(bAutosizeScale) + { + // when autosize scaling, adapt to DXArray, too + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::multiplies<double>(), fAutosizeScaleFactor)); + } + } + + if(bShadow) + { + // shadow primitive creation const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( @@ -522,30 +547,25 @@ namespace mrShadowDecomposition.push_back(pNew); } - } - // primitive creation - if(pCandidate->getText().Len() && nNextGlyphLen) - { - const Color aColor(pCandidate->getFont().GetColor()); - const basegfx::BColor aRGBColor(aColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); - - drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aNewTransformB * aNewTransformA, - pCandidate->getText(), - nPortionIndex, - nNextGlyphLen, - aNewDXArray, - aCandidateFontAttribute, - pCandidate->getLocale(), - aRGBColor); - - mrDecomposition.push_back(pNew); + { + // primitive creation + const Color aColor(pCandidate->getFont().GetColor()); + const basegfx::BColor aRGBColor(aColor.getBColor()); + + drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransformB * aNewTransformA, + pCandidate->getText(), + nPortionIndex, + nNextGlyphLen, + aNewDXArray, + aCandidateFontAttribute, + pCandidate->getLocale(), + aRGBColor); + + mrDecomposition.push_back(pNew); + } } // consume from portion // no += here, xub_StrLen is USHORT and the compiler will gererate a warning here diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx index e4b27766a265..79e74a3382b8 100644 --- a/svx/source/svdraw/svdoutl.cxx +++ b/svx/source/svdraw/svdoutl.cxx @@ -125,5 +125,8 @@ XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, const SdrTextObj* SdrOutliner::GetTextObj() const { - return static_cast< SdrTextObj* >( mpTextObj.get() ); + if( mpTextObj.is() ) + return static_cast< SdrTextObj* >( mpTextObj.get() ); + else + return 0; } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 872d88bc180b..f388e91c4556 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1221,18 +1221,6 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } } -SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: SfxListener(), - mpSdrPage(rCandidate.mpSdrPage), - mpStyleSheet(0), - mpProperties(new SfxItemSet(*rCandidate.mpProperties)) -{ - if(rCandidate.GetStyleSheet()) - { - ImpAddStyleSheet(*rCandidate.GetStyleSheet()); - } -} - SdrPageProperties::~SdrPageProperties() { ImpRemoveStyleSheet(); @@ -1365,6 +1353,8 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) // Warning: this leads to slicing (see issue 93186) and has to be // removed as soon as possible. *this = rSrcPage; + OSL_ENSURE(mpSdrPageProperties, + "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)"); // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrOIbjList::operator= before... @@ -1382,8 +1372,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } - - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } SdrPage::~SdrPage() @@ -1478,8 +1466,28 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; { - delete mpSdrPageProperties; - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + // #i111122# delete SdrPageProperties when model is different + if(mpSdrPageProperties && GetModel() != rSrcPage.GetModel()) + { + delete mpSdrPageProperties; + mpSdrPageProperties = 0; + } + + if(!mpSdrPageProperties) + { + mpSdrPageProperties = new SdrPageProperties(*this); + } + else + { + mpSdrPageProperties->ClearItem(0); + } + + if(!IsMasterPage()) + { + mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet()); + } + + mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet()); } // Now copy the contained obejcts (by cloning them) @@ -1659,7 +1667,17 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + // create new SdrPageProperties with new model (due to SfxItemSet there) + // and copy ItemSet and StyleSheet + SdrPageProperties *pNew = new SdrPageProperties(*this); + + if(!IsMasterPage()) + { + pNew->PutItemSet(getSdrPageProperties().GetItemSet()); + } + + pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet()); + delete mpSdrPageProperties; mpSdrPageProperties = pNew; } diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index c594813f4292..6e852e72017a 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -754,6 +754,12 @@ sal_Bool SdrPageView::IsObjMarkable(SdrObject* pObj) const return sal_False; } + // only visible are markable + if( !pObj->IsVisible() ) + { + return sal_False; + } + // #112440# if(pObj->ISA(SdrObjGroup)) { diff --git a/svx/source/svdraw/svdscrol.hxx b/svx/source/svdraw/svdscrol.hxx deleted file mode 100644 index f44cf3d81c65..000000000000 --- a/svx/source/svdraw/svdscrol.hxx +++ /dev/null @@ -1,31 +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 _SVDSCROL_HXX -#define _SVDSCROL_HXX - -#endif //_SVDSCROL_HXX diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index ce024291241b..5125d8f099a9 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -2395,6 +2395,11 @@ String SIP_SA_OBJPRINTABLE Text [ en-US ] = "Object, printable"; }; +String SIP_SA_OBJVISIBLE +{ + Text [ en-US ] = "Object, visible"; +}; + String SIP_SA_LAYERID { Text [ en-US ] = "Level ID"; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 960c440d5973..1320aef9b17b 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 71e48ff06cb0..7f9250a90561 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 45a53ee7758a..e5bc5045c7b3 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -32,9 +32,15 @@ #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 <svtools/toolbarmenu.hxx> #include <vcl/toolbox.hxx> -#endif #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -42,30 +48,35 @@ #include <vcl/settings.hxx> #include <svl/intitem.hxx> #include <editeng/colritem.hxx> -#include "svx/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/extrusioncontrols.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 +86,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 +105,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 +123,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 +176,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 +228,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 +253,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 +337,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 +411,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 +451,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 +471,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 +479,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 +503,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 +517,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 +608,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 +633,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 +656,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 +693,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 +732,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 +752,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 +777,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 +791,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 +917,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 +932,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 +1048,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 c1dd5443e610..23f2241ab235 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 <svx/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 "svx/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 "svx/fontworkgallery.hxx" +#include "svx/gallery.hxx" +#include <svx/dlgutil.hxx> + +#include <svx/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..73a178d97594 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 @@ -62,7 +61,8 @@ LIB2OBJFILES= \ $(SLO)$/verttexttbxctrl.obj \ $(SLO)$/subtoolboxcontrol.obj \ $(SLO)$/tbxcolor.obj \ - $(SLO)$/tbunocontroller.obj + $(SLO)$/tbunocontroller.obj \ + $(SLO)$/tbunosearchcontrollers.obj SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx new file mode 100644 index 000000000000..f4f03170a90f --- /dev/null +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -0,0 +1,867 @@ +/************************************************************************* + * + * 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 "tbunosearchcontrollers.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/util/URL.hpp> + +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> + +namespace svx +{ + +static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::createFromAscii("SearchItem.SearchString"); +static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward"); + +static const ::rtl::OUString COMMAND_EXECUTESEARCH = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); +static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ; +static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch"); +static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ; +static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory"); + +static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"); +static const sal_Int32 REMEMBER_SIZE = 10; + +void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) +{ + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); + if ( xURLTransformer.is() ) + { + css::util::URL aURL; + aURL.Complete = COMMAND_EXECUTESEARCH; + xURLTransformer->parseStrict(aURL); + + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + { + css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + if ( xDispatch.is() && aURL.Complete.getLength() > 0 ) + xDispatch->dispatch( aURL, lArgs ); + } + } +} + +FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) : + ComboBox( pParent, nStyle ), + m_xFrame(xFrame), + m_xServiceManager(xServiceManager), + m_bToClearTextField(sal_True) +{ + InitControls_Impl(); +} + +FindTextFieldControl::~FindTextFieldControl() +{ +} + +void FindTextFieldControl::InitControls_Impl() +{ + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + + EnableAutocomplete(TRUE, TRUE); +} + +void FindTextFieldControl::Remember_Impl(const String& rStr) +{ + USHORT nCount = GetEntryCount(); + + for (USHORT i=0; i<nCount; ++i) + { + if ( rStr == GetEntry(i)) + return; + } + + if (nCount == REMEMBER_SIZE) + RemoveEntry(REMEMBER_SIZE-1); + + InsertEntry(rStr, 0); +} + +void FindTextFieldControl::Modify() +{ + ComboBox::Modify(); + + SetControlForeground( Color( COL_BLACK ) ); +} + +long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) +{ + long nRet= ComboBox::PreNotify( rNEvt ); + + switch ( rNEvt.GetType() ) + { + case EVENT_KEYINPUT: + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); + sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); + sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); + sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); + + if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) + GrabFocusToDocument(); + + if ( KEY_RETURN == nCode ) + { + Remember_Impl(GetText()); + + ::rtl::OUString sFindText = GetText(); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + if (bShift) + lArgs[1].Value <<= sal_True; + else + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + } + break; + } + + case EVENT_GETFOCUS: + if ( m_bToClearTextField ) + { + SetText( String() ); + m_bToClearTextField = sal_False; + } + SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); + break; + + case EVENT_LOSEFOCUS: + if ( GetText().Len() == 0 ) + { + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + m_bToClearTextField = sal_True; + } + break; + } + + return nRet; +} + + +//----------------------------------------------------------------------------------------------------------- +// SearchToolbarControllersManager + +SearchToolbarControllersManager* SearchToolbarControllersManager::m_pInstance = 0; + +SearchToolbarControllersManager::SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager::~SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager* SearchToolbarControllersManager::createControllersManager() +{ + if (!m_pInstance) + m_pInstance = new SearchToolbarControllersManager(); + + return m_pInstance; +} + +void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt == aSearchToolbarControllersMap.end()) + { + SearchToolbarControllersVec lControllers(1); + lControllers[0].Name = sCommandURL; + lControllers[0].Value <<= xStatusListener; + aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers)); + } + else + { + sal_Int32 nSize = pIt->second.size(); + for (sal_Int32 i=0; i<nSize; ++i) + { + if (pIt->second[i].Name.equals(sCommandURL)) + return; + } + + pIt->second.resize(nSize+1); + pIt->second[nSize].Name = sCommandURL; + pIt->second[nSize].Value <<= xStatusListener; + } +} + +void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pIt->second.erase(pItCtrl); + break; + } + } + + if (pIt->second.empty()) + aSearchToolbarControllersMap.erase(pIt); + } +} + +css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ) +{ + css::uno::Reference< css::frame::XStatusListener > xStatusListener; + + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pItCtrl->Value >>= xStatusListener; + break; + } + } + } + + return xStatusListener; +} + +//----------------------------------------------------------------------------------------------------------- +// FindTextToolbarController + +FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_FINDTEXT ) +{ +} + +FindTextToolbarController::~FindTextToolbarController() +{ +} + +// XInterface +css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL FindTextToolbarController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL FindTextToolbarController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); + delete m_pFindTextFieldControl; + m_pFindTextFieldControl = 0; +} + +// XInitialization +void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException) +{ + svt::ToolboxController::initialize(aArguments); + + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) ) + m_nDownSearchId = i; + else if (sItemCommand.equals( COMMAND_UPSEARCH )) + m_nUpSearchId = i; + } + } + + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ +} + +css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ) +{ + css::uno::Reference< css::awt::XWindow > xItemWindow; + + css::uno::Reference< css::awt::XWindow > xParent( Parent ); + Window* pParent = VCLUnoHelper::GetWindow( xParent ); + if ( pParent ) + { + ToolBox* pToolbar = ( ToolBox* )pParent; + m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); + + Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200); + m_pFindTextFieldControl->SetSizePixel( aSize ); + m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); + } + xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); + + return xItemWindow; +} + +// XStatusListener +void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; + + ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete; + if (aFeatureURL.equalsAscii("AppendSearchHistory")) + { + m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText()); + } +} + +IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) +{ + // enable or disable item DownSearch/UpSearch of findbar + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox && m_pFindTextFieldControl ) + { + if (m_pFindTextFieldControl->GetText().Len()>0) + { + if ( !pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_True); + if ( !pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_True); + } + else + { + if ( pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_False); + if ( pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_False); + } + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------- +// class DownSearchToolboxController + +DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + : svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_DOWNSEARCH ) +{ +} + +DownSearchToolboxController::~DownSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL DownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL DownSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL DownSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL DownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL DownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL DownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; +} + +// XComponent +void SAL_CALL DownSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL DownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); +} + +// XStatusListener +void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; +} + +//----------------------------------------------------------------------------------------------------------- +// class UpSearchToolboxController + +UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + COMMAND_UPSEARCH ) +{ +} + +UpSearchToolboxController::~UpSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL UpSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL UpSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL UpSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL UpSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL UpSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL UpSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL UpSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL UpSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_True; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) + xStatusListener->statusChanged( aEvent ); +} + +// XStatusListener +void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; +} + +//----------------------------------------------------------------------------------------------------------- +// class FindbarDispatcher + +FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory) + : m_xFactory( xFactory ) +{ +} + +FindbarDispatcher::~FindbarDispatcher() +{ + m_xFactory = NULL; + m_xFrame = NULL; +} + +// XInterface +css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ) +{ + css::uno::Any aReturn( ::cppu::queryInterface( aType, + static_cast< css::lang::XServiceInfo* >(this), + static_cast< css::lang::XInitialization* >(this), + static_cast< css::frame::XDispatchProvider* >(this), + static_cast< css::frame::XDispatch* >(this)) ); + + if ( aReturn.hasValue() ) + return aReturn; + + return OWeakObject::queryInterface( aType ); +} + +void SAL_CALL FindbarDispatcher::acquire() throw() +{ + OWeakObject::acquire(); +} + +void SAL_CALL FindbarDispatcher::release() throw() +{ + OWeakObject::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + return ( + ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") || + ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler") + ); +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" )); + aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" )); + return aSNS; +} + +// XInitialization +void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + if ( aArguments.getLength() ) + aArguments[0] >>= m_xFrame; +} + +// XDispatchProvider +css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException ) +{ + css::uno::Reference< css::frame::XDispatch > xDispatch; + + if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") ) + xDispatch = this; + + return xDispatch; +} + +css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ) +{ + sal_Int32 nCount = seqDescripts.getLength(); + css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount ); + + for( sal_Int32 i=0; i<nCount; ++i ) + lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags ); + + return lDispatcher; +} + +// XDispatch +void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException ) +{ + //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar + if ( aURL.Path.equalsAscii("FocusToFindbar") ) + { + css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); + if(!xPropSet.is()) + return; + + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); + aValue >>= xLayoutManager; + if (!xLayoutManager.is()) + return; + + const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar"); + css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); + if (!xUIElement.is()) + return; + + css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; i<nItemCount; ++i ) + { + ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); + if ( sItemCommand.equalsAscii(".uno:FindText") ) + { + Window* pItemWin = pToolBox->GetItemWindow( i ); + if ( pItemWin ) + { + pItemWin->GrabFocus(); + return; + } + } + } + } + + } +} + +void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +//----------------------------------------------------------------------------------------------------------- +// create Instance + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindTextToolbarController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new DownSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new UpSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindbarDispatcher( rSMgr ); +} + +//----------------------------------------------------------------------------------------------------------- +} 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 cf1c7dd50e3e..74a00bd431c6 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -53,7 +53,8 @@ #include "svx/chrtitem.hxx" #include <svx/extrusionbar.hxx> -#include "svx/extrusioncontrols.hxx" +#include "extrusiondepthdialog.hxx" + using namespace ::svx; using namespace ::rtl; diff --git a/svx/source/unodialogs/textconversiondlgs/export.map b/svx/source/unodialogs/textconversiondlgs/export.map deleted file mode 100644 index ff4971857d69..000000000000 --- a/svx/source/unodialogs/textconversiondlgs/export.map +++ /dev/null @@ -1,8 +0,0 @@ -EXTDBI_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svx/source/unodialogs/textconversiondlgs/makefile.mk b/svx/source/unodialogs/textconversiondlgs/makefile.mk index 6cdec3906c9a..b5013ca9d165 100644 --- a/svx/source/unodialogs/textconversiondlgs/makefile.mk +++ b/svx/source/unodialogs/textconversiondlgs/makefile.mk @@ -59,7 +59,7 @@ SHL1TARGET= txcnvdlg .ELSE SHL1TARGET= $(TARGET)$(DLLPOSTFIX) .ENDIF -SHL1VERSIONMAP= export.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1STDLIBS= \ $(CPPULIB) \ diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 31e8dbc49c35..8e782eef8347 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -39,6 +39,7 @@ #include "recoveryui.hxx" #include "svx/xmlgrhlp.hxx" #include "tbunocontroller.hxx" +#include "tbunosearchcontrollers.hxx" using namespace ::com::sun::star; using namespace ::rtl; @@ -233,9 +234,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 +243,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,10 +287,14 @@ 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, svx::FindTextToolbarController::getImplementationName_Static(), svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::DownSearchToolboxController::getImplementationName_Static(), svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::UpSearchToolboxController::getImplementationName_Static(), svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::FindbarDispatcher::getImplementationName_Static(), svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); // XPrimitiveFactory2D @@ -292,6 +304,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 +351,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 +358,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 ), @@ -354,6 +365,34 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::FontHeightToolBoxControl_createInstance, svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); } + else if ( svx::FindTextToolbarController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindTextToolbarController::getImplementationName_Static(), + svx::FindTextToolbarController_createInstance, + svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + } + else if ( svx::DownSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::DownSearchToolboxController::getImplementationName_Static(), + svx::DownSearchToolboxController_createInstance, + svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::UpSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::UpSearchToolboxController::getImplementationName_Static(), + svx::UpSearchToolboxController_createInstance, + svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindbarDispatcher::getImplementationName_Static(), + svx::FindbarDispatcher_createInstance, + svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + } else if( ::unogallery::GalleryThemeProvider_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -385,7 +424,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 294d621b8ff8..a905aa0fd2f4 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/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index b682d19dd1af..1116501414cf 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -478,6 +478,7 @@ SfxItemPropertyMapEntry* ImplGetSvxOle2PropertyMap() { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 }, { MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("EmbeddedObject"), OWN_ATTR_OLE_EMBEDDED_OBJECT , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN("EmbeddedObjectNoNewClient"),OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("OriginalSize"), OWN_ATTR_OLESIZE , &::getCppuType(( const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("CLSID"), OWN_ATTR_CLSID , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 }, { MAP_CHAR_LEN("IsInternal"), OWN_ATTR_INTERNAL_OLE , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 5085dd72fe57..79d5b7c5dec9 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -355,22 +355,26 @@ bool SvxOle2Shape::getPropertyValueImpl( const ::rtl::OUString& rName, const Sfx case OWN_ATTR_OLEMODEL: case OWN_ATTR_OLE_EMBEDDED_OBJECT: + case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT: { SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( mpObj.get() ); if( pObj ) { uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() ); if ( xObj.is() - && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) ) + && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) ) { // Discussed with CL fue to the before GetPaintingPageView // usage. Removed it, former fallback is used now + if ( pProperty->nWID == OWN_ATTR_OLEMODEL || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT ) + { #ifdef DBG_UTIL - const sal_Bool bSuccess(pObj->AddOwnLightClient()); - OSL_ENSURE( bSuccess, "An object without client is provided!" ); + const sal_Bool bSuccess(pObj->AddOwnLightClient()); + OSL_ENSURE( bSuccess, "An object without client is provided!" ); #else - pObj->AddOwnLightClient(); + pObj->AddOwnLightClient(); #endif + } if ( pProperty->nWID == OWN_ATTR_OLEMODEL ) rValue <<= pObj->GetObjRef()->getComponent(); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 99a378f0ceb4..17b9b6c3326e 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -577,6 +577,37 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw() } //---------------------------------------------------------------------- +// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051 +void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() +{ + DBG_TESTSOLARMUTEX(); + if(mpModel) + { + SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + basegfx::B2DHomMatrix aTransform; + const double fMMToTWIPS(72.0 / 127.0); + + aTransform.scale(fMMToTWIPS, fMMToTWIPS); + rPolyPolygon.transform(aTransform); + break; + } + default: + { + DBG_ERROR("Missing unit translation to PoolMetric!"); + } + } + } + } +} +// <-- + +//---------------------------------------------------------------------- void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() { DBG_TESTSOLARMUTEX(); @@ -604,6 +635,38 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() } //---------------------------------------------------------------------- +// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051 +void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() +{ + DBG_TESTSOLARMUTEX(); + SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM; + if(mpModel) + { + eMapUnit = mpModel->GetItemPool().GetMetric(0); + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + switch(eMapUnit) + { + case SFX_MAPUNIT_TWIP : + { + basegfx::B2DHomMatrix aTransform; + const double fTWIPSToMM(127.0 / 72.0); + aTransform.scale(fTWIPSToMM, fTWIPSToMM); + rPolyPolygon.transform(aTransform); + break; + } + default: + { + DBG_ERROR("Missing unit translation to 100th mm!"); + } + } + } + } +} +// <-- +//---------------------------------------------------------------------- + + //---------------------------------------------------------------------- void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet, SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap ) @@ -635,7 +698,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& { if(rSet.GetPool()->IsWhich(pEntry->nWID)) rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID)); - // setzen SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet); } @@ -650,7 +712,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& } - void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet) { DBG_TESTSOLARMUTEX(); @@ -2505,10 +2566,15 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( rValue >>= aUnoPoint ) { Point aPoint( aUnoPoint.X, aUnoPoint.Y ); + + // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051 + // perform metric change before applying anchor position, + // because the anchor position is in pool metric. + ForceMetricToItemPoolMetric( aPoint ); + // <-- if( mpModel->IsWriter() ) aPoint += mpObj->GetAnchorPos(); - ForceMetricToItemPoolMetric( aPoint ); pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint ); return true; } @@ -2532,6 +2598,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if ( rValue >>= aPolyPoly ) { basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) ); + // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051 + ForceMetricToItemPoolMetric( aNewPolyPolygon ); + // <-- if( mpModel->IsWriter() ) { Point aPoint( mpObj->GetAnchorPos() ); @@ -2554,6 +2623,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper { Point aPoint( aUnoPoint.X, aUnoPoint.Y ); + // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051 + ForceMetricToItemPoolMetric( aPoint ); + // <-- if( mpModel->IsWriter() ) aPoint += mpObj->GetAnchorPos(); @@ -2699,6 +2771,16 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper } break; } + case SDRATTR_OBJVISIBLE: + { + sal_Bool bVisible = sal_Bool(); + if( rValue >>= bVisible ) + { + mpObj->SetVisible(bVisible); + return true; + } + break; + } case SDRATTR_OBJSIZEPROTECT: { sal_Bool bResizeProtect = sal_Bool(); @@ -2970,6 +3052,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper Point aPoint( mpObj->GetAnchorPos() ); aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y())); } + // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051 + ForceMetricTo100th_mm( aPolyPoly ); + // <-- drawing::PolyPolygonBezierCoords aRetval; SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval); rValue <<= aRetval; @@ -2990,6 +3075,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper if( mpModel->IsWriter() ) aPoint -= mpObj->GetAnchorPos(); + // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051 + ForceMetricTo100th_mm( aPoint ); + // <-- awt::Point aUnoPoint( aPoint.X(), aPoint.Y() ); rValue <<= aUnoPoint; @@ -3069,11 +3157,15 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper } case SDRATTR_OBJPRINTABLE: - rValue = uno::makeAny( (sal_Bool) mpObj->IsPrintable() ); + rValue <<= static_cast<sal_Bool>( mpObj->IsPrintable() ); + break; + + case SDRATTR_OBJVISIBLE: + rValue <<= static_cast<sal_Bool>( mpObj->IsVisible() ); break; case SDRATTR_OBJSIZEPROTECT: - rValue = uno::makeAny( (sal_Bool)mpObj->IsResizeProtect() ); + rValue <<= static_cast<sal_Bool>( mpObj->IsResizeProtect() ); break; case OWN_ATTR_PAGE_NUMBER: diff --git a/svx/uiconfig/accelerator/default.xml b/svx/uiconfig/accelerator/default.xml deleted file mode 100644 index dafd9e022f12..000000000000 --- a/svx/uiconfig/accelerator/default.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> - <accel:item accel:code="KEY_S" accel:shift="true" accel:mod1="true" xlink:href=".uno:SaveAs"/> - <accel:item accel:code="KEY_Y" accel:shift="true" accel:mod1="true" xlink:href=".uno:Repeat"/> -</accel:acceleratorlist> diff --git a/svx/uiconfig/accelerator/en-US/default.xml b/svx/uiconfig/accelerator/en-US/default.xml deleted file mode 100644 index 67a6e9127c8a..000000000000 --- a/svx/uiconfig/accelerator/en-US/default.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> - <accel:item accel:code="KEY_Q" accel:mod1="true" xlink:href=".uno:Quit"/> - <accel:item accel:code="KEY_N" accel:shift="true" accel:mod1="true" xlink:href=".uno:NewDoc"/> - <accel:item accel:code="KEY_O" accel:mod1="true" xlink:href=".uno:Open"/> - <accel:item accel:code="KEY_OPEN" xlink:href=".uno:Open"/> - <accel:item accel:code="KEY_P" accel:mod1="true" xlink:href=".uno:Print"/> - <accel:item accel:code="KEY_S" accel:mod1="true" xlink:href=".uno:Save"/> - <accel:item accel:code="KEY_N" accel:mod1="true" xlink:href=".uno:AddDirect"/> - <accel:item accel:code="KEY_W" accel:mod1="true" xlink:href=".uno:CloseWin"/> - <accel:item accel:code="KEY_F4" accel:mod1="true" xlink:href=".uno:CloseWin"/> - <accel:item accel:code="KEY_X" accel:mod1="true" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_DELETE" accel:shift="true" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_CUT" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_C" accel:mod1="true" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_INSERT" accel:mod1="true" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_COPY" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_V" accel:mod1="true" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_INSERT" accel:shift="true" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_PASTE" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_DELETE" xlink:href=".uno:Delete"/> - <accel:item accel:code="KEY_A" accel:mod1="true" xlink:href=".uno:SelectAll"/> - <accel:item accel:code="KEY_F" accel:mod1="true" xlink:href=".uno:SearchDialog"/> - <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> - <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> - <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> - <accel:item accel:code="KEY_F11" accel:mod2="true" xlink:href=".uno:MacroDialog"/> -</accel:acceleratorlist> diff --git a/svx/uiconfig/accelerator/es/default.xml b/svx/uiconfig/accelerator/es/default.xml deleted file mode 100644 index 71ba6212d275..000000000000 --- a/svx/uiconfig/accelerator/es/default.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink"> - <accel:item accel:code="KEY_Q" accel:mod1="true" xlink:href=".uno:Quit"/> - <accel:item accel:code="KEY_N" accel:shift="true" accel:mod1="true" xlink:href=".uno:NewDoc"/> - <accel:item accel:code="KEY_A" accel:mod1="true" xlink:href=".uno:Open"/> - <accel:item accel:code="KEY_OPEN" xlink:href=".uno:Open"/> - <accel:item accel:code="KEY_P" accel:mod1="true" xlink:href=".uno:Print"/> - <accel:item accel:code="KEY_G" accel:mod1="true" xlink:href=".uno:Save"/> - <accel:item accel:code="KEY_U" accel:mod1="true" xlink:href=".uno:AddDirect"/> - <accel:item accel:code="KEY_W" accel:mod1="true" xlink:href=".uno:CloseWin"/> - <accel:item accel:code="KEY_F4" accel:mod1="true" xlink:href=".uno:CloseWin"/> - <accel:item accel:code="KEY_X" accel:mod1="true" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_DELETE" accel:shift="true" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_CUT" xlink:href=".uno:Cut"/> - <accel:item accel:code="KEY_C" accel:mod1="true" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_INSERT" accel:mod1="true" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_COPY" xlink:href=".uno:Copy"/> - <accel:item accel:code="KEY_V" accel:mod1="true" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_INSERT" accel:shift="true" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_PASTE" xlink:href=".uno:Paste"/> - <accel:item accel:code="KEY_DELETE" xlink:href=".uno:Delete"/> - <accel:item accel:code="KEY_E" accel:mod1="true" xlink:href=".uno:SelectAll"/> - <accel:item accel:code="KEY_B" accel:mod1="true" xlink:href=".uno:SearchDialog"/> - <accel:item accel:code="KEY_Q" accel:shift="true" accel:mod1="true" xlink:href=".uno:BasicBreak"/> - <accel:item accel:code="KEY_F4" xlink:href=".uno:ViewDataSourceBrowser"/> - <accel:item accel:code="KEY_F5" accel:mod1="true" xlink:href=".uno:GrabControlFocus"/> - <accel:item accel:code="KEY_F7" accel:shift="true" accel:mod1="true" xlink:href=".uno:HangulHanjaConversion"/> - <accel:item accel:code="KEY_F11" accel:mod2="true" xlink:href=".uno:MacroDialog"/> -</accel:acceleratorlist> diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 464ec894e350..b5359d74f538 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 \ diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx index 32d556b31626..baee57ad75dc 100644 --- a/svx/workben/msview/msview.cxx +++ b/svx/workben/msview/msview.cxx @@ -34,7 +34,7 @@ #include <boost/shared_ptr.hpp> #include <sot/storage.hxx> #ifndef _SVTOOLS_HRC -#include <svl/svtools.hrc> +#include <svtools/svtools.hrc> #endif #include <sal/main.h> |