bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / helper / titlebarupdate.hxx
blobb6ac8255951efee06466a1cf826d07a505ceccd0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
21 #define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
25 #include <macros/debug.hxx>
27 #include <macros/xinterface.hxx>
29 #include <macros/xtypeprovider.hxx>
31 #include <general.h>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <com/sun/star/frame/XFrame.hpp>
39 #include <com/sun/star/frame/XTitle.hpp>
41 #include <com/sun/star/frame/XFrameActionListener.hpp>
43 #include <com/sun/star/frame/XTitleChangeListener.hpp>
45 #include <com/sun/star/lang/XEventListener.hpp>
47 #include <unotools/moduleoptions.hxx>
49 #include <cppuhelper/weak.hxx>
51 #include <rtl/ustrbuf.hxx>
53 namespace framework{
55 /*-************************************************************************************************************//**
56 @short helps our frame on setting title/icon on the titlebar (including updates)
58 @devstatus draft
59 @threadsafe yes
60 *//*-*************************************************************************************************************/
61 class TitleBarUpdate : // interfaces
62 public css::lang::XTypeProvider
63 , public css::lang::XInitialization
64 , public css::frame::XTitleChangeListener // => XEventListener
65 , public css::frame::XFrameActionListener // => XEventListener
66 // baseclasses (order necessary for right initialization!)
67 , private ThreadHelpBase
68 , public ::cppu::OWeakObject
70 //________________________________
71 // structs, types
73 private:
75 struct TModuleInfo
77 /// internal id of this module
78 OUString sID;
79 /// localized name for this module
80 OUString sUIName;
81 /// configured icon for this module
82 ::sal_Int32 nIcon;
85 //________________________________
86 // member
88 private:
90 /// may we need an uno service manager to create own services
91 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
93 /// reference to the frame which was created by the office himself
94 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
96 //________________________________
97 // interface
99 public:
101 //____________________________
102 // ctor/dtor
103 TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
104 virtual ~TitleBarUpdate( );
106 //____________________________
107 // XInterface, XTypeProvider
108 FWK_DECLARE_XINTERFACE
109 FWK_DECLARE_XTYPEPROVIDER
111 //____________________________
112 // XInitialization
113 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
114 throw(css::uno::Exception ,
115 css::uno::RuntimeException);
117 //____________________________
118 // XFrameActionListener
119 virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
120 throw(css::uno::RuntimeException);
122 //____________________________
123 // XTitleChangeListener
124 virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
125 throw (css::uno::RuntimeException);
127 //____________________________
128 // XEventListener
129 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
130 throw(css::uno::RuntimeException);
132 //________________________________
133 // helper
135 private:
137 //____________________________
138 /** @short identify the application module, which is used behind the component
139 of our frame.
141 @param xFrame
142 contains the component, which must be identified.
144 @param rInfo
145 describe the module in its details.
146 Is set only if return value is true.
148 @return [sal_Bool]
149 sal_True in casee module could be identified and all needed values could be read.
150 sal_False otherwise.
152 ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
153 TModuleInfo& rInfo );
155 //____________________________
156 /** @short set a new icon and title on the title bar of our connected frame window.
158 @descr It does not check if an update is realy needed. That has to be done outside.
159 It retrieves all needed information and update the title bar - nothing less -
160 nothing more.
162 void impl_forceUpdate();
164 //____________________________
165 /** @short identify the current component (inside the connected frame)
166 and set the right module icon on the title bar.
168 @param xFrame
169 the frame which contains the component and where the icon must be set
170 on the window title bar.
172 void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
174 //____________________________
175 /** @short gets the current title from the frame and set it on the window.
177 @param xFrame
178 the frame which contains the component and where the title must be set
179 on the window title bar.
181 void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
183 //Hook to set GNOME3/Windows 7 applicationID for toplevel frames
184 //http://msdn.microsoft.com/en-us/library/dd378459(v=VS.85).aspx
185 //http://live.gnome.org/GnomeShell/ApplicationBased
186 void impl_updateApplicationID(const css::uno::Reference< css::frame::XFrame >& xFrame);
187 }; // class TitleBarUpdate
189 } // namespace framework
191 #endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */