LCOV - code coverage report
Current view: top level - forms/source/component - entrylisthelper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.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_ENTRYLISTHELPER_HXX
      21             : #define INCLUDED_FORMS_SOURCE_COMPONENT_ENTRYLISTHELPER_HXX
      22             : 
      23             : #include <com/sun/star/form/binding/XListEntrySink.hpp>
      24             : #include <com/sun/star/util/XRefreshable.hpp>
      25             : #include <com/sun/star/form/binding/XListEntryListener.hpp>
      26             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      27             : 
      28             : #include <cppuhelper/implbase3.hxx>
      29             : #include <cppuhelper/interfacecontainer.hxx>
      30             : 
      31             : 
      32             : namespace frm
      33             : {
      34             : 
      35             : 
      36             :     class OControlModel;
      37             :     class ControlModelLock;
      38             : 
      39             : 
      40             :     //= OEntryListHelper
      41             : 
      42             :     typedef ::cppu::ImplHelper3 <      ::com::sun::star::form::binding::XListEntrySink
      43             :                                 ,   ::com::sun::star::form::binding::XListEntryListener
      44             :                                 ,   ::com::sun::star::util::XRefreshable
      45             :                                 >   OEntryListHelper_BASE;
      46             : 
      47             :     class OEntryListHelper : public OEntryListHelper_BASE
      48             :     {
      49             :     private:
      50             :         OControlModel&  m_rControlModel;
      51             : 
      52             :         ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >
      53             :                         m_xListSource;      /// our external list source
      54             :         ::com::sun::star::uno::Sequence< OUString >
      55             :                         m_aStringItems;     /// "overridden" StringItemList property value
      56             :         ::cppu::OInterfaceContainerHelper
      57             :                         m_aRefreshListeners;
      58             : 
      59             : 
      60             :     protected:
      61             :         OEntryListHelper( OControlModel& _rControlModel );
      62             :         OEntryListHelper( const OEntryListHelper& _rSource, OControlModel& _rControlModel );
      63             :         virtual ~OEntryListHelper( );
      64             : 
      65             :         /// returns the current string item list
      66             :         inline const ::com::sun::star::uno::Sequence< OUString >&
      67         319 :                     getStringItemList() const { return m_aStringItems; }
      68             :         inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >&
      69             :                     getExternalListEntrySource() const { return m_xListSource; }
      70             : 
      71             :         /// determines whether we actually have an external list source
      72         198 :         inline bool hasExternalListSource( ) const { return m_xListSource.is(); }
      73             : 
      74             :         /** handling the XEventListener::disposing call for the case where
      75             :             our list source is being disposed
      76             :             @return
      77             :                 <TRUE/> if and only if the disposed object was our list source, and so the
      78             :                 event was handled
      79             :         */
      80             :         bool        handleDisposing( const ::com::sun::star::lang::EventObject& _rEvent );
      81             : 
      82             :         /** to be called by derived classes' instances when they're being disposed
      83             :         */
      84             :         void        disposing( );
      85             : 
      86             :         // prevent method hiding
      87             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
      88             : 
      89             :         /** helper for implementing convertFastPropertyValue( StringItemList )
      90             : 
      91             :             <p>The signature of this method and the return type have the same semantics
      92             :             as convertFastPropertyValue.</p>
      93             :         */
      94             :         bool    convertNewListSourceProperty(
      95             :                         ::com::sun::star::uno::Any& _rConvertedValue,
      96             :                         ::com::sun::star::uno::Any& _rOldValue,
      97             :                         const ::com::sun::star::uno::Any& _rValue
      98             :                     );
      99             : 
     100             :         /** helper for implementing setFastPropertyValueNoBroadcast
     101             : 
     102             :             <p>Will internally call stringItemListChanged after the new item list
     103             :             has been set.</p>
     104             : 
     105             :             @precond
     106             :                 not to be called when we have an external list source
     107             :             @see hasExternalListSource
     108             :         */
     109             :         void        setNewStringItemList( const ::com::sun::star::uno::Any& _rValue, ControlModelLock& _rInstanceLock );
     110             : 
     111             :         /** announces that the list of entries has changed.
     112             : 
     113             :             <p>Derived classes have to override this. Most probably, they'll set the new
     114             :             as model property.</p>
     115             : 
     116             :             @pure
     117             :             @see getStringItemList
     118             :         */
     119             :         virtual void    stringItemListChanged( ControlModelLock& _rInstanceLock ) = 0;
     120             : 
     121             :         /** called whenever a connection to a new external list source has been established
     122             :         */
     123             :         virtual void    connectedExternalListSource( );
     124             : 
     125             :         /** called whenever a connection to a new external list source has been revoked
     126             :         */
     127             :         virtual void    disconnectedExternalListSource( );
     128             : 
     129             :         /** called when XRefreshable::refresh has been called, and we do *not* have an external
     130             :             list source
     131             :         */
     132             :         virtual void    refreshInternalEntryList() = 0;
     133             : 
     134             :     private:
     135             :         // XListEntrySink
     136             :         virtual void SAL_CALL setListEntrySource( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource > SAL_CALL getListEntrySource(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             : 
     139             :         // XListEntryListener
     140             :         virtual void SAL_CALL entryChanged( const ::com::sun::star::form::binding::ListEntryEvent& _rSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :         virtual void SAL_CALL entryRangeInserted( const ::com::sun::star::form::binding::ListEntryEvent& _rSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             :         virtual void SAL_CALL entryRangeRemoved( const ::com::sun::star::form::binding::ListEntryEvent& _rSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     143             :         virtual void SAL_CALL allEntriesChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             : 
     145             :         // XRefreshable
     146             :         virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             :         virtual void SAL_CALL addRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :         virtual void SAL_CALL removeRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             :     private:
     151             :         /** disconnects from the active external list source, if present
     152             :             @see connectExternalListSource
     153             :         */
     154             :         void        disconnectExternalListSource( );
     155             : 
     156             :         /** connects to a new external list source
     157             :             @param _rxSource
     158             :                 the new list source. Must not be <NULL/>
     159             :             @see disconnectExternalListSource
     160             :         */
     161             :         void        connectExternalListSource(
     162             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource,
     163             :                         ControlModelLock& _rInstanceLock
     164             :                     );
     165             : 
     166             :         /** refreshes our list entries
     167             : 
     168             :             In case we have an external list source, its used to obtain the new entries, and then
     169             :             stringItemListChanged is called to give the derived class the possibility to
     170             :             react on this.
     171             : 
     172             :             In case we do not have an external list source, refreshInternalEntryList is called.
     173             :         */
     174             :         void        impl_lock_refreshList( ControlModelLock& _rInstanceLock );
     175             : 
     176             :     private:
     177             :         OEntryListHelper( const OEntryListHelper& ) SAL_DELETED_FUNCTION;
     178             :         OEntryListHelper& operator=( const OEntryListHelper& ) SAL_DELETED_FUNCTION;
     179             :     };
     180             : 
     181             : 
     182             : }   // namespace frm
     183             : 
     184             : 
     185             : 
     186             : #endif // INCLUDED_FORMS_SOURCE_COMPONENT_ENTRYLISTHELPER_HXX
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11