LCOV - code coverage report
Current view: top level - libreoffice/forms/source/component - Columns.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 12 0.0 %
Date: 2012-12-27 Functions: 0 24 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 _FRM_COLUMNS_HXX
      21             : #define _FRM_COLUMNS_HXX
      22             : 
      23             : #include "cloneable.hxx"
      24             : #include "frm_strings.hxx"
      25             : 
      26             : #include <com/sun/star/io/XObjectInputStream.hpp>
      27             : #include <com/sun/star/io/XObjectOutputStream.hpp>
      28             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      29             : #include <com/sun/star/util/XCloneable.hpp>
      30             : 
      31             : #include <comphelper/broadcasthelper.hxx>
      32             : #include <comphelper/componentcontext.hxx>
      33             : #include <comphelper/propagg.hxx>
      34             : #include <comphelper/proparrhlp.hxx>
      35             : #include <comphelper/uno3.hxx>
      36             : #include <cppuhelper/compbase2.hxx>
      37             : #include <cppuhelper/component.hxx>
      38             : 
      39             : using namespace comphelper;
      40             : 
      41             : //.........................................................................
      42             : namespace frm
      43             : {
      44             : //.........................................................................
      45             : 
      46             : //==================================================================
      47             : // OGridColumn
      48             : //==================================================================
      49             : typedef ::cppu::WeakAggComponentImplHelper2 <   ::com::sun::star::lang::XUnoTunnel
      50             :                                             ,   ::com::sun::star::util::XCloneable > OGridColumn_BASE;
      51             : class OGridColumn   :public ::comphelper::OBaseMutex
      52             :                     ,public OGridColumn_BASE
      53             :                     ,public OPropertySetAggregationHelper
      54             :                     ,public OCloneableAggregation
      55             : {
      56             : protected:
      57             : // [properties]
      58             :     ::com::sun::star::uno::Any  m_aWidth;                   // column width
      59             :     ::com::sun::star::uno::Any  m_aAlign;                   // column alignment
      60             :     ::com::sun::star::uno::Any  m_aHidden;                  // column hidden?
      61             : // [properties]
      62             : 
      63             :     ::comphelper::ComponentContext  m_aContext;
      64             :     ::rtl::OUString                 m_aModelName;
      65             : 
      66             : // [properties]
      67             :     ::rtl::OUString             m_aLabel;                   // Column name
      68             : // [properties]
      69             : 
      70             : public:
      71             :     OGridColumn(const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName = ::rtl::OUString());
      72             :     OGridColumn(const OGridColumn* _pOriginal );
      73             :     virtual ~OGridColumn();
      74             : 
      75             :     // UNO binding
      76           0 :     DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE);
      77             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
      78             : 
      79             :     static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelImplementationId();
      80             :     // XUnoTunnel
      81             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<sal_Int8>& _rIdentifier) throw(::com::sun::star::uno::RuntimeException);
      82             : 
      83             :     // XTypeProvider
      84             :     virtual ::com::sun::star::uno::Sequence<sal_Int8>           SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
      85             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>   SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
      86             : 
      87             :     // OComponentHelper
      88             :     virtual void SAL_CALL disposing();
      89             : 
      90             :     // XEventListener
      91             :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
      92             : 
      93             :     // XPersistObject
      94             :     virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
      95             :     virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
      96             : 
      97             :     // XPropertySet
      98             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
      99             :     virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
     100             :     virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
     101             :                                           sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
     102             :                                         throw(::com::sun::star::lang::IllegalArgumentException);
     103             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
     104             : 
     105             :     using OPropertySetAggregationHelper::getFastPropertyValue;
     106             : 
     107             :     // ::com::sun::star::beans::XPropertyState
     108             :     virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
     109             : 
     110             :     // XCloneable
     111             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
     112             : 
     113           0 :     const ::rtl::OUString& getModelName() const { return m_aModelName; }
     114             : 
     115             : protected:
     116             :     static void clearAggregateProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps, sal_Bool bAllowDropDown);
     117             :     static void setOwnProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps);
     118             : 
     119             :     virtual OGridColumn* createCloneColumn() const = 0;
     120             : };
     121             : 
     122             : #define DECL_COLUMN(ClassName)                                                                              \
     123             : class ClassName                                                                                             \
     124             :     :public OGridColumn                                                                                     \
     125             :     ,public OAggregationArrayUsageHelper< ClassName >                                                       \
     126             : {                                                                                                           \
     127             : public:                                                                                                     \
     128             :     ClassName(const ::comphelper::ComponentContext& _rContext );                                            \
     129             :     ClassName(const ClassName* _pCloneFrom);                                                                \
     130             :                                                                                                             \
     131             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);  \
     132             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();                                         \
     133             :                                                                                                             \
     134             :     virtual void fillProperties(                                                                            \
     135             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,          \
     136             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps  \
     137             :         ) const;                                                                                            \
     138             :                                                                                                             \
     139             :     virtual OGridColumn* createCloneColumn() const;                                                         \
     140             : };
     141             : 
     142             : 
     143             : #define IMPL_COLUMN(ClassName, Model, bAllowDropDown)                               \
     144             :     ClassName::ClassName( const ::comphelper::ComponentContext& _rContext ) \
     145             :     :OGridColumn(_rContext, Model) \
     146             : { \
     147             : } \
     148             : ClassName::ClassName( const ClassName* _pCloneFrom ) \
     149             :     :OGridColumn( _pCloneFrom ) \
     150             : { \
     151             : } \
     152             : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>  ClassName::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) \
     153             : { \
     154             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) ); \
     155             :     return xInfo; \
     156             : } \
     157             : ::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \
     158             : { \
     159             :     return *const_cast<ClassName*>(this)->getArrayHelper(); \
     160             : } \
     161             : void ClassName::fillProperties( \
     162             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \
     163             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \
     164             :     ) const \
     165             : { \
     166             :     if (m_xAggregateSet.is()) \
     167             :     { \
     168             :         _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \
     169             :         clearAggregateProperties(_rAggregateProps, bAllowDropDown); \
     170             :         setOwnProperties(_rProps); \
     171             :     } \
     172             : } \
     173             : OGridColumn* ClassName::createCloneColumn() const \
     174             : { \
     175             :     return new ClassName( this ); \
     176             : } \
     177             :  \
     178             : // column type ids
     179             : #define TYPE_CHECKBOX       0
     180             : #define TYPE_COMBOBOX       1
     181             : #define TYPE_CURRENCYFIELD  2
     182             : #define TYPE_DATEFIELD      3
     183             : #define TYPE_FORMATTEDFIELD 4
     184             : #define TYPE_LISTBOX        5
     185             : #define TYPE_NUMERICFIELD   6
     186             : #define TYPE_PATTERNFIELD   7
     187             : #define TYPE_TEXTFIELD      8
     188             : #define TYPE_TIMEFIELD      9
     189             : 
     190             : // List of all known columns
     191             : const StringSequence& getColumnTypes();
     192             : sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName);
     193             : 
     194             : // Columns
     195           0 : DECL_COLUMN(TextFieldColumn)
     196           0 : DECL_COLUMN(PatternFieldColumn)
     197           0 : DECL_COLUMN(DateFieldColumn)
     198           0 : DECL_COLUMN(TimeFieldColumn)
     199           0 : DECL_COLUMN(NumericFieldColumn)
     200           0 : DECL_COLUMN(CurrencyFieldColumn)
     201           0 : DECL_COLUMN(CheckBoxColumn)
     202           0 : DECL_COLUMN(ComboBoxColumn)
     203           0 : DECL_COLUMN(ListBoxColumn)
     204           0 : DECL_COLUMN(FormattedFieldColumn)
     205             : 
     206             : #endif // _FRM_COLUMNS_HXX
     207             : 
     208             : //.........................................................................
     209             : }   // namespace frm
     210             : //.........................................................................
     211             : 
     212             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10