summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 17:32:35 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 16:29:11 +0100
commit7e3d6c54f629f5a84b1fd09525d506b708acb386 (patch)
tree2cec24fa40bf49aa8d9e837ab915448e4203c42f
parent1bae084f333912db8aacce47a9f94eab5bb0ef4f (diff)
fwk: Use constructor feature for TaskCreatorService.
Change-Id: I9e994ebb4822458039709690aa5dd0a7f75735ac
-rw-r--r--framework/inc/helper/persistentwindowstate.hxx1
-rw-r--r--framework/inc/services/taskcreatorsrv.hxx148
-rw-r--r--framework/inc/taskcreatordefs.hxx58
-rw-r--r--framework/source/classes/taskcreator.cxx2
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/source/services/taskcreatorsrv.cxx89
-rw-r--r--framework/util/fwk.component3
7 files changed, 142 insertions, 161 deletions
diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx
index bc042f7b7d25..09ede334a785 100644
--- a/framework/inc/helper/persistentwindowstate.hxx
+++ b/framework/inc/helper/persistentwindowstate.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <unotools/moduleoptions.hxx>
#include <cppuhelper/implbase2.hxx>
diff --git a/framework/inc/services/taskcreatorsrv.hxx b/framework/inc/services/taskcreatorsrv.hxx
deleted file mode 100644
index 4fc9642e59d2..000000000000
--- a/framework/inc/services/taskcreatorsrv.hxx
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- 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 INCLUDED_FRAMEWORK_INC_SERVICES_TASKCREATORSRV_HXX
-#define INCLUDED_FRAMEWORK_INC_SERVICES_TASKCREATORSRV_HXX
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <general.h>
-#include <stdtypes.h>
-
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/frame/XFrame2.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-#include <comphelper/sequenceashashmap.hxx>
-
-//_______________________________________________
-// definition
-
-/// [XFrame] if it's set, it will be used as parent frame for the new created frame.
-const char ARGUMENT_PARENTFRAME[] = "ParentFrame"; // XFrame
-
-/** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
- it will be set as the API name of the new created frame.
- */
-const char ARGUMENT_FRAMENAME[] = "FrameName"; // OUString
-
-/// [sal_Bool] If its set to sal_True we will make the new created frame visible.
-const char ARGUMENT_MAKEVISIBLE[] = "MakeVisible"; // sal_Bool
-
-/** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
- top level window as new container window.
- */
-const char ARGUMENT_CREATETOPWINDOW[] = "CreateTopWindow"; // sal_Bool
-
-/// [Rectangle] Place the new created frame on this place and resize the container window.
-const char ARGUMENT_POSSIZE[] = "PosSize"; // Rectangle
-
-/// [XWindow] an outside created window, used as container window of the new created frame.
-const char ARGUMENT_CONTAINERWINDOW[] = "ContainerWindow"; // XWindow
-
-/** [sal_Bool] enable/disable special mode, where this frame will be part of
- the persistent window state feature suitable for any office module window
- */
-const char ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE[] = "SupportPersistentWindowState"; // sal_Bool
-
-/** [sal_Bool] enable/disable special mode, where the title bar of our
- the new created frame will be updated automaticly.
- Default = ON !
- */
-const char ARGUMENT_ENABLE_TITLEBARUPDATE[] = "EnableTitleBarUpdate"; // sal_Bool
-
-
-namespace framework
-{
-
-//_______________________________________________
-/**
- * TODO document me
- */
-class TaskCreatorService : // attention! Must be the first base class to guarentee right initialize lock ...
- private ThreadHelpBase,
- public ::cppu::WeakImplHelper2<
- css::lang::XServiceInfo,
- css::lang::XSingleServiceFactory>
-{
- //___________________________________________
- // member
-
- private:
-
- //---------------------------------------
- /** @short the global uno service manager.
- @descr Must be used to create own needed services.
- */
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- //___________________________________________
- // interface
-
- public:
-
- TaskCreatorService(const css::uno::Reference< css::uno::XComponentContext >& xContext);
- virtual ~TaskCreatorService( );
-
- // XInterface, XTypeProvider, XServiceInfo
- DECLARE_XSERVICEINFO
-
- // XSingleServiceFactory
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance()
- throw(css::uno::Exception ,
- css::uno::RuntimeException);
-
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments)
- throw(css::uno::Exception ,
- css::uno::RuntimeException);
- //___________________________________________
- // helper
-
- private:
-
- css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow ,
- const css::awt::Rectangle& aPosSize ,
- sal_Bool bTopWindow );
-
- void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const;
-
- css::uno::Reference< css::frame::XFrame2 > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame ,
- const css::uno::Reference< css::awt::XWindow >& xContainerWindow ,
- const OUString& sName );
-
- void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
- void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
-
- void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
-
- OUString impl_filterNames( const OUString& sName );
-};
-
-} // namespace framework
-
-#endif // INCLUDED_FRAMEWORK_INC_SERVICES_TASKCREATORSRV_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/inc/taskcreatordefs.hxx b/framework/inc/taskcreatordefs.hxx
new file mode 100644
index 000000000000..7da077237e25
--- /dev/null
+++ b/framework/inc/taskcreatordefs.hxx
@@ -0,0 +1,58 @@
+/* -*- 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 INCLUDED_FRAMEWORK_INC_TASKCREATORDEFS_HXX
+#define INCLUDED_FRAMEWORK_INC_TASKCREATORDEFS_HXX
+
+/// [XFrame] if it's set, it will be used as parent frame for the new created frame.
+const char ARGUMENT_PARENTFRAME[] = "ParentFrame"; // XFrame
+
+/** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
+ it will be set as the API name of the new created frame.
+ */
+const char ARGUMENT_FRAMENAME[] = "FrameName"; // OUString
+
+/// [sal_Bool] If its set to sal_True we will make the new created frame visible.
+const char ARGUMENT_MAKEVISIBLE[] = "MakeVisible"; // sal_Bool
+
+/** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
+ top level window as new container window.
+ */
+const char ARGUMENT_CREATETOPWINDOW[] = "CreateTopWindow"; // sal_Bool
+
+/// [Rectangle] Place the new created frame on this place and resize the container window.
+const char ARGUMENT_POSSIZE[] = "PosSize"; // Rectangle
+
+/// [XWindow] an outside created window, used as container window of the new created frame.
+const char ARGUMENT_CONTAINERWINDOW[] = "ContainerWindow"; // XWindow
+
+/** [sal_Bool] enable/disable special mode, where this frame will be part of
+ the persistent window state feature suitable for any office module window
+ */
+const char ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE[] = "SupportPersistentWindowState"; // sal_Bool
+
+/** [sal_Bool] enable/disable special mode, where the title bar of our
+ the new created frame will be updated automaticly.
+ Default = ON !
+ */
+const char ARGUMENT_ENABLE_TITLEBARUPDATE[] = "EnableTitleBarUpdate"; // sal_Bool
+
+#endif // INCLUDED_FRAMEWORK_INC_TASKCREATORDEFS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index 410aa0ad06a8..b425aaa538bf 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -18,10 +18,10 @@
*/
#include <classes/taskcreator.hxx>
-#include "services/taskcreatorsrv.hxx"
#include <threadhelp/readguard.hxx>
#include <loadenv/targethelper.hxx>
#include <services.h>
+#include <taskcreatordefs.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/TaskCreator.hpp>
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 5d8cfd16f466..a5ad5bca8492 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -48,7 +48,6 @@
#include <accelerators/documentacceleratorconfiguration.hxx>
#include <uielement/recentfilesmenucontroller.hxx>
#include <services/sessionlistener.hxx>
-#include <services/taskcreatorsrv.hxx>
#include <uiconfiguration/imagemanager.hxx>
#include <services/substitutepathvars.hxx>
@@ -72,7 +71,6 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::RecentFilesMenuController ) else
IFFACTORY( ::framework::SessionListener ) else
IFFACTORY( ::framework::SessionListener ) else
- IFFACTORY( ::framework::TaskCreatorService ) else
IFFACTORY( ::framework::ImageManager ) else
IFFACTORY( ::framework::SubstitutePathVariables ) else
IFFACTORY( ::framework::PathSettings ) else
diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx
index 6ce88a996e63..1d1732ec0deb 100644
--- a/framework/source/services/taskcreatorsrv.cxx
+++ b/framework/source/services/taskcreatorsrv.cxx
@@ -17,38 +17,98 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "services/taskcreatorsrv.hxx"
-
#include <helper/persistentwindowstate.hxx>
#include <helper/tagwindowasmodified.hxx>
#include <helper/titlebarupdate.hxx>
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
#include <loadenv/targethelper.hxx>
+#include <macros/xserviceinfo.hxx>
#include <services.h>
+#include <taskcreatordefs.hxx>
#include <com/sun/star/frame/Frame.hpp>
+#include <com/sun/star/frame/XFrame2.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/WindowDescriptor.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <comphelper/sequenceashashmap.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
#include <svtools/colorcfg.hxx>
-#include <vcl/svapp.hxx>
-
#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
-//_______________________________________________
-// namespaces
+using namespace framework;
-namespace framework
+namespace {
+
+class TaskCreatorService : // attention! Must be the first base class to guarentee right initialize lock ...
+ private ThreadHelpBase,
+ public ::cppu::WeakImplHelper2<
+ css::lang::XServiceInfo,
+ css::lang::XSingleServiceFactory>
{
-//-----------------------------------------------
+ private:
+
+ //---------------------------------------
+ /** @short the global uno service manager.
+ @descr Must be used to create own needed services.
+ */
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ //___________________________________________
+ // interface
+
+ public:
+
+ TaskCreatorService(const css::uno::Reference< css::uno::XComponentContext >& xContext);
+ virtual ~TaskCreatorService( );
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+
+ // XSingleServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException);
+ //___________________________________________
+ // helper
+
+ private:
+
+ css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow ,
+ const css::awt::Rectangle& aPosSize ,
+ sal_Bool bTopWindow );
+
+ void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const;
+
+ css::uno::Reference< css::frame::XFrame2 > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame ,
+ const css::uno::Reference< css::awt::XWindow >& xContainerWindow ,
+ const OUString& sName );
+
+ void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
+ void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
+
+ void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame );
+
+ OUString impl_filterNames( const OUString& sName );
+};
+
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2(TaskCreatorService ,
::cppu::OWeakObject ,
"com.sun.star.frame.TaskCreator",
@@ -338,6 +398,17 @@ OUString TaskCreatorService::impl_filterNames( const OUString& sName )
return sFiltered;
}
-} // namespace framework
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_TaskCreator_get_implementation(
+ css::uno::XComponentContext * context,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ rtl::Reference<TaskCreatorService> x(new TaskCreatorService(context));
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index bbab2c49f5fd..a39e355adc6c 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -104,7 +104,8 @@
constructor="com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation">
<service name="com.sun.star.task.StatusIndicatorFactory"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.TaskCreator">
+ <implementation name="com.sun.star.comp.framework.TaskCreator"
+ constructor="com_sun_star_comp_framework_TaskCreator_get_implementation">
<service name="com.sun.star.frame.TaskCreator"/>
</implementation>
<implementation name="com.sun.star.comp.framework.ToolBarControllerFactory"