merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / helper / titlebarupdate.hxx
blob96549bfe30ebd0aebf8c2f7bfcfad95af7dab4f2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: titlebarupdate.hxx,v $
11 * $Revision: 1.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
33 #define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
35 //_________________________________________________________________________________________________________________
36 // my own includes
37 //_________________________________________________________________________________________________________________
39 #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
40 #include <threadhelp/threadhelpbase.hxx>
41 #endif
43 #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
44 #include <macros/debug.hxx>
45 #endif
47 #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
48 #include <macros/xinterface.hxx>
49 #endif
51 #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_
52 #include <macros/xtypeprovider.hxx>
53 #endif
55 #ifndef __FRAMEWORK_GENERAL_H_
56 #include <general.h>
57 #endif
59 //_________________________________________________________________________________________________________________
60 // interface includes
61 //_________________________________________________________________________________________________________________
63 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
64 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
65 #endif
67 #ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
68 #include <com/sun/star/lang/XInitialization.hpp>
69 #endif
71 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
72 #include <com/sun/star/frame/XFrame.hpp>
73 #endif
75 #ifndef _COM_SUN_STAR_FRAME_XTITLE_HPP_
76 #include <com/sun/star/frame/XTitle.hpp>
77 #endif
79 #ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
80 #include <com/sun/star/frame/XFrameActionListener.hpp>
81 #endif
83 #ifndef _COM_SUN_STAR_FRAME_XTITLECHANGELISTENER_HPP_
84 #include <com/sun/star/frame/XTitleChangeListener.hpp>
85 #endif
87 #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
88 #include <com/sun/star/lang/XEventListener.hpp>
89 #endif
91 //_________________________________________________________________________________________________________________
92 // other includes
93 //_________________________________________________________________________________________________________________
95 #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
96 #include <svtools/moduleoptions.hxx>
97 #endif
99 #ifndef _CPPUHELPER_WEAK_HXX_
100 #include <cppuhelper/weak.hxx>
101 #endif
103 #ifndef _RTL_USTRBUF_HXX_
104 #include <rtl/ustrbuf.hxx>
105 #endif
107 //_________________________________________________________________________________________________________________
108 // const
109 //_________________________________________________________________________________________________________________
111 //_________________________________________________________________________________________________________________
112 // namespace
113 //_________________________________________________________________________________________________________________
115 namespace framework{
117 //_________________________________________________________________________________________________________________
118 // declarations
119 //_________________________________________________________________________________________________________________
121 /*-************************************************************************************************************//**
122 @short helps our frame on setting title/icon on the titlebar (including updates)
124 @devstatus draft
125 @threadsafe yes
126 *//*-*************************************************************************************************************/
127 class TitleBarUpdate : // interfaces
128 public css::lang::XTypeProvider
129 , public css::lang::XInitialization
130 , public css::frame::XTitleChangeListener // => XEventListener
131 , public css::frame::XFrameActionListener // => XEventListener
132 // baseclasses (order neccessary for right initialization!)
133 , private ThreadHelpBase
134 , public ::cppu::OWeakObject
136 //________________________________
137 // structs, types
139 private:
141 struct TModuleInfo
143 /// internal id of this module
144 ::rtl::OUString sID;
145 /// localized name for this module
146 ::rtl::OUString sUIName;
147 /// configured icon for this module
148 ::sal_Int32 nIcon;
151 //________________________________
152 // member
154 private:
156 /// may we need an uno service manager to create own services
157 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
159 /// reference to the frame which was created by the office himself
160 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
162 //________________________________
163 // interface
165 public:
167 //____________________________
168 // ctor/dtor
169 TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
170 virtual ~TitleBarUpdate( );
172 //____________________________
173 // XInterface, XTypeProvider
174 FWK_DECLARE_XINTERFACE
175 FWK_DECLARE_XTYPEPROVIDER
177 //____________________________
178 // XInitialization
179 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
180 throw(css::uno::Exception ,
181 css::uno::RuntimeException);
183 //____________________________
184 // XFrameActionListener
185 virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
186 throw(css::uno::RuntimeException);
188 //____________________________
189 // XTitleChangeListener
190 virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
191 throw (css::uno::RuntimeException);
193 //____________________________
194 // XEventListener
195 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
196 throw(css::uno::RuntimeException);
198 //________________________________
199 // helper
201 private:
203 //____________________________
204 /** @short identify the application module, which is used behind the component
205 of our frame.
207 @param xFrame
208 contains the component, wich must be identified.
210 @param rInfo
211 describe the module in its details.
212 Is set only if return value is true.
214 @return [sal_Bool]
215 TRUE in casee module could be identified and all needed values could be read.
216 FALSE otherwise.
218 ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
219 TModuleInfo& rInfo );
221 //____________________________
222 /** @short set a new icon and title on the title bar of our connected frame window.
224 @descr It does not check if an update is realy needed. That has to be done outside.
225 It retrieves all needed informations and update the title bar - nothing less -
226 nothing more.
228 void impl_forceUpdate();
230 //____________________________
231 /** @short identify the current component (inside the connected frame)
232 and set the right module icon on the title bar.
234 @param xFrame
235 the frame which contains the component and where the icon must be set
236 on the window title bar.
238 void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
240 //____________________________
241 /** @short gets the current title from the frame and set it on the window.
243 @param xFrame
244 the frame which contains the component and where the title must be set
245 on the window title bar.
247 void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
249 }; // class TitleBarUpdate
251 } // namespace framework
253 #endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_