LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoredline.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 324 0.0 %
Date: 2012-08-25 Functions: 0 45 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 664 0.0 %

           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                 :            : 
      30                 :            : #include <com/sun/star/util/DateTime.hpp>
      31                 :            : #include <com/sun/star/text/XTextTable.hpp>
      32                 :            : 
      33                 :            : #include <rtl/ustrbuf.hxx>
      34                 :            : #include <osl/mutex.hxx>
      35                 :            : #include <vcl/svapp.hxx>
      36                 :            : #include <comphelper/servicehelper.hxx>
      37                 :            : 
      38                 :            : #include <pagedesc.hxx>
      39                 :            : #include "poolfmt.hxx"
      40                 :            : #include <redline.hxx>
      41                 :            : #include <section.hxx>
      42                 :            : #include <unoprnms.hxx>
      43                 :            : #include <unomid.h>
      44                 :            : #include <unotextrange.hxx>
      45                 :            : #include <unotextcursor.hxx>
      46                 :            : #include <unoparagraph.hxx>
      47                 :            : #include <unocoll.hxx>
      48                 :            : #include <unomap.hxx>
      49                 :            : #include <unocrsr.hxx>
      50                 :            : #include <unoredline.hxx>
      51                 :            : #include <doc.hxx>
      52                 :            : #include <docary.hxx>
      53                 :            : 
      54                 :            : 
      55                 :            : using namespace ::com::sun::star;
      56                 :            : using ::rtl::OUString;
      57                 :            : using ::rtl::OUStringBuffer;
      58                 :            : 
      59                 :          0 : SwXRedlineText::SwXRedlineText(SwDoc* _pDoc, SwNodeIndex aIndex) :
      60                 :            :     SwXText(_pDoc, CURSOR_REDLINE),
      61         [ #  # ]:          0 :     aNodeIndex(aIndex)
      62                 :            : {
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : const SwStartNode* SwXRedlineText::GetStartNode() const
      66                 :            : {
      67                 :          0 :     return aNodeIndex.GetNode().GetStartNode();
      68                 :            : }
      69                 :            : 
      70                 :          0 : uno::Any SwXRedlineText::queryInterface( const uno::Type& rType )
      71                 :            :     throw(uno::RuntimeException)
      72                 :            : {
      73                 :          0 :     uno::Any aRet;
      74                 :            : 
      75 [ #  # ][ #  # ]:          0 :     if (::getCppuType((uno::Reference<container::XEnumerationAccess> *)0) == rType)
      76                 :            :     {
      77         [ #  # ]:          0 :         uno::Reference<container::XEnumerationAccess> aAccess = this;
      78         [ #  # ]:          0 :         aRet <<= aAccess;
      79                 :            :     }
      80                 :            :     else
      81                 :            :     {
      82                 :            :         // delegate to SwXText and OWeakObject
      83         [ #  # ]:          0 :         aRet = SwXText::queryInterface(rType);
      84         [ #  # ]:          0 :         if(!aRet.hasValue())
      85                 :            :         {
      86         [ #  # ]:          0 :             aRet = OWeakObject::queryInterface(rType);
      87                 :            :         }
      88                 :            :     }
      89                 :            : 
      90                 :          0 :     return aRet;
      91                 :            : }
      92                 :            : 
      93                 :          0 : uno::Sequence<uno::Type> SwXRedlineText::getTypes()
      94                 :            :     throw(uno::RuntimeException)
      95                 :            : {
      96                 :            :     // SwXText::getTypes()
      97                 :          0 :     uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
      98                 :            : 
      99                 :            :     // add container::XEnumerationAccess
     100                 :          0 :     sal_Int32 nLength = aTypes.getLength();
     101         [ #  # ]:          0 :     aTypes.realloc(nLength + 1);
     102 [ #  # ][ #  # ]:          0 :     aTypes[nLength] = ::getCppuType((uno::Reference<container::XEnumerationAccess> *)0);
     103                 :            : 
     104                 :          0 :     return aTypes;
     105                 :            : }
     106                 :            : 
     107                 :            : namespace
     108                 :            : {
     109                 :            :     class theSwXRedlineTextImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXRedlineTextImplementationId> {};
     110                 :            : }
     111                 :            : 
     112                 :          0 : uno::Sequence<sal_Int8> SwXRedlineText::getImplementationId()
     113                 :            :     throw(uno::RuntimeException)
     114                 :            : {
     115                 :          0 :     return theSwXRedlineTextImplementationId::get().getSeq();
     116                 :            : }
     117                 :            : 
     118                 :          0 : uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor(void)
     119                 :            :     throw( uno::RuntimeException )
     120                 :            : {
     121         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     122                 :            : 
     123         [ #  # ]:          0 :     SwPosition aPos(aNodeIndex);
     124                 :            :     SwXTextCursor *const pXCursor =
     125 [ #  # ][ #  # ]:          0 :         new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos);
                 [ #  # ]
     126         [ #  # ]:          0 :     SwUnoCrsr *const pUnoCursor = pXCursor->GetCursor();
     127         [ #  # ]:          0 :     pUnoCursor->Move(fnMoveForward, fnGoNode);
     128                 :            : 
     129                 :            :     // #101929# prevent a newly created text cursor from running inside a table
     130                 :            :     // because table cells have their own XText.
     131                 :            :     // Patterned after SwXTextFrame::createTextCursor(void).
     132                 :            : 
     133                 :            :     // skip all tables at the beginning
     134         [ #  # ]:          0 :     SwTableNode* pTableNode = pUnoCursor->GetNode()->FindTableNode();
     135                 :          0 :     SwCntntNode* pContentNode = NULL;
     136                 :          0 :     bool bTable = pTableNode != NULL;
     137         [ #  # ]:          0 :     while( pTableNode != NULL )
     138                 :            :     {
     139         [ #  # ]:          0 :         pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode());
     140 [ #  # ][ #  # ]:          0 :         pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode);
                 [ #  # ]
     141         [ #  # ]:          0 :         pTableNode = pContentNode->FindTableNode();
     142                 :            :     }
     143         [ #  # ]:          0 :     if( pContentNode != NULL )
     144 [ #  # ][ #  # ]:          0 :         pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 );
     145 [ #  # ][ #  # ]:          0 :     if( bTable && pUnoCursor->GetNode()->FindSttNodeByType( SwNormalStartNode )
         [ #  # ][ #  # ]
     146         [ #  # ]:          0 :                                                             != GetStartNode() )
     147                 :            :     {
     148                 :            :         // We have gone too far and have left our own redline. This means that
     149                 :            :         // no content node outside of a table could be found, and therefore we
     150                 :            :         // except.
     151         [ #  # ]:          0 :         uno::RuntimeException aExcept;
     152                 :            :         aExcept.Message = OUString( RTL_CONSTASCII_USTRINGPARAM(
     153                 :            :             "No content node found that is inside this change section "
     154         [ #  # ]:          0 :             "but outside of a table" ) );
     155         [ #  # ]:          0 :         throw aExcept;
     156                 :            :     }
     157                 :            : 
     158 [ #  # ][ #  # ]:          0 :     return static_cast<text::XWordCursor*>(pXCursor);
         [ #  # ][ #  # ]
     159                 :            : }
     160                 :            : 
     161                 :          0 : uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursorByRange(
     162                 :            :     const uno::Reference<text::XTextRange> & aTextRange)
     163                 :            :         throw( uno::RuntimeException )
     164                 :            : {
     165                 :          0 :     uno::Reference<text::XTextCursor> xCursor = createTextCursor();
     166 [ #  # ][ #  # ]:          0 :     xCursor->gotoRange(aTextRange->getStart(), sal_False);
         [ #  # ][ #  # ]
     167 [ #  # ][ #  # ]:          0 :     xCursor->gotoRange(aTextRange->getEnd(), sal_True);
         [ #  # ][ #  # ]
     168                 :          0 :     return xCursor;
     169                 :            : }
     170                 :            : 
     171                 :          0 : uno::Reference<container::XEnumeration> SwXRedlineText::createEnumeration(void)
     172                 :            :     throw( uno::RuntimeException )
     173                 :            : {
     174         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     175         [ #  # ]:          0 :     SwPaM aPam(aNodeIndex);
     176         [ #  # ]:          0 :     aPam.Move(fnMoveForward, fnGoNode);
     177                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     178                 :            :     ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     179 [ #  # ][ #  # ]:          0 :         GetDoc()->CreateUnoCrsr(*aPam.Start(), sal_False));
                 [ #  # ]
     180                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     181 [ #  # ][ #  # ]:          0 :     return new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     182                 :            : }
     183                 :            : 
     184                 :          0 : uno::Type SwXRedlineText::getElementType(  ) throw(uno::RuntimeException)
     185                 :            : {
     186                 :          0 :     return ::getCppuType((uno::Reference<text::XTextRange>*)0);
     187                 :            : }
     188                 :            : 
     189                 :          0 : sal_Bool SwXRedlineText::hasElements(  ) throw(uno::RuntimeException)
     190                 :            : {
     191                 :          0 :     return sal_True;    // we always have a content index
     192                 :            : }
     193                 :            : 
     194                 :          0 : SwXRedlinePortion::SwXRedlinePortion(   const SwRedline* pRed,
     195                 :            :                         const SwUnoCrsr* pPortionCrsr,
     196                 :            :                         uno::Reference< text::XText >  xParent, sal_Bool bStart) :
     197                 :            :     SwXTextPortion(pPortionCrsr, xParent, bStart ? PORTION_REDLINE_START : PORTION_REDLINE_END),
     198         [ #  # ]:          0 :     pRedline(pRed)
     199                 :            : {
     200                 :          0 :     SetCollapsed(!pRedline->HasMark());
     201                 :          0 : }
     202                 :            : 
     203                 :          0 : SwXRedlinePortion::~SwXRedlinePortion()
     204                 :            : {
     205         [ #  # ]:          0 : }
     206                 :            : 
     207                 :          0 : static util::DateTime lcl_DateTimeToUno(const DateTime& rDT)
     208                 :            : {
     209                 :          0 :     util::DateTime aRetDT;
     210                 :          0 :     aRetDT.Year = rDT.GetYear();
     211                 :          0 :     aRetDT.Month= rDT.GetMonth();
     212                 :          0 :     aRetDT.Day      = rDT.GetDay();
     213                 :          0 :     aRetDT.Hours    = rDT.GetHour();
     214                 :          0 :     aRetDT.Minutes = rDT.GetMin();
     215                 :          0 :     aRetDT.Seconds = rDT.GetSec();
     216                 :          0 :     aRetDT.HundredthSeconds = rDT.Get100Sec();
     217                 :          0 :     return aRetDT;
     218                 :            : }
     219                 :            : 
     220                 :          0 : static OUString lcl_RedlineTypeToOUString(RedlineType_t eType)
     221                 :            : {
     222                 :          0 :     OUString sRet;
     223   [ #  #  #  #  :          0 :     switch(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)
                   #  # ]
     224                 :            :     {
     225         [ #  # ]:          0 :         case nsRedlineType_t::REDLINE_INSERT: sRet = C2U("Insert"); break;
     226         [ #  # ]:          0 :         case nsRedlineType_t::REDLINE_DELETE: sRet = C2U("Delete"); break;
     227         [ #  # ]:          0 :         case nsRedlineType_t::REDLINE_FORMAT: sRet = C2U("Format"); break;
     228         [ #  # ]:          0 :         case nsRedlineType_t::REDLINE_TABLE:  sRet = C2U("TextTable"); break;
     229         [ #  # ]:          0 :         case nsRedlineType_t::REDLINE_FMTCOLL:sRet = C2U("Style"); break;
     230                 :            :     }
     231                 :          0 :     return sRet;
     232                 :            : }
     233                 :            : 
     234                 :          0 : static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRedline& rRedline)
     235                 :            : {
     236                 :          0 :     uno::Sequence<beans::PropertyValue> aValues(4);
     237                 :            : 
     238         [ #  # ]:          0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     239         [ #  # ]:          0 :     if(pNext)
     240                 :            :     {
     241         [ #  # ]:          0 :         beans::PropertyValue* pValues = aValues.getArray();
     242         [ #  # ]:          0 :         pValues[0].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
     243                 :            :         // GetAuthorString(n) walks the SwRedlineData* chain;
     244                 :            :         // here we always need element 1
     245 [ #  # ][ #  # ]:          0 :         pValues[0].Value <<= OUString(rRedline.GetAuthorString(1));
                 [ #  # ]
     246         [ #  # ]:          0 :         pValues[1].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
     247         [ #  # ]:          0 :         pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
     248         [ #  # ]:          0 :         pValues[2].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
     249 [ #  # ][ #  # ]:          0 :         pValues[2].Value <<= OUString(pNext->GetComment());
     250         [ #  # ]:          0 :         pValues[3].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
     251 [ #  # ][ #  # ]:          0 :         pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
     252                 :            :     }
     253                 :          0 :     return aValues;
     254                 :            : }
     255                 :            : 
     256                 :          0 : uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
     257                 :            :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     258                 :            : {
     259         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     260         [ #  # ]:          0 :     Validate();
     261                 :          0 :     uno::Any aRet;
     262 [ #  # ][ #  # ]:          0 :     if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
                 [ #  # ]
     263                 :            :     {
     264                 :          0 :         SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
     265         [ #  # ]:          0 :         if(pNodeIdx )
     266                 :            :         {
     267         [ #  # ]:          0 :             if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     268                 :            :             {
     269                 :          0 :                 SwUnoCrsr* pUnoCrsr = GetCursor();
     270 [ #  # ][ #  # ]:          0 :                 uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
         [ #  # ][ #  # ]
                 [ #  # ]
     271         [ #  # ]:          0 :                 aRet <<= xRet;
     272                 :            :             }
     273                 :            :             else {
     274                 :            :                 OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     275                 :            :             }
     276                 :            :         }
     277                 :            :     }
     278                 :            :     else
     279                 :            :     {
     280                 :          0 :         aRet = GetPropertyValue( rPropertyName, *pRedline);
     281         [ #  # ]:          0 :         if(!aRet.hasValue() &&
           [ #  #  #  # ]
     282 [ #  # ][ #  # ]:          0 :            ! rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
     283         [ #  # ]:          0 :             aRet = SwXTextPortion::getPropertyValue(rPropertyName);
     284                 :            :     }
     285         [ #  # ]:          0 :     return aRet;
     286                 :            : }
     287                 :            : 
     288                 :          0 : void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
     289                 :            : {
     290                 :          0 :     SwUnoCrsr* pUnoCrsr = GetCursor();
     291         [ #  # ]:          0 :     if(!pUnoCrsr)
     292         [ #  # ]:          0 :         throw uno::RuntimeException();
     293                 :            :     //search for the redline
     294                 :          0 :     SwDoc* pDoc = pUnoCrsr->GetDoc();
     295                 :          0 :     const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
     296                 :          0 :     sal_Bool bFound = sal_False;
     297 [ #  # ][ #  # ]:          0 :     for(sal_uInt16 nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
                 [ #  # ]
     298                 :          0 :         bFound = pRedline == rRedTbl[nRed];
     299         [ #  # ]:          0 :     if(!bFound)
     300         [ #  # ]:          0 :         throw uno::RuntimeException();
     301                 :          0 : }
     302                 :            : 
     303                 :            : namespace
     304                 :            : {
     305                 :            :     class theSwXRedlinePortionImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXRedlinePortionImplementationId > {};
     306                 :            : }
     307                 :            : 
     308                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId(  ) throw(uno::RuntimeException)
     309                 :            : {
     310                 :          0 :     return theSwXRedlinePortionImplementationId::get().getSeq();
     311                 :            : }
     312                 :            : 
     313                 :          0 : uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, const SwRedline& rRedline ) throw()
     314                 :            : {
     315                 :          0 :     uno::Any aRet;
     316 [ #  # ][ #  # ]:          0 :     if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
                 [ #  # ]
     317 [ #  # ][ #  # ]:          0 :         aRet <<= OUString(rRedline.GetAuthorString());
                 [ #  # ]
     318 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
                 [ #  # ]
     319                 :            :     {
     320 [ #  # ][ #  # ]:          0 :         aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     321                 :            :     }
     322 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
                 [ #  # ]
     323 [ #  # ][ #  # ]:          0 :         aRet <<= OUString(rRedline.GetComment());
                 [ #  # ]
     324 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
                 [ #  # ]
     325                 :            :     {
     326 [ #  # ][ #  # ]:          0 :         aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
                 [ #  # ]
     327                 :            :     }
     328 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
                 [ #  # ]
     329                 :            :     {
     330 [ #  # ][ #  # ]:          0 :         if(rRedline.GetRedlineData().Next())
     331 [ #  # ][ #  # ]:          0 :             aRet <<= lcl_GetSuccessorProperties(rRedline);
                 [ #  # ]
     332                 :            :     }
     333 [ #  # ][ #  # ]:          0 :     else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_IDENTIFIER)))
                 [ #  # ]
     334                 :            :     {
     335                 :          0 :         OUStringBuffer sBuf;
     336         [ #  # ]:          0 :         sBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     337 [ #  # ][ #  # ]:          0 :         aRet <<= sBuf.makeStringAndClear();
     338                 :            :     }
     339 [ #  # ][ #  # ]:          0 :     else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_IN_HEADER_FOOTER)))
                 [ #  # ]
     340                 :            :     {
     341                 :            :         sal_Bool bRet =
     342         [ #  # ]:          0 :             rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
     343         [ #  # ]:          0 :         aRet.setValue(&bRet, ::getBooleanCppuType());
     344                 :            :     }
     345 [ #  # ][ #  # ]:          0 :     else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_MERGE_LAST_PARA)))
                 [ #  # ]
     346                 :            :     {
     347                 :          0 :         sal_Bool bRet = !rRedline.IsDelLastPara();
     348         [ #  # ]:          0 :         aRet.setValue( &bRet, ::getBooleanCppuType() );
     349                 :            :     }
     350                 :          0 :     return aRet;
     351                 :            : }
     352                 :            : 
     353                 :          0 : uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
     354                 :            :     const SwRedline& rRedline, sal_Bool bIsStart ) throw()
     355                 :            : {
     356         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aRet(11);
     357         [ #  # ]:          0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     358         [ #  # ]:          0 :     beans::PropertyValue* pRet = aRet.getArray();
     359                 :            : 
     360                 :          0 :     OUStringBuffer sRedlineIdBuf;
     361         [ #  # ]:          0 :     sRedlineIdBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     362                 :            : 
     363                 :          0 :     sal_Int32 nPropIdx  = 0;
     364         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
     365 [ #  # ][ #  # ]:          0 :     pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString());
                 [ #  # ]
     366         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
     367 [ #  # ][ #  # ]:          0 :     pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     368         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
     369 [ #  # ][ #  # ]:          0 :     pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment());
                 [ #  # ]
     370         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
     371 [ #  # ][ #  # ]:          0 :     pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
                 [ #  # ]
     372         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_IDENTIFIER));
     373 [ #  # ][ #  # ]:          0 :     pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear();
     374         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_IS_COLLAPSED));
     375                 :          0 :     sal_Bool bTmp = !rRedline.HasMark();
     376         [ #  # ]:          0 :     pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
     377                 :            : 
     378         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_IS_START));
     379         [ #  # ]:          0 :     pRet[nPropIdx++].Value.setValue(&bIsStart, ::getBooleanCppuType()) ;
     380                 :            : 
     381                 :          0 :     bTmp = !rRedline.IsDelLastPara();
     382         [ #  # ]:          0 :     pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_MERGE_LAST_PARA));
     383         [ #  # ]:          0 :     pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
     384                 :            : 
     385                 :          0 :     SwNodeIndex* pNodeIdx = rRedline.GetContentIdx();
     386         [ #  # ]:          0 :     if(pNodeIdx )
     387                 :            :     {
     388         [ #  # ]:          0 :         if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     389                 :            :         {
     390 [ #  # ][ #  # ]:          0 :             uno::Reference<text::XText> xRet = new SwXRedlineText(rRedline.GetDoc(), *pNodeIdx);
         [ #  # ][ #  # ]
                 [ #  # ]
     391         [ #  # ]:          0 :             pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TEXT));
     392         [ #  # ]:          0 :             pRet[nPropIdx++].Value <<= xRet;
     393                 :            :         }
     394                 :            :         else {
     395                 :            :             OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     396                 :            :         }
     397                 :            :     }
     398         [ #  # ]:          0 :     if(pNext)
     399                 :            :     {
     400         [ #  # ]:          0 :         pRet[nPropIdx].Name = rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_REDLINE_SUCCESSOR_DATA));
     401 [ #  # ][ #  # ]:          0 :         pRet[nPropIdx++].Value <<= lcl_GetSuccessorProperties(rRedline);
                 [ #  # ]
     402                 :            :     }
     403         [ #  # ]:          0 :     aRet.realloc(nPropIdx);
     404                 :          0 :     return aRet;
     405                 :            : }
     406                 :            : 
     407 [ #  # ][ #  # ]:          0 : TYPEINIT1(SwXRedline, SwClient);
     408                 :          0 : SwXRedline::SwXRedline(SwRedline& rRedline, SwDoc& rDoc) :
     409                 :            :     SwXText(&rDoc, CURSOR_REDLINE),
     410                 :            :     pDoc(&rDoc),
     411         [ #  # ]:          0 :     pRedline(&rRedline)
     412                 :            : {
     413 [ #  # ][ #  # ]:          0 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
     414                 :          0 : }
     415                 :            : 
     416 [ #  # ][ #  # ]:          0 : SwXRedline::~SwXRedline()
     417                 :            : {
     418         [ #  # ]:          0 : }
     419                 :            : 
     420                 :          0 : uno::Reference< beans::XPropertySetInfo > SwXRedline::getPropertySetInfo(  ) throw(uno::RuntimeException)
     421                 :            : {
     422                 :            :     static uno::Reference< beans::XPropertySetInfo >  xRef =
     423 [ #  # ][ #  # ]:          0 :         aSwMapProvider.GetPropertySet(PROPERTY_MAP_REDLINE)->getPropertySetInfo();
         [ #  # ][ #  # ]
                 [ #  # ]
     424                 :          0 :     return xRef;
     425                 :            : }
     426                 :            : 
     427                 :          0 : void SwXRedline::setPropertyValue( const OUString& rPropertyName, const uno::Any& aValue )
     428                 :            :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
     429                 :            :         lang::WrappedTargetException, uno::RuntimeException)
     430                 :            : {
     431         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     432         [ #  # ]:          0 :     if(!pDoc)
     433         [ #  # ]:          0 :         throw uno::RuntimeException();
     434 [ #  # ][ #  # ]:          0 :     if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
                 [ #  # ]
     435                 :            :     {
     436                 :            :         OSL_FAIL("currently not available");
     437                 :            :     }
     438 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
                 [ #  # ]
     439                 :            :     {
     440                 :            :         OSL_FAIL("currently not available");
     441                 :            :     }
     442 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
                 [ #  # ]
     443                 :            :     {
     444                 :          0 :         OUString sTmp; aValue >>= sTmp;
     445 [ #  # ][ #  # ]:          0 :         pRedline->SetComment(sTmp);
                 [ #  # ]
     446                 :            :     }
     447 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
                 [ #  # ]
     448                 :            :     {
     449                 :            :         OSL_FAIL("currently not available");
     450                 :          0 :         OUString sTmp; aValue >>= sTmp;
     451         [ #  # ]:          0 :         if(sTmp.isEmpty())
     452         [ #  # ]:          0 :             throw lang::IllegalArgumentException();
     453                 :            :     }
     454 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
                 [ #  # ]
     455                 :            :     {
     456                 :            :         OSL_FAIL("currently not available");
     457                 :            :     }
     458                 :            :     else
     459                 :            :     {
     460         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     461         [ #  # ]:          0 :     }
     462                 :          0 : }
     463                 :            : 
     464                 :          0 : uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName )
     465                 :            :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     466                 :            : {
     467         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     468         [ #  # ]:          0 :     if(!pDoc)
     469         [ #  # ]:          0 :         throw uno::RuntimeException();
     470                 :          0 :     uno::Any aRet;
     471 [ #  # ][ #  # ]:          0 :     sal_Bool bStart = rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_START));
     472         [ #  # ]:          0 :     if(bStart ||
           [ #  #  #  # ]
     473 [ #  # ][ #  # ]:          0 :         rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_END)))
     474                 :            :     {
     475                 :          0 :         uno::Reference<XInterface> xRet;
     476                 :          0 :         SwNode* pNode = pRedline->GetNode();
     477 [ #  # ][ #  # ]:          0 :         if(!bStart && pRedline->HasMark())
                 [ #  # ]
     478                 :          0 :             pNode = pRedline->GetNode(sal_False);
     479   [ #  #  #  # ]:          0 :         switch(pNode->GetNodeType())
     480                 :            :         {
     481                 :            :             case ND_SECTIONNODE:
     482                 :            :             {
     483                 :          0 :                 SwSectionNode* pSectNode = pNode->GetSectionNode();
     484                 :            :                 OSL_ENSURE(pSectNode, "No section node!");
     485 [ #  # ][ #  # ]:          0 :                 xRet = SwXTextSections::GetObject( *pSectNode->GetSection().GetFmt() );
     486                 :            :             }
     487                 :          0 :             break;
     488                 :            :             case ND_TABLENODE :
     489                 :            :             {
     490                 :          0 :                 SwTableNode* pTblNode = pNode->GetTableNode();
     491                 :            :                 OSL_ENSURE(pTblNode, "No table node!");
     492                 :          0 :                 SwTable& rTbl = pTblNode->GetTable();
     493                 :          0 :                 SwFrmFmt* pTblFmt = rTbl.GetFrmFmt();
     494 [ #  # ][ #  # ]:          0 :                 xRet = SwXTextTables::GetObject( *pTblFmt );
     495                 :            :             }
     496                 :          0 :             break;
     497                 :            :             case ND_TEXTNODE :
     498                 :            :             {
     499                 :          0 :                 SwPosition* pPoint = 0;
     500 [ #  # ][ #  # ]:          0 :                 if(bStart || !pRedline->HasMark())
                 [ #  # ]
     501                 :          0 :                     pPoint = pRedline->GetPoint();
     502                 :            :                 else
     503                 :          0 :                     pPoint = pRedline->GetMark();
     504                 :            :                 const uno::Reference<text::XTextRange> xRange =
     505         [ #  # ]:          0 :                     SwXTextRange::CreateXTextRange(*pDoc, *pPoint, 0);
     506 [ #  # ][ #  # ]:          0 :                 xRet = xRange.get();
     507                 :            :             }
     508                 :          0 :             break;
     509                 :            :             default:
     510                 :            :                 OSL_FAIL("illegal node type");
     511                 :            :         }
     512         [ #  # ]:          0 :         aRet <<= xRet;
     513                 :            :     }
     514 [ #  # ][ #  # ]:          0 :     else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
                 [ #  # ]
     515                 :            :     {
     516                 :          0 :         SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
     517         [ #  # ]:          0 :         if( pNodeIdx )
     518                 :            :         {
     519         [ #  # ]:          0 :             if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     520                 :            :             {
     521 [ #  # ][ #  # ]:          0 :                 uno::Reference<text::XText> xRet = new SwXRedlineText(pDoc, *pNodeIdx);
         [ #  # ][ #  # ]
                 [ #  # ]
     522         [ #  # ]:          0 :                 aRet <<= xRet;
     523                 :            :             }
     524                 :            :             else {
     525                 :            :                 OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     526                 :            :             }
     527                 :            :         }
     528                 :            :     }
     529                 :            :     else
     530                 :          0 :         aRet = SwXRedlinePortion::GetPropertyValue(rPropertyName, *pRedline);
     531         [ #  # ]:          0 :     return aRet;
     532                 :            : }
     533                 :            : 
     534                 :          0 : void SwXRedline::addPropertyChangeListener(
     535                 :            :     const OUString& /*aPropertyName*/,
     536                 :            :     const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
     537                 :            :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     538                 :            : {
     539                 :          0 : }
     540                 :            : 
     541                 :          0 : void SwXRedline::removePropertyChangeListener(
     542                 :            :     const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
     543                 :            :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     544                 :            : {
     545                 :          0 : }
     546                 :            : 
     547                 :          0 : void SwXRedline::addVetoableChangeListener(
     548                 :            :     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     549                 :            :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     550                 :            : {
     551                 :          0 : }
     552                 :            : 
     553                 :          0 : void SwXRedline::removeVetoableChangeListener(
     554                 :            :     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     555                 :            :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     556                 :            : {
     557                 :          0 : }
     558                 :            : 
     559                 :          0 : void SwXRedline::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     560                 :            : {
     561                 :          0 :     ClientModify(this, pOld, pNew);
     562         [ #  # ]:          0 :     if(!GetRegisteredIn())
     563                 :            :       {
     564                 :          0 :         pDoc = 0;
     565                 :          0 :         pRedline = 0;
     566                 :            :     }
     567                 :          0 : }
     568                 :            : 
     569                 :          0 : uno::Reference< container::XEnumeration >  SwXRedline::createEnumeration(void) throw( uno::RuntimeException )
     570                 :            : {
     571         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     572                 :          0 :     uno::Reference< container::XEnumeration > xRet;
     573         [ #  # ]:          0 :     if(!pDoc)
     574         [ #  # ]:          0 :         throw uno::RuntimeException();
     575                 :            : 
     576                 :          0 :     SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
     577         [ #  # ]:          0 :     if(pNodeIndex)
     578                 :            :     {
     579         [ #  # ]:          0 :         SwPaM aPam(*pNodeIndex);
     580         [ #  # ]:          0 :         aPam.Move(fnMoveForward, fnGoNode);
     581                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     582                 :            :         ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     583 [ #  # ][ #  # ]:          0 :             GetDoc()->CreateUnoCrsr(*aPam.Start(), sal_False));
                 [ #  # ]
     584                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     585 [ #  # ][ #  # ]:          0 :         xRet = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     586                 :            :     }
     587         [ #  # ]:          0 :     return xRet;
     588                 :            : }
     589                 :            : 
     590                 :          0 : uno::Type SwXRedline::getElementType(  ) throw(uno::RuntimeException)
     591                 :            : {
     592                 :          0 :     return ::getCppuType((uno::Reference<text::XTextRange>*)0);
     593                 :            : }
     594                 :            : 
     595                 :          0 : sal_Bool SwXRedline::hasElements(  ) throw(uno::RuntimeException)
     596                 :            : {
     597         [ #  # ]:          0 :     if(!pDoc)
     598         [ #  # ]:          0 :         throw uno::RuntimeException();
     599                 :          0 :     return 0 != pRedline->GetContentIdx();
     600                 :            : }
     601                 :            : 
     602                 :          0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursor(void) throw( uno::RuntimeException )
     603                 :            : {
     604         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     605         [ #  # ]:          0 :     if(!pDoc)
     606         [ #  # ]:          0 :         throw uno::RuntimeException();
     607                 :            : 
     608                 :          0 :     uno::Reference< text::XTextCursor >     xRet;
     609                 :          0 :     SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
     610         [ #  # ]:          0 :     if(pNodeIndex)
     611                 :            :     {
     612         [ #  # ]:          0 :         SwPosition aPos(*pNodeIndex);
     613                 :            :         SwXTextCursor *const pXCursor =
     614 [ #  # ][ #  # ]:          0 :             new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos);
     615         [ #  # ]:          0 :         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     616         [ #  # ]:          0 :         pUnoCrsr->Move(fnMoveForward, fnGoNode);
     617                 :            : 
     618                 :            :         //steht hier eine Tabelle?
     619         [ #  # ]:          0 :         SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
     620                 :          0 :         SwCntntNode* pCont = 0;
     621         [ #  # ]:          0 :         while( pTblNode )
     622                 :            :         {
     623         [ #  # ]:          0 :             pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
     624 [ #  # ][ #  # ]:          0 :             pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
                 [ #  # ]
     625         [ #  # ]:          0 :             pTblNode = pCont->FindTableNode();
     626                 :            :         }
     627         [ #  # ]:          0 :         if(pCont)
     628 [ #  # ][ #  # ]:          0 :             pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
     629 [ #  # ][ #  # ]:          0 :         xRet = static_cast<text::XWordCursor*>(pXCursor);
                 [ #  # ]
     630                 :            :     }
     631                 :            :     else
     632                 :            :     {
     633         [ #  # ]:          0 :         throw uno::RuntimeException();
     634                 :            :     }
     635         [ #  # ]:          0 :     return xRet;
     636                 :            : }
     637                 :            : 
     638                 :          0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursorByRange(
     639                 :            :     const uno::Reference< text::XTextRange > & /*aTextPosition*/)
     640                 :            :         throw( uno::RuntimeException )
     641                 :            : {
     642         [ #  # ]:          0 :     throw uno::RuntimeException();
     643                 :            : }
     644                 :            : 
     645                 :          0 : uno::Any SwXRedline::queryInterface( const uno::Type& rType )
     646                 :            :     throw(uno::RuntimeException)
     647                 :            : {
     648                 :          0 :     uno::Any aRet = SwXText::queryInterface(rType);
     649         [ #  # ]:          0 :     if(!aRet.hasValue())
     650                 :            :     {
     651         [ #  # ]:          0 :         aRet = SwXRedlineBaseClass::queryInterface(rType);
     652                 :            :     }
     653                 :          0 :     return aRet;
     654                 :            : }
     655                 :            : 
     656                 :          0 : uno::Sequence<uno::Type> SwXRedline::getTypes()
     657                 :            :     throw(uno::RuntimeException)
     658                 :            : {
     659         [ #  # ]:          0 :     uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
     660         [ #  # ]:          0 :     uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes();
     661                 :          0 :     const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
     662                 :          0 :     sal_Int32 nCurType = aTypes.getLength();
     663         [ #  # ]:          0 :     aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength());
     664         [ #  # ]:          0 :     uno::Type* pTypes = aTypes.getArray();
     665         [ #  # ]:          0 :     for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++)
     666                 :          0 :         pTypes[nCurType++] = pBaseTypes[nType];
     667         [ #  # ]:          0 :     return aTypes;
     668                 :            : }
     669                 :            : 
     670                 :            : namespace
     671                 :            : {
     672                 :            :     class theSwXRedlineImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXRedlineImplementationId > {};
     673                 :            : }
     674                 :            : 
     675                 :          0 : uno::Sequence<sal_Int8> SwXRedline::getImplementationId()
     676                 :            :     throw(uno::RuntimeException)
     677                 :            : {
     678                 :          0 :     return theSwXRedlineImplementationId::get().getSeq();
     679                 :            : }
     680                 :            : 
     681                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10