diff options
Diffstat (limited to 'sd/source')
170 files changed, 4757 insertions, 9349 deletions
diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx index 5e755d8b8eaa..8f92369a2c71 100644 --- a/sd/source/core/typemap.cxx +++ b/sd/source/core/typemap.cxx @@ -38,6 +38,9 @@ #include <editeng/fontitem.hxx> #include <svl/poolitem.hxx> #include <editeng/tstpitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/protitem.hxx> #include <svx/chrtitem.hxx> @@ -125,6 +128,10 @@ #include <svl/rectitem.hxx> #include <sfx2/frame.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> #define SFX_TYPEMAP #include "sdslots.hxx" diff --git a/sd/source/ui/accessibility/makefile.mk b/sd/source/ui/accessibility/makefile.mk index d32623ff2d6a..5df7638042b8 100644 --- a/sd/source/ui/accessibility/makefile.mk +++ b/sd/source/ui/accessibility/makefile.mk @@ -49,12 +49,13 @@ SLOFILES = \ $(SLO)$/AccessibleViewForwarder.obj \ $(SLO)$/AccessibleOutlineEditSource.obj \ $(SLO)$/AccessiblePageShape.obj \ - $(SLO)$/AccessibleScrollPanel.obj \ $(SLO)$/AccessibleSlideSorterView.obj \ $(SLO)$/AccessibleSlideSorterObject.obj \ - $(SLO)$/AccessibleTreeNode.obj \ $(SLO)$/SdShapeTypes.obj +#SIDEBAR_TO_BE_REMOVED +# $(SLO)$/AccessibleScrollPanel.obj \ +# $(SLO)$/AccessibleTreeNode.obj \ EXCEPTIONSFILES= diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index ac9bd015a43e..f098dd51aec3 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -230,7 +230,7 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, Window* pParent, con SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorTable* pColorTable = NULL; + XColorList* pColorTable = NULL; bool bKillTable = false; const SfxPoolItem* pItem = NULL; @@ -239,7 +239,7 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, Window* pParent, con if ( !pColorTable ) { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); bKillTable = sal_True; } @@ -1250,7 +1250,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( Window* pParent, con // fill the color box SfxObjectShell* pDocSh = SfxObjectShell::Current(); DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorTable* pColorTable = NULL; + XColorList* pColorTable = NULL; bool bKillTable = false; const SfxPoolItem* pItem = NULL; @@ -1259,7 +1259,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( Window* pParent, con if ( !pColorTable ) { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); bKillTable = sal_True; } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index e23512708704..ca68a134e66a 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -59,6 +59,7 @@ #include <comphelper/sequence.hxx> #include <sfx2/frame.hxx> +#include <sfx2/sidebar/Theme.hxx> #include <svx/unoapi.hxx> #include <svx/svxids.hrc> @@ -246,6 +247,8 @@ CustomAnimationPane::CustomAnimationPane( ::Window* pParent, ViewShellBase& rBas maLateInitTimer.SetTimeout(100); maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback)); maLateInitTimer.Start(); + + UpdateLook(); } CustomAnimationPane::~CustomAnimationPane() @@ -1073,6 +1076,42 @@ void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry ) updateControls(); } + + + +void CustomAnimationPane::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + UpdateLook(); +} + + + + +void CustomAnimationPane::UpdateLook (void) +{ + SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); + if (mpFLModify != NULL) + mpFLModify->SetBackground(Wallpaper()); + if (mpFLEffect != NULL) + mpFLEffect->SetBackground(Wallpaper()); + if (mpFTStart != NULL) + mpFTStart->SetBackground(Wallpaper()); + if (mpFTProperty != NULL) + mpFTProperty->SetBackground(Wallpaper()); + if (mpFTSpeed != NULL) + mpFTSpeed->SetBackground(Wallpaper()); + if (mpFTChangeOrder != NULL) + mpFTChangeOrder->SetBackground(Wallpaper()); + if (mpFLSeperator1 != NULL) + mpFLSeperator1->SetBackground(Wallpaper()); + if (mpFLSeperator2 != NULL) + mpFLSeperator2->SetBackground(Wallpaper()); +} + + + + void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue ) { switch( pSet->getPropertyState( nHandle ) ) @@ -2540,8 +2579,10 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot if( pDocSh ) { pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL ); + const Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); + pWindow->SetSizePixel(aMinSize); + pWindow->SetBackground(Wallpaper(Color(COL_BLUE))); - Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); ::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize ); pWindow->SetChildWindow( pPaneWindow, aMinSize ); pWindow->SetText( pPaneWindow->GetText() ); @@ -2552,4 +2593,13 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot + +sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pDialog) +{ + if (pDialog != NULL) + return pDialog->LogicToPixel(Size( 80, 256 ), MAP_APPFONT).Height(); + else + return 0; +} + } diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx index 443ce2fc01ee..7fe349ac470a 100644 --- a/sd/source/ui/animations/CustomAnimationPane.hxx +++ b/sd/source/ui/animations/CustomAnimationPane.hxx @@ -93,6 +93,9 @@ public: virtual void onDoubleClick(); virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ); + // Window + virtual void DataChanged (const DataChangedEvent& rEvent); + void addUndo(); void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ); @@ -116,6 +119,7 @@ private: ::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect ); bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue ); + void UpdateLook (void); DECL_LINK( implControlHdl, Control* ); DECL_LINK( implPropertyHdl, Control* ); diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index a2c67b47865d..257af3c5fd14 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -57,6 +57,7 @@ #include "framework/FrameworkHelper.hxx" #include "DialogListBox.hxx" +#include <sfx2/sidebar/Theme.hxx> #include <algorithm> #include <memory> @@ -515,6 +516,8 @@ SlideTransitionPane::SlideTransitionPane( maLateInitTimer.SetTimeout(200); maLateInitTimer.SetTimeoutHdl(LINK(this, SlideTransitionPane, LateInitCallback)); maLateInitTimer.Start(); + + UpdateLook(); } SlideTransitionPane::~SlideTransitionPane() @@ -528,6 +531,33 @@ void SlideTransitionPane::Resize() updateLayout(); } + + + +void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + UpdateLook(); +} + + + + +void SlideTransitionPane::UpdateLook (void) +{ + SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); + maFL_APPLY_TRANSITION.SetBackground(Wallpaper()); + maFL_MODIFY_TRANSITION.SetBackground(Wallpaper());; + maFT_SPEED.SetBackground(Wallpaper()); + maFT_SOUND.SetBackground(Wallpaper()); + maFL_ADVANCE_SLIDE.SetBackground(Wallpaper()); + maFL_EMPTY1.SetBackground(Wallpaper()); + maFL_EMPTY2.SetBackground(Wallpaper()); +} + + + + void SlideTransitionPane::onSelectionChanged() { updateControls(); @@ -1314,4 +1344,15 @@ IMPL_LINK( SlideTransitionPane, LateInitCallback, Timer*, EMPTYARG ) } + + +sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pDialog) +{ + if (pDialog != NULL) + return pDialog->LogicToPixel(Size( 72, 216 ), MAP_APPFONT).Height(); + else + return 0; +} + + } // namespace sd diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx index 2d52c66d8380..b0489e75046d 100644 --- a/sd/source/ui/animations/SlideTransitionPane.hxx +++ b/sd/source/ui/animations/SlideTransitionPane.hxx @@ -61,7 +61,9 @@ public: SdDrawDocument* pDoc ); virtual ~SlideTransitionPane(); + // Window virtual void Resize(); + virtual void DataChanged (const DataChangedEvent& rEvent); void onSelectionChanged(); void onChangeCurrentPage(); @@ -84,6 +86,8 @@ private: ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const; + void UpdateLook (void); + DECL_LINK( ApplyToAllButtonClicked, void * ); DECL_LINK( PlayButtonClicked, void * ); DECL_LINK( SlideShowButtonClicked, void * ); @@ -98,7 +102,6 @@ private: DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*); DECL_LINK(LateInitCallback, Timer*); -private: ViewShellBase & mrBase; SdDrawDocument * mpDrawDoc; Size maMinSize; diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx index 28741ae3a3bf..313b36a0bdb3 100644 --- a/sd/source/ui/app/sddll1.cxx +++ b/sd/source/ui/app/sddll1.cxx @@ -45,7 +45,6 @@ #include "DrawDocShell.hxx" #include "GraphicDocShell.hxx" #include "SlideSorterViewShell.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "FactoryIds.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -123,8 +122,4 @@ void SdDLL::RegisterInterfaces() // View shells for the side panes. ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod); - ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod); - // Tell the tool panel view shell to register the interfaces of its - // controls. - ::sd::toolpanel::ToolPanelViewShell::RegisterControls(); } diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index 16e4745b3285..65435c0365ca 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -63,6 +63,7 @@ #include <svx/layctrl.hxx> #include <svx/subtoolboxcontrol.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include "sddll.hxx" #define _SD_DIACTRL_CXX @@ -136,7 +137,7 @@ void SdDLL::RegisterControllers() ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); - ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(NULL, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); SvxLineStyleToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 3297c586bc06..5b9901cb262a 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -753,7 +753,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame); if (pBase != NULL) { - FrameworkHelper::Instance(*pBase)->RequestTaskPanel( + FrameworkHelper::Instance(*pBase)->RequestSidebarPanel( FrameworkHelper::msLayoutTaskPanelURL); } } diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 262757b7233e..b0dc681c61df 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -29,11 +29,31 @@ #include "app.hrc" #include "navigatr.hrc" #include <sfx2/app.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svl/eitem.hxx> +#include <boost/bind.hpp> + namespace sd { SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR) +void RequestNavigatorUpdate (SfxBindings* pBindings) +{ + if (pBindings != NULL + && pBindings->GetDispatcher() != NULL) + { + SfxBoolItem aItem (SID_NAVIGATOR_INIT, sal_True); + pBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_INIT, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + &aItem, + 0L); + } +} + + NavigatorChildWindow::NavigatorChildWindow ( ::Window* pParent, sal_uInt16 nId, @@ -41,8 +61,12 @@ NavigatorChildWindow::NavigatorChildWindow ( SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this, - SdResId( FLT_NAVIGATOR ), pBindings ); + SdNavigatorWin* pNavWin = new SdNavigatorWin( + pParent, + this, + SdResId( FLT_NAVIGATOR ), + pBindings, + ::boost::bind(RequestNavigatorUpdate, pBindings)); SetWindow( pNavWin ); } diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 92067843a1d0..c1787de31056 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -28,7 +28,6 @@ #include "PaneDockingWindow.hxx" #include "ViewShellBase.hxx" #include "framework/FrameworkHelper.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "app.hrc" #include "strings.hrc" #include "sdresid.hxx" @@ -52,7 +51,6 @@ using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) -SFX_IMPL_DOCKINGWINDOW( ToolPanelChildWindow, SID_TASKPANE) //===== PaneChildWindow ======================================================= @@ -142,89 +140,4 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( } - - -//====================================================================================================================== -//= ToolPanelChildWindow -//====================================================================================================================== -//---------------------------------------------------------------------------------------------------------------------- -ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings, - SfxChildWinInfo* i_pChildWindowInfo ) - :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, - FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT ) -{ - // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework - // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the - // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell - // which has this responsibility. And this view shell is created implicitly via the resource framework.) - // #i113788# / 2010-09-03 / frank.schoenheit@oracle.com - SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); - ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); - ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" ); - - const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); - ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" ); - Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() ); - ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" ); - xConfigController->requestResourceActivation( - framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ), - ResourceActivationMode_ADD ); - xConfigController->requestResourceActivation( - framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ), - ResourceActivationMode_REPLACE - ); -} - -//---------------------------------------------------------------------------------------------------------------------- -struct DelayedToolPanelActivation -{ - DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const ::rtl::OUString& i_rPanelURL ) - :m_rToolPanelWindow( i_rToolPanelWindow ) - ,m_sPanelURL( i_rPanelURL ) - { - } - - void operator() (bool) - { - m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL ); - } - -private: - ToolPanelChildWindow& m_rToolPanelWindow; - const ::rtl::OUString m_sPanelURL; -}; - -//---------------------------------------------------------------------------------------------------------------------- -void ToolPanelChildWindow::ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) -{ - SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() ); - ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() ); - ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" ); - - const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) ); - - if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 ) - { - // it's one of our standard panels known to the drawing framework - pFrameworkHelper->RequestTaskPanel( i_rPanelURL ); - } - else - { - // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by - // extensions, too. As long as this is not the case, we need to take the direct way ... - ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); - toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() ); - if ( pToolPanelViewShell ) - { - pToolPanelViewShell->ActivatePanel( i_rPanelURL ); - } - else - { - Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView( - framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ); - pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) ); - } - } -} - } // end of namespace ::sd diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx index 199aa1a4dc83..8ee7d51d3f9c 100644 --- a/sd/source/ui/dlg/PaneShells.cxx +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -103,33 +103,4 @@ LeftDrawPaneShell::~LeftDrawPaneShell (void) } - - -//===== ToolPanelPaneShell ======================================================== - -#undef ShellClass -#define ShellClass ToolPanelPaneShell - -SFX_SLOTMAP( ToolPanelPaneShell ) -{ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) ) -{ - SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() ); -} - -TYPEINIT1( ToolPanelPaneShell, SfxShell ); - -ToolPanelPaneShell::ToolPanelPaneShell() - :SfxShell() -{ - SetName( ::rtl::OUString::createFromAscii( "ToolPanel" ) ); -} - -ToolPanelPaneShell::~ToolPanelPaneShell(void) -{ -} - } // end of namespace ::sd diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 7605f4f1ed4f..4efb7a576b17 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -62,7 +62,7 @@ namespace sd { CopyDlg::CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorTable* pColTab, + XColorList* pColTab, ::sd::View* pInView ) : SfxModalDialog ( pWindow, SdResId( DLG_COPY ) ), maFtCopies ( this, SdResId( FT_COPIES ) ), diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 32f03af155ed..390726ad80ae 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -72,18 +72,19 @@ SdNavigatorWin::SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChWinCtxt, const SdResId& rSdResId, - SfxBindings* pInBindings ) -: ::Window( pParent, rSdResId ) -, maToolbox ( this, SdResId( 1 ) ) -, maTlbObjects( this, SdResId( TLB_OBJECTS ) ) -, maLbDocs ( this, SdResId( LB_DOCS ) ) -, mpChildWinContext( pChWinCtxt ) -, mbDocImported ( sal_False ) - // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen! -, meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) -, mpBindings ( pInBindings ) -, maImageList ( SdResId( IL_NAVIGATR ) ) -, maImageListH ( SdResId( ILH_NAVIGATR ) ) + SfxBindings* pInBindings, + const UpdateRequestFunctor& rUpdateRequest) + : ::Window( pParent, rSdResId ), + maToolbox ( this, SdResId( 1 ) ), + maTlbObjects( this, SdResId( TLB_OBJECTS ) ), + maLbDocs ( this, SdResId( LB_DOCS ) ), + mpChildWinContext( pChWinCtxt ), + mbDocImported ( sal_False ), + // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen! + meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ), + mpBindings ( pInBindings ), + maImageList ( SdResId( IL_NAVIGATR ) ), + maImageListH ( SdResId( ILH_NAVIGATR ) ) { maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); @@ -91,8 +92,8 @@ SdNavigatorWin::SdNavigatorWin( maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE))); - mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings ); - mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings ); + mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest); + mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest); mpDocList = new List(); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! @@ -137,13 +138,13 @@ SdNavigatorWin::SdNavigatorWin( if( nMinWidth > maMinSize.Width() ) maMinSize.Width() = nMinWidth; maMinSize.Height() -= 40; - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize ); + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetParent()); + if (pDockingParent != NULL) + pDockingParent->SetMinOutputSizePixel( maMinSize ); // InitTlb; Wird ueber Slot initiiert - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - mpBindings->GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); - + if (rUpdateRequest) + rUpdateRequest(); } // ----------------------------------------------------------------------- @@ -882,11 +883,14 @@ void SdNavigatorWin::ApplyImageList() |* \************************************************************************/ -SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdNavigatorControllerItem::SdNavigatorControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } @@ -954,9 +958,8 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, if( nState & NAVTLB_UPDATE ) { // InitTlb; Wird ueber Slot initiiert - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - GetBindings().GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + if (maUpdateRequest) + maUpdateRequest(); } } } @@ -968,11 +971,14 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, |* \************************************************************************/ -SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdPageNameControllerItem::SdPageNameControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index be71806bbb38..f8f00cba2de0 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -391,7 +391,7 @@ VclAbstractDialog * SdAbstractDialogFactory_Impl::CreateBreakDlg( //add for CopyDlg begin AbstractCopyDlg * SdAbstractDialogFactory_Impl::CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorTable* pColTab, ::sd::View* pView ) //add for CopyDlg + XColorList* pColTab, ::sd::View* pView ) //add for CopyDlg { return new AbstractCopyDlg_Impl( new ::sd::CopyDlg( pWindow, rInAttrs, pColTab, pView ) ); } diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 71ca7de2a0ca..aabb19d784b1 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -255,7 +255,7 @@ class SdAbstractDialogFactory_Impl : public SdAbstractDialogFactory public: virtual VclAbstractDialog* CreateBreakDlg(::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ); - virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorTable* pColTab, ::sd::View* pView ); + virtual AbstractCopyDlg* CreateCopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, XColorList* pColTab, ::sd::View* pView ); virtual AbstractSdCustomShowDlg* CreateSdCustomShowDlg( ::Window* pWindow, SdDrawDocument& rDrawDoc ); virtual SfxAbstractTabDialog* CreateSdTabCharDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell ); virtual SfxAbstractTabDialog* CreateSdTabPageDialog( ::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, sal_Bool bAreaPage = sal_True ); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 70148e8df615..51fe0cb0ff17 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -192,7 +192,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { // passende ColorTable ist per PutItem gesetzt worden SvxColorTableItem* pColItem = (SvxColorTableItem*) GetItem( SID_COLOR_TABLE ); - XColorTable* pTable = pColItem->GetColorTable(); + XColorList* pTable = pColItem->GetColorTable(); rReq.SetReturnValue( OfaPtrItem( SID_GET_COLORTABLE, pTable ) ); } break; diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx index 27ea6d53c4c7..b182a3b4656f 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx @@ -143,7 +143,7 @@ void ConfigurationControllerResourceManager::ActivateResource ( if ( ! xFactory.is()) { #if defined VERBOSE && VERBOSE>=1 - OSL_TRACE(" no factory found fo %s\n", + OSL_TRACE(" no factory found for %s\n", OUStringToOString(sResourceURL, RTL_TEXTENCODING_UTF8).getStr()); #endif return; @@ -163,9 +163,9 @@ void ConfigurationControllerResourceManager::ActivateResource ( // of registered factories. mpResourceFactoryContainer->RemoveFactoryForReference(xFactory); } - catch(Exception&) + catch (Exception& e) { - DBG_UNHANDLED_EXCEPTION(); + (void)e; } if (xResource.is()) @@ -204,9 +204,10 @@ void ConfigurationControllerResourceManager::ActivateResource ( /* In this method we do following steps. 1. Remove the resource from the URL->Object map of the configuration controller. - 2. Notify listeners. + 2. Notify listeners that deactivation has started. 3. Remove the resource id from the current configuration. 4. Release the resource. + 5. Notify listeners about that deactivation is completed. */ void ConfigurationControllerResourceManager::DeactivateResource ( const Reference<XResourceId>& rxResourceId, @@ -257,6 +258,12 @@ void ConfigurationControllerResourceManager::DeactivateResource ( DBG_UNHANDLED_EXCEPTION(); } + // 5. Notifiy listeners that the resource is being deactivated. + mpBroadcaster->NotifyListeners( + FrameworkHelper::msResourceDeactivationEndEvent, + rxResourceId, + NULL); + #if defined VERBOSE && VERBOSE>=1 if (bSuccess) OSL_TRACE("successfully deactivated %s\n", OUStringToOString( diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx index 51ea957897ef..86cf8b8aacd7 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx @@ -37,6 +37,9 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::rtl::OUString; +#undef VERBOSE +//#define VERBOSE 1 + namespace sd { namespace framework { ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager) @@ -84,10 +87,22 @@ void ResourceFactoryManager::AddFactory ( { // The URL is a URL pattern not an single URL. maFactoryPatternList.push_back(FactoryPatternList::value_type(rsURL, rxFactory)); + +#if defined VERBOSE && VERBOSE>=1 + OSL_TRACE("ResourceFactoryManager::AddFactory pattern %s %x\n", + OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(), + rxFactory.get()); +#endif } else { maFactoryMap[rsURL] = rxFactory; + +#if defined VERBOSE && VERBOSE>=1 + OSL_TRACE("ResourceFactoryManager::AddFactory fixed %s %x\n", + OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(), + rxFactory.get()); +#endif } } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 47d06a6e605c..eef89fd631c0 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -51,8 +51,7 @@ namespace { CenterPaneId, FullScreenPaneId, LeftImpressPaneId, - LeftDrawPaneId, - RightPaneId + LeftDrawPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); @@ -205,7 +204,7 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) mxConfigurationControllerWeak = xCC; // Add pane factories for the two left panes (one for Impress and one for - // Draw), the center pane, and the right pane. + // Draw) and the center pane. if (xController.is() && xCC.is()) { PaneDescriptor aDescriptor; @@ -231,11 +230,6 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) aDescriptor.mePaneId = LeftDrawPaneId; mpPaneContainer->push_back(aDescriptor); xCC->addResourceFactory(aDescriptor.msPaneURL, this); - - aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL; - aDescriptor.mePaneId = RightPaneId; - mpPaneContainer->push_back(aDescriptor); - xCC->addResourceFactory(aDescriptor.msPaneURL, this); } // Register as configuration change listener. @@ -304,7 +298,6 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource ( case LeftImpressPaneId: case LeftDrawPaneId: - case RightPaneId: xPane = CreateChildWindowPane( rxPaneId, *iDescriptor); @@ -524,11 +517,6 @@ Reference<XResource> BasicPaneFactory::CreateChildWindowPane ( nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId(); break; - case RightPaneId: - pShell.reset(new ToolPanelPaneShell()); - nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); - break; - default: break; } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx index 3feff87322fb..4a31a9d77231 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx @@ -67,7 +67,6 @@ namespace sd { namespace framework { private:resource/pane/FullScreenPane private:resource/pane/LeftImpressPane private:resource/pane/LeftDrawPane - private:resource/pane/RightPane There are two left panes because this is (seems to be) the only way to show different titles for the left pane in Draw and Impress. */ diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 1b0e892eafa5..70fabe2ab94d 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -38,7 +38,6 @@ #include "DrawViewShell.hxx" #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "FrameView.hxx" @@ -327,7 +326,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); } catch (RuntimeException&) @@ -445,15 +443,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) &rWindow, pFrameView)); } - else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL)) - { - pViewShell.reset( - new ::sd::toolpanel::ToolPanelViewShell( - &rFrame, - *mpBase, - &rWindow, - pFrameView)); - } else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL)) { pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create ( @@ -529,8 +518,6 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL)); maCacheableResources.push_back(pHelper->CreateResourceId( FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL)); - maCacheableResources.push_back(pHelper->CreateResourceId( - FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); } ::std::vector<Reference<XResourceId> >::const_iterator iId; diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index c6b75cc8bdaf..80a3f489eb98 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -81,6 +81,16 @@ void Pane::disposing (void) +void Pane::SetWindow (::Window* pWindow) +{ + OSL_TRACE("setting Pane::mpWindow to %x", pWindow); + mpWindow = pWindow; + mxWindow = VCLUnoHelper::GetInterface(mpWindow); +} + + + + //----- XPane ----------------------------------------------------------------- Reference<awt::XWindow> SAL_CALL Pane::getWindow (void) diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx deleted file mode 100644 index 34f0ee3dd71d..000000000000 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ /dev/null @@ -1,319 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "precompiled_sd.hxx" -#include "TaskPanelFactory.hxx" -#include "taskpane/ToolPanelViewShell.hxx" -#include "DrawController.hxx" -#include "framework/FrameworkHelper.hxx" -#include <cppuhelper/compbase1.hxx> -#include <tools/diagnose_ex.h> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::drawing::framework; - -using ::rtl::OUString; -using ::sd::framework::FrameworkHelper; - -namespace sd { namespace framework { - -Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance ( - const Reference<XComponentContext>& rxContext) -{ - return Reference<XInterface>(static_cast<XWeak*>(new TaskPanelFactory(rxContext))); -} - - - - -::rtl::OUString TaskPanelFactory_getImplementationName (void) throw(RuntimeException) -{ - return ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.framework.TaskPanelFactory")); -} - - - - -Sequence<rtl::OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void) - throw (RuntimeException) -{ - static const OUString sServiceName( - OUString::createFromAscii("com.sun.star.drawing.framework.TaskPanelFactory")); - return Sequence<rtl::OUString>(&sServiceName, 1); -} - - - - -//===== ToolPanelResource ===================================================== - -namespace { - -typedef ::cppu::WeakComponentImplHelper1 < - css::drawing::framework::XResource - > TaskPanelResourceInterfaceBase; - -class TaskPanelResource - : private ::cppu::BaseMutex, - public TaskPanelResourceInterfaceBase -{ -public: - TaskPanelResource ( - const Reference<XResourceId>& rxResourceId ); - virtual ~TaskPanelResource (); - - virtual void SAL_CALL disposing (); - - // XResource - - virtual Reference<XResourceId> SAL_CALL getResourceId (void) - throw (css::uno::RuntimeException); - - virtual sal_Bool SAL_CALL isAnchorOnly () throw (RuntimeException) - { return false; } - -private: - const Reference<XResourceId> mxResourceId; -}; - -} // end of anonymous namespace. - - - - -//===== TaskPanelFactory ======================================================= - -TaskPanelFactory::TaskPanelFactory ( - const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext) - : TaskPanelFactoryInterfaceBase(m_aMutex), - mpViewShellBase(NULL) -{ - (void)rxContext; -} - - - - -TaskPanelFactory::~TaskPanelFactory (void) -{ -} - - - - -void SAL_CALL TaskPanelFactory::disposing (void) -{ -} - - - - -//===== XInitialization ======================================================= - -void SAL_CALL TaskPanelFactory::initialize( - const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - if (aArguments.getLength() > 0) - { - try - { - // Get the XController from the first argument. - Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW); - - // Tunnel through the controller to obtain access to the ViewShellBase. - try - { - Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW); - DrawController* pController - = reinterpret_cast<DrawController*>( - sal::static_int_cast<sal_uIntPtr>( - xTunnel->getSomething(DrawController::getUnoTunnelId()))); - if (pController != NULL) - mpViewShellBase = pController->GetViewShellBase(); - - } - catch(RuntimeException&) - {} - - - Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW); - Reference<XConfigurationController> xCC ( - xCM->getConfigurationController(), UNO_QUERY_THROW); - xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this); - xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this); - xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this); - xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this); - xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this); - } - catch (RuntimeException&) - { - } - } -} - - -//===== XResourceController =================================================== - -namespace -{ - void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< ::rtl::OUString >& o_rResourceURLs ) - { - ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" ); - o_rResourceURLs.resize(0); - - Reference< XResourceId > xResourceId( i_rResourceId ); - ::rtl::OUString sResourceURL = xResourceId->getResourceURL(); - while ( sResourceURL.getLength() > 0 ) - { - o_rResourceURLs.push_back( sResourceURL ); - xResourceId = xResourceId->getAnchor(); - sResourceURL = xResourceId->getResourceURL(); - } - } -} - -Reference<XResource> SAL_CALL TaskPanelFactory::createResource ( - const Reference<XResourceId>& rxResourceId) - throw (RuntimeException, IllegalArgumentException, WrappedTargetException) -{ - Reference<XResource> xResource; - - if ( ! rxResourceId.is()) - return NULL; - - OUString sResourceURL (rxResourceId->getResourceURL()); - - if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) ) - { - toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) ); - - if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) ) - { - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) ); - - // assume that the top-level anchor is the URL of the pane - ::std::vector< ::rtl::OUString > aResourceURLs; - lcl_collectResourceURLs( rxResourceId, aResourceURLs ); - - const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ]; - const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); - - toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); - if ( pToolPanel != NULL ) - xResource = new TaskPanelResource( rxResourceId ); - - OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!" ); - } - } - - return xResource; -} - - - - -void SAL_CALL TaskPanelFactory::releaseResource ( - const Reference<XResource>& rxResource) - throw (RuntimeException) -{ - ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" ); - const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW ); - - // assume that the top-level anchor is the URL of the pane - ::std::vector< ::rtl::OUString > aResourceURLs; - lcl_collectResourceURLs( xResourceId, aResourceURLs ); - - OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" ); - if ( !aResourceURLs.empty() ) - { - const ::rtl::OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ]; - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) ); - const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) ); - if ( pPaneViewShell != NULL ) - { - const ::rtl::OUString sPanelResourceURL( xResourceId->getResourceURL() ); - const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) ); - toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() ); - - if ( ( ePanelId != toolpanel::PID_UNKNOWN ) - && ( pToolPanel != NULL ) - ) - { - pToolPanel->DeactivatePanel( sPanelResourceURL ); - } - else - { - OSL_ENSURE( false, "TaskPanelFactory::releaseResource: don't know what to do with this resource!" ); - } - } - } - - Reference<XComponent> xComponent (rxResource, UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); -} - - - - -//===== ToolPanelResource ===================================================== - -namespace { - -TaskPanelResource::TaskPanelResource ( - const Reference<XResourceId>& rxResourceId) - : TaskPanelResourceInterfaceBase(m_aMutex), - mxResourceId(rxResourceId) -{ -} - - - - -TaskPanelResource::~TaskPanelResource (void) -{ -} - - - - -void SAL_CALL TaskPanelResource::disposing () -{ -} - - - - -Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId () - throw (css::uno::RuntimeException) -{ - return mxResourceId; -} - -} // end of anonymous namespace - -} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx deleted file mode 100644 index 7ab8b1ec75e7..000000000000 --- a/sd/source/ui/framework/factories/TaskPanelFactory.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX -#define SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX - -#include <com/sun/star/drawing/framework/XResourceFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <osl/mutex.hxx> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase2.hxx> - -#include <boost/scoped_ptr.hpp> - -namespace css = ::com::sun::star; - -namespace { - -typedef ::cppu::WeakComponentImplHelper2 < - css::lang::XInitialization, - css::drawing::framework::XResourceFactory - > TaskPanelFactoryInterfaceBase; - -} // end of anonymous namespace. - - -namespace sd { class ViewShellBase; } - -namespace sd { namespace framework { - -/** This class creates panels for the task pane. -*/ -class TaskPanelFactory - : private ::cppu::BaseMutex, - public TaskPanelFactoryInterfaceBase -{ -public: - TaskPanelFactory ( - const css::uno::Reference<css::uno::XComponentContext>& rxContext); - virtual ~TaskPanelFactory (void); - - virtual void SAL_CALL disposing (void); - - - // XInitialization - - virtual void SAL_CALL initialize( - const css::uno::Sequence<css::uno::Any>& aArguments) - throw (css::uno::Exception, css::uno::RuntimeException); - - - // XResourceFactory - - virtual css::uno::Reference<css::drawing::framework::XResource> - SAL_CALL createResource ( - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxResourcesId) - throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); - - virtual void SAL_CALL releaseResource ( - const css::uno::Reference< - css::drawing::framework::XResource>& rxResource) - throw (css::uno::RuntimeException); - -private: - ViewShellBase* mpViewShellBase; -}; - -} } // end of namespace sd::framework - -#endif diff --git a/sd/source/ui/framework/factories/TaskPanelResource.cxx b/sd/source/ui/framework/factories/TaskPanelResource.cxx new file mode 100644 index 000000000000..8964359907b0 --- /dev/null +++ b/sd/source/ui/framework/factories/TaskPanelResource.cxx @@ -0,0 +1,133 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "framework/TaskPanelResource.hxx" + +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + + +using namespace css; +using namespace cssu; +using namespace cssdf; + + +namespace sd { namespace framework { + +namespace { + ::Window* GetWindowForResource ( + ViewShellBase& rViewShellBase, + const cssu::Reference<cssdf::XResourceId>& rxResourceId) + { + ::Window* pWindow = NULL; + if (rxResourceId.is() && rxResourceId->getAnchor().is()) + { + ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rViewShellBase)); + Reference<awt::XWindow> xWindow ( + pFrameworkHelper->GetPaneWindow(rxResourceId->getAnchor()->getAnchor())); + pWindow = VCLUnoHelper::GetWindow(xWindow); + } + return pWindow; + } +} + + + + +TaskPanelResource::TaskPanelResource ( + sidebar::SidebarViewShell& rSidebarViewShell, + sidebar::PanelId ePanelId, + const Reference<XResourceId>& rxResourceId) + : TaskPanelResourceInterfaceBase(m_aMutex), + mxResourceId(rxResourceId), + mpControl(rSidebarViewShell.CreatePanel( + GetWindowForResource(rSidebarViewShell.GetViewShellBase(), rxResourceId), + ePanelId)) +{ + if (mpControl.get() != NULL) + { + mpControl->Show(); + mpControl->GetParent()->Show(); + mpControl->AddEventListener(LINK(this,TaskPanelResource,WindowEventHandler)); + } +} + + + + +TaskPanelResource::~TaskPanelResource (void) +{ + mpControl.reset(); +} + + + + +void SAL_CALL TaskPanelResource::disposing () +{ + mpControl.reset(); +} + + + + +Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId () + throw (css::uno::RuntimeException) +{ + return mxResourceId; +} + + + + +sal_Bool SAL_CALL TaskPanelResource::isAnchorOnly (void) + throw (RuntimeException) +{ + return false; +} + + + + +::Window* TaskPanelResource::GetControl (void) const +{ + return mpControl.get(); +} + + + + +IMPL_LINK(TaskPanelResource,WindowEventHandler,VclWindowEvent*,pEvent) +{ + if (pEvent!=NULL && pEvent->GetId()==SFX_HINT_DYING) + { + // Somebody else deleted the window. Release our reference so + // that we do not delete it again. + mpControl.release(); + return sal_True; + } + else + return sal_False; +} + +} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index 826467c99fd1..5aec3f2906e0 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -25,7 +25,6 @@ #include "framework/ViewShellWrapper.hxx" #include "framework/Pane.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "ViewShell.hxx" #include "Window.hxx" @@ -50,7 +49,6 @@ using ::com::sun::star::rendering::XCanvas; using ::com::sun::star::lang::DisposedException; using ::rtl::OUString; -using ::sd::toolpanel::ToolPanelViewShell; namespace sd { namespace framework { diff --git a/sd/source/ui/framework/factories/makefile.mk b/sd/source/ui/framework/factories/makefile.mk index 9699a5892daa..d92741419fba 100644 --- a/sd/source/ui/framework/factories/makefile.mk +++ b/sd/source/ui/framework/factories/makefile.mk @@ -47,7 +47,6 @@ SLOFILES = \ $(SLO)$/FullScreenPane.obj \ $(SLO)$/Pane.obj \ $(SLO)$/PresentationFactory.obj \ - $(SLO)$/TaskPanelFactory.obj \ $(SLO)$/ViewShellWrapper.obj # --- Tagets ------------------------------------------------------- diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index caba74aa51a5..79c87d06fa61 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -29,7 +29,6 @@ #include "ViewTabBarModule.hxx" #include "CenterViewFocusModule.hxx" #include "SlideSorterModule.hxx" -#include "ToolPanelModule.hxx" #include "ToolBarModule.hxx" #include "ShellStackGuard.hxx" @@ -50,7 +49,6 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController) new SlideSorterModule( rxController, FrameworkHelper::msLeftImpressPaneURL); - ToolPanelModule::Initialize(rxController); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index 77922bfefd44..3bb93aa86058 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -304,9 +304,18 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) // Create the factory service. Sequence<Any> aArguments(1); aArguments[0] <<= mxController; - xFactory = xGlobalFactory->createInstanceWithArguments( - iFactory->second, - aArguments); + OSL_TRACE("creating resource %s", + OUStringToOString(iFactory->second, RTL_TEXTENCODING_ASCII_US).getStr()); + try + { + xFactory = xGlobalFactory->createInstanceWithArguments( + iFactory->second, + aArguments); + } + catch(Exception&e) + { + OSL_TRACE("caught exception while creating factory."); + } // Remember that this factory has been instanced. (*mpLoadedFactories)[iFactory->second] = xFactory; diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx index 007f34501e38..cf72e1d12560 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.cxx +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -142,8 +142,8 @@ void ToolPanelModule::Initialize (const Reference<frame::XController>& rxControl new ResourceManager( rxController, FrameworkHelper::CreateResourceId( - FrameworkHelper::msTaskPaneURL, - FrameworkHelper::msRightPaneURL))); + FrameworkHelper::msSidebarViewURL, + FrameworkHelper::msSidebarPaneURL))); pResourceManager->AddActiveMainView(FrameworkHelper::msImpressViewURL); pResourceManager->AddActiveMainView(FrameworkHelper::msNotesViewURL); pResourceManager->AddActiveMainView(FrameworkHelper::msHandoutViewURL); diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index 33535330b231..5f79903401b2 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #include "precompiled_sd.hxx" #include <osl/time.h> @@ -37,6 +35,7 @@ #include "DrawController.hxx" #include "app.hrc" #include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XPane.hpp> #include <cppuhelper/compbase1.hxx> #include <svl/lstner.hxx> @@ -102,8 +101,10 @@ public: virtual ~CallbackCaller (void); virtual void SAL_CALL disposing (void); + // XEventListener virtual void SAL_CALL disposing (const lang::EventObject& rEvent) throw (RuntimeException); + // XConfigurationChangeListener virtual void SAL_CALL notifyConfigurationChange (const ConfigurationChangeEvent& rEvent) throw (RuntimeException); @@ -179,8 +180,8 @@ const OUString FrameworkHelper::msLeftImpressPaneURL( msPaneURLPrefix + OUString::createFromAscii("LeftImpressPane")); const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + OUString::createFromAscii("LeftDrawPane")); -const OUString FrameworkHelper::msRightPaneURL( - msPaneURLPrefix + OUString::createFromAscii("RightPane")); +const OUString FrameworkHelper::msSidebarPaneURL( + msPaneURLPrefix + OUString::createFromAscii("SidebarPane")); // View URLs. @@ -201,8 +202,8 @@ const OUString FrameworkHelper::msSlideSorterURL( msViewURLPrefix + OUString::createFromAscii("SlideSorter")); const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + OUString::createFromAscii("PresentationView")); -const OUString FrameworkHelper::msTaskPaneURL( - msViewURLPrefix + OUString::createFromAscii("TaskPane")); +const OUString FrameworkHelper::msSidebarViewURL( + msViewURLPrefix + OUString::createFromAscii("SidebarView")); // Tool bar URLs. @@ -215,9 +216,13 @@ const OUString FrameworkHelper::msViewTabBarURL( // Task panel URLs. const ::rtl::OUString FrameworkHelper::msTaskPanelURLPrefix( - OUString::createFromAscii("private:resource/toolpanel/DrawingFramework/")); -const ::rtl::OUString FrameworkHelper::msMasterPagesTaskPanelURL( - msTaskPanelURLPrefix + OUString::createFromAscii("MasterPages")); + OUString::createFromAscii("private:resource/toolpanel/")); +const ::rtl::OUString FrameworkHelper::msAllMasterPagesTaskPanelURL( + msTaskPanelURLPrefix + OUString::createFromAscii("AllMasterPages")); +const ::rtl::OUString FrameworkHelper::msRecentMasterPagesTaskPanelURL( + msTaskPanelURLPrefix + OUString::createFromAscii("RecentMasterPages")); +const ::rtl::OUString FrameworkHelper::msUsedMasterPagesTaskPanelURL( + msTaskPanelURLPrefix + OUString::createFromAscii("UsedMasterPages")); const ::rtl::OUString FrameworkHelper::msLayoutTaskPanelURL( msTaskPanelURLPrefix + OUString::createFromAscii("Layouts")); const ::rtl::OUString FrameworkHelper::msTableDesignPanelURL( @@ -237,6 +242,8 @@ const OUString FrameworkHelper::msResourceActivationEvent( OUString::createFromAscii("ResourceActivation")); const OUString FrameworkHelper::msResourceDeactivationEvent( OUString::createFromAscii("ResourceDeactivation")); +const OUString FrameworkHelper::msResourceDeactivationEndEvent( + OUString::createFromAscii("ResourceDeactivationEnd")); const OUString FrameworkHelper::msConfigurationUpdateStartEvent( OUString::createFromAscii("ConfigurationUpdateStart")); const OUString FrameworkHelper::msConfigurationUpdateEndEvent( @@ -337,6 +344,20 @@ private: +//----- FrameworkHelper::Deleter ---------------------------------------------- + +class FrameworkHelper::Deleter +{ +public: + void operator()(FrameworkHelper* pObject) + { + delete pObject; + } +}; + + + + //----- FrameworkHelper ------------------------------------------------------- ::boost::scoped_ptr<FrameworkHelper::ViewURLMap> FrameworkHelper::mpViewURLMap(new ViewURLMap()); @@ -381,7 +402,9 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap; ::osl::MutexGuard aGuard (aMutexFunctor()); if (iHelper == maInstanceMap.end()) { - pHelper = ::boost::shared_ptr<FrameworkHelper>(new FrameworkHelper(rBase)); + pHelper = ::boost::shared_ptr<FrameworkHelper>( + new FrameworkHelper(rBase), + FrameworkHelper::Deleter()); pHelper->Initialize(); OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); maInstanceMap[&rBase] = pHelper; @@ -524,6 +547,61 @@ Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneO +Reference<awt::XWindow> FrameworkHelper::GetPaneWindow (const Reference<XResourceId>& rxPaneId) +{ + Reference<awt::XWindow> xWindow; + + if (rxPaneId.is() && mxConfigurationController.is()) + { + try + { + if (rxPaneId->getResourceURL().match(msPaneURLPrefix)) + { + Reference<XPane> xPane (mxConfigurationController->getResource(rxPaneId), UNO_QUERY); + if (xPane.is()) + xWindow = xPane->getWindow(); + } + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + { + } + } + + return xWindow; +} + + + + +Reference<XResource> FrameworkHelper::GetResource (const Reference<XResourceId>& rxResourceId) +{ + Reference<XResource> xResource; + + if (rxResourceId.is() && mxConfigurationController.is()) + { + try + { + return mxConfigurationController->getResource(rxResourceId); + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + { + } + } + + return NULL; +} + + + + Reference<XResourceId> FrameworkHelper::RequestView ( const OUString& rsResourceURL, const OUString& rsAnchorURL) @@ -559,7 +637,7 @@ Reference<XResourceId> FrameworkHelper::RequestView ( -void FrameworkHelper::RequestTaskPanel ( +Reference<XResourceId> FrameworkHelper::RequestSidebarPanel ( const OUString& rsTaskPanelURL, const bool bEnsureTaskPaneIsVisible) { @@ -572,26 +650,29 @@ void FrameworkHelper::RequestTaskPanel ( { Reference<XConfiguration> xConfiguration ( mxConfigurationController->getCurrentConfiguration()); - if (xConfiguration.is()) - if ( ! xConfiguration->hasResource( - CreateResourceId(msTaskPaneURL, msRightPaneURL))) - { - // Task pane does is not active. Do not force it. - return; - } + if (xConfiguration.is()) + if ( ! xConfiguration->hasResource( + CreateResourceId(msSidebarViewURL, msSidebarPaneURL))) + { + // Task pane is not active. Do not force it. + return NULL; + } } - // Create the resource id from URLs for the pane, the task pane - // view, and the task panel. + // Create the resource id from URLs for the sidebar pane + // and view and the requested panel. mxConfigurationController->requestResourceActivation( - CreateResourceId(msRightPaneURL), + CreateResourceId(msSidebarPaneURL), ResourceActivationMode_ADD); mxConfigurationController->requestResourceActivation( - CreateResourceId(msTaskPaneURL, msRightPaneURL), + CreateResourceId(msSidebarViewURL, msSidebarPaneURL), ResourceActivationMode_REPLACE); + Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL)); mxConfigurationController->requestResourceActivation( - CreateResourceId(rsTaskPanelURL, msTaskPaneURL, msRightPaneURL), + xPanelId, ResourceActivationMode_REPLACE); + + return xPanelId; } } catch (lang::DisposedException&) @@ -600,6 +681,26 @@ void FrameworkHelper::RequestTaskPanel ( } catch (RuntimeException&) {} + + return NULL; +} + + + + +void FrameworkHelper::RequestResourceDeactivation (const cssu::Reference<cssdf::XResourceId>& rxResourceId) +{ + try + { + if (mxConfigurationController.is() && rxResourceId.is()) + mxConfigurationController->requestResourceDeactivation(rxResourceId); + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + {} } @@ -616,7 +717,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) (*mpViewURLMap)[msHandoutViewURL] = ViewShell::ST_HANDOUT; (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER; (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION; - (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE; + (*mpViewURLMap)[msSidebarViewURL] = ViewShell::ST_SIDEBAR; } ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL)); if (iView != mpViewURLMap->end()) @@ -639,7 +740,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const rtl::OUString& rsViewURL) case ViewShell::ST_HANDOUT : return msHandoutViewURL; case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL; case ViewShell::ST_PRESENTATION : return msPresentationViewURL; - case ViewShell::ST_TASK_PANE : return msTaskPaneURL; + case ViewShell::ST_SIDEBAR : return msSidebarViewURL; default: return OUString(); } @@ -788,6 +889,30 @@ void FrameworkHelper::RunOnResourceActivation( +void FrameworkHelper::RunOnResourceDeactivation( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const Callback& rCallback, + const bool bRunOnDeactivationEnd) +{ + if (mxConfigurationController.is() + && ! mxConfigurationController->getResource(rxResourceId).is()) + { + rCallback(false); + } + else + { + RunOnEvent( + bRunOnDeactivationEnd + ? msResourceDeactivationEndEvent + : msResourceDeactivationEvent, + FrameworkHelperResourceIdFilter(rxResourceId), + rCallback); + } +} + + + + /** A callback that sets a flag to a specified value when the callback is called. */ diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx index ce3a5202c111..96cf766a9ead 100644 --- a/sd/source/ui/func/fuarea.cxx +++ b/sd/source/ui/func/fuarea.cxx @@ -91,6 +91,8 @@ void FuArea::DoExecute( SfxRequest& rReq ) SID_ATTR_FILL_GRADIENT, SID_ATTR_FILL_HATCH, SID_ATTR_FILL_BITMAP, + SID_ATTR_FILL_TRANSPARENCE, + SID_ATTR_FILL_FLOATTRANSPARENCE, 0 }; mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx index 9ed3e12c2efc..9bc2e307ebed 100644 --- a/sd/source/ui/func/fuchar.cxx +++ b/sd/source/ui/func/fuchar.cxx @@ -26,7 +26,7 @@ #include "fuchar.hxx" - +#include <svx/dialogs.hrc> #include <sfx2/viewfrm.hxx> #include <editeng/editdata.hxx> @@ -87,6 +87,10 @@ void FuChar::DoExecute( SfxRequest& rReq ) SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0; if( pDlg ) { + if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } sal_uInt16 nResult = pDlg->Execute(); if( nResult == RET_OK ) @@ -110,9 +114,12 @@ void FuChar::DoExecute( SfxRequest& rReq ) SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_SHADOWED, + SID_ATTR_CHAR_STRIKEOUT, SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_KERNING, SID_SET_SUPER_SCRIPT, SID_SET_SUB_SCRIPT, 0 }; diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx index d7e4108b5d94..7f7f70760406 100644 --- a/sd/source/ui/func/fuline.cxx +++ b/sd/source/ui/func/fuline.cxx @@ -99,11 +99,16 @@ void FuLine::DoExecute( SfxRequest& rReq ) // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden static sal_uInt16 SidArray[] = { - SID_ATTR_LINE_STYLE, - SID_ATTR_LINE_DASH, - SID_ATTR_LINE_WIDTH, - SID_ATTR_LINE_COLOR, - 0 }; + SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 ) + SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 ) + SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 ) + SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 ) + SID_ATTR_LINE_START, // ( SID_SVX_START + 173 ) + SID_ATTR_LINE_END, // ( SID_SVX_START + 174 ) + SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107) + SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110) + SID_ATTR_LINE_CAP, // (SID_SVX_START+1111) + 0 }; mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index e96979b1818d..e8b31a725382 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -32,6 +32,9 @@ #include <editeng/eeitem.hxx> #include <sfx2/request.hxx> #include <svl/intitem.hxx> +#include <editeng/numitem.hxx> +#include "sdresid.hxx" +#include "glob.hrc" #include <editeng/editdata.hxx> #include <svx/svxids.hrc> @@ -43,7 +46,10 @@ #endif #include "drawdoc.hxx" #include "sdabstdlg.hxx" - +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <svx/svdoutl.hxx> +using namespace svx::sidebar; namespace sd { TYPEINIT1( FuOutlineBullet, FuPoor ); @@ -70,6 +76,16 @@ FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWi void FuOutlineBullet::DoExecute( SfxRequest& rReq ) { + sal_uInt16 nSId = rReq.GetSlot(); + if (nSId == FN_SVX_SET_BULLET){ + SetCurrentBullet(rReq); + return; + } + else if (nSId == FN_SVX_SET_NUMBER){ + SetCurrentNumbering(rReq); + return; + } + const SfxItemSet* pArgs = rReq.GetArgs(); if( !pArgs ) @@ -137,6 +153,390 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) */ } +void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq) +{ + if (!mpDoc || !mpView) + return; + + SfxItemSet aEditAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + SfxItemSet aSetAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + + //Init bullet level in "Customize" tab page in bullet dialog in master page view + if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) + && ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE ) + { + SdrObject* pObj = mpView->GetTextEditObject(); + if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) + { + sal_uInt16 nLevel = mpView->GetSelectionLevel(); + if( nLevel != 0xFFFF ) + { + + SfxItemSet aStoreSet( aNewAttr ); + aNewAttr.ClearItem(); + //extend range + aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); + aNewAttr.Put( aStoreSet ); + //put current level user selected + aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + } + } + } + //End of add + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE; + + if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False ); + if (pItem && pNumRule) + { + sal_uInt16 nIdx = pItem->GetValue(); + // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off + // And the bullet default status is 1. + bool bBulletSwitch = false; + sal_Bool isRemoveNum =false; + if( nIdx == (sal_uInt16)0xFFFF ) + { + nIdx = 1; + bBulletSwitch = true; + } + if (nIdx == DEFAULT_NONE) + { + bBulletSwitch = false; + isRemoveNum = true; + } + nIdx--; + + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + //Sym3_2508, set unit attribute to NB Manager + pNumbering->SetItems(&aNewAttr); + SvxNumRule aTmpRule( *pNumRule ); + pNumbering->ApplyNumRule(aTmpRule,nIdx,nActNumLvl); + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); + pNumRule->SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); + OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); + + std::auto_ptr< OutlineViewModelChangeGuard > aGuard; + + if (mpView->ISA(OutlineView)) + { + pOLV = static_cast<OutlineView*>(mpView) + ->GetViewByWindow(mpViewShell->GetActiveWindow()); + + aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); + } + + SdrOutliner* pOwner = mpView->GetTextEditOutliner(); + bool bMasterView = false; + + DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell); + + if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE ) + bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + + if( bMasterView ) + { + pOwner->UndoActionStart( OLUNDO_ATTR ); + pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule,isRemoveNum); + mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151 + pOwner->UndoActionEnd( OLUNDO_ATTR ); + } + else if( pOLV ) + pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule ,isRemoveNum); + else + { + sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE; + SdrModel* pSdrModel = mpView->GetModel(); + sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False; + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->BegUndo(); + } + mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_False, bInMasterView, pNumRule,isRemoveNum); + if (bInMasterView) + { + mpView->SetAttributes(aSetAttr); + } + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->EndUndo(); + } + } + } + //End + } + delete pNumRule; + rReq.Done(); +} + +void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq) +{ + if (!mpDoc || !mpView) + return; + + SfxItemSet aEditAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + //Add for Sym2_3151, should add new attributes in an empty item set, then use this item set as parameter in SetAttributes() + SfxItemSet aSetAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + + //Init bullet level in "Customize" tab page in bullet dialog in master page view + if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) + && ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE ) + { + SdrObject* pObj = mpView->GetTextEditObject(); + if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) + { + sal_uInt16 nLevel = mpView->GetSelectionLevel(); + if( nLevel != 0xFFFF ) + { + //aNewAttr.MergeRange( SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL ); + //aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + //save the itemset value + SfxItemSet aStoreSet( aNewAttr ); + aNewAttr.ClearItem(); + //extend range + aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); + aNewAttr.Put( aStoreSet ); + //put current level user selected + aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + } + } + } + //End of add + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE; + + if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); + if (pItem && pNumRule) + { + sal_uInt16 nIdx = pItem->GetValue(); + // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off + // And the bullet default status is 2. + bool bBulletSwitch = false; + sal_Bool isRemoveNum =false; + if( nIdx == (sal_uInt16)0xFFFF ) + { + nIdx = 1; + bBulletSwitch = true; + } + if (nIdx == DEFAULT_NONE) + { + bBulletSwitch = false; + isRemoveNum = true; + } + + nIdx--; + //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.8.7 + + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + //Sym3_2508, set unit attribute to NB Manager + pBullets->SetItems(&aNewAttr); + SvxNumRule aTmpRule( *pNumRule ); + //Sym3_3423 Always apply the "." if wants a default numbering rule + if (bBulletSwitch==true && nIdx==0) //want to reset bullet + { + pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true); + } + else { + pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl); + } + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); + pNumRule->SetLevel(i, aFmt); + } + nMask <<= 1; + } + aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); + + OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); + + std::auto_ptr< OutlineViewModelChangeGuard > aGuard; + + if (mpView->ISA(OutlineView)) + { + pOLV = static_cast<OutlineView*>(mpView) + ->GetViewByWindow(mpViewShell->GetActiveWindow()); + + aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); + } + + SdrOutliner* pOwner = mpView->GetTextEditOutliner(); + bool bMasterView = false; + + DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell); + + if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE ) + bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + + if( bMasterView ) + { + pOwner->UndoActionStart( OLUNDO_ATTR ); + pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum ); + mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151 + pOwner->UndoActionEnd( OLUNDO_ATTR ); + } + else if( pOLV ) + pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum ); + else + { + sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE; + SdrModel* pSdrModel = mpView->GetModel(); + sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False; + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->BegUndo(); + } + mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_True, bInMasterView, pNumRule, isRemoveNum ); + if (bInMasterView) + { + mpView->SetAttributes(aSetAttr); + } + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->EndUndo(); + } + } + } + //End + } + delete pNumRule; + rReq.Done(); +} + +const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId) +{ + //SvxNumBulletItem* pRetItem = NULL; + const SfxPoolItem* pTmpItem = NULL; + + if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET) + { + return pTmpItem; + } + else + { + nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + else + { + sal_Bool bOutliner = sal_False; + sal_Bool bTitle = sal_False; + + if( mpView ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const sal_uInt32 nCount = rMarkList.GetMarkCount(); + for(sal_uInt32 nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId((sal_uInt16)STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + //DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" ); + + aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + + if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pItem->GetNumRule(); + if(pRule) + { + SvxNumRule aNewRule( *pRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aNewAttr.Put(aNewItem); + } + } + + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + + } + //DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!") + } + return pTmpItem; +} } // end of namespace sd diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx index 82010cbe5d6e..922d02923052 100644 --- a/sd/source/ui/func/fuoltext.cxx +++ b/sd/source/ui/func/fuoltext.cxx @@ -61,9 +61,12 @@ static sal_uInt16 SidArray[] = { SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_SHADOWED, + SID_ATTR_CHAR_STRIKEOUT, SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_KERNING, SID_OUTLINE_UP, SID_OUTLINE_DOWN, SID_OUTLINE_LEFT, diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index 65f08860860f..650ac325ba79 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -154,6 +154,8 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) // invalidieren der Slots static sal_uInt16 SidArray[] = { SID_ATTR_TABSTOP, + SID_ATTR_PARA_LINESPACE, + SID_ATTR_PARA_ULSPACE, SID_ATTR_PARA_ADJUST_LEFT, SID_ATTR_PARA_ADJUST_RIGHT, SID_ATTR_PARA_ADJUST_CENTER, diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 3cb88f4530a1..10969efbc1d2 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -93,9 +93,12 @@ static sal_uInt16 SidArray[] = { SID_ATTR_CHAR_FONT, // 10007 SID_ATTR_CHAR_POSTURE, // 10008 SID_ATTR_CHAR_WEIGHT, // 10009 + SID_ATTR_CHAR_SHADOWED, //10010 + SID_ATTR_CHAR_STRIKEOUT, //10013 SID_ATTR_CHAR_UNDERLINE, // 10014 SID_ATTR_CHAR_FONTHEIGHT, // 10015 SID_ATTR_CHAR_COLOR, // 10017 + SID_ATTR_CHAR_KERNING, //10018 SID_ATTR_PARA_ADJUST_LEFT, // 10028 SID_ATTR_PARA_ADJUST_RIGHT, // 10029 SID_ATTR_PARA_ADJUST_CENTER, // 10030 @@ -103,14 +106,26 @@ static sal_uInt16 SidArray[] = { SID_ATTR_PARA_LINESPACE_10, // 10034 SID_ATTR_PARA_LINESPACE_15, // 10035 SID_ATTR_PARA_LINESPACE_20, // 10036 + SID_ATTR_PARA_ULSPACE, // 10042 SID_ATTR_PARA_LRSPACE, // 10043 + SID_ATTR_TRANSFORM_POS_X, // 10088 + SID_ATTR_TRANSFORM_POS_Y, // 10089 + SID_ATTR_TRANSFORM_WIDTH, // 10090 + SID_ATTR_TRANSFORM_HEIGHT,// 10091 + SID_ATTR_TRANSFORM_ROT_X, // 10093 + SID_ATTR_TRANSFORM_ROT_Y, // 10094 + SID_ATTR_TRANSFORM_ANGLE, // 10095 //Added SID_OUTLINE_UP, // 10150 SID_OUTLINE_DOWN, // 10151 SID_OUTLINE_LEFT, // 10152 SID_OUTLINE_RIGHT, // 10153 + SID_ATTR_TRANSFORM_PROTECT_POS,// 10236 + SID_ATTR_TRANSFORM_PROTECT_SIZE,// 10237 //Added SID_FORMTEXT_STYLE, // 10257 SID_SET_SUPER_SCRIPT, // 10294 SID_SET_SUB_SCRIPT, // 10295 + SID_ATTR_TRANSFORM_AUTOWIDTH,// 10310 + SID_ATTR_TRANSFORM_AUTOHEIGHT,// 10311 //Added SID_HYPERLINK_GETLINK, // 10361 SID_CHARMAP, // 10503 SID_TEXTDIRECTION_LEFT_TO_RIGHT, // 10907 @@ -1183,7 +1198,8 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag) { // #98198# Move cursor to end of text ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); - pOLV->SetSelection(aNewSelection); + if (pOLV != NULL) + pOLV->SetSelection(aNewSelection); } } else diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 90e66012b0fe..7dc873bdad61 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -28,8 +28,10 @@ #include "tools/AsynchronousCall.hxx" #include <sfx2/viewfac.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "TabControl.hxx" #include "pres.hxx" +#include <svx/sidebar/SelectionChangeHandler.hxx> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/scanner/XScannerManager.hpp> @@ -164,6 +166,7 @@ public: void ExecCtrl(SfxRequest& rReq); void GetCtrlState(SfxItemSet& rSet); + void GetDrawAttrState(SfxItemSet& rSet); void GetMenuState(SfxItemSet& rSet); void GetTableMenuState(SfxItemSet& rSet); /** Set the items of the given item set that are related to @@ -196,6 +199,9 @@ public: void ExecNavigatorWin(SfxRequest& rReq); void GetNavigatorWinState(SfxItemSet& rSet); + void ExecutePropPanelAttr (SfxRequest& rReq); + void GetStatePropPanelAttr(SfxItemSet& rSet); + void ExecEffectWin(SfxRequest& rReq); void Update3DWindow(); @@ -218,6 +224,8 @@ public: void AttrExec (SfxRequest& rReq); void AttrState (SfxItemSet& rSet); + void ExecChar(SfxRequest& rReq); + void ExecuteAnnotation (SfxRequest& rRequest); void GetAnnotationState (SfxItemSet& rItemSet); @@ -430,6 +438,10 @@ private: */ bool mbIsInSwitchPage; + /** Listen for selection changes and broadcast context changes for the sidebar. + */ + ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + void Construct (DrawDocShell* pDocSh, PageKind ePageKind); /** Depending on the given request create a new page or duplicate an @@ -483,6 +495,8 @@ private: const sal_uInt16 nSnapLineIndex, const Point& rMouseLocation); + ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const; + using ViewShell::Notify; ::std::auto_ptr< AnnotationManager > mpAnnotationManager; diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index b69cff505aa7..f3d7aedd9119 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -69,28 +69,6 @@ public: }; - - -//====================================================================================================================== -//= ToolPanelChildWindow -//====================================================================================================================== -class ToolPanelChildWindow :public PaneChildWindow - ,public ::sfx2::ITaskPaneToolPanelAccess -{ -public: - ToolPanelChildWindow( - ::Window* i_pParentWindow, - sal_uInt16 i_nId, - SfxBindings* i_pBindings, - SfxChildWinInfo* i_pChildWindowInfo ); - - SFX_DECL_CHILDWINDOW( ToolPanelChildWindow ); - - // ::sfx2::ITaskPaneToolPanelAccess - virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ); -}; - - } // end of namespace ::sd #endif diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/inc/SidebarPanelId.hxx index 355295d7f55d..ada38b6f2d99 100644 --- a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx +++ b/sd/source/ui/inc/SidebarPanelId.hxx @@ -19,35 +19,35 @@ * *************************************************************/ +#ifndef SD_SIDEBAR_PANEL_ID_HXX +#define SD_SIDEBAR_PANEL_ID_HXX - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/TaskPaneControlFactory.hxx" - -#include <vos/diagnose.hxx> - -namespace sd { namespace toolpanel { - -ControlFactory::ControlFactory (void) -{ -} - - - - -ControlFactory::~ControlFactory (void) +namespace rtl { + class OUString; } +namespace sd { namespace sidebar { - -::std::auto_ptr<TreeNode> ControlFactory::CreateControl( ::Window& i_rParent ) +/** List of top level panels that can be shown in the task pane. +*/ +enum PanelId { - TreeNode* pNewNode = InternalCreateControl( i_rParent ); - return ::std::auto_ptr<TreeNode>( pNewNode ); -} - -} } // end of namespace ::sd::toolpanel + PID__START = 0, + PID_UNKNOWN = PID__START, + PID_MASTER_PAGES_ALL, + PID_MASTER_PAGES_RECENT, + PID_MASTER_PAGES_USED, + PID_LAYOUT, + PID_TABLE_DESIGN, + PID_ANIMATION_SCHEMES, + PID_CUSTOM_ANIMATION, + PID_SLIDE_TRANSITION, + PID__END = PID_SLIDE_TRANSITION +}; + +} } // namespace sd::sidebar + + +#endif diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index b088c8fb1e49..5591d3d873e2 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -115,6 +115,7 @@ public: virtual void ArrangeGUIElements (void); virtual void Activate (sal_Bool IsMDIActivate); + virtual void Deactivate (sal_Bool IsMDIActivate); //===== Drag and Drop ===================================================== diff --git a/sd/source/ui/inc/TextObjectBar.hxx b/sd/source/ui/inc/TextObjectBar.hxx index a86512808d26..05c348c42754 100644 --- a/sd/source/ui/inc/TextObjectBar.hxx +++ b/sd/source/ui/inc/TextObjectBar.hxx @@ -51,6 +51,7 @@ public: virtual ~TextObjectBar (void); void GetAttrState( SfxItemSet& rSet ); + void GetCharState( SfxItemSet& rSet ); void Execute( SfxRequest &rReq ); virtual void Command( const CommandEvent& rCEvt ); diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index abe3811df04a..c541fbbadd05 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -36,6 +36,7 @@ #include "fupoor.hxx" #include "smarttag.hxx" +#include <editeng/numitem.hxx> class SdDrawDocument; class SdrOle2Obj; @@ -190,6 +191,8 @@ public: virtual void CheckPossibilities(); virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark); using SdrMarkView::MarkPoints; + sal_Bool ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet); + void ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false); void SetPossibilitiesDirty() { bPossibilitiesDirty = true; } void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; } diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 264ae75d175d..d744a57d9572 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -35,9 +35,7 @@ #include "glob.hxx" #include "pres.hxx" #include "cfgids.hxx" -#ifndef _SD_VIEW_HXX #include "View.hxx" -#endif #include "sddllapi.h" #include <com/sun/star/drawing/XDrawSubController.hpp> @@ -111,7 +109,7 @@ public: ST_OUTLINE, ST_SLIDE_SORTER, ST_PRESENTATION, - ST_TASK_PANE + ST_SIDEBAR }; static const int MAX_HSPLIT_CNT = 1; static const int MAX_VSPLIT_CNT = 1; @@ -212,6 +210,8 @@ public: virtual void SetUIUnit(FieldUnit eUnit); virtual void SetDefTabHRuler( sal_uInt16 nDefTab ); + const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId); + sal_Bool HasRuler (void); void SetRuler(sal_Bool bRuler); diff --git a/sd/source/ui/inc/celltempl.hxx b/sd/source/ui/inc/celltempl.hxx index 26f7d8be3cec..7cb005c1c1ee 100644 --- a/sd/source/ui/inc/celltempl.hxx +++ b/sd/source/ui/inc/celltempl.hxx @@ -26,7 +26,7 @@ #include <sfx2/styledlg.hxx> -class XColorTable; +class XColorList; class XGradientList; class XHatchList; class XBitmapList; @@ -36,7 +36,7 @@ class SdrModel; class SdPresCellTemplateDlg : public SfxStyleDialog { private: - XColorTable* mpColorTab; + XColorList* mpColorTab; XGradientList* mpGradientList; XHatchList* mpHatchingList; XBitmapList* mpBitmapList; diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 3ba88505cbc8..467f48b6ad47 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -33,7 +33,7 @@ #include <vcl/fixed.hxx> #include <sfx2/basedlgs.hxx> -class XColorTable; +class XColorList; namespace sd { @@ -49,7 +49,7 @@ class CopyDlg { public: CopyDlg( ::Window* pWindow, const SfxItemSet& rInAttrs, - XColorTable* pColTab, ::sd::View* pView ); + XColorList* pColTab, ::sd::View* pView ); ~CopyDlg(); void GetAttr( SfxItemSet& rOutAttrs ); @@ -86,7 +86,7 @@ private: PushButton maBtnSetDefault; const SfxItemSet& mrOutAttrs; - XColorTable* mpColorTab; + XColorList* mpColorTab; Fraction maUIScale; ::sd::View* mpView; diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx index 0e6408dd0a27..27116933a605 100644 --- a/sd/source/ui/inc/dlgpage.hxx +++ b/sd/source/ui/inc/dlgpage.hxx @@ -29,7 +29,7 @@ #include "dlgpage.hrc" class SfxObjectShell; -class XColorTable; +class XColorList; class XGradientList; class XHatchList; class XBitmapList; @@ -48,7 +48,7 @@ private: const SfxObjectShell* mpDocShell; - XColorTable* mpColorTab; + XColorList* mpColorTab; XGradientList* mpGradientList; XHatchList* mpHatchingList; XBitmapList* mpBitmapList; diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index 9c9c642b98a2..d8ac6a321c44 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -48,6 +48,8 @@ class OUString; } namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssdf = ::com::sun::star::drawing::framework; namespace sd { namespace framework { @@ -56,10 +58,10 @@ namespace sd { namespace framework { It has three main tasks: 1. Provide frequently used strings of resource URLs and event names. 2. Provide shortcuts for accessing the sd framework. - 3. Easy the migration to the drawing framwork. + 3. Ease the migration to the drawing framwork. Note that a FrameworkHelper disposes itself when one of the resource - controllers called by it throw a DisposedException. + controllers called by it throws a DisposedException. */ class FrameworkHelper : public ::boost::enable_shared_from_this<FrameworkHelper>, @@ -72,7 +74,7 @@ public: static const ::rtl::OUString msFullScreenPaneURL; static const ::rtl::OUString msLeftImpressPaneURL; static const ::rtl::OUString msLeftDrawPaneURL; - static const ::rtl::OUString msRightPaneURL; + static const ::rtl::OUString msSidebarPaneURL; // URLs of frequently used views. static const ::rtl::OUString msViewURLPrefix; @@ -83,7 +85,7 @@ public: static const ::rtl::OUString msHandoutViewURL; static const ::rtl::OUString msSlideSorterURL; static const ::rtl::OUString msPresentationViewURL; - static const ::rtl::OUString msTaskPaneURL; + static const ::rtl::OUString msSidebarViewURL; // URLs of frequently used tool bars. static const ::rtl::OUString msToolBarURLPrefix; @@ -91,7 +93,9 @@ public: // URLs of task panels. static const ::rtl::OUString msTaskPanelURLPrefix; - static const ::rtl::OUString msMasterPagesTaskPanelURL; + static const ::rtl::OUString msAllMasterPagesTaskPanelURL; + static const ::rtl::OUString msRecentMasterPagesTaskPanelURL; + static const ::rtl::OUString msUsedMasterPagesTaskPanelURL; static const ::rtl::OUString msLayoutTaskPanelURL; static const ::rtl::OUString msTableDesignPanelURL; static const ::rtl::OUString msCustomAnimationTaskPanelURL; @@ -102,6 +106,7 @@ public: static const ::rtl::OUString msResourceDeactivationRequestEvent; static const ::rtl::OUString msResourceActivationEvent; static const ::rtl::OUString msResourceDeactivationEvent; + static const ::rtl::OUString msResourceDeactivationEndEvent; static const ::rtl::OUString msConfigurationUpdateStartEvent; static const ::rtl::OUString msConfigurationUpdateEndEvent; @@ -116,7 +121,7 @@ public: static ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase); static ::boost::shared_ptr<FrameworkHelper> Instance ( - const css::uno::Reference<css::frame::XController>& rxController); + const cssu::Reference<css::frame::XController>& rxController); /** Mark the FrameworkHelper object for the given ViewShellBase as disposed. A following ReleaseInstance() call will destroy the @@ -153,17 +158,15 @@ public: reference then an empty pointer is returned. */ static ::boost::shared_ptr<ViewShell> GetViewShell ( - const css::uno::Reference<css::drawing::framework::XView>& rxView); + const cssu::Reference<cssdf::XView>& rxView); - ~FrameworkHelper (void); - - typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)> + typedef ::boost::function<bool(const cssdf::ConfigurationChangeEvent&)> ConfigurationChangeEventFilter; typedef ::boost::function<void(bool bEventSeen)> Callback; typedef ::boost::function< void( - const css::uno::Reference< - css::drawing::framework::XResourceId>&) + const cssu::Reference< + cssdf::XResourceId>&) > ResourceFunctor; /** Test whether the called FrameworkHelper object is valid. @@ -196,10 +199,19 @@ public: of the involved objects does not support XTunnel (where necessary). */ - css::uno::Reference<css::drawing::framework::XView> - GetView ( - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxPaneOrViewId); + cssu::Reference<cssdf::XView> GetView ( + const cssu::Reference<cssdf::XResourceId>& rxPaneOrViewId); + + /** Return the XWindow that is represented by the pane with the + given resource id. + */ + cssu::Reference<css::awt::XWindow> GetPaneWindow ( + const cssu::Reference<cssdf::XResourceId>& rxPaneId); + + /** Return the XResource object with the given resource id. + */ + cssu::Reference<cssdf::XResource> GetResource ( + const cssu::Reference<cssdf::XResourceId>& rxResourceId); /** Request the specified view to be displayed in the specified pane. When the pane is not visible its creation is also requested. The @@ -213,25 +225,34 @@ public: the caller can, for example, call RunOnResourceActivation() to do some initialization after the requested view becomes active. */ - css::uno::Reference<css::drawing::framework::XResourceId> RequestView ( + cssu::Reference<cssdf::XResourceId> RequestView ( const ::rtl::OUString& rsResourceURL, const ::rtl::OUString& rsAnchorURL); - /** Request the activation of the specified task panel in the standard - task pane. - @param rsTaskPanelURL + /** Request the activation of the specified panel in the + sidebar. + @param rsSidebarPanelURL The panel that is to be activated. - @param bEnsureTaskPaneIsVisible - When this is <TRUE/> then the task pane is activated when not + @param bEnsurePaneIsVisible + When this is <TRUE/> then the sidebar pane is activated when not yet active. When this flag is <FALSE/> then the requested panel is activated only when the task pane is already active. When it is not active then this call is silently ignored. + @return + The resource id of the requested sidebar panel is returned. With that + the caller can, for example, call RunOnResourceActivation() to + do some initialization after the requested view becomes active. */ - void RequestTaskPanel ( - const ::rtl::OUString& rsTaskPanelURL, + cssu::Reference<cssdf::XResourceId> RequestSidebarPanel ( + const ::rtl::OUString& rsSidebarPanelURL, const bool bEnsureTaskPaneIsVisible = true); + /** Request the deactivation of the specified resource. + */ + void RequestResourceDeactivation ( + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + /** Process a slot call that requests a view shell change. */ void HandleModeChangeSlot ( @@ -260,9 +281,30 @@ public: */ void RunOnResourceActivation( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const cssu::Reference<cssdf::XResourceId>& rxResourceId, const Callback& rCallback); + /** Run the given callback when the specified resource has been + deactivated. When the resource is not active already when + this method is called then rCallback is called before this + method returns. + @param rxResourceId + Wait for the deactivation of this resource before calling + rCallback. + @param rCallback + The callback to be called when the resource is + deactivated. + @param bRunOnDeactivationEnd + The callback is run either when the deactivation starts + and the callback can still access the resource or when the + deactivatio is complete and the resource is no longer available. + + */ + void RunOnResourceDeactivation( + const cssu::Reference<cssdf::XResourceId>& rxResourceId, + const Callback& rCallback, + const bool bRunOnDeactivationEnd); + /** Normally the requested changes of the configuration are executed asynchronously. However, there is at least one situation (searching with the Outliner) where the surrounding code does not cope with @@ -296,21 +338,21 @@ public: /** Return a string representation of the given XResourceId object. */ static ::rtl::OUString ResourceIdToString ( - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxResourceId); + const cssu::Reference< + cssdf::XResourceId>& rxResourceId); /** Create a new XResourceId object for the given resource URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const ::rtl::OUString& rsResourceURL); /** Create a new XResourceId object for the given resource URL and a single anchor URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const ::rtl::OUString& rsResourceURL, const ::rtl::OUString& rsAnchorURL); @@ -318,8 +360,8 @@ public: /** Create a new XResourceId object for the given resource URL and the two given anchor URLs. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const ::rtl::OUString& rsResourceURL, const ::rtl::OUString& rsFirstAnchorURL, @@ -327,14 +369,14 @@ public: /** Create a new XResourceId object for the given resource URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const ::rtl::OUString& rsResourceURL, - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxAnchor); + const cssu::Reference< + cssdf::XResourceId>& rxAnchor); - css::uno::Reference<css::drawing::framework::XConfigurationController> + cssu::Reference<cssdf::XConfigurationController> GetConfigurationController (void) const; @@ -350,16 +392,18 @@ private: static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap; ViewShellBase& mrBase; - css::uno::Reference<css::drawing::framework::XConfigurationController> + cssu::Reference<cssdf::XConfigurationController> mxConfigurationController; class DisposeListener; friend class DisposeListener; - css::uno::Reference<css::lang::XComponent> + cssu::Reference<css::lang::XComponent> mxDisposeListener; FrameworkHelper (ViewShellBase& rBase); FrameworkHelper (const FrameworkHelper& rHelper); // Not implemented. + ~FrameworkHelper (void); + class Deleter; friend class Deleter; FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented. void Initialize (void); @@ -399,7 +443,7 @@ namespace { class FrameworkHelperAllPassFilter { public: - bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; } + bool operator() (const cssdf::ConfigurationChangeEvent&) { return true; } }; @@ -407,12 +451,12 @@ namespace { { public: FrameworkHelperResourceIdFilter ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId); - bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent) + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + bool operator() (const cssdf::ConfigurationChangeEvent& rEvent) { return mxResourceId.is() && rEvent.ResourceId.is() && mxResourceId->compareTo(rEvent.ResourceId) == 0; } private: - css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId; + cssu::Reference<cssdf::XResourceId> mxResourceId; }; } // end of anonymous namespace diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx index 7e85559f929d..bb3f20f58036 100644 --- a/sd/source/ui/inc/framework/Pane.hxx +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -94,6 +94,7 @@ public: */ virtual ::Window* GetWindow (void); + void SetWindow (::Window* pWindow); //----- XPane ------------------------------------------------------------- diff --git a/sd/source/ui/inc/framework/TaskPanelResource.hxx b/sd/source/ui/inc/framework/TaskPanelResource.hxx new file mode 100644 index 000000000000..230a230a7a79 --- /dev/null +++ b/sd/source/ui/inc/framework/TaskPanelResource.hxx @@ -0,0 +1,85 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include "SidebarPanelId.hxx" + +#include <com/sun/star/drawing/framework/XResource.hpp> +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssdf = ::com::sun::star::drawing::framework; + +class Window; + +namespace sd { namespace sidebar { + class SidebarViewShell; +} } + + +namespace sd { namespace framework { + +typedef ::cppu::WeakComponentImplHelper1 < + cssdf::XResource + > TaskPanelResourceInterfaceBase; + + +/** A simple wrapper around a legacy task pane control that gives + access to that control (via GetControl()). +*/ +class TaskPanelResource + : private ::cppu::BaseMutex, + public TaskPanelResourceInterfaceBase +{ +public: + /** Create a resource object that represents the legacy taskpane + panel. + @param rxResourceId + drawing framework resource id + @param pControl + The new TaskPanelResource object takes ownership for this control. + */ + TaskPanelResource ( + sidebar::SidebarViewShell& rSidebarViewShell, + sidebar::PanelId ePanelId, + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + virtual ~TaskPanelResource (void); + virtual void SAL_CALL disposing (void); + + // XResource + virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException); + virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException); + + ::Window* GetControl (void) const; + +private: + const cssu::Reference<cssdf::XResourceId> mxResourceId; + // Using auto_ptr because it has release(), what scoped_ptr doesn't. + ::std::auto_ptr< ::Window> mpControl; + + DECL_LINK(WindowEventHandler,VclWindowEvent*); +}; + +} } // end of namespace sd::framework diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx index d7683506b357..9b7deb15dcd6 100644 --- a/sd/source/ui/inc/fuolbull.hxx +++ b/sd/source/ui/inc/fuolbull.hxx @@ -28,6 +28,8 @@ class SdDrawDocument; class SfxRequest; +class SfxItemSet; +class SfxPoolItem; namespace sd { @@ -49,6 +51,8 @@ public: static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); virtual void DoExecute( SfxRequest& rReq ); + void SetCurrentBullet(SfxRequest& rReq); + void SetCurrentNumbering(SfxRequest& rReq); private: FuOutlineBullet ( @@ -57,8 +61,11 @@ private: ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq); + + const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId); }; + } // end of namespace sd #endif diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index 4967b7dbdd84..74ca3e71f608 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -88,11 +88,21 @@ class SdNavigatorWin : public Window { public: + typedef ::boost::function<void(void)> UpdateRequestFunctor; + + /** Create a new instance of the navigator. + @param bUseActiveUpdate + When <TRUE/>, the default, then the SdNavigatorWin object + will make a SID_NAVIGATOR_INIT call whenever it thinks an + update is necessary. When <FALSE/> the navigator will + rely on others to trigger updates. + */ SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChildWinContext, const SdResId& rSdResId, - SfxBindings* pBindings ); + SfxBindings* pBindings, + const UpdateRequestFunctor& rUpdateRequest); virtual ~SdNavigatorWin(); virtual void KeyInput( const KeyEvent& rKEvt ); @@ -137,7 +147,7 @@ private: /** This flag controls whether all shapes or only the named shapes are shown. */ - bool mbShowAllShapes; + // bool mbShowAllShapes; sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False ); NavDocInfo* GetDocInfo(); @@ -169,7 +179,8 @@ private: class SdNavigatorControllerItem : public SfxControllerItem { public: - SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -177,6 +188,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; @@ -190,7 +202,8 @@ private: class SdPageNameControllerItem : public SfxControllerItem { public: - SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -198,6 +211,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; #endif diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx index 724425060ebb..c556703989bb 100644 --- a/sd/source/ui/inc/prltempl.hxx +++ b/sd/source/ui/inc/prltempl.hxx @@ -34,7 +34,7 @@ #include "prlayout.hxx" // fuer enum PresentationObjects -class XColorTable; +class XColorList; class XGradientList; class XHatchList; class XBitmapList; @@ -54,7 +54,7 @@ class SdPresLayoutTemplateDlg : public SfxTabDialog private: const SfxObjectShell* mpDocShell; - XColorTable* pColorTab; + XColorList* pColorTab; XGradientList* pGradientList; XHatchList* pHatchingList; XBitmapList* pBitmapList; diff --git a/sd/source/ui/inc/tabtempl.hxx b/sd/source/ui/inc/tabtempl.hxx index 51071a526ded..0c114fc8ab27 100644 --- a/sd/source/ui/inc/tabtempl.hxx +++ b/sd/source/ui/inc/tabtempl.hxx @@ -30,7 +30,7 @@ class SdrModel; class SfxObjectShell; class SdrView; -class XColorTable; +class XColorList; class XGradientList; class XBitmapList; class XDashList; @@ -49,7 +49,7 @@ private: const SfxObjectShell& rDocShell; SdrView* pSdrView; - XColorTable* pColorTab; + XColorList* pColorTab; XGradientList* pGradientList; XHatchList* pHatchingList; XBitmapList* pBitmapList; diff --git a/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx b/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx deleted file mode 100644 index 1a50aa6a0029..000000000000 --- a/sd/source/ui/inc/taskpane/ILayoutableWindow.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX -#define SD_TOOLPANEL_I_LAYOUTABLE_WINDOW_HXX - -#include <tools/gen.hxx> -#include <sal/types.h> - -class Window; - -namespace sd { namespace toolpanel { - - -class ILayouter -{ -public: - /** This method is called by layoutable controls when they have to be - resized. - */ - virtual void RequestResize (void) = 0; -}; - - - -/** This interface has to be implemented by windows that want to be - layouted by a SubToolPanel or ScrollablePanel object. -*/ -class ILayoutableWindow -{ -public: - virtual ~ILayoutableWindow (void) {}; - - /** Return the preferred size without constraints on either the - height or the width. - The size the window will later be set to may but does not have - to be equal to this size. - */ - virtual Size GetPreferredSize (void) = 0; - - /** Return the preferred width with the constraint, that the - window will be set to the given height. - The width the window will later be set to may but does not have - to be equal to this width. - */ - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight) = 0; - - /** Return the preferred height with the constraint, that the - window will be set to the given width. - The height the window will later be set to may but does not have - to be equal to this height. - */ - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth) = 0; - - /** Return wether the window is generally resizable. When used by - a VerticalLayouter then the width will always be resized and - the return value of this method determines whether the height - may be modified as well. - */ - virtual bool IsResizable (void) = 0; - - /** Return the window so that its size and position can be set. - @return - Returns the window which is layouted or NULL to indicate - that the object is in an invalid state. - */ - virtual ::Window* GetWindow (void) = 0; - - /** Return the minimal width of the window. - */ - virtual sal_Int32 GetMinimumWidth (void) = 0; -}; - - - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/inc/taskpane/PanelId.hxx b/sd/source/ui/inc/taskpane/PanelId.hxx deleted file mode 100644 index 2ed3424b1160..000000000000 --- a/sd/source/ui/inc/taskpane/PanelId.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_UI_TASKPANE_PANELID_HXX -#define SD_UI_TASKPANE_PANELID_HXX - -namespace rtl -{ - class OUString; -} - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - //================================================================================================================== - //= PanelId - //================================================================================================================== - /** List of top level panels that can be shown in the task pane. - */ - enum PanelId - { - PID_MASTER_PAGES = 0, - PID_LAYOUT = 1, - PID_TABLE_DESIGN = 2, - PID_CUSTOM_ANIMATION = 3, - PID_SLIDE_TRANSITION = 4, - - PID_UNKNOWN = 5 - }; - - PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ); - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_UI_TASKPANE_PANELID_HXX diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx index 029899f6dabf..75c4cb6ffc66 100644 --- a/sd/source/ui/inc/tpaction.hxx +++ b/sd/source/ui/inc/tpaction.hxx @@ -89,7 +89,7 @@ private: const SfxItemSet& rOutAttrs; const ::sd::View* mpView; SdDrawDocument* mpDoc; - XColorTable* pColTab; + XColorList* pColTab; sal_Bool bTreeUpdated; List* pCurrentActions; diff --git a/sd/source/ui/presenter/PresenterHelper.hxx b/sd/source/ui/presenter/PresenterHelper.hxx index d978cc62ad02..ffbdc2548847 100644 --- a/sd/source/ui/presenter/PresenterHelper.hxx +++ b/sd/source/ui/presenter/PresenterHelper.hxx @@ -47,7 +47,7 @@ namespace { /** Implementation of the XPresenterHelper interface: functionality that can not be implemented in an extension. */ - class PresenterHelper +class PresenterHelper : private ::boost::noncopyable, private ::cppu::BaseMutex, public PresenterHelperInterfaceBase diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index ea0a234026b6..dbeb63f0b0b8 100644 --- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -19,22 +19,23 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "AllMasterPagesSelector.hxx" #include "PreviewValueSet.hxx" -#include "app.hrc" +#include "ViewShellBase.hxx" +#include "SidebarShellManager.hxx" #include "MasterPageContainer.hxx" #include "MasterPageDescriptor.hxx" +#include "app.hrc" +#include "helpids.h" + #include <tools/link.hxx> #include <set> namespace { -using namespace sd::toolpanel::controls; +using namespace sd::sidebar; int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor) { @@ -56,8 +57,9 @@ int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor) class MasterPageDescriptorOrder { public: - bool operator() (const sd::toolpanel::controls::SharedMasterPageDescriptor& rp1, - const sd::toolpanel::controls::SharedMasterPageDescriptor& rp2) + bool operator() ( + const SharedMasterPageDescriptor& rp1, + const SharedMasterPageDescriptor& rp2) { if (rp1->meOrigin == MasterPageContainer::DEFAULT) return true; @@ -74,7 +76,7 @@ public: -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { class AllMasterPagesSelector::SortedMasterPageDescriptorList : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder> @@ -86,17 +88,42 @@ public: +MasterPagesSelector* AllMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new AllMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); + + return pSelector; +} + + + + AllMasterPagesSelector::AllMasterPagesSelector ( - TreeNode* pParent, + ::Window* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, - DrawViewShell& rViewShell, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer) - : MasterPagesSelector(pParent, rDocument, rBase, rpContainer), - mrViewShell(rViewShell), + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar), mpSortedMasterPages(new SortedMasterPageDescriptorList()) { - SetName (String(RTL_CONSTASCII_USTRINGPARAM("AllMasterPagesSelector"))); MasterPagesSelector::Fill(); } @@ -192,7 +219,7 @@ void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList) void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet) { - MasterPagesSelector::GetState(rItemSet); + // MasterPagesSelector::GetState(rItemSet); if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE) rItemSet.DisableItem(SID_TP_EDIT_MASTER); @@ -201,4 +228,4 @@ void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet) -} } } // end of namespace ::sd::toolpanel::control +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx index ecbf497c0143..f5e79015d207 100644 --- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx @@ -19,16 +19,14 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX -#define SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX +#ifndef SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX #include "MasterPagesSelector.hxx" #include <memory> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Show a list of all available master pages so that the user can assign @@ -38,13 +36,10 @@ class AllMasterPagesSelector : public MasterPagesSelector { public: - AllMasterPagesSelector ( - TreeNode* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - DrawViewShell& rViewShell, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer); - virtual ~AllMasterPagesSelector (void); + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); /** Scan the set of templates for the ones whose first master pages are shown by this control and store them in the MasterPageContainer. @@ -57,13 +52,19 @@ protected: virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent); private: - DrawViewShell& mrViewShell; - /** The list of master pages displayed by this class. */ class SortedMasterPageDescriptorList; ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages; + AllMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~AllMasterPagesSelector (void); + void AddTemplate (const TemplateEntry& rEntry); /** This filter returns <TRUE/> when the master page specified by the @@ -82,9 +83,9 @@ private: */ void UpdateMasterPageList (void); - using sd::toolpanel::controls::MasterPagesSelector::Fill; + using MasterPagesSelector::Fill; }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index e4d073727704..4d4ff45f0c0c 100644 --- a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -19,14 +19,12 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "CurrentMasterPagesSelector.hxx" #include "PreviewValueSet.hxx" #include "ViewShellBase.hxx" +#include "SidebarShellManager.hxx" #include "DrawViewShell.hxx" #include "drawdoc.hxx" #include "sdpage.hxx" @@ -38,6 +36,7 @@ #include "DrawViewShell.hxx" #include "res_bmp.hrc" #include "sdresid.hxx" +#include "helpids.h" #include <vcl/image.hxx> #include <svx/svdmodel.hxx> @@ -48,18 +47,43 @@ using namespace ::com::sun::star; -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { + +MasterPagesSelector* CurrentMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new CurrentMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); + + return pSelector; +} + + CurrentMasterPagesSelector::CurrentMasterPagesSelector ( - TreeNode* pParent, + ::Window* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer) - : MasterPagesSelector (pParent, rDocument, rBase, rpContainer) + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar) { - SetName(String(RTL_CONSTASCII_USTRINGPARAM("CurrentMasterPagesSelector"))); - // For this master page selector only we change the default action for // left clicks. mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES; @@ -199,13 +223,13 @@ void CurrentMasterPagesSelector::UpdateSelection (void) } // Find the items for the master pages in the set. - sal_uInt16 nItemCount (mpPageSet->GetItemCount()); + sal_uInt16 nItemCount (PreviewValueSet::GetItemCount()); for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++) { - String sName (mpPageSet->GetItemText (nIndex)); + String sName (PreviewValueSet::GetItemText (nIndex)); if (aNames.find(sName) != aNames.end()) { - mpPageSet->SelectItem (nIndex); + PreviewValueSet::SelectItem (nIndex); } } } @@ -213,54 +237,48 @@ void CurrentMasterPagesSelector::UpdateSelection (void) -void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest) +void CurrentMasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId) { - switch (rRequest.GetSlot()) + if (nCommandId == SID_DELETE_MASTER_PAGE) { - case SID_DELETE_MASTER_PAGE: + // Check once again that the master page can safely be deleted, + // i.e. is not used. + SdPage* pMasterPage = GetSelectedMasterPage(); + if (pMasterPage != NULL + && mrDocument.GetMasterPageUserCount(pMasterPage) == 0) { - // Check once again that the master page can safely be deleted, - // i.e. is not used. - SdPage* pMasterPage = GetSelectedMasterPage(); - if (pMasterPage != NULL - && mrDocument.GetMasterPageUserCount(pMasterPage) == 0) - { - // Removing the precious flag so that the following call to - // RemoveUnnessesaryMasterPages() will remove this master page. - pMasterPage->SetPrecious(false); - mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True); - } + // Removing the precious flag so that the following call to + // RemoveUnnessesaryMasterPages() will remove this master page. + pMasterPage->SetPrecious(false); + mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True); } - break; - - default: - MasterPagesSelector::Execute(rRequest); - break; } + else + MasterPagesSelector::ExecuteCommand(nCommandId); } -void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet) +void CurrentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu) { // Disable the SID_DELTE_MASTER slot when there is only one master page. - if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE - && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0) + if (mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0) { - rItemSet.DisableItem(SID_DELETE_MASTER_PAGE); + if (rMenu.GetItemPos(SID_DELETE_MASTER_PAGE) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_DELETE_MASTER_PAGE, sal_False); } ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell())); - if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE - && pDrawViewShell + if (pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE) { - rItemSet.DisableItem (SID_TP_EDIT_MASTER); + if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False); } - MasterPagesSelector::GetState(rItemSet); + MasterPagesSelector::ProcessPopupMenu(rMenu); } @@ -334,6 +352,4 @@ void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint) } - - -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx index e0b926f6287c..45f1b2018a8b 100644 --- a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx @@ -19,18 +19,21 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX -#define SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX +#ifndef SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX #include "MasterPagesSelector.hxx" #include <com/sun/star/lang/XComponent.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + namespace sd { namespace tools { class EventMultiplexerEvent; } } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Show the master pages currently used by a SdDrawDocument. @@ -40,14 +43,10 @@ class CurrentMasterPagesSelector public SfxListener { public: - CurrentMasterPagesSelector ( - TreeNode* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer); - virtual ~CurrentMasterPagesSelector (void); - - virtual void LateInit (void); + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); /** Set the selection so that the master page is selected that is used by the currently selected page of the document in the @@ -59,21 +58,31 @@ public: */ virtual void Fill (ItemList& rItemList); - using sd::toolpanel::controls::MasterPagesSelector::Fill; + using MasterPagesSelector::Fill; protected: virtual ResId GetContextMenuResId (void) const; - virtual void Execute (SfxRequest& rRequest); - virtual void GetState (SfxItemSet& rItemSet); + + virtual void ProcessPopupMenu (Menu& rMenu); + virtual void ExecuteCommand (const sal_Int32 nCommandId); private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> - mxListener; + cssu::Reference<css::lang::XComponent> mxListener; + + CurrentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~CurrentMasterPagesSelector (void); + + virtual void LateInit (void); DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*); void Notify (SfxBroadcaster&, const SfxHint& rHint); }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.cxx b/sd/source/ui/sidebar/CustomAnimationPanel.cxx new file mode 100644 index 000000000000..5fd87d2a2a00 --- /dev/null +++ b/sd/source/ui/sidebar/CustomAnimationPanel.cxx @@ -0,0 +1,79 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "CustomAnimationPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window * createCustomAnimationPanel (::Window* pParent, ViewShellBase& rBase); + extern sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pParent); +} + + + + +namespace sd { namespace sidebar { + + +CustomAnimationPanel::CustomAnimationPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase( + pParentWindow, + rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:CustomAnimationPanel"))); +#endif +} + + + + +CustomAnimationPanel::~CustomAnimationPanel (void) +{ +} + + + + +::Window* CustomAnimationPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createCustomAnimationPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize CustomAnimationPanel::GetHeightForWidth (const sal_Int32 nWidth) +{ + const sal_Int32 nMinimumHeight(getCustomAnimationPanelMinimumHeight(mpWrappedControl.get())); + return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight); +} + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.hxx b/sd/source/ui/sidebar/CustomAnimationPanel.hxx new file mode 100644 index 000000000000..12f2316c63c9 --- /dev/null +++ b/sd/source/ui/sidebar/CustomAnimationPanel.hxx @@ -0,0 +1,50 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX +#define SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX + +#include "PanelBase.hxx" + + +namespace sd { namespace sidebar { + +class CustomAnimationPanel + : public PanelBase +{ +public: + CustomAnimationPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~CustomAnimationPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index b3148bb2a946..1ae5a2154865 100644 --- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "DocumentHelper.hxx" @@ -44,7 +41,7 @@ using namespace ::com::sun::star; -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( SdDrawDocument& rTargetDocument, @@ -286,7 +283,7 @@ void DocumentHelper::ProvideStyles ( // Add an undo action for the copied style sheets. if( !aCreatedStyles.empty() ) { - ::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager(); + ::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager(); if (pUndoManager != NULL) { SdMoveStyleSheetsUndoAction* pMovStyles = @@ -578,4 +575,4 @@ SdPage* DocumentHelper::ProvideMasterPage ( -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.hxx b/sd/source/ui/sidebar/DocumentHelper.hxx index 6c1b2193a8e5..a5f7d8b35950 100644 --- a/sd/source/ui/toolpanel/controls/DocumentHelper.hxx +++ b/sd/source/ui/sidebar/DocumentHelper.hxx @@ -19,10 +19,8 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX -#define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX +#ifndef SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX +#define SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX #include <tools/solar.h> #include <boost/shared_ptr.hpp> @@ -32,7 +30,7 @@ class SdDrawDocument; class SdPage; class String; -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** A collection of methods supporting the handling of master pages. */ @@ -107,6 +105,6 @@ private: }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/TestPanel.hxx b/sd/source/ui/sidebar/IDisposable.hxx index 4fa768e70109..f7cb3448626e 100644 --- a/sd/source/ui/toolpanel/TestPanel.hxx +++ b/sd/source/ui/sidebar/IDisposable.hxx @@ -21,33 +21,24 @@ -#ifndef SD_TASKPANE_TEST_PANEL_HXX -#define SD_TASKPANE_TEST_PANEL_HXX +#ifndef SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX +#define SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX -#include "taskpane/SubToolPanel.hxx" +#include <tools/gen.hxx> +#include <sal/types.h> +class Window; -namespace sd { namespace toolpanel { +namespace sd { namespace sidebar { -class ControlFactory; -class TreeNode; -#ifdef SHOW_TEST_PANEL - -/** This panel demonstrates how to create a panel for the task pane. -*/ -class TestPanel - : public SubToolPanel +class IDisposable { public: - TestPanel (::Window& i_rParent); - virtual ~TestPanel (void); - - static std::auto_ptr<ControlFactory> CreateControlFactory (void); + virtual void Dispose (void) = 0; }; -#endif -} } // end of namespace ::sd::toolpanel +} } // end of namespace ::sd::sidebar #endif diff --git a/sd/source/ui/sidebar/ISidebarReceiver.hxx b/sd/source/ui/sidebar/ISidebarReceiver.hxx new file mode 100644 index 000000000000..1755ad681aa7 --- /dev/null +++ b/sd/source/ui/sidebar/ISidebarReceiver.hxx @@ -0,0 +1,40 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_RECEIVER_INTERFACE_HXX +#define SD_SIDEBAR_RECEIVER_INTERFACE_HXX + +#include <com/sun/star/ui/XSidebar.hpp> + +namespace sd { namespace sidebar { + + +class ISidebarReceiver +{ +public: + virtual void SetSidebar (const ::com::sun::star::uno::Reference< + ::com::sun::star::ui::XSidebar>& rxSidebar) = 0; +}; + + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 9fb6e4c2c5ab..e775f426121f 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -19,58 +19,48 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "LayoutMenu.hxx" -#include "TaskPaneShellManager.hxx" -#include "pres.hxx" +#include "SidebarShellManager.hxx" +#include "app.hrc" #include "drawdoc.hxx" -#include "DrawDocShell.hxx" -#include "sdpage.hxx" -#include "glob.hxx" +#include "framework/FrameworkHelper.hxx" #include "glob.hrc" -#include "app.hrc" +#include "glob.hxx" #include "helpids.h" +#include "pres.hxx" #include "res_bmp.hrc" +#include "sdpage.hxx" +#include "sdresid.hxx" #include "strings.hrc" -#include "ViewShellBase.hxx" -#include "DrawViewShell.hxx" -#include "SlideSorterViewShell.hxx" -#include "controller/SlideSorterController.hxx" -#include "controller/SlsPageSelector.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include "taskpane/ToolPanelViewShell.hxx" -#include "taskpane/ScrollPanel.hxx" #include "tools/SlotStateListener.hxx" -#include "EventMultiplexer.hxx" #include "DrawController.hxx" -#include "framework/FrameworkHelper.hxx" +#include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" +#include "EventMultiplexer.hxx" +#include "SlideSorterViewShell.hxx" +#include "ViewShellBase.hxx" +#include <sfx2/sidebar/Theme.hxx> -#include <vector> -#include <memory> -#include <sfx2/objface.hxx> -#include "sdresid.hxx" -#include <vcl/image.hxx> -#include <svl/languageoptions.hxx> +#include <comphelper/processfactory.hxx> #include <sfx2/app.hxx> -#include "taskpane/TitledControl.hxx" #include <sfx2/dispatch.hxx> +#include <sfx2/objface.hxx> #include <sfx2/request.hxx> -#include <comphelper/processfactory.hxx> #include <sfx2/viewfrm.hxx> +#include <svl/languageoptions.hxx> +#include <vcl/image.hxx> +#include <vcl/floatwin.hxx> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/drawing/framework/XView.hpp> #include <com/sun/star/drawing/framework/ResourceId.hpp> -using namespace ::sd::toolpanel; -#define LayoutMenu -#include "sdslots.hxx" +#include <vector> +#include <memory> using namespace ::com::sun::star; using namespace ::com::sun::star::text; @@ -79,41 +69,9 @@ using namespace ::com::sun::star::drawing::framework; using namespace ::sd::slidesorter; using ::sd::framework::FrameworkHelper; -namespace sd { namespace toolpanel { +namespace sd { namespace sidebar { -class LayoutMenuRootFactory - : public ControlFactory -{ -public: - LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell) - :mrPanelViewShell(i_rPanelViewShell) - { - } - -protected: - virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) - { - ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent); - ::std::auto_ptr<TreeNode> pMenu ( - new LayoutMenu ( - pScrollPanel, - mrPanelViewShell)); - pScrollPanel->AddControl(pMenu); - return pScrollPanel; - } - -private: - ToolPanelViewShell& mrPanelViewShell; -}; - - -SFX_IMPL_INTERFACE(LayoutMenu, SfxShell, - SdResId(STR_TASKPANELAYOUTMENU)) -{ - SFX_POPUPMENU_REGISTRATION(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP)); -} -TYPEINIT1(LayoutMenu, SfxShell); struct snewfoil_value_info { @@ -171,23 +129,41 @@ static snewfoil_value_info standard[] = {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE} }; -LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell ) - : ValueSet (pParent->GetWindow()), - TreeNode(pParent), + + + +LayoutMenu::LayoutMenu ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : ValueSet (pParent), DragSourceHelper(this), DropTargetHelper(this), - mrBase( i_rPanelViewShell.GetViewShellBase() ), - mpShellManager (&i_rPanelViewShell.GetSubShellManager()), - mbUseOwnScrollBar( false ), + mrBase(rViewShellBase), + mbUseOwnScrollBar(false), mnPreferredColumnCount(3), mxListener(NULL), mbSelectionUpdatePending(true), - mbIsMainViewChangePending(false) + mbIsMainViewChangePending(false), + mxSidebar(rxSidebar), + mbIsDisposed(false) { implConstruct( *mrBase.GetDocument()->GetDocSh() ); + OSL_TRACE("created LayoutMenu at %x", this); + + SetStyle(GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_TABSTOP); + + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); + +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:LayoutMenu"))); +#endif } + + void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) { OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, @@ -197,14 +173,13 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) SetStyle ( ( GetStyle() & ~(WB_ITEMBORDER) ) | WB_TABSTOP + | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT ); if (mbUseOwnScrollBar) SetStyle (GetStyle() | WB_VSCROLL); SetExtraSpacing(2); SetSelectHdl (LINK(this, LayoutMenu, ClickHandler)); - SetPool (&rDocumentShell.GetDoc()->GetPool()); - SetName(String(RTL_CONSTASCII_USTRINGPARAM("LayoutMenu"))); InvalidateContent(); Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener)); @@ -226,17 +201,31 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY), ::rtl::OUString::createFromAscii(".uno:VerticalTextState")); - // Add this new object as shell to the shell factory. - GetShellManager()->AddSubShell(SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this); + SetSizePixel(GetParent()->GetSizePixel()); + Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler)); + GetParent()->AddEventListener(aWindowEventHandlerLink); } + LayoutMenu::~LayoutMenu (void) { - // Tell the shell factory that this object is no longer available. - if (GetShellManager() != NULL) - GetShellManager()->RemoveSubShell(this); + OSL_TRACE("destroying LayoutMenu at %x", this); + Dispose(); +} + + + + +void LayoutMenu::Dispose (void) +{ + if (mbIsDisposed) + return; + + OSL_TRACE("disposing LayoutMenu at %x", this); + + mbIsDisposed = true; Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY); if (xComponent.is()) @@ -245,15 +234,9 @@ LayoutMenu::~LayoutMenu (void) Clear(); Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener)); mrBase.GetEventMultiplexer()->RemoveEventListener (aLink); -} - - - -::std::auto_ptr<ControlFactory> LayoutMenu::CreateControlFactory ( - ToolPanelViewShell& i_rPanelViewShell ) -{ - return ::std::auto_ptr<ControlFactory>(new LayoutMenuRootFactory(i_rPanelViewShell)); + Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler)); + GetParent()->RemoveEventListener(aWindowEventHandlerLink); } @@ -315,7 +298,7 @@ sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight) -sal_Int32 LayoutMenu::GetPreferredHeight (sal_Int32 nWidth) +ui::LayoutSize LayoutMenu::GetHeightForWidth (const sal_Int32 nWidth) { sal_Int32 nPreferredHeight = 200; if ( ! mbUseOwnScrollBar && GetItemCount()>0) @@ -335,7 +318,7 @@ sal_Int32 LayoutMenu::GetPreferredHeight (sal_Int32 nWidth) nPreferredHeight = nRowCount * aItemSize.Height(); } } - return nPreferredHeight; + return ui::LayoutSize(nPreferredHeight,nPreferredHeight,nPreferredHeight); } @@ -356,14 +339,6 @@ sal_Int32 LayoutMenu::GetMinimumWidth (void) -bool LayoutMenu::IsResizable (void) -{ - return true; -} - - - - void LayoutMenu::UpdateEnabledState (const MasterMode eMode) { bool bIsEnabled (false); @@ -376,7 +351,7 @@ void LayoutMenu::UpdateEnabledState (const MasterMode eMode) case ViewShell::ST_NONE: case ViewShell::ST_OUTLINE: case ViewShell::ST_PRESENTATION: - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: // The complete task pane is disabled for these values or // not even visible. Disabling the LayoutMenu would be // logical but unnecessary. The main disadvantage is that @@ -416,42 +391,20 @@ void LayoutMenu::UpdateEnabledState (const MasterMode eMode) bIsEnabled = true; break; } - - TreeNode* pParentNode = GetParentNode(); - if (pParentNode != NULL) - { - TitledControl* pGrandParentNode - = dynamic_cast<TitledControl*>(pParentNode->GetParentNode()); - if (pGrandParentNode != NULL) - pGrandParentNode->SetEnabledState(bIsEnabled); - } - } } -::Window* LayoutMenu::GetWindow (void) -{ - return this; -} - - - - void LayoutMenu::Paint (const Rectangle& rRect) { - SetBackground (GetSettings().GetStyleSettings().GetWindowColor()); - if (mbSelectionUpdatePending) { mbSelectionUpdatePending = false; UpdateSelection(); } ValueSet::Paint (rRect); - - SetBackground (Wallpaper()); } @@ -507,46 +460,6 @@ void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent) -void LayoutMenu::Execute (SfxRequest& rRequest) -{ - switch (rRequest.GetSlot()) - { - case SID_TP_APPLY_TO_SELECTED_SLIDES: - AssignLayoutToSelectedSlides(GetSelectedAutoLayout()); - rRequest.Done(); - break; - - case SID_INSERTPAGE_LAYOUT_MENU: - // Add arguments to this slot and forward it to the main view - // shell. - InsertPageWithLayout(GetSelectedAutoLayout()); - break; - } -} - - - - -void LayoutMenu::GetState (SfxItemSet& rItemSet) -{ - // Cut and paste is not supported. The SID_(CUT,COPY,PASTE) entries - // therefore must not show up in the context menu. - rItemSet.DisableItem (SID_CUT); - rItemSet.DisableItem (SID_COPY); - rItemSet.DisableItem (SID_PASTE); - - // The SID_INSERTPAGE_LAYOUT_MENU slot depends on the SID_INSERTPAGE - // slot being supported elsewhere. - const SfxPoolItem* pItem = NULL; - const SfxItemState aState ( - mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem)); - if (aState == SFX_ITEM_DISABLED) - rItemSet.DisableItem(SID_INSERTPAGE_LAYOUT_MENU); -} - - - - void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) { ViewShell* pViewShell = mrBase.GetMainViewShell().get(); @@ -577,22 +490,14 @@ void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) -TaskPaneShellManager* LayoutMenu::GetShellManager() -{ - if ( mpShellManager ) - return mpShellManager; - return TreeNode::GetShellManager(); -} - void LayoutMenu::InvalidateContent (void) { - // The number of items may have changed. Request a resize so that the - // vertical size of this control can be adapted. - RequestResize(); - // Throw away the current set and fill the menu anew according to the // current settings (this includes the support for vertical writing.) Fill(); + + if (mxSidebar.is()) + mxSidebar->requestLayout(); } @@ -865,31 +770,40 @@ void LayoutMenu::Command (const CommandEvent& rEvent) case COMMAND_CONTEXTMENU: if ( ! SD_MOD()->GetWaterCan()) { - if (GetShellManager() != NULL) - GetShellManager()->MoveToTop(this); + // Determine the position where to show the menu. + Point aMenuPosition; if (rEvent.IsMouseEvent()) { - // Do not show the context menu when the mouse was not - // pressed over an item. - if (GetItemId(rEvent.GetMousePosPixel()) > 0) - mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup( - SdResId(RID_TASKPANE_LAYOUTMENU_POPUP)); + if (GetItemId(rEvent.GetMousePosPixel()) <= 0) + return; + aMenuPosition = rEvent.GetMousePosPixel(); } else { - // When the command event was not caused by a mouse - // event (for example a key press instead) then show the - // popup menu at the center of the current item. - if (GetSelectItemId() != (sal_uInt16)-1) - { - Rectangle aBBox (GetItemRect(GetSelectItemId())); - Point aPosition (aBBox.Center()); - mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup( - SdResId(RID_TASKPANE_LAYOUTMENU_POPUP), - this, - &aPosition); - } + if (GetSelectItemId() == (sal_uInt16)-1) + return; + Rectangle aBBox (GetItemRect(GetSelectItemId())); + aMenuPosition = aBBox.Center(); } + + // Setup the menu. + ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP))); + FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pMenuWindow != NULL) + pMenuWindow->SetPopupModeFlags( + pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenu->SetSelectHdl(LINK(this, LayoutMenu, OnMenuItemSelected)); + + // Disable the SID_INSERTPAGE_LAYOUT_MENU item when + // the document is read-only. + const SfxPoolItem* pItem = NULL; + const SfxItemState aState ( + mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem)); + if (aState == SFX_ITEM_DISABLED) + pMenu->EnableItem(SID_INSERTPAGE_LAYOUT_MENU, sal_False); + + // Show the menu. + pMenu->Execute(this, Rectangle(aMenuPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN); } break; @@ -911,6 +825,34 @@ IMPL_LINK(LayoutMenu, StateChangeHandler, ::rtl::OUString*, EMPTYARG) +IMPL_LINK(LayoutMenu, OnMenuItemSelected, Menu*, pMenu) +{ + if (pMenu == NULL) + { + OSL_ENSURE(pMenu!=NULL, "LayoutMenu::OnMenuItemSelected: illegal menu!"); + return 0; + } + + pMenu->Deactivate(); + const sal_Int32 nIndex (pMenu->GetCurItemId()); + + if (nIndex == SID_TP_APPLY_TO_SELECTED_SLIDES) + { + AssignLayoutToSelectedSlides(GetSelectedAutoLayout()); + } + else if (nIndex == SID_INSERTPAGE_LAYOUT_MENU) + { + // Add arguments to this slot and forward it to the main view + // shell. + InsertPageWithLayout(GetSelectedAutoLayout()); + } + + return 0; +} + + + + void LayoutMenu::UpdateSelection (void) { bool bItemSelected = false; @@ -998,11 +940,45 @@ IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEve +IMPL_LINK(LayoutMenu, WindowEventHandler, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->GetId()) + { + case VCLEVENT_WINDOW_SHOW: + case VCLEVENT_WINDOW_RESIZE: + SetSizePixel(GetParent()->GetSizePixel()); + return sal_True; + + default: + return sal_False; + } + + const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, pEvent); + if (pSimpleHint != NULL + && pSimpleHint->GetId() == SFX_HINT_DYING) + { + return sal_True; + } + } + + return sal_False; +} + + + + void LayoutMenu::DataChanged (const DataChangedEvent& rEvent) { Fill(); ValueSet::DataChanged(rEvent); + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); } -} } // end of namespace ::sd::toolpanel + + + +} } // end of namespace ::sd::sidebar diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index fe276d0ab50c..f8deb8fc312f 100644 --- a/sd/source/ui/toolpanel/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -19,27 +19,29 @@ * *************************************************************/ +#ifndef SD_SIDEBAR_LAYOUT_MENU_HXX +#define SD_SIDEBAR_LAYOUT_MENU_HXX - -#ifndef SD_TASKPANE_LAYOUT_MENU_HXX -#define SD_TASKPANE_LAYOUT_MENU_HXX - -#include "taskpane/TaskPaneTreeNode.hxx" - -#ifndef _COM_SUN_STAR_FRAME_XSTATUS_LISTENER_HPP_ -#include <com/sun/star/frame/XStatusListener.hpp> -#endif +#include "IDisposable.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> #include "glob.hxx" #include "pres.hxx" + #include <vcl/ctrl.hxx> #include <svtools/valueset.hxx> #include <svtools/transfer.hxx> #include <sfx2/shell.hxx> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + class SfxModule; +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; namespace sd { class DrawDocShell; @@ -53,23 +55,20 @@ class EventMultiplexerEvent; } } -namespace sd { namespace toolpanel { +namespace sd { namespace sidebar { class ControlFactory; -class ToolPanelViewShell; +class SidebarViewShell; +class SidebarShellManager; class LayoutMenu : public ValueSet, - public TreeNode, - public SfxShell, public DragSourceHelper, - public DropTargetHelper + public DropTargetHelper, + public sfx2::sidebar::ILayoutableWindow { public: - TYPEINFO(); - SFX_DECL_INTERFACE(SD_IF_SDLAYOUTMENU) - /** Create a new layout menu. Depending on the given flag it displays its own scroll bar or lets a surrounding window handle that. @@ -79,26 +78,24 @@ public: the view shell of the task pane. */ LayoutMenu ( - TreeNode* i_pParent, - ToolPanelViewShell& i_rPanelViewShell); + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); virtual ~LayoutMenu (void); - static std::auto_ptr<ControlFactory> CreateControlFactory ( - ToolPanelViewShell& i_rPanelViewShell ); + virtual void Dispose (void); /** Return a numerical value representing the currently selected layout. */ AutoLayout GetSelectedAutoLayout (void); + Size GetPreferredSize (void); + sal_Int32 GetPreferredWidth (sal_Int32 nHeight); + sal_Int32 GetMinimumWidth (void); // From ILayoutableWindow - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual sal_Int32 GetMinimumWidth (void); - virtual bool IsResizable (void); - virtual ::Window* GetWindow (void); + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); // From ::Window virtual void Paint (const Rectangle& rRect); @@ -108,9 +105,6 @@ public: */ virtual void MouseButtonDown (const MouseEvent& rEvent); - void Execute (SfxRequest& rRequest); - void GetState (SfxItemSet& rItemSet); - /** The LayoutMenu does not support some main views. In this case the LayoutMenu is disabled. This state is updated in this method. @param eMode @@ -123,9 +117,6 @@ public: enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN }; void UpdateEnabledState (const MasterMode eMode); - // TreeNode overridables - virtual TaskPaneShellManager* GetShellManager (void); - /** Call this method when the set of displayed layouts is not up-to-date anymore. It will re-assemple this set according to the current settings. @@ -154,8 +145,6 @@ public: private: ViewShellBase& mrBase; - TaskPaneShellManager* mpShellManager; - /** Do we use our own scroll bar or is viewport handling done by our parent? */ @@ -165,12 +154,11 @@ private: many columns for the calculation. */ const int mnPreferredColumnCount; - - ::com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> mxListener; - + cssu::Reference<css::frame::XStatusListener> mxListener; bool mbSelectionUpdatePending; - bool mbIsMainViewChangePending; + cssu::Reference<css::ui::XSidebar> mxSidebar; + bool mbIsDisposed; /** Calculate the number of displayed rows. This depends on the given item size, the given number of columns, and the size of the @@ -228,6 +216,8 @@ private: DECL_LINK(RightClickHandler, MouseEvent*); DECL_LINK(StateChangeHandler, ::rtl::OUString*); DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*); + DECL_LINK(WindowEventHandler, VclWindowEvent*); + DECL_LINK(OnMenuItemSelected, Menu*); }; } } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 1d5144336d5b..d32629419245 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageContainer.hxx" @@ -63,16 +60,15 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::sd::toolpanel::controls; namespace { -typedef ::std::vector<SharedMasterPageDescriptor> MasterPageContainerType; +typedef ::std::vector<sd::sidebar::SharedMasterPageDescriptor> MasterPageContainerType; } // end of anonymous namespace -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Inner implementation class of the MasterPageContainer. @@ -1213,4 +1209,4 @@ void MasterPageContainer::Implementation::FillingDone (void) -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx b/sd/source/ui/sidebar/MasterPageContainer.hxx index 336ecf851f4c..e1502082b743 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx +++ b/sd/source/ui/sidebar/MasterPageContainer.hxx @@ -19,10 +19,8 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX -#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX #include "MasterPageContainerProviders.hxx" @@ -45,7 +43,7 @@ namespace sd { class DrawDocShell; } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { class MasterPageDescriptor; @@ -211,6 +209,6 @@ public: }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx index 591bc322ea14..2ace8e2f781f 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageContainerFiller.hxx" @@ -32,10 +29,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::sd::toolpanel::controls; -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter) : mrContainerAdapter(rpAdapter), @@ -192,4 +188,4 @@ MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void) -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx b/sd/source/ui/sidebar/MasterPageContainerFiller.hxx index 847eb49eb487..e475d84ffe67 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx +++ b/sd/source/ui/sidebar/MasterPageContainerFiller.hxx @@ -19,10 +19,8 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX -#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX #include "MasterPageContainer.hxx" #include "MasterPageDescriptor.hxx" @@ -33,7 +31,7 @@ class TemplateScanner; class TemplateEntry; } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Fill a MasterPageContainer with information about the available master pages. These are provided by one default page and from the existing @@ -86,6 +84,6 @@ private: State AddTemplate (void); }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx index 5ddf82d3884b..2a583185f937 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageContainerProviders.hxx" @@ -40,10 +37,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using namespace ::sd::toolpanel::controls; - -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { //===== PagePreviewProvider =================================================== @@ -422,4 +417,4 @@ bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider) } -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx b/sd/source/ui/sidebar/MasterPageContainerProviders.hxx index 78b6b1029912..eaf6fc9de9d9 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx +++ b/sd/source/ui/sidebar/MasterPageContainerProviders.hxx @@ -19,10 +19,8 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX -#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX #include <rtl/ustring.hxx> #include <sfx2/objsh.hxx> @@ -34,7 +32,7 @@ namespace sd { class PreviewRenderer; } namespace sd { class DrawDocShell; } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Interface for a provider of page objects. It is used by the @@ -169,7 +167,7 @@ public: /** This implementation of the PageObjectProvider simply returns an already existing master page object. */ -class ExistingPageProvider : public ::sd::toolpanel::controls::PageObjectProvider +class ExistingPageProvider : public PageObjectProvider { public: ExistingPageProvider (SdPage* pPage); @@ -180,6 +178,6 @@ private: SdPage* mpPage; }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx index d7d78dfaae1c..c55354d8b62a 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageContainerQueue.hxx" @@ -30,7 +27,7 @@ #include <set> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15); const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100); @@ -297,4 +294,4 @@ void MasterPageContainerQueue::ProcessAllRequests (void) } -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx b/sd/source/ui/sidebar/MasterPageContainerQueue.hxx index 7348da644644..48f048de14ed 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx +++ b/sd/source/ui/sidebar/MasterPageContainerQueue.hxx @@ -19,10 +19,8 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX -#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX #include "MasterPageContainer.hxx" #include "MasterPageDescriptor.hxx" @@ -30,7 +28,7 @@ #include <boost/scoped_ptr.hpp> #include <boost/weak_ptr.hpp> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** The queue stores and processes all requests from a MasterPageContainer @@ -127,6 +125,6 @@ private: DECL_LINK(DelayedPreviewCreation, Timer *); }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx index 99387405c04a..310838180430 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx +++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageDescriptor.hxx" @@ -30,7 +27,7 @@ #include "sdpage.hxx" #include <tools/urlobj.hxx> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { //===== MasterPageDescriptor ================================================== @@ -416,4 +413,4 @@ bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDesc } -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx b/sd/source/ui/sidebar/MasterPageDescriptor.hxx index 49a761cd1ed4..a3f3b73c9551 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx +++ b/sd/source/ui/sidebar/MasterPageDescriptor.hxx @@ -19,15 +19,13 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX -#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX #include "MasterPageContainer.hxx" #include <boost/shared_ptr.hpp> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { class PageObjectProvider; class PreviewProvider; @@ -231,6 +229,6 @@ public: }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx index c2e40748fd46..328493a91f24 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx +++ b/sd/source/ui/sidebar/MasterPageObserver.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPageObserver.hxx" diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 576284bf6a4a..694ee21b404b 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -19,15 +19,13 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "MasterPagesSelector.hxx" #include "MasterPageContainer.hxx" #include "DocumentHelper.hxx" +#include "SidebarShellManager.hxx" #include "pres.hxx" #include "drawdoc.hxx" #include "DrawDocShell.hxx" @@ -42,18 +40,11 @@ #include "SlideSorterViewShell.hxx" #include "PreviewValueSet.hxx" #include "ViewShellBase.hxx" -#include "../TaskPaneShellManager.hxx" -#include "taskpane/TitledControl.hxx" -#include "taskpane/ControlContainer.hxx" -#include "controller/SlideSorterController.hxx" -#include "controller/SlsPageSelector.hxx" #include <sfx2/objface.hxx> #include "sdresid.hxx" -#include "TemplateScanner.hxx" -#ifndef _SD_DRAWVIEW_HXX #include "drawview.hxx" -#endif #include <vcl/image.hxx> +#include <vcl/floatwin.hxx> #include <svl/languageoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> @@ -69,57 +60,44 @@ #include "unmovss.hxx" #include <sfx2/request.hxx> #include <svl/itempool.hxx> +#include <sfx2/sidebar/Theme.hxx> -using namespace ::sd::toolpanel::controls; -#define MasterPagesSelector -#include "sdslots.hxx" using namespace ::com::sun::star::text; -namespace sd { namespace toolpanel { namespace controls { - - -SFX_IMPL_INTERFACE(MasterPagesSelector, SfxShell, - SdResId(STR_MASTERPAGESSELECTOR)) -{ - SFX_POPUPMENU_REGISTRATION( SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP) ); -} - -TYPEINIT1(MasterPagesSelector, SfxShell); - +namespace sd { namespace sidebar { MasterPagesSelector::MasterPagesSelector ( - TreeNode* pParent, + ::Window* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer) - : TreeNode (pParent), - SfxShell(), + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : PreviewValueSet(pParent), maMutex(), mpContainer(rpContainer), mrDocument(rDocument), - mpPageSet (new PreviewValueSet(pParent)), mrBase(rBase), mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES), maPreviewUpdateQueue(), maCurrentItemList(), maTokenToValueSetIndex(), - maLockedMasterPages() + maLockedMasterPages(), + mxSidebar(rxSidebar) { - SetPool (&rDocument.GetPool()); - - mpPageSet->SetSelectHdl ( + PreviewValueSet::SetSelectHdl ( LINK(this, MasterPagesSelector, ClickHandler)); - mpPageSet->SetRightMouseClickHandler ( + PreviewValueSet::SetRightMouseClickHandler ( LINK(this, MasterPagesSelector, RightClickHandler)); - mpPageSet->SetContextMenuCallback ( - LINK(this, MasterPagesSelector, ContextMenuCallback)); - mpPageSet->SetStyle(mpPageSet->GetStyle() | WB_NO_DIRECTSELECT); - mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel()); - mpPageSet->Show(); + PreviewValueSet::SetStyle(PreviewValueSet::GetStyle() | WB_NO_DIRECTSELECT); + PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel()); + PreviewValueSet::Show(); + + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->AddChangeListener(aChangeListener); @@ -131,12 +109,8 @@ MasterPagesSelector::MasterPagesSelector ( MasterPagesSelector::~MasterPagesSelector (void) { Clear(); - mpPageSet.reset(); UpdateLocks(ItemList()); - if (GetShellManager() != NULL) - GetShellManager()->RemoveSubShell (this); - Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->RemoveChangeListener(aChangeListener); } @@ -155,7 +129,7 @@ sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight) { const ::osl::MutexGuard aGuard (maMutex); - return mpPageSet->GetPreferredWidth (nHeight); + return PreviewValueSet::GetPreferredWidth (nHeight); } @@ -165,7 +139,7 @@ sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth) { const ::osl::MutexGuard aGuard (maMutex); - return mpPageSet->GetPreferredHeight (nWidth); + return PreviewValueSet::GetPreferredHeight (nWidth); } @@ -174,7 +148,7 @@ sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth) Size MasterPagesSelector::GetPreferredSize (void) { int nPreferredWidth = GetPreferredWidth( - mpPageSet->GetOutputSizePixel().Height()); + PreviewValueSet::GetOutputSizePixel().Height()); int nPreferredHeight = GetPreferredHeight(nPreferredWidth); return Size (nPreferredWidth, nPreferredHeight); @@ -239,16 +213,7 @@ IMPL_LINK(MasterPagesSelector, ClickHandler, PreviewValueSet*, EMPTYARG) // We use the framework to assign the clicked-on master page because we // so use the same mechanism as the context menu does (where we do not // have the option to call the assignment method directly.) - if (GetShellManager() != NULL) - GetShellManager()->MoveToTop (this); - - SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); - if (pViewFrame != NULL) - { - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - if (pDispatcher != NULL) - pDispatcher->Execute(mnDefaultClickAction); - } + ExecuteCommand(mnDefaultClickAction); return 0; } @@ -262,13 +227,18 @@ IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent) // the mouse is selected. The actual display of the context menu is // done in ContextMenuCallback which is called indirectly through // PreviewValueSet::Command(). - mpPageSet->GrabFocus (); - mpPageSet->ReleaseMouse(); - if (GetDispatcher() != NULL && pEvent != NULL) + PreviewValueSet::GrabFocus (); + PreviewValueSet::ReleaseMouse(); + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame != NULL) { - sal_uInt16 nIndex = mpPageSet->GetItemId (pEvent->GetPosPixel()); - if (nIndex > 0) - mpPageSet->SelectItem (nIndex); + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher != NULL && pEvent != NULL) + { + sal_uInt16 nIndex = PreviewValueSet::GetItemId (pEvent->GetPosPixel()); + if (nIndex > 0) + PreviewValueSet::SelectItem (nIndex); + } } return 0; } @@ -276,39 +246,144 @@ IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent) -IMPL_LINK(MasterPagesSelector, ContextMenuCallback, CommandEvent*, pEvent) +void MasterPagesSelector::Command (const CommandEvent& rEvent) { - // Use the currently selected item and show the popup menu in its - // center. - if (GetShellManager() != NULL) - GetShellManager()->MoveToTop (this); - const sal_uInt16 nIndex = mpPageSet->GetSelectItemId(); - if (nIndex > 0 && pEvent!=NULL) + switch (rEvent.GetCommand()) { - // The position of the upper left corner of the context menu is - // taken either from the mouse position (when the command was sent - // as reaction to a right click) or in the center of the selected - // item (when the command was sent as reaction to Shift+F10.) - Point aPosition (pEvent->GetMousePosPixel()); - if ( ! pEvent->IsMouseEvent()) + case COMMAND_CONTEXTMENU: { - Rectangle aBBox (mpPageSet->GetItemRect(nIndex)); - aPosition = aBBox.Center(); + // Use the currently selected item and show the popup menu in its + // center. + const sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); + if (nIndex > 0) + { + // The position of the upper left corner of the context menu is + // taken either from the mouse position (when the command was sent + // as reaction to a right click) or in the center of the selected + // item (when the command was sent as reaction to Shift+F10.) + Point aPosition (rEvent.GetMousePosPixel()); + if ( ! rEvent.IsMouseEvent()) + { + Rectangle aBBox (PreviewValueSet::GetItemRect(nIndex)); + aPosition = aBBox.Center(); + } + + // Setup the menu. + ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu(GetContextMenuResId())); + FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pMenuWindow != NULL) + pMenuWindow->SetPopupModeFlags( + pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected)); + + ProcessPopupMenu(*pMenu); + + // Show the menu. + pMenu->Execute(this, Rectangle(aPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN); + } + break; } + } +} + - const ResId aPopupResId (GetContextMenuResId()); - mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup( - aPopupResId, - mpPageSet.get(), - &aPosition); + + +void MasterPagesSelector::ProcessPopupMenu (Menu& rMenu) +{ + // Disable some entries. + if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL) + rMenu.EnableItem(SID_TP_SHOW_SMALL_PREVIEW, sal_False); + else + rMenu.EnableItem(SID_TP_SHOW_LARGE_PREVIEW, sal_False); +} + + + + +IMPL_LINK(MasterPagesSelector, OnMenuItemSelected, Menu*, pMenu) +{ + if (pMenu == NULL) + { + OSL_ENSURE(pMenu!=NULL, "MasterPagesSelector::OnMenuItemSelected: illegal menu!"); + return 0; } + pMenu->Deactivate(); + ExecuteCommand(pMenu->GetCurItemId()); return 0; } +void MasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId) +{ + switch (nCommandId) + { + case SID_TP_APPLY_TO_ALL_SLIDES: + mrBase.SetBusyState (true); + AssignMasterPageToAllSlides (GetSelectedMasterPage()); + mrBase.SetBusyState (false); + break; + + case SID_TP_APPLY_TO_SELECTED_SLIDES: + mrBase.SetBusyState (true); + AssignMasterPageToSelectedSlides (GetSelectedMasterPage()); + mrBase.SetBusyState (false); + break; + + case SID_TP_USE_FOR_NEW_PRESENTATIONS: + DBG_ASSERT (false, + "Using slides as default for new presentations" + " is not yet implemented"); + break; + + case SID_TP_SHOW_SMALL_PREVIEW: + case SID_TP_SHOW_LARGE_PREVIEW: + { + mrBase.SetBusyState (true); + mpContainer->SetPreviewSize( + nCommandId==SID_TP_SHOW_SMALL_PREVIEW + ? MasterPageContainer::SMALL + : MasterPageContainer::LARGE); + mrBase.SetBusyState (false); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case SID_TP_EDIT_MASTER: + { + using namespace ::com::sun::star; + uno::Reference<drawing::XDrawPage> xSelectedMaster ( + GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY); + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame != NULL && xSelectedMaster.is()) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher != NULL) + { + sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); + pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON); + PreviewValueSet::SelectItem (nIndex); + mrBase.GetDrawController().setCurrentPage(xSelectedMaster); + } + } + break; + } + + case SID_CUT: + case SID_COPY: + case SID_PASTE: + // Cut, copy, and paste are not supported and thus are ignored. + break; + } +} + + + + IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent) { if (pEvent) @@ -324,7 +399,7 @@ SdPage* MasterPagesSelector::GetSelectedMasterPage (void) const ::osl::MutexGuard aGuard (maMutex); SdPage* pMasterPage = NULL; - sal_uInt16 nIndex = mpPageSet->GetSelectItemId(); + sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); UserData* pData = GetUserData(nIndex); if (pData != NULL) { @@ -427,7 +502,7 @@ void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerC switch (rEvent.meEventType) { case MasterPageContainerChangeEvent::SIZE_CHANGED: - mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel()); + PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel()); UpdateAllPreviews(); break; @@ -436,10 +511,10 @@ void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerC int nIndex (GetIndexForToken(rEvent.maChildToken)); if (nIndex >= 0) { - mpPageSet->SetItemImage ( + PreviewValueSet::SetItemImage ( (sal_uInt16)nIndex, mpContainer->GetPreviewForToken(rEvent.maChildToken)); - mpPageSet->Invalidate(mpPageSet->GetItemRect((sal_uInt16)nIndex)); + PreviewValueSet::Invalidate(PreviewValueSet::GetItemRect((sal_uInt16)nIndex)); } } break; @@ -473,8 +548,8 @@ MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) con { const ::osl::MutexGuard aGuard (maMutex); - if (nIndex>0 && nIndex<=mpPageSet->GetItemCount()) - return reinterpret_cast<UserData*>(mpPageSet->GetItemData((sal_uInt16)nIndex)); + if (nIndex>0 && nIndex<=PreviewValueSet::GetItemCount()) + return reinterpret_cast<UserData*>(PreviewValueSet::GetItemData((sal_uInt16)nIndex)); else return NULL; } @@ -486,12 +561,12 @@ void MasterPagesSelector::SetUserData (int nIndex, UserData* pData) { const ::osl::MutexGuard aGuard (maMutex); - if (nIndex>0 && nIndex<=mpPageSet->GetItemCount()) + if (nIndex>0 && nIndex<=PreviewValueSet::GetItemCount()) { UserData* pOldData = GetUserData(nIndex); if (pOldData!=NULL && pOldData!=pData) delete pOldData; - mpPageSet->SetItemData((sal_uInt16)nIndex, pData); + PreviewValueSet::SetItemData((sal_uInt16)nIndex, pData); } } @@ -508,7 +583,7 @@ bool MasterPagesSelector::IsResizable (void) ::Window* MasterPagesSelector::GetWindow (void) { - return mpPageSet.get(); + return this; } @@ -529,87 +604,6 @@ void MasterPagesSelector::UpdateSelection (void) -void MasterPagesSelector::Execute (SfxRequest& rRequest) -{ - switch (rRequest.GetSlot()) - { - case SID_TP_APPLY_TO_ALL_SLIDES: - mrBase.SetBusyState (true); - AssignMasterPageToAllSlides (GetSelectedMasterPage()); - mrBase.SetBusyState (false); - break; - - case SID_TP_APPLY_TO_SELECTED_SLIDES: - mrBase.SetBusyState (true); - AssignMasterPageToSelectedSlides (GetSelectedMasterPage()); - mrBase.SetBusyState (false); - break; - - case SID_TP_USE_FOR_NEW_PRESENTATIONS: - DBG_ASSERT (false, - "Using slides as default for new presentations" - " is not yet implemented"); - break; - - case SID_TP_SHOW_SMALL_PREVIEW: - case SID_TP_SHOW_LARGE_PREVIEW: - { - mrBase.SetBusyState (true); - mpContainer->SetPreviewSize( - rRequest.GetSlot()==SID_TP_SHOW_SMALL_PREVIEW - ? MasterPageContainer::SMALL - : MasterPageContainer::LARGE); - mrBase.SetBusyState (false); - break; - } - - case SID_TP_EDIT_MASTER: - { - using namespace ::com::sun::star; - uno::Reference<drawing::XDrawPage> xSelectedMaster ( - GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY); - SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); - if (pViewFrame != NULL && xSelectedMaster.is()) - { - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - if (pDispatcher != NULL) - { - sal_uInt16 nIndex = mpPageSet->GetSelectItemId(); - pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON); - mpPageSet->SelectItem (nIndex); - mrBase.GetDrawController().setCurrentPage(xSelectedMaster); - } - } - break; - } - - case SID_CUT: - case SID_COPY: - case SID_PASTE: - // Cut, copy, and paste are not supported and thus are ignored. - break; - } -} - - - - -void MasterPagesSelector::GetState (SfxItemSet& rItemSet) -{ - if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL) - rItemSet.DisableItem (SID_TP_SHOW_SMALL_PREVIEW); - else - rItemSet.DisableItem (SID_TP_SHOW_LARGE_PREVIEW); - - // Cut and paste is not supported so do not show the menu entries. - rItemSet.DisableItem (SID_CUT); - rItemSet.DisableItem (SID_COPY); - rItemSet.DisableItem (SID_PASTE); -} - - - - void MasterPagesSelector::SetItem ( sal_uInt16 nIndex, MasterPageContainer::Token aToken) @@ -627,14 +621,14 @@ void MasterPagesSelector::SetItem ( if (aPreview.GetSizePixel().Width()>0) { - if (mpPageSet->GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) + if (PreviewValueSet::GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) { - mpPageSet->SetItemImage(nIndex,aPreview); - mpPageSet->SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); + PreviewValueSet::SetItemImage(nIndex,aPreview); + PreviewValueSet::SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); } else { - mpPageSet->InsertItem ( + PreviewValueSet::InsertItem ( nIndex, aPreview, mpContainer->GetPageNameForToken(aToken), @@ -650,7 +644,7 @@ void MasterPagesSelector::SetItem ( } else { - mpPageSet->RemoveItem(nIndex); + PreviewValueSet::RemoveItem(nIndex); } } @@ -698,7 +692,7 @@ void MasterPagesSelector::InvalidatePreview (const SdPage* pPage) { const ::osl::MutexGuard aGuard (maMutex); - for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++) + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) { UserData* pData = GetUserData(nIndex); if (pData != NULL) @@ -718,20 +712,20 @@ void MasterPagesSelector::UpdateAllPreviews (void) { const ::osl::MutexGuard aGuard (maMutex); - for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++) + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) { UserData* pData = GetUserData(nIndex); if (pData != NULL) { MasterPageContainer::Token aToken (pData->second); - mpPageSet->SetItemImage( + PreviewValueSet::SetItemImage( nIndex, mpContainer->GetPreviewForToken(aToken)); if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE) mpContainer->RequestPreview(aToken); } } - mpPageSet->Rearrange(true); + PreviewValueSet::Rearrange(true); } @@ -741,13 +735,13 @@ void MasterPagesSelector::ClearPageSet (void) { const ::osl::MutexGuard aGuard (maMutex); - for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++) + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) { UserData* pData = GetUserData(nIndex); if (pData != NULL) delete pData; } - mpPageSet->Clear(); + PreviewValueSet::Clear(); } @@ -757,7 +751,7 @@ void MasterPagesSelector::SetHelpId( const rtl::OString& aId ) { const ::osl::MutexGuard aGuard (maMutex); - mpPageSet->SetHelpId( aId ); + PreviewValueSet::SetHelpId( aId ); } @@ -838,13 +832,18 @@ void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList maCurrentItemList.swap(*pNewItemList); - mpPageSet->Rearrange(); - if (GetParentNode() != NULL) - GetParentNode()->RequestResize(); + PreviewValueSet::Rearrange(); + if (mxSidebar.is()) + mxSidebar->requestLayout(); } +css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth (const sal_Int32 nWidth) +{ + const sal_Int32 nHeight (GetPreferredHeight(nWidth)); + return css::ui::LayoutSize(nHeight,nHeight,nHeight); +} -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx index c7d4edf754f1..f58ddefffae1 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -19,23 +19,27 @@ * *************************************************************/ +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX - -#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX -#define SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX - -#include "taskpane/TaskPaneTreeNode.hxx" #include "MasterPageContainer.hxx" #include "SlideSorterViewShell.hxx" +#include "PreviewValueSet.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> #include "pres.hxx" #include <sfx2/shell.hxx> #include <vcl/image.hxx> #include "glob.hxx" #include <osl/mutex.hxx> +#include <com/sun/star/ui/XSidebar.hpp> #include <queue> +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + class MouseEvent; class SdDrawDocument; class SdPage; @@ -48,26 +52,26 @@ class TemplateDir; class ViewShellBase; } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { class PreviewValueSet; +class SidebarShellManager; + /** Base class of a menu that lets the user select from a list of templates or designs that are loaded from files. */ class MasterPagesSelector - : public TreeNode, - public SfxShell + : public PreviewValueSet, + public sfx2::sidebar::ILayoutableWindow { public: - TYPEINFO(); - SFX_DECL_INTERFACE(SD_IF_SDMASTERPAGESSELECTOR) - MasterPagesSelector ( - TreeNode* pParent, + ::Window* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer); + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); virtual ~MasterPagesSelector (void); virtual void LateInit (void); @@ -92,9 +96,6 @@ public: virtual ::Window* GetWindow (void); virtual sal_Int32 GetMinimumWidth (void); - virtual void Execute (SfxRequest& rRequest); - virtual void GetState (SfxItemSet& rItemSet); - /** Update the selection of previews according to whatever influences them appart from mouse and keyboard. If, for example, the current page of the main pane changes, then call @@ -117,7 +118,6 @@ public: */ void ClearPageSet (void); - using SfxShell::SetHelpId; void SetHelpId( const rtl::OString& aId ); /** Mark the preview that belongs to the given index as not up-to-date @@ -132,12 +132,14 @@ public: void UpdateAllPreviews (void); + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + protected: mutable ::osl::Mutex maMutex; ::boost::shared_ptr<MasterPageContainer> mpContainer; SdDrawDocument& mrDocument; - ::std::auto_ptr<PreviewValueSet> mpPageSet; bool mbSmallPreviewSize; ViewShellBase& mrBase; /** Slot that is executed as default action when the left mouse button is @@ -206,7 +208,14 @@ protected: */ virtual ResId GetContextMenuResId (void) const; + virtual void Command (const CommandEvent& rEvent); + + virtual void ProcessPopupMenu (Menu& rMenu); + virtual void ExecuteCommand (const sal_Int32 nCommandId); + private: + cssu::Reference<css::ui::XSidebar> mxSidebar; + /** The offset between ValueSet index and MasterPageContainer::Token last seen. This value is used heuristically to speed up the lookup of an index for a token. @@ -215,6 +224,7 @@ private: DECL_LINK(RightClickHandler, MouseEvent*); DECL_LINK(ContextMenuCallback, CommandEvent*); DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*); + DECL_LINK(OnMenuItemSelected, Menu*); void SetItem ( sal_uInt16 nIndex, @@ -227,6 +237,6 @@ private: MasterPageContainer::Token aToken); }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx new file mode 100644 index 000000000000..6a4f3bc104cb --- /dev/null +++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx @@ -0,0 +1,89 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "NavigatorWrapper.hxx" +#include "navigatr.hrc" +#include "ViewShellBase.hxx" + +#include <sfx2/sidebar/Theme.hxx> + +#include <boost/bind.hpp> + + +namespace sd { namespace sidebar { + +NavigatorWrapper::NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings) + : Control(pParent, 0), + mrViewShellBase(rViewShellBase), + maNavigator( + this, + NULL, + SdResId(FLT_NAVIGATOR), + pBindings, + ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)) +{ + maNavigator.SetPosSizePixel( + Point(0,0), + GetSizePixel()); + maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + maNavigator.Show(); +} + + + + +NavigatorWrapper::~NavigatorWrapper (void) +{ +} + + + + +void NavigatorWrapper::Resize (void) +{ + maNavigator.SetSizePixel(GetSizePixel()); +} + + + + +css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth) +{ + (void)nWidth; + + return css::ui::LayoutSize(-1,-1,-1); +} + + + + +void NavigatorWrapper::UpdateNavigator (void) +{ + maNavigator.InitTreeLB(mrViewShellBase.GetDocument()); +} + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx new file mode 100644 index 000000000000..83370d1da444 --- /dev/null +++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx @@ -0,0 +1,72 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX +#define SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX + +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <vcl/ctrl.hxx> +#include "navigatr.hxx" + + +class SfxBindings; +namespace sd { class ViewShellBase; } + +namespace css = ::com::sun::star; + +namespace sd { namespace sidebar { + +/** Present the navigator as control that can be displayed inside the + sidebar. + This wrapper has two main responsibilities: + - Watch for document changes and update the navigator when one + happens. + - Forward size changes from sidebar to navigator. +*/ +class NavigatorWrapper + : public Control, + public sfx2::sidebar::ILayoutableWindow +{ +public: + NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings); + + virtual ~NavigatorWrapper (void); + + // Control + virtual void Resize (void); + + // From ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +private: + ViewShellBase& mrViewShellBase; + SdNavigatorWin maNavigator; + + void UpdateNavigator (void); +}; + + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx new file mode 100644 index 000000000000..ba2519c67712 --- /dev/null +++ b/sd/source/ui/sidebar/PanelBase.cxx @@ -0,0 +1,130 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "TableDesignPanel.hxx" + + + +namespace sd { namespace sidebar { + + +PanelBase::PanelBase ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : Control(pParentWindow), + mpWrappedControl(NULL), + mxSidebar(), + mrViewShellBase(rViewShellBase) +{ + OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow); + +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase"))); +#endif +} + + + + +PanelBase::~PanelBase (void) +{ + OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get()); + mpWrappedControl.reset(); + OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent()); +} + + + + + +void PanelBase::Dispose (void) +{ + OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get()); + mpWrappedControl.reset(); +} + + + + +css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 nWidth) +{ + sal_Int32 nHeight (0); + if (ProvideWrappedControl()) + nHeight = mpWrappedControl->GetSizePixel().Height(); + return css::ui::LayoutSize(nHeight,nHeight,nHeight); +} + + + + +void PanelBase::Resize (void) +{ + if (ProvideWrappedControl()) + { + Size aNewSize (GetSizePixel()); + mpWrappedControl->SetOutputSizePixel(aNewSize); + } +} + + + + +::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& ) +{ + if (ProvideWrappedControl()) + return mpWrappedControl->GetAccessible(); + else + return NULL; +} + + + + +void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + mxSidebar = rxSidebar; + if (mxSidebar.is() && mpWrappedControl!=NULL) + mxSidebar->requestLayout(); +} + + + + +bool PanelBase::ProvideWrappedControl (void) +{ + if ( ! mpWrappedControl) + { + mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase)); + OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this); + if (mpWrappedControl) + mpWrappedControl->Show(); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + return mpWrappedControl.get() != NULL; +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx new file mode 100644 index 000000000000..3deddc81f1a6 --- /dev/null +++ b/sd/source/ui/sidebar/PanelBase.hxx @@ -0,0 +1,90 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_PANELS_PANEL_BASE_HXX +#define SD_SIDEBAR_PANELS_PANEL_BASE_HXX + +#include "IDisposable.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> + +#include <vcl/ctrl.hxx> + +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sd { + class ViewShellBase; +} + + + + +namespace sd { namespace sidebar { + + +class PanelBase + : public Control, + public sfx2::sidebar::ILayoutableWindow, + public IDisposable, + public ISidebarReceiver +{ +public: + PanelBase ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~PanelBase (void); + + virtual void Resize (void); + + // IDisposable + virtual void Dispose (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + + // ISidebarReceiver + virtual void SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent); + +protected: + ::boost::scoped_ptr< ::Window> mpWrappedControl; + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) = 0; + +private: + cssu::Reference<css::ui::XSidebar> mxSidebar; + ViewShellBase& mrViewShellBase; + + bool ProvideWrappedControl (void); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx new file mode 100644 index 000000000000..7dba3eea3afa --- /dev/null +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -0,0 +1,212 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "PanelFactory.hxx" +#include "framework/Pane.hxx" +#include "ViewShellBase.hxx" +#include "DrawController.hxx" +#include "LayoutMenu.hxx" +#include "CurrentMasterPagesSelector.hxx" +#include "RecentMasterPagesSelector.hxx" +#include "AllMasterPagesSelector.hxx" +#include "CustomAnimationPanel.hxx" +#include "SlideTransitionPanel.hxx" +#include "NavigatorWrapper.hxx" + +#include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +using namespace css; +using namespace cssu; +using namespace ::sd::framework; +using ::rtl::OUString; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace sd { + extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase); +} + +namespace sd { namespace sidebar { + +namespace { + /** Note that these names have to be identical to (the tail of) + the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu + for the TaskPanelFactory. + */ + const static char* gsResourceNameCustomAnimations = "/CustomAnimations"; + const static char* gsResourceNameLayouts = "/Layouts"; + const static char* gsResourceNameAllMasterPages = "/AllMasterPages"; + const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages"; + const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages"; + const static char* gsResourceNameSlideTransitions = "/SlideTransitions"; + const static char* gsResourceNameTableDesign = "/TableDesign"; + const static char* gsResourceNameNavigator = "/NavigatorPanel"; +} + +Reference<lang::XEventListener> mxControllerDisposeListener; + + + +// ----- Service functions ---------------------------------------------------- + +Reference<XInterface> SAL_CALL PanelFactory_createInstance ( + const Reference<XComponentContext>& rxContext) +{ + return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext))); +} + + + + +::rtl::OUString PanelFactory_getImplementationName (void) throw(RuntimeException) +{ + return ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.PanelFactory")); +} + + + + +Sequence<rtl::OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) + throw (RuntimeException) +{ + static const ::rtl::OUString sServiceName( + ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.PanelFactory")); + return Sequence<rtl::OUString>(&sServiceName, 1); +} + + + + +//----- PanelFactory -------------------------------------------------------- + +PanelFactory::PanelFactory( + const css::uno::Reference<css::uno::XComponentContext>& rxContext) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + + + +PanelFactory::~PanelFactory (void) +{ +} + + + + +void SAL_CALL PanelFactory::disposing (void) +{ +} + + + + +// XUIElementFactory + +Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( + const ::rtl::OUString& rsUIElementResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException) +{ + // Process arguments. + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + + // Throw exceptions when the arguments are not as expected. + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without XFrame"), + NULL); + + // Tunnel through the controller to obtain a ViewShellBase. + ViewShellBase* pBase = NULL; + Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY); + if (xTunnel.is()) + { + ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( + xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); + if (pController != NULL) + pBase = pController->GetViewShellBase(); + } + if (pBase == NULL) + throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL); + + // Get bindings from given arguments. + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + // Create a framework view. + ::Window* pControl = NULL; + css::ui::LayoutSize aLayoutSize (-1,-1,-1); + +#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) + if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) + pControl = new CustomAnimationPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) + pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) + pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) + pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) + pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) + pControl = new SlideTransitionPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) + pControl = createTableDesignPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator)) + pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings); +#undef EndsWith + + if (pControl == NULL) + throw lang::IllegalArgumentException(); + + // Create a wrapper around the control that implements the + // necessary UNO interfaces. + return sfx2::sidebar::SidebarPanelBase::Create( + rsUIElementResourceURL, + xFrame, + pControl, + aLayoutSize); +} + + + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/PanelFactory.hxx b/sd/source/ui/sidebar/PanelFactory.hxx new file mode 100644 index 000000000000..392b0dc1a0cb --- /dev/null +++ b/sd/source/ui/sidebar/PanelFactory.hxx @@ -0,0 +1,88 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_PANEL_FACTORY_HXX +#define SD_SIDEBAR_PANEL_FACTORY_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include "framework/Pane.hxx" + +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <map> +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sd { + class ViewShellBase; +} + +namespace sd { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class PanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + PanelFactory (const cssu::Reference<cssu::XComponentContext>& rxContext); + virtual ~PanelFactory (void); + + virtual void SAL_CALL disposing (void); + + + // XUIElementFactory + + cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException); +}; + + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx index 2604db18b122..556073f242e5 100644 --- a/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx +++ b/sd/source/ui/sidebar/PreviewValueSet.cxx @@ -19,21 +19,17 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "PreviewValueSet.hxx" #include <vcl/image.hxx> -#include "taskpane/TaskPaneTreeNode.hxx" -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { -PreviewValueSet::PreviewValueSet (TreeNode* pParent) - : ValueSet (pParent->GetWindow(), WB_TABSTOP), - mpParent(pParent), + +PreviewValueSet::PreviewValueSet (::Window* pParent) + : ValueSet (pParent, WB_TABSTOP), maPreviewSize(10,10), mnBorderWidth(3), mnBorderHeight(3), @@ -44,9 +40,7 @@ PreviewValueSet::PreviewValueSet (TreeNode* pParent) & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET) // | WB_FLATVALUESET); ); - SetColCount(2); - // SetLineCount(1); SetExtraSpacing (2); } @@ -89,18 +83,6 @@ void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent) -void PreviewValueSet::Paint (const Rectangle& rRect) -{ - SetBackground (GetSettings().GetStyleSettings().GetWindowColor()); - - ValueSet::Paint (rRect); - - SetBackground (Wallpaper()); -} - - - - void PreviewValueSet::Resize (void) { ValueSet::Resize (); @@ -115,26 +97,6 @@ void PreviewValueSet::Resize (void) -void PreviewValueSet::Command (const CommandEvent& rEvent) -{ - switch (rEvent.GetCommand()) - { - case COMMAND_CONTEXTMENU: - { - CommandEvent aNonConstEventCopy (rEvent); - maContextMenuCallback.Call(&aNonConstEventCopy); - } - break; - - default: - ValueSet::Command(rEvent); - break; - } -} - - - - void PreviewValueSet::Rearrange (bool bForceRequestResize) { sal_uInt16 nOldColumnCount (GetColCount()); @@ -146,19 +108,6 @@ void PreviewValueSet::Rearrange (bool bForceRequestResize) SetColCount(nNewColumnCount); SetLineCount(nNewRowCount); - - if (bForceRequestResize - || nOldColumnCount != nNewColumnCount - || nOldRowCount != nNewRowCount) - mpParent->RequestResize(); -} - - - - -void PreviewValueSet::SetContextMenuCallback (const Link& rLink) -{ - maContextMenuCallback = rLink; } @@ -233,4 +182,4 @@ sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth) -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx b/sd/source/ui/sidebar/PreviewValueSet.hxx index bf0bdfa9a3eb..5a0c55c18d10 100644 --- a/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx +++ b/sd/source/ui/sidebar/PreviewValueSet.hxx @@ -19,19 +19,13 @@ * *************************************************************/ - - -#ifndef SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX -#define SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX +#ifndef SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX +#define SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX #include <svtools/valueset.hxx> -namespace sd { namespace toolpanel { -class TreeNode; -} } - -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Adapt the svtools valueset to the needs of the master page controlls. @@ -40,21 +34,12 @@ class PreviewValueSet : public ValueSet { public: - PreviewValueSet (TreeNode* pParent); + PreviewValueSet (::Window* pParent); ~PreviewValueSet (void); void SetRightMouseClickHandler (const Link& rLink); - virtual void Paint (const Rectangle& rRect); virtual void Resize (void); - /** When a request for the display of a context menu is made to this - method then that request is forwarded via the ContextMenuCallback. - This way the owning class can handle the context menu without having - to be derived from this class. - Use SetContextMenuCallback to set or rest the handler. - */ - virtual void Command (const CommandEvent& rEvent); - void SetPreviewSize (const Size& rSize); sal_Int32 GetPreferredWidth (sal_Int32 nHeight); @@ -65,19 +50,11 @@ public: */ void Rearrange (bool bForceRequestResize = false); - /** Set the callback function to which requests for context menus are - forewarded. Call with an empty Link to reset the callback - function. - */ - void SetContextMenuCallback (const Link& rLink); - protected: virtual void MouseButtonDown (const MouseEvent& rEvent); private: Link maRightMouseClickHandler; - Link maContextMenuCallback; - TreeNode* mpParent; Size maPreviewSize; const int mnBorderWidth; const int mnBorderHeight; @@ -87,6 +64,6 @@ private: sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const; }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index 87cffd4bd33a..c107a5e43384 100644 --- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -19,34 +19,61 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "RecentMasterPagesSelector.hxx" -#include "PreviewValueSet.hxx" +#include "ViewShellBase.hxx" #include "RecentlyUsedMasterPages.hxx" #include "MasterPageContainerProviders.hxx" #include "MasterPageObserver.hxx" +#include "SidebarShellManager.hxx" #include "sdpage.hxx" #include "drawdoc.hxx" #include "app.hrc" +#include "helpids.h" + #include <vcl/bitmap.hxx> #include <tools/color.hxx> -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { + + +MasterPagesSelector* RecentMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new RecentMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); + + return pSelector; +} + + RecentMasterPagesSelector::RecentMasterPagesSelector ( - TreeNode* pParent, + ::Window* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer) - : MasterPagesSelector (pParent, rDocument, rBase, rpContainer) + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar) { - SetName (String(RTL_CONSTASCII_USTRINGPARAM("RecentMasterPagesSelector"))); } @@ -125,31 +152,30 @@ void RecentMasterPagesSelector::AssignMasterPageToPageList ( SdPage* pMasterPage, const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList) { - sal_uInt16 nSelectedItemId = mpPageSet->GetSelectItemId(); + sal_uInt16 nSelectedItemId = PreviewValueSet::GetSelectItemId(); MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList); // Restore the selection. - if (mpPageSet->GetItemCount() > 0) + if (PreviewValueSet::GetItemCount() > 0) { - if (mpPageSet->GetItemCount() >= nSelectedItemId) - mpPageSet->SelectItem(nSelectedItemId); + if (PreviewValueSet::GetItemCount() >= nSelectedItemId) + PreviewValueSet::SelectItem(nSelectedItemId); else - mpPageSet->SelectItem(mpPageSet->GetItemCount()); + PreviewValueSet::SelectItem(PreviewValueSet::GetItemCount()); } } -void RecentMasterPagesSelector::GetState (SfxItemSet& rItemSet) +void RecentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu) { - MasterPagesSelector::GetState (rItemSet); - if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE) - rItemSet.DisableItem (SID_TP_EDIT_MASTER); + if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False); } -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx index c5c2dd5b798b..da9bcc90fbd5 100644 --- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -21,12 +21,12 @@ -#ifndef SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX -#define SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX +#ifndef SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX #include "MasterPagesSelector.hxx" -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** Show the recently used master pages (that are not currently used). @@ -35,22 +35,16 @@ class RecentMasterPagesSelector : public MasterPagesSelector { public: - RecentMasterPagesSelector ( - TreeNode* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - const ::boost::shared_ptr<MasterPageContainer>& rpContainer); - virtual ~RecentMasterPagesSelector (void); - - virtual void LateInit (void); - - virtual void GetState (SfxItemSet& rItemSet); + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); protected: DECL_LINK(MasterPageListListener, void*); virtual void Fill (ItemList& rItemList); - using sd::toolpanel::controls::MasterPagesSelector::Fill; + using sd::sidebar::MasterPagesSelector::Fill; /** Forward this call to the base class but save and restore the currently selected item. @@ -65,8 +59,21 @@ protected: virtual void AssignMasterPageToPageList ( SdPage* pMasterPage, const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList); + + virtual void ProcessPopupMenu (Menu& rMenu); + +private: + RecentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~RecentMasterPagesSelector (void); + + virtual void LateInit (void); }; -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index f56477b8804c..9c71f68f4b10 100644 --- a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -19,9 +19,6 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" #include "RecentlyUsedMasterPages.hxx" @@ -78,13 +75,13 @@ class Descriptor public: ::rtl::OUString msURL; ::rtl::OUString msName; - ::sd::toolpanel::controls::MasterPageContainer::Token maToken; + ::sd::sidebar::MasterPageContainer::Token maToken; Descriptor (const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName) : msURL(rsURL), msName(rsName), - maToken(::sd::toolpanel::controls::MasterPageContainer::NIL_TOKEN) + maToken(::sd::sidebar::MasterPageContainer::NIL_TOKEN) {} - Descriptor (::sd::toolpanel::controls::MasterPageContainer::Token aToken, + Descriptor (::sd::sidebar::MasterPageContainer::Token aToken, const ::rtl::OUString& rsURL, const ::rtl::OUString& rsName) : msURL(rsURL), msName(rsName), @@ -92,11 +89,11 @@ public: {} class TokenComparator { public: - TokenComparator(::sd::toolpanel::controls::MasterPageContainer::Token aToken) + TokenComparator(::sd::sidebar::MasterPageContainer::Token aToken) : maToken(aToken) {} bool operator () (const Descriptor& rDescriptor) { return maToken==rDescriptor.maToken; } - private: ::sd::toolpanel::controls::MasterPageContainer::Token maToken; + private: ::sd::sidebar::MasterPageContainer::Token maToken; }; }; @@ -105,7 +102,7 @@ public: -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor> { @@ -494,4 +491,4 @@ void RecentlyUsedMasterPages::ResolveList (void) } -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx index 22439c1c45a5..936c2ef2e1a0 100644 --- a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx @@ -21,8 +21,8 @@ -#ifndef SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX -#define SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX +#ifndef SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX +#define SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX #include "tools/SdGlobalResourceContainer.hxx" #include <osl/mutex.hxx> @@ -42,7 +42,7 @@ class MasterPageObserverEvent; } -namespace sd { namespace toolpanel { namespace controls { +namespace sd { namespace sidebar { /** This singleton holds a list of the most recently used master pages. */ @@ -119,6 +119,6 @@ private: -} } } // end of namespace ::sd::toolpanel::controls +} } // end of namespace sd::sidebar #endif diff --git a/sd/source/ui/sidebar/SidebarFactory.cxx b/sd/source/ui/sidebar/SidebarFactory.cxx new file mode 100644 index 000000000000..7eb2b6b65b30 --- /dev/null +++ b/sd/source/ui/sidebar/SidebarFactory.cxx @@ -0,0 +1,240 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "SidebarFactory.hxx" +#include "framework/Pane.hxx" +#include "ViewShellBase.hxx" +#include "DrawController.hxx" +#include "LayoutMenu.hxx" +#include "CurrentMasterPagesSelector.hxx" +#include "RecentMasterPagesSelector.hxx" +#include "AllMasterPagesSelector.hxx" +#include "CustomAnimationPanel.hxx" +#include "TableDesignPanel.hxx" +#include "SlideTransitionPanel.hxx" + +#include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +using namespace css; +using namespace cssu; +using namespace ::sd::framework; +using ::rtl::OUString; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace sd { namespace sidebar { + +namespace { + /** Note that these names have to be identical to (the tail of) + the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu + for the TaskPanelFactory. + */ + const static char* gsResourceNameCustomAnimations = "/CustomAnimations"; + const static char* gsResourceNameLayouts = "/Layouts"; + const static char* gsResourceNameAllMasterPages = "/AllMasterPages"; + const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages"; + const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages"; + const static char* gsResourceNameSlideTransitions = "/SlideTransitions"; + const static char* gsResourceNameTableDesign = "/TableDesign"; +} + +Reference<lang::XEventListener> mxControllerDisposeListener; + + + +// ----- Service functions ---------------------------------------------------- + +Reference<XInterface> SAL_CALL SidebarFactory_createInstance ( + const Reference<XComponentContext>& rxContext) +{ + return Reference<XInterface>(static_cast<XWeak*>(new SidebarFactory(rxContext))); +} + + + + +::rtl::OUString SidebarFactory_getImplementationName (void) throw(RuntimeException) +{ + return ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.SidebarFactory")); +} + + + + +Sequence<rtl::OUString> SAL_CALL SidebarFactory_getSupportedServiceNames (void) + throw (RuntimeException) +{ + static const ::rtl::OUString sServiceName( + ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.SidebarFactory")); + return Sequence<rtl::OUString>(&sServiceName, 1); +} + + + + +//----- SidebarFactory -------------------------------------------------------- + +SidebarFactory::SidebarFactory( + const css::uno::Reference<css::uno::XComponentContext>& rxContext) + : SidebarFactoryInterfaceBase(m_aMutex) +{ +} + + + + +SidebarFactory::~SidebarFactory (void) +{ +} + + + + +void SAL_CALL SidebarFactory::disposing (void) +{ +} + + + + +// XInitialization + +void SAL_CALL SidebarFactory::initialize (const Sequence<Any>& aArguments) + throw (Exception, RuntimeException) +{ +} + + + + +// XUIElementFactory + +Reference<ui::XUIElement> SAL_CALL SidebarFactory::createUIElement ( + const ::rtl::OUString& rsUIElementResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException) +{ + // Process arguments. + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + + // Throw exceptions when the arguments are not as expected. + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("SidebarFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("SidebarFactory::createUIElement called without XFrame"), + NULL); + + // Tunnel through the controller to obtain a ViewShellBase. + ViewShellBase* pBase = NULL; + Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY); + if (xTunnel.is()) + { + ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( + xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); + if (pController != NULL) + pBase = pController->GetViewShellBase(); + } + if (pBase == NULL) + throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL); + + // Create a framework view. + ::Window* pControl = NULL; + +#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) + if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) + pControl = new CustomAnimationPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) + pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) + pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) + pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) + pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) + pControl = new SlideTransitionPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) + pControl = new TableDesignPanel(pParentWindow, *pBase); +#undef EndsWith + + if (pControl == NULL) + throw lang::IllegalArgumentException(); + + // Create a wrapper around pane and view and return it as + // XUIElement. + Reference<ui::XUIElement> xUIElement; + try + { + xUIElement.set( + sfx2::sidebar::SidebarPanelBase::Create( + rsUIElementResourceURL, + xFrame, + pControl, + ui::LayoutSize(-1,-1,-1))); + } + catch(Exception& rException) + { + // Creation of XUIElement failed. mxUIElement remains empty. + } + + Reference<lang::XComponent> xComponent (xUIElement, UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(this); + + return xUIElement; +} + + + + +void SAL_CALL SidebarFactory::disposing (const ::css::lang::EventObject& rEvent) + throw(cssu::RuntimeException) +{ + /* + if (mpImplementation + && rEvent.Source == mpImplementation->mxUIElement) + { + mpImplementation->mxUIElement.clear(); + } + */ +} + + + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/SidebarFactory.hxx b/sd/source/ui/sidebar/SidebarFactory.hxx new file mode 100644 index 000000000000..0b4ae9542bf6 --- /dev/null +++ b/sd/source/ui/sidebar/SidebarFactory.hxx @@ -0,0 +1,120 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_FACTORY_HXX +#define SD_SIDEBAR_FACTORY_HXX + +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include "framework/Pane.hxx" + +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <map> +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sd { + class ViewShellBase; +} + +namespace sd { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper3 < + css::lang::XInitialization, + css::ui::XUIElementFactory, + css::lang::XEventListener + > SidebarFactoryInterfaceBase; +} + + +/** This factory creates both XUIElements (for sidebar panels) and + a drawing framework pane. + + The drawing framework pane is a container for the SidebarViewShell + which is necessary to run the legacy implementations of the task + pane panels. + + Control and information flow is like this: + + When one of the old task panels is requested to be displayed in + the sidebar this factory is called for + XUIElementFactory::createUIElement(). + One of the arguments, the window, is then exported into the + drawing framework as pane. After this the drawing framework is + used to create the SidebarViewShell (once known as + TaskPaneViewShell or ToolPanelViewShell) and the requested panel. +*/ +class SidebarFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SidebarFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + SidebarFactory (const cssu::Reference<cssu::XComponentContext>& rxContext); + virtual ~SidebarFactory (void); + + virtual void SAL_CALL disposing (void); + + + // XInitialization + + virtual void SAL_CALL initialize( + const css::uno::Sequence<css::uno::Any>& aArguments) + throw (css::uno::Exception, css::uno::RuntimeException); + + + // XUIElementFactory + + cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException); + + + // XEventListener + + virtual void SAL_CALL disposing (const ::css::lang::EventObject& rEvent) + throw(cssu::RuntimeException); +}; + + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx b/sd/source/ui/sidebar/SidebarFocusManager.hxx index c77b5a96126d..c77b5a96126d 100644 --- a/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx +++ b/sd/source/ui/sidebar/SidebarFocusManager.hxx diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/sidebar/SidebarShellManager.cxx index fe3ef0ba80ab..ffecd014c5f9 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx +++ b/sd/source/ui/sidebar/SidebarShellManager.cxx @@ -19,12 +19,9 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" -#include "TaskPaneShellManager.hxx" +#include "SidebarShellManager.hxx" #include "ViewShellManager.hxx" #include <tools/diagnose_ex.h> @@ -32,9 +29,9 @@ #include <algorithm> -namespace sd { namespace toolpanel { +namespace sd { namespace sidebar { -TaskPaneShellManager::TaskPaneShellManager ( +SidebarShellManager::SidebarShellManager ( const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, const ViewShell& rViewShell) : mpViewShellManager(rpViewShellManager), @@ -46,7 +43,7 @@ TaskPaneShellManager::TaskPaneShellManager ( -TaskPaneShellManager::~TaskPaneShellManager (void) +SidebarShellManager::~SidebarShellManager (void) { while ( ! maSubShells.empty()) RemoveSubShell(maSubShells.begin()->second.mpShell); @@ -55,7 +52,7 @@ TaskPaneShellManager::~TaskPaneShellManager (void) -SfxShell* TaskPaneShellManager::CreateShell( ShellId nId, ::Window* , FrameView* ) +SfxShell* SidebarShellManager::CreateShell( ShellId nId, ::Window* , FrameView* ) { SubShells::const_iterator iShell (maSubShells.find(nId)); if (iShell != maSubShells.end()) @@ -67,12 +64,12 @@ SfxShell* TaskPaneShellManager::CreateShell( ShellId nId, ::Window* , FrameView* -void TaskPaneShellManager::ReleaseShell (SfxShell* ) +void SidebarShellManager::ReleaseShell (SfxShell* ) { // Nothing to do. } -void TaskPaneShellManager::AddSubShell ( +void SidebarShellManager::AddSubShell ( ShellId nId, SfxShell* pShell, ::Window* pWindow) @@ -82,7 +79,7 @@ void TaskPaneShellManager::AddSubShell ( maSubShells[nId] = ShellDescriptor(pShell,pWindow); if (pWindow != NULL) { - pWindow->AddEventListener(LINK(this,TaskPaneShellManager,WindowCallback)); + pWindow->AddEventListener(LINK(this,SidebarShellManager,WindowCallback)); if (pWindow->IsReallyVisible()) mpViewShellManager->ActivateSubShell(mrViewShell, nId); } @@ -94,13 +91,13 @@ void TaskPaneShellManager::AddSubShell ( -void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId) +void SidebarShellManager::RemoveSubShell (const ShellId i_nShellId) { SubShells::iterator pos = maSubShells.find( i_nShellId ); ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" ); if ( pos->second.mpWindow != NULL ) { - pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) ); + pos->second.mpWindow->RemoveEventListener( LINK( this, SidebarShellManager, WindowCallback ) ); } mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first ); maSubShells.erase( pos ); @@ -109,7 +106,7 @@ void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId) -void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell) +void SidebarShellManager::RemoveSubShell (const SfxShell* pShell) { if (pShell != NULL) { @@ -119,7 +116,7 @@ void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell) { if (iShell->second.mpWindow != NULL) iShell->second.mpWindow->RemoveEventListener( - LINK(this,TaskPaneShellManager,WindowCallback)); + LINK(this,SidebarShellManager,WindowCallback)); mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first); maSubShells.erase(iShell); break; @@ -130,7 +127,7 @@ void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell) -void TaskPaneShellManager::MoveToTop (SfxShell* pShell) +void SidebarShellManager::MoveToTop (SfxShell* pShell) { SubShells::const_iterator iShell; for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell) @@ -146,7 +143,7 @@ void TaskPaneShellManager::MoveToTop (SfxShell* pShell) -IMPL_LINK(TaskPaneShellManager, WindowCallback, VclWindowEvent*, pEvent) +IMPL_LINK(SidebarShellManager, WindowCallback, VclWindowEvent*, pEvent) { if (pEvent != NULL) { @@ -176,4 +173,4 @@ IMPL_LINK(TaskPaneShellManager, WindowCallback, VclWindowEvent*, pEvent) } -} } // end of namespace ::sd::toolpanel +} } // end of namespace ::sd::sidebar diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/sidebar/SidebarShellManager.hxx index 5f34ed1fd280..809f8ecf883e 100644 --- a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx +++ b/sd/source/ui/sidebar/SidebarShellManager.hxx @@ -21,8 +21,8 @@ -#ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX -#define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX +#ifndef SD_SIDEBAR_SHELL_MANAGER_HXX +#define SD_SIDEBAR_SHELL_MANAGER_HXX #include "ShellFactory.hxx" #include "ViewShellManager.hxx" @@ -37,7 +37,7 @@ namespace sd { class ViewShell; } -namespace sd { namespace toolpanel { +namespace sd { namespace sidebar { /** The TaskPaneShellManager implements the ViewShellManager::ShellFactory interface. However, it does not create or delete shells. It only @@ -45,17 +45,17 @@ namespace sd { namespace toolpanel { ToolPanelViewShell. Life time control of the sub shells is managed by the sub shells themselves. */ -class TaskPaneShellManager +class SidebarShellManager : public ShellFactory<SfxShell> { public: /** Create a shell manager that manages the stacked shells for the given view shell. It works together with the given view shell manager. */ - TaskPaneShellManager ( + SidebarShellManager ( const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, const ViewShell& rViewShell); - ~TaskPaneShellManager (void); + ~SidebarShellManager (void); /** Return the requested sub shell. @param nId @@ -112,6 +112,6 @@ private: SubShells maSubShells; }; -} } // end of namespace ::sd::toolpanel +} } // end of namespace ::sd::sidebar #endif diff --git a/sd/source/ui/sidebar/SlideTransitionPanel.cxx b/sd/source/ui/sidebar/SlideTransitionPanel.cxx new file mode 100644 index 000000000000..c23ebc135c7c --- /dev/null +++ b/sd/source/ui/sidebar/SlideTransitionPanel.cxx @@ -0,0 +1,76 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "SlideTransitionPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window* createSlideTransitionPanel (::Window* pParent, ViewShellBase& rBase); + extern sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pParent); +} + + + + +namespace sd { namespace sidebar { + + +SlideTransitionPanel::SlideTransitionPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase(pParentWindow, rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:SlideTransitionPanel"))); +#endif +} + + + + +SlideTransitionPanel::~SlideTransitionPanel (void) +{ +} + + + + +::Window* SlideTransitionPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createSlideTransitionPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize SlideTransitionPanel::GetHeightForWidth (const sal_Int32 nWidth) +{ + const sal_Int32 nMinimumHeight(getSlideTransitionPanelMinimumHeight(mpWrappedControl.get())); + return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight); +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/toolpanel/ControlList.hxx b/sd/source/ui/sidebar/SlideTransitionPanel.hxx index e6061d1e7b8a..f3843bc26b14 100644 --- a/sd/source/ui/toolpanel/ControlList.hxx +++ b/sd/source/ui/sidebar/SlideTransitionPanel.hxx @@ -20,36 +20,32 @@ *************************************************************/ +#ifndef SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX +#define SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX -#ifndef SD_TOOLPANEL_CONTROL_LIST_HXX -#define SD_TOOLPANEL_CONTROL_LIST_HXX +#include "PanelBase.hxx" -#include "ConstrainedIterator.hxx" -#include "ConstrainedIterator.cxx" -#include "TitledControl.hxx" +namespace sd { namespace sidebar { -#include <vector> - -namespace sd { namespace toolpanel { - - -typedef ::std::vector<TitledControl*> ControlList; -typedef ConstrainedIterator<ControlList> ControlIterator; - - -class VisibilityConstraint - : public Constraint<ControlList> +class SlideTransitionPanel + : public PanelBase { public: - virtual bool operator() ( - const ControlList& rContainer, - const ControlList::iterator& rIterator) const - { - return (**rIterator).GetWindow()->IsVisible(); - } + SlideTransitionPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~SlideTransitionPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); }; +} } // end of namespace sd::sidebar -} } // end of namespace ::sd::toolpanel #endif diff --git a/sd/source/ui/sidebar/TableDesignPanel.cxx b/sd/source/ui/sidebar/TableDesignPanel.cxx new file mode 100644 index 000000000000..27df5b584a65 --- /dev/null +++ b/sd/source/ui/sidebar/TableDesignPanel.cxx @@ -0,0 +1,73 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sd.hxx" + +#include "TableDesignPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase); +} + + +namespace sd { namespace sidebar { + + +TableDesignPanel::TableDesignPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase(pParentWindow, rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:TableDesignPanel"))); +#endif +} + + + + +TableDesignPanel::~TableDesignPanel (void) +{ +} + + + + +::Window* TableDesignPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createTableDesignPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize TableDesignPanel::GetHeightForWidth (const sal_Int32 nWidth) +{ + //TODO: make the sizes depend on the font size. + return css::ui::LayoutSize(350,-1, 400); +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/TableDesignPanel.hxx b/sd/source/ui/sidebar/TableDesignPanel.hxx new file mode 100644 index 000000000000..75bf411640d3 --- /dev/null +++ b/sd/source/ui/sidebar/TableDesignPanel.hxx @@ -0,0 +1,49 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX +#define SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX + +#include "PanelBase.hxx" + +namespace sd { namespace sidebar { + +class TableDesignPanel + : public PanelBase +{ +public: + TableDesignPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~TableDesignPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/toolpanel/controls/makefile.mk b/sd/source/ui/sidebar/makefile.mk index 82d3d6c431ee..eb23504bebe1 100644 --- a/sd/source/ui/toolpanel/controls/makefile.mk +++ b/sd/source/ui/sidebar/makefile.mk @@ -21,15 +21,15 @@ -PRJ=..$/..$/..$/.. +PRJ=..$/..$/.. PROJECTPCH=sd PROJECTPCHSOURCE=$(PRJ)$/util$/sd PRJNAME=sd -TARGET=tpcontrols +TARGET=sidebar ENABLE_EXCEPTIONS=TRUE AUTOSEG=true -PRJINC=..$/..$/ ..$/..$/slidesorter +PRJINC=.. # --- Settings ----------------------------------------------------- @@ -41,21 +41,23 @@ PRJINC=..$/..$/ ..$/..$/slidesorter SLOFILES = \ $(SLO)$/AllMasterPagesSelector.obj \ $(SLO)$/CurrentMasterPagesSelector.obj \ + $(SLO)$/CustomAnimationPanel.obj \ $(SLO)$/DocumentHelper.obj \ - $(SLO)$/MasterPageObserver.obj \ - $(SLO)$/MasterPagesPanel.obj \ - $(SLO)$/MasterPagesSelector.obj \ + $(SLO)$/LayoutMenu.obj \ $(SLO)$/MasterPageContainer.obj \ $(SLO)$/MasterPageContainerFiller.obj \ $(SLO)$/MasterPageContainerProviders.obj\ $(SLO)$/MasterPageContainerQueue.obj \ $(SLO)$/MasterPageDescriptor.obj \ + $(SLO)$/MasterPageObserver.obj \ + $(SLO)$/MasterPagesSelector.obj \ + $(SLO)$/NavigatorWrapper.obj \ + $(SLO)$/PanelBase.obj \ + $(SLO)$/PanelFactory.obj \ $(SLO)$/PreviewValueSet.obj \ $(SLO)$/RecentlyUsedMasterPages.obj \ $(SLO)$/RecentMasterPagesSelector.obj \ - $(SLO)$/CustomAnimationPanel.obj \ - $(SLO)$/SlideTransitionPanel.obj \ - $(SLO)$/TableDesignPanel.obj + $(SLO)$/SlideTransitionPanel.obj # --- Tagets ------------------------------------------------------- diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 22d6dcdbd673..2fd7549fdbbd 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -191,7 +191,8 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) // in the tool pane. if (mrSlideSorter.GetViewShellBase() != NULL) framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase()) - ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL); + ->RequestSidebarPanel( + sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL); rRequest.Ignore (); break; } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 0cd00699140f..cec62e8ce11f 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -51,6 +51,7 @@ #include "sdresid.hxx" #include "AccessibleSlideSorterView.hxx" #include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" #include "FrameView.hxx" #include "SdUnoSlideView.hxx" #include "ViewShellManager.hxx" @@ -62,7 +63,10 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <svx/svxids.hrc> +#include <sfx2/sidebar/EnumContext.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/drawing/framework/ResourceId.hpp> #include <cppuhelper/bootstrap.hxx> @@ -77,12 +81,14 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::sd::framework::FrameworkHelper; +using ::sfx2::sidebar::EnumContext; namespace sd { namespace slidesorter { SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell, SdResId(STR_SLIDESORTERVIEWSHELL)) { + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -220,12 +226,11 @@ SlideSorterViewShell* SlideSorterViewShell::GetSlideSorter (ViewShellBase& rBase { SlideSorterViewShell* pViewShell = NULL; - // Test the center, left, and then the right pane for showing a slide sorter. + // Test the center and left pane for showing a slide sorter. ::rtl::OUString aPaneURLs[] = { FrameworkHelper::msCenterPaneURL, FrameworkHelper::msFullScreenPaneURL, FrameworkHelper::msLeftImpressPaneURL, - FrameworkHelper::msRightPaneURL, ::rtl::OUString()}; try @@ -547,6 +552,50 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate) ViewShell::Activate(bIsMDIActivate); if (mbIsArrangeGUIElementsPending) ArrangeGUIElements(); + + // Determine and broadcast the context that belongs to the main view shell. + EnumContext::Context eContext = EnumContext::Context_Unknown; + ::boost::shared_ptr<ViewShell> pMainViewShell (GetViewShellBase().GetMainViewShell()); + ViewShell::ShellType eMainViewShellType ( + pMainViewShell + ? pMainViewShell->GetShellType() + : ViewShell::ST_NONE); + switch (eMainViewShellType) + { + case ViewShell::ST_IMPRESS: + eContext = EnumContext::Context_DrawPage; + if (pMainViewShell->ISA(DrawViewShell)) + { + DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell.get()); + if (pDrawViewShell && (pDrawViewShell->GetEditMode()== EM_MASTERPAGE)) + eContext = EnumContext::Context_MasterPage; + } + break; + + case ViewShell::ST_SLIDE_SORTER: + eContext = EnumContext::Context_SlidesorterPage; + break; + + case ViewShell::ST_NOTES: + eContext = EnumContext::Context_NotesPage; + break; + + default: + break; + } + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShellBase(), + eContext); +} + + + + +void SlideSorterViewShell::Deactivate (sal_Bool bIsMDIActivate) +{ + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShellBase(), + EnumContext::Context_Default); } diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index e49cffbaecdf..3f363d53dd19 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -105,7 +105,7 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool { Window* pControlParent = mbModal ? pParent : this; - mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); + // mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) ); mxControls[CT_TABLE_STYLES].reset( pValueSet ); @@ -122,7 +122,7 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool } pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl)); - mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); + // mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); sal_uInt16 i; for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) { @@ -132,7 +132,14 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool } for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ ) - mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); + { + if (mxControls[i]) + mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); + else if (i > 0) + mnOrgOffsetY[i] = mnOrgOffsetY[i-1]; + else + mnOrgOffsetY[i] = 0; + } // get current controller and initialize listeners try @@ -180,6 +187,60 @@ void TableDesignPane::Resize() updateLayout(); } + + + +LayoutSize TableDesignPane::GetHeightForWidth (const sal_Int32 nWidth) +{ + if ( ! IsVisible() || nWidth<=0) + return LayoutSize(0,0,0); + + // Initialize the height with the offset above and below the value + // set and below the check boxes. + const Point aOffset (LogicToPixel( Point(3,3), MAP_APPFONT)); + sal_Int32 nHeight (3 * aOffset.Y()); + + // Add the height for the check boxes. + nHeight += mnOrgOffsetY[CB_BANDED_COLUMNS] - mnOrgOffsetY[CB_HEADER_ROW] + + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height(); + + // Setup minimal and maximal heights that include all check boxes + // and a small or large value set. + const sal_Int32 nMinimalHeight (nHeight+100); + const sal_Int32 nMaximalHeight (nHeight+450); + + // Calculate the number of rows and columns and then add the + // preferred size of the value set. + ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() ); + if (pValueSet->GetItemCount() > 0) + { + Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0)); + Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel()); + aItemSize.Width() += 10; + aItemSize.Height() += 10; + + int nColumnCount = (pValueSet->GetSizePixel().Width() - pValueSet->GetScrollWidth()) / aItemSize.Width(); + if (nColumnCount < 1) + nColumnCount = 1; + + int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount; + if (nRowCount < 1) + nRowCount = 1; + + nHeight += nRowCount * aItemSize.Height(); + } + + // Clip the requested height. + if (nHeight<nMinimalHeight) + nHeight = nMinimalHeight; + else if (nHeight>nMaximalHeight) + nHeight = nMaximalHeight; + return LayoutSize(nMinimalHeight, nMaximalHeight, nHeight); +} + + + + // -------------------------------------------------------------------- static SfxBindings* getBindings( ViewShellBase& rBase ) @@ -378,16 +439,19 @@ void TableDesignPane::updateLayout() const long nStylesHeight = aPaneSize.Height() - nOptionsHeight; - // set with of controls to size of pane + // set width of controls to size of pane for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId ) { - Size aSize( mxControls[nId]->GetSizePixel() ); - aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); - mxControls[nId]->SetSizePixel( aSize ); - mxControls[nId]->SetPaintTransparent(sal_True); - mxControls[nId]->SetBackground(); + if (mxControls[nId]) + { + Size aSize( mxControls[nId]->GetSizePixel() ); + aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); + mxControls[nId]->SetSizePixel( aSize ); + mxControls[nId]->SetPaintTransparent(sal_True); + mxControls[nId]->SetBackground(); + } } - aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] ); + aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight ); } else { @@ -449,18 +513,22 @@ void TableDesignPane::updateLayout() // shift show options section down const long nOptionsPos = aPos.Y() + aValueSetSize.Height(); - for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId ) + sal_Int32 nMaxY (0); + for( sal_Int32 nId = FL_STYLE_OPTIONS+1; nId <= CB_BANDED_COLUMNS; ++nId ) { - Point aCPos( mxControls[nId]->GetPosPixel() ); - aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); - aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; - mxControls[nId]->SetPosPixel( aCPos ); + if (mxControls[nId]) + { + Point aCPos( mxControls[nId]->GetPosPixel() ); + aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); + aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; + mxControls[nId]->SetPosPixel( aCPos ); + const sal_Int32 nBottom (aCPos.Y() + mxControls[nId]->GetSizePixel().Height()); + if (nBottom > nMaxY) + nMaxY = nBottom; + } } } } - - if( !mbModal ) - SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); } // -------------------------------------------------------------------- diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx index dc4c8c2f156d..02d674f0160f 100644 --- a/sd/source/ui/table/TableDesignPane.hxx +++ b/sd/source/ui/table/TableDesignPane.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/LayoutSize.hpp> #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/container/XIndexAccess.hpp> @@ -33,6 +34,7 @@ #include <vcl/fixed.hxx> #include <vcl/button.hxx> #include <svtools/valueset.hxx> +#include <sfx2/sidebar/ILayoutableWindow.hxx> #include <boost/scoped_ptr.hpp> @@ -49,7 +51,7 @@ class ViewShellBase; // -------------------------------------------------------------------- -class TableDesignPane : public Control +class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow { public: TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal ); @@ -61,6 +63,9 @@ public: // Control virtual void Resize(); + // ILayoutableWindow + virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); void ApplyOptions(); diff --git a/sd/source/ui/table/TableDesignPane.src b/sd/source/ui/table/TableDesignPane.src index 6e584d2ac59d..afae1bcd1418 100644 --- a/sd/source/ui/table/TableDesignPane.src +++ b/sd/source/ui/table/TableDesignPane.src @@ -30,7 +30,7 @@ Control DLG_TABLEDESIGNPANE DialogControl = TRUE; Border = FALSE; - Size = MAP_APPFONT( 264, 160 ); + Size = MAP_APPFONT( 264, 134 ); Text [ en-US ] = "Table Design"; FixedLine FL_STYLE_OPTIONS+1 @@ -43,7 +43,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_HEADER_ROW+1 { - Pos = MAP_APPFONT ( 146, 16 ) ; + Pos = MAP_APPFONT ( 146, 3 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Header Row" ; @@ -51,7 +51,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_TOTAL_ROW+1 { - Pos = MAP_APPFONT ( 146, 29 ) ; + Pos = MAP_APPFONT ( 146, 16 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Total Row" ; @@ -59,7 +59,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_BANDED_ROWS+1 { - Pos = MAP_APPFONT ( 146, 42 ) ; + Pos = MAP_APPFONT ( 146, 29 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Banded Rows" ; @@ -67,7 +67,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_FIRST_COLUMN+1 { - Pos = MAP_APPFONT ( 146, 55 ) ; + Pos = MAP_APPFONT ( 146, 42 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "First Column" ; @@ -75,7 +75,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_LAST_COLUMN+1 { - Pos = MAP_APPFONT ( 146, 68 ) ; + Pos = MAP_APPFONT ( 146, 55 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Last Column" ; @@ -83,7 +83,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_BANDED_COLUMNS+1 { - Pos = MAP_APPFONT ( 146, 82 ) ; + Pos = MAP_APPFONT ( 146, 68 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Banded Columns" ; @@ -99,7 +99,7 @@ Control DLG_TABLEDESIGNPANE Control CT_TABLE_STYLES+1 { - Pos = MAP_APPFONT ( 6, 14 ) ; + Pos = MAP_APPFONT ( 4, 3 ) ; Size = MAP_APPFONT( 120, 143 ); Border = TRUE ; TabStop = TRUE ; diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index b78238337678..69760a93d243 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -206,7 +206,7 @@ SfxViewShell* pViewShell = GetViewShell(); { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msTableDesignPanelURL); } diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 60f65856d889..022ef1e32a99 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -32,6 +32,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/msgpool.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <svl/itempool.hxx> #include <svx/svdomedia.hxx> @@ -104,6 +105,7 @@ TableObjectBar::TableObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView ) SetRepeatTarget( mpView ); SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR ); SetName( String( SdResId( RID_DRAW_TABLE_TOOLBOX ) ) ); + SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table)); } // ----------------------------------------------------------------------------- @@ -203,6 +205,8 @@ void TableObjectBar::Execute( SfxRequest& rReq ) pBindings->Invalidate( SID_FRAME_LINECOLOR ); pBindings->Invalidate( SID_ATTR_BORDER ); pBindings->Invalidate( SID_ATTR_FILL_STYLE ); + pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE ); + pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE ); pBindings->Invalidate( SID_TABLE_MERGE_CELLS ); pBindings->Invalidate( SID_TABLE_SPLIT_CELLS ); pBindings->Invalidate( SID_OPTIMIZE_TABLE ); diff --git a/sd/source/ui/toolpanel/ConstrainedIterator.cxx b/sd/source/ui/toolpanel/ConstrainedIterator.cxx deleted file mode 100644 index 1747a5ad4f50..000000000000 --- a/sd/source/ui/toolpanel/ConstrainedIterator.cxx +++ /dev/null @@ -1,263 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -// This is a definition file of a template class. It is therefore -// included by other files and thus has to be guarded against multiple -// inclusion. - -#ifndef SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX -#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_CXX - -namespace sd { namespace toolpanel { - - -template <class Container> -ConstrainedIterator<Container>::value_type& - ConstrainedIterator<Container>::operator* (void) -{ - return *maIterator; -} - - - - -template <class Container> -const ConstrainedIterator<Container>::value_type& - ConstrainedIterator<Container>::operator* (void) - const -{ - return *maIterator; -} - - - - -template <class Container> -ConstrainedIterator<Container>::value_type& - ConstrainedIterator<Container>::operator-> (void) -{ - return *maIterator; -} - - - - -template <class Container> -const ConstrainedIterator<Container>::value_type& - ConstrainedIterator<Container>::operator-> (void) - const -{ - return *maIterator; -} - - - - - -template <class Container> -ConstrainedIterator<Container> - ::ConstrainedIterator (void) - : mpContainer (NULL) -{ -} - - - - -template <class Container> -ConstrainedIterator<Container>::ConstrainedIterator ( - const Container& rContainer, - const Container::iterator& rIterator) - : mpContainer(&rContainer), - maIterator (rIterator), - mpConstraint (NULL) -{ - AdvanceToNextValidElement(); -} - - - - -template <class Container> -ConstrainedIterator<Container>::ConstrainedIterator ( - const Container& rContainer, - const Container::iterator& rIterator, - const Constraint<Container>& rConstraint) - : mpContainer(&rContainer), - maIterator (rIterator), - mpConstraint (&rConstraint) -{ - AdvanceToNextValidElement(); -} - - - - -template <class Container> -ConstrainedIterator<Container>::ConstrainedIterator ( - const ConstrainedIterator& rIterator) - : mpContainer (rIterator.mpContainer), - maIterator (rIterator.maIterator), - mpConstraint (rIterator.mpConstraint) -{ - // Everything has been done in the initializer -} - - - - -template <class Container> -ConstrainedIterator<Container>& - ConstrainedIterator<Container> - ::operator= (const ConstrainedIterator& rIterator) -{ - mpContainer = rIterator.mpContainer; - maIterator = rIterator.maIterator; - mpConstraint = rIterator.mpConstraint; - - AdvanceToNextValidElement(); - - return *this; -} - - - - -template <class Container> -bool ConstrainedIterator<Container>::operator== ( - const ConstrainedIterator& aIterator) const -{ - return ! operator!=(aIterator); -} - - - - -template <class Container> -bool ConstrainedIterator<Container>::operator!= ( - const ConstrainedIterator& aIterator) const -{ - return maIterator != aIterator.maIterator; -} - - - - -template <class Container> -ConstrainedIterator<Container>& - ConstrainedIterator<Container>::operator++ (void) -{ - maIterator++; - AdvanceToNextValidElement(); - return *this; -} - - - - -template <class Container> -ConstrainedIterator<Container> - ConstrainedIterator<Container>::operator++ (int) -{ - ConstrainedIterator aIterator (*this); - ++(*this); - return aIterator; -} - - - - -template <class Container> -ConstrainedIterator<Container>& - ConstrainedIterator<Container>::operator-- (void) -{ - maIterator--; - AdvanceToPreviousValidElement(); - return *this; -} - - - - -template <class Container> -ConstrainedIterator<Container> - ConstrainedIterator<Container>::operator-- (int) -{ - ConstrainedIterator aIterator (*this); - --(*this); - return aIterator; -} - - - - -template <class Container> -ConstrainedIterator<Container> - ConstrainedIterator<Container>::operator+ (int nValue) const -{ - return ConstrainedIterator (*mpContainer, maIterator+nValue); -} - - - -template <class Container> -ConstrainedIterator<Container> - ConstrainedIterator<Container>::operator- (int nValue) const -{ - return ConstrainedIterator (*mpContainer, maIterator-nValue); -} - - - -template <class Container> -void ConstrainedIterator<Container>::AdvanceToNextValidElement (void) -{ - if (mpContainer!=NULL && mpConstraint!=NULL) - { - while (maIterator != mpContainer->end() - && ! mpConstraint->operator()(*mpContainer, maIterator)) - ++maIterator; - } -} - - - - -template <class Container> -void ConstrainedIterator<Container>::AdvanceToPreviousValidElement (void) -{ - if (mpContainer!=NULL && mpConstraint!=NULL) - { - while (maIterator != mpContainer->begin() - && ! mpConstraint->operator()(*mpContainer, maIterator)) - --maIterator; - } -} - - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/ConstrainedIterator.hxx b/sd/source/ui/toolpanel/ConstrainedIterator.hxx deleted file mode 100644 index d40f0fc5319a..000000000000 --- a/sd/source/ui/toolpanel/ConstrainedIterator.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX -#define SD_TOOLPANEL_CONSTRAINED_ITERATOR_HXX - -#include <iterator> - -namespace sd { namespace toolpanel { - - -template <class Container> -class Constraint -{ -public: - virtual bool operator() ( - const Container& rContainer, - const Container::iterator& rIterator) const = 0; -}; - - - - -/** This iterator is a bidirectional iterator with something of random - access thrown in. It uses a constraint object to jump over - elements in the underlying container that do not meet the - constraint. -*/ -template <class Container> -class ConstrainedIterator - : public ::std::bidirectional_iterator_tag -{ -public: - typedef Container::value_type value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - - ConstrainedIterator (void); - ConstrainedIterator ( - const Container& rContainer, - const Container::iterator& rIterator); - ConstrainedIterator ( - const Container& rContainer, - const Container::iterator& rIterator, - const Constraint<Container>& pConstraint); - ConstrainedIterator ( - const ConstrainedIterator& rIterator); - - ConstrainedIterator& operator= ( - const ConstrainedIterator& aIterator); - - reference operator* (void); - const_reference operator* (void) const; - reference operator-> (void); - const_reference operator-> (void) const; - - bool operator== (const ConstrainedIterator& aIterator) const; - bool operator!= (const ConstrainedIterator& aIterator) const; - - ConstrainedIterator& operator++ (void); - ConstrainedIterator operator++ (int); - ConstrainedIterator& operator-- (void); - ConstrainedIterator operator-- (int); - - ConstrainedIterator operator+ (int nValue) const; - ConstrainedIterator operator- (int nValue) const; - - -private: - const Container* mpContainer; - Container::iterator maIterator; - const Constraint<Container>* mpConstraint; - - void AdvanceToNextValidElement (void); - void AdvanceToPreviousValidElement (void); -}; - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/ControlContainer.cxx b/sd/source/ui/toolpanel/ControlContainer.cxx deleted file mode 100644 index 21ab98868708..000000000000 --- a/sd/source/ui/toolpanel/ControlContainer.cxx +++ /dev/null @@ -1,441 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/ControlContainer.hxx" - -#include "taskpane/TaskPaneTreeNode.hxx" - -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> - -namespace sd { namespace toolpanel { - - -ControlContainer::ControlContainer (TreeNode* pNode) - : mpNode(pNode), - mnActiveControlIndex((sal_uInt32)-1), - mbMultiSelection(false) -{ -} - - - - -ControlContainer::~ControlContainer (void) -{ - // Set mpNode to NULL so that no one calls it from now on. - mpNode = NULL; - DeleteChildren(); -} - - - - -void ControlContainer::DeleteChildren (void) -{ - // Deleting the children may lead to calls back to the container. To - // prevent the container from accessing the just deleted children, the - // maControlList member is first cleared (by transferring its content to - // a local list) before the children are destroyed. - ControlList maList; - maList.swap(maControlList); - ControlList::iterator I; - ControlList::iterator Iend (maList.end()); - for (I=maList.begin(); I!=Iend; ++I) - delete *I; - - if (mpNode != NULL) - mpNode->FireStateChangeEvent(EID_ALL_CHILDREN_REMOVED); -} - - - -sal_uInt32 ControlContainer::AddControl (::std::auto_ptr<TreeNode> pControl) -{ - ::osl::MutexGuard aGuard (maMutex); - - pControl->GetWindow()->Show(); - sal_uInt32 nIndex = maControlList.size(); - maControlList.push_back (pControl.get()); - pControl.release(); - - ListHasChanged (); - - if (mpNode != NULL) - mpNode->FireStateChangeEvent(EID_CHILD_ADDED, pControl.get()); - - return nIndex; -} - - - - -void ControlContainer::SetExpansionState ( - sal_uInt32 nIndex, - ExpansionState aState) -{ - ::osl::MutexGuard aGuard (maMutex); - - bool bResizeNecessary (false); - - if (mbMultiSelection) - { - TreeNode* pControl = GetControl(nIndex); - switch (aState) - { - case ES_TOGGLE: - bResizeNecessary = pControl->Expand( ! pControl->IsExpanded()); - break; - - case ES_EXPAND: - bResizeNecessary = pControl->Expand(true); - break; - - case ES_COLLAPSE: - bResizeNecessary = pControl->Expand(false); - break; - } - } - else - { - // When bExpansionState is true then the control to expand is the - // one with the given index. If bExpansionState is false and the - // given index points to the active control then then following - // control (in cyclic order) it is expanded. When there is only one - // control then that is always expanded. - do - { - // Ignore a call with an invalid index. (The seperate comparison - // with -1 is not strictly necessary but it is here just in - // case.) - if (nIndex>=GetControlCount() || nIndex==(sal_uInt32)-1) - break; - - bool bExpand; - switch (aState) - { - default: - case ES_TOGGLE: - bExpand = ! GetControl(nIndex)->IsExpanded(); - break; - - case ES_EXPAND: - bExpand = true; - break; - - case ES_COLLAPSE: - bExpand = false; - break; - } - if (bExpand) - { - // Make the specified control the active one and expand it. - mnActiveControlIndex = nIndex; - } - else - { - if (nIndex == mnActiveControlIndex) - { - // We have to determine a new active control since the - // current one is about to be collapsed. Choose the - // previous one for the last and the next one for all - // other. - if (mnActiveControlIndex+1 == GetControlCount()) - mnActiveControlIndex - = GetPreviousIndex(mnActiveControlIndex); - else - mnActiveControlIndex - = GetNextIndex (mnActiveControlIndex); - } - } - - // Update the expansion state of all controls. - for (sal_uInt32 i=0; i<GetControlCount(); i=GetNextIndex(i)) - { - TreeNode* pControl = GetControl(i); - bResizeNecessary |= pControl->Expand(i == mnActiveControlIndex); - } - } - while (false); - } - - if (bResizeNecessary && mpNode != NULL) - mpNode->RequestResize(); -} - - - - -void ControlContainer::SetExpansionState ( - TreeNode* pControl, - ExpansionState aState) -{ - SetExpansionState (GetControlIndex(pControl), aState); -} - - - - -sal_uInt32 ControlContainer::GetControlIndex (TreeNode* pControlToExpand) const -{ - sal_uInt32 nIndex; - for (nIndex=0; nIndex<GetControlCount(); nIndex++) - { - TreeNode* pControl = GetControl(nIndex); - if (pControl == pControlToExpand) - break; - } - return nIndex; -} - - - - -void ControlContainer::ListHasChanged (void) -{ -} - - - - -sal_uInt32 ControlContainer::GetControlCount (void) const -{ - return maControlList.size(); -} - - - - -sal_uInt32 ControlContainer::GetVisibleControlCount (void) const -{ - sal_uInt32 nCount (0); - - sal_uInt32 nIndex; - sal_uInt32 nAllCount (maControlList.size()); - for (nIndex=0; nIndex<nAllCount; nIndex=GetNextIndex(nIndex,true)) - { - if (maControlList[nIndex]->GetWindow()->IsVisible()) - nCount += 1; - } - - return nCount; -} - - - - -TreeNode* ControlContainer::GetControl (sal_uInt32 nIndex) const -{ - if (nIndex<maControlList.size() && nIndex!=(sal_uInt32)-1) - return maControlList[nIndex]; - else - return NULL; -} - - - - -sal_uInt32 ControlContainer::GetPreviousIndex ( - sal_uInt32 nIndex, - bool bIncludeHidden, - bool bCycle) const -{ - sal_uInt32 nCandidate (nIndex); - - while (true) - { - if (nCandidate==0) - if ( ! bCycle) - { - // We have reached the head of the list of controls and must - // not cycle to its end. - nCandidate = maControlList.size(); - break; - } - else - { - // Cycle to the end of the list. - nCandidate = maControlList.size() - 1; - } - else - // Go to the regular predecessor. - nCandidate -= 1; - - if (nCandidate == nIndex) - { - // Made one full loop and found no valid control. - nCandidate = maControlList.size(); - break; - } - else if (bIncludeHidden) - { - // Return the candidate index regardless of whether the control - // is hidden or not. - break; - } - else if (maControlList[nCandidate]->GetWindow()->IsVisible()) - { - // Found a visible control. - break; - } - - // The candidate does not meet our constraints so do one more loop. - } - - return nCandidate; -} - - - -sal_uInt32 ControlContainer::GetNextIndex ( - sal_uInt32 nIndex, - bool bIncludeHidden, - bool bCycle) const -{ - sal_uInt32 nCandidate (nIndex); - - while (true) - { - // Go to the regular successor. - nCandidate += 1; - if (nCandidate==maControlList.size()) - { - if ( ! bCycle) - { - // We have reached the end of the list of controls and must - // not cycle to its head. - break; - } - else - { - // Cycle to the head of the list. - nCandidate = 0; - } - } - - if (nCandidate == nIndex) - { - // Made one full loop and found no valid control. - nCandidate = maControlList.size(); - break; - } - else if (bIncludeHidden) - { - // Return the candidate index regardless of whether the control - // is hidden or not. - break; - } - else if (maControlList[nCandidate]->GetWindow()->IsVisible()) - { - // Found a visible control. - break; - } - - // The candidate does not meet our constraints so do one more loop. - } - - return nCandidate; -} - - - - -void ControlContainer::SetMultiSelection (bool bFlag) -{ - mbMultiSelection = bFlag; -} - - - - -void ControlContainer::SetVisibilityState ( - sal_uInt32 nControlIndex, - VisibilityState aState) -{ - TreeNode* pControl = GetControl (nControlIndex); - if (pControl != NULL) - { - bool bShow; - switch (aState) - { - default: - case VS_TOGGLE: - bShow = ! pControl->IsShowing(); - break; - case VS_SHOW: - bShow = true; - break; - case VS_HIDE: - bShow = false; - break; - } - - bool bControlWasExpanded = pControl->IsExpanded(); - if (bShow != pControl->IsShowing()) - { - pControl->Show (bShow); - - if (bShow) - { - // If we just turned on the first control then expand it, too. - // If we turned on another control collapse it. - if (GetVisibleControlCount() == 1) - SetExpansionState (nControlIndex, ES_EXPAND); - else - SetExpansionState (nControlIndex, ES_COLLAPSE); - } - else - { - if (GetVisibleControlCount() > 0) - { - if (bControlWasExpanded) - { - // We turned off an expanded control. Make sure that - // one of the still visible ones is expanded. - sal_uInt32 nIndex = GetNextIndex( - nControlIndex, - false, - false); - if (nIndex == GetControlCount()) - nIndex = GetPreviousIndex( - nControlIndex, - false, - false); - SetExpansionState (nIndex, ES_EXPAND); - } - } - } - - if (mpNode != NULL) - mpNode->RequestResize(); - } - } -} - - - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx b/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx deleted file mode 100644 index afdf0799ed64..000000000000 --- a/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX -#define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX - -#include "taskpane/ILayoutableWindow.hxx" -#include "taskpane/TitleBar.hxx" -#include <tools/string.hxx> -#include <tools/gen.hxx> -#ifndef SD_WINDOW_HXX -#include <vcl/window.hxx> -#endif -#include <memory> - -class Window; - -namespace sd { namespace toolpanel { - -class ControlContainer; - -/** Collection of information the describes entries of the tool - panel. A descriptor owns the control it is associated with. -*/ -class ControlContainerDescriptor - : public ::Window, - public virtual ILayoutableWindow -{ -public: - /** Create a new descriptor for the given control. - @param rContainer - The container to inform about selection (caused by mouse - clicks or keyboard.) - @param pParent - The parent window of the new descriptor. - @param pControl - The control that is shown when being in the expanded - state. - @param rTitle - String that is shown as title in the title area above the - control. - @param eType - Type of the title bar. This specifies how the title bar - will be formated. For more information see TitleBar. - - */ - ControlContainerDescriptor ( - ControlContainer& rContainer, - ::Window* pParent, - ::std::auto_ptr<ILayoutableWindow> pControl, - const String& rTitle, - TitleBar::TitleBarType eType); - - virtual ~ControlContainerDescriptor (void); - - - virtual Size GetPreferredSize (void); - virtual int GetPreferredWidth (int nHeight); - virtual int GetPreferredHeight (int nWidth); - virtual bool IsResizable (void); - virtual ::Window* GetWindow (void); - - virtual void Resize (void); - virtual void GetFocus (void); - virtual void LoseFocus (void); - virtual void MouseButtonUp (const MouseEvent& rMouseEvent); - virtual void KeyInput (const KeyEvent& rEvent); - - void Select (bool bExpansionState); - - // const Rectangle& GetTitleBarBox (void) const; - - Window* GetControl (void) const; - const String& GetTitle (void) const; - - void Expand (bool bExpanded = true); - void Collapse (void); - bool IsExpanded (void) const; - - /** Ownership of the given data remains with the caller. The data - is thus not destroyed when the destructor of this class is - called. - */ - void SetUserData (void* pUserData); - void* GetUserData (void) const; - - bool IsVisible (void) const; - void SetVisible (bool bVisible); - - using Window::GetWindow; - using sd::toolpanel::ILayoutableWindow::GetPreferredWidth; - using sd::toolpanel::ILayoutableWindow::GetPreferredHeight; - -private: - ControlContainer& mrContainer; - ::std::auto_ptr<TitleBar> mpTitleBar; - ::std::auto_ptr<ILayoutableWindow> mpControl; - String msTitle; - bool mbExpanded; - bool mbVisible; - void* mpUserData; - bool mnVisible; - - /// Do not use! Assignment operator is not supported. - const ControlContainerDescriptor& operator= ( - const ControlContainerDescriptor& aDescriptor); - - void UpdateStates (void); - - DECL_LINK(WindowEventListener, VclSimpleEvent*); -}; - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/MethodGuard.hxx b/sd/source/ui/toolpanel/MethodGuard.hxx deleted file mode 100644 index eb43204daa0d..000000000000 --- a/sd/source/ui/toolpanel/MethodGuard.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_METHODGUARD_HXX -#define SD_METHODGUARD_HXX - -#include <osl/mutex.hxx> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - //================================================================================================================== - //= MethodGuard - //================================================================================================================== - template < class COMPONENT > - class MethodGuard - { - public: - MethodGuard( COMPONENT& i_rComponent ) - :m_aGuard( i_rComponent.getMutex() ) - { - i_rComponent.checkDisposed(); - } - - ~MethodGuard() - { - } - - inline void clear() - { - m_aGuard.clear(); - } - - private: - ::osl::ClearableMutexGuard m_aGuard; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_METHODGUARD_HXX diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx deleted file mode 100644 index c32d8bb21df0..000000000000 --- a/sd/source/ui/toolpanel/ScrollPanel.cxx +++ /dev/null @@ -1,811 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/ScrollPanel.hxx" - -#include "taskpane/ControlContainer.hxx" -#include "TaskPaneFocusManager.hxx" -#include "taskpane/TitledControl.hxx" -#include "AccessibleScrollPanel.hxx" - -#include <vcl/svapp.hxx> -#include <svtools/valueset.hxx> - -namespace sd { namespace toolpanel { - -ScrollPanel::ScrollPanel ( - ::Window& i_rParentWindow) - : Control (&i_rParentWindow, WB_DIALOGCONTROL), - TreeNode(NULL), - maScrollWindow(this, WB_DIALOGCONTROL), - maVerticalScrollBar(this, WB_VERT), - maHorizontalScrollBar(this, WB_HORZ), - maScrollBarFiller(this), - maScrollWindowFiller(&maScrollWindow), - mbIsRearrangePending(true), - mbIsLayoutPending(true), - mnChildrenWidth(0), - mnVerticalBorder(2), - mnVerticalGap(3), - mnHorizontalBorder(2) -{ - Construct(); -} - -void ScrollPanel::Construct() -{ - SetAccessibleName ( - ::rtl::OUString::createFromAscii("Sub Task Panel")); - mpControlContainer->SetMultiSelection (true); - - SetBorderStyle (WINDOW_BORDER_NORMAL); - SetMapMode (MapMode(MAP_PIXEL)); - - // To reduce flickering during repaints make the container windows - // transparent and rely on their children to paint the whole area. - SetBackground(Wallpaper()); - maScrollWindow.SetBackground(Wallpaper()); - maScrollWindowFiller.SetBackground( - Application::GetSettings().GetStyleSettings().GetWindowColor()); - - maScrollWindow.Show(); - - // Initialize the scroll bars. - maVerticalScrollBar.SetScrollHdl ( - LINK(this, ScrollPanel, ScrollBarHandler)); - maVerticalScrollBar.EnableDrag (sal_True); - maHorizontalScrollBar.SetScrollHdl ( - LINK(this, ScrollPanel, ScrollBarHandler)); - maHorizontalScrollBar.EnableDrag (sal_True); -} - - - - -ScrollPanel::~ScrollPanel (void) -{ - sal_uInt32 nCount = mpControlContainer->GetControlCount(); - for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pNode = mpControlContainer->GetControl(nIndex); - TreeNode* pControl = pNode; - // When the node has been created as TitledControl then use its - // control instead of pNode directly. - TitledControl* pTitledControl = static_cast<TitledControl*>(pNode); - if (pTitledControl != NULL) - pControl = pTitledControl->GetControl(); - - // Remove this object as listener from the control. - if (pControl != NULL && pControl->GetWindow()!=NULL) - { - pControl->GetWindow()->RemoveEventListener( - LINK(this,ScrollPanel,WindowEventListener)); - } - } - mpControlContainer->DeleteChildren(); -} - - - - -TitledControl* ScrollPanel::AddControl ( - ::std::auto_ptr<TreeNode> pControl, - const String& rTitle, - const rtl::OString& rHelpId) -{ - // We are interested only in the title. The control itself is - // managed by the content object. - TitledControl* pTitledControl = new TitledControl( - this, - pControl, - rTitle, - TitledControlStandardClickHandler(GetControlContainer(), ControlContainer::ES_TOGGLE), - TitleBar::TBT_SUB_CONTROL_HEADLINE); - pTitledControl->GetTitleBar()->SetHelpId(rHelpId); - - AddControl(::std::auto_ptr<TreeNode>(pTitledControl)); - - return pTitledControl; -} - - - - -void ScrollPanel::AddControl (::std::auto_ptr<TreeNode> pControl) -{ - if (pControl.get() != NULL) - { - // Add a window event listener which does two things: - // 1. Listen for controls being shown or hidden so that the layout - // can be adapted. - // 2. Track selection changes in order to make the selected elements - // visible. - const Link aWindowListener(LINK(this,ScrollPanel,WindowEventListener)); - OSL_ASSERT(pControl->GetWindow()!=NULL); - pControl->GetWindow()->AddEventListener(aWindowListener); - - TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pControl.get()); - if (pTitledControl != NULL) - { - OSL_ASSERT(pTitledControl->GetControl()!=NULL); - OSL_ASSERT(pTitledControl->GetControl()->GetWindow()!=NULL); - pTitledControl->GetControl()->GetWindow()->AddEventListener(aWindowListener); - } - - FocusManager& rFocusManager (FocusManager::Instance()); - int nControlCount (mpControlContainer->GetControlCount()); - // Replace the old links for cycling between first and last child by - // current ones. - if (nControlCount > 0) - { - ::Window* pFirst = mpControlContainer->GetControl(0)->GetWindow(); - ::Window* pLast = mpControlContainer->GetControl(nControlCount-1)->GetWindow(); - rFocusManager.RemoveLinks(pFirst,pLast); - rFocusManager.RemoveLinks(pLast,pFirst); - - rFocusManager.RegisterLink(pFirst,pControl->GetWindow(), KEY_UP); - rFocusManager.RegisterLink(pControl->GetWindow(),pFirst, KEY_DOWN); - } - - - // Add a down link only for the first control so that when entering - // the sub tool panel the focus is set to the first control. - if (nControlCount == 0) - rFocusManager.RegisterDownLink(GetParent(), pControl->GetWindow()); - rFocusManager.RegisterUpLink(pControl->GetWindow(), GetParent()); - - pControl->GetWindow()->SetParent(&maScrollWindow); - mpControlContainer->AddControl (pControl); - mpControlContainer->SetExpansionState( - mpControlContainer->GetControlCount()-1, - ControlContainer::ES_EXPAND); - } -} - - - - -void ScrollPanel::Paint (const Rectangle& rRect) -{ - if (mbIsRearrangePending) - Rearrange(); - if (mbIsLayoutPending) - LayoutChildren(); - ::Window::Paint (rRect); - - // Paint the outer border and the space between every two children. - Color aOriginalLineColor (maScrollWindow.GetLineColor()); - Color aOriginalFillColor (maScrollWindow.GetFillColor()); - - maScrollWindow.SetLineColor (); - maScrollWindow.SetFillColor ( - GetSettings().GetStyleSettings().GetWindowColor()); - - Size aSize (maScrollWindow.GetOutputSizePixel()); - // Paint left and right vertical border. - Rectangle aVerticalArea ( - Point(0,0), - Size(mnHorizontalBorder,aSize.Height())); - maScrollWindow.DrawRect (aVerticalArea); - aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1; - aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder; - maScrollWindow.DrawRect (aVerticalArea); - - // Paint horizontal stripes. - Rectangle aStripeArea ( - Point (mnHorizontalBorder,0), - Size(mnChildrenWidth,0)); - StripeList::const_iterator iStripe; - for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); iStripe++) - { - aStripeArea.Top() = iStripe->first; - aStripeArea.Bottom() = iStripe->second; - if (aStripeArea.Bottom() < 0) - continue; - if (aStripeArea.Top() >= aSize.Height()) - break; - maScrollWindow.DrawRect (aStripeArea); - } - - maScrollWindow.SetLineColor (aOriginalLineColor); - maScrollWindow.SetFillColor (aOriginalFillColor); -} - - - - -void ScrollPanel::Resize (void) -{ - ::Window::Resize(); - mbIsRearrangePending = true; - mbIsLayoutPending = true; -} - - - - -void ScrollPanel::RequestResize (void) -{ - mbIsRearrangePending = true; - mbIsLayoutPending = true; - Invalidate(); -} - - - - -Size ScrollPanel::GetPreferredSize (void) -{ - return GetRequiredSize(); -} - - - - -sal_Int32 ScrollPanel::GetPreferredWidth (sal_Int32 ) -{ - return GetPreferredSize().Width(); -} - - - - -sal_Int32 ScrollPanel::GetPreferredHeight (sal_Int32 ) -{ - return GetPreferredSize().Height(); -} - - - - -bool ScrollPanel::IsResizable (void) -{ - return true; -} - - - - -::Window* ScrollPanel::GetWindow (void) -{ - return this; -} - - - - -sal_Int32 ScrollPanel::GetMinimumWidth (void) -{ - return TreeNode::GetMinimumWidth(); -} - - - - -void ScrollPanel::ExpandControl ( - TreeNode* pControl, - bool bExpansionState) -{ - // Toggle expand status. - pControl->Expand (bExpansionState); - - Rearrange (); - Invalidate (); -} - - - - -bool ScrollPanel::IsVerticalScrollBarVisible (void) const -{ - return maVerticalScrollBar.IsReallyVisible(); -} - - - - -bool ScrollPanel::IsHorizontalScrollBarVisible (void) const -{ - return maHorizontalScrollBar.IsReallyVisible(); -} - - - - -ScrollBar& ScrollPanel::GetVerticalScrollBar (void) -{ - return maVerticalScrollBar; -} - - - - -ScrollBar& ScrollPanel::GetHorizontalScrollBar (void) -{ - return maHorizontalScrollBar; -} - - - - -/** This control shows an expansion bar for every control and in a - separate area below that expansion area it shows all controls each - with its title bar. When there is not enough space then show a - scroll bar in the control area. -*/ -void ScrollPanel::Rearrange (void) -{ - Size aRequiredSize (GetRequiredSize()); - if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0) - { - Size aAvailableSize (SetupScrollBars (aRequiredSize)); - maScrollWindow.SetPosSizePixel( - Point(0,0), - aAvailableSize); - - // Make the children at least as wide as the sub tool panel. - if (aRequiredSize.Width() < aAvailableSize.Width()) - aRequiredSize.Width() = aAvailableSize.Width(); - mnChildrenWidth = -2*mnHorizontalBorder; - if (maHorizontalScrollBar.IsVisible()) - mnChildrenWidth += aRequiredSize.Width(); - else - mnChildrenWidth += aAvailableSize.Width(); - - sal_Int32 nChildrenHeight (LayoutChildren()); - maVerticalScrollBar.SetRangeMax ( - nChildrenHeight + mnVerticalBorder); - - mbIsRearrangePending = false; - } -} - - - - -Size ScrollPanel::GetRequiredSize (void) -{ - // First determine the width of the children. This is the maximum of - // the current window width and the individual minimum widths of the - // children. - int nChildrenWidth (GetSizePixel().Width()); - unsigned int nCount = mpControlContainer->GetControlCount(); - unsigned int nIndex; - for (nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - int nMinimumWidth (pChild->GetMinimumWidth()); - if (nMinimumWidth > nChildrenWidth) - nChildrenWidth = nMinimumWidth; - } - - // Determine the accumulated width of all children when scaled to the - // minimum width. - nChildrenWidth -= 2*mnHorizontalBorder; - Size aTotalSize (nChildrenWidth, - 2*mnVerticalBorder + (nCount-1) * mnVerticalGap); - for (nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth); - aTotalSize.Height() += nHeight; - } - - return aTotalSize; -} - - - - -sal_Int32 ScrollPanel::LayoutChildren (void) -{ - maStripeList.clear(); - - Point aPosition (maScrollOffset); - aPosition.X() += mnHorizontalBorder; - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - aPosition.Y() + mnVerticalBorder - 1)); - aPosition.Y() += mnVerticalBorder; - - // Place the controls one over the other. - unsigned int nCount (mpControlContainer->GetControlCount()); - for (unsigned int nIndex=0; nIndex<nCount; nIndex++) - { - if (nIndex > 0) - { - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - aPosition.Y() + mnVerticalGap - 1)); - aPosition.Y() += mnVerticalGap; - } - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth); - pChild->GetWindow()->SetPosSizePixel( - aPosition, - Size(mnChildrenWidth, nControlHeight)); - aPosition.Y() += nControlHeight; - } - - // If the children do not cover their parent window completely - // (regarding the height) we put a filler below that is responsible for - // painting the remaining space. - int nWindowHeight = maScrollWindow.GetSizePixel().Height(); - if (aPosition.Y() < nWindowHeight) - { - maScrollWindowFiller.SetPosSizePixel ( - aPosition, - Size(mnChildrenWidth, nWindowHeight-aPosition.Y())); - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - nWindowHeight-1)); - // maScrollWindowFiller.Show(); - aPosition.Y() = nWindowHeight; - } - else - maScrollWindowFiller.Hide(); - - aPosition.Y() += mnVerticalBorder; - mbIsLayoutPending = false; - - return aPosition.Y()-maScrollOffset.Y(); -} - - - - -Size ScrollPanel::SetupScrollBars (const Size& rRequiredSize) -{ - Size aWindowSize (GetSizePixel()); - Size aScrollBarSize ( - maVerticalScrollBar.GetSizePixel().Width(), - maHorizontalScrollBar.GetSizePixel().Height()); - Size aRemainingSize (aWindowSize); - - // Determine which scroll bars have to be shown. - bool bShowHorizontal = false; - if (rRequiredSize.Width() > aWindowSize.Width()) - bShowHorizontal = true; - bool bShowVertical = false; - if (rRequiredSize.Height() > aWindowSize.Height()) - bShowVertical = true; - // Showing one scroll bar may reduce the available size so that the - // other one has to be shown as well. - if (bShowHorizontal && ! bShowVertical) - { - if ((rRequiredSize.Height() + aScrollBarSize.Height()) - > aWindowSize.Height()) - bShowVertical = true; - } - else if (bShowVertical && ! bShowHorizontal) - { - if (GetMinimumWidth() + aScrollBarSize.Width() > aWindowSize.Width()) - bShowHorizontal = true; - } - - // Setup the scroll bars. - aRemainingSize.Width() - = SetupVerticalScrollBar (bShowVertical, rRequiredSize.Height()); - aRemainingSize.Height() - = SetupHorizontalScrollBar (bShowHorizontal, rRequiredSize.Width()); - - // Place the filler. - if (bShowHorizontal && bShowVertical) - { - maScrollBarFiller.SetPosSizePixel ( - Point(aWindowSize.Width(), aWindowSize.Height()), - aScrollBarSize); - maScrollBarFiller.Show(); - } - else - maScrollBarFiller.Hide(); - - - return aRemainingSize; -} - - - - -sal_Int32 ScrollPanel::SetupVerticalScrollBar (bool bShow, sal_Int32 nRange) -{ - Size aScrollBarSize ( - maVerticalScrollBar.GetSizePixel().Width(), - maHorizontalScrollBar.GetSizePixel().Height()); - Size aWindowSize (GetOutputSizePixel()); - sal_Int32 nRemainingWidth (aWindowSize.Width()); - - // Setup the verical scroll bar. - if (bShow) - { - int nWidth = aScrollBarSize.Width(); - int nHeight = aWindowSize.Height(); - maVerticalScrollBar.SetPosSizePixel( - Point(aWindowSize.Width()-nWidth,0), - Size(nWidth, nHeight)); - maVerticalScrollBar.Show(); - - // Set the scroll bar range and thumb size. - maVerticalScrollBar.SetRangeMin (0); - maVerticalScrollBar.SetRangeMax ( - nRange + 2*mnVerticalBorder); - maVerticalScrollBar.SetVisibleSize (aWindowSize.Height()); - // Make page size approx. 10% of visible area. - maVerticalScrollBar.SetLineSize (aWindowSize.Height()/10); - // Make page size approx. 100% of visible area. - maVerticalScrollBar.SetPageSize (aWindowSize.Height()); - // Make sure that thumb is inside the valid range. - maVerticalScrollBar.SetThumbPos(-maScrollOffset.Y()); - long nMinPos = maVerticalScrollBar.GetRangeMin(); - if (maVerticalScrollBar.GetThumbPos() < nMinPos) - maVerticalScrollBar.SetThumbPos(nMinPos); - long nMaxPos = maVerticalScrollBar.GetRangeMax() - - maVerticalScrollBar.GetVisibleSize(); - if (maVerticalScrollBar.GetThumbPos() >= nMaxPos) - maVerticalScrollBar.SetThumbPos(nMaxPos); - // Set offset to match thumb pos. - maScrollOffset.Y() = -maVerticalScrollBar.GetThumbPos(); - - nRemainingWidth -= aScrollBarSize.Width(); - } - else - { - maVerticalScrollBar.Hide(); - maScrollOffset.Y() = 0; - } - - return nRemainingWidth; -} - - - - -sal_Int32 ScrollPanel::SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange) -{ - Size aScrollBarSize ( - maVerticalScrollBar.GetSizePixel().Width(), - maHorizontalScrollBar.GetSizePixel().Height()); - Size aWindowSize (GetOutputSizePixel()); - sal_Int32 nRemainingHeight (aWindowSize.Height()); - - // Setup the horizontal scroll bar. - if (bShow) - { - int nHeight = aScrollBarSize.Height(); - int nWidth = GetOutputSizePixel().Width(); - maHorizontalScrollBar.SetPosSizePixel( - Point(0, aWindowSize.Height()-nHeight), - Size(nWidth,nHeight)); - maHorizontalScrollBar.Show(); - - // Set the scroll bar range and thumb size. - maHorizontalScrollBar.SetRangeMin (0); - maHorizontalScrollBar.SetRangeMax ( - nRange + 2*mnHorizontalBorder); - maHorizontalScrollBar.SetVisibleSize (aWindowSize.Width()); - // Make page size approx. 5% of visible area. - maHorizontalScrollBar.SetLineSize (aWindowSize.Width()/20+1); - // Make page size approx. 50% of visible area. - maHorizontalScrollBar.SetPageSize (aWindowSize.Width()/2+1); - // Make sure that thumb is inside the valid range. - maHorizontalScrollBar.SetThumbPos(-maScrollOffset.X()); - long nMinPos = maHorizontalScrollBar.GetRangeMin(); - if (maHorizontalScrollBar.GetThumbPos() < nMinPos) - maHorizontalScrollBar.SetThumbPos(nMinPos); - long nMaxPos = maHorizontalScrollBar.GetRangeMax() - - maHorizontalScrollBar.GetVisibleSize(); - if (maHorizontalScrollBar.GetThumbPos() >= nMaxPos) - maHorizontalScrollBar.SetThumbPos(nMaxPos); - // Set offset to match thumb pos. - maScrollOffset.X() = -maHorizontalScrollBar.GetThumbPos(); - - nRemainingHeight -= aScrollBarSize.Height(); - } - else - { - maHorizontalScrollBar.Hide(); - maScrollOffset.X() = 0; - } - - return nRemainingHeight; -} - - -IMPL_LINK(ScrollPanel, ScrollBarHandler, ScrollBar*, EMPTYARG) -{ - maScrollOffset.X() -= maHorizontalScrollBar.GetDelta(); - maScrollOffset.Y() -= maVerticalScrollBar.GetDelta(); - - // Scrolling is done by moving the child windows up or down. - mbIsLayoutPending = true; - Invalidate(); - // LayoutChildren(); - - return 0; -} - - - - -long ScrollPanel::Notify( NotifyEvent& rNEvt ) -{ - long nRet = sal_False; - if( rNEvt.GetType() == EVENT_COMMAND ) - { - // note: dynamic_cast is not possible as GetData() returns a void* - CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData()); - DBG_ASSERT( pCmdEvent!=0 && - ( pCmdEvent->IsMouseEvent() == sal_True || - pCmdEvent->IsMouseEvent() == sal_False ), - "Invalid CommandEvent" ); - if (pCmdEvent) - switch (pCmdEvent->GetCommand()) - { - case COMMAND_WHEEL: - case COMMAND_STARTAUTOSCROLL: - case COMMAND_AUTOSCROLL: - { - nRet = HandleScrollCommand (*pCmdEvent, &maHorizontalScrollBar, &maVerticalScrollBar); - break; - } - } - } - - if( ! nRet ) - nRet = ::Window::Notify( rNEvt ); - - return nRet; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> ScrollPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - return new ::accessibility::AccessibleScrollPanel ( - *this, - ::rtl::OUString::createFromAscii("Scroll Panel"), - ::rtl::OUString::createFromAscii("Scroll Panel")); -} - - - - -void ScrollPanel::MakeRectangleVisible ( - Rectangle& aRectangle, - ::Window* pWindow) -{ - if (maVerticalScrollBar.IsVisible() && aRectangle.GetWidth()>0 && aRectangle.GetHeight()>0) - { - const Rectangle aRelativeBox (pWindow->GetWindowExtentsRelative(&maScrollWindow)); - - aRectangle.Move( - -maScrollOffset.X() + aRelativeBox.Left(), - -maScrollOffset.Y() + aRelativeBox.Top()); - - const int nVisibleHeight (maVerticalScrollBar.GetVisibleSize()); - const int nVisibleTop (maVerticalScrollBar.GetThumbPos()); - if (aRectangle.Bottom() >= nVisibleTop+nVisibleHeight) - maVerticalScrollBar.DoScroll(aRectangle.Bottom() - nVisibleHeight); - else if (aRectangle.Top() < nVisibleTop) - maVerticalScrollBar.DoScroll(aRectangle.Top()); - } -} - - - - -IMPL_LINK(ScrollPanel,WindowEventListener,VclSimpleEvent*,pEvent) -{ - VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(pEvent); - if (pWindowEvent != NULL) - { - switch (pWindowEvent->GetId()) - { - case VCLEVENT_WINDOW_KEYUP: - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - // Make the currently selected item visible. - ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow()); - if (pControl != NULL) - { - // Get the bounding box of the currently selected item - // and enlarge this so that the selection frame is - // inside as well. - Rectangle aBox (pControl->GetItemRect(pControl->GetSelectItemId())); - aBox.Top()-=4; - aBox.Bottom()+=4; - - MakeRectangleVisible(aBox, pControl); - } - } - break; - - case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: - { - // Make the item under the mouse visible. We need this case - // for right clicks that open context menus. For these we - // only get the mouse down event. The following mouse up - // event is sent to the context menu. - ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow()); - if (pControl != NULL) - { - // Get the bounding box of the item at the mouse - // position and enlarge this so that the selection frame - // is inside as well. - MouseEvent* pMouseEvent - = reinterpret_cast<MouseEvent*>(pWindowEvent->GetData()); - if (pMouseEvent != NULL) - { - Point aPosition (pMouseEvent->GetPosPixel()); - Rectangle aBox (pControl->GetItemRect(pControl->GetItemId(aPosition))); - aBox.Top()-=4; - aBox.Bottom()+=4; - - MakeRectangleVisible(aBox, pControl); - } - } - } - break; - - - case VCLEVENT_WINDOW_GETFOCUS: - { - // Move title bars into the visible area when they get the - // focus (::Window wise their enclosing TitledControl gets - // the focus.) - TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pWindowEvent->GetWindow()); - if (pTitledControl!=NULL && pTitledControl->GetTitleBar()!=NULL) - { - ::Window* pTitleBarWindow = pTitledControl->GetTitleBar()->GetWindow(); - Rectangle aBox(pTitleBarWindow->GetPosPixel(),pTitleBarWindow->GetSizePixel()); - MakeRectangleVisible( - aBox, - pTitleBarWindow); - } - } - break; - - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - case VCLEVENT_WINDOW_ACTIVATE: - case VCLEVENT_WINDOW_RESIZE: - // Rearrange the children of the scroll panel when one of - // the children changes its size or visibility. - RequestResize(); - break; - } - } - return 0; -} - - - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx deleted file mode 100644 index 009a3e5a4094..000000000000 --- a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx +++ /dev/null @@ -1,368 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/SlideSorterCacheDisplay.hxx" - -#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY - -#include "taskpane/ScrollPanel.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" - -#include <vcl/window.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/button.hxx> - -namespace { - -static const Color maBackgroundColor (255,250,245); - -class PageCacheWindow : public ::Window -{ -public: - PageCacheWindow ( - ::Window* pParentWindow, - ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay) - : ::Window(pParentWindow), - mpDisplay(pDisplay) - { - SetBackground(Wallpaper(maBackgroundColor)); - } - - virtual void Paint (const Rectangle& rBoundingBox) - { mpDisplay->Paint(rBoundingBox); ::Window::Paint(rBoundingBox); } - virtual void Resize (void) { mpDisplay->Resize(); ::Window::Resize(); } - -private: - ::sd::toolpanel::SlideSorterCacheDisplay* mpDisplay; -}; - -} - - - -namespace sd { namespace toolpanel { - -::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> SlideSorterCacheDisplay::maDisplays; - -SlideSorterCacheDisplay::SlideSorterCacheDisplay (const SdDrawDocument* pDocument) - : TreeNode(NULL), - mpWindow(NULL), - mnPageCount(0), - mnColumnCount(0), - mnRowCount(0), - maCellSize(0,0), - mnHorizontalBorder(0), - mnVerticalBorder(0) -{ - SlideSorterCacheDisplay::AddInstance(pDocument,this); -} - - - - -SlideSorterCacheDisplay::~SlideSorterCacheDisplay (void) -{ - if (mpWindow != NULL) - delete mpWindow; - SlideSorterCacheDisplay::RemoveInstance(this); -} - - - - -void SlideSorterCacheDisplay::SetParentWindow (::Window* pParentWindow) -{ - mpWindow = new PageCacheWindow(pParentWindow, this); -} - - - - -void SlideSorterCacheDisplay::Paint (const Rectangle& rBoundingBox) -{ - if (maCellSize.Width()>0 && maCellSize.Height()>0 && mpWindow!=NULL) - { - Color maSavedFillColor (mpWindow->GetFillColor()); - Color maSavedLineColor (mpWindow->GetLineColor()); - sal_Int32 nC0 = (rBoundingBox.Left() - mnHorizontalBorder) / maCellSize.Width(); - sal_Int32 nC1 = (rBoundingBox.Right() - mnHorizontalBorder) / maCellSize.Width(); - sal_Int32 nR0 = (rBoundingBox.Top() - mnVerticalBorder) / maCellSize.Height(); - sal_Int32 nR1 = (rBoundingBox.Bottom() - mnVerticalBorder) / maCellSize.Height(); - for (sal_Int32 nC=nC0; nC<=nC1; ++nC) - for (sal_Int32 nR=nR0; nR<=nR1; ++nR) - { - sal_Int32 nPageIndex (nC + nR*mnColumnCount); - if (nPageIndex < mnPageCount) - { - Rectangle aBox (GetPageBox(nPageIndex)); - if ( ! maPageDescriptors[nPageIndex].mbVisible) - { - mpWindow->SetLineColor(); - mpWindow->SetFillColor(maBackgroundColor); - mpWindow->DrawRect(aBox); - - aBox.Left() += maCellSize.Width()/4; - aBox.Right() -= maCellSize.Width()/4; - aBox.Top() += maCellSize.Height()/4; - aBox.Bottom() -= maCellSize.Height()/4; - } - - switch (maPageDescriptors[nPageIndex].meStatus) - { - case NONE : mpWindow->SetFillColor (Color(95,255,128)); break; - case RENDERING : mpWindow->SetFillColor (Color(236,125,128)); break; - case IN_QUEUE_PRIORITY_0 : mpWindow->SetFillColor (Color(255,243,0)); break; - case IN_QUEUE_PRIORITY_1 : mpWindow->SetFillColor (Color(255,199,0)); break; - case IN_QUEUE_PRIORITY_2 : mpWindow->SetFillColor (Color(20,255,128)); break; - default : mpWindow->SetFillColor (COL_BLACK); break; - } - mpWindow->SetLineColor(COL_BLACK); - mpWindow->DrawRect(aBox); - - if ( ! maPageDescriptors[nPageIndex].mbUpToDate) - mpWindow->DrawLine(aBox.TopLeft(), aBox.BottomRight()); - } - } - mpWindow->SetLineColor(maSavedLineColor); - mpWindow->SetFillColor(maSavedFillColor); - } -} - - - - -void SlideSorterCacheDisplay::Resize (void) -{ - if (mpWindow != NULL) - { - double nW = mpWindow->GetSizePixel().Width(); - double nH = mpWindow->GetSizePixel().Height(); - if (nH > 0) - { - double nAspect = nW / nH; - sal_Int32 nR = 1; - sal_Int32 nC = 1; - while (nR * nC < mnPageCount) - { - if (double(nC) / double(nR) > nAspect) - ++nR; - else - ++nC; - } - double nAspect2 = double(nC) / double(nR); - - mnRowCount = nR; - mnColumnCount = nC; - mnHorizontalGap = 2; - mnVerticalGap = 2; - maCellSize = Size( - (int)((nW-(nC-1)*mnHorizontalGap) / nC), - (int)((nH-(nR-1)*mnVerticalGap) / nR)); - mnHorizontalBorder = (int)(nW - nC*maCellSize.Width() - ((nC-1)*mnHorizontalGap))/2; - mnVerticalBorder = (int)(nH - nR*maCellSize.Height() - ((nR-1)*mnVerticalGap))/2; - } - } -} - - - - -SlideSorterCacheDisplay* SlideSorterCacheDisplay::Instance (const SdDrawDocument* pDocument) -{ - SlideSorterCacheDisplay* pDisplay = NULL; - ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay; - for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay) - if (iDisplay->first == pDocument) - pDisplay = iDisplay->second; - - if (pDisplay == NULL) - { - pDisplay = new SlideSorterCacheDisplay(pDocument); - } - - return pDisplay; -} - - - - -void SlideSorterCacheDisplay::SetPageCount (sal_Int32 nPageCount) -{ - mnPageCount = nPageCount; - maPageDescriptors.resize(nPageCount); - Resize(); - if (mpWindow != NULL) - mpWindow->Invalidate(); -} - - - - -void SlideSorterCacheDisplay::SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus) -{ - ProvideSize(nPageIndex); - maPageDescriptors[nPageIndex].meStatus = eStatus; - PaintPage(nPageIndex); -} - - - - -void SlideSorterCacheDisplay::SetPageVisibility (sal_Int32 nPageIndex, bool bVisible) -{ - ProvideSize(nPageIndex); - maPageDescriptors[nPageIndex].mbVisible = bVisible; - PaintPage(nPageIndex); -} - - - - -void SlideSorterCacheDisplay::SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate) -{ - ProvideSize(nPageIndex); - maPageDescriptors[nPageIndex].mbUpToDate = bUpToDate; - PaintPage(nPageIndex); -} - - - - -Rectangle SlideSorterCacheDisplay::GetPageBox (sal_Int32 nPageIndex) -{ - sal_Int32 nRow = nPageIndex / mnColumnCount; - sal_Int32 nColumn = nPageIndex % mnColumnCount; - return Rectangle( - Point(mnHorizontalBorder + nColumn * maCellSize.Width() + nColumn*mnHorizontalGap, - mnVerticalBorder + nRow * maCellSize.Height() + nRow*mnVerticalGap), - maCellSize); -} - - - - -void SlideSorterCacheDisplay::AddInstance ( - const SdDrawDocument* pDocument, - SlideSorterCacheDisplay* pControl) -{ - maDisplays[pDocument] = pControl; -} - - - - -void SlideSorterCacheDisplay::RemoveInstance (SlideSorterCacheDisplay* pControl) -{ - ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay; - for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay) - if (iDisplay->second == pControl) - { - maDisplays.erase(iDisplay); - break; - } -} - - - - -void SlideSorterCacheDisplay::ProvideSize (sal_Int32 nPageIndex) -{ - if (maPageDescriptors.size() <= (sal_uInt32)nPageIndex) - maPageDescriptors.resize(nPageIndex+1); - if (mnPageCount <= nPageIndex) - mnPageCount = nPageIndex; -} - - - - -Size SlideSorterCacheDisplay::GetPreferredSize (void) -{ - return Size(100,100); -} - - - - -sal_Int32 SlideSorterCacheDisplay::GetPreferredWidth (sal_Int32 nHeigh) -{ - return GetPreferredSize().Width(); -} - - - - -sal_Int32 SlideSorterCacheDisplay::GetPreferredHeight (sal_Int32 nWidth) -{ - return GetPreferredSize().Height(); -} - - - -::Window* SlideSorterCacheDisplay::GetWindow (void) -{ - return mpWindow; -} - - - - -bool SlideSorterCacheDisplay::IsResizable (void) -{ - return true; -} - - - - -bool SlideSorterCacheDisplay::IsExpandable (void) const -{ - return true; -} - - - - -bool SlideSorterCacheDisplay::IsExpanded (void) const -{ - return true; -} - - - - -void SlideSorterCacheDisplay::PaintPage (sal_Int32 nPageIndex) -{ - if (mpWindow != NULL) - { - Paint(GetPageBox(nPageIndex)); - } -} - - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx deleted file mode 100644 index 18807152c2a0..000000000000 --- a/sd/source/ui/toolpanel/SubToolPanel.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/SubToolPanel.hxx" - -#include "TaskPaneFocusManager.hxx" -#include "taskpane/TitleBar.hxx" -#include "taskpane/TitledControl.hxx" -#include "taskpane/ControlContainer.hxx" -#include "AccessibleTreeNode.hxx" -#include <vcl/decoview.hxx> -#include <vcl/svapp.hxx> - -namespace sd { namespace toolpanel { - - -SubToolPanel::SubToolPanel ( - Window& i_rParentWindow) - : Control (&i_rParentWindow, WB_DIALOGCONTROL), - TreeNode(NULL), - maWindowFiller(this), - mbIsRearrangePending(true), - mbIsLayoutPending(true), - mnChildrenWidth(0), - mnVerticalBorder(0), - mnVerticalGap(3), - mnHorizontalBorder(2) -{ - SetAccessibleName ( - ::rtl::OUString::createFromAscii("Sub Task Panel")); - mpControlContainer->SetMultiSelection (true); - - SetBorderStyle (WINDOW_BORDER_NORMAL); - SetMapMode (MapMode(MAP_PIXEL)); - - // To reduce flickering during repaints make the container windows - // transparent and rely on their children to paint the whole area. - SetBackground(Wallpaper()); - maWindowFiller.SetBackground( - Application::GetSettings().GetStyleSettings().GetWindowColor()); -} - - - - -SubToolPanel::~SubToolPanel (void) -{ - sal_uInt32 nCount = mpControlContainer->GetControlCount(); - for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++) - { - TitledControl* pControl = static_cast<TitledControl*>( - mpControlContainer->GetControl(nIndex)); - pControl->GetControl()->GetWindow()->RemoveEventListener( - LINK(this,SubToolPanel,WindowEventListener)); - } - mpControlContainer->DeleteChildren(); -} - - - - -void SubToolPanel::Paint (const Rectangle& rRect) -{ - if (mbIsRearrangePending) - Rearrange(); - if (mbIsLayoutPending) - LayoutChildren(); - ::Window::Paint (rRect); - - // Paint the outer border and the space between every two children. - Color aOriginalLineColor (GetLineColor()); - Color aOriginalFillColor (GetFillColor()); - - SetLineColor (); - SetFillColor (GetSettings().GetStyleSettings().GetWindowColor()); - - Size aSize (GetOutputSizePixel()); - // Paint left and right vertical border. - Rectangle aVerticalArea ( - Point(0,0), - Size(mnHorizontalBorder,aSize.Height())); - DrawRect (aVerticalArea); - aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1; - aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder; - DrawRect (aVerticalArea); - - // Paint horizontal stripes. - Rectangle aStripeArea ( - Point (mnHorizontalBorder,0), - Size(mnChildrenWidth,0)); - StripeList::const_iterator iStripe; - for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); iStripe++) - { - aStripeArea.Top() = iStripe->first; - aStripeArea.Bottom() = iStripe->second; - if (aStripeArea.Bottom() < 0) - continue; - if (aStripeArea.Top() >= aSize.Height()) - break; - DrawRect (aStripeArea); - } - - SetLineColor (aOriginalLineColor); - SetFillColor (aOriginalFillColor); -} - - - - -void SubToolPanel::Resize (void) -{ - ::Window::Resize(); - mbIsRearrangePending = true; - mbIsLayoutPending = true; -} - - - - -void SubToolPanel::RequestResize (void) -{ - mbIsRearrangePending = true; - mbIsLayoutPending = true; - Invalidate(); -} - - - - -Size SubToolPanel::GetPreferredSize (void) -{ - return GetRequiredSize(); -} - - - - -sal_Int32 SubToolPanel::GetPreferredWidth (sal_Int32 ) -{ - return GetPreferredSize().Width(); -} - - - - -sal_Int32 SubToolPanel::GetPreferredHeight (sal_Int32 ) -{ - return GetPreferredSize().Height(); -} - - - - -bool SubToolPanel::IsResizable (void) -{ - return true; -} - - - - -::Window* SubToolPanel::GetWindow (void) -{ - return this; -} - - - - -sal_Int32 SubToolPanel::GetMinimumWidth (void) -{ - return TreeNode::GetMinimumWidth(); -} - - - - -void SubToolPanel::ExpandControl ( - TreeNode* pControl, - bool bExpansionState) -{ - // Toggle expand status. - pControl->Expand (bExpansionState); - - Rearrange (); - Invalidate (); -} - - - - -/** This control shows an expansion bar for every control and in a - separate area below that expansion area it shows all controls each - with its title bar. When there is not enough space then show a - scroll bar in the control area. -*/ -void SubToolPanel::Rearrange (void) -{ - Size aRequiredSize (GetRequiredSize()); - if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0) - { - Size aAvailableSize (GetOutputSizePixel()); - - // Make the children at least as wide as the sub tool panel. - if (aRequiredSize.Width() < aAvailableSize.Width()) - aRequiredSize.Width() = aAvailableSize.Width(); - mnChildrenWidth = -2*mnHorizontalBorder; - mnChildrenWidth += aAvailableSize.Width(); - - LayoutChildren(); - - mbIsRearrangePending = false; - } -} - - - - -Size SubToolPanel::GetRequiredSize (void) -{ - // First determine the width of the children. This is the maximum of - // the current window width and the individual minimum widths of the - // children. - int nChildrenWidth (GetSizePixel().Width()); - unsigned int nCount = mpControlContainer->GetControlCount(); - unsigned int nIndex; - for (nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - int nMinimumWidth (pChild->GetMinimumWidth()); - if (nMinimumWidth > nChildrenWidth) - nChildrenWidth = nMinimumWidth; - } - - // Determine the accumulated width of all children when scaled to the - // minimum width. - nChildrenWidth -= 2*mnHorizontalBorder; - Size aTotalSize (nChildrenWidth, - 2*mnVerticalBorder + (nCount-1) * mnVerticalGap); - for (nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth); - aTotalSize.Height() += nHeight; - } - - return aTotalSize; -} - - - - -sal_Int32 SubToolPanel::LayoutChildren (void) -{ - // Determine vertical space that can be distributed to sizable children. - unsigned int nCount (mpControlContainer->GetControlCount()); - unsigned int nResizableCount = 0; - int nAvailableHeight = GetSizePixel().Height() - 2*mnVerticalBorder; - unsigned int nIndex; - for (nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth); - if (pChild->IsResizable()) - nResizableCount++; - else - nAvailableHeight -= nControlHeight; - } - - maStripeList.clear(); - - Point aPosition (0,0); - aPosition.X() += mnHorizontalBorder; - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - aPosition.Y() + mnVerticalBorder - 1)); - aPosition.Y() += mnVerticalBorder; - - // Place the controls one over the other. - for (nIndex=0; nIndex<nCount; nIndex++) - { - if (nIndex > 0) - { - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - aPosition.Y() + mnVerticalGap - 1)); - aPosition.Y() += mnVerticalGap; - } - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth); - if (pChild->IsResizable()) - { - nControlHeight = nAvailableHeight / nResizableCount; - nResizableCount--; - } - nAvailableHeight -= nControlHeight; - pChild->GetWindow()->SetPosSizePixel( - aPosition, - Size(mnChildrenWidth, nControlHeight)); - aPosition.Y() += nControlHeight; - } - - // If the children do not cover their parent window completely - // (regarding the height) we put a filler below that is responsible for - // painting the remaining space. - int nWindowHeight = GetSizePixel().Height(); - if (aPosition.Y() < nWindowHeight) - { - maWindowFiller.SetPosSizePixel ( - aPosition, - Size(mnChildrenWidth, nWindowHeight-aPosition.Y())); - maStripeList.push_back( ::std::pair<int,int>( - aPosition.Y(), - nWindowHeight-1)); - // maScrollWindowFiller.Show(); - aPosition.Y() = nWindowHeight; - } - else - maWindowFiller.Hide(); - - aPosition.Y() += mnVerticalBorder; - mbIsLayoutPending = false; - - return aPosition.Y(); -} - - - - -IMPL_LINK(SubToolPanel, WindowEventListener, VclSimpleEvent*, pEvent) -{ - if (pEvent!=NULL && pEvent->ISA(VclWindowEvent)) - { - VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); - switch (pWindowEvent->GetId()) - { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - case VCLEVENT_WINDOW_ACTIVATE: - case VCLEVENT_WINDOW_RESIZE: - RequestResize(); - break; - } - } - return 0; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> SubToolPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - return new ::accessibility::AccessibleTreeNode ( - *this, - ::rtl::OUString::createFromAscii("Sub Task Panel"), - ::rtl::OUString::createFromAscii("Sub Task Panel"), - ::com::sun::star::accessibility::AccessibleRole::PANEL); -} - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx b/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx deleted file mode 100644 index 79ed39912751..000000000000 --- a/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx +++ /dev/null @@ -1,328 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "TaskPaneFocusManager.hxx" - -#include <vcl/window.hxx> -#include <vcl/svapp.hxx> -#include <vcl/event.hxx> -#include <rtl/instance.hxx> -#include <hash_map> - -namespace { - -class WindowHash -{ -public: - size_t operator()(const ::Window* argument) const - { return reinterpret_cast<unsigned long>(argument); } -}; - -class EventDescriptor -{ -public: - EventDescriptor (const KeyCode& rKey, ::Window* pWindow) - : maKeyCode(rKey), mpTargetWindow(pWindow) {} - KeyCode maKeyCode; - ::Window* mpTargetWindow; -}; - -} // end of anonymous namespace - - - - -namespace sd { namespace toolpanel { - - - -class FocusManager::LinkMap - : public ::std::hash_multimap< ::Window*, EventDescriptor, WindowHash> -{ -}; - - - -FocusManager& FocusManager::Instance (void) -{ - static FocusManager* spInstance = NULL; - - if (spInstance == NULL) - { - ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex()); - if (spInstance == NULL) - { - static FocusManager aInstance; - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - spInstance = &aInstance; - } - } - else - { - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - } - return *spInstance; -} - - - - -FocusManager::FocusManager (void) - : mpLinks(new LinkMap()) -{ -} - - - - -FocusManager::~FocusManager (void) -{ - Clear(); -} - - - - -void FocusManager::Clear (void) -{ - if (mpLinks.get() != NULL) - { - while ( ! mpLinks->empty()) - { - ::Window* pWindow = mpLinks->begin()->first; - if (pWindow == NULL) - { - mpLinks->erase(mpLinks->begin()); - } - else - { - RemoveLinks(pWindow); - } - } - } -} - - - - -void FocusManager::RegisterUpLink (::Window* pSource, ::Window* pTarget) -{ - RegisterLink(pSource, pTarget, KEY_ESCAPE); -} - - - - -void FocusManager::RegisterDownLink (::Window* pSource, ::Window* pTarget) -{ - RegisterLink(pSource, pTarget, KEY_RETURN); -} - - - - -void FocusManager::RegisterLink ( - ::Window* pSource, - ::Window* pTarget, - const KeyCode& rKey) -{ - OSL_ASSERT(pSource!=NULL); - OSL_ASSERT(pTarget!=NULL); - - if (pSource==NULL || pTarget==NULL) - return; - - // Register this focus manager as event listener at the source window. - if (mpLinks->equal_range(pSource).first == mpLinks->end()) - pSource->AddEventListener (LINK (this, FocusManager, WindowEventListener)); - mpLinks->insert(LinkMap::value_type(pSource, EventDescriptor(rKey,pTarget))); -} - - - - -void FocusManager::RemoveLinks ( - ::Window* pSourceWindow, - ::Window* pTargetWindow) -{ - OSL_ASSERT(pSourceWindow!=NULL); - OSL_ASSERT(pTargetWindow!=NULL); - - if (pSourceWindow==NULL || pTargetWindow==NULL) - { - // This method was called with invalid arguments. To avoid - // referencing windows that will soon be deleted we clear *all* - // links as an emergency fallback. - Clear(); - return; - } - - ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates; - LinkMap::iterator iCandidate; - bool bLoop (mpLinks->size() > 0); - while (bLoop) - { - aCandidates = mpLinks->equal_range(pSourceWindow); - if (aCandidates.first == mpLinks->end()) - { - // No links for the source window found -> nothing more to do. - bLoop = false; - } - else - { - // Set the loop control to false so that when no candidate for - // deletion is found the loop is left. - bLoop = false; - for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate) - if (iCandidate->second.mpTargetWindow == pTargetWindow) - { - mpLinks->erase(iCandidate); - // One link erased. The iterators have become invalid so - // start the search for links to delete anew. - bLoop = true; - break; - } - } - } - - RemoveUnusedEventListener(pSourceWindow); -} - - - - -void FocusManager::RemoveLinks (::Window* pWindow) -{ - OSL_ASSERT(pWindow!=NULL); - - if (pWindow == NULL) - { - // This method was called with invalid arguments. To avoid - // referencing windows that will soon be deleted we clear *all* - // links as an emergency fallback. - Clear(); - return; - } - - // Make sure that we are not called back for the window. - pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener)); - - // Remove the links from the given window. - ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates(mpLinks->equal_range(pWindow)); - mpLinks->erase(aCandidates.first, aCandidates.second); - - // Remove links to the given window. - bool bLinkRemoved; - do - { - bLinkRemoved = false; - LinkMap::iterator iLink; - for (iLink=mpLinks->begin(); iLink!=mpLinks->end(); ++iLink) - { - if (iLink->second.mpTargetWindow == pWindow) - { - RemoveUnusedEventListener(iLink->first); - mpLinks->erase(iLink); - bLinkRemoved = true; - break; - } - } - } - while (bLinkRemoved); -} - - - - -void FocusManager::RemoveUnusedEventListener (::Window* pWindow) -{ - OSL_ASSERT(pWindow!=NULL); - - if (pWindow == NULL) - return; - - // When there are no more links from the window to another window - // then remove the event listener from the window. - if (mpLinks->find(pWindow) == mpLinks->end()) - pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener)); -} - - - - -bool FocusManager::TransferFocus ( - ::Window* pSourceWindow, - const KeyCode& rKeyCode) -{ - bool bSuccess (false); - - OSL_ASSERT(pSourceWindow!=NULL); - if (pSourceWindow == NULL) - return bSuccess; - - ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates ( - mpLinks->equal_range(pSourceWindow)); - LinkMap::const_iterator iCandidate; - for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate) - if (iCandidate->second.maKeyCode == rKeyCode) - { - OSL_ASSERT(iCandidate->second.mpTargetWindow != NULL); - iCandidate->second.mpTargetWindow->GrabFocus(); - bSuccess = true; - break; - } - - return bSuccess; -} - - - - -IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent) -{ - if (pEvent!=NULL && pEvent->ISA(VclWindowEvent)) - { - VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); - switch (pWindowEvent->GetId()) - { - case VCLEVENT_WINDOW_KEYINPUT: - { - ::Window* pSource = pWindowEvent->GetWindow(); - KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData()); - TransferFocus(pSource, pKeyEvent->GetKeyCode()); - } - break; - - case VCLEVENT_OBJECT_DYING: - RemoveLinks(pWindowEvent->GetWindow()); - break; - } - } - return 1; -} - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx deleted file mode 100644 index 271953d46b08..000000000000 --- a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/TaskPaneTreeNode.hxx" - -#include "taskpane/ControlContainer.hxx" -#include "taskpane/TitledControl.hxx" - -#include <vector> -#include <algorithm> - -namespace sd { namespace toolpanel { - -TreeNode::TreeNode( TreeNode* pParent) -: mpControlContainer (new ControlContainer(this)) -, mpParent (pParent) -, maStateChangeListeners() -{ -} - - - - -TreeNode::~TreeNode (void) -{ -} - - - - -void TreeNode::SetParentNode (TreeNode* pNewParent) -{ - mpParent = pNewParent; - GetWindow()->SetParent (pNewParent->GetWindow()); -} - - - - -TreeNode* TreeNode::GetParentNode (void) -{ - return mpParent; -} - - - - -::Window* TreeNode::GetWindow (void) -{ - return NULL; -} - - - - -const ::Window* TreeNode::GetConstWindow (void) const -{ - return const_cast<TreeNode*>(this)->GetWindow(); -} - - - - -sal_Int32 TreeNode::GetMinimumWidth (void) -{ - sal_Int32 nTotalMinimumWidth = 0; - unsigned int nCount = mpControlContainer->GetControlCount(); - for (unsigned int nIndex=0; nIndex<nCount; nIndex++) - { - TreeNode* pChild = mpControlContainer->GetControl (nIndex); - sal_Int32 nMinimumWidth = pChild->GetMinimumWidth (); - if (nMinimumWidth > nTotalMinimumWidth) - nTotalMinimumWidth = nMinimumWidth; - } - - return nTotalMinimumWidth;; -} - - - - -bool TreeNode::IsResizable (void) -{ - return false; -} - - - - -void TreeNode::RequestResize (void) -{ - if (mpParent != NULL) - mpParent->RequestResize(); -} - - - - -ControlContainer& TreeNode::GetControlContainer (void) -{ - return *mpControlContainer.get(); -} - - - - -bool TreeNode::Expand (bool bExpansionState) -{ - bool bExpansionStateChanged (false); - - if (IsExpandable() && IsExpanded()!=bExpansionState) - { - if (bExpansionState) - GetWindow()->Show(); - else - GetWindow()->Hide(); - bExpansionStateChanged = true; - - FireStateChangeEvent (EID_EXPANSION_STATE_CHANGED); - } - - return bExpansionStateChanged; -} - - - - -bool TreeNode::IsExpanded (void) const -{ - if (GetConstWindow()!=NULL) - return GetConstWindow()->IsVisible(); - else - return false; -} - - - - -bool TreeNode::IsExpandable (void) const -{ - return GetConstWindow()!=NULL; -} - - - - -void TreeNode::Show (bool bExpansionState) -{ - if (GetWindow() != NULL) - { - bool bWasShowing (IsShowing()); - GetWindow()->Show (bExpansionState); - if (bWasShowing != bExpansionState) - FireStateChangeEvent (EID_SHOWING_STATE_CHANGED); - } -} - - - - -bool TreeNode::IsShowing (void) const -{ - const ::Window* pWindow = const_cast<TreeNode*>(this)->GetWindow(); - if (pWindow != NULL) - return pWindow->IsVisible(); - else - return false; -} - - - - -TaskPaneShellManager* TreeNode::GetShellManager (void) -{ - if (mpParent != NULL) - return mpParent->GetShellManager(); - else - return NULL; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> TreeNode::GetAccessibleObject (void) -{ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> xAccessible; - ::Window* pWindow = GetWindow(); - if (pWindow != NULL) - { - xAccessible = pWindow->GetAccessible(sal_False); - if ( ! xAccessible.is()) - { - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> xParent; - if (pWindow!=NULL && pWindow->GetAccessibleParentWindow()!=NULL) - xParent = pWindow->GetAccessibleParentWindow()->GetAccessible(); - xAccessible = CreateAccessibleObject(xParent); - pWindow->SetAccessible(xAccessible); - } - } - return xAccessible; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> TreeNode::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - if (GetWindow() != NULL) - return GetWindow()->CreateAccessible(); - else - return NULL; -} - - - - -void TreeNode::AddStateChangeListener (const Link& rListener) -{ - if (::std::find ( - maStateChangeListeners.begin(), - maStateChangeListeners.end(), - rListener) == maStateChangeListeners.end()) - { - maStateChangeListeners.push_back(rListener); - } -} - - - - -void TreeNode::FireStateChangeEvent ( - TreeNodeStateChangeEventId eEventId, - TreeNode* pChild) const -{ - TreeNodeStateChangeEvent aEvent (*this, eEventId, pChild); - StateChangeListenerContainer aContainerCopy(maStateChangeListeners); - StateChangeListenerContainer::iterator aLink (aContainerCopy.begin()); - StateChangeListenerContainer::iterator aEnd (aContainerCopy.end()); - while (aLink!=aEnd) - { - aLink->Call (&aEvent); - ++aLink; - } -} - - - -TreeNodeStateChangeEvent::TreeNodeStateChangeEvent ( - const TreeNode& rNode, - TreeNodeStateChangeEventId eEventId, - TreeNode* pChild) - : mrSource(rNode), - meEventId(eEventId), - mpChild(pChild) -{ -} - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TestMenu.cxx b/sd/source/ui/toolpanel/TestMenu.cxx deleted file mode 100644 index da9ef821cc8b..000000000000 --- a/sd/source/ui/toolpanel/TestMenu.cxx +++ /dev/null @@ -1,314 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "TestMenu.hxx" - -#include "taskpane/TaskPaneControlFactory.hxx" - -#include <vcl/image.hxx> -#include <vcl/svapp.hxx> - -namespace sd { namespace toolpanel { - -#ifdef SHOW_COLOR_MENU -/** This factory class is used to create instances of ColorMenu. It can be - extended so that its constructor stores arguments that later are passed - to new ColorMenu objects. -*/ -class ColorMenuFactory - : public ControlFactory -{ -protected: - virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) - { - return new ColorMenu (&i_rParent); - } -}; - - -ColorMenu::ColorMenu (::Window* i_pParent) - : Window (i_pParent), - TreeNode(NULL), - maSet (this), - mnPreferredColumnCount(2) -{ - WinBits aStyle = - WB_ITEMBORDER - | WB_DOUBLEBORDER - | WB_NAMEFIELD - | WB_FLATVALUESET - | WB_TABSTOP - | WB_VSCROLL; - - maSet.SetStyle (maSet.GetStyle() | aStyle); - maSet.SetExtraSpacing(2); - - Fill (); - maSet.Show(); - i_pParent->Resize(); -} - - - - -ColorMenu::~ColorMenu (void) -{ -} - - -::std::auto_ptr<ControlFactory> ColorMenu::CreateControlFactory (void) -{ - return ::std::auto_ptr<ControlFactory>(new ColorMenuFactory()); -} - - -/** The preferred size depends on the preferred number of columns, the - number of items, and the size of the items. -*/ -Size ColorMenu::GetPreferredSize (void) -{ - Size aItemSize = maSet.CalcItemSizePixel (Size()); - Size aPreferredWindowSize = maSet.CalcWindowSizePixel ( - aItemSize, - (sal_uInt16)mnPreferredColumnCount, - (sal_uInt16)CalculateRowCount (aItemSize, (sal_uInt16)mnPreferredColumnCount)); - return aPreferredWindowSize; -} - - - - -sal_Int32 ColorMenu::GetPreferredWidth (sal_Int32 nHeight) -{ - sal_Int32 nPreferredWidth = 0; - if (maSet.GetItemCount() > 0) - { - Image aImage = maSet.GetItemImage(maSet.GetItemId(0)); - Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel()); - if (nHeight>0 && aItemSize.Height()>0) - { - int nRowCount = nHeight / aItemSize.Height(); - if (nRowCount <= 0) - nRowCount = 1; - int nColumnCount = (maSet.GetItemCount() + nRowCount-1) - / nRowCount; - nPreferredWidth = nColumnCount * aItemSize.Width(); - } - } - - return nPreferredWidth; -} - - - - -sal_Int32 ColorMenu::GetPreferredHeight (sal_Int32 nWidth) -{ - sal_Int32 nPreferredHeight = 0; - if (maSet.GetItemCount()>0) - { - Image aImage = maSet.GetItemImage(maSet.GetItemId(0)); - Size aItemSize = maSet.CalcItemSizePixel (aImage.GetSizePixel()); - if (nWidth>0 && aItemSize.Width()>0) - { - int nColumnCount = nWidth / aItemSize.Width(); - if (nColumnCount <= 0) - nColumnCount = 1; - else if (nColumnCount > 4) - nColumnCount = 4; - int nRowCount = (maSet.GetItemCount() + nColumnCount-1) - / nColumnCount; - nPreferredHeight = nRowCount * aItemSize.Height(); - } - } - return nPreferredHeight; -} - - - - -bool ColorMenu::IsResizable (void) -{ - return true; -} - - - - -::Window* ColorMenu::GetWindow (void) -{ - return this; -} - - - - -void ColorMenu::Resize (void) -{ - ::Window::Resize(); - Size aWindowSize = GetOutputSizePixel(); - maSet.SetPosSizePixel (Point(0,0), aWindowSize); - if (IsVisible() && aWindowSize.Width() > 0) - { - // maSet.SetPosSizePixel ( - // Point (0,0), - // aWindowSize); - - // Calculate the number of rows and columns. - if (maSet.GetItemCount() > 0) - { - Image aImage = maSet.GetItemImage(maSet.GetItemId(0)); - Size aItemSize = maSet.CalcItemSizePixel ( - aImage.GetSizePixel()); - int nColumnCount = aWindowSize.Width() / 30; - if (nColumnCount < 1) - nColumnCount = 1; - else if (nColumnCount > 4) - nColumnCount = 4; - - sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount (aItemSize, nColumnCount); - - maSet.SetColCount ((sal_uInt16)nColumnCount); - maSet.SetLineCount (nRowCount); - } - } - -} - - - - -int ColorMenu::CalculateRowCount (const Size&, int nColumnCount) -{ - int nRowCount = 0; - - if (maSet.GetItemCount()>0 && nColumnCount>0) - { - nRowCount = GetOutputSizePixel().Height() / 30; - if (nRowCount < 1) - nRowCount = 1; - } - - return nRowCount; -} - - - - -void ColorMenu::Fill (void) -{ - const StyleSettings& rSettings ( - Application::GetSettings().GetStyleSettings()); - maSet.Clear(); - maSet.SetItemWidth (30); - maSet.SetItemHeight (30); - sal_uInt16 i = 0; - maSet.InsertItem (++i, rSettings.GetFaceColor()); - maSet.SetItemText (i, String::CreateFromAscii("FaceColor")); - maSet.InsertItem (++i, rSettings.GetCheckedColor()); - maSet.SetItemText (i, String::CreateFromAscii("CheckedColor")); - maSet.InsertItem (++i, rSettings.GetLightColor()); - maSet.SetItemText (i, String::CreateFromAscii("LightColor")); - maSet.InsertItem (++i, rSettings.GetLightBorderColor()); - maSet.SetItemText (i, String::CreateFromAscii("LightBorderColor")); - maSet.InsertItem (++i, rSettings.GetShadowColor()); - maSet.SetItemText (i, String::CreateFromAscii("ShadowColor")); - maSet.InsertItem (++i, rSettings.GetDarkShadowColor()); - maSet.SetItemText (i, String::CreateFromAscii("DarkShadowColor")); - maSet.InsertItem (++i, rSettings.GetButtonTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("ButtonTextColor")); - maSet.InsertItem (++i, rSettings.GetRadioCheckTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("RadioCheckTextColor")); - maSet.InsertItem (++i, rSettings.GetGroupTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("GroupTextColor")); - maSet.InsertItem (++i, rSettings.GetLabelTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("LabelTextColor")); - maSet.InsertItem (++i, rSettings.GetInfoTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("InfoTextColor")); - maSet.InsertItem (++i, rSettings.GetWindowColor()); - maSet.SetItemText (i, String::CreateFromAscii("WindowColor")); - maSet.InsertItem (++i, rSettings.GetWindowTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("WindowTextColor")); - maSet.InsertItem (++i, rSettings.GetDialogColor()); - maSet.SetItemText (i, String::CreateFromAscii("DialogColor")); - maSet.InsertItem (++i, rSettings.GetDialogTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("DialogTextColor")); - maSet.InsertItem (++i, rSettings.GetWorkspaceColor()); - maSet.SetItemText (i, String::CreateFromAscii("WorkspaceColor")); - maSet.InsertItem (++i, rSettings.GetFieldColor()); - maSet.SetItemText (i, String::CreateFromAscii("FieldColor")); - maSet.InsertItem (++i, rSettings.GetFieldTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("FieldTextColor")); - maSet.InsertItem (++i, rSettings.GetActiveColor()); - maSet.SetItemText (i, String::CreateFromAscii("ActiveColor")); - maSet.InsertItem (++i, rSettings.GetActiveColor2()); - maSet.SetItemText (i, String::CreateFromAscii("ActiveColor2")); - maSet.InsertItem (++i, rSettings.GetActiveTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("ActiveTextColor")); - maSet.InsertItem (++i, rSettings.GetActiveBorderColor()); - maSet.SetItemText (i, String::CreateFromAscii("ActiveBorderColor")); - maSet.InsertItem (++i, rSettings.GetDeactiveColor()); - maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor")); - maSet.InsertItem (++i, rSettings.GetDeactiveColor2()); - maSet.SetItemText (i, String::CreateFromAscii("DeactiveColor2")); - maSet.InsertItem (++i, rSettings.GetDeactiveTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("DeactiveTextColor")); - maSet.InsertItem (++i, rSettings.GetDeactiveBorderColor()); - maSet.SetItemText (i, String::CreateFromAscii("DeactiveBorderColor")); - maSet.InsertItem (++i, rSettings.GetHighlightColor()); - maSet.SetItemText (i, String::CreateFromAscii("HighlightColor")); - maSet.InsertItem (++i, rSettings.GetHighlightTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("HighlightTextColor")); - maSet.InsertItem (++i, rSettings.GetDisableColor()); - maSet.SetItemText (i, String::CreateFromAscii("DisableColor")); - maSet.InsertItem (++i, rSettings.GetHelpColor()); - maSet.SetItemText (i, String::CreateFromAscii("HelpColor")); - maSet.InsertItem (++i, rSettings.GetHelpTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("HelpTextColor")); - maSet.InsertItem (++i, rSettings.GetMenuColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuColor")); - maSet.InsertItem (++i, rSettings.GetMenuBarColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuBarColor")); - maSet.InsertItem (++i, rSettings.GetMenuBorderColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuBorderColor")); - maSet.InsertItem (++i, rSettings.GetMenuTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuTextColor")); - maSet.InsertItem (++i, rSettings.GetMenuHighlightColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightColor")); - maSet.InsertItem (++i, rSettings.GetMenuHighlightTextColor()); - maSet.SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor")); - maSet.InsertItem (++i, rSettings.GetLinkColor()); - maSet.SetItemText (i, String::CreateFromAscii("LinkColor")); - maSet.InsertItem (++i, rSettings.GetVisitedLinkColor()); - maSet.SetItemText (i, String::CreateFromAscii("VisitedLinkColor")); - maSet.InsertItem (++i, rSettings.GetHighlightLinkColor()); - maSet.SetItemText (i, String::CreateFromAscii("HighlightLinkColor")); - maSet.InsertItem (++i, rSettings.GetFontColor()); - maSet.SetItemText (i, String::CreateFromAscii("FontColor")); -} -#endif - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TestMenu.hxx b/sd/source/ui/toolpanel/TestMenu.hxx deleted file mode 100644 index 40bad7854661..000000000000 --- a/sd/source/ui/toolpanel/TestMenu.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TASKPANE_COLOR_MENU_HXX -#define SD_TASKPANE_COLOR_MENU_HXX - -#include "taskpane/TaskPaneTreeNode.hxx" -#include <svtools/valueset.hxx> -#include <vcl/window.hxx> - -#include <memory> - - -namespace sd { namespace toolpanel { - -class ControlFactory; - -#ifdef SHOW_COLOR_MENU - -/** This demo menu shows the colors that are available from the - StyleSettings. -*/ -class ColorMenu - : public ::Window, - public TreeNode -{ -public: - ColorMenu (::Window* i_pParent); - virtual ~ColorMenu (void); - - static ::std::auto_ptr<ControlFactory> CreateControlFactory (void); - - // From ILayoutableWindow - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual bool IsResizable (void); - virtual ::Window* GetWindow (void); - - // From ::Window - virtual void Resize (void); - - using Window::GetWindow; - -private: - ValueSet maSet; - int mnPreferredColumnCount; - - /** Depending on the given number of columns and the item size - calculate the number of rows that are necessary to display all - items. - */ - int CalculateRowCount (const Size& rItemSize, int nColumnCount); - void Fill (void); -}; -#endif - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx deleted file mode 100644 index 1162f69e35e5..000000000000 --- a/sd/source/ui/toolpanel/TestPanel.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "TestPanel.hxx" -#include "taskpane/ScrollPanel.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" - -#include <vcl/lstbox.hxx> -#include <vcl/button.hxx> - -namespace sd { namespace toolpanel { - -#ifdef SHOW_TEST_PANEL -/** This factory class is used to create instances of TestPanel. It can be - extended so that its constructor stores arguments that later are passed - to new TestPanel objects. -*/ -class TestPanelFactory - : public ControlFactory -{ -protected: - virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) - { - return new TestPanel (i_rParent); - } -}; - - -class Wrapper - : public TreeNode -{ -public: - Wrapper ( - TreeNode* pParent, - Size aPreferredSize, - ::Window* pWrappedControl, - bool bIsResizable) - : TreeNode (pParent), - maPreferredSize(aPreferredSize), - mpWrappedControl(pWrappedControl), - mbIsResizable(bIsResizable) - { - mpWrappedControl->Show(); - } - virtual ~Wrapper (void) - { - delete mpWrappedControl; - } - - virtual Size GetPreferredSize (void) - { - return maPreferredSize; - } - virtual sal_Int32 GetPreferredWidth (sal_Int32 ) - { - return maPreferredSize.Width(); - } - virtual sal_Int32 GetPreferredHeight (sal_Int32 ) - { - return maPreferredSize.Height(); - } - virtual ::Window* GetWindow (void) - { - return mpWrappedControl; - } - virtual bool IsResizable (void) - { - return mbIsResizable; - } - virtual bool IsExpandable (void) const - { - return false; - } - virtual bool IsExpanded (void) const - { - return true; - } - -private: - Size maPreferredSize; - ::Window* mpWrappedControl; - bool mbIsResizable; -}; - - -TestPanel::TestPanel (::Window& i_rParent) - : SubToolPanel (i_rParent) -{ - // Create a scrollable panel with two list boxes. - ScrollPanel* pScrollPanel = new ScrollPanel (this); - - ListBox* pBox = new ListBox (pScrollPanel->GetWindow()); - int i; - for (i=1; i<=20; i++) - { - XubString aString (XubString::CreateFromAscii("Text ")); - aString.Append (XubString::CreateFromInt32(i)); - aString.Append (XubString::CreateFromAscii("/20")); - pBox->InsertEntry (aString); - } - pScrollPanel->AddControl ( - ::std::auto_ptr<TreeNode>(new Wrapper ( - pScrollPanel, Size (200,300), pBox, true)), - String::CreateFromAscii ("First ListBox"), - ""); - - pBox = new ListBox (pScrollPanel->GetWindow()); - for (i=1; i<=20; i++) - { - XubString aString (XubString::CreateFromAscii("More Text ")); - aString.Append (XubString::CreateFromInt32(i)); - aString.Append (XubString::CreateFromAscii("/20")); - pBox->InsertEntry (aString); - } - pScrollPanel->AddControl ( - ::std::auto_ptr<TreeNode>(new Wrapper ( - pScrollPanel, Size (200,300), pBox, true)), - String::CreateFromAscii ("Second ListBox"), - ""); - - AddControl (::std::auto_ptr<TreeNode>(pScrollPanel)); - - // Add a fixed size button. - Button* pButton = new OKButton (this); - AddControl ( - ::std::auto_ptr<TreeNode>(new Wrapper ( - this, Size (100,30), pButton, false)), - String::CreateFromAscii ("Button Area"), - ""); -} - - - - - -TestPanel::~TestPanel (void) -{ -} - -std::auto_ptr<ControlFactory> TestPanel::CreateControlFactory (void) -{ - return std::auto_ptr<ControlFactory>(new TestPanelFactory()); -} -#endif - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx deleted file mode 100644 index 9e9bc28eb7f4..000000000000 --- a/sd/source/ui/toolpanel/TitleBar.cxx +++ /dev/null @@ -1,581 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/TitleBar.hxx" - -#include "ControlContainerDescriptor.hxx" -#include "tools/IconCache.hxx" -#include "AccessibleTreeNode.hxx" -#include <vcl/decoview.hxx> -#include <vcl/window.hxx> -#include <vcl/virdev.hxx> -#include <vos/mutex.hxx> -#include <vcl/svapp.hxx> -#include "sdresid.hxx" -#include <vcl/bitmap.hxx> -#include <vcl/lineinfo.hxx> -#include <vcl/bitmapex.hxx> -#include <tools/color.hxx> -#include <svx/xdash.hxx> -#include <svl/itemset.hxx> -#include <svx/xlndsit.hxx> -#include <svx/xlineit0.hxx> -#include <svx/svdobj.hxx> -#include <svx/svdpool.hxx> -#include <svtools/colorcfg.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xfillit0.hxx> -#include "res_bmp.hrc" - - -namespace sd { namespace toolpanel { - -const int TitleBar::snIndentationWidth = 16; - -TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable) -: ::Window (pParent, WB_TABSTOP) -, TreeNode(this) -, meType(eType) -, msTitle(rsTitle) -, mbExpanded(false) -, mbFocused(false) -, mpDevice(new VirtualDevice (*this)) -, mbIsExpandable (bIsExpandable) -{ - EnableMapMode (sal_False); - - SetBackground (Wallpaper()); - - // Change the mouse pointer shape so that it acts as a mouse over effect. - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - if (mbIsExpandable) - SetPointer (POINTER_REFHAND); - break; - } -} - - - - -TitleBar::~TitleBar (void) -{ -} - - - - -Size TitleBar::GetPreferredSize (void) -{ - int nWidth = GetOutputSizePixel().Width(); - Rectangle aTitleBarBox ( - CalculateTitleBarBox( - CalculateTextBoundingBox(nWidth, true), - nWidth)); - - return aTitleBarBox.GetSize(); -} - - - - -sal_Int32 TitleBar::GetPreferredWidth (sal_Int32 ) -{ - Rectangle aTitleBarBox ( - CalculateTitleBarBox( - CalculateTextBoundingBox(0, true), - 0)); - return aTitleBarBox.GetWidth(); -} - - - - -sal_Int32 TitleBar::GetPreferredHeight (sal_Int32 nWidth) -{ - Rectangle aTitleBarBox ( - CalculateTitleBarBox( - CalculateTextBoundingBox(nWidth, true), - nWidth)); - - return aTitleBarBox.GetHeight(); -} - - - - -bool TitleBar::IsResizable (void) -{ - return true; -} - - - - -::Window* TitleBar::GetWindow (void) -{ - return this; -} - - - - -sal_Int32 TitleBar::GetMinimumWidth (void) -{ - return 20; -} - - - - -void TitleBar::Paint (const Rectangle& rBoundingBox) -{ - mpDevice->SetMapMode(GetMapMode()); - mpDevice->SetOutputSize (GetOutputSizePixel()); - mpDevice->SetSettings(GetSettings()); - mpDevice->SetDrawMode(GetDrawMode()); - - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - PaintSubPanelHeadLineBar (); - break; - } - - DrawOutDev ( - Point(0,0), - GetOutputSizePixel(), - Point(0,0), - GetOutputSizePixel(), - *mpDevice); - - ::Window::Paint (rBoundingBox); -} - - - - -bool TitleBar::Expand (bool bFlag) -{ - bool bExpansionStateChanged (bFlag!=IsExpanded()); - mbExpanded = bFlag; - Invalidate (); - return bExpansionStateChanged; -} - - - - -bool TitleBar::IsExpanded (void) const -{ - return mbExpanded; -} - - -void TitleBar::SetEnabledState(bool bFlag) -{ - if(bFlag) - Enable(); - else - Disable(); - Invalidate (); -} - - - - -void TitleBar::GetFocus() -{ - mbFocused = true; - Invalidate(); -} - - - - -void TitleBar::LoseFocus() -{ - mbFocused = false; - Invalidate(); -} - - - - -bool TitleBar::HasExpansionIndicator (void) const -{ - bool bHasExpansionIndicator (false); - if (mbIsExpandable) - { - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - bHasExpansionIndicator = true; - break; - } - } - return bHasExpansionIndicator; -} - - - - -Image TitleBar::GetExpansionIndicator (void) const -{ - Image aIndicator; - bool bHighContrastMode (GetSettings().GetStyleSettings().GetHighContrastMode() != 0); - if (mbIsExpandable) - { - sal_uInt16 nResourceId = 0; - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - if (mbExpanded) - if (bHighContrastMode) - nResourceId = BMP_COLLAPSE_H; - else - nResourceId = BMP_COLLAPSE; - else - if (bHighContrastMode) - nResourceId = BMP_EXPAND_H; - else - nResourceId = BMP_EXPAND; - - aIndicator = IconCache::Instance().GetIcon(nResourceId); - break; - } - } - - return aIndicator; -} - - - - -void TitleBar::PaintSubPanelHeadLineBar (void) -{ - int nWidth (GetOutputSizePixel().Width()); - Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true)); - - Rectangle aTitleBarBox (CalculateTitleBarBox(aTextBox, nWidth)); - int nVerticalOffset = -aTitleBarBox.Top(); - aTitleBarBox.Top() += nVerticalOffset; - aTitleBarBox.Bottom() += nVerticalOffset; - aTextBox.Top() += nVerticalOffset; - aTextBox.Bottom() += nVerticalOffset; - - PaintBackground (aTitleBarBox); - Rectangle aFocusBox (PaintExpansionIndicator (aTextBox)); - PaintText (aTextBox); - - aFocusBox.Union (aTextBox); - aFocusBox.Left() -= 2; - aFocusBox.Right() += 1; - PaintFocusIndicator (aFocusBox); -} - - - - -void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox) -{ - if (mbFocused) - { - Rectangle aTextPixelBox (mpDevice->LogicToPixel (rTextBox)); - mpDevice->EnableMapMode (sal_False); - Rectangle aBox (rTextBox); - aBox.Top() -= 1; - aBox.Bottom() += 1; - - mpDevice->SetFillColor (); - - mpDevice->DrawRect (aTextPixelBox); - - LineInfo aDottedStyle (LINE_DASH); - aDottedStyle.SetDashCount (0); - aDottedStyle.SetDotCount (1); - aDottedStyle.SetDotLen (1); - aDottedStyle.SetDistance (1); - - mpDevice->SetLineColor (COL_BLACK); - mpDevice->DrawPolyLine (Polygon(aTextPixelBox), aDottedStyle); - mpDevice->EnableMapMode (sal_False); - } - else - HideFocus (); -} - - - - -Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox) -{ - Rectangle aExpansionIndicatorArea; - - if (HasExpansionIndicator()) - { - Image aImage = GetExpansionIndicator(); - int nHeight (aImage.GetSizePixel().Height()); - if (nHeight > 0) - { - Point aPosition ( - 0, - rTextBox.Top() + (GetTextHeight() - nHeight) / 2); - if (meType == TBT_SUB_CONTROL_HEADLINE) - aPosition.X() += 3; - mpDevice->DrawImage (aPosition, aImage); - - aExpansionIndicatorArea = Rectangle ( - aPosition, aImage.GetSizePixel()); - } - } - - return aExpansionIndicatorArea; -} - - - - -void TitleBar::PaintText (const Rectangle& rTextBox) -{ - mpDevice->DrawText (rTextBox, msTitle, GetTextStyle()); -} - - - - -sal_uInt16 TitleBar::GetTextStyle (void) -{ - if(IsEnabled()) - { - return TEXT_DRAW_LEFT - | TEXT_DRAW_TOP - | TEXT_DRAW_MULTILINE - | TEXT_DRAW_WORDBREAK; - } - else - { - return TEXT_DRAW_DISABLE; - } -} - - - -void TitleBar::PaintBackground (const Rectangle& rTitleBarBox) -{ - // Fill a slightly rounded rectangle. - Color aFillColor (GetFillColor()); - Color aLineColor (GetLineColor()); - - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - { - Color aColor (GetSettings().GetStyleSettings().GetDialogColor()); - if (mbExpanded) - { - // Make the color a little bit darker. - aColor.SetRed(sal_uInt8(((sal_uInt16)aColor.GetRed()) * 8 / 10)); - aColor.SetGreen(sal_uInt8(((sal_uInt16)aColor.GetGreen()) * 8 / 10)); - aColor.SetBlue(sal_uInt8(((sal_uInt16)aColor.GetBlue()) * 8 / 10)); - } - - mpDevice->SetFillColor (aColor); - mpDevice->SetLineColor (); - mpDevice->DrawRect (rTitleBarBox); - - // Erase the four corner pixels to make the rectangle appear - // rounded. - mpDevice->SetLineColor ( - GetSettings().GetStyleSettings().GetWindowColor()); - mpDevice->DrawPixel ( - rTitleBarBox.TopLeft()); - mpDevice->DrawPixel ( - Point(rTitleBarBox.Right(), rTitleBarBox.Top())); - mpDevice->DrawPixel ( - Point(rTitleBarBox.Left(), rTitleBarBox.Bottom())); - mpDevice->DrawPixel ( - Point(rTitleBarBox.Right(), rTitleBarBox.Bottom())); - } - break; - } -} - - - - -Rectangle TitleBar::CalculateTextBoundingBox ( - int nAvailableWidth, - bool bEmphasizeExpanded) -{ - // Show the title of expanded controls in bold font. - const Font& rOriginalFont (GetFont()); - Font aFont (rOriginalFont); - if (bEmphasizeExpanded && mbExpanded) - aFont.SetWeight (WEIGHT_BOLD); - else - aFont.SetWeight (WEIGHT_NORMAL); - mpDevice->SetFont (aFont); - - // Use the natural width of the text when no width is given. - if (nAvailableWidth == 0) - nAvailableWidth = GetTextWidth (msTitle); - - Rectangle aTextBox ( - Point(0,0), - Size (nAvailableWidth, - GetSettings().GetStyleSettings().GetTitleHeight())); - aTextBox.Top() += (aTextBox.GetHeight() - GetTextHeight()) / 2; - if (HasExpansionIndicator()) - aTextBox.Left() += snIndentationWidth; - else - aTextBox.Left() += 3; - aTextBox.Right() -= 1; - - aTextBox = mpDevice->GetTextRect (aTextBox, msTitle, GetTextStyle()); - - return aTextBox; -} - - - - -Rectangle TitleBar::CalculateTitleBarBox ( - const Rectangle& rTextBox, - int nWidth) -{ - Rectangle aTitleBarBox (rTextBox); - - switch (meType) - { - case TBT_SUB_CONTROL_HEADLINE: - aTitleBarBox.Top() -= 3; - aTitleBarBox.Bottom() += 3; - break; - - } - aTitleBarBox.Left() = 0; - if (aTitleBarBox.GetWidth() < nWidth) - aTitleBarBox.Right() = nWidth-1; - - return aTitleBarBox; -} - - - - -void TitleBar::MouseMove (const MouseEvent& ) -{ -} - - - - -void TitleBar::MouseButtonDown (const MouseEvent& ) -{ - // Do not forward to parent window so that the mouse button handler of - // the docking window is not invoked. -} - - - - -void TitleBar::MouseButtonUp (const MouseEvent& ) -{ - // Do not forward to parent window so that the mouse button handler of - // the docking window is not invoked. -} - - - - -void TitleBar::DataChanged (const DataChangedEvent& rEvent) -{ - ::Window::DataChanged (rEvent); - - switch (rEvent.GetType()) - { - case DATACHANGED_SETTINGS: - if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0) - break; - SetSettings(Application::GetSettings()); - mpDevice.reset(new VirtualDevice (*this)); - - // fall through. - - case DATACHANGED_FONTS: - case DATACHANGED_FONTSUBSTITUTION: - { - const StyleSettings& rStyleSettings (GetSettings().GetStyleSettings()); - - // Font. - Font aFont = rStyleSettings.GetAppFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(aFont); - - // Color. - Color aColor; - if (IsControlForeground()) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor(aColor); - SetTextFillColor(); - - Resize(); - Invalidate(); - } - break; - } -} - - - - -String TitleBar::GetTitle (void) const -{ - return msTitle; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > TitleBar::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - return new ::accessibility::AccessibleTreeNode( - *this, - GetTitle(), - GetTitle(), - ::com::sun::star::accessibility::AccessibleRole::LABEL); -} - - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx deleted file mode 100644 index bdd90ceb8fa7..000000000000 --- a/sd/source/ui/toolpanel/TitledControl.cxx +++ /dev/null @@ -1,428 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/TitledControl.hxx" - -#include "AccessibleTreeNode.hxx" -#include "taskpane/ControlContainer.hxx" -#include "TaskPaneFocusManager.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include <vcl/ctrl.hxx> -#include <vcl/svapp.hxx> - - -namespace sd { namespace toolpanel { - - -TitledControl::TitledControl ( - TreeNode* pParent, - ::std::auto_ptr<TreeNode> pControl, - const String& rTitle, - const ClickHandler& rClickHandler, - TitleBar::TitleBarType eType) - : ::Window (pParent->GetWindow(), WB_TABSTOP), - TreeNode(pParent), - msTitle(rTitle), - mbVisible(true), - mpUserData(NULL), - mpClickHandler(new ClickHandler(rClickHandler)) -{ - mpControlContainer->AddControl (::std::auto_ptr<TreeNode> ( - new TitleBar (this, rTitle, eType, pControl->IsExpandable()))); - pControl->SetParentNode (this); - mpControlContainer->AddControl (pControl); - - FocusManager::Instance().RegisterDownLink( GetTitleBar()->GetWindow(), GetControl()->GetWindow() ); - FocusManager::Instance().RegisterUpLink( GetControl()->GetWindow(), GetTitleBar()->GetWindow() ); - - SetBackground (Wallpaper()); - - GetTitleBar()->GetWindow()->Show (); - GetTitleBar()->GetWindow()->AddEventListener ( - LINK(this,TitledControl,WindowEventListener)); - - UpdateStates (); -} - - - - -TitledControl::~TitledControl (void) -{ - GetTitleBar()->GetWindow()->RemoveEventListener ( - LINK(this,TitledControl,WindowEventListener)); -} - - - - -Size TitledControl::GetPreferredSize (void) -{ - Size aPreferredSize; - if (GetControl() != NULL) - { - aPreferredSize = GetControl()->GetPreferredSize(); - if ( ! IsExpanded()) - aPreferredSize.Height() = 0; - } - else - aPreferredSize = Size (GetSizePixel().Width(), 0); - if (aPreferredSize.Width() == 0) - aPreferredSize.Width() = 300; - aPreferredSize.Height() += GetTitleBar()->GetPreferredHeight( - aPreferredSize.Width()); - - return aPreferredSize; -} - - - - -sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight) -{ - int nPreferredWidth = 0; - if (GetControl() != NULL) - nPreferredWidth = GetControl()->GetPreferredWidth( - nHeight - GetTitleBar()->GetWindow()->GetSizePixel().Height()); - else - nPreferredWidth = GetSizePixel().Width(); - if (nPreferredWidth == 0) - nPreferredWidth = 300; - - return nPreferredWidth; -} - - - - -sal_Int32 TitledControl::GetPreferredHeight (sal_Int32 nWidth) -{ - int nPreferredHeight = 0; - if (IsExpanded() && GetControl()!=NULL) - nPreferredHeight = GetControl()->GetPreferredHeight(nWidth); - nPreferredHeight += GetTitleBar()->GetPreferredHeight(nWidth); - - return nPreferredHeight; -} - - - - -bool TitledControl::IsResizable (void) -{ - return IsExpanded() - && GetControl()->IsResizable(); -} - - - - -::Window* TitledControl::GetWindow (void) -{ - return this; -} - - - - -void TitledControl::Resize (void) -{ - Size aWindowSize (GetOutputSizePixel()); - - int nTitleBarHeight - = GetTitleBar()->GetPreferredHeight(aWindowSize.Width()); - GetTitleBar()->GetWindow()->SetPosSizePixel ( - Point (0,0), - Size (aWindowSize.Width(), nTitleBarHeight)); - - - TreeNode* pControl = GetControl(); - if (pControl != NULL - && pControl->GetWindow() != NULL - && pControl->GetWindow()->IsVisible()) - { - pControl->GetWindow()->SetPosSizePixel ( - Point (0,nTitleBarHeight), - Size (aWindowSize.Width(), aWindowSize.Height()-nTitleBarHeight)); - } -} - - - - -void TitledControl::GetFocus (void) -{ - ::Window::GetFocus(); - if (GetTitleBar() != NULL) - GetTitleBar()->GrabFocus(); -} - - - - -void TitledControl::KeyInput (const KeyEvent& rEvent) -{ - KeyCode nCode = rEvent.GetKeyCode(); - if (nCode == KEY_SPACE) - { - // Toggle the expansion state of the control (when toggling is - // supported.) The focus remains on this control. - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_TOGGLE); - } - else if (nCode == KEY_RETURN) - { - // Return, also called enter, enters the control and puts the - // focus to the first child. If the control is not yet - // expanded then do that first. - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_EXPAND); - - if ( ! FocusManager::Instance().TransferFocus(this,nCode)) - { - // When already expanded then put focus on first child. - TreeNode* pControl = GetControl(); - if (pControl!=NULL && IsExpanded()) - if (pControl->GetWindow() != NULL) - pControl->GetWindow()->GrabFocus(); - } - } - else if (nCode == KEY_ESCAPE) - { - if ( ! FocusManager::Instance().TransferFocus(this,nCode)) - // Put focus to parent. - GetParent()->GrabFocus(); - } - else - Window::KeyInput (rEvent); -} - - - - -const String& TitledControl::GetTitle (void) const -{ - return msTitle; -} - - - - -bool TitledControl::Expand (bool bExpanded) -{ - bool bExpansionStateChanged (false); - - if (IsExpandable() && IsEnabled()) - { - if (GetTitleBar()->IsExpanded() != bExpanded) - bExpansionStateChanged |= GetTitleBar()->Expand (bExpanded); - // Get the control. Use the bExpanded parameter as argument to - // indicate that a control is created via its factory only when it - // is to be expanded. When it is collapsed this is not necessary. - TreeNode* pControl = GetControl(); - if (pControl != NULL - && GetControl()->IsExpanded() != bExpanded) - { - bExpansionStateChanged |= pControl->Expand (bExpanded); - } - if (bExpansionStateChanged) - UpdateStates(); - } - - return bExpansionStateChanged; -} - - - - -bool TitledControl::IsExpandable (void) const -{ - const TreeNode* pControl = GetConstControl(); - if (pControl != NULL) - return pControl->IsExpandable(); - else - // When a control factory is given but the control has not yet been - // created we assume that the control is expandable. - return true; -} - - - - -bool TitledControl::IsExpanded (void) const -{ - const TreeNode* pControl = GetConstControl(); - if (pControl != NULL) - return pControl->IsExpanded(); - else - return false; -} - -void TitledControl::SetEnabledState(bool bFlag) -{ - if (!bFlag) - { - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_COLLAPSE); - Disable(); - } - else - { -/* - GetParentNode()->GetControlContainer().SetExpansionState ( - this, - ControlContainer::ES_EXPAND); -*/ - Enable(); - } - - GetTitleBar()->SetEnabledState(bFlag); -} - - - -bool TitledControl::IsShowing (void) const -{ - return mbVisible; -} - - - - -void TitledControl::Show (bool bVisible) -{ - if (mbVisible != bVisible) - { - mbVisible = bVisible; - UpdateStates (); - } -} - - - - -void TitledControl::UpdateStates (void) -{ - if (mbVisible) - GetWindow()->Show(); - else - GetWindow()->Hide(); - - TreeNode* pControl = GetControl(); - if (pControl!=NULL && pControl->GetWindow() != NULL) - { - if (IsVisible() && IsExpanded()) - pControl->GetWindow()->Show(); - else - pControl->GetWindow()->Hide(); - } -} - - - - -IMPL_LINK(TitledControl, WindowEventListener, - VclSimpleEvent*, pEvent) -{ - if (pEvent!=NULL && pEvent->ISA(VclWindowEvent)) - { - VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); - switch (pWindowEvent->GetId()) - { - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - if (IsEnabled()) - (*mpClickHandler)(*this); - break; - } - } - return 0; -} - - - - -TreeNode* TitledControl::GetControl (void) -{ - return mpControlContainer->GetControl(1); -} - - - - -const TreeNode* TitledControl::GetConstControl () const -{ - return const_cast<TitledControl*>(this)->GetControl(); -} - - - - -TitleBar* TitledControl::GetTitleBar (void) -{ - return static_cast<TitleBar*>(mpControlContainer->GetControl(0)); -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> TitledControl::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - return new ::accessibility::AccessibleTreeNode( - *this, - GetTitle(), - GetTitle(), - ::com::sun::star::accessibility::AccessibleRole::LIST_ITEM); -} - - - - -//===== TitledControlStandardClickHandler ===================================== - -TitledControlStandardClickHandler::TitledControlStandardClickHandler ( - ControlContainer& rControlContainer, - ControlContainer::ExpansionState eExpansionState) - : mrControlContainer(rControlContainer), - meExpansionState(eExpansionState) -{ -} - - - - -void TitledControlStandardClickHandler::operator () (TitledControl& rTitledControl) -{ - // Toggle expansion. - mrControlContainer.SetExpansionState (&rTitledControl, meExpansionState); -} - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx deleted file mode 100644 index 3e229cda9776..000000000000 --- a/sd/source/ui/toolpanel/ToolPanel.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "precompiled_sd.hxx" - -#include "ToolPanel.hxx" -#include "MethodGuard.hxx" -#include <taskpane/TaskPaneTreeNode.hxx> - -/** === begin UNO includes === **/ -#include <com/sun/star/lang/DisposedException.hpp> -/** === end UNO includes === **/ - -#include <vcl/window.hxx> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::accessibility::XAccessible; - /** === end UNO using === **/ - - typedef MethodGuard< ToolPanel > ToolPanelGuard; - - //================================================================================================================== - //= ToolPanel - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl ) - :ToolPanel_Base( m_aMutex ) - ,m_pControl( i_rControl ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanel::~ToolPanel() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanel::checkDisposed() - { - if ( m_pControl.get() == NULL ) - throw DisposedException( ::rtl::OUString(), *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException) - { - ToolPanelGuard aGuard( *this ); - return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException) - { - ToolPanelGuard aGuard( *this ); - Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) ); - if ( !xAccessible.is() ) - { - xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) ); - m_pControl->GetWindow()->SetAccessible( xAccessible ); - } - return xAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL ToolPanel::disposing() - { - m_pControl.reset(); - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanel.hxx deleted file mode 100644 index ffaba793feb8..000000000000 --- a/sd/source/ui/toolpanel/ToolPanel.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANEL_HXX -#define SD_TOOLPANEL_HXX - -/** === begin UNO includes === **/ -#include <com/sun/star/ui/XToolPanel.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase1.hxx> - -#include <memory> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class TreeNode; - - //================================================================================================================== - //= ToolPanel - //================================================================================================================== - typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XToolPanel - > ToolPanel_Base; - class ToolPanel :public ::cppu::BaseMutex - ,public ToolPanel_Base - { - public: - ToolPanel( - ::std::auto_ptr< TreeNode >& i_rControl - ); - - // XToolPanel - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - ::osl::Mutex& getMutex() { return m_aMutex; } - void checkDisposed(); - - protected: - ~ToolPanel(); - - private: - ::std::auto_ptr< TreeNode > m_pControl; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANEL_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx b/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx deleted file mode 100644 index f418fcf3d728..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelDescriptor.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOL_PANEL_DESCRIPTOR_HXX -#define SD_TOOL_PANEL_DESCRIPTOR_HXX - -#include <tools/string.hxx> -#include <tools/gen.hxx> -#include <memory> - -class Window; - -namespace sd { namespace toolpanel { - - -/** Collection of information the describes entries of the tool - panel. A descriptor owns the control it is associated with. -*/ -class ToolPanelDescriptor -{ -public: - /** Create a new descriptor for the given control. - @param pControl - */ - ToolPanelDescriptor (::std::auto_ptr< ::Window> pControl, - const String& rTitle); - - ~ToolPanelDescriptor (void); - - /** Return the height of the title bar. - @return - The title bar height is returned in pixels. - */ - int GetTitleBarHeight (void) const; - - - void SetPositionAndSize (const Point& aPosition, - const Size& aSize); - void SetPositionAndSize (const Rectangle& aBox); - void SetWeight (double nWeight); - - Window* GetControl (void) const; - const String& GetTitle (void) const; - const Rectangle& GetTitleBox (void) const; - Rectangle GetPositionAndSize (void) const; - double GetWeight (void) const; - - int GetTotalHeight (void) const; - int GetWindowHeight (void) const; - -private: - ::std::auto_ptr< ::Window> mpControl; - String msTitle; - Rectangle maTitleBox; - double mnWeight; - int mnTotalHeight; - - /// Do not use! Assignment operator is not supported. - const ToolPanelDescriptor& operator= ( - const ToolPanelDescriptor& aDescriptor); -}; - -} } // end of namespace ::sd::toolpanel - -#endif diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx deleted file mode 100644 index dafab6cd88bc..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelFactory.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "precompiled_sd.hxx" - -#include "taskpane/ToolPanelViewShell.hxx" -#include "framework/FrameworkHelper.hxx" -#include "PaneChildWindows.hxx" -#include "ViewShellBase.hxx" -#include "app.hrc" - -/** === begin UNO includes === **/ -#include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/awt/XWindow.hpp> -/** === end UNO includes === **/ - -#include <sfx2/frame.hxx> -#include <vcl/svapp.hxx> -#include <vos/mutex.hxx> -#include <sfx2/viewfrm.hxx> -#include <cppuhelper/implbase3.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <toolkit/helper/vclunohelper.hxx> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::ui::XUIElementFactory; - using ::com::sun::star::ui::XUIElement; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::container::NoSuchElementException; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::lang::XInitialization; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::awt::XWindow; - /** === end UNO using === **/ - - //================================================================================================================== - //= ToolPanelFactory - //================================================================================================================== - typedef ::cppu::WeakImplHelper3 < XUIElementFactory - , XServiceInfo - , XInitialization - > ToolPanelFactory_Base; - class ToolPanelFactory : public ToolPanelFactory_Base - { - public: - ToolPanelFactory( const Reference< XComponentContext >& i_rContext ); - - // XUIElementFactory - virtual Reference< XUIElement > SAL_CALL createUIElement( const ::rtl::OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); - - protected: - virtual ~ToolPanelFactory(); - - private: - const Reference< XComponentContext > m_xContext; - }; - - //------------------------------------------------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext ) - { - return Reference< XInterface >( *new ToolPanelFactory( i_rContext ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString ToolPanelFactory_getImplementationName() throw(RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.drawing.ToolPanelFactory" ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void) - throw (RuntimeException) - { - const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DefaultToolPanelFactory" ) ); - return Sequence< ::rtl::OUString >( &sServiceName, 1 ); - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext ) - :m_xContext( i_rContext ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanelFactory::~ToolPanelFactory() - { - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const ::rtl::OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException) - { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - - const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) ); - if ( ePanelId == PID_UNKNOWN ) - throw NoSuchElementException( i_rResourceURL, *this ); - - const ::comphelper::NamedValueCollection aArgs( i_rArgs ); - const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) ); - const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) ); - if ( !xDocFrame.is() || !xParentWindow.is() ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "For creating a standard tool panel, a Frame and a Parent window are needed." ) ), - *this, - 2 - ); - - // look up the Sfx(View)Frame for the given XFrame - SfxViewFrame* pViewFrame = NULL; - for ( SfxFrame* pFrame = SfxFrame::GetFirst(); - pFrame != NULL; - pFrame = SfxFrame::GetNext( *pFrame ) - ) - { - if ( pFrame->GetFrameInterface() == xDocFrame ) - { - pViewFrame = pFrame->GetCurrentViewFrame(); - break; - } - } - - if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_TASKPANE ) ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal frame." ) ), - *this, - 2 - ); - - // retrieve the task pane - ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_TASKPANE ) ) ); - if ( !pToolPanelWindow ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No Impress document, or no Impress Task Pane." ) ), - *this, - 2 - ); - - // retrieve the ViewShellBase, and the view shell of the task pane - ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() ); - ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper; - if ( pViewShellBase ) - pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase ); - ::boost::shared_ptr< ViewShell > pViewShell; - if ( pFrameworkHelper.get() ) - pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL ); - ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() ); - - if ( !pToolPanelShell ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wrong document type." ) ), - *this, - 2 - ); - - ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); - if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) ) - throw IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported parent window." ) ), - *this, - 2 - ); - - return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException) - { - return ToolPanelFactory_getImplementationName(); - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const ::rtl::OUString& i_rServiceName ) throw (RuntimeException) - { - const Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - for ( const ::rtl::OUString* pSupported = aSupported.getConstArray(); - pSupported != aSupported.getConstArray() + aSupported.getLength(); - ++pSupported - ) - if ( *pSupported == i_rServiceName ) - return sal_True; - - return sal_False; - } - - //------------------------------------------------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames( ) throw (RuntimeException) - { - return ToolPanelFactory_getSupportedServiceNames(); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException) - { - ::comphelper::NamedValueCollection aArgs( i_rArguments ); - (void)aArgs; - // TODO - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx deleted file mode 100644 index 4b795ee2a6c6..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "precompiled_sd.hxx" - -#include "ToolPanelUIElement.hxx" -#include "MethodGuard.hxx" - -/** === begin UNO includes === **/ -#include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/lang/XComponent.hpp> -/** === end UNO includes === **/ - -#include <tools/diagnose_ex.h> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::lang::XComponent; - using ::com::sun::star::ui::XToolPanel; - using ::com::sun::star::lang::DisposedException; - /** === end UNO using === **/ - namespace UIElementType = ::com::sun::star::ui::UIElementType; - - typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard; - - //================================================================================================================== - //= ToolPanelUIElement - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL, - const Reference< XToolPanel >& i_rToolPanel ) - :ToolPanelUIElement_Base( m_aMutex ) - ,m_xFrame( i_rFrame ) - ,m_sResourceURL( i_rResourceURL ) - ,m_xToolPanel( i_rToolPanel ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - ToolPanelUIElement::~ToolPanelUIElement() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void ToolPanelUIElement::checkDisposed() - { - if ( !m_xToolPanel.is() ) - throw DisposedException( ::rtl::OUString(), *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException) - { - UIElementMethodGuard aGuard( *this ); - return m_xFrame; - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException) - { - UIElementMethodGuard aGuard( *this ); - return m_sResourceURL; - } - - //------------------------------------------------------------------------------------------------------------------ - ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException) - { - UIElementMethodGuard aGuard( *this ); - return UIElementType::TOOLPANEL; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException) - { - UIElementMethodGuard aGuard( *this ); - return m_xToolPanel.get(); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL ToolPanelUIElement::disposing() - { - try - { - Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW ); - xPanelComponent->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx deleted file mode 100644 index 0354e01f7039..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANELUIELEMENT_HXX -#define SD_TOOLPANELUIELEMENT_HXX - -/** === begin UNO includes === **/ -#include <com/sun/star/ui/XUIElement.hpp> -#include <com/sun/star/ui/XToolPanel.hpp> -/** === end UNO includes === **/ - -#include <cppuhelper/compbase1.hxx> -#include <cppuhelper/basemutex.hxx> - -#include <memory> - -//...................................................................................................................... -namespace sd { namespace toolpanel -{ -//...................................................................................................................... - - class TreeNode; - - //================================================================================================================== - //= ToolPanelUIElement - //================================================================================================================== - typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement - > ToolPanelUIElement_Base; - class ToolPanelUIElement :public ::cppu::BaseMutex - ,public ToolPanelUIElement_Base - { - public: - ToolPanelUIElement( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, - const ::rtl::OUString& i_rResourceURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel - ); - - // XUIElement - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException); - - void checkDisposed(); - ::osl::Mutex& getMutex() { return m_aMutex; } - - protected: - virtual ~ToolPanelUIElement(); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - private: - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - const ::rtl::OUString m_sResourceURL; - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel; - }; - -//...................................................................................................................... -} } // namespace sd::toolpanel -//...................................................................................................................... - -#endif // SD_TOOLPANELUIELEMENT_HXX diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx deleted file mode 100644 index ba49bac8f0d7..000000000000 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ /dev/null @@ -1,900 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "taskpane/ToolPanelViewShell.hxx" - -#include "TaskPaneShellManager.hxx" -#include "TaskPaneFocusManager.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include "controls/MasterPagesPanel.hxx" -#include "LayoutMenu.hxx" -#include "DrawDocShell.hxx" -#include "controls/TableDesignPanel.hxx" -#include "controls/CustomAnimationPanel.hxx" -#include "controls/SlideTransitionPanel.hxx" -#include "controls/MasterPagesSelector.hxx" -#include "ToolPanel.hxx" -#include "ToolPanelUIElement.hxx" -#include "PaneDockingWindow.hxx" -#include "FrameView.hxx" -#include "Window.hxx" -#include "sdmod.hxx" -#include "app.hrc" -#include "glob.hrc" -#include "res_bmp.hrc" -#include "helpids.h" -#include "strings.hrc" -#include "sdresid.hxx" -#include "framework/FrameworkHelper.hxx" - -/** === begin UNO includes === **/ -#include <com/sun/star/drawing/framework/XResourceId.hpp> -#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> -#include <com/sun/star/drawing/framework/AnchorBindingMode.hpp> -#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp> -#include <com/sun/star/drawing/XDrawSubController.hpp> -/** === end UNO includes === **/ - -#include <svtools/toolpanel/toolpanel.hxx> -#include <svtools/toolpanel/toolpaneldeck.hxx> -#include <svx/dlgctrl.hxx> -#include <sfx2/taskpane.hxx> -#include <sfx2/imagemgr.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/msg.hxx> -#include <sfx2/objface.hxx> -#include <svx/colrctrl.hxx> -#include <svx/xtable.hxx> -#include <vcl/dockwin.hxx> -#include "sdtreelb.hxx" -#include "DrawViewShell.hxx" -#include "drawdoc.hxx" -#include "ViewShellBase.hxx" -#include <svx/ruler.hxx> -#include <vcl/svapp.hxx> -#include <vcl/toolbox.hxx> -#include <tools/diagnose_ex.h> -#include <unotools/confignode.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/componentcontext.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/basemutex.hxx> - -#include <vector> - -using namespace ::sd::toolpanel; - -#define ToolPanelViewShell -#include "sdslots.hxx" - -/** === begin UNO using === **/ -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::XInterface; -using ::com::sun::star::uno::UNO_QUERY; -using ::com::sun::star::uno::UNO_QUERY_THROW; -using ::com::sun::star::uno::UNO_SET_THROW; -using ::com::sun::star::uno::Exception; -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::makeAny; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Type; -using ::com::sun::star::accessibility::XAccessible; -using ::com::sun::star::drawing::XDrawSubController; -using ::com::sun::star::frame::XFrame; -using ::com::sun::star::drawing::framework::XResourceId; -using ::com::sun::star::drawing::framework::XConfigurationChangeListener; -using ::com::sun::star::drawing::framework::ConfigurationChangeEvent; -using ::com::sun::star::lang::EventObject; -using ::com::sun::star::lang::DisposedException; -using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster; -using ::com::sun::star::drawing::framework::XConfigurationController; -using ::com::sun::star::drawing::framework::XConfiguration; -using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT; -using ::com::sun::star::ui::XUIElement; -using ::com::sun::star::ui::XToolPanel; -using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; -/** === end UNO using === **/ - -using ::sd::framework::FrameworkHelper; - -namespace sd { namespace toolpanel { - -// ===================================================================================================================== -// = misc helper -// ===================================================================================================================== -// --------------------------------------------------------------------------------------------------------------------- -PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown ) -{ - PanelId ePanelId( PID_UNKNOWN ); - - if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) ) - { - ePanelId = PID_MASTER_PAGES; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) ) - { - ePanelId = PID_LAYOUT; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) ) - { - ePanelId = PID_TABLE_DESIGN; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) ) - { - ePanelId = PID_CUSTOM_ANIMATION; - } - else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) ) - { - ePanelId = PID_SLIDE_TRANSITION; - } - else - { - OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" ); - (void)i_bIgnoreUnknown; - } - - return ePanelId; -} - -// --------------------------------------------------------------------------------------------------------------------- -PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL ) -{ - return GetStandardPanelId( i_rTaskPanelResourceURL, false ); -} - -// ===================================================================================================================== -// = ConfigurationListener - declaration -// ===================================================================================================================== -typedef ::cppu::WeakImplHelper1 < XConfigurationChangeListener - > ConfigurationListener_Base; - -class ConfigurationListener :public ::cppu::BaseMutex - ,public ConfigurationListener_Base -{ -public: - ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl ); - - // XConfigurationChangeListener - virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); - - // XComponent equivalents (not available per UNO interface) - void dispose(); - -protected: - ~ConfigurationListener(); - - void impl_checkDisposed_throw() - { - if ( !m_pShellImpl ) - throw DisposedException( ::rtl::OUString(), *this ); - } - -private: - ToolPanelViewShell_Impl* m_pShellImpl; -}; - -// ===================================================================================================================== -// = ToolPanelViewShell_Impl - declaration -// ===================================================================================================================== -/** Inner implementation class of ToolPanelViewShell. -*/ -class ToolPanelViewShell_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - ,public ::sfx2::IToolPanelCompare -{ -public: - static const size_t mnInvalidId = static_cast< size_t >( -1 ); - - ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ); - ~ToolPanelViewShell_Impl(); - - ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; } - - /** Here the panels are created that are shown in the task pane. - */ - void Setup(); - - /** clean up the instance - */ - void Cleanup(); - - /** activates the panel which has the given resource URL - */ - void ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ); - - /** de-activates the panel given by its resource URL, bypassing the configuration controller - - If the panel is not active currently, nothing happens. - */ - void DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ); - - /** provides access to the the VCL window of the panel deck - */ - ::sfx2::ModuleTaskPane& GetTaskPane() { return *m_pTaskPane; } - const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; } - - ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); } - const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); } - - Reference< XAccessible > - CreateAccessible( ::sd::Window& i_rWindow ); - - void ConnectToDockingWindow(); - -private: - // IToolPanelDeckListener overridables - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - // IToolPanelCompare overridables - virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const; - -private: - struct InitialPanel - { - ::rtl::OUString sPanelResourceURL; - bool bActivateDirectly; - InitialPanel() - :sPanelResourceURL() - ,bActivateDirectly( true ) - { - } - }; - InitialPanel impl_determineInitialPanel(); - ::rtl::OUString impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel ); - -private: - ToolPanelViewShell& m_rPanelViewShell; - ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane; - ::std::auto_ptr< ::sfx2::TaskPaneController > m_pTaskPaneController; - ::rtl::Reference< ConfigurationListener > m_pConfigListener; - bool m_bInitialized; -}; - -// ===================================================================================================================== -// = ConfigurationListener - implementation -// ===================================================================================================================== -// --------------------------------------------------------------------------------------------------------------------- -ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl ) - :m_pShellImpl( &i_rShellImpl ) -{ - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) ); - Reference< XConfigurationControllerBroadcaster > xBroadcaster; - if ( pFrameworkHelper.get() ) - xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() ); - ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" ); - - osl_incrementInterlockedCount( &m_refCount ); - { - xBroadcaster->addConfigurationChangeListener( this, ::rtl::OUString(), Any() ); - } - osl_decrementInterlockedCount( &m_refCount ); -} - -// --------------------------------------------------------------------------------------------------------------------- -ConfigurationListener::~ConfigurationListener() -{ -} - -// --------------------------------------------------------------------------------------------------------------------- -void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - impl_checkDisposed_throw(); - - // is this an event we're interested in? - if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent ) - return; - - // is this a resource we're interested in? Must be anchored in the task pane ... - Reference< XResourceId > xAnchorId; - if ( i_rEvent.ResourceId.is() ) - xAnchorId = i_rEvent.ResourceId->getAnchor(); - if ( !xAnchorId.is() ) - return; - const ::rtl::OUString sAnchorURL( xAnchorId->getResourceURL() ); - if ( sAnchorURL != FrameworkHelper::msTaskPaneURL ) - return; - - m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException) -{ - (void)i_rEvent; - { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_checkDisposed_throw(); - } - - dispose(); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ConfigurationListener::dispose() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pShellImpl = NULL; -} - -// ===================================================================================================================== -// = ToolPanelViewShell -// ===================================================================================================================== -// --------------------------------------------------------------------------------------------------------------------- -SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL)) -{ -} - -// --------------------------------------------------------------------------------------------------------------------- -TYPEINIT1(ToolPanelViewShell, ViewShell); - -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel() -{ - InitialPanel aPanelToActivate; - if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW ) - // for Draw, rely on SFX's default handling, which is to activate the previously active panel - return aPanelToActivate; - - // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case, - // use that one. - aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL; - aPanelToActivate.bActivateDirectly = false; - try - { - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) ); - const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) ); - Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); - Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW ); - Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources( - FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ), - FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) ); - - if ( aViewIds.getLength() > 0 ) - { - const ::rtl::OUString sResourceURL( aViewIds[0]->getResourceURL() ); - PanelId nRequestedPanel = GetStandardPanelId( sResourceURL ); - if ( nRequestedPanel != PID_UNKNOWN ) - { - aPanelToActivate.sPanelResourceURL = sResourceURL; - aPanelToActivate.bActivateDirectly = true; - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aPanelToActivate; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::Setup() -{ - if ( m_bInitialized ) - return; - m_bInitialized = true; - - // initially activate a panel - const InitialPanel aInitialPanel = impl_determineInitialPanel(); - if ( aInitialPanel.sPanelResourceURL.getLength() ) - { - if ( aInitialPanel.bActivateDirectly ) - { - ActivatePanelByResource( aInitialPanel.sPanelResourceURL ); - } - else - { - ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); - pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL ); - } - } - - // listen at the configuration - m_pConfigListener.set( new ConfigurationListener( *this ) ); - - m_pTaskPane->Show(); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::Cleanup() -{ - if ( m_bInitialized ) - { - if ( m_pConfigListener.is() ) - m_pConfigListener->dispose(); - } - GetToolPanelDeck().RemoveListener( *this ); - m_pTaskPaneController.reset(); - m_pTaskPane.reset(); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL ) -{ - // determine position of the requested panel - ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL ); - OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" ); - if ( !!aPanelPos ) - GetToolPanelDeck().ActivatePanel( *aPanelPos ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL ) -{ - // determine position of the requested panel - ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL ); - OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" ); - if ( !!aPanelPos ) - { - if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos ) - GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() ); - } -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Initialize() -{ - mpImpl->Setup(); -} - -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, - FrameView* pFrameViewArgument ) - :ViewShell(pFrame, pParentWindow, rViewShellBase) - ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) ) - ,mpSubShellManager() - ,mnMenuId(0) -{ - meShellType = ST_TASK_PANE; - - mpContentWindow->SetCenterAllowed( false ); - pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL ); - - GetParentWindow()->SetBackground( Wallpaper() ); - mpContentWindow->SetBackground( Wallpaper() ); - - GetParentWindow()->SetHelpId(HID_SD_TASK_PANE); - - mpImpl->ConnectToDockingWindow(); - - SetPool( &GetDoc()->GetPool() ); - - if ( pFrameViewArgument ) - mpFrameView = pFrameViewArgument; - else - mpFrameView = new FrameView( GetDoc() ); - GetFrameView()->Connect(); - - // Hide or delete unused controls that we have inherited from the - // ViewShell base class. - mpHorizontalScrollBar.reset(); - mpVerticalScrollBar.reset(); - mpScrollBarBox.reset(); - mpHorizontalRuler.reset(); - mpVerticalRuler.reset(); - - SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) ); - - // enforce the creation of the Accessible object here. - // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some - // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular) - // loop (which is /not/ a bug in the tool, of course). - // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation - // (which originally was intended as a workaround) herein. Better to be safe ... - // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible - // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only - // create the former here, the latter is still created on demand, when somebody requests it. - // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com - if (mpContentWindow.get()) - mpContentWindow->GetAccessible( sal_True ); - - // For accessibility we have to shortly hide the content window. This - // triggers the construction of a new accessibility object for the new - // view shell. (One is created earlier while the construtor of the base - // class is executed. At that time the correct accessibility object can - // not be constructed.) - if (mpContentWindow.get()) - { - mpContentWindow->Hide(); - mpContentWindow->Show(); - } - - // Register the shell manager as factory at the ViewShellManager. - mpSubShellManager.reset( new TaskPaneShellManager( - GetViewShellBase().GetViewShellManager(), - *this - ) ); - GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager ); -} - -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell::~ToolPanelViewShell() -{ - mpImpl->Cleanup(); - - // reset our impl before destroying the panel deck, to ensure the hidden panels are properly - // disposed/destroyed, too - mpImpl.reset(); - GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager); - - GetFrameView()->Disconnect(); // i120663, release the FrameView object -} - -// --------------------------------------------------------------------------------------------------------------------- -// static -void ToolPanelViewShell::RegisterControls() -{ - SfxModule* pModule = SD_MOD(); - controls::MasterPagesSelector::RegisterInterface( pModule ); - LayoutMenu::RegisterInterface( pModule ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::ArrangeGUIElements() -{ - ViewShell::ArrangeGUIElements(); - - Initialize(); - - mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::GetFocus() -{ - Invalidate(); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::LoseFocus() -{ - Invalidate(); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent ) -{ - const KeyCode nCode = i_rKeyEvent.GetKeyCode(); - if ( nCode == KEY_RETURN ) - { - if ( !mpImpl->GetTaskPane().HasChildPathFocus() ) - mpImpl->GetTaskPane().GrabFocus(); - } - else - ViewShell::KeyInput( i_rKeyEvent, NULL ); -} - -// --------------------------------------------------------------------------------------------------------------------- -SdPage* ToolPanelViewShell::GetActualPage() -{ - return NULL; -} - -// --------------------------------------------------------------------------------------------------------------------- -SdPage* ToolPanelViewShell::getCurrentPage() const -{ - return NULL; -} - -// --------------------------------------------------------------------------------------------------------------------- -TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const -{ - return *mpSubShellManager.get(); -} - -// --------------------------------------------------------------------------------------------------------------------- -DockingWindow* ToolPanelViewShell::GetDockingWindow() -{ - ::Window* pParentWindow = GetParentWindow(); - DockingWindow* pDockingWindow = NULL; - while (pParentWindow!=NULL && pDockingWindow==NULL) - { - pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow); - pParentWindow = pParentWindow->GetParent(); - } - return pDockingWindow; -} - -// --------------------------------------------------------------------------------------------------------------------- -Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow ) -{ - ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL ); - return mpImpl->CreateAccessible( *i_pWindow ); -} - -// --------------------------------------------------------------------------------------------------------------------- -Reference< XDrawSubController > ToolPanelViewShell::CreateSubController() -{ - // This view shell is not designed to be the main view shell and thus - // does not support a UNO sub controller. - return Reference< XDrawSubController >(); -} - -// --------------------------------------------------------------------------------------------------------------------- -bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow ) -{ - ::Window* pOldParentWindow = GetParentWindow(); - FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() ); - FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow ); - - PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() ); - if ( pDockingWindow != NULL ) - { - pDockingWindow->SetEndDockingHdl( Link() ); - } - - ViewShell::RelocateToParentWindow(pParentWindow); - - mpImpl->ConnectToDockingWindow(); - - Resize(); - - return true; -} - -//--------------------------------------------------------------------------------------------------------------------- -bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const -{ - return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow; -} - -//--------------------------------------------------------------------------------------------------------------------- -namespace -{ - typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell ); - - struct PanelFactory - { - ControlFactoryFactory pFactory; - rtl::OString sHelpID; - PanelFactory( const ControlFactoryFactory i_pFactory, const rtl::OString& i_nHelpID ) - :pFactory( i_pFactory ) - ,sHelpID( i_nHelpID ) - { - } - }; - - const PanelFactory lcl_describePanel( const PanelId i_ePanelId ) - { - switch ( i_ePanelId ) - { - case PID_MASTER_PAGES: - return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS ); - case PID_LAYOUT: - return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS ); - case PID_TABLE_DESIGN: - return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN ); - case PID_CUSTOM_ANIMATION: - return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS ); - case PID_SLIDE_TRANSITION: - return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS ); - default: - break; - } - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal panel ID" ) ), NULL ); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL ) -{ - const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) ); - ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL ); - - // a TreeNode which will resemble the panel - const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) ); - ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) ); - ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) ); - ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ), - "illegal node returned by the control factory" ); - pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID ); - - // create an XToolPanel - Reference< XToolPanel > xPanel( new ToolPanel( pNode ) ); - - // create an XUIElement providing this panel - const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) ); - - return xUIElement; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL ) -{ - OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0, - "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" ); - mpImpl->ActivatePanelByResource( i_rPanelResourceURL ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL ) -{ - mpImpl->DeactivatePanelByResource( i_rPanelResourceURL ); -} - -// ===================================================================================================================== -// = ToolPanelViewShell_Impl - implementation -// ===================================================================================================================== -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent ) - :m_rPanelViewShell( i_rPanelViewShell ) - ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) ) - ,m_bInitialized( false ) -{ - const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) ); - GetToolPanelDeck().SetAccessibleName( sPaneTitle ); - GetToolPanelDeck().SetAccessibleDescription( sPaneTitle ); - - GetToolPanelDeck().AddListener( *this ); -} - -// --------------------------------------------------------------------------------------------------------------------- -ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl() -{ -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) -{ - // not interested in - (void)i_pPanel; - (void)i_nPosition; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition ) -{ - // not interested in - (void)i_nPosition; -} - -// --------------------------------------------------------------------------------------------------------------------- -::rtl::OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel ) -{ - ::rtl::OUString sPanelURL; - if ( !!i_rPanel ) - { - sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel ); - const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) ); - if ( ePanelId == PID_UNKNOWN ) - sPanelURL = ::rtl::OUString(); - } - return sPanelURL; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) -{ - // update the configuration controller, since this change in the active panel might have been triggered by means other - // than the drawing framework, so it does not yet know about it. - - const ::rtl::OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) ); - const ::rtl::OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) ); - - const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); - if ( sNewPanelURL.getLength() ) - { - // activate the resource belonging to the new panel. This will automatically de-activate the previously active - // panel resource (since ResourceActivationMode_REPLACE is used) - pFrameworkHelper->RequestTaskPanel( sNewPanelURL ); - } - else if ( sOldPanelURL.getLength() ) - { - // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the - // resource framework. => Deactivate the old resource. - try - { - Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW ); - xConfigController->requestResourceDeactivation( - pFrameworkHelper->CreateResourceId( - sOldPanelURL, - FrameworkHelper::msTaskPaneURL, - FrameworkHelper::msRightPaneURL - ) - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) -{ - // not interested in - (void)i_rNewLayouter; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::Dying() -{ - // not interested in -} - -// --------------------------------------------------------------------------------------------------------------------- -short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const -{ - const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) ); - const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) ); - if ( eLHS < eRHS ) - return -1; - if ( eLHS == eRHS ) - return 0; - return 1; -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell_Impl::ConnectToDockingWindow() -{ - m_pTaskPaneController.reset(); - DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() ); - if ( pDockingWindow ) - { - PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow ); - OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" ); - if ( pPaneDockingWindow != NULL ) - m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) ); - } - - // Tell the focus manager that we want to pass the focus to our - // child. - FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() ); -} - -// --------------------------------------------------------------------------------------------------------------------- -Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow ) -{ - Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( sal_False ) ); - if ( !xAccessible.is() ) - { - // determine the XAccessible which is the parent of the to-be-created object - ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow(); - OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" ); - GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent ); - - xAccessible = GetToolPanelDeck().GetAccessible( sal_True ); - ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL ); - OSL_ENSURE( xAccessible->getAccessibleContext().is() - && xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(), - "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" ); - } - return xAccessible; -} - -} } // end of namespace ::sd::toolpanel diff --git a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx deleted file mode 100644 index 79c9a01f2154..000000000000 --- a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" -#include "AnimationSchemesPanel.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" -#include <com/sun/star/frame/XModel.hpp> - -namespace sd -{ - - class ViewShellBase; - extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase ); - -namespace toolpanel { namespace controls { - - -AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase) - : SubToolPanel (pParent), - maPreferredSize( 100, 200 ) -{ - mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase ); - mpWrappedControl->Show(); -} - -AnimationSchemesPanel::~AnimationSchemesPanel() -{ - delete mpWrappedControl; -} - -Size AnimationSchemesPanel::GetPreferredSize() -{ - return maPreferredSize; -} -sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 ) -{ - return maPreferredSize.Width(); -} -sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 ) -{ - return maPreferredSize.Height(); -} -::Window* AnimationSchemesPanel::GetWindow() -{ - return mpWrappedControl; -} -bool AnimationSchemesPanel::IsResizable() -{ - return true; -} -bool AnimationSchemesPanel::IsExpandable() const -{ - return true; -} - - -} } } // end of namespace ::sd::toolpanel::controls -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" -#include "AnimationSchemesPanel.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" -#include <com/sun/star/frame/XModel.hpp> - -namespace sd -{ - - class ViewShellBase; - extern ::Window * createAnimationSchemesPanel( ::Window* pParent, ViewShellBase& rBase ); - -namespace toolpanel { namespace controls { - - -AnimationSchemesPanel::AnimationSchemesPanel(TreeNode* pParent, ViewShellBase& rBase) - : SubToolPanel (pParent), - maPreferredSize( 100, 200 ) -{ - mpWrappedControl = createAnimationSchemesPanel( pParent->GetWindow(), rBase ); - mpWrappedControl->Show(); -} - -AnimationSchemesPanel::~AnimationSchemesPanel() -{ - delete mpWrappedControl; -} - -Size AnimationSchemesPanel::GetPreferredSize() -{ - return maPreferredSize; -} -sal_Int32 AnimationSchemesPanel::GetPreferredWidth(sal_Int32 ) -{ - return maPreferredSize.Width(); -} -sal_Int32 AnimationSchemesPanel::GetPreferredHeight(sal_Int32 ) -{ - return maPreferredSize.Height(); -} -::Window* AnimationSchemesPanel::GetWindow() -{ - return mpWrappedControl; -} -bool AnimationSchemesPanel::IsResizable() -{ - return true; -} -bool AnimationSchemesPanel::IsExpandable() const -{ - return true; -} - - -} } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx b/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx deleted file mode 100644 index aa5e8080d7a2..000000000000 --- a/sd/source/ui/toolpanel/controls/AnimationSchemesPanel.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX -#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX - -#include "taskpane/SubToolPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class TreeNode; -} } - -namespace sd { namespace toolpanel { namespace controls { - -class AnimationSchemesPanel - : public SubToolPanel -{ -public: - AnimationSchemesPanel ( - TreeNode* pParent, - ViewShellBase& rBase); - virtual ~AnimationSchemesPanel (void); - - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual ::Window* GetWindow (void); - virtual bool IsResizable (void); - virtual bool IsExpandable (void) const; - - using Window::GetWindow; - -private: - Size maPreferredSize; - ::Window* mpWrappedControl; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif -#ifndef SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX -#define SD_TASKPANE_CONTROLS_ANIMATION_SCHEMES_PANEL_HXX - -#include "taskpane/SubToolPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class TreeNode; -} } - -namespace sd { namespace toolpanel { namespace controls { - -class AnimationSchemesPanel - : public SubToolPanel -{ -public: - AnimationSchemesPanel ( - TreeNode* pParent, - ViewShellBase& rBase); - virtual ~AnimationSchemesPanel (void); - - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual ::Window* GetWindow (void); - virtual bool IsResizable (void); - virtual bool IsExpandable (void) const; - - using Window::GetWindow; - -private: - Size maPreferredSize; - ::Window* mpWrappedControl; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx deleted file mode 100644 index ccb9db835d6e..000000000000 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "CustomAnimationPanel.hxx" - -#include "taskpane/TaskPaneControlFactory.hxx" -#include "taskpane/ToolPanelViewShell.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" - -namespace sd -{ - - class ViewShellBase; - extern ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase ); - -namespace toolpanel { namespace controls { - - -CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) - :SubToolPanel( i_rParentWindow ) - ,m_pPanelViewShell( &i_rPanelViewShell ) -{ - mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); - mpWrappedControl->Show(); -} - -CustomAnimationPanel::~CustomAnimationPanel() -{ - delete mpWrappedControl; -} - -std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) -{ - return std::auto_ptr< ControlFactory >( - new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); -} - -TaskPaneShellManager* CustomAnimationPanel::GetShellManager() -{ - if ( m_pPanelViewShell ) - return &m_pPanelViewShell->GetSubShellManager(); - return SubToolPanel::GetShellManager(); -} - -Size CustomAnimationPanel::GetPreferredSize() -{ - return maPreferredSize; -} -sal_Int32 CustomAnimationPanel::GetPreferredWidth(sal_Int32 ) -{ - return maPreferredSize.Width(); -} -sal_Int32 CustomAnimationPanel::GetPreferredHeight(sal_Int32 ) -{ - return maPreferredSize.Height(); -} -::Window* CustomAnimationPanel::GetWindow() -{ - return mpWrappedControl; -} -bool CustomAnimationPanel::IsResizable() -{ - return true; -} -bool CustomAnimationPanel::IsExpandable() const -{ - return true; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> CustomAnimationPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - if (GetWindow() != NULL) - return GetWindow()->GetAccessible(); - else - return NULL; -} - -} } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx deleted file mode 100644 index 8a1c28f594ab..000000000000 --- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX -#define SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX - -#include "taskpane/SubToolPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class TreeNode; -class ControlFactory; -class ToolPanelViewShell; -} } - -namespace sd { namespace toolpanel { namespace controls { - -class CustomAnimationPanel - : public SubToolPanel -{ -public: - CustomAnimationPanel ( - Window& i_rParentWindow, - ToolPanelViewShell& i_rPanelViewShell); - virtual ~CustomAnimationPanel (void); - - static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell); - - // TreeNode overridables - virtual TaskPaneShellManager* GetShellManager(); - - // ILayoutableWindow overridables - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual ::Window* GetWindow (void); - virtual bool IsResizable (void); - virtual bool IsExpandable (void) const; - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& rxParent); - - using Window::GetWindow; -private: - Size maPreferredSize; - ::Window* mpWrappedControl; - ToolPanelViewShell* m_pPanelViewShell; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx deleted file mode 100644 index f5d7218963e7..000000000000 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "MasterPagesPanel.hxx" -#include "taskpane/ScrollPanel.hxx" -#include "CurrentMasterPagesSelector.hxx" -#include "RecentMasterPagesSelector.hxx" -#include "AllMasterPagesSelector.hxx" -#include "taskpane/ToolPanelViewShell.hxx" -#include "taskpane/TaskPaneControlFactory.hxx" -#include "taskpane/TitledControl.hxx" -#include "../TaskPaneShellManager.hxx" - -#include "DrawViewShell.hxx" -#include "ViewShellBase.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" -#include "helpids.h" -#include <svtools/valueset.hxx> -#include "app.hrc" - -namespace sd { namespace toolpanel { namespace controls { - - -MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell) - :ScrollPanel (i_rParentWindow) - ,m_pPanelViewShell( &i_rPanelViewShell ) -{ - impl_construct( m_pPanelViewShell->GetViewShellBase() ); -} - -void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) -{ - SdDrawDocument* pDocument = rBase.GetDocument(); - ::std::auto_ptr<controls::MasterPagesSelector> pSelector; - TitledControl* pTitledControl; - - ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); - - // Create a panel with the master pages that are in use by the currently - // edited document. - DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(rBase.GetMainViewShell().get()); - pSelector.reset(new controls::CurrentMasterPagesSelector ( - this, - *pDocument, - rBase, - pContainer)); - pSelector->LateInit(); - pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); - GetShellManager()->AddSubShell( - SHELLID_SD_TASK_PANE_PREVIEW_CURRENT, - pSelector.get(), - pSelector->GetWindow()); - pTitledControl = AddControl ( - ::std::auto_ptr<TreeNode>(pSelector.release()), - SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE), - HID_SD_CURRENT_MASTERS); - - // Create a panel with the most recently used master pages. - pSelector.reset(new controls::RecentMasterPagesSelector ( - this, - *pDocument, - rBase, - pContainer)); - pSelector->LateInit(); - pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT ); - GetShellManager()->AddSubShell( - SHELLID_SD_TASK_PANE_PREVIEW_RECENT, - pSelector.get(), - pSelector->GetWindow()); - pTitledControl = AddControl ( - ::std::auto_ptr<TreeNode>(pSelector.release()), - SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE), - HID_SD_RECENT_MASTERS); - - // Create a panel with all available master pages. - pSelector.reset(new controls::AllMasterPagesSelector ( - this, - *pDocument, - rBase, - *pDrawViewShell, - pContainer)); - pSelector->LateInit(); - pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL ); - GetShellManager()->AddSubShell( - SHELLID_SD_TASK_PANE_PREVIEW_ALL, - pSelector.get(), - pSelector->GetWindow()); - pTitledControl = AddControl ( - ::std::auto_ptr<TreeNode>(pSelector.release()), - SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE), - HID_SD_ALL_MASTERS); -} - - - - - -MasterPagesPanel::~MasterPagesPanel (void) -{ - TaskPaneShellManager* pShellManager( GetShellManager() ); - OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" ); - if ( pShellManager ) - { - pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT ); - pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT ); - pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL ); - } -} - - - - -TaskPaneShellManager* MasterPagesPanel::GetShellManager() -{ - if ( m_pPanelViewShell ) - return &m_pPanelViewShell->GetSubShellManager(); - return TreeNode::GetShellManager(); -} - - - - -std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) -{ - return std::auto_ptr< ControlFactory >( - new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); -} - -} } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx deleted file mode 100644 index aeaf97180c24..000000000000 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX -#define SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX - -#include "taskpane/ScrollPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class ControlFactory; -class TreeNode; -class ToolPanelViewShell; -} } - -namespace sd { namespace toolpanel { namespace controls { - -/** The master pages panel combines three master page related panels into - one. This has the benefit that creation of the task pane becomes a - little bit simpler and that common scroll bars can be displayed. -*/ -class MasterPagesPanel - : public ScrollPanel -{ -public: - MasterPagesPanel ( - ::Window& i_rParentWindow, - ToolPanelViewShell& i_rPanelViewShell); - virtual ~MasterPagesPanel (void); - - // TreeNode overridables - virtual TaskPaneShellManager* GetShellManager (void); - - static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); - -private: - void impl_construct( ViewShellBase& rBase ); - -private: - ToolPanelViewShell* m_pPanelViewShell; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx deleted file mode 100644 index a55f18caf41e..000000000000 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" -#include "SlideTransitionPanel.hxx" - -#include "taskpane/TaskPaneControlFactory.hxx" -#include "taskpane/ToolPanelViewShell.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" -#include <com/sun/star/frame/XModel.hpp> - -namespace sd -{ - - class ViewShellBase; - extern ::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase ); - -namespace toolpanel { namespace controls { - - - -SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell) - :SubToolPanel( i_rParentWindow ) - ,maPreferredSize( 100, 200 ) - ,m_pPanelViewShell( &i_rToolPanelShell ) -{ - mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase() ); - mpWrappedControl->Show(); -} - -SlideTransitionPanel::~SlideTransitionPanel() -{ - delete mpWrappedControl; -} - -std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) -{ - return std::auto_ptr< ControlFactory >( - new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); -} - -TaskPaneShellManager* SlideTransitionPanel::GetShellManager() -{ - if ( m_pPanelViewShell ) - return &m_pPanelViewShell->GetSubShellManager(); - return SubToolPanel::GetShellManager(); -} - -Size SlideTransitionPanel::GetPreferredSize() -{ - return maPreferredSize; -} -sal_Int32 SlideTransitionPanel::GetPreferredWidth(sal_Int32 ) -{ - return maPreferredSize.Width(); -} -sal_Int32 SlideTransitionPanel::GetPreferredHeight(sal_Int32 ) -{ - return maPreferredSize.Height(); -} -::Window* SlideTransitionPanel::GetWindow() -{ - return mpWrappedControl; -} -bool SlideTransitionPanel::IsResizable() -{ - return true; -} -bool SlideTransitionPanel::IsExpandable() const -{ - return true; -} - - - - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> SlideTransitionPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - if (GetWindow() != NULL) - return GetWindow()->GetAccessible(); - else - return NULL; -} - - -} } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx deleted file mode 100644 index f29a3b02786a..000000000000 --- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -#ifndef SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX -#define SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX - -#include "taskpane/SubToolPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class ControlFactory; -class TreeNode; -class ToolPanelViewShell; -} } - -namespace sd { namespace toolpanel { namespace controls { - -class SlideTransitionPanel - : public SubToolPanel -{ -public: - SlideTransitionPanel ( - Window& i_rParentWindow, - ToolPanelViewShell& i_rToolPanelShell); - virtual ~SlideTransitionPanel (void); - - static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); - - // TreeNode overridables - virtual TaskPaneShellManager* GetShellManager(); - - // ILayoutableWindow overridables - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual ::Window* GetWindow (void); - virtual bool IsResizable (void); - virtual bool IsExpandable (void) const; - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& rxParent); - - using Window::GetWindow; - -private: - Size maPreferredSize; - ::Window* mpWrappedControl; - ToolPanelViewShell* m_pPanelViewShell; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx deleted file mode 100644 index 161b6165005d..000000000000 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include "TableDesignPanel.hxx" - -#include "taskpane/TaskPaneControlFactory.hxx" -#include "taskpane/ToolPanelViewShell.hxx" - -#include "strings.hrc" -#include "sdresid.hxx" - -namespace sd -{ - - class ViewShellBase; - extern ::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase ); - -namespace toolpanel { namespace controls { - - -TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell ) - :SubToolPanel( i_rParentWindow ) - ,m_pPanelViewShell( &i_rPanelViewShell ) -{ - mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() ); - mpWrappedControl->Show(); -} - -TableDesignPanel::~TableDesignPanel() -{ - delete mpWrappedControl; -} - -std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell ) -{ - return std::auto_ptr< ControlFactory >( - new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) ); -} - -TaskPaneShellManager* TableDesignPanel::GetShellManager() -{ - if ( m_pPanelViewShell ) - return &m_pPanelViewShell->GetSubShellManager(); - return SubToolPanel::GetShellManager(); -} - -Size TableDesignPanel::GetPreferredSize() -{ - return maPreferredSize; -} -sal_Int32 TableDesignPanel::GetPreferredWidth(sal_Int32 ) -{ - return maPreferredSize.Width(); -} -sal_Int32 TableDesignPanel::GetPreferredHeight(sal_Int32 ) -{ - return maPreferredSize.Height(); -} -::Window* TableDesignPanel::GetWindow() -{ - return mpWrappedControl; -} -bool TableDesignPanel::IsResizable() -{ - return true; -} -bool TableDesignPanel::IsExpandable() const -{ - return true; -} - -::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible> TableDesignPanel::CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& ) -{ - if (GetWindow() != NULL) - return GetWindow()->GetAccessible(); - else - return NULL; -} - -} } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx deleted file mode 100644 index 73b347ca58fa..000000000000 --- a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX -#define SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX - -#include "taskpane/SubToolPanel.hxx" - -namespace sd { -class ViewShellBase; -} - -namespace sd { namespace toolpanel { -class TreeNode; -class ControlFactory; -class ToolPanelViewShell; -} } - -namespace sd { namespace toolpanel { namespace controls { - -class TableDesignPanel - : public SubToolPanel -{ -public: - TableDesignPanel ( - ::Window& i_rParentWindow, - ToolPanelViewShell& i_rPanelViewShell); - virtual ~TableDesignPanel (void); - - static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell); - - // TreeNode overridables - virtual TaskPaneShellManager* GetShellManager(); - - // ILayoutableWindow overridables - virtual Size GetPreferredSize (void); - virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); - virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); - virtual ::Window* GetWindow (void); - virtual bool IsResizable (void); - virtual bool IsExpandable (void) const; - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject ( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible>& rxParent); - - using Window::GetWindow; -private: - Size maPreferredSize; - ::Window* mpWrappedControl; - ToolPanelViewShell* m_pPanelViewShell; -}; - -} } } // end of namespace ::sd::toolpanel::controls - -#endif diff --git a/sd/source/ui/toolpanel/makefile.mk b/sd/source/ui/toolpanel/makefile.mk deleted file mode 100644 index 7ba8276fb21e..000000000000 --- a/sd/source/ui/toolpanel/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ=..$/..$/.. - -PROJECTPCH=sd -PROJECTPCHSOURCE=$(PRJ)$/util$/sd -PRJNAME=sd -TARGET=toolpanel -ENABLE_EXCEPTIONS=TRUE -AUTOSEG=true -PRJINC=..$/slidesorter - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/ControlContainer.obj \ - $(SLO)$/ScrollPanel.obj \ - $(SLO)$/SubToolPanel.obj \ - $(SLO)$/TitleBar.obj \ - $(SLO)$/TitledControl.obj \ - $(SLO)$/TaskPaneControlFactory.obj \ - $(SLO)$/TaskPaneFocusManager.obj \ - $(SLO)$/TaskPaneShellManager.obj \ - $(SLO)$/TaskPaneTreeNode.obj \ - $(SLO)$/ToolPanel.obj \ - $(SLO)$/ToolPanelViewShell.obj \ - $(SLO)$/ToolPanelFactory.obj \ - $(SLO)$/ToolPanelUIElement.obj \ - \ - $(SLO)$/LayoutMenu.obj \ - $(SLO)$/TestMenu.obj \ - $(SLO)$/TestPanel.obj \ - $(SLO)$/SlideSorterCacheDisplay.obj - -EXCEPTIONSFILES= - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 1c14255c2362..d6f4185b7897 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -278,7 +278,7 @@ void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, c aPathURL.removeSegment(); aPathURL.removeFinalSlash(); - XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); + XColorList* pColTab = new XColorList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() ); pColTab->SetName( aURL.getName() ); if( pColTab->Load() ) { diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index 90774f68da76..8901dca17fa6 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -122,13 +122,6 @@ extern OUString BasicViewFactory_getImplementationName(void) throw (uno::Runtime extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void) throw (uno::RuntimeException); -extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance( - const uno::Reference<uno::XComponentContext>& rxContext) - throw(uno::Exception); -extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException); -extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void) - throw (uno::RuntimeException); - extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance( const uno::Reference<uno::XComponentContext>& rxContext) throw(uno::Exception); @@ -145,14 +138,13 @@ extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupported throw (uno::RuntimeException); } } +namespace sd { namespace sidebar { -namespace sd { namespace toolpanel { - -extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance( +extern uno::Reference<uno::XInterface> SAL_CALL PanelFactory_createInstance( const uno::Reference<uno::XComponentContext>& rxContext) throw(uno::Exception); -extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException); -extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void) +extern OUString PanelFactory_getImplementationName(void) throw (uno::RuntimeException); +extern uno::Sequence<OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) throw (uno::RuntimeException); } } @@ -214,7 +206,7 @@ using namespace ::sd; using namespace ::sd::framework; using namespace ::sd::presenter; using namespace ::sd::slidesorter; -using namespace ::sd::toolpanel; +using namespace ::sd::sidebar; @@ -237,8 +229,7 @@ enum FactoryId BasicPaneFactoryFactoryId, BasicToolBarFactoryFactoryId, BasicViewFactoryFactoryId, - TaskPanelFactoryFactoryId, - ToolPanelFactoryFactoryId, + PanelFactoryFactoryId, ResourceIdFactoryId, PresentationFactoryProviderFactoryId, SlideRendererFactoryId, @@ -271,8 +262,7 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap; (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId; (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId; (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId; - (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId; - (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId; + (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId; (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId; (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId; (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId; @@ -402,18 +392,11 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sd::framework::BasicViewFactory_getSupportedServiceNames()); break; - case TaskPanelFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::TaskPanelFactory_createInstance, - sd::framework::TaskPanelFactory_getImplementationName(), - sd::framework::TaskPanelFactory_getSupportedServiceNames()); - break; - - case ToolPanelFactoryFactoryId: + case PanelFactoryFactoryId: xComponentFactory = ::cppu::createSingleComponentFactory( - sd::toolpanel::ToolPanelFactory_createInstance, - sd::toolpanel::ToolPanelFactory_getImplementationName(), - sd::toolpanel::ToolPanelFactory_getSupportedServiceNames()); + sd::sidebar::PanelFactory_createInstance, + sd::sidebar::PanelFactory_getImplementationName(), + sd::sidebar::PanelFactory_getSupportedServiceNames()); break; case ResourceIdFactoryId: diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 73ea33ddc795..282f7fca565f 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1230,7 +1230,7 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index a9898e40d935..6704a2127059 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -62,7 +62,7 @@ #include "PresentationViewShell.hxx" #include "FormShellManager.hxx" #include "ToolBarManager.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "Window.hxx" #include "framework/ConfigurationController.hxx" #include "DocumentRenderer.hxx" @@ -729,13 +729,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msSlideSorterURL); break; - case SID_TASKPANE: - mpImpl->SetPaneVisibility( - rRequest, - framework::FrameworkHelper::msRightPaneURL, - framework::FrameworkHelper::msTaskPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1449,11 +1442,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msLeftDrawPaneURL); break; - case SID_TASKPANE: - xResourceId = ResourceId::create( - xContext, FrameworkHelper::msRightPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, @@ -1553,8 +1541,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Set the visibility state of the toolpanel and one of its top // level panels. sal_Bool bShowToolPanel = sal_True; - toolpanel::PanelId nPanelId ( - toolpanel::PID_UNKNOWN); + sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN); bool bPanelIdGiven = false; // Extract the given arguments. @@ -1574,9 +1561,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) ID_VAL_PANEL_INDEX, sal_False); if (pPanelId != NULL) { - nPanelId = static_cast< - toolpanel::PanelId>( - pPanelId->GetValue()); + nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue()); bPanelIdGiven = true; } } @@ -1585,11 +1570,11 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Ignore the request for some combinations of panels and view // shell types. if (bPanelIdGiven - && ! (nPanelId==toolpanel::PID_LAYOUT + && ! (nPanelId==sidebar::PID_LAYOUT && mrBase.GetMainViewShell()!=NULL && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE)) { - framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel( + framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel( framework::FrameworkHelper::msLayoutTaskPanelURL); } } diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index b9a2cb9721b9..c507d00cafd2 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -47,7 +47,7 @@ #include "FrameView.hxx" #include "DrawViewShell.hxx" #include "ViewShellHint.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "framework/FrameworkHelper.hxx" #include <sfx2/bindings.hxx> @@ -148,8 +148,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( // Make the layout menu visible in the tool pane. SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True); - SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, - ::sd::toolpanel::PID_LAYOUT); + SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT); SfxViewFrame* pFrame = mrViewShell.GetViewFrame(); if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { @@ -349,7 +348,7 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // Since we have to return a view id for every possible shell type // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 0872e034a814..e8b31a17f63f 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -61,6 +61,8 @@ public: SfxShell* mpShell; ShellId mnId; ViewShellManager::SharedShellFactory mpFactory; + bool mbIsListenerAddedToWindow; + ShellDescriptor (); ShellDescriptor (SfxShell* pShell, ShellId nId); ShellDescriptor (const ShellDescriptor& rDescriptor); @@ -241,7 +243,7 @@ private: ShellId nShellId, ::Window* pParentWindow, FrameView* pFrameView); - void DestroyViewShell (const ShellDescriptor& rDescriptor); + void DestroyViewShell (ShellDescriptor& rDescriptor); void DestroySubShell ( const SfxShell& rViewShell, const ShellDescriptor& rDescriptor); @@ -519,8 +521,11 @@ void ViewShellManager::Implementation::ActivateViewShell (ViewShell* pViewShell) { ::Window* pWindow = aResult.GetWindow(); if (pWindow != NULL) + { pWindow->AddEventListener( LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + aResult.mbIsListenerAddedToWindow = true; + } else { DBG_ASSERT(false, @@ -1181,6 +1186,23 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*, case VCLEVENT_WINDOW_LOSEFOCUS: break; + + case VCLEVENT_OBJECT_DYING: + // Remember that we do not have to remove the window + // listener for this window. + for (ActiveShellList::iterator + iShell(maActiveViewShells.begin()), + iEnd(maActiveViewShells.end()); + iShell!=iEnd; + ++iShell) + { + if (iShell->GetWindow() == pEventWindow) + { + iShell->mbIsListenerAddedToWindow = false; + break; + } + } + break; } } return sal_True; @@ -1225,15 +1247,19 @@ ShellDescriptor ViewShellManager::Implementation::CreateSubShell ( void ViewShellManager::Implementation::DestroyViewShell ( - const ShellDescriptor& rDescriptor) + ShellDescriptor& rDescriptor) { OSL_ASSERT(rDescriptor.mpShell != NULL); - ::Window* pWindow = rDescriptor.GetWindow(); - if (pWindow != NULL) + if (rDescriptor.mbIsListenerAddedToWindow) { - pWindow->RemoveEventListener( - LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + rDescriptor.mbIsListenerAddedToWindow = false; + ::Window* pWindow = rDescriptor.GetWindow(); + if (pWindow != NULL) + { + pWindow->RemoveEventListener( + LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + } } // Destroy the sub shell factories. @@ -1395,7 +1421,8 @@ namespace { ShellDescriptor::ShellDescriptor (void) : mpShell(NULL), mnId(0), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1407,7 +1434,8 @@ ShellDescriptor::ShellDescriptor ( ShellId nId) : mpShell(pShell), mnId(nId), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1415,9 +1443,10 @@ ShellDescriptor::ShellDescriptor ( ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) - : mpShell(rDescriptor.mpShell), - mnId(rDescriptor.mnId), - mpFactory(rDescriptor.mpFactory) + : mpShell(rDescriptor.mpShell), + mnId(rDescriptor.mnId), + mpFactory(rDescriptor.mpFactory), + mbIsListenerAddedToWindow(rDescriptor.mbIsListenerAddedToWindow) { } @@ -1426,9 +1455,13 @@ ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) ShellDescriptor& ShellDescriptor::operator= (const ShellDescriptor& rDescriptor) { - mpShell = rDescriptor.mpShell; - mnId = rDescriptor.mnId; - mpFactory = rDescriptor.mpFactory; + if (this != &rDescriptor) + { + mpShell = rDescriptor.mpShell; + mnId = rDescriptor.mnId; + mpFactory = rDescriptor.mpFactory; + mbIsListenerAddedToWindow = rDescriptor.mbIsListenerAddedToWindow; + } return *this; } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index e6bc04110ed4..343a5dfd3cae 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -39,6 +39,7 @@ #include <editeng/ulspitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/adjitem.hxx> +#include <editeng/kernitem.hxx> #include <vcl/vclenum.hxx> #include <sfx2/app.hxx> #include <svl/whiter.hxx> @@ -153,6 +154,27 @@ TextObjectBar::~TextObjectBar() SetRepeatTarget(NULL); } +void TextObjectBar::GetCharState( SfxItemSet& rSet ) +{ + SfxItemSet aCharAttrSet( mpView->GetDoc()->GetPool() ); + mpView->GetAttributes( aCharAttrSet ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END); + + aNewAttr.Put(aCharAttrSet, sal_False); + rSet.Put(aNewAttr, sal_False); + + SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) ); + //aKern.SetWhich(SID_ATTR_CHAR_KERNING); + rSet.Put(aKern); + + SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + } +} + /************************************************************************* |* |* Status der Attribut-Items @@ -183,6 +205,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_STRIKEOUT: { SvxScriptSetItem aSetItem( nSlotId, GetPool() ); aSetItem.GetItemSet().Put( aAttrSet, sal_False ); @@ -464,6 +488,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } // Absatzausrichtung + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + rSet.Put(aLR); SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust(); switch( eAdj ) { @@ -483,6 +509,13 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) break; } + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + Invalidate(SID_ATTR_PARA_LINESPACE); + Invalidate(SID_ATTR_PARA_ULSPACE); + // paragraph text direction if( bDisableParagraphTextDirection ) { @@ -547,6 +580,17 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } } */ + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + Invalidate(SID_ATTR_PARA_LRSPACE); + //Added by xuxu + SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet. Get( EE_PARA_SBL ) ).GetPropLineSpace(); switch( nLineSpace ) diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index eeffc210fa89..275ceee0526a 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -241,6 +241,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_LEFT: + case SID_ATTR_PARA_LEFT: { if (pOLV) { @@ -256,6 +257,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_RIGHT: + case SID_ATTR_PARA_RIGHT: { if (pOLV) { @@ -270,6 +272,22 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_ATTR_PARA_LRSPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_OUTLINE_UP: { if (pOLV) @@ -585,6 +603,71 @@ void TextObjectBar::Execute( SfxRequest &rReq ) rReq.Done( aNewAttr ); pArgs = rReq.GetArgs(); } + else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT || + nSlot == SID_ATTR_PARA_ADJUST_CENTER || + nSlot == SID_ATTR_PARA_ADJUST_RIGHT || + nSlot == SID_ATTR_PARA_ADJUST_BLOCK) + { + switch( nSlot ) + { + case SID_ATTR_PARA_ADJUST_LEFT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); + } + break; + } + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_ATTR_CHAR_KERNING) + { + aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_SET_SUPER_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if( nSlot == SID_SET_SUB_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } mpView->SetAttributes(*pArgs); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 7cc906faa92b..cea20a02f767 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -63,6 +63,26 @@ #include <svx/xlnedwit.hxx> #include <svx/fontworkbar.hxx> +#include <editeng/escpitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crsditem.hxx> +#include <editeng/cntritem.hxx> +#include <editeng/shdditem.hxx> +#include <svx/xtable.hxx> +#include <svx/svdobj.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brshitem.hxx> + +#include <svl/whiter.hxx> + #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -84,6 +104,7 @@ #include "unmodpg.hxx" #include "slideshow.hxx" #include "fuvect.hxx" +#include "futext.hxx" #include "stlpool.hxx" // #90356# @@ -135,12 +156,19 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: case SID_ATTR_LINEEND_STYLE: + case SID_ATTR_LINE_START: + case SID_ATTR_LINE_END: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_TEXT_FITTOSIZE: { @@ -287,12 +315,17 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON ); break; case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON ); break; case SID_ATTR_TEXT_FITTOSIZE: @@ -985,7 +1018,176 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } } +void DrawViewShell::ExecChar( SfxRequest &rReq ) +{ + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aEditAttr( pDoc->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + //modified by wj for sym2_1580, if put old itemset into new set, + //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item + // and use old attr to update all the attributes +// SfxItemSet aNewAttr( GetPool(), +// EE_ITEMS_START, EE_ITEMS_END ); +// aNewAttr.Put( aEditAttr, sal_False ); + SfxItemSet aNewAttr( pDoc->GetPool() ); + //modified end + + sal_uInt16 nSId = rReq.GetSlot(); + + MapSlot( nSId ); + + switch ( nSId ) + { + case SID_ATTR_CHAR_FONT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_FONTHEIGHT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_WEIGHT: + if( rReq.GetArgs() ) + { + //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_POSTURE: + if( rReq.GetArgs() ) + { + //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_UNDERLINE: + if( rReq.GetArgs() ) + { + //<<modify by wj for sym2_1873 + //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + //end>> + if (pItem) + { + aNewAttr.Put(*pItem); + } + else + { + FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); + }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) ); + } + break; + case SID_ATTR_CHAR_SHADOWED: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_COLOR: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_KERNING: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_SET_SUB_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SET_SUPER_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SHRINK_FONT_SIZE: + case SID_GROW_FONT_SIZE: + //if (rReq.GetArgs()) + { + const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFonts->GetFontList(); + if( pFontList ) + { + FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView ); + GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + } + default: + ; + } + mpDrawView->SetAttributes(aNewAttr); + rReq.Done(); + Cancel(); +} /** This method consists basically of three parts: @@ -1011,4 +1213,86 @@ SdPage* DrawViewShell::CreateOrDuplicatePage ( return pNewPage; } +void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq) +{ + if(SlideShow::IsRunning( GetViewShellBase() )) + return; + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + sal_uInt16 nSId = rReq.GetSlot(); + SfxItemSet aAttrs( pDoc->GetPool() ); + + switch ( nSId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSId == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSId == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + aAttrs.Put( SdrTextVertAdjustItem(eTVA) ); + mpDrawView->SetAttributes(aAttrs); + + break; + } +} + +void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aAttrs( pDoc->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + while ( nWhich ) + { + sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) + ? GetPool().GetSlotId(nWhich) + : nWhich; + switch ( nSlotId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + sal_Bool bContour = sal_False; + SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + if(SFX_ITEM_DONTCARE != eVState) + { + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + sal_Bool bSet = nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP|| + nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER || + nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM; + rSet.Put(SfxBoolItem(nSlotId, bSet)); + } + else + { + rSet.Put(SfxBoolItem(nSlotId, sal_False)); + } + break; + } + nWhich = aIter.NextWhich(); + } +} + } // end of namespace sd diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index af25326bc0d5..5fee5118459f 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -32,6 +32,7 @@ #include <editeng/lrspitem.hxx> #include <editeng/protitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/adjitem.hxx> #include <svx/ruler.hxx> #ifndef _SVX_RULERITEM_HXX #include <svx/rulritem.hxx> @@ -96,7 +97,8 @@ #include <com/sun/star/drawing/framework/XConfigurationController.hpp> #include <com/sun/star/drawing/framework/XConfiguration.hpp> #include <com/sun/star/frame/XFrame.hpp> - +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::com::sun::star::frame::XFrame; @@ -677,17 +679,106 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) break; } + case SID_ATTR_PARA_LINESPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE; + SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); + aParaLineSP.SetWhich( EE_PARA_SBL ); + + aEditAttr.Put( aParaLineSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ADJUST_LEFT: + { + SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE; + SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); + aULSP.SetWhich( EE_PARA_ULSPACE ); + + aEditAttr.Put( aULSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; + case SID_ATTR_PARA_LRSPACE: { + sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + break; + } + case SID_ATTR_LRSPACE: + { if( mpDrawView->IsTextEdit() ) { sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&) pArgs->Get( nId ); - SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); - nId = EE_PARA_LRSPACE; + nId = EE_PARA_LRSPACE; SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), rItem.GetRight(), rItem.GetTxtLeft(), rItem.GetTxtFirstLineOfst(), nId ); diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index b8926729cf82..daa02e452083 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -577,7 +577,7 @@ void DrawViewShell::FuTemp04(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msCustomAnimationTaskPanelURL); Cancel(); @@ -589,7 +589,7 @@ void DrawViewShell::FuTemp04(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msSlideTransitionTaskPanelURL); Cancel(); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index cb1423cc359d..38176d4551c9 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -206,6 +206,20 @@ IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper return 0; } + + + +void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet) +{ + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + + SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() ); + rSet.Put(aSet,sal_False); +} + + + + /************************************************************************* |* |* Status (Enabled/Disabled) von Menue-SfxSlots setzen @@ -512,6 +526,8 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); } if( !mpDrawView->IsMirrorAllowed() ) diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx index 4fb718846b2a..19f42f6af338 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -118,6 +118,7 @@ void DrawViewShell::FuTemp01(SfxRequest& rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // BASIC { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); @@ -131,8 +132,24 @@ void DrawViewShell::FuTemp01(SfxRequest& rReq) Cancel(); } break; + case FN_NUM_BULLET_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + case FN_NUM_NUMBERING_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); Cancel(); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 8ecc12b695e6..48cf6e595f2a 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -57,6 +57,7 @@ #include <sfx2/dispatch.hxx> #include <svtools/cliplistener.hxx> #include <svx/float3d.hxx> +#include <svx/sidebar/SelectionAnalyzer.hxx> #include "helpids.h" #include "view/viewoverlaymanager.hxx" @@ -80,9 +81,12 @@ #include "ToolBarManager.hxx" #include "annotationmanager.hxx" +#include <boost/bind.hpp> + using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using sfx2::sidebar::EnumContext; namespace { static const ::rtl::OUString MASTER_VIEW_TOOL_BAR_NAME( @@ -137,13 +141,20 @@ void SAL_CALL ScannerEventListener::disposing( const ::com::sun::star::lang::Eve DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) : ViewShell (pFrame, pParentWindow, rViewShellBase) , maTabControl(this, pParentWindow) -, mbIsInSwitchPage(false) +, mbIsInSwitchPage(false), + mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + ::boost::bind(&DrawViewShell::GetContextForSelection, this), + uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()), + sfx2::sidebar::EnumContext::Context_Default)) + { if (pFrameViewArgument != NULL) mpFrameView = pFrameViewArgument; else mpFrameView = new FrameView(GetDoc()); Construct(GetDocSh(), ePageKind); + + mpSelectionChangeHandler->Connect(); } /************************************************************************* @@ -154,6 +165,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas DrawViewShell::~DrawViewShell() { + mpSelectionChangeHandler->Disconnect(); + mpAnnotationManager.reset(); mpViewOverlayManager.reset(); @@ -853,4 +866,20 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) } +EnumContext::Context DrawViewShell::GetContextForSelection (void) const +{ + if (mpDrawView->GetMarkedObjectList().GetMarkCount() == 1) + if (mpDrawView->GetTextEditObject() != NULL) + if (mpDrawView->GetTextEditOutlinerView() != NULL) + return EnumContext::Context_DrawText; + + // All other cases are handled by the SelectionAnalyzer. + return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD( + mpDrawView->GetMarkedObjectList(), + meEditMode == EM_MASTERPAGE, + mePageKind == PK_HANDOUT, + mePageKind == PK_NOTES); +} + + } // end of namespace sd diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index e325dc721991..23f63c667775 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -472,6 +472,7 @@ void DrawViewShell::FuTemp03(SfxRequest& rReq) break; case SID_HORIZONTAL: // BASIC + case SID_FLIP_HORIZONTAL: { mpDrawView->MirrorAllMarkedHorizontal(); Cancel(); @@ -480,6 +481,7 @@ void DrawViewShell::FuTemp03(SfxRequest& rReq) break; case SID_VERTICAL: // BASIC + case SID_FLIP_VERTICAL: { mpDrawView->MirrorAllMarkedVertical(); Cancel(); diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 91909d60dc64..6e947e03f08e 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -73,6 +73,16 @@ #include "cfgids.hxx" #include "anminfo.hxx" +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/escpitem.hxx> +#include <editeng/numitem.hxx> +#include <editeng/adjitem.hxx> +#include <svx/nbdtmgfact.hxx> +#include <svx/nbdtmg.hxx> + +using namespace svx::sidebar; using ::rtl::OUString; using namespace ::com::sun::star; @@ -302,17 +312,133 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) : nWhich; switch ( nSlotId ) { + case SID_ATTR_PARA_ADJUST_LEFT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_LEFT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_CENTER) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_RIGHT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_BLOCK) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_LRSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) ); + rSet.Put(aLineLR); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) ); + aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSP); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_TEXT_FITTOSIZE: + case SID_ATTR_CHAR_FONT: + case SID_ATTR_CHAR_FONTHEIGHT: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_UNDERLINE: + case SID_ATTR_CHAR_STRIKEOUT: + case SID_ATTR_CHAR_WEIGHT: + case SID_ATTR_CHAR_COLOR: + case SID_ATTR_CHAR_KERNING: + case SID_SET_SUB_SCRIPT: + case SID_SET_SUPER_SCRIPT: { bAttr = sal_True; } @@ -454,6 +580,118 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } } break; + case FN_BUL_NUM_RULE_INDEX: + case FN_NUM_NUM_RULE_INDEX: + { + SfxItemSet aEditAttr( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE; + + //if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + // nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); + nActNumLvl = mpDrawView->GetSelectionLevel(); + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + if ( pNumRule ) + { + sal_uInt16 nMask = 1; + sal_uInt16 nCount = 0; + sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + nCount++; + nCurLevel = i; + } + nMask <<= 1; + } + if ( nCount == 1 ) + { + sal_Bool bBullets = sal_False; + const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel); + if ( pNumFmt ) + { + switch(pNumFmt->GetNumberingType()) + { + case SVX_NUM_CHAR_SPECIAL: + case SVX_NUM_BITMAP: + bBullets = sal_True; + break; + + default: + bBullets = sal_False; + } + + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + if ( bBullets ) + { + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); + } + }else + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); + } + } + } + } + } + } + break; + //End + // Added by Li Hui for story 179. + case FN_NUM_BULLET_ON: + case FN_NUM_NUMBERING_ON: + { + sal_Bool bEnable = sal_False; + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + const sal_uInt32 nMarkCount = rMarkList.GetMarkCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj()); + if (pTextObj && pTextObj->GetObjInventor() == SdrInventor) + { + if (pTextObj->GetObjIdentifier() != OBJ_OLE2) + { + bEnable = sal_True; + break; + } + } + } + if (bEnable) + { + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False)); + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False)); + } + else + { + rSet.DisableItem(FN_NUM_BULLET_ON); + rSet.DisableItem(FN_NUM_NUMBERING_ON); + } + } + break; } nWhich = aIter.NextWhich(); } @@ -488,25 +726,45 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) nWhich = aNewIter.NextWhich(); } } + + SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } + eState = pSet->GetItemState( EE_PARA_SBL ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_SBL); + rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + } + eState = pSet->GetItemState( EE_PARA_ULSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_ULSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + } + + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); + } + else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); + } + + eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); + } delete pSet; } - -// const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); -// sal_uLong nMarkCount = rMarkList.GetMarkCount(); -// sal_Bool bDisabled = sal_False; -// -// for (sal_uLong i = 0; -// i < nMarkCount && !bDisabled && i < 50; i++) -// { -// SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); -// -// if (pObj->GetObjInventor() == E3dInventor) -// { -// bDisabled = sal_True; -// rSet.ClearItem(SDRATTR_SHADOW); -// rSet.DisableItem(SDRATTR_SHADOW); -// } -// } } diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 40366a4ee555..a94fc9e0370a 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -91,6 +91,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_TRANSPARENCE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_FLOATTRANSPARENCE ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) || @@ -189,6 +191,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { //rSet.DisableItem( SID_ATTRIBUTES_AREA ); // wieder raus! rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // Solange es JOE fehlerhaft behandelt! { // JOE: Ein Gruppenobjekt kann eben u.U. in ein PathObj gewandelt werden @@ -411,6 +415,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { //rSet.DisableItem( SID_ATTRIBUTES_AREA ); rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( !bEdgeObj ) rSet.DisableItem( SID_CONNECTION_DLG ); @@ -532,6 +538,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) rSet.DisableItem( SID_COPYOBJECTS ); rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); rSet.DisableItem( SID_GROUP ); rSet.DisableItem( SID_UNGROUP ); rSet.DisableItem( SID_NAME_GROUP ); diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index d6183f3fa066..a07d20018f0f 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -33,6 +33,7 @@ #include <svx/imapdlg.hxx> #include <svx/colrctrl.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <svx/f3dchild.hxx> #include <svx/tbxcustomshapes.hxx> @@ -89,6 +90,7 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -115,6 +117,7 @@ SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } TYPEINIT1( GraphicViewShell, DrawViewShell ); diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 5c598a814aa8..9b2a81eac98e 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -330,12 +330,16 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq) void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { - OutlineViewModelChangeGuard aGuard( *pOlView ); - + sal_uInt16 nSId = rReq.GetSlot(); + std::auto_ptr< OutlineViewModelChangeGuard > aGuard; + if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER) + { + aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) ); + } DeactivateCurrentFunction(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); - sal_uInt16 nSId = rReq.GetSlot(); + //sal_uInt16 nSId = rReq.GetSlot(); switch( nSId ) { @@ -380,6 +384,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) break; case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); Cancel(); @@ -394,6 +400,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index d856c94b0163..37ac1664edf2 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -52,6 +52,8 @@ #include <editeng/editstat.hxx> #include <svl/itempool.hxx> #include <sfx2/tplpitem.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdorect.hxx> #include <sot/formats.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -128,6 +130,7 @@ SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -230,6 +233,8 @@ OutlineViewShell::OutlineViewShell ( mpFrameView->Connect(); Construct(GetDocSh()); + + SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText)); } /************************************************************************* diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index cf096a396b27..8b2a8a888f7c 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -51,11 +51,13 @@ #include <svx/dialogs.hrc> #include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdopage.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <svx/xlndsit.hxx> #include <svx/xlineit0.hxx> #include <svx/xlnclit.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <vcl/virdev.hxx> #include "app.hrc" @@ -79,6 +81,7 @@ #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdr/contact/displayinfo.hxx> +#include <svx/svdotable.hxx> #include "EventMultiplexer.hxx" #include "ViewShellBase.hxx" #include "ViewShellManager.hxx" @@ -89,6 +92,7 @@ #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/contact/objectcontact.hxx> +#include <svx/sdr/table/tablecontroller.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <svx/unoapi.hxx> @@ -98,6 +102,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace sdr::table; namespace sd { #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED @@ -775,6 +780,10 @@ sal_Bool View::SdrBeginTextEdit( pGivenOutlinerView, bDontDeleteOutliner, bOnlyOneView, bGrabFocus); + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_DrawText); + if (bReturn) { ::Outliner* pOL = GetTextEditOutliner(); @@ -790,11 +799,15 @@ sal_Bool View::SdrBeginTextEdit( { aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV); } - pOL->SetBackgroundColor( aBackground ); + if (pOL != NULL) + pOL->SetBackgroundColor( aBackground ); } - pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); - pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + if (pOL != NULL) + { + pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); + pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + } } return(bReturn); @@ -831,10 +844,16 @@ SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally ) } } - GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() ); + GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( + sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, + (void*)xObj.get() ); if( xObj.is() ) { + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_Default); + SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() ); if( pPage ) pPage->onEndTextEdit( xObj.get() ); @@ -1314,4 +1333,167 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) } } +sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet) +{ + // If setting bullets/numbering by the dialog, always should toggle on. + if (!bBulletOnOffMode) + return sal_True; + SdrModel* pSdrModel = GetModel(); + if (!pSdrModel) + return sal_False; + + sal_Bool bToggleOn = sal_False; + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++) + { + sal_Int32 nIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + delete pOutliner; + return bToggleOn; +} + +void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) +{ + SdrModel* pSdrModel = GetModel(); + Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice()); + if (!pSdrModel || !pWindow) + return; + + sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled(); + sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet); + if ( bForceBulletOnOff ) { + bToggleOn = bBulletOnOffMode; + } + SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel); + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow); + + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) + { + sal_Int32 nIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nIndex)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + // Broadcast the object change event. + if (!pTextObj->AdjustTextFrameWidthAndHeight()) + { + pTextObj->SetChanged(); + pTextObj->BroadcastObjectChange(); + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + + if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled) + { + pSdrModel->BegUndo(); + pSdrModel->AddUndo(pUndoGroup); + pSdrModel->EndUndo(); + } + else + { + delete pUndoGroup; + } + delete pOutliner; + delete pOutlinerView; +} + } // end of namespace sd diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index b758d1bbe7bd..bc4979369437 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -91,6 +91,11 @@ #include "Window.hxx" #include "fupoor.hxx" +#include <editeng/numitem.hxx> +#include <editeng/eeitem.hxx> +#include <svl/poolitem.hxx> +#include <glob.hrc> + #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED #define SO2_DECL_SVINPLACEOBJECT_DEFINED SO2_DECL_REF(SvInPlaceObject) @@ -174,7 +179,8 @@ ViewShell::~ViewShell() { // Keep the content window from accessing in its destructor the // WindowUpdater. - mpContentWindow->SetViewShell(NULL); + if (mpContentWindow) + mpContentWindow->SetViewShell(NULL); delete mpZoomList; @@ -183,6 +189,13 @@ ViewShell::~ViewShell() if (mpImpl->mpSubShellFactory.get() != NULL) GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( this,mpImpl->mpSubShellFactory); + + if (mpContentWindow) + { + OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(), + mpContentWindow->GetParent()); + mpContentWindow.reset(); + } } @@ -794,7 +807,86 @@ void ViewShell::SetupRulers (void) } } +const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId) +{ + const SfxPoolItem* pTmpItem = NULL; + + if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET) + { + return pTmpItem; + } + else + { + nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + else + { + sal_Bool bOutliner = sal_False; + sal_Bool bTitle = sal_False; + + if( mpView ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const sal_uInt32 nCount = rMarkList.GetMarkCount(); + + for(sal_uInt32 nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId(STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + + if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pItem->GetNumRule(); + if(pRule) + { + SvxNumRule aNewRule( *pRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aNewAttr.Put(aNewItem); + } + } + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + + } + } + return pTmpItem; +} sal_Bool ViewShell::HasRuler (void) @@ -964,9 +1056,10 @@ void ViewShell::ArrangeGUIElements (void) { OSL_ASSERT (GetViewShell()!=NULL); - mpContentWindow->SetPosSizePixel( - Point(nLeft,nTop), - Size(nRight-nLeft,nBottom-nTop)); + if (mpContentWindow) + mpContentWindow->SetPosSizePixel( + Point(nLeft,nTop), + Size(nRight-nLeft,nBottom-nTop)); } // Windows in the center and rulers at the left and top side. |