LCOV - code coverage report
Current view: top level - forms/source/component - Edit.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 8 75.0 %
Date: 2015-06-13 12:38:46 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_EDIT_HXX
      21             : #define INCLUDED_FORMS_SOURCE_COMPONENT_EDIT_HXX
      22             : 
      23             : #include "EditBase.hxx"
      24             : 
      25             : #include <tools/link.hxx>
      26             : #include <cppuhelper/implbase3.hxx>
      27             : 
      28             : namespace dbtools { class FormattedColumnValue; }
      29             : struct ImplSVEvent;
      30             : 
      31             : namespace frm
      32             : {
      33             : 
      34             : class OEditModel : public OEditBaseModel
      35             : {
      36             :     ::std::unique_ptr< ::dbtools::FormattedColumnValue >
      37             :                                 m_pValueFormatter;
      38             :     bool                    m_bMaxTextLenModified : 1;  // set to <TRUE/> when we change the MaxTextLen of the aggregate
      39             : 
      40             :     bool                    m_bWritingFormattedFake : 1; // are we writing something which should be interpreted as formatted upon reading?
      41             : 
      42             : public:
      43             :     DECLARE_DEFAULT_LEAF_XTOR( OEditModel );
      44             : 
      45             : protected:
      46             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
      47             : 
      48           0 :     void enableFormattedWriteFake() { m_bWritingFormattedFake = true; }
      49           0 :     void disableFormattedWriteFake() { m_bWritingFormattedFake = false; }
      50           1 :     bool lastReadWasFormattedFake() const { return (getLastReadVersion() & PF_FAKE_FORMATTED_FIELD) != 0; }
      51             : 
      52             :     friend class OFormattedFieldWrapper;
      53             :     friend class OFormattedModel;   // temporary
      54             : 
      55             : public:
      56             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      57             : 
      58             :     // XPropertySet
      59             :     virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
      60             : 
      61             :     // XPersistObject
      62             :     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;
      63             :     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;
      64             :     virtual OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      65             : 
      66             :     // XPropertySet
      67             :     using OBoundControlModel::getFastPropertyValue;
      68             : 
      69             :     // XReset
      70             :     virtual void SAL_CALL reset(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             : 
      72             :     // XServiceInfo
      73           9 :     OUString SAL_CALL getImplementationName()
      74             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
      75           9 :     { return OUString("com.sun.star.form.OEditModel"); }
      76             : 
      77             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
      78             : 
      79             :     // OControlModel's property handling
      80             :     virtual void describeFixedProperties(
      81             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
      82             :     ) const SAL_OVERRIDE;
      83             :     virtual void describeAggregateProperties(
      84             :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
      85             :     ) const SAL_OVERRIDE;
      86             : 
      87             :     // XEventListener
      88             :     using OBoundControlModel::disposing;
      89             : 
      90             : protected:
      91             :     // OControlModel overridables
      92             :     virtual void writeAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream ) const SAL_OVERRIDE;
      93             :     virtual void readAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream ) SAL_OVERRIDE;
      94             : 
      95             :     // OBoundControlModel overridables
      96             :     virtual ::com::sun::star::uno::Any
      97             :                             translateDbColumnToControlValue( ) SAL_OVERRIDE;
      98             :     virtual bool            commitControlValueToDbColumn( bool _bPostReset ) SAL_OVERRIDE;
      99             : 
     100             :     virtual ::com::sun::star::uno::Any
     101             :                             getDefaultForReset() const SAL_OVERRIDE;
     102             : 
     103             :     virtual void            onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ) SAL_OVERRIDE;
     104             :     virtual void            onDisconnectedDbColumn() SAL_OVERRIDE;
     105             : 
     106             :     virtual bool            approveDbColumnType( sal_Int32 _nColumnType ) SAL_OVERRIDE;
     107             : 
     108             :     virtual void            resetNoBroadcast() SAL_OVERRIDE;
     109             : 
     110             : protected:
     111             :     virtual sal_uInt16 getPersistenceFlags() const SAL_OVERRIDE;
     112             : 
     113             :     virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone(  ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             : private:
     116             :     bool    implActsAsRichText( ) const;
     117             : };
     118             : 
     119             : 
     120             : //= OEditControl
     121             : 
     122             : typedef ::cppu::ImplHelper3<    ::com::sun::star::awt::XFocusListener,
     123             :                                 ::com::sun::star::awt::XKeyListener,
     124             :                                 ::com::sun::star::form::XChangeBroadcaster > OEditControl_BASE;
     125             : 
     126             : class OEditControl : public OBoundControl
     127             :                       ,public OEditControl_BASE
     128             : {
     129             :     ::cppu::OInterfaceContainerHelper
     130             :                         m_aChangeListeners;
     131             : 
     132             :     OUString         m_aHtmlChangeValue;
     133             :     ImplSVEvent *    m_nKeyEvent;
     134             : 
     135             : public:
     136             :     OEditControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
     137             :     virtual ~OEditControl();
     138             : 
     139      108413 :     DECLARE_UNO3_AGG_DEFAULTS(OEditControl, OBoundControl)
     140             :     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;
     141             : 
     142             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes() SAL_OVERRIDE;
     143             : 
     144             : // OComponentHelper
     145             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     146             : 
     147             : // ::com::sun::star::lang::XEventListener
     148             :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             : // ::com::sun::star::lang::XServiceInfo
     151           1 :     OUString SAL_CALL getImplementationName()
     152             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     153           1 :     { return OUString("com.sun.star.form.OEditControl"); }
     154             : 
     155             :     virtual StringSequence SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
     156             : 
     157             : // ::com::sun::star::form::XChangeBroadcaster
     158             :     virtual void SAL_CALL addChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             :     virtual void SAL_CALL removeChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             : 
     161             : // ::com::sun::star::awt::XFocusListener
     162             :     virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             :     virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             : // ::com::sun::star::awt::XKeyListener
     166             :     virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     167             :     virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     168             : 
     169             :     // XControl
     170             :     virtual void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& _rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _rxParent ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     171             : 
     172             : private:
     173             :     DECL_LINK( OnKeyPressed, void* );
     174             : };
     175             : 
     176             : }
     177             : 
     178             : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_EDIT_HXX
     179             : 
     180             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11