LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoredline.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 78 310 25.2 %
Date: 2015-06-13 12:38:46 Functions: 14 46 30.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11