LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/helper - titlebarupdate.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 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 __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
      21             : #define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
      22             : 
      23             : #include <threadhelp/threadhelpbase.hxx>
      24             : 
      25             : #include <macros/debug.hxx>
      26             : 
      27             : #include <macros/xinterface.hxx>
      28             : 
      29             : #include <macros/xtypeprovider.hxx>
      30             : 
      31             : #include <general.h>
      32             : 
      33             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34             : 
      35             : #include <com/sun/star/lang/XInitialization.hpp>
      36             : 
      37             : #include <com/sun/star/frame/XFrame.hpp>
      38             : 
      39             : #include <com/sun/star/frame/XTitle.hpp>
      40             : 
      41             : #include <com/sun/star/frame/XFrameActionListener.hpp>
      42             : 
      43             : #include <com/sun/star/frame/XTitleChangeListener.hpp>
      44             : 
      45             : #include <com/sun/star/lang/XEventListener.hpp>
      46             : 
      47             : #include <unotools/moduleoptions.hxx>
      48             : 
      49             : #include <cppuhelper/weak.hxx>
      50             : 
      51             : #include <rtl/ustrbuf.hxx>
      52             : 
      53             : namespace framework{
      54             : 
      55             : /*-************************************************************************************************************//**
      56             :     @short          helps our frame on setting title/icon on the titlebar (including updates)
      57             : 
      58             :     @devstatus      draft
      59             :     @threadsafe     yes
      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 neccessary for right initialization!)
      67             :                      , private ThreadHelpBase
      68             :                      , public  ::cppu::OWeakObject
      69             : {
      70             :     //________________________________
      71             :     // structs, types
      72             : 
      73             :     private:
      74             : 
      75         606 :         struct TModuleInfo
      76             :         {
      77             :             /// internal id of this module
      78             :             ::rtl::OUString sID;
      79             :             /// localized name for this module
      80             :             ::rtl::OUString sUIName;
      81             :             /// configured icon for this module
      82             :             ::sal_Int32 nIcon;
      83             :         };
      84             : 
      85             :     //________________________________
      86             :     // member
      87             : 
      88             :     private:
      89             : 
      90             :         /// may we need an uno service manager to create own services
      91             :         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
      92             : 
      93             :         /// reference to the frame which was created by the office himself
      94             :         css::uno::WeakReference< css::frame::XFrame > m_xFrame;
      95             : 
      96             :     //________________________________
      97             :     // interface
      98             : 
      99             :     public:
     100             : 
     101             :         //____________________________
     102             :         // ctor/dtor
     103             :                  TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
     104             :         virtual ~TitleBarUpdate(                                                                   );
     105             : 
     106             :         //____________________________
     107             :         // XInterface, XTypeProvider
     108             :         FWK_DECLARE_XINTERFACE
     109             :         FWK_DECLARE_XTYPEPROVIDER
     110             : 
     111             :         //____________________________
     112             :         // XInitialization
     113             :         virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
     114             :             throw(css::uno::Exception       ,
     115             :                   css::uno::RuntimeException);
     116             : 
     117             :         //____________________________
     118             :         // XFrameActionListener
     119             :         virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
     120             :             throw(css::uno::RuntimeException);
     121             : 
     122             :         //____________________________
     123             :         // XTitleChangeListener
     124             :         virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
     125             :             throw (css::uno::RuntimeException);
     126             : 
     127             :         //____________________________
     128             :         // XEventListener
     129             :         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
     130             :             throw(css::uno::RuntimeException);
     131             : 
     132             :     //________________________________
     133             :     // helper
     134             : 
     135             :     private:
     136             : 
     137             :         //____________________________
     138             :         /** @short  identify the application module, which  is used behind the component
     139             :                     of our frame.
     140             : 
     141             :             @param  xFrame
     142             :                     contains the component, wich must be identified.
     143             : 
     144             :             @param  rInfo
     145             :                     describe the module in its details.
     146             :                     Is set only if return value is true.
     147             : 
     148             :             @return [sal_Bool]
     149             :                     sal_True in casee module could be identified and all needed values could be read.
     150             :                     sal_False otherwise.
     151             :          */
     152             :         ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
     153             :                                               TModuleInfo&                               rInfo );
     154             : 
     155             :         //____________________________
     156             :         /** @short  set a new icon and title on the title bar of our connected frame window.
     157             : 
     158             :             @descr  It does not check if an update is realy needed. That has to be done outside.
     159             :                     It retrieves all needed informations and update the title bar - nothing less -
     160             :                     nothing more.
     161             :          */
     162             :         void impl_forceUpdate();
     163             : 
     164             :         //____________________________
     165             :         /** @short  identify the current component (inside the connected frame)
     166             :                     and set the right module icon on the title bar.
     167             : 
     168             :             @param  xFrame
     169             :                     the frame which contains the component and where the icon must be set
     170             :                     on the window title bar.
     171             :          */
     172             :         void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
     173             : 
     174             :         //____________________________
     175             :         /** @short  gets the current title from the frame and set it on the window.
     176             : 
     177             :             @param  xFrame
     178             :                     the frame which contains the component and where the title must be set
     179             :                     on the window title bar.
     180             :          */
     181             :         void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
     182             : 
     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
     188             : 
     189             : } // namespace framework
     190             : 
     191             : #endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
     192             : 
     193             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10