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 | 4b5f01a83d670da5c37fbd070b6ab1f5b756b248 (patch) | |
tree | 4f6dca7a66663744ae4f1affd1006f42c784bb4f /sd/source | |
parent | 7242cc3a94576242d17ecd7f785049458d7a37ef (diff) |
moved toolbarmenu to svtools and reworked to non sfx2 code
Diffstat (limited to 'sd/source')
-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) | 274 | ||||
-rw-r--r-- | sd/source/ui/controller/slidelayoutcontroller.hxx (renamed from sd/source/ui/inc/layoutdialog.hxx) | 50 | ||||
-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 |
13 files changed, 295 insertions, 415 deletions
diff --git a/sd/source/ui/app/layoutctrl.cxx b/sd/source/ui/app/layoutctrl.cxx deleted file mode 100644 index 5be3d06a1..000000000 --- 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 56b44606a..d53dd3bf7 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 000000000..4e37fbd5e --- /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 5b296765b..b149add6d 100644 --- a/sd/source/ui/dlg/layoutdialog.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -1,13 +1,10 @@ /************************************************************************* * * 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 + * Copyright 2000, 2010 Oracle and/or its affiliates. * - * $RCSfile: LayerDialogContent.cxx,v $ - * $Revision: 1.7 $ + * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * @@ -26,51 +23,77 @@ * <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/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 52099c3dc..4048af942 100644 --- a/sd/source/ui/inc/layoutdialog.hxx +++ b/sd/source/ui/controller/slidelayoutcontroller.hxx @@ -1,13 +1,10 @@ /************************************************************************* * * 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 + * Copyright 2000, 2010 Oracle and/or its affiliates. * - * $RCSfile: LayerDialogContent.hxx,v $ - * $Revision: 1.4 $ + * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * @@ -26,44 +23,31 @@ * <http://www.openoffice.org/license.html> * for a copy of the LGPLv3 License. * - ************************************************************************/ - -#ifndef SD_LAYOUTDIALOG_HXX -#define SD_LAYOUTDIALOG_HXX - -#include <svx/toolbarmenu.hxx> - -#include <svtools/valueset.hxx> + ************************************************************************/ -#include <boost/scoped_ptr.hpp> +#ifndef __SD_SLIDELAYOUTCONTROLLER_HXX_ +#define __SD_SLIDELAYOUTCONTROLLER_HXX_ -class ::Window; -class ValueSet; +#include <svtools/popupwindowcontroller.hxx> -namespace sd { - -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 d6a0d9894..000000000 --- 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 0f616113c..000000000 --- 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 252950a73..64762afb0 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 e9b7e848e..000000000 --- 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 b6cf0f75d..9a7fdb8e8 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 90a920ad2..f5da0c7e2 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 336cdef06..d8c766d5a 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 2a5ca3780..e8bd90493 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" |