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