fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / inc / helper / titlebarupdate.hxx
blob2089cf3295d6ab92da5c41b4619efe95ccd02f34
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 INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
21 #define INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
23 #include <macros/xinterface.hxx>
24 #include <macros/xtypeprovider.hxx>
25 #include <general.h>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/frame/XFrame.hpp>
29 #include <com/sun/star/frame/XTitle.hpp>
30 #include <com/sun/star/frame/XFrameActionListener.hpp>
31 #include <com/sun/star/frame/XTitleChangeListener.hpp>
32 #include <com/sun/star/lang/XEventListener.hpp>
33 #include <unotools/moduleoptions.hxx>
34 #include <cppuhelper/implbase3.hxx>
35 #include <rtl/ustrbuf.hxx>
37 namespace framework{
39 /*-************************************************************************************************************
40 @short helps our frame on setting title/icon on the titlebar (including updates)
42 @devstatus draft
43 @threadsafe yes
44 *//*-*************************************************************************************************************/
45 class TitleBarUpdate : public ::cppu::WeakImplHelper3<
46 css::lang::XInitialization
47 , css::frame::XTitleChangeListener // => XEventListener
48 , css::frame::XFrameActionListener > // => XEventListener
51 // structs, types
53 private:
55 struct TModuleInfo
57 /// internal id of this module
58 OUString sID;
59 /// localized name for this module
60 OUString sUIName;
61 /// configured icon for this module
62 ::sal_Int32 nIcon;
65 // member
67 private:
69 /// may we need an uno service manager to create own services
70 css::uno::Reference< css::uno::XComponentContext > m_xContext;
72 /// reference to the frame which was created by the office himself
73 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
75 // interface
77 public:
79 // ctor/dtor
80 TitleBarUpdate(const css::uno::Reference< css::uno::XComponentContext >& xContext);
81 virtual ~TitleBarUpdate( );
83 // XInterface, XTypeProvider
85 // XInitialization
86 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
87 throw(css::uno::Exception ,
88 css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 // XFrameActionListener
91 virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
92 throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 // XTitleChangeListener
95 virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
96 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 // XEventListener
99 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
100 throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 // helper
104 private:
106 /** @short identify the application module, which is used behind the component
107 of our frame.
109 @param xFrame
110 contains the component, which must be identified.
112 @param rInfo
113 describe the module in its details.
114 Is set only if return value is true.
116 @return [sal_Bool]
117 sal_True in casee module could be identified and all needed values could be read.
118 sal_False otherwise.
120 bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
121 TModuleInfo& rInfo );
123 /** @short set a new icon and title on the title bar of our connected frame window.
125 @descr It does not check if an update is really needed. That has to be done outside.
126 It retrieves all needed information and update the title bar - nothing less -
127 nothing more.
129 void impl_forceUpdate();
131 /** @short identify the current component (inside the connected frame)
132 and set the right module icon on the title bar.
134 @param xFrame
135 the frame which contains the component and where the icon must be set
136 on the window title bar.
138 void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
140 /** @short gets the current title from the frame and set it on the window.
142 @param xFrame
143 the frame which contains the component and where the title must be set
144 on the window title bar.
146 void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
148 //Hook to set GNOME3/Windows 7 applicationID for toplevel frames
149 //http://msdn.microsoft.com/en-us/library/dd378459(v=VS.85).aspx
150 //http://live.gnome.org/GnomeShell/ApplicationBased
151 void impl_updateApplicationID(const css::uno::Reference< css::frame::XFrame >& xFrame);
152 }; // class TitleBarUpdate
154 } // namespace framework
156 #endif // INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */