summaryrefslogtreecommitdiff
path: root/framework/source/classes
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-09-08 04:57:32 +0000
committerOliver Bolte <obo@openoffice.org>2009-09-08 04:57:32 +0000
commit6664cb3f24f87ca83f891d9940b3b51bf209acc8 (patch)
tree50b08ac7742f01a57002e02b5034c5e84f56e866 /framework/source/classes
parent47ba649c43ed59963c33b6786b7dde30864e298e (diff)
CWS-TOOLING: integrate CWS oj18
2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass
Diffstat (limited to 'framework/source/classes')
-rw-r--r--framework/source/classes/addonmenu.cxx15
-rw-r--r--framework/source/classes/addonsoptions.cxx2
-rw-r--r--framework/source/classes/bmkmenu.cxx23
-rw-r--r--framework/source/classes/framelistanalyzer.cxx6
-rw-r--r--framework/source/classes/fwktabwindow.cxx19
-rwxr-xr-xframework/source/classes/fwlresid.cxx68
-rw-r--r--framework/source/classes/imagewrapper.cxx86
-rw-r--r--framework/source/classes/makefile.mk1
-rw-r--r--framework/source/classes/menumanager.cxx553
-rw-r--r--framework/source/classes/propertysethelper.cxx3
-rw-r--r--framework/source/classes/protocolhandlercache.cxx15
-rw-r--r--framework/source/classes/taskcreator.cxx3
12 files changed, 254 insertions, 540 deletions
diff --git a/framework/source/classes/addonmenu.cxx b/framework/source/classes/addonmenu.cxx
index aac8ba9489..35b61510ce 100644
--- a/framework/source/classes/addonmenu.cxx
+++ b/framework/source/classes/addonmenu.cxx
@@ -39,7 +39,7 @@
#include <general.h>
#include <macros/debug/assertion.hxx>
#include <helper/imageproducer.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -106,23 +106,12 @@ sal_Bool AddonPopupMenu::IsCommandURLPrefix( const ::rtl::OUString& aCmdURL )
}
AddonPopupMenu::AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ) :
- m_xFrame( rFrame )
+ AddonMenu( rFrame )
{
}
AddonPopupMenu::~AddonPopupMenu()
{
- for ( USHORT i = 0; i < GetItemCount(); i++ )
- {
- if ( GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- // delete user attributes created with new!
- USHORT nId = GetItemId( i );
- MenuConfiguration::Attributes* pUserAttributes = (MenuConfiguration::Attributes*)GetUserValue( nId );
- delete pUserAttributes;
- delete GetPopupMenu( nId );
- }
- }
}
// ------------------------------------------------------------------------
diff --git a/framework/source/classes/addonsoptions.cxx b/framework/source/classes/addonsoptions.cxx
index 26de1c7b24..b94d47c988 100644
--- a/framework/source/classes/addonsoptions.cxx
+++ b/framework/source/classes/addonsoptions.cxx
@@ -789,7 +789,7 @@ sal_Bool AddonsOptions_Impl::ReadOfficeToolBarSet( AddonToolBars& rAddonOfficeTo
ReadToolBarItemSet( aToolBarItemNode, rAddonOfficeToolBars[n] );
}
- return ( rAddonOfficeToolBars.size() > 0 );
+ return ( !rAddonOfficeToolBars.empty() );
}
diff --git a/framework/source/classes/bmkmenu.cxx b/framework/source/classes/bmkmenu.cxx
index 0e6c269464..3c2d17771d 100644
--- a/framework/source/classes/bmkmenu.cxx
+++ b/framework/source/classes/bmkmenu.cxx
@@ -41,7 +41,7 @@
#include <general.h>
#include <macros/debug/assertion.hxx>
#include <helper/imageproducer.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
//_________________________________________________________________________________________________________________
// interface includes
@@ -130,15 +130,17 @@ USHORT BmkMenu_Impl::GetMID()
// ------------------------------------------------------------------------
-BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot ) :
- m_nType( nType ), m_xFrame( xFrame )
+BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot )
+ :AddonMenu(xFrame)
+ ,m_nType( nType )
{
_pImp = new BmkMenu_Impl( pRoot );
Initialize();
}
-BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType ) :
- m_nType( nType ), m_xFrame( xFrame )
+BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType )
+ :AddonMenu(xFrame)
+ ,m_nType( nType )
{
_pImp = new BmkMenu_Impl();
Initialize();
@@ -147,17 +149,6 @@ BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType ) :
BmkMenu::~BmkMenu()
{
delete _pImp;
-
- for ( USHORT i = 0; i < GetItemCount(); i++ )
- {
- if ( GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- // delete user attributes created with new!
- USHORT nId = GetItemId( i );
- MenuConfiguration::Attributes* pUserAttributes = (MenuConfiguration::Attributes*)GetUserValue( nId );
- delete pUserAttributes;
- }
- }
}
void BmkMenu::Initialize()
diff --git a/framework/source/classes/framelistanalyzer.cxx b/framework/source/classes/framelistanalyzer.cxx
index bf16a997d0..84b9e97969 100644
--- a/framework/source/classes/framelistanalyzer.cxx
+++ b/framework/source/classes/framelistanalyzer.cxx
@@ -151,8 +151,7 @@ void FrameListAnalyzer::impl_analyze()
(xSet.is() )
)
{
- css::uno::Any aValue = xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN);
- aValue >>= m_bReferenceIsHidden;
+ xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN) >>= m_bReferenceIsHidden;
}
// check, if the reference frame includes the backing component.
@@ -272,8 +271,7 @@ void FrameListAnalyzer::impl_analyze()
xSet = css::uno::Reference< css::beans::XPropertySet >(xFrame, css::uno::UNO_QUERY);
if (xSet.is())
{
- css::uno::Any aValue = xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN);
- aValue >>= bHidden;
+ xSet->getPropertyValue(FRAME_PROPNAME_ISHIDDEN) >>= bHidden;
}
}
diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx
index 8628744fbc..973d3cbdc0 100644
--- a/framework/source/classes/fwktabwindow.cxx
+++ b/framework/source/classes/fwktabwindow.cxx
@@ -33,7 +33,7 @@
#include <classes/fwktabwindow.hxx>
#include "framework.hrc"
-#include <classes/fwkresid.hxx>
+#include <classes/fwlresid.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
@@ -224,9 +224,9 @@ void FwkTabPage::Save()
FwkTabWindow::FwkTabWindow( Window* pParent ) :
- Window( pParent, FwkResId( WIN_TABWINDOW ) ),
+ Window( pParent, FwlResId( WIN_TABWINDOW ) ),
- m_aTabCtrl ( this, FwkResId( TC_TABCONTROL ) )
+ m_aTabCtrl ( this, FwlResId( TC_TABCONTROL ) )
{
uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >(
@@ -365,20 +365,19 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea
{
beans::NamedValue aValue = rProperties[i];
::rtl::OUString sName = aValue.Name;
- uno::Any aAny = aValue.Value;
if ( sName.equalsAscii("Title") )
- aAny >>= sTitle;
+ aValue.Value >>= sTitle;
else if ( sName.equalsAscii("ToolTip") )
- aAny >>= sToolTip;
+ aValue.Value >>= sToolTip;
else if ( sName.equalsAscii("PageURL") )
- aAny >>= sPageURL;
+ aValue.Value >>= sPageURL;
else if ( sName.equalsAscii("EventHdl") )
- aAny >>= xEventHdl;
+ aValue.Value >>= xEventHdl;
else if ( sName.equalsAscii("Image") )
- aAny >>= xImage;
+ aValue.Value >>= xImage;
else if ( sName.equalsAscii("Disabled") )
- aAny >>= bDisabled;
+ aValue.Value >>= bDisabled;
}
TabEntry* pEntry = new TabEntry( nIndex, sPageURL, xEventHdl );
diff --git a/framework/source/classes/fwlresid.cxx b/framework/source/classes/fwlresid.cxx
new file mode 100755
index 0000000000..d8eeb18dee
--- /dev/null
+++ b/framework/source/classes/fwlresid.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * 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: FwlResId.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * 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_framework.hxx"
+
+#include "classes/fwlresid.hxx"
+#include <tools/string.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <rtl/strbuf.hxx>
+
+namespace framework
+{
+
+ResMgr* FwlResId::GetResManager()
+{
+ static ResMgr* pResMgr = NULL;
+
+ if ( !pResMgr )
+ {
+ rtl::OStringBuffer aBuf( 32 );
+ aBuf.append( "fwe" );
+
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ pResMgr = ResMgr::CreateResMgr( aBuf.getStr() );
+ }
+
+ return pResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+FwlResId::FwlResId( USHORT nId ) :
+ ResId( nId, *FwlResId::GetResManager() )
+{
+}
+
+}
+
diff --git a/framework/source/classes/imagewrapper.cxx b/framework/source/classes/imagewrapper.cxx
index cd57d41895..7e001a9e41 100644
--- a/framework/source/classes/imagewrapper.cxx
+++ b/framework/source/classes/imagewrapper.cxx
@@ -54,7 +54,6 @@ static Sequence< sal_Int8 > impl_getStaticIdentifier()
ImageWrapper::ImageWrapper( const Image& aImage ) : ThreadHelpBase( &Application::GetSolarMutex() )
- , cppu::OWeakObject()
, m_aImage( aImage )
{
}
@@ -70,33 +69,6 @@ Sequence< sal_Int8 > ImageWrapper::GetUnoTunnelId()
return impl_getStaticIdentifier();
}
-
-// XInterface
-void SAL_CALL ImageWrapper::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL ImageWrapper::release() throw ()
-{
- OWeakObject::release();
-}
-
-Any SAL_CALL ImageWrapper::queryInterface( const Type& aType )
-throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- aType ,
- SAL_STATIC_CAST( com::sun::star::awt::XBitmap*, this ),
- SAL_STATIC_CAST( XUnoTunnel*, this ),
- SAL_STATIC_CAST( XTypeProvider*, this ));
-
- if( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( aType );
-}
-
// XBitmap
com::sun::star::awt::Size SAL_CALL ImageWrapper::getSize() throw ( RuntimeException )
{
@@ -147,63 +119,5 @@ sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIden
return 0;
}
-// XTypeProvider
-Sequence< Type > SAL_CALL ImageWrapper::getTypes() throw ( RuntimeException )
-{
- // Optimize this method !
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
- static ::cppu::OTypeCollection* pTypeCollection = NULL ;
-
- if ( pTypeCollection == NULL )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pTypeCollection == NULL )
- {
- // Create a static typecollection ...
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType(( const Reference< XTypeProvider >*)NULL ) ,
- ::getCppuType(( const Reference< XUnoTunnel >*)NULL ) ,
- ::getCppuType(( const Reference< com::sun::star::awt::XBitmap >*)NULL ) ) ;
-
- // ... and set his address to static pointer!
- pTypeCollection = &aTypeCollection ;
- }
- }
-
- return pTypeCollection->getTypes() ;
-}
-
-Sequence< sal_Int8 > SAL_CALL ImageWrapper::getImplementationId() throw ( RuntimeException )
-{
- // Create one Id for all instances of this class.
- // Use ethernet address to do this! (sal_True)
-
- // Optimize this method
- // We initialize a static variable only one time. And we don't must use a mutex at every call!
- // For the first call; pID is NULL - for the second call pID is different from NULL!
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- // Ready for multithreading; get global mutex for first call of this method only! see before
- osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
-
- // Control these pointer again ... it can be, that another instance will be faster then these!
- if ( pID == NULL )
- {
- // Create a new static ID ...
- static ::cppu::OImplementationId aID( sal_False ) ;
- // ... and set his address to static pointer!
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-}
-
}
diff --git a/framework/source/classes/makefile.mk b/framework/source/classes/makefile.mk
index a80bf0b87a..c55af1cdf8 100644
--- a/framework/source/classes/makefile.mk
+++ b/framework/source/classes/makefile.mk
@@ -57,6 +57,7 @@ SLOFILES= \
$(SLO)$/addonmenu.obj \
$(SLO)$/addonsoptions.obj \
$(SLO)$/fwkresid.obj \
+ $(SLO)$/fwlresid.obj \
$(SLO)$/framelistanalyzer.obj \
$(SLO)$/sfxhelperfunctions.obj \
$(SLO)$/menuextensionsupplier.obj \
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 88b573bbf0..0527084adb 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -36,14 +36,14 @@
// my own includes
//_________________________________________________________________________________________________________________
#include <classes/menumanager.hxx>
-#include <classes/menuconfiguration.hxx>
+#include <xml/menuconfiguration.hxx>
#include <classes/bmkmenu.hxx>
#include <classes/addonmenu.hxx>
#include <helper/imageproducer.hxx>
#include <threadhelp/resetableguard.hxx>
#include "classes/addonsoptions.hxx"
#include <classes/fwkresid.hxx>
-
+#include <services.h>
#include "classes/resource.hrc"
//_________________________________________________________________________________________________________________
@@ -92,6 +92,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
@@ -122,9 +123,7 @@ namespace framework
#define SID_HELPMENU (SID_SFX_START + 410)
#define SFX_REFERER_USER "private:user"
-#define DESKTOP_SERVICE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))
-const ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
const ::rtl::OUString aSlotNewDocDirect( RTL_CONSTASCII_USTRINGPARAM( "slot:5537" ));
const ::rtl::OUString aSlotAutoPilot( RTL_CONSTASCII_USTRINGPARAM( "slot:6381" ));
@@ -146,7 +145,6 @@ MenuManager::MenuManager(
REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: // #110897#
ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
mxServiceFactory(xServiceFactory)
{
m_bActive = sal_False;
@@ -163,61 +161,30 @@ MenuManager::MenuManager(
m_bShowMenuImages = rSettings.GetUseImagesInMenus();
sal_Int32 nAddonsURLPrefixLength = ADDONSPOPUPMENU_URL_PREFIX.getLength();
+#if 0
::std::vector< USHORT > aQueryLabelItemIdVector;
+#endif
USHORT nItemCount = pMenu->GetItemCount();
+ m_aMenuItemHandlerVector.reserve(nItemCount);
+ ::rtl::OUString aItemCommand;
for ( USHORT i = 0; i < nItemCount; i++ )
{
- USHORT nItemId = pMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pMenu->SetItemCommand( nItemId, aItemCommand );
- }
+ USHORT nItemId = FillItemCommand(aItemCommand,pMenu, i );
PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId );
if ( pPopupMenu )
{
- if (( aItemCommand.getLength() > nAddonsURLPrefixLength ) &&
- ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 ))
- {
- // A special addon popup menu, must be created with a different ctor
-
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, (AddonPopupMenu *)pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, (AddonPopupMenu *)pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
+ AddMenu(pPopupMenu,aItemCommand,nItemId,bDeleteChildren,bDeleteChildren);
+ if (! (( aItemCommand.getLength() > nAddonsURLPrefixLength ) &&
+ ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 )) )
{
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuMgr = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Activate handler)
- pSubMenuMgr->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispRef;
- MenuItemHandler* pMenuItemHdl = new MenuItemHandler(
- nItemId,
- pSubMenuMgr,
- aXDispRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHdl );
-
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
+#endif
// Create addon popup menu if there exist elements and this is the tools popup menu
if (( nItemId == SID_ADDONLIST ||
@@ -237,23 +204,18 @@ MenuManager::MenuManager(
pPopupMenu->SetPopupMenu( ITEMID_ADDONLIST, pSubMenu );
// Set item command for popup menu to enable it for GetImageFromURL
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
aItemCommand = aSlotString;
aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST );
pPopupMenu->SetItemCommand( ITEMID_ADDONLIST, aItemCommand );
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
-
+#endif
// Set image for the addon popup menu item
if ( m_bShowMenuImages && !pPopupMenu->GetItemImage( ITEMID_ADDONLIST ))
{
@@ -281,16 +243,11 @@ MenuManager::MenuManager(
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+#endif
if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
{
@@ -311,16 +268,11 @@ MenuManager::MenuManager(
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pSubMenu, sal_True, sal_False );
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
+ AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False);
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+#endif
if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId ))
{
@@ -368,8 +320,10 @@ MenuManager::MenuManager(
REFERENCE< XDISPATCH > aXDispatchRef;
m_aMenuItemHandlerVector.push_back( new MenuItemHandler( nItemId, NULL, aXDispatchRef ));
+#if 0
if ( pMenu->GetItemText( nItemId ).Len() == 0 )
aQueryLabelItemIdVector.push_back( nItemId );
+#endif
}
}
}
@@ -397,98 +351,15 @@ MenuManager::MenuManager(
}
}
#endif
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
-}
-
-
-// #110897#
-MenuManager::MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, BmkMenu* pBmkMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
-: // #110897#
- ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
- mxServiceFactory(xServiceFactory)
-{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pBmkMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
-
- USHORT nItemCount = pBmkMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pBmkMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pBmkMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pBmkMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pBmkMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pBmkMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pBmkAttributes = (MenuConfiguration::Attributes *)(pBmkMenu->GetUserValue( nItemId ));
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, NULL, aXDispatchRef );
-
- if ( pBmkAttributes )
- {
- // read additional attributes from attributes struct and BmkMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pBmkAttributes->aTargetFrame;
- }
-
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
+ SetHdl();
}
-
// #110897#
MenuManager::MenuManager(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
REFERENCE< XFRAME >& rFrame, AddonMenu* pAddonMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
: // #110897#
ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
mxServiceFactory(xServiceFactory)
{
m_bActive = sal_False;
@@ -505,34 +376,18 @@ MenuManager::MenuManager(
SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
USHORT nItemCount = pAddonMenu->GetItemCount();
+ m_aMenuItemHandlerVector.reserve(nItemCount);
+ ::rtl::OUString aItemCommand;
for ( USHORT i = 0; i < nItemCount; i++ )
{
- USHORT nItemId = pAddonMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonMenu->SetItemCommand( nItemId, aItemCommand );
- }
+ USHORT nItemId = FillItemCommand(aItemCommand,pAddonMenu, i );
PopupMenu* pPopupMenu = pAddonMenu->GetPopupMenu( nItemId );
if ( pPopupMenu )
{
// #110897#
// MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+ AddMenu(pPopupMenu,aItemCommand,nItemId,bDeleteChildren,bDeleteChildren);
}
else
{
@@ -553,110 +408,27 @@ MenuManager::MenuManager(
}
}
- m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
- m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
- m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
- m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
+ SetHdl();
}
-
-// #110897#
-MenuManager::MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- REFERENCE< XFRAME >& rFrame, AddonPopupMenu* pAddonPopupMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
-: // #110897#
- ThreadHelpBase( &Application::GetSolarMutex() ),
- OWeakObject(),
- mxServiceFactory(xServiceFactory)
+void MenuManager::SetHdl()
{
- m_bActive = sal_False;
- m_bDeleteMenu = bDelete;
- m_bDeleteChildren = bDeleteChildren;
- m_pVCLMenu = pAddonPopupMenu;
- m_xFrame = rFrame;
- m_bInitialized = sal_False;
- m_bIsBookmarkMenu = sal_True;
-
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
-
- SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)this )->acquire();
-
- USHORT nItemCount = pAddonPopupMenu->GetItemCount();
- for ( USHORT i = 0; i < nItemCount; i++ )
- {
- USHORT nItemId = pAddonPopupMenu->GetItemId( i );
-
- ::rtl::OUString aItemCommand = pAddonPopupMenu->GetItemCommand( nItemId );
- if ( !aItemCommand.getLength() )
- {
- aItemCommand = aSlotString;
- aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
- pAddonPopupMenu->SetItemCommand( nItemId, aItemCommand );
- }
-
- PopupMenu* pPopupMenu = pAddonPopupMenu->GetPopupMenu( nItemId );
- if ( pPopupMenu )
- {
- // #110897#
- // MenuManager* pSubMenuManager = new MenuManager( rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), rFrame, pPopupMenu, bDeleteChildren, bDeleteChildren );
-
- // store menu item command as we later have to know which menu is active (see Acivate handler)
- pSubMenuManager->m_aMenuItemCommand = aItemCommand;
-
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
- nItemId,
- pSubMenuManager,
- aXDispatchRef );
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- else
- {
- if ( pAddonPopupMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
- MenuConfiguration::Attributes* pAttributes = (MenuConfiguration::Attributes *)(pAddonPopupMenu->GetUserValue( nItemId ));
- REFERENCE< XDISPATCH > aXDispatchRef;
- MenuItemHandler* pMenuItemHandler = new MenuItemHandler( nItemId, NULL, aXDispatchRef );
-
- if ( pAttributes )
- {
- // read additional attributes from attributes struct and BmkMenu implementation will delete all attributes itself!!
- pMenuItemHandler->aTargetFrame = pAttributes->aTargetFrame;
- }
-
- m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
- }
- }
- }
-
m_pVCLMenu->SetHighlightHdl( LINK( this, MenuManager, Highlight ));
m_pVCLMenu->SetActivateHdl( LINK( this, MenuManager, Activate ));
m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
-}
-Any SAL_CALL MenuManager::queryInterface( const ::com::sun::star::uno::Type & rType ) throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ),
- SAL_STATIC_CAST( XEVENTLISTENER*, this ));
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
+ if ( mxServiceFactory.is() )
+ m_xURLTransformer.set( mxServiceFactory->createInstance(SERVICENAME_URLTRANSFORMER),UNO_QUERY );
}
-
MenuManager::~MenuManager()
{
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
{
MenuItemHandler* pItemHandler = *p;
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ pItemHandler->xMenuItemDispatch.clear();
if ( pItemHandler->pSubMenuManager )
SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, (OWeakObject*)pItemHandler->pSubMenuManager )->release();
delete pItemHandler;
@@ -730,11 +502,7 @@ throw ( RuntimeException )
aTargetURL.Complete = pStatusChangedMenu->aMenuItemURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
REFERENCE< XDISPATCH > xMenuItemDispatch = xDispatchProvider->queryDispatch(
@@ -754,16 +522,15 @@ throw ( RuntimeException )
void MenuManager::RemoveListener()
{
ResetableGuard aGuard( m_aLock );
+ ClearMenuDispatch();
+}
+void MenuManager::ClearMenuDispatch(const EVENTOBJECT& Source,bool _bRemoveOnly)
+{
// disposing called from parent dispatcher
// remove all listener to prepare shutdown
// #110897#
- //REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
{
@@ -772,15 +539,20 @@ void MenuManager::RemoveListener()
{
URL aTargetURL;
aTargetURL.Complete = pItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
pItemHandler->xMenuItemDispatch->removeStatusListener(
SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
}
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ pItemHandler->xMenuItemDispatch.clear();
if ( pItemHandler->pSubMenuManager )
- pItemHandler->pSubMenuManager->RemoveListener();
+ {
+ if ( _bRemoveOnly )
+ pItemHandler->pSubMenuManager->RemoveListener();
+ else
+ pItemHandler->pSubMenuManager->disposing( Source );
+ }
}
}
@@ -790,34 +562,7 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
if ( Source.Source == m_xFrame )
{
ResetableGuard aGuard( m_aLock );
-
- // disposing called from parent dispatcher
- // remove all listener to prepare shutdown
-
- // #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
- std::vector< MenuItemHandler* >::iterator p;
- for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
- {
- MenuItemHandler* pItemHandler = *p;
- if ( pItemHandler->xMenuItemDispatch.is() )
- {
- URL aTargetURL;
- aTargetURL.Complete = pItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
-
- pItemHandler->xMenuItemDispatch->removeStatusListener(
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
- }
-
- pItemHandler->xMenuItemDispatch = REFERENCE< XDISPATCH >();
- if ( pItemHandler->pSubMenuManager )
- pItemHandler->pSubMenuManager->disposing( Source );
- }
+ ClearMenuDispatch(Source,false);
}
else
{
@@ -844,15 +589,10 @@ void SAL_CALL MenuManager::disposing( const EVENTOBJECT& Source ) throw ( RUNTIM
aTargetURL.Complete = pMenuItemDisposing->aMenuItemURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
-
- pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
- SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
- pMenuItemDisposing->xMenuItemDispatch = REFERENCE< XDISPATCH >();
+ m_xURLTransformer->parseStrict( aTargetURL );
+
+ pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(SAL_STATIC_CAST( XSTATUSLISTENER*, this ), aTargetURL );
+ pMenuItemDisposing->xMenuItemDispatch.clear();
}
}
}
@@ -869,6 +609,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
USHORT nPickItemId = START_ITEMID_PICKLIST;
int nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength();
+ aNewPickVector.reserve(nPickListMenuItems);
for ( int i = 0; i < nPickListMenuItems; i++ )
{
Sequence< PropertyValue > aPickListEntry = aHistoryList[i];
@@ -896,19 +637,15 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
aNewPickVector.push_back( pNewMenuItemHandler );
}
- if ( aNewPickVector.size() > 0 )
+ if ( !aNewPickVector.empty() )
{
URL aTargetURL;
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
REFERENCE< XDISPATCH > xMenuItemDispatch;
+ static const ::rtl::OUString s_sDefault(RTL_CONSTASCII_USTRINGPARAM("_default"));
// query for dispatcher
std::vector< MenuItemHandler* >::iterator p;
for ( p = aNewPickVector.begin(); p != aNewPickVector.end(); p++ )
@@ -916,12 +653,12 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
MenuItemHandler* pMenuItemHandler = *p;
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( !xMenuItemDispatch.is() )
{
// attention: this code assume that "_blank" can only be consumed by desktop service
- xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString::createFromAscii("_default"), 0 );
+ xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, s_sDefault, 0 );
}
if ( xMenuItemDispatch.is() )
@@ -963,8 +700,10 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
// append new picklist menu entries
+ aNewPickVector.reserve(aNewPickVector.size());
pMenu->InsertSeparator();
- for ( sal_uInt32 i = 0; i < aNewPickVector.size(); i++ )
+ const sal_uInt32 nCount = aNewPickVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
char menuShortCut[5] = "~n: ";
@@ -1027,17 +766,13 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
}
-
-void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
+void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiServiceFactory >& xServiceFactory,framework::IMutex& _rMutex )
{
// update window list
::std::vector< ::rtl::OUString > aNewWindowListVector;
// #110897#
- // Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
- // DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XDesktop > xDesktop( getServiceFactory()->createInstance(
- DESKTOP_SERVICE ), UNO_QUERY );
+ Reference< XDesktop > xDesktop( xServiceFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
USHORT nActiveItemId = 0;
USHORT nItemId = START_ITEMID_WINDOWLIST;
@@ -1048,11 +783,12 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
sal_Int32 nCount = xList->getCount();
+ aNewWindowListVector.reserve(nCount);
for (sal_Int32 i=0; i<nCount; ++i )
{
- Any aItem = xList->getByIndex(i);
Reference< XFrame > xFrame;
- aItem >>= xFrame;
+ xList->getByIndex(i) >>= xFrame;
+
if (xFrame.is())
{
if ( xFrame == xCurrentFrame )
@@ -1069,9 +805,9 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
}
{
- ResetableGuard aGuard( m_aLock );
+ ResetableGuard aGuard( _rMutex );
- int nItemCount = pMenu->GetItemCount();
+ int nItemCount = pMenu->GetItemCount();
if ( nItemCount > 0 )
{
@@ -1084,12 +820,13 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
pMenu->RemoveItem( pMenu->GetItemCount()-1 );
}
- if ( aNewWindowListVector.size() > 0 )
+ if ( !aNewWindowListVector.empty() )
{
// append new window list entries to menu
pMenu->InsertSeparator();
nItemId = START_ITEMID_WINDOWLIST;
- for ( sal_uInt32 i = 0; i < aNewWindowListVector.size(); i++ )
+ const sal_uInt32 nCount = aNewWindowListVector.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
pMenu->InsertItem( nItemId, aNewWindowListVector.at( i ), MIB_RADIOCHECK );
if ( nItemId == nActiveItemId )
@@ -1179,7 +916,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
else if ( m_aMenuItemCommand == aSpecialWindowMenu ||
m_aMenuItemCommand == aSlotSpecialWindowMenu ||
aCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu );
+ UpdateSpecialWindowMenu( pMenu,getServiceFactory(),m_aLock );
// Check if some modes have changed so we have to update our menu images
sal_Bool bIsHiContrast = rSettings.GetMenuColor().IsDark();
@@ -1189,48 +926,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
// The mode changed so we have to replace all images
m_bWasHiContrast = bIsHiContrast;
m_bShowMenuImages = bShowMenuImages;
- AddonsOptions aAddonOptions;
-
- for ( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
- {
- USHORT nId = pMenu->GetItemId( nPos );
- if ( pMenu->GetItemType( nPos ) != 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 )
- {
- Image aImage = GetImageFromURL( m_xFrame, aImageId, FALSE, bIsHiContrast );
- if ( !!aImage )
- {
- bImageSet = sal_True;
- pMenu->SetItemImage( nId, aImage );
- }
- }
-
- if ( !bImageSet )
- {
- rtl::OUString aMenuItemCommand = pMenu->GetItemCommand( nId );
- Image aImage = GetImageFromURL( m_xFrame, aMenuItemCommand, FALSE, bIsHiContrast );
- if ( !aImage )
- aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast );
-
- pMenu->SetItemImage( nId, aImage );
- }
- }
- else
- pMenu->SetItemImage( nId, Image() );
- }
- }
+ FillMenuImages(m_xFrame,pMenu,bIsHiContrast,bShowMenuImages);
}
if ( m_bInitialized )
@@ -1240,11 +936,6 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
URL aTargetURL;
// #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
ResetableGuard aGuard( m_aLock );
REFERENCE< XDISPATCHPROVIDER > xDispatchProvider( m_xFrame, UNO_QUERY );
@@ -1266,14 +957,15 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
::rtl::OUString aItemCommand = pMenu->GetItemCommand( pMenuItemHandler->nItemId );
if ( !aItemCommand.getLength() )
{
- aItemCommand = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aItemCommand = aSlotString;
aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)pMenuItemHandler->nItemId );
pMenu->SetItemCommand( pMenuItemHandler->nItemId, aItemCommand );
}
aTargetURL.Complete = aItemCommand;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
REFERENCE< XDISPATCH > xMenuItemDispatch;
if ( m_bIsBookmarkMenu )
@@ -1330,8 +1022,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
// #110897#
// Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
// DESKTOP_SERVICE ), UNO_QUERY );
- Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance(
- DESKTOP_SERVICE ), UNO_QUERY );
+ Reference< XFramesSupplier > xDesktop( getServiceFactory()->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY );
if ( xDesktop.is() )
{
@@ -1340,9 +1031,9 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
sal_Int32 nCount = xList->getCount();
for ( sal_Int32 i=0; i<nCount; ++i )
{
- Any aItem = xList->getByIndex(i);
Reference< XFrame > xFrame;
- aItem >>= xFrame;
+ xList->getByIndex(i) >>= xFrame;
+
if ( xFrame.is() && nTaskId == nCurItemId )
{
Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
@@ -1360,14 +1051,8 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
MenuItemHandler* pMenuItemHandler = GetMenuItemHandler( nCurItemId );
if ( pMenuItemHandler && pMenuItemHandler->xMenuItemDispatch.is() )
{
- // #110897#
- // REFERENCE< XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
- // rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
- REFERENCE< XURLTransformer > xTrans( getServiceFactory()->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-
aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
- xTrans->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
if ( nCurItemId >= START_ITEMID_PICKLIST &&
nCurItemId < START_ITEMID_WINDOWLIST )
@@ -1378,11 +1063,9 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
else if ( m_bIsBookmarkMenu )
{
// bookmark menu item selected
- Any a;
aArgs.realloc( 1 );
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
- a <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
- aArgs[0].Value = a;
+ aArgs[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ));
}
xDispatch = pMenuItemHandler->xMenuItemDispatch;
@@ -1410,4 +1093,78 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFac
return mxServiceFactory;
}
+void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,USHORT _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren)
+{
+ MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren );
+
+ // store menu item command as we later have to know which menu is active (see Activate handler)
+ pSubMenuManager->m_aMenuItemCommand = _sItemCommand;
+
+ REFERENCE< XDISPATCH > aXDispatchRef;
+ MenuItemHandler* pMenuItemHandler = new MenuItemHandler(
+ _nItemId,
+ pSubMenuManager,
+ aXDispatchRef );
+ m_aMenuItemHandlerVector.push_back( pMenuItemHandler );
+}
+
+USHORT MenuManager::FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const
+{
+ USHORT nItemId = _pMenu->GetItemId( _nIndex );
+
+ _rItemCommand = _pMenu->GetItemCommand( nItemId );
+ if ( !_rItemCommand.getLength() )
+ {
+ const static ::rtl::OUString aSlotString( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ _rItemCommand = aSlotString;
+ _rItemCommand += ::rtl::OUString::valueOf( (sal_Int32)nItemId );
+ _pMenu->SetItemCommand( nItemId, _rItemCommand );
+ }
+ return nItemId;
+}
+void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame,Menu* _pMenu,sal_Bool bIsHiContrast,sal_Bool bShowMenuImages)
+{
+ AddonsOptions aAddonOptions;
+
+ for ( USHORT nPos = 0; nPos < _pMenu->GetItemCount(); nPos++ )
+ {
+ USHORT nId = _pMenu->GetItemId( nPos );
+ if ( _pMenu->GetItemType( nPos ) != 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 )
+ {
+ Image aImage = GetImageFromURL( _xFrame, aImageId, FALSE, bIsHiContrast );
+ if ( !!aImage )
+ {
+ bImageSet = sal_True;
+ _pMenu->SetItemImage( nId, aImage );
+ }
+ }
+
+ if ( !bImageSet )
+ {
+ rtl::OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );
+ Image aImage = GetImageFromURL( _xFrame, aMenuItemCommand, FALSE, bIsHiContrast );
+ if ( !aImage )
+ aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast );
+
+ _pMenu->SetItemImage( nId, aImage );
+ }
+ }
+ else
+ _pMenu->SetItemImage( nId, Image() );
+ }
+ }
+}
}
diff --git a/framework/source/classes/propertysethelper.cxx b/framework/source/classes/propertysethelper.cxx
index 40bb50cec8..5e1c2d5604 100644
--- a/framework/source/classes/propertysethelper.cxx
+++ b/framework/source/classes/propertysethelper.cxx
@@ -301,8 +301,7 @@ css::uno::Any SAL_CALL PropertySetHelper::getPropertyValue(const ::rtl::OUString
// <- SAFE
}
- css::uno::Any aValue = impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
- return aValue;
+ return impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
}
//-----------------------------------------------------------------------------
diff --git a/framework/source/classes/protocolhandlercache.cxx b/framework/source/classes/protocolhandlercache.cxx
index 1b05108568..3a1c4131c5 100644
--- a/framework/source/classes/protocolhandlercache.cxx
+++ b/framework/source/classes/protocolhandlercache.cxx
@@ -56,6 +56,7 @@
//_________________________________________________________________________________________________________________
#include <tools/wldcrd.hxx>
#include <unotools/configpathes.hxx>
+#include <rtl/ustrbuf.hxx>
//_________________________________________________________________________________________________________________
// namespace
@@ -299,15 +300,13 @@ void HandlerCFGAccess::read( HandlerHash** ppHandler ,
sal_Int32 nTarget=0;
for( nSource=0; nSource<nSourceCount; ++nSource )
{
- ::rtl::OUString sPath;
+ ::rtl::OUStringBuffer sPath( SETNAME_HANDLER );
+ sPath.append(CFG_PATH_SEPERATOR);
+ sPath.append(lNames[nSource]);
+ sPath.append(CFG_PATH_SEPERATOR);
+ sPath.append(PROPERTY_PROTOCOLS);
- sPath = SETNAME_HANDLER ;
- sPath += CFG_PATH_SEPERATOR ;
- sPath += lNames[nSource] ;
- sPath += CFG_PATH_SEPERATOR ;
-
- lFullNames[nTarget] = sPath;
- lFullNames[nTarget] += PROPERTY_PROTOCOLS;
+ lFullNames[nTarget] = sPath.makeStringAndClear();
++nTarget;
}
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index 3471a22b86..2ab4e33b50 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -127,8 +127,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl::
( TargetHelper::matchSpecialTarget(sName, TargetHelper::E_DEFAULT) )
)
{
- css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, PACKAGE, RELPATH, KEY, ::comphelper::ConfigurationHelper::E_READONLY);
- aVal >>= sCreator;
+ ::comphelper::ConfigurationHelper::readDirectKey(xSMGR, PACKAGE, RELPATH, KEY, ::comphelper::ConfigurationHelper::E_READONLY) >>= sCreator;
}
xCreator = css::uno::Reference< css::lang::XSingleServiceFactory >(