LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoparagraph.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 259 518 50.0 %
Date: 2012-08-25 Functions: 39 64 60.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 238 892 26.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <unoparagraph.hxx>
      30                 :            : #include <cmdid.h>
      31                 :            : #include <unomid.h>
      32                 :            : #include <unoparaframeenum.hxx>
      33                 :            : #include <unotext.hxx>
      34                 :            : #include <unotextrange.hxx>
      35                 :            : #include <unoport.hxx>
      36                 :            : #include <unomap.hxx>
      37                 :            : #include <unocrsr.hxx>
      38                 :            : #include <unoprnms.hxx>
      39                 :            : #include <unocrsrhelper.hxx>
      40                 :            : #include <doc.hxx>
      41                 :            : #include <ndtxt.hxx>
      42                 :            : #include <osl/mutex.hxx>
      43                 :            : #include <vcl/svapp.hxx>
      44                 :            : #include <docsh.hxx>
      45                 :            : 
      46                 :            : 
      47                 :            : #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
      48                 :            : #include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
      49                 :            : #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
      50                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      51                 :            : #include <com/sun/star/text/WrapTextMode.hpp>
      52                 :            : #include <com/sun/star/text/TextContentAnchorType.hpp>
      53                 :            : #include <comphelper/servicehelper.hxx>
      54                 :            : 
      55                 :            : 
      56                 :            : using namespace ::com::sun::star;
      57                 :            : using ::rtl::OUString;
      58                 :            : 
      59                 :            : class SwParaSelection
      60                 :            : {
      61                 :            :     SwCursor & m_rCursor;
      62                 :            : public:
      63                 :            :     SwParaSelection(SwCursor & rCursor);
      64                 :            :     ~SwParaSelection();
      65                 :            : };
      66                 :            : 
      67                 :       1806 : SwParaSelection::SwParaSelection(SwCursor & rCursor)
      68                 :       1806 :     : m_rCursor(rCursor)
      69                 :            : {
      70         [ -  + ]:       1806 :     if (m_rCursor.HasMark())
      71                 :            :     {
      72                 :          0 :         m_rCursor.DeleteMark();
      73                 :            :     }
      74                 :            :     // is it at the start?
      75         [ -  + ]:       1806 :     if (m_rCursor.GetPoint()->nContent != 0)
      76                 :            :     {
      77                 :          0 :         m_rCursor.MovePara(fnParaCurr, fnParaStart);
      78                 :            :     }
      79                 :            :     // or at the end already?
      80         [ +  + ]:       1806 :     if (m_rCursor.GetPoint()->nContent != m_rCursor.GetCntntNode()->Len())
      81                 :            :     {
      82                 :       1272 :         m_rCursor.SetMark();
      83                 :       1272 :         m_rCursor.MovePara(fnParaCurr, fnParaEnd);
      84                 :            :     }
      85                 :       1806 : }
      86                 :            : 
      87                 :       1806 : SwParaSelection::~SwParaSelection()
      88                 :            : {
      89         [ +  + ]:       1806 :     if (m_rCursor.GetPoint()->nContent != 0)
      90                 :            :     {
      91                 :       1272 :         m_rCursor.DeleteMark();
      92                 :       1272 :         m_rCursor.MovePara(fnParaCurr, fnParaStart);
      93                 :            :     }
      94                 :       1806 : }
      95                 :            : 
      96                 :            : /******************************************************************
      97                 :            :  * forward declarations
      98                 :            :  ******************************************************************/
      99                 :            : beans::PropertyState lcl_SwXParagraph_getPropertyState(
     100                 :            :                             const SwTxtNode& rTxtNode,
     101                 :            :                             const SwAttrSet** ppSet,
     102                 :            :                             const SfxItemPropertySimpleEntry& rEntry,
     103                 :            :                             sal_Bool &rAttrSetFetched )
     104                 :            :     throw (beans::UnknownPropertyException);
     105                 :            : 
     106                 :            : /******************************************************************
     107                 :            :  * SwXParagraph
     108                 :            :  ******************************************************************/
     109 [ +  - ][ -  + ]:       7864 : class SwXParagraph::Impl
     110                 :            :     : public SwClient
     111                 :            : {
     112                 :            : 
     113                 :            : public:
     114                 :            :     SwXParagraph &              m_rThis;
     115                 :            :     SwEventListenerContainer    m_ListenerContainer;
     116                 :            :     SfxItemPropertySet const&   m_rPropSet;
     117                 :            :     bool                        m_bIsDescriptor;
     118                 :            :     sal_Int32                   m_nSelectionStartPos;
     119                 :            :     sal_Int32                   m_nSelectionEndPos;
     120                 :            :     ::rtl::OUString             m_sText;
     121                 :            :     uno::Reference<text::XText> m_xParentText;
     122                 :            : 
     123                 :       3932 :     Impl(   SwXParagraph & rThis,
     124                 :            :             SwTxtNode *const pTxtNode = 0,
     125                 :            :             uno::Reference< text::XText > const & xParent = 0,
     126                 :            :             const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
     127                 :            :         : SwClient(pTxtNode)
     128                 :            :         , m_rThis(rThis)
     129                 :            :         , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
     130         [ +  - ]:       3932 :         , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
     131                 :            :         // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
     132                 :            :         , m_bIsDescriptor((0 == pTxtNode) ? true : false)
     133                 :            :         , m_nSelectionStartPos(nSelStart)
     134                 :            :         , m_nSelectionEndPos(nSelEnd)
     135         [ +  - ]:       7864 :         , m_xParentText(xParent)
     136                 :            :     {
     137                 :       3932 :     }
     138                 :            : 
     139                 :            :     const SwTxtNode * GetTxtNode() const {
     140                 :            :         return static_cast<const SwTxtNode*>(GetRegisteredIn());
     141                 :            :     }
     142                 :       4231 :           SwTxtNode * GetTxtNode()       {
     143                 :       4231 :         return static_cast<SwTxtNode*>(GetRegisteredInNonConst());
     144                 :            :     }
     145                 :            : 
     146                 :       3084 :     SwTxtNode & GetTxtNodeOrThrow() {
     147                 :       3084 :         SwTxtNode *const pTxtNode( GetTxtNode() );
     148         [ -  + ]:       3084 :         if (!pTxtNode) {
     149                 :            :             throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
     150 [ #  # ][ #  # ]:          0 :                     "SwXParagraph: disposed or invalid")), 0);
                 [ #  # ]
     151                 :            :         }
     152                 :       3084 :         return *pTxtNode;
     153                 :            :     }
     154                 :            : 
     155                 :         20 :     bool IsDescriptor() const { return m_bIsDescriptor; }
     156                 :            : 
     157                 :            :     void SetPropertyValues_Impl(
     158                 :            :             const uno::Sequence< ::rtl::OUString >& rPropertyNames,
     159                 :            :             const uno::Sequence< uno::Any >& rValues)
     160                 :            :         throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     161                 :            :                 lang::IllegalArgumentException, lang::WrappedTargetException,
     162                 :            :                 uno::RuntimeException);
     163                 :            : 
     164                 :            :     uno::Sequence< uno::Any >
     165                 :            :         GetPropertyValues_Impl(
     166                 :            :             const uno::Sequence< ::rtl::OUString >& rPropertyNames)
     167                 :            :         throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     168                 :            :                 uno::RuntimeException);
     169                 :            : 
     170                 :            :     uno::Sequence< beans::GetDirectPropertyTolerantResult >
     171                 :            :         GetPropertyValuesTolerant_Impl(
     172                 :            :             const uno::Sequence< ::rtl::OUString >& rPropertyNames,
     173                 :            :             bool bDirectValuesOnly)
     174                 :            :         throw (uno::RuntimeException);
     175                 :            : protected:
     176                 :            :     // SwClient
     177                 :            :     virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew);
     178                 :            : 
     179                 :            : };
     180                 :            : 
     181                 :       3639 : void SwXParagraph::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNew )
     182                 :            : {
     183                 :       3639 :     ClientModify(this, pOld, pNew);
     184         [ +  + ]:       3639 :     if (!GetRegisteredIn())
     185                 :            :     {
     186                 :        859 :         m_ListenerContainer.Disposing();
     187                 :            :     }
     188                 :       3639 : }
     189                 :            : 
     190                 :         30 : SwXParagraph::SwXParagraph()
     191 [ +  - ][ +  - ]:         30 :     : m_pImpl( new SwXParagraph::Impl(*this) )
                 [ +  - ]
     192                 :            : {
     193                 :         30 : }
     194                 :            : 
     195                 :       3902 : SwXParagraph::SwXParagraph(
     196                 :            :         uno::Reference< text::XText > const & xParent,
     197                 :            :         SwTxtNode & rTxtNode,
     198                 :            :         const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
     199                 :            :     : m_pImpl(
     200 [ +  - ][ +  - ]:       3902 :         new SwXParagraph::Impl(*this, &rTxtNode, xParent, nSelStart, nSelEnd))
     201                 :            : {
     202                 :       3902 : }
     203                 :            : 
     204         [ +  - ]:       3932 : SwXParagraph::~SwXParagraph()
     205                 :            : {
     206         [ -  + ]:       7864 : }
     207                 :            : 
     208                 :         97 : const SwTxtNode * SwXParagraph::GetTxtNode() const
     209                 :            : {
     210                 :         97 :     return m_pImpl->GetTxtNode();
     211                 :            : }
     212                 :            : 
     213                 :         20 : bool SwXParagraph::IsDescriptor() const
     214                 :            : {
     215                 :         20 :     return m_pImpl->IsDescriptor();
     216                 :            : }
     217                 :            : 
     218                 :            : uno::Reference<text::XTextContent>
     219                 :       4635 : SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode,
     220                 :            :         uno::Reference< text::XText> const& i_xParent,
     221                 :            :         const sal_Int32 nSelStart, const sal_Int32 nSelEnd)
     222                 :            : {
     223                 :            :     // re-use existing SwXParagraph
     224                 :            :     // #i105557#: do not iterate over the registered clients: race condition
     225                 :       4635 :     uno::Reference<text::XTextContent> xParagraph;
     226 [ +  - ][ +  + ]:       4635 :     if ((-1 == nSelStart) && (-1 == nSelEnd)) // only use cache if no selection!
     227                 :            :     {
     228 [ +  - ][ +  - ]:       4191 :         xParagraph.set(rTxtNode.GetXParagraph());
     229                 :            :     }
     230         [ +  + ]:       4635 :     if (xParagraph.is())
     231                 :            :     {
     232                 :            :         return xParagraph;
     233                 :            :     }
     234                 :            : 
     235                 :            :     // create new SwXParagraph
     236                 :       3902 :     uno::Reference<text::XText> xParentText(i_xParent);
     237         [ -  + ]:       3902 :     if (!xParentText.is())
     238                 :            :     {
     239         [ #  # ]:          0 :         SwPosition Pos( rTxtNode );
     240 [ #  # ][ #  # ]:          0 :         xParentText.set(::sw::CreateParentXText( rDoc, Pos ));
                 [ #  # ]
     241                 :            :     }
     242                 :            :     SwXParagraph *const pXPara(
     243         [ +  - ]:       3902 :             new SwXParagraph(xParentText, rTxtNode, nSelStart, nSelEnd) );
     244                 :            :     // this is why the constructor is private: need to acquire pXPara here
     245 [ +  - ][ +  - ]:       3902 :     xParagraph.set(pXPara);
     246                 :            :     // in order to initialize the weak pointer cache in the core object
     247 [ +  + ][ +  - ]:       3902 :     if ((-1 == nSelStart) && (-1 == nSelEnd))
     248                 :            :     {
     249         [ +  - ]:       3458 :         rTxtNode.SetXParagraph(xParagraph);
     250                 :            :     }
     251                 :       4635 :     return xParagraph;
     252                 :            : }
     253                 :            : 
     254                 :          0 : bool SwXParagraph::SelectPaM(SwPaM & rPaM)
     255                 :            : {
     256                 :          0 :     SwTxtNode const*const pTxtNode( GetTxtNode() );
     257                 :            : 
     258         [ #  # ]:          0 :     if (!pTxtNode)
     259                 :            :     {
     260                 :          0 :         return false;
     261                 :            :     }
     262                 :            : 
     263         [ #  # ]:          0 :     *rPaM.GetPoint() = SwPosition( *pTxtNode );
     264                 :            :     // set selection to the whole paragraph
     265                 :          0 :     rPaM.SetMark();
     266                 :          0 :     rPaM.GetMark()->nContent = pTxtNode->GetTxt().Len();
     267                 :          0 :     return true;
     268                 :            : }
     269                 :            : 
     270                 :            : namespace
     271                 :            : {
     272                 :            :     class theSwXParagraphUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXParagraphUnoTunnelId > {};
     273                 :            : }
     274                 :            : 
     275                 :      16612 : const uno::Sequence< sal_Int8 > & SwXParagraph::getUnoTunnelId()
     276                 :            : {
     277                 :      16612 :     return theSwXParagraphUnoTunnelId::get().getSeq();
     278                 :            : }
     279                 :            : 
     280                 :            : sal_Int64 SAL_CALL
     281                 :         20 : SwXParagraph::getSomething(const uno::Sequence< sal_Int8 >& rId)
     282                 :            : throw (uno::RuntimeException)
     283                 :            : {
     284                 :         20 :     return ::sw::UnoTunnelImpl<SwXParagraph>(rId, this);
     285                 :            : }
     286                 :            : 
     287                 :            : OUString SAL_CALL
     288                 :          0 : SwXParagraph::getImplementationName() throw (uno::RuntimeException)
     289                 :            : {
     290                 :          0 :     return C2U("SwXParagraph");
     291                 :            : }
     292                 :            : 
     293                 :            : static char const*const g_ServicesParagraph[] =
     294                 :            : {
     295                 :            :     "com.sun.star.text.TextContent",
     296                 :            :     "com.sun.star.text.Paragraph",
     297                 :            :     "com.sun.star.style.CharacterProperties",
     298                 :            :     "com.sun.star.style.CharacterPropertiesAsian",
     299                 :            :     "com.sun.star.style.CharacterPropertiesComplex",
     300                 :            :     "com.sun.star.style.ParagraphProperties",
     301                 :            :     "com.sun.star.style.ParagraphPropertiesAsian",
     302                 :            :     "com.sun.star.style.ParagraphPropertiesComplex",
     303                 :            : };
     304                 :            : 
     305                 :            : static const size_t g_nServicesParagraph(
     306                 :            :     sizeof(g_ServicesParagraph)/sizeof(g_ServicesParagraph[0]));
     307                 :            : 
     308                 :            : sal_Bool SAL_CALL
     309                 :        447 : SwXParagraph::supportsService(const OUString& rServiceName)
     310                 :            : throw (uno::RuntimeException)
     311                 :            : {
     312                 :            :     return ::sw::SupportsServiceImpl(
     313                 :        447 :             g_nServicesParagraph, g_ServicesParagraph, rServiceName);
     314                 :            : }
     315                 :            : 
     316                 :            : uno::Sequence< OUString > SAL_CALL
     317                 :          0 : SwXParagraph::getSupportedServiceNames() throw (uno::RuntimeException)
     318                 :            : {
     319                 :            :     return ::sw::GetSupportedServiceNamesImpl(
     320                 :          0 :             g_nServicesParagraph, g_ServicesParagraph);
     321                 :            : }
     322                 :            : 
     323                 :            : void
     324                 :         20 : SwXParagraph::attachToText(SwXText & rParent, SwTxtNode & rTxtNode)
     325                 :            : {
     326                 :            :     OSL_ENSURE(m_pImpl->m_bIsDescriptor, "Paragraph is not a descriptor");
     327         [ +  - ]:         20 :     if (m_pImpl->m_bIsDescriptor)
     328                 :            :     {
     329                 :         20 :         m_pImpl->m_bIsDescriptor = false;
     330                 :         20 :         rTxtNode.Add(m_pImpl.get());
     331         [ +  - ]:         20 :         rTxtNode.SetXParagraph(uno::Reference<text::XTextContent>(this));
     332                 :         20 :         m_pImpl->m_xParentText = &rParent;
     333         [ -  + ]:         20 :         if (!m_pImpl->m_sText.isEmpty())
     334                 :            :         {
     335         [ #  # ]:          0 :             try { setString(m_pImpl->m_sText); }
     336                 :          0 :             catch(...){}
     337                 :          0 :             m_pImpl->m_sText = OUString();
     338                 :            :         }
     339                 :            :     }
     340                 :         20 : }
     341                 :            : 
     342                 :            : uno::Reference< beans::XPropertySetInfo > SAL_CALL
     343                 :        375 : SwXParagraph::getPropertySetInfo()
     344                 :            : throw (uno::RuntimeException)
     345                 :            : {
     346         [ +  - ]:        375 :     SolarMutexGuard g;
     347                 :            : 
     348                 :            :     static uno::Reference< beans::XPropertySetInfo > xRef =
     349 [ +  + ][ +  - ]:        375 :         m_pImpl->m_rPropSet.getPropertySetInfo();
         [ +  - ][ #  # ]
     350         [ +  - ]:        375 :     return xRef;
     351                 :            : }
     352                 :            : 
     353                 :            : void SAL_CALL
     354                 :        459 : SwXParagraph::setPropertyValue(const OUString& rPropertyName,
     355                 :            :         const uno::Any& rValue)
     356                 :            : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     357                 :            :     lang::IllegalArgumentException, lang::WrappedTargetException,
     358                 :            :     uno::RuntimeException )
     359                 :            : {
     360         [ +  - ]:        459 :     SolarMutexGuard aGuard;
     361         [ +  - ]:        459 :     uno::Sequence<OUString> aPropertyNames(1);
     362         [ +  - ]:        459 :     aPropertyNames.getArray()[0] = rPropertyName;
     363         [ +  - ]:        459 :     uno::Sequence<uno::Any> aValues(1);
     364         [ +  - ]:        459 :     aValues.getArray()[0] = rValue;
     365 [ +  - ][ +  - ]:        459 :     m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues );
         [ +  - ][ +  - ]
     366                 :        459 : }
     367                 :            : 
     368                 :            : uno::Any
     369                 :        429 : SwXParagraph::getPropertyValue(const OUString& rPropertyName)
     370                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     371                 :            :     uno::RuntimeException )
     372                 :            : {
     373         [ +  - ]:        429 :     SolarMutexGuard aGuard;
     374         [ +  - ]:        429 :     uno::Sequence<OUString> aPropertyNames(1);
     375         [ +  - ]:        429 :     aPropertyNames.getArray()[0] = rPropertyName;
     376                 :            :     const uno::Sequence< uno::Any > aRet =
     377         [ +  - ]:        429 :         m_pImpl->GetPropertyValues_Impl(aPropertyNames);
     378 [ +  - ][ +  - ]:        429 :     return aRet.getConstArray()[0];
                 [ +  - ]
     379                 :            : }
     380                 :            : 
     381                 :        459 : void SwXParagraph::Impl::SetPropertyValues_Impl(
     382                 :            :     const uno::Sequence< OUString >& rPropertyNames,
     383                 :            :     const uno::Sequence< uno::Any >& rValues )
     384                 :            : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     385                 :            :     lang::IllegalArgumentException, lang::WrappedTargetException,
     386                 :            :     uno::RuntimeException)
     387                 :            : {
     388         [ +  - ]:        459 :     SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
     389                 :            : 
     390         [ +  - ]:        459 :     SwPosition aPos( rTxtNode );
     391         [ +  - ]:        459 :     SwCursor aCursor( aPos, 0, false );
     392                 :        459 :     const OUString* pPropertyNames = rPropertyNames.getConstArray();
     393                 :        459 :     const uno::Any* pValues = rValues.getConstArray();
     394                 :        459 :     const SfxItemPropertyMap &rMap = m_rPropSet.getPropertyMap();
     395         [ +  - ]:        459 :     SwParaSelection aParaSel( aCursor );
     396         [ +  + ]:        918 :     for (sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
     397                 :            :     {
     398                 :            :         SfxItemPropertySimpleEntry const*const pEntry =
     399         [ +  - ]:        459 :             rMap.getByName( pPropertyNames[nProp] );
     400         [ -  + ]:        459 :         if (!pEntry)
     401                 :            :         {
     402                 :            :             throw beans::UnknownPropertyException(
     403                 :            :                 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
     404                 :          0 :                     + pPropertyNames[nProp],
     405 [ #  # ][ #  # ]:          0 :                 static_cast< cppu::OWeakObject * >(&m_rThis));
                 [ #  # ]
     406                 :            :         }
     407         [ -  + ]:        459 :         if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     408                 :            :         {
     409                 :            :             throw beans::PropertyVetoException(
     410                 :            :                 OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
     411                 :          0 :                     + pPropertyNames[nProp],
     412 [ #  # ][ #  # ]:          0 :                 static_cast< cppu::OWeakObject * >(&m_rThis));
                 [ #  # ]
     413                 :            :         }
     414                 :            :         SwUnoCursorHelper::SetPropertyValue(aCursor, m_rPropSet,
     415         [ +  - ]:        459 :                 pPropertyNames[nProp], pValues[nProp]);
     416 [ +  - ][ +  - ]:        459 :     }
                 [ +  - ]
     417                 :        459 : }
     418                 :            : 
     419                 :          0 : void SAL_CALL SwXParagraph::setPropertyValues(
     420                 :            :     const uno::Sequence< OUString >& rPropertyNames,
     421                 :            :     const uno::Sequence< uno::Any >& rValues )
     422                 :            : throw (beans::PropertyVetoException, lang::IllegalArgumentException,
     423                 :            :     lang::WrappedTargetException, uno::RuntimeException)
     424                 :            : {
     425         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     426                 :            : 
     427                 :            :     // workaround for bad designed API
     428                 :            :     try
     429                 :            :     {
     430         [ #  # ]:          0 :         m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues );
     431                 :            :     }
     432         [ #  # ]:          0 :     catch (const beans::UnknownPropertyException &rException)
     433                 :            :     {
     434                 :            :         // wrap the original (here not allowed) exception in
     435                 :            :         // a lang::WrappedTargetException that gets thrown instead.
     436         [ #  # ]:          0 :         lang::WrappedTargetException aWExc;
     437         [ #  # ]:          0 :         aWExc.TargetException <<= rException;
     438         [ #  # ]:          0 :         throw aWExc;
     439         [ #  # ]:          0 :     }
     440                 :          0 : }
     441                 :            : 
     442                 :        606 : uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl(
     443                 :            :         const uno::Sequence< OUString > & rPropertyNames )
     444                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     445                 :            :     uno::RuntimeException)
     446                 :            : {
     447         [ +  - ]:        606 :     SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
     448                 :            : 
     449         [ +  - ]:        606 :     uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
     450         [ +  - ]:        606 :     SwPosition aPos( rTxtNode );
     451         [ +  - ]:        606 :     SwPaM aPam( aPos );
     452         [ +  - ]:        606 :     uno::Any* pValues = aValues.getArray();
     453                 :        606 :     const OUString* pPropertyNames = rPropertyNames.getConstArray();
     454                 :        606 :     const SfxItemPropertyMap &rMap = m_rPropSet.getPropertyMap();
     455         [ +  - ]:        606 :     const SwAttrSet& rAttrSet( rTxtNode.GetSwAttrSet() );
     456         [ +  + ]:       2097 :     for (sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
     457                 :            :     {
     458                 :            :         SfxItemPropertySimpleEntry const*const pEntry =
     459         [ +  - ]:       1491 :             rMap.getByName( pPropertyNames[nProp] );
     460         [ -  + ]:       1491 :         if (!pEntry)
     461                 :            :         {
     462                 :            :             throw beans::UnknownPropertyException(
     463                 :            :                 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
     464                 :          0 :                     + pPropertyNames[nProp],
     465 [ #  # ][ #  # ]:          0 :                 static_cast< cppu::OWeakObject * >(&m_rThis));
                 [ #  # ]
     466                 :            :         }
     467         [ +  - ]:       1491 :         if (! ::sw::GetDefaultTextContentValue(
     468         [ +  - ]:       1491 :                 pValues[nProp], pPropertyNames[nProp], pEntry->nWID))
     469                 :            :         {
     470                 :            :             beans::PropertyState eTemp;
     471                 :            :             const bool bDone = SwUnoCursorHelper::getCrsrPropertyValue(
     472         [ +  - ]:       1491 :                 *pEntry, aPam, &(pValues[nProp]), eTemp, &rTxtNode );
     473         [ +  + ]:       1491 :             if (!bDone)
     474                 :            :             {
     475                 :            :                 m_rPropSet.getPropertyValue(
     476         [ +  - ]:       1491 :                     *pEntry, rAttrSet, pValues[nProp]);
     477                 :            :             }
     478                 :            :         }
     479                 :            :     }
     480 [ +  - ][ +  - ]:        606 :     return aValues;
     481                 :            : }
     482                 :            : 
     483                 :            : uno::Sequence< uno::Any > SAL_CALL
     484                 :        177 : SwXParagraph::getPropertyValues(const uno::Sequence< OUString >& rPropertyNames)
     485                 :            : throw (uno::RuntimeException)
     486                 :            : {
     487         [ +  - ]:        177 :     SolarMutexGuard aGuard;
     488         [ +  - ]:        177 :     uno::Sequence< uno::Any > aValues;
     489                 :            : 
     490                 :            :     // workaround for bad designed API
     491                 :            :     try
     492                 :            :     {
     493 [ +  - ][ +  - ]:        177 :         aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames );
                 [ +  - ]
     494                 :            :     }
     495                 :          0 :     catch (beans::UnknownPropertyException &)
     496                 :            :     {
     497                 :            :         throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
     498                 :            :                 "Unknown property exception caught")),
     499   [ #  #  #  #  :          0 :             static_cast<cppu::OWeakObject *>(this));
                   #  # ]
     500                 :            :     }
     501      [ #  #  # ]:          0 :     catch (lang::WrappedTargetException &)
     502                 :            :     {
     503                 :            :         throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
     504                 :            :                 "WrappedTargetException caught")),
     505   [ #  #  #  #  :          0 :             static_cast<cppu::OWeakObject *>(this));
                   #  # ]
     506                 :            :     }
     507                 :            : 
     508         [ +  - ]:        177 :     return aValues;
     509                 :            : }
     510                 :            : 
     511                 :          0 : void SAL_CALL SwXParagraph::addPropertiesChangeListener(
     512                 :            :     const uno::Sequence< OUString >& /*aPropertyNames*/,
     513                 :            :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
     514                 :            : throw (uno::RuntimeException)
     515                 :            : {
     516                 :            :     OSL_FAIL("SwXParagraph::addPropertiesChangeListener(): not implemented");
     517                 :          0 : }
     518                 :            : 
     519                 :          0 : void SAL_CALL SwXParagraph::removePropertiesChangeListener(
     520                 :            :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
     521                 :            : throw (uno::RuntimeException)
     522                 :            : {
     523                 :            :     OSL_FAIL("SwXParagraph::removePropertiesChangeListener(): not implemented");
     524                 :          0 : }
     525                 :            : 
     526                 :          0 : void SAL_CALL SwXParagraph::firePropertiesChangeEvent(
     527                 :            :     const uno::Sequence< OUString >& /*aPropertyNames*/,
     528                 :            :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
     529                 :            :         throw(uno::RuntimeException)
     530                 :            : {
     531                 :            :     OSL_FAIL("SwXParagraph::firePropertiesChangeEvent(): not implemented");
     532                 :          0 : }
     533                 :            : 
     534                 :            : /* disabled for #i46921# */
     535                 :            : 
     536                 :            : uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL
     537                 :          0 : SwXParagraph::setPropertyValuesTolerant(
     538                 :            :         const uno::Sequence< OUString >& rPropertyNames,
     539                 :            :         const uno::Sequence< uno::Any >& rValues )
     540                 :            : throw (lang::IllegalArgumentException, uno::RuntimeException)
     541                 :            : {
     542         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     543                 :            : 
     544         [ #  # ]:          0 :     if (rPropertyNames.getLength() != rValues.getLength())
     545                 :            :     {
     546 [ #  # ][ #  #  :          0 :         throw lang::IllegalArgumentException();
                #  #  # ]
     547                 :            :     }
     548                 :            : 
     549         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
     550                 :            : 
     551                 :            :     //SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode();
     552                 :            :     //const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet();
     553                 :            :     //sal_uInt16 nAttrCount = rAttrSet.Count();
     554                 :            : 
     555                 :          0 :     const sal_Int32 nProps = rPropertyNames.getLength();
     556                 :          0 :     const OUString *pProp = rPropertyNames.getConstArray();
     557                 :            : 
     558                 :            :     //sal_Int32 nVals = rValues.getLength();
     559                 :          0 :     const uno::Any *pValue = rValues.getConstArray();
     560                 :            : 
     561                 :          0 :     sal_Int32 nFailed = 0;
     562         [ #  # ]:          0 :     uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
     563         [ #  # ]:          0 :     beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
     564                 :            : 
     565                 :            :     // get entry to start with
     566                 :            :     const SfxItemPropertyMap &rPropMap =
     567                 :          0 :         m_pImpl->m_rPropSet.getPropertyMap();
     568                 :            : 
     569         [ #  # ]:          0 :     SwPosition aPos( rTxtNode );
     570         [ #  # ]:          0 :     SwCursor aCursor( aPos, 0, false );
     571         [ #  # ]:          0 :     SwParaSelection aParaSel( aCursor );
     572         [ #  # ]:          0 :     for (sal_Int32 i = 0;  i < nProps;  ++i)
     573                 :            :     {
     574                 :            :         try
     575                 :            :         {
     576                 :          0 :             pFailed[ nFailed ].Name = pProp[i];
     577                 :            : 
     578                 :            :             SfxItemPropertySimpleEntry const*const pEntry =
     579         [ #  # ]:          0 :                 rPropMap.getByName( pProp[i] );
     580         [ #  # ]:          0 :             if (!pEntry)
     581                 :            :             {
     582                 :          0 :                 pFailed[ nFailed++ ].Result  =
     583                 :          0 :                     beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
     584                 :            :             }
     585                 :            :             else
     586                 :            :             {
     587                 :            :                 // set property value
     588                 :            :                 // (compare to SwXParagraph::setPropertyValues)
     589         [ #  # ]:          0 :                 if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     590                 :            :                 {
     591                 :          0 :                     pFailed[ nFailed++ ].Result  =
     592                 :          0 :                         beans::TolerantPropertySetResultType::PROPERTY_VETO;
     593                 :            :                 }
     594                 :            :                 else
     595                 :            :                 {
     596                 :            :                     SwUnoCursorHelper::SetPropertyValue(
     597         [ #  # ]:          0 :                         aCursor, m_pImpl->m_rPropSet, pProp[i], pValue[i]);
     598                 :            :                 }
     599                 :            :             }
     600                 :            :         }
     601         [ #  # ]:          0 :         catch (beans::UnknownPropertyException &)
     602                 :            :         {
     603                 :            :             // should not occur because property was searched for before
     604                 :            :             OSL_FAIL( "unexpected exception caught" );
     605                 :          0 :             pFailed[ nFailed++ ].Result =
     606                 :          0 :                 beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
     607                 :            :         }
     608         [ #  # ]:          0 :         catch (lang::IllegalArgumentException &)
     609                 :            :         {
     610                 :          0 :             pFailed[ nFailed++ ].Result =
     611                 :          0 :                 beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
     612                 :            :         }
     613         [ #  # ]:          0 :         catch (beans::PropertyVetoException &)
     614                 :            :         {
     615                 :          0 :             pFailed[ nFailed++ ].Result =
     616                 :          0 :                 beans::TolerantPropertySetResultType::PROPERTY_VETO;
     617                 :            :         }
     618         [ #  # ]:          0 :         catch (lang::WrappedTargetException &)
     619                 :            :         {
     620                 :          0 :             pFailed[ nFailed++ ].Result =
     621                 :          0 :                 beans::TolerantPropertySetResultType::WRAPPED_TARGET;
     622                 :            :         }
     623                 :            :     }
     624                 :            : 
     625         [ #  # ]:          0 :     aFailed.realloc( nFailed );
     626 [ #  # ][ #  # ]:          0 :     return aFailed;
         [ #  # ][ #  # ]
     627                 :            : }
     628                 :            : 
     629                 :            : uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL
     630                 :          0 : SwXParagraph::getPropertyValuesTolerant(
     631                 :            :         const uno::Sequence< OUString >& rPropertyNames )
     632                 :            : throw (uno::RuntimeException)
     633                 :            : {
     634         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     635                 :            : 
     636                 :            :     uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
     637         [ #  # ]:          0 :         m_pImpl->GetPropertyValuesTolerant_Impl( rPropertyNames, false ) );
     638                 :            :     const beans::GetDirectPropertyTolerantResult *pTmpRes =
     639                 :          0 :         aTmpRes.getConstArray();
     640                 :            : 
     641                 :            :     // copy temporary result to final result type
     642                 :          0 :     const sal_Int32 nLen = aTmpRes.getLength();
     643         [ #  # ]:          0 :     uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
     644         [ #  # ]:          0 :     beans::GetPropertyTolerantResult *pRes = aRes.getArray();
     645         [ #  # ]:          0 :     for (sal_Int32 i = 0;  i < nLen;  i++)
     646                 :            :     {
     647                 :          0 :         *pRes++ = *pTmpRes++;
     648                 :            :     }
     649 [ #  # ][ #  # ]:          0 :     return aRes;
     650                 :            : }
     651                 :            : 
     652                 :            : uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL
     653                 :        177 : SwXParagraph::getDirectPropertyValuesTolerant(
     654                 :            :         const uno::Sequence< OUString >& rPropertyNames )
     655                 :            : throw (uno::RuntimeException)
     656                 :            : {
     657         [ +  - ]:        177 :     SolarMutexGuard aGuard;
     658                 :            : 
     659 [ +  - ][ +  - ]:        177 :     return m_pImpl->GetPropertyValuesTolerant_Impl( rPropertyNames, true );
     660                 :            : }
     661                 :            : 
     662                 :            : uno::Sequence< beans::GetDirectPropertyTolerantResult >
     663                 :        177 : SwXParagraph::Impl::GetPropertyValuesTolerant_Impl(
     664                 :            :         const uno::Sequence< OUString >& rPropertyNames,
     665                 :            :         bool bDirectValuesOnly )
     666                 :            : throw (uno::RuntimeException)
     667                 :            : {
     668         [ +  - ]:        177 :     SolarMutexGuard aGuard;
     669                 :            : 
     670         [ +  - ]:        177 :     SwTxtNode & rTxtNode(GetTxtNodeOrThrow());
     671                 :            : 
     672                 :            :     // #i46786# Use SwAttrSet pointer for determining the state.
     673                 :            :     //          Use the value SwAttrSet (from the paragraph OR the style)
     674                 :            :     //          for determining the actual value(s).
     675         [ +  - ]:        177 :     const SwAttrSet* pAttrSet = rTxtNode.GetpSwAttrSet();
     676         [ +  - ]:        177 :     const SwAttrSet& rValueAttrSet = rTxtNode.GetSwAttrSet();
     677                 :            : 
     678                 :        177 :     sal_Int32 nProps = rPropertyNames.getLength();
     679                 :        177 :     const OUString *pProp = rPropertyNames.getConstArray();
     680                 :            : 
     681         [ +  - ]:        177 :     uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( nProps );
     682         [ +  - ]:        177 :     beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray();
     683                 :        177 :     sal_Int32 nIdx = 0;
     684                 :            : 
     685                 :            :     // get entry to start with
     686                 :        177 :     const SfxItemPropertyMap &rPropMap = m_rPropSet.getPropertyMap();
     687                 :            : 
     688         [ +  + ]:      19470 :     for (sal_Int32 i = 0;  i < nProps;  ++i)
     689                 :            :     {
     690                 :            :         OSL_ENSURE( nIdx < nProps, "index out ouf bounds" );
     691                 :      19293 :         beans::GetDirectPropertyTolerantResult &rResult = pResult[nIdx];
     692                 :            : 
     693                 :            :         try
     694                 :            :         {
     695                 :      19293 :             rResult.Name = pProp[i];
     696                 :            : 
     697                 :            :             SfxItemPropertySimpleEntry const*const pEntry =
     698         [ +  - ]:      19293 :                 rPropMap.getByName( pProp[i] );
     699         [ -  + ]:      19293 :             if (!pEntry)  // property available?
     700                 :            :             {
     701                 :            :                 rResult.Result =
     702                 :          0 :                     beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
     703                 :            :             }
     704                 :            :             else
     705                 :            :             {
     706                 :            :                 // get property state
     707                 :            :                 // (compare to SwXParagraph::getPropertyState)
     708                 :      19293 :                 sal_Bool bAttrSetFetched = sal_True;
     709                 :            :                 beans::PropertyState eState = lcl_SwXParagraph_getPropertyState(
     710         [ +  - ]:      19293 :                             rTxtNode, &pAttrSet, *pEntry, bAttrSetFetched );
     711                 :      19293 :                 rResult.State  = eState;
     712                 :            : 
     713                 :            : //                if (bDirectValuesOnly  &&  PropertyState_DIRECT_VALUE != eState)
     714                 :            : //                    rResult.Result = beans::TolerantPropertySetResultType::NO_DIRECT_VALUE;
     715                 :            : //                else
     716                 :      19293 :                 rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
     717 [ +  - ][ +  + ]:      19293 :                 if (!bDirectValuesOnly ||
     718                 :            :                     (beans::PropertyState_DIRECT_VALUE == eState))
     719                 :            :                 {
     720                 :            :                     // get property value
     721                 :            :                     // (compare to SwXParagraph::getPropertyValue(s))
     722                 :         76 :                     uno::Any aValue;
     723         [ +  - ]:         76 :                     if (! ::sw::GetDefaultTextContentValue(
     724         [ +  - ]:         76 :                                 aValue, pProp[i], pEntry->nWID ) )
     725                 :            :                     {
     726         [ +  - ]:         76 :                         SwPosition aPos( rTxtNode );
     727         [ +  - ]:         76 :                         SwPaM aPam( aPos );
     728                 :            :                         // handle properties that are not part of the attribute
     729                 :            :                         // and thus only pretendend to be paragraph attributes
     730                 :            :                         beans::PropertyState eTemp;
     731                 :            :                         const bool bDone =
     732                 :            :                             SwUnoCursorHelper::getCrsrPropertyValue(
     733         [ +  - ]:         76 :                                     *pEntry, aPam, &aValue, eTemp, &rTxtNode );
     734                 :            : 
     735                 :            :                         // if not found try the real paragraph attributes...
     736         [ +  - ]:         76 :                         if (!bDone)
     737                 :            :                         {
     738                 :            :                             m_rPropSet.getPropertyValue(
     739         [ +  - ]:         76 :                                 *pEntry, rValueAttrSet, aValue );
     740 [ +  - ][ +  - ]:         76 :                         }
     741                 :            :                     }
     742                 :            : 
     743                 :         76 :                     rResult.Value  = aValue;
     744                 :         76 :                     rResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
     745                 :            : 
     746   [ #  #  #  #  :      19293 :                     nIdx++;
                      # ]
     747                 :            :                 }
     748                 :            :                 // this assertion should never occur!
     749                 :            :                 OSL_ENSURE( nIdx < 1  ||  pResult[nIdx - 1].Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE,
     750                 :            :                         "unknown failure while retrieving property" );
     751                 :            : 
     752                 :            :             }
     753                 :            :         }
     754         [ #  # ]:          0 :         catch (beans::UnknownPropertyException &)
     755                 :            :         {
     756                 :            :             // should not occur because property was searched for before
     757                 :            :             OSL_FAIL( "unexpected exception caught" );
     758                 :          0 :             rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
     759                 :            :         }
     760         [ #  # ]:          0 :         catch (lang::IllegalArgumentException &)
     761                 :            :         {
     762                 :          0 :             rResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
     763                 :            :         }
     764         [ #  # ]:          0 :         catch (beans::PropertyVetoException &)
     765                 :            :         {
     766                 :          0 :             rResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
     767                 :            :         }
     768         [ #  # ]:          0 :         catch (lang::WrappedTargetException &)
     769                 :            :         {
     770                 :          0 :             rResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
     771                 :            :         }
     772                 :            :     }
     773                 :            : 
     774                 :            :     // resize to actually used size
     775         [ +  - ]:        177 :     aResult.realloc( nIdx );
     776                 :            : 
     777         [ +  - ]:        177 :     return aResult;
     778                 :            : }
     779                 :            : 
     780                 :       1728 : bool ::sw::GetDefaultTextContentValue(
     781                 :            :         uno::Any& rAny, const OUString& rPropertyName, sal_uInt16 nWID)
     782                 :            : {
     783         [ +  + ]:       1728 :     if(!nWID)
     784                 :            :     {
     785         [ +  + ]:         23 :         if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
     786                 :          4 :             nWID = FN_UNO_ANCHOR_TYPE;
     787         [ +  + ]:         19 :         else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)))
     788                 :          4 :             nWID = FN_UNO_ANCHOR_TYPES;
     789         [ +  + ]:         15 :         else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
     790                 :          4 :             nWID = FN_UNO_TEXT_WRAP;
     791                 :            :         else
     792                 :         11 :             return sal_False;
     793                 :            :     }
     794                 :            : 
     795   [ +  +  +  + ]:       1717 :     switch(nWID)
     796                 :            :     {
     797         [ +  - ]:         16 :         case FN_UNO_TEXT_WRAP:  rAny <<= text::WrapTextMode_NONE; break;
     798         [ +  - ]:         16 :         case FN_UNO_ANCHOR_TYPE: rAny <<= text::TextContentAnchorType_AT_PARAGRAPH; break;
     799                 :            :         case FN_UNO_ANCHOR_TYPES:
     800         [ +  - ]:         12 :         {   uno::Sequence<text::TextContentAnchorType> aTypes(1);
     801         [ +  - ]:         12 :             text::TextContentAnchorType* pArray = aTypes.getArray();
     802                 :         12 :             pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
     803 [ +  - ][ +  - ]:         12 :             rAny.setValue(&aTypes, ::getCppuType((uno::Sequence<text::TextContentAnchorType>*)0));
     804                 :            :         }
     805                 :         12 :         break;
     806                 :            :         default:
     807                 :       1673 :             return sal_False;
     808                 :            :     }
     809                 :       1728 :     return sal_True;
     810                 :            : }
     811                 :            : 
     812                 :            : void SAL_CALL
     813                 :          0 : SwXParagraph::addPropertyChangeListener(
     814                 :            :         const ::rtl::OUString& /*rPropertyName*/,
     815                 :            :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     816                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     817                 :            :     uno::RuntimeException)
     818                 :            : {
     819                 :            :     OSL_FAIL("SwXParagraph::addPropertyChangeListener(): not implemented");
     820                 :          0 : }
     821                 :            : 
     822                 :            : void SAL_CALL
     823                 :          0 : SwXParagraph::removePropertyChangeListener(
     824                 :            :         const ::rtl::OUString& /*rPropertyName*/,
     825                 :            :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     826                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     827                 :            :     uno::RuntimeException)
     828                 :            : {
     829                 :            :     OSL_FAIL("SwXParagraph::removePropertyChangeListener(): not implemented");
     830                 :          0 : }
     831                 :            : 
     832                 :            : void SAL_CALL
     833                 :          0 : SwXParagraph::addVetoableChangeListener(
     834                 :            :         const ::rtl::OUString& /*rPropertyName*/,
     835                 :            :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     836                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     837                 :            :     uno::RuntimeException)
     838                 :            : {
     839                 :            :     OSL_FAIL("SwXParagraph::addVetoableChangeListener(): not implemented");
     840                 :          0 : }
     841                 :            : 
     842                 :            : void SAL_CALL
     843                 :          0 : SwXParagraph::removeVetoableChangeListener(
     844                 :            :         const ::rtl::OUString& /*rPropertyName*/,
     845                 :            :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     846                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     847                 :            :         uno::RuntimeException)
     848                 :            : {
     849                 :            :     OSL_FAIL("SwXParagraph::removeVetoableChangeListener(): not implemented");
     850                 :          0 : }
     851                 :            : 
     852                 :      19293 : beans::PropertyState lcl_SwXParagraph_getPropertyState(
     853                 :            : //                          SwUnoCrsr& rUnoCrsr,
     854                 :            :                             const SwTxtNode& rTxtNode,
     855                 :            :                             const SwAttrSet** ppSet,
     856                 :            :                             const SfxItemPropertySimpleEntry& rEntry,
     857                 :            :                             sal_Bool &rAttrSetFetched )
     858                 :            : throw (beans::UnknownPropertyException)
     859                 :            : {
     860                 :      19293 :     beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
     861                 :            : 
     862 [ +  + ][ -  + ]:      19293 :     if(!(*ppSet) && !rAttrSetFetched )
     863                 :            :     {
     864         [ #  # ]:          0 :         (*ppSet) = rTxtNode.GetpSwAttrSet();
     865                 :          0 :         rAttrSetFetched = sal_True;
     866                 :            :     }
     867         [ +  - ]:      19293 :     SwPosition aPos( rTxtNode );
     868         [ +  - ]:      19293 :     SwPaM aPam( aPos );
     869   [ -  -  -  -  :      19293 :     switch( rEntry.nWID )
                -  -  + ]
     870                 :            :     {
     871                 :            :     case FN_UNO_NUM_RULES:
     872                 :            :         // if numbering is set, return it; else do nothing
     873         [ #  # ]:          0 :         SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL );
     874                 :          0 :         break;
     875                 :            :     case FN_UNO_ANCHOR_TYPES:
     876                 :          0 :         break;
     877                 :            :     case RES_ANCHOR:
     878         [ #  # ]:          0 :         if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId )
     879                 :          0 :             goto lcl_SwXParagraph_getPropertyStateDEFAULT;
     880                 :          0 :         break;
     881                 :            :     case RES_SURROUND:
     882         [ #  # ]:          0 :         if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId )
     883                 :          0 :             goto lcl_SwXParagraph_getPropertyStateDEFAULT;
     884                 :          0 :         break;
     885                 :            :     case FN_UNO_PARA_STYLE:
     886                 :            :     case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
     887                 :            :         {
     888                 :            :             SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(
     889         [ #  # ]:          0 :                 aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
     890                 :            :             eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
     891         [ #  # ]:          0 :                         : beans::PropertyState_AMBIGUOUS_VALUE;
     892                 :            :         }
     893                 :          0 :         break;
     894                 :            :     case FN_UNO_PAGE_STYLE:
     895                 :            :         {
     896         [ #  # ]:          0 :             String sVal;
     897         [ #  # ]:          0 :             SwUnoCursorHelper::GetCurPageStyle( aPam, sVal );
     898                 :          0 :             eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE
     899 [ #  # ][ #  # ]:          0 :                               : beans::PropertyState_AMBIGUOUS_VALUE;
     900                 :            :         }
     901                 :          0 :         break;
     902                 :            :     lcl_SwXParagraph_getPropertyStateDEFAULT:
     903                 :            :     default:
     904 [ +  + ][ +  - ]:      19293 :         if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, sal_False))
         [ +  + ][ +  + ]
     905                 :         76 :             eRet = beans::PropertyState_DIRECT_VALUE;
     906                 :      19293 :         break;
     907                 :            :     }
     908 [ +  - ][ +  - ]:      19293 :     return eRet;
     909                 :            : }
     910                 :            : 
     911                 :            : beans::PropertyState SAL_CALL
     912                 :          0 : SwXParagraph::getPropertyState(const OUString& rPropertyName)
     913                 :            : throw (beans::UnknownPropertyException, uno::RuntimeException)
     914                 :            : {
     915         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     916                 :            : 
     917         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
     918                 :            : 
     919                 :          0 :     const SwAttrSet* pSet = 0;
     920                 :            :     SfxItemPropertySimpleEntry const*const pEntry =
     921         [ #  # ]:          0 :         m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
     922         [ #  # ]:          0 :     if (!pEntry)
     923                 :            :     {
     924                 :            :         throw beans::UnknownPropertyException(
     925                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
     926                 :            :                 + rPropertyName,
     927 [ #  # ][ #  # ]:          0 :             static_cast<cppu::OWeakObject *>(this));
                 [ #  # ]
     928                 :            :     }
     929                 :          0 :     sal_Bool bDummy = sal_False;
     930                 :            :     const beans::PropertyState eRet =
     931         [ #  # ]:          0 :         lcl_SwXParagraph_getPropertyState(rTxtNode, &pSet, *pEntry, bDummy);
     932         [ #  # ]:          0 :     return eRet;
     933                 :            : }
     934                 :            : 
     935                 :            : uno::Sequence< beans::PropertyState > SAL_CALL
     936                 :          0 : SwXParagraph::getPropertyStates(
     937                 :            :         const uno::Sequence< OUString >& PropertyNames)
     938                 :            : throw (beans::UnknownPropertyException, uno::RuntimeException)
     939                 :            : {
     940         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     941                 :            : 
     942         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
     943                 :            : 
     944                 :          0 :     const OUString* pNames = PropertyNames.getConstArray();
     945         [ #  # ]:          0 :     uno::Sequence< beans::PropertyState > aRet(PropertyNames.getLength());
     946         [ #  # ]:          0 :     beans::PropertyState* pStates = aRet.getArray();
     947                 :          0 :     const SfxItemPropertyMap &rMap = m_pImpl->m_rPropSet.getPropertyMap();
     948                 :          0 :     const SwAttrSet* pSet = 0;
     949                 :          0 :     sal_Bool bAttrSetFetched = sal_False;
     950                 :            : 
     951         [ #  # ]:          0 :     for (sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd;
     952                 :            :             ++i, ++pStates, ++pNames)
     953                 :            :     {
     954                 :            :         SfxItemPropertySimpleEntry const*const pEntry =
     955         [ #  # ]:          0 :             rMap.getByName( *pNames );
     956         [ #  # ]:          0 :         if (!pEntry)
     957                 :            :         {
     958                 :            :             throw beans::UnknownPropertyException(
     959                 :            :                 OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
     960                 :            :                     + *pNames,
     961 [ #  # ][ #  # ]:          0 :                 static_cast<cppu::OWeakObject *>(this));
                 [ #  # ]
     962                 :            :         }
     963                 :            : 
     964 [ #  # ][ #  # ]:          0 :         if (bAttrSetFetched && !pSet && isATR(pEntry->nWID))
         [ #  # ][ #  # ]
     965                 :            :         {
     966                 :          0 :             *pStates = beans::PropertyState_DEFAULT_VALUE;
     967                 :            :         }
     968                 :            :         else
     969                 :            :         {
     970                 :            :             *pStates = lcl_SwXParagraph_getPropertyState(
     971         [ #  # ]:          0 :                 rTxtNode, &pSet, *pEntry, bAttrSetFetched );
     972                 :            :         }
     973                 :            :     }
     974                 :            : 
     975         [ #  # ]:          0 :     return aRet;
     976                 :            : }
     977                 :            : 
     978                 :            : void SAL_CALL
     979                 :          0 : SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
     980                 :            : throw (beans::UnknownPropertyException, uno::RuntimeException)
     981                 :            : {
     982         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     983                 :            : 
     984         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
     985                 :            : 
     986         [ #  # ]:          0 :     SwPosition aPos( rTxtNode );
     987         [ #  # ]:          0 :     SwCursor aCursor( aPos, 0, false );
     988 [ #  # ][ #  # ]:          0 :     if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE))  ||
           [ #  #  #  #  
           #  # ][ #  # ]
     989 [ #  # ][ #  # ]:          0 :         rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)) ||
     990 [ #  # ][ #  # ]:          0 :         rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
     991                 :            :     {
     992                 :          0 :         return;
     993                 :            :     }
     994                 :            : 
     995                 :            :     // select paragraph
     996         [ #  # ]:          0 :     SwParaSelection aParaSel( aCursor );
     997                 :            :     SfxItemPropertySimpleEntry const*const pEntry =
     998         [ #  # ]:          0 :         m_pImpl->m_rPropSet.getPropertyMap().getByName( rPropertyName );
     999         [ #  # ]:          0 :     if (!pEntry)
    1000                 :            :     {
    1001                 :            :         throw beans::UnknownPropertyException(
    1002                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
    1003                 :            :                 + rPropertyName,
    1004 [ #  # ][ #  # ]:          0 :             static_cast<cppu::OWeakObject *>(this));
                 [ #  # ]
    1005                 :            :     }
    1006                 :            : 
    1007         [ #  # ]:          0 :     if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
    1008                 :            :     {
    1009                 :            :         throw uno::RuntimeException(
    1010                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
    1011                 :            :                 + rPropertyName,
    1012 [ #  # ][ #  # ]:          0 :             static_cast<cppu::OWeakObject *>(this));
                 [ #  # ]
    1013                 :            :     }
    1014                 :            : 
    1015         [ #  # ]:          0 :     if (pEntry->nWID < RES_FRMATR_END)
    1016                 :            :     {
    1017         [ #  # ]:          0 :         std::set<sal_uInt16> aWhichIds;
    1018         [ #  # ]:          0 :         aWhichIds.insert( pEntry->nWID );
    1019         [ #  # ]:          0 :         if (pEntry->nWID < RES_PARATR_BEGIN)
    1020                 :            :         {
    1021         [ #  # ]:          0 :             aCursor.GetDoc()->ResetAttrs(aCursor, sal_True, aWhichIds);
    1022                 :            :         }
    1023                 :            :         else
    1024                 :            :         {
    1025                 :            :             // for paragraph attributes the selection must be extended
    1026                 :            :             // to paragraph boundaries
    1027 [ #  # ][ #  # ]:          0 :             SwPosition aStart( *aCursor.Start() );
    1028 [ #  # ][ #  # ]:          0 :             SwPosition aEnd  ( *aCursor.End()   );
    1029                 :            :             ::std::auto_ptr<SwUnoCrsr> pTemp(
    1030         [ #  # ]:          0 :                 aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) );
    1031         [ #  # ]:          0 :             if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
    1032                 :            :             {
    1033         [ #  # ]:          0 :                 pTemp->MovePara(fnParaCurr, fnParaStart);
    1034                 :            :             }
    1035         [ #  # ]:          0 :             pTemp->SetMark();
    1036         [ #  # ]:          0 :             *pTemp->GetPoint() = aEnd;
    1037                 :            :             //pTemp->Exchange();
    1038         [ #  # ]:          0 :             SwUnoCursorHelper::SelectPam(*pTemp, true);
    1039 [ #  # ][ #  # ]:          0 :             if (!SwUnoCursorHelper::IsEndOfPara(*pTemp))
    1040                 :            :             {
    1041         [ #  # ]:          0 :                 pTemp->MovePara(fnParaCurr, fnParaEnd);
    1042                 :            :             }
    1043 [ #  # ][ #  # ]:          0 :             pTemp->GetDoc()->ResetAttrs(*pTemp, sal_True, aWhichIds);
         [ #  # ][ #  # ]
    1044                 :          0 :         }
    1045                 :            :     }
    1046                 :            :     else
    1047                 :            :     {
    1048         [ #  # ]:          0 :         SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, aCursor);
    1049 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1050                 :            : }
    1051                 :            : 
    1052                 :            : uno::Any SAL_CALL
    1053                 :          0 : SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
    1054                 :            : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
    1055                 :            :     uno::RuntimeException)
    1056                 :            : {
    1057         [ #  # ]:          0 :     SolarMutexGuard g;
    1058                 :            : 
    1059         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1060                 :            : 
    1061                 :          0 :     uno::Any aRet;
    1062 [ #  # ][ #  # ]:          0 :     if (::sw::GetDefaultTextContentValue(aRet, rPropertyName))
    1063                 :            :     {
    1064                 :            :         return aRet;
    1065                 :            :     }
    1066                 :            : 
    1067                 :            :     SfxItemPropertySimpleEntry const*const pEntry =
    1068         [ #  # ]:          0 :         m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
    1069         [ #  # ]:          0 :     if (!pEntry)
    1070                 :            :     {
    1071                 :            :         throw beans::UnknownPropertyException(
    1072                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
    1073                 :            :                 + rPropertyName,
    1074 [ #  # ][ #  # ]:          0 :             static_cast<cppu::OWeakObject *>(this));
                 [ #  # ]
    1075                 :            :     }
    1076                 :            : 
    1077         [ #  # ]:          0 :     if (pEntry->nWID < RES_FRMATR_END)
    1078                 :            :     {
    1079                 :            :         const SfxPoolItem& rDefItem =
    1080         [ #  # ]:          0 :             rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
    1081         [ #  # ]:          0 :         rDefItem.QueryValue(aRet, pEntry->nMemberId);
    1082                 :            :     }
    1083                 :            : 
    1084         [ #  # ]:          0 :     return aRet;
    1085                 :            : }
    1086                 :            : 
    1087                 :            : void SAL_CALL
    1088                 :          0 : SwXParagraph::attach(const uno::Reference< text::XTextRange > & /*xTextRange*/)
    1089                 :            : throw (lang::IllegalArgumentException, uno::RuntimeException)
    1090                 :            : {
    1091         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1092                 :            :     // SwXParagraph will only created in order to be inserted by
    1093                 :            :     // 'insertTextContentBefore' or 'insertTextContentAfter' therefore
    1094                 :            :     // they cannot be attached
    1095         [ #  # ]:          0 :     throw uno::RuntimeException();
    1096                 :            : }
    1097                 :            : 
    1098                 :            : uno::Reference< text::XTextRange > SAL_CALL
    1099                 :          0 : SwXParagraph::getAnchor() throw (uno::RuntimeException)
    1100                 :            : {
    1101         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1102                 :            : 
    1103         [ #  # ]:          0 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1104                 :            : 
    1105         [ #  # ]:          0 :     SwPosition aPos( rTxtNode );
    1106         [ #  # ]:          0 :     SwCursor aCursor( aPos, 0, false );
    1107                 :            :     // select paragraph
    1108         [ #  # ]:          0 :     SwParaSelection aParaSel( aCursor );
    1109                 :            :     const uno::Reference< text::XTextRange >  xRet =
    1110 [ #  # ][ #  # ]:          0 :         new SwXTextRange(aCursor, m_pImpl->m_xParentText);
                 [ #  # ]
    1111 [ #  # ][ #  # ]:          0 :     return xRet;
         [ #  # ][ #  # ]
    1112                 :            : }
    1113                 :            : 
    1114                 :        372 : void SAL_CALL SwXParagraph::dispose() throw (uno::RuntimeException)
    1115                 :            : {
    1116         [ +  - ]:        372 :     SolarMutexGuard aGuard;
    1117                 :            : 
    1118                 :        372 :     SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
    1119         [ +  - ]:        372 :     if (pTxtNode)
    1120                 :            :     {
    1121 [ +  - ][ +  - ]:        372 :         SwCursor aCursor( SwPosition( *pTxtNode ), 0, false );
                 [ +  - ]
    1122                 :            :         // select paragraph
    1123                 :            :         {
    1124         [ +  - ]:        372 :             SwParaSelection aParaSel( aCursor );
    1125 [ +  - ][ +  - ]:        372 :             pTxtNode->GetDoc()->DelFullPara(aCursor);
    1126                 :            :         }
    1127 [ +  - ][ +  - ]:        372 :         m_pImpl->m_ListenerContainer.Disposing();
    1128         [ +  - ]:        372 :     }
    1129                 :        372 : }
    1130                 :            : 
    1131                 :          0 : void SAL_CALL SwXParagraph::addEventListener(
    1132                 :            :         const uno::Reference< lang::XEventListener > & xListener)
    1133                 :            : throw (uno::RuntimeException)
    1134                 :            : {
    1135         [ #  # ]:          0 :     SolarMutexGuard g;
    1136                 :            : 
    1137         [ #  # ]:          0 :     if (!m_pImpl->GetTxtNode())
    1138                 :            :     {
    1139         [ #  # ]:          0 :         throw uno::RuntimeException();
    1140                 :            :     }
    1141 [ #  # ][ #  # ]:          0 :     m_pImpl->m_ListenerContainer.AddListener(xListener);
    1142                 :          0 : }
    1143                 :            : 
    1144                 :          0 : void SAL_CALL SwXParagraph::removeEventListener(
    1145                 :            :         const uno::Reference< lang::XEventListener > & xListener)
    1146                 :            : throw (uno::RuntimeException)
    1147                 :            : {
    1148         [ #  # ]:          0 :     SolarMutexGuard g;
    1149                 :            : 
    1150 [ #  # ][ #  # ]:          0 :     if (!m_pImpl->GetTxtNode() ||
                 [ #  # ]
    1151         [ #  # ]:          0 :         !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
    1152                 :            :     {
    1153         [ #  # ]:          0 :         throw uno::RuntimeException();
    1154         [ #  # ]:          0 :     }
    1155                 :          0 : }
    1156                 :            : 
    1157                 :            : uno::Reference< container::XEnumeration >  SAL_CALL
    1158                 :        787 : SwXParagraph::createEnumeration() throw (uno::RuntimeException)
    1159                 :            : {
    1160         [ +  - ]:        787 :     SolarMutexGuard aGuard;
    1161                 :            : 
    1162         [ +  - ]:        787 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1163                 :            : 
    1164         [ +  - ]:        787 :     SwPosition aPos( rTxtNode );
    1165         [ +  - ]:        787 :     SwPaM aPam ( aPos );
    1166                 :            :     const uno::Reference< container::XEnumeration > xRef =
    1167                 :        787 :         new SwXTextPortionEnumeration(aPam, m_pImpl->m_xParentText,
    1168 [ +  - ][ +  - ]:        787 :             m_pImpl->m_nSelectionStartPos, m_pImpl->m_nSelectionEndPos);
                 [ +  - ]
    1169 [ +  - ][ +  - ]:        787 :     return xRef;
                 [ +  - ]
    1170                 :            : }
    1171                 :            : 
    1172                 :          0 : uno::Type SAL_CALL SwXParagraph::getElementType() throw (uno::RuntimeException)
    1173                 :            : {
    1174                 :          0 :     return text::XTextRange::static_type();
    1175                 :            : }
    1176                 :            : 
    1177                 :          0 : sal_Bool SAL_CALL SwXParagraph::hasElements() throw (uno::RuntimeException)
    1178                 :            : {
    1179         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1180 [ #  # ][ #  # ]:          0 :     return (GetTxtNode()) ? sal_True : sal_False;
                 [ #  # ]
    1181                 :            : }
    1182                 :            : 
    1183                 :            : uno::Reference< text::XText > SAL_CALL
    1184                 :       2352 : SwXParagraph::getText() throw (uno::RuntimeException)
    1185                 :            : {
    1186         [ +  - ]:       2352 :     SolarMutexGuard g;
    1187                 :            : 
    1188         [ +  - ]:       2352 :     return m_pImpl->m_xParentText;
    1189                 :            : }
    1190                 :            : 
    1191                 :            : uno::Reference< text::XTextRange > SAL_CALL
    1192                 :        440 : SwXParagraph::getStart() throw (uno::RuntimeException)
    1193                 :            : {
    1194         [ +  - ]:        440 :     SolarMutexGuard aGuard;
    1195                 :            : 
    1196         [ +  - ]:        440 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1197                 :            : 
    1198         [ +  - ]:        440 :     SwPosition aPos( rTxtNode );
    1199         [ +  - ]:        440 :     SwCursor aCursor( aPos, 0, false );
    1200         [ +  - ]:        440 :     SwParaSelection aParaSel( aCursor );
    1201 [ +  - ][ +  - ]:        440 :     SwPaM aPam( *aCursor.Start() );
    1202         [ +  - ]:        440 :     uno::Reference< text::XText >  xParent = getText();
    1203                 :            :     const uno::Reference< text::XTextRange > xRet =
    1204 [ +  - ][ +  - ]:        440 :         new SwXTextRange(aPam, xParent);
                 [ +  - ]
    1205 [ +  - ][ +  - ]:        440 :     return xRet;
         [ +  - ][ +  - ]
                 [ +  - ]
    1206                 :            : }
    1207                 :            : 
    1208                 :            : uno::Reference< text::XTextRange > SAL_CALL
    1209                 :        438 : SwXParagraph::getEnd() throw (uno::RuntimeException)
    1210                 :            : {
    1211         [ +  - ]:        438 :     SolarMutexGuard aGuard;
    1212                 :            : 
    1213         [ +  - ]:        438 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1214                 :            : 
    1215         [ +  - ]:        438 :     SwPosition aPos( rTxtNode );
    1216         [ +  - ]:        438 :     SwCursor aCursor( aPos, 0, false );
    1217         [ +  - ]:        438 :     SwParaSelection aParaSel( aCursor );
    1218 [ +  - ][ +  - ]:        438 :     SwPaM aPam( *aCursor.End() );
    1219         [ +  - ]:        438 :     uno::Reference< text::XText >  xParent = getText();
    1220                 :            :     const uno::Reference< text::XTextRange > xRet =
    1221 [ +  - ][ +  - ]:        438 :         new SwXTextRange(aPam, xParent);
                 [ +  - ]
    1222 [ +  - ][ +  - ]:        438 :     return xRet;
         [ +  - ][ +  - ]
                 [ +  - ]
    1223                 :            : }
    1224                 :            : 
    1225                 :         97 : OUString SAL_CALL SwXParagraph::getString() throw (uno::RuntimeException)
    1226                 :            : {
    1227         [ +  - ]:         97 :     SolarMutexGuard aGuard;
    1228                 :         97 :     OUString aRet;
    1229         [ +  - ]:         97 :     SwTxtNode const*const pTxtNode( GetTxtNode() );
    1230         [ +  - ]:         97 :     if (pTxtNode)
    1231                 :            :     {
    1232         [ +  - ]:         97 :         SwPosition aPos( *pTxtNode );
    1233         [ +  - ]:         97 :         SwCursor aCursor( aPos, 0, false );
    1234         [ +  - ]:         97 :         SwParaSelection aParaSel( aCursor );
    1235 [ +  - ][ +  - ]:         97 :         SwUnoCursorHelper::GetTextFromPam(aCursor, aRet);
         [ +  - ][ +  - ]
    1236                 :            :     }
    1237         [ #  # ]:          0 :     else if (m_pImpl->IsDescriptor())
    1238                 :            :     {
    1239                 :          0 :         aRet = m_pImpl->m_sText;
    1240                 :            :     }
    1241                 :            :     else
    1242                 :            :     {
    1243         [ #  # ]:          0 :         throw uno::RuntimeException();
    1244                 :            :     }
    1245         [ +  - ]:         97 :     return aRet;
    1246                 :            : }
    1247                 :            : 
    1248                 :          0 : void SAL_CALL SwXParagraph::setString(const OUString& aString)
    1249                 :            : throw (uno::RuntimeException)
    1250                 :            : {
    1251         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1252                 :            : 
    1253         [ #  # ]:          0 :     SwTxtNode const*const pTxtNode( GetTxtNode() );
    1254         [ #  # ]:          0 :     if (pTxtNode)
    1255                 :            :     {
    1256         [ #  # ]:          0 :         SwPosition aPos( *pTxtNode );
    1257         [ #  # ]:          0 :         SwCursor aCursor( aPos, 0, false );
    1258         [ #  # ]:          0 :         if (!SwUnoCursorHelper::IsStartOfPara(aCursor)) {
    1259         [ #  # ]:          0 :             aCursor.MovePara(fnParaCurr, fnParaStart);
    1260                 :            :         }
    1261         [ #  # ]:          0 :         SwUnoCursorHelper::SelectPam(aCursor, true);
    1262         [ #  # ]:          0 :         if (pTxtNode->GetTxt().Len()) {
    1263         [ #  # ]:          0 :             aCursor.MovePara(fnParaCurr, fnParaEnd);
    1264                 :            :         }
    1265         [ #  # ]:          0 :         SwUnoCursorHelper::SetString(aCursor, aString);
    1266 [ #  # ][ #  # ]:          0 :         SwUnoCursorHelper::SelectPam(aCursor, false);
                 [ #  # ]
    1267                 :            :     }
    1268         [ #  # ]:          0 :     else if (m_pImpl->IsDescriptor())
    1269                 :            :     {
    1270                 :          0 :         m_pImpl->m_sText = aString;
    1271                 :            :     }
    1272                 :            :     else
    1273                 :            :     {
    1274         [ #  # ]:          0 :         throw uno::RuntimeException();
    1275         [ #  # ]:          0 :     }
    1276                 :          0 : }
    1277                 :            : 
    1278                 :            : uno::Reference< container::XEnumeration > SAL_CALL
    1279                 :        177 : SwXParagraph::createContentEnumeration(const OUString& rServiceName)
    1280                 :            : throw (uno::RuntimeException)
    1281                 :            : {
    1282         [ +  - ]:        177 :     SolarMutexGuard g;
    1283                 :            : 
    1284         [ -  + ]:        177 :     if ( rServiceName != "com.sun.star.text.TextContent" )
    1285                 :            :     {
    1286         [ #  # ]:          0 :         throw uno::RuntimeException();
    1287                 :            :     }
    1288                 :            : 
    1289         [ +  - ]:        177 :     SwTxtNode & rTxtNode(m_pImpl->GetTxtNodeOrThrow());
    1290                 :            : 
    1291         [ +  - ]:        177 :     SwPosition aPos( rTxtNode );
    1292         [ +  - ]:        177 :     SwPaM aPam( aPos );
    1293                 :            :     uno::Reference< container::XEnumeration > xRet =
    1294 [ +  - ][ +  - ]:        177 :         new SwXParaFrameEnumeration(aPam, PARAFRAME_PORTION_PARAGRAPH);
                 [ +  - ]
    1295 [ +  - ][ +  - ]:        177 :     return xRet;
                 [ +  - ]
    1296                 :            : }
    1297                 :            : 
    1298                 :            : uno::Sequence< OUString > SAL_CALL
    1299                 :          0 : SwXParagraph::getAvailableServiceNames() throw (uno::RuntimeException)
    1300                 :            : {
    1301                 :          0 :     uno::Sequence< OUString > aRet(1);
    1302         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1303         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextContent");
    1304                 :          0 :     return aRet;
    1305                 :            : }
    1306                 :            : 
    1307                 :            : // MetadatableMixin
    1308                 :        676 : ::sfx2::Metadatable* SwXParagraph::GetCoreObject()
    1309                 :            : {
    1310                 :        676 :     SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
    1311         [ +  - ]:        676 :     return pTxtNode;
    1312                 :            : }
    1313                 :            : 
    1314                 :          2 : uno::Reference<frame::XModel> SwXParagraph::GetModel()
    1315                 :            : {
    1316                 :          2 :     SwTxtNode *const pTxtNode( m_pImpl->GetTxtNode() );
    1317         [ +  - ]:          2 :     if (pTxtNode)
    1318                 :            :     {
    1319                 :          2 :         SwDocShell const*const pShell( pTxtNode->GetDoc()->GetDocShell() );
    1320         [ +  - ]:          2 :         return (pShell) ? pShell->GetModel() : 0;
    1321                 :            :     }
    1322                 :          2 :     return 0;
    1323                 :            : }
    1324                 :            : 
    1325                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10