LCOV - code coverage report
Current view: top level - framework/inc/helper - titlebarupdate.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
      21             : #define INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
      22             : 
      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>
      36             : 
      37             : namespace framework{
      38             : 
      39             : /*-************************************************************************************************************
      40             :     @short          helps our frame on setting title/icon on the titlebar (including updates)
      41             : 
      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
      49             : {
      50             : 
      51             :     // structs, types
      52             : 
      53             :     private:
      54             : 
      55       22436 :         struct TModuleInfo
      56             :         {
      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;
      63             :         };
      64             : 
      65             :     // member
      66             : 
      67             :     private:
      68             : 
      69             :         /// may we need an uno service manager to create own services
      70             :         css::uno::Reference< css::uno::XComponentContext > m_xContext;
      71             : 
      72             :         /// reference to the frame which was created by the office himself
      73             :         css::uno::WeakReference< css::frame::XFrame > m_xFrame;
      74             : 
      75             :     // interface
      76             : 
      77             :     public:
      78             : 
      79             :         // ctor/dtor
      80             :                  TitleBarUpdate(const css::uno::Reference< css::uno::XComponentContext >& xContext);
      81             :         virtual ~TitleBarUpdate(                                                                   );
      82             : 
      83             :         // XInterface, XTypeProvider
      84             : 
      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;
      89             : 
      90             :         // XFrameActionListener
      91             :         virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
      92             :             throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             : 
      94             :         // XTitleChangeListener
      95             :         virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
      96             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             : 
      98             :         // XEventListener
      99             :         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
     100             :             throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :     // helper
     103             : 
     104             :     private:
     105             : 
     106             :         /** @short  identify the application module, which  is used behind the component
     107             :                     of our frame.
     108             : 
     109             :             @param  xFrame
     110             :                     contains the component, which must be identified.
     111             : 
     112             :             @param  rInfo
     113             :                     describe the module in its details.
     114             :                     Is set only if return value is true.
     115             : 
     116             :             @return [sal_Bool]
     117             :                     sal_True in casee module could be identified and all needed values could be read.
     118             :                     sal_False otherwise.
     119             :          */
     120             :         bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
     121             :                                               TModuleInfo&                               rInfo );
     122             : 
     123             :         /** @short  set a new icon and title on the title bar of our connected frame window.
     124             : 
     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.
     128             :          */
     129             :         void impl_forceUpdate();
     130             : 
     131             :         /** @short  identify the current component (inside the connected frame)
     132             :                     and set the right module icon on the title bar.
     133             : 
     134             :             @param  xFrame
     135             :                     the frame which contains the component and where the icon must be set
     136             :                     on the window title bar.
     137             :          */
     138             :         void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
     139             : 
     140             :         /** @short  gets the current title from the frame and set it on the window.
     141             : 
     142             :             @param  xFrame
     143             :                     the frame which contains the component and where the title must be set
     144             :                     on the window title bar.
     145             :          */
     146             :         void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
     147             : 
     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
     153             : 
     154             : } // namespace framework
     155             : 
     156             : #endif // INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10