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

Generated by: LCOV version 1.10