1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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>
55 /*-************************************************************************************************************//**
56 @short helps our frame on setting title/icon on the titlebar (including updates)
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 //________________________________
77 /// internal id of this module
79 /// localized name for this module
81 /// configured icon for this module
85 //________________________________
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 //________________________________
101 //____________________________
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 //____________________________
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 //____________________________
129 virtual void SAL_CALL
disposing(const css::lang::EventObject
& aEvent
)
130 throw(css::uno::RuntimeException
);
132 //________________________________
137 //____________________________
138 /** @short identify the application module, which is used behind the component
142 contains the component, which must be identified.
145 describe the module in its details.
146 Is set only if return value is true.
149 sal_True in casee module could be identified and all needed values could be read.
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 -
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.
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.
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: */