LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/forms/source/component - FormattedField.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 4 50.0 %
Date: 2013-07-09 Functions: 6 8 75.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 _FORMS_FORMATTEDFIELD_HXX_
      21             : #define _FORMS_FORMATTEDFIELD_HXX_
      22             : 
      23             : #include "EditBase.hxx"
      24             : #include <tools/link.hxx>
      25             : #include <comphelper/propmultiplex.hxx>
      26             : #include <cppuhelper/implbase1.hxx>
      27             : #include "errorbroadcaster.hxx"
      28             : 
      29             : //.........................................................................
      30             : namespace frm
      31             : {
      32             : 
      33             :     //==================================================================
      34             :     //= OFormattedModel
      35             :     //==================================================================
      36             : 
      37             :     class OFormattedModel
      38             :                     :public OEditBaseModel
      39             :                     ,public OErrorBroadcaster
      40             :     {
      41             :         // das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das
      42             :         // ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded)
      43             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>   m_xOriginalFormatter;
      44             :         ::com::sun::star::util::Date        m_aNullDate;
      45             :         ::com::sun::star::uno::Any          m_aSaveValue;
      46             : 
      47             :         sal_Int32                           m_nFieldType;
      48             :         sal_Int16                           m_nKeyType;
      49             :         sal_Bool                            m_bOriginalNumeric      : 1,
      50             :                                             m_bNumeric              : 1;    // analog fuer TreatAsNumeric-Property
      51             : 
      52             :     protected:
      53             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcDefaultFormatsSupplier() const;
      54             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcFormFormatsSupplier() const;
      55             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcFormatsSupplier() const;
      56             : 
      57             :         DECLARE_DEFAULT_LEAF_XTOR( OFormattedModel );
      58             : 
      59             :         friend class OFormattedFieldWrapper;
      60             : 
      61             :     protected:
      62             :     // XInterface
      63       13014 :         DECLARE_UNO3_AGG_DEFAULTS( OFormattedModel, OEditBaseModel );
      64             : 
      65             :     // XTypeProvider
      66             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
      67             : 
      68             :     // XAggregation
      69             :         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
      70             : 
      71             :     // OComponentHelper
      72             :         virtual void SAL_CALL disposing();
      73             : 
      74             :     // XServiceInfo
      75           0 :         IMPLEMENTATION_NAME(OFormattedModel);
      76             :         virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
      77             : 
      78             :     // XPersistObject
      79             :         virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
      80             :         virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
      81             :         virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException);
      82             : 
      83             :     // XPropertySet
      84             :         virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
      85             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
      86             :                                               sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
      87             :                                             throw(::com::sun::star::lang::IllegalArgumentException);
      88             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
      89             : 
      90             :     // XLoadListener
      91             :         virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw ( ::com::sun::star::uno::RuntimeException);
      92             : 
      93             :     // XPropertyState
      94             :         void setPropertyToDefaultByHandle(sal_Int32 nHandle);
      95             :         ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
      96             : 
      97             :         void SAL_CALL setPropertyToDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
      98             :         ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
      99             : 
     100             :         // OControlModel's property handling
     101             :         virtual void describeFixedProperties(
     102             :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
     103             :         ) const;
     104             :         virtual void describeAggregateProperties(
     105             :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
     106             :         ) const;
     107             : 
     108             :     // XPropertyChangeListener
     109             :         virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
     110             : 
     111             :     // prevent method hiding
     112             :         using OEditBaseModel::disposing;
     113             :         using OEditBaseModel::getFastPropertyValue;
     114             : 
     115             :     protected:
     116             :         virtual sal_uInt16 getPersistenceFlags() const;
     117             :             // as we have an own version handling for persistence
     118             : 
     119             :         // OBoundControlModel overridables
     120             :         virtual ::com::sun::star::uno::Any
     121             :                             translateDbColumnToControlValue( );
     122             :         virtual sal_Bool    commitControlValueToDbColumn( bool _bPostReset );
     123             : 
     124             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
     125             :                             getSupportedBindingTypes();
     126             :         virtual ::com::sun::star::uno::Any
     127             :                             translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
     128             :         virtual ::com::sun::star::uno::Any
     129             :                             translateControlValueToExternalValue( ) const;
     130             :         virtual void onConnectedExternalValue( );
     131             : 
     132             :         virtual ::com::sun::star::uno::Any
     133             :                             getDefaultForReset() const;
     134             :         virtual void        resetNoBroadcast();
     135             : 
     136             :         virtual void        onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
     137             :         virtual void        onDisconnectedDbColumn();
     138             : 
     139             :     private:
     140             :         DECLARE_XCLONEABLE();
     141             : 
     142             :         void implConstruct();
     143             : 
     144             :         void    updateFormatterNullDate();
     145             :     };
     146             : 
     147             :     //==================================================================
     148             :     //= OFormattedControl
     149             :     //==================================================================
     150             :     typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE;
     151             :     class OFormattedControl :    public OBoundControl
     152             :                                 ,public OFormattedControl_BASE
     153             :     {
     154             :         sal_uInt32              m_nKeyEvent;
     155             : 
     156             :     public:
     157             :         OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
     158             :         virtual ~OFormattedControl();
     159             : 
     160        3652 :         DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl);
     161             :         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
     162             : 
     163             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
     164             : 
     165             :     // ::com::sun::star::lang::XServiceInfo
     166           0 :         IMPLEMENTATION_NAME(OFormattedControl);
     167             :         virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
     168             : 
     169             :     // ::com::sun::star::lang::XEventListener
     170             :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
     171             : 
     172             :     // ::com::sun::star::awt::XKeyListener
     173             :         virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     174             :         virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException);
     175             : 
     176             :     // ::com::sun::star::awt::XControl
     177             :         virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw ( ::com::sun::star::uno::RuntimeException);
     178             : 
     179             :     // disambiguation
     180             :         using OBoundControl::disposing;
     181             : 
     182             :     private:
     183             :         DECL_LINK( OnKeyPressed, void* );
     184             :     };
     185             : 
     186             : //.........................................................................
     187             : }
     188             : //.........................................................................
     189             : 
     190             : #endif // _FORMS_FORMATTEDFIELD_HXX_
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10