1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
21 #define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/xinterface.hxx>
25 #include <macros/xtypeprovider.hxx>
26 #include <macros/xserviceinfo.hxx>
30 #include <com/sun/star/uno/XInterface.hpp>
31 #include <com/sun/star/frame/XFrame2.hpp>
32 #include <com/sun/star/lang/XTypeProvider.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
36 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <cppuhelper/weak.hxx>
39 #include <comphelper/sequenceashashmap.hxx>
41 //_______________________________________________
44 /// [XFrame] if it's set, it will be used as parent frame for the new created frame.
45 const char ARGUMENT_PARENTFRAME
[] = "ParentFrame"; // XFrame
47 /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!)
48 it will be set as the API name of the new created frame.
50 const char ARGUMENT_FRAMENAME
[] = "FrameName"; // OUString
52 /// [sal_Bool] If its set to sal_True we will make the new created frame visible.
53 const char ARGUMENT_MAKEVISIBLE
[] = "MakeVisible"; // sal_Bool
55 /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a
56 top level window as new container window.
58 const char ARGUMENT_CREATETOPWINDOW
[] = "CreateTopWindow"; // sal_Bool
60 /// [Rectangle] Place the new created frame on this place and resize the container window.
61 const char ARGUMENT_POSSIZE
[] = "PosSize"; // Rectangle
63 /// [XWindow] an outside created window, used as container window of the new created frame.
64 const char ARGUMENT_CONTAINERWINDOW
[] = "ContainerWindow"; // XWindow
66 /** [sal_Bool] enable/disable special mode, where this frame will be part of
67 the persistent window state feature suitable for any office module window
69 const char ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE
[] = "SupportPersistentWindowState"; // sal_Bool
71 /** [sal_Bool] enable/disable special mode, where the title bar of our
72 the new created frame will be updated automaticly.
75 const char ARGUMENT_ENABLE_TITLEBARUPDATE
[] = "EnableTitleBarUpdate"; // sal_Bool
81 //_______________________________________________
85 class TaskCreatorService
: public css::lang::XTypeProvider
86 , public css::lang::XServiceInfo
87 , public css::lang::XSingleServiceFactory
88 // attention! Must be the first base class to guarentee right initialize lock ...
89 , private ThreadHelpBase
90 , public ::cppu::OWeakObject
92 //___________________________________________
97 //---------------------------------------
98 /** @short the global uno service manager.
99 @descr Must be used to create own needed services.
101 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
103 //___________________________________________
108 TaskCreatorService(const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
109 virtual ~TaskCreatorService( );
111 // XInterface, XTypeProvider, XServiceInfo
112 FWK_DECLARE_XINTERFACE
113 FWK_DECLARE_XTYPEPROVIDER
116 // XSingleServiceFactory
117 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstance()
118 throw(css::uno::Exception
,
119 css::uno::RuntimeException
);
121 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithArguments(const css::uno::Sequence
< css::uno::Any
>& lArguments
)
122 throw(css::uno::Exception
,
123 css::uno::RuntimeException
);
124 //___________________________________________
129 css::uno::Reference
< css::awt::XWindow
> implts_createContainerWindow( const css::uno::Reference
< css::awt::XWindow
>& xParentWindow
,
130 const css::awt::Rectangle
& aPosSize
,
131 sal_Bool bTopWindow
);
133 void implts_applyDocStyleToWindow(const css::uno::Reference
< css::awt::XWindow
>& xWindow
) const;
135 css::uno::Reference
< css::frame::XFrame2
> implts_createFrame( const css::uno::Reference
< css::frame::XFrame
>& xParentFrame
,
136 const css::uno::Reference
< css::awt::XWindow
>& xContainerWindow
,
137 const OUString
& sName
);
139 void implts_establishWindowStateListener( const css::uno::Reference
< css::frame::XFrame2
>& xFrame
);
140 void implts_establishTitleBarUpdate( const css::uno::Reference
< css::frame::XFrame2
>& xFrame
);
142 void implts_establishDocModifyListener( const css::uno::Reference
< css::frame::XFrame2
>& xFrame
);
144 OUString
impl_filterNames( const OUString
& sName
);
147 } // namespace framework
149 #endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */