diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
commit | fd90f23f3a727dc80e4fa0be1a2a967feee8cb43 (patch) | |
tree | d5dd671ec5249774c3efdd741a0964181b802c49 /framework/source | |
parent | e8ec11b41233376724acd0f58bf3f6439c0e21d8 (diff) | |
parent | a2e7c2e0d002d75a6b77a629a4e904ab54bf8375 (diff) |
CWS gnumake2: resync to DEV300_m84
Diffstat (limited to 'framework/source')
53 files changed, 1456 insertions, 1358 deletions
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index 3979d72b1e62..493ac9dfb4a1 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -357,6 +357,7 @@ MenuManager::MenuManager( SetHdl(); } +#if 0 // #110897# MenuManager::MenuManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, @@ -413,6 +414,7 @@ MenuManager::MenuManager( SetHdl(); } +#endif void MenuManager::SetHdl() { diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index 0f45e683654f..2f8e1bdf2f16 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -124,7 +124,7 @@ String STR_TOOLBAR_TITLE_ADDON String STR_STATUSBAR_LOGOTEXT { - Text [ en-US ] = "A %PRODUCTNAME product by Sun Microsystems, Inc."; + Text [ en-US ] = "A %PRODUCTNAME product by Oracle"; }; // *********************************************************************** @@ -327,6 +327,11 @@ String STR_LANGSTATUS_NONE Text [ en-US ] = "None (Do not check spelling)" ; Text [ x-comment ] = " "; }; +String STR_RESET_TO_DEFAULT_LANGUAGE +{ + Text [ en-US ] = "Reset to Default Language" ; + Text [ x-comment ] = " "; +}; String STR_LANGSTATUS_MORE { Text [ en-US ] = "More..." ; diff --git a/framework/source/constant/filter.cxx b/framework/source/constant/filter.cxx deleted file mode 100644 index 57d94d772e6d..000000000000 --- a/framework/source/constant/filter.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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" - -#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_ -#include <constant/filter.hxx> -#endif - -namespace framework{ - namespace constant{ - -const ::rtl::OUString Filter::PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name" )); -const ::rtl::OUString Filter::PROP_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type" )); -const ::rtl::OUString Filter::PROP_DOCUMENTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); -const ::rtl::OUString Filter::PROP_FILTERSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterService" )); -const ::rtl::OUString Filter::PROP_UICOMPONENT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UIComponent" )); -const ::rtl::OUString Filter::PROP_FLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Flags" )); -const ::rtl::OUString Filter::PROP_USERDATA = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserData" )); -const ::rtl::OUString Filter::PROP_TEMPLATENAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplateName" )); - -const ::rtl::OUString Filter::QUERY_GET_DEFAULT_FILTER_FOR_TYPE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getDefaultFilterForType")); -const ::rtl::OUString Filter::QUERY_ALL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_all" )); -const ::rtl::OUString Filter::QUERY_WRITER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_writer" )); -const ::rtl::OUString Filter::QUERY_WEB = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_web" )); -const ::rtl::OUString Filter::QUERY_GLOBAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_global" )); -const ::rtl::OUString Filter::QUERY_CHART = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_chart" )); -const ::rtl::OUString Filter::QUERY_CALC = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_calc" )); -const ::rtl::OUString Filter::QUERY_IMPRESS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_impress" )); -const ::rtl::OUString Filter::QUERY_DRAW = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_draw" )); -const ::rtl::OUString Filter::QUERY_MATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_query_math" )); - -const ::rtl::OUString Filter::QUERYPARAM_IFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("iflags" )); -const ::rtl::OUString Filter::QUERYPARAM_EFLAGS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("eflags" )); -const ::rtl::OUString Filter::QUERYPARAM_SORT_PROP = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sort_prop" )); -const ::rtl::OUString Filter::QUERYPARAM_DESCENDING = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("descending" )); -const ::rtl::OUString Filter::QUERYPARAM_USE_ORDER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("use_order" )); -const ::rtl::OUString Filter::QUERYPARAM_DEFAULT_FIRST = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default_first" )); -const ::rtl::OUString Filter::QUERYPARAM_CASE_SENSITIVE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("case_sensitive")); -const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_NAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name" )); -const ::rtl::OUString Filter::QUERYPARAMVALUE_SORT_PROP_UINAME = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uiname" )); - -const ::rtl::OUString Filter::FLAGNAME_IMPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Import" )); -const ::rtl::OUString Filter::FLAGNAME_EXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Export" )); -const ::rtl::OUString Filter::FLAGNAME_TEMPLATE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Template" )); -const ::rtl::OUString Filter::FLAGNAME_INTERNAL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Internal" )); -const ::rtl::OUString Filter::FLAGNAME_TEMPLATEPATH = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TemplatePath" )); -const ::rtl::OUString Filter::FLAGNAME_OWN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Own" )); -const ::rtl::OUString Filter::FLAGNAME_ALIEN = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Alien" )); -const ::rtl::OUString Filter::FLAGNAME_USESOPTIONS = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsesOptions" )); -const ::rtl::OUString Filter::FLAGNAME_DEFAULT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default" )); -const ::rtl::OUString Filter::FLAGNAME_EXECUTABLE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Executable" )); -const ::rtl::OUString Filter::FLAGNAME_SUPPORTSSELECTION = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SupportsSelection")); -const ::rtl::OUString Filter::FLAGNAME_MAPTOAPPPLUG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MapToAppPlug" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINFILEDIALOG = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInFileDialog" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINCHOOSER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInChooser" )); -const ::rtl::OUString Filter::FLAGNAME_ASYNCHRON = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Asynchron" )); -const ::rtl::OUString Filter::FLAGNAME_CREATOR = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creator" )); -const ::rtl::OUString Filter::FLAGNAME_READONLY = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Readonly" )); -const ::rtl::OUString Filter::FLAGNAME_NOTINSTALLED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NotInstalled" )); -const ::rtl::OUString Filter::FLAGNAME_CONSULTSERVICE = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConsultService" )); -const ::rtl::OUString Filter::FLAGNAME_3RDPARTYFILTER = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("3rdPartyFilter" )); -const ::rtl::OUString Filter::FLAGNAME_PACKED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Packed" )); -const ::rtl::OUString Filter::FLAGNAME_SILENTEXPORT = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SilentExport" )); -const ::rtl::OUString Filter::FLAGNAME_BROWSERPREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BrowserPrefered" )); -const ::rtl::OUString Filter::FLAGNAME_PREFERED = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prefered" )); - -const sal_Int32 Filter::FLAGVALUE_IMPORT = 0x00000001L; // 1 -const sal_Int32 Filter::FLAGVALUE_EXPORT = 0x00000002L; // 2 -const sal_Int32 Filter::FLAGVALUE_TEMPLATE = 0x00000004L; // 4 -const sal_Int32 Filter::FLAGVALUE_INTERNAL = 0x00000008L; // 8 -const sal_Int32 Filter::FLAGVALUE_TEMPLATEPATH = 0x00000010L; // 16 -const sal_Int32 Filter::FLAGVALUE_OWN = 0x00000020L; // 32 -const sal_Int32 Filter::FLAGVALUE_ALIEN = 0x00000040L; // 64 -const sal_Int32 Filter::FLAGVALUE_USESOPTIONS = 0x00000080L; // 128 -const sal_Int32 Filter::FLAGVALUE_DEFAULT = 0x00000100L; // 256 -const sal_Int32 Filter::FLAGVALUE_EXECUTABLE = 0x00000200L; // 512 -const sal_Int32 Filter::FLAGVALUE_SUPPORTSSELECTION = 0x00000400L; // 1024 -const sal_Int32 Filter::FLAGVALUE_MAPTOAPPPLUG = 0x00000800L; // 2048 -const sal_Int32 Filter::FLAGVALUE_NOTINFILEDIALOG = 0x00001000L; // 4096 -const sal_Int32 Filter::FLAGVALUE_NOTINCHOOSER = 0x00002000L; // 8192 -const sal_Int32 Filter::FLAGVALUE_ASYNCHRON = 0x00004000L; // 16384 -const sal_Int32 Filter::FLAGVALUE_CREATOR = 0x00008000L; // 32768 -const sal_Int32 Filter::FLAGVALUE_READONLY = 0x00010000L; // 65536 -const sal_Int32 Filter::FLAGVALUE_NOTINSTALLED = 0x00020000L; // 131072 -const sal_Int32 Filter::FLAGVALUE_CONSULTSERVICE = 0x00040000L; // 262144 -const sal_Int32 Filter::FLAGVALUE_3RDPARTYFILTER = 0x00080000L; // 524288 -const sal_Int32 Filter::FLAGVALUE_PACKED = 0x00100000L; // 1048576 -const sal_Int32 Filter::FLAGVALUE_SILENTEXPORT = 0x00200000L; // 2097152 -const sal_Int32 Filter::FLAGVALUE_BROWSERPREFERED = 0x00400000L; // 4194304 -const sal_Int32 Filter::FLAGVALUE_PREFERED = 0x10000000L; // 268435456 - - } // namespace constant -} // namespace framework diff --git a/framework/source/constant/makefile.mk b/framework/source/constant/makefile.mk index 1c050db57dca..05fc28870d0a 100644 --- a/framework/source/constant/makefile.mk +++ b/framework/source/constant/makefile.mk @@ -35,8 +35,7 @@ ENABLE_EXCEPTIONS= TRUE # --- Generate ----------------------------------------------------- -SLOFILES= $(SLO)$/filter.obj \ - $(SLO)$/frameloader.obj \ +SLOFILES= $(SLO)$/frameloader.obj \ $(SLO)$/contenthandler.obj \ $(SLO)$/containerquery.obj diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index a6171f4219b6..ba3db729817d 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -30,11 +30,14 @@ #include <framework/sfxhelperfunctions.hxx> +#include <tools/diagnose_ex.h> + static pfunc_setToolBoxControllerCreator pToolBoxControllerCreator = NULL; static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = NULL; static pfunc_getRefreshToolbars pRefreshToolbars = NULL; static pfunc_createDockingWindow pCreateDockingWindow = NULL; static pfunc_isDockingWindowVisible pIsDockingWindowVisible = NULL; +static pfunc_activateToolPanel pActivateToolPanel = NULL; @@ -153,4 +156,24 @@ bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< :: return false; } +pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ) +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + pfunc_activateToolPanel pOldFunc = pActivateToolPanel; + pActivateToolPanel = i_pActivator; + return pOldFunc; +} + +void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL ) +{ + pfunc_activateToolPanel pActivator = NULL; + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + pActivator = pActivateToolPanel; + } + + ENSURE_OR_RETURN_VOID( pActivator, "framework::ActivateToolPanel: no activator function!" ); + (*pActivator)( i_rFrame, i_rPanelURL ); +} + } diff --git a/framework/source/fwe/helper/imageproducer.cxx b/framework/source/fwe/helper/imageproducer.cxx index 97ad3063fb3c..eae77637187c 100644 --- a/framework/source/fwe/helper/imageproducer.cxx +++ b/framework/source/fwe/helper/imageproducer.cxx @@ -44,7 +44,7 @@ pfunc_getImage SAL_CALL SetImageProducer( pfunc_getImage pNewGetImageFunc ) } -Image SAL_CALL GetImageFromURL( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) +Image SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ) { if ( _pGetImageFunc ) return _pGetImageFunc( rFrame, aURL, bBig, bHiContrast ); diff --git a/framework/source/fwe/helper/uiconfigelementwrapperbase.cxx b/framework/source/fwe/helper/uiconfigelementwrapperbase.cxx index 1ddda0eb0f4d..030ec5bf8cf6 100644 --- a/framework/source/fwe/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/fwe/helper/uiconfigelementwrapperbase.cxx @@ -45,7 +45,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -550,4 +549,23 @@ Reference< XIndexAccess > SAL_CALL UIConfigElementWrapperBase::getSettings( sal_ return m_xConfigData; } +Reference< XFrame > SAL_CALL UIConfigElementWrapperBase::getFrame() throw (RuntimeException) +{ + ResetableGuard aLock( m_aLock ); + Reference< XFrame > xFrame( m_xWeakFrame ); + return xFrame; +} + +::rtl::OUString SAL_CALL UIConfigElementWrapperBase::getResourceURL() throw (RuntimeException) +{ + ResetableGuard aLock( m_aLock ); + return m_aResourceURL; +} + +::sal_Int16 SAL_CALL UIConfigElementWrapperBase::getType() throw (RuntimeException) +{ + ResetableGuard aLock( m_aLock ); + return m_nType; +} + } diff --git a/framework/source/fwe/helper/uielementwrapperbase.cxx b/framework/source/fwe/helper/uielementwrapperbase.cxx index 85bb1cdb1e60..6329f94b3063 100644 --- a/framework/source/fwe/helper/uielementwrapperbase.cxx +++ b/framework/source/fwe/helper/uielementwrapperbase.cxx @@ -151,6 +151,23 @@ throw ( Exception, RuntimeException ) } } +// XUIElement +::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL UIElementWrapperBase::getFrame() throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( m_xWeakFrame ); + return xFrame; +} + +::rtl::OUString SAL_CALL UIElementWrapperBase::getResourceURL() throw (::com::sun::star::uno::RuntimeException) +{ + return m_aResourceURL; +} + +::sal_Int16 SAL_CALL UIElementWrapperBase::getType() throw (::com::sun::star::uno::RuntimeException) +{ + return m_nType; +} + // XUpdatable void SAL_CALL UIElementWrapperBase::update() throw (::com::sun::star::uno::RuntimeException) { diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index b3decdde9859..c5d5e84cf609 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -94,6 +94,7 @@ #define ATTRIBUTE_ITEMSTYLE_TEXT "text" #define ATTRIBUTE_ITEMSTYLE_IMAGE "image" +#define ATTRIBUTE_ITEMSTYLE_RADIO "radio" // Property names of a menu/menu item ItemDescriptor static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; @@ -134,6 +135,7 @@ struct MenuStyleItem MenuStyleItem MenuItemStyles[ ] = { { ::com::sun::star::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE }, { ::com::sun::star::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT }, + { ::com::sun::star::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO } }; @@ -437,8 +439,10 @@ throw( SAXException, RuntimeException ) { if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT; - if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::ICON; + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) ) + nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK; } } while ( nIndex >= 0 ); @@ -670,8 +674,10 @@ throw( SAXException, RuntimeException ) { if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT; - if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::ICON; + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) ) + nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK; } } while ( nIndex >= 0 ); @@ -725,8 +731,10 @@ throw( SAXException, RuntimeException ) { if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_TEXT ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::TEXT; - if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_IMAGE ) ) ) nItemBits |= ::com::sun::star::ui::ItemStyle::ICON; + else if ( aToken.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ITEMSTYLE_RADIO ) ) ) + nItemBits |= ::com::sun::star::ui::ItemStyle::RADIO_CHECK; } } while ( nIndex >= 0 ); diff --git a/framework/source/fwe/xml/toolboxconfiguration.cxx b/framework/source/fwe/xml/toolboxconfiguration.cxx index 00ef4111ad55..994354a7e1a8 100644 --- a/framework/source/fwe/xml/toolboxconfiguration.cxx +++ b/framework/source/fwe/xml/toolboxconfiguration.cxx @@ -30,7 +30,6 @@ #include "precompiled_framework.hxx" #include <framework/toolboxconfiguration.hxx> #include <xml/toolboxdocumenthandler.hxx> -#include <xml/toolboxlayoutdocumenthandler.hxx> #include <xml/saxnamespacefilter.hxx> #include <services.h> diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index edf69523e873..deb5aa023c1b 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -29,10 +29,15 @@ #include "precompiled_framework.hxx" #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <tools/debug.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <i18npool/mslangid.hxx> +#include <svtools/langtab.hxx> #include <comphelper/processfactory.hxx> #include <helper/mischelper.hxx> #include <services.h> @@ -45,6 +50,9 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; +using ::rtl::OUString; + + namespace framework { @@ -68,20 +76,23 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues return m_xLanguageGuesser; } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory - ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame - ,::rtl::OUString& _rModuleIdentifier - ,sal_Bool& _rIni - ,const sal_Char* _pName) +//////////////////////////////////////////////////////////// + +::rtl::OUString RetrieveLabelFromCommand( + const ::rtl::OUString& aCmdURL, + const uno::Reference< lang::XMultiServiceFactory >& _xServiceFactory, + uno::Reference< container::XNameAccess >& _xUICommandLabels, + const uno::Reference< frame::XFrame >& _xFrame, + ::rtl::OUString& _rModuleIdentifier, + sal_Bool& _rIni, + const sal_Char* _pName) { ::rtl::OUString aLabel; // Retrieve popup menu labels if ( !_xUICommandLabels.is() ) { - try + try { if ( !_rIni ) { @@ -137,5 +148,92 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues return aLabel; } + +//////////////////////////////////////////////////////////// + +void FillLangItems( std::set< OUString > &rLangItems, + const SvtLanguageTable & rLanguageTable, + const uno::Reference< frame::XFrame > & rxFrame, + const LanguageGuessingHelper & rLangGuessHelper, + sal_Int16 nScriptType, + const OUString & rCurLang, + const OUString & rKeyboardLang, + const OUString & rGuessedTextLang ) +{ + rLangItems.clear(); + + //1--add current language + if( rCurLang != OUString() && + LANGUAGE_DONTKNOW != rLanguageTable.GetType( rCurLang )) + rLangItems.insert( rCurLang ); + + //2--System + const AllSettings& rAllSettings = Application::GetSettings(); + LanguageType rSystemLanguage = rAllSettings.GetLanguage(); + if( rSystemLanguage != LANGUAGE_DONTKNOW ) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rSystemLanguage )) + rLangItems.insert( OUString( rLanguageTable.GetString( rSystemLanguage )) ); + } + + //3--UI + LanguageType rUILanguage = rAllSettings.GetUILanguage(); + if( rUILanguage != LANGUAGE_DONTKNOW ) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rUILanguage )) + rLangItems.insert( OUString( rLanguageTable.GetString( rUILanguage )) ); + } + + //4--guessed language + uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( rLangGuessHelper.GetGuesser() ); + if ( xLangGuesser.is() && rGuessedTextLang.getLength() > 0) + { + ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( rGuessedTextLang, 0, rGuessedTextLang.getLength()) ); + LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); + if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM + && IsScriptTypeMatchingToLanguage( nScriptType, nLang )) + rLangItems.insert( rLanguageTable.GetString( nLang )); + } + + //5--keyboard language + if( rKeyboardLang != OUString()) + { + if ( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rKeyboardLang ))) + rLangItems.insert( rKeyboardLang ); + } + + //6--all languages used in current document + Reference< com::sun::star::frame::XModel > xModel; + if ( rxFrame.is() ) + { + Reference< com::sun::star::frame::XController > xController( rxFrame->getController(), UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); + } + Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); + /*the description of nScriptType + LATIN : 0x001 + ASIAN : 0x002 + COMPLEX: 0x004 + */ + const sal_Int16 nMaxCount = 7; + if ( xDocumentLanguages.is() ) + { + Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount )); + if ( rLocales.getLength() > 0 ) + { + for ( USHORT i = 0; i < rLocales.getLength(); ++i ) + { + if ( rLangItems.size() == static_cast< size_t >(nMaxCount) ) + break; + const Locale& rLocale=rLocales[i]; + if( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rLocale.Language ))) + rLangItems.insert( OUString( rLocale.Language ) ); + } + } + } +} + } // namespace framework + diff --git a/framework/source/fwi/helper/popupmenucontrollerbase.cxx b/framework/source/fwi/helper/popupmenucontrollerbase.cxx deleted file mode 100644 index cc5d388de9a8..000000000000 --- a/framework/source/fwi/helper/popupmenucontrollerbase.cxx +++ /dev/null @@ -1,429 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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 <helper/popupmenucontrollerbase.hxx> - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <threadhelp/resetableguard.hxx> -#include "services.h" - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/awt/XDevice.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/awt/MenuItemStyle.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/lang/DisposedException.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ - -#ifndef _VCL_MENU_HXX_ -#include <vcl/menu.hxx> -#endif -#include <vcl/svapp.hxx> -#include <rtl/ustrbuf.hxx> -#include <rtl/logfile.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::frame; -using namespace com::sun::star::beans; -using namespace com::sun::star::util; - -namespace framework -{ - -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** -DEFINE_XINTERFACE_11 ( PopupMenuControllerBase , - OWeakObject , - DIRECT_INTERFACE( css::lang::XTypeProvider ), - DIRECT_INTERFACE( css::lang::XServiceInfo ), - DIRECT_INTERFACE( ::com::sun::star::frame::XPopupMenuController ), - DIRECT_INTERFACE( css::lang::XInitialization ), - DIRECT_INTERFACE( css::frame::XStatusListener ), - DIRECT_INTERFACE( css::awt::XMenuListener ), - DIRECT_INTERFACE( css::frame::XDispatchProvider ), - DIRECT_INTERFACE( css::frame::XDispatch ), - DIRECT_INTERFACE( css::lang::XComponent ), - DERIVED_INTERFACE( css::lang::XEventListener, css::frame::XStatusListener ), - DERIVED_INTERFACE( css::lang::XEventListener, css::awt::XMenuListener ) - ) - -DEFINE_XTYPEPROVIDER_10 ( PopupMenuControllerBase , - css::lang::XTypeProvider , - css::lang::XServiceInfo , - ::com::sun::star::frame::XPopupMenuController , - css::lang::XInitialization , - css::frame::XStatusListener , - css::awt::XMenuListener , - css::lang::XEventListener , - css::frame::XDispatchProvider , - css::frame::XDispatch , - css::lang::XComponent - ) - -PopupMenuControllerBase::PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - ThreadHelpBase(), - ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ), - m_bInitialized( false ), - m_bDisposed( false ), - m_xServiceManager( xServiceManager ), - m_aListenerContainer( m_aLock.getShareableOslMutex() ) -{ - if ( m_xServiceManager.is() ) - m_xURLTransformer.set( m_xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY ); -} - -PopupMenuControllerBase::~PopupMenuControllerBase() -{ -} - -// protected function -void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ) -{ - VCLXPopupMenu* pPopupMenu = 0; - if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 ) - { - pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); - if ( pPopupMenu ) - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - pVCLPopupMenu->Clear(); - } - } -} - -void SAL_CALL PopupMenuControllerBase::dispose() -throw (::com::sun::star::uno::RuntimeException) -{ - css::uno::Reference< css::lang::XComponent > xThis( static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY ); - - // Send message to all listener and forget their references. - css::lang::EventObject aEvent( xThis ); - m_aListenerContainer.disposeAndClear( aEvent ); - - // Reset our members and set disposed flag - ResetableGuard aLock( m_aLock ); - m_xFrame.clear(); - m_xDispatch.clear(); - m_xPopupMenu.clear(); - m_xServiceManager.clear(); - m_bDisposed = true; -} - -void SAL_CALL PopupMenuControllerBase::addEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::lang::XEventListener >*)NULL ), xListener ); -} - -void SAL_CALL PopupMenuControllerBase::removeEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::lang::XEventListener >*)NULL ), xListener ); -} - -// XEventListener -void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - m_xFrame.clear(); - m_xDispatch.clear(); - m_xPopupMenu.clear(); -} - -// XMenuListener -void SAL_CALL PopupMenuControllerBase::highlight( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL) -{ - Sequence<PropertyValue> aArgs; - OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch"); - if ( _xDispatch.is() ) - _xDispatch->dispatch( aURL, aArgs ); -} - -void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) -{ - Reference< css::awt::XPopupMenu > xPopupMenu; - Reference< XDispatch > xDispatch; - Reference< XMultiServiceFactory > xServiceManager; - - if ( m_bDisposed ) - throw DisposedException(); - - ResetableGuard aLock( m_aLock ); - xPopupMenu = m_xPopupMenu; - xDispatch = m_xDispatch; - xServiceManager = m_xServiceManager; - aLock.unlock(); - - if ( xPopupMenu.is() ) - { - VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu ); - if ( pPopupMenu ) - { - css::util::URL aTargetURL; - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId ); - } - - m_xURLTransformer->parseStrict( aTargetURL ); - impl_select(xDispatch,aTargetURL); - } - } -} - -void SAL_CALL PopupMenuControllerBase::activate( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void SAL_CALL PopupMenuControllerBase::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( m_bDisposed ) - throw DisposedException(); - - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XDispatch > xDispatch( m_xDispatch ); - com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = m_aCommandURL; - m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); - - // Add/remove status listener to get a status update once - if ( xDispatch.is() ) - { - xDispatch->addStatusListener( xStatusListener, aTargetURL ); - xDispatch->removeStatusListener( xStatusListener, aTargetURL ); - } -} - -// XDispatchProvider -Reference< XDispatch > SAL_CALL -PopupMenuControllerBase::queryDispatch( - const URL& /*aURL*/, - const rtl::OUString& /*sTarget*/, - sal_Int32 /*nFlags*/ ) -throw( RuntimeException ) -{ - // must be implemented by subclass - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - - return Reference< XDispatch >(); -} - -Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException ) -{ - // Create return list - which must have same size then the given descriptor - // It's not allowed to pack it! - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - aLock.unlock(); - - sal_Int32 nCount = lDescriptor.getLength(); - css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); - - // Step over all descriptors and try to get any dispatcher for it. - for( sal_Int32 i=0; i<nCount; ++i ) - { - lDispatcher[i] = queryDispatch( lDescriptor[i].FeatureURL , - lDescriptor[i].FrameName , - lDescriptor[i].SearchFlags ); - } - - return lDispatcher; -} - -// XDispatch -void SAL_CALL -PopupMenuControllerBase::dispatch( - const URL& /*aURL*/, - const Sequence< PropertyValue >& /*seqProperties*/ ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - // must be implemented by subclass - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); -} - -void SAL_CALL -PopupMenuControllerBase::addStatusListener( - const Reference< XStatusListener >& xControl, - const URL& aURL ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - aLock.unlock(); - - bool bStatusUpdate( false ); - m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::frame::XStatusListener >*)NULL ), xControl ); - - aLock.lock(); - if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) - bStatusUpdate = true; - aLock.unlock(); - - if ( bStatusUpdate ) - { - // Dummy update for popup menu controllers - FeatureStateEvent aEvent; - aEvent.FeatureURL = aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.State = Any(); - xControl->statusChanged( aEvent ); - } -} - -void SAL_CALL PopupMenuControllerBase::removeStatusListener( - const Reference< XStatusListener >& xControl, - const URL& /*aURL*/ ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::frame::XStatusListener >*)NULL ), xControl ); -} - -::rtl::OUString PopupMenuControllerBase::determineBaseURL( const ::rtl::OUString& aURL ) -{ - // Just use the main part of the URL for popup menu controllers - sal_Int32 nQueryPart( 0 ); - sal_Int32 nSchemePart( 0 ); - rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" )); - - nSchemePart = aURL.indexOf( ':' ); - if (( nSchemePart > 0 ) && - ( aURL.getLength() > ( nSchemePart+1 ))) - { - nQueryPart = aURL.indexOf( '?', nSchemePart ); - if ( nQueryPart > 0 ) - aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart ); - else if ( nQueryPart == -1 ) - aMainURL += aURL.copy( nSchemePart+1 ); - } - - return aMainURL; -} - -// XInitialization -void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - sal_Bool bInitalized( m_bInitialized ); - if ( !bInitalized ) - { - PropertyValue aPropValue; - rtl::OUString aCommandURL; - Reference< XFrame > xFrame; - - for ( int i = 0; i < aArguments.getLength(); i++ ) - { - if ( aArguments[i] >>= aPropValue ) - { - if ( aPropValue.Name.equalsAscii( "Frame" )) - aPropValue.Value >>= xFrame; - else if ( aPropValue.Name.equalsAscii( "CommandURL" )) - aPropValue.Value >>= aCommandURL; - } - } - - if ( xFrame.is() && aCommandURL.getLength() ) - { - m_xFrame = xFrame; - m_aCommandURL = aCommandURL; - m_aBaseURL = determineBaseURL( aCommandURL ); - m_bInitialized = true; - } - } -} -// XPopupMenuController -void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( m_bDisposed ) - throw DisposedException(); - - if ( m_xFrame.is() && !m_xPopupMenu.is() ) - { - // Create popup menu on demand - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - m_xPopupMenu = xPopupMenu; - m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY )); - - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - - com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = m_aCommandURL; - m_xURLTransformer->parseStrict( aTargetURL ); - m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); - - impl_setPopupMenu(); - - updatePopupMenu(); - } -} -void PopupMenuControllerBase::impl_setPopupMenu() -{ -} -} diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx b/framework/source/fwi/threadhelp/transactionmanager.cxx index 7094bd884302..3523ddbbd128 100644 --- a/framework/source/fwi/threadhelp/transactionmanager.cxx +++ b/framework/source/fwi/threadhelp/transactionmanager.cxx @@ -320,42 +320,6 @@ sal_Bool TransactionManager::isCallRejected( ERejectReason& eReason ) const } /*-****************************************************************************************************//** - @short return a reference to a static manager - @descr Sometimes we need the global member! (e.g. in our own static methods) - We create our own "class global static" member threadsafe. - It will be created at first call only! - All other requests use these created one then directly. - - @seealso - - - @param - - @return A reference to a static member. - - @onerror No error should occure. -*//*-*****************************************************************************************************/ -TransactionManager& TransactionManager::getGlobalTransactionManager() -{ - // Initialize static member only for one time! - static TransactionManager* pManager = NULL; - // If these method first called (member not already exist!) ... - if( pManager == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because ... another instance of ouer class could be faster then these one! - if( pManager == NULL ) - { - // Create the new manager and set it for return on static variable. - static TransactionManager aManager; - pManager = &aManager; - } - } - // Return new created or already existing object. - return *pManager; -} - -/*-****************************************************************************************************//** @short throw any exceptions for rejected calls @descr If user whish to use our automaticly exception mode we use this impl-method. We check all combinations of eReason and eExceptionMode and throw right exception with some diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index e67b734730e5..8c81f31f2394 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -127,7 +127,6 @@ RootItemContainer::RootItemContainer( const Reference< XIndexAccess >& rSourceCo Reference< XPropertySet > xPropSet( rSourceContainer, UNO_QUERY ); if ( xPropSet.is() ) { - rtl::OUString aUIName; xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= m_aUIName; } } diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk index f19416899c86..556a9829d27c 100644 --- a/framework/source/helper/makefile.mk +++ b/framework/source/helper/makefile.mk @@ -41,18 +41,29 @@ CDEFS+=-DCOMPMOD_NAMESPACE=framework # --- Generate ----------------------------------------------------- -SLOFILES=\ - $(SLO)$/dockingareadefaultacceptor.obj \ - $(SLO)$/ocomponentaccess.obj \ - $(SLO)$/ocomponentenumeration.obj \ - $(SLO)$/oframes.obj \ - $(SLO)$/persistentwindowstate.obj \ - $(SLO)$/statusindicator.obj \ - $(SLO)$/statusindicatorfactory.obj \ - $(SLO)$/tagwindowasmodified.obj \ - $(SLO)$/titlebarupdate.obj \ - $(SLO)$/vclstatusindicator.obj \ - $(SLO)$/wakeupthread.obj \ +SLOFILES= $(SLO)$/ocomponentaccess.obj \ + $(SLO)$/ocomponentenumeration.obj \ + $(SLO)$/oframes.obj \ + $(SLO)$/statusindicatorfactory.obj \ + $(SLO)$/statusindicator.obj \ + $(SLO)$/imageproducer.obj \ + $(SLO)$/propertysetcontainer.obj \ + $(SLO)$/actiontriggerhelper.obj \ + $(SLO)$/persistentwindowstate.obj \ + $(SLO)$/networkdomain.obj \ + $(SLO)$/acceleratorinfo.obj \ + $(SLO)$/uielementwrapperbase.obj \ + $(SLO)$/popupmenucontrollerbase.obj \ + $(SLO)$/dockingareadefaultacceptor.obj \ + $(SLO)$/uiconfigelementwrapperbase.obj \ + $(SLO)$/shareablemutex.obj \ + $(SLO)$/vclstatusindicator.obj \ + $(SLO)$/wakeupthread.obj \ + $(SLO)$/configimporter.obj \ + $(SLO)$/tagwindowasmodified.obj \ + $(SLO)$/titlebarupdate.obj \ + $(SLO)$/titlehelper.obj \ + $(SLO)$/mischelper.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/inc/constant/filter.hxx b/framework/source/inc/constant/filter.hxx deleted file mode 100644 index 141440a77716..000000000000 --- a/framework/source/inc/constant/filter.hxx +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_CONSTANT_FILTER_H_ -#define __FRAMEWORK_CONSTANT_FILTER_H_ - -#include <rtl/ustring.hxx> - -namespace framework{ - namespace constant{ - -struct Filter -{ - public: - - static const ::rtl::OUString PROP_NAME; // string - static const ::rtl::OUString PROP_TYPE; // string - static const ::rtl::OUString PROP_DOCUMENTSERVICE; // string - static const ::rtl::OUString PROP_FILTERSERVICE; // string - static const ::rtl::OUString PROP_UICOMPONENT; // string - static const ::rtl::OUString PROP_FLAGS; // int32 - static const ::rtl::OUString PROP_USERDATA; // seq< string > - static const ::rtl::OUString PROP_TEMPLATENAME; // string - - static const ::rtl::OUString QUERY_GET_DEFAULT_FILTER_FOR_TYPE; - static const ::rtl::OUString QUERY_ALL; - static const ::rtl::OUString QUERY_WRITER; - static const ::rtl::OUString QUERY_WEB; - static const ::rtl::OUString QUERY_GLOBAL; - static const ::rtl::OUString QUERY_CHART; - static const ::rtl::OUString QUERY_CALC; - static const ::rtl::OUString QUERY_IMPRESS; - static const ::rtl::OUString QUERY_DRAW; - static const ::rtl::OUString QUERY_MATH; - - static const ::rtl::OUString QUERYPARAM_IFLAGS; - static const ::rtl::OUString QUERYPARAM_EFLAGS; - static const ::rtl::OUString QUERYPARAM_SORT_PROP; - static const ::rtl::OUString QUERYPARAM_DESCENDING; - static const ::rtl::OUString QUERYPARAM_USE_ORDER; - static const ::rtl::OUString QUERYPARAM_DEFAULT_FIRST; - static const ::rtl::OUString QUERYPARAM_CASE_SENSITIVE; - static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_NAME; - static const ::rtl::OUString QUERYPARAMVALUE_SORT_PROP_UINAME; - - static const ::rtl::OUString FLAGNAME_IMPORT; - static const ::rtl::OUString FLAGNAME_EXPORT; - static const ::rtl::OUString FLAGNAME_TEMPLATE; - static const ::rtl::OUString FLAGNAME_INTERNAL; - static const ::rtl::OUString FLAGNAME_TEMPLATEPATH; - static const ::rtl::OUString FLAGNAME_OWN; - static const ::rtl::OUString FLAGNAME_ALIEN; - static const ::rtl::OUString FLAGNAME_USESOPTIONS; - static const ::rtl::OUString FLAGNAME_DEFAULT; - static const ::rtl::OUString FLAGNAME_EXECUTABLE; - static const ::rtl::OUString FLAGNAME_SUPPORTSSELECTION; - static const ::rtl::OUString FLAGNAME_MAPTOAPPPLUG; - static const ::rtl::OUString FLAGNAME_NOTINFILEDIALOG; - static const ::rtl::OUString FLAGNAME_NOTINCHOOSER; - static const ::rtl::OUString FLAGNAME_ASYNCHRON; - static const ::rtl::OUString FLAGNAME_CREATOR; - static const ::rtl::OUString FLAGNAME_READONLY; - static const ::rtl::OUString FLAGNAME_NOTINSTALLED; - static const ::rtl::OUString FLAGNAME_CONSULTSERVICE; - static const ::rtl::OUString FLAGNAME_3RDPARTYFILTER; - static const ::rtl::OUString FLAGNAME_PACKED; - static const ::rtl::OUString FLAGNAME_SILENTEXPORT; - static const ::rtl::OUString FLAGNAME_BROWSERPREFERED; - static const ::rtl::OUString FLAGNAME_PREFERED; - - static const sal_Int32 FLAGVALUE_IMPORT; - static const sal_Int32 FLAGVALUE_EXPORT; - static const sal_Int32 FLAGVALUE_TEMPLATE; - static const sal_Int32 FLAGVALUE_INTERNAL; - static const sal_Int32 FLAGVALUE_TEMPLATEPATH; - static const sal_Int32 FLAGVALUE_OWN; - static const sal_Int32 FLAGVALUE_ALIEN; - static const sal_Int32 FLAGVALUE_USESOPTIONS; - static const sal_Int32 FLAGVALUE_DEFAULT; - static const sal_Int32 FLAGVALUE_EXECUTABLE; - static const sal_Int32 FLAGVALUE_SUPPORTSSELECTION; - static const sal_Int32 FLAGVALUE_MAPTOAPPPLUG; - static const sal_Int32 FLAGVALUE_NOTINFILEDIALOG; - static const sal_Int32 FLAGVALUE_NOTINCHOOSER; - static const sal_Int32 FLAGVALUE_ASYNCHRON; - static const sal_Int32 FLAGVALUE_CREATOR; - static const sal_Int32 FLAGVALUE_READONLY; - static const sal_Int32 FLAGVALUE_NOTINSTALLED; - static const sal_Int32 FLAGVALUE_CONSULTSERVICE; - static const sal_Int32 FLAGVALUE_3RDPARTYFILTER; - static const sal_Int32 FLAGVALUE_PACKED; - static const sal_Int32 FLAGVALUE_SILENTEXPORT; - static const sal_Int32 FLAGVALUE_BROWSERPREFERED; - //FREE! ... 0x00800000L - static const sal_Int32 FLAGVALUE_PREFERED; - -}; - - } // namespace constant -} // namespace framework - -#endif // #ifndef __FRAMEWORK_CONSTANT_FILTER_H_ diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx index f00bee4ed432..d5d11ebc2097 100644 --- a/framework/source/interaction/quietinteraction.cxx +++ b/framework/source/interaction/quietinteraction.cxx @@ -44,7 +44,9 @@ #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/document/XInteractionFilterSelect.hpp> +#include <com/sun/star/document/XInteractionFilterOptions.hpp> #include <com/sun/star/document/AmbigousFilterRequest.hpp> +#include <com/sun/star/document/FilterOptionsRequest.hpp> #include <com/sun/star/task/ErrorCodeRequest.hpp> #ifndef _COM_SUN_STAR_DOCUMENT_LOCKEDDOCUMENTREQUEST_HPP_ @@ -111,6 +113,7 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::uno::Reference< css::task::XInteractionAbort > xAbort ; css::uno::Reference< css::task::XInteractionApprove > xApprove ; css::uno::Reference< css::document::XInteractionFilterSelect > xFilter ; + css::uno::Reference< css::document::XInteractionFilterOptions > xFOptions ; sal_Int32 nCount=lContinuations.getLength(); for (sal_Int32 i=0; i<nCount; ++i) @@ -123,6 +126,9 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI if ( ! xFilter.is() ) xFilter = css::uno::Reference< css::document::XInteractionFilterSelect >( lContinuations[i], css::uno::UNO_QUERY ); + + if ( ! xFOptions.is() ) + xFOptions = css::uno::Reference< css::document::XInteractionFilterOptions >( lContinuations[i], css::uno::UNO_QUERY ); } // differ between abortable interactions (error, unknown filter ...) @@ -130,6 +136,7 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI css::task::ErrorCodeRequest aErrorCodeRequest ; css::document::AmbigousFilterRequest aAmbigousFilterRequest; css::document::LockedDocumentRequest aLockedDocumentRequest; + css::document::FilterOptionsRequest aFilterOptionsRequest; if (aRequest>>=aAmbigousFilterRequest) { @@ -163,6 +170,15 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI xAbort->select(); } else + if (aRequest>>=aFilterOptionsRequest) + { + if (xFOptions.is()) + { + // let the default filter options be used + xFOptions->select(); + } + } + else if (xAbort.is()) xAbort->select(); } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index d4db2d70e771..08d49b179a56 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -4707,6 +4707,14 @@ throw (RuntimeException) impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true ); } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolpanel" )) + { + ReadGuard aReadGuard( m_aLock ); + css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); + aReadGuard.unlock(); + + ActivateToolPanel( m_xFrame, aName ); + } } if ( bNotify ) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 07c8846bb3ce..1084fbc7f74c 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -36,13 +36,6 @@ #endif #include <classes/framelistanalyzer.hxx> -#ifndef __FRAMEWORK_CONSTANT_FILTER_HXX_ -#include <constant/filter.hxx> -#endif - -#include <comphelper/interaction.hxx> -#include <framework/interaction.hxx> - #ifndef __FRAMEWORK_CONSTANT_FRAMELOADER_HXX_ #include <constant/frameloader.hxx> #endif @@ -61,6 +54,7 @@ #include <properties.h> #include <protocols.h> #include <services.h> +#include <comphelper/interaction.hxx> #include <framework/interaction.hxx> //_______________________________________________ @@ -1770,7 +1764,10 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X ::comphelper::ConfigurationHelper::E_READONLY); a >>= bForceFrontAndFocus; - pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); + if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) ) + pWindow->ToTop(); + else + pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); } /* #i19976# diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index dc5682c7d398..7382380ef525 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -78,6 +78,7 @@ #include <uielement/macrosmenucontroller.hxx> #include <uielement/newmenucontroller.hxx> #include <uielement/toolbarsmenucontroller.hxx> +#include <uielement/popupmenucontroller.hxx> COMPONENTGETIMPLEMENTATIONENVIRONMENT @@ -103,6 +104,7 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::MediaTypeDetectionHelper COMPONENTINFO( ::framework::DispatchRecorderSupplier ) COMPONENTINFO( ::framework::Oxt_Handler ) COMPONENTINFO( ::framework::License ) + COMPONENTINFO( ::framework::PopupMenuController ) ) COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper ) @@ -126,5 +128,6 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper IFFACTORY( ::framework::FooterMenuController ) else IFFACTORY( ::framework::HeaderMenuController ) else IFFACTORY( ::framework::LanguageSelectionMenuController ) else - IFFACTORY( ::framework::Oxt_Handler ) + IFFACTORY( ::framework::Oxt_Handler ) else + IFFACTORY( ::framework::PopupMenuController ) ) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index bbbefdbdbda1..17def8e1c684 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -41,21 +41,26 @@ #include "tools/urlobj.hxx" #include "unotools/dynamicmenuoptions.hxx" +#include "unotools/historyoptions.hxx" #include "svtools/imagemgr.hxx" -#include "svl/svtools.hrc" +#include "svtools/svtools.hrc" #include "comphelper/processfactory.hxx" #include "comphelper/sequenceashashmap.hxx" #include "comphelper/configurationhelper.hxx" +#include "cppuhelper/implbase1.hxx" + #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" +#include "osl/file.h" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/system/XSystemShellExecute.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/task/XJobExecutor.hpp" +#include "com/sun/star/util/XStringWidth.hpp" using namespace ::com::sun::star::beans; @@ -110,27 +115,33 @@ Size DecoToolBox::getMinSize() return maMinSize; } +class RecentFilesStringLength : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XStringWidth > +{ + public: + RecentFilesStringLength() {} + virtual ~RecentFilesStringLength() {} + + // XStringWidth + sal_Int32 SAL_CALL queryStringWidth( const ::rtl::OUString& aString ) + throw (::com::sun::star::uno::RuntimeException) + { + return aString.getLength(); + } +}; + #define STC_BUTTON_STYLE (WB_LEFT | WB_VCENTER | WB_FLATBUTTON | WB_BEVELBUTTON) BackingWindow::BackingWindow( Window* i_pParent ) : Window( i_pParent, FwkResId( DLG_BACKING ) ), maWelcome( this, WB_LEFT ), maProduct( this, WB_LEFT ), - maWriterText( this, WB_WORDBREAK | WB_VCENTER ), maWriterButton( this, STC_BUTTON_STYLE ), - maCalcText( this, WB_WORDBREAK | WB_VCENTER ), maCalcButton( this, STC_BUTTON_STYLE ), - maImpressText( this, WB_WORDBREAK | WB_VCENTER ), maImpressButton( this, STC_BUTTON_STYLE ), - maOpenText( this, WB_WORDBREAK | WB_VCENTER ), maOpenButton( this, STC_BUTTON_STYLE ), - maDrawText( this, WB_WORDBREAK | WB_VCENTER ), maDrawButton( this, STC_BUTTON_STYLE ), - maDBText( this, WB_WORDBREAK | WB_VCENTER ), maDBButton( this, STC_BUTTON_STYLE ), - maMathText( this, WB_WORDBREAK | WB_VCENTER ), maMathButton( this, STC_BUTTON_STYLE ), - maTemplateText( this, WB_WORDBREAK | WB_VCENTER ), maTemplateButton( this, STC_BUTTON_STYLE ), maToolbox( this, WB_DIALOGCONTROL ), maWelcomeString( FwkResId( STR_BACKING_WELCOME ) ), @@ -141,7 +152,9 @@ BackingWindow::BackingWindow( Window* i_pParent ) : mbInitControls( false ), mnLayoutStyle( 0 ), mpAccExec( NULL ), - mnBtnPos( 120 ) + mnBtnPos( 120 ), + mnBtnTop( 150 ), + mpRecentMenu( NULL ) { mnColumnWidth[0] = mnColumnWidth[1] = 0; mnTextColumnWidth[0] = mnTextColumnWidth[1] = 0; @@ -171,16 +184,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) : { } - // get icon images from vcl resource and set them on the appropriate buttons - loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); - loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); - loadImage( FwkResId( BMP_BACKING_IMPRESS ), maImpressButton ); - loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); - loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); - loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); - loadImage( FwkResId( BMP_BACKING_FOLDER ), maOpenButton ); - loadImage( FwkResId( BMP_BACKING_FOLDER ), maTemplateButton ); - String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) ); String aRegHelpText( FwkResId( STR_BACKING_REGHELP ) ); String aInfoHelpText( FwkResId( STR_BACKING_INFOHELP ) ); @@ -195,10 +198,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) : SetStyle( GetStyle() | WB_DIALOGCONTROL ); - // add some breathing space for the images - maButtonImageSize.Width() += 12; - maButtonImageSize.Height() += 12; - // force tab cycling in toolbox maToolbox.SetStyle( maToolbox.GetStyle() | WB_FORCETABCYCLE ); @@ -244,11 +243,17 @@ BackingWindow::BackingWindow( Window* i_pParent ) : // init background initBackground(); + + // add some breathing space for the images + maButtonImageSize.Width() += 12; + maButtonImageSize.Height() += 12; + } BackingWindow::~BackingWindow() { + delete mpRecentMenu; delete mpAccExec; } @@ -277,6 +282,116 @@ 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( ( nPickListMenuItems > 0 ) ) + { + 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 ); + + nArgs--; + rArgsList[nArgs].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); + rArgsList[nArgs].Value = makeAny( aFilter ); + + 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<USHORT>(i+1), aBuf.makeStringAndClear() ); + } + maOpenButton.SetPopupMenu( mpRecentMenu ); + } +} + void BackingWindow::initBackground() { SetBackground( GetSettings().GetStyleSettings().GetWorkspaceGradient() ); @@ -324,22 +439,6 @@ void BackingWindow::initBackground() maWelcome.SetBackground(); maProduct.SetControlForeground( maWelcomeTextColor ); maProduct.SetBackground(); - maWriterText.SetControlForeground( maLabelTextColor ); - maWriterText.SetControlBackground( aTextBGColor ); - maCalcText.SetControlForeground( maLabelTextColor ); - maCalcText.SetControlBackground( aTextBGColor ); - maImpressText.SetControlForeground( maLabelTextColor ); - maImpressText.SetControlBackground( aTextBGColor ); - maDrawText.SetControlForeground( maLabelTextColor ); - maDrawText.SetControlBackground( aTextBGColor ); - maDBText.SetControlForeground( maLabelTextColor ); - maDBText.SetControlBackground( aTextBGColor ); - maMathText.SetControlForeground( maLabelTextColor ); - maMathText.SetControlBackground( aTextBGColor ); - maTemplateText.SetControlForeground( maLabelTextColor ); - maTemplateText.SetControlBackground( aTextBGColor ); - maOpenText.SetControlForeground( maLabelTextColor ); - maOpenText.SetControlBackground( aTextBGColor ); if( mnLayoutStyle == 1 ) { @@ -348,6 +447,20 @@ void BackingWindow::initBackground() else mnBtnPos = maBackgroundLeft.GetSizePixel().Width() + 40; } + + // get icon images from fwk resource and set them on the appropriate buttons + loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); + loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); + loadImage( FwkResId( BMP_BACKING_IMPRESS ), maImpressButton ); + loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); + loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); + loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); + loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); + loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + + maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); + maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) ); + maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) ); } void BackingWindow::initControls() @@ -456,35 +569,35 @@ void BackingWindow::initControls() } // layout the buttons - layoutButtonAndText( WRITER_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maWriterButton, maWriterText, aMnemns ); - layoutButtonAndText( DRAW_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SDRAW, - maDrawButton, maDrawText, aMnemns ); + layoutButton( WRITER_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maWriterButton, aMnemns ); + layoutButton( DRAW_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SDRAW, + maDrawButton, aMnemns ); nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( CALC_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SCALC, - maCalcButton, maCalcText, aMnemns ); - layoutButtonAndText( BASE_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SDATABASE, - maDBButton, maDBText, aMnemns ); + layoutButton( CALC_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SCALC, + maCalcButton, aMnemns ); + layoutButton( BASE_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SDATABASE, + maDBButton, aMnemns ); nYPos += maButtonImageSize.Height() + 10; - layoutButtonAndText( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SIMPRESS, - maImpressButton, maImpressText, aMnemns ); - layoutButtonAndText( MATH_URL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SMATH, - maMathButton, maMathText, aMnemns ); + layoutButton( IMPRESS_WIZARD_URL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SIMPRESS, + maImpressButton, aMnemns ); + layoutButton( MATH_URL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SMATH, + maMathButton, aMnemns ); nYPos += 3*maButtonImageSize.Height() / 2; - layoutButtonAndText( NULL, 0, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maOpenButton, maOpenText, aMnemns, maOpenString ); - layoutButtonAndText( NULL, 1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maTemplateButton, maTemplateText, aMnemns, maTemplateString ); + layoutButton( NULL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maOpenButton, aMnemns, maOpenString ); + layoutButton( NULL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maTemplateButton, aMnemns, maTemplateString ); nYPos += 10; DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" ); @@ -532,9 +645,11 @@ void BackingWindow::initControls() maBackgroundMiddle = BitmapEx(); Resize(); + + maWriterButton.GrabFocus(); } -void BackingWindow::loadImage( const ResId& i_rId, ImageButton& i_rButton ) +void BackingWindow::loadImage( const ResId& i_rId, PushButton& i_rButton ) { BitmapEx aBmp( i_rId ); Size aImgSize( aBmp.GetSizePixel() ); @@ -545,11 +660,11 @@ void BackingWindow::loadImage( const ResId& i_rId, ImageButton& i_rButton ) i_rButton.SetModeImage( aBmp ); } -void BackingWindow::layoutButtonAndText( +void BackingWindow::layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, - ImageButton& i_rBtn, FixedText& i_rText, + PushButton& i_rBtn, MnemonicGenerator& i_rMnemns, const String& i_rStr ) @@ -572,7 +687,7 @@ void BackingWindow::layoutButtonAndText( long nTextWidth = i_rBtn.GetTextWidth( i_rBtn.GetText() ); - nTextWidth += maButtonImageSize.Width(); + nTextWidth += maButtonImageSize.Width() + 8; // add some fuzz to be on the safe side if( nColumn >= 0 && nColumn < static_cast<int>(sizeof(mnColumnWidth)/sizeof(mnColumnWidth[0])) ) { if( nTextWidth > mnColumnWidth[nColumn] ) @@ -582,12 +697,6 @@ void BackingWindow::layoutButtonAndText( i_rBtn.SetImageAlign( IMAGEALIGN_LEFT ); // show the controls i_rBtn.Show(); - i_rText.Show( FALSE ); - - - // FIXME: the only reason the FixedTexts are left are not to trigger - // a translation change due to changed src files. For the next minor - // the FixedTexts should be removed completely } void BackingWindow::Paint( const Rectangle& ) @@ -635,8 +744,73 @@ long BackingWindow::Notify( NotifyEvent& rNEvt ) } const KeyEvent* pEvt = rNEvt.GetKeyEvent(); - if( pEvt && mpAccExec->execute(pEvt->GetKeyCode()) ) + const KeyCode& rKeyCode(pEvt->GetKeyCode()); + if( pEvt && mpAccExec->execute(rKeyCode) ) return 1; + // #i110344# extrawurst: specialized arrow key control + if( rKeyCode.GetModifier() == 0 ) + { + if( rKeyCode.GetCode() == KEY_RIGHT ) + { + if( maWriterButton.HasFocus() ) + maDrawButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maOpenButton.HasFocus() ) + maTemplateButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_LEFT ) + { + if( maDrawButton.HasFocus() ) + maWriterButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maTemplateButton.HasFocus() ) + maOpenButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_UP ) + { + // first column + if( maOpenButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maWriterButton.GrabFocus(); + // second column + else if( maTemplateButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maDrawButton.GrabFocus(); + return 1; + } + else if( rKeyCode.GetCode() == KEY_DOWN ) + { + // first column + if( maWriterButton.HasFocus() ) + maCalcButton.GrabFocus(); + else if( maCalcButton.HasFocus() ) + maImpressButton.GrabFocus(); + else if( maImpressButton.HasFocus() ) + maOpenButton.GrabFocus(); + // second column + else if( maDrawButton.HasFocus() ) + maDBButton.GrabFocus(); + else if( maDBButton.HasFocus() ) + maMathButton.GrabFocus(); + else if( maMathButton.HasFocus() ) + maTemplateButton.GrabFocus(); + return 1; + } + } } return Window::Notify( rNEvt ); } @@ -696,6 +870,9 @@ void BackingWindow::Resize() nYPos += nWDelta/2 - nDiff; + if( mnLayoutStyle != 1 ) + nYPos = maControlRect.Top() + mnBtnTop; + maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( mnTextColumnWidth[0], maButtonImageSize.Height() ) ); maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), Size( mnTextColumnWidth[1], maButtonImageSize.Height() ) ); nYPos += nBDelta - nDiff; @@ -865,52 +1042,25 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) return 0; } -Window* BackingWindow::GetParentLabelFor( const Window* pLabel ) const +IMPL_LINK( BackingWindow, SelectHdl, Button*, pButton ) { - const Window* pRet = NULL; - - if( pLabel == &maWriterText ) - pRet = &maWriterButton; - else if( pLabel == &maCalcText ) - pRet = &maCalcButton; - else if( pLabel == &maImpressText ) - pRet = &maImpressButton; - else if( pLabel == &maDrawText ) - pRet = &maDrawButton; - else if( pLabel == &maDBText ) - pRet = &maDBButton; - else if( pLabel == &maMathText ) - pRet = &maMathButton; - else if( pLabel == &maTemplateText ) - pRet = &maTemplateButton; - else if( pLabel == &maOpenText ) - pRet = &maOpenButton; - - return const_cast<Window*>(pRet); + 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; } -Window* BackingWindow::GetParentLabeledBy( const Window* pLabeled ) const +IMPL_LINK( BackingWindow, ActivateHdl, Button*, pButton ) { - const Window *pRet = NULL; - - if( pLabeled == &maWriterButton ) - pRet = &maWriterText; - else if( pLabeled == &maCalcButton ) - pRet = &maCalcText; - else if( pLabeled == &maImpressButton ) - pRet = &maImpressText; - else if( pLabeled == &maDrawButton ) - pRet = &maDrawText; - else if( pLabeled == &maDBButton ) - pRet = &maDBText; - else if( pLabeled == &maMathButton ) - pRet = &maMathText; - else if( pLabeled == &maTemplateButton ) - pRet = &maTemplateText; - else if( pLabeled == &maOpenButton ) - pRet = &maOpenText; - - return const_cast<Window*>(pRet); + if( pButton == &maOpenButton ) + prepareRecentFileMenu(); + return 0; } struct ImplDelayedDispatch diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index 7b7dfa34b110..958ebfbb243e 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -31,6 +31,7 @@ #include "rtl/ustring.hxx" #include "vcl/button.hxx" +#include "vcl/menubtn.hxx" #include "vcl/fixed.hxx" #include "vcl/bitmapex.hxx" #include "vcl/toolbox.hxx" @@ -77,6 +78,12 @@ 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::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; @@ -86,21 +93,13 @@ namespace framework Size maWelcomeSize; FixedText maProduct; Size maProductSize; - FixedText maWriterText; ImageButton maWriterButton; - FixedText maCalcText; ImageButton maCalcButton; - FixedText maImpressText; ImageButton maImpressButton; - FixedText maOpenText; - ImageButton maOpenButton; - FixedText maDrawText; + MenuButton maOpenButton; ImageButton maDrawButton; - FixedText maDBText; ImageButton maDBButton; - FixedText maMathText; ImageButton maMathButton; - FixedText maTemplateText; ImageButton maTemplateButton; DecoToolBox maToolbox; @@ -129,6 +128,10 @@ namespace framework sal_Int32 mnLayoutStyle; svt::AcceleratorExecute* mpAccExec; long mnBtnPos; + long mnBtnTop; + + PopupMenu* mpRecentMenu; + std::vector< LoadRecentFile > maRecentFiles; static const int nItemId_Extensions = 1; static const int nItemId_Reg = 2; @@ -139,14 +142,14 @@ namespace framework static const int nShadowRight = 45; static const int nShadowBottom = 50; - void loadImage( const ResId& i_rId, ImageButton& i_rButton ); + void loadImage( const ResId& i_rId, PushButton& i_rButton ); - void layoutButtonAndText( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, - SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, - ImageButton& i_rBtn, FixedText& i_rText, - MnemonicGenerator& i_rMnemonicGen, - const String& i_rStr = String() - ); + void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, + SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, + PushButton& i_rBtn, + MnemonicGenerator& i_rMnemonicGen, + const String& i_rStr = String() + ); void dispatchURL( const rtl::OUString& i_rURL, const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ), @@ -155,10 +158,13 @@ namespace framework ); DECL_LINK( ClickHdl, Button* ); + DECL_LINK( SelectHdl, Button* ); + DECL_LINK( ActivateHdl, Button* ); DECL_LINK( ToolboxHdl, void* ); void initControls(); void initBackground(); + void prepareRecentFileMenu(); public: BackingWindow( Window* pParent ); ~BackingWindow(); @@ -167,9 +173,7 @@ namespace framework virtual void Resize(); virtual long Notify( NotifyEvent& rNEvt ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual Window* GetParentLabelFor( const Window* pLabel ) const; - virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; - virtual void GetFocus(); + virtual void GetFocus(); void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); }; diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index dbdc3875df9b..dfc6225b4572 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -1551,8 +1551,9 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() th css::uno::Reference< css::frame::XController > SAL_CALL Frame::getController() throw( css::uno::RuntimeException ) { /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ + // It seems to be unavoidable that disposed frames allow to ask for a Controller (#111452) // Register transaction and reject wrong calls. - TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + // TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); diff --git a/framework/source/services/fwk_services.src b/framework/source/services/fwk_services.src index 7e2ee3253e71..ef037c75778a 100644 --- a/framework/source/services/fwk_services.src +++ b/framework/source/services/fwk_services.src @@ -51,35 +51,7 @@ Window DLG_BACKING }; String STR_BACKING_FILE { - Text [ en-US ] = "~Open a document..."; - }; - Bitmap BMP_BACKING_WRITER - { - File = "odt_32.png"; - }; - Bitmap BMP_BACKING_CALC - { - File = "ods_32.png"; - }; - Bitmap BMP_BACKING_IMPRESS - { - File = "odp_32.png"; - }; - Bitmap BMP_BACKING_DRAW - { - File = "odg_32.png"; - }; - Bitmap BMP_BACKING_DATABASE - { - File = "odb_32.png"; - }; - Bitmap BMP_BACKING_FORMULA - { - File = "odf_32.png"; - }; - Bitmap BMP_BACKING_FOLDER - { - File = "folder_32.png"; + Text [ en-US ] = "~Open..."; }; String STR_BACKING_EXTHELP { @@ -137,6 +109,38 @@ Resource RES_BACKING_IMAGES { File = "addtemplate_32.png"; }; + Bitmap BMP_BACKING_WRITER + { + File = "odt_32.png"; + }; + Bitmap BMP_BACKING_CALC + { + File = "ods_32.png"; + }; + Bitmap BMP_BACKING_IMPRESS + { + File = "odp_32.png"; + }; + Bitmap BMP_BACKING_DRAW + { + File = "odg_32.png"; + }; + Bitmap BMP_BACKING_DATABASE + { + File = "odb_32.png"; + }; + Bitmap BMP_BACKING_FORMULA + { + File = "odf_32.png"; + }; + Bitmap BMP_BACKING_OPENFILE + { + File = "folder_32.png"; + }; + Bitmap BMP_BACKING_OPENTEMPLATE + { + File = "templates_32.png"; + }; }; Resource RES_BACKING_IMAGES_HC @@ -177,6 +181,38 @@ Resource RES_BACKING_IMAGES_HC { File = "template_hc.png"; }; + Bitmap BMP_BACKING_WRITER + { + File = "odt_32_hc.png"; + }; + Bitmap BMP_BACKING_CALC + { + File = "ods_32_hc.png"; + }; + Bitmap BMP_BACKING_IMPRESS + { + File = "odp_32_hc.png"; + }; + Bitmap BMP_BACKING_DRAW + { + File = "odg_32_hc.png"; + }; + Bitmap BMP_BACKING_DATABASE + { + File = "odb_32_hc.png"; + }; + Bitmap BMP_BACKING_FORMULA + { + File = "odf_32_hc.png"; + }; + Bitmap BMP_BACKING_OPENFILE + { + File = "folder_32_hc.png"; + }; + Bitmap BMP_BACKING_OPENTEMPLATE + { + File = "templates_32_hc.png"; + }; }; Window WIN_TABWINDOW diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index e248bb0e9480..b626ce81b2dd 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -857,6 +857,7 @@ void PathSettings::impl_setPathValue( sal_Int32 nID , ::rtl::OUString sVal; aVal >>= sVal; OUStringList lList = impl_convertOldStyle2Path(sVal); + impl_subst(lList, fa_getSubstitution(), sal_False); impl_purgeKnownPaths(aChangePath, lList); if (! impl_isValidPath(lList)) throw css::lang::IllegalArgumentException(); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index d262c344d711..988168547e4d 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -120,7 +120,8 @@ static const char* UIELEMENTTYPENAMES[] = UIELEMENTTYPE_TOOLBAR_NAME, UIELEMENTTYPE_STATUSBAR_NAME, UIELEMENTTYPE_FLOATINGWINDOW_NAME, - UIELEMENTTYPE_PROGRESSBAR_NAME + UIELEMENTTYPE_PROGRESSBAR_NAME, + UIELEMENTTYPE_TOOLPANEL_NAME }; static const char RESOURCEURL_PREFIX[] = "private:resource/"; @@ -292,11 +293,12 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData )); } } + rElementTypeData.bLoaded = true; } } } - rElementTypeData.bLoaded = true; + //rElementTypeData.bLoaded = true; } void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData ) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index df2495dd6bb1..366e58c0adb2 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -118,7 +118,8 @@ static const char* UIELEMENTTYPENAMES[] = UIELEMENTTYPE_TOOLBAR_NAME, UIELEMENTTYPE_STATUSBAR_NAME, UIELEMENTTYPE_FLOATINGWINDOW_NAME, - UIELEMENTTYPE_PROGRESSBAR_NAME + UIELEMENTTYPE_PROGRESSBAR_NAME, + UIELEMENTTYPE_TOOLPANEL_NAME }; static const char RESOURCEURL_PREFIX[] = "private:resource/"; diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 3921625cc76f..058005ffdc40 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 0672ac69d351..49501194a014 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -61,6 +61,7 @@ #include <vcl/image.hxx> #include <svtools/menuoptions.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> // Copied from svx // Function-Id's @@ -213,7 +214,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ControlMenuController DEFINE_INIT_SERVICE ( ControlMenuController, {} ) ControlMenuController::ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_pResPopupMenu( 0 ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); @@ -272,7 +273,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -286,7 +287,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run // XStatusListener void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); USHORT nMenuId = 0; for (sal_uInt32 i=0; i < sizeof(aCommands)/sizeof(aCommands[0]); ++i) @@ -351,7 +352,7 @@ void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispat void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { @@ -404,10 +405,9 @@ void ControlMenuController::impl_setPopupMenu() void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( m_xFrame.is() && m_xPopupMenu.is() ) { @@ -435,8 +435,8 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star:: // XInitialization void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); - PopupMenuControllerBase::initialize(aArguments); + osl::ResettableMutexGuard aLock( m_aMutex ); + svt::PopupMenuControllerBase::initialize(aArguments); m_aBaseURL = ::rtl::OUString(); } diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 43b50eb2a49a..0800103c743e 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 3ad4b11fd1e9..387213d7c3eb 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 7110ea5aa519..c2625a951efb 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -59,6 +59,7 @@ #include <vcl/mnemonic.hxx> #endif #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -91,7 +92,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( FontMenuController DEFINE_INIT_SERVICE ( FontMenuController, {} ) FontMenuController::FontMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) { } @@ -145,7 +146,7 @@ void SAL_CALL FontMenuController::disposing( const EventObject& ) throw ( Runtim { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xFontListDispatch.clear(); @@ -164,12 +165,12 @@ void SAL_CALL FontMenuController::statusChanged( const FeatureStateEvent& Event if ( Event.State >>= aFontDescriptor ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontFamilyName = aFontDescriptor.Name; } else if ( Event.State >>= aFontNameSeq ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) fillPopupMenu( aFontNameSeq, m_xPopupMenu ); } @@ -192,7 +193,7 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { @@ -241,14 +242,14 @@ void FontMenuController::impl_setPopupMenu() void SAL_CALL FontMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< XDispatch > xDispatch( m_xFontListDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontNameList" )); m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 8dbd608a28e0..58cf3a3b02be 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -64,6 +64,7 @@ #include <svtools/ctrltool.hxx> #endif #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -90,7 +91,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( FontSizeMenuController DEFINE_INIT_SERVICE ( FontSizeMenuController, {} ) FontSizeMenuController::FontSizeMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_pHeightArray( 0 ), m_bRebuildMenu( sal_True ) { @@ -280,7 +281,7 @@ void SAL_CALL FontSizeMenuController::disposing( const EventObject& ) throw ( Ru { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xCurrentFontDispatch.clear(); @@ -297,7 +298,7 @@ void SAL_CALL FontSizeMenuController::statusChanged( const FeatureStateEvent& Ev if ( Event.State >>= aFontDescriptor ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontDescriptor = aFontDescriptor; if ( m_xPopupMenu.is() ) @@ -306,7 +307,7 @@ void SAL_CALL FontSizeMenuController::statusChanged( const FeatureStateEvent& Ev } else if ( Event.State >>= aFontHeight ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontHeight = aFontHeight; if ( m_xPopupMenu.is() ) @@ -341,16 +342,15 @@ void FontSizeMenuController::impl_setPopupMenu() void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< XDispatch > xDispatch( m_xCurrentFontDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )); m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { @@ -358,6 +358,6 @@ void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star xDispatch->removeStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); } - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); } } diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 50b2ed65e2d2..c0d7b48a401b 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -50,7 +50,6 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -65,6 +64,7 @@ #include <rtl/ustrbuf.hxx> //#include <tools/solar.hrc> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -97,7 +97,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( HeaderMenuController DEFINE_INIT_SERVICE ( HeaderMenuController, {} ) HeaderMenuController::HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) ,m_bFooter(_bFooter) { } @@ -221,7 +221,7 @@ void SAL_CALL HeaderMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -238,7 +238,7 @@ void SAL_CALL HeaderMenuController::statusChanged( const FeatureStateEvent& Even if ( Event.State >>= xModel ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xModel = xModel; if ( m_xPopupMenu.is() ) fillPopupMenu( xModel, m_xPopupMenu ); @@ -258,18 +258,17 @@ void HeaderMenuController::impl_select(const Reference< XDispatch >& _xDispatch, void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< com::sun::star::frame::XModel > xModel( m_xModel ); - aLock.unlock(); + aLock.clear(); if ( !xModel.is() ) - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); - aLock.lock(); + aLock.reset(); if ( m_xPopupMenu.is() && m_xModel.is() ) fillPopupMenu( m_xModel, m_xPopupMenu ); } diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 887002335ff8..e883b236584a 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XControlNotificationListener.hpp> #include "com/sun/star/util/XMacroExpander.hpp" #include "com/sun/star/uno/XComponentContext.hpp" diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index 9c8e68e24734..651c9bbfdc86 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" + #include <uielement/langselectionmenucontroller.hxx> //_________________________________________________________________________________________________________________ @@ -63,7 +64,7 @@ #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> -#include <map> + #include <i18npool/mslangid.hxx> #include <svl/languageoptions.hxx> #include <com/sun/star/awt/MenuItemStyle.hpp> @@ -76,6 +77,10 @@ #include <dispatch/uieventloghelper.hxx> #include "helper/mischelper.hxx" +#include <vos/mutex.hxx> + +#include <map> +#include <set> //_________________________________________________________________________________________________________________ // Defines @@ -88,6 +93,7 @@ using namespace com::sun::star::frame; using namespace com::sun::star::beans; using namespace com::sun::star::util; +using ::rtl::OUString; namespace framework { @@ -101,9 +107,9 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LanguageSelectionMenuController DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} ) LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), - m_bShowMenu( sal_True ) - ,m_aLangGuessHelper(xServiceManager) + svt::PopupMenuControllerBase( xServiceManager ), + m_bShowMenu( sal_True ), + m_aLangGuessHelper( xServiceManager ) { } @@ -116,7 +122,7 @@ void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) t { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xLanguageDispatch.clear(); @@ -132,29 +138,25 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( m_bDisposed ) + if (rBHelper.bDisposed || rBHelper.bInDispose) return; m_bShowMenu = sal_True; - m_nScriptType=7;//set the default value + m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value - rtl::OUString aStrValue; - Sequence< ::rtl::OUString > aSeq; + OUString aStrValue; + Sequence< OUString > aSeq; - if ( Event.State >>= aStrValue ) - { - m_aCurrentLanguage=aStrValue; - } - else if ( Event.State >>= aSeq ) + if ( Event.State >>= aSeq ) { if ( aSeq.getLength() == 4 ) { // Retrieve all other values from the sequence and // store it members! - m_aCurLang=aSeq[0]; - m_nScriptType= static_cast< sal_Int16 >(aSeq[1].toInt32()); - m_aKeyboardLang=aSeq[2]; - m_aGuessedText=aSeq[3]; + m_aCurLang = aSeq[0]; + m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + m_aKeyboardLang = aSeq[2]; + m_aGuessedTextLang = aSeq[3]; } } else if ( !Event.State.hasValue() ) @@ -185,14 +187,14 @@ void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& { Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); if ( xDispatchProvider.is() ) - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); } if ( xDispatch.is() ) { Sequence<PropertyValue> aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# - UiEventLogHelper(::rtl::OUString::createFromAscii("LanguageSelectionMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); + UiEventLogHelper( OUString::createFromAscii("LanguageSelectionMenuController")).log( m_xServiceManager, m_xFrame, aTargetURL, aArgs ); xDispatch->dispatch( aTargetURL, aArgs ); } } @@ -207,22 +209,22 @@ void LanguageSelectionMenuController::impl_setPopupMenu() // Register for language updates aTargetURL.Complete = m_aLangStatusCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for setting languages and opening language dialog aTargetURL.Complete = m_aMenuCommandURL_Lang; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for opening character dialog aTargetURL.Complete = m_aMenuCommandURL_Font; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); // Register for opening character dialog with preselected paragraph aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph; m_xURLTransformer->parseStrict( aTargetURL ); - m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); } void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode ) @@ -244,151 +246,91 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup String aCmd_Language; if( eMode == MODE_SetLanguageSelectionMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:FontDialog?Language:string=*"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_"); + aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_"); } else if ( eMode == MODE_SetLanguageParagraphMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:FontDialogForParagraph"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); + aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_"); } else if ( eMode == MODE_SetLanguageAllTextMenu ) { - aCmd_Dialog+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=*"); - aCmd_Language+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Default_"); + aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*"); + aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_"); } - //Reference< awt::XMenuExtended > m_xMenuExtended( m_xPopupMenu, UNO_QUERY ); - std::map< ::rtl::OUString, ::rtl::OUString > LangItems; - - SvtLanguageTable aLanguageTable; - USHORT nItemId = 1; - - //1--add current language - if(m_aCurLang.getLength()) + SvtLanguageTable aLanguageTable; + + // get languages to be displayed in the menu + std::set< OUString > aLangItems; + FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, + m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); + + // + // now add menu entries + // the different menues purpose will be handled by the different string + // for aCmd_Dialog and aCmd_Language + // + + sal_Int16 nItemId = 1; // in this control the item id is not important for executing the command + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::map< sal_Int16, OUString > aLangMap; + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - LangItems[m_aCurLang]=m_aCurLang; - } - - SvtLanguageTable aLangTable; - //2--System - const AllSettings& rAllSettings=Application::GetSettings(); - LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if(rSystemLanguage!=LANGUAGE_DONTKNOW) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType,rSystemLanguage )) - LangItems[::rtl::OUString(aLangTable.GetString(rSystemLanguage))]=::rtl::OUString(aLangTable.GetString(rSystemLanguage)); - } - - //3--UI - LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if(rUILanguage!=LANGUAGE_DONTKNOW) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType, rUILanguage )) - LangItems[::rtl::OUString(aLangTable.GetString(rUILanguage))]=::rtl::OUString(aLangTable.GetString(rUILanguage)); - } - - //4--guessed language - uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() ); - if (xLangGuesser.is() && m_aGuessedText.getLength() > 0) - { - ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) ); - LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); - if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM - && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang )) - LangItems[aLangTable.GetString(nLang)]=aLangTable.GetString(nLang); - } - - //5--keyboard language - if(m_aKeyboardLang!=::rtl::OUString::createFromAscii("")) - { - if (IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(m_aKeyboardLang))) - LangItems[m_aKeyboardLang] = m_aKeyboardLang; - } - - //6--all languages used in current document - Reference< com::sun::star::frame::XModel > xModel; - if ( m_xFrame.is() ) - { - Reference< com::sun::star::frame::XController > xController( m_xFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); - /*the description of m_nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 - */ - - sal_Int16 nCount=7; - if(xDocumentLanguages.is()) - { - Sequence< Locale > rLocales(xDocumentLanguages->getDocumentLanguages(m_nScriptType,nCount)); - if(rLocales.getLength()>0) - { - for(USHORT i = 0; i<rLocales.getLength();++i) - { - if (LangItems.size()==7) - break; - const Locale& rLocale=rLocales[i]; - if(IsScriptTypeMatchingToLanguage(m_nScriptType, aLanguageTable.GetType(rLocale.Language))) - LangItems[rLocale.Language] = rLocale.Language; - } - } - } - std::map< sal_Int16, ::rtl::OUString > LangTable; - - const ::rtl::OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); - for(std::map< ::rtl::OUString, ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it) - { - if(it->first != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - it->first != sAsterix && - it->first.getLength()) + const OUString & rStr( *it ); + if (rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + rStr != sAsterix && + rStr != sEmpty) { - ++nItemId; - pPopupMenu->InsertItem( nItemId,it->first); - LangTable[nItemId] = it->first; - if(it->first == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) + pPopupMenu->InsertItem( nItemId, rStr ); + aCmd = aCmd_Language; + aCmd += String( rStr ); + pPopupMenu->SetItemCommand( nItemId, aCmd ); + if (rStr == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) { //make a sign for the current language - pPopupMenu->CheckItem(nItemId,TRUE); + pPopupMenu->CheckItem( nItemId, TRUE ); } - aCmd=aCmd_Language; - aCmd+=(String)it->first; - pPopupMenu->SetItemCommand(nItemId,aCmd); + aLangMap[ nItemId ] = rStr; + ++nItemId; } } - //7--none - nItemId++; + // entry for LANGUAGE_NONE + ++nItemId; pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) ); aCmd=aCmd_Language; - aCmd+=String::CreateFromAscii("LANGUAGE_NONE"); - pPopupMenu->SetItemCommand(nItemId,aCmd); + aCmd.AppendAscii("LANGUAGE_NONE"); + pPopupMenu->SetItemCommand( nItemId, aCmd ); + + // entry for 'Reset to default language' + ++nItemId; + pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) ); + aCmd=aCmd_Language; + aCmd.AppendAscii("RESET_LANGUAGES"); + pPopupMenu->SetItemCommand( nItemId, aCmd ); - //More... - nItemId++; + // entry for opening the Format/Character dialog + ++nItemId; pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE ))); - pPopupMenu->SetItemCommand(nItemId,aCmd_Dialog); + pPopupMenu->SetItemCommand( nItemId, aCmd_Dialog ); } void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); // Force status update to get information about the current languages - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< XDispatch > xDispatch( m_xLanguageDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = m_aLangStatusCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { @@ -415,19 +357,19 @@ void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com:: // XInitialization void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize(aArguments); + svt::PopupMenuControllerBase::initialize(aArguments); if ( m_bInitialized ) { - m_aLangStatusCommandURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); + m_aLangStatusCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); m_aMenuCommandURL_Lang = m_aLangStatusCommandURL; - m_aMenuCommandURL_Font = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); - m_aMenuCommandURL_CharDlgForParagraph = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); + m_aMenuCommandURL_Font = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); + m_aMenuCommandURL_CharDlgForParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); } } } diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index 953470314785..021ee4e8f8df 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" + #include <uielement/langselectionstatusbarcontroller.hxx> #include <classes/fwkresid.hxx> #include <services.h> @@ -53,8 +54,6 @@ #include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <map> -#include <set> #include <classes/fwkresid.hxx> #ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_ #include <classes/resource.hrc> @@ -74,6 +73,9 @@ #include "helper/mischelper.hxx" +#include <map> +#include <set> + using namespace ::cppu; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -82,9 +84,14 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::document; +using ::rtl::OUString; + + namespace framework { +//////////////////////////////////////////////////////////// + DEFINE_XSERVICEINFO_MULTISERVICE ( LangSelectionStatusbarController , OWeakObject , SERVICENAME_STATUSBARCONTROLLER , @@ -94,10 +101,10 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LangSelectionStatusbarController DEFINE_INIT_SERVICE ( LangSelectionStatusbarController, {} ) LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) : - svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 ), + svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), OUString(), 0 ), m_bShowMenu( sal_True ), - m_nScriptType( 7 ) - ,m_aLangGuessHelper(xServiceManager) + m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ), + m_aLangGuessHelper( xServiceManager ) { } @@ -178,216 +185,158 @@ throw (::com::sun::star::uno::RuntimeException) return sal_False; } -void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::RuntimeException) +void LangSelectionStatusbarController::LangMenu() +throw (::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::LangMenu" ); if (!m_bShowMenu) return; //add context menu - const static ::rtl::OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu")); + const static OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu")); Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY ); //sub menu that contains all items except the last two items: Separator + Set Language for Paragraph Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY ); - std::set< ::rtl::OUString > LangItems; - - SvtLanguageTable aLanguageTable; - USHORT nItemId=1; - - //1--add current language - if( m_aCurLang != ::rtl::OUString( ) && - LANGUAGE_DONTKNOW != aLanguageTable.GetType( m_aCurLang )) - LangItems.insert( m_aCurLang ); - - //2--System - SvtLanguageTable aLangTable; - const AllSettings& rAllSettings = Application::GetSettings(); - LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if( rSystemLanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rSystemLanguage )) - LangItems.insert( ::rtl::OUString( aLangTable.GetString( rSystemLanguage )) ); - } - - //3--UI - LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if( rUILanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, rUILanguage )) - LangItems.insert( ::rtl::OUString( aLangTable.GetString( rUILanguage )) ); - } - - //4--guessed language - uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( m_aLangGuessHelper.GetGuesser() ); - if ( xLangGuesser.is() && m_aGuessedText.getLength() > 0) - { - ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( m_aGuessedText, 0, m_aGuessedText.getLength()) ); - LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); - if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM - && IsScriptTypeMatchingToLanguage( m_nScriptType, nLang )) - LangItems.insert( aLangTable.GetString( nLang )); - } - - //5--keyboard language - if( m_aKeyboardLang != ::rtl::OUString::createFromAscii( "" )) + SvtLanguageTable aLanguageTable; + + // get languages to be displayed in the menu + std::set< OUString > aLangItems; + FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, + m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); + + // + // add first few entries to main menu + // + sal_Int16 nItemId = static_cast< sal_Int16 >(MID_LANG_SEL_1); + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::map< sal_Int16, OUString > aLangMap; + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - if ( IsScriptTypeMatchingToLanguage( m_nScriptType, aLanguageTable.GetType( m_aKeyboardLang ))) - LangItems.insert( m_aKeyboardLang ); - } - - //6--all languages used in current document - Reference< com::sun::star::frame::XModel > xModel; - if ( m_xFrame.is() ) - { - Reference< com::sun::star::frame::XController > xController( m_xFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); - /*the description of m_nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 - */ - - sal_Int16 nCount=7; - if ( xDocumentLanguages.is() ) - { - Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( m_nScriptType, nCount )); - if ( rLocales.getLength() > 0 ) + const OUString & rStr( *it ); + if ( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) ) && + rStr != sAsterix && + rStr != sEmpty) { - for ( USHORT i = 0; i<rLocales.getLength();++i ) - { - if ( LangItems.size() == 7 ) - break; - const Locale& rLocale=rLocales[i]; - if( IsScriptTypeMatchingToLanguage( m_nScriptType, aLangTable.GetType( rLocale.Language ))) - LangItems.insert( ::rtl::OUString( rLocale.Language ) ); - } - } - } - std::map< sal_Int16, ::rtl::OUString > LangTable; - - for( std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it ) - { - if ( *it != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - *it != ::rtl::OUString::createFromAscii( "*" ) && - *it != ::rtl::OUString::createFromAscii( "" )) - { - //nItemId = xPopupMenu->getItemCount()+1; - nItemId++; - xPopupMenu->insertItem( nItemId, *it, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - LangTable[nItemId]=*it; - if( *it == m_aCurLang ) + DBG_ASSERT( MID_LANG_SEL_1 <= nItemId && nItemId <= MID_LANG_SEL_9, + "nItemId outside of expected range!" ); + xPopupMenu->insertItem( nItemId, rStr, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); + if ( rStr == m_aCurLang ) { //make a sign for the current language xPopupMenu->checkItem( nItemId, TRUE ); } + aLangMap[ nItemId ] = rStr; + ++nItemId; } } - - //7--none - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - //More... - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - - for( ::std::set< ::rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it ) + xPopupMenu->insertItem( MID_LANG_SEL_NONE, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_NONE ); + xPopupMenu->insertItem( MID_LANG_SEL_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_RESET ); + xPopupMenu->insertItem( MID_LANG_SEL_MORE, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_MORE ); + + // + // add entries to submenu ('set language for paragraph') + // + nItemId = static_cast< sal_Int16 >(MID_LANG_PARA_1); + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - if( *it != ::rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - *it != ::rtl::OUString::createFromAscii( "*" ) && - *it != ::rtl::OUString::createFromAscii( "" )) + const OUString & rStr( *it ); + if( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + rStr != sAsterix && + rStr != sEmpty) { - nItemId++; - subPopupMenu->insertItem( nItemId, *it, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - LangTable[nItemId]=*it; + DBG_ASSERT( MID_LANG_PARA_1 <= nItemId && nItemId <= MID_LANG_PARA_9, + "nItemId outside of expected range!" ); + subPopupMenu->insertItem( nItemId, rStr, css::awt::MenuItemStyle::RADIOCHECK, nItemId ); + aLangMap[nItemId] = rStr; + ++nItemId; } } - //7--none - nItemId++; - subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - //More - nItemId++; - subPopupMenu->insertItem( nItemId, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, nItemId ); + subPopupMenu->insertItem( MID_LANG_PARA_NONE, String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_NONE ); + subPopupMenu->insertItem( MID_LANG_PARA_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_RESET ); + subPopupMenu->insertItem( MID_LANG_PARA_MORE, String( FwkResId( STR_LANGSTATUS_MORE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_MORE ); - nItemId++; - xPopupMenu->insertSeparator(nItemId); + // + // add last two entries to main menu + // + xPopupMenu->insertSeparator( MID_LANG_PARA_SEPERATOR ); + xPopupMenu->insertItem( MID_LANG_PARA_STRING, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_PARA_STRING ); + xPopupMenu->setPopupMenu( MID_LANG_PARA_STRING, subPopupMenu ); - nItemId++; - xPopupMenu->insertItem( nItemId, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), css::awt::MenuItemStyle::RADIOCHECK, nItemId ); - xPopupMenu->setPopupMenu( nItemId, subPopupMenu ); - //display the popup menu and execute every command + // + // now display the popup menu and execute every command ... + // Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY ); - com::sun::star::awt::Rectangle mRectangle; + com::sun::star::awt::Rectangle aRectangle; Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow ); const Point mMousePos = pWindow->GetPointerPosPixel(); - mRectangle.X = mMousePos.X(); - mRectangle.Y = mMousePos.Y(); - sal_Int16 nId = xPopupMenu->execute( xParent, mRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); + aRectangle.X = mMousePos.X(); + aRectangle.Y = mMousePos.Y(); + sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); //click "More..." if ( nId && m_xFrame.is() ) { uno::Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); util::URL aURL; - if ( nId < nItemId-3-subPopupMenu->getItemCount() ) + if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9) { - //1..7 //set selected language as current language for selection - String SelectedLang = LangTable[nId]; - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_"); - aURL.Complete+=SelectedLang; + String aSelectedLang = aLangMap[nId]; + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_"); + aURL.Complete += aSelectedLang; } - else if ( nId == nItemId-3-subPopupMenu->getItemCount() ) + else if (nId == MID_LANG_SEL_NONE) { - //8 //set None as current language for selection - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); + } + else if (nId == MID_LANG_SEL_RESET) + { + // reset language attributes for selection + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES"); } - else if ( nId == nItemId-2-subPopupMenu->getItemCount() ) + else if (nId == MID_LANG_SEL_MORE) { - //9 (more)... //open the dialog "format/character" for current selection - aURL.Complete+=String::CreateFromAscii(".uno:FontDialog?Language:string=*"); + aURL.Complete += OUString::createFromAscii(".uno:FontDialog?Language:string=*"); } - else if ( nId < nItemId-3 && nId>nItemId-2-subPopupMenu->getItemCount() ) + else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9) { - //1..7 para //set selected language for current paragraph - String SelectedLang = LangTable[nId]; - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); - aURL.Complete+=SelectedLang; + String aSelectedLang = aLangMap[nId]; + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_"); + aURL.Complete += aSelectedLang; } - else if ( nId==nItemId-3 ) + else if (nId == MID_LANG_PARA_NONE) { - //8 para //set None as language for current paragraph - aURL.Complete+=String::CreateFromAscii(".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); } - else if ( nId==nItemId-2 ) + else if (nId == MID_LANG_PARA_RESET) + { + // reset language attributes for paragraph + aURL.Complete += OUString::createFromAscii(".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"); + } + else if (nId == MID_LANG_PARA_MORE) { - //9 (more) para... //open the dialog "format/character" for current paragraph - aURL.Complete+=String::CreateFromAscii(".uno:FontDialogForParagraph"); + aURL.Complete += OUString::createFromAscii(".uno:FontDialogForParagraph"); } - uno::Reference< util::XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); + uno::Reference< util::XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY ); xURLTransformer->parseStrict( aURL ); - uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL,::rtl::OUString(),0); + uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, OUString(), 0); if( xDispatch.is() ) { uno::Sequence< beans::PropertyValue > aPV; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# - UiEventLogHelper(::rtl::OUString::createFromAscii("ButtonToolbarController")).log(m_xServiceManager, m_xFrame, aURL, aPV); + UiEventLogHelper( OUString::createFromAscii("ButtonToolbarController")).log(m_xServiceManager, m_xFrame, aURL, aPV); xDispatch->dispatch( aURL, aPV); } } @@ -436,6 +385,13 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { + // This function will be called when observed data changes, + // for example the selection or keyboard language. + // - It displays the language in use in the status bar + // - and it stores the relevant data for creating the menu + // at some later point in the member variables + // m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedText + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::statusChanged" ); vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); @@ -444,25 +400,22 @@ throw ( RuntimeException ) m_bShowMenu = sal_True; - m_nScriptType=7;//set the default value + m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 ) { - rtl::OUString aStrValue; - Sequence< ::rtl::OUString > aSeq; + OUString aStrValue; + Sequence< OUString > aSeq; StatusBar* pStatusBar = (StatusBar *)pWindow; if ( Event.State >>= aStrValue ) - { pStatusBar->SetItemText( m_nID, aStrValue ); - m_aCurrentLanguage = aStrValue; - } else if ( Event.State >>= aSeq ) { if ( aSeq.getLength() == 4 ) { const String aMultipleLangText( FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) ); - ::rtl::OUString aStatusText = aSeq[0]; + OUString aStatusText = aSeq[0]; if ( 0 == aStatusText.compareToAscii( "*" )) aStatusText = aMultipleLangText; pStatusBar->SetItemText( m_nID, aStatusText ); @@ -472,7 +425,7 @@ throw ( RuntimeException ) m_aCurLang = aSeq[0]; m_nScriptType = static_cast< sal_Int16 >( aSeq[1].toInt32() ); m_aKeyboardLang = aSeq[2]; - m_aGuessedText = aSeq[3]; + m_aGuessedTextLang = aSeq[3]; } } else if ( !Event.State.hasValue() ) diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 7424b871a05f..679067cbd5c3 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -48,6 +48,7 @@ #include <rtl/ustrbuf.hxx> #include <dispatch/uieventloghelper.hxx> #include "helper/mischelper.hxx" +#include <vos/mutex.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -70,7 +71,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( MacrosMenuController DEFINE_INIT_SERVICE ( MacrosMenuController, {} ) MacrosMenuController::MacrosMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_xServiceManager( xServiceManager) { } @@ -92,6 +93,9 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo if ( pVCLPopupMenu ) pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu(); + if (!pPopupMenu) + return; + // insert basic String aCommand = String::CreateFromAscii( ".uno:MacroDialog" ); String aDisplayName = RetrieveLabelFromCommand( aCommand ); @@ -109,7 +113,7 @@ void SAL_CALL MacrosMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); OSL_TRACE("disposing"); m_xFrame.clear(); m_xDispatch.clear(); @@ -126,7 +130,7 @@ void SAL_CALL MacrosMenuController::disposing( const EventObject& ) throw ( Runt // XStatusListener void SAL_CALL MacrosMenuController::statusChanged( const FeatureStateEvent& ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { fillPopupMenu( m_xPopupMenu ); diff --git a/framework/source/uielement/makefile.mk b/framework/source/uielement/makefile.mk index 76ec935cac78..367ba52a3fdc 100644 --- a/framework/source/uielement/makefile.mk +++ b/framework/source/uielement/makefile.mk @@ -76,6 +76,7 @@ SLOFILES= \ $(SLO)$/toolbarmerger.obj \ $(SLO)$/toolbarsmenucontroller.obj \ $(SLO)$/toolbarwrapper.obj \ + $(SLO)$/popupmenucontroller.obj \ $(SLO)$/uicommanddescription.obj \ # --- Targets ------------------------------------------------------ diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 40473d0775a1..4459de78fb3f 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -548,11 +548,14 @@ throw ( RuntimeException ) if ( Event.State >>= bCheckmark ) { - // Checkmark + // Checkmark or RadioButton m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE ); m_pVCLMenu->CheckItem( pMenuItemHandler->nItemId, bCheckmark ); - m_pVCLMenu->SetItemBits( pMenuItemHandler->nItemId, - m_pVCLMenu->GetItemBits( pMenuItemHandler->nItemId ) | MIB_CHECKABLE ); + + MenuItemBits nBits = m_pVCLMenu->GetItemBits( pMenuItemHandler->nItemId ); + //If not already designated RadioButton set as CheckMark + if (!(nBits & MIB_RADIOCHECK)) + m_pVCLMenu->SetItemBits( pMenuItemHandler->nItemId, nBits | MIB_CHECKABLE ); } else if ( Event.State >>= aItemText ) { @@ -1805,6 +1808,8 @@ void MenuBarManager::FillMenu( nBits |= MIB_ICON; if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT ) nBits |= MIB_TEXT; + if ( nStyle & ::com::sun::star::ui::ItemStyle::RADIO_CHECK ) + nBits |= MIB_RADIOCHECK; pMenu->SetItemBits( nId, nBits ); } if ( xIndexContainer.is() ) diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 3007816ad888..8ae7842d07fd 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -67,6 +67,7 @@ #include <svtools/acceleratorexecute.hxx> #include <unotools/moduleoptions.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -326,7 +327,7 @@ void NewMenuController::retrieveShortcutsFromConfiguration( } NewMenuController::NewMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_bShowImages( sal_True ), m_bHiContrast( sal_False ), m_bNewMenu( sal_False ), @@ -399,7 +400,7 @@ void SAL_CALL NewMenuController::disposing( const EventObject& ) throw ( Runtime { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -423,12 +424,12 @@ void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) thr Reference< XMultiServiceFactory > xServiceManager; Reference< XURLTransformer > xURLTransformer; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; xURLTransformer = m_xURLTransformer; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList( 1 ); @@ -548,12 +549,12 @@ void NewMenuController::impl_setPopupMenu() // XInitialization void SAL_CALL NewMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize( aArguments ); + svt::PopupMenuControllerBase::initialize( aArguments ); if ( m_bInitialized ) { diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index f4d6aea0d82b..80dccb76db05 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -59,6 +59,7 @@ #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -83,7 +84,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ObjectMenuController DEFINE_INIT_SERVICE ( ObjectMenuController, {} ) ObjectMenuController::ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) { } @@ -128,7 +129,7 @@ void SAL_CALL ObjectMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xObjectUpdateDispatch.clear(); @@ -145,7 +146,7 @@ void SAL_CALL ObjectMenuController::statusChanged( const FeatureStateEvent& Even Sequence < com::sun::star::embed::VerbDescriptor > aVerbCommandSeq; if ( Event.State >>= aVerbCommandSeq ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) fillPopupMenu( aVerbCommandSeq, m_xPopupMenu ); } diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx new file mode 100644 index 000000000000..328777db2b79 --- /dev/null +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 <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 +//======================================================================== + +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( "ModuleName" )); + 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 + USHORT 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( "stardiv.Toolkit.VCLXPopupMenu" ) ), UNO_QUERY_THROW ); + mxPopupMenuController->setPopupMenu( mxPopupMenu ); + } + else + { + mxPopupMenuController->updatePopupMenu(); + + } + pToolBox->SetItemDown( nItemId, TRUE ); + Reference< awt::XWindowPeer > xPeer( getParent(), UNO_QUERY_THROW ); + mxPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 ); + pToolBox->SetItemDown( nItemId, 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/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx index 2cd0ed891db6..a20f107ea22e 100644 --- a/framework/source/uielement/progressbarwrapper.cxx +++ b/framework/source/uielement/progressbarwrapper.cxx @@ -43,6 +43,7 @@ // interface includes //_________________________________________________________________________________________________________________ #include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index cec95485dacd..64f05ed642cb 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -47,7 +47,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/util/XStringWidth.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ @@ -64,6 +63,7 @@ #include <osl/file.hxx> //#include <tools/solar.hrc> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -105,7 +105,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( RecentFilesMenuController DEFINE_INIT_SERVICE ( RecentFilesMenuController, {} ) RecentFilesMenuController::RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_bDisabled( sal_False ) { } @@ -245,11 +245,11 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) Reference< XDispatchProvider > xDispatchProvider; Reference< XMultiServiceFactory > xServiceManager; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList; @@ -312,7 +312,7 @@ void SAL_CALL RecentFilesMenuController::disposing( const EventObject& ) throw ( { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -325,7 +325,7 @@ void SAL_CALL RecentFilesMenuController::disposing( const EventObject& ) throw ( // XStatusListener void SAL_CALL RecentFilesMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_bDisabled = !Event.IsEnabled; } @@ -336,11 +336,11 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve Reference< XDispatchProvider > xDispatchProvider; Reference< XMultiServiceFactory > xServiceManager; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList; @@ -355,7 +355,7 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); impl_setPopupMenu(); } @@ -368,17 +368,16 @@ void RecentFilesMenuController::impl_setPopupMenu() void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); Reference< XDispatch > xDispatch( m_xDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = m_aCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); // Add/remove status listener to get a status update once if ( xDispatch.is() ) @@ -395,10 +394,9 @@ Reference< XDispatch > SAL_CALL RecentFilesMenuController::queryDispatch( sal_Int32 /*nFlags*/ ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) return Reference< XDispatch >( static_cast< OWeakObject* >( this ), UNO_QUERY ); @@ -412,10 +410,9 @@ void SAL_CALL RecentFilesMenuController::dispatch( const Sequence< PropertyValue >& /*seqProperties*/ ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) { @@ -448,12 +445,11 @@ void SAL_CALL RecentFilesMenuController::addStatusListener( const URL& aURL ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); - PopupMenuControllerBase::addStatusListener( xControl, aURL ); + svt::PopupMenuControllerBase::addStatusListener( xControl, aURL ); } void SAL_CALL RecentFilesMenuController::removeStatusListener( @@ -461,7 +457,7 @@ void SAL_CALL RecentFilesMenuController::removeStatusListener( const URL& aURL ) throw( RuntimeException ) { - PopupMenuControllerBase::removeStatusListener( xControl, aURL ); + svt::PopupMenuControllerBase::removeStatusListener( xControl, aURL ); } IMPL_STATIC_LINK_NOINSTANCE( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentFile ) diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index 43ad09ffc1ee..dad2775dc453 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -49,7 +49,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index b6c4251ffaf9..8d37da3c3e49 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Command.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx index 5230cf9bbd6e..43262fcc64a2 100644 --- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XControlNotificationListener.hpp> #include "com/sun/star/util/XMacroExpander.hpp" #include "com/sun/star/uno/XComponentContext.hpp" diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index b6ce3a526156..a7b1f18e9c15 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -52,6 +52,7 @@ #endif #include <framework/addonsoptions.hxx> #include <uielement/toolbarmerger.hxx> +#include <helper/acceleratorinfo.hxx> //_________________________________________________________________________________________________________________ // interface includes @@ -75,6 +76,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <comphelper/sequence.hxx> #include <com/sun/star/frame/status/Visibility.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes @@ -97,11 +99,14 @@ #include <svtools/menuoptions.hxx> #include <unotools/cmdoptions.hxx> #include <boost/bind.hpp> +#include <svtools/acceleratorexecute.hxx> //_________________________________________________________________________________________________________________ // namespaces //_________________________________________________________________________________________________________________ +using rtl::OUString; + using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -112,6 +117,7 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::ui; +using namespace ::com::sun::star; namespace framework { @@ -257,7 +263,8 @@ ToolBarManager::ToolBarManager( const Reference< XMultiServiceFactory >& rServic m_xFrame( rFrame ), m_aListenerContainer( m_aLock.getShareableOslMutex() ), m_xServiceManager( rServiceManager ), - m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) + m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ), + m_bAcceleratorCfg( sal_False ) { Window* pWindow = m_pToolBar; while ( pWindow && !pWindow->IsSystemWindow() ) @@ -510,7 +517,47 @@ void ToolBarManager::UpdateControllers() } m_bUpdateControllers = sal_False; } +//for update toolbar controller via Support Visible by shizhoubo +void ToolBarManager::UpdateController( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xController) +{ + RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::UpdateControllers" ); + + if ( !m_bUpdateControllers ) + { + m_bUpdateControllers = sal_True; + try + { if(xController.is()) + { + Reference< XUpdatable > xUpdatable( xController, UNO_QUERY ); + if ( xUpdatable.is() ) + xUpdatable->update(); + } + } + catch ( Exception& ) + { + } + + /* m_bUpdateControllers = sal_True; + ToolBarControllerMap::iterator pIter = m_aControllerMap.begin(); + + while ( pIter != m_aControllerMap.end() ) + { + try + { + Reference< XUpdatable > xUpdatable( pIter->second, UNO_QUERY ); + if ( xUpdatable.is() ) + xUpdatable->update(); + } + catch ( Exception& ) + { + } + ++pIter; + }*/ + } + m_bUpdateControllers = sal_False; +} +//end void ToolBarManager::frameAction( const FrameActionEvent& Action ) throw ( RuntimeException ) { @@ -663,6 +710,9 @@ void SAL_CALL ToolBarManager::dispose() throw( RuntimeException ) m_xFrame.clear(); m_xServiceManager.clear(); + m_xGlobalAcceleratorManager.clear(); + m_xModuleAcceleratorManager.clear(); + m_xDocAcceleratorManager.clear(); m_bDisposed = sal_True; } @@ -803,17 +853,18 @@ void ToolBarManager::RemoveControllers() m_aControllerMap.clear(); } -::rtl::OUString ToolBarManager::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) +uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const ::rtl::OUString& rCmdURL ) { - ::rtl::OUString aLabel; + Sequence< PropertyValue > aPropSeq; - // Retrieve popup menu labels - if ( !m_bModuleIdentified ) + // Retrieve properties for command + try { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); - Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); - try + if ( !m_bModuleIdentified ) { + Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); + m_bModuleIdentified = sal_True; m_aModuleIdentifier = xModuleManager->identify( xIfac ); @@ -821,44 +872,57 @@ void ToolBarManager::RemoveControllers() { Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY ); if ( xNameAccess.is() ) - { xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels; - } } } - catch ( Exception& ) + + if ( m_xUICommandLabels.is() ) { + if ( rCmdURL.getLength() > 0 ) + m_xUICommandLabels->getByName( rCmdURL ) >>= aPropSeq; } } + catch ( Exception& ) + { + } - if ( m_xUICommandLabels.is() ) + return aPropSeq; +} + +::rtl::OUString ToolBarManager::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) +{ + ::rtl::OUString aLabel; + Sequence< PropertyValue > aPropSeq; + + // Retrieve popup menu labels + aPropSeq = GetPropsForCommand( aCmdURL ); + for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - try + if ( aPropSeq[i].Name.equalsAscii( "Name" )) { - if ( aCmdURL.getLength() > 0 ) - { - rtl::OUString aStr; - Sequence< PropertyValue > aPropSeq; - if ( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name.equalsAscii( "Name" )) - { - aPropSeq[i].Value >>= aStr; - break; - } - } - } - aLabel = aStr; - } + aPropSeq[i].Value >>= aLabel; + break; } - catch ( com::sun::star::uno::Exception& ) + } + return aLabel; +} + +sal_Int32 ToolBarManager::RetrievePropertiesFromCommand( const ::rtl::OUString& aCmdURL ) +{ + sal_Int32 nProperties(0); + Sequence< PropertyValue > aPropSeq; + + // Retrieve popup menu labels + aPropSeq = GetPropsForCommand( aCmdURL ); + for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) + { + if ( aPropSeq[i].Name.equalsAscii( "Properties" )) { + aPropSeq[i].Value >>= nProperties; + break; } } - - return aLabel; + return nProperties; } void ToolBarManager::CreateControllers() @@ -969,8 +1033,15 @@ void ToolBarManager::CreateControllers() { MenuDescriptionMap::iterator it = m_aMenuMap.find( nId ); if ( it == m_aMenuMap.end() ) - xController = Reference< XStatusListener >( - new GenericToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL )); + { + xController = Reference< XStatusListener >( + new GenericToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL )); + + // Accessibility support: Set toggle button role for specific commands + sal_Int32 nProps = RetrievePropertiesFromCommand( aCommandURL ); + if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON ) + m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | TIB_CHECKABLE ); + } else xController = Reference< XStatusListener >( new MenuToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL, m_aModuleIdentifier, m_aMenuMap[ nId ] )); @@ -1028,6 +1099,10 @@ void ToolBarManager::CreateControllers() aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + aPropValue.Value <<= m_aModuleIdentifier; + aPropertyVector.push_back( makeAny( aPropValue )); + if ( nWidth > 0 ) { aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); @@ -1037,6 +1112,19 @@ void ToolBarManager::CreateControllers() Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); xInit->initialize( aArgs ); + //for Support Visiblitly by shizhoubo + if (pController) + { + // rtl::OUString aCommandURL = pController->m_aCommandURL; + if(aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwitchXFormsDesignMode" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ViewDataSourceBrowser" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaLeftToRight" )) || + aCommandURL == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ParaRightToLeft" )) + ) + pController->setFastPropertyValue_NoBroadcast(1,makeAny(sal_True)); + } + + //end } // Request a item window from the toolbar controller and set it at the VCL toolbar @@ -1057,6 +1145,31 @@ void ToolBarManager::CreateControllers() } } } + //for update Controller via support visiable state by shizhoubo + Reference< XPropertySet > xPropSet( xController, UNO_QUERY ); + if ( xPropSet.is() ) + { + try + { + sal_Bool bSupportVisiable = sal_True; + Any a( xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" ))) ); + a >>= bSupportVisiable; + if ( bSupportVisiable ) + { + Reference< XToolbarController > xTbxController( xController, UNO_QUERY ); + UpdateController(xTbxController); + } + } + catch ( RuntimeException& ) + { + throw; + } + catch ( Exception& ) + { + } + } + //end + } AddFrameActionListener(); @@ -1257,13 +1370,31 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine m_pToolBar->InsertItem( nId, aString, nItemBits ); m_pToolBar->SetItemCommand( nId, aCommandURL ); if ( aTooltip.getLength() ) + { m_pToolBar->SetQuickHelpText( nId, aTooltip ); + } else - m_pToolBar->SetQuickHelpText( nId, aString ); + { + ::rtl::OUString sQuickHelp( aString ); + ::rtl::OUString sShortCut; + if( RetrieveShortcut( aCommandURL, sShortCut ) ) + { + sQuickHelp += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); + sQuickHelp += sShortCut; + sQuickHelp += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); + } + + m_pToolBar->SetQuickHelpText( nId, sQuickHelp ); + } + if ( aLabel.getLength() > 0 ) + { m_pToolBar->SetItemText( nId, aLabel ); + } else + { m_pToolBar->SetItemText( nId, aString ); + } m_pToolBar->EnableItem( nId, sal_True ); m_pToolBar->SetItemState( nId, STATE_NOCHECK ); @@ -1530,7 +1661,11 @@ IMPL_LINK( ToolBarManager, DropdownClick, ToolBox*, EMPTYARG ) Reference< XToolbarController > xController( pIter->second, UNO_QUERY ); if ( xController.is() ) - xController->createPopupWindow(); + { + Reference< XWindow > xWin = xController->createPopupWindow(); + if ( xWin.is() ) + xWin->setFocus(); + } } return 1; } @@ -2102,6 +2237,121 @@ Image ToolBarManager::QueryAddonsImage( const ::rtl::OUString& aCommandURL, bool return aImage; } +bool ToolBarManager::impl_RetrieveShortcutsFromConfiguration( + const Reference< XAcceleratorConfiguration >& rAccelCfg, + const rtl::OUString& rCommand, + rtl::OUString& rShortCut ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ToolBarManager::impl_RetrieveShortcutsFromConfiguration" ); + if ( rAccelCfg.is() ) + { + try + { + com::sun::star::awt::KeyEvent aKeyEvent; + Sequence< OUString > aCommands(1); + aCommands[0] = rCommand; + + Sequence< Any > aSeqKeyCode( rAccelCfg->getPreferredKeyEventsForCommandList( aCommands ) ); + if( aSeqKeyCode.getLength() == 1 ) + { + if ( aSeqKeyCode[0] >>= aKeyEvent ) + { + rShortCut = svt::AcceleratorExecute::st_AWTKey2VCLKey( aKeyEvent ).GetName(); + return true; + } + } + } + catch ( IllegalArgumentException& ) + { + } + } + + return false; +} + +bool ToolBarManager::RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OUString& rShortCut ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ToolBarManager::RetrieveShortcuts" ); + if ( m_bModuleIdentified ) + { + Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager ); + Reference< XAcceleratorConfiguration > xModuleAccelCfg( m_xModuleAcceleratorManager ); + Reference< XAcceleratorConfiguration > xGlobalAccelCfg( m_xGlobalAcceleratorManager ); + + if ( !m_bAcceleratorCfg ) + { + // Retrieve references on demand + m_bAcceleratorCfg = sal_True; + if ( !xDocAccelCfg.is() ) + { + Reference< XController > xController = m_xFrame->getController(); + Reference< XModel > xModel; + if ( xController.is() ) + { + xModel = xController->getModel(); + if ( xModel.is() ) + { + Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY ); + if ( xSupplier.is() ) + { + Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY ); + if ( xDocUICfgMgr.is() ) + { + xDocAccelCfg = Reference< XAcceleratorConfiguration >( xDocUICfgMgr->getShortCutManager(), UNO_QUERY ); + m_xDocAcceleratorManager = xDocAccelCfg; + } + } + } + } + } + + if ( !xModuleAccelCfg.is() ) + { + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( m_xServiceManager->createInstance( + SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), + UNO_QUERY ); + try + { + Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); + if ( xUICfgMgr.is() ) + { + xModuleAccelCfg = Reference< XAcceleratorConfiguration >( xUICfgMgr->getShortCutManager(), UNO_QUERY ); + m_xModuleAcceleratorManager = xModuleAccelCfg; + } + } + catch ( RuntimeException& ) + { + throw; + } + catch ( Exception& ) + { + } + } + + if ( !xGlobalAccelCfg.is() ) + { + xGlobalAccelCfg = Reference< XAcceleratorConfiguration >( m_xServiceManager->createInstance( + SERVICENAME_GLOBALACCELERATORCONFIGURATION ), + UNO_QUERY ); + m_xGlobalAcceleratorManager = xGlobalAccelCfg; + } + } + + bool bFound = false; + + if ( m_xGlobalAcceleratorManager.is() ) + bFound = impl_RetrieveShortcutsFromConfiguration( xGlobalAccelCfg, rCommandURL, rShortCut ); + if ( !bFound && m_xModuleAcceleratorManager.is() ) + bFound = impl_RetrieveShortcutsFromConfiguration( xModuleAccelCfg, rCommandURL, rShortCut ); + if ( !bFound && m_xDocAcceleratorManager.is() ) + impl_RetrieveShortcutsFromConfiguration( xGlobalAccelCfg, rCommandURL, rShortCut ); + + if( bFound ) + return true; + } + return false; +} + } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 90c372a9ff62..6450563c57ab 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -58,7 +58,6 @@ #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -167,7 +166,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ToolbarsMenuController DEFINE_INIT_SERVICE ( ToolbarsMenuController, {} ) ToolbarsMenuController::ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" )), m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )), m_bModuleIdentified( sal_False ), @@ -563,7 +562,7 @@ void SAL_CALL ToolbarsMenuController::disposing( const EventObject& ) throw ( Ru { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xDocCfgMgr.clear(); @@ -584,9 +583,9 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev sal_Bool bSetCheckmark = sal_False; sal_Bool bCheckmark = sal_False; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu ); - aLock.unlock(); + aLock.clear(); if ( xPopupMenu.is() ) { @@ -633,13 +632,13 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent Reference< XFrame > xFrame; Reference< XNameAccess > xPersistentWindowState; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xServiceManager = m_xServiceManager; xURLTransformer = m_xURLTransformer; xFrame = m_xFrame; xPersistentWindowState = m_xPersistentWindowState; - aLock.unlock(); + aLock.clear(); if ( xPopupMenu.is() ) { @@ -792,7 +791,7 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); Reference< XURLTransformer > xURLTransformer( m_xURLTransformer ); { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); fillPopupMenu( m_xPopupMenu ); aCmdVector = m_aCommandVector; } @@ -829,10 +828,9 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr // XPopupMenuController void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( m_xFrame.is() && !m_xPopupMenu.is() ) { @@ -848,11 +846,11 @@ void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::X // XInitialization void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize(aArguments); + svt::PopupMenuControllerBase::initialize(aArguments); if ( m_bInitialized ) { diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 9f5593183e09..7b6e81ff91d9 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index fdcd08f221fd..0d50aa4c36d4 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -340,7 +340,7 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const ::rtl::OUString& if ( !pIter->second.bCommandNameCreated ) fillInfoFromResult( pIter->second, pIter->second.aLabel ); - Sequence< PropertyValue > aPropSeq( 3 ); + Sequence< PropertyValue > aPropSeq( 4 ); aPropSeq[0].Name = m_aPropLabel; aPropSeq[0].Value = pIter->second.aContextLabel.getLength() ? makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel ); @@ -348,6 +348,8 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const ::rtl::OUString& aPropSeq[1].Value <<= pIter->second.aCommandName; aPropSeq[2].Name = m_aPropPopup; aPropSeq[2].Value <<= pIter->second.bPopup; + aPropSeq[3].Name = m_aPropProperties; + aPropSeq[3].Value <<= pIter->second.nProperties; return makeAny( aPropSeq ); } diff --git a/framework/source/xml/makefile.mk b/framework/source/xml/makefile.mk index 7384ea19645a..a4f18a555ab3 100644 --- a/framework/source/xml/makefile.mk +++ b/framework/source/xml/makefile.mk @@ -37,8 +37,20 @@ ENABLE_EXCEPTIONS= TRUE # --- Generate ----------------------------------------------------- SLOFILES= \ - $(SLO)$/acceleratorconfigurationreader.obj \ - $(SLO)$/acceleratorconfigurationwriter.obj \ + $(SLO)$/eventsconfiguration.obj \ + $(SLO)$/eventsdocumenthandler.obj \ + $(SLO)$/imagesconfiguration.obj \ + $(SLO)$/imagesdocumenthandler.obj \ + $(SLO)$/menuconfiguration.obj \ + $(SLO)$/menudocumenthandler.obj \ + $(SLO)$/statusbarconfiguration.obj \ + $(SLO)$/statusbardocumenthandler.obj \ + $(SLO)$/toolboxconfiguration.obj \ + $(SLO)$/toolboxdocumenthandler.obj \ + $(SLO)$/saxnamespacefilter.obj \ + $(SLO)$/xmlnamespaces.obj \ + $(SLO)$/acceleratorconfigurationreader.obj \ + $(SLO)$/acceleratorconfigurationwriter.obj # --- Targets ------------------------------------------------------ |