diff options
author | Christian Lippka <cl@openoffice.org> | 2009-12-02 10:19:06 +0100 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2009-12-02 10:19:06 +0100 |
commit | 5e3ff24a76d5819f2074716b7fc9a90eac51280b (patch) | |
tree | 190f5f502fdac6968c56bb8168b6af72b1497862 /sd/source | |
parent | d78e19009f4cc8af969da61b3e35ac6c6527231d (diff) |
#i107213# added ViewOverlayManager
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/core/cusshow.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/app/strings.src | 77 | ||||
-rw-r--r-- | sd/source/ui/dlg/custsdlg.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/dlg/ins_paste.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/smarttag.cxx | 55 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/smarttag.hxx | 9 | ||||
-rw-r--r-- | sd/source/ui/inc/strings.hrc | 38 | ||||
-rw-r--r-- | sd/source/ui/inc/view/viewoverlaymanager.hxx | 82 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/LayoutMenu.cxx | 83 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsa.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/makefile.mk | 3 | ||||
-rw-r--r-- | sd/source/ui/view/viewoverlaymanager.cxx | 568 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 3 |
15 files changed, 806 insertions, 138 deletions
diff --git a/sd/source/core/cusshow.cxx b/sd/source/core/cusshow.cxx index 78dc2192293a..25f0d47e9f8a 100644 --- a/sd/source/core/cusshow.cxx +++ b/sd/source/core/cusshow.cxx @@ -127,3 +127,13 @@ void SdCustomShow::RemovePage( const SdPage* pPage ) } } +void SdCustomShow::SetName(const String& rName) +{ + aName = rName; +} + +String SdCustomShow::GetName() const +{ + return aName; +} + diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src index 696e92940b9f..13f3503b5d31 100644 --- a/sd/source/ui/app/strings.src +++ b/sd/source/ui/app/strings.src @@ -169,6 +169,7 @@ String STR_HANDOUT_MODE { Text [ en-US ] = "Handout" ; }; + String STR_AUTOLAYOUT_NONE { Text [ en-US ] = "Blank Slide" ; @@ -185,77 +186,41 @@ String STR_AUTOLAYOUT_TITLE { Text [ en-US ] = "Title Slide" ; }; -String STR_AUTOLAYOUT_OBJ -{ - Text [ en-US ] = "Title, Object" ; -}; -String STR_AUTOLAYOUT_ENUM -{ - Text [ en-US ] = "Title, Text" ; -}; -String STR_AUTOLAYOUT_CHART -{ - Text [ en-US ] = "Title, Chart" ; -}; -String STR_AUTOLAYOUT_TAB -{ - Text [ en-US ] = "Title, Spreadsheet" ; -}; -String STR_AUTOLAYOUT_CLIPTEXT -{ - Text [ en-US ] = "Title, Clipart, Text" ; -}; -String STR_AUTOLAYOUT_2TEXT +String STR_AUTOLAYOUT_CONTENT { - Text [ en-US ] = "Title, 2 Text Blocks" ; + Text [ en-US ] = "Title, Content" ; }; -String STR_AUTOLAYOUT_TEXTCHART +String STR_AUTOLAYOUT_2CONTENT { - Text [ en-US ] = "Title, Text, Chart" ; + Text [ en-US ] = "Title and 2 Content" ; }; -String STR_AUTOLAYOUT_TEXTCLIP +String STR_AUTOLAYOUT_CONTENT_2CONTENT { - Text [ en-US ] = "Title, Text, Clipart" ; + Text [ en-US ] = "Title, Content and 2 Content" ; }; -String STR_AUTOLAYOUT_CHARTTEXT +String STR_AUTOLAYOUT_2CONTENT_CONTENT { - Text [ en-US ] = "Title, Chart, Text" ; + Text [ en-US ] = "Title, 2 Content and Content" ; }; -String STR_AUTOLAYOUT_TEXTOBJ +String STR_AUTOLAYOUT_CONTENT_OVER_2CONTENT { - Text [ en-US ] = "Title, Text, Object" ; + Text [ en-US ] = "Title, Content over 2 Content" ; }; -String STR_AUTOLAYOUT_TEXT2OBJ +String STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT { - Text [ en-US ] = "Title, Text, 2 Objects" ; + Text [ en-US ] = "Title, 2 Content over Content" ; }; -String STR_AUTOLAYOUT_OBJTEXT +String STR_AUTOLAYOUT_CONTENT_OVER_CONTENT { - Text [ en-US ] = "Title, Object, Text" ; + Text [ en-US ] = "Title, Content over Content" ; }; -String STR_AUTOLAYOUT_OBJOVERTEXT +String STR_AUTOLAYOUT_4CONTENT { - Text [ en-US ] = "Title, Object Above Text" ; + Text [ en-US ] = "Title, 4 Content" ; }; -String STR_AUTOLAYOUT_2OBJTEXT +String STR_AUTOLAYOUT_6CONTENT { - Text [ en-US ] = "Title, 2 Objects, Text" ; -}; -String STR_AUTOLAYOUT_2OBJOVERTEXT -{ - Text [ en-US ] = "Title, 2 Objects Above Text" ; -}; -String STR_AUTOLAYOUT_TEXTOVEROBJ -{ - Text [ en-US ] = "Title, Text Above Object" ; -}; -String STR_AUTOLAYOUT_4OBJ -{ - Text [ en-US ] = "Title, 4 Objects" ; -}; -String STR_AUTOLAYOUT_4CLIPART -{ - Text [ en-US ] = "Title, 4 Cliparts" ; + Text [ en-US ] = "Title, 6 Content" ; }; String STR_AL_TITLE_VERT_OUTLINE { @@ -273,10 +238,6 @@ String STR_AL_VERT_TITLE_VERT_OUTLINE { Text [ en-US ] = "Vertical Title, Vertical Text" ; }; -String STR_AUTOLAYOUT_6CLIPART -{ - Text [ en-US ] = "Title, 6 Cliparts" ; -}; String STR_AUTOLAYOUT_HANDOUT1 { diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index 631a3b8a23f2..9876e193ff38 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -45,7 +45,6 @@ #include "sdpage.hxx" #include "cusshow.hxx" #include "app.hxx" -#include "optsitem.hxx" #include <vcl/msgbox.hxx> diff --git a/sd/source/ui/dlg/ins_paste.cxx b/sd/source/ui/dlg/ins_paste.cxx index 9f2c3bf0b6b6..422acbec4a73 100644 --- a/sd/source/ui/dlg/ins_paste.cxx +++ b/sd/source/ui/dlg/ins_paste.cxx @@ -31,6 +31,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" +#ifdef SD_DLLIMPLEMENTATION +#undef SD_DLLIMPLEMENTATION +#endif + #include "ins_paste.hrc" #include "ins_paste.hxx" diff --git a/sd/source/ui/func/smarttag.cxx b/sd/source/ui/func/smarttag.cxx index ecd2c7a685f6..99212adc12f1 100644 --- a/sd/source/ui/func/smarttag.cxx +++ b/sd/source/ui/func/smarttag.cxx @@ -156,6 +156,18 @@ void SmartTag::CheckPossibilities() { } +// -------------------------------------------------------------------- + +void SmartTag::onMouseEnter(SmartHdl& rHdl) +{ +} + +// -------------------------------------------------------------------- + +void SmartTag::onMouseLeave() +{ +} + // ==================================================================== SmartTagSet::SmartTagSet( View& rView ) @@ -175,6 +187,12 @@ void SmartTagSet::add( const SmartTagReference& xTag ) { maSet.insert( xTag ); mrView.InvalidateAllWin(); + + if( xTag == mxMouseOverTag ) + mxMouseOverTag.clear(); + + if( xTag == mxSelectedTag ) + mxSelectedTag.clear(); } // -------------------------------------------------------------------- @@ -185,6 +203,12 @@ void SmartTagSet::remove( const SmartTagReference& xTag ) if( aIter != maSet.end() ) maSet.erase( aIter ); mrView.InvalidateAllWin(); + + if( xTag == mxMouseOverTag ) + mxMouseOverTag.clear(); + + if( xTag == mxSelectedTag ) + mxSelectedTag.clear(); } // -------------------------------------------------------------------- @@ -196,6 +220,8 @@ void SmartTagSet::Dispose() for( std::set< SmartTagReference >::iterator aIter( aSet.begin() ); aIter != aSet.end(); ) (*aIter++)->Dispose(); mrView.InvalidateAllWin(); + mxMouseOverTag.clear(); + mxSelectedTag.clear(); } // -------------------------------------------------------------------- @@ -258,6 +284,35 @@ bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt ) // -------------------------------------------------------------------- +void SmartTagSet::MouseMove(const MouseEvent& rMEvt) +{ + SmartTagReference xTag; + + SmartHdl* pSmartHdl = 0; + if( !rMEvt.IsLeaveWindow() ) + { + Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rMEvt.GetPosPixel() ) ); + SdrHdl* pHdl = mrView.PickHandle(aMDPos); + + pSmartHdl = dynamic_cast< SmartHdl* >( pHdl ); + if( pSmartHdl ) + xTag = pSmartHdl->getTag(); + } + + if( xTag != mxMouseOverTag ) + { + if( mxMouseOverTag.is() ) + mxMouseOverTag->onMouseLeave(); + + mxMouseOverTag = xTag; + + if( mxMouseOverTag.is() ) + mxMouseOverTag->onMouseEnter(*pSmartHdl); + } +} + +// -------------------------------------------------------------------- + bool SmartTagSet::KeyInput( const KeyEvent& rKEvt ) { if( mxSelectedTag.is() ) diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index b9a3e062955b..2b9ee36a2cc6 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -60,6 +60,7 @@ class LayerTabBar; class Ruler; class SdUnoDrawView; class AnnotationManager; +class ViewOverlayManager; #define CHECK_RANGE(nMin, nValue, nMax) ((nValue >= nMin) && (nValue <= nMax)) @@ -499,6 +500,7 @@ private: using ViewShell::Notify; ::std::auto_ptr< AnnotationManager > mpAnnotationManager; + ::std::auto_ptr< ViewOverlayManager > mpViewOverlayManager; }; diff --git a/sd/source/ui/inc/smarttag.hxx b/sd/source/ui/inc/smarttag.hxx index feaa0fa27fd8..561d2e495ebd 100644 --- a/sd/source/ui/inc/smarttag.hxx +++ b/sd/source/ui/inc/smarttag.hxx @@ -76,6 +76,12 @@ public: /** returns true if this smart tag is currently selected */ bool isSelected() const; + /** is called once if the mouse enters this tag */ + virtual void onMouseEnter(SmartHdl& rHdl); + + /** is called once if the mouse leaves this tag */ + virtual void onMouseLeave(); + ::sd::View& getView() const { return mrView; } protected: @@ -141,6 +147,8 @@ public: a special context, returned in rContext. */ bool getContext( SdrViewContext& rContext ) const; + void MouseMove(const MouseEvent& rMEvt); + // support point editing BOOL HasMarkablePoints() const; ULONG GetMarkablePointCount() const; @@ -166,6 +174,7 @@ private: ::sd::View& mrView; SmartTagReference mxSelectedTag; + SmartTagReference mxMouseOverTag; }; /** a derivation from this handle is the visual representation for a smart tag. diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc index b04582046502..c29b8bc5f8fb 100644 --- a/sd/source/ui/inc/strings.hrc +++ b/sd/source/ui/inc/strings.hrc @@ -171,26 +171,20 @@ #define STR_DRAW_MEDIA_TOOLBOX RID_DRAW_MEDIA_TOOLBOX // IDs fuer Praesentationsfolien -#define STR_AUTOLAYOUT_NONE (RID_APP_START+210) -#define STR_AUTOLAYOUT_ONLY_TITLE (RID_APP_START+211) -#define STR_AUTOLAYOUT_TITLE (RID_APP_START+212) -#define STR_AUTOLAYOUT_OBJ (RID_APP_START+213) -#define STR_AUTOLAYOUT_ENUM (RID_APP_START+214) -#define STR_AUTOLAYOUT_CHART (RID_APP_START+215) -#define STR_AUTOLAYOUT_TAB (RID_APP_START+217) -#define STR_AUTOLAYOUT_CLIPTEXT (RID_APP_START+218) -#define STR_AUTOLAYOUT_2TEXT (RID_APP_START+219) -#define STR_AUTOLAYOUT_TEXTCHART (RID_APP_START+220) -#define STR_AUTOLAYOUT_TEXTCLIP (RID_APP_START+221) -#define STR_AUTOLAYOUT_CHARTTEXT (RID_APP_START+222) -#define STR_AUTOLAYOUT_TEXTOBJ (RID_APP_START+223) -#define STR_AUTOLAYOUT_TEXT2OBJ (RID_APP_START+224) -#define STR_AUTOLAYOUT_OBJTEXT (RID_APP_START+225) -#define STR_AUTOLAYOUT_OBJOVERTEXT (RID_APP_START+226) -#define STR_AUTOLAYOUT_2OBJTEXT (RID_APP_START+227) -#define STR_AUTOLAYOUT_2OBJOVERTEXT (RID_APP_START+228) -#define STR_AUTOLAYOUT_TEXTOVEROBJ (RID_APP_START+229) -#define STR_AUTOLAYOUT_4OBJ (RID_APP_START+230) +#define STR_AUTOLAYOUT_NONE (RID_APP_START+210) +#define STR_AUTOLAYOUT_ONLY_TITLE (RID_APP_START+211) +#define STR_AUTOLAYOUT_ONLY_TEXT (RID_APP_START+212) +#define STR_AUTOLAYOUT_TITLE (RID_APP_START+213) +#define STR_AUTOLAYOUT_CONTENT (RID_APP_START+214) +#define STR_AUTOLAYOUT_2CONTENT (RID_APP_START+215) +#define STR_AUTOLAYOUT_CONTENT_2CONTENT (RID_APP_START+217) +#define STR_AUTOLAYOUT_2CONTENT_CONTENT (RID_APP_START+218) +#define STR_AUTOLAYOUT_CONTENT_OVER_2CONTENT (RID_APP_START+219) +#define STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT (RID_APP_START+220) +#define STR_AUTOLAYOUT_CONTENT_OVER_CONTENT (RID_APP_START+221) +#define STR_AUTOLAYOUT_4CONTENT (RID_APP_START+222) +#define STR_AUTOLAYOUT_6CONTENT (RID_APP_START+223) + #define STR_AUTOLAYOUT_HANDOUT1 (RID_APP_START+231) #define STR_AUTOLAYOUT_HANDOUT2 (RID_APP_START+232) #define STR_AUTOLAYOUT_HANDOUT3 (RID_APP_START+233) @@ -198,13 +192,9 @@ #define STR_AUTOLAYOUT_HANDOUT6 (RID_APP_START+235) #define STR_AUTOLAYOUT_NOTES (RID_APP_START+236) #define STR_AUTOLAYOUT_HANDOUT9 (RID_APP_START+237) -#define STR_AUTOLAYOUT_ONLY_TEXT (RID_APP_START+238) -#define STR_AUTOLAYOUT_4CLIPART (RID_APP_START+239) #define STR_TRANSFORM (RID_APP_START+240) -#define STR_AUTOLAYOUT_6CLIPART (RID_APP_START+241) - #define STR_EXPORT_HTML_NAME (RID_APP_START+244) #define STR_EXPORT_HTML_FILTER (RID_APP_START+245) #define STR_EXPORT_DIALOG_TITLE (RID_APP_START+261) diff --git a/sd/source/ui/inc/view/viewoverlaymanager.hxx b/sd/source/ui/inc/view/viewoverlaymanager.hxx new file mode 100644 index 000000000000..54164c08c138 --- /dev/null +++ b/sd/source/ui/inc/view/viewoverlaymanager.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * 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 _SD_VIEWOVERLAYMANAGER_HXX +#define _SD_VIEWOVERLAYMANAGER_HXX + +//#include <com/sun/star/drawing/XDrawView.hpp> + +#include <vcl/image.hxx> +#include <svtools/lstner.hxx> +#include "EventMultiplexer.hxx" +#include "ViewShellBase.hxx" + +namespace sd +{ + +typedef std::vector< rtl::Reference< SmartTag > > ViewTagVector; + +class ViewOverlayManager : public SfxListener +{ +public: + ViewOverlayManager( ViewShellBase& rViewShellBase ); + virtual ~ViewOverlayManager(); + + void onZoomChanged(); + void UpdateTags(); + + DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*); + DECL_LINK(UpdateTagsHdl, void *); + + bool CreateTags(); + bool DisposeTags(); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + + static const int ButtonCount = 4; + static Image maLargeButtonImages[ButtonCount]; + static Image maSmallButtonImages[ButtonCount]; + static USHORT mnButtonSlots[ButtonCount]; + +private: + void UpdateImages(); + + ViewShellBase& mrBase; + ULONG mnUpdateTagsEvent; + + ViewTagVector maTagVector; + +// ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView; +// ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage; +}; + +} + +#endif // _SD_VIEWOVERLAYMANAGER_HXX diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index d2faeb06eb00..f1a918d7e7e0 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -164,60 +164,37 @@ static snewfoil_value_info handout[] = static snewfoil_value_info standard[] = { - {BMP_FOIL_20, BMP_FOIL_20_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, - AUTOLAYOUT_NONE}, - {BMP_FOIL_00, BMP_FOIL_00_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, - AUTOLAYOUT_TITLE}, - {BMP_FOIL_01, BMP_FOIL_01_H, STR_AUTOLAYOUT_ENUM, WritingMode_LR_TB, - AUTOLAYOUT_ENUM}, - {BMP_FOIL_03, BMP_FOIL_03_H, STR_AUTOLAYOUT_2TEXT, WritingMode_LR_TB, - AUTOLAYOUT_2TEXT}, - {BMP_FOIL_19, BMP_FOIL_19_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, - AUTOLAYOUT_ONLY_TITLE}, - {BMP_FOIL_25, BMP_FOIL_25_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, - AUTOLAYOUT_ONLY_TEXT}, - {BMP_FOIL_11, BMP_FOIL_11_H, STR_AUTOLAYOUT_OBJ, WritingMode_LR_TB, - AUTOLAYOUT_OBJ}, - {BMP_FOIL_02, BMP_FOIL_02_H, STR_AUTOLAYOUT_CHART, WritingMode_LR_TB, - AUTOLAYOUT_CHART}, - {BMP_FOIL_08, BMP_FOIL_08_H, STR_AUTOLAYOUT_TAB, WritingMode_LR_TB, - AUTOLAYOUT_TAB}, - {BMP_FOIL_09, BMP_FOIL_09_H, STR_AUTOLAYOUT_CLIPTEXT, WritingMode_LR_TB, - AUTOLAYOUT_CLIPTEXT}, - {BMP_FOIL_04, BMP_FOIL_04_H, STR_AUTOLAYOUT_TEXTCHART, WritingMode_LR_TB, - AUTOLAYOUT_TEXTCHART}, - {BMP_FOIL_06, BMP_FOIL_06_H, STR_AUTOLAYOUT_TEXTCLIP, WritingMode_LR_TB, - AUTOLAYOUT_TEXTCLIP}, - {BMP_FOIL_07, BMP_FOIL_07_H, STR_AUTOLAYOUT_CHARTTEXT, WritingMode_LR_TB, - AUTOLAYOUT_CHARTTEXT}, - {BMP_FOIL_10, BMP_FOIL_10_H, STR_AUTOLAYOUT_TEXTOBJ, WritingMode_LR_TB, - AUTOLAYOUT_TEXTOBJ}, - {BMP_FOIL_12, BMP_FOIL_12_H, STR_AUTOLAYOUT_TEXT2OBJ, WritingMode_LR_TB, - AUTOLAYOUT_TEXT2OBJ}, - {BMP_FOIL_13, BMP_FOIL_13_H, STR_AUTOLAYOUT_OBJTEXT, WritingMode_LR_TB, - AUTOLAYOUT_OBJTEXT}, - {BMP_FOIL_14, BMP_FOIL_14_H, STR_AUTOLAYOUT_OBJOVERTEXT, WritingMode_LR_TB, - AUTOLAYOUT_OBJOVERTEXT}, - {BMP_FOIL_15, BMP_FOIL_15_H, STR_AUTOLAYOUT_2OBJTEXT, WritingMode_LR_TB, - AUTOLAYOUT_2OBJTEXT}, - {BMP_FOIL_16, BMP_FOIL_16_H, STR_AUTOLAYOUT_2OBJOVERTEXT, - WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT}, - {BMP_FOIL_17, BMP_FOIL_17_H, STR_AUTOLAYOUT_TEXTOVEROBJ, WritingMode_LR_TB, - AUTOLAYOUT_TEXTOVEROBJ}, - {BMP_FOIL_18, BMP_FOIL_18_H, STR_AUTOLAYOUT_4OBJ, WritingMode_LR_TB, - AUTOLAYOUT_4OBJ}, - {BMP_FOIL_26, BMP_FOIL_26_H, STR_AUTOLAYOUT_4CLIPART, WritingMode_LR_TB, AUTOLAYOUT_4CLIPART}, - {BMP_FOIL_27, BMP_FOIL_27_H, STR_AUTOLAYOUT_6CLIPART, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART}, - + {BMP_FOIL_20, BMP_FOIL_20_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE}, + {BMP_FOIL_00, BMP_FOIL_00_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE}, + {BMP_FOIL_01, BMP_FOIL_01_H, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM}, + {BMP_FOIL_03, BMP_FOIL_03_H, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT}, + {BMP_FOIL_19, BMP_FOIL_19_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE}, + {BMP_FOIL_25, BMP_FOIL_25_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT}, + {BMP_FOIL_12, BMP_FOIL_12_H, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ}, + {BMP_FOIL_15, BMP_FOIL_15_H, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT}, +//STR_AUTOLAYOUT_CONTENT_OVER_2CONTENT + {BMP_FOIL_16, BMP_FOIL_16_H, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT}, + {BMP_FOIL_14, BMP_FOIL_14_H, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT}, + {BMP_FOIL_18, BMP_FOIL_18_H, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ}, + {BMP_FOIL_27, BMP_FOIL_27_H, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART}, +/* + {BMP_FOIL_11, BMP_FOIL_11_H, STR_AUTOLAYOUT_OBJ, WritingMode_LR_TB, AUTOLAYOUT_OBJ}, + {BMP_FOIL_02, BMP_FOIL_02_H, STR_AUTOLAYOUT_CHART, WritingMode_LR_TB, AUTOLAYOUT_CHART}, + {BMP_FOIL_08, BMP_FOIL_08_H, STR_AUTOLAYOUT_TAB, WritingMode_LR_TB, AUTOLAYOUT_TAB}, + {BMP_FOIL_09, BMP_FOIL_09_H, STR_AUTOLAYOUT_CLIPTEXT, WritingMode_LR_TB, AUTOLAYOUT_CLIPTEXT}, + {BMP_FOIL_04, BMP_FOIL_04_H, STR_AUTOLAYOUT_TEXTCHART, WritingMode_LR_TB, AUTOLAYOUT_TEXTCHART}, + {BMP_FOIL_06, BMP_FOIL_06_H, STR_AUTOLAYOUT_TEXTCLIP, WritingMode_LR_TB, AUTOLAYOUT_TEXTCLIP}, + {BMP_FOIL_07, BMP_FOIL_07_H, STR_AUTOLAYOUT_CHARTTEXT, WritingMode_LR_TB, AUTOLAYOUT_CHARTTEXT}, + {BMP_FOIL_10, BMP_FOIL_10_H, STR_AUTOLAYOUT_TEXTOBJ, WritingMode_LR_TB, AUTOLAYOUT_TEXTOBJ}, + {BMP_FOIL_13, BMP_FOIL_13_H, STR_AUTOLAYOUT_OBJTEXT, WritingMode_LR_TB, AUTOLAYOUT_OBJTEXT}, + {BMP_FOIL_17, BMP_FOIL_17_H, STR_AUTOLAYOUT_TEXTOVEROBJ, WritingMode_LR_TB, AUTOLAYOUT_TEXTOVEROBJ}, + {BMP_FOIL_26, BMP_FOIL_26_H, STR_AUTOLAYOUT_4CLIPART, WritingMode_LR_TB, AUTOLAYOUT_4CLIPART}, +*/ // vertical - {BMP_FOIL_21, BMP_FOIL_21_H, STR_AL_VERT_TITLE_TEXT_CHART, - WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART}, - {BMP_FOIL_22, BMP_FOIL_22_H, STR_AL_VERT_TITLE_VERT_OUTLINE, - WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE}, - {BMP_FOIL_23, BMP_FOIL_23_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, - AUTOLAYOUT_TITLE_VERTICAL_OUTLINE}, - {BMP_FOIL_24, BMP_FOIL_24_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART, - WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART}, + {BMP_FOIL_21, BMP_FOIL_21_H, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART}, + {BMP_FOIL_22, BMP_FOIL_22_H, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE}, + {BMP_FOIL_23, BMP_FOIL_23_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE}, + {BMP_FOIL_24, BMP_FOIL_24_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART}, {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE} }; diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 2077a852f960..e870f706f810 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -71,6 +71,8 @@ #include <svx/dialogs.hrc> +#include "view/viewoverlaymanager.hxx" + #include "glob.hrc" #include "app.hrc" #include "res_bmp.hrc" @@ -295,6 +297,7 @@ void DrawViewShell::SetZoom( long nZoom ) ViewShell::SetZoom( nZoom ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); + mpViewOverlayManager->onZoomChanged(); } /************************************************************************* @@ -308,6 +311,7 @@ void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect ) ViewShell::SetZoomRect( rZoomRect ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); + mpViewOverlayManager->onZoomChanged(); } /************************************************************************* diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 3c396db7207d..201a1018cf78 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -65,6 +65,7 @@ #include <svtools/cliplistener.hxx> #include <svx/float3d.hxx> +#include "view/viewoverlaymanager.hxx" #include "app.hrc" #include "helpids.h" #include "strings.hrc" @@ -174,7 +175,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ::Window* pParentWindow, con DrawViewShell::~DrawViewShell() { - mpAnnotationManager.release(); + mpAnnotationManager.reset(); + mpViewOverlayManager.reset(); OSL_ASSERT (GetViewShell()!=NULL); @@ -419,6 +421,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) } mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) ); + mpViewOverlayManager.reset( new ViewOverlayManager( GetViewShellBase() ) ); } diff --git a/sd/source/ui/view/makefile.mk b/sd/source/ui/view/makefile.mk index a65f3fd7c87f..89b6f3d232c4 100644 --- a/sd/source/ui/view/makefile.mk +++ b/sd/source/ui/view/makefile.mk @@ -113,7 +113,8 @@ SLOFILES = \ $(SLO)$/ViewShellManager.obj \ $(SLO)$/ViewShellHint.obj \ $(SLO)$/ViewTabBar.obj \ - $(SLO)$/WindowUpdater.obj + $(SLO)$/WindowUpdater.obj \ + $(SLO)$/ViewOverlayManager.obj diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx new file mode 100644 index 000000000000..a6684fcdfd3e --- /dev/null +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -0,0 +1,568 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * 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_sd.hxx" + +#include "sddll.hxx" + +#include <com/sun/star/frame/XFrame.hpp> +#include <sfx2/imagemgr.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/app.hxx> +#include <sfx2/request.hxx> +#include <sfx2/dispatch.hxx> + +#include <svx/sdrpagewindow.hxx> +#include <svx/sdrpaintwindow.hxx> +#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx> +#include <svx/sdr/overlay/overlaybitmapex.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <svx/svxids.hrc> + +#include "view/viewoverlaymanager.hxx" + +#include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" +#include "DrawController.hxx" +#include "glob.hrc" +#include "sdresid.hxx" +#include "EventMultiplexer.hxx" +#include "ViewShellManager.hxx" +#include "helpids.h" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "smarttag.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; + +namespace sd { + +class ImageButtonHdl; + +const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32; + +class ChangePlaceholderTag : public SmartTag +{ + friend class ImageButtonHdl; +public: + ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj ); + virtual ~ChangePlaceholderTag(); + + /** returns true if the SmartTag handled the event. */ + virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool KeyInput( const KeyEvent& rKEvt ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool RequestHelp( const HelpEvent& rHEvt ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool Command( const CommandEvent& rCEvt ); + + /** is called once if the mouse enters this tag */ + virtual void onMouseEnter(SmartHdl& rHdl); + + /** is called once if the mouse leaves this tag */ + virtual void onMouseLeave(); + +protected: + virtual void addCustomHandles( SdrHdlList& rHandlerList ); + virtual void disposing(); + virtual void select(); + virtual void deselect(); + +private: + ViewOverlayManager& mrManager; + SdrObjectWeakRef mxPlaceholderObj; + ImageButtonHdl* mpSelectedHdl; +}; + +class ImageButtonHdl : public SmartHdl +{ +public: + ImageButtonHdl( const SmartTagReference& xTag, const Image& rImage, const Point& rPnt ); + virtual ~ImageButtonHdl(); + virtual void CreateB2dIAObject(); + virtual BOOL IsFocusHdl() const; + virtual Pointer GetSdrDragPointer() const; + virtual bool isMarkable() const; + + void select( bool bSelect ); +private: + rtl::Reference< ChangePlaceholderTag > mxTag; + bool mbSelected; + Image maImage; +}; + +// -------------------------------------------------------------------- + +ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag, const Image& rImage, const Point& rPnt ) +: SmartHdl( xTag, rPnt ) +, mxTag( dynamic_cast< ChangePlaceholderTag* >( xTag.get() ) ) +, mbSelected(false) +, maImage( rImage ) +{ +} + +// -------------------------------------------------------------------- + +ImageButtonHdl::~ImageButtonHdl() +{ + if( mxTag.is() && (mxTag->mpSelectedHdl == this) ) + mxTag->mpSelectedHdl = 0; +} + +// -------------------------------------------------------------------- + +void ImageButtonHdl::select( bool bSelect ) +{ + if( bSelect != mbSelected ) + { + mbSelected = bSelect; + Touch(); + } +} + +// -------------------------------------------------------------------- + +void ImageButtonHdl::CreateB2dIAObject() +{ + // first throw away old one + GetRidOfIAObject(); + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + const Point aTagPos( GetPos() ); + basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() ); + + const bool bFocused = IsFocusHdl() && pHdlList && (pHdlList->GetFocusHdl() == this); + + BitmapEx aBitmapEx( maImage.GetBitmapEx() ); + + const double fAlpha = mbSelected ? 0.0 : 0.5; + + if(pHdlList) + { + SdrMarkView* pView = pHdlList->GetView(); + + if(pView && !pView->areMarkHandlesHidden()) + { + SdrPageView* pPageView = pView->GetSdrPageView(); + + if(pPageView) + { + for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++) + { + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); + + SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow(); + if(rPaintWindow.OutputToWindow() && rPageWindow.GetOverlayManager() ) + { + ::sdr::overlay::OverlayObject* pOverlayObject = 0; + + // animate focused handles + pOverlayObject = new ::sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0, fAlpha ); + rPageWindow.GetOverlayManager()->add(*pOverlayObject); + maOverlayGroup.append(*pOverlayObject); + } + } + } + } + } +} + +// -------------------------------------------------------------------- + +BOOL ImageButtonHdl::IsFocusHdl() const +{ + return TRUE; +} + +// -------------------------------------------------------------------- + +bool ImageButtonHdl::isMarkable() const +{ + return false; +} + +// -------------------------------------------------------------------- + +Pointer ImageButtonHdl::GetSdrDragPointer() const +{ + return Pointer( POINTER_ARROW ); +} + +// ==================================================================== + +ChangePlaceholderTag::ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj ) +: SmartTag( rView ) +, mrManager( rManager ) +, mxPlaceholderObj( &rPlaceholderObj ) +{ +} + +// -------------------------------------------------------------------- + +ChangePlaceholderTag::~ChangePlaceholderTag() +{ +} + +// -------------------------------------------------------------------- + +/** returns true if the ChangePlaceholderTag handled the event. */ +bool ChangePlaceholderTag::MouseButtonDown( const MouseEvent& rMEvt, SmartHdl& /*rHdl*/ ) +{ + return false; +} + +// -------------------------------------------------------------------- + +/** returns true if the SmartTag consumes this event. */ +bool ChangePlaceholderTag::KeyInput( const KeyEvent& rKEvt ) +{ + USHORT nCode = rKEvt.GetKeyCode().GetCode(); + switch( nCode ) + { + case KEY_DOWN: + case KEY_UP: + case KEY_LEFT: + case KEY_RIGHT: + case KEY_ESCAPE: + case KEY_TAB: + case KEY_RETURN: + case KEY_SPACE: + default: + return false; + } +} + +/** returns true if the SmartTag consumes this event. */ +bool ChangePlaceholderTag::RequestHelp( const HelpEvent& /*rHEvt*/ ) +{ + return false; +} + +/** returns true if the SmartTag consumes this event. */ +bool ChangePlaceholderTag::Command( const CommandEvent& rCEvt ) +{ + return false; +} + +/** is called once if the mouse enters this tag */ +void ChangePlaceholderTag::onMouseEnter(SmartHdl& rHdl) +{ + ImageButtonHdl* pHdl = dynamic_cast< ImageButtonHdl* >( &rHdl ); + if( mpSelectedHdl != 0 ) + { + if( mpSelectedHdl == pHdl ) + return; + + mpSelectedHdl->select(false); + } + + mpSelectedHdl = pHdl; + + if( mpSelectedHdl ) + { + mpSelectedHdl->select( true ); + } +} + +/** is called once if the mouse leaves this tag */ +void ChangePlaceholderTag::onMouseLeave() +{ + if( mpSelectedHdl ) + { + mpSelectedHdl->select( false ); + mpSelectedHdl = 0; + } +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::addCustomHandles( SdrHdlList& rHandlerList ) +{ + if( mxPlaceholderObj.is() ) + { + SdrObject* pPlaceholder = mxPlaceholderObj.get(); + SmartTagReference xThis( this ); + const Rectangle& rSnapRect = pPlaceholder->GetSnapRect(); + const Point aPoint; + + OutputDevice* pDev = mrView.GetFirstOutputDevice(); + if( pDev == 0 ) + pDev = Application::GetDefaultDevice(); + + Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize()); + long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height()); + + Image* pImages = (nShapeSizePix > 300) ? &ViewOverlayManager::maLargeButtonImages[0] : &ViewOverlayManager::maSmallButtonImages[0]; + + Size aButtonSize( pDev->PixelToLogic(pImages[0].GetSizePixel()) ); + if( 200 > nShapeSizePix ) + { + aButtonSize.Width() >>= 1; aButtonSize.Height() >>= 1; + } + + const long nBorderPix = (nShapeSizePix > 300) ? 4 : (nShapeSizePix > 100) ? 2 : 1; + Size aBorder( pDev->PixelToLogic(Size(nBorderPix,nBorderPix)) ); + + const int nColumns = (ViewOverlayManager::ButtonCount+1) >> 1; + const int nRows = (ViewOverlayManager::ButtonCount + nColumns - 1) / nColumns; + + long all_width = (nColumns * aButtonSize.Width()) + ((nColumns-1) * aBorder.Width()); + long all_height = (nRows * aButtonSize.Height()) + ((nRows-1) * aBorder.Height()); + + Point aPos( rSnapRect.Center() ); + aPos.X() -= all_width >> 1; + aPos.Y() -= all_height >> 1; + + long nStartX = aPos.X(); + + for( int i = 0, c = 0; i < ViewOverlayManager::ButtonCount; i++ ) + { + Image aImg( pImages[i] ); + if( 200 > nShapeSizePix ) + { + BitmapEx b( aImg.GetBitmapEx() ); + const double scale = 0.5; + b.Scale( scale, scale ); + aImg = Image(b); + } + + ImageButtonHdl* pHdl = new ImageButtonHdl( xThis, aImg, aPoint ); + pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); + pHdl->SetPageView( mrView.GetSdrPageView() ); + + pHdl->SetPos( aPos ); + + rHandlerList.AddHdl( pHdl ); + + if( ++c == nColumns ) + { + aPos.X() = nStartX; + aPos.Y() += aButtonSize.Height() + aBorder.Height(); + c = 0; + } + else + { + aPos.X() += aButtonSize.Width() + aBorder.Width(); + } + } + } +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::disposing() +{ + SmartTag::disposing(); +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::select() +{ + SmartTag::select(); +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::deselect() +{ + SmartTag::deselect(); +} + +// -------------------------------------------------------------------- + +Image ViewOverlayManager::maSmallButtonImages[ViewOverlayManager::ButtonCount]; +Image ViewOverlayManager::maLargeButtonImages[ViewOverlayManager::ButtonCount]; +USHORT ViewOverlayManager::mnButtonSlots[ViewOverlayManager::ButtonCount] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA }; + +// -------------------------------------------------------------------- + +static Image lcl_getslotimage( ::com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& xFrame, USHORT nSID, BOOL b1, BOOL b2 ) +{ + rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); + aSlotURL += rtl::OUString::valueOf( sal_Int32( nSID )); + return ::GetImage( xFrame, aSlotURL, b1, b2 ); +} + +ViewOverlayManager::ViewOverlayManager( ViewShellBase& rViewShellBase ) +: mrBase( rViewShellBase ) +, mnUpdateTagsEvent( 0 ) +{ + Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->AddEventListener(aLink, tools::EventMultiplexerEvent::EID_CURRENT_PAGE); + + StartListening( *mrBase.GetDocShell() ); +} + +// -------------------------------------------------------------------- + +ViewOverlayManager::~ViewOverlayManager() +{ + Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->RemoveEventListener( aLink ); + + if( mnUpdateTagsEvent ) + { + Application::RemoveUserEvent( mnUpdateTagsEvent ); + mnUpdateTagsEvent = 0; + } + + DisposeTags(); +} + +// -------------------------------------------------------------------- + +void ViewOverlayManager::UpdateImages() +{ + try + { + Reference<XFrame> xFrame(mrBase.GetFrame()->GetTopFrame()->GetFrameInterface(), UNO_QUERY_THROW); + for( int i = 0; i < ButtonCount; i++ ) + { + maSmallButtonImages[i] = lcl_getslotimage( xFrame, mnButtonSlots[i], FALSE, FALSE ); + maLargeButtonImages[i] = lcl_getslotimage( xFrame, mnButtonSlots[i], TRUE, FALSE ); + } + } + catch( Exception& ) + { + DBG_ERROR( "ViewOverlayManager::ViewOverlayManager(), exception caught!" ); + } +} + +// -------------------------------------------------------------------- + +void ViewOverlayManager::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if (pSimpleHint != NULL) + { + if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED) + { + UpdateTags(); + } + } +} + +void ViewOverlayManager::onZoomChanged() +{ + if( !maTagVector.empty() ) + { + UpdateTags(); + } +} + +void ViewOverlayManager::UpdateTags() +{ + if( !mnUpdateTagsEvent ) + mnUpdateTagsEvent = Application::PostUserEvent( LINK( this, ViewOverlayManager, UpdateTagsHdl ) ); +} + +IMPL_LINK(ViewOverlayManager,UpdateTagsHdl, void *, EMPTYARG) +{ + mnUpdateTagsEvent = 0; + bool bChanges = DisposeTags(); + bChanges |= CreateTags(); + + if( bChanges && mrBase.GetDrawView() ) + static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); + return 0; +} + +bool ViewOverlayManager::CreateTags() +{ + bool bChanges = false; + + SdPage* pPage = mrBase.GetMainViewShell()->getCurrentPage(); + + if( pPage ) + { + if( !maSmallButtonImages[0] ) + UpdateImages(); + + const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList(); + + for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); iter++ ) + { + if( (*iter)->IsEmptyPresObj() && ((*iter)->GetObjIdentifier() == OBJ_OUTLINETEXT) ) + { + rtl::Reference< SmartTag > xTag( new ChangePlaceholderTag( *this, *mrBase.GetMainViewShell()->GetView(), *(*iter) ) ); + maTagVector.push_back(xTag); + } + } + } + + return bChanges; +} + +// -------------------------------------------------------------------- + +bool ViewOverlayManager::DisposeTags() +{ + if( !maTagVector.empty() ) + { + ViewTagVector vec; + vec.swap( maTagVector ); + + ViewTagVector::iterator iter = vec.begin(); + do + { + (*iter++)->Dispose(); + } + while( iter != vec.end() ); + return true; + } + + return false; +} + +// -------------------------------------------------------------------- + +IMPL_LINK(ViewOverlayManager,EventMultiplexerListener, + tools::EventMultiplexerEvent*,pEvent) +{ + switch (pEvent->meEventId) + { + case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + UpdateTags(); + break; + } + return 0; +} + +} diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 208d5426c8bd..98c425110c23 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -579,6 +579,9 @@ void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin) void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) { + if( GetView() ) + GetView()->getSmartTags().MouseMove( rMEvt ); + if (rMEvt.IsLeaveWindow()) { if ( ! mpImpl->mpUpdateLockForMouse.expired()) |