LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/services - tabwindowservice.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-12-27 Functions: 0 4 0.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_SERVICES_TABWINDOWSERVICE_HXX_
      21             : #define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
      22             : 
      23             : /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
      24             :                with solaris headers ...
      25             : */
      26             : #include <vector>
      27             : 
      28             : #include <classes/fwktabwindow.hxx>
      29             : #include <classes/propertysethelper.hxx>
      30             : #include <threadhelp/threadhelpbase.hxx>
      31             : #include <macros/generic.hxx>
      32             : #include <macros/debug.hxx>
      33             : #include <macros/xinterface.hxx>
      34             : #include <macros/xtypeprovider.hxx>
      35             : #include <macros/xserviceinfo.hxx>
      36             : #include <general.h>
      37             : #include <stdtypes.h>
      38             : 
      39             : #include <com/sun/star/awt/XSimpleTabController.hpp>
      40             : #include <com/sun/star/awt/XWindow.hpp>
      41             : #include <com/sun/star/beans/XPropertySet.hpp>
      42             : 
      43             : #include <cppuhelper/weak.hxx>
      44             : #include <vcl/window.hxx>
      45             : 
      46             : namespace framework{
      47             : 
      48           0 : struct TTabPageInfo
      49             : {
      50             :     public:
      51             : 
      52           0 :         TTabPageInfo()
      53             :             : m_nIndex      ( -1      )
      54             :             , m_bCreated    (sal_False)
      55             :             , m_pPage       ( NULL    )
      56           0 :             , m_lProperties (         )
      57           0 :         {}
      58             : 
      59           0 :         TTabPageInfo(::sal_Int32 nID)
      60             :             : m_nIndex      ( nID     )
      61             :             , m_bCreated    (sal_False)
      62             :             , m_pPage       ( NULL    )
      63           0 :             , m_lProperties (         )
      64           0 :         {}
      65             : 
      66             :     public:
      67             : 
      68             :         ::sal_Int32                                   m_nIndex;
      69             :         ::sal_Bool                                    m_bCreated;
      70             :         FwkTabPage*                                   m_pPage;
      71             :         css::uno::Sequence< css::beans::NamedValue >  m_lProperties;
      72             : };
      73             : 
      74             : typedef ::boost::unordered_map< ::sal_Int32                    ,
      75             :                          TTabPageInfo                   ,
      76             :                          Int32HashCode                  ,
      77             :                          ::std::equal_to< ::sal_Int32 > > TTabPageInfoHash;
      78             : 
      79             : /*-************************************************************************************************************//**
      80             :     @short  implements a helper service providing a dockable tab control window
      81             : *//*-*************************************************************************************************************/
      82             : 
      83             : class TabWindowService :  public css::lang::XTypeProvider
      84             :                          ,  public css::lang::XServiceInfo
      85             :                          ,  public css::awt::XSimpleTabController
      86             :                          ,  public css::lang::XComponent
      87             :                          ,  public ThreadHelpBase
      88             :                          ,  public TransactionBase
      89             :                          ,  public PropertySetHelper
      90             :                          ,  public ::cppu::OWeakObject
      91             : {
      92             :     //-------------------------------------------------------------------------------------------------------------
      93             :     //  public methods
      94             :     //-------------------------------------------------------------------------------------------------------------
      95             : 
      96             :     public:
      97             : 
      98             :         //---------------------------------------------------------------------------------------------------------
      99             :         //  constructor / destructor
     100             :         //---------------------------------------------------------------------------------------------------------
     101             : 
     102             :         TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
     103             :         virtual ~TabWindowService();
     104             : 
     105             :         //---------------------------------------------------------------------------------------------------------
     106             :         //  XInterface, XTypeProvider, XServiceInfo
     107             :         //---------------------------------------------------------------------------------------------------------
     108             : 
     109             :         FWK_DECLARE_XINTERFACE
     110             :         FWK_DECLARE_XTYPEPROVIDER
     111             :         DECLARE_XSERVICEINFO
     112             : 
     113             :         //---------------------------------------------------------------------------------------------------------
     114             :         //  XSimpleTabController
     115             :         //---------------------------------------------------------------------------------------------------------
     116             : 
     117             :         virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException );
     118             :         virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
     119             :         virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
     120             :         virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
     121             :         virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
     122             :         virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException );
     123             :         virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
     124             :         virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
     125             : 
     126             :         //---------------------------------------------------------------------------------------------------------
     127             :         //  XComponent
     128             :         //---------------------------------------------------------------------------------------------------------
     129             : 
     130             :         virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
     131             :         virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
     132             :         virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
     133             : 
     134             :     //-------------------------------------------------------------------------------------------------------------
     135             :     //  protected methods
     136             :     //-------------------------------------------------------------------------------------------------------------
     137             : 
     138             :     protected:
     139             : 
     140             :     //-------------------------------------------------------------------------------------------------------------
     141             :     //  private methods
     142             :     //-------------------------------------------------------------------------------------------------------------
     143             : 
     144             :     private:
     145             : 
     146             :         void impl_initializePropInfo();
     147             :         virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty,
     148             :                                                           sal_Int32        nHandle  ,
     149             :                                                     const css::uno::Any&   aValue   );
     150             :         virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty,
     151             :                                                                    sal_Int32        nHandle  );
     152             : 
     153             :         DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * );
     154             : 
     155             :         void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
     156             :         TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
     157             :         FwkTabWindow* mem_TabWin ();
     158             :     //-------------------------------------------------------------------------------------------------------------
     159             :     //  variables
     160             :     //  (should be private everyway!)
     161             :     //-------------------------------------------------------------------------------------------------------------
     162             : 
     163             :     private:
     164             : 
     165             :         /// reference to factory, which has created this instance
     166             :         css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
     167             : 
     168             :         /// the tab window as XWindow ( to hold window* alive !)
     169             :         css::uno::Reference< css::awt::XWindow > m_xTabWin;
     170             : 
     171             :         /// the VCL tab window
     172             :         FwkTabWindow* m_pTabWin;
     173             : 
     174             :         /// container of inserted tab pages
     175             :         TTabPageInfoHash m_lTabPageInfos;
     176             : 
     177             :         /// container of the added TabListener
     178             :         ::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
     179             : 
     180             :         /// counter of the tabpage indexes
     181             :         ::sal_Int32 m_nPageIndexCounter;
     182             : 
     183             :         /// index of the current active page
     184             :         ::sal_Int32 m_nCurrentPageIndex;
     185             : 
     186             :         /// title of the tabcontrolled window
     187             :         ::rtl::OUString m_sTitle;
     188             : 
     189             : };      //  class TabWindowService
     190             : 
     191             : }       //  namespace framework
     192             : 
     193             : #endif  //  #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
     194             : 
     195             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10