LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoredline.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 74 325 22.8 %
Date: 2014-04-11 Functions: 12 45 26.7 %
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 <com/sun/star/util/DateTime.hpp>
      21             : #include <com/sun/star/text/XTextTable.hpp>
      22             : 
      23             : #include <rtl/ustrbuf.hxx>
      24             : #include <osl/mutex.hxx>
      25             : #include <vcl/svapp.hxx>
      26             : #include <comphelper/servicehelper.hxx>
      27             : 
      28             : #include <pagedesc.hxx>
      29             : #include "poolfmt.hxx"
      30             : #include <redline.hxx>
      31             : #include <section.hxx>
      32             : #include <unoprnms.hxx>
      33             : #include <unomid.h>
      34             : #include <unotextrange.hxx>
      35             : #include <unotextcursor.hxx>
      36             : #include <unoparagraph.hxx>
      37             : #include <unocoll.hxx>
      38             : #include <unomap.hxx>
      39             : #include <unocrsr.hxx>
      40             : #include <unoport.hxx>
      41             : #include <unoredline.hxx>
      42             : #include <doc.hxx>
      43             : #include <docary.hxx>
      44             : 
      45             : using namespace ::com::sun::star;
      46             : 
      47           1 : SwXRedlineText::SwXRedlineText(SwDoc* _pDoc, SwNodeIndex aIndex) :
      48             :     SwXText(_pDoc, CURSOR_REDLINE),
      49           1 :     aNodeIndex(aIndex)
      50             : {
      51           1 : }
      52             : 
      53           1 : const SwStartNode* SwXRedlineText::GetStartNode() const
      54             : {
      55           1 :     return aNodeIndex.GetNode().GetStartNode();
      56             : }
      57             : 
      58           1 : uno::Any SwXRedlineText::queryInterface( const uno::Type& rType )
      59             :     throw(uno::RuntimeException, std::exception)
      60             : {
      61           1 :     uno::Any aRet;
      62             : 
      63           1 :     if (::getCppuType((uno::Reference<container::XEnumerationAccess> *)0) == rType)
      64             :     {
      65           0 :         uno::Reference<container::XEnumerationAccess> aAccess = this;
      66           0 :         aRet <<= aAccess;
      67             :     }
      68             :     else
      69             :     {
      70             :         // delegate to SwXText and OWeakObject
      71           1 :         aRet = SwXText::queryInterface(rType);
      72           1 :         if(!aRet.hasValue())
      73             :         {
      74           0 :             aRet = OWeakObject::queryInterface(rType);
      75             :         }
      76             :     }
      77             : 
      78           1 :     return aRet;
      79             : }
      80             : 
      81           0 : uno::Sequence<uno::Type> SwXRedlineText::getTypes()
      82             :     throw(uno::RuntimeException, std::exception)
      83             : {
      84             :     // SwXText::getTypes()
      85           0 :     uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
      86             : 
      87             :     // add container::XEnumerationAccess
      88           0 :     sal_Int32 nLength = aTypes.getLength();
      89           0 :     aTypes.realloc(nLength + 1);
      90           0 :     aTypes[nLength] = ::getCppuType((uno::Reference<container::XEnumerationAccess> *)0);
      91             : 
      92           0 :     return aTypes;
      93             : }
      94             : 
      95           0 : uno::Sequence<sal_Int8> SwXRedlineText::getImplementationId()
      96             :     throw(uno::RuntimeException, std::exception)
      97             : {
      98           0 :     return css::uno::Sequence<sal_Int8>();
      99             : }
     100             : 
     101           2 : uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor(void)
     102             :     throw( uno::RuntimeException, std::exception )
     103             : {
     104           2 :     SolarMutexGuard aGuard;
     105             : 
     106           4 :     SwPosition aPos(aNodeIndex);
     107             :     SwXTextCursor *const pXCursor =
     108           2 :         new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos);
     109           2 :     SwUnoCrsr *const pUnoCursor = pXCursor->GetCursor();
     110           2 :     pUnoCursor->Move(fnMoveForward, fnGoNode);
     111             : 
     112             :     // #101929# prevent a newly created text cursor from running inside a table
     113             :     // because table cells have their own XText.
     114             :     // Patterned after SwXTextFrame::createTextCursor(void).
     115             : 
     116             :     // skip all tables at the beginning
     117           2 :     SwTableNode* pTableNode = pUnoCursor->GetNode()->FindTableNode();
     118           2 :     SwCntntNode* pContentNode = NULL;
     119           2 :     bool bTable = pTableNode != NULL;
     120           4 :     while( pTableNode != NULL )
     121             :     {
     122           0 :         pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode());
     123           0 :         pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode);
     124           0 :         pTableNode = pContentNode->FindTableNode();
     125             :     }
     126           2 :     if( pContentNode != NULL )
     127           0 :         pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 );
     128           2 :     if( bTable && pUnoCursor->GetNode()->FindSttNodeByType( SwNormalStartNode )
     129           0 :                                                             != GetStartNode() )
     130             :     {
     131             :         // We have gone too far and have left our own redline. This means that
     132             :         // no content node outside of a table could be found, and therefore we
     133             :         // except.
     134           0 :         uno::RuntimeException aExcept;
     135           0 :         aExcept.Message = OUString(
     136             :             "No content node found that is inside this change section "
     137           0 :             "but outside of a table" );
     138           0 :         throw aExcept;
     139             :     }
     140             : 
     141           4 :     return static_cast<text::XWordCursor*>(pXCursor);
     142             : }
     143             : 
     144           2 : uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursorByRange(
     145             :     const uno::Reference<text::XTextRange> & aTextRange)
     146             :         throw( uno::RuntimeException, std::exception )
     147             : {
     148           2 :     uno::Reference<text::XTextCursor> xCursor = createTextCursor();
     149           2 :     xCursor->gotoRange(aTextRange->getStart(), sal_False);
     150           2 :     xCursor->gotoRange(aTextRange->getEnd(), sal_True);
     151           2 :     return xCursor;
     152             : }
     153             : 
     154           0 : uno::Reference<container::XEnumeration> SwXRedlineText::createEnumeration(void)
     155             :     throw( uno::RuntimeException, std::exception )
     156             : {
     157           0 :     SolarMutexGuard aGuard;
     158           0 :     SwPaM aPam(aNodeIndex);
     159           0 :     aPam.Move(fnMoveForward, fnGoNode);
     160             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     161             :     ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     162           0 :         GetDoc()->CreateUnoCrsr(*aPam.Start(), false));
     163             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     164           0 :     return new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
     165             : }
     166             : 
     167           0 : uno::Type SwXRedlineText::getElementType(  ) throw(uno::RuntimeException, std::exception)
     168             : {
     169           0 :     return ::getCppuType((uno::Reference<text::XTextRange>*)0);
     170             : }
     171             : 
     172           0 : sal_Bool SwXRedlineText::hasElements(  ) throw(uno::RuntimeException, std::exception)
     173             : {
     174           0 :     return sal_True;    // we always have a content index
     175             : }
     176             : 
     177          48 : SwXRedlinePortion::SwXRedlinePortion(SwRangeRedline const& rRedline,
     178             :         SwUnoCrsr const*const pPortionCrsr,
     179             :         uno::Reference< text::XText > const& xParent, bool const bStart)
     180             :     : SwXTextPortion(pPortionCrsr, xParent,
     181             :             (bStart) ? PORTION_REDLINE_START : PORTION_REDLINE_END)
     182          48 :     , m_rRedline(rRedline)
     183             : {
     184          48 :     SetCollapsed(!m_rRedline.HasMark());
     185          48 : }
     186             : 
     187          96 : SwXRedlinePortion::~SwXRedlinePortion()
     188             : {
     189          96 : }
     190             : 
     191           0 : static util::DateTime lcl_DateTimeToUno(const DateTime& rDT)
     192             : {
     193           0 :     util::DateTime aRetDT;
     194           0 :     aRetDT.Year = rDT.GetYear();
     195           0 :     aRetDT.Month= rDT.GetMonth();
     196           0 :     aRetDT.Day      = rDT.GetDay();
     197           0 :     aRetDT.Hours    = rDT.GetHour();
     198           0 :     aRetDT.Minutes = rDT.GetMin();
     199           0 :     aRetDT.Seconds = rDT.GetSec();
     200           0 :     aRetDT.NanoSeconds = rDT.GetNanoSec();
     201           0 :     return aRetDT;
     202             : }
     203             : 
     204          10 : static OUString lcl_RedlineTypeToOUString(RedlineType_t eType)
     205             : {
     206          10 :     OUString sRet;
     207          10 :     switch(eType & nsRedlineType_t::REDLINE_NO_FLAG_MASK)
     208             :     {
     209           2 :         case nsRedlineType_t::REDLINE_INSERT: sRet = "Insert"; break;
     210           4 :         case nsRedlineType_t::REDLINE_DELETE: sRet = "Delete"; break;
     211           4 :         case nsRedlineType_t::REDLINE_FORMAT: sRet = "Format"; break;
     212           0 :         case nsRedlineType_t::REDLINE_TABLE:  sRet = "TextTable"; break;
     213           0 :         case nsRedlineType_t::REDLINE_FMTCOLL:sRet = "Style"; break;
     214             :     }
     215          10 :     return sRet;
     216             : }
     217             : 
     218           0 : static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRangeRedline& rRedline)
     219             : {
     220           0 :     uno::Sequence<beans::PropertyValue> aValues(4);
     221             : 
     222           0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     223           0 :     if(pNext)
     224             :     {
     225           0 :         beans::PropertyValue* pValues = aValues.getArray();
     226           0 :         pValues[0].Name = UNO_NAME_REDLINE_AUTHOR;
     227             :         // GetAuthorString(n) walks the SwRedlineData* chain;
     228             :         // here we always need element 1
     229           0 :         pValues[0].Value <<= OUString(rRedline.GetAuthorString(1));
     230           0 :         pValues[1].Name = UNO_NAME_REDLINE_DATE_TIME;
     231           0 :         pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
     232           0 :         pValues[2].Name = UNO_NAME_REDLINE_COMMENT;
     233           0 :         pValues[2].Value <<= OUString(pNext->GetComment());
     234           0 :         pValues[3].Name = UNO_NAME_REDLINE_TYPE;
     235           0 :         pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
     236             :     }
     237           0 :     return aValues;
     238             : }
     239             : 
     240          14 : uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
     241             :         throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     242             : {
     243          14 :     SolarMutexGuard aGuard;
     244          14 :     Validate();
     245          14 :     uno::Any aRet;
     246          14 :     if(rPropertyName == UNO_NAME_REDLINE_TEXT)
     247             :     {
     248           0 :         SwNodeIndex* pNodeIdx = m_rRedline.GetContentIdx();
     249           0 :         if(pNodeIdx )
     250             :         {
     251           0 :             if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
     252             :             {
     253           0 :                 SwUnoCrsr* pUnoCrsr = GetCursor();
     254           0 :                 uno::Reference<text::XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
     255           0 :                 aRet <<= xRet;
     256             :             }
     257             :             else {
     258             :                 OSL_FAIL("Empty section in redline portion! (end node immediately follows start node)");
     259             :             }
     260             :         }
     261             :     }
     262             :     else
     263             :     {
     264          14 :         aRet = GetPropertyValue(rPropertyName, m_rRedline);
     265          18 :         if(!aRet.hasValue() &&
     266           4 :            rPropertyName != UNO_NAME_REDLINE_SUCCESSOR_DATA)
     267           4 :             aRet = SwXTextPortion::getPropertyValue(rPropertyName);
     268             :     }
     269          14 :     return aRet;
     270             : }
     271             : 
     272          14 : void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
     273             : {
     274          14 :     SwUnoCrsr* pUnoCrsr = GetCursor();
     275          14 :     if(!pUnoCrsr)
     276           0 :         throw uno::RuntimeException();
     277             :     //search for the redline
     278          14 :     SwDoc* pDoc = pUnoCrsr->GetDoc();
     279          14 :     const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
     280          14 :     bool bFound = false;
     281          30 :     for(sal_uInt16 nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
     282          16 :         bFound = &m_rRedline == rRedTbl[nRed];
     283          14 :     if(!bFound)
     284           0 :         throw uno::RuntimeException();
     285          14 : }
     286             : 
     287           0 : uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId(  ) throw(uno::RuntimeException, std::exception)
     288             : {
     289           0 :     return css::uno::Sequence<sal_Int8>();
     290             : }
     291             : 
     292          14 : uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, const SwRangeRedline& rRedline ) throw()
     293             : {
     294          14 :     uno::Any aRet;
     295          14 :     if(rPropertyName == UNO_NAME_REDLINE_AUTHOR)
     296           0 :         aRet <<= OUString(rRedline.GetAuthorString());
     297          14 :     else if(rPropertyName == UNO_NAME_REDLINE_DATE_TIME)
     298             :     {
     299           0 :         aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     300             :     }
     301          14 :     else if(rPropertyName == UNO_NAME_REDLINE_COMMENT)
     302           0 :         aRet <<= OUString(rRedline.GetComment());
     303          14 :     else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
     304             :     {
     305          10 :         aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
     306             :     }
     307           4 :     else if(rPropertyName == UNO_NAME_REDLINE_SUCCESSOR_DATA)
     308             :     {
     309           0 :         if(rRedline.GetRedlineData().Next())
     310           0 :             aRet <<= lcl_GetSuccessorProperties(rRedline);
     311             :     }
     312           4 :     else if (rPropertyName == UNO_NAME_REDLINE_IDENTIFIER)
     313             :     {
     314           0 :         OUStringBuffer sBuf;
     315           0 :         sBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     316           0 :         aRet <<= sBuf.makeStringAndClear();
     317             :     }
     318           4 :     else if (rPropertyName == UNO_NAME_IS_IN_HEADER_FOOTER)
     319             :     {
     320             :         sal_Bool bRet =
     321           0 :             rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
     322           0 :         aRet.setValue(&bRet, ::getBooleanCppuType());
     323             :     }
     324           4 :     else if (rPropertyName == UNO_NAME_MERGE_LAST_PARA)
     325             :     {
     326           0 :         sal_Bool bRet = !rRedline.IsDelLastPara();
     327           0 :         aRet.setValue( &bRet, ::getBooleanCppuType() );
     328             :     }
     329          14 :     return aRet;
     330             : }
     331             : 
     332           0 : uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
     333             :     const SwRangeRedline& rRedline, sal_Bool bIsStart ) throw()
     334             : {
     335           0 :     uno::Sequence< beans::PropertyValue > aRet(11);
     336           0 :     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     337           0 :     beans::PropertyValue* pRet = aRet.getArray();
     338             : 
     339           0 :     OUStringBuffer sRedlineIdBuf;
     340           0 :     sRedlineIdBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     341             : 
     342           0 :     sal_Int32 nPropIdx  = 0;
     343           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_AUTHOR;
     344           0 :     pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString());
     345           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_DATE_TIME;
     346           0 :     pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     347           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_COMMENT;
     348           0 :     pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment());
     349           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_TYPE;
     350           0 :     pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
     351           0 :     pRet[nPropIdx].Name = UNO_NAME_REDLINE_IDENTIFIER;
     352           0 :     pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear();
     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->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 :     sal_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             :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     561             :         ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
     562           0 :             GetDoc()->CreateUnoCrsr(*aPam.Start(), false));
     563             :         SAL_WNODEPRECATED_DECLARATIONS_POP
     564           0 :         xRet = new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_REDLINE);
     565             :     }
     566           0 :     return xRet;
     567             : }
     568             : 
     569           0 : uno::Type SwXRedline::getElementType(  ) throw(uno::RuntimeException, std::exception)
     570             : {
     571           0 :     return ::getCppuType((uno::Reference<text::XTextRange>*)0);
     572             : }
     573             : 
     574           0 : sal_Bool SwXRedline::hasElements(  ) throw(uno::RuntimeException, std::exception)
     575             : {
     576           0 :     if(!pDoc)
     577           0 :         throw uno::RuntimeException();
     578           0 :     return 0 != pRedline->GetContentIdx();
     579             : }
     580             : 
     581           0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursor(void) throw( uno::RuntimeException, std::exception )
     582             : {
     583           0 :     SolarMutexGuard aGuard;
     584           0 :     if(!pDoc)
     585           0 :         throw uno::RuntimeException();
     586             : 
     587           0 :     uno::Reference< text::XTextCursor >     xRet;
     588           0 :     SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
     589           0 :     if(pNodeIndex)
     590             :     {
     591           0 :         SwPosition aPos(*pNodeIndex);
     592             :         SwXTextCursor *const pXCursor =
     593           0 :             new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos);
     594           0 :         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     595           0 :         pUnoCrsr->Move(fnMoveForward, fnGoNode);
     596             : 
     597             :         //steht hier eine Tabelle?
     598           0 :         SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
     599           0 :         SwCntntNode* pCont = 0;
     600           0 :         while( pTblNode )
     601             :         {
     602           0 :             pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
     603           0 :             pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
     604           0 :             pTblNode = pCont->FindTableNode();
     605             :         }
     606           0 :         if(pCont)
     607           0 :             pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
     608           0 :         xRet = static_cast<text::XWordCursor*>(pXCursor);
     609             :     }
     610             :     else
     611             :     {
     612           0 :         throw uno::RuntimeException();
     613             :     }
     614           0 :     return xRet;
     615             : }
     616             : 
     617           0 : uno::Reference< text::XTextCursor >  SwXRedline::createTextCursorByRange(
     618             :     const uno::Reference< text::XTextRange > & /*aTextPosition*/)
     619             :         throw( uno::RuntimeException, std::exception )
     620             : {
     621           0 :     throw uno::RuntimeException();
     622             : }
     623             : 
     624           0 : uno::Any SwXRedline::queryInterface( const uno::Type& rType )
     625             :     throw(uno::RuntimeException, std::exception)
     626             : {
     627           0 :     uno::Any aRet = SwXText::queryInterface(rType);
     628           0 :     if(!aRet.hasValue())
     629             :     {
     630           0 :         aRet = SwXRedlineBaseClass::queryInterface(rType);
     631             :     }
     632           0 :     return aRet;
     633             : }
     634             : 
     635           0 : uno::Sequence<uno::Type> SwXRedline::getTypes()
     636             :     throw(uno::RuntimeException, std::exception)
     637             : {
     638           0 :     uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
     639           0 :     uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes();
     640           0 :     const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
     641           0 :     sal_Int32 nCurType = aTypes.getLength();
     642           0 :     aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength());
     643           0 :     uno::Type* pTypes = aTypes.getArray();
     644           0 :     for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++)
     645           0 :         pTypes[nCurType++] = pBaseTypes[nType];
     646           0 :     return aTypes;
     647             : }
     648             : 
     649           0 : uno::Sequence<sal_Int8> SwXRedline::getImplementationId()
     650             :     throw(uno::RuntimeException, std::exception)
     651             : {
     652           0 :     return css::uno::Sequence<sal_Int8>();
     653             : }
     654             : 
     655             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10