summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 16:42:06 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 16:29:02 +0100
commitda68b2d30c3b25d633936d08c5f476e99de0e5d5 (patch)
tree6d62ef2bb790e905de82aa5e78b3a0076a84d48f /framework/source
parenta2317de0c3ef6094f67a6684ab395382f34b0f80 (diff)
fwk: Use constructor feature for WindowContentFactoryManager.
Change-Id: I6786bc1d76fd57edc8dfacb667b53deab792bd20
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx3
-rw-r--r--framework/source/uifactory/windowcontentfactorymanager.cxx90
3 files changed, 43 insertions, 52 deletions
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 617bd1f1f281..7e3fb68e948d 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -56,7 +56,6 @@
#include <services/taskcreatorsrv.hxx>
#include <uiconfiguration/imagemanager.hxx>
-#include <uifactory/windowcontentfactorymanager.hxx>
#include <services/substitutepathvars.hxx>
#include <services/pathsettings.hxx>
#include <services/ContextChangeEventMultiplexer.hxx>
@@ -85,7 +84,6 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::SessionListener ) else
IFFACTORY( ::framework::TaskCreatorService ) else
IFFACTORY( ::framework::ImageManager ) else
- IFFACTORY( ::framework::WindowContentFactoryManager ) else
IFFACTORY( ::framework::SubstitutePathVariables ) else
IFFACTORY( ::framework::PathSettings ) else
IFFACTORY( ::framework::ContextChangeEventMultiplexer )
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index d1dd274e3501..6d52f970690a 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -18,7 +18,6 @@
*/
#include <uifactory/uielementfactorymanager.hxx>
-#include <uifactory/windowcontentfactorymanager.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
@@ -465,7 +464,7 @@ throw ( RuntimeException )
OUString aType;
OUString aName;
- WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
+ RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
Reference< XComponentContext > xContext( m_xContext );
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index b66c473b2d2a..2cf90ec857f8 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -17,43 +17,55 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <uifactory/windowcontentfactorymanager.hxx>
#include <uifactory/uielementfactorymanager.hxx>
#include <threadhelp/resetableguard.hxx>
+#include <threadhelp/threadhelpbase.hxx>
+#include <helper/mischelper.hxx>
+#include <macros/xinterface.hxx>
+#include <macros/xtypeprovider.hxx>
+#include <macros/xserviceinfo.hxx>
#include "services.h"
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include "com/sun/star/frame/XModuleManager2.hpp"
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/weak.hxx>
#include <tools/urlobj.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
-//_________________________________________________________________________________________________________________
-// Defines
-//_________________________________________________________________________________________________________________
-
using namespace ::com::sun::star;
+using namespace framework;
-//_________________________________________________________________________________________________________________
-// Namespace
-//_________________________________________________________________________________________________________________
+namespace {
-namespace framework
+class WindowContentFactoryManager : private ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo ,
+ com::sun::star::lang::XSingleComponentFactory>
{
+ public:
+ WindowContentFactoryManager( const css::uno::Reference< css::uno::XComponentContext>& rxContext );
+ virtual ~WindowContentFactoryManager();
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+
+ // XSingleComponentFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithContext( const css::uno::Reference< css::uno::XComponentContext >& Context ) throw (css::uno::Exception, css::uno::RuntimeException);
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const css::uno::Sequence< css::uno::Any >& Arguments, const css::uno::Reference< css::uno::XComponentContext >& Context ) throw (css::uno::Exception, css::uno::RuntimeException);
+
+ private:
+ sal_Bool m_bConfigRead;
+ css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
+ ConfigurationAccess_FactoryManager* m_pConfigAccess;
+};
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( WindowContentFactoryManager ,
::cppu::OWeakObject ,
"com.sun.star.ui.WindowContentFactoryManager",
@@ -79,35 +91,6 @@ WindowContentFactoryManager::~WindowContentFactoryManager()
m_pConfigAccess->release();
}
-void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const OUString& aResourceURL, OUString& aType, OUString& aName )
-{
- const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
- const char RESOURCEURL_PREFIX[] = "private:resource/";
-
- if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
- sal_Int32 nToken = 0;
- sal_Int32 nPart = 0;
- do
- {
- OUString sToken = aTmpStr.getToken( 0, '/', nToken);
- if ( !sToken.isEmpty() )
- {
- if ( nPart == 0 )
- aType = sToken;
- else if ( nPart == 1 )
- aName = sToken;
- else
- break;
- nPart++;
- }
- }
- while( nToken >=0 );
- }
-}
-
// XSingleComponentFactory
uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext(
const uno::Reference< uno::XComponentContext >& /*xContext*/ )
@@ -214,6 +197,17 @@ throw (uno::Exception, uno::RuntimeException)
return xWindow;
}
-} // namespace framework
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_WindowContentFactoryManager_get_implementation(
+ css::uno::XComponentContext * context,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ rtl::Reference<WindowContentFactoryManager> x(new WindowContentFactoryManager(context));
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */