LCOV - code coverage report
Current view: top level - framework/inc/helper - titlebarupdate.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
      30                 :            : #define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
      31                 :            : 
      32                 :            : #include <threadhelp/threadhelpbase.hxx>
      33                 :            : 
      34                 :            : #include <macros/debug.hxx>
      35                 :            : 
      36                 :            : #include <macros/xinterface.hxx>
      37                 :            : 
      38                 :            : #include <macros/xtypeprovider.hxx>
      39                 :            : 
      40                 :            : #include <general.h>
      41                 :            : 
      42                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      43                 :            : 
      44                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      45                 :            : 
      46                 :            : #include <com/sun/star/frame/XFrame.hpp>
      47                 :            : 
      48                 :            : #include <com/sun/star/frame/XTitle.hpp>
      49                 :            : 
      50                 :            : #include <com/sun/star/frame/XFrameActionListener.hpp>
      51                 :            : 
      52                 :            : #include <com/sun/star/frame/XTitleChangeListener.hpp>
      53                 :            : 
      54                 :            : #include <com/sun/star/lang/XEventListener.hpp>
      55                 :            : 
      56                 :            : #include <unotools/moduleoptions.hxx>
      57                 :            : 
      58                 :            : #include <cppuhelper/weak.hxx>
      59                 :            : 
      60                 :            : #include <rtl/ustrbuf.hxx>
      61                 :            : 
      62                 :            : namespace framework{
      63                 :            : 
      64                 :            : /*-************************************************************************************************************//**
      65                 :            :     @short          helps our frame on setting title/icon on the titlebar (including updates)
      66                 :            : 
      67                 :            :     @devstatus      draft
      68                 :            :     @threadsafe     yes
      69                 :            : *//*-*************************************************************************************************************/
      70                 :            : class TitleBarUpdate : // interfaces
      71                 :            :                        public css::lang::XTypeProvider
      72                 :            :                      , public css::lang::XInitialization
      73                 :            :                      , public css::frame::XTitleChangeListener // => XEventListener
      74                 :            :                      , public css::frame::XFrameActionListener // => XEventListener
      75                 :            :                        // baseclasses (order neccessary for right initialization!)
      76                 :            :                      , private ThreadHelpBase
      77                 :            :                      , public  ::cppu::OWeakObject
      78                 :            : {
      79                 :            :     //________________________________
      80                 :            :     // structs, types
      81                 :            : 
      82                 :            :     private:
      83                 :            : 
      84                 :       7010 :         struct TModuleInfo
      85                 :            :         {
      86                 :            :             /// internal id of this module
      87                 :            :             ::rtl::OUString sID;
      88                 :            :             /// localized name for this module
      89                 :            :             ::rtl::OUString sUIName;
      90                 :            :             /// configured icon for this module
      91                 :            :             ::sal_Int32 nIcon;
      92                 :            :         };
      93                 :            : 
      94                 :            :     //________________________________
      95                 :            :     // member
      96                 :            : 
      97                 :            :     private:
      98                 :            : 
      99                 :            :         /// may we need an uno service manager to create own services
     100                 :            :         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
     101                 :            : 
     102                 :            :         /// reference to the frame which was created by the office himself
     103                 :            :         css::uno::WeakReference< css::frame::XFrame > m_xFrame;
     104                 :            : 
     105                 :            :     //________________________________
     106                 :            :     // interface
     107                 :            : 
     108                 :            :     public:
     109                 :            : 
     110                 :            :         //____________________________
     111                 :            :         // ctor/dtor
     112                 :            :                  TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
     113                 :            :         virtual ~TitleBarUpdate(                                                                   );
     114                 :            : 
     115                 :            :         //____________________________
     116                 :            :         // XInterface, XTypeProvider
     117                 :            :         FWK_DECLARE_XINTERFACE
     118                 :            :         FWK_DECLARE_XTYPEPROVIDER
     119                 :            : 
     120                 :            :         //____________________________
     121                 :            :         // XInitialization
     122                 :            :         virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
     123                 :            :             throw(css::uno::Exception       ,
     124                 :            :                   css::uno::RuntimeException);
     125                 :            : 
     126                 :            :         //____________________________
     127                 :            :         // XFrameActionListener
     128                 :            :         virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
     129                 :            :             throw(css::uno::RuntimeException);
     130                 :            : 
     131                 :            :         //____________________________
     132                 :            :         // XTitleChangeListener
     133                 :            :         virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
     134                 :            :             throw (css::uno::RuntimeException);
     135                 :            : 
     136                 :            :         //____________________________
     137                 :            :         // XEventListener
     138                 :            :         virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
     139                 :            :             throw(css::uno::RuntimeException);
     140                 :            : 
     141                 :            :     //________________________________
     142                 :            :     // helper
     143                 :            : 
     144                 :            :     private:
     145                 :            : 
     146                 :            :         //____________________________
     147                 :            :         /** @short  identify the application module, which  is used behind the component
     148                 :            :                     of our frame.
     149                 :            : 
     150                 :            :             @param  xFrame
     151                 :            :                     contains the component, wich must be identified.
     152                 :            : 
     153                 :            :             @param  rInfo
     154                 :            :                     describe the module in its details.
     155                 :            :                     Is set only if return value is true.
     156                 :            : 
     157                 :            :             @return [sal_Bool]
     158                 :            :                     sal_True in casee module could be identified and all needed values could be read.
     159                 :            :                     sal_False otherwise.
     160                 :            :          */
     161                 :            :         ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame,
     162                 :            :                                               TModuleInfo&                               rInfo );
     163                 :            : 
     164                 :            :         //____________________________
     165                 :            :         /** @short  set a new icon and title on the title bar of our connected frame window.
     166                 :            : 
     167                 :            :             @descr  It does not check if an update is realy needed. That has to be done outside.
     168                 :            :                     It retrieves all needed informations and update the title bar - nothing less -
     169                 :            :                     nothing more.
     170                 :            :          */
     171                 :            :         void impl_forceUpdate();
     172                 :            : 
     173                 :            :         //____________________________
     174                 :            :         /** @short  identify the current component (inside the connected frame)
     175                 :            :                     and set the right module icon on the title bar.
     176                 :            : 
     177                 :            :             @param  xFrame
     178                 :            :                     the frame which contains the component and where the icon must be set
     179                 :            :                     on the window title bar.
     180                 :            :          */
     181                 :            :         void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame);
     182                 :            : 
     183                 :            :         //____________________________
     184                 :            :         /** @short  gets the current title from the frame and set it on the window.
     185                 :            : 
     186                 :            :             @param  xFrame
     187                 :            :                     the frame which contains the component and where the title must be set
     188                 :            :                     on the window title bar.
     189                 :            :          */
     190                 :            :         void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame);
     191                 :            : 
     192                 :            :         //Hook to set GNOME3/Windows 7 applicationID for toplevel frames
     193                 :            :         //http://msdn.microsoft.com/en-us/library/dd378459(v=VS.85).aspx
     194                 :            :         //http://live.gnome.org/GnomeShell/ApplicationBased
     195                 :            :         void impl_updateApplicationID(const css::uno::Reference< css::frame::XFrame >& xFrame);
     196                 :            : }; // class TitleBarUpdate
     197                 :            : 
     198                 :            : } // namespace framework
     199                 :            : 
     200                 :            : #endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_
     201                 :            : 
     202                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10