LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - unoport.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 18 61.1 %
Date: 2012-12-27 Functions: 6 10 60.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             : #ifndef _UNOPORT_HXX
      20             : #define _UNOPORT_HXX
      21             : 
      22             : #include <unocrsr.hxx>
      23             : #include <unoevtlstnr.hxx>
      24             : #include <calbck.hxx>
      25             : 
      26             : #include <com/sun/star/beans/XPropertySet.hpp>
      27             : #include <com/sun/star/text/XTextRange.hpp>
      28             : #include <com/sun/star/container/XEnumeration.hpp>
      29             : #include <com/sun/star/container/XContentEnumerationAccess.hpp>
      30             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      31             : #include <com/sun/star/beans/XPropertyState.hpp>
      32             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      33             : #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
      34             : #include <com/sun/star/text/XTextField.hpp>
      35             : #include <com/sun/star/text/XFootnote.hpp>
      36             : #include <com/sun/star/lang/XServiceInfo.hpp>
      37             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      38             : #include <cppuhelper/implbase8.hxx>
      39             : #include <cppuhelper/implbase3.hxx>
      40             : #include <svl/itemprop.hxx>
      41             : 
      42             : #include <memory>
      43             : #include <deque>
      44             : 
      45             : 
      46             : class SwFmtFld;
      47             : class SwFrmFmt;
      48             : class SwTxtRuby;
      49             : 
      50             : 
      51             : typedef ::std::deque<
      52             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > >
      53             :     TextRangeList_t;
      54             : 
      55             : enum SwTextPortionType
      56             : {
      57             :     PORTION_TEXT,
      58             :     PORTION_FIELD,
      59             :     PORTION_FRAME,
      60             :     PORTION_FOOTNOTE,
      61             :     PORTION_REFMARK_START,
      62             :     PORTION_REFMARK_END,
      63             :     PORTION_TOXMARK_START,
      64             :     PORTION_TOXMARK_END,
      65             :     PORTION_BOOKMARK_START,
      66             :     PORTION_BOOKMARK_END,
      67             :     PORTION_REDLINE_START,
      68             :     PORTION_REDLINE_END,
      69             :     PORTION_RUBY_START,
      70             :     PORTION_RUBY_END,
      71             :     PORTION_SOFT_PAGEBREAK,
      72             :     PORTION_META,
      73             :     PORTION_FIELD_START,
      74             :     PORTION_FIELD_END,
      75             :     PORTION_FIELD_START_END
      76             : };
      77             : 
      78             : 
      79             : class SwXTextPortion : public cppu::WeakImplHelper8
      80             : <
      81             :     ::com::sun::star::beans::XTolerantMultiPropertySet,
      82             :     ::com::sun::star::beans::XMultiPropertySet,
      83             :     ::com::sun::star::beans::XPropertySet,
      84             :     ::com::sun::star::text::XTextRange,
      85             :     ::com::sun::star::beans::XPropertyState,
      86             :     ::com::sun::star::container::XContentEnumerationAccess,
      87             :     ::com::sun::star::lang::XUnoTunnel,
      88             :     ::com::sun::star::lang::XServiceInfo
      89             : >,
      90             :     public SwClient
      91             : {
      92             : private:
      93             : 
      94             :     SwEventListenerContainer    m_ListenerContainer;
      95             :     const SfxItemPropertySet *  m_pPropSet;
      96             :     const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
      97             :         m_xParentText;
      98             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
      99             :         m_xRefMark;
     100             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
     101             :         m_xTOXMark;
     102             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
     103             :         m_xBookmark;
     104             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote >
     105             :         m_xFootnote;
     106             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >
     107             :         m_xTextField;
     108             :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
     109             :         m_xMeta;
     110             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     111             :     ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyText;
     112             :     ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyStyle;
     113             :     ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyAdjust;
     114             :     ::std::auto_ptr< ::com::sun::star::uno::Any > m_pRubyIsAbove;
     115             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     116             : 
     117             :     const SwDepend              m_FrameDepend;
     118             :     SwFrmFmt *                  m_pFrameFmt;
     119             :     const SwTextPortionType     m_ePortionType;
     120             : 
     121             :     bool                        m_bIsCollapsed;
     122             : 
     123             :     SwFmtFld * GetFldFmt(bool bInit = false);
     124             : 
     125             :     void init(const SwUnoCrsr* pPortionCursor);
     126             : 
     127             : protected:
     128             : 
     129             :     void SAL_CALL SetPropertyValues_Impl(
     130             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
     131             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
     132             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     133             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl(
     134             :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
     135             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     136             : 
     137             :     void        GetPropertyValues( const ::rtl::OUString *pPropertyNames,
     138             :                                     ::com::sun::star::uno::Any *pValues,
     139             :                                     sal_Int32 nLength );
     140             : 
     141             :     void GetPropertyValue( ::com::sun::star::uno::Any &rVal,
     142             :                 const SfxItemPropertySimpleEntry& rEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet );
     143             : 
     144             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl(
     145             :         const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
     146             :         sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException);
     147             : 
     148             :     virtual ~SwXTextPortion();
     149             : 
     150             :     //SwClient
     151             :    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
     152             : 
     153             : public:
     154             :     SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwTextPortionType   eType   );
     155             :     SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const& rParent, SwFrmFmt& rFmt );
     156             : 
     157             :     // for Ruby
     158             :     SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
     159             :         SwTxtRuby const& rAttr,
     160             :         ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
     161             :             const& xParent,
     162             :         sal_Bool bIsEnd );
     163             : 
     164             :     //XTextRange
     165             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >  SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException );
     166             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL  getStart() throw( ::com::sun::star::uno::RuntimeException );
     167             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL   getEnd() throw( ::com::sun::star::uno::RuntimeException );
     168             :     virtual rtl::OUString SAL_CALL  getString() throw( ::com::sun::star::uno::RuntimeException );
     169             :     virtual void SAL_CALL  setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
     170             : 
     171             :     //XTolerantMultiPropertySet
     172             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     173             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
     174             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
     175             : 
     176             :     //XMultiPropertySet
     177             :     virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     178             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
     179             :     virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     180             :     virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     181             :     virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
     182             : 
     183             :     //XPropertySet
     184             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     185             :     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     186             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     187             :     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     188             :     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     189             :     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     190             :     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     191             : 
     192             :     //XPropertyState
     193             :     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     194             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     195             :     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     196             :     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     197             : 
     198             :     //XTextContent
     199             :     virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
     200             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(  ) throw(::com::sun::star::uno::RuntimeException);
     201             : 
     202             :     //XComponent
     203             :     virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
     204             :     virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
     205             :     virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
     206             : 
     207             :     //XUnoTunnel
     208             :     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
     209             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     210             : 
     211             :     //XServiceInfo
     212             :     virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
     213             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
     214             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
     215             : 
     216             :     //XContentEnumerationAccess
     217             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createContentEnumeration(const rtl::OUString& aServiceName) throw( ::com::sun::star::uno::RuntimeException );
     218             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException );
     219             : 
     220           0 :     void SetRefMark( ::com::sun::star::uno::Reference<
     221             :                         ::com::sun::star::text::XTextContent >  xMark)
     222           0 :     { m_xRefMark = xMark; }
     223             : 
     224           0 :     void SetTOXMark( ::com::sun::star::uno::Reference<
     225             :                         ::com::sun::star::text::XTextContent >  xMark)
     226           0 :     { m_xTOXMark = xMark; }
     227             : 
     228          16 :     void SetBookmark( ::com::sun::star::uno::Reference<
     229             :                         ::com::sun::star::text::XTextContent >  xMark)
     230          16 :     { m_xBookmark = xMark; }
     231             : 
     232           3 :     void SetFootnote( ::com::sun::star::uno::Reference<
     233             :                         ::com::sun::star::text::XFootnote > xNote)
     234           3 :     { m_xFootnote = xNote; }
     235             : 
     236          17 :     void SetTextField( ::com::sun::star::uno::Reference<
     237             :                         ::com::sun::star::text::XTextField> xField)
     238          17 :     { m_xTextField = xField; }
     239             : 
     240           0 :     void SetMeta( ::com::sun::star::uno::Reference<
     241             :                         ::com::sun::star::text::XTextContent >  xMeta)
     242           0 :     { m_xMeta = xMeta; }
     243             : 
     244             :     bool IsCollapsed() const { return m_bIsCollapsed; }
     245          33 :     void SetCollapsed(bool bSet)        { m_bIsCollapsed = bSet;}
     246             : 
     247           0 :     SwTextPortionType GetTextPortionType() const { return m_ePortionType; }
     248             : 
     249         852 :     SwUnoCrsr* GetCursor() const
     250         852 :     {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
     251             : };
     252             : 
     253             : class SwXTextPortionEnumeration
     254             :     : public ::cppu::WeakImplHelper3
     255             :         < ::com::sun::star::container::XEnumeration
     256             :         , ::com::sun::star::lang::XServiceInfo
     257             :         , ::com::sun::star::lang::XUnoTunnel
     258             :         >
     259             :    , public SwClient
     260             : {
     261             :     TextRangeList_t m_Portions; // contains all portions, filled by ctor
     262             : 
     263         202 :     SwUnoCrsr*          GetCursor() const
     264         202 :     {return static_cast<SwUnoCrsr*>(const_cast<SwModify*>(GetRegisteredIn()));}
     265             : 
     266             : protected:
     267             :     virtual ~SwXTextPortionEnumeration();
     268             : 
     269             : public:
     270             :     SwXTextPortionEnumeration(SwPaM& rParaCrsr,
     271             :             ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
     272             :                 const & xParent,
     273             :             const sal_Int32 nStart, const sal_Int32 nEnd );
     274             : 
     275             :     SwXTextPortionEnumeration(SwPaM& rParaCrsr,
     276             :         TextRangeList_t const & rPortions );
     277             : 
     278             : 
     279             :     static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
     280             : 
     281             :     //XUnoTunnel
     282             :     virtual sal_Int64 SAL_CALL getSomething(
     283             :             const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
     284             :         throw(::com::sun::star::uno::RuntimeException);
     285             : 
     286             :     //XEnumeration
     287             :     virtual sal_Bool SAL_CALL hasMoreElements()
     288             :         throw( ::com::sun::star::uno::RuntimeException );
     289             :     virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
     290             :         throw( ::com::sun::star::container::NoSuchElementException,
     291             :                ::com::sun::star::lang::WrappedTargetException,
     292             :                ::com::sun::star::uno::RuntimeException );
     293             : 
     294             :     //XServiceInfo
     295             :     virtual rtl::OUString SAL_CALL getImplementationName()
     296             :         throw( ::com::sun::star::uno::RuntimeException );
     297             :     virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
     298             :         throw( ::com::sun::star::uno::RuntimeException );
     299             :     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
     300             :         getSupportedServiceNames()
     301             :         throw( ::com::sun::star::uno::RuntimeException );
     302             : protected:
     303             :     //SwClient
     304             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
     305             : };
     306             : 
     307             : #endif
     308             : 
     309             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10