1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
31cdf0e10cSrcweir #include <macros/xinterface.hxx>
32cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
33cdf0e10cSrcweir #include <macros/xserviceinfo.hxx>
34cdf0e10cSrcweir #include <general.h>
35cdf0e10cSrcweir #include <stdtypes.h>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //_______________________________________________
38cdf0e10cSrcweir // interface includes
39cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp>
40cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
41cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
42cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
43cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
45cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //_______________________________________________
48cdf0e10cSrcweir // other includes
49cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
50cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //_______________________________________________
53cdf0e10cSrcweir // definition
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace framework
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //_______________________________________________
59cdf0e10cSrcweir /**
60cdf0e10cSrcweir  *  TODO document me
61cdf0e10cSrcweir  */
62cdf0e10cSrcweir class TaskCreatorService : public  css::lang::XTypeProvider
63cdf0e10cSrcweir                          , public  css::lang::XServiceInfo
64cdf0e10cSrcweir                          , public  css::lang::XSingleServiceFactory
65cdf0e10cSrcweir                            // attention! Must be the first base class to guarentee right initialize lock ...
66cdf0e10cSrcweir                          , private ThreadHelpBase
67cdf0e10cSrcweir                          , public  ::cppu::OWeakObject
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     //___________________________________________
70cdf0e10cSrcweir     // types
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     public:
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         /// [XFrame] if it's set, it will be used as parent frame for the new created frame.
75cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_PARENTFRAME;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
78cdf0e10cSrcweir                        it will be set as the API name of the new created frame.
79cdf0e10cSrcweir          */
80cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_FRAMENAME;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir         /// [sal_Bool] If its set to sal_True we will make the new created frame visible.
83cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_MAKEVISIBLE;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
86cdf0e10cSrcweir                        top level window as new container window.
87cdf0e10cSrcweir          */
88cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_CREATETOPWINDOW;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         /// [Rectangle] Place the new created frame on this place and resize the container window.
91cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_POSSIZE;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /// [XWindow] an outside created window, used as container window of the new created frame.
94cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_CONTAINERWINDOW;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         /** [sal_Bool] enable/disable special mode, where this frame will be part of
97cdf0e10cSrcweir                        the persistent window state feature suitable for any office module window
98cdf0e10cSrcweir          */
99cdf0e10cSrcweir         static const ::rtl::OUString ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         /** [sal_Bool] enable/disable special mode, where the title bar of our
102cdf0e10cSrcweir                        the new created frame will be updated automaticly.
103cdf0e10cSrcweir                        Default = ON !
104cdf0e10cSrcweir          */
105cdf0e10cSrcweir         static const ::rtl::OUString ARGUMENT_ENABLE_TITLEBARUPDATE;
106cdf0e10cSrcweir     //___________________________________________
107cdf0e10cSrcweir     // member
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     private:
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         //---------------------------------------
112cdf0e10cSrcweir         /** @short  the global uno service manager.
113cdf0e10cSrcweir             @descr  Must be used to create own needed services.
114cdf0e10cSrcweir          */
115cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     //___________________________________________
118cdf0e10cSrcweir     // interface
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     public:
121cdf0e10cSrcweir 
122cdf0e10cSrcweir                  TaskCreatorService(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
123cdf0e10cSrcweir         virtual ~TaskCreatorService(                                                                   );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         // XInterface, XTypeProvider, XServiceInfo
126cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
127cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
128cdf0e10cSrcweir         DECLARE_XSERVICEINFO
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         // XSingleServiceFactory
131cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance()
132cdf0e10cSrcweir             throw(css::uno::Exception       ,
133cdf0e10cSrcweir                   css::uno::RuntimeException);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments)
136cdf0e10cSrcweir             throw(css::uno::Exception       ,
137cdf0e10cSrcweir                   css::uno::RuntimeException);
138cdf0e10cSrcweir     //___________________________________________
139cdf0e10cSrcweir     // helper
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     private:
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow ,
144cdf0e10cSrcweir                                                                                const css::awt::Rectangle&                      aPosSize      ,
145cdf0e10cSrcweir                                                                                      sal_Bool                                  bTopWindow    );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame     ,
150cdf0e10cSrcweir                                                                       const css::uno::Reference< css::awt::XWindow >&  xContainerWindow ,
151cdf0e10cSrcweir                                                                       const ::rtl::OUString&                           sName            );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir         void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame );
154cdf0e10cSrcweir         void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir         void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame );
157cdf0e10cSrcweir 
158cdf0e10cSrcweir         ::rtl::OUString impl_filterNames( const ::rtl::OUString& sName );
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir } // namespace framework
162cdf0e10cSrcweir 
163cdf0e10cSrcweir #endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
164