[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 8 commits - basctl/uiconfig chart2/uiconfig dbaccess/uiconfig default_images/res forms/source framework/inc framework/Library_fwk.mk framework/Library_fwl.mk framework/source framework/uiconfig framework/util odk/examples offapi/com offapi/type_reference officecfg/registry qadevOOo/tests sc/uiconfig sd/uiconfig sfx2/inc sfx2/source starmath/uiconfig svtools/inc svtools/source sw/uiconfig toolkit/inc toolkit/source
Ariel Constenla-Haile
arielch at apache.org
Sat May 25 17:07:31 PDT 2013
basctl/uiconfig/basicide/toolbar/standardbar.xml | 2
chart2/uiconfig/toolbar/standardbar.xml | 2
dbaccess/uiconfig/dbapp/toolbar/toolbar.xml | 2
default_images/res/commandimagelist/lc_autopilotmenu.png |binary
default_images/res/commandimagelist/lch_autopilotmenu.png |binary
default_images/res/commandimagelist/sc_autopilotmenu.png |binary
default_images/res/commandimagelist/sch_autopilotmenu.png |binary
forms/source/component/ImageControl.cxx | 8
framework/Library_fwk.mk | 5
framework/Library_fwl.mk | 1
framework/inc/uielement/popupmenucontroller.hxx | 76 -
framework/inc/uielement/popuptoolbarcontroller.hxx | 100 ++
framework/source/register/registerservices.cxx | 6
framework/source/register/registertemp.cxx | 4
framework/source/services/backingwindow.cxx | 197 +---
framework/source/services/backingwindow.hxx | 18
framework/source/uielement/generictoolbarcontroller.cxx | 6
framework/source/uielement/langselectionstatusbarcontroller.cxx | 3
framework/source/uielement/popupmenucontroller.cxx | 244 -----
framework/source/uielement/popuptoolbarcontroller.cxx | 415 ++++++++++
framework/source/uielement/recentfilesmenucontroller.cxx | 4
framework/source/uielement/toolbarmanager.cxx | 16
framework/uiconfig/startmodule/toolbar/standardbar.xml | 2
framework/util/fwk.component | 9
framework/util/fwl.component | 3
odk/examples/DevelopersGuide/GUI/UnoMenu2.java | 4
offapi/com/sun/star/awt/XPopupMenu.idl | 7
offapi/type_reference/types.rdb |binary
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 33
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 3
qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java | 2
sc/uiconfig/scalc/toolbar/standardbar.xml | 2
sd/uiconfig/sdraw/toolbar/standardbar.xml | 2
sd/uiconfig/simpress/toolbar/standardbar.xml | 2
sfx2/inc/sfx2/mnuitem.hxx | 12
sfx2/inc/sfx2/tbxctrl.hxx | 40
sfx2/source/appl/appreg.cxx | 2
sfx2/source/menu/mnuitem.cxx | 59 +
sfx2/source/toolbox/tbxitem.cxx | 379 ---------
starmath/uiconfig/smath/toolbar/standardbar.xml | 2
svtools/inc/svtools/toolboxcontroller.hxx | 19
svtools/source/uno/toolboxcontroller.cxx | 86 --
sw/uiconfig/sglobal/toolbar/standardbar.xml | 2
sw/uiconfig/sweb/toolbar/standardbar.xml | 2
sw/uiconfig/swform/toolbar/standardbar.xml | 2
sw/uiconfig/swreport/toolbar/standardbar.xml | 2
sw/uiconfig/swriter/toolbar/standardbar.xml | 2
sw/uiconfig/swxform/toolbar/standardbar.xml | 2
toolkit/inc/toolkit/awt/vclxmenu.hxx | 2
toolkit/source/awt/vclxmenu.cxx | 5
50 files changed, 821 insertions(+), 975 deletions(-)
New commits:
commit 273121f8d7e277e35c8e5a8aad46ef0c103ebc03
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:11:58 2013 +0000
Kill SfxAppToolBoxControl_Impl
diff --git a/sfx2/inc/sfx2/mnuitem.hxx b/sfx2/inc/sfx2/mnuitem.hxx
index 9f1dd70..edb4ac9 100644
--- a/sfx2/inc/sfx2/mnuitem.hxx
+++ b/sfx2/inc/sfx2/mnuitem.hxx
@@ -37,6 +37,9 @@ struct SfxMenuCtrlFactory;
#include <tools/string.hxx>
#include <sfx2/ctrlitem.hxx>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/util/URL.hpp>
+
class SFX2_DLLPUBLIC SfxMenuControl: public SfxControllerItem
{
//friend SvStream& operator<<( SvStream& rStream, const SfxMenuControl& rItem );
@@ -165,6 +168,15 @@ public:
SFX_DECL_MENU_CONTROL();
SfxAppMenuControl_Impl( sal_uInt16 nPos, Menu& rMenu, SfxBindings& rBindings );
~SfxAppMenuControl_Impl();
+
+ struct ExecuteInfo
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ ::com::sun::star::util::URL aTargetURL;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
+ };
+
+ DECL_STATIC_LINK( SfxAppMenuControl_Impl, ExecuteHdl_Impl, ExecuteInfo* );
};
//#endif
diff --git a/sfx2/inc/sfx2/tbxctrl.hxx b/sfx2/inc/sfx2/tbxctrl.hxx
index ebe83f5..0919690 100644
--- a/sfx2/inc/sfx2/tbxctrl.hxx
+++ b/sfx2/inc/sfx2/tbxctrl.hxx
@@ -346,46 +346,6 @@ public:
//------------------------------------------------------------------------
-class SfxAppToolBoxControl_Impl : public SfxToolBoxControl
-
-/* [Beschreibung]
-
- Interne Hilfsklasse f"ur um das Popup-Menu <AppMenu_Impl> unter Neu
- im SDT zu starten.
-*/
-
-{
-public:
- SFX_DECL_TOOLBOX_CONTROL();
- SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
- ~SfxAppToolBoxControl_Impl();
- void SetImage( const String& rFacName );
-
- struct ExecuteInfo
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
- ::com::sun::star::util::URL aTargetURL;
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
- };
-
- DECL_STATIC_LINK( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo* );
-
-protected:
- virtual void Click();
- using SfxToolBoxControl::Select;
- virtual void Select( sal_Bool );
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
- virtual SfxPopupWindow* CreatePopupWindow();
- DECL_LINK( Activate, Menu * ); // Needed to support high contrast images
-private:
- String aLastURL;
- sal_Bool bBigImages;
- PopupMenu* pMenu;
- sal_uIntPtr m_nSymbolsStyle;
- sal_Bool m_bWasHiContrastMode;
- sal_Bool m_bShowMenuImages;
-};
-
class SfxHistoryToolBoxControl_Impl : public SfxToolBoxControl
{
Timer aTimer;
diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx
index 9c752f5..62c1214 100644
--- a/sfx2/source/appl/appreg.cxx
+++ b/sfx2/source/appl/appreg.cxx
@@ -69,8 +69,6 @@ void SfxApplication::Registrations_Impl()
// Controller
SfxToolBoxControl::RegisterControl(SID_REPEAT);
SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL);
- SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT );
- SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU );
};
//--------------------------------------------------------------------
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx
index d4edbde..ad6994a 100644
--- a/sfx2/source/menu/mnuitem.cxx
+++ b/sfx2/source/menu/mnuitem.cxx
@@ -574,3 +574,62 @@ void SfxUnoMenuControl::Select()
{
pUnoCtrl->Execute();
}
+
+long Select_Impl( void* /*pHdl*/, void* pVoid )
+{
+ Menu* pMenu = (Menu*)pVoid;
+ String aURL( pMenu->GetItemCommand( pMenu->GetCurItemId() ) );
+
+ if( !aURL.Len() )
+ return 0;
+
+ Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop =
+ Reference < ::com::sun::star::frame::XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ Reference < ::com::sun::star::frame::XFrame > xFrame( xDesktop, UNO_QUERY );
+
+ URL aTargetURL;
+ aTargetURL.Complete = aURL;
+ Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
+ UNO_QUERY );
+ xTrans->parseStrict( aTargetURL );
+
+ Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
+ Reference < XDispatch > xDisp;
+ if ( xProv.is() )
+ {
+ if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL )
+ xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
+ else
+ {
+ ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii( "_blank" ) );
+ ::framework::MenuConfiguration::Attributes* pMenuAttributes =
+ (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() );
+
+ if ( pMenuAttributes )
+ aTargetFrame = pMenuAttributes->aTargetFrame;
+
+ xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 );
+ }
+ }
+
+ if ( xDisp.is() )
+ {
+ SfxAppMenuControl_Impl::ExecuteInfo* pExecuteInfo = new SfxAppMenuControl_Impl::ExecuteInfo;
+ pExecuteInfo->xDispatch = xDisp;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ pExecuteInfo->aArgs = Sequence< PropertyValue >();
+ Application::PostUserEvent( STATIC_LINK( 0, SfxAppMenuControl_Impl, ExecuteHdl_Impl), pExecuteInfo );
+ }
+
+ return sal_True;
+}
+
+
+IMPL_STATIC_LINK_NOINSTANCE( SfxAppMenuControl_Impl, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
+{
+ pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs );
+ delete pExecuteInfo;
+ return 0;
+}
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 45f7903..a8c3824 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -121,7 +121,6 @@ using namespace ::com::sun::star::ui;
//====================================================================
SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, sal_True);
-SFX_IMPL_TOOLBOX_CONTROL(SfxAppToolBoxControl_Impl, SfxStringItem);
static Window* GetTopMostParentSystemWindow( Window* pWindow )
{
@@ -1510,381 +1509,3 @@ IMPL_LINK( SfxPopupWindow, Delete, void *, EMPTYARG )
//--------------------------------------------------------------------
-SfxAppToolBoxControl_Impl::SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox )
- : SfxToolBoxControl( nSlotId, nId, rBox )
- , bBigImages( sal_False )
- , pMenu( 0 )
-{
- rBox.SetHelpId( nId, HID_TBXCONTROL_FILENEW );
- rBox.SetItemBits( nId, rBox.GetItemBits( nId ) | TIB_DROPDOWN);
-
- // Determine the current background color of the menus
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_nSymbolsStyle = rSettings.GetSymbolsStyle();
- m_bWasHiContrastMode = rSettings.GetHighContrastMode();
- m_bShowMenuImages = rSettings.GetUseImagesInMenus();
-
- SetImage( String() );
-}
-
-SfxAppToolBoxControl_Impl::~SfxAppToolBoxControl_Impl()
-{
- delete pMenu;
-}
-
-//_____________________________________________________
-/*
- it return the existing state of the given URL in the popupmenu of this toolbox control.
-
- If the given URL can be located as an action command of one menu item of the
- popup menu of this control, we return sal_True. Otherwhise we return sal_False.
- Further we return a fallback URL, in case we have to return sal_False. Because
- the outside code must select a valid item of the popup menu everytime ...
- and we define it here. By the way this m ethod was written to handle
- error situations gracefully. E.g. it can be called during creation time
- but then we have no valid menu. For this case we know another fallback URL.
- Then we return the private:factory/ URL of the default factory.
-
- @param *pMenu
- pounts to the popup menu, on which item we try to locate the given URL
- Can be NULL! Search will be supressed then.
-
- @param sURL
- the URL for searching
-
- @param pFallback
- contains the fallback URL in case we return FALSE
- Must point to valid memory!
-
- @param pImage
- contains the image of the menu for the URL.
-
- @return sal_True - if URL could be located as an item of the popup menu.
- sal_False - otherwhise.
-*/
-sal_Bool Impl_ExistURLInMenu( const PopupMenu *pMenu ,
- String &sURL ,
- String *pFallback ,
- Image *pImage )
-{
- sal_Bool bValidFallback = sal_False;
- if (pMenu && sURL.Len())
- {
- sal_uInt16 c = pMenu->GetItemCount();
- for (sal_uInt16 p=0; p<c; ++p)
- {
- sal_uInt16 nId = pMenu->GetItemId(p);
- String aCmd( pMenu->GetItemCommand(nId) );
-
- if (!bValidFallback && aCmd.Len())
- {
- *pFallback = aCmd;
- bValidFallback = sal_True;
- }
-
- if (aCmd.Search(sURL)==0)//match even if the menu command is more detailed (maybe an additional query) #i28667#
- {
- sURL = aCmd;
- *pImage = pMenu->GetItemImage( nId );
- return sal_True;
- }
- }
- }
-
- if (!bValidFallback)
- {
- *pFallback = DEFINE_CONST_UNICODE("private:factory/");
- *pFallback += String(SvtModuleOptions().GetDefaultModuleName());
- }
-
- return sal_False;
-}
-
-long Select_Impl( void* pHdl, void* pVoid );
-
-SfxPopupWindow* SfxAppToolBoxControl_Impl::CreatePopupWindow()
-{
- ToolBox& rBox = GetToolBox();
- ::Rectangle aRect( rBox.GetItemRect( GetId() ) );
-
- if ( !pMenu )
- {
- ::framework::MenuConfiguration aConf( m_xServiceManager );
- if ( m_aCommandURL.equalsAscii( ".uno:AddDirect" ))
- pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_NEWMENU );
- else
- pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_WIZARDMENU );
- }
-
- if ( pMenu )
- {
- pMenu->SetSelectHdl( Link( NULL, Select_Impl ) );
- pMenu->SetActivateHdl( LINK( this, SfxAppToolBoxControl_Impl, Activate ));
- rBox.SetItemDown( GetId(), sal_True );
- sal_uInt16 nSelected = pMenu->Execute( &rBox, aRect, POPUPMENU_EXECUTE_DOWN );
- if ( nSelected )
- {
- aLastURL = pMenu->GetItemCommand( nSelected );
- SetImage( pMenu->GetItemCommand( nSelected ) );
- }
-
- rBox.SetItemDown( GetId(), sal_False );
- }
-
- return 0;
-}
-
-void SfxAppToolBoxControl_Impl::SetImage( const String &rURL )
-{
- /* We accept URL's here only, which exist as items of our internal popup menu.
- All other ones will be ignored and a fallback is used ... */
- String aURL = rURL;
- String sFallback;
- Image aMenuImage;
- sal_Bool bValid = Impl_ExistURLInMenu(pMenu,aURL,&sFallback,&aMenuImage);
- if (!bValid)
- aURL = sFallback;
-
- sal_Bool bBig = SvtMiscOptions().AreCurrentSymbolsLarge();
- sal_Bool bHC = GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode();
- Image aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( aURL ), bBig, bHC );
- if ( !aImage )
- aImage = !!aMenuImage ? aMenuImage :
- SvFileInformationManager::GetImage( INetURLObject( aURL ), bBig, bHC );
- Size aBigSize( GetToolBox().GetDefaultImageSize() );
- if ( bBig && aImage.GetSizePixel() != aBigSize )
- {
- BitmapEx aScaleBmpEx( aImage.GetBitmapEx() );
- aScaleBmpEx.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
- GetToolBox().SetItemImage( GetId(), Image( aScaleBmpEx ) );
- }
- else
- GetToolBox().SetItemImage( GetId(), aImage );
- aLastURL = aURL;
-}
-
-void SfxAppToolBoxControl_Impl::StateChanged
-(
- sal_uInt16 nSlotId,
- SfxItemState eState,
- const SfxPoolItem* pState
-)
-{
- if ( pState && pState->ISA(SfxStringItem) )
- {
- // Important step for following SetImage() call!
- // It needs the valid pMenu item to fullfill it's specification
- // to check for supported URLs ...
- if ( !pMenu )
- {
- ::framework::MenuConfiguration aConf( m_xServiceManager );
- // This toolbox controller is used for two popup menus (new documents and wizards!). Create the correct
- // popup menu according to the slot ID our controller has been initialized with.
- if ( nSlotId == SID_NEWDOCDIRECT )
- pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_NEWMENU );
- else
- pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_WIZARDMENU );
- }
-
- GetToolBox().EnableItem( GetId(), eState != SFX_ITEM_DISABLED );
- SetImage(((const SfxStringItem*)pState)->GetValue());
- }
- else
- SfxToolBoxControl::StateChanged( nSlotId, eState, pState );
-}
-
-//--------------------------------------------------------------------
-
-void SfxAppToolBoxControl_Impl::Select( sal_Bool bMod1 )
-{
- if( aLastURL.Len() )
- {
- URL aTargetURL;
- Reference< XDispatch > xDispatch;
- Reference< XDispatchProvider > xDispatchProvider( getFrameInterface(), UNO_QUERY );
-
- if ( xDispatchProvider.is() )
- {
- aTargetURL.Complete = aLastURL;
- getURLTransformer()->parseStrict( aTargetURL );
-
- ::rtl::OUString aTarget( ::rtl::OUString::createFromAscii( "_default" ));
- if ( pMenu )
- {
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() );
-
- if ( pMenuAttributes )
- aTarget = pMenuAttributes->aTargetFrame;
- }
-
- xDispatch = xDispatchProvider->queryDispatch( aTargetURL, aTarget, 0 );
-
- if ( xDispatch.is() )
- {
- Sequence< PropertyValue > aArgs( 1 );
-
- aArgs[0].Name = ::rtl::OUString::createFromAscii( "Referer" );
- aArgs[0].Value = makeAny( ::rtl::OUString::createFromAscii( SFX_REFERER_USER ));
-
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( STATIC_LINK(0, SfxAppToolBoxControl_Impl, ExecuteHdl_Impl), pExecuteInfo );
- }
- }
- }
- else
- SfxToolBoxControl::Select( bMod1 );
-}
-
-//--------------------------------------------------------------------
-long Select_Impl( void* /*pHdl*/, void* pVoid )
-{
- Menu* pMenu = (Menu*)pVoid;
- String aURL( pMenu->GetItemCommand( pMenu->GetCurItemId() ) );
-
- if( !aURL.Len() )
- return 0;
-
- Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop =
- Reference < ::com::sun::star::frame::XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- Reference < ::com::sun::star::frame::XFrame > xFrame( xDesktop, UNO_QUERY );
-
- URL aTargetURL;
- aTargetURL.Complete = aURL;
- Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
- UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
-
- Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
- Reference < XDispatch > xDisp;
- if ( xProv.is() )
- {
- if ( aTargetURL.Protocol.compareToAscii("slot:") == COMPARE_EQUAL )
- xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- else
- {
- ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii( "_blank" ) );
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() );
-
- if ( pMenuAttributes )
- aTargetFrame = pMenuAttributes->aTargetFrame;
-
- xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 );
- }
- }
-
- if ( xDisp.is() )
- {
- SfxAppToolBoxControl_Impl::ExecuteInfo* pExecuteInfo = new SfxAppToolBoxControl_Impl::ExecuteInfo;
- pExecuteInfo->xDispatch = xDisp;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = Sequence< PropertyValue >();
- Application::PostUserEvent( STATIC_LINK( 0, SfxAppToolBoxControl_Impl, ExecuteHdl_Impl), pExecuteInfo );
- }
-
- return sal_True;
-}
-
-IMPL_LINK( SfxAppToolBoxControl_Impl, Activate, Menu *, pActMenu )
-{
- if ( pActMenu )
- {
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- sal_uIntPtr nSymbolsStyle = rSettings.GetSymbolsStyle();
- sal_Bool bIsHiContrastMode = rSettings.GetHighContrastMode();
- sal_Bool bShowMenuImages = rSettings.GetUseImagesInMenus();
-
- if (( nSymbolsStyle != m_nSymbolsStyle ) ||
- ( bIsHiContrastMode != m_bWasHiContrastMode ) ||
- ( bShowMenuImages != m_bShowMenuImages ))
- {
- m_nSymbolsStyle = nSymbolsStyle;
- m_bWasHiContrastMode = bIsHiContrastMode;
- m_bShowMenuImages = bShowMenuImages;
-
- sal_uInt16 nCount = pActMenu->GetItemCount();
- for ( sal_uInt16 nSVPos = 0; nSVPos < nCount; nSVPos++ )
- {
- sal_uInt16 nId = pActMenu->GetItemId( nSVPos );
- if ( pActMenu->GetItemType( nSVPos ) != MENUITEM_SEPARATOR )
- {
- if ( bShowMenuImages )
- {
- sal_Bool bImageSet = sal_False;
- ::rtl::OUString aImageId;
- ::framework::MenuConfiguration::Attributes* pMenuAttributes =
- (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nId );
-
- if ( pMenuAttributes )
- aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes
-
- if ( aImageId.getLength() > 0 )
- {
- Reference< ::com::sun::star::frame::XFrame > xFrame;
- Image aImage = GetImage( xFrame, aImageId, sal_False, bIsHiContrastMode );
- if ( !!aImage )
- {
- bImageSet = sal_True;
- pActMenu->SetItemImage( nId, aImage );
- }
- }
-
- String aCmd( pActMenu->GetItemCommand( nId ) );
- if ( !bImageSet && aCmd.Len() )
- {
- Image aImage = SvFileInformationManager::GetImage(
- INetURLObject(aCmd), sal_False, bIsHiContrastMode );
- if ( !!aImage )
- pActMenu->SetItemImage( nId, aImage );
- }
- }
- else
- pActMenu->SetItemImage( nId, Image() );
- }
- }
- }
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-//--------------------------------------------------------------------
-
-IMPL_STATIC_LINK_NOINSTANCE( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
-{
-/* i62706: Don't catch all exceptions. We hide all problems here and are not able
- to handle them on higher levels.
- try
- {
-*/
- // Asynchronous execution as this can lead to our own destruction!
- // Framework can recycle our current frame and the layout manager disposes all user interface
- // elements if a component gets detached from its frame!
- pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs );
-/*
-}
- catch (const ::com::sun::star::document::CorruptedFilterConfigurationException& exFilters)
- {
- throw exFilters;
- }
- catch (const Exception& )
- {
- }
-*/
- delete pExecuteInfo;
- return 0;
-}
-
-//--------------------------------------------------------------------
-
-void SfxAppToolBoxControl_Impl::Click( )
-{
-}
commit c1954d6e72071c12aa4eda412d4370a22f91f787
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:11:47 2013 +0000
Add an icon for .uno:AutoPilotMenu
diff --git a/default_images/res/commandimagelist/lc_autopilotmenu.png b/default_images/res/commandimagelist/lc_autopilotmenu.png
new file mode 100644
index 0000000..ff5ec86
Binary files /dev/null and b/default_images/res/commandimagelist/lc_autopilotmenu.png differ
diff --git a/default_images/res/commandimagelist/lch_autopilotmenu.png b/default_images/res/commandimagelist/lch_autopilotmenu.png
new file mode 100644
index 0000000..9dbb8b6
Binary files /dev/null and b/default_images/res/commandimagelist/lch_autopilotmenu.png differ
diff --git a/default_images/res/commandimagelist/sc_autopilotmenu.png b/default_images/res/commandimagelist/sc_autopilotmenu.png
new file mode 100644
index 0000000..ed92277
Binary files /dev/null and b/default_images/res/commandimagelist/sc_autopilotmenu.png differ
diff --git a/default_images/res/commandimagelist/sch_autopilotmenu.png b/default_images/res/commandimagelist/sch_autopilotmenu.png
new file mode 100644
index 0000000..4611aed
Binary files /dev/null and b/default_images/res/commandimagelist/sch_autopilotmenu.png differ
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 2ef0336..61ef187 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -458,6 +458,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Wizards</value>
</prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
</node>
<node oor:name=".uno:AutoPilotPresentations" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
commit b38a51d67373daf9a45a4701e7c760c7b3571a66
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:11:30 2013 +0000
Make .uno:Open a drop-down toolbar item
diff --git a/basctl/uiconfig/basicide/toolbar/standardbar.xml b/basctl/uiconfig/basicide/toolbar/standardbar.xml
index 9fc57c4..156b2cc 100644
--- a/basctl/uiconfig/basicide/toolbar/standardbar.xml
+++ b/basctl/uiconfig/basicide/toolbar/standardbar.xml
@@ -25,7 +25,7 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbarseparator/>
diff --git a/chart2/uiconfig/toolbar/standardbar.xml b/chart2/uiconfig/toolbar/standardbar.xml
index 126892e..34edbde 100644
--- a/chart2/uiconfig/toolbar/standardbar.xml
+++ b/chart2/uiconfig/toolbar/standardbar.xml
@@ -25,7 +25,7 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/dbaccess/uiconfig/dbapp/toolbar/toolbar.xml b/dbaccess/uiconfig/dbapp/toolbar/toolbar.xml
index c850a78..0ac83ae 100644
--- a/dbaccess/uiconfig/dbapp/toolbar/toolbar.xml
+++ b/dbaccess/uiconfig/dbapp/toolbar/toolbar.xml
@@ -25,7 +25,7 @@
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:Copy"/>
diff --git a/framework/uiconfig/startmodule/toolbar/standardbar.xml b/framework/uiconfig/startmodule/toolbar/standardbar.xml
index 858daf9..d357c72 100644
--- a/framework/uiconfig/startmodule/toolbar/standardbar.xml
+++ b/framework/uiconfig/startmodule/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:HelpIndex"/>
<toolbar:toolbaritem xlink:href=".uno:ExtendedHelp" toolbar:visible="false"/>
diff --git a/sc/uiconfig/scalc/toolbar/standardbar.xml b/sc/uiconfig/scalc/toolbar/standardbar.xml
index e922c45..7d074bb 100644
--- a/sc/uiconfig/scalc/toolbar/standardbar.xml
+++ b/sc/uiconfig/scalc/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sd/uiconfig/sdraw/toolbar/standardbar.xml b/sd/uiconfig/sdraw/toolbar/standardbar.xml
index 5dbb3b9..fc1d47a 100644
--- a/sd/uiconfig/sdraw/toolbar/standardbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sd/uiconfig/simpress/toolbar/standardbar.xml b/sd/uiconfig/simpress/toolbar/standardbar.xml
index 38ddb96..3aeb78c 100644
--- a/sd/uiconfig/simpress/toolbar/standardbar.xml
+++ b/sd/uiconfig/simpress/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/starmath/uiconfig/smath/toolbar/standardbar.xml b/starmath/uiconfig/smath/toolbar/standardbar.xml
index a6d031b..2868a18 100644
--- a/starmath/uiconfig/smath/toolbar/standardbar.xml
+++ b/starmath/uiconfig/smath/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/sglobal/toolbar/standardbar.xml b/sw/uiconfig/sglobal/toolbar/standardbar.xml
index fe6385a..8ad7b47 100644
--- a/sw/uiconfig/sglobal/toolbar/standardbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/sweb/toolbar/standardbar.xml b/sw/uiconfig/sweb/toolbar/standardbar.xml
index da71e3f..8b9d37f 100644
--- a/sw/uiconfig/sweb/toolbar/standardbar.xml
+++ b/sw/uiconfig/sweb/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/swform/toolbar/standardbar.xml b/sw/uiconfig/swform/toolbar/standardbar.xml
index fe6385a..8ad7b47 100644
--- a/sw/uiconfig/swform/toolbar/standardbar.xml
+++ b/sw/uiconfig/swform/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/swreport/toolbar/standardbar.xml b/sw/uiconfig/swreport/toolbar/standardbar.xml
index fe6385a..8ad7b47 100644
--- a/sw/uiconfig/swreport/toolbar/standardbar.xml
+++ b/sw/uiconfig/swreport/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml
index fe6385a..8ad7b47 100644
--- a/sw/uiconfig/swriter/toolbar/standardbar.xml
+++ b/sw/uiconfig/swriter/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
diff --git a/sw/uiconfig/swxform/toolbar/standardbar.xml b/sw/uiconfig/swxform/toolbar/standardbar.xml
index 9fb204e..6f442e1 100644
--- a/sw/uiconfig/swxform/toolbar/standardbar.xml
+++ b/sw/uiconfig/swxform/toolbar/standardbar.xml
@@ -26,7 +26,7 @@
<toolbar:toolbaritem xlink:href=".uno:OpenUrl" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:AddDirect"/>
<toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/>
- <toolbar:toolbaritem xlink:href=".uno:Open"/>
+ <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/>
<toolbar:toolbaritem xlink:href=".uno:Save"/>
<toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:SendMail"/>
commit 9d1015051c92900def3d465d2eb8bf179f19a398
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:11:08 2013 +0000
framework::PopupMenuController clean-up
Changed the name, it is not a PopupMenuController, but a ToolbarController that shows a PopupMenu filled at runtime by a PopupMenuController
Make it a base class for other ToolbarController components, there is no sense to make it a component by itself
Use this base class for three new pure UNO ToolbarController's
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk
index db55c57..d541867 100644
--- a/framework/Library_fwk.mk
+++ b/framework/Library_fwk.mk
@@ -112,11 +112,11 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/loadenv/loadenv \
framework/source/loadenv/targethelper \
framework/source/register/registerservices \
+ framework/source/services/ContextChangeEventMultiplexer \
framework/source/services/autorecovery \
framework/source/services/backingcomp \
framework/source/services/backingwindow \
framework/source/services/desktop \
- framework/source/services/ContextChangeEventMultiplexer \
framework/source/services/frame \
framework/source/services/modelwinservice \
framework/source/services/modulemanager \
@@ -154,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uielement/menubarmerger \
framework/source/uielement/menubarwrapper \
framework/source/uielement/objectmenucontroller \
+ framework/source/uielement/popuptoolbarcontroller \
framework/source/uielement/panelwindow \
framework/source/uielement/panelwrapper \
framework/source/uielement/progressbarwrapper \
@@ -175,8 +176,8 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
framework/source/uifactory/factoryconfiguration \
framework/source/uifactory/menubarfactory \
framework/source/uifactory/statusbarfactory \
- framework/source/uifactory/uicontrollerfactory \
framework/source/uifactory/toolboxfactory \
+ framework/source/uifactory/uicontrollerfactory \
framework/source/uifactory/uielementfactorymanager \
framework/source/uifactory/windowcontentfactorymanager \
framework/source/xml/acceleratorconfigurationreader \
diff --git a/framework/Library_fwl.mk b/framework/Library_fwl.mk
index 04aa707..3347c7c 100644
--- a/framework/Library_fwl.mk
+++ b/framework/Library_fwl.mk
@@ -73,7 +73,6 @@ $(eval $(call gb_Library_add_exception_objects,fwl,\
framework/source/uielement/langselectionmenucontroller \
framework/source/uielement/macrosmenucontroller \
framework/source/uielement/newmenucontroller \
- framework/source/uielement/popupmenucontroller \
framework/source/uielement/toolbarsmenucontroller \
))
diff --git a/framework/inc/uielement/popupmenucontroller.hxx b/framework/inc/uielement/popupmenucontroller.hxx
deleted file mode 100644
index e00ff9c..0000000
--- a/framework/inc/uielement/popupmenucontroller.hxx
+++ /dev/null
@@ -1,76 +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 __FRAMEWORK_POPUPMENUCONTROLLER_HXX_
-#define __FRAMEWORK_POPUPMENUCONTROLLER_HXX_
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-
-#include "svtools/toolboxcontroller.hxx"
-#include "boost/scoped_ptr.hpp"
-
-#include <macros/xserviceinfo.hxx>
-
-class Window;
-
-namespace framework
-{
-class PopupMenuControllerImpl;
-
-class PopupMenuController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo
-{
-public:
- PopupMenuController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
- ~PopupMenuController();
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw ();
- virtual void SAL_CALL release() throw ();
-
- // XServiceInfo
- DECLARE_XSERVICEINFO
-
- // XComponent
- virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
-
- // XStatusListener
- virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
-
- // XToolbarController
- virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
-
- bool CreatePopupMenuController() throw (::com::sun::star::uno::Exception);
-
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > mxPopupMenuController;
- ::com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu;
-};
-
-} // namespace framework
-
-#endif // __FRAMEWORK_POPUPMENUCONTROLLER_HXX_
diff --git a/framework/inc/uielement/popuptoolbarcontroller.hxx b/framework/inc/uielement/popuptoolbarcontroller.hxx
new file mode 100644
index 0000000..f42adbd
--- /dev/null
+++ b/framework/inc/uielement/popuptoolbarcontroller.hxx
@@ -0,0 +1,100 @@
+/**************************************************************
+ *
+ * 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 __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
+#define __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
+
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <macros/xserviceinfo.hxx>
+#include <svtools/toolboxcontroller.hxx>
+
+namespace framework
+{
+ class PopupMenuToolbarController : public svt::ToolboxController
+ {
+ public:
+ virtual ~PopupMenuToolbarController();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XToolbarController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ PopupMenuToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::rtl::OUString &rPopupCommand = rtl::OUString() );
+ virtual void functionExecuted( const rtl::OUString &rCommand );
+ virtual sal_uInt16 getDropDownStyle() const;
+ void createPopupMenuController();
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
+ sal_Bool m_bHasController;
+ com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > m_xPopupMenu;
+
+ private:
+ rtl::OUString m_aPopupCommand;
+ com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > m_xPopupMenuFactory;
+ com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > m_xPopupMenuController;
+ };
+
+ class OpenToolbarController : public PopupMenuToolbarController
+ {
+ public:
+ OpenToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // XServiceInfo
+ DECLARE_XSERVICEINFO
+ };
+
+ class NewToolbarController : public PopupMenuToolbarController
+ {
+ public:
+ NewToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // XServiceInfo
+ DECLARE_XSERVICEINFO
+ private:
+ void functionExecuted( const rtl::OUString &rCommand );
+ void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
+ void setItemImage( const rtl::OUString &rCommand );
+ };
+
+ class WizardsToolbarController : public PopupMenuToolbarController
+ {
+ public:
+ WizardsToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // XServiceInfo
+ DECLARE_XSERVICEINFO
+ private:
+ sal_uInt16 getDropDownStyle() const;
+ };
+}
+
+#endif
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index f7ef107..725a80f 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -85,6 +85,7 @@
#include <services/substitutepathvars.hxx>
#include <services/pathsettings.hxx>
#include <services/ContextChangeEventMultiplexer.hxx>
+#include <uielement/popuptoolbarcontroller.hxx>
COMPONENTGETIMPLEMENTATIONENVIRONMENT
@@ -127,6 +128,9 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer
IFFACTORY( ::framework::TabWindowService ) else
IFFACTORY( ::framework::SubstitutePathVariables ) else
IFFACTORY( ::framework::PathSettings ) else
- IFFACTORY( ::framework::ContextChangeEventMultiplexer )
+ IFFACTORY( ::framework::ContextChangeEventMultiplexer ) else
+ IFFACTORY( ::framework::OpenToolbarController ) else
+ IFFACTORY( ::framework::NewToolbarController ) else
+ IFFACTORY( ::framework::WizardsToolbarController )
)
diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx
index 7221950..6429624 100644
--- a/framework/source/register/registertemp.cxx
+++ b/framework/source/register/registertemp.cxx
@@ -66,7 +66,6 @@
#include <uielement/macrosmenucontroller.hxx>
#include <uielement/newmenucontroller.hxx>
#include <uielement/toolbarsmenucontroller.hxx>
-#include <uielement/popupmenucontroller.hxx>
COMPONENTGETIMPLEMENTATIONENVIRONMENT
@@ -87,6 +86,5 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper
IFFACTORY( ::framework::FooterMenuController ) else
IFFACTORY( ::framework::HeaderMenuController ) else
IFFACTORY( ::framework::LanguageSelectionMenuController ) else
- IFFACTORY( ::framework::Oxt_Handler ) else
- IFFACTORY( ::framework::PopupMenuController )
+ IFFACTORY( ::framework::Oxt_Handler )
)
diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx
deleted file mode 100644
index 4c45e4e..0000000
--- a/framework/source/uielement/popupmenucontroller.cxx
+++ /dev/null
@@ -1,244 +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_framework.hxx"
-
-#include <com/sun/star/awt/XPopupMenu.hpp>
-#include <com/sun/star/frame/XPopupMenuController.hpp>
-
-#include <toolkit/helper/vclunohelper.hxx>
-//#include <toolkit/unohlp.hxx>
-
-#include <rtl/ref.hxx>
-
-#include <vcl/toolbox.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
-
-#include "uielement/popupmenucontroller.hxx"
-#include "services.h"
-
-using rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::beans;
-
-// --------------------------------------------------------------------
-
-
-namespace framework
-{
-
-DEFINE_XSERVICEINFO_MULTISERVICE ( PopupMenuController ,
- OWeakObject ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ) ,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.framework.PopupMenuController" ) )
- )
-
-DEFINE_INIT_SERVICE ( PopupMenuController, {} )
-
-class PopupMenuControllerImpl
-{
-};
-
-//========================================================================
-// class PopupMenuController REMOVE REMOVE REMOVE
-//========================================================================
-
-PopupMenuController::PopupMenuController( const Reference< lang::XMultiServiceFactory >& rServiceManager )
-: svt::ToolboxController( rServiceManager, Reference< frame::XFrame >(), OUString() )
-{
-}
-
-// --------------------------------------------------------------------
-
-PopupMenuController::~PopupMenuController()
-{
-}
-
-// --------------------------------------------------------------------
-// XInterface
-// --------------------------------------------------------------------
-
-Any SAL_CALL PopupMenuController::queryInterface( const Type& aType ) throw (RuntimeException)
-{
- Any a( ToolboxController::queryInterface( aType ) );
- if ( a.hasValue() )
- return a;
-
- return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
-}
-
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::acquire() throw ()
-{
- ToolboxController::acquire();
-}
-
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::release() throw ()
-{
- ToolboxController::release();
-}
-
-// --------------------------------------------------------------------
-// XComponent
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::dispose() throw (RuntimeException)
-{
- if( mxPopupMenuController.is() )
- {
- Reference< XComponent > xComponent( mxPopupMenuController, UNO_QUERY );
- if( xComponent.is() )
- xComponent->dispose();
- mxPopupMenuController.clear();
- }
-
- mxPopupMenu.clear();
-
- svt::ToolboxController::dispose();
-}
-
-// --------------------------------------------------------------------
-// XStatusListener
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException )
-{
- svt::ToolboxController::statusChanged(rEvent);
- enable( rEvent.IsEnabled );
-}
-
-// --------------------------------------------------------------------
-// XToolbarController
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::execute( sal_Int16 KeyModifier ) throw (RuntimeException)
-{
- svt::ToolboxController::execute( KeyModifier );
-}
-
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::click() throw (RuntimeException)
-{
- svt::ToolboxController::click();
-}
-
-// --------------------------------------------------------------------
-
-void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException)
-{
- svt::ToolboxController::doubleClick();
-}
-
-// --------------------------------------------------------------------
-
-bool PopupMenuController::CreatePopupMenuController() throw (Exception)
-{
- Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW );
-
- Sequence< Any > aSeq( 2 );
- PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
- aPropValue.Value <<= getModuleName();
- aSeq[0] <<= aPropValue;
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
- aPropValue.Value <<= m_xFrame;
- aSeq[1] <<= aPropValue;
-
- Reference< XPropertySet > xProps( getServiceManager(), UNO_QUERY_THROW );
- Reference< XComponentContext > xComponentContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
-
- Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY );
- if ( xPopupMenuController.is() )
- {
- mxPopupMenuController = xPopupMenuController;
- return true;
- }
- return false;
-}
-
-Reference< awt::XWindow > SAL_CALL PopupMenuController::createPopupWindow() throw (RuntimeException)
-{
- ::vos::OGuard aSolarLock(Application::GetSolarMutex());
-
- Reference< awt::XWindow > xRet;
-
- try
- {
- ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
- if( !pToolBox )
- return xRet;
-
- // get selected button
- sal_uInt16 nItemId = pToolBox->GetDownItemId();
- if( !nItemId )
- return xRet;
-
- ::Rectangle aRect( pToolBox->GetItemRect( nItemId ) );
-
- if( !mxPopupMenuController.is() && !CreatePopupMenuController() )
- return xRet;
-
- if( !mxPopupMenu.is() )
- {
- mxPopupMenu = Reference< awt::XPopupMenu >( getServiceManager()->createInstance( DECLARE_ASCII( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY_THROW );
- mxPopupMenuController->setPopupMenu( mxPopupMenu );
- }
- else
- {
- mxPopupMenuController->updatePopupMenu();
-
- }
- pToolBox->SetItemDown( nItemId, sal_True );
- Reference< awt::XWindowPeer > xPeer( getParent(), UNO_QUERY_THROW );
- mxPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 );
- pToolBox->SetItemDown( nItemId, sal_False );
- }
- catch( Exception& )
- {
- }
-
- return xRet;
-}
-
-// --------------------------------------------------------------------
-
-Reference< awt::XWindow > SAL_CALL PopupMenuController::createItemWindow( const Reference< awt::XWindow >& /*Parent*/ ) throw (RuntimeException)
-{
- return Reference< awt::XWindow >();
-}
-
-// --------------------------------------------------------------------
-
-}
-
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
new file mode 100644
index 0000000..53530b3
--- /dev/null
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -0,0 +1,415 @@
+/**************************************************************
+ *
+ * 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_framework.hxx"
+
+#include <uielement/popuptoolbarcontroller.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svtools/imagemgr.hxx>
+#include <svtools/miscopt.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include <vos/mutex.hxx>
+
+#include <com/sun/star/awt/PopupMenuDirection.hpp>
+#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
+
+
+#define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList"
+
+using rtl::OUString;
+namespace css = ::com::sun::star;
+
+namespace framework
+{
+
+PopupMenuToolbarController::PopupMenuToolbarController(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const OUString &rPopupCommand )
+ : svt::ToolboxController()
+ , m_xContext( xContext )
+ , m_bHasController( sal_False )
+ , m_aPopupCommand( rPopupCommand )
+{
+}
+
+PopupMenuToolbarController::~PopupMenuToolbarController()
+{
+}
+
+void SAL_CALL PopupMenuToolbarController::dispose()
+throw ( css::uno::RuntimeException )
+{
+ svt::ToolboxController::dispose();
+
+ osl::MutexGuard aGuard( m_aMutex );
+ if( m_xPopupMenuController.is() )
+ {
+ css::uno::Reference< css::lang::XComponent > xComponent(
+ m_xPopupMenuController, css::uno::UNO_QUERY );
+ if( xComponent.is() )
+ {
+ try
+ {
+ xComponent->dispose();
+ }
+ catch (...)
+ {}
+ }
+ m_xPopupMenuController.clear();
+ }
+
+ m_xContext.clear();
+ m_xPopupMenuFactory.clear();
+ m_xPopupMenu.clear();
+}
+
+void SAL_CALL PopupMenuToolbarController::initialize(
+ const css::uno::Sequence< css::uno::Any >& aArguments )
+throw ( css::uno::Exception, css::uno::RuntimeException )
+{
+ ToolboxController::initialize( aArguments );
+
+ osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_aPopupCommand.getLength() )
+ m_aPopupCommand = m_aCommandURL;
+
+ try
+ {
+ m_xPopupMenuFactory.set(
+ css::frame::PopupMenuControllerFactory::create( m_xContext ) );
+ m_bHasController = m_xPopupMenuFactory->hasController(
+ m_aPopupCommand, getModuleName() );
+ }
+ catch (const css::uno::Exception& e)
+ {
+ OSL_TRACE( "PopupMenuToolbarController - caught an exception! %s",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ (void) e;
+ }
+
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if ( pToolBox )
+ {
+ ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( m_nToolBoxId ) );
+ ToolBoxItemBits nSetStyle( getDropDownStyle() );
+ pToolBox->SetItemBits( m_nToolBoxId,
+ m_bHasController ?
+ nCurStyle | nSetStyle :
+ nCurStyle & ~nSetStyle );
+ }
+
+}
+
+void SAL_CALL
+PopupMenuToolbarController::statusChanged(
+ const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException )
+{
+ // TODO move to base class
+
+ svt::ToolboxController::statusChanged( rEvent );
+ enable( rEvent.IsEnabled );
+}
+
+css::uno::Reference< css::awt::XWindow > SAL_CALL
+PopupMenuToolbarController::createPopupWindow()
+ throw ( css::uno::RuntimeException )
+{
+ css::uno::Reference< css::awt::XWindow > xRet;
+
+ osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_bHasController )
+ return xRet;
+
+ createPopupMenuController();
+
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if ( !pToolBox )
+ return xRet;
+
+ pToolBox->SetItemDown( m_nToolBoxId, sal_True );
+ sal_uInt16 nId = m_xPopupMenu->execute(
+ css::uno::Reference< css::awt::XWindowPeer >( getParent(), css::uno::UNO_QUERY ),
+ VCLUnoHelper::ConvertToAWTRect( pToolBox->GetItemRect( m_nToolBoxId ) ),
+ css::awt::PopupMenuDirection::EXECUTE_DEFAULT );
+ pToolBox->SetItemDown( m_nToolBoxId, sal_False );
+
+ if ( nId )
+ functionExecuted( m_xPopupMenu->getCommand( nId ) );
+
+ return xRet;
+}
+
+void PopupMenuToolbarController::functionExecuted( const OUString &/*rCommand*/)
+{
+}
+
+sal_uInt16 PopupMenuToolbarController::getDropDownStyle() const
+{
+ return TIB_DROPDOWN;
+}
+
+void PopupMenuToolbarController::createPopupMenuController()
+{
+ if( !m_bHasController )
+ return;
+
+ if ( !m_xPopupMenuController.is() )
+ {
+ css::uno::Sequence< css::uno::Any > aArgs( 2 );
+ css::beans::PropertyValue aProp;
+
+ aProp.Name = DECLARE_ASCII( "Frame" );
+ aProp.Value <<= m_xFrame;
+ aArgs[0] <<= aProp;
+
+ aProp.Name = DECLARE_ASCII( "ModuleIdentifier" );
+ aProp.Value <<= getModuleName();
+ aArgs[1] <<= aProp;
+ try
+ {
+ m_xPopupMenu.set(
+ m_xContext->getServiceManager()->createInstanceWithContext(
+ DECLARE_ASCII( "com.sun.star.awt.PopupMenu" ), m_xContext ),
+ css::uno::UNO_QUERY_THROW );
+ m_xPopupMenuController.set(
+ m_xPopupMenuFactory->createInstanceWithArgumentsAndContext(
+ m_aPopupCommand, aArgs, m_xContext), css::uno::UNO_QUERY_THROW );
+
+ m_xPopupMenuController->setPopupMenu( m_xPopupMenu );
+ }
+ catch ( const css::uno::Exception &e )
+ {
+ m_xPopupMenu.clear();
+ OSL_TRACE( "PopupMenuToolbarController - caught an exception! %s",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ (void) e;
+ }
+ }
+}
+
+DEFINE_XSERVICEINFO_MULTISERVICE_2( WizardsToolbarController,
+ ::cppu::OWeakObject,
+ DECLARE_ASCII("com.sun.star.frame.ToolbarController"),
+ DECLARE_ASCII("org.apache.openoffice.comp.framework.WizardsToolbarController")
+ )
+
+DEFINE_INIT_SERVICE( WizardsToolbarController, {} )
+
+WizardsToolbarController::WizardsToolbarController(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext )
+ : PopupMenuToolbarController( xContext )
+{
+}
+
+sal_uInt16 WizardsToolbarController::getDropDownStyle() const
+{
+ return TIB_DROPDOWNONLY;
+}
+
+DEFINE_XSERVICEINFO_MULTISERVICE_2( OpenToolbarController,
+ ::cppu::OWeakObject,
+ DECLARE_ASCII("com.sun.star.frame.ToolbarController"),
+ DECLARE_ASCII("org.apache.openoffice.comp.framework.OpenToolbarController")
+ )
+
+DEFINE_INIT_SERVICE( OpenToolbarController, {} )
+
+OpenToolbarController::OpenToolbarController(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext )
+ : PopupMenuToolbarController( xContext, DECLARE_ASCII( UNO_COMMAND_RECENT_FILE_LIST ) )
+{
+}
+
+
+DEFINE_XSERVICEINFO_MULTISERVICE_2( NewToolbarController,
+ ::cppu::OWeakObject,
+ DECLARE_ASCII("com.sun.star.frame.ToolbarController"),
+ DECLARE_ASCII("org.apache.openoffice.comp.framework.NewToolbarController")
+ )
+
+DEFINE_INIT_SERVICE( NewToolbarController, {} )
+
+NewToolbarController::NewToolbarController(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext )
+ : PopupMenuToolbarController( xContext )
+{
+}
+
+void SAL_CALL
+NewToolbarController::statusChanged(
+ const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException )
+{
+ if ( rEvent.IsEnabled )
+ {
+ OUString aState;
+ rEvent.State >>= aState;
+ // set the image even if the state is not a string
+ // this will set the image of the default module
+ setItemImage( aState );
+ }
+
+ enable( rEvent.IsEnabled );
+}
+
+void NewToolbarController::functionExecuted( const OUString &rCommand )
+{
+ setItemImage( rCommand );
+}
+
+/**
+ it return the existing state of the given URL in the popupmenu of this toolbox control.
+
+ If the given URL can be located as an action command of one menu item of the
+ popup menu of this control, we return sal_True. Otherwhise we return sal_False.
+ Further we return a fallback URL, in case we have to return sal_False. Because
+ the outside code must select a valid item of the popup menu everytime ...
+ and we define it here. By the way this m ethod was written to handle
+ error situations gracefully. E.g. it can be called during creation time
+ but then we have no valid menu. For this case we know another fallback URL.
+ Then we return the private:factory/ URL of the default factory.
+
+ @param rPopupMenu
+ pounts to the popup menu, on which item we try to locate the given URL
+ Can be NULL! Search will be supressed then.
+
+ @param sURL
+ the URL for searching
+
+ @param sFallback
+ contains the fallback URL in case we return FALSE
+ Must point to valid memory!
+
+ @param aImage
+ contains the image of the menu for the URL.
+
+ @return sal_True - if URL could be located as an item of the popup menu.
+ sal_False - otherwhise.
+*/
+static sal_Bool Impl_ExistURLInMenu(
+ const css::uno::Reference< css::awt::XPopupMenu > &rPopupMenu,
+ OUString &sURL,
+ OUString &sFallback,
+ Image &aImage )
+{
+ sal_Bool bValidFallback( sal_False );
+ sal_uInt16 nCount( 0 );
+ if ( rPopupMenu.is() && ( nCount = rPopupMenu->getItemCount() ) && sURL.getLength() )
+ {
+ for ( sal_uInt16 n = 0; n < nCount; ++n )
+ {
+ sal_uInt16 nId = rPopupMenu->getItemId( n );
+ OUString aCmd( rPopupMenu->getCommand( nId ) );
+
+ if ( !bValidFallback && aCmd.getLength() )
+ {
+ sFallback = aCmd;
+ bValidFallback = sal_True;
+ }
+
+ // match even if the menu command is more detailed
+ // (maybe an additional query) #i28667#
+ if ( aCmd.match( sURL ) )
+ {
+ sURL = aCmd;
+ const css::uno::Reference< css::graphic::XGraphic > xGraphic(
+ rPopupMenu->getItemImage( nId ) );
+ if ( xGraphic.is() )
+ aImage = Image( xGraphic );
+ return sal_True;
+ }
+ }
+ }
+
+ if ( !bValidFallback )
+ {
+ rtl::OUStringBuffer aBuffer;
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) );
+ aBuffer.append( SvtModuleOptions().GetDefaultModuleName() );
+ sFallback = aBuffer.makeStringAndClear();
+ }
+
+ return sal_False;
+}
+
+/** We accept URL's here only, which exist as items of our internal popup menu.
+ All other ones will be ignored and a fallback is used.
+ */
+void NewToolbarController::setItemImage( const OUString &rCommand )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ if ( !pToolBox )
+ return;
+
+ OUString aURL = rCommand;
+ OUString sFallback;
+ Image aMenuImage;
+
+ sal_Bool bValid( Impl_ExistURLInMenu( m_xPopupMenu, aURL, sFallback, aMenuImage ) );
+ // do not change aURL if Impl_ExistURLInMenu returned sal_False
+ // this allows later initialization of the PopupMenuController on createPopupWindow()
+ // and works even if SvFileInformationManager does not know the module
+ if ( !aURL.getLength() )
+ aURL = sFallback;
+
+ sal_Bool bBig = SvtMiscOptions().AreCurrentSymbolsLarge();
+ sal_Bool bHC = pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ INetURLObject aURLObj( aURL );
+ Image aImage = SvFileInformationManager::GetImageNoDefault( aURLObj, bBig, bHC );
+ if ( !aImage )
+ {
+ if ( !!aMenuImage )
+ aImage = aMenuImage;
+ else if ( !bValid )
+ // If SvFileInformationManager didn't know the module, try with the default
+ aImage = SvFileInformationManager::GetImageNoDefault( INetURLObject( sFallback ), bBig, bHC );
+
+ if ( !aImage )
+ aImage = SvFileInformationManager::GetImage( aURLObj, bBig, bHC );
+ }
+
+ // if everything failed, just use the image associated with the toolbar item command
+ if ( !aImage )
+ return;
+
+ Size aBigSize( pToolBox->GetDefaultImageSize() );
+ if ( bBig && aImage.GetSizePixel() != aBigSize )
+ {
+ BitmapEx aScaleBmpEx( aImage.GetBitmapEx() );
+ aScaleBmpEx.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
+ pToolBox->SetItemImage( m_nToolBoxId, Image( aScaleBmpEx ) );
+ }
+ else
+ pToolBox->SetItemImage( m_nToolBoxId, aImage );
+}
+
+
+}
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index c41c25b..1e1e17d 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -142,4 +142,13 @@
<implementation name="com.sun.star.comp.framework.TabWindowService">
<service name="com.sun.star.ui.dialogs.TabContainerWindow"/>
</implementation>
+ <implementation name="org.apache.openoffice.comp.framework.OpenToolbarController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="org.apache.openoffice.comp.framework.NewToolbarController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="org.apache.openoffice.comp.framework.WizardsToolbarController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
</component>
diff --git a/framework/util/fwl.component b/framework/util/fwl.component
index 4853f6d..d4fda5c 100644
--- a/framework/util/fwl.component
+++ b/framework/util/fwl.component
@@ -63,9 +63,6 @@
<implementation name="com.sun.star.comp.framework.OXTFileHandler">
<service name="com.sun.star.frame.ContentHandler"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.PopupMenuController">
- <service name="com.sun.star.frame.ToolbarController"/>
- </implementation>
<implementation name="com.sun.star.comp.framework.PopupMenuControllerDispatcher">
<service name="com.sun.star.frame.ProtocolHandler"/>
</implementation>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 86c10bb..6b00240 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -412,6 +412,39 @@
<value>com.sun.star.svx.UpSearchToolboxController</value>
</prop>
</node>
+ <node oor:name="org.apache.openoffice.comp.framework.OpenToolbarController" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:Open</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>org.apache.openoffice.comp.framework.OpenToolbarController</value>
+ </prop>
+ </node>
+ <node oor:name="org.apache.openoffice.comp.framework.NewToolbarController" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:AddDirect</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>org.apache.openoffice.comp.framework.NewToolbarController</value>
+ </prop>
+ </node>
+ <node oor:name="org.apache.openoffice.comp.framework.WizardsToolbarController" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:AutoPilotMenu</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>org.apache.openoffice.comp.framework.WizardsToolbarController</value>
+ </prop>
+ </node>
</node>
<node oor:name="StatusBar">
<node oor:name="c1" oor:op="replace">
commit c01a6f4f370b72f0751cf4f5c11310682e2b3248
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:10:51 2013 +0000
i121542 - css::awt::XPopupMenu::execute() needs a css::awt::Rectangle
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 3c8dd87..6f3a875 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -925,7 +925,7 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent&
if ( impl_isEmptyGraphics_nothrow() )
xMenu->enableItem( ID_CLEAR_GRAPHICS, sal_False );
- awt::Point aPos( e.X, e.Y );
+ awt::Rectangle aRect( e.X, e.Y, 0, 0 );
if ( ( e.X < 0 ) || ( e.Y < 0 ) )
{ // context menu triggered by keyboard
// position it in the center of the control
@@ -935,12 +935,12 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent&
if ( xWindow.is() )
{
awt::Rectangle aPosSize = xWindow->getPosSize();
- aPos.X = aPosSize.Width / 2;
- aPos.Y = aPosSize.Height / 2;
+ aRect.X = aPosSize.Width / 2;
+ aRect.Y = aPosSize.Height / 2;
}
}
- const sal_Int16 nResult = xMenu->execute( xWindowPeer, aPos, PopupMenuDirection::EXECUTE_DEFAULT );
+ const sal_Int16 nResult = xMenu->execute( xWindowPeer, aRect, PopupMenuDirection::EXECUTE_DEFAULT );
switch ( nResult )
{
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index b570fd6..c825ee6 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -203,7 +203,8 @@ throw (::com::sun::star::uno::RuntimeException)
//
Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY );
- sal_Int16 nId = xPopupMenu->execute( xParent, aPos, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 );
+ com::sun::star::awt::Rectangle aRect( aPos.X, aPos.Y, 0, 0 );
+ sal_Int16 nId = xPopupMenu->execute( xParent, aRect, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 );
//click "More..."
if ( nId && m_xFrame.is() )
{
diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx
index 2b9e24a..4c45e4e 100644
--- a/framework/source/uielement/popupmenucontroller.cxx
+++ b/framework/source/uielement/popupmenucontroller.cxx
@@ -66,7 +66,7 @@ class PopupMenuControllerImpl
};
//========================================================================
-// class PopupMenuController
+// class PopupMenuController REMOVE REMOVE REMOVE
//========================================================================
PopupMenuController::PopupMenuController( const Reference< lang::XMultiServiceFactory >& rServiceManager )
@@ -221,7 +221,7 @@ Reference< awt::XWindow > SAL_CALL PopupMenuController::createPopupWindow() thro
}
pToolBox->SetItemDown( nItemId, sal_True );
Reference< awt::XWindowPeer > xPeer( getParent(), UNO_QUERY_THROW );
- mxPopupMenu->execute( xPeer, awt::Point( aRect.getX(), aRect.getY() ), 0 );
+ mxPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 );
pToolBox->SetItemDown( nItemId, sal_False );
}
catch( Exception& )
diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java
index 2212c93..11d49c9 100644
--- a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java
+++ b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java
@@ -20,7 +20,7 @@
*************************************************************/
import com.sun.star.awt.MouseEvent;
-import com.sun.star.awt.Point;
+import com.sun.star.awt.Rectangle;
import com.sun.star.awt.XControl;
import com.sun.star.awt.XMouseListener;
import com.sun.star.awt.XTopWindow;
@@ -99,7 +99,7 @@ public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) {
public void mousePressed(MouseEvent mouseEvent) {
if (mouseEvent.PopupTrigger){
- Point aPos = new Point(mouseEvent.X, mouseEvent.Y);
+ Rectangle aPos = new Rectangle(mouseEvent.X, mouseEvent.Y, 0, 0);
XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, mouseEvent.Source);
getPopupMenu().execute( xControl.getPeer(), aPos, com.sun.star.awt.PopupMenuDirection.EXECUTE_DEFAULT);
}
diff --git a/offapi/com/sun/star/awt/XPopupMenu.idl b/offapi/com/sun/star/awt/XPopupMenu.idl
index 856bf62..ad2998e 100644
--- a/offapi/com/sun/star/awt/XPopupMenu.idl
+++ b/offapi/com/sun/star/awt/XPopupMenu.idl
@@ -23,7 +23,7 @@
#define __com_sun_star_awt_XPopupMenu_idl__
#include <com/sun/star/awt/KeyEvent.idl>
-#include <com/sun/star/awt/Point.idl>
+#include <com/sun/star/awt/Rectangle.idl>
#include <com/sun/star/awt/XMenu.idl>
#include <com/sun/star/graphic/XGraphic.idl>
@@ -84,7 +84,8 @@ published interface XPopupMenu: XMenu
the parent window.
@param Position
- the coordinates where the popup menu should be executed.
+ a <type>Rectangle</type> representing the coordinates system
+ where the popup menu should be executed.
@param Direction
the direction in which a popup menu will grow, as specified
@@ -94,7 +95,7 @@ published interface XPopupMenu: XMenu
returns the selected item or <code>0</code>, if cancelled.
*/
short execute( [in] XWindowPeer Parent,
- [in] Point Position,
+ [in] Rectangle Position,
[in] short Direction );
/** queries if the <type>PopupMenu</type> is being.
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index e566943..a6edadf 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java b/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java
index a94ab4d..e97666c 100644
--- a/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java
+++ b/qadevOOo/tests/java/ifc/frame/_XPopupMenuController.java
@@ -61,7 +61,7 @@ public class _XPopupMenuController extends MultiMethodTest {
System.out.println("enableItem called.");
}
- public short execute(com.sun.star.awt.XWindowPeer xWindowPeer, com.sun.star.awt.Point pos, short param) {
+ public short execute(com.sun.star.awt.XWindowPeer xWindowPeer, com.sun.star.awt.Rectangle pos, short param) {
System.out.println("execute called.");
return 0;
}
diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx
index e8c79b6..4df82c7 100644
--- a/toolkit/inc/toolkit/awt/vclxmenu.hxx
+++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx
@@ -120,7 +120,7 @@ public:
virtual ::sal_Int16 SAL_CALL getDefaultItem( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL checkItem( ::sal_Int16 nItemId, ::sal_Bool bCheck ) throw (css::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isItemChecked( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
- virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Point& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isInExecute( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL endExecute( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) throw (css::uno::RuntimeException);
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 3d6c43a..30f1973 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -578,7 +578,7 @@ throw(css::uno::RuntimeException)
sal_Int16 VCLXMenu::execute(
const css::uno::Reference< css::awt::XWindowPeer >& rxWindowPeer,
- const css::awt::Point& rPos,
+ const css::awt::Rectangle& rPos,
sal_Int16 nFlags )
throw(css::uno::RuntimeException)
{
@@ -588,9 +588,8 @@ throw(css::uno::RuntimeException)
sal_Int16 nRet = 0;
if ( mpMenu && IsPopupMenu() )
{
- const ::Point aPoint = VCLPoint( rPos );
nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ),
- ::Rectangle(aPoint,aPoint),
+ VCLRectangle( rPos ),
nFlags | POPUPMENU_NOMOUSEUPCLOSE );
}
return nRet;
commit da18984094aa5ae4a66731bf581103298b133738
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:10:31 2013 +0000
Recent file list: small fix when no documents
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index cc213d3..3ebf9bd 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -206,7 +206,9 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
{
// No recent documents => insert "no document" string
pVCLPopupMenu->InsertItem( 1, String( FwkResId( STR_NODOCUMENT ) ) );
- pVCLPopupMenu->EnableItem( 1, sal_False );
+ // Do not disable it, otherwise the Toolbar controller and MenuButton
+ // will display SV_RESID_STRING_NOSELECTIONPOSSIBLE instead of STR_NODOCUMENT
+ pVCLPopupMenu->SetItemBits( 1, pVCLPopupMenu->GetItemBits( 1 ) | MIB_NOSELECT );
}
}
}
commit cbf0812a9bcd4287af1f5db0f2c30caf1508baa6
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:10:24 2013 +0000
Recent files menu in the StartModule should be the same as in the menubar
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index b93e9d1..b7cb95a 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -46,6 +46,8 @@
#include "comphelper/sequenceashashmap.hxx"
#include "comphelper/configurationhelper.hxx"
+#include <toolkit/awt/vclxmenu.hxx>
+
#include "cppuhelper/implbase1.hxx"
#include "rtl/strbuf.hxx"
@@ -58,7 +60,7 @@
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include "com/sun/star/task/XJobExecutor.hpp"
#include "com/sun/star/util/XStringWidth.hpp"
-
+#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
@@ -66,6 +68,8 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using namespace framework;
+#define RECENT_FILE_LIST ".uno:RecentFileList"
+
#define WRITER_URL "private:factory/swriter"
#define CALC_URL "private:factory/scalc"
#define IMPRESS_WIZARD_URL "private:factory/simpress?slot=6686"
@@ -150,15 +154,18 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
mnLayoutStyle( 0 ),
mpAccExec( NULL ),
mnBtnPos( 120 ),
- mnBtnTop( 150 ),
- mpRecentMenu( NULL )
+ mnBtnTop( 150 )
{
mnColumnWidth[0] = mnColumnWidth[1] = 0;
mnTextColumnWidth[0] = mnTextColumnWidth[1] = 0;
try
{
- Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
+ mxContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
+
+ Reference<lang::XMultiServiceFactory> xConfig(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ SERVICENAME_CFGPROVIDER, mxContext), UNO_QUERY);
if( xConfig.is() )
{
Sequence<Any> args(1);
@@ -176,9 +183,22 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
mnLayoutStyle = value.get<sal_Int32>();
}
}
+
+ mxPopupMenuFactory.set(
+ frame::PopupMenuControllerFactory::create( mxContext ) );
+ // TODO If there is no PopupMenuController, the button should be a nomral one not a MenuButton
+ if ( mxPopupMenuFactory->hasController(
+ DECLARE_ASCII( RECENT_FILE_LIST ) , SERVICENAME_STARTMODULE ) )
+ {
+ mxPopupMenu.set( mxContext->getServiceManager()->createInstanceWithContext(
+ DECLARE_ASCII( "com.sun.star.awt.PopupMenu" ), mxContext ), uno::UNO_QUERY_THROW );
+ }
}
- catch (Exception& )
+ catch (const Exception& e)
{
+ OSL_TRACE( "BackingWindow - caught an exception! %s",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ (void) e;
}
String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) );
@@ -244,8 +264,24 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
BackingWindow::~BackingWindow()
{
- delete mpRecentMenu;
delete mpAccExec;
+
+ if( mxPopupMenuController.is() )
+ {
+ Reference< lang::XComponent > xComponent( mxPopupMenuController, UNO_QUERY );
+ if( xComponent.is() )
+ {
+ try
+ {
+ xComponent->dispose();
+ }
+ catch (...)
+ {}
+ }
+ mxPopupMenuController.clear();
+ }
+ mxPopupMenuFactory.clear();
+ mxPopupMenu.clear();
}
void BackingWindow::GetFocus()
@@ -275,117 +311,42 @@ void BackingWindow::DataChanged( const DataChangedEvent& rDCEvt )
void BackingWindow::prepareRecentFileMenu()
{
- if( ! mpRecentMenu )
- mpRecentMenu = new PopupMenu();
- mpRecentMenu->Clear();
- maRecentFiles.clear();
-
- // get recent file list and dispatch arguments
- Sequence< Sequence< PropertyValue > > aHistoryList( SvtHistoryOptions().GetList( ePICKLIST ) );
-
- sal_Int32 nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength();
+ if( ! mxPopupMenu.is() )
+ return;
- if( ( nPickListMenuItems > 0 ) )
+ if ( !mxPopupMenuController.is() )
{
- maRecentFiles.reserve( nPickListMenuItems );
- for ( sal_Int32 i = 0; i < nPickListMenuItems; i++ )
- {
- Sequence< PropertyValue >& rPickListEntry = aHistoryList[i];
- rtl::OUString aURL, aFilter, aFilterOpt, aTitle;
-
- for ( sal_Int32 j = 0; j < rPickListEntry.getLength(); j++ )
- {
- const Any& a = rPickListEntry[j].Value;
-
- if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_URL )
- a >>= aURL;
- else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_FILTER )
- {
- a >>= aFilter;
- sal_Int32 nPos = aFilter.indexOf( '|' );
- if ( nPos >= 0 )
- {
- if ( nPos < ( aFilter.getLength() - 1 ) )
- aFilterOpt = aFilter.copy( nPos+1 );
- aFilter = aFilter.copy( 0, nPos-1 );
- }
- }
- else if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_TITLE )
- a >>= aTitle;
- }
- maRecentFiles.push_back( LoadRecentFile() );
- maRecentFiles.back().aTargetURL = aURL;
-
- sal_Int32 nArgs = aFilterOpt.getLength() ? 4 : 3;
- Sequence< PropertyValue >& rArgsList( maRecentFiles.back().aArgSeq );
- rArgsList.realloc( nArgs );
+ uno::Sequence< uno::Any > aArgs( 2 );
+ beans::PropertyValue aProp;
- nArgs--;
- rArgsList[nArgs].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- rArgsList[nArgs].Value = makeAny( aFilter );
+ aProp.Name = DECLARE_ASCII( "Frame" );
+ aProp.Value <<= mxFrame;
+ aArgs[0] <<= aProp;
- if( aFilterOpt.getLength() )
- {
- nArgs--;
- rArgsList[nArgs].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterOptions" ));
- rArgsList[nArgs].Value = makeAny( aFilterOpt );
- }
-
- // documents in the picklist will never be opened as templates
- nArgs--;
- rArgsList[nArgs].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AsTemplate" ));
- rArgsList[nArgs].Value = makeAny( (sal_Bool) sal_False );
-
- nArgs--;
- rArgsList[nArgs].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
- rArgsList[nArgs].Value = makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:user" ) ) );
-
- // and finally create an entry in the popupmenu
- rtl::OUString aMenuTitle;
- INetURLObject aURLObj( aURL );
-
- if ( aURLObj.GetProtocol() == INET_PROT_FILE )
- {
- // Do handle file URL differently => convert it to a system
- // path and abbreviate it with a special function:
- String aFileSystemPath( aURLObj.getFSysPath( INetURLObject::FSYS_DETECT ) );
-
- rtl::OUString aSystemPath( aFileSystemPath );
- rtl::OUString aCompactedSystemPath;
-
- oslFileError nError = osl_abbreviateSystemPath( aSystemPath.pData, &aCompactedSystemPath.pData, 46, NULL );
- if ( !nError )
- aMenuTitle = String( aCompactedSystemPath );
- else
- aMenuTitle = aSystemPath;
- }
- else
- {
- // Use INetURLObject to abbreviate all other URLs
- Reference< util::XStringWidth > xStringLength( new RecentFilesStringLength() );
- aMenuTitle = aURLObj.getAbbreviated( xStringLength, 46, INetURLObject::DECODE_UNAMBIGUOUS );
- }
- rtl::OUStringBuffer aBuf( aMenuTitle.getLength() + 5 );
- if( i < 9 )
- {
- aBuf.append( sal_Unicode( '~' ) );
- aBuf.append( i+1 );
- }
- else if( i == 9 )
- aBuf.appendAscii( "1~0" );
- else
- aBuf.append( i+1 );
- aBuf.appendAscii( ": " );
- aBuf.append( aMenuTitle );
- mpRecentMenu->InsertItem( static_cast<sal_uInt16>(i+1), aBuf.makeStringAndClear() );
+ aProp.Name = DECLARE_ASCII( "ModuleIdentifier" );
+ aProp.Value <<= SERVICENAME_STARTMODULE;
+ aArgs[1] <<= aProp;
+ try
+ {
+ mxPopupMenuController.set(
+ mxPopupMenuFactory->createInstanceWithArgumentsAndContext(
+ DECLARE_ASCII( RECENT_FILE_LIST ), aArgs, mxContext),
+ uno::UNO_QUERY_THROW );
+ mxPopupMenuController->setPopupMenu( mxPopupMenu );
}
+ catch ( const Exception &e )
+ {
+ OSL_TRACE( "BackingWindow - caught an exception! %s",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ (void) e;
+ }
+
+ PopupMenu *pRecentMenu = NULL;
+ VCLXMenu* pTKMenu = VCLXMenu::GetImplementation( mxPopupMenu );
+ if ( pTKMenu )
+ pRecentMenu = dynamic_cast< PopupMenu * >( pTKMenu->GetMenu() );
+ maOpenButton.SetPopupMenu( pRecentMenu );
}
- else
- {
- String aNoDoc( FwkResId( STR_NODOCUMENT ) );
- mpRecentMenu->InsertItem( 0xffff, aNoDoc );
- }
- maOpenButton.SetPopupMenu( mpRecentMenu );
}
void BackingWindow::initBackground()
@@ -455,7 +416,6 @@ void BackingWindow::initBackground()
loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton );
maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
- maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) );
maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) );
}
@@ -1026,19 +986,6 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
return 0;
}
-IMPL_LINK( BackingWindow, SelectHdl, Button*, pButton )
-{
- if( pButton == &maOpenButton )
- {
- sal_Int32 nItem = sal_Int32(maOpenButton.GetCurItemId())-1;
- if( nItem >= 0 && nItem < sal_Int32(maRecentFiles.size()) )
- {
- Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
- dispatchURL( maRecentFiles[nItem].aTargetURL, rtl::OUString(), xFrame, maRecentFiles[nItem].aArgSeq );
- }
- }
- return 0;
-}
IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton )
{
diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx
index 5040d89..8728f78 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -35,6 +35,10 @@
#include "unotools/moduleoptions.hxx"
#include "svtools/acceleratorexecute.hxx"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XUIControllerFactory.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
#include "com/sun/star/frame/XDispatchProvider.hpp"
#include "com/sun/star/frame/XDesktop.hpp"
#include "com/sun/star/frame/XFrame.hpp"
@@ -74,16 +78,14 @@ namespace framework
class BackingWindow : public Window
{
- struct LoadRecentFile
- {
- rtl::OUString aTargetURL;
- com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgSeq;
- };
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop;
com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
- com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster;
+ com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > mxPopupMenuFactory;
+ com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > mxPopupMenuController;
+ com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu;
FixedText maWelcome;
Size maWelcomeSize;
@@ -126,9 +128,6 @@ namespace framework
long mnBtnPos;
long mnBtnTop;
- PopupMenu* mpRecentMenu;
- std::vector< LoadRecentFile > maRecentFiles;
-
static const int nItemId_Extensions = 1;
static const int nItemId_Reg = 2;
static const int nItemId_Info = 3;
@@ -154,7 +153,6 @@ namespace framework
);
DECL_LINK( ClickHdl, Button* );
- DECL_LINK( SelectHdl, Button* );
DECL_LINK( ActivateHdl, Button* );
DECL_LINK( ToolboxHdl, void* );
commit e1687ce159e787d98f79d29a3d2131cca4b6ec71
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sat May 25 22:10:02 2013 +0000
svt::ToolboxController clean-up
Some small clean-up to use the PopupMenu ToolbarController
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 8f6b8d0..285f868 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list