LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unocrsrhelper.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 427 710 60.1 %
Date: 2014-04-11 Functions: 15 17 88.2 %
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 <unocrsrhelper.hxx>
      21             : 
      22             : #include <map>
      23             : 
      24             : #include <com/sun/star/beans/PropertyState.hpp>
      25             : #include <com/sun/star/embed/ElementModes.hpp>
      26             : #include <com/sun/star/embed/XStorage.hpp>
      27             : #include <com/sun/star/text/XTextSection.hpp>
      28             : 
      29             : #include <svx/svxids.hrc>
      30             : #include <svx/unoshape.hxx>
      31             : 
      32             : #include <cmdid.h>
      33             : #include <unotextrange.hxx>
      34             : #include <unodraw.hxx>
      35             : #include <unofootnote.hxx>
      36             : #include <unobookmark.hxx>
      37             : #include <unorefmark.hxx>
      38             : #include <unostyle.hxx>
      39             : #include <unoidx.hxx>
      40             : #include <unofield.hxx>
      41             : #include <unotbl.hxx>
      42             : #include <unosett.hxx>
      43             : #include <unoframe.hxx>
      44             : #include <unocrsr.hxx>
      45             : #include <doc.hxx>
      46             : #include <IDocumentUndoRedo.hxx>
      47             : #include <IDocumentRedlineAccess.hxx>
      48             : #include <fmtftn.hxx>
      49             : #include <fmtpdsc.hxx>
      50             : #include <charfmt.hxx>
      51             : #include <pagedesc.hxx>
      52             : #include <docstyle.hxx>
      53             : #include <ndtxt.hxx>
      54             : #include <txtrfmrk.hxx>
      55             : #include <fmtfld.hxx>
      56             : #include <docsh.hxx>
      57             : #include <section.hxx>
      58             : #include <shellio.hxx>
      59             : #include <edimp.hxx>
      60             : #include <swundo.hxx>
      61             : #include <cntfrm.hxx>
      62             : #include <pagefrm.hxx>
      63             : #include <svl/eitem.hxx>
      64             : #include <docary.hxx>
      65             : #include <swtable.hxx>
      66             : #include <tox.hxx>
      67             : #include <doctxm.hxx>
      68             : #include <fchrfmt.hxx>
      69             : #include <editeng/flstitem.hxx>
      70             : #include <vcl/metric.hxx>
      71             : #include <svtools/ctrltool.hxx>
      72             : #include <sfx2/docfilt.hxx>
      73             : #include <sfx2/docfile.hxx>
      74             : #include <sfx2/fcontnr.hxx>
      75             : #include <svl/stritem.hxx>
      76             : #include <SwStyleNameMapper.hxx>
      77             : #include <redline.hxx>
      78             : #include <numrule.hxx>
      79             : #include <comphelper/storagehelper.hxx>
      80             : #include <unotools/mediadescriptor.hxx>
      81             : #include <comphelper/sequenceashashmap.hxx>
      82             : #include <SwNodeNum.hxx>
      83             : #include <fmtmeta.hxx>
      84             : #include <txtfld.hxx>
      85             : 
      86             : using namespace ::com::sun::star;
      87             : using namespace ::com::sun::star::uno;
      88             : using namespace ::com::sun::star::beans;
      89             : using namespace ::com::sun::star::text;
      90             : using namespace ::com::sun::star::table;
      91             : using namespace ::com::sun::star::container;
      92             : using namespace ::com::sun::star::lang;
      93             : 
      94             : namespace SwUnoCursorHelper
      95             : {
      96             : 
      97           0 : static SwPaM* lcl_createPamCopy(const SwPaM& rPam)
      98             : {
      99           0 :     SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
     100           0 :     ::sw::DeepCopyPaM(rPam, *pRet);
     101           0 :     return pRet;
     102             : }
     103             : 
     104           9 : void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
     105             :         SwDoc & rTargetDoc,
     106             :         SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
     107             :         OUString & o_rTableName, SwUnoTableCrsr const*& o_rpTableCursor,
     108             :         ::sw::mark::IMark const*& o_rpMark,
     109             :         std::vector<SdrObject *> & o_rSdrObjects)
     110             : {
     111           9 :     uno::Reference<drawing::XShapes> const xShapes(xIfc, UNO_QUERY);
     112           9 :     if (xShapes.is())
     113             :     {
     114           0 :         sal_Int32 nShapes(xShapes->getCount());
     115           0 :         for (sal_Int32 i = 0; i < nShapes; ++i)
     116             :         {
     117           0 :             uno::Reference<lang::XUnoTunnel> xShape;
     118           0 :             xShapes->getByIndex(i) >>= xShape;
     119           0 :             if (xShape.is())
     120             :             {
     121             :                 SvxShape *const pSvxShape(
     122           0 :                         ::sw::UnoTunnelGetImplementation<SvxShape>(xShape));
     123           0 :                 if (pSvxShape)
     124             :                 {
     125           0 :                     SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
     126           0 :                     if (pSdrObject)
     127             :                     {   // hmm... needs view to verify it's in right doc...
     128           0 :                         o_rSdrObjects.push_back(pSdrObject);
     129             :                     }
     130             :                 }
     131             :             }
     132           0 :         }
     133           0 :         return;
     134             :     }
     135             : 
     136           9 :     uno::Reference<lang::XUnoTunnel> const xTunnel(xIfc, UNO_QUERY);
     137           9 :     if (!xTunnel.is()) // everything below needs tunnel
     138             :     {
     139           0 :         return;
     140             :     }
     141             : 
     142           9 :     SwXShape *const pShape(::sw::UnoTunnelGetImplementation<SwXShape>(xTunnel));
     143           9 :     if (pShape)
     144             :     {
     145             :         uno::Reference<uno::XAggregation> const xAgg(
     146           0 :                 pShape->GetAggregationInterface());
     147           0 :         if (xAgg.is())
     148             :         {
     149             :             SvxShape *const pSvxShape(
     150           0 :                     ::sw::UnoTunnelGetImplementation<SvxShape>(xTunnel));
     151           0 :             if (pSvxShape)
     152             :             {
     153           0 :                 SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
     154           0 :                 if (pSdrObject)
     155             :                 {   // hmm... needs view to verify it's in right doc...
     156           0 :                     o_rSdrObjects.push_back(pSdrObject);
     157             :                 }
     158             :             }
     159             :         }
     160           0 :         return;
     161             :     }
     162             : 
     163             :     OTextCursorHelper *const pCursor(
     164           9 :         ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel));
     165           9 :     if (pCursor)
     166             :     {
     167           0 :         if (pCursor->GetDoc() == &rTargetDoc)
     168             :         {
     169           0 :             o_rpPaM = lcl_createPamCopy(*pCursor->GetPaM());
     170             :         }
     171           0 :         return;
     172             :     }
     173             : 
     174             :     SwXTextRanges *const pRanges(
     175           9 :         ::sw::UnoTunnelGetImplementation<SwXTextRanges>(xTunnel));
     176           9 :     if (pRanges)
     177             :     {
     178           0 :         SwUnoCrsr const* pUnoCrsr = pRanges->GetCursor();
     179           0 :         if (pUnoCrsr && pUnoCrsr->GetDoc() == &rTargetDoc)
     180             :         {
     181           0 :             o_rpPaM = lcl_createPamCopy(*pUnoCrsr);
     182             :         }
     183           0 :         return;
     184             :     }
     185             : 
     186             :     // check these before Range to prevent misinterpretation of text frames
     187             :     // and cells also implement XTextRange
     188             :     SwXFrame *const pFrame(
     189           9 :         ::sw::UnoTunnelGetImplementation<SwXFrame>(xTunnel));
     190           9 :     if (pFrame)
     191             :     {
     192           0 :         SwFrmFmt *const pFrmFmt(pFrame->GetFrmFmt());
     193           0 :         if (pFrmFmt && pFrmFmt->GetDoc() == &rTargetDoc)
     194             :         {
     195           0 :             o_rFrame = std::make_pair(pFrmFmt->GetName(), pFrame->GetFlyCntType());
     196             :         }
     197           0 :         return;
     198             :     }
     199             : 
     200             :     SwXTextTable *const pTextTable(
     201           9 :         ::sw::UnoTunnelGetImplementation<SwXTextTable>(xTunnel));
     202           9 :     if (pTextTable)
     203             :     {
     204           9 :         SwFrmFmt *const pFrmFmt(pTextTable->GetFrmFmt());
     205           9 :         if (pFrmFmt && pFrmFmt->GetDoc() == &rTargetDoc)
     206             :         {
     207           9 :             o_rTableName = pFrmFmt->GetName();
     208             :         }
     209           9 :         return;
     210             :     }
     211             : 
     212             :     SwXCell *const pCell(
     213           0 :         ::sw::UnoTunnelGetImplementation<SwXCell>(xTunnel));
     214           0 :     if (pCell)
     215             :     {
     216           0 :         SwFrmFmt *const pFrmFmt(pCell->GetFrmFmt());
     217           0 :         if (pFrmFmt && pFrmFmt->GetDoc() == &rTargetDoc)
     218             :         {
     219           0 :             SwTableBox * pBox = pCell->GetTblBox();
     220           0 :             SwTable *const pTable = SwTable::FindTable(pFrmFmt);
     221             :             // ??? what's the benefit of setting pBox in this convoluted way?
     222           0 :             pBox = pCell->FindBox(pTable, pBox);
     223           0 :             if (pBox)
     224             :             {
     225           0 :                 SwPosition const aPos(*pBox->GetSttNd());
     226           0 :                 SwPaM aPam(aPos);
     227           0 :                 aPam.Move(fnMoveForward, fnGoNode);
     228           0 :                 o_rpPaM = lcl_createPamCopy(aPam);
     229             :             }
     230             :         }
     231           0 :         return;
     232             :     }
     233             : 
     234           0 :     uno::Reference<text::XTextRange> const xTextRange(xTunnel, UNO_QUERY);
     235           0 :     if (xTextRange.is())
     236             :     {
     237           0 :         SwUnoInternalPaM aPam(rTargetDoc);
     238           0 :         if (::sw::XTextRangeToSwPaM(aPam, xTextRange))
     239             :         {
     240           0 :             o_rpPaM = lcl_createPamCopy(aPam);
     241             :         }
     242           0 :         return;
     243             :     }
     244             : 
     245             :     SwXCellRange *const pCellRange(
     246           0 :         ::sw::UnoTunnelGetImplementation<SwXCellRange>(xTunnel));
     247           0 :     if (pCellRange)
     248             :     {
     249           0 :         SwUnoCrsr const*const pUnoCrsr(pCellRange->GetTblCrsr());
     250           0 :         if (pUnoCrsr && pUnoCrsr->GetDoc() == &rTargetDoc)
     251             :         {
     252             :             // probably can't copy it to o_rpPaM for this since it's
     253             :             // a SwTableCursor
     254           0 :             o_rpTableCursor = dynamic_cast<SwUnoTableCrsr const*>(pUnoCrsr);
     255             :         }
     256           0 :         return;
     257             :     }
     258             : 
     259             :     ::sw::mark::IMark const*const pMark(
     260           0 :             SwXBookmark::GetBookmarkInDoc(& rTargetDoc, xTunnel));
     261           0 :     if (pMark)
     262             :     {
     263           0 :         o_rpMark = pMark;
     264           0 :         return;
     265           0 :     }
     266             : }
     267             : 
     268             : uno::Reference<text::XTextContent>
     269          22 : GetNestedTextContent(SwTxtNode & rTextNode, sal_Int32 const nIndex,
     270             :         bool const bParent)
     271             : {
     272             :     // these should be unambiguous because of the dummy character
     273             :     SwTxtNode::GetTxtAttrMode const eMode( (bParent)
     274          22 :         ? SwTxtNode::PARENT : SwTxtNode::EXPAND );
     275             :     SwTxtAttr *const pMetaTxtAttr =
     276          22 :         rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_META, eMode);
     277             :     SwTxtAttr *const pMetaFieldTxtAttr =
     278          22 :         rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
     279             :     // which is innermost?
     280             :     SwTxtAttr *const pTxtAttr = (pMetaTxtAttr)
     281             :         ? ((pMetaFieldTxtAttr)
     282          20 :             ? ((*pMetaFieldTxtAttr->GetStart() >
     283          10 :                     *pMetaTxtAttr->GetStart())
     284             :                 ? pMetaFieldTxtAttr : pMetaTxtAttr)
     285             :             : pMetaTxtAttr)
     286          32 :         : pMetaFieldTxtAttr;
     287          22 :     uno::Reference<XTextContent> xRet;
     288          22 :     if (pTxtAttr)
     289             :     {
     290             :         ::sw::Meta *const pMeta(
     291          16 :             static_cast<SwFmtMeta &>(pTxtAttr->GetAttr()).GetMeta());
     292             :         OSL_ASSERT(pMeta);
     293          16 :         xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
     294             :     }
     295          22 :     return xRet;
     296             : }
     297             : 
     298             : /* --------------------------------------------------
     299             :  *  Read the special properties of the cursor
     300             :  * --------------------------------------------------*/
     301        9219 : bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
     302             :                                         , SwPaM& rPam
     303             :                                         , Any *pAny
     304             :                                         , PropertyState& eState
     305             :                                         , const SwTxtNode* pNode  )
     306             : {
     307        9219 :     PropertyState eNewState = PropertyState_DIRECT_VALUE;
     308             : //    PropertyState_DEFAULT_VALUE
     309             : //    PropertyState_AMBIGUOUS_VALUE
     310        9219 :     bool bDone = true;
     311        9219 :     switch(rEntry.nWID)
     312             :     {
     313             :         case FN_UNO_PARA_CONT_PREV_SUBTREE:
     314           2 :             if (pAny)
     315             :             {
     316           2 :                 const SwTxtNode * pTmpNode = pNode;
     317             : 
     318           2 :                 if (!pTmpNode)
     319           2 :                     pTmpNode = rPam.GetNode()->GetTxtNode();
     320             : 
     321           2 :                 bool bRet = false;
     322             : 
     323           2 :                 if ( pTmpNode &&
     324           2 :                      pTmpNode->GetNum() &&
     325           0 :                      pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
     326             :                 {
     327           0 :                     bRet = true;
     328             :                 }
     329             : 
     330           2 :                 *pAny <<= bRet;
     331             :             }
     332           2 :         break;
     333             :         case FN_UNO_PARA_NUM_STRING:
     334           2 :             if (pAny)
     335             :             {
     336           2 :                 const SwTxtNode * pTmpNode = pNode;
     337             : 
     338           2 :                 if (!pTmpNode)
     339           2 :                     pTmpNode = rPam.GetNode()->GetTxtNode();
     340             : 
     341           2 :                 OUString sRet;
     342           2 :                 if ( pTmpNode && pTmpNode->GetNum() )
     343             :                 {
     344           0 :                     sRet = pTmpNode->GetNumString();
     345             :                 }
     346             : 
     347           2 :                 *pAny <<= OUString(sRet);
     348             :             }
     349           2 :         break;
     350             :         case RES_PARATR_OUTLINELEVEL:
     351        3179 :             if (pAny)
     352             :             {
     353        3179 :                 const SwTxtNode * pTmpNode = pNode;
     354             : 
     355        3179 :                 if (!pTmpNode)
     356        3044 :                     pTmpNode = rPam.GetNode()->GetTxtNode();
     357             : 
     358        3179 :                 sal_Int16 nRet = -1;
     359        3179 :                 if ( pTmpNode )
     360        3177 :                     nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
     361             : 
     362        3179 :                 *pAny <<= nRet;
     363             :             }
     364        3179 :         break;
     365             :         case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
     366             :         case FN_UNO_PARA_STYLE :
     367             :         {
     368         362 :             SwFmtColl* pFmt = 0;
     369         362 :             if(pNode)
     370         295 :                 pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
     371         295 :                             ? pNode->GetFmtColl() : &pNode->GetAnyFmtColl();
     372             :             else
     373             :             {
     374             :                 pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(rPam,
     375          67 :                         FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID);
     376             :             }
     377         362 :             if(pFmt)
     378             :             {
     379         358 :                 if( pAny )
     380             :                 {
     381         356 :                     OUString sVal;
     382         356 :                     SwStyleNameMapper::FillProgName(pFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
     383         356 :                     *pAny <<= sVal;
     384             :                 }
     385             :             }
     386             :             else
     387           4 :                 eNewState = PropertyState_AMBIGUOUS_VALUE;
     388             :         }
     389         362 :         break;
     390             :         case FN_UNO_PAGE_STYLE :
     391             :         {
     392         111 :             OUString sVal;
     393         111 :             GetCurPageStyle(rPam, sVal);
     394         111 :             if( pAny )
     395         111 :                 *pAny <<= sVal;
     396         111 :             if(sVal.isEmpty())
     397          65 :                 eNewState = PropertyState_AMBIGUOUS_VALUE;
     398             :         }
     399         111 :         break;
     400             :         case FN_UNO_NUM_START_VALUE  :
     401           5 :             if( pAny )
     402             :             {
     403           2 :                 sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
     404           2 :                 *pAny <<= nValue;
     405             :             }
     406           5 :         break;
     407             :         case FN_UNO_NUM_LEVEL  :
     408             :         case FN_UNO_IS_NUMBER  :
     409             :         // #i91601#
     410             :         case FN_UNO_LIST_ID:
     411             :         case FN_NUMBER_NEWSTART:
     412             :         {
     413             :             // a multi selection is not considered
     414         319 :             const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
     415         319 :             if ( pTxtNd && pTxtNd->IsInList() )
     416             :             {
     417          29 :                 if( pAny )
     418             :                 {
     419          29 :                     if(rEntry.nWID == FN_UNO_NUM_LEVEL)
     420          29 :                         *pAny <<= (sal_Int16)(pTxtNd->GetActualListLevel());
     421           0 :                     else if(rEntry.nWID == FN_UNO_IS_NUMBER)
     422             :                     {
     423           0 :                         sal_Bool bIsNumber = pTxtNd->IsCountedInList();
     424           0 :                         pAny->setValue(&bIsNumber, ::getBooleanCppuType());
     425             :                     }
     426             :                     // #i91601#
     427           0 :                     else if ( rEntry.nWID == FN_UNO_LIST_ID )
     428             :                     {
     429           0 :                         const OUString sListId = pTxtNd->GetListId();
     430           0 :                         *pAny <<= OUString(sListId);
     431             :                     }
     432             :                     else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
     433             :                     {
     434           0 :                         sal_Bool bIsRestart = pTxtNd->IsListRestart();
     435           0 :                         pAny->setValue(&bIsRestart, ::getBooleanCppuType());
     436             :                     }
     437             :                 }
     438             :             }
     439             :             else
     440             :             {
     441         290 :                 eNewState = PropertyState_DEFAULT_VALUE;
     442             : 
     443         290 :                 if( pAny )
     444             :                 {
     445             :                     // #i30838# set default values for default properties
     446         278 :                     if(rEntry.nWID == FN_UNO_NUM_LEVEL)
     447         137 :                         *pAny <<= static_cast<sal_Int16>( 0 );
     448         141 :                     else if(rEntry.nWID == FN_UNO_IS_NUMBER)
     449         137 :                         *pAny <<= false;
     450             :                     // #i91601#
     451           4 :                     else if ( rEntry.nWID == FN_UNO_LIST_ID )
     452             :                     {
     453           2 :                         *pAny <<= OUString();
     454             :                     }
     455             :                     else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
     456           2 :                         *pAny <<= false;
     457             :                 }
     458             :             }
     459             :             //PROPERTY_MAYBEVOID!
     460             :         }
     461         319 :         break;
     462             :         case FN_UNO_NUM_RULES  :
     463        2926 :             if( pAny )
     464        2924 :                 getNumberingProperty(rPam, eNewState, pAny);
     465             :             else
     466             :             {
     467           2 :                 if( !rPam.GetDoc()->GetNumRuleAtPos( *rPam.GetPoint() ) )
     468           2 :                     eNewState = PropertyState_DEFAULT_VALUE;
     469             :             }
     470        2926 :             break;
     471             :         case FN_UNO_DOCUMENT_INDEX_MARK:
     472             :         {
     473           2 :             ::std::vector<SwTxtAttr *> marks;
     474           2 :             if (rPam.GetNode()->IsTxtNode())
     475             :             {
     476           0 :                 marks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
     477           0 :                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK);
     478             :             }
     479           2 :             if (marks.size())
     480             :             {
     481           0 :                 if( pAny )
     482             :                 {   // hmm... can only return 1 here
     483             :                     SwTOXMark & rMark =
     484           0 :                         static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
     485             :                     const uno::Reference< text::XDocumentIndexMark > xRef =
     486             :                         SwXDocumentIndexMark::CreateXDocumentIndexMark(
     487           0 :                             *rPam.GetDoc(),
     488           0 :                             *const_cast<SwTOXType*>(rMark.GetTOXType()), rMark);
     489           0 :                     (*pAny) <<= xRef;
     490             :                 }
     491             :             }
     492             :             else
     493             :                 //also here - indistinguishable
     494           2 :                 eNewState = PropertyState_DEFAULT_VALUE;
     495             :         }
     496           2 :         break;
     497             :         case FN_UNO_DOCUMENT_INDEX:
     498             :         {
     499             :             const SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX(
     500           2 :                                                     *rPam.Start() );
     501           2 :             if( pBase )
     502             :             {
     503           0 :                 if( pAny )
     504             :                 {
     505             :                     const uno::Reference< text::XDocumentIndex > xRef =
     506           0 :                         SwXDocumentIndex::CreateXDocumentIndex(*rPam.GetDoc(),
     507           0 :                             *static_cast<SwTOXBaseSection const*>(pBase));
     508           0 :                     (*pAny) <<= xRef;
     509             :                 }
     510             :             }
     511             :             else
     512           2 :                 eNewState = PropertyState_DEFAULT_VALUE;
     513             :         }
     514           2 :         break;
     515             :         case FN_UNO_TEXT_FIELD:
     516             :         {
     517           2 :             const SwPosition *pPos = rPam.Start();
     518             :             const SwTxtNode *pTxtNd =
     519           2 :                 rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
     520             :             const SwTxtAttr* pTxtAttr = (pTxtNd)
     521           0 :                 ? pTxtNd->GetFldTxtAttrAt( pPos->nContent.GetIndex(), true )
     522           2 :                 : 0;
     523           2 :             if ( pTxtAttr != NULL )
     524             :             {
     525           0 :                 if( pAny )
     526             :                 {
     527             :                     uno::Reference<text::XTextField> const xField(
     528           0 :                         SwXTextField::CreateXTextField(*rPam.GetDoc(),
     529           0 :                            pTxtAttr->GetFmtFld()));
     530           0 :                     *pAny <<= xField;
     531             :                 }
     532             :             }
     533             :             else
     534           2 :                 eNewState = PropertyState_DEFAULT_VALUE;
     535             :         }
     536           2 :         break;
     537             :         case FN_UNO_TEXT_TABLE:
     538             :         case FN_UNO_CELL:
     539             :         {
     540           4 :             SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
     541           4 :             SwStartNodeType eType = pSttNode->GetStartNodeType();
     542           4 :             if(SwTableBoxStartNode == eType)
     543             :             {
     544           0 :                 if( pAny )
     545             :                 {
     546           0 :                     const SwTableNode* pTblNode = pSttNode->FindTableNode();
     547           0 :                     SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
     548             :                     //SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable();
     549           0 :                     if(FN_UNO_TEXT_TABLE == rEntry.nWID)
     550             :                     {
     551           0 :                         uno::Reference< XTextTable >  xTable = SwXTextTables::GetObject(*pTableFmt);
     552           0 :                         pAny->setValue(&xTable, ::getCppuType((uno::Reference<XTextTable>*)0));
     553             :                     }
     554             :                     else
     555             :                     {
     556           0 :                         SwTableBox* pBox = pSttNode->GetTblBox();
     557           0 :                         uno::Reference< XCell >  xCell = SwXCell::CreateXCell(pTableFmt, pBox);
     558           0 :                         pAny->setValue(&xCell, ::getCppuType((uno::Reference<XCell>*)0));
     559             :                     }
     560             :                 }
     561             :             }
     562             :             else
     563           4 :                 eNewState = PropertyState_DEFAULT_VALUE;
     564             :         }
     565           4 :         break;
     566             :         case FN_UNO_TEXT_FRAME:
     567             :         {
     568          20 :             SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
     569          20 :             SwStartNodeType eType = pSttNode->GetStartNodeType();
     570             : 
     571             :             SwFrmFmt* pFmt;
     572          20 :             if(eType == SwFlyStartNode && 0 != (pFmt = pSttNode->GetFlyFmt()))
     573             :             {
     574           1 :                 if( pAny )
     575             :                 {
     576           1 :                     uno::Reference< XTextFrame >  xFrm = (SwXTextFrame*) SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM);
     577           1 :                     pAny->setValue(&xFrm, ::getCppuType((uno::Reference<XTextFrame>*)0));
     578             :                 }
     579             :             }
     580             :             else
     581          19 :                 eNewState = PropertyState_DEFAULT_VALUE;
     582             :         }
     583          20 :         break;
     584             :         case FN_UNO_TEXT_SECTION:
     585             :         {
     586         151 :             SwSection* pSect = rPam.GetDoc()->GetCurrSection(*rPam.GetPoint());
     587         151 :             if(pSect)
     588             :             {
     589          13 :                 if( pAny )
     590             :                 {
     591          13 :                     uno::Reference< XTextSection >  xSect = SwXTextSections::GetObject( *pSect->GetFmt() );
     592          13 :                     pAny->setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0) );
     593             :                 }
     594             :             }
     595             :             else
     596         138 :                 eNewState = PropertyState_DEFAULT_VALUE;
     597             :         }
     598         151 :         break;
     599             :         case FN_UNO_ENDNOTE:
     600             :         case FN_UNO_FOOTNOTE:
     601             :         {
     602           4 :             SwTxtAttr *const pTxtAttr = rPam.GetNode()->IsTxtNode() ?
     603             :                 rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
     604           4 :                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : 0;
     605           4 :             if(pTxtAttr)
     606             :             {
     607           0 :                 const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
     608           0 :                 if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
     609             :                 {
     610           0 :                     if( pAny )
     611             :                     {
     612             :                         const uno::Reference< text::XFootnote > xFootnote =
     613           0 :                             SwXFootnote::CreateXFootnote(*rPam.GetDoc(), rFtn);
     614           0 :                         *pAny <<= xFootnote;
     615             :                     }
     616             :                 }
     617             :                 else
     618           0 :                     eNewState = PropertyState_DEFAULT_VALUE;
     619             :             }
     620             :             else
     621           4 :                 eNewState = PropertyState_DEFAULT_VALUE;
     622             :         }
     623           4 :         break;
     624             :         case FN_UNO_REFERENCE_MARK:
     625             :         {
     626           2 :             ::std::vector<SwTxtAttr *> marks;
     627           2 :             if (rPam.GetNode()->IsTxtNode())
     628             :             {
     629           0 :                 marks = (
     630             :                 rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
     631           0 :                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
     632             :             }
     633           2 :             if (marks.size())
     634             :             {
     635           0 :                 if( pAny )
     636             :                 {   // hmm... can only return 1 here
     637           0 :                     const SwFmtRefMark& rRef = (*marks.begin())->GetRefMark();
     638           0 :                     uno::Reference< XTextContent >  xRef = SwXReferenceMarks::GetObject( rPam.GetDoc(), &rRef );
     639           0 :                     pAny->setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
     640             :                 }
     641             :             }
     642             :             else
     643           2 :                 eNewState = PropertyState_DEFAULT_VALUE;
     644             :         }
     645           2 :         break;
     646             :         case FN_UNO_NESTED_TEXT_CONTENT:
     647             :         {
     648          18 :             uno::Reference<XTextContent> const xRet(rPam.GetNode()->IsTxtNode()
     649          16 :                 ? GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
     650          16 :                     rPam.GetPoint()->nContent.GetIndex(), false)
     651          50 :                 : 0);
     652          18 :             if (xRet.is())
     653             :             {
     654          13 :                 if (pAny)
     655             :                 {
     656          13 :                     (*pAny) <<= xRet;
     657             :                 }
     658             :             }
     659             :             else
     660             :             {
     661           5 :                 eNewState = PropertyState_DEFAULT_VALUE;
     662          18 :             }
     663             :         }
     664          18 :         break;
     665             :         case FN_UNO_CHARFMT_SEQUENCE:
     666             :         {
     667             : 
     668           9 :             SwTxtNode *const pTxtNode = rPam.GetNode()->GetTxtNode();
     669          18 :             if (rPam.GetNode(true) == rPam.GetNode(false)
     670           9 :                 && pTxtNode && pTxtNode->GetpSwpHints())
     671             :             {
     672           5 :                 sal_uInt16 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
     673           5 :                 sal_uInt16 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
     674           5 :                 if(nPaMStart > nPaMEnd)
     675             :                 {
     676           1 :                     sal_uInt16 nTmp = nPaMStart;
     677           1 :                     nPaMStart = nPaMEnd;
     678           1 :                     nPaMEnd = nTmp;
     679             :                 }
     680           5 :                 Sequence< OUString> aCharStyles;
     681           5 :                 SwpHints* pHints = pTxtNode->GetpSwpHints();
     682          24 :                 for(sal_uInt16 nAttr = 0; nAttr < pHints->GetStartCount(); nAttr++ )
     683             :                 {
     684          19 :                     SwTxtAttr* pAttr = pHints->GetStart( nAttr );
     685          19 :                     if(pAttr->Which() != RES_TXTATR_CHARFMT)
     686          14 :                         continue;
     687           5 :                     sal_uInt16 nAttrStart = *pAttr->GetStart();
     688           5 :                     sal_uInt16 nAttrEnd = *pAttr->GetEnd();
     689             :                     //check if the attribute touches the selection
     690           5 :                     if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
     691           0 :                         ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
     692             :                     {
     693             :                         //check for overlapping
     694           5 :                         if(nAttrStart > nPaMStart ||
     695             :                                     nAttrEnd < nPaMEnd)
     696             :                         {
     697           0 :                             aCharStyles.realloc(0);
     698           0 :                             eNewState = PropertyState_AMBIGUOUS_VALUE;
     699           0 :                             break;
     700             :                         }
     701             :                         else
     702             :                         {
     703             :                             //now the attribute should start before or at the selection
     704             :                             //and it should end at the end of the selection or behind
     705             :                             OSL_ENSURE(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
     706             :                                     "attribute overlaps or is outside");
     707             :                             //now the name of the style has to be added to the sequence
     708           5 :                             aCharStyles.realloc(aCharStyles.getLength() + 1);
     709             :                             OSL_ENSURE(pAttr->GetCharFmt().GetCharFmt(), "no character format set");
     710           5 :                             aCharStyles.getArray()[aCharStyles.getLength() - 1] =
     711             :                                         SwStyleNameMapper::GetProgName(
     712          10 :                                             pAttr->GetCharFmt().GetCharFmt()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
     713             :                         }
     714             :                     }
     715             : 
     716             :                 }
     717             :                 eNewState =
     718           5 :                     aCharStyles.getLength() ?
     719           5 :                         PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
     720           5 :                 if(pAny)
     721           5 :                     (*pAny) <<= aCharStyles;
     722             :             }
     723             :             else
     724           4 :                 eNewState = PropertyState_DEFAULT_VALUE;
     725             :         }
     726           9 :         break;
     727             :         case RES_TXTATR_CHARFMT:
     728             :         // no break here!
     729        2099 :         default: bDone = false;
     730             :     }
     731        9219 :     if( bDone )
     732        7120 :         eState = eNewState;
     733        9219 :     return bDone;
     734             : };
     735             : 
     736           2 : sal_Int16 IsNodeNumStart(SwPaM& rPam, PropertyState& eState)
     737             : {
     738           2 :     const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
     739             :     // correction: check, if restart value is set at the text node and use
     740             :     // new method <SwTxtNode::GetAttrListRestartValue()> to retrieve the value
     741           2 :     if ( pTxtNd && pTxtNd->GetNumRule() && pTxtNd->IsListRestart() &&
     742           0 :          pTxtNd->HasAttrListRestartValue() )
     743             :     {
     744           0 :         eState = PropertyState_DIRECT_VALUE;
     745           0 :         sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTxtNd->GetAttrListRestartValue());
     746           0 :         return nTmp;
     747             :     }
     748           2 :     eState = PropertyState_DEFAULT_VALUE;
     749           2 :     return -1;
     750             : }
     751             : 
     752        1248 : void setNumberingProperty(const Any& rValue, SwPaM& rPam)
     753             : {
     754        1248 :     uno::Reference<XIndexReplace> xIndexReplace;
     755        1248 :     if(rValue >>= xIndexReplace)
     756             :     {
     757        1248 :         SwXNumberingRules* pSwNum = 0;
     758             : 
     759        1248 :         uno::Reference<XUnoTunnel> xNumTunnel(xIndexReplace, UNO_QUERY);
     760        1248 :         if(xNumTunnel.is())
     761             :         {
     762             :             pSwNum = reinterpret_cast< SwXNumberingRules * >(
     763        1248 :                 sal::static_int_cast< sal_IntPtr >( xNumTunnel->getSomething( SwXNumberingRules::getUnoTunnelId() )));
     764             :         }
     765             : 
     766        1248 :         if(pSwNum)
     767             :         {
     768        1248 :             SwDoc* pDoc = rPam.GetDoc();
     769        1248 :             if(pSwNum->GetNumRule())
     770             :             {
     771        1172 :                 SwNumRule aRule(*pSwNum->GetNumRule());
     772        1172 :                 const OUString* pNewCharStyles =  pSwNum->GetNewCharStyleNames();
     773        1172 :                 const OUString* pBulletFontNames = pSwNum->GetBulletFontNames();
     774       12892 :                 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
     775             :                 {
     776       11720 :                     SwNumFmt aFmt(aRule.Get( i ));
     777       54267 :                     if (!pNewCharStyles[i].isEmpty() &&
     778       23440 :                         !SwXNumberingRules::isInvalidStyle(pNewCharStyles[i]) &&
     779       11720 :                         (!aFmt.GetCharFmt() || pNewCharStyles[i] != aFmt.GetCharFmt()->GetName()))
     780             :                     {
     781           0 :                         if (pNewCharStyles[i].isEmpty())
     782             :                         {
     783             :                             // FIXME
     784             :                             // Is something missing/wrong here?
     785             :                             // if condition is always false due to outer check!
     786           0 :                             aFmt.SetCharFmt(0);
     787             :                         }
     788             :                         else
     789             :                         {
     790             : 
     791             :                             // get CharStyle and set the rule
     792           0 :                             sal_uInt16 nChCount = pDoc->GetCharFmts()->size();
     793           0 :                             SwCharFmt* pCharFmt = 0;
     794           0 :                             for(sal_uInt16 nCharFmt = 0; nCharFmt < nChCount; nCharFmt++)
     795             :                             {
     796           0 :                                 SwCharFmt& rChFmt = *((*(pDoc->GetCharFmts()))[nCharFmt]);
     797           0 :                                 if(rChFmt.GetName() == pNewCharStyles[i])
     798             :                                 {
     799           0 :                                     pCharFmt = &rChFmt;
     800           0 :                                     break;
     801             :                                 }
     802             :                             }
     803             : 
     804           0 :                             if(!pCharFmt)
     805             :                             {
     806           0 :                                 SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
     807             :                                 SfxStyleSheetBase* pBase;
     808           0 :                                 pBase = pPool->Find(pNewCharStyles[i], SFX_STYLE_FAMILY_CHAR);
     809             :                             // shall it really be created?
     810           0 :                                 if(!pBase)
     811           0 :                                     pBase = &pPool->Make(pNewCharStyles[i], SFX_STYLE_FAMILY_PAGE);
     812           0 :                                 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
     813             :                             }
     814           0 :                             if(pCharFmt)
     815           0 :                                 aFmt.SetCharFmt(pCharFmt);
     816             :                         }
     817             :                     }
     818             :                     //Now again for fonts
     819       11720 :                     if(
     820       23440 :                        !pBulletFontNames[i].isEmpty() &&
     821       11720 :                        !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
     822           0 :                        (!aFmt.GetBulletFont() || aFmt.GetBulletFont()->GetName() != pBulletFontNames[i])
     823             :                       )
     824             :                     {
     825             :                         const SvxFontListItem* pFontListItem =
     826           0 :                                 (const SvxFontListItem* )pDoc->GetDocShell()
     827           0 :                                                     ->GetItem( SID_ATTR_CHAR_FONTLIST );
     828           0 :                         const FontList*  pList = pFontListItem->GetFontList();
     829             : 
     830             :                         FontInfo aInfo = pList->Get(
     831           0 :                             pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
     832           0 :                         Font aFont(aInfo);
     833           0 :                         aFmt.SetBulletFont(&aFont);
     834             :                     }
     835       11720 :                     aRule.Set( i, aFmt );
     836       11720 :                 }
     837        2344 :                 UnoActionContext aAction(pDoc);
     838             : 
     839        1172 :                 if( rPam.GetNext() != &rPam )           // Multiple selection?
     840             :                 {
     841           0 :                     pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
     842           0 :                     SwPamRanges aRangeArr( rPam );
     843           0 :                     SwPaM aPam( *rPam.GetPoint() );
     844           0 :                     for ( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
     845             :                     {
     846             :                         // no start of a new list
     847           0 :                         pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
     848             :                     }
     849           0 :                     pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
     850             :                 }
     851             :                 else
     852             :                 {
     853             :                     // no start of a new list
     854        1172 :                     pDoc->SetNumRule( rPam, aRule, false );
     855        1172 :                 }
     856             : 
     857             :             }
     858          76 :             else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
     859             :             {
     860          72 :                 UnoActionContext aAction( pDoc );
     861          72 :                 SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
     862          72 :                 if ( !pRule )
     863           0 :                     throw RuntimeException();
     864             :                 // no start of a new list
     865          72 :                 pDoc->SetNumRule( rPam, *pRule, false );
     866             :             }
     867             :             // #i103817#
     868             :             // outline numbering
     869             :             else
     870             :             {
     871             :                 // outline numbering
     872           4 :                 UnoActionContext aAction(pDoc);
     873           4 :                 SwNumRule* pRule = pDoc->GetOutlineNumRule();
     874           4 :                 if(!pRule)
     875           0 :                     throw RuntimeException();
     876           4 :                 pDoc->SetNumRule( rPam, *pRule, false );
     877             :             }
     878        1248 :         }
     879             :     }
     880           0 :     else if ( rValue.getValueType() == ::getVoidCppuType() )
     881             :     {
     882           0 :         rPam.GetDoc()->DelNumRules(rPam);
     883        1248 :     }
     884        1248 : }
     885             : 
     886        2924 : void  getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
     887             : {
     888        2924 :     const SwNumRule* pNumRule = rPam.GetDoc()->GetNumRuleAtPos( *rPam.GetPoint() );
     889        2924 :     if(pNumRule)
     890             :     {
     891          36 :         uno::Reference< XIndexReplace >  xNum = new SwXNumberingRules(*pNumRule);
     892          36 :         if ( pAny )
     893          36 :             pAny->setValue(&xNum, ::getCppuType((const uno::Reference<XIndexReplace>*)0));
     894          36 :         eState = PropertyState_DIRECT_VALUE;
     895             :     }
     896             :     else
     897        2888 :         eState = PropertyState_DEFAULT_VALUE;
     898        2924 : }
     899             : 
     900         111 : void GetCurPageStyle(SwPaM& rPaM, OUString &rString)
     901             : {
     902         111 :     if (!rPaM.GetCntntNode())
     903         113 :         return; // TODO: is there an easy way to get it for tables/sections?
     904         109 :     const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->GetCurrentLayout())->FindPageFrm();
     905         109 :     if(pPage)
     906             :     {
     907          46 :         OUString tmp;
     908             :         SwStyleNameMapper::FillProgName(pPage->GetPageDesc()->GetName(),
     909          46 :             tmp, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true);
     910          46 :         rString = tmp;
     911             :     }
     912             : }
     913             : 
     914             : /* --------------------------------------------------
     915             :  * reset special properties of the cursor
     916             :  * --------------------------------------------------*/
     917           3 : void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam)
     918             : {
     919           3 :     SwDoc* pDoc = rPam.GetDoc();
     920           3 :     switch(rEntry.nWID)
     921             :     {
     922             :         case FN_UNO_PARA_STYLE :
     923             : //          lcl_SetTxtFmtColl(aValue, pUnoCrsr);
     924           0 :         break;
     925             :         case FN_UNO_PAGE_STYLE :
     926           0 :         break;
     927             :         case FN_UNO_NUM_START_VALUE  :
     928             :         {
     929           1 :             UnoActionContext aAction(pDoc);
     930             : 
     931           1 :             if( rPam.GetNext() != &rPam )           // Multiple selection?
     932             :             {
     933           0 :                 pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
     934           0 :                 SwPamRanges aRangeArr( rPam );
     935           0 :                 SwPaM aPam( *rPam.GetPoint() );
     936           0 :                 for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
     937           0 :                     pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
     938           0 :                 pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
     939             :             }
     940             :             else
     941           1 :                 pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
     942             :         }
     943             : 
     944           1 :         break;
     945             :         case FN_UNO_NUM_LEVEL  :
     946           0 :         break;
     947             :         case FN_UNO_NUM_RULES:
     948             : //          lcl_setNumberingProperty(aValue, pUnoCrsr);
     949           0 :         break;
     950             :         case FN_UNO_CHARFMT_SEQUENCE:
     951             :         {
     952           0 :             std::set<sal_uInt16> aWhichIds;
     953           0 :             aWhichIds.insert( RES_TXTATR_CHARFMT);
     954           0 :             pDoc->ResetAttrs(rPam, true, aWhichIds);
     955             :         }
     956           0 :         break;
     957             :     }
     958           3 : }
     959             : 
     960           0 : void InsertFile(SwUnoCrsr* pUnoCrsr, const OUString& rURL,
     961             :     const uno::Sequence< beans::PropertyValue >& rOptions)
     962             :     throw (lang::IllegalArgumentException, io::IOException,
     963             :            uno::RuntimeException, std::exception)
     964             : {
     965           0 :     SfxMedium* pMed = 0;
     966           0 :     SwDoc* pDoc = pUnoCrsr->GetDoc();
     967           0 :     SwDocShell* pDocSh = pDoc->GetDocShell();
     968           0 :     utl::MediaDescriptor aMediaDescriptor( rOptions );
     969           0 :     OUString sFileName = rURL;
     970           0 :     OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
     971           0 :     uno::Reference < io::XStream > xStream;
     972           0 :     uno::Reference < io::XInputStream > xInputStream;
     973             : 
     974           0 :     if( sFileName.isEmpty() )
     975           0 :         aMediaDescriptor[utl::MediaDescriptor::PROP_URL()] >>= sFileName;
     976           0 :     if( sFileName.isEmpty() )
     977           0 :         aMediaDescriptor[utl::MediaDescriptor::PROP_FILENAME()] >>= sFileName;
     978           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
     979           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_STREAM()] >>= xStream;
     980           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
     981           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] >>= sFilterName;
     982           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_FILTEROPTIONS()] >>= sFilterOptions;
     983           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_PASSWORD()] >>= sPassword;
     984           0 :     aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= sBaseURL;
     985           0 :     if ( !xInputStream.is() && xStream.is() )
     986           0 :         xInputStream = xStream->getInputStream();
     987             : 
     988           0 :     if(!pDocSh || (sFileName.isEmpty() && !xInputStream.is()))
     989           0 :         return;
     990             : 
     991           0 :     SfxObjectFactory& rFact = pDocSh->GetFactory();
     992           0 :     const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
     993           0 :     uno::Reference < embed::XStorage > xReadStorage;
     994           0 :     if( xInputStream.is() )
     995             :     {
     996           0 :         uno::Sequence< uno::Any > aArgs( 2 );
     997           0 :         aArgs[0] <<= xInputStream;
     998           0 :         aArgs[1] <<= embed::ElementModes::READ;
     999             :         try
    1000             :         {
    1001           0 :             xReadStorage = uno::Reference< embed::XStorage >(
    1002           0 :                             ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
    1003           0 :                             uno::UNO_QUERY );
    1004             :         }
    1005           0 :         catch( const io::IOException& rEx)
    1006             :         {
    1007             :             (void)rEx;
    1008           0 :         }
    1009             :     }
    1010           0 :     if ( !pFilter )
    1011             :     {
    1012           0 :         if( xInputStream.is() && !xReadStorage.is())
    1013             :         {
    1014           0 :             pMed = new SfxMedium;
    1015           0 :             pMed->setStreamToLoadFrom(xInputStream, true );
    1016             :         }
    1017             :         else
    1018           0 :             pMed = xReadStorage.is() ?
    1019           0 :                 new SfxMedium(xReadStorage, sBaseURL, 0 ) :
    1020           0 :                 new SfxMedium(sFileName, STREAM_READ, 0, 0 );
    1021           0 :         if( !sBaseURL.isEmpty() )
    1022           0 :             pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
    1023             : 
    1024           0 :         SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
    1025           0 :         ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False );
    1026           0 :         if ( nErr || !pFilter)
    1027           0 :             DELETEZ(pMed);
    1028             :         else
    1029           0 :             pMed->SetFilter( pFilter );
    1030             :     }
    1031             :     else
    1032             :     {
    1033           0 :         if(!pMed)
    1034             :         {
    1035           0 :             if( xInputStream.is() && !xReadStorage.is())
    1036             :             {
    1037           0 :                 pMed = new SfxMedium;
    1038           0 :                 pMed->setStreamToLoadFrom(xInputStream, true );
    1039           0 :                 pMed->SetFilter( pFilter );
    1040             :             }
    1041             :             else
    1042             :             {
    1043           0 :                 if( xReadStorage.is() )
    1044             :                 {
    1045           0 :                     pMed = new SfxMedium(xReadStorage, sBaseURL, 0 );
    1046           0 :                     pMed->SetFilter( pFilter );
    1047             :                 }
    1048             :                 else
    1049           0 :                     pMed = new SfxMedium(sFileName, STREAM_READ, pFilter, 0);
    1050             :             }
    1051             :         }
    1052           0 :         if(!sFilterOptions.isEmpty())
    1053           0 :             pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
    1054           0 :         if(!sBaseURL.isEmpty())
    1055           0 :             pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
    1056             :     }
    1057             : 
    1058           0 :     if( !pMed )
    1059           0 :         return;
    1060             : 
    1061             :     // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used
    1062           0 :     SfxObjectShellRef aRef( pDocSh );
    1063             : 
    1064           0 :     pMed->Download();   // if necessary: start the download
    1065           0 :     if( aRef.Is() && 1 < aRef->GetRefCount() )  // Ref still valid?
    1066             :     {
    1067             :         SwReader* pRdr;
    1068           0 :         SfxItemSet* pSet =  pMed->GetItemSet();
    1069           0 :         pSet->Put(SfxBoolItem(FN_API_CALL, true));
    1070           0 :         if(!sPassword.isEmpty())
    1071           0 :             pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
    1072           0 :         Reader *pRead = pDocSh->StartConvertFrom( *pMed, &pRdr, 0, pUnoCrsr);
    1073           0 :         if( pRead )
    1074             :         {
    1075             : 
    1076           0 :             UnoActionContext aContext(pDoc);
    1077             : 
    1078           0 :             if(pUnoCrsr->HasMark())
    1079           0 :                 pDoc->DeleteAndJoin(*pUnoCrsr);
    1080             : 
    1081           0 :             SwNodeIndex aSave(  pUnoCrsr->GetPoint()->nNode, -1 );
    1082           0 :             sal_Int32 nCntnt = pUnoCrsr->GetPoint()->nContent.GetIndex();
    1083             : 
    1084           0 :             sal_uInt32 nErrno = pRdr->Read( *pRead );   // and paste the document
    1085             : 
    1086           0 :             if(!nErrno)
    1087             :             {
    1088           0 :                 ++aSave;
    1089           0 :                 pUnoCrsr->SetMark();
    1090           0 :                 pUnoCrsr->GetMark()->nNode = aSave;
    1091             : 
    1092           0 :                 SwCntntNode* pCntNode = aSave.GetNode().GetCntntNode();
    1093           0 :                 if( !pCntNode )
    1094           0 :                     nCntnt = 0;
    1095           0 :                 pUnoCrsr->GetMark()->nContent.Assign( pCntNode, nCntnt );
    1096             :             }
    1097             : 
    1098           0 :             delete pRdr;
    1099             : 
    1100             :         }
    1101             :     }
    1102           0 :     delete pMed;
    1103             : }
    1104             : 
    1105             : // insert text and scan for CR characters in order to insert
    1106             : // paragraph breaks at those positions by calling SplitNode
    1107       41850 : bool DocInsertStringSplitCR(
    1108             :         SwDoc &rDoc,
    1109             :         const SwPaM &rNewCursor,
    1110             :         const OUString &rText,
    1111             :         const bool bForceExpandHints )
    1112             : {
    1113       41850 :     bool bOK = true;
    1114             : 
    1115             :         const enum IDocumentContentOperations::InsertFlags nInsertFlags =
    1116             :             (bForceExpandHints)
    1117             :             ? static_cast<IDocumentContentOperations::InsertFlags>(
    1118             :                     IDocumentContentOperations::INS_FORCEHINTEXPAND |
    1119             :                     IDocumentContentOperations::INS_EMPTYEXPAND)
    1120       41850 :             : IDocumentContentOperations::INS_EMPTYEXPAND;
    1121             : 
    1122             :     // grouping done in InsertString is intended for typing, not API calls
    1123       41850 :     ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
    1124       83700 :     OUString aTxt;
    1125       41850 :     sal_Int32 nStartIdx = 0;
    1126             :     SwTxtNode* const pTxtNd =
    1127       41850 :         rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
    1128       41850 :     if (!pTxtNd)
    1129             :     {
    1130             :         SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
    1131           0 :         return false;
    1132             :     }
    1133       41850 :     const sal_Int32 nMaxLength = COMPLETE_STRING - pTxtNd->GetTxt().getLength();
    1134             : 
    1135       41850 :     sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
    1136       41850 :     if( ( nIdx == -1 && nMaxLength < rText.getLength() ) ||
    1137           0 :         ( nIdx != -1 && nMaxLength < nIdx ) )
    1138             :     {
    1139           0 :         nIdx = nMaxLength;
    1140             :     }
    1141       83700 :     while (nIdx != -1 )
    1142             :     {
    1143             :         OSL_ENSURE( nIdx - nStartIdx >= 0, "index negative!" );
    1144           0 :         aTxt = rText.copy( nStartIdx, nIdx - nStartIdx );
    1145           0 :         if (!aTxt.isEmpty() &&
    1146           0 :             !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
    1147             :         {
    1148             :             OSL_FAIL( "Doc->Insert(Str) failed." );
    1149           0 :             bOK = false;
    1150             :         }
    1151           0 :         if (!rDoc.SplitNode( *rNewCursor.GetPoint(), false ) )
    1152             :         {
    1153             :             OSL_FAIL( "SplitNode failed" );
    1154           0 :             bOK = false;
    1155             :         }
    1156           0 :         nStartIdx = nIdx + 1;
    1157           0 :         nIdx = rText.indexOf( '\r', nStartIdx );
    1158             :     }
    1159       41850 :     aTxt = rText.copy( nStartIdx );
    1160       83579 :     if (!aTxt.isEmpty() &&
    1161       41729 :         !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
    1162             :     {
    1163             :         OSL_FAIL( "Doc->Insert(Str) failed." );
    1164           0 :         bOK = false;
    1165             :     }
    1166             : 
    1167       83700 :     return bOK;
    1168             : }
    1169             : 
    1170         768 : void makeRedline( SwPaM& rPaM,
    1171             :     const OUString& rRedlineType,
    1172             :     const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
    1173             :         throw (lang::IllegalArgumentException, uno::RuntimeException)
    1174             : {
    1175         768 :     IDocumentRedlineAccess* pRedlineAccess = rPaM.GetDoc();
    1176             : 
    1177             :     RedlineType_t eType;
    1178         768 :     if      ( rRedlineType == "Insert" )
    1179          47 :         eType = nsRedlineType_t::REDLINE_INSERT;
    1180         721 :     else if ( rRedlineType == "Delete" )
    1181         201 :         eType = nsRedlineType_t::REDLINE_DELETE;
    1182         520 :     else if ( rRedlineType == "Format" )
    1183         459 :         eType = nsRedlineType_t::REDLINE_FORMAT;
    1184          61 :     else if ( rRedlineType == "TextTable" )
    1185           0 :         eType = nsRedlineType_t::REDLINE_TABLE;
    1186          61 :     else if ( rRedlineType == "ParagraphFormat" )
    1187          61 :         eType = nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT;
    1188             :     else
    1189           0 :         throw lang::IllegalArgumentException();
    1190             : 
    1191             :     //todo: what about REDLINE_FMTCOLL?
    1192         768 :     comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
    1193        1536 :     uno::Any aAuthorValue;
    1194         768 :     aAuthorValue = aPropMap.getUnpackedValueOrDefault("RedlineAuthor", aAuthorValue);
    1195         768 :     sal_uInt16 nAuthor = 0;
    1196        1536 :     OUString sAuthor;
    1197         768 :     if( aAuthorValue >>= sAuthor )
    1198         768 :         nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
    1199             : 
    1200        1536 :     OUString sComment;
    1201        1536 :     uno::Any aCommentValue;
    1202         768 :     aCommentValue = aPropMap.getUnpackedValueOrDefault("RedlineComment", aCommentValue);
    1203             : 
    1204        1536 :     SwRedlineData aRedlineData( eType, nAuthor );
    1205         768 :     if( aCommentValue >>= sComment )
    1206           0 :         aRedlineData.SetComment( sComment );
    1207             : 
    1208         768 :     ::util::DateTime aStamp;
    1209        1536 :     uno::Any aDateTimeValue;
    1210         768 :     aDateTimeValue = aPropMap.getUnpackedValueOrDefault("RedlineDateTime", aDateTimeValue);
    1211         768 :     if( aDateTimeValue >>= aStamp )
    1212             :     {
    1213             :        aRedlineData.SetTimeStamp(
    1214         768 :         DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
    1215             :     }
    1216             : 
    1217         768 :     SwRedlineExtraData_FormattingChanges* pRedlineExtraData = NULL;
    1218             : 
    1219             :     // Read the 'Redline Revert Properties' from the parameters
    1220        1536 :     uno::Sequence< beans::PropertyValue > aRevertProperties;
    1221        1536 :     uno::Any aRevertPropertiesValue;
    1222         768 :     aRevertPropertiesValue = aPropMap.getUnpackedValueOrDefault("RedlineRevertProperties", aRevertPropertiesValue);
    1223             : 
    1224             :     // Check if the value exists
    1225         768 :     if ( aRevertPropertiesValue >>= aRevertProperties )
    1226             :     {
    1227             :         // sw/source/core/unocore/unoport.cxx#83 is where it's decided what map gets used for a text portion
    1228             :         // so it's PROPERTY_MAP_TEXTPORTION_EXTENSIONS, unless it's a redline portion
    1229         768 :         SfxItemPropertySet const& rPropSet = (*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXTPORTION_EXTENSIONS));
    1230             : 
    1231             :         // Check if there are any properties
    1232         768 :         if (aRevertProperties.getLength())
    1233             :         {
    1234          24 :             SwDoc *const pDoc = rPaM.GetDoc();
    1235          48 :             OUString aUnknownExMsg, aPropertyVetoExMsg;
    1236             : 
    1237             :             // Build set of attributes we want to fetch
    1238          48 :             std::vector<sal_uInt16> aWhichPairs;
    1239          48 :             std::vector<SfxItemPropertySimpleEntry const*> aEntries;
    1240          24 :             aEntries.reserve(aRevertProperties.getLength());
    1241         224 :             for (sal_Int32 i = 0; i < aRevertProperties.getLength(); ++i)
    1242             :             {
    1243          88 :                 const OUString &rPropertyName = aRevertProperties[i].Name;
    1244          88 :                 SfxItemPropertySimpleEntry const* pEntry = rPropSet.getPropertyMap().getByName(rPropertyName);
    1245             : 
    1246             :                 // Queue up any exceptions until the end ...
    1247          88 :                 if (!pEntry)
    1248             :                 {
    1249           0 :                     aUnknownExMsg += "Unknown property: '" + rPropertyName + "' ";
    1250           0 :                     break;
    1251             :                 }
    1252          88 :                 else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
    1253             :                 {
    1254           0 :                     aPropertyVetoExMsg += "Property is read-only: '" + rPropertyName + "' ";
    1255           0 :                     break;
    1256             :                 }
    1257             :                 else
    1258             :                 {
    1259             :                     // FIXME: we should have some nice way of merging ranges surely ?
    1260          88 :                     aWhichPairs.push_back(pEntry->nWID);
    1261          88 :                     aWhichPairs.push_back(pEntry->nWID);
    1262             :                 }
    1263          88 :                 aEntries.push_back(pEntry);
    1264             :             }
    1265             : 
    1266          24 :             if (!aWhichPairs.empty())
    1267             :             {
    1268          24 :                 aWhichPairs.push_back(0); // terminate
    1269          24 :                 SfxItemSet aItemSet(pDoc->GetAttrPool(), &aWhichPairs[0]);
    1270             : 
    1271         112 :                 for (size_t i = 0; i < aEntries.size(); ++i)
    1272             :                 {
    1273          88 :                     SfxItemPropertySimpleEntry const*const pEntry = aEntries[i];
    1274          88 :                     const uno::Any &rValue = aRevertProperties[i].Value;
    1275          88 :                     rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
    1276             :                 }
    1277          24 :                 pRedlineExtraData = new SwRedlineExtraData_FormattingChanges( &aItemSet );
    1278          24 :             }
    1279             :         }
    1280             :     }
    1281             : 
    1282         768 :     SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
    1283         768 :     RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
    1284         768 :     pRedline->SetExtraData( pRedlineExtraData );
    1285             : 
    1286         768 :     pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
    1287         768 :     bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
    1288         768 :     pRedlineAccess->SetRedlineMode_intern( nPrevMode );
    1289         768 :     if( !bRet )
    1290         860 :         throw lang::IllegalArgumentException();
    1291         676 : }
    1292             : 
    1293          28 : void makeTableRowRedline( SwTableLine& rTableLine,
    1294             :     const OUString& rRedlineType,
    1295             :     const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
    1296             :         throw (lang::IllegalArgumentException, uno::RuntimeException)
    1297             : {
    1298          28 :     IDocumentRedlineAccess* pRedlineAccess = rTableLine.GetFrmFmt()->GetDoc();
    1299             : 
    1300             :     RedlineType_t eType;
    1301          28 :     if ( rRedlineType == "TableRowInsert" )
    1302             :     {
    1303           3 :         eType = nsRedlineType_t::REDLINE_TABLE_ROW_INSERT;
    1304             :     }
    1305          25 :     else if ( rRedlineType == "TableRowDelete" )
    1306             :     {
    1307          25 :         eType = nsRedlineType_t::REDLINE_TABLE_ROW_DELETE;
    1308             :     }
    1309             :     else
    1310             :     {
    1311           0 :         throw lang::IllegalArgumentException();
    1312             :     }
    1313             : 
    1314          28 :     comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
    1315          56 :     uno::Any aAuthorValue;
    1316          28 :     aAuthorValue = aPropMap.getUnpackedValueOrDefault("RedlineAuthor", aAuthorValue);
    1317          28 :     sal_uInt16 nAuthor = 0;
    1318          56 :     OUString sAuthor;
    1319          28 :     if( aAuthorValue >>= sAuthor )
    1320          28 :         nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
    1321             : 
    1322          56 :     OUString sComment;
    1323          56 :     uno::Any aCommentValue;
    1324          28 :     aCommentValue = aPropMap.getUnpackedValueOrDefault("RedlineComment", aCommentValue);
    1325             : 
    1326          56 :     SwRedlineData aRedlineData( eType, nAuthor );
    1327          28 :     if( aCommentValue >>= sComment )
    1328           0 :         aRedlineData.SetComment( sComment );
    1329             : 
    1330          28 :     ::util::DateTime aStamp;
    1331          56 :     uno::Any aDateTimeValue;
    1332          28 :     aDateTimeValue = aPropMap.getUnpackedValueOrDefault("RedlineDateTime", aDateTimeValue);
    1333          28 :     if( aDateTimeValue >>= aStamp )
    1334             :     {
    1335             :        aRedlineData.SetTimeStamp(
    1336          28 :         DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
    1337             :     }
    1338             : 
    1339          28 :     SwTableRowRedline* pRedline = new SwTableRowRedline( aRedlineData, rTableLine );
    1340          28 :     RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
    1341          28 :     pRedline->SetExtraData( NULL );
    1342             : 
    1343          28 :     pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
    1344          28 :     bool bRet = pRedlineAccess->AppendTableRowRedline( pRedline, false );
    1345          28 :     pRedlineAccess->SetRedlineMode_intern( nPrevMode );
    1346          28 :     if( !bRet )
    1347          28 :         throw lang::IllegalArgumentException();
    1348          28 : }
    1349             : 
    1350           6 : void makeTableCellRedline( SwTableBox& rTableBox,
    1351             :     const OUString& rRedlineType,
    1352             :     const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
    1353             :         throw (lang::IllegalArgumentException, uno::RuntimeException)
    1354             : {
    1355           6 :     IDocumentRedlineAccess* pRedlineAccess = rTableBox.GetFrmFmt()->GetDoc();
    1356             : 
    1357             :     RedlineType_t eType;
    1358           6 :     if ( rRedlineType == "TableCellInsert" )
    1359             :     {
    1360           3 :         eType = nsRedlineType_t::REDLINE_TABLE_CELL_INSERT;
    1361             :     }
    1362           3 :     else if ( rRedlineType == "TableCellDelete" )
    1363             :     {
    1364           3 :         eType = nsRedlineType_t::REDLINE_TABLE_CELL_DELETE;
    1365             :     }
    1366             :     else
    1367             :     {
    1368           0 :         throw lang::IllegalArgumentException();
    1369             :     }
    1370             : 
    1371           6 :     comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
    1372          12 :     uno::Any aAuthorValue;
    1373           6 :     aAuthorValue = aPropMap.getUnpackedValueOrDefault("RedlineAuthor", aAuthorValue);
    1374           6 :     sal_uInt16 nAuthor = 0;
    1375          12 :     OUString sAuthor;
    1376           6 :     if( aAuthorValue >>= sAuthor )
    1377           6 :         nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
    1378             : 
    1379          12 :     OUString sComment;
    1380          12 :     uno::Any aCommentValue;
    1381           6 :     aCommentValue = aPropMap.getUnpackedValueOrDefault("RedlineComment", aCommentValue);
    1382             : 
    1383          12 :     SwRedlineData aRedlineData( eType, nAuthor );
    1384           6 :     if( aCommentValue >>= sComment )
    1385           0 :         aRedlineData.SetComment( sComment );
    1386             : 
    1387           6 :     ::util::DateTime aStamp;
    1388          12 :     uno::Any aDateTimeValue;
    1389           6 :     aDateTimeValue = aPropMap.getUnpackedValueOrDefault("RedlineDateTime", aDateTimeValue);
    1390           6 :     if( aDateTimeValue >>= aStamp )
    1391             :     {
    1392             :        aRedlineData.SetTimeStamp(
    1393           6 :         DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
    1394             :     }
    1395             : 
    1396           6 :     SwTableCellRedline* pRedline = new SwTableCellRedline( aRedlineData, rTableBox );
    1397           6 :     RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
    1398           6 :     pRedline->SetExtraData( NULL );
    1399             : 
    1400           6 :     pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
    1401           6 :     bool bRet = pRedlineAccess->AppendTableCellRedline( pRedline, false );
    1402           6 :     pRedlineAccess->SetRedlineMode_intern( nPrevMode );
    1403           6 :     if( !bRet )
    1404           6 :         throw lang::IllegalArgumentException();
    1405           6 : }
    1406             : 
    1407        2508 : SwAnyMapHelper::~SwAnyMapHelper()
    1408             : {
    1409        1254 :     AnyMapHelper_t::iterator aIt = begin();
    1410       16733 :     while( aIt != end() )
    1411             :     {
    1412       14225 :         delete ( aIt->second );
    1413       14225 :         ++aIt;
    1414             :     }
    1415        1254 : }
    1416             : 
    1417       14479 : void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
    1418             : {
    1419       14479 :     sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
    1420       14479 :     AnyMapHelper_t::iterator aIt = find( nKey );
    1421       14479 :     if( aIt != end() )
    1422             :     {
    1423         254 :         *(aIt->second) = rAny;
    1424             :     }
    1425             :     else
    1426       14225 :         insert( value_type(nKey, new uno::Any( rAny )) );
    1427       14479 : }
    1428             : 
    1429      121031 : bool    SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
    1430             : {
    1431      121031 :     bool bRet = false;
    1432      121031 :     sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
    1433      121031 :     AnyMapHelper_t::iterator aIt = find( nKey );
    1434      121031 :     if( aIt != end() )
    1435             :     {
    1436       14821 :         pAny = aIt->second;
    1437       14821 :         bRet = true;
    1438             :     }
    1439      121031 :     return bRet;
    1440             : }
    1441             : 
    1442             : }//namespace SwUnoCursorHelper
    1443             : 
    1444             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10