LibreOffice Module framework (master) 1
titlebarupdate.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
29
30namespace framework{
31
32/*-************************************************************************************************************
33 @short helps our frame on setting title/icon on the titlebar (including updates)
34
35 @devstatus draft
36 @threadsafe yes
37*//*-*************************************************************************************************************/
38class TitleBarUpdate final : public ::cppu::WeakImplHelper<
39 css::lang::XInitialization
40 , css::frame::XTitleChangeListener // => XEventListener
41 , css::frame::XFrameActionListener > // => XEventListener
42{
43
44 // structs, types
45
46 private:
47
49 {
51 OUString sID;
53 ::sal_Int32 nIcon;
54 };
55
56 // member
57
58 private:
59
61 css::uno::Reference< css::uno::XComponentContext > m_xContext;
62
64 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
65
66 // interface
67
68 public:
69
70 // ctor/dtor
71 TitleBarUpdate(css::uno::Reference< css::uno::XComponentContext > xContext);
72 virtual ~TitleBarUpdate( ) override;
73
74 // XInterface, XTypeProvider
75
76 // XInitialization
77 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) override;
78
79 // XFrameActionListener
80 virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
81
82 // XTitleChangeListener
83 virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) override;
84
85 // XEventListener
86 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
87
88 // helper
89
90 private:
91
106 bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
107 TModuleInfo& rInfo );
108
115 void impl_forceUpdate();
116
124 void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
125
132 void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
133
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
139
140} // namespace framework
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::WeakReference< css::frame::XFrame > m_xFrame
reference to the frame which was created by the office himself
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &lArguments) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
may we need a uno service manager to create own services
void impl_updateTitle(const css::uno::Reference< css::frame::XFrame > &xFrame)
gets the current title from the frame and set it on the window.
virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent &aEvent) override
virtual ~TitleBarUpdate() override
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &aEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
void impl_updateApplicationID(const css::uno::Reference< css::frame::XFrame > &xFrame)
void impl_forceUpdate()
set a new icon and title on the title bar of our connected frame window.
bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame > &xFrame, TModuleInfo &rInfo)
identify the application module, which is used behind the component of our frame.
void impl_updateIcon(const css::uno::Reference< css::frame::XFrame > &xFrame)
identify the current component (inside the connected frame) and set the right module icon on the titl...
TitleBarUpdate(css::uno::Reference< css::uno::XComponentContext > xContext)
::sal_Int32 nIcon
configured icon for this module
OUString sID
internal id of this module