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

Generated by: LCOV version 1.11