diff options
author | Christian Lippka <cl@openoffice.org> | 2010-03-11 18:18:08 +0100 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2010-03-11 18:18:08 +0100 |
commit | 9b03159e7030963753dcc7ff82f0b49207bd42b4 (patch) | |
tree | ed11dfcd9788b7cbb2c46d24497aa4095189316e /sd | |
parent | 7531716e6f1c08977105886102dcde4e536e0a72 (diff) |
moved toolbarmenu to svtools and reworked to non sfx2 code
Diffstat (limited to 'sd')
-rw-r--r-- | sd/prj/build.lst | 3 | ||||
-rw-r--r-- | sd/source/ui/app/layoutctrl.cxx | 123 | ||||
-rw-r--r-- | sd/source/ui/app/sddll2.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/controller/makefile.mk | 54 | ||||
-rw-r--r-- | sd/source/ui/controller/slidelayoutcontroller.cxx (renamed from sd/source/ui/dlg/layoutdialog.cxx) | 270 | ||||
-rw-r--r-- | sd/source/ui/controller/slidelayoutcontroller.hxx (renamed from sd/source/ui/inc/layoutdialog.hxx) | 46 | ||||
-rw-r--r-- | sd/source/ui/dlg/layoutdialog.hrc | 34 | ||||
-rw-r--r-- | sd/source/ui/dlg/layoutdialog.src | 55 | ||||
-rw-r--r-- | sd/source/ui/dlg/makefile.mk | 10 | ||||
-rw-r--r-- | sd/source/ui/inc/layoutctrl.hxx | 56 | ||||
-rw-r--r-- | sd/source/ui/unoidl/facreg.cxx | 36 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews6.cxx | 1 | ||||
-rw-r--r-- | sd/uiconfig/simpress/toolbar/commontaskbar.xml | 4 | ||||
-rw-r--r-- | sd/util/makefile.mk | 3 |
16 files changed, 297 insertions, 415 deletions
diff --git a/sd/prj/build.lst b/sd/prj/build.lst index bc8bf923f7e5..c8a15328d886 100644 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -26,6 +26,7 @@ sd sd\source\ui\slidesorter\model nmake - all sd_slsmodel sd_inc NULL sd sd\source\ui\slidesorter\view nmake - all sd_slsview sd_inc NULL sd sd\source\ui\slidesorter\controller nmake - all sd_slscontroller sd_sdi sd_inc NULL sd sd\source\ui\slidesorter\cache nmake - all sd_slscache sd_inc NULL +sd sd\source\ui\controller nmake - all sd_controller sd_inc NULL sd sd\source\ui\notes nmake - all sd_notes sd_inc NULL sd sd\source\ui\table nmake - all sd_table sd_inc NULL sd sd\source\filter\ppt nmake - all sd_ppt sd_inc NULL @@ -43,4 +44,4 @@ sd sd\source\ui\framework\module nmake - all sd_framework_module sd_inc N sd sd\source\ui\framework\factories nmake - all sd_framework_factories sd_inc NULL sd sd\source\ui\framework\tools nmake - all sd_framework_tools sd_inc NULL sd sd\source\ui\annotations nmake - all sd_uiannotations sd_inc NULL -sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL +sd sd\util nmake - all sd_util sd_app sd_cgm sd_core sd_dlg sd_docsh sd_eppt sd_filt sd_func sd_grf sd_unid sd_view sd_xml sd_html sd_ppt sd_accessibility sd_animations sd_toolpanel sd_toolpanel_controls sd_tools sd_slsshell sd_slsmodel sd_slsview sd_slscontroller sd_slscache sd_notes sd_controller sd_table sd_slideshow sd_presenter sd_undo sd_helper sd_framework_configuration sd_framework_module sd_framework_tools sd_framework_factories sd_text sd_annotations sd_uiannotations NULL diff --git a/sd/source/ui/app/layoutctrl.cxx b/sd/source/ui/app/layoutctrl.cxx deleted file mode 100644 index d2ca5f09d46e..000000000000 --- a/sd/source/ui/app/layoutctrl.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: tmplctrl.cxx,v $ - * - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sd.hxx" - -#include <com/sun/star/text/WritingMode.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> - -#include <vcl/menu.hxx> -#include <vcl/status.hxx> -#include <vcl/toolbox.hxx> - -#include <svl/languageoptions.hxx> -#include <svl/style.hxx> -#include <svl/stritem.hxx> -#include <svtools/miscopt.hxx> - -#include <sfx2/dispatch.hxx> - -#include <svx/toolbarmenu.hxx> - -#include "layoutdialog.hxx" -#include "sdresid.hxx" -#include "res_bmp.hrc" -#include "strings.hrc" -#include "layoutctrl.hxx" -#include "ViewShellBase.hxx" -#include "drawdoc.hxx" -#include "sdattr.hrc" -#include "app.hrc" -#include "glob.hrc" - -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; - -SFX_IMPL_TOOLBOX_CONTROL( SdLayoutControl, SfxVoidItem ); - -// class SdLayoutControl ------------------------------------------ - -SdLayoutControl::SdLayoutControl( USHORT _nSlotId, USHORT _nId, ToolBox& rTbx ) -: SfxToolBoxControl( _nSlotId, _nId, rTbx ) -{ - if( SID_INSERTPAGE != _nSlotId ) - rTbx.SetItemBits( _nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( _nId ) ); - - rTbx.Invalidate(); -} - -// ----------------------------------------------------------------------- - -SdLayoutControl::~SdLayoutControl() -{ -} - -// ----------------------------------------------------------------------- - -void SdLayoutControl::Select( BOOL bMod1 ) -{ - SfxToolBoxControl::Select( bMod1 ); -} - -// ----------------------------------------------------------------------- - -void SdLayoutControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - -// ----------------------------------------------------------------------- - -SfxPopupWindowType SdLayoutControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - -// ----------------------------------------------------------------------- - -SfxPopupWindow* SdLayoutControl::CreatePopupWindow() -{ - Window* pWin = 0; - - ToolBox& rTbx = GetToolBox(); - sd::ViewShellBase* pViewShellBase = sd::ViewShellBase::GetViewShellBase( SfxViewFrame::Current() ); - if( pViewShellBase ) - { - pWin = new sd::SdLayoutDialogContent( *pViewShellBase, &rTbx, GetSlotId() == SID_INSERTPAGE ); - if( pWin ) - StartPopupMode( pWin ); - } - return 0; -} diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index 606789ef84a9..947cc841eb71 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -89,7 +89,6 @@ #include "PaneChildWindows.hxx" #include "tmplctrl.hxx" -#include "layoutctrl.hxx" /************************************************************************* |* @@ -217,6 +216,6 @@ void SdDLL::RegisterControllers() SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); SvxSubToolBoxControl::RegisterControl(SID_OPTIMIZE_TABLE, pMod); - SdLayoutControl::RegisterControl( SID_ASSIGN_LAYOUT, pMod ); - SdLayoutControl::RegisterControl( SID_INSERTPAGE, pMod ); +// SdLayoutControl::RegisterControl( SID_ASSIGN_LAYOUT, pMod ); +// SdLayoutControl::RegisterControl( SID_INSERTPAGE, pMod ); } diff --git a/sd/source/ui/controller/makefile.mk b/sd/source/ui/controller/makefile.mk new file mode 100644 index 000000000000..4e37fbd5ea88 --- /dev/null +++ b/sd/source/ui/controller/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.21 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + + +PRJ=..$/..$/.. + +PROJECTPCH=sd +PROJECTPCHSOURCE=$(PRJ)$/util$/sd +PRJNAME=sd +TARGET=controller +ENABLE_EXCEPTIONS=TRUE +AUTOSEG=true + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/slidelayoutcontroller.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/sd/source/ui/dlg/layoutdialog.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 4d1b6a7a9f06..57fafdc7c8c0 100644 --- a/sd/source/ui/dlg/layoutdialog.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LayerDialogContent.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,44 +30,70 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/frame/status/FontHeight.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> -#include <vcl/image.hxx> +#include <memory> +#include <boost/scoped_ptr.hpp> -#include <sfx2/dockwin.hxx> -#include <sfx2/app.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/imagemgr.hxx> -#include <sfx2/tbxctrl.hxx> +#include <vos/mutex.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> #include <svl/languageoptions.hxx> +#include <svtools/ctrltool.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/toolbarmenu.hxx> #include <svtools/valueset.hxx> -#include <svx/toolbarmenu.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +#include <sfx2/imagemgr.hxx> #include "app.hrc" -#include "layoutdialog.hxx" #include "glob.hrc" #include "strings.hrc" #include "res_bmp.hrc" #include "sdresid.hxx" -#include "View.hxx" -#include "drawdoc.hxx" -#include "ViewShellBase.hxx" -#include "DrawViewShell.hxx" -#include "layoutdialog.hrc" +#include "pres.hxx" +#include "slidelayoutcontroller.hxx" + +using rtl::OUString; -using ::rtl::OUString; using namespace ::com::sun::star; -using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::text; using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::beans; + +namespace sd +{ -namespace sd { +extern ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL ); // ----------------------------------------------------------------------- +class LayoutToolbarMenu : public svtools::ToolbarMenu +{ +public: + LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage ); + virtual ~LayoutToolbarMenu(); + +protected: + DECL_LINK( SelectHdl, void * ); + +private: + SlideLayoutController& mrController; + Reference< XFrame > mxFrame; + bool mbInsertPage; + ValueSet* mpLayoutSet1; + ValueSet* mpLayoutSet2; +}; + // ----------------------------------------------------------------------- struct snewfoil_value_info @@ -130,19 +153,16 @@ static void fillLayoutValueSet( ValueSet* pValue, snewfoil_value_info* pInfo, co // ----------------------------------------------------------------------- - -SdLayoutDialogContent::SdLayoutDialogContent( ViewShellBase& rBase, ::Window* pParent, const bool bInsertPage ) -: ToolbarMenu(rBase.GetFrame()->GetTopFrame()->GetFrameInterface(), pParent, SdResId( DLG_LAYOUTDIALOG ) /*WB_CLIPCHILDREN|WB_DIALOGCONTROL|WB_SYSTEMWINDOW|WB_MOVEABLE|WB_SIZEABLE|WB_CLOSEABLE*/) -, mrBase(rBase) +LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage ) +: svtools::ToolbarMenu(xFrame, pParent, WB_CLIPCHILDREN ) +, mrController( rController ) +, mxFrame(xFrame) , mbInsertPage( bInsertPage ) , mpLayoutSet1( 0 ) , mpLayoutSet2( 0 ) -, msAssignLayout( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" ) ) { - String aTitle1( SdResId( STR_HORIZONTAL_LAYOUTS ) ); - String aTitle2( SdResId( STR_VERTICAL_LAYOUTS ) ); - - FreeResource(); + String aTitle1( SdResId( STR_GLUE_ESCDIR_HORZ ) ); + String aTitle2( SdResId( STR_GLUE_ESCDIR_VERT ) ); const Color aMenuColor( GetSettings().GetStyleSettings().GetMenuColor() ); const Color aMenuBarColor( GetSettings().GetStyleSettings().GetMenuBarColor() ); @@ -153,12 +173,12 @@ SdLayoutDialogContent::SdLayoutDialogContent( ViewShellBase& rBase, ::Window* pP SvtLanguageOptions aLanguageOptions; const bool bVerticalEnabled = aLanguageOptions.IsVerticalTextEnabled(); - SetSelectHdl( LINK( this, SdLayoutDialogContent, SelectHdl ) ); + SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); - mpLayoutSet1 = new ValueSet( this, WB_TABSTOP | /* WB_MENUSTYLEVALUESET | */ WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLayoutSet1 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); // mpLayoutSet1->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); - mpLayoutSet1->SetSelectHdl( LINK( this, SdLayoutDialogContent, SelectHdl ) ); + mpLayoutSet1->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); mpLayoutSet1->SetColCount( 4 ); mpLayoutSet1->EnableFullItemMode( FALSE ); mpLayoutSet1->SetColor( GetControlBackground() ); @@ -171,10 +191,10 @@ SdLayoutDialogContent::SdLayoutDialogContent( ViewShellBase& rBase, ::Window* pP if( bVerticalEnabled ) { - mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | /* WB_MENUSTYLEVALUESET | */ WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); // mpLayoutSet2->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); - mpLayoutSet2->SetSelectHdl( LINK( this, SdLayoutDialogContent, SelectHdl ) ); + mpLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); mpLayoutSet2->SetColCount( 4 ); mpLayoutSet2->EnableFullItemMode( FALSE ); mpLayoutSet2->SetColor( GetControlBackground() ); @@ -185,35 +205,30 @@ SdLayoutDialogContent::SdLayoutDialogContent( ViewShellBase& rBase, ::Window* pP appendEntry( 1, mpLayoutSet2 ); } - //appendSeparator(); - OUString sSlotStr; Image aSlotImage; - Reference< XFrame > xFrame( GetFrame(), UNO_QUERY ); - if( xFrame.is() ) + if( mxFrame.is() ) { if( bInsertPage ) sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) ); else sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Undo" ) ); - aSlotImage = ::GetImage( xFrame, sSlotStr, FALSE, FALSE ); - } + aSlotImage = ::GetImage( mxFrame, sSlotStr, FALSE, FALSE ); - String sSlotTitle; - if( bInsertPage ) - sSlotTitle = mrBase.RetrieveLabelFromCommand( sSlotStr ); - else - sSlotTitle = String( SdResId( STR_RESET_LAYOUT ) ); - appendEntry( 2, sSlotTitle, aSlotImage); + String sSlotTitle; + if( bInsertPage ) + sSlotTitle = ImplRetrieveLabelFromCommand( mxFrame, sSlotStr ); + else + sSlotTitle = String( SdResId( STR_RESET_LAYOUT ) ); + appendEntry( 2, sSlotTitle, aSlotImage); + } SetOutputSizePixel( getMenuSize() ); - - AddStatusListener( msAssignLayout ); } // ----------------------------------------------------------------------- -SdLayoutDialogContent::~SdLayoutDialogContent() +LayoutToolbarMenu::~LayoutToolbarMenu() { } @@ -222,7 +237,7 @@ SdLayoutDialogContent::~SdLayoutDialogContent() /* -void SdLayoutDialogContent::DataChanged( const DataChangedEvent& rDCEvt ) +void LayoutToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) { SfxDockingWindow::DataChanged( rDCEvt ); @@ -237,62 +252,125 @@ void SdLayoutDialogContent::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -/* -void SdLayoutDialogContent::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +IMPL_LINK( LayoutToolbarMenu, SelectHdl, void *, pControl ) { - if( (nSID == SID_ASSIGN_LAYOUT) && (eState != SFX_ITEM_DISABLED) ) + if ( IsInPopupMode() ) + EndPopupMode(); + + Sequence< PropertyValue > aArgs; + + AutoLayout eLayout = AUTOLAYOUT__END; + + OUString sCommandURL( mrController.getCommandURL() ); + + if( pControl == mpLayoutSet1 ) + { + eLayout = static_cast< AutoLayout >(mpLayoutSet1->GetSelectItemId()-1); + } + else if( pControl == mpLayoutSet2 ) { - const SfxUInt32Item* pStateItem = dynamic_cast< const SfxUInt32Item* >(pState); - if( pStateItem ) - { - meCurrentLayout = static_cast< AutoLayout >( pStateItem->GetValue() ); - mpLayoutSet1->SelectItem( static_cast<USHORT>(meCurrentLayout)+1 ); - } + eLayout = static_cast< AutoLayout >(mpLayoutSet2->GetSelectItemId()-1); } + + if( eLayout != AUTOLAYOUT__END ) + { + aArgs = Sequence< PropertyValue >(1); + aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WhatLayout" ) ); + aArgs[0].Value <<= (sal_Int32)eLayout; + } + else if( mbInsertPage ) + { + sCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) ); + } + + mrController.dispatchCommand( sCommandURL, aArgs ); + + return 0; } -*/ -// ----------------------------------------------------------------------- +// ==================================================================== -IMPL_LINK( SdLayoutDialogContent, SelectHdl, void *, pControl ) +OUString SlideLayoutController_getImplementationName() { - if ( IsInPopupMode() ) - EndPopupMode(); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.SlideLayoutController" )); +} - if( mrBase.GetMainViewShell().get() && mrBase.GetMainViewShell()->GetViewFrame() ) - { - if( pControl == mpLayoutSet1 ) - { - AutoLayout eLayout = static_cast< AutoLayout >(mpLayoutSet1->GetSelectItemId()-1); - - const SfxUInt32Item aItem(ID_VAL_WHATLAYOUT, eLayout); - mrBase.GetMainViewShell()->GetViewFrame()->GetBindings().GetDispatcher()->Execute(mbInsertPage ? SID_INSERTPAGE : SID_ASSIGN_LAYOUT,SFX_CALLMODE_ASYNCHRON,&aItem,0); - } - else if( pControl == mpLayoutSet2 ) - { - AutoLayout eLayout = static_cast< AutoLayout >(mpLayoutSet2->GetSelectItemId()-1); - - const SfxUInt32Item aItem(ID_VAL_WHATLAYOUT, eLayout); - mrBase.GetMainViewShell()->GetViewFrame()->GetBindings().GetDispatcher()->Execute(mbInsertPage ? SID_INSERTPAGE : SID_ASSIGN_LAYOUT,SFX_CALLMODE_ASYNCHRON,&aItem,0); - } - else - { - // reset autolayout - mrBase.GetMainViewShell()->GetViewFrame()->GetBindings().GetDispatcher()->Execute( mbInsertPage ? SID_DUPLICATE_PAGE : SID_ASSIGN_LAYOUT,SFX_CALLMODE_ASYNCHRON); - } - } +// -------------------------------------------------------------------- - return 0; +Sequence< OUString > SlideLayoutController_getSupportedServiceNames() throw( RuntimeException ) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -void SAL_CALL SdLayoutDialogContent::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +// -------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL SlideLayoutController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - if( Event.FeatureURL.Main.equals( msAssignLayout ) ) - { - sal_Int32 nLayout = 0; - Event.State >>= nLayout; - OSL_TRACE("SdLayoutDialogContent::statusChanged(%ld)", nLayout ); - } + return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" )), false ); } -} // end of namespace sd +// -------------------------------------------------------------------- + +OUString InsertSlideController_getImplementationName() +{ + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.InsertSlideController" )); +} + +// -------------------------------------------------------------------- + +Sequence< OUString > InsertSlideController_getSupportedServiceNames() throw( RuntimeException ) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; +} + +// -------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL InsertSlideController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) +{ + return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPage" )), true ); +} + +//======================================================================== +// class SlideLayoutController +//======================================================================== + +SlideLayoutController::SlideLayoutController( const Reference< lang::XMultiServiceFactory >& rServiceManager, const rtl::OUString& sCommandURL, bool bInsertPage ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), sCommandURL ) +, mbInsertPage( bInsertPage ) +{ +} + +// -------------------------------------------------------------------- + +::Window* SlideLayoutController::createPopupWindow( ::Window* pParent ) +{ + return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage ); +} + +// -------------------------------------------------------------------- +// XServiceInfo +// -------------------------------------------------------------------- + +OUString SAL_CALL SlideLayoutController::getImplementationName() throw( RuntimeException ) +{ + if( mbInsertPage ) + return InsertSlideController_getImplementationName(); + else + return SlideLayoutController_getImplementationName(); +} + +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL SlideLayoutController::getSupportedServiceNames( ) throw( RuntimeException ) +{ + if( mbInsertPage ) + return InsertSlideController_getSupportedServiceNames(); + else + return SlideLayoutController_getSupportedServiceNames(); +} + +} diff --git a/sd/source/ui/inc/layoutdialog.hxx b/sd/source/ui/controller/slidelayoutcontroller.hxx index 860b2ca8d054..9e1c1692f953 100644 --- a/sd/source/ui/inc/layoutdialog.hxx +++ b/sd/source/ui/controller/slidelayoutcontroller.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LayerDialogContent.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,42 +25,29 @@ * ************************************************************************/ -#ifndef SD_LAYOUTDIALOG_HXX -#define SD_LAYOUTDIALOG_HXX - -#include <svx/toolbarmenu.hxx> - -#include <svtools/valueset.hxx> - -#include <boost/scoped_ptr.hpp> - -class ::Window; -class ValueSet; +#ifndef __SD_SLIDELAYOUTCONTROLLER_HXX_ +#define __SD_SLIDELAYOUTCONTROLLER_HXX_ -namespace sd { +#include <svtools/popupwindowcontroller.hxx> -class ViewShellBase; +namespace sd +{ -class SdLayoutDialogContent : public ToolbarMenu +class SlideLayoutController : public svt::PopupWindowController { public: - SdLayoutDialogContent( ViewShellBase& rBase, ::Window* pParent, const bool bInsertPage ); - virtual ~SdLayoutDialogContent(); + SlideLayoutController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, const rtl::OUString& sCommandURL, bool bInsertPage ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); -protected: - DECL_LINK( SelectHdl, void * ); + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); private: - ViewShellBase& mrBase; bool mbInsertPage; - ValueSet* mpLayoutSet1; - ValueSet* mpLayoutSet2; - const rtl::OUString msAssignLayout; }; +} -} // end of namespace sd - -#endif - +#endif // __SD_SLIDELAYOUTCONTROLLER_HXX_ diff --git a/sd/source/ui/dlg/layoutdialog.hrc b/sd/source/ui/dlg/layoutdialog.hrc deleted file mode 100644 index a0a29c577831..000000000000 --- a/sd/source/ui/dlg/layoutdialog.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: printdialog.hrc,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define DLG_LAYOUTDIALOG 1347 - -#define STR_HORIZONTAL_LAYOUTS 1 -#define STR_VERTICAL_LAYOUTS 2 diff --git a/sd/source/ui/dlg/layoutdialog.src b/sd/source/ui/dlg/layoutdialog.src deleted file mode 100644 index ffadd7412565..000000000000 --- a/sd/source/ui/dlg/layoutdialog.src +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: animobjs.src,v $ - * $Revision: 1.36 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "layoutdialog.hrc" - -DockingWindow DLG_LAYOUTDIALOG -{ - Border = FALSE; - Hide = TRUE ; - SVLook = TRUE ; - Sizeable = FALSE ; - Moveable = TRUE ; - Closeable = TRUE ; - Zoomable = TRUE ; - Dockable = TRUE; - - Text [ en-US ] = "Slide Layouts" ; - - String STR_HORIZONTAL_LAYOUTS - { - Text [ en-US ] = "Horizontal" ; - }; - - String STR_VERTICAL_LAYOUTS - { - Text [ en-US ] = "Vertical" ; - }; -}; diff --git a/sd/source/ui/dlg/makefile.mk b/sd/source/ui/dlg/makefile.mk index 252950a73a5e..64762afb0648 100644 --- a/sd/source/ui/dlg/makefile.mk +++ b/sd/source/ui/dlg/makefile.mk @@ -76,9 +76,7 @@ SRC1FILES =\ LayerDialog.src \ PaneDockingWindow.src \ layeroptionsdlg.src \ - printdialog.src \ - layoutdialog.src - + printdialog.src SLOFILES = \ $(SLO)$/inspagob.obj \ @@ -127,8 +125,7 @@ SLOFILES = \ $(SLO)$/PaneChildWindows.obj \ $(SLO)$/PaneDockingWindow.obj \ $(SLO)$/PaneShells.obj \ - $(SLO)$/printdialog.obj \ - $(SLO)$/layoutdialog.obj + $(SLO)$/printdialog.obj LIB1TARGET= $(SLB)$/$(TARGET).lib @@ -155,8 +152,7 @@ LIB1OBJFILES= \ $(SLO)$/PaneChildWindows.obj \ $(SLO)$/PaneDockingWindow.obj \ $(SLO)$/PaneShells.obj \ - $(SLO)$/printdialog.obj \ - $(SLO)$/layoutdialog.obj + $(SLO)$/printdialog.obj LIB2TARGET= $(SLB)$/sdui.lib diff --git a/sd/source/ui/inc/layoutctrl.hxx b/sd/source/ui/inc/layoutctrl.hxx deleted file mode 100644 index fdd0628b49b5..000000000000 --- a/sd/source/ui/inc/layoutctrl.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: tmplctrl.hxx,v $ - * - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SD_LAYOUTCTRL_HXX -#define _SD_LAYOUTCTRL_HXX - -#include <sfx2/tbxctrl.hxx> - -class SdLayoutControl : public SfxToolBoxControl -{ -public: - SdLayoutControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~SdLayoutControl(); - - using SfxToolBoxControl::Select; - virtual void Select( BOOL bMod1 = FALSE ); - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); - - SFX_DECL_TOOLBOX_CONTROL(); - -private: - DECL_LINK( WindowEventListener, VclSimpleEvent* ); -}; - - -#endif - diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index b90832acaa51..2f1f59a1d16d 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -75,6 +75,14 @@ namespace sd extern uno::Reference< uno::XInterface > SAL_CALL RandomNode_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory ); extern OUString RandomNode__getImplementationName() throw( uno::RuntimeException ); extern uno::Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( uno::RuntimeException ); + +extern uno::Reference< uno::XInterface > SAL_CALL SlideLayoutController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory ); +extern OUString SlideLayoutController_getImplementationName() throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SlideLayoutController_getSupportedServiceNames() throw( uno::RuntimeException ); + +extern uno::Reference< uno::XInterface > SAL_CALL InsertSlideController_createInstance( const uno::Reference< lang::XMultiServiceFactory > & _rxFactory ); +extern OUString InsertSlideController_getImplementationName() throw( uno::RuntimeException ); +extern uno::Sequence< OUString > InsertSlideController_getSupportedServiceNames() throw( uno::RuntimeException ); } namespace sd { namespace framework { @@ -232,7 +240,9 @@ enum FactoryId PresenterTextViewServiceFactoryId, PresenterHelperServiceFactoryId, PresenterPreviewCacheFactoryId, - SlideSorterServiceFactoryId + SlideSorterServiceFactoryId, + SlideLayoutControllerFactoryId, + InsertSlideControllerFactoryId, }; typedef ::std::hash_map<OUString, FactoryId, comphelper::UStringHash, comphelper::UStringEqual> FactoryMap; @@ -264,6 +274,8 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap; (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId; (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId; (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId; + (*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId; + (*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId; } return spFactoryMap; }; @@ -370,6 +382,14 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( pKey, sd::slidesorter::SlideSorterService_getImplementationName(), sd::slidesorter::SlideSorterService_getSupportedServiceNames()); + writeInfo( + pKey, + sd::SlideLayoutController_getImplementationName(), + sd::SlideLayoutController_getSupportedServiceNames()); + writeInfo( + pKey, + sd::InsertSlideController_getImplementationName(), + sd::InsertSlideController_getSupportedServiceNames()); } catch (registry::InvalidRegistryException &) { @@ -545,6 +565,20 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sd::slidesorter::SlideSorterService_getSupportedServiceNames()); break; + case SlideLayoutControllerFactoryId: + xFactory = ::cppu::createSingleFactory( + xMSF, + sd::SlideLayoutController_getImplementationName(), + sd::SlideLayoutController_createInstance, + sd::SlideLayoutController_getSupportedServiceNames()); + break; + + case InsertSlideControllerFactoryId: + xFactory = ::cppu::createSingleFactory( + xMSF, + sd::InsertSlideController_getImplementationName(), + sd::InsertSlideController_createInstance, + sd::InsertSlideController_getSupportedServiceNames()); default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 431add66bc2b..e4ce8f287e19 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1264,7 +1264,7 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const return *mpImpl->mpCustomHandleManager.get(); } -::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const +::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const ::rtl::OUString& aCmdURL ) { ::rtl::OUString aLabel; @@ -1273,7 +1273,7 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager") ) ), UNO_QUERY_THROW ); - Reference< XInterface > xIfac( GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW ); + Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); @@ -1305,6 +1305,12 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const return aLabel; } +::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const +{ + Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + return ImplRetrieveLabelFromCommand( xFrame, aCmdURL ); +} + //===== ViewShellBase::Implementation ========================================= diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index f1bebd83da83..4ddc49c5efd0 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -101,8 +101,6 @@ #include <strings.hrc> -#include "layoutdialog.hxx" - using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index bb5aa18d81c5..d89bb43a0098 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -73,7 +73,6 @@ #include "AnimationChildWindow.hxx" #include "NavigatorChildWindow.hxx" #include "LayerDialogChildWindow.hxx" -#include "layoutdialog.hxx" #include "sdresid.hxx" #include "fupoor.hxx" #include "fusldlg.hxx" diff --git a/sd/uiconfig/simpress/toolbar/commontaskbar.xml b/sd/uiconfig/simpress/toolbar/commontaskbar.xml index 794f55af134b..c64a4b935717 100644 --- a/sd/uiconfig/simpress/toolbar/commontaskbar.xml +++ b/sd/uiconfig/simpress/toolbar/commontaskbar.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> <toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink"> - <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="27014" toolbar:style="radio dropdown" /> - <toolbar:toolbaritem xlink:href=".uno:AssignLayout" toolbar:helpid="27435" toolbar:style="dropdown"/> + <toolbar:toolbaritem xlink:href=".uno:InsertPage" toolbar:helpid="27014" toolbar:style="dropdown" /> + <toolbar:toolbaritem xlink:href=".uno:AssignLayout" toolbar:helpid="27435" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:PresentationLayout" toolbar:helpid="27064"/> <toolbar:toolbaritem xlink:href=".uno:DuplicatePage" toolbar:visible="false" toolbar:helpid="27342"/> <toolbar:toolbaritem xlink:href=".uno:ExpandPage" toolbar:visible="false" toolbar:helpid="27343"/> diff --git a/sd/util/makefile.mk b/sd/util/makefile.mk index d74700307291..cccaf572fa95 100644 --- a/sd/util/makefile.mk +++ b/sd/util/makefile.mk @@ -128,7 +128,8 @@ LIB3FILES= \ $(SLB)$/cgm.lib \ $(SLB)$/uitable.lib \ $(SLB)$/uiannotations.lib\ - $(SLB)$/grf.lib + $(SLB)$/grf.lib \ + $(SLB)$/controller.lib LIB5TARGET=$(SLB)$/sdraw3_2.lib LIB5FILES= \ |