LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoredline.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 88 324 27.2 %
Date: 2014-11-03 Functions: 15 47 31.9 %
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          12 : SwXRedlineText::SwXRedlineText(SwDoc* _pDoc, SwNodeIndex aIndex) :
      52             :     SwXText(_pDoc, CURSOR_REDLINE),
      53          12 :     aNodeIndex(aIndex)
      54             : {
      55          12 : }
      56             : 
      57           8 : const SwStartNode* SwXRedlineText::GetStartNode() const
      58             : {
      59           8 :     return aNodeIndex.GetNode().GetStartNode();
      60             : }
      61             : 
      62          12 : uno::Any SwXRedlineText::queryInterface( const uno::Type& rType )
      63             :     throw(uno::RuntimeException, std::exception)
      64             : {
      65          12 :     uno::Any aRet;
      66             : 
      67          12 :     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          12 :         aRet = SwXText::queryInterface(rType);
      76          12 :         if(!aRet.hasValue())
      77             :         {
      78           0 :             aRet = OWeakObject::queryInterface(rType);
      79             :         }
      80             :     }
      81             : 
      82          12 :     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(void)
     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 :     SwUnoCrsr *const 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(void).
     119             : 
     120             :     // skip all tables at the beginning
     121          18 :     SwTableNode* pTableNode = pUnoCursor->GetNode().FindTableNode();
     122          18 :     SwCntntNode* 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(void)
     159             :     throw( uno::RuntimeException, std::exception )
     160             : {
     161           0 :     SolarMutexGuard aGuard;
     162           0 :     SwPaM aPam(aNodeIndex);
     163           0 :     aPam.Move(fnMoveForward, fnGoNode);
     164             :     ::std::unique_ptr<SwUnoCrsr> pUnoCursor(
     165           0 :         GetDoc()->CreateUnoCrsr(*aPam.Start(), false));
     166           0 :     return new SwXParagraphEnumeration(this, std::move(pUnoCursor), CURSOR_REDLINE);
     167             : }
     168             : 
     169           0 : uno::Type SwXRedlineText::getElementType(  ) throw(uno::RuntimeException, std::exception)
     170             : {
     171           0 :     return cppu::UnoType<text::XTextRange>::get();
     172             : }
     173             : 
     174           0 : sal_Bool SwXRedlineText::hasElements(  ) throw(uno::RuntimeException, std::exception)
     175             : {
     176           0 :     return sal_True;    // we always have a content index
     177             : }
     178             : 
     179         750 : SwXRedlinePortion::SwXRedlinePortion(SwRangeRedline const& rRedline,
     180             :         SwUnoCrsr const*const pPortionCrsr,
     181             :         uno::Reference< text::XText > const& xParent, bool const bStart)
     182             :     : SwXTextPortion(pPortionCrsr, xParent,
     183             :             (bStart) ? PORTION_REDLINE_START : PORTION_REDLINE_END)
     184         750 :     , m_rRedline(rRedline)
     185             : {
     186         750 :     SetCollapsed(!m_rRedline.HasMark());
     187         750 : }
     188             : 
     189        1500 : SwXRedlinePortion::~SwXRedlinePortion()
     190             : {
     191        1500 : }
     192             : 
     193          10 : static util::DateTime lcl_DateTimeToUno(const DateTime& rDT)
     194             : {
     195          10 :     util::DateTime aRetDT;
     196          10 :     aRetDT.Year = rDT.GetYear();
     197          10 :     aRetDT.Month= rDT.GetMonth();
     198          10 :     aRetDT.Day      = rDT.GetDay();
     199          10 :     aRetDT.Hours    = rDT.GetHour();
     200          10 :     aRetDT.Minutes = rDT.GetMin();
     201          10 :     aRetDT.Seconds = rDT.GetSec();
     202          10 :     aRetDT.NanoSeconds = rDT.GetNanoSec();
     203          10 :     return aRetDT;
     204             : }
     205             : 
     206          64 : static OUString lcl_RedlineTypeToOUString(RedlineType_t eType)
     207             : {
     208          64 :     OUString sRet;
     209          64 :     switch(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)
     210             :     {
     211          24 :         case nsRedlineType_t::REDLINE_INSERT: sRet = "Insert"; break;
     212          14 :         case nsRedlineType_t::REDLINE_DELETE: sRet = "Delete"; break;
     213          14 :         case nsRedlineType_t::REDLINE_FORMAT: sRet = "Format"; break;
     214          12 :         case nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT: sRet = "ParagraphFormat"; break;
     215           0 :         case nsRedlineType_t::REDLINE_TABLE:  sRet = "TextTable"; break;
     216           0 :         case nsRedlineType_t::REDLINE_FMTCOLL:sRet = "Style"; break;
     217             :     }
     218          64 :     return sRet;
     219             : }
     220             : 
     221           0 : static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRangeRedline& rRedline)
     222             : {
     223           0 :     uno::Sequence<beans::PropertyValue> aValues(4);
     224             : 
     225           0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     226           0 :     if(pNext)
     227             :     {
     228           0 :         beans::PropertyValue* pValues = aValues.getArray();
     229           0 :         pValues[0].Name = UNO_NAME_REDLINE_AUTHOR;
     230             :         // GetAuthorString(n) walks the SwRedlineData* chain;
     231             :         // here we always need element 1
     232           0 :         pValues[0].Value <<= rRedline.GetAuthorString(1);
     233           0 :         pValues[1].Name = UNO_NAME_REDLINE_DATE_TIME;
     234           0 :         pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
     235           0 :         pValues[2].Name = UNO_NAME_REDLINE_COMMENT;
     236           0 :         pValues[2].Value <<= pNext->GetComment();
     237           0 :         pValues[3].Name = UNO_NAME_REDLINE_TYPE;
     238           0 :         pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
     239             :     }
     240           0 :     return aValues;
     241             : }
     242             : 
     243         142 : uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
     244             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     245             : {
     246         142 :     SolarMutexGuard aGuard;
     247         142 :     Validate();
     248         142 :     uno::Any aRet;
     249         142 :     if(rPropertyName == UNO_NAME_REDLINE_TEXT)
     250             :     {
     251           0 :         SwNodeIndex* pNodeIdx = m_rRedline.GetContentIdx();
     252           0 :         if(pNodeIdx )
     253             :         {
     254           0 :             if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     255             :             {
     256           0 :                 SwUnoCrsr* pUnoCrsr = GetCursor();
     257           0 :                 uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
     258           0 :                 aRet <<= xRet;
     259             :             }
     260             :             else {
     261             :                 OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     262             :             }
     263             :         }
     264             :     }
     265             :     else
     266             :     {
     267         142 :         aRet = GetPropertyValue(rPropertyName, m_rRedline);
     268         194 :         if(!aRet.hasValue() &&
     269          52 :            rPropertyName != UNO_NAME_REDLINE_SUCCESSOR_DATA)
     270          52 :             aRet = SwXTextPortion::getPropertyValue(rPropertyName);
     271             :     }
     272         142 :     return aRet;
     273             : }
     274             : 
     275         142 : void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
     276             : {
     277         142 :     SwUnoCrsr* pUnoCrsr = GetCursor();
     278         142 :     if(!pUnoCrsr)
     279           0 :         throw uno::RuntimeException();
     280             :     //search for the redline
     281         142 :     SwDoc* pDoc = pUnoCrsr->GetDoc();
     282         142 :     const SwRedlineTbl& rRedTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
     283         142 :     bool bFound = false;
     284         880 :     for(size_t nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
     285         738 :         bFound = &m_rRedline == rRedTbl[nRed];
     286         142 :     if(!bFound)
     287           0 :         throw uno::RuntimeException();
     288         142 : }
     289             : 
     290           0 : uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId(  ) throw(uno::RuntimeException, std::exception)
     291             : {
     292           0 :     return css::uno::Sequence<sal_Int8>();
     293             : }
     294             : 
     295         142 : uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, const SwRangeRedline& rRedline ) throw()
     296             : {
     297         142 :     uno::Any aRet;
     298         142 :     if(rPropertyName == UNO_NAME_REDLINE_AUTHOR)
     299          16 :         aRet <<= rRedline.GetAuthorString();
     300         126 :     else if(rPropertyName == UNO_NAME_REDLINE_DATE_TIME)
     301             :     {
     302          10 :         aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     303             :     }
     304         116 :     else if(rPropertyName == UNO_NAME_REDLINE_COMMENT)
     305           0 :         aRet <<= rRedline.GetComment();
     306         116 :     else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
     307             :     {
     308          64 :         aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
     309             :     }
     310          52 :     else if(rPropertyName == UNO_NAME_REDLINE_SUCCESSOR_DATA)
     311             :     {
     312           0 :         if(rRedline.GetRedlineData().Next())
     313           0 :             aRet <<= lcl_GetSuccessorProperties(rRedline);
     314             :     }
     315          52 :     else if (rPropertyName == UNO_NAME_REDLINE_IDENTIFIER)
     316             :     {
     317           0 :         aRet <<= OUString::number(
     318           0 :             sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     319             :     }
     320          52 :     else if (rPropertyName == UNO_NAME_IS_IN_HEADER_FOOTER)
     321             :     {
     322             :         sal_Bool bRet =
     323           0 :             rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
     324           0 :         aRet.setValue(&bRet, ::getBooleanCppuType());
     325             :     }
     326          52 :     else if (rPropertyName == UNO_NAME_MERGE_LAST_PARA)
     327             :     {
     328           0 :         sal_Bool bRet = !rRedline.IsDelLastPara();
     329           0 :         aRet.setValue( &bRet, ::getBooleanCppuType() );
     330             :     }
     331         142 :     return aRet;
     332             : }
     333             : 
     334           0 : uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
     335             :     const SwRangeRedline& rRedline, bool bIsStart ) throw()
     336             : {
     337           0 :     uno::Sequence< beans::PropertyValue > aRet(11);
     338           0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     339           0 :     beans::PropertyValue* pRet = aRet.getArray();
     340             : 
     341           0 :     sal_Int32 nPropIdx  = 0;
     342           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_AUTHOR;
     343           0 :     pRet[nPropIdx++].Value <<= rRedline.GetAuthorString();
     344           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_DATE_TIME;
     345           0 :     pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     346           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_COMMENT;
     347           0 :     pRet[nPropIdx++].Value <<= rRedline.GetComment();
     348           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_TYPE;
     349           0 :     pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
     350           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_IDENTIFIER;
     351           0 :     pRet[nPropIdx++].Value <<= OUString::number(
     352           0 :         sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     353           0 :     pRet[nPropIdx].Name = UNO_NAME_IS_COLLAPSED;
     354           0 :     sal_Bool bTmp = !rRedline.HasMark();
     355           0 :     pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
     356             : 
     357           0 :     pRet[nPropIdx].Name = UNO_NAME_IS_START;
     358           0 :     pRet[nPropIdx++].Value.setValue(&bIsStart, ::getBooleanCppuType()) ;
     359             : 
     360           0 :     bTmp = !rRedline.IsDelLastPara();
     361           0 :     pRet[nPropIdx].Name = UNO_NAME_MERGE_LAST_PARA;
     362           0 :     pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
     363             : 
     364           0 :     SwNodeIndex* pNodeIdx = rRedline.GetContentIdx();
     365           0 :     if(pNodeIdx )
     366             :     {
     367           0 :         if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     368             :         {
     369           0 :             uno::Reference<text::XText> xRet = new SwXRedlineText(rRedline.GetDoc(), *pNodeIdx);
     370           0 :             pRet[nPropIdx].Name = UNO_NAME_REDLINE_TEXT;
     371           0 :             pRet[nPropIdx++].Value <<= xRet;
     372             :         }
     373             :         else {
     374             :             OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     375             :         }
     376             :     }
     377           0 :     if(pNext)
     378             :     {
     379           0 :         pRet[nPropIdx].Name = UNO_NAME_REDLINE_SUCCESSOR_DATA;
     380           0 :         pRet[nPropIdx++].Value <<= lcl_GetSuccessorProperties(rRedline);
     381             :     }
     382           0 :     aRet.realloc(nPropIdx);
     383           0 :     return aRet;
     384             : }
     385             : 
     386           0 : TYPEINIT1(SwXRedline, SwClient);
     387           0 : SwXRedline::SwXRedline(SwRangeRedline& rRedline, SwDoc& rDoc) :
     388             :     SwXText(&rDoc, CURSOR_REDLINE),
     389             :     pDoc(&rDoc),
     390           0 :     pRedline(&rRedline)
     391             : {
     392           0 :     pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
     393           0 : }
     394             : 
     395           0 : SwXRedline::~SwXRedline()
     396             : {
     397           0 : }
     398             : 
     399           0 : uno::Reference< beans::XPropertySetInfo > SwXRedline::getPropertySetInfo(  ) throw(uno::RuntimeException, std::exception)
     400             : {
     401             :     static uno::Reference< beans::XPropertySetInfo >  xRef =
     402           0 :         aSwMapProvider.GetPropertySet(PROPERTY_MAP_REDLINE)->getPropertySetInfo();
     403           0 :     return xRef;
     404             : }
     405             : 
     406           0 : void SwXRedline::setPropertyValue( const OUString& rPropertyName, const uno::Any& aValue )
     407             :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
     408             :         lang::WrappedTargetException, uno::RuntimeException, std::exception)
     409             : {
     410           0 :     SolarMutexGuard aGuard;
     411           0 :     if(!pDoc)
     412           0 :         throw uno::RuntimeException();
     413           0 :     if(rPropertyName == UNO_NAME_REDLINE_AUTHOR)
     414             :     {
     415             :         OSL_FAIL("currently not available");
     416             :     }
     417           0 :     else if(rPropertyName == UNO_NAME_REDLINE_DATE_TIME)
     418             :     {
     419             :         OSL_FAIL("currently not available");
     420             :     }
     421           0 :     else if(rPropertyName == UNO_NAME_REDLINE_COMMENT)
     422             :     {
     423           0 :         OUString sTmp; aValue >>= sTmp;
     424           0 :         pRedline->SetComment(sTmp);
     425             :     }
     426           0 :     else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
     427             :     {
     428             :         OSL_FAIL("currently not available");
     429           0 :         OUString sTmp; aValue >>= sTmp;
     430           0 :         if(sTmp.isEmpty())
     431           0 :             throw lang::IllegalArgumentException();
     432             :     }
     433           0 :     else if(rPropertyName == UNO_NAME_REDLINE_SUCCESSOR_DATA)
     434             :     {
     435             :         OSL_FAIL("currently not available");
     436             :     }
     437             :     else
     438             :     {
     439           0 :         throw lang::IllegalArgumentException();
     440           0 :     }
     441           0 : }
     442             : 
     443           0 : uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName )
     444             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     445             : {
     446           0 :     SolarMutexGuard aGuard;
     447           0 :     if(!pDoc)
     448           0 :         throw uno::RuntimeException();
     449           0 :     uno::Any aRet;
     450           0 :     bool bStart = rPropertyName == UNO_NAME_REDLINE_START;
     451           0 :     if(bStart ||
     452           0 :         rPropertyName == UNO_NAME_REDLINE_END)
     453             :     {
     454           0 :         uno::Reference<XInterface> xRet;
     455           0 :         SwNode* pNode = &pRedline->GetNode();
     456           0 :         if(!bStart && pRedline->HasMark())
     457           0 :             pNode = &pRedline->GetNode(false);
     458           0 :         switch(pNode->GetNodeType())
     459             :         {
     460             :             case ND_SECTIONNODE:
     461             :             {
     462           0 :                 SwSectionNode* pSectNode = pNode->GetSectionNode();
     463             :                 OSL_ENSURE(pSectNode, "No section node!");
     464           0 :                 xRet = SwXTextSections::GetObject( *pSectNode->GetSection().GetFmt() );
     465             :             }
     466           0 :             break;
     467             :             case ND_TABLENODE :
     468             :             {
     469           0 :                 SwTableNode* pTblNode = pNode->GetTableNode();
     470             :                 OSL_ENSURE(pTblNode, "No table node!");
     471           0 :                 SwTable& rTbl = pTblNode->GetTable();
     472           0 :                 SwFrmFmt* pTblFmt = rTbl.GetFrmFmt();
     473           0 :                 xRet = SwXTextTables::GetObject( *pTblFmt );
     474             :             }
     475           0 :             break;
     476             :             case ND_TEXTNODE :
     477             :             {
     478           0 :                 SwPosition* pPoint = 0;
     479           0 :                 if(bStart || !pRedline->HasMark())
     480           0 :                     pPoint = pRedline->GetPoint();
     481             :                 else
     482           0 :                     pPoint = pRedline->GetMark();
     483             :                 const uno::Reference<text::XTextRange> xRange =
     484           0 :                     SwXTextRange::CreateXTextRange(*pDoc, *pPoint, 0);
     485           0 :                 xRet = xRange.get();
     486             :             }
     487           0 :             break;
     488             :             default:
     489             :                 OSL_FAIL("illegal node type");
     490             :         }
     491           0 :         aRet <<= xRet;
     492             :     }
     493           0 :     else if(rPropertyName == UNO_NAME_REDLINE_TEXT)
     494             :     {
     495           0 :         SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
     496           0 :         if( pNodeIdx )
     497             :         {
     498           0 :             if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     499             :             {
     500           0 :                 uno::Reference<text::XText> xRet = new SwXRedlineText(pDoc, *pNodeIdx);
     501           0 :                 aRet <<= xRet;
     502             :             }
     503             :             else {
     504             :                 OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     505             :             }
     506             :         }
     507             :     }
     508             :     else
     509           0 :         aRet = SwXRedlinePortion::GetPropertyValue(rPropertyName, *pRedline);
     510           0 :     return aRet;
     511             : }
     512             : 
     513           0 : void SwXRedline::addPropertyChangeListener(
     514             :     const OUString& /*aPropertyName*/,
     515             :     const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
     516             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     517             : {
     518           0 : }
     519             : 
     520           0 : void SwXRedline::removePropertyChangeListener(
     521             :     const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
     522             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     523             : {
     524           0 : }
     525             : 
     526           0 : void SwXRedline::addVetoableChangeListener(
     527             :     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     528             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     529             : {
     530           0 : }
     531             : 
     532           0 : void SwXRedline::removeVetoableChangeListener(
     533             :     const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     534             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     535             : {
     536           0 : }
     537             : 
     538           0 : void SwXRedline::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     539             : {
     540           0 :     ClientModify(this, pOld, pNew);
     541           0 :     if(!GetRegisteredIn())
     542             :       {
     543           0 :         pDoc = 0;
     544           0 :         pRedline = 0;
     545             :     }
     546           0 : }
     547             : 
     548           0 : uno::Reference< container::XEnumeration >  SwXRedline::createEnumeration(void) throw( uno::RuntimeException, std::exception )
     549             : {
     550           0 :     SolarMutexGuard aGuard;
     551           0 :     uno::Reference< container::XEnumeration > xRet;
     552           0 :     if(!pDoc)
     553           0 :         throw uno::RuntimeException();
     554             : 
     555           0 :     SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
     556           0 :     if(pNodeIndex)
     557             :     {
     558           0 :         SwPaM aPam(*pNodeIndex);
     559           0 :         aPam.Move(fnMoveForward, fnGoNode);
     560             :         ::std::unique_ptr<SwUnoCrsr> pUnoCursor(
     561           0 :             GetDoc()->CreateUnoCrsr(*aPam.Start(), false));
     562           0 :         xRet = new SwXParagraphEnumeration(this, std::move(pUnoCursor), CURSOR_REDLINE);
     563             :     }
     564           0 :     return xRet;
     565             : }
     566             : 
     567           0 : uno::Type SwXRedline::getElementType(  ) throw(uno::RuntimeException, std::exception)
     568             : {
     569           0 :     return cppu::UnoType<text::XTextRange>::get();
     570             : }
     571             : 
     572           0 : sal_Bool SwXRedline::hasElements(  ) throw(uno::RuntimeException, std::exception)
     573             : {
     574           0 :     if(!pDoc)
     575           0 :         throw uno::RuntimeException();
     576           0 :     return 0 != pRedline->GetContentIdx();
     577             : }
     578             : 
     579           0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursor(void) throw( uno::RuntimeException, std::exception )
     580             : {
     581           0 :     SolarMutexGuard aGuard;
     582           0 :     if(!pDoc)
     583           0 :         throw uno::RuntimeException();
     584             : 
     585           0 :     uno::Reference< text::XTextCursor >     xRet;
     586           0 :     SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
     587           0 :     if(pNodeIndex)
     588             :     {
     589           0 :         SwPosition aPos(*pNodeIndex);
     590             :         SwXTextCursor *const pXCursor =
     591           0 :             new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos);
     592           0 :         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     593           0 :         pUnoCrsr->Move(fnMoveForward, fnGoNode);
     594             : 
     595             :         // is here a table?
     596           0 :         SwTableNode* pTblNode = pUnoCrsr->GetNode().FindTableNode();
     597           0 :         SwCntntNode* pCont = 0;
     598           0 :         while( pTblNode )
     599             :         {
     600           0 :             pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
     601           0 :             pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
     602           0 :             pTblNode = pCont->FindTableNode();
     603             :         }
     604           0 :         if(pCont)
     605           0 :             pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
     606           0 :         xRet = static_cast<text::XWordCursor*>(pXCursor);
     607             :     }
     608             :     else
     609             :     {
     610           0 :         throw uno::RuntimeException();
     611             :     }
     612           0 :     return xRet;
     613             : }
     614             : 
     615           0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursorByRange(
     616             :     const uno::Reference< text::XTextRange > & /*aTextPosition*/)
     617             :         throw( uno::RuntimeException, std::exception )
     618             : {
     619           0 :     throw uno::RuntimeException();
     620             : }
     621             : 
     622           0 : uno::Any SwXRedline::queryInterface( const uno::Type& rType )
     623             :     throw(uno::RuntimeException, std::exception)
     624             : {
     625           0 :     uno::Any aRet = SwXText::queryInterface(rType);
     626           0 :     if(!aRet.hasValue())
     627             :     {
     628           0 :         aRet = SwXRedlineBaseClass::queryInterface(rType);
     629             :     }
     630           0 :     return aRet;
     631             : }
     632             : 
     633           0 : uno::Sequence<uno::Type> SwXRedline::getTypes()
     634             :     throw(uno::RuntimeException, std::exception)
     635             : {
     636           0 :     uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
     637           0 :     uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes();
     638           0 :     const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
     639           0 :     sal_Int32 nCurType = aTypes.getLength();
     640           0 :     aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength());
     641           0 :     uno::Type* pTypes = aTypes.getArray();
     642           0 :     for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++)
     643           0 :         pTypes[nCurType++] = pBaseTypes[nType];
     644           0 :     return aTypes;
     645             : }
     646             : 
     647           0 : uno::Sequence<sal_Int8> SwXRedline::getImplementationId()
     648             :     throw(uno::RuntimeException, std::exception)
     649             : {
     650           0 :     return css::uno::Sequence<sal_Int8>();
     651         270 : }
     652             : 
     653             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10