LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/toolkit/controls - stdtabcontrollermodel.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 8 62.5 %
Date: 2013-07-09 Functions: 5 10 50.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 _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
      21             : #define _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
      22             : 
      23             : 
      24             : #include <com/sun/star/lang/XServiceInfo.hpp>
      25             : #include <com/sun/star/io/XPersistObject.hpp>
      26             : #include <com/sun/star/awt/XTabControllerModel.hpp>
      27             : #include <com/sun/star/awt/XWindow.hpp>
      28             : #include <com/sun/star/lang/XTypeProvider.hpp>
      29             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      30             : #include <cppuhelper/weakagg.hxx>
      31             : #include <toolkit/helper/macros.hxx>
      32             : #include <toolkit/helper/servicenames.hxx>
      33             : #include <osl/mutex.hxx>
      34             : 
      35             : #include <tools/gen.hxx>
      36             : #include <vector>
      37             : 
      38             : struct UnoControlModelEntry;
      39             : typedef ::std::vector< UnoControlModelEntry* > UnoControlModelEntryListBase;
      40             : 
      41             : class UnoControlModelEntryList
      42             : {
      43             : private:
      44             :     UnoControlModelEntryListBase maList;
      45             :     OUString maGroupName;
      46             : 
      47             : public:
      48             :                     UnoControlModelEntryList();
      49             :                     ~UnoControlModelEntryList();
      50             : 
      51           0 :     const OUString&      GetName() const                         { return maGroupName; }
      52           0 :     void                        SetName( const OUString& rName ) { maGroupName = rName; }
      53             : 
      54             :     void    Reset();
      55             :     void    DestroyEntry( size_t nEntry );
      56             :     size_t  size() const;
      57             :     UnoControlModelEntry* operator[]( size_t i ) const;
      58             :     void push_back( UnoControlModelEntry* item );
      59             :     void insert( size_t i, UnoControlModelEntry* item );
      60             : };
      61             : 
      62             : struct UnoControlModelEntry
      63             : {
      64             :     sal_Bool        bGroup;
      65             :     union
      66             :     {
      67             :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >* pxControl;
      68             :         UnoControlModelEntryList*   pGroup;
      69             :     };
      70             : };
      71             : 
      72           1 : struct ComponentEntry
      73             : {
      74             :     ::com::sun::star::awt::XWindow*     pComponent;
      75             :     Point                               aPos;
      76             : };
      77             : 
      78             : typedef ::std::vector< ComponentEntry* > ComponentEntryList;
      79             : 
      80             : #define CONTROLPOS_NOTFOUND 0xFFFFFFFF
      81             : 
      82             : class StdTabControllerModel :   public ::com::sun::star::awt::XTabControllerModel,
      83             :                                 public ::com::sun::star::lang::XServiceInfo,
      84             :                                 public ::com::sun::star::io::XPersistObject,
      85             :                                 public ::com::sun::star::lang::XTypeProvider,
      86             :                                 public ::cppu::OWeakAggObject
      87             : {
      88             : private:
      89             :     ::osl::Mutex                maMutex;
      90             :     UnoControlModelEntryList    maControls;
      91             :     sal_Bool                    mbGroupControl;
      92             : 
      93             : protected:
      94           0 :     ::osl::Mutex&           GetMutex() { return maMutex; }
      95             :     sal_uInt32              ImplGetControlCount( const UnoControlModelEntryList& rList ) const;
      96             :     void                    ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const;
      97             :     void                    ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const;
      98             :     sal_uInt32              ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >  xCtrl, const UnoControlModelEntryList& rList ) const;
      99             : 
     100             : public:
     101             :                             StdTabControllerModel();
     102             :                             ~StdTabControllerModel();
     103             : 
     104             :     // ::com::sun::star::uno::XInterface
     105           5 :     ::com::sun::star::uno::Any  SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
     106          14 :     void                        SAL_CALL acquire() throw()  { OWeakAggObject::acquire(); }
     107          14 :     void                        SAL_CALL release() throw()  { OWeakAggObject::release(); }
     108             : 
     109             :     ::com::sun::star::uno::Any  SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
     110             : 
     111             :     // ::com::sun::star::lang::XTypeProvider
     112             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >  SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
     113             :     ::com::sun::star::uno::Sequence< sal_Int8 >                     SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
     114             : 
     115             :     // ::com::sun::star::awt::XTabControllerModel
     116             :     sal_Bool SAL_CALL getGroupControl(  ) throw(::com::sun::star::uno::RuntimeException);
     117             :     void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
     118             :     void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException);
     119             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels(  ) throw(::com::sun::star::uno::RuntimeException);
     120             :     void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException);
     121             :     sal_Int32 SAL_CALL getGroupCount(  ) throw(::com::sun::star::uno::RuntimeException);
     122             :     void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
     123             :     void SAL_CALL getGroupByName( const OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw(::com::sun::star::uno::RuntimeException);
     124             : 
     125             :     // ::com::sun::star::io::XPersistObject
     126             :     OUString SAL_CALL getServiceName(  ) throw(::com::sun::star::uno::RuntimeException);
     127             :     void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
     128             :     void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
     129             : 
     130             :     // XServiceInfo
     131           1 :     DECLIMPL_SERVICEINFO( StdTabControllerModel, szServiceName2_TabControllerModel )
     132             : };
     133             : 
     134             : 
     135             : 
     136             : #endif // _TOOLKIT_HELPER_STDTABCONTROLLERMODEL_HXX_
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10