LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoflatpara.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 238 0.4 %
Date: 2015-06-13 12:38:46 Functions: 2 37 5.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 <editeng/unolingu.hxx>
      21             : 
      22             : #include <unobaseclass.hxx>
      23             : #include <unocrsrhelper.hxx>
      24             : #include <unoflatpara.hxx>
      25             : 
      26             : #include <osl/mutex.hxx>
      27             : #include <vcl/svapp.hxx>
      28             : #include <com/sun/star/text/TextMarkupType.hpp>
      29             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      30             : #include <unotextmarkup.hxx>
      31             : #include <ndtxt.hxx>
      32             : #include <doc.hxx>
      33             : #include <docsh.hxx>
      34             : #include <IDocumentLayoutAccess.hxx>
      35             : #include <IDocumentStylePoolAccess.hxx>
      36             : #include <viewsh.hxx>
      37             : #include <viewimp.hxx>
      38             : #include <breakit.hxx>
      39             : #include <pam.hxx>
      40             : #include <unotextrange.hxx>
      41             : #include <pagefrm.hxx>
      42             : #include <cntfrm.hxx>
      43             : #include <rootfrm.hxx>
      44             : #include <poolfmt.hxx>
      45             : #include <pagedesc.hxx>
      46             : #include <IGrammarContact.hxx>
      47             : #include <viewopt.hxx>
      48             : #include <comphelper/servicehelper.hxx>
      49             : #include <comphelper/propertysetinfo.hxx>
      50             : 
      51             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      52             : #include <com/sun/star/text/XTextRange.hpp>
      53             : 
      54             : using namespace ::com::sun::star;
      55             : 
      56             : namespace SwUnoCursorHelper {
      57             : 
      58             : uno::Reference<text::XFlatParagraphIterator>
      59           0 : CreateFlatParagraphIterator(SwDoc & rDoc, sal_Int32 const nTextMarkupType,
      60             :         bool const bAutomatic)
      61             : {
      62           0 :     return new SwXFlatParagraphIterator(rDoc, nTextMarkupType, bAutomatic);
      63             : }
      64             : 
      65             : }
      66             : 
      67           0 : SwXFlatParagraph::SwXFlatParagraph( SwTextNode& rTextNode, const OUString& aExpandText, const ModelToViewHelper& rMap )
      68             :     : SwXFlatParagraph_Base(& rTextNode, rMap)
      69           0 :     , maExpandText(aExpandText)
      70             : {
      71           0 : }
      72             : 
      73           0 : SwXFlatParagraph::~SwXFlatParagraph()
      74             : {
      75           0 : }
      76             : 
      77             : 
      78             : // XPropertySet
      79             : uno::Reference< beans::XPropertySetInfo > SAL_CALL
      80           0 : SwXFlatParagraph::getPropertySetInfo()
      81             : throw (uno::RuntimeException, std::exception)
      82             : {
      83             :     static comphelper::PropertyMapEntry s_Entries[] = {
      84           0 :         { OUString("FieldPositions"), -1, ::cppu::UnoType<uno::Sequence<sal_Int32>>::get(), beans::PropertyAttribute::READONLY, 0 },
      85           0 :         { OUString("FootnotePositions"), -1, ::cppu::UnoType<uno::Sequence<sal_Int32>>::get(), beans::PropertyAttribute::READONLY, 0 },
      86             :         { OUString(), -1, css::uno::Type(), 0, 0 }
      87           0 :     };
      88           0 :     return new comphelper::PropertySetInfo(s_Entries);
      89             : }
      90             : 
      91             : void SAL_CALL
      92           0 : SwXFlatParagraph::setPropertyValue(const OUString&, const uno::Any&)
      93             : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
      94             :         lang::IllegalArgumentException, lang::WrappedTargetException,
      95             :         uno::RuntimeException, std::exception)
      96             : {
      97             :     throw lang::IllegalArgumentException("no values can be set",
      98           0 :             static_cast< ::cppu::OWeakObject*>(this), 0);
      99             : }
     100             : 
     101             : uno::Any SAL_CALL
     102           0 : SwXFlatParagraph::getPropertyValue(const OUString& rPropertyName)
     103             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     104             :         uno::RuntimeException, std::exception)
     105             : {
     106           0 :     SolarMutexGuard g;
     107             : 
     108           0 :     if (rPropertyName == "FieldPositions")
     109             :     {
     110           0 :         uno::Sequence<sal_Int32> ret(GetConversionMap().getFieldPositions().size());
     111           0 :         std::copy(GetConversionMap().getFieldPositions().begin(),
     112           0 :                 GetConversionMap().getFieldPositions().end(), ret.begin());
     113           0 :         return uno::makeAny(ret);
     114             :     }
     115           0 :     else if (rPropertyName == "FootnotePositions")
     116             :     {
     117           0 :         uno::Sequence<sal_Int32> ret(GetConversionMap().getFootnotePositions().size());
     118           0 :         std::copy(GetConversionMap().getFootnotePositions().begin(),
     119           0 :                 GetConversionMap().getFootnotePositions().end(), ret.begin());
     120           0 :         return uno::makeAny(ret);
     121             :     }
     122           0 :     return uno::Any();
     123             : }
     124             : 
     125             : void SAL_CALL
     126           0 : SwXFlatParagraph::addPropertyChangeListener(
     127             :         const OUString& /*rPropertyName*/,
     128             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     129             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     130             :     uno::RuntimeException, std::exception)
     131             : {
     132             :     SAL_WARN("sw.uno",
     133             :         "SwXFlatParagraph::addPropertyChangeListener(): not implemented");
     134           0 : }
     135             : 
     136             : void SAL_CALL
     137           0 : SwXFlatParagraph::removePropertyChangeListener(
     138             :         const OUString& /*rPropertyName*/,
     139             :         const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
     140             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     141             :     uno::RuntimeException, std::exception)
     142             : {
     143             :     SAL_WARN("sw.uno",
     144             :         "SwXFlatParagraph::removePropertyChangeListener(): not implemented");
     145           0 : }
     146             : 
     147             : void SAL_CALL
     148           0 : SwXFlatParagraph::addVetoableChangeListener(
     149             :         const OUString& /*rPropertyName*/,
     150             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     151             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     152             :     uno::RuntimeException, std::exception)
     153             : {
     154             :     SAL_WARN("sw.uno",
     155             :         "SwXFlatParagraph::addVetoableChangeListener(): not implemented");
     156           0 : }
     157             : 
     158             : void SAL_CALL
     159           0 : SwXFlatParagraph::removeVetoableChangeListener(
     160             :         const OUString& /*rPropertyName*/,
     161             :         const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
     162             : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     163             :         uno::RuntimeException, std::exception)
     164             : {
     165             :     SAL_WARN("sw.uno",
     166             :         "SwXFlatParagraph::removeVetoableChangeListener(): not implemented");
     167           0 : }
     168             : 
     169             : 
     170           0 : css::uno::Reference< css::container::XStringKeyMap > SAL_CALL SwXFlatParagraph::getMarkupInfoContainer() throw (css::uno::RuntimeException, std::exception)
     171             : {
     172           0 :     return SwXTextMarkup::getMarkupInfoContainer();
     173             : }
     174             : 
     175           0 : void SAL_CALL SwXFlatParagraph::commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
     176             :                                                       const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer) throw (uno::RuntimeException, std::exception)
     177             : {
     178           0 :     SolarMutexGuard aGuard;
     179           0 :     SwXTextMarkup::commitTextRangeMarkup( nType, aIdentifier, xRange,  xMarkupInfoContainer );
     180           0 : }
     181             : 
     182           0 : void SAL_CALL SwXFlatParagraph::commitStringMarkup(::sal_Int32 nType, const OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer) throw (css::uno::RuntimeException, std::exception)
     183             : {
     184           0 :     SolarMutexGuard aGuard;
     185           0 :     SwXTextMarkup::commitStringMarkup( nType, rIdentifier, nStart, nLength,  rxMarkupInfoContainer );
     186           0 : }
     187             : 
     188             : // text::XFlatParagraph:
     189           0 : OUString SAL_CALL SwXFlatParagraph::getText() throw (uno::RuntimeException, std::exception)
     190             : {
     191           0 :     return maExpandText;
     192             : }
     193             : 
     194             : // text::XFlatParagraph:
     195           0 : void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, sal_Bool bVal ) throw (uno::RuntimeException, std::exception)
     196             : {
     197           0 :     SolarMutexGuard aGuard;
     198             : 
     199           0 :     if (GetTextNode())
     200             :     {
     201           0 :         if ( text::TextMarkupType::SPELLCHECK == nType )
     202           0 :             GetTextNode()->SetWrongDirty( !bVal );
     203           0 :         else if ( text::TextMarkupType::SMARTTAG == nType )
     204           0 :             GetTextNode()->SetSmartTagDirty( !bVal );
     205           0 :         else if( text::TextMarkupType::PROOFREADING == nType )
     206             :         {
     207           0 :             GetTextNode()->SetGrammarCheckDirty( !bVal );
     208           0 :             if( bVal )
     209           0 :                 ::finishGrammarCheck( *GetTextNode() );
     210             :         }
     211           0 :     }
     212           0 : }
     213             : 
     214             : // text::XFlatParagraph:
     215           0 : sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 nType ) throw (uno::RuntimeException, std::exception)
     216             : {
     217           0 :     SolarMutexGuard aGuard;
     218           0 :     if (GetTextNode())
     219             :     {
     220           0 :         if ( text::TextMarkupType::SPELLCHECK == nType )
     221           0 :             return GetTextNode()->IsWrongDirty();
     222           0 :         else if ( text::TextMarkupType::PROOFREADING == nType )
     223           0 :             return GetTextNode()->IsGrammarCheckDirty();
     224           0 :         else if ( text::TextMarkupType::SMARTTAG == nType )
     225           0 :             return GetTextNode()->IsSmartTagDirty();
     226             :     }
     227             : 
     228           0 :     return sal_False;
     229             : }
     230             : 
     231             : // text::XFlatParagraph:
     232           0 : sal_Bool SAL_CALL SwXFlatParagraph::isModified() throw (uno::RuntimeException, std::exception)
     233             : {
     234           0 :     SolarMutexGuard aGuard;
     235           0 :     return 0 == GetTextNode();
     236             : }
     237             : 
     238             : // text::XFlatParagraph:
     239           0 : lang::Locale SAL_CALL SwXFlatParagraph::getLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen)
     240             :     throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
     241             : {
     242           0 :     SolarMutexGuard aGuard;
     243           0 :     if (!GetTextNode())
     244           0 :         return LanguageTag::convertToLocale( LANGUAGE_NONE );
     245             : 
     246           0 :     const lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetTextNode()->GetLang(nPos, nLen) ) );
     247           0 :     return aLocale;
     248             : }
     249             : 
     250             : // text::XFlatParagraph:
     251           0 : lang::Locale SAL_CALL SwXFlatParagraph::getPrimaryLanguageOfText(::sal_Int32 nPos, ::sal_Int32 nLen)
     252             :     throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
     253             : {
     254           0 :     SolarMutexGuard aGuard;
     255             : 
     256           0 :     if (!GetTextNode())
     257           0 :         return LanguageTag::convertToLocale( LANGUAGE_NONE );
     258             : 
     259           0 :     const lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetTextNode()->GetLang(nPos, nLen) ) );
     260           0 :     return aLocale;
     261             : }
     262             : 
     263             : // text::XFlatParagraph:
     264           0 : void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, const OUString & aNewText, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, std::exception)
     265             : {
     266           0 :     SolarMutexGuard aGuard;
     267             : 
     268           0 :     if (!GetTextNode())
     269           0 :         return;
     270             : 
     271           0 :     SwTextNode *const pOldTextNode = GetTextNode();
     272             : 
     273           0 :     SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
     274             : 
     275           0 :     UnoActionContext aAction( GetTextNode()->GetDoc() );
     276             : 
     277             :     const uno::Reference< text::XTextRange > xRange =
     278             :         SwXTextRange::CreateXTextRange(
     279           0 :             *GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
     280           0 :     uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
     281           0 :     if ( xPropSet.is() )
     282             :     {
     283           0 :         for ( sal_Int32 i = 0; i < aAttributes.getLength(); ++i )
     284           0 :             xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
     285             :     }
     286             : 
     287           0 :     IDocumentContentOperations* pIDCO = pOldTextNode->getIDocumentContentOperations();
     288           0 :     pIDCO->ReplaceRange( aPaM, aNewText, false );
     289             : 
     290           0 :     ClearTextNode(); // TODO: is this really needed?
     291             : }
     292             : 
     293             : // text::XFlatParagraph:
     294           0 : void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > & aAttributes) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, std::exception)
     295             : {
     296           0 :     SolarMutexGuard aGuard;
     297             : 
     298           0 :     if (!GetTextNode())
     299           0 :         return;
     300             : 
     301           0 :     SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
     302             : 
     303           0 :     UnoActionContext aAction( GetTextNode()->GetDoc() );
     304             : 
     305             :     const uno::Reference< text::XTextRange > xRange =
     306             :         SwXTextRange::CreateXTextRange(
     307           0 :             *GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
     308           0 :     uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
     309           0 :     if ( xPropSet.is() )
     310             :     {
     311           0 :         for ( sal_Int32 i = 0; i < aAttributes.getLength(); ++i )
     312           0 :             xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
     313             :     }
     314             : 
     315           0 :     ClearTextNode(); // TODO: is this really needed?
     316             : }
     317             : 
     318             : // text::XFlatParagraph:
     319           0 : css::uno::Sequence< ::sal_Int32 > SAL_CALL SwXFlatParagraph::getLanguagePortions() throw (css::uno::RuntimeException, std::exception)
     320             : {
     321           0 :     SolarMutexGuard aGuard;
     322           0 :     return css::uno::Sequence< ::sal_Int32>();
     323             : }
     324             : 
     325             : namespace
     326             : {
     327             :     class theSwXFlatParagraphUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFlatParagraphUnoTunnelId > {};
     328             : }
     329             : 
     330             : const uno::Sequence< sal_Int8 >&
     331           0 : SwXFlatParagraph::getUnoTunnelId()
     332             : {
     333           0 :     return theSwXFlatParagraphUnoTunnelId::get().getSeq();
     334             : }
     335             : 
     336             : sal_Int64 SAL_CALL
     337           0 : SwXFlatParagraph::getSomething(
     338             :         const uno::Sequence< sal_Int8 >& rId)
     339             :     throw (uno::RuntimeException, std::exception)
     340             : {
     341           0 :     return sw::UnoTunnelImpl(rId, this);
     342             : }
     343             : 
     344           0 : SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, bool bAutomatic )
     345             :     : mpDoc( &rDoc ),
     346             :       mnType( nType ),
     347             :       mbAutomatic( bAutomatic ),
     348             :       mnCurrentNode( 0 ),
     349             :       mnStartNode( 0 ),
     350           0 :       mnEndNode( rDoc.GetNodes().Count() ),
     351           0 :       mbWrapped( false )
     352             : {
     353             :     //mnStartNode = mnCurrentNode = get node from current cursor TODO!
     354             : 
     355             :     // register as listener and get notified when document is closed
     356           0 :     mpDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD )->Add(this);
     357           0 : }
     358             : 
     359           0 : SwXFlatParagraphIterator::~SwXFlatParagraphIterator()
     360             : {
     361           0 : }
     362             : 
     363           0 : void SwXFlatParagraphIterator::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
     364             : {
     365           0 :     ClientModify( this, pOld, pNew );
     366             :     // check if document gets closed...
     367           0 :     if(!GetRegisteredIn())
     368             :     {
     369           0 :         SolarMutexGuard aGuard;
     370           0 :         mpDoc = 0;
     371             :     }
     372           0 : }
     373             : 
     374           0 : uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getFirstPara()
     375             :     throw( uno::RuntimeException, std::exception )
     376             : {
     377           0 :     return getNextPara();   // TODO
     378             : }
     379             : 
     380           0 : uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara()
     381             :     throw( uno::RuntimeException, std::exception )
     382             : {
     383           0 :     SolarMutexGuard aGuard;
     384             : 
     385           0 :     uno::Reference< text::XFlatParagraph > xRet;
     386           0 :     if (!mpDoc)
     387           0 :         return xRet;
     388             : 
     389           0 :     SwTextNode* pRet = 0;
     390           0 :     if ( mbAutomatic )
     391             :     {
     392           0 :         SwViewShell* pViewShell = mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
     393             : 
     394           0 :         SwPageFrm* pCurrentPage = pViewShell ? pViewShell->Imp()->GetFirstVisPage() : 0;
     395           0 :         SwPageFrm* pStartPage = pCurrentPage;
     396           0 :         SwPageFrm* pStopPage = 0;
     397             : 
     398           0 :         while ( pCurrentPage && pCurrentPage != pStopPage )
     399             :         {
     400           0 :             if (mnType != text::TextMarkupType::SPELLCHECK || pCurrentPage->IsInvalidSpelling() )
     401             :             {
     402             :                 // this method is supposed to return an empty paragraph in case Online Checking is disabled
     403           0 :                 if ( ( mnType == text::TextMarkupType::PROOFREADING || mnType == text::TextMarkupType::SPELLCHECK )
     404           0 :                     && !pViewShell->GetViewOptions()->IsOnlineSpell() )
     405           0 :                     return xRet;
     406             : 
     407             :                 // search for invalid content:
     408           0 :                 SwContentFrm* pCnt = pCurrentPage->ContainsContent();
     409             : 
     410           0 :                 while( pCnt && pCurrentPage->IsAnLower( pCnt ) )
     411             :                 {
     412           0 :                     SwTextNode* pTextNode = dynamic_cast<SwTextNode*>( pCnt->GetNode()->GetTextNode() );
     413             : 
     414           0 :                     if ( pTextNode &&
     415           0 :                         ((mnType == text::TextMarkupType::SPELLCHECK &&
     416           0 :                                 pTextNode->IsWrongDirty()) ||
     417           0 :                          (mnType == text::TextMarkupType::PROOFREADING &&
     418           0 :                                 pTextNode->IsGrammarCheckDirty())) )
     419             :                     {
     420           0 :                         pRet = pTextNode;
     421           0 :                         break;
     422             :                     }
     423             : 
     424           0 :                     pCnt = pCnt->GetNextContentFrm();
     425             :                 }
     426             :             }
     427             : 
     428           0 :             if ( pRet )
     429           0 :                 break;
     430             : 
     431             :             // if there is no invalid text node on the current page,
     432             :             // we validate the page
     433           0 :             pCurrentPage->ValidateSpelling();
     434             : 
     435             :             // proceed with next page, wrap at end of document if required:
     436           0 :             pCurrentPage = static_cast<SwPageFrm*>(pCurrentPage->GetNext());
     437             : 
     438           0 :             if ( !pCurrentPage && !pStopPage )
     439             :             {
     440           0 :                 pStopPage = pStartPage;
     441           0 :                 pCurrentPage = static_cast<SwPageFrm*>(pViewShell->GetLayout()->Lower());
     442             :             }
     443             :         }
     444             :     }
     445             :     else    // non-automatic checking
     446             :     {
     447           0 :         const SwNodes& rNodes = mpDoc->GetNodes();
     448           0 :         const sal_uLong nMaxNodes = rNodes.Count();
     449             : 
     450           0 :         while ( mnCurrentNode < mnEndNode && mnCurrentNode < nMaxNodes )
     451             :         {
     452           0 :             SwNode* pNd = rNodes[ mnCurrentNode ];
     453             : 
     454           0 :             ++mnCurrentNode;
     455             : 
     456           0 :             pRet = dynamic_cast<SwTextNode*>(pNd);
     457           0 :             if ( pRet )
     458           0 :                 break;
     459             : 
     460           0 :             if ( mnCurrentNode == mnEndNode && !mbWrapped )
     461             :             {
     462           0 :                 mnCurrentNode = 0;
     463           0 :                 mnEndNode = mnStartNode;
     464             :             }
     465             :         }
     466             :     }
     467             : 
     468           0 :     if ( pRet )
     469             :     {
     470             :         // Expand the string:
     471           0 :         const ModelToViewHelper aConversionMap(*pRet);
     472           0 :         OUString aExpandText = aConversionMap.getViewText();
     473             : 
     474           0 :         xRet = new SwXFlatParagraph( *pRet, aExpandText, aConversionMap );
     475             :         // keep hard references...
     476           0 :         m_aFlatParaList.insert( xRet );
     477             :     }
     478             : 
     479           0 :     return xRet;
     480             : }
     481             : 
     482           0 : uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getLastPara()
     483             :     throw( uno::RuntimeException, std::exception )
     484             : {
     485           0 :     return getNextPara();
     486             : }
     487             : 
     488           0 : uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(const uno::Reference< text::XFlatParagraph > & xPara)
     489             :     throw ( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
     490             : {
     491           0 :     SolarMutexGuard aGuard;
     492             : 
     493           0 :     uno::Reference< text::XFlatParagraph > xRet;
     494           0 :     if (!mpDoc)
     495           0 :         return xRet;
     496             : 
     497           0 :     const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
     498             :     OSL_ASSERT(xFPTunnel.is());
     499           0 :     SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
     500             : 
     501           0 :     if ( !pFlatParagraph )
     502           0 :         return xRet;
     503             : 
     504           0 :     SwTextNode const*const pCurrentNode = pFlatParagraph->GetTextNode();
     505             : 
     506           0 :     if ( !pCurrentNode )
     507           0 :         return xRet;
     508             : 
     509           0 :     SwTextNode* pNextTextNode = 0;
     510           0 :     const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
     511             : 
     512           0 :     for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() + 1; nCurrentNode < rNodes.Count(); ++nCurrentNode )
     513             :     {
     514           0 :         SwNode* pNd = rNodes[ nCurrentNode ];
     515           0 :         pNextTextNode = dynamic_cast<SwTextNode*>(pNd);
     516           0 :         if ( pNextTextNode )
     517           0 :             break;
     518             :     }
     519             : 
     520           0 :     if ( pNextTextNode )
     521             :     {
     522             :         // Expand the string:
     523           0 :         const ModelToViewHelper aConversionMap(*pNextTextNode);
     524           0 :         OUString aExpandText = aConversionMap.getViewText();
     525             : 
     526           0 :         xRet = new SwXFlatParagraph( *pNextTextNode, aExpandText, aConversionMap );
     527             :         // keep hard references...
     528           0 :         m_aFlatParaList.insert( xRet );
     529             :     }
     530             : 
     531           0 :     return xRet;
     532             : }
     533             : 
     534           0 : uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(const uno::Reference< text::XFlatParagraph > & xPara )
     535             :     throw ( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
     536             : {
     537           0 :     SolarMutexGuard aGuard;
     538             : 
     539           0 :     uno::Reference< text::XFlatParagraph > xRet;
     540           0 :     if (!mpDoc)
     541           0 :         return xRet;
     542             : 
     543           0 :     const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
     544             :     OSL_ASSERT(xFPTunnel.is());
     545           0 :     SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel));
     546             : 
     547           0 :     if ( !pFlatParagraph )
     548           0 :         return xRet;
     549             : 
     550           0 :     SwTextNode const*const pCurrentNode = pFlatParagraph->GetTextNode();
     551             : 
     552           0 :     if ( !pCurrentNode )
     553           0 :         return xRet;
     554             : 
     555           0 :     SwTextNode* pPrevTextNode = 0;
     556           0 :     const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
     557             : 
     558           0 :     for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() - 1; nCurrentNode > 0; --nCurrentNode )
     559             :     {
     560           0 :         SwNode* pNd = rNodes[ nCurrentNode ];
     561           0 :         pPrevTextNode = dynamic_cast<SwTextNode*>(pNd);
     562           0 :         if ( pPrevTextNode )
     563           0 :             break;
     564             :     }
     565             : 
     566           0 :     if ( pPrevTextNode )
     567             :     {
     568             :         // Expand the string:
     569           0 :         const ModelToViewHelper aConversionMap(*pPrevTextNode);
     570           0 :         OUString aExpandText = aConversionMap.getViewText();
     571             : 
     572           0 :         xRet = new SwXFlatParagraph( *pPrevTextNode, aExpandText, aConversionMap );
     573             :         // keep hard references...
     574           0 :         m_aFlatParaList.insert( xRet );
     575             :     }
     576             : 
     577           0 :     return xRet;
     578         177 : }
     579             : 
     580             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11