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