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