LCOV - code coverage report
Current view: top level - toolkit/inc/toolkit/controls - geometrycontrolmodel.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-08-25 Functions: 52 58 89.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 50 112 44.6 %

           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 _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
      30                 :            : #define _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
      31                 :            : 
      32                 :            : #include <comphelper/broadcasthelper.hxx>
      33                 :            : #include <comphelper/uno3.hxx>
      34                 :            : #include <comphelper/propagg.hxx>
      35                 :            : #include <comphelper/proparrhlp.hxx>
      36                 :            : #include <comphelper/propertycontainer.hxx>
      37                 :            : #include <cppuhelper/weakagg.hxx>
      38                 :            : #include <cppuhelper/compbase2.hxx>
      39                 :            : #include <com/sun/star/util/XCloneable.hpp>
      40                 :            : #include <com/sun/star/script/XScriptEventsSupplier.hpp>
      41                 :            : #include <com/sun/star/resource/XStringResourceResolver.hpp>
      42                 :            : #include <cppuhelper/typeprovider.hxx>
      43                 :            : #include <comphelper/IdPropArrayHelper.hxx>
      44                 :            : #include <comphelper/stl_types.hxx>
      45                 :            : 
      46                 :            : namespace com { namespace sun { namespace star {
      47                 :            :     namespace lang {
      48                 :            :         class XMultiServiceFactory;
      49                 :            :     }
      50                 :            :     namespace script {
      51                 :            :         class XNameContainer;
      52                 :            :     }
      53                 :            : }}}
      54                 :            : 
      55                 :            : //........................................................................
      56                 :            : // namespace toolkit
      57                 :            : // {
      58                 :            : //........................................................................
      59                 :            : 
      60                 :            :     //====================================================================
      61                 :            :     //= OGeometryControlModel_Base
      62                 :            :     //====================================================================
      63                 :            :     typedef ::cppu::WeakAggComponentImplHelper2 <   ::com::sun::star::util::XCloneable
      64                 :            :                                                 ,   ::com::sun::star::script::XScriptEventsSupplier
      65                 :            :                                                 >   OGCM_Base;
      66                 :            :     class OGeometryControlModel_Base
      67                 :            :         :public ::comphelper::OMutexAndBroadcastHelper
      68                 :            :         ,public ::comphelper::OPropertySetAggregationHelper
      69                 :            :         ,public ::comphelper::OPropertyContainer
      70                 :            :         ,public OGCM_Base
      71                 :            :     {
      72                 :            :     protected:
      73                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
      74                 :            :                     m_xAggregate;
      75                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
      76                 :            :                     mxEventContainer;
      77                 :            : 
      78                 :            :         // <properties>
      79                 :            :         sal_Int32       m_nPosX;
      80                 :            :         sal_Int32       m_nPosY;
      81                 :            :         sal_Int32       m_nWidth;
      82                 :            :         sal_Int32       m_nHeight;
      83                 :            :         ::rtl::OUString m_aName;
      84                 :            :         sal_Int16       m_nTabIndex;
      85                 :            :         sal_Int32       m_nStep;
      86                 :            :         ::rtl::OUString m_aTag;
      87                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xStrResolver;
      88                 :            :         // </properties>
      89                 :            : 
      90                 :            :         sal_Bool        m_bCloneable;
      91                 :            : 
      92                 :            :     protected:
      93                 :            :         virtual ::com::sun::star::uno::Any          ImplGetDefaultValueByHandle(sal_Int32 nHandle) const;
      94                 :            :         virtual ::com::sun::star::uno::Any          ImplGetPropertyValueByHandle(sal_Int32 nHandle) const;
      95                 :            :         virtual void                                ImplSetPropertyValueByHandle(sal_Int32 nHandle, const :: com::sun::star::uno::Any& aValue);
      96                 :            : 
      97                 :            :     protected:
      98                 :            :         /**
      99                 :            :             @param _pAggregateInstance
     100                 :            :                 the object to be aggregated. The refcount of the instance given MUST be 0!
     101                 :            :         */
     102                 :            :         OGeometryControlModel_Base(::com::sun::star::uno::XAggregation* _pAggregateInstance);
     103                 :            : 
     104                 :            :         /**
     105                 :            :             @param _rxAggregateInstance
     106                 :            :                 is the object to be aggregated. Must be aquired excatly once (by the reference object given).<br/>
     107                 :            :                 Will be reset to NULL upon leaving
     108                 :            :         */
     109                 :            :         OGeometryControlModel_Base(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
     110                 :            : 
     111                 :            :         /** releases the aggregation
     112                 :            :             <p>Can be used if in a derived class, an exception has to be thrown after this base class here already
     113                 :            :             did the aggregation</p>
     114                 :            :         */
     115                 :            :         void releaseAggregation();
     116                 :            : 
     117                 :            :     protected:
     118                 :            :         ~OGeometryControlModel_Base();
     119                 :            : 
     120                 :            :         // XAggregation
     121                 :            :         ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _aType ) throw(::com::sun::star::uno::RuntimeException);
     122                 :            : 
     123                 :            :         // XInterface
     124                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
     125                 :            :         virtual void SAL_CALL acquire(  ) throw();
     126                 :            :         virtual void SAL_CALL release(  ) throw();
     127                 :            : 
     128                 :            :         // XTypeProvider
     129                 :            :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException);
     130                 :            : 
     131                 :            :         // OPropertySetHelper overridables
     132                 :            :         virtual sal_Bool SAL_CALL convertFastPropertyValue(
     133                 :            :                 ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue,
     134                 :            :                 sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
     135                 :            :             throw (::com::sun::star::lang::IllegalArgumentException);
     136                 :            : 
     137                 :            :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     138                 :            :                 sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue)
     139                 :            :             throw (::com::sun::star::uno::Exception);
     140                 :            : 
     141                 :            :         using comphelper::OPropertySetAggregationHelper::getFastPropertyValue;
     142                 :            :         virtual void SAL_CALL getFastPropertyValue(
     143                 :            :             ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle) const;
     144                 :            : 
     145                 :            :         // OPropertyStateHelper overridables
     146                 :            :         virtual ::com::sun::star::beans::PropertyState  getPropertyStateByHandle(sal_Int32 nHandle);
     147                 :            :         virtual void                                    setPropertyToDefaultByHandle(sal_Int32 nHandle);
     148                 :            :         virtual ::com::sun::star::uno::Any              getPropertyDefaultByHandle(sal_Int32 nHandle) const;
     149                 :            : 
     150                 :            :         // XPropertySet
     151                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
     152                 :            : 
     153                 :            :         // OPropertySetAggregationHelper overridables
     154                 :            :         using OPropertySetAggregationHelper::getInfoHelper;
     155                 :            : 
     156                 :            :         // XCloneable
     157                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw(::com::sun::star::uno::RuntimeException);
     158                 :            : 
     159                 :            :         //XScriptEventsSupplier
     160                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
     161                 :            :             SAL_CALL getEvents(  ) throw(::com::sun::star::uno::RuntimeException);
     162                 :            : 
     163                 :            :         // XCloneable implementation - to be overwritten
     164                 :            :         virtual OGeometryControlModel_Base* createClone_Impl(
     165                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance) = 0;
     166                 :            : 
     167                 :            :         // XComponent
     168                 :            :         using comphelper::OPropertySetAggregationHelper::disposing;
     169                 :            :         virtual void SAL_CALL disposing();
     170                 :            : 
     171                 :            :     private:
     172                 :            :         void registerProperties();
     173                 :            :     };
     174                 :            : 
     175                 :            :     //====================================================================
     176                 :            :     //= OTemplateInstanceDisambiguation
     177                 :            :     //====================================================================
     178                 :            :     template <class CONTROLMODEL>
     179                 :            :     class OTemplateInstanceDisambiguation
     180                 :            :     {
     181                 :            :     };
     182                 :            : 
     183                 :            :     //====================================================================
     184                 :            :     //= OGeometryControlModel
     185                 :            :     //====================================================================
     186                 :            :     /*  example for usage:
     187                 :            :             Reference< XAggregation > xIFace = new ::toolkit::OGeometryControlModel< UnoControlButtonModel > ();
     188                 :            :     */
     189                 :            :     template <class CONTROLMODEL>
     190 [ +  - ][ -  + ]:        104 :     class OGeometryControlModel
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ +  - ][ -  + ]
     191                 :            :         :public OGeometryControlModel_Base
     192                 :            :         ,public ::comphelper::OAggregationArrayUsageHelper< OTemplateInstanceDisambiguation< CONTROLMODEL > >
     193                 :            :     {
     194                 :            :     public:
     195                 :            :         OGeometryControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
     196                 :            : 
     197                 :            :     private:
     198                 :            :         OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
     199                 :            : 
     200                 :            :     protected:
     201                 :            :         // OAggregationArrayUsageHelper overridables
     202                 :            :         virtual void fillProperties(
     203                 :            :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rProps,
     204                 :            :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rAggregateProps
     205                 :            :             ) const;
     206                 :            : 
     207                 :            :         // OPropertySetAggregationHelper overridables
     208                 :            :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
     209                 :            : 
     210                 :            :         // OGeometryControlModel_Base
     211                 :            :         virtual OGeometryControlModel_Base* createClone_Impl(
     212                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
     213                 :            : 
     214                 :            :         // XTypeProvider
     215                 :            :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException);
     216                 :            :     };
     217                 :            : 
     218                 :            :     //====================================================================
     219                 :            :     //= OCommonGeometryControlModel
     220                 :            :     //====================================================================
     221                 :            :     /** allows to extend an arbitrary <type scope="com.sun.star.awt">UnoControlModel</type> with geometry
     222                 :            :         information.
     223                 :            :     */
     224 [ +  - ][ -  + ]:         24 :     class OCommonGeometryControlModel
     225                 :            :         :public OGeometryControlModel_Base
     226                 :            :         ,public ::comphelper::OIdPropertyArrayUsageHelper< OCommonGeometryControlModel >
     227                 :            :     {
     228                 :            :     private:
     229                 :            :         ::rtl::OUString m_sServiceSpecifier;        // the service specifier of our aggregate
     230                 :            :         sal_Int32       m_nPropertyMapId;           // our unique property info id, used to look up in s_aAggregateProperties
     231                 :            : 
     232                 :            :     public:
     233                 :            :         /** instantiate the model
     234                 :            : 
     235                 :            :             @param _rxAgg
     236                 :            :                 the instance to aggregate. Must support the <type scope="com.sun.star.awt">UnoControlModel</type>
     237                 :            :                 (this is not checked here)
     238                 :            :         */
     239                 :            :         OCommonGeometryControlModel(
     240                 :            :                     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAgg,
     241                 :            :             const   ::rtl::OUString& _rxServiceSpecifier
     242                 :            :         );
     243                 :            : 
     244                 :            :         // OIdPropertyArrayUsageHelper overridables
     245                 :            :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
     246                 :            : 
     247                 :            :         // OPropertySetAggregationHelper overridables
     248                 :            :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
     249                 :            : 
     250                 :            :         // OGeometryControlModel_Base
     251                 :            :         virtual OGeometryControlModel_Base* createClone_Impl(
     252                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
     253                 :            : 
     254                 :            :         // XTypeProvider
     255                 :            :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException);
     256                 :            : 
     257                 :            :     private:
     258                 :            :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     259                 :            :                 sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue)
     260                 :            :             throw (::com::sun::star::uno::Exception);
     261                 :            :     };
     262                 :            : 
     263                 :            : #include "toolkit/controls/geometrycontrolmodel_impl.hxx"
     264                 :            : 
     265                 :            : //........................................................................
     266                 :            : // }    // namespace toolkit
     267                 :            : //........................................................................
     268                 :            : 
     269                 :            : #endif // _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
     270                 :            : 
     271                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10