LCOV - code coverage report
Current view: top level - forms/source/component - FormattedField.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 4 50.0 %
Date: 2014-11-03 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 INCLUDED_FORMS_SOURCE_COMPONENT_FORMATTEDFIELD_HXX
      21             : #define INCLUDED_FORMS_SOURCE_COMPONENT_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             : struct ImplSVEvent;
      30             : 
      31             : namespace frm
      32             : {
      33             : class OFormattedModel
      34             :                     :public OEditBaseModel
      35             :                     ,public OErrorBroadcaster
      36             :     {
      37             :         // the original, in case I faked the format properties of my aggregated model,
      38             :         // i.e. I just passed on the attributes of the field to which I am bound
      39             :         // (only valid if loaded)
      40             : 
      41             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>   m_xOriginalFormatter;
      42             :         ::com::sun::star::util::Date        m_aNullDate;
      43             :         ::com::sun::star::uno::Any          m_aSaveValue;
      44             : 
      45             :         sal_Int32                           m_nFieldType;
      46             :         sal_Int16                           m_nKeyType;
      47             :         bool                                m_bOriginalNumeric      : 1,
      48             :                                             m_bNumeric              : 1;    // analogous for the TreatAsNumeric-property
      49             : 
      50             :     protected:
      51             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcDefaultFormatsSupplier() const;
      52             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcFormFormatsSupplier() const;
      53             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier>  calcFormatsSupplier() const;
      54             : 
      55             :         DECLARE_DEFAULT_LEAF_XTOR( OFormattedModel );
      56             : 
      57             :         friend class OFormattedFieldWrapper;
      58             : 
      59             :     protected:
      60             :         // XInterface
      61       25680 :         DECLARE_UNO3_AGG_DEFAULTS( OFormattedModel, OEditBaseModel )
      62             : 
      63             :         // XTypeProvider
      64             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
      65             : 
      66             :         // XAggregation
      67             :         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;
      68             : 
      69             :         // OComponentHelper
      70             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
      71             : 
      72             :         // XServiceInfo
      73           0 :         IMPLEMENTATION_NAME(OFormattedModel);
      74             :         virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
      75             : 
      76             :         // XPersistObject
      77             :         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, std::exception) SAL_OVERRIDE;
      78             :         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, std::exception) SAL_OVERRIDE;
      79             :         virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             : 
      81             :         // XPropertySet
      82             :         virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      83             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
      84             :                                               sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
      85             :                                             throw(::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
      86             :         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;
      87             : 
      88             :         // XLoadListener
      89             :         virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             : 
      91             :         // XPropertyState
      92             :         void setPropertyToDefaultByHandle(sal_Int32 nHandle) SAL_OVERRIDE;
      93             :         ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const SAL_OVERRIDE;
      94             : 
      95             :         void SAL_CALL setPropertyToDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :         ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             : 
      98             :         // OControlModel's property handling
      99             :         virtual void describeFixedProperties(
     100             :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
     101             :         ) const SAL_OVERRIDE;
     102             :         virtual void describeAggregateProperties(
     103             :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
     104             :         ) const SAL_OVERRIDE;
     105             : 
     106             :         // XPropertyChangeListener
     107             :         virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     108             : 
     109             :         // prevent method hiding
     110             :         using OEditBaseModel::disposing;
     111             :         using OEditBaseModel::getFastPropertyValue;
     112             : 
     113             :     protected:
     114             :         virtual sal_uInt16 getPersistenceFlags() const SAL_OVERRIDE;
     115             :         // as we have an own version handling for persistence
     116             : 
     117             :         // OBoundControlModel overridables
     118             :         virtual ::com::sun::star::uno::Any
     119             :                             translateDbColumnToControlValue( ) SAL_OVERRIDE;
     120             :         virtual bool        commitControlValueToDbColumn( bool _bPostReset ) SAL_OVERRIDE;
     121             : 
     122             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
     123             :                             getSupportedBindingTypes() SAL_OVERRIDE;
     124             :         virtual ::com::sun::star::uno::Any
     125             :                             translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const SAL_OVERRIDE;
     126             :         virtual ::com::sun::star::uno::Any
     127             :                             translateControlValueToExternalValue( ) const SAL_OVERRIDE;
     128             :         virtual void onConnectedExternalValue( ) SAL_OVERRIDE;
     129             : 
     130             :         virtual ::com::sun::star::uno::Any
     131             :                             getDefaultForReset() const SAL_OVERRIDE;
     132             :         virtual void        resetNoBroadcast() SAL_OVERRIDE;
     133             : 
     134             :         virtual void        onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ) SAL_OVERRIDE;
     135             :         virtual void        onDisconnectedDbColumn() SAL_OVERRIDE;
     136             : 
     137             :     private:
     138             :         virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     139             : 
     140             :         void implConstruct();
     141             : 
     142             :         void    updateFormatterNullDate();
     143             :     };
     144             : 
     145             :     typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE;
     146             :     class OFormattedControl :    public OBoundControl
     147             :                                 ,public OFormattedControl_BASE
     148             :     {
     149             :         ImplSVEvent * m_nKeyEvent;
     150             : 
     151             :     public:
     152             :         OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
     153             :         virtual ~OFormattedControl();
     154             : 
     155        6684 :         DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl)
     156             :         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;
     157             : 
     158             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
     159             : 
     160             :         // ::com::sun::star::lang::XServiceInfo
     161           0 :         IMPLEMENTATION_NAME(OFormattedControl);
     162             :         virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
     163             : 
     164             :         // ::com::sun::star::lang::XEventListener
     165             :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :         // ::com::sun::star::awt::XKeyListener
     168             :         virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :         virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             : 
     171             :         // ::com::sun::star::awt::XControl
     172             :         virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             : 
     174             :         // disambiguation
     175             :         using OBoundControl::disposing;
     176             : 
     177             :     private:
     178             :         DECL_LINK( OnKeyPressed, void* );
     179             :     };
     180             : }
     181             : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_FORMATTEDFIELD_HXX
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10