[Libreoffice-commits] core.git: 5 commits - framework/inc framework/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk sfx2/source svx/source
Noel Grandin
noel at peralex.com
Mon Mar 4 04:23:24 PST 2013
framework/inc/classes/menumanager.hxx | 10 -
framework/inc/dispatch/menudispatcher.hxx | 37 ---
framework/inc/framework/menuconfiguration.hxx | 5
framework/inc/framework/preventduplicateinteraction.hxx | 5
framework/inc/properties.h | 13 -
framework/inc/services.h | 5
framework/inc/uiconfiguration/uiconfigurationmanager.hxx | 4
framework/source/classes/menumanager.cxx | 23 +-
framework/source/dispatch/dispatchprovider.cxx | 2
framework/source/dispatch/menudispatcher.cxx | 59 ++++--
framework/source/fwe/interaction/preventduplicateinteraction.cxx | 12 -
framework/source/fwe/xml/menuconfiguration.cxx | 8
framework/source/helper/statusindicatorfactory.cxx | 45 +++-
framework/source/inc/loadenv/loadenv.hxx | 9
framework/source/loadenv/loadenv.cxx | 7
framework/source/recording/dispatchrecorder.cxx | 4
framework/source/services/autorecovery.cxx | 2
framework/source/services/frame.cxx | 14 -
framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 4
framework/source/uiconfiguration/uiconfigurationmanager.cxx | 24 +-
framework/source/uielement/newmenucontroller.cxx | 2
offapi/UnoApi_offapi.mk | 3
offapi/com/sun/star/frame/DispatchRecorder.idl | 11 -
offapi/com/sun/star/task/StatusIndicatorFactory.idl | 43 ++++
offapi/type_reference/types.rdb |binary
sfx2/source/appl/appopen.cxx | 8
sfx2/source/dialog/filedlghelper.cxx | 93 ++++------
sfx2/source/menu/virtmenu.cxx | 3
sfx2/source/toolbox/tbxitem.cxx | 4
sfx2/source/view/ipclient.cxx | 21 --
sfx2/source/view/viewfrm.cxx | 11 -
sfx2/source/view/viewsh.cxx | 13 -
svx/source/dialog/docrecovery.cxx | 23 --
svx/source/inc/docrecovery.hxx | 10 -
34 files changed, 258 insertions(+), 279 deletions(-)
New commits:
commit dc00ad1e823e3b36619cd04c7e4d169362e199b3
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 25 16:09:10 2013 +0200
fdo#46808, Use service constructor for task::InteractionHandler
a lot of code was loading the service using it's implementation name,
which is why this got missed earlier.
Change-Id: I0b150bc9383a1a3a09ab905c4ddb7f914e69638d
diff --git a/framework/inc/framework/preventduplicateinteraction.hxx b/framework/inc/framework/preventduplicateinteraction.hxx
index 559f6b4..2d058c2 100644
--- a/framework/inc/framework/preventduplicateinteraction.hxx
+++ b/framework/inc/framework/preventduplicateinteraction.hxx
@@ -26,7 +26,6 @@
#include <com/sun/star/task/XInteractionHandler2.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -92,7 +91,7 @@ class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2
private:
/// Used to create needed uno services at runtime.
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
/** The outside interaction handler, which is used to handle every incoming interaction,
if it's not blocked. */
@@ -160,7 +159,7 @@ class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2
@threadsafe not neccessary
*/
- PreventDuplicateInteraction(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+ PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
//_________________________________
/**
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 28f8b6d..6fb4b45 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -77,7 +77,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorderSupplier")
#define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" )
#define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" )
-#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.comp.uui.UUIInteractionHandler" )
#define IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.comp.framework.PathSubstitution" )
#define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" )
#define IMPLEMENTATIONNAME_JOBDISPATCH DECLARE_ASCII("com.sun.star.comp.framework.jobs.JobDispatch" )
diff --git a/framework/source/fwe/interaction/preventduplicateinteraction.cxx b/framework/source/fwe/interaction/preventduplicateinteraction.cxx
index eeddfd7..0ccb88d 100644
--- a/framework/source/fwe/interaction/preventduplicateinteraction.cxx
+++ b/framework/source/fwe/interaction/preventduplicateinteraction.cxx
@@ -19,16 +19,15 @@
#include "framework/preventduplicateinteraction.hxx"
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionRetry.hpp>
namespace framework{
-#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler"))
-
-PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
: ThreadHelpBase2()
- , m_xSMGR(xSMGR)
+ , m_xContext(rxContext)
{
}
@@ -55,13 +54,10 @@ void PreventDuplicateInteraction::useDefaultUUIHandler()
{
// SAFE ->
::osl::ResettableMutexGuard aLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
aLock.clear();
// <- SAFE
- css::uno::Reference< css::task::XInteractionHandler > xHandler(
- xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::task::XInteractionHandler > xHandler( css::task::InteractionHandler::createWithParent( m_xContext, 0 ), css::uno::UNO_QUERY_THROW );
// SAFE ->
aLock.reset();
diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx
index b82f0ab..c76877f 100644
--- a/framework/source/inc/loadenv/loadenv.hxx
+++ b/framework/source/inc/loadenv/loadenv.hxx
@@ -24,17 +24,16 @@
#include <loadenv/actionlockguard.hxx>
#include <threadhelp/threadhelpbase.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XFrameLoader.hpp>
#include <com/sun/star/frame/XLoadEventListener.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/util/URL.hpp>
-
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/URL.hpp>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -370,7 +369,7 @@ public:
/** TODO document me ... */
static void initializeUIDefaults(
- const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR,
+ const css::uno::Reference< css::uno::XComponentContext >& i_rxContext,
::comphelper::MediaDescriptor& io_lMediaDescriptor,
const bool _bUIMode,
QuietInteraction** o_ppQuiteInteraction
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 332f3c9..3b0f4cb 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -37,6 +37,7 @@
#include "officecfg/Office/Common.hxx"
#include <com/sun/star/task/ErrorCodeRequest.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -293,7 +294,7 @@ void LoadEnv::initializeLoading(const ::rtl::OUString&
( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False );
initializeUIDefaults(
- m_xSMGR,
+ comphelper::getComponentContext(m_xSMGR),
m_lMediaDescriptor,
bUIMode,
&m_pQuietInteraction
@@ -304,7 +305,7 @@ void LoadEnv::initializeLoading(const ::rtl::OUString&
}
-void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR,
+void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XComponentContext >& i_rxContext,
::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode,
QuietInteraction** o_ppQuietInteraction )
{
@@ -318,7 +319,7 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMulti
nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG;
try
{
- xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY);
+ xInteractionHandler.set( css::task::InteractionHandler::createWithParent( i_rxContext, 0 ), css::uno::UNO_QUERY_THROW );
}
catch(const css::uno::RuntimeException&) {throw;}
catch(const css::uno::Exception& ) { }
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 6248ae1..e6f35e8 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2523,7 +2523,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa
else
continue; // TODO ERROR!
- LoadEnv::initializeUIDefaults( m_xSMGR, lDescriptor, true, NULL );
+ LoadEnv::initializeUIDefaults( comphelper::getComponentContext(m_xSMGR), lDescriptor, true, NULL );
// <- SAFE ------------------------------
aWriteLock.unlock();
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 821b0b6..cce73e6 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -696,7 +697,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
// intercept all incoming interactions and provide useful informations
// later if the following transaction was finished.
- ::framework::PreventDuplicateInteraction* pHandler = new ::framework::PreventDuplicateInteraction(::comphelper::getProcessServiceFactory());
+ ::framework::PreventDuplicateInteraction* pHandler = new ::framework::PreventDuplicateInteraction(::comphelper::getProcessComponentContext());
css::uno::Reference< css::task::XInteractionHandler > xHandler (static_cast< css::task::XInteractionHandler* >(pHandler), css::uno::UNO_QUERY);
css::uno::Reference< css::task::XInteractionHandler > xWrappedHandler;
@@ -1032,9 +1033,8 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
if (!pInteractionItem)
{
- Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
- if (xHdl.is())
- rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) );
+ Reference < task::XInteractionHandler2 > xHdl = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), 0 );
+ rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) );
}
if (!pMacroExecItem)
rReq.AppendItem( SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::USE_CONFIG) );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 2e4a536..4a1c879 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
@@ -2689,69 +2690,65 @@ ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
ErrCode RequestPassword(const SfxFilter* pCurrentFilter, rtl::OUString& aURL, SfxItemSet* pSet)
{
- uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
- if( xInteractionHandler.is() )
- {
- // TODO: need a save way to distinguish MS filters from other filters
- // for now MS-filters are the only alien filters that support encryption
- sal_Bool bMSType = !pCurrentFilter->IsOwnFormat();
- ::comphelper::DocPasswordRequestType eType = bMSType ?
- ::comphelper::DocPasswordRequestType_MS :
- ::comphelper::DocPasswordRequestType_STANDARD;
+ uno::Reference < task::XInteractionHandler2 > xInteractionHandler = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), 0 );
+ // TODO: need a save way to distinguish MS filters from other filters
+ // for now MS-filters are the only alien filters that support encryption
+ sal_Bool bMSType = !pCurrentFilter->IsOwnFormat();
+ ::comphelper::DocPasswordRequestType eType = bMSType ?
+ ::comphelper::DocPasswordRequestType_MS :
+ ::comphelper::DocPasswordRequestType_STANDARD;
- ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, aURL, ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) != 0 ) );
+ ::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, aURL, ( pCurrentFilter->GetFilterFlags() & SFX_FILTER_PASSWORDTOMODIFY ) != 0 ) );
- uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() );
- xInteractionHandler->handle( rRequest );
- if ( pPasswordRequest->isPassword() )
+ uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest.get() );
+ xInteractionHandler->handle( rRequest );
+ if ( pPasswordRequest->isPassword() )
+ {
+ if ( pPasswordRequest->getPassword().getLength() )
{
- if ( pPasswordRequest->getPassword().getLength() )
+ // TODO/LATER: The filters should show the password dialog themself in future
+ if ( bMSType )
{
- // TODO/LATER: The filters should show the password dialog themself in future
- if ( bMSType )
- {
- // all the current MS-filters use MSCodec_Std97 implementation
- uno::Sequence< sal_Int8 > aUniqueID = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 );
- uno::Sequence< sal_Int8 > aEncryptionKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPasswordRequest->getPassword(), aUniqueID );
+ // all the current MS-filters use MSCodec_Std97 implementation
+ uno::Sequence< sal_Int8 > aUniqueID = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 );
+ uno::Sequence< sal_Int8 > aEncryptionKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPasswordRequest->getPassword(), aUniqueID );
- if ( aEncryptionKey.getLength() )
- {
- ::comphelper::SequenceAsHashMap aHashData;
- aHashData[ ::rtl::OUString( "STD97EncryptionKey" ) ] <<= aEncryptionKey;
- aHashData[ ::rtl::OUString( "STD97UniqueID" ) ] <<= aUniqueID;
+ if ( aEncryptionKey.getLength() )
+ {
+ ::comphelper::SequenceAsHashMap aHashData;
+ aHashData[ ::rtl::OUString( "STD97EncryptionKey" ) ] <<= aEncryptionKey;
+ aHashData[ ::rtl::OUString( "STD97UniqueID" ) ] <<= aUniqueID;
- pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aHashData.getAsConstNamedValueList() ) ) );
- }
- else
- return ERRCODE_IO_NOTSUPPORTED;
+ pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aHashData.getAsConstNamedValueList() ) ) );
}
else
- {
- pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( ::comphelper::OStorageHelper::CreatePackageEncryptionData( pPasswordRequest->getPassword() ) ) ) );
- }
- }
-
- if ( pPasswordRequest->getRecommendReadOnly() )
- pSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) );
-
- if ( bMSType )
- {
- // the empty password has 0 as Hash
- sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( "com.sun.star.text.TextDocument" ).equals( pCurrentFilter->GetServiceName() ) );
- if ( nHash )
- pSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) );
+ return ERRCODE_IO_NOTSUPPORTED;
}
else
{
- uno::Sequence< beans::PropertyValue > aModifyPasswordInfo = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfo( pPasswordRequest->getPasswordToModify() );
- if ( aModifyPasswordInfo.getLength() )
- pSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( aModifyPasswordInfo ) ) );
+ pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( ::comphelper::OStorageHelper::CreatePackageEncryptionData( pPasswordRequest->getPassword() ) ) ) );
}
}
+
+ if ( pPasswordRequest->getRecommendReadOnly() )
+ pSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) );
+
+ if ( bMSType )
+ {
+ // the empty password has 0 as Hash
+ sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), ::rtl::OUString( "com.sun.star.text.TextDocument" ).equals( pCurrentFilter->GetServiceName() ) );
+ if ( nHash )
+ pSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) );
+ }
else
- return ERRCODE_ABORT;
+ {
+ uno::Sequence< beans::PropertyValue > aModifyPasswordInfo = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfo( pPasswordRequest->getPasswordToModify() );
+ if ( aModifyPasswordInfo.getLength() )
+ pSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( aModifyPasswordInfo ) ) );
+ }
}
- return ERRCODE_NONE;
+ else
+ return ERRCODE_ABORT;
}
// ------------------------------------------------------------------------
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 9ec782e..98b2100 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -65,6 +65,7 @@
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
#include <rtl/ustrbuf.hxx>
#include <unotools/localfilehelper.hxx>
@@ -694,7 +695,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if (!pInteractionItem)
{
- Reference < ::com::sun::star::task::XInteractionHandler > xHdl( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
+ Reference < task::XInteractionHandler2 > xHdl = task::InteractionHandler::createWithParent( ::comphelper::getProcessComponentContext(), 0 );
if (xHdl.is())
pNewSet->Put( SfxUnoAnyItem(SID_INTERACTIONHANDLER,::com::sun::star::uno::makeAny(xHdl)) );
}
commit 244c7cdede13980c29850b7b68e9da16cdc61879
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 25 15:17:03 2013 +0200
fdo#46808, convert task::StatusIndicatorFactory to new style
the service already existed, it just needed an IDL file.
Change-Id: I84c8e48e176ec3a38ac48a7abcec7463390523b9
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index 8e2ac6f..a6112a1 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -38,8 +38,6 @@
#include <threadhelp/threadhelpbase.hxx>
#include <macros/debug.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
#define REFERENCE ::com::sun::star::uno::Reference
#define XFRAME ::com::sun::star::frame::XFrame
#define XDISPATCH ::com::sun::star::frame::XDispatch
@@ -61,7 +59,7 @@ class MenuManager : public ThreadHelpBase ,
{
public:
MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
REFERENCE< XFRAME >& rFrame,
Menu* pMenu,
sal_Bool bDelete,
@@ -81,7 +79,7 @@ class MenuManager : public ThreadHelpBase ,
void RemoveListener();
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext();
static void UpdateSpecialWindowMenu( Menu* pMenu ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,IMutex& _rMutex);
static void FillMenuImages(
@@ -136,8 +134,8 @@ class MenuManager : public ThreadHelpBase ,
REFERENCE< XFRAME > m_xFrame;
::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector;
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& mxServiceFactory;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
};
} // namespace
diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx
index eb0a8e7..a41318f 100644
--- a/framework/inc/dispatch/menudispatcher.hxx
+++ b/framework/inc/dispatch/menudispatcher.hxx
@@ -99,14 +99,14 @@ class MenuDispatcher : // interfaces
@seealso using at owner
- @param "xFactory" , css::uno::Reference to servicemanager for creation of new services
+ @param "rxContext" , css::uno::Reference to servicemanager for creation of new services
@param "xOwner" , css::uno::Reference to our owner, the Desktop!!!
@return -
@onerror -
*//*-*****************************************************************************************************/
- MenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
+ MenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
const css::uno::Reference< css::frame::XFrame >& xOwner );
//---------------------------------------------------------------------------------------------------------
@@ -252,37 +252,6 @@ class MenuDispatcher : // interfaces
void impl_setAccelerators( Menu* pMenu, const Accelerator& aAccel );
//-------------------------------------------------------------------------------------------------------------
- // debug methods
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short debug-method to check incoming parameter of some other mehods of this class
- @descr The following methods are used to check parameters for other methods
- of this class. The return value is used directly for an ASSERT(...).
-
- @seealso ASSERTs in implementation!
-
- @param css::uno::References to checking variables
- @return sal_False on invalid parameter<BR>
- sal_True otherway
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- #ifdef ENABLE_ASSERTIONS
-
- private:
-
- static sal_Bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
- const css::uno::Reference< css::frame::XFrame >& xOwner );
- static sal_Bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl ,
- const css::util::URL& aURL );
- static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl ,
- const css::util::URL& aURL );
- #endif // #ifdef ENABLE_ASSERTIONS
-
- //-------------------------------------------------------------------------------------------------------------
// variables
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
@@ -290,7 +259,7 @@ class MenuDispatcher : // interfaces
private:
css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak ; /// css::uno::WeakReference to owner (Don't use a hard css::uno::Reference. Owner can't delete us then!)
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services!
+ css::uno::Reference< css::uno::XComponentContext > m_xContext ; /// factory shared with our owner to create new services!
IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs
sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls.
sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation
diff --git a/framework/inc/framework/menuconfiguration.hxx b/framework/inc/framework/menuconfiguration.hxx
index d122e40..9b6eb74 100644
--- a/framework/inc/framework/menuconfiguration.hxx
+++ b/framework/inc/framework/menuconfiguration.hxx
@@ -71,7 +71,7 @@ class FWE_DLLPUBLIC MenuConfiguration
MenuConfiguration(
// use const when giving a uno reference by reference
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~MenuConfiguration();
@@ -97,8 +97,7 @@ class FWE_DLLPUBLIC MenuConfiguration
throw ( ::com::sun::star::lang::WrappedTargetException );
private:
- // do not hold the uno reference by reference
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
};
}
diff --git a/framework/inc/properties.h b/framework/inc/properties.h
index 1071b0e..31052a2 100644
--- a/framework/inc/properties.h
+++ b/framework/inc/properties.h
@@ -27,19 +27,6 @@
namespace framework{
//_______________________________________________
-/** properties for "StatusIndicatorFactory" class */
-
-#define STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME "Frame"
-#define STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW "Window"
-#define STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW "AllowParentShow"
-#define STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE "DisableReschedule"
-
-#define STATUSINDICATORFACTORY_PROPNAME_FRAME DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_FRAME )
-#define STATUSINDICATORFACTORY_PROPNAME_WINDOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_WINDOW )
-#define STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_ALLOWPARENTSHOW )
-#define STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE DECLARE_ASCII(STATUSINDICATORFACTORY_PROPNAME_ASCII_DISABLERESCHEDULE)
-
-//_______________________________________________
/** properties for "Frame" class */
#define FRAME_PROPNAME_ASCII_DISPATCHRECORDERSUPPLIER "DispatchRecorderSupplier"
diff --git a/framework/inc/services.h b/framework/inc/services.h
index abc275b..28f8b6d 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -36,7 +36,6 @@ namespace framework{
#define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration
#define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" )
#define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" )
-#define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" )
#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" )
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" )
@@ -111,7 +110,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarControllerFactory" )
#define IMPLEMENTATIONNAME_LICENSE DECLARE_ASCII("com.sun.star.comp.framework.License" )
#define IMPLEMENTATIONNAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.comp.framework.AutoRecovery" )
-#define IMPLEMENTATIONNAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusIndicatorFactory" )
#define IMPLEMENTATIONNAME_RECENTFILESMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.RecentFilesMenuController" )
#define IMPLEMENTATIONNAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarFactory" )
#define IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarControllerFactory" )
diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
index 17e7f41..6d93a744 100644
--- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
@@ -71,7 +71,7 @@ namespace framework
FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
- UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager );
+ UIConfigurationManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext );
virtual ~UIConfigurationManager();
// XComponent
@@ -180,7 +180,7 @@ namespace framework
rtl::OUString m_aPropUIName;
rtl::OUString m_aPropResourceURL;
rtl::OUString m_aModuleIdentifier;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager;
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig;
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 54e4dc3..c53ac70 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -32,7 +32,6 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
@@ -110,11 +109,11 @@ namespace framework
const char UNO_COMMAND[] = ".uno:";
MenuManager::MenuManager(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
:
ThreadHelpBase( &Application::GetSolarMutex() ),
- mxServiceFactory(xServiceFactory)
+ m_xContext(rxContext)
{
m_bActive = sal_False;
m_bDeleteMenu = bDelete;
@@ -193,7 +192,7 @@ MenuManager::MenuManager(
{
if ( nItemId == SID_NEWDOCDIRECT || aItemCommand == aSlotNewDocDirect )
{
- MenuConfiguration aMenuCfg( getServiceFactory() );
+ MenuConfiguration aMenuCfg( m_xContext );
BmkMenu* pSubMenu = (BmkMenu*)aMenuCfg.CreateBookmarkMenu( rFrame, BOOKMARK_NEWMENU );
pMenu->SetPopupMenu( nItemId, pSubMenu );
@@ -207,7 +206,7 @@ MenuManager::MenuManager(
}
else if ( nItemId == SID_AUTOPILOTMENU || aItemCommand == aSlotAutoPilot )
{
- MenuConfiguration aMenuCfg( getServiceFactory() );
+ MenuConfiguration aMenuCfg( m_xContext );
BmkMenu* pSubMenu = (BmkMenu*)aMenuCfg.CreateBookmarkMenu( rFrame, BOOKMARK_WIZARDMENU );
pMenu->SetPopupMenu( nItemId, pSubMenu );
@@ -278,8 +277,8 @@ void MenuManager::SetHdl()
m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuManager, Deactivate ));
m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select ));
- if ( mxServiceFactory.is() )
- m_xURLTransformer.set( URLTransformer::create(::comphelper::getComponentContext(mxServiceFactory)) );
+ if ( m_xContext.is() )
+ m_xURLTransformer.set( URLTransformer::create( m_xContext ) );
}
MenuManager::~MenuManager()
@@ -763,7 +762,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
if ( m_aMenuItemCommand == aSpecialFileMenu || m_aMenuItemCommand == aSlotSpecialFileMenu || aCommand == aSpecialFileCommand )
UpdateSpecialFileMenu( pMenu );
else if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock );
+ UpdateSpecialWindowMenu( pMenu, m_xContext, m_aLock );
// Check if some modes have changed so we have to update our menu images
if ( bShowMenuImages != m_bShowMenuImages )
@@ -862,7 +861,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
{
// window list menu item selected
- Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) );
+ Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );
sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
@@ -923,14 +922,14 @@ IMPL_LINK_NOARG(MenuManager, Highlight)
return 0;
}
-const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& MenuManager::getServiceFactory()
+const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& MenuManager::getContext()
{
- return mxServiceFactory;
+ return m_xContext;
}
void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,sal_uInt16 _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren)
{
- MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren );
+ MenuManager* pSubMenuManager = new MenuManager( m_xContext, m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren );
// store menu item command as we later have to know which menu is active (see Activate handler)
pSubMenuManager->m_aMenuItemCommand = _sItemCommand;
diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx
index 56053cc..90f3994 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -597,7 +597,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
WriteGuard aWriteLock( m_aLock );
if ( ! m_xMenuDispatcher.is() )
{
- MenuDispatcher* pDispatcher = new MenuDispatcher( xFactory, xOwner );
+ MenuDispatcher* pDispatcher = new MenuDispatcher( comphelper::getComponentContext(xFactory), xOwner );
m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
xDispatchHelper = m_xMenuDispatcher;
diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx
index 61fd130..0402a95 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -44,8 +44,8 @@ namespace framework
{
MenuConfiguration::MenuConfiguration(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager )
-: m_rxServiceManager( rServiceManager )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+: m_xContext( rxContext )
{
}
@@ -59,7 +59,7 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML(
Reference< XInputStream >& rInputStream )
throw ( WrappedTargetException )
{
- Reference< XParser > xParser = Parser::create( comphelper::getComponentContext(m_rxServiceManager) );
+ Reference< XParser > xParser = Parser::create( m_xContext );
// connect stream to input stream to the parser
InputSource aInputSource;
@@ -121,7 +121,7 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML(
Reference< XOutputStream >& rOutputStream )
throw ( WrappedTargetException )
{
- Reference< XWriter > xWriter = Writer::create(comphelper::getComponentContext(m_rxServiceManager));
+ Reference< XWriter > xWriter = Writer::create(m_xContext);
xWriter->setOutputStream( rOutputStream );
try
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index 3f6b34d..19347ee 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -71,8 +71,8 @@ DEFINE_XTYPEPROVIDER_5(StatusIndicatorFactory ,
DEFINE_XSERVICEINFO_MULTISERVICE(StatusIndicatorFactory ,
::cppu::OWeakObject ,
- SERVICENAME_STATUSINDICATORFACTORY ,
- IMPLEMENTATIONNAME_STATUSINDICATORFACTORY)
+ OUString("com.sun.star.task.StatusIndicatorFactory"),
+ OUString("com.sun.star.comp.framework.StatusIndicatorFactory"))
DEFINE_INIT_SERVICE(StatusIndicatorFactory,
{
@@ -107,18 +107,37 @@ void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::
throw(css::uno::Exception ,
css::uno::RuntimeException)
{
- ::comphelper::SequenceAsHashMap lArgs(lArguments);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- m_xFrame = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_FRAME , css::uno::Reference< css::frame::XFrame >());
- m_xPluggWindow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_WINDOW , css::uno::Reference< css::awt::XWindow >() );
- m_bAllowParentShow = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW , (sal_Bool)sal_False );
- m_bDisableReschedule = lArgs.getUnpackedValueOrDefault(STATUSINDICATORFACTORY_PROPNAME_DISABLERESCHEDULE, (sal_Bool)sal_False );
+ if (lArguments.getLength() > 0) {
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::frame::XFrame > xTmpFrame;
+ css::uno::Reference< css::awt::XWindow > xTmpWindow;
+ bool b1 = lArguments[0] >>= xTmpFrame;
+ bool b2 = lArguments[0] >>= xTmpWindow;
+ if (lArguments.getLength() == 3 && b1) {
+ // it's the first service constructor "createWithFrame"
+ m_xFrame = xTmpFrame;
+ lArguments[1] >>= m_bDisableReschedule;
+ lArguments[2] >>= m_bAllowParentShow;
+ } else if (lArguments.getLength() == 3 && b2) {
+ // it's the second service constructor "createWithWindow"
+ m_xPluggWindow = xTmpWindow;
+ lArguments[1] >>= m_bDisableReschedule;
+ lArguments[2] >>= m_bAllowParentShow;
+ } else {
+ // it's an old-style initialisation using properties
+ ::comphelper::SequenceAsHashMap lArgs(lArguments);
+
+ m_xFrame = lArgs.getUnpackedValueOrDefault("Frame" , css::uno::Reference< css::frame::XFrame >());
+ m_xPluggWindow = lArgs.getUnpackedValueOrDefault("Window" , css::uno::Reference< css::awt::XWindow >() );
+ m_bAllowParentShow = lArgs.getUnpackedValueOrDefault("AllowParentShow" , (sal_Bool)sal_False );
+ m_bDisableReschedule = lArgs.getUnpackedValueOrDefault("DisableReschedule", (sal_Bool)sal_False );
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+ }
+ }
impl_createProgress();
}
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index ba54b20..4cf109d 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/task/StatusIndicatorFactory.hpp>
#include <com/sun/star/task/JobExecutor.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
@@ -564,17 +565,8 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
// create progress helper
css::uno::Reference< css::frame::XFrame > xThis (static_cast< css::frame::XFrame* >(this) , css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory(xSMGR->createInstance(IMPLEMENTATIONNAME_STATUSINDICATORFACTORY), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::lang::XInitialization > xIndicatorInit (xIndicatorFactory , css::uno::UNO_QUERY_THROW);
- css::uno::Sequence< css::uno::Any > lArgs(2);
- css::beans::NamedValue aArg;
- aArg.Name = STATUSINDICATORFACTORY_PROPNAME_FRAME;
- aArg.Value <<= xThis;
- lArgs[0] <<= aArg;
- aArg.Name = STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW;
- aArg.Value <<= sal_True;
- lArgs[1] <<= aArg;
- xIndicatorInit->initialize(lArgs);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory =
+ css::task::StatusIndicatorFactory::createWithFrame(comphelper::getComponentContext(xSMGR), xThis, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/ );
// SAFE -> ----------------------------------
aWriteLock.lock();
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index f101ef1..35e14bc 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -305,7 +305,7 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
{
try
{
- MenuConfiguration aMenuCfg( m_xServiceManager );
+ MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) );
Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
if ( pRootItemContainer )
@@ -446,7 +446,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag
{
try
{
- MenuConfiguration aMenuCfg( m_xServiceManager );
+ MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) );
aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
}
catch ( const ::com::sun::star::lang::WrappedTargetException& )
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 7c2c3c6..8f3224f 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -81,7 +81,7 @@ DEFINE_XTYPEPROVIDER_7 ( UIConfigurationManager
::com::sun::star::ui::XUIConfigurationStorage
)
-DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager ,
+DEFINE_XSERVICEINFO_MULTISERVICE_2 ( UIConfigurationManager ,
::cppu::OWeakObject ,
SERVICENAME_UICONFIGURATIONMANAGER ,
IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER
@@ -243,7 +243,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType,
{
try
{
- MenuConfiguration aMenuCfg( m_xServiceManager );
+ MenuConfiguration aMenuCfg( m_xContext );
Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
if ( pRootItemContainer )
@@ -268,7 +268,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType,
try
{
Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- ToolBoxConfiguration::LoadToolBox( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
+ ToolBoxConfiguration::LoadToolBox( m_xContext, xInputStream, xIndexContainer );
RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
return;
@@ -285,7 +285,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType,
try
{
Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
- StatusBarConfiguration::LoadStatusBar( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
+ StatusBarConfiguration::LoadStatusBar( m_xContext, xInputStream, xIndexContainer );
RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
return;
@@ -375,7 +375,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x
{
try
{
- MenuConfiguration aMenuCfg( m_xServiceManager );
+ MenuConfiguration aMenuCfg( m_xContext );
aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
}
catch ( const ::com::sun::star::lang::WrappedTargetException& )
@@ -388,7 +388,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x
{
try
{
- ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings );
+ ToolBoxConfiguration::StoreToolBox( m_xContext, xOutputStream, rElement.xSettings );
}
catch ( const ::com::sun::star::lang::WrappedTargetException& )
{
@@ -400,7 +400,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x
{
try
{
- StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings );
+ StatusBarConfiguration::StoreStatusBar( m_xContext, xOutputStream, rElement.xSettings );
}
catch ( const ::com::sun::star::lang::WrappedTargetException& )
{
@@ -578,7 +578,7 @@ void UIConfigurationManager::impl_Initialize()
}
}
-UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) :
+UIConfigurationManager::UIConfigurationManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext ) :
ThreadHelpBase( &Application::GetSolarMutex() )
, m_xDocConfigStorage( 0 )
, m_bReadOnly( true )
@@ -588,7 +588,7 @@ UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference<
, m_aXMLPostfix( ".xml" )
, m_aPropUIName( "UIName" )
, m_aPropResourceURL( "ResourceURL" )
- , m_xServiceManager( xServiceManager )
+ , m_xContext( rxContext )
, m_aListenerContainer( m_aLock.getShareableOslMutex() )
{
// Make sure we have a default initialized entry for every layer and user interface element type!
@@ -1050,7 +1050,9 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw
if ( !m_xImageManager.is() )
{
- m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )),
+ Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
+
+ m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( xMSF )),
UNO_QUERY );
Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY );
@@ -1077,7 +1079,7 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() th
if (m_xAccConfig.is())
return m_xAccConfig;
- Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
+ Reference<XMultiServiceFactory> xSMGR(m_xContext->getServiceManager(), UNO_QUERY_THROW);
Reference< XStorage > xDocumentRoot = m_xDocConfigStorage;
aGuard.unlock();
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index 867a890..bddc886 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -326,7 +326,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup
if ( pVCLPopupMenu )
{
- MenuConfiguration aMenuCfg( m_xServiceManager );
+ MenuConfiguration aMenuCfg( comphelper::getComponentContext(m_xServiceManager) );
BmkMenu* pSubMenu( 0 );
if ( m_bNewMenu )
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 81968bb..0f91b61 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -325,6 +325,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/task,\
OfficeRestartManager \
PasswordContainer \
PasswordContainerInteractionHandler \
+ StatusIndicatorFactory \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/text,\
DefaultNumberingProvider \
diff --git a/offapi/com/sun/star/task/StatusIndicatorFactory.idl b/offapi/com/sun/star/task/StatusIndicatorFactory.idl
new file mode 100644
index 0000000..cc2c749
--- /dev/null
+++ b/offapi/com/sun/star/task/StatusIndicatorFactory.idl
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_task_StatusIndicatorFactory_idl__
+#define __com_sun_star_task_StatusIndicatorFactory_idl__
+
+#include <com/sun/star/awt/XWindow.idl>
+#include <com/sun/star/frame/XFrame.idl>
+#include <com/sun/star/task/XStatusIndicatorFactory.idl>
+
+
+ module com { module sun { module star { module task {
+
+/**
+ @since LibreOffice 4.1
+ */
+service StatusIndicatorFactory : XStatusIndicatorFactory
+{
+ createWithFrame( [in] com::sun::star::frame::XFrame Frame, [in] boolean DisableReschedule, [in] boolean AllowParentShow );
+
+ createWithWindow( [in] com::sun::star::awt::XWindow ParentWindow, [in] boolean DisableReschedule, [in] boolean AllowParentShow );
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index 81f186c..87b3a88 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -766,8 +766,7 @@ void SfxVirtualMenu::UnbindControllers()
void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu )
{
// Create special popup menu that is filled with the 3rd party components popup menu items
- Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory());
- ::framework::MenuConfiguration aConf( aXMultiServiceFactory );
+ ::framework::MenuConfiguration aConf( ::comphelper::getProcessComponentContext() );
Reference<com::sun::star::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() );
PopupMenu* pAddonMenu = NULL;
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index bf7003d..fe863b0 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1485,7 +1485,7 @@ SfxPopupWindow* SfxAppToolBoxControl_Impl::CreatePopupWindow()
if ( !pMenu )
{
- ::framework::MenuConfiguration aConf( m_xServiceManager );
+ ::framework::MenuConfiguration aConf( comphelper::getComponentContext(m_xServiceManager) );
if ( m_aCommandURL == ".uno:AddDirect" )
pMenu = aConf.CreateBookmarkMenu( m_xFrame, BOOKMARK_NEWMENU );
else
@@ -1552,7 +1552,7 @@ void SfxAppToolBoxControl_Impl::StateChanged
// to check for supported URLs ...
if ( !pMenu )
{
- ::framework::MenuConfiguration aConf( m_xServiceManager );
+ ::framework::MenuConfiguration aConf( comphelper::getComponentContext(m_xServiceManager) );
// This toolbox controller is used for two popup menus (new documents and wizards!). Create the correct
// popup menu according to the slot ID our controller has been initialized with.
if ( nSlotId == SID_NEWDOCDIRECT )
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index ffed312..64c9a81 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/task/StatusIndicatorFactory.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
@@ -231,7 +231,7 @@ void SAL_CALL SfxInPlaceClient_Impl::saveObject()
uno::Reference< frame::XFrame > xFrame;
uno::Reference< task::XStatusIndicator > xStatusIndicator;
uno::Reference< frame::XModel > xModel( m_xObject->getComponent(), uno::UNO_QUERY );
- uno::Reference< lang::XMultiServiceFactory > xSrvMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
if ( xModel.is() )
{
@@ -240,29 +240,18 @@ void SAL_CALL SfxInPlaceClient_Impl::saveObject()
xFrame = xController->getFrame();
}
- if ( xSrvMgr.is() && xFrame.is() )
+ if ( xFrame.is() )
{
// set non-reschedule progress to prevent problems when asynchronous calls are made
// during storing of the embedded object
- uno::Reference< lang::XInitialization > xInit(
- xSrvMgr->createInstance( "com.sun.star.comp.framework.StatusIndicatorFactory" ), uno::UNO_QUERY_THROW );
- beans::PropertyValue aProperty;
- uno::Sequence< uno::Any > aArgs( 2 );
- aProperty.Name = "DisableReschedule";
- aProperty.Value = uno::makeAny( sal_True );
- aArgs[0] = uno::makeAny( aProperty );
- aProperty.Name = "Frame";
- aProperty.Value = uno::makeAny( xFrame );
- aArgs[1] = uno::makeAny( aProperty );
-
- xInit->initialize( aArgs );
+ uno::Reference< task::XStatusIndicatorFactory > xStatusIndicatorFactory =
+ task::StatusIndicatorFactory::createWithFrame( xContext, xFrame, sal_True/*DisableReschedule*/, sal_False/*AllowParentShow*/ );
uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY );
if ( xPropSet.is() )
{
try
{
- uno::Reference< task::XStatusIndicatorFactory > xStatusIndicatorFactory( xInit, uno::UNO_QUERY_THROW );
xStatusIndicator = xStatusIndicatorFactory->createStatusIndicator();
xPropSet->setPropertyValue( "IndicatorInterception" , uno::makeAny( xStatusIndicator ));
}
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 2d8d4b4..d696568 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -598,25 +598,12 @@ PluginProgressWindow::~PluginProgressWindow()
}
//===============================================
-PluginProgress::PluginProgress( Window* pParent,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+PluginProgress::PluginProgress( Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext )
{
m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this));
css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow);
- m_xProgressFactory = css::uno::Reference< css::task::XStatusIndicatorFactory >(xSMGR->createInstance(SERVICENAME_PROGRESSFACTORY), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::lang::XInitialization > xInit(m_xProgressFactory, css::uno::UNO_QUERY_THROW);
-
- css::uno::Sequence< css::uno::Any > lArgs(2);
- css::beans::NamedValue aProp;
- aProp.Name = PROP_PARENTWINDOW;
- aProp.Value <<= xProgressWindow;
- lArgs[0] <<= aProp;
- aProp.Name = PROP_ALLOWPARENTSHOW;
- aProp.Value <<= sal_True;
- lArgs[1] <<= aProp;
-
- xInit->initialize(lArgs);
-
+ m_xProgressFactory = css::task::StatusIndicatorFactory::createWithWindow(xContext, xProgressWindow, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/);
m_xProgress = m_xProgressFactory->createStatusIndicator();
}
@@ -789,7 +776,7 @@ SaveProgressDialog::SaveProgressDialog(Window* pParent,
, m_pCore ( pCore )
{
FreeResource();
- PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, css::uno::Reference<css::lang::XMultiServiceFactory>(pCore->getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW) );
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getComponentContext() );
m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
}
@@ -998,7 +985,7 @@ RecoveryDialog::RecoveryDialog(Window* pParent,
aVal >>= bCrashRepEnabled;
m_bRecoveryOnly = !bCrashRepEnabled;
- PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, css::uno::Reference<css::lang::XMultiServiceFactory>(pCore->getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW) );
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getComponentContext() );
m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index d4ba999..51f312e 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -32,7 +32,7 @@
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/task/StatusIndicatorFactory.hpp>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -50,14 +50,10 @@
#define RECOVERY_CMD_DO_ENTRY_BACKUP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryBackup" ))
#define RECOVERY_CMD_DO_ENTRY_CLEANUP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryCleanUp" ))
-#define SERVICENAME_PROGRESSFACTORY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory"))
-
-#define PROP_PARENTWINDOW rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window" ))
#define PROP_STATUSINDICATOR rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ))
#define PROP_DISPATCHASYNCHRON rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DispatchAsynchron"))
#define PROP_SAVEPATH rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SavePath" ))
#define PROP_ENTRYID rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "EntryID" ))
-#define PROP_ALLOWPARENTSHOW rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AllowParentShow" ))
#define STATEPROP_ID rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ID" ))
#define STATEPROP_STATE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentState"))
@@ -337,8 +333,8 @@ class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicat
//---------------------------------------
/** @short TODO */
- PluginProgress( Window* pParent,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
+ PluginProgress( Window* pParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext );
//---------------------------------------
/** @short TODO */
commit c4c736c2a4c9852f8ef8257c36d7b5481aa9e83a
Author: Noel Grandin <noel at peralex.com>
Date: Mon Feb 25 11:51:40 2013 +0200
fdo#46808, Convert the menu classes in framework to XComponentContext
Change-Id: Ia800083ab052dd648e25d6ee3ac284a017d2176e
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index e8117de..956a403 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -60,17 +60,46 @@ using namespace ::cppu ;
const sal_uInt16 SLOTID_MDIWINDOWLIST = 5610;
+//-------------------------------------------------------------------------------------------------------------
+// debug methods
+// (should be private everyway!)
+//-------------------------------------------------------------------------------------------------------------
+
+/*-****************************************************************************************************//**
+ @short debug-method to check incoming parameter of some other mehods of this class
+ @descr The following methods are used to check parameters for other methods
+ of this class. The return value is used directly for an ASSERT(...).
+
+ @seealso ASSERTs in implementation!
+
+ @param css::uno::References to checking variables
+ @return sal_False on invalid parameter<BR>
+ sal_True otherway
+
+ @onerror -
+*//*-*****************************************************************************************************/
+
+#ifdef ENABLE_ASSERTIONS
+
+static sal_Bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::uno::XComponentContext >& xContext ,
+ const css::uno::Reference< css::frame::XFrame >& xOwner );
+static sal_Bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl ,
+ const css::util::URL& aURL );
+static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl ,
+ const css::util::URL& aURL );
+#endif // #ifdef ENABLE_ASSERTIONS
+
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
-MenuDispatcher::MenuDispatcher( const uno::Reference< XMultiServiceFactory >& xFactory ,
- const uno::Reference< XFrame >& xOwner )
+MenuDispatcher::MenuDispatcher( const uno::Reference< XComponentContext >& xContext ,
+ const uno::Reference< XFrame >& xOwner )
// Init baseclasses first
: ThreadHelpBase ( &Application::GetSolarMutex() )
, OWeakObject ( )
// Init member
, m_xOwnerWeak ( xOwner )
- , m_xFactory ( xFactory )
+ , m_xContext ( xContext )
, m_aListenerContainer ( m_aLock.getShareableOslMutex() )
, m_bAlreadyDisposed ( sal_False )
, m_bActivateListener ( sal_False )
@@ -78,7 +107,7 @@ MenuDispatcher::MenuDispatcher( const uno::Reference< XMultiServiceFactory >
{
// Safe impossible cases
// We need valid information about our owner for work.
- LOG_ASSERT( impldbg_checkParameter_MenuDispatcher( xFactory, xOwner ), "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!\n" )
+ LOG_ASSERT( impldbg_checkParameter_MenuDispatcher( xContext, xOwner ), "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!\n" )
m_bActivateListener = sal_True;
xOwner->addFrameActionListener( uno::Reference< XFrameActionListener >( (OWeakObject *)this, UNO_QUERY ));
@@ -221,7 +250,7 @@ void SAL_CALL MenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce
}
// Forget our factory.
- m_xFactory = uno::Reference< XMultiServiceFactory >();
+ m_xContext = uno::Reference< XComponentContext >();
// Remove our menu from system window if it is still there!
if ( m_pMenuManager )
@@ -310,11 +339,11 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
// set new menu on our system window and create new menu manager
if ( bMenuFromResource )
{
- m_pMenuManager = new MenuManager( m_xFactory, xFrame, pMenuBar, sal_True, sal_False );
+ m_pMenuManager = new MenuManager( m_xContext, xFrame, pMenuBar, sal_True, sal_False );
}
else
{
- m_pMenuManager = new MenuManager( m_xFactory, xFrame, pMenuBar, sal_True, sal_True );
+ m_pMenuManager = new MenuManager( m_xContext, xFrame, pMenuBar, sal_True, sal_True );
}
pSysWindow->SetMenuBar( pMenuBar );
@@ -344,16 +373,16 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
#ifdef ENABLE_ASSERTIONS
//*****************************************************************************************************************
-sal_Bool MenuDispatcher::impldbg_checkParameter_MenuDispatcher( const uno::Reference< XMultiServiceFactory >& xFactory ,
- const uno::Reference< XFrame >& xOwner )
+static sal_Bool impldbg_checkParameter_MenuDispatcher( const uno::Reference< XComponentContext >& xContext ,
+ const uno::Reference< XFrame >& xOwner )
{
// Set default return value.
sal_Bool bOK = sal_True;
// Check parameter.
if (
- ( &xFactory == NULL ) ||
+ ( &xContext == NULL ) ||
( &xOwner == NULL ) ||
- ( xFactory.is() == sal_False ) ||
+ ( xContext.is() == sal_False ) ||
( xOwner.is() == sal_False )
)
{
@@ -366,8 +395,8 @@ sal_Bool MenuDispatcher::impldbg_checkParameter_MenuDispatcher( const uno::R
//*****************************************************************************************************************
// We need a valid URL. What is meaning with "register for nothing"?!
// xControl must correct to - nobody can advised otherwise!
-sal_Bool MenuDispatcher::impldbg_checkParameter_addStatusListener( const uno::Reference< XStatusListener >& xControl,
- const URL& aURL )
+static sal_Bool impldbg_checkParameter_addStatusListener( const uno::Reference< XStatusListener >& xControl,
+ const URL& aURL )
{
// Set default return value.
sal_Bool bOK = sal_True;
@@ -387,8 +416,8 @@ sal_Bool MenuDispatcher::impldbg_checkParameter_addStatusListener( const uno::
//*****************************************************************************************************************
// The same goes for these case! We have added valid listener for correct URL only.
// We can't remove invalid listener for nothing!
-sal_Bool MenuDispatcher::impldbg_checkParameter_removeStatusListener( const uno::Reference< XStatusListener >& xControl,
- const URL& aURL )
+static sal_Bool impldbg_checkParameter_removeStatusListener( const uno::Reference< XStatusListener >& xControl,
+ const URL& aURL )
{
// Set default return value.
sal_Bool bOK = sal_True;
commit 89d4ecc16e7e9501f357a26de50b3318d24446f3
Author: Noel Grandin <noel at peralex.com>
Date: Fri Feb 22 14:55:20 2013 +0200
fdo#46808, Convert frame::DispatchRecorder to new style
API CHANGE: dropped the XIndexReplace interface because no-one is using it.
Change-Id: Iad77af588a070b22f2fce007a6ec4641758997a8
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 3a5496a..abc275b 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -38,7 +38,6 @@ namespace framework{
#define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" )
#define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" )
#define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" )
-#define SERVICENAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.frame.DispatchRecorder" )
#define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" )
#define SERVICENAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.util.PathSettings" )
#define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" )
@@ -77,7 +76,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_SWTHREADMANAGER DECLARE_ASCII("com.sun.star.util.comp.FinalThreadManager" )
#define IMPLEMENTATIONNAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.comp.framework.JobExecutor" )
#define IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorderSupplier")
-#define IMPLEMENTATIONNAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorder" )
#define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" )
#define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" )
#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.comp.uui.UUIInteractionHandler" )
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index f4a1313..73c8d1e 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -59,8 +59,8 @@ DEFINE_XTYPEPROVIDER_6(
DEFINE_XSERVICEINFO_MULTISERVICE(
DispatchRecorder,
::cppu::OWeakObject,
- SERVICENAME_DISPATCHRECORDER,
- IMPLEMENTATIONNAME_DISPATCHRECORDER)
+ OUString("com.sun.star.frame.DispatchRecorder"),
+ OUString("com.sun.star.comp.framework.DispatchRecorder"))
DEFINE_INIT_SERVICE(
DispatchRecorder,
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 3f2f287..81968bb 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -149,6 +149,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
AutoRecovery \
Desktop \
DispatchHelper \
+ DispatchRecorder \
DispatchRecorderSupplier \
DocumentTemplates \
GlobalEventBroadcaster \
@@ -872,7 +873,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\
DesktopTask \
DesktopTasks \
DispatchProvider \
- DispatchRecorder \
Frame \
FrameControl \
FrameLoader \
diff --git a/offapi/com/sun/star/frame/DispatchRecorder.idl b/offapi/com/sun/star/frame/DispatchRecorder.idl
index 499f5ba..2038477 100644
--- a/offapi/com/sun/star/frame/DispatchRecorder.idl
+++ b/offapi/com/sun/star/frame/DispatchRecorder.idl
@@ -20,7 +20,6 @@
#define __com_sun_star_frame_DispatchRecorder_idl__
#include <com/sun/star/frame/XDispatchRecorder.idl>
-#include <com/sun/star/container/XIndexReplace.idl>
module com { module sun { module star { module frame {
@@ -42,15 +41,7 @@
@since OOo 1.1.2
*/
-published service DispatchRecorder
-{
- /** provides the record functionality and access on the generated code
- */
- interface com::sun::star::frame::XDispatchRecorder;
- /** provides replacement capability of recorded statements
- */
- interface com::sun::star::container::XIndexReplace;
-};
+published service DispatchRecorder : XDispatchRecorder;
}; }; }; };
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index ff334d8..5c4c99c 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index bdc54c0..9ec782e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -24,6 +24,7 @@
#include <sfx2/viewfrm.hxx>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/DispatchRecorder.hpp>
#include <com/sun/star/frame/DispatchRecorderSupplier.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -2828,15 +2829,10 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )
else if ( rReq.GetSlot() == SID_RECORDMACRO )
{
// enable recording
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xFactory(
- ::comphelper::getProcessServiceFactory(),
- com::sun::star::uno::UNO_QUERY);
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext(
::comphelper::getProcessComponentContext());
- xRecorder = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder >(
- xFactory->createInstance(rtl::OUString("com.sun.star.frame.DispatchRecorder")),
- com::sun::star::uno::UNO_QUERY);
+ xRecorder = com::sun::star::frame::DispatchRecorder::create( xContext );
xSupplier = com::sun::star::frame::DispatchRecorderSupplier::create( xContext );
commit 4633b07bed7d71d1ab9d7fa30d979f054043958b
Author: Noel Grandin <noel at peralex.com>
Date: Fri Feb 22 12:20:16 2013 +0200
fdo#46808, remove some unnecessary getProcessServiceFactory calls
Change-Id: I62652b0fd9a28e0e7eaea65569764bc534b112f1
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 88f8763..de6b6d3 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -228,10 +228,7 @@ static ::rtl::OUString RetrieveLabelFromCommand(
::rtl::OUString aLabel;
css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( s_xModuleManager );
css::uno::Reference< css::container::XNameAccess > xNameAccess( s_xNameAccess );
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR(
- ::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::uno::XComponentContext > xContext(
- ::comphelper::getProcessComponentContext(), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
try
{
@@ -246,8 +243,7 @@ static ::rtl::OUString RetrieveLabelFromCommand(
if ( !xNameAccess.is() )
{
xNameAccess = css::uno::Reference< css::container::XNameAccess >(
- css::frame::UICommandDescription::create(
- comphelper::getComponentContext(xSMGR)),
+ css::frame::UICommandDescription::create(xContext),
css::uno::UNO_QUERY_THROW );
s_xNameAccess = xNameAccess;
}
@@ -362,9 +358,8 @@ enum ETypeFamily
{
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (::comphelper::getProcessServiceFactory() , css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext() , css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
+ css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext());
+ css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext));
::rtl::OUString sModule = xModuleManager->identify(xFrame);
::rtl::OUString sType ;
More information about the Libreoffice-commits
mailing list