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: titlebarupdate.hxx,v $
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 //_________________________________________________________________________________________________________________
37 //_________________________________________________________________________________________________________________
39 #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
40 #include <threadhelp/threadhelpbase.hxx>
43 #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
44 #include <macros/debug.hxx>
47 #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
48 #include <macros/xinterface.hxx>
51 #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_
52 #include <macros/xtypeprovider.hxx>
55 #ifndef __FRAMEWORK_GENERAL_H_
59 //_________________________________________________________________________________________________________________
61 //_________________________________________________________________________________________________________________
63 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
64 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
67 #ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
68 #include <com/sun/star/lang/XInitialization.hpp>
71 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
72 #include <com/sun/star/frame/XFrame.hpp>
75 #ifndef _COM_SUN_STAR_FRAME_XTITLE_HPP_
76 #include <com/sun/star/frame/XTitle.hpp>
79 #ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
80 #include <com/sun/star/frame/XFrameActionListener.hpp>
83 #ifndef _COM_SUN_STAR_FRAME_XTITLECHANGELISTENER_HPP_
84 #include <com/sun/star/frame/XTitleChangeListener.hpp>
87 #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
88 #include <com/sun/star/lang/XEventListener.hpp>
91 //_________________________________________________________________________________________________________________
93 //_________________________________________________________________________________________________________________
95 #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
96 #include <svtools/moduleoptions.hxx>
99 #ifndef _CPPUHELPER_WEAK_HXX_
100 #include <cppuhelper/weak.hxx>
103 #ifndef _RTL_USTRBUF_HXX_
104 #include <rtl/ustrbuf.hxx>
107 //_________________________________________________________________________________________________________________
109 //_________________________________________________________________________________________________________________
111 //_________________________________________________________________________________________________________________
113 //_________________________________________________________________________________________________________________
117 //_________________________________________________________________________________________________________________
119 //_________________________________________________________________________________________________________________
121 /*-************************************************************************************************************//**
122 @short helps our frame on setting title/icon on the titlebar (including updates)
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 //________________________________
143 /// internal id of this module
145 /// localized name for this module
146 ::rtl::OUString sUIName
;
147 /// configured icon for this module
151 //________________________________
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 //________________________________
167 //____________________________
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 //____________________________
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 //____________________________
195 virtual void SAL_CALL
disposing(const css::lang::EventObject
& aEvent
)
196 throw(css::uno::RuntimeException
);
198 //________________________________
203 //____________________________
204 /** @short identify the application module, which is used behind the component
208 contains the component, wich must be identified.
211 describe the module in its details.
212 Is set only if return value is true.
215 TRUE in casee module could be identified and all needed values could be read.
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 -
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.
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.
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_