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 .
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <com/sun/star/lang/XInitialization.hpp>
24 #include <com/sun/star/frame/XFrame.hpp>
25 #include <com/sun/star/frame/XFrameActionListener.hpp>
26 #include <com/sun/star/frame/XTitleChangeListener.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <cppuhelper/weakref.hxx>
32 /*-************************************************************************************************************
33 @short helps our frame on setting title/icon on the titlebar (including updates)
37 *//*-*************************************************************************************************************/
38 class TitleBarUpdate final
: public ::cppu::WeakImplHelper
<
39 css::lang::XInitialization
40 , css::frame::XTitleChangeListener
// => XEventListener
41 , css::frame::XFrameActionListener
> // => XEventListener
50 /// internal id of this module
52 /// configured icon for this module
60 /// may we need a uno service manager to create own services
61 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
63 /// reference to the frame which was created by the office himself
64 css::uno::WeakReference
< css::frame::XFrame
> m_xFrame
;
71 TitleBarUpdate(css::uno::Reference
< css::uno::XComponentContext
> xContext
);
72 virtual ~TitleBarUpdate( ) override
;
74 // XInterface, XTypeProvider
77 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
>& lArguments
) override
;
79 // XFrameActionListener
80 virtual void SAL_CALL
frameAction(const css::frame::FrameActionEvent
& aEvent
) override
;
82 // XTitleChangeListener
83 virtual void SAL_CALL
titleChanged(const css::frame::TitleChangedEvent
& aEvent
) override
;
86 virtual void SAL_CALL
disposing(const css::lang::EventObject
& aEvent
) override
;
92 /** @short identify the application module, which is used behind the component
96 contains the component, which must be identified.
99 describe the module in its details.
100 Is set only if return value is true.
103 sal_True in case module could be identified and all needed values could be read.
106 bool implst_getModuleInfo(const css::uno::Reference
< css::frame::XFrame
>& xFrame
,
107 TModuleInfo
& rInfo
);
109 /** @short set a new icon and title on the title bar of our connected frame window.
111 @descr It does not check if an update is really needed. That has to be done outside.
112 It retrieves all needed information and update the title bar - nothing less -
115 void impl_forceUpdate();
117 /** @short identify the current component (inside the connected frame)
118 and set the right module icon on the title bar.
121 the frame which contains the component and where the icon must be set
122 on the window title bar.
124 void impl_updateIcon(const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
126 /** @short gets the current title from the frame and set it on the window.
129 the frame which contains the component and where the title must be set
130 on the window title bar.
132 static void impl_updateTitle(const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
134 //Hook to set GNOME3/Windows 7 applicationID for toplevel frames
135 //http://msdn.microsoft.com/en-us/library/dd378459(v=VS.85).aspx
136 //http://live.gnome.org/GnomeShell/ApplicationBased
137 void impl_updateApplicationID(const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
138 }; // class TitleBarUpdate
140 } // namespace framework
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */