1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: taskcreatorsrv.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
32 #define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
34 //_______________________________________________
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/xinterface.hxx>
39 #include <macros/xtypeprovider.hxx>
40 #include <macros/xserviceinfo.hxx>
44 //_______________________________________________
46 #include <com/sun/star/uno/XInterface.hpp>
47 #include <com/sun/star/frame/XFrame.hpp>
48 #include <com/sun/star/lang/XTypeProvider.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
52 #include <com/sun/star/awt/Rectangle.hpp>
54 //_______________________________________________
56 #include <cppuhelper/weak.hxx>
57 #include <comphelper/sequenceashashmap.hxx>
59 //_______________________________________________
65 //_______________________________________________
69 class TaskCreatorService
: public css::lang::XTypeProvider
70 , public css::lang::XServiceInfo
71 , public css::lang::XSingleServiceFactory
72 // attention! Must be the first base class to guarentee right initialize lock ...
73 , private ThreadHelpBase
74 , public ::cppu::OWeakObject
76 //___________________________________________
81 /// [XFrame] if it's set, it will be used as parent frame for the new created frame.
82 static const ::rtl::OUString ARGUMENT_PARENTFRAME
;
84 /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
85 it will be set as the API name of the new created frame.
87 static const ::rtl::OUString ARGUMENT_FRAMENAME
;
89 /// [sal_Bool] If its set to TRUE we will make the new created frame visible.
90 static const ::rtl::OUString ARGUMENT_MAKEVISIBLE
;
92 /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
93 top level window as new container window.
95 static const ::rtl::OUString ARGUMENT_CREATETOPWINDOW
;
97 /// [Rectangle] Place the new created frame on this place and resize the container window.
98 static const ::rtl::OUString ARGUMENT_POSSIZE
;
100 /// [XWindow] an outside created window, used as container window of the new created frame.
101 static const ::rtl::OUString ARGUMENT_CONTAINERWINDOW
;
103 /** [sal_Bool] enable/disable special mode, where this frame will be part of
104 the persistent window state feature suitable for any office module window
106 static const ::rtl::OUString ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE
;
108 /** [sal_Bool] enable/disable special mode, where the title bar of our
109 the new created frame will be updated automaticly.
112 static const ::rtl::OUString ARGUMENT_ENABLE_TITLEBARUPDATE
;
113 //___________________________________________
118 //---------------------------------------
119 /** @short the global uno service manager.
120 @descr Must be used to create own needed services.
122 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
124 //___________________________________________
129 TaskCreatorService(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
130 virtual ~TaskCreatorService( );
132 // XInterface, XTypeProvider, XServiceInfo
133 FWK_DECLARE_XINTERFACE
134 FWK_DECLARE_XTYPEPROVIDER
137 // XSingleServiceFactory
138 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstance()
139 throw(css::uno::Exception
,
140 css::uno::RuntimeException
);
142 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithArguments(const css::uno::Sequence
< css::uno::Any
>& lArguments
)
143 throw(css::uno::Exception
,
144 css::uno::RuntimeException
);
145 //___________________________________________
150 css::uno::Reference
< css::awt::XWindow
> implts_createContainerWindow( const css::uno::Reference
< css::awt::XWindow
>& xParentWindow
,
151 const css::awt::Rectangle
& aPosSize
,
152 sal_Bool bTopWindow
);
154 void implts_applyDocStyleToWindow(const css::uno::Reference
< css::awt::XWindow
>& xWindow
) const;
156 css::uno::Reference
< css::frame::XFrame
> implts_createFrame( const css::uno::Reference
< css::frame::XFrame
>& xParentFrame
,
157 const css::uno::Reference
< css::awt::XWindow
>& xContainerWindow
,
158 const ::rtl::OUString
& sName
);
160 void implts_establishWindowStateListener( const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
161 void implts_establishTitleBarUpdate( const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
163 void implts_establishDocModifyListener( const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
165 ::rtl::OUString
impl_filterNames( const ::rtl::OUString
& sName
);
168 } // namespace framework
170 #endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_