1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //_______________________________________________
32*cdf0e10cSrcweir // own includes
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
35*cdf0e10cSrcweir #include <macros/xinterface.hxx>
36*cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
37*cdf0e10cSrcweir #include <macros/xserviceinfo.hxx>
38*cdf0e10cSrcweir #include <general.h>
39*cdf0e10cSrcweir #include <stdtypes.h>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //_______________________________________________
42*cdf0e10cSrcweir // interface includes
43*cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //_______________________________________________
52*cdf0e10cSrcweir // other includes
53*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
54*cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //_______________________________________________
57*cdf0e10cSrcweir // definition
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir namespace framework
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //_______________________________________________
63*cdf0e10cSrcweir /**
64*cdf0e10cSrcweir  *  TODO document me
65*cdf0e10cSrcweir  */
66*cdf0e10cSrcweir class TaskCreatorService : public  css::lang::XTypeProvider
67*cdf0e10cSrcweir                          , public  css::lang::XServiceInfo
68*cdf0e10cSrcweir                          , public  css::lang::XSingleServiceFactory
69*cdf0e10cSrcweir                            // attention! Must be the first base class to guarentee right initialize lock ...
70*cdf0e10cSrcweir                          , private ThreadHelpBase
71*cdf0e10cSrcweir                          , public  ::cppu::OWeakObject
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir     //___________________________________________
74*cdf0e10cSrcweir     // types
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     public:
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir         /// [XFrame] if it's set, it will be used as parent frame for the new created frame.
79*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_PARENTFRAME;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir         /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
82*cdf0e10cSrcweir                        it will be set as the API name of the new created frame.
83*cdf0e10cSrcweir          */
84*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_FRAMENAME;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir         /// [sal_Bool] If its set to sal_True we will make the new created frame visible.
87*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_MAKEVISIBLE;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir         /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
90*cdf0e10cSrcweir                        top level window as new container window.
91*cdf0e10cSrcweir          */
92*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_CREATETOPWINDOW;
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         /// [Rectangle] Place the new created frame on this place and resize the container window.
95*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_POSSIZE;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir         /// [XWindow] an outside created window, used as container window of the new created frame.
98*cdf0e10cSrcweir 		static const ::rtl::OUString ARGUMENT_CONTAINERWINDOW;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         /** [sal_Bool] enable/disable special mode, where this frame will be part of
101*cdf0e10cSrcweir                        the persistent window state feature suitable for any office module window
102*cdf0e10cSrcweir          */
103*cdf0e10cSrcweir         static const ::rtl::OUString ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE;
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir         /** [sal_Bool] enable/disable special mode, where the title bar of our
106*cdf0e10cSrcweir                        the new created frame will be updated automaticly.
107*cdf0e10cSrcweir                        Default = ON !
108*cdf0e10cSrcweir          */
109*cdf0e10cSrcweir         static const ::rtl::OUString ARGUMENT_ENABLE_TITLEBARUPDATE;
110*cdf0e10cSrcweir     //___________________________________________
111*cdf0e10cSrcweir     // member
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     private:
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         //---------------------------------------
116*cdf0e10cSrcweir         /** @short  the global uno service manager.
117*cdf0e10cSrcweir             @descr  Must be used to create own needed services.
118*cdf0e10cSrcweir          */
119*cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     //___________________________________________
122*cdf0e10cSrcweir     // interface
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     public:
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir                  TaskCreatorService(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
127*cdf0e10cSrcweir         virtual ~TaskCreatorService(                                                                   );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir         // XInterface, XTypeProvider, XServiceInfo
130*cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
131*cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
132*cdf0e10cSrcweir         DECLARE_XSERVICEINFO
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir         // XSingleServiceFactory
135*cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance()
136*cdf0e10cSrcweir             throw(css::uno::Exception       ,
137*cdf0e10cSrcweir                   css::uno::RuntimeException);
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments)
140*cdf0e10cSrcweir             throw(css::uno::Exception       ,
141*cdf0e10cSrcweir                   css::uno::RuntimeException);
142*cdf0e10cSrcweir     //___________________________________________
143*cdf0e10cSrcweir     // helper
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     private:
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow ,
148*cdf0e10cSrcweir                                                                                const css::awt::Rectangle&                      aPosSize      ,
149*cdf0e10cSrcweir                                                                                      sal_Bool                                  bTopWindow    );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir         void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame     ,
154*cdf0e10cSrcweir                                                                       const css::uno::Reference< css::awt::XWindow >&  xContainerWindow ,
155*cdf0e10cSrcweir                                                                       const ::rtl::OUString&                           sName            );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir         void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame );
158*cdf0e10cSrcweir         void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir         void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir         ::rtl::OUString impl_filterNames( const ::rtl::OUString& sName );
163*cdf0e10cSrcweir };
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir } // namespace framework
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir #endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
168