LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unotbl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1850 2774 66.7 %
Date: 2012-08-25 Functions: 181 260 69.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1753 4865 36.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : 
      31                 :            : // STL includes
      32                 :            : #include <list>
      33                 :            : #include <vector>
      34                 :            : 
      35                 :            : #include <svx/svxids.hrc>
      36                 :            : #include <editeng/memberids.hrc>
      37                 :            : #include <float.h> // for DBL_MIN
      38                 :            : #include <swtypes.hxx>
      39                 :            : #include <cmdid.h>
      40                 :            : #include <unotbl.hxx>
      41                 :            : #include <unostyle.hxx>
      42                 :            : #include <section.hxx>
      43                 :            : #include <unocrsr.hxx>
      44                 :            : #include <svx/unomid.hxx>
      45                 :            : #include <hints.hxx>
      46                 :            : #include <swtblfmt.hxx>
      47                 :            : #include <doc.hxx>
      48                 :            : #include <IDocumentUndoRedo.hxx>
      49                 :            : #include <shellres.hxx>
      50                 :            : #include <docary.hxx>
      51                 :            : #include <ndole.hxx>
      52                 :            : #include <frame.hxx>
      53                 :            : #include <vcl/svapp.hxx>
      54                 :            : #include <fmtfsize.hxx>
      55                 :            : #include <tblafmt.hxx>
      56                 :            : #include <tabcol.hxx>
      57                 :            : #include <cellatr.hxx>
      58                 :            : #include <fmtpdsc.hxx>
      59                 :            : #include <pagedesc.hxx>
      60                 :            : #include <viewsh.hxx>
      61                 :            : #include <tabfrm.hxx>
      62                 :            : #include <redline.hxx>
      63                 :            : #include <unoredline.hxx>
      64                 :            : #include <unoprnms.hxx>
      65                 :            : #include <unocrsrhelper.hxx>
      66                 :            : #include <com/sun/star/text/WrapTextMode.hpp>
      67                 :            : #include <com/sun/star/text/TextContentAnchorType.hpp>
      68                 :            : #include <com/sun/star/text/TableColumnSeparator.hpp>
      69                 :            : #include <com/sun/star/text/XTextSection.hpp>
      70                 :            : #include <com/sun/star/text/VertOrientation.hpp>
      71                 :            : #include <com/sun/star/table/ShadowFormat.hpp>
      72                 :            : #include <com/sun/star/table/TableBorder.hpp>
      73                 :            : #include <com/sun/star/table/TableBorder2.hpp>
      74                 :            : #include <com/sun/star/table/BorderLine2.hpp>
      75                 :            : #include <com/sun/star/table/BorderLineStyle.hpp>
      76                 :            : #include <com/sun/star/table/TableBorderDistances.hpp>
      77                 :            : #include <com/sun/star/style/PageStyleLayout.hpp>
      78                 :            : #include <com/sun/star/style/BreakType.hpp>
      79                 :            : #include <com/sun/star/style/GraphicLocation.hpp>
      80                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      81                 :            : #include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
      82                 :            : #include <com/sun/star/chart/ChartDataChangeEvent.hpp>
      83                 :            : #include <com/sun/star/chart2/data/XDataSequence.hpp>
      84                 :            : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
      85                 :            : #include <com/sun/star/table/CellContentType.hpp>
      86                 :            : #include <unotextrange.hxx>
      87                 :            : #include <unotextcursor.hxx>
      88                 :            : #include <unoparagraph.hxx>
      89                 :            : #include <svl/zforlist.hxx>     // SvNumberFormatter
      90                 :            : #include <editeng/brkitem.hxx>
      91                 :            : #include <editeng/shaditem.hxx>
      92                 :            : #include <editeng/lrspitem.hxx>
      93                 :            : #include <editeng/ulspitem.hxx>
      94                 :            : #include <fmtornt.hxx>
      95                 :            : #include <editeng/keepitem.hxx>
      96                 :            : #include <fmtlsplt.hxx>
      97                 :            : #include <swundo.hxx>
      98                 :            : #include <osl/mutex.hxx>
      99                 :            : #include <SwStyleNameMapper.hxx>
     100                 :            : #include <frmatr.hxx>
     101                 :            : #include <crsskip.hxx>
     102                 :            : #include <unochart.hxx>
     103                 :            : #include <sortopt.hxx>
     104                 :            : #include <rtl/math.hxx>
     105                 :            : #include <editeng/frmdiritem.hxx>
     106                 :            : #include <switerator.hxx>
     107                 :            : #include <comphelper/servicehelper.hxx>
     108                 :            : #include <comphelper/string.hxx>
     109                 :            : 
     110                 :            : using namespace ::com::sun::star;
     111                 :            : using ::rtl::OUString;
     112                 :            : using ::editeng::SvxBorderLine;
     113                 :            : 
     114                 :            : // from swtable.cxx
     115                 :            : extern void lcl_GetTblBoxColStr( sal_uInt16 nCol, String& rNm );
     116                 :            : 
     117                 :            : #define UNO_TABLE_COLUMN_SUM    10000
     118                 :            : 
     119                 :        456 : sal_Bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
     120                 :            : {
     121                 :        456 :     rSvxLine.SetColor(Color(rLine.Color));
     122                 :            : 
     123                 :            :     rSvxLine.GuessLinesWidths( table::BorderLineStyle::NONE,
     124                 :            :                                 MM100_TO_TWIP( rLine.OuterLineWidth ),
     125                 :            :                                 MM100_TO_TWIP( rLine.InnerLineWidth ),
     126 [ +  - ][ +  - ]:        456 :                                 MM100_TO_TWIP( rLine.LineDistance ) );
                 [ +  - ]
     127                 :            : 
     128 [ +  + ][ +  + ]:        456 :     sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0;
     129                 :        456 :     return bRet;
     130                 :            : }
     131                 :            : 
     132                 :        165 : void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue)
     133                 :            :     throw (lang::IllegalArgumentException)
     134                 :            : {
     135                 :            :     //Sonderbehandlung fuer "Nicht-Items"
     136   [ +  +  +  - ]:        165 :     switch(pEntry->nWID)
     137                 :            :     {
     138                 :            :         case  FN_TABLE_HEADLINE_REPEAT:
     139                 :            :         case  FN_TABLE_HEADLINE_COUNT:
     140                 :            :         {
     141                 :         74 :             SwTable* pTable = SwTable::FindTable( pFmt );
     142                 :            :             {
     143         [ +  - ]:         74 :                 UnoActionContext aAction(pFmt->GetDoc());
     144         [ +  + ]:         74 :                 if( pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
     145                 :            :                 {
     146                 :          2 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     147 [ +  - ][ +  - ]:          2 :                     pFmt->GetDoc()->SetRowsToRepeat( *pTable, bVal ? 1 : 0 );
     148                 :            :                 }
     149                 :            :                 else
     150                 :            :                 {
     151                 :         72 :                     sal_Int32 nRepeat = 0;
     152                 :         72 :                     aValue >>= nRepeat;
     153 [ +  - ][ +  - ]:         72 :                     if( nRepeat >= 0 && nRepeat < USHRT_MAX )
     154         [ +  - ]:         72 :                         pFmt->GetDoc()->SetRowsToRepeat( *pTable, (sal_uInt16) nRepeat );
     155         [ +  - ]:         74 :                 }
     156                 :            :             }
     157                 :            :         }
     158                 :         74 :         break;
     159                 :            :         case  FN_TABLE_IS_RELATIVE_WIDTH:
     160                 :            :         case  FN_TABLE_WIDTH:
     161                 :            :         case  FN_TABLE_RELATIVE_WIDTH:
     162                 :            :         {
     163 [ +  - ][ +  - ]:         78 :             SwFmtFrmSize aSz( pFmt->GetFrmSize() );
     164         [ +  + ]:         78 :             if(FN_TABLE_WIDTH == pEntry->nWID)
     165                 :            :             {
     166                 :         74 :                 sal_Int32 nWidth = 0;
     167                 :         74 :                 aValue >>= nWidth;
     168                 :         74 :                 aSz.SetWidthPercent(0);
     169         [ +  - ]:         74 :                 aSz.SetWidth ( MM100_TO_TWIP ( nWidth ) );
     170                 :            :             }
     171         [ +  + ]:          4 :             else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID)
     172                 :            :             {
     173                 :          2 :                 sal_Int16 nSet = 0;
     174                 :          2 :                 aValue >>= nSet;
     175 [ +  - ][ +  - ]:          2 :                 if(nSet && nSet <=100)
     176                 :          2 :                     aSz.SetWidthPercent( (sal_uInt8)nSet );
     177                 :            :             }
     178         [ +  - ]:          2 :             else if(FN_TABLE_IS_RELATIVE_WIDTH == pEntry->nWID)
     179                 :            :             {
     180                 :          2 :                 sal_Bool bPercent = *(sal_Bool*)aValue.getValue();
     181         [ +  - ]:          2 :                 if(!bPercent)
     182                 :          2 :                     aSz.SetWidthPercent(0);
     183                 :            :                 else
     184                 :            :                 {
     185         [ #  # ]:          0 :                     lang::IllegalArgumentException aExcept;
     186         [ #  # ]:          0 :                     aExcept.Message = C2U("relative width cannot be switched on with this property");
     187         [ #  # ]:          0 :                     throw aExcept;
     188                 :            :                 }
     189                 :            :             }
     190 [ +  - ][ +  - ]:         78 :             pFmt->GetDoc()->SetAttr(aSz, *pFmt);
     191                 :            :         }
     192                 :         78 :         break;
     193                 :            :         case RES_PAGEDESC:
     194                 :            :         {
     195                 :         13 :             OUString uTemp;
     196                 :         13 :             aValue >>= uTemp;
     197         [ +  - ]:         13 :             String sPageStyle = uTemp;
     198                 :         13 :             const SwPageDesc* pDesc = 0;
     199         [ +  - ]:         13 :             if(sPageStyle.Len())
     200                 :            :             {
     201         [ +  - ]:         13 :                 SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
     202         [ +  - ]:         13 :                 pDesc = ::GetPageDescByName_Impl(*pFmt->GetDoc(), sPageStyle);
     203                 :            :             }
     204         [ +  - ]:         13 :             SwFmtPageDesc aDesc( pDesc );
     205 [ +  - ][ +  - ]:         13 :             pFmt->GetDoc()->SetAttr(aDesc, *pFmt);
                 [ +  - ]
     206                 :            :         }
     207                 :         13 :         break;
     208                 :            :         default:
     209         [ #  # ]:          0 :             throw lang::IllegalArgumentException();
     210                 :            :     }
     211                 :        165 : }
     212                 :            : 
     213                 :         24 : uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry )
     214                 :            : {
     215                 :         24 :     uno::Any aRet;
     216   [ +  +  +  -  :         24 :     switch(pEntry->nWID)
             +  -  -  -  
                      - ]
     217                 :            :     {
     218                 :            :         case  FN_TABLE_HEADLINE_REPEAT:
     219                 :            :         case  FN_TABLE_HEADLINE_COUNT:
     220                 :            :         {
     221         [ +  - ]:          4 :             SwTable* pTable = SwTable::FindTable( pFmt );
     222         [ +  - ]:          4 :             sal_uInt16 nRepeat = pTable->GetRowsToRepeat();
     223         [ +  - ]:          4 :             if(pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
     224                 :            :             {
     225                 :          4 :                 sal_Bool bTemp = nRepeat > 0;
     226         [ +  - ]:          4 :                 aRet.setValue(&bTemp, ::getCppuBooleanType());
     227                 :            :             }
     228                 :            :             else
     229         [ #  # ]:          0 :                 aRet <<= (sal_Int32)nRepeat;
     230                 :            :         }
     231                 :          4 :         break;
     232                 :            :         case  FN_TABLE_WIDTH:
     233                 :            :         case  FN_TABLE_IS_RELATIVE_WIDTH:
     234                 :            :         case  FN_TABLE_RELATIVE_WIDTH:
     235                 :            :         {
     236         [ +  - ]:         12 :             const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
     237         [ +  + ]:         12 :             if(FN_TABLE_WIDTH == pEntry->nWID)
     238         [ +  - ]:          4 :                 rSz.QueryValue(aRet, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
     239         [ +  + ]:          8 :             else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID)
     240         [ +  - ]:          4 :                 rSz.QueryValue(aRet, MID_FRMSIZE_REL_WIDTH);
     241                 :            :             else
     242                 :            :             {
     243                 :          4 :                 sal_Bool bTemp = 0 != rSz.GetWidthPercent();
     244         [ +  - ]:          4 :                 aRet.setValue(&bTemp, ::getBooleanCppuType());
     245                 :            :             }
     246                 :            :         }
     247                 :         12 :         break;
     248                 :            :         case RES_PAGEDESC:
     249                 :            :         {
     250                 :          4 :             const SfxItemSet& rSet = pFmt->GetAttrSet();
     251                 :            :             const SfxPoolItem* pItem;
     252         [ +  - ]:          4 :             String sPDesc;
     253 [ +  - ][ +  - ]:          4 :             if(SFX_ITEM_SET == rSet.GetItemState(RES_PAGEDESC, sal_False, &pItem))
     254                 :            :             {
     255                 :          4 :                 const SwPageDesc* pDsc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
     256         [ +  + ]:          4 :                 if(pDsc)
     257                 :            :                 {
     258 [ +  - ][ +  - ]:          2 :                    sPDesc = SwStyleNameMapper::GetProgName(pDsc->GetName(), nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
     259                 :            :                 }
     260                 :            :             }
     261 [ +  - ][ +  - ]:          4 :             aRet <<= OUString(sPDesc);
                 [ +  - ]
     262                 :            :         }
     263                 :          4 :         break;
     264                 :            :         case RES_ANCHOR :
     265         [ #  # ]:          0 :             aRet <<= text::TextContentAnchorType_AT_PARAGRAPH;
     266                 :          0 :         break;
     267                 :            :         case FN_UNO_ANCHOR_TYPES :
     268                 :            :         {
     269         [ +  - ]:          4 :             uno::Sequence<text::TextContentAnchorType> aTypes(1);
     270         [ +  - ]:          4 :              text::TextContentAnchorType* pArray = aTypes.getArray();
     271                 :          4 :             pArray[0] = text::TextContentAnchorType_AT_PARAGRAPH;
     272 [ +  - ][ +  - ]:          4 :             aRet <<= aTypes;
     273                 :            :         }
     274                 :          4 :         break;
     275                 :            :         case FN_UNO_WRAP :
     276                 :            :         {
     277         [ #  # ]:          0 :             aRet <<= text::WrapTextMode_NONE;
     278                 :            :         }
     279                 :          0 :         break;
     280                 :            :         case FN_PARAM_LINK_DISPLAY_NAME :
     281 [ #  # ][ #  # ]:          0 :             aRet <<= OUString(pFmt->GetName());
     282                 :          0 :         break;
     283                 :            :         case FN_UNO_REDLINE_NODE_START:
     284                 :            :         case FN_UNO_REDLINE_NODE_END:
     285                 :            :         {
     286         [ #  # ]:          0 :             SwTable* pTable = SwTable::FindTable( pFmt );
     287         [ #  # ]:          0 :             SwNode* pTblNode = pTable->GetTableNode();
     288         [ #  # ]:          0 :             if(FN_UNO_REDLINE_NODE_END == pEntry->nWID)
     289                 :          0 :                 pTblNode = pTblNode->EndOfSectionNode();
     290         [ #  # ]:          0 :             const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
     291         [ #  # ]:          0 :             for(sal_uInt16 nRed = 0; nRed < rRedTbl.size(); nRed++)
     292                 :            :             {
     293         [ #  # ]:          0 :                 const SwRedline* pRedline = rRedTbl[nRed];
     294                 :          0 :                 const SwNode* pRedPointNode = pRedline->GetNode(sal_True);
     295                 :          0 :                 const SwNode* pRedMarkNode = pRedline->GetNode(sal_False);
     296 [ #  # ][ #  # ]:          0 :                 if(pRedPointNode == pTblNode || pRedMarkNode == pTblNode)
     297                 :            :                 {
     298 [ #  # ][ #  # ]:          0 :                     const SwNode* pStartOfRedline = SwNodeIndex(*pRedPointNode) <= SwNodeIndex(*pRedMarkNode) ?
         [ #  # ][ #  # ]
     299         [ #  # ]:          0 :                         pRedPointNode : pRedMarkNode;
     300                 :          0 :                     sal_Bool bIsStart = pStartOfRedline == pTblNode;
     301 [ #  # ][ #  # ]:          0 :                     aRet <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, bIsStart);
     302                 :          0 :                     break;
     303                 :            :                 }
     304                 :            :             }
     305                 :            :         }
     306                 :          0 :         break;
     307                 :            :     }
     308                 :         24 :     return aRet;
     309                 :            : }
     310                 :            : 
     311                 :            : // returns the position for the cell with the specified name
     312                 :            : // (note that the indices rColumn and rRow are 0 based here)
     313                 :            : // Also since the implementations of tables does not really have
     314                 :            : // columns using this function is appropriate only for tables
     315                 :            : // that are not complex (i.e. where IsTblComplex() returns false).
     316                 :            : //
     317                 :            : // returns: both indices for column and row (all >= 0) if everything was Ok.
     318                 :            : //          At least one value < 0 if sth was wrong.
     319                 :            : //
     320                 :            : // Sample for naming scheme of cell in a single row (in groups a 26):
     321                 :            : // A1..Z1, a1..z1, AA1..AZ1, Aa1..Az1, BA1..BZ1, Ba1..Bz1, ...
     322                 :          8 : void lcl_GetCellPosition( const String &rCellName,
     323                 :            :         sal_Int32 &rColumn, sal_Int32 &rRow)
     324                 :            : {
     325                 :          8 :     rColumn = rRow = -1;    // default return values indicating failure
     326                 :          8 :     xub_StrLen nLen = rCellName.Len();
     327         [ +  - ]:          8 :     if (nLen)
     328                 :            :     {
     329                 :          8 :         const sal_Unicode *pBuf = rCellName.GetBuffer();
     330                 :          8 :         const sal_Unicode *pEnd = pBuf + nLen;
     331 [ +  - ][ +  - ]:         16 :         while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
         [ +  + ][ +  + ]
     332                 :          8 :             ++pBuf;
     333                 :            :         // start of number found?
     334 [ +  - ][ +  - ]:          8 :         if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
                 [ +  - ]
     335                 :            :         {
     336                 :          8 :             rtl::OUString aColTxt(rCellName.GetBuffer(), pBuf - rCellName.GetBuffer());
     337                 :          8 :             rtl::OUString aRowTxt(pBuf, (rCellName.GetBuffer() + nLen - pBuf));
     338 [ +  - ][ +  - ]:          8 :             if (!aColTxt.isEmpty() && !aRowTxt.isEmpty())
                 [ +  - ]
     339                 :            :             {
     340                 :          8 :                 sal_Int32 nColIdx = 0;
     341                 :          8 :                 sal_Int32 nLength = aColTxt.getLength();
     342         [ +  + ]:         16 :                 for (sal_Int32 i = 0;  i < nLength;  ++i)
     343                 :            :                 {
     344                 :          8 :                     nColIdx = 52 * nColIdx;
     345         [ -  + ]:          8 :                     if (i < nLength - 1)
     346                 :          0 :                         ++nColIdx;
     347                 :          8 :                     sal_Unicode cChar = aColTxt[i];
     348 [ +  - ][ +  - ]:          8 :                     if ('A' <= cChar && cChar <= 'Z')
     349                 :          8 :                         nColIdx = nColIdx + (cChar - 'A');
     350 [ #  # ][ #  # ]:          0 :                     else if ('a' <= cChar && cChar <= 'z')
     351                 :          0 :                         nColIdx = nColIdx + (26 + cChar - 'a');
     352                 :            :                     else
     353                 :            :                     {
     354                 :          0 :                         nColIdx = -1;   // sth failed
     355                 :          0 :                         break;
     356                 :            :                     }
     357                 :            :                 }
     358                 :            : 
     359                 :          8 :                 rColumn = nColIdx;
     360                 :          8 :                 rRow    = aRowTxt.toInt32() - 1;    // - 1 because indices ought to be 0 based
     361                 :          8 :             }
     362                 :            :         }
     363                 :            :     }
     364                 :            :     OSL_ENSURE( rColumn != -1 && rRow != -1, "failed to get column or row index" );
     365                 :          8 : }
     366                 :            : 
     367                 :            : // arguments: must be non-empty strings with valid cell names
     368                 :            : //
     369                 :            : // returns: -1 if first cell < second cell
     370                 :            : //           0 if both cells are equal
     371                 :            : //          +1 if the first cell > second cell
     372                 :            : //
     373                 :            : // Note: this function probably also make sense only
     374                 :            : //      for cell names of non-complex tables
     375                 :          0 : int lcl_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 )
     376                 :            : {
     377                 :          0 :     sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
     378                 :          0 :     lcl_GetCellPosition( rCellName1, nCol1, nRow1 );
     379                 :          0 :     lcl_GetCellPosition( rCellName2, nCol2, nRow2 );
     380                 :            : 
     381 [ #  # ][ #  # ]:          0 :     if (nRow1 < nRow2 || (nRow1 == nRow2 && nCol1 < nCol2))
                 [ #  # ]
     382                 :          0 :         return -1;
     383 [ #  # ][ #  # ]:          0 :     else if (nCol1 == nCol2 && nRow1 == nRow2)
     384                 :          0 :         return 0;
     385                 :            :     else
     386                 :          0 :         return +1;
     387                 :            : }
     388                 :            : 
     389                 :            : // arguments: must be non-empty strings with valid cell names
     390                 :            : //
     391                 :            : // returns: -1 if first cell < second cell
     392                 :            : //           0 if both cells are equal
     393                 :            : //          +1 if the first cell > second cell
     394                 :            : //
     395                 :            : // Note: this function probably also make sense only
     396                 :            : //      for cell names of non-complex tables
     397                 :          0 : int lcl_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 )
     398                 :            : {
     399                 :          0 :     sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
     400                 :          0 :     lcl_GetCellPosition( rCellName1, nCol1, nRow1 );
     401                 :          0 :     lcl_GetCellPosition( rCellName2, nCol2, nRow2 );
     402                 :            : 
     403 [ #  # ][ #  # ]:          0 :     if (nCol1 < nCol2 || (nCol1 == nCol2 && nRow1 < nRow2))
                 [ #  # ]
     404                 :          0 :         return -1;
     405 [ #  # ][ #  # ]:          0 :     else if (nRow1 == nRow2 && nCol1 == nCol2)
     406                 :          0 :         return 0;
     407                 :            :     else
     408                 :          0 :         return +1;
     409                 :            : }
     410                 :            : 
     411                 :            : // arguments: must be non-empty strings with valid cell names
     412                 :            : //
     413                 :            : // returns: -1 if first cell range < second cell range
     414                 :            : //           0 if both cell ranges are identical
     415                 :            : //          +1 if the first cell range > second cell range
     416                 :            : //
     417                 :            : // Note: this function probably also make sense only
     418                 :            : //      for cell names of non-complex tables
     419                 :          0 : int lcl_CompareCellRanges(
     420                 :            :         const String &rRange1StartCell, const String &rRange1EndCell,
     421                 :            :         const String &rRange2StartCell, const String &rRange2EndCell,
     422                 :            :         sal_Bool bCmpColsFirst )
     423                 :            : {
     424                 :            :     int (*pCompareCells)( const String &, const String & ) =
     425         [ #  # ]:          0 :             bCmpColsFirst ? &lcl_CompareCellsByColFirst : &lcl_CompareCellsByRowFirst;
     426                 :            : 
     427                 :          0 :     int nCmpResStartCells = pCompareCells( rRange1StartCell, rRange2StartCell );
     428   [ #  #  #  # ]:          0 :     if ((-1 == nCmpResStartCells ) ||
         [ #  # ][ #  # ]
     429                 :            :          ( 0 == nCmpResStartCells &&
     430                 :          0 :           -1 == pCompareCells( rRange1EndCell, rRange2EndCell ) ))
     431                 :          0 :         return -1;
     432   [ #  #  #  # ]:          0 :     else if (0 == nCmpResStartCells &&
                 [ #  # ]
     433                 :          0 :              0 == pCompareCells( rRange1EndCell, rRange2EndCell ))
     434                 :          0 :         return 0;
     435                 :            :     else
     436                 :          0 :         return +1;
     437                 :            : }
     438                 :            : 
     439                 :            : // returns the cell name for the cell at the specified position
     440                 :            : // (note that the indices nColumn and nRow are 0 based here)
     441                 :        981 : String lcl_GetCellName( sal_Int32 nColumn, sal_Int32 nRow )
     442                 :            : {
     443                 :            : #if OSL_DEBUG_LEVEL > 0
     444                 :            :     {
     445                 :            :         sal_Int32 nCol, nRow2;
     446                 :            :         lcl_GetCellPosition( rtl::OUString("z1"), nCol, nRow2);
     447                 :            :         OSL_ENSURE( nCol == 51, "lcl_GetCellPosition failed" );
     448                 :            :         lcl_GetCellPosition( rtl::OUString("AA1"), nCol, nRow2);
     449                 :            :         OSL_ENSURE( nCol == 52, "lcl_GetCellPosition failed" );
     450                 :            :         lcl_GetCellPosition( rtl::OUString("AB1"), nCol, nRow2);
     451                 :            :         OSL_ENSURE( nCol == 53, "lcl_GetCellPosition failed" );
     452                 :            :         lcl_GetCellPosition( rtl::OUString("BB1"), nCol, nRow2);
     453                 :            :         OSL_ENSURE( nCol == 105, "lcl_GetCellPosition failed" );
     454                 :            :     }
     455                 :            : #endif
     456                 :            : 
     457                 :        981 :     String sCellName;
     458 [ -  + ][ +  - ]:        981 :     if (nColumn < 0 || nRow < 0)
     459                 :          0 :         return sCellName;
     460         [ +  - ]:        981 :     lcl_GetTblBoxColStr( static_cast< sal_uInt16 >(nColumn), sCellName );
     461 [ +  - ][ +  - ]:        981 :     sCellName += String::CreateFromInt32( nRow + 1 );
                 [ +  - ]
     462                 :        981 :     return sCellName;
     463                 :            : }
     464                 :            : 
     465                 :            : /** Find the top left or bottom right corner box in given table.
     466                 :            :   Consider nested lines when finding the box.
     467                 :            : 
     468                 :            :   @param i_pTable the table
     469                 :            : 
     470                 :            :   @param i_bTopLeft if true, find top left box, otherwise find bottom
     471                 :            :          right box
     472                 :            :  */
     473                 :         42 : const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const bool i_bTopLeft)
     474                 :            : {
     475                 :         42 :     bool bFirst = true;
     476                 :         42 :     const SwTableBox* pBox = 0;
     477   [ +  -  -  + ]:         84 :     do
                 [ -  + ]
     478                 :            :     {
     479         [ +  - ]:         42 :         const SwTableLines& rLines(bFirst ? rTableLines : pBox->GetTabLines());
     480                 :         42 :         bFirst = false;
     481                 :            :         OSL_ASSERT(rLines.size() != 0);
     482         [ +  - ]:         42 :         if (!rLines.empty())
     483                 :            :         {
     484         [ +  + ]:         42 :             const SwTableLine* pLine(i_bTopLeft ? rLines.front() : rLines.back());
     485                 :            :             OSL_ASSERT(pLine);
     486                 :         42 :             const SwTableBoxes& rBoxes(pLine->GetTabBoxes());
     487                 :            :             OSL_ASSERT(rBoxes.size() != 0);
     488         [ +  + ]:         42 :             pBox = i_bTopLeft ? rBoxes.front() : rBoxes.back();
     489                 :            :             OSL_ASSERT(pBox);
     490                 :            :         }
     491                 :            :         else
     492                 :            :         {
     493                 :          0 :             pBox = 0;
     494                 :            :         }
     495                 :         42 :     } while (pBox && !pBox->GetSttNd());
     496                 :         42 :     return pBox;
     497                 :            : }
     498                 :            : 
     499                 :            : // start cell should be in the upper-left corner of the range and
     500                 :            : // end cell in the lower-right.
     501                 :            : // I.e. from the four possible representation
     502                 :            : //      A1:C5, C5:A1, A5:C1, C1:A5
     503                 :            : // only A1:C5 is the one to use
     504                 :          0 : void lcl_NormalizeRange(
     505                 :            :     String &rCell1,     // will hold the upper-left cell of the range upon return
     506                 :            :     String &rCell2 )    // will hold the lower-right cell of the range upon return
     507                 :            : {
     508                 :          0 :     sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
     509                 :          0 :     lcl_GetCellPosition( rCell1, nCol1, nRow1 );
     510                 :          0 :     lcl_GetCellPosition( rCell2, nCol2, nRow2 );
     511 [ #  # ][ #  # ]:          0 :     if (nCol2 < nCol1 || nRow2 < nRow1)
     512                 :            :     {
     513 [ #  # ][ #  # ]:          0 :         rCell1  = lcl_GetCellName( Min(nCol1, nCol2), Min(nRow1, nRow2) );
                 [ #  # ]
     514 [ #  # ][ #  # ]:          0 :         rCell2  = lcl_GetCellName( Max(nCol1, nCol2), Max(nRow1, nRow2) );
                 [ #  # ]
     515                 :            :     }
     516                 :            : 
     517                 :          0 : }
     518                 :            : 
     519                 :         22 : void SwRangeDescriptor::Normalize()
     520                 :            : {
     521         [ -  + ]:         22 :     if (nTop > nBottom)
     522                 :            :     {
     523                 :          0 :         sal_Int32 nTmp = nTop;
     524                 :          0 :         nTop = nBottom;
     525                 :          0 :         nBottom = nTmp;
     526                 :            :     }
     527         [ -  + ]:         22 :     if (nLeft > nRight)
     528                 :            :     {
     529                 :          0 :         sal_Int32 nTmp = nLeft;
     530                 :          0 :         nLeft = nRight;
     531                 :          0 :         nRight = nTmp;
     532                 :            :     }
     533                 :         22 : }
     534                 :            : 
     535                 :        951 : SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRow)
     536                 :            : {
     537                 :        951 :     SwXCell* pXCell = 0;
     538         [ +  - ]:        951 :     String sCellName = lcl_GetCellName(nColumn, nRow);
     539         [ +  - ]:        951 :     SwTable* pTable = SwTable::FindTable( pFmt );
     540         [ +  - ]:        951 :     SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
     541         [ +  - ]:        951 :     if(pBox)
     542                 :            :     {
     543         [ +  - ]:        951 :         pXCell = SwXCell::CreateXCell(pFmt, pBox, pTable);
     544                 :            :     }
     545         [ +  - ]:        951 :     return pXCell;
     546                 :            : }
     547                 :            : 
     548                 :         79 : void lcl_InspectLines(SwTableLines& rLines, std::vector<String*>& rAllNames)
     549                 :            : {
     550         [ +  + ]:        238 :     for( sal_uInt16 i = 0; i < rLines.size(); i++ )
     551                 :            :     {
     552                 :        159 :         SwTableLine* pLine = rLines[i];
     553                 :        159 :         SwTableBoxes& rBoxes = pLine->GetTabBoxes();
     554         [ +  + ]:       1083 :         for(sal_uInt16 j = 0; j < rBoxes.size(); j++)
     555                 :            :         {
     556                 :        924 :             SwTableBox* pBox = rBoxes[j];
     557 [ +  - ][ +  - ]:        924 :             if(pBox->GetName().Len() && pBox->getRowSpan() > 0 )
         [ +  - ][ +  - ]
           [ +  -  #  # ]
                 [ +  - ]
     558 [ +  - ][ +  - ]:        924 :                 rAllNames.push_back( new String(pBox->GetName()) );
     559                 :        924 :             SwTableLines& rBoxLines = pBox->GetTabLines();
     560         [ -  + ]:        924 :             if(!rBoxLines.empty())
     561                 :            :             {
     562                 :          0 :                 lcl_InspectLines(rBoxLines, rAllNames);
     563                 :            :             }
     564                 :            :         }
     565                 :            :     }
     566                 :         79 : }
     567                 :            : 
     568                 :        554 : void lcl_FormatTable(SwFrmFmt* pTblFmt)
     569                 :            : {
     570         [ +  - ]:        554 :     SwIterator<SwFrm,SwFmt> aIter( *pTblFmt );
     571 [ +  - ][ +  - ]:       1105 :     for( SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
                 [ +  + ]
     572                 :            :     {
     573                 :            :         // mba: no TYPEINFO for SwTabFrm
     574         [ +  - ]:        551 :         if( pFrm->IsTabFrm() )
     575                 :            :         {
     576         [ +  + ]:        551 :             if(pFrm->IsValid())
     577         [ +  - ]:        482 :                 pFrm->InvalidatePos();
     578                 :        551 :             ((SwTabFrm*)pFrm)->SetONECalcLowers();
     579         [ +  - ]:        551 :             ((SwTabFrm*)pFrm)->Calc();
     580                 :            :         }
     581         [ +  - ]:        554 :     }
     582                 :        554 : }
     583                 :            : 
     584                 :         38 : void lcl_CrsrSelect(SwPaM* pCrsr, sal_Bool bExpand)
     585                 :            : {
     586         [ +  + ]:         38 :     if(bExpand)
     587                 :            :     {
     588         [ +  - ]:          6 :         if(!pCrsr->HasMark())
     589                 :          6 :             pCrsr->SetMark();
     590                 :            :     }
     591         [ +  + ]:         32 :     else if(pCrsr->HasMark())
     592                 :          4 :         pCrsr->DeleteMark();
     593                 :            : 
     594                 :         38 : }
     595                 :            : 
     596                 :          8 : void lcl_GetTblSeparators(uno::Any& rRet, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow)
     597                 :            : {
     598         [ +  - ]:          8 :     SwTabCols aCols;
     599                 :          8 :     aCols.SetLeftMin ( 0 );
     600                 :          8 :     aCols.SetLeft    ( 0 );
     601                 :          8 :     aCols.SetRight   ( UNO_TABLE_COLUMN_SUM );
     602                 :          8 :     aCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
     603                 :            : 
     604         [ +  - ]:          8 :     pTable->GetTabCols( aCols, pBox, sal_False, bRow );
     605                 :            : 
     606         [ +  - ]:          8 :     sal_uInt16 nSepCount = aCols.Count();
     607         [ +  - ]:          8 :     uno::Sequence< text::TableColumnSeparator> aColSeq(nSepCount);
     608         [ +  - ]:          8 :      text::TableColumnSeparator* pArray = aColSeq.getArray();
     609                 :          8 :     sal_Bool bError = sal_False;
     610         [ +  + ]:         28 :     for(sal_uInt16 i = 0; i < nSepCount; i++)
     611                 :            :     {
     612         [ +  - ]:         20 :         pArray[i].Position = static_cast< sal_Int16 >(aCols[i]);
     613         [ +  - ]:         20 :         pArray[i].IsVisible = !aCols.IsHidden(i);
     614 [ +  + ][ -  + ]:         20 :         if(!bRow && !pArray[i].IsVisible)
     615                 :            :         {
     616                 :          0 :             bError = sal_True;
     617                 :          0 :             break;
     618                 :            :         }
     619                 :            :     }
     620         [ +  - ]:          8 :     if(!bError)
     621 [ +  - ][ +  - ]:          8 :         rRet.setValue(&aColSeq, ::getCppuType((uno::Sequence< text::TableColumnSeparator>*)0));
     622                 :            : 
     623                 :          8 : }
     624                 :            : 
     625                 :         83 : void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow, SwDoc* pDoc)
     626                 :            : {
     627         [ +  - ]:         83 :     SwTabCols aOldCols;
     628                 :            : 
     629                 :         83 :     aOldCols.SetLeftMin ( 0 );
     630                 :         83 :     aOldCols.SetLeft    ( 0 );
     631                 :         83 :     aOldCols.SetRight   ( UNO_TABLE_COLUMN_SUM );
     632                 :         83 :     aOldCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
     633                 :            : 
     634         [ +  - ]:         83 :     pTable->GetTabCols( aOldCols, pBox, sal_False, bRow );
     635         [ +  - ]:         83 :     sal_uInt16 nOldCount = aOldCols.Count();
     636                 :            :     //there's no use in setting tab cols if there's only one column
     637         [ -  + ]:         83 :     if( !nOldCount )
     638                 :         83 :         return;
     639                 :            : 
     640                 :            :     const uno::Sequence< text::TableColumnSeparator>* pSepSeq =
     641                 :         83 :                 (uno::Sequence< text::TableColumnSeparator>*) rVal.getValue();
     642 [ +  - ][ +  - ]:         83 :     if(pSepSeq && pSepSeq->getLength() == nOldCount)
                 [ +  - ]
     643                 :            :     {
     644         [ +  - ]:         83 :         SwTabCols aCols(aOldCols);
     645                 :         83 :         sal_Bool bError = sal_False;
     646                 :         83 :         const text::TableColumnSeparator* pArray = pSepSeq->getConstArray();
     647                 :         83 :         sal_Int32 nLastValue = 0;
     648                 :            :         //sal_Int32 nTblWidth = aCols.GetRight() - aCols.GetLeft();
     649         [ +  + ]:        440 :         for(sal_uInt16 i = 0; i < nOldCount; i++)
     650                 :            :         {
     651         [ +  - ]:        361 :             aCols[i] = pArray[i].Position;
     652 [ +  - ][ +  + ]:       1075 :             if(pArray[i].IsVisible == aCols.IsHidden(i) ||
         [ -  + ][ #  # ]
         [ +  - ][ -  + ]
                 [ +  + ]
     653         [ #  # ]:          0 :                 (!bRow && aCols.IsHidden(i)) ||
     654         [ +  - ]:        357 :                 long(aCols[i] - long(nLastValue)) < 0 ||
     655         [ +  - ]:        357 :                 UNO_TABLE_COLUMN_SUM < aCols[i] )
     656                 :            :             {
     657                 :          4 :                 bError = sal_True;
     658                 :          4 :                 break;
     659                 :            :             }
     660         [ +  - ]:        357 :             nLastValue = aCols[i];
     661                 :            :         }
     662         [ +  + ]:         83 :         if(!bError)
     663                 :            :         {
     664         [ +  - ]:         79 :             pDoc->SetTabCols(*pTable, aCols, aOldCols, pBox, bRow );
     665                 :         83 :         }
     666         [ +  - ]:         83 :     }
     667                 :            : }
     668                 :            : 
     669                 :         64 : inline rtl::OUString lcl_getString( SwXCell &rCell )
     670                 :            : {
     671                 :            :     // getString is a member function of the base class...
     672                 :         64 :     return rCell.getString();
     673                 :            : }
     674                 :            : 
     675                 :            : /*  non UNO function call to set string in SwXCell */
     676                 :        238 : void lcl_setString( SwXCell &rCell, const rtl::OUString &rTxt,
     677                 :            :         sal_Bool bKeepNumberFmt )
     678                 :            : {
     679         [ +  - ]:        238 :     if(rCell.IsValid())
     680                 :            :     {
     681                 :        238 :         SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
     682                 :        238 :         pBoxFmt->LockModify();
     683                 :        238 :         pBoxFmt->ResetFmtAttr( RES_BOXATR_FORMULA );
     684                 :        238 :         pBoxFmt->ResetFmtAttr( RES_BOXATR_VALUE );
     685         [ +  + ]:        238 :         if (!bKeepNumberFmt)
     686         [ +  - ]:         94 :             pBoxFmt->SetFmtAttr( SwTblBoxNumFormat(NUMBERFORMAT_TEXT) );
     687                 :        238 :         pBoxFmt->UnlockModify();
     688                 :            :     }
     689                 :        238 :     rCell.SwXText::setString(rTxt);
     690                 :        238 : }
     691                 :            : 
     692                 :            : /* non UNO function call to get value from SwXCell */
     693                 :        192 : double lcl_getValue( SwXCell &rCell )
     694                 :            : {
     695                 :            :     double fRet;
     696 [ +  - ][ +  - ]:        192 :     if(rCell.IsValid() && !rCell.getString().isEmpty())
         [ +  - ][ +  + ]
                 [ +  - ]
           [ +  +  #  # ]
     697         [ +  - ]:        132 :         fRet = rCell.pBox->GetFrmFmt()->GetTblBoxValue().GetValue();
     698                 :            :     else
     699                 :         60 :         ::rtl::math::setNan( &fRet );
     700                 :        192 :     return fRet;
     701                 :            : }
     702                 :            : 
     703                 :            : /* non UNO function call to set value in SwXCell */
     704                 :        144 : void lcl_setValue( SwXCell &rCell, double nVal )
     705                 :            : {
     706         [ +  - ]:        144 :     if(rCell.IsValid())
     707                 :            :     {
     708                 :            :         // Der Text mu? zunaechst (vielleicht) geloescht werden
     709         [ +  - ]:        144 :         sal_uLong nNdPos = rCell.pBox->IsValidNumTxtNd( sal_True );
     710         [ +  - ]:        144 :         if(ULONG_MAX != nNdPos)
     711         [ +  - ]:        144 :             lcl_setString( rCell, OUString(), sal_True );   // sal_True == keep number format
     712         [ +  - ]:        144 :         SwDoc* pDoc = rCell.GetDoc();
     713         [ +  - ]:        144 :         UnoActionContext aAction(pDoc);
     714         [ +  - ]:        144 :         SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
     715         [ +  - ]:        144 :         SfxItemSet aSet(pDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE);
     716                 :            :         const SfxPoolItem* pItem;
     717                 :            : 
     718                 :            :         //!! do we need to set a new number format? Yes, if
     719                 :            :         // - there is no current number format
     720                 :            :         // - the current number format is not a number format according to the number formatter, but rather a text format
     721                 :            :         // - the current number format is not even a valid number formatter number format, but rather Writer's own 'special' text number format
     722 [ +  - ][ +  + ]:        264 :         if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
           [ +  -  +  + ]
                 [ +  + ]
     723 [ +  - ][ +  - ]:         60 :             ||  pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
     724                 :         60 :             ||  ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT)
     725                 :            :         {
     726 [ +  - ][ +  - ]:        134 :             aSet.Put(SwTblBoxNumFormat(0));
                 [ +  - ]
     727                 :            :         }
     728                 :            : 
     729         [ +  - ]:        144 :         SwTblBoxValue aVal(nVal);
     730         [ +  - ]:        144 :         aSet.Put(aVal);
     731         [ +  - ]:        144 :         pDoc->SetTblBoxFormulaAttrs( *rCell.pBox, aSet );
     732                 :            :         //Tabelle aktualisieren
     733 [ +  - ][ +  - ]:        144 :         SwTableFmlUpdate aTblUpdate( SwTable::FindTable( rCell.GetFrmFmt() ));
     734 [ +  - ][ +  - ]:        144 :         pDoc->UpdateTblFlds( &aTblUpdate );
         [ +  - ][ +  - ]
                 [ +  - ]
     735                 :            :     }
     736                 :        144 : }
     737                 :            : 
     738                 :            : /******************************************************************
     739                 :            :  * SwXCell
     740                 :            :  ******************************************************************/
     741 [ +  + ][ +  + ]:       7593 : TYPEINIT1(SwXCell, SwClient);
     742                 :            : 
     743                 :       1546 : SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, sal_uInt16 nPos ) :
     744                 :            :     SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
     745                 :            :     SwClient(pTblFmt),
     746         [ +  - ]:       1546 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
     747                 :            :     pBox(pBx),
     748                 :            :     pStartNode(0),
     749 [ +  - ][ +  - ]:       1546 :     nFndPos(nPos)
     750                 :            : {
     751                 :       1546 : }
     752                 :            : 
     753                 :          0 : SwXCell::SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode) :
     754                 :            :     SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
     755                 :            :     SwClient(pTblFmt),
     756         [ #  # ]:          0 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
     757                 :            :     pBox(0),
     758                 :            :     pStartNode(&rStartNode),
     759 [ #  # ][ #  # ]:          0 :     nFndPos(USHRT_MAX)
     760                 :            : {
     761                 :          0 : }
     762                 :            : 
     763 [ +  - ][ +  - ]:       1546 : SwXCell::~SwXCell()
     764                 :            : {
     765         [ -  + ]:       3092 : }
     766                 :            : 
     767                 :            : namespace
     768                 :            : {
     769                 :            :     class theSwXCellUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXCellUnoTunnelId > {};
     770                 :            : }
     771                 :            : 
     772                 :        347 : const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId()
     773                 :            : {
     774                 :        347 :     return theSwXCellUnoTunnelId::get().getSeq();
     775                 :            : }
     776                 :            : 
     777                 :        345 : sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId )
     778                 :            :     throw(uno::RuntimeException)
     779                 :            : {
     780   [ +  -  -  + ]:        690 :     if( rId.getLength() == 16
                 [ -  + ]
     781                 :        345 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
     782                 :        345 :                                         rId.getConstArray(), 16 ) )
     783                 :            :     {
     784                 :          0 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
     785                 :            :     }
     786                 :            :     else
     787                 :        345 :         return SwXText::getSomething(rId);
     788                 :            : }
     789                 :            : 
     790                 :          0 : uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes(  ) throw(uno::RuntimeException)
     791                 :            : {
     792 [ #  # ][ #  # ]:          0 :     static uno::Sequence< uno::Type > aRetTypes;
         [ #  # ][ #  # ]
     793         [ #  # ]:          0 :     if(!aRetTypes.getLength())
     794                 :            :     {
     795 [ #  # ][ #  # ]:          0 :         aRetTypes = SwXCellBaseClass::getTypes();
                 [ #  # ]
     796         [ #  # ]:          0 :         uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
     797                 :            : 
     798                 :          0 :         long nIndex = aRetTypes.getLength();
     799                 :            :         aRetTypes.realloc(
     800                 :          0 :             aRetTypes.getLength() +
     801         [ #  # ]:          0 :             aTextTypes.getLength());
     802                 :            : 
     803         [ #  # ]:          0 :         uno::Type* pRetTypes = aRetTypes.getArray();
     804                 :            : 
     805                 :          0 :         const uno::Type* pTextTypes = aTextTypes.getConstArray();
     806         [ #  # ]:          0 :         for(long nPos = 0; nPos <aTextTypes.getLength(); nPos++)
     807         [ #  # ]:          0 :             pRetTypes[nIndex++] = pTextTypes[nPos];
     808                 :            :     }
     809                 :          0 :     return aRetTypes;
     810                 :            : }
     811                 :            : 
     812                 :            : namespace
     813                 :            : {
     814                 :            :     class theSwXCellImplementationId : public rtl::Static< UnoTunnelIdInit, theSwXCellImplementationId > {};
     815                 :            : }
     816                 :            : 
     817                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL SwXCell::getImplementationId(  ) throw(uno::RuntimeException)
     818                 :            : {
     819                 :          0 :     return theSwXCellImplementationId::get().getSeq();
     820                 :            : }
     821                 :            : 
     822                 :      13332 : void SAL_CALL SwXCell::acquire(  ) throw()
     823                 :            : {
     824                 :      13332 :     SwXCellBaseClass::acquire();
     825                 :      13332 : }
     826                 :            : 
     827                 :      13332 : void SAL_CALL SwXCell::release(  ) throw()
     828                 :            : {
     829                 :      13332 :     SwXCellBaseClass::release();
     830                 :      13332 : }
     831                 :            : 
     832                 :       1506 : uno::Any SAL_CALL SwXCell::queryInterface( const uno::Type& aType )
     833                 :            :     throw (uno::RuntimeException)
     834                 :            : {
     835                 :       1506 :     uno::Any aRet = SwXCellBaseClass::queryInterface(aType);
     836 [ +  + ][ +  - ]:       1506 :     if(aRet.getValueType() == ::getCppuVoidType())
     837         [ +  - ]:        421 :         aRet = SwXText::queryInterface(aType);
     838                 :       1506 :     return aRet;
     839                 :            : }
     840                 :            : 
     841                 :        301 : const SwStartNode *SwXCell::GetStartNode() const
     842                 :            : {
     843                 :        301 :     const SwStartNode *pSttNd = 0;
     844                 :            : 
     845 [ +  - ][ +  - ]:        301 :     if( pStartNode || ((SwXCell *)this)->IsValid() )
                 [ +  - ]
     846         [ -  + ]:        301 :         pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
     847                 :            : 
     848                 :        301 :     return pSttNd;
     849                 :            : }
     850                 :            : 
     851                 :            : uno::Reference< text::XTextCursor >
     852                 :        608 : SwXCell::CreateCursor() throw (uno::RuntimeException)
     853                 :            : {
     854                 :        608 :     return createTextCursor();
     855                 :            : }
     856                 :            : 
     857                 :       6318 : bool SwXCell::IsValid() const
     858                 :            : {
     859                 :            :     // FIXME: this is now a const method, to make SwXText::IsValid invisible
     860                 :            :     // but the const_cast here are still ridiculous. TODO: find a better way.
     861         [ +  - ]:       6318 :     SwFrmFmt* pTblFmt = pBox ? GetFrmFmt() : 0;
     862         [ -  + ]:       6318 :     if(!pTblFmt)
     863                 :            :     {
     864                 :          0 :         const_cast<SwXCell*>(this)->pBox = 0;
     865                 :            :     }
     866                 :            :     else
     867                 :            :     {
     868                 :       6318 :         SwTable* pTable = SwTable::FindTable( pTblFmt );
     869                 :            :         SwTableBox const*const pFoundBox =
     870                 :       6318 :             const_cast<SwXCell*>(this)->FindBox(pTable, pBox);
     871         [ -  + ]:       6318 :         if (!pFoundBox)
     872                 :            :         {
     873                 :          0 :             const_cast<SwXCell*>(this)->pBox = 0;
     874                 :            :         }
     875                 :            :     }
     876                 :       6318 :     return 0 != pBox;
     877                 :            : }
     878                 :            : 
     879                 :          0 : OUString SwXCell::getFormula(void) throw( uno::RuntimeException )
     880                 :            : {
     881         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     882                 :          0 :     OUString sRet;
     883 [ #  # ][ #  # ]:          0 :     if(IsValid())
     884                 :            :     {
     885 [ #  # ][ #  # ]:          0 :         SwTblBoxFormula aFormula( pBox->GetFrmFmt()->GetTblBoxFormula() );
     886         [ #  # ]:          0 :         SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
     887         [ #  # ]:          0 :         aFormula.PtrToBoxNm( pTable );
     888 [ #  # ][ #  # ]:          0 :         sRet = aFormula.GetFormula();
     889                 :            :     }
     890         [ #  # ]:          0 :     return sRet;
     891                 :            : }
     892                 :            : 
     893                 :          0 : void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException )
     894                 :            : {
     895         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     896 [ #  # ][ #  # ]:          0 :     if(IsValid())
     897                 :            :     {
     898                 :            :         // Der Text mu? zunaechst (vielleicht) geloescht werden
     899         [ #  # ]:          0 :         sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
     900         [ #  # ]:          0 :         if(USHRT_MAX == nNdPos)
     901         [ #  # ]:          0 :             lcl_setString( *this, OUString(), sal_True );
     902 [ #  # ][ #  # ]:          0 :         String sFml(comphelper::string::stripStart(rFormula, ' '));
     903 [ #  # ][ #  # ]:          0 :         if( sFml.Len() && '=' == sFml.GetChar( 0 ) )
                 [ #  # ]
     904         [ #  # ]:          0 :                     sFml.Erase( 0, 1 );
     905         [ #  # ]:          0 :         SwTblBoxFormula aFml( sFml );
     906         [ #  # ]:          0 :         SwDoc* pMyDoc = GetDoc();
     907         [ #  # ]:          0 :         UnoActionContext aAction(pMyDoc);
     908         [ #  # ]:          0 :         SfxItemSet aSet(pMyDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA);
     909                 :            :         const SfxPoolItem* pItem;
     910                 :          0 :         SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
     911 [ #  # ][ #  # ]:          0 :         if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
         [ #  # ][ #  # ]
     912 [ #  # ][ #  # ]:          0 :             ||  pMyDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue()))
     913                 :            :         {
     914 [ #  # ][ #  # ]:          0 :             aSet.Put(SwTblBoxNumFormat(0));
                 [ #  # ]
     915                 :            :         }
     916         [ #  # ]:          0 :         aSet.Put(aFml);
     917 [ #  # ][ #  # ]:          0 :         GetDoc()->SetTblBoxFormulaAttrs( *pBox, aSet );
     918                 :            :         //Tabelle aktualisieren
     919 [ #  # ][ #  # ]:          0 :         SwTableFmlUpdate aTblUpdate( SwTable::FindTable( GetFrmFmt() ));
     920 [ #  # ][ #  # ]:          0 :         pMyDoc->UpdateTblFlds( &aTblUpdate );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     921         [ #  # ]:          0 :     }
     922                 :          0 : }
     923                 :            : 
     924                 :        128 : double SwXCell::getValue(void) throw( uno::RuntimeException )
     925                 :            : {
     926         [ +  - ]:        128 :     SolarMutexGuard aGuard;
     927                 :            : 
     928         [ +  - ]:        128 :     double const fRet = lcl_getValue( *this );
     929                 :            :     // #i112652# a table cell may contain NaN as a value, do not filter that
     930         [ +  - ]:        128 :     return fRet;
     931                 :            : }
     932                 :            : 
     933                 :         80 : void SwXCell::setValue(double rValue) throw( uno::RuntimeException )
     934                 :            : {
     935         [ +  - ]:         80 :     SolarMutexGuard aGuard;
     936 [ +  - ][ +  - ]:         80 :     lcl_setValue( *this, rValue );
     937                 :         80 : }
     938                 :            : 
     939                 :          0 : table::CellContentType SwXCell::getType(void) throw( uno::RuntimeException )
     940                 :            : {
     941         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     942                 :            : 
     943                 :          0 :     table::CellContentType nRes = table::CellContentType_EMPTY;
     944         [ #  # ]:          0 :     sal_uInt32 nNdPos = pBox->IsFormulaOrValueBox();
     945   [ #  #  #  #  :          0 :     switch (nNdPos)
                      # ]
     946                 :            :     {
     947                 :          0 :         case 0 :                    nRes = table::CellContentType_TEXT; break;
     948                 :          0 :         case USHRT_MAX :            nRes = table::CellContentType_EMPTY; break;
     949                 :          0 :         case RES_BOXATR_VALUE :     nRes = table::CellContentType_VALUE; break;
     950                 :          0 :         case RES_BOXATR_FORMULA :   nRes = table::CellContentType_FORMULA; break;
     951                 :            :         default :
     952                 :            :             OSL_FAIL( "unexpected case" );
     953                 :            :     }
     954         [ #  # ]:          0 :     return  nRes;
     955                 :            : }
     956                 :            : 
     957                 :         30 : void SwXCell::setString(const OUString& aString) throw( uno::RuntimeException )
     958                 :            : {
     959         [ +  - ]:         30 :     SolarMutexGuard aGuard;
     960 [ +  - ][ +  - ]:         30 :     lcl_setString( *this, aString );
     961                 :         30 : }
     962                 :            : 
     963                 :          0 : sal_Int32 SwXCell::getError(void) throw( uno::RuntimeException )
     964                 :            : {
     965         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     966         [ #  # ]:          0 :     OUString sContent = getString();
     967 [ #  # ][ #  # ]:          0 :     return sContent.equals(ViewShell::GetShellRes()->aCalc_Error);
                 [ #  # ]
     968                 :            : }
     969                 :            : 
     970                 :        627 : uno::Reference< text::XTextCursor >  SwXCell::createTextCursor(void) throw( uno::RuntimeException )
     971                 :            : {
     972         [ +  - ]:        627 :     SolarMutexGuard aGuard;
     973                 :        627 :     uno::Reference< text::XTextCursor >     aRef;
     974 [ +  - ][ +  - ]:        627 :     if(pStartNode || IsValid())
         [ +  - ][ +  - ]
     975                 :            :     {
     976         [ -  + ]:        627 :         const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
     977         [ +  - ]:        627 :         SwPosition aPos(*pSttNd);
     978                 :            :         SwXTextCursor *const pXCursor =
     979 [ +  - ][ +  - ]:        627 :             new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, aPos);
                 [ +  - ]
     980         [ +  - ]:        627 :         SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
     981         [ +  - ]:        627 :         pUnoCrsr->Move(fnMoveForward, fnGoNode);
     982 [ +  - ][ +  - ]:        627 :         aRef =  static_cast<text::XWordCursor*>(pXCursor);
                 [ +  - ]
     983                 :            : //      // no Cursor in protected sections
     984                 :            : //      SwCrsrSaveState aSave( *pUnoCrsr );
     985                 :            : //      if(pUnoCrsr->IsInProtectTable( sal_True ) ||
     986                 :            : //          pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
     987                 :            : //          throw( uno::RuntimeException() );
     988                 :            :     }
     989                 :            :     else
     990         [ #  # ]:        627 :         throw uno::RuntimeException();
     991         [ +  - ]:       1254 :     return aRef;
     992                 :            : }
     993                 :            : 
     994                 :        689 : uno::Reference< text::XTextCursor >  SwXCell::createTextCursorByRange(const uno::Reference< text::XTextRange > & xTextPosition)
     995                 :            :                                                         throw( uno::RuntimeException )
     996                 :            : {
     997         [ +  - ]:        689 :     SolarMutexGuard aGuard;
     998                 :        689 :     uno::Reference< text::XTextCursor >  aRef;
     999 [ +  - ][ +  - ]:        689 :     SwUnoInternalPaM aPam(*GetDoc());
    1000 [ +  - ][ +  - ]:       1378 :     if ((pStartNode || IsValid())
         [ +  - ][ +  - ]
                 [ +  - ]
    1001         [ +  - ]:        689 :         && ::sw::XTextRangeToSwPaM(aPam, xTextPosition))
    1002                 :            :     {
    1003         [ -  + ]:        689 :         const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
    1004                 :            :         //skip sections
    1005                 :        689 :         SwStartNode* p1 = aPam.GetNode()->StartOfSectionNode();
    1006         [ -  + ]:        689 :         while(p1->IsSectionNode())
    1007                 :          0 :             p1 = p1->StartOfSectionNode();
    1008                 :            : 
    1009         [ +  - ]:        689 :         if( p1 == pSttNd )
    1010                 :            :         {
    1011                 :            :             aRef = static_cast<text::XWordCursor*>(
    1012                 :        689 :                     new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT,
    1013 [ +  - ][ +  - ]:        689 :                         *aPam.GetPoint(), aPam.GetMark()));
         [ +  - ][ +  - ]
                 [ +  - ]
    1014                 :            :         }
    1015                 :            :     }
    1016                 :            :     else
    1017         [ #  # ]:          0 :         throw uno::RuntimeException();
    1018 [ +  - ][ +  - ]:        689 :     return aRef;
    1019                 :            : }
    1020                 :            : 
    1021                 :          4 : uno::Reference< beans::XPropertySetInfo >  SwXCell::getPropertySetInfo(void) throw( uno::RuntimeException )
    1022                 :            : {
    1023 [ +  + ][ +  - ]:          4 :     static uno::Reference< beans::XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
         [ +  - ][ #  # ]
    1024                 :          4 :     return xRef;
    1025                 :            : }
    1026                 :            : 
    1027                 :       3383 : void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
    1028                 :            :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
    1029                 :            : {
    1030         [ +  - ]:       3383 :     SolarMutexGuard aGuard;
    1031 [ +  - ][ +  - ]:       3383 :     if(IsValid())
    1032                 :            :     {
    1033                 :            :         // Hack to support hidden property to transfer textDirection
    1034         [ -  + ]:       3383 :         if  ( rPropertyName == "FRMDirection" )
    1035                 :            :         {
    1036                 :          0 :             SvxFrameDirection eDir = FRMDIR_ENVIRONMENT;
    1037                 :          0 :             sal_Int16 nNum = 0;
    1038                 :          0 :             aValue >>= nNum;
    1039                 :            :             OSL_TRACE("FRMDirection val %d", nNum );
    1040   [ #  #  #  # ]:          0 :             switch (nNum)
    1041                 :            :             {
    1042                 :            :                 case 0:
    1043                 :          0 :                     eDir = FRMDIR_HORI_LEFT_TOP;
    1044                 :          0 :                     break;
    1045                 :            :                 case 1:
    1046                 :          0 :                     eDir = FRMDIR_HORI_RIGHT_TOP;
    1047                 :          0 :                     break;
    1048                 :            :                 case 2:
    1049                 :          0 :                     eDir = FRMDIR_VERT_TOP_RIGHT;
    1050                 :          0 :                     break;
    1051                 :            :                 default:
    1052                 :            :                     OSL_FAIL( "unknown direction code, maybe its a bitfield");
    1053                 :            :             }
    1054         [ #  # ]:          0 :             SvxFrameDirectionItem aItem( eDir, RES_FRAMEDIR);
    1055 [ #  # ][ #  # ]:          0 :             pBox->GetFrmFmt()->SetFmtAttr(aItem);
    1056                 :            :         }
    1057                 :            :         else
    1058                 :            :         {
    1059                 :            :             const SfxItemPropertySimpleEntry* pEntry =
    1060         [ +  - ]:       3383 :                 m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1061         [ -  + ]:       3383 :             if( !pEntry )
    1062                 :            :             {
    1063         [ #  # ]:          0 :                 beans::UnknownPropertyException aEx;
    1064                 :          0 :                 aEx.Message = rPropertyName;
    1065         [ #  # ]:          0 :                 throw( aEx );
    1066                 :            :             }
    1067         [ -  + ]:       3383 :             if( pEntry->nWID == FN_UNO_CELL_ROW_SPAN )
    1068                 :            :             {
    1069                 :          0 :                 sal_Int32 nRowSpan = 0;
    1070         [ #  # ]:          0 :                 if( aValue >>= nRowSpan )
    1071         [ #  # ]:          0 :                     pBox->setRowSpan( nRowSpan );
    1072                 :            :             }
    1073                 :            :             else
    1074                 :            :             {
    1075         [ +  - ]:       3383 :                 SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
    1076         [ +  - ]:       3383 :                 SwAttrSet aSet(pBoxFmt->GetAttrSet());
    1077         [ +  - ]:       3383 :                 m_pPropSet->setPropertyValue(rPropertyName, aValue, aSet);
    1078 [ +  - ][ +  - ]:       3383 :                 pBoxFmt->GetDoc()->SetAttr(aSet, *pBoxFmt);
    1079                 :            :             }
    1080                 :            :         }
    1081         [ +  - ]:       3383 :     }
    1082                 :       3383 : }
    1083                 :            : 
    1084                 :        739 : uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
    1085                 :            :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1086                 :            : {
    1087         [ +  - ]:        739 :     SolarMutexGuard aGuard;
    1088                 :        739 :     uno::Any aRet;
    1089 [ +  - ][ +  - ]:        739 :     if(IsValid())
    1090                 :            :     {
    1091                 :            :         const SfxItemPropertySimpleEntry* pEntry =
    1092         [ +  - ]:        739 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1093         [ -  + ]:        739 :         if( !pEntry )
    1094                 :            :         {
    1095         [ #  # ]:          0 :             beans::UnknownPropertyException aEx;
    1096                 :          0 :             aEx.Message = rPropertyName;
    1097         [ #  # ]:          0 :             throw( aEx );
    1098                 :            :         }
    1099   [ -  -  -  +  :        739 :         switch( pEntry->nWID )
                      + ]
    1100                 :            :         {
    1101                 :            :             case FN_UNO_CELL_ROW_SPAN:
    1102 [ #  # ][ #  # ]:          0 :                 aRet <<= pBox->getRowSpan();
    1103                 :          0 :             break;
    1104                 :            :             case FN_UNO_TEXT_SECTION:
    1105                 :            :             {
    1106                 :          0 :                 SwFrmFmt* pTblFmt = GetFrmFmt();
    1107         [ #  # ]:          0 :                 SwTable* pTable = SwTable::FindTable( pTblFmt );
    1108         [ #  # ]:          0 :                 SwTableNode* pTblNode = pTable->GetTableNode();
    1109         [ #  # ]:          0 :                 SwSectionNode* pSectionNode =  pTblNode->FindSectionNode();
    1110         [ #  # ]:          0 :                 if(pSectionNode)
    1111                 :            :                 {
    1112                 :          0 :                     const SwSection& rSect = pSectionNode->GetSection();
    1113                 :            :                     uno::Reference< text::XTextSection >  xSect =
    1114         [ #  # ]:          0 :                                     SwXTextSections::GetObject( *rSect.GetFmt() );
    1115         [ #  # ]:          0 :                     aRet <<= xSect;
    1116                 :            :                 }
    1117                 :            :             }
    1118                 :          0 :             break;
    1119                 :            :             case FN_UNO_CELL_NAME:
    1120 [ #  # ][ #  # ]:          0 :                 aRet <<= OUString ( pBox->GetName() );
         [ #  # ][ #  # ]
    1121                 :          0 :             break;
    1122                 :            :             case FN_UNO_REDLINE_NODE_START:
    1123                 :            :             case FN_UNO_REDLINE_NODE_END:
    1124                 :            :             {
    1125                 :            :                 //redline can only be returned if it's a living object
    1126         [ +  - ]:          4 :                 aRet = SwXText::getPropertyValue(rPropertyName);
    1127                 :            :             }
    1128                 :          4 :             break;
    1129                 :            :             default:
    1130                 :            :             {
    1131                 :        735 :                 const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
    1132                 :        735 :                 const SwAttrSet& rSet = pBoxFmt->GetAttrSet();
    1133         [ +  - ]:        739 :                 m_pPropSet->getPropertyValue(rPropertyName, rSet, aRet);
    1134                 :            :             }
    1135                 :            :         }
    1136                 :            :     }
    1137         [ +  - ]:        739 :     return aRet;
    1138                 :            : }
    1139                 :            : 
    1140                 :          0 : void SwXCell::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1141                 :            : {
    1142                 :            :     OSL_FAIL("not implemented");
    1143                 :          0 : }
    1144                 :            : 
    1145                 :          0 : void SwXCell::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1146                 :            : {
    1147                 :            :     OSL_FAIL("not implemented");
    1148                 :          0 : }
    1149                 :            : 
    1150                 :          0 : void SwXCell::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1151                 :            : {
    1152                 :            :     OSL_FAIL("not implemented");
    1153                 :          0 : }
    1154                 :            : 
    1155                 :          0 : void SwXCell::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1156                 :            : {
    1157                 :            :     OSL_FAIL("not implemented");
    1158                 :          0 : }
    1159                 :            : 
    1160                 :          5 : uno::Reference< container::XEnumeration >  SwXCell::createEnumeration(void) throw( uno::RuntimeException )
    1161                 :            : {
    1162         [ +  - ]:          5 :     SolarMutexGuard aGuard;
    1163                 :          5 :     uno::Reference< container::XEnumeration >  aRef;
    1164 [ +  - ][ +  - ]:          5 :     if(IsValid())
    1165                 :            :     {
    1166                 :          5 :         const SwStartNode* pSttNd = pBox->GetSttNd();
    1167         [ +  - ]:          5 :         SwPosition aPos(*pSttNd);
    1168                 :            :         ::std::auto_ptr<SwUnoCrsr> pUnoCursor(
    1169 [ +  - ][ +  - ]:          5 :             GetDoc()->CreateUnoCrsr(aPos, sal_False));
    1170         [ +  - ]:          5 :         pUnoCursor->Move(fnMoveForward, fnGoNode);
    1171                 :            : 
    1172                 :            :         // remember table and start node for later travelling
    1173                 :            :         // (used in export of tables in tables)
    1174         [ +  - ]:          5 :         SwTable const*const pTable( & pSttNd->FindTableNode()->GetTable() );
    1175                 :            :         SwXParagraphEnumeration *const pEnum =
    1176                 :            :             new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_TBLTEXT,
    1177 [ +  - ][ +  - ]:          5 :                     pSttNd, pTable);
                 [ +  - ]
    1178                 :            : 
    1179 [ +  - ][ +  - ]:          5 :         aRef = pEnum;
         [ +  - ][ +  - ]
    1180                 :            : //      // no Cursor in protected sections
    1181                 :            : //      SwCrsrSaveState aSave( *pUnoCrsr );
    1182                 :            : //      if(pUnoCrsr->IsInProtectTable( sal_True ) ||
    1183                 :            : //          pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
    1184                 :            : //          throw( uno::RuntimeException() );
    1185                 :            :     }
    1186         [ +  - ]:          5 :     return aRef;
    1187                 :            : }
    1188                 :            : 
    1189                 :          2 : uno::Type SAL_CALL SwXCell::getElementType(void) throw( uno::RuntimeException )
    1190                 :            : {
    1191                 :          2 :     return ::getCppuType((const uno::Reference<text::XTextRange>*)0);
    1192                 :            : 
    1193                 :            : }
    1194                 :            : 
    1195                 :          2 : sal_Bool SwXCell::hasElements(void) throw( uno::RuntimeException )
    1196                 :            : {
    1197                 :          2 :     return sal_True;
    1198                 :            : }
    1199                 :            : 
    1200                 :         33 : void SwXCell::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    1201                 :            : {
    1202                 :         33 :     ClientModify(this, pOld, pNew);
    1203                 :         33 : }
    1204                 :            : 
    1205                 :       1946 : SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, SwTable *pTable )
    1206                 :            : {
    1207                 :       1946 :     SwXCell* pRet = 0;
    1208 [ +  - ][ +  - ]:       1946 :     if(pTblFmt && pBox)
    1209                 :            :     {
    1210         [ +  + ]:       1946 :         if( !pTable )
    1211         [ +  - ]:        995 :             pTable = SwTable::FindTable( pTblFmt );
    1212         [ +  - ]:       1946 :         SwTableSortBoxes::const_iterator it = pTable->GetTabSortBoxes().find( pBox );
    1213                 :            : 
    1214                 :            :         //wenn es die Box gibt, dann wird auch eine Zelle zurueckgegeben
    1215 [ +  - ][ +  - ]:       1946 :         if( it != pTable->GetTabSortBoxes().end() )
    1216                 :            :         {
    1217         [ +  - ]:       1946 :             sal_uInt16 nPos = it - pTable->GetTabSortBoxes().begin();
    1218         [ +  - ]:       1946 :             SwIterator<SwXCell,SwFmt> aIter( *pTblFmt );
    1219         [ +  - ]:       1946 :             SwXCell* pXCell = aIter.First();
    1220         [ +  + ]:       2282 :             while( pXCell )
    1221                 :            :             {
    1222                 :            :                 // gibt es eine passende Zelle bereits?
    1223         [ +  + ]:        736 :                 if(pXCell->GetTblBox() == pBox)
    1224                 :        400 :                     break;
    1225         [ +  - ]:        336 :                 pXCell = aIter.Next();
    1226                 :            :             }
    1227                 :            :             //sonst anlegen
    1228         [ +  + ]:       1946 :             if(!pXCell)
    1229         [ +  - ]:       1546 :                 pXCell = new SwXCell(pTblFmt, pBox, nPos );
    1230         [ +  - ]:       1946 :             pRet = pXCell;
    1231                 :            :         }
    1232                 :            :     }
    1233                 :       1946 :     return pRet;
    1234                 :            : }
    1235                 :            : 
    1236                 :            : /* does box exist in given table? */
    1237                 :       6318 : SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox2)
    1238                 :            : {
    1239                 :            :     // check if nFndPos happens to point to the right table box
    1240 [ +  - ][ +  + ]:      12636 :     if( nFndPos < pTable->GetTabSortBoxes().size() &&
                 [ +  + ]
    1241         [ +  - ]:       6318 :         pBox2 == pTable->GetTabSortBoxes()[ nFndPos ] )
    1242                 :       6317 :         return pBox2;
    1243                 :            : 
    1244                 :            :     // if not, seek the entry (and return, if successful)
    1245         [ +  - ]:          1 :     SwTableSortBoxes::const_iterator it = pTable->GetTabSortBoxes().find( pBox2 );
    1246 [ +  - ][ +  - ]:          1 :     if( it != pTable->GetTabSortBoxes().end() )
    1247                 :            :     {
    1248         [ +  - ]:          1 :         nFndPos = it - pTable->GetTabSortBoxes().begin();
    1249                 :          1 :         return pBox2;
    1250                 :            :     }
    1251                 :            : 
    1252                 :            :     // box not found: reset nFndPos pointer
    1253                 :          0 :     nFndPos = USHRT_MAX;
    1254                 :       6318 :     return 0;
    1255                 :            : }
    1256                 :            : 
    1257                 :          0 : OUString SwXCell::getImplementationName(void) throw( uno::RuntimeException )
    1258                 :            : {
    1259                 :          0 :     return C2U("SwXCell");
    1260                 :            : }
    1261                 :            : 
    1262                 :          2 : sal_Bool SwXCell::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    1263                 :            : {
    1264         [ +  - ]:          2 :     String sServiceName(rServiceName);
    1265 [ +  - ][ +  - ]:          2 :     return sServiceName.EqualsAscii("com.sun.star.text.CellProperties");
    1266                 :            : }
    1267                 :            : 
    1268                 :          0 : uno::Sequence< OUString > SwXCell::getSupportedServiceNames(void) throw( uno::RuntimeException )
    1269                 :            : {
    1270                 :          0 :     uno::Sequence< OUString > aRet(1);
    1271         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1272         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.CellProperties");
    1273                 :          0 :     return aRet;
    1274                 :            : }
    1275                 :            : 
    1276                 :            : /******************************************************************
    1277                 :            :  * SwXTextTableRow
    1278                 :            :  ******************************************************************/
    1279                 :          0 : OUString SwXTextTableRow::getImplementationName(void) throw( uno::RuntimeException )
    1280                 :            : {
    1281                 :          0 :     return C2U("SwXTextTableRow");
    1282                 :            : }
    1283                 :            : 
    1284                 :          2 : sal_Bool SwXTextTableRow::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    1285                 :            : {
    1286                 :          2 :     return C2U("com.sun.star.text.TextTableRow") == rServiceName;
    1287                 :            : }
    1288                 :            : 
    1289                 :          0 : uno::Sequence< OUString > SwXTextTableRow::getSupportedServiceNames(void) throw( uno::RuntimeException )
    1290                 :            : {
    1291                 :          0 :     uno::Sequence< OUString > aRet(1);
    1292         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1293         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextTableRow");
    1294                 :          0 :     return aRet;
    1295                 :            : }
    1296 [ +  + ][ +  + ]:        169 : TYPEINIT1(SwXTextTableRow, SwClient);
    1297                 :            : 
    1298                 :         85 : SwXTextTableRow::SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLn) :
    1299                 :            :     SwClient(pFmt),
    1300         [ +  - ]:         85 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW)),
    1301         [ +  - ]:         85 :     pLine(pLn)
    1302                 :            : {
    1303                 :            : 
    1304                 :         85 : }
    1305                 :            : 
    1306         [ +  - ]:         85 : SwXTextTableRow::~SwXTextTableRow()
    1307                 :            : {
    1308                 :            : 
    1309         [ -  + ]:        170 : }
    1310                 :            : 
    1311                 :         38 : uno::Reference< beans::XPropertySetInfo >  SwXTextTableRow::getPropertySetInfo(void) throw( uno::RuntimeException )
    1312                 :            : {
    1313 [ +  + ][ +  - ]:         38 :     static uno::Reference< beans::XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
         [ +  - ][ #  # ]
    1314                 :         38 :     return xRef;
    1315                 :            : }
    1316                 :            : 
    1317                 :        224 : void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName,
    1318                 :            :     const uno::Any& aValue)
    1319                 :            :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
    1320                 :            : {
    1321         [ +  - ]:        224 :     SolarMutexGuard aGuard;
    1322                 :        224 :     SwFrmFmt* pFmt = GetFrmFmt();
    1323         [ +  - ]:        224 :     if(pFmt)
    1324                 :            :     {
    1325         [ +  - ]:        224 :         SwTable* pTable = SwTable::FindTable( pFmt );
    1326         [ +  - ]:        224 :         SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
    1327         [ +  - ]:        224 :         if(pLn)
    1328                 :            :         {
    1329                 :            :             const SfxItemPropertySimpleEntry* pEntry =
    1330         [ +  - ]:        224 :                 m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1331                 :        224 :             SwDoc* pDoc = pFmt->GetDoc();
    1332         [ -  + ]:        224 :             if (!pEntry)
    1333 [ #  # ][ #  # ]:          0 :                 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1334         [ -  + ]:        224 :             if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    1335 [ #  # ][ #  # ]:          0 :                 throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1336                 :            : 
    1337      [ +  +  + ]:        224 :             switch(pEntry->nWID)
    1338                 :            :             {
    1339                 :            :                 case FN_UNO_ROW_HEIGHT:
    1340                 :            :                 case FN_UNO_ROW_AUTO_HEIGHT:
    1341                 :            :                 {
    1342 [ +  - ][ +  - ]:         20 :                     SwFmtFrmSize aFrmSize(pLn->GetFrmFmt()->GetFrmSize());
    1343         [ +  + ]:         20 :                     if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID)
    1344                 :            :                     {
    1345                 :          6 :                         sal_Bool bSet = *(sal_Bool*)aValue.getValue();
    1346                 :          6 :                         aFrmSize.SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
    1347                 :            :                     }
    1348                 :            :                     else
    1349                 :            :                     {
    1350                 :         14 :                         sal_Int32 nHeight = 0;
    1351                 :         14 :                         aValue >>= nHeight;
    1352                 :         14 :                          Size aSz(aFrmSize.GetSize());
    1353         [ +  - ]:         14 :                         aSz.Height() = MM100_TO_TWIP(nHeight);
    1354                 :         14 :                         aFrmSize.SetSize(aSz);
    1355                 :            :                     }
    1356 [ +  - ][ +  - ]:         20 :                     pDoc->SetAttr(aFrmSize, *pLn->ClaimFrmFmt());
                 [ +  - ]
    1357                 :            :                 }
    1358                 :         20 :                 break;
    1359                 :            :                 case FN_UNO_TABLE_COLUMN_SEPARATORS:
    1360                 :            :                 {
    1361         [ +  - ]:         81 :                     UnoActionContext aContext(pDoc);
    1362         [ +  - ]:         81 :                     SwTable* pTable2 = SwTable::FindTable( pFmt );
    1363 [ +  - ][ +  - ]:         81 :                     lcl_SetTblSeparators(aValue, pTable2, pLine->GetTabBoxes()[0], sal_True, pDoc);
    1364                 :            :                 }
    1365                 :         81 :                 break;
    1366                 :            :                 default:
    1367                 :            :                 {
    1368         [ +  - ]:        123 :                     SwFrmFmt* pLnFmt = pLn->ClaimFrmFmt();
    1369         [ +  - ]:        123 :                     SwAttrSet aSet(pLnFmt->GetAttrSet());
    1370         [ +  + ]:        123 :                     m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
    1371 [ +  - ][ +  - ]:        224 :                     pDoc->SetAttr(aSet, *pLnFmt);
    1372                 :            :                 }
    1373                 :            :             }
    1374                 :            :         }
    1375         [ +  - ]:        224 :     }
    1376                 :        222 : }
    1377                 :            : 
    1378                 :        114 : uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1379                 :            : {
    1380         [ +  - ]:        114 :     SolarMutexGuard aGuard;
    1381                 :        114 :     uno::Any aRet;
    1382                 :        114 :     SwFrmFmt* pFmt = GetFrmFmt();
    1383         [ +  - ]:        114 :     if(pFmt)
    1384                 :            :     {
    1385         [ +  - ]:        114 :         SwTable* pTable = SwTable::FindTable( pFmt );
    1386         [ +  - ]:        114 :         SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
    1387         [ +  - ]:        114 :         if(pLn)
    1388                 :            :         {
    1389                 :            :             const SfxItemPropertySimpleEntry* pEntry =
    1390         [ +  - ]:        114 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1391         [ -  + ]:        114 :             if (!pEntry)
    1392 [ #  # ][ #  # ]:          0 :                 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1393                 :            : 
    1394      [ +  +  + ]:        114 :             switch(pEntry->nWID)
    1395                 :            :             {
    1396                 :            :                 case FN_UNO_ROW_HEIGHT:
    1397                 :            :                 case FN_UNO_ROW_AUTO_HEIGHT:
    1398                 :            :                 {
    1399         [ +  - ]:         28 :                     const SwFmtFrmSize& rSize = pLn->GetFrmFmt()->GetFrmSize();
    1400         [ +  + ]:         28 :                     if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID)
    1401                 :            :                     {
    1402                 :         14 :                         sal_Bool bTmp =  ATT_VAR_SIZE == rSize.GetHeightSizeType();
    1403         [ +  - ]:         14 :                         aRet.setValue(&bTmp, ::getCppuBooleanType());
    1404                 :            :                     }
    1405                 :            :                     else
    1406 [ +  - ][ +  - ]:         14 :                         aRet <<= (sal_Int32)(TWIP_TO_MM100(rSize.GetSize().Height()));
    1407                 :            :                 }
    1408                 :         28 :                 break;
    1409                 :            :                 case FN_UNO_TABLE_COLUMN_SEPARATORS:
    1410                 :            :                 {
    1411         [ +  - ]:          4 :                     lcl_GetTblSeparators(aRet, pTable, pLine->GetTabBoxes()[0], sal_True);
    1412                 :            :                 }
    1413                 :          4 :                 break;
    1414                 :            :                 default:
    1415                 :            :                 {
    1416                 :         82 :                     const SwAttrSet& rSet = pLn->GetFrmFmt()->GetAttrSet();
    1417         [ +  - ]:        114 :                     m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
    1418                 :            :                 }
    1419                 :            :             }
    1420                 :            :         }
    1421                 :            :     }
    1422         [ +  - ]:        114 :     return aRet;
    1423                 :            : }
    1424                 :            : 
    1425                 :          0 : void SwXTextTableRow::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1426                 :            : {
    1427                 :            :     OSL_FAIL("not implemented");
    1428                 :          0 : }
    1429                 :            : 
    1430                 :          0 : void SwXTextTableRow::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1431                 :            : {
    1432                 :            :     OSL_FAIL("not implemented");
    1433                 :          0 : }
    1434                 :            : 
    1435                 :          0 : void SwXTextTableRow::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1436                 :            : {
    1437                 :            :     OSL_FAIL("not implemented");
    1438                 :          0 : }
    1439                 :            : 
    1440                 :          0 : void SwXTextTableRow::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1441                 :            : {
    1442                 :            :     OSL_FAIL("not implemented");
    1443                 :          0 : }
    1444                 :            : 
    1445                 :          6 : void SwXTextTableRow::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    1446                 :            : {
    1447                 :          6 :     ClientModify(this, pOld, pNew);
    1448                 :          6 : }
    1449                 :            : 
    1450                 :        338 : SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine)
    1451                 :            : {
    1452                 :        338 :     SwTableLine* pRet = 0;
    1453                 :        338 :     SwTableLines &rLines = pTable->GetTabLines();
    1454         [ +  - ]:        520 :     for(sal_uInt16 i = 0; i < rLines.size(); i++)
    1455         [ +  + ]:        520 :         if(rLines[i] == pLine)
    1456                 :            :         {
    1457                 :        338 :             pRet = pLine;
    1458                 :        338 :             break;
    1459                 :            :         }
    1460                 :        338 :     return pRet;
    1461                 :            : }
    1462                 :            : 
    1463                 :            : /******************************************************************
    1464                 :            :  * SwXTextTableCursor
    1465                 :            :  ******************************************************************/
    1466                 :          0 : OUString SwXTextTableCursor::getImplementationName(void) throw( uno::RuntimeException )
    1467                 :            : {
    1468                 :          0 :     return C2U("SwXTextTableCursor");
    1469                 :            : }
    1470                 :            : 
    1471                 :          6 : sal_Bool SwXTextTableCursor::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    1472                 :            : {
    1473                 :          6 :     return C2U("com.sun.star.text.TextTableCursor") == rServiceName;
    1474                 :            : }
    1475                 :            : 
    1476 [ -  + ][ #  # ]:        152 : IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper)
    1477         [ #  # ]:          0 : const SwPaM*        SwXTextTableCursor::GetPaM() const  { return GetCrsr(); }
    1478         [ #  # ]:          0 : SwPaM*              SwXTextTableCursor::GetPaM()        { return GetCrsr(); }
    1479                 :          0 : const SwDoc*        SwXTextTableCursor::GetDoc() const  { return GetFrmFmt()->GetDoc(); }
    1480                 :          0 : SwDoc*              SwXTextTableCursor::GetDoc()        { return GetFrmFmt()->GetDoc(); }
    1481                 :          0 : const SwUnoCrsr*    SwXTextTableCursor::GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
    1482                 :        532 : SwUnoCrsr*          SwXTextTableCursor::GetCrsr()       { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
    1483                 :            : 
    1484                 :          0 : uno::Sequence< OUString > SwXTextTableCursor::getSupportedServiceNames(void) throw( uno::RuntimeException )
    1485                 :            : {
    1486                 :          0 :     uno::Sequence< OUString > aRet(1);
    1487         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1488         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TextTableCursor");
    1489                 :          0 :     return aRet;
    1490                 :            : }
    1491                 :            : 
    1492                 :          8 : SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) :
    1493                 :            :     SwClient(pFmt),
    1494                 :            :     aCrsrDepend(this, 0),
    1495 [ +  - ][ +  - ]:          8 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
                 [ +  - ]
    1496                 :            : {
    1497                 :          8 :     SwDoc* pDoc = pFmt->GetDoc();
    1498                 :          8 :     const SwStartNode* pSttNd = pBox->GetSttNd();
    1499         [ +  - ]:          8 :     SwPosition aPos(*pSttNd);
    1500         [ +  - ]:          8 :     SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
    1501         [ +  - ]:          8 :     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    1502         [ +  - ]:          8 :     pUnoCrsr->Add(&aCrsrDepend);
    1503         [ -  + ]:          8 :     SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1504 [ +  - ][ +  - ]:          8 :     pTblCrsr->MakeBoxSels();
    1505                 :          8 : }
    1506                 :            : 
    1507                 :          0 : SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor* pTableSelection) :
    1508                 :            :     SwClient(&rTableFmt),
    1509                 :            :     aCrsrDepend(this, 0),
    1510 [ #  # ][ #  # ]:          0 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
                 [ #  # ]
    1511                 :            : {
    1512         [ #  # ]:          0 :     SwUnoCrsr* pUnoCrsr = pTableSelection->GetDoc()->CreateUnoCrsr(*pTableSelection->GetPoint(), sal_True);
    1513         [ #  # ]:          0 :     if(pTableSelection->HasMark())
    1514                 :            :     {
    1515         [ #  # ]:          0 :         pUnoCrsr->SetMark();
    1516         [ #  # ]:          0 :         *pUnoCrsr->GetMark() = *pTableSelection->GetMark();
    1517                 :            :     }
    1518                 :          0 :     const SwSelBoxes& rBoxes = pTableSelection->GetBoxes();
    1519         [ #  # ]:          0 :     SwTableCursor* pTableCrsr = dynamic_cast<SwTableCursor*>(pUnoCrsr);
    1520         [ #  # ]:          0 :     for(sal_uInt16 i = 0; i < rBoxes.size(); i++)
    1521 [ #  # ][ #  # ]:          0 :         pTableCrsr->InsertBox( *rBoxes[i] );
    1522                 :            : 
    1523         [ #  # ]:          0 :     pUnoCrsr->Add(&aCrsrDepend);
    1524         [ #  # ]:          0 :     SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1525         [ #  # ]:          0 :     pTblCrsr->MakeBoxSels();
    1526                 :          0 : }
    1527                 :            : 
    1528 [ +  - ][ +  - ]:          8 : SwXTextTableCursor::~SwXTextTableCursor()
    1529                 :            : {
    1530         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1531         [ +  - ]:          8 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1532 [ -  + ][ #  # ]:          8 :     delete pUnoCrsr;
                 [ +  - ]
    1533         [ -  + ]:         16 : }
    1534                 :            : 
    1535                 :         14 : OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException )
    1536                 :            : {
    1537         [ +  - ]:         14 :     SolarMutexGuard aGuard;
    1538                 :         14 :     OUString aRet;
    1539         [ +  - ]:         14 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1540                 :            : 
    1541                 :            :     //!! see also SwChartDataSequence::getSourceRangeRepresentation
    1542         [ +  - ]:         14 :     if(pUnoCrsr)
    1543                 :            :     {
    1544         [ -  + ]:         14 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1545         [ +  - ]:         14 :         pTblCrsr->MakeBoxSels();
    1546         [ +  - ]:         14 :         const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
    1547         [ +  - ]:         14 :         const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
    1548         [ +  - ]:         14 :         const SwTableBox* pEndBox = pTable->GetTblBox( pNode->GetIndex());
    1549         [ +  - ]:         14 :         String aTmp( pEndBox->GetName() );
    1550                 :            : 
    1551         [ -  + ]:         14 :         if(pTblCrsr->HasMark())
    1552                 :            :         {
    1553         [ #  # ]:          0 :             pNode = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
    1554         [ #  # ]:          0 :             const SwTableBox* pStartBox = pTable->GetTblBox( pNode->GetIndex());
    1555         [ #  # ]:          0 :             if(pEndBox != pStartBox)
    1556                 :            :             {
    1557                 :            :                 // need to switch start and end?
    1558 [ #  # ][ #  # ]:          0 :                 if (*pTblCrsr->GetPoint() < *pTblCrsr->GetMark())
    1559                 :            :                 {
    1560                 :          0 :                     const SwTableBox* pTmpBox = pStartBox;
    1561                 :          0 :                     pStartBox = pEndBox;
    1562                 :          0 :                     pEndBox = pTmpBox;
    1563                 :            :                 }
    1564                 :            : 
    1565 [ #  # ][ #  # ]:          0 :                 aTmp  = pStartBox->GetName();
                 [ #  # ]
    1566         [ #  # ]:          0 :                 aTmp += ':';
    1567 [ #  # ][ #  # ]:          0 :                 aTmp += pEndBox->GetName();
                 [ #  # ]
    1568                 :            :             }
    1569                 :            :         }
    1570 [ +  - ][ +  - ]:         14 :         aRet = aTmp;
    1571                 :            :     }
    1572         [ +  - ]:         14 :     return aRet;
    1573                 :            : }
    1574                 :            : 
    1575                 :          2 : sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool Expand)
    1576                 :            :     throw( uno::RuntimeException )
    1577                 :            : {
    1578         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1579                 :          2 :     sal_Bool bRet = sal_False;
    1580         [ +  - ]:          2 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1581         [ +  - ]:          2 :     if(pUnoCrsr)
    1582                 :            :     {
    1583         [ -  + ]:          2 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1584 [ +  - ][ +  - ]:          2 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1585         [ +  - ]:          2 :         String sCellName(CellName);
    1586 [ +  - ][ +  - ]:          2 :         bRet = pTblCrsr->GotoTblBox(sCellName);
    1587                 :            :     }
    1588         [ +  - ]:          2 :     return bRet;
    1589                 :            : }
    1590                 :            : 
    1591                 :          4 : sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
    1592                 :            : {
    1593         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1594                 :          4 :     sal_Bool bRet = sal_False;
    1595         [ +  - ]:          4 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1596         [ +  - ]:          4 :     if(pUnoCrsr)
    1597                 :            :     {
    1598         [ -  + ]:          4 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1599 [ +  - ][ +  - ]:          4 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1600         [ +  - ]:          4 :         bRet = pTblCrsr->Left( Count,CRSR_SKIP_CHARS, sal_False, sal_False);
    1601                 :            :     }
    1602         [ +  - ]:          4 :     return bRet;
    1603                 :            : }
    1604                 :            : 
    1605                 :          4 : sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
    1606                 :            : {
    1607         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1608                 :          4 :     sal_Bool bRet = sal_False;
    1609         [ +  - ]:          4 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1610         [ +  - ]:          4 :     if(pUnoCrsr)
    1611                 :            :     {
    1612         [ -  + ]:          4 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1613 [ +  - ][ +  - ]:          4 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1614         [ +  - ]:          4 :         bRet = pTblCrsr->Right( Count, CRSR_SKIP_CHARS, sal_False, sal_False);
    1615                 :            :     }
    1616         [ +  - ]:          4 :     return bRet;
    1617                 :            : }
    1618                 :            : 
    1619                 :          4 : sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
    1620                 :            : {
    1621         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1622                 :          4 :     sal_Bool bRet = sal_False;
    1623         [ +  - ]:          4 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1624         [ +  - ]:          4 :     if(pUnoCrsr)
    1625                 :            :     {
    1626         [ -  + ]:          4 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1627 [ +  - ][ +  - ]:          4 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1628         [ +  - ]:          4 :         bRet = pTblCrsr->UpDown(sal_True, Count, 0, 0);
    1629                 :            :     }
    1630         [ +  - ]:          4 :     return bRet;
    1631                 :            : }
    1632                 :            : 
    1633                 :          2 : sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
    1634                 :            : {
    1635         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1636                 :          2 :     sal_Bool bRet = sal_False;
    1637         [ +  - ]:          2 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1638         [ +  - ]:          2 :     if(pUnoCrsr)
    1639                 :            :     {
    1640         [ -  + ]:          2 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1641 [ +  - ][ +  - ]:          2 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1642         [ +  - ]:          2 :         bRet = pTblCrsr->UpDown(sal_False, Count, 0, 0);
    1643                 :            :     }
    1644         [ +  - ]:          2 :     return bRet;
    1645                 :            : }
    1646                 :            : 
    1647                 :          8 : void SwXTextTableCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
    1648                 :            : {
    1649         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1650         [ +  - ]:          8 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1651         [ +  - ]:          8 :     if(pUnoCrsr)
    1652                 :            :     {
    1653         [ -  + ]:          8 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1654 [ +  - ][ +  - ]:          8 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1655         [ +  - ]:          8 :         pTblCrsr->MoveTable(fnTableCurr, fnTableStart);
    1656         [ +  - ]:          8 :     }
    1657                 :          8 : }
    1658                 :            : 
    1659                 :         14 : void SwXTextTableCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
    1660                 :            : {
    1661         [ +  - ]:         14 :     SolarMutexGuard aGuard;
    1662         [ +  - ]:         14 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1663         [ +  - ]:         14 :     if(pUnoCrsr)
    1664                 :            :     {
    1665         [ -  + ]:         14 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1666 [ +  - ][ +  - ]:         14 :         lcl_CrsrSelect( pTblCrsr, Expand );
    1667         [ +  - ]:         14 :         pTblCrsr->MoveTable(fnTableCurr, fnTableEnd);
    1668         [ +  - ]:         14 :     }
    1669                 :         14 : }
    1670                 :            : 
    1671                 :          2 : sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
    1672                 :            : {
    1673         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    1674                 :          2 :     sal_Bool bRet = sal_False;
    1675         [ +  - ]:          2 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1676         [ +  - ]:          2 :     if(pUnoCrsr)
    1677                 :            :     {
    1678                 :            :         {
    1679                 :            :             // hier muessen die Actions aufgehoben werden
    1680 [ +  - ][ +  - ]:          2 :             UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
    1681                 :            :         }
    1682         [ -  + ]:          2 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1683         [ +  - ]:          2 :         pTblCrsr->MakeBoxSels();
    1684                 :            : 
    1685                 :            :         {
    1686         [ +  - ]:          2 :             UnoActionContext aContext(pUnoCrsr->GetDoc());
    1687         [ +  - ]:          2 :             bRet = TBLMERGE_OK == pTblCrsr->GetDoc()->MergeTbl(*pTblCrsr);
    1688         [ +  - ]:          2 :             if(bRet)
    1689                 :            :             {
    1690                 :          2 :                 sal_uInt16 nCount = pTblCrsr->GetBoxesCount();
    1691         [ +  + ]:         10 :                 while(nCount--)
    1692         [ +  - ]:          8 :                     pTblCrsr->DeleteBox(nCount);
    1693         [ +  - ]:          2 :             }
    1694                 :            :         }
    1695         [ +  - ]:          2 :         pTblCrsr->MakeBoxSels();
    1696                 :            :     }
    1697         [ +  - ]:          2 :     return bRet;
    1698                 :            : }
    1699                 :            : 
    1700                 :          4 : sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) throw( uno::RuntimeException )
    1701                 :            : {
    1702         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1703         [ -  + ]:          4 :     if (Count <= 0)
    1704 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal first argument: needs to be > 0" ) ), static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1705                 :          4 :     sal_Bool bRet = sal_False;
    1706         [ +  - ]:          4 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1707         [ +  - ]:          4 :     if(pUnoCrsr)
    1708                 :            :     {
    1709                 :            :         {
    1710                 :            :             // hier muessen die Actions aufgehoben werden
    1711 [ +  - ][ +  - ]:          4 :             UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
    1712                 :            :         }
    1713         [ -  + ]:          4 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1714         [ +  - ]:          4 :         pTblCrsr->MakeBoxSels();
    1715                 :            :         {
    1716         [ +  - ]:          4 :             UnoActionContext aContext(pUnoCrsr->GetDoc());
    1717 [ +  - ][ +  - ]:          4 :             bRet = pTblCrsr->GetDoc()->SplitTbl( pTblCrsr->GetBoxes(), !Horizontal, Count );
    1718                 :            :         }
    1719         [ +  - ]:          4 :         pTblCrsr->MakeBoxSels();
    1720                 :            :     }
    1721         [ +  - ]:          4 :     return bRet;
    1722                 :            : }
    1723                 :            : 
    1724                 :        262 : uno::Reference< beans::XPropertySetInfo >  SwXTextTableCursor::getPropertySetInfo(void) throw( uno::RuntimeException )
    1725                 :            : {
    1726 [ +  + ][ +  - ]:        262 :     static uno::Reference< beans::XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
         [ +  - ][ #  # ]
    1727                 :        262 :     return xRef;
    1728                 :            : }
    1729                 :            : 
    1730                 :        152 : void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
    1731                 :            :                                                         const uno::Any& aValue)
    1732                 :            :             throw( beans::UnknownPropertyException,
    1733                 :            :                         beans::PropertyVetoException,
    1734                 :            :                      lang::IllegalArgumentException,
    1735                 :            :                      lang::WrappedTargetException,
    1736                 :            :                      uno::RuntimeException)
    1737                 :            : {
    1738         [ +  - ]:        152 :     SolarMutexGuard aGuard;
    1739         [ +  - ]:        152 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1740         [ +  - ]:        152 :     if(pUnoCrsr)
    1741                 :            :     {
    1742                 :        152 :         SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
    1743         [ +  - ]:        152 :         const SwTableNode* pTblNode = pSttNode->FindTableNode();
    1744         [ +  - ]:        152 :         lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
    1745         [ -  + ]:        152 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1746                 :            :         const SfxItemPropertySimpleEntry* pEntry =
    1747         [ +  - ]:        152 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1748         [ +  - ]:        152 :         if(pEntry)
    1749                 :            :         {
    1750         [ -  + ]:        152 :             if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    1751 [ #  # ][ #  # ]:          0 :                 throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1752         [ +  - ]:        152 :             pTblCrsr->MakeBoxSels();
    1753                 :        152 :             SwDoc* pDoc = pUnoCrsr->GetDoc();
    1754   [ -  -  -  + ]:        152 :             switch(pEntry->nWID )
    1755                 :            :             {
    1756                 :            :                 case FN_UNO_TABLE_CELL_BACKGROUND:
    1757                 :            :                 {
    1758         [ #  # ]:          0 :                     SvxBrushItem aBrush( RES_BACKGROUND );
    1759         [ #  # ]:          0 :                     pDoc->GetBoxAttr( *pUnoCrsr, aBrush );
    1760         [ #  # ]:          0 :                     aBrush.PutValue(aValue, pEntry->nMemberId);
    1761 [ #  # ][ #  # ]:          0 :                     pDoc->SetBoxAttr( *pUnoCrsr, aBrush );
    1762                 :            : 
    1763                 :            :                 }
    1764                 :          0 :                 break;
    1765                 :            :                 case RES_BOXATR_FORMAT:
    1766                 :            :                 {
    1767         [ #  # ]:          0 :                     SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
    1768         [ #  # ]:          0 :                     aNumberFormat.PutValue(aValue, 0);
    1769 [ #  # ][ #  # ]:          0 :                     pDoc->SetBoxAttr( *pUnoCrsr, aNumberFormat);
    1770                 :            :                 }
    1771                 :          0 :                 break;
    1772                 :            :                 case FN_UNO_PARA_STYLE:
    1773         [ #  # ]:          0 :                     SwUnoCursorHelper::SetTxtFmtColl(aValue, *pUnoCrsr);
    1774                 :          0 :                 break;
    1775                 :            :                 default:
    1776                 :            :                 {
    1777         [ +  - ]:        152 :                     SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
    1778                 :        152 :                     SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
    1779         [ +  - ]:        152 :                             aItemSet);
    1780                 :            : 
    1781         [ +  + ]:        152 :                     if (!SwUnoCursorHelper::SetCursorPropertyValue(
    1782         [ +  - ]:        152 :                             *pEntry, aValue, pTblCrsr->GetSelRing(), aItemSet))
    1783                 :            :                     {
    1784         [ +  + ]:        150 :                         m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
    1785                 :            :                     }
    1786                 :        150 :                     SwUnoCursorHelper::SetCrsrAttr(pTblCrsr->GetSelRing(),
    1787 [ +  - ][ +  - ]:        152 :                             aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
    1788                 :            :                 }
    1789                 :            :             }
    1790                 :            :         }
    1791                 :            :         else
    1792 [ #  # ][ #  # ]:          0 :             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1793         [ +  - ]:        152 :     }
    1794                 :        150 : }
    1795                 :            : 
    1796                 :        314 : uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
    1797                 :            :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1798                 :            : {
    1799         [ +  - ]:        314 :     SolarMutexGuard aGuard;
    1800                 :        314 :     uno::Any aRet;
    1801         [ +  - ]:        314 :     SwUnoCrsr* pUnoCrsr = GetCrsr();
    1802         [ +  - ]:        314 :     if(pUnoCrsr)
    1803                 :            :     {
    1804                 :        314 :         SwStartNode* pSttNode = pUnoCrsr->GetNode()->StartOfSectionNode();
    1805         [ +  - ]:        314 :         const SwTableNode* pTblNode = pSttNode->FindTableNode();
    1806         [ +  - ]:        314 :         lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
    1807         [ -  + ]:        314 :         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    1808                 :            :         const SfxItemPropertySimpleEntry* pEntry =
    1809         [ +  - ]:        314 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    1810         [ +  - ]:        314 :         if(pEntry)
    1811                 :            :         {
    1812         [ +  - ]:        314 :             pTblCrsr->MakeBoxSels();
    1813   [ -  -  -  + ]:        314 :             switch(pEntry->nWID )
    1814                 :            :             {
    1815                 :            :                 case FN_UNO_TABLE_CELL_BACKGROUND:
    1816                 :            :                 {
    1817         [ #  # ]:          0 :                     SvxBrushItem aBrush( RES_BACKGROUND );
    1818 [ #  # ][ #  # ]:          0 :                     if(pTblCrsr->GetDoc()->GetBoxAttr( *pUnoCrsr, aBrush ))
    1819 [ #  # ][ #  # ]:          0 :                         aBrush.QueryValue(aRet, pEntry->nMemberId);
    1820                 :            : 
    1821                 :            :                 }
    1822                 :          0 :                 break;
    1823                 :            :                 case RES_BOXATR_FORMAT:
    1824                 :            :                     //GetAttr fuer Tabellenselektion am Doc fehlt noch
    1825                 :            :                     OSL_FAIL("not implemented");
    1826                 :          0 :                 break;
    1827                 :            :                 case FN_UNO_PARA_STYLE:
    1828                 :            :                 {
    1829                 :            :                     SwFmtColl *const pFmt =
    1830         [ #  # ]:          0 :                         SwUnoCursorHelper::GetCurTxtFmtColl(*pUnoCrsr, sal_False);
    1831                 :          0 :                     OUString sRet;
    1832         [ #  # ]:          0 :                     if(pFmt)
    1833         [ #  # ]:          0 :                         sRet = pFmt->GetName();
    1834         [ #  # ]:          0 :                     aRet <<= sRet;
    1835                 :            :                 }
    1836                 :          0 :                 break;
    1837                 :            :                 default:
    1838                 :            :                 {
    1839                 :        314 :                     SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
    1840                 :            :                         RES_CHRATR_BEGIN,       RES_FRMATR_END -1,
    1841                 :            :                         RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
    1842         [ +  - ]:        314 :                         0L);
    1843                 :            :                     // erstmal die Attribute des Cursors
    1844                 :        314 :                     SwUnoCursorHelper::GetCrsrAttr(pTblCrsr->GetSelRing(),
    1845         [ +  - ]:        314 :                             aSet);
    1846 [ +  - ][ +  - ]:        314 :                     m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
    1847                 :            :                 }
    1848                 :            :             }
    1849                 :            :         }
    1850                 :            :         else
    1851 [ #  # ][ #  # ]:          0 :             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    1852                 :            :     }
    1853         [ +  - ]:        314 :     return aRet;
    1854                 :            : }
    1855                 :            : 
    1856                 :          0 : void SwXTextTableCursor::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1857                 :            : {
    1858                 :            :     OSL_FAIL("not implemented");
    1859                 :          0 : }
    1860                 :            : 
    1861                 :          0 : void SwXTextTableCursor::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1862                 :            : {
    1863                 :            :     OSL_FAIL("not implemented");
    1864                 :          0 : }
    1865                 :            : 
    1866                 :          0 : void SwXTextTableCursor::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1867                 :            : {
    1868                 :            :     OSL_FAIL("not implemented");
    1869                 :          0 : }
    1870                 :            : 
    1871                 :          0 : void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    1872                 :            : {
    1873                 :            :     OSL_FAIL("not implemented");
    1874                 :          0 : }
    1875                 :            : 
    1876                 :          8 : void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    1877                 :            : {
    1878                 :          8 :     ClientModify(this, pOld, pNew);
    1879                 :          8 : }
    1880                 :            : 
    1881                 :            : /******************************************************************
    1882                 :            :  * SwXTextTable
    1883                 :            :  ******************************************************************/
    1884                 :            : /****************************************************************************
    1885                 :            :     Tabellenbeschreibung
    1886                 :            : ****************************************************************************/
    1887                 :            : class SwTableProperties_Impl
    1888                 :            : {
    1889                 :            :     SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
    1890                 :            : public:
    1891                 :            :     SwTableProperties_Impl();
    1892                 :            :     ~SwTableProperties_Impl();
    1893                 :            : 
    1894                 :            :     void        SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& aVal);
    1895                 :            :     sal_Bool    GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny);
    1896                 :            : 
    1897                 :            :     void        ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc);
    1898                 :            : };
    1899                 :            : 
    1900                 :            : 
    1901                 :         91 : SwTableProperties_Impl::SwTableProperties_Impl()
    1902                 :            : {
    1903                 :         91 : }
    1904                 :            : 
    1905                 :         91 : SwTableProperties_Impl::~SwTableProperties_Impl()
    1906                 :            : {
    1907                 :         91 : }
    1908                 :            : 
    1909                 :          2 : void SwTableProperties_Impl::SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rVal)
    1910                 :            : {
    1911                 :          2 :     aAnyMap.SetValue( nWhichId, nMemberId, rVal );
    1912                 :          2 : }
    1913                 :            : 
    1914                 :       1407 : sal_Bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny )
    1915                 :            : {
    1916                 :       1407 :     return aAnyMap.FillValue( nWhichId, nMemberId, rpAny );
    1917                 :            : }
    1918                 :            : 
    1919                 :         67 : void    SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
    1920                 :            : {
    1921                 :         67 :     SfxItemSet aSet(rDoc.GetAttrPool(),
    1922                 :            :         RES_LAYOUT_SPLIT,   RES_LAYOUT_SPLIT,
    1923                 :            :         RES_BACKGROUND,     RES_BACKGROUND,
    1924                 :            :         RES_FRM_SIZE,       RES_UL_SPACE,
    1925                 :            :         RES_HORI_ORIENT,    RES_HORI_ORIENT,
    1926                 :            :         RES_BREAK,          RES_BREAK,
    1927                 :            :         RES_KEEP,           RES_KEEP,
    1928                 :            :         RES_SHADOW,         RES_SHADOW,
    1929                 :            :         RES_PAGEDESC,       RES_PAGEDESC,
    1930                 :            :         0
    1931         [ +  - ]:         67 :         );
    1932                 :            :     const uno::Any* pRepHead;
    1933                 :         67 :     const SwFrmFmt &rFrmFmt = *rTbl.GetFrmFmt();
    1934 [ -  + ][ +  - ]:         67 :     if(GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff, pRepHead ))
    1935                 :            :     {
    1936                 :          0 :         sal_Bool bVal = *(sal_Bool*)pRepHead->getValue();
    1937         [ #  # ]:          0 :         ((SwTable&)rTbl).SetRowsToRepeat( bVal ? 1 : 0 );  // TODO MULTIHEADER
    1938                 :            :     }
    1939                 :            : 
    1940                 :         67 :     const uno::Any* pBackColor   = 0;
    1941         [ +  - ]:         67 :     GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pBackColor );
    1942                 :         67 :     const uno::Any* pBackTrans  = 0;
    1943         [ +  - ]:         67 :     GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pBackTrans );
    1944                 :         67 :     const uno::Any* pGrLoc      = 0;
    1945         [ +  - ]:         67 :     GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc    );
    1946                 :         67 :     const uno::Any* pGrURL      = 0;
    1947         [ +  - ]:         67 :     GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL     );
    1948                 :         67 :     const uno::Any* pGrFilter   = 0;
    1949         [ +  - ]:         67 :     GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter     );
    1950                 :            : 
    1951 [ +  + ][ +  - ]:         67 :     if(pBackColor||pBackTrans||pGrURL||pGrFilter||pGrLoc)
         [ +  - ][ +  - ]
                 [ -  + ]
    1952                 :            :     {
    1953 [ +  - ][ +  - ]:          2 :         SvxBrushItem aBrush ( rFrmFmt.GetBackground() );
    1954         [ +  - ]:          2 :         if(pBackColor)
    1955         [ +  - ]:          2 :             aBrush.PutValue(*pBackColor, MID_BACK_COLOR);
    1956         [ -  + ]:          2 :         if(pBackTrans)
    1957         [ #  # ]:          0 :             aBrush.PutValue(*pBackTrans, MID_GRAPHIC_TRANSPARENT);
    1958         [ -  + ]:          2 :         if(pGrURL)
    1959         [ #  # ]:          0 :             aBrush.PutValue(*pGrURL, MID_GRAPHIC_URL);
    1960         [ -  + ]:          2 :         if(pGrFilter)
    1961         [ #  # ]:          0 :             aBrush.PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
    1962         [ -  + ]:          2 :         if(pGrLoc)
    1963         [ #  # ]:          0 :             aBrush.PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
    1964 [ +  - ][ +  - ]:          2 :         aSet.Put(aBrush);
    1965                 :            :     }
    1966                 :            : 
    1967                 :         67 :     sal_Bool bPutBreak = sal_True;
    1968                 :            :     const uno::Any* pPage;
    1969 [ +  - ][ +  - ]:         67 :     if(GetProperty(FN_UNO_PAGE_STYLE, 0, pPage) || GetProperty(RES_PAGEDESC, 0xff, pPage))
         [ +  - ][ -  + ]
                 [ -  + ]
    1970                 :            :     {
    1971                 :          0 :         OUString uTmp;
    1972                 :          0 :         (*pPage) >>= uTmp;
    1973         [ #  # ]:          0 :         String sPageStyle = uTmp;
    1974         [ #  # ]:          0 :         if(sPageStyle.Len())
    1975                 :            :         {
    1976         [ #  # ]:          0 :             SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
    1977         [ #  # ]:          0 :             const SwPageDesc* pDesc = ::GetPageDescByName_Impl(rDoc, sPageStyle);
    1978         [ #  # ]:          0 :             if(pDesc)
    1979                 :            :             {
    1980         [ #  # ]:          0 :                 SwFmtPageDesc aDesc( pDesc );
    1981                 :            :                 const uno::Any* pPgNo;
    1982 [ #  # ][ #  # ]:          0 :                 if(GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET, pPgNo ))
    1983                 :            :                 {
    1984                 :          0 :                     sal_Int16 nTmp = 0;
    1985                 :          0 :                     (*pPgNo) >>= nTmp;
    1986                 :          0 :                     aDesc.SetNumOffset( nTmp );
    1987                 :            :                 }
    1988         [ #  # ]:          0 :                 aSet.Put(aDesc);
    1989         [ #  # ]:          0 :                 bPutBreak = sal_False;
    1990                 :            :             }
    1991                 :            : 
    1992         [ #  # ]:          0 :         }
    1993                 :            :     }
    1994                 :            :     const uno::Any* pBreak;
    1995 [ +  - ][ +  - ]:         67 :     if(bPutBreak && GetProperty(RES_BREAK, 0, pBreak))
         [ -  + ][ -  + ]
    1996                 :            :     {
    1997 [ #  # ][ #  # ]:          0 :         SvxFmtBreakItem aBreak ( rFrmFmt.GetBreak() );
    1998         [ #  # ]:          0 :         aBreak.PutValue(*pBreak, 0);
    1999 [ #  # ][ #  # ]:          0 :         aSet.Put(aBreak);
    2000                 :            :     }
    2001                 :            :     const uno::Any* pShadow;
    2002 [ +  - ][ -  + ]:         67 :     if(GetProperty(RES_SHADOW, 0, pShadow))
    2003                 :            :     {
    2004 [ #  # ][ #  # ]:          0 :         SvxShadowItem aShd ( rFrmFmt.GetShadow() );
    2005         [ #  # ]:          0 :         aShd.PutValue(*pShadow, CONVERT_TWIPS);
    2006 [ #  # ][ #  # ]:          0 :         aSet.Put(aShd);
    2007                 :            :     }
    2008                 :            :     const uno::Any* pKeep;
    2009 [ +  - ][ -  + ]:         67 :     if(GetProperty(RES_KEEP, 0, pKeep))
    2010                 :            :     {
    2011 [ #  # ][ #  # ]:          0 :         SvxFmtKeepItem aKeep( rFrmFmt.GetKeep() );
    2012         [ #  # ]:          0 :         aKeep.PutValue(*pKeep, 0);
    2013 [ #  # ][ #  # ]:          0 :         aSet.Put(aKeep);
    2014                 :            :     }
    2015                 :            : 
    2016                 :            :     const uno::Any* pHOrient;
    2017 [ +  - ][ -  + ]:         67 :     if(GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHOrient))
    2018                 :            :     {
    2019 [ #  # ][ #  # ]:          0 :         SwFmtHoriOrient aOrient ( rFrmFmt.GetHoriOrient() );
    2020         [ #  # ]:          0 :         ((SfxPoolItem&)aOrient).PutValue(*pHOrient, MID_HORIORIENT_ORIENT|CONVERT_TWIPS);
    2021 [ #  # ][ #  # ]:          0 :         aSet.Put(aOrient);
    2022                 :            :     }
    2023                 :            : 
    2024                 :         67 :     const uno::Any* pSzRel       = 0;
    2025         [ +  - ]:         67 :     GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel  );
    2026                 :         67 :     const uno::Any* pRelWidth   = 0;
    2027         [ +  - ]:         67 :     GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff, pRelWidth);
    2028                 :         67 :     const uno::Any* pWidth      = 0;
    2029         [ +  - ]:         67 :     GetProperty(FN_TABLE_WIDTH, 0xff, pWidth  );
    2030                 :            : 
    2031                 :         67 :     sal_Bool bPutSize = pWidth != 0;
    2032         [ +  - ]:         67 :     SwFmtFrmSize aSz( ATT_VAR_SIZE);
    2033         [ -  + ]:         67 :     if(pWidth)
    2034                 :            :     {
    2035         [ #  # ]:          0 :         ((SfxPoolItem&)aSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH);
    2036                 :          0 :         bPutSize = sal_True;
    2037                 :            :     }
    2038         [ -  + ]:         67 :     sal_Bool bTemp = pSzRel ? *(sal_Bool*)pSzRel->getValue() : sal_False;
    2039 [ -  + ][ #  # ]:         67 :     if(pSzRel && bTemp && pRelWidth)
                 [ #  # ]
    2040                 :            :     {
    2041         [ #  # ]:          0 :         ((SfxPoolItem&)aSz).PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS);
    2042                 :          0 :         bPutSize = sal_True;
    2043                 :            :     }
    2044         [ -  + ]:         67 :     if(bPutSize)
    2045                 :            :     {
    2046         [ #  # ]:          0 :         if(!aSz.GetWidth())
    2047                 :          0 :             aSz.SetWidth(MINLAY);
    2048         [ #  # ]:          0 :         aSet.Put(aSz);
    2049                 :            :     }
    2050                 :         67 :     const uno::Any* pL      = 0;
    2051         [ +  - ]:         67 :     GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL);
    2052                 :         67 :     const uno::Any* pR      = 0;
    2053         [ +  - ]:         67 :     GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR);
    2054 [ +  - ][ -  + ]:         67 :     if(pL||pR)
    2055                 :            :     {
    2056 [ #  # ][ #  # ]:          0 :         SvxLRSpaceItem aLR ( rFrmFmt.GetLRSpace() );
    2057         [ #  # ]:          0 :         if(pL)
    2058         [ #  # ]:          0 :             ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
    2059         [ #  # ]:          0 :         if(pR)
    2060         [ #  # ]:          0 :             ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
    2061 [ #  # ][ #  # ]:          0 :         aSet.Put(aLR);
    2062                 :            :     }
    2063                 :         67 :     const uno::Any* pU      = 0;
    2064         [ +  - ]:         67 :     GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pU);
    2065                 :         67 :     const uno::Any* pLo     = 0;
    2066         [ +  - ]:         67 :     GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pLo);
    2067 [ +  - ][ -  + ]:         67 :     if(pU||pLo)
    2068                 :            :     {
    2069 [ #  # ][ #  # ]:          0 :         SvxULSpaceItem aUL ( rFrmFmt.GetULSpace() );
    2070         [ #  # ]:          0 :         if(pU)
    2071         [ #  # ]:          0 :             ((SfxPoolItem&)aUL).PutValue(*pU, MID_UP_MARGIN|CONVERT_TWIPS);
    2072         [ #  # ]:          0 :         if(pLo)
    2073         [ #  # ]:          0 :             ((SfxPoolItem&)aUL).PutValue(*pLo, MID_LO_MARGIN|CONVERT_TWIPS);
    2074 [ #  # ][ #  # ]:          0 :         aSet.Put(aUL);
    2075                 :            :     }
    2076                 :            :     const::uno::Any* pSplit;
    2077 [ +  - ][ -  + ]:         67 :     if(GetProperty(RES_LAYOUT_SPLIT, 0, pSplit ))
    2078                 :            :     {
    2079                 :          0 :         sal_Bool bTmp = *(sal_Bool*)pSplit->getValue();
    2080         [ #  # ]:          0 :         SwFmtLayoutSplit aSp(bTmp);
    2081 [ #  # ][ #  # ]:          0 :         aSet.Put(aSp);
    2082                 :            :     }
    2083                 :            : 
    2084                 :            :     //TODO: folgende Propertiers noch impl.
    2085                 :            : //  FN_UNO_RANGE_ROW_LABEL
    2086                 :            : //  FN_UNO_RANGE_COL_LABEL
    2087                 :            : //  FN_UNO_TABLE_BORDER
    2088                 :            : 
    2089         [ +  + ]:         67 :     if(aSet.Count())
    2090                 :            :     {
    2091         [ +  - ]:          2 :         rDoc.SetAttr( aSet, *rTbl.GetFrmFmt() );
    2092 [ +  - ][ +  - ]:         67 :     }
    2093                 :         67 : }
    2094                 :            : 
    2095                 :            : namespace
    2096                 :            : {
    2097                 :            :     class theSwXTextTableUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXTextTableUnoTunnelId > {};
    2098                 :            : }
    2099                 :            : 
    2100                 :        448 : const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId()
    2101                 :            : {
    2102                 :        448 :     return theSwXTextTableUnoTunnelId::get().getSeq();
    2103                 :            : }
    2104                 :            : 
    2105                 :        423 : sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId )
    2106                 :            :     throw(uno::RuntimeException)
    2107                 :            : {
    2108   [ +  -  +  + ]:        846 :     if( rId.getLength() == 16
                 [ +  + ]
    2109                 :        423 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2110                 :        423 :                                         rId.getConstArray(), 16 ) )
    2111                 :            :     {
    2112                 :         17 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    2113                 :            :     }
    2114                 :        423 :     return 0;
    2115                 :            : }
    2116                 :            : 
    2117 [ +  + ][ +  + ]:       8463 : TYPEINIT1(SwXTextTable, SwClient)
    2118                 :            : 
    2119                 :         91 : SwXTextTable::SwXTextTable() :
    2120                 :            :     aLstnrCntnr( (text::XTextTable*)this),
    2121                 :            :     aChartLstnrCntnr( (text::XTextTable*)this),
    2122         [ +  - ]:         91 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
    2123         [ +  - ]:         91 :     pTableProps(new SwTableProperties_Impl),
    2124                 :            :     bIsDescriptor(sal_True),
    2125                 :            :     nRows(2),
    2126                 :            :     nColumns(2),
    2127                 :            :     bFirstRowAsLabel(sal_False),
    2128 [ +  - ][ +  - ]:        273 :     bFirstColumnAsLabel(sal_False)
         [ +  - ][ +  - ]
    2129                 :            : {
    2130                 :         91 : }
    2131                 :            : 
    2132                 :        176 : SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt) :
    2133                 :            :     SwClient( &rFrmFmt ),
    2134                 :            :     aLstnrCntnr( (text::XTextTable*)this),
    2135                 :            :     aChartLstnrCntnr( (text::XTextTable*)this),
    2136         [ +  - ]:        176 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
    2137                 :            :     pTableProps(0),
    2138                 :            :     bIsDescriptor(sal_False),
    2139                 :            :     nRows(0),
    2140                 :            :     nColumns(0),
    2141                 :            :     bFirstRowAsLabel(sal_False),
    2142 [ +  - ][ +  - ]:        352 :     bFirstColumnAsLabel(sal_False)
         [ +  - ][ +  - ]
    2143                 :            : {
    2144                 :        176 : }
    2145                 :            : 
    2146 [ +  - ][ +  - ]:        267 : SwXTextTable::~SwXTextTable()
         [ +  - ][ +  - ]
    2147                 :            : {
    2148 [ +  + ][ +  - ]:        267 :     delete pTableProps;
    2149         [ -  + ]:        534 : }
    2150                 :            : 
    2151                 :         57 : void SwXTextTable::initialize(sal_Int32 nR, sal_Int32 nC) throw( uno::RuntimeException )
    2152                 :            : {
    2153 [ +  - ][ +  - ]:         57 :     if(!bIsDescriptor || nR <= 0 || nC <= 0 || nR >= USHRT_MAX || nC >= USHRT_MAX )
         [ +  - ][ +  - ]
                 [ -  + ]
    2154         [ #  # ]:          0 :         throw uno::RuntimeException();
    2155                 :            :     else
    2156                 :            :     {
    2157                 :         57 :         nRows = (sal_uInt16)nR;
    2158                 :         57 :         nColumns = (sal_uInt16)nC;
    2159                 :            :     }
    2160                 :         57 : }
    2161                 :            : 
    2162                 :         78 : uno::Reference< table::XTableRows >  SwXTextTable::getRows(void) throw( uno::RuntimeException )
    2163                 :            : {
    2164         [ +  - ]:         78 :     SolarMutexGuard aGuard;
    2165                 :         78 :     uno::Reference< table::XTableRows >  xRet;
    2166         [ +  - ]:         78 :     if (SwFrmFmt* pFmt = GetFrmFmt())
    2167                 :            :     {
    2168         [ +  - ]:         78 :         SwXTableRows* pRows = SwIterator<SwXTableRows,SwFmt>::FirstElement(*pFmt);
    2169         [ +  - ]:         78 :         if (!pRows)
    2170         [ +  - ]:         78 :             pRows = new SwXTableRows(*pFmt);
    2171 [ +  - ][ +  - ]:         78 :         xRet = pRows;
    2172                 :            :     }
    2173         [ -  + ]:         78 :     if (!xRet.is())
    2174         [ #  # ]:          0 :         throw uno::RuntimeException();
    2175         [ +  - ]:         78 :     return xRet;
    2176                 :            : }
    2177                 :            : 
    2178                 :          4 : uno::Reference< table::XTableColumns >  SwXTextTable::getColumns(void) throw( uno::RuntimeException )
    2179                 :            : {
    2180         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2181                 :          4 :     uno::Reference< table::XTableColumns >  xRet;
    2182         [ +  - ]:          4 :     if (SwFrmFmt* pFmt = GetFrmFmt())
    2183                 :            :     {
    2184         [ +  - ]:          4 :         SwXTableColumns* pCols = SwIterator<SwXTableColumns,SwFmt>::FirstElement(*pFmt);
    2185         [ +  - ]:          4 :         if (!pCols)
    2186         [ +  - ]:          4 :             pCols = new SwXTableColumns(*pFmt);
    2187 [ +  - ][ +  - ]:          4 :         xRet = pCols;
    2188                 :            :     }
    2189         [ -  + ]:          4 :     if (!xRet.is())
    2190         [ #  # ]:          0 :         throw uno::RuntimeException();
    2191         [ +  - ]:          4 :     return xRet;
    2192                 :            : }
    2193                 :            : 
    2194                 :        651 : uno::Reference< table::XCell >  SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException )
    2195                 :            : {
    2196         [ +  - ]:        651 :     SolarMutexGuard aGuard;
    2197                 :        651 :     uno::Reference< table::XCell >  xRet;
    2198                 :        651 :     SwFrmFmt* pFmt = GetFrmFmt();
    2199         [ +  - ]:        651 :     if(pFmt)
    2200                 :            :     {
    2201         [ +  - ]:        651 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2202         [ +  - ]:        651 :         String sCellName(CellName);
    2203         [ +  - ]:        651 :         SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
    2204         [ +  - ]:        651 :         if(pBox)
    2205                 :            :         {
    2206 [ +  - ][ +  - ]:        651 :             xRet = SwXCell::CreateXCell(pFmt, pBox);
                 [ +  - ]
    2207         [ +  - ]:        651 :         }
    2208                 :            :     }
    2209                 :            :     else
    2210         [ #  # ]:        651 :         throw uno::RuntimeException();
    2211         [ +  - ]:       1302 :     return xRet;
    2212                 :            : }
    2213                 :            : 
    2214                 :         79 : uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeException )
    2215                 :            : {
    2216         [ +  - ]:         79 :     SolarMutexGuard aGuard;
    2217                 :         79 :     SwFrmFmt* pFmt = GetFrmFmt();
    2218         [ +  - ]:         79 :     if(pFmt)
    2219                 :            :     {
    2220         [ +  - ]:         79 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2221                 :            :           // gibts an der Tabelle und an allen Boxen
    2222                 :         79 :         SwTableLines& rTblLines = pTable->GetTabLines();
    2223         [ +  - ]:         79 :         std::vector<String*> aAllNames;
    2224         [ +  - ]:         79 :         lcl_InspectLines(rTblLines, aAllNames);
    2225         [ +  - ]:         79 :         uno::Sequence< OUString > aRet( static_cast<sal_uInt16>(aAllNames.size()) );
    2226         [ +  - ]:         79 :         OUString* pArray = aRet.getArray();
    2227         [ +  + ]:       1003 :         for( size_t i = 0; i < aAllNames.size(); ++i)
    2228                 :            :         {
    2229 [ +  - ][ +  - ]:        924 :             pArray[i] = *aAllNames[i];
    2230 [ +  - ][ +  - ]:        924 :             delete aAllNames[i];
                 [ +  - ]
    2231                 :            :         }
    2232 [ +  - ][ +  - ]:         79 :         return aRet;
    2233                 :            :     }
    2234 [ #  # ][ +  - ]:         79 :     return uno::Sequence< OUString >();
    2235                 :            : }
    2236                 :            : 
    2237                 :          8 : uno::Reference< text::XTextTableCursor >  SwXTextTable::createCursorByCellName(const OUString& CellName)
    2238                 :            :     throw( uno::RuntimeException )
    2239                 :            : {
    2240         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    2241                 :          8 :     uno::Reference< text::XTextTableCursor >  xRet;
    2242                 :          8 :     SwFrmFmt* pFmt = GetFrmFmt();
    2243         [ +  - ]:          8 :     if(pFmt)
    2244                 :            :     {
    2245         [ +  - ]:          8 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2246         [ +  - ]:          8 :         String sCellName(CellName);
    2247         [ +  - ]:          8 :         SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
    2248 [ +  - ][ +  - ]:          8 :         if(pBox && pBox->getRowSpan() > 0 )
         [ +  - ][ +  - ]
    2249                 :            :         {
    2250 [ +  - ][ +  - ]:          8 :             xRet = new SwXTextTableCursor(pFmt, pBox);
                 [ +  - ]
    2251         [ +  - ]:          8 :         }
    2252                 :            :     }
    2253         [ -  + ]:          8 :     if(!xRet.is())
    2254         [ #  # ]:          0 :         throw uno::RuntimeException();
    2255         [ +  - ]:          8 :     return xRet;
    2256                 :            : }
    2257                 :            : 
    2258                 :         67 : void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
    2259                 :            :     throw( lang::IllegalArgumentException, uno::RuntimeException )
    2260                 :            : {
    2261                 :            :     // attachToRange must only be called once
    2262         [ -  + ]:         67 :     if(!bIsDescriptor)  /* already attached ? */
    2263 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "SwXTextTable: already attached to range." ) ), static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    2264                 :            : 
    2265         [ +  - ]:         67 :     uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
    2266                 :         67 :     SwXTextRange* pRange = 0;
    2267                 :         67 :     OTextCursorHelper* pCursor = 0;
    2268         [ +  - ]:         67 :     if(xRangeTunnel.is())
    2269                 :            :     {
    2270                 :            :         pRange  = reinterpret_cast< SwXTextRange * >(
    2271 [ +  - ][ +  - ]:         67 :                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
                 [ +  - ]
    2272                 :            :         pCursor = reinterpret_cast< OTextCursorHelper * >(
    2273 [ +  - ][ +  - ]:         67 :                 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
                 [ +  - ]
    2274                 :            :     }
    2275 [ +  + ][ +  - ]:         67 :     SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
         [ +  - ][ +  - ]
    2276 [ +  - ][ +  - ]:         67 :     if(pDoc && nRows && nColumns)
                 [ +  - ]
    2277                 :            :     {
    2278         [ +  - ]:         67 :         SwUnoInternalPaM aPam(*pDoc);
    2279                 :            :         //das muss jetzt sal_True liefern
    2280         [ +  - ]:         67 :         ::sw::XTextRangeToSwPaM(aPam, xTextRange);
    2281                 :            : 
    2282                 :            :         {
    2283         [ +  - ]:         67 :             UnoActionContext aCont( pDoc );
    2284                 :            : 
    2285 [ +  - ][ +  - ]:         67 :             pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
    2286                 :         67 :             const SwTable *pTable = 0;
    2287 [ +  - ][ -  + ]:         67 :             if( 0 != aPam.Start()->nContent.GetIndex() )
    2288                 :            :             {
    2289 [ #  # ][ #  # ]:          0 :                 pDoc->SplitNode(*aPam.Start(), false );
    2290                 :            :             }
    2291                 :            :             //TODO: wenn es der letzte Absatz ist, dann muss noch ein Absatz angehaengt werden!
    2292         [ -  + ]:         67 :             if( aPam.HasMark() )
    2293                 :            :             {
    2294         [ #  # ]:          0 :                 pDoc->DeleteAndJoin(aPam);
    2295         [ #  # ]:          0 :                 aPam.DeleteMark();
    2296                 :            :             }
    2297                 :            :             pTable = pDoc->InsertTable( SwInsertTableOptions( tabopts::HEADLINE | tabopts::DEFAULT_BORDER | tabopts::SPLIT_LAYOUT, 0 ),
    2298                 :         67 :                                         *aPam.GetPoint(),
    2299                 :            :                                         nRows,
    2300                 :            :                                         nColumns,
    2301         [ +  - ]:         67 :                                         text::HoriOrientation::FULL );
    2302         [ +  - ]:         67 :             if(pTable)
    2303                 :            :             {
    2304                 :            :                 // hier muessen die Properties des Descriptors ausgewertet werden
    2305         [ +  - ]:         67 :                 pTableProps->ApplyTblAttr(*pTable, *pDoc);
    2306                 :         67 :                 SwFrmFmt* pTblFmt = pTable->GetFrmFmt();
    2307         [ +  - ]:         67 :                 lcl_FormatTable( pTblFmt );
    2308                 :            : 
    2309         [ +  - ]:         67 :                 pTblFmt->Add(this);
    2310         [ +  + ]:         67 :                 if(m_sTableName.Len())
    2311                 :            :                 {
    2312                 :          4 :                     sal_uInt16 nIndex = 1;
    2313         [ +  - ]:          4 :                     const String sTmpName(m_sTableName);
    2314         [ +  - ]:          4 :                     String sTmpNameIndex(sTmpName);
    2315 [ +  - ][ -  + ]:          4 :                     while(pDoc->FindTblFmtByName( sTmpNameIndex, sal_True ) && nIndex < USHRT_MAX)
         [ #  # ][ -  + ]
    2316                 :            :                     {
    2317         [ #  # ]:          0 :                         sTmpNameIndex = sTmpName;
    2318         [ #  # ]:          0 :                         sTmpNameIndex += nIndex++;
    2319                 :            :                     }
    2320 [ +  - ][ +  - ]:          4 :                     pDoc->SetTableName( *pTblFmt, sTmpNameIndex);
                 [ +  - ]
    2321                 :            :                 }
    2322                 :            : 
    2323                 :            :                 const::uno::Any* pName;
    2324 [ +  - ][ -  + ]:         67 :                 if(pTableProps->GetProperty(FN_UNO_TABLE_NAME, 0, pName))
    2325                 :            :                 {
    2326                 :          0 :                     OUString sTmp;
    2327                 :          0 :                     (*pName) >>= sTmp;
    2328         [ #  # ]:          0 :                     setName(sTmp);
    2329                 :            :                 }
    2330                 :         67 :                 bIsDescriptor = sal_False;
    2331 [ +  - ][ +  - ]:         67 :                 DELETEZ(pTableProps);
    2332                 :            :             }
    2333 [ +  - ][ +  - ]:         67 :             pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
                 [ +  - ]
    2334         [ +  - ]:         67 :         }
    2335                 :            :     }
    2336                 :            :     else
    2337         [ #  # ]:         67 :         throw lang::IllegalArgumentException();
    2338                 :         67 : }
    2339                 :            : 
    2340                 :         67 : void SwXTextTable::attach(const uno::Reference< text::XTextRange > & xTextRange)
    2341                 :            :         throw( lang::IllegalArgumentException, uno::RuntimeException )
    2342                 :            : {
    2343         [ +  - ]:         67 :     SolarMutexGuard aGuard;
    2344 [ +  - ][ +  - ]:         67 :     attachToRange( xTextRange );
    2345                 :         67 : }
    2346                 :            : 
    2347                 :         74 : uno::Reference< text::XTextRange >  SwXTextTable::getAnchor(void)
    2348                 :            :         throw( uno::RuntimeException )
    2349                 :            : {
    2350         [ +  - ]:         74 :     SolarMutexGuard aGuard;
    2351                 :         74 :     SwFrmFmt* pFmt = GetFrmFmt();
    2352         [ -  + ]:         74 :     if(!pFmt)
    2353         [ #  # ]:          0 :         throw uno::RuntimeException();
    2354 [ +  - ][ +  - ]:         74 :     uno::Reference< text::XTextRange >  xRet = new SwXTextRange(*pFmt);
                 [ +  - ]
    2355         [ +  - ]:         74 :     return xRet;
    2356                 :            : }
    2357                 :            : 
    2358                 :          8 : void SwXTextTable::dispose(void) throw( uno::RuntimeException )
    2359                 :            : {
    2360         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    2361                 :          8 :     SwFrmFmt* pFmt = GetFrmFmt();
    2362         [ +  - ]:          8 :     if(pFmt)
    2363                 :            :     {
    2364         [ +  - ]:          8 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2365                 :          8 :         SwTableSortBoxes& rBoxes = pTable->GetTabSortBoxes();
    2366         [ +  - ]:          8 :         SwSelBoxes aSelBoxes;
    2367 [ +  - ][ +  + ]:        176 :         for(SwTableSortBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it )
    2368         [ +  - ]:        168 :             aSelBoxes.insert( *it );
    2369         [ +  - ]:          8 :         pFmt->GetDoc()->DeleteRowCol(aSelBoxes);
    2370                 :            :     }
    2371                 :            :     else
    2372 [ #  # ][ +  - ]:          8 :         throw uno::RuntimeException();
    2373                 :          8 : }
    2374                 :            : 
    2375                 :          4 : void SwXTextTable::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
    2376                 :            : {
    2377         [ -  + ]:          4 :     if(!GetRegisteredIn())
    2378         [ #  # ]:          0 :         throw uno::RuntimeException();
    2379                 :          4 :     aLstnrCntnr.AddListener(aListener);
    2380                 :          4 : }
    2381                 :            : 
    2382                 :          2 : void SwXTextTable::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
    2383                 :            : {
    2384 [ +  - ][ -  + ]:          2 :     if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
                 [ -  + ]
    2385         [ #  # ]:          0 :         throw uno::RuntimeException();
    2386                 :          2 : }
    2387                 :            : 
    2388                 :        575 : uno::Reference< table::XCell >  SwXTextTable::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
    2389                 :            :     throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
    2390                 :            : {
    2391         [ +  - ]:        575 :     SolarMutexGuard aGuard;
    2392                 :        575 :     uno::Reference< table::XCell >  aRef;
    2393                 :        575 :     SwFrmFmt* pFmt = GetFrmFmt();
    2394                 :            :     // Sheet interessiert nicht
    2395 [ +  - ][ +  - ]:        575 :     if(nColumn >= 0 && nRow >= 0 && nColumn < USHRT_MAX && nRow < USHRT_MAX && pFmt)
         [ +  - ][ +  - ]
                 [ +  + ]
    2396                 :            :     {
    2397         [ +  - ]:        573 :         SwXCell* pXCell = lcl_CreateXCell(pFmt, nColumn, nRow);
    2398         [ +  - ]:        573 :         if(pXCell)
    2399 [ +  - ][ +  - ]:        573 :             aRef = pXCell;
    2400                 :            :     }
    2401         [ +  + ]:        575 :     if(!aRef.is())
    2402         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    2403         [ +  - ]:        575 :     return aRef;
    2404                 :            : 
    2405                 :            : }
    2406                 :            : 
    2407                 :         10 : uno::Reference< table::XCellRange >  SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
    2408                 :            :                     const String& rTLName, const String& rBRName,
    2409                 :            :                     SwRangeDescriptor& rDesc)
    2410                 :            : {
    2411         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    2412                 :         10 :     uno::Reference< table::XCellRange >  aRef;
    2413         [ +  - ]:         10 :     String sTLName(rTLName);
    2414         [ +  - ]:         10 :     String sBRName(rBRName);
    2415         [ +  - ]:         10 :     const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    2416         [ +  - ]:         10 :     if(pTLBox)
    2417                 :            :     {
    2418                 :            :         // hier muessen die Actions aufgehoben werden
    2419         [ +  - ]:         10 :         UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
    2420                 :         10 :         const SwStartNode* pSttNd = pTLBox->GetSttNd();
    2421         [ +  - ]:         10 :         SwPosition aPos(*pSttNd);
    2422                 :            :         // Cursor in die obere linke Zelle des Ranges setzen
    2423         [ +  - ]:         10 :         SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    2424         [ +  - ]:         10 :         pUnoCrsr->Move( fnMoveForward, fnGoNode );
    2425                 :         10 :         pUnoCrsr->SetRemainInSection( sal_False );
    2426         [ +  - ]:         10 :         const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
    2427         [ +  - ]:         10 :         if(pBRBox)
    2428                 :            :         {
    2429         [ +  - ]:         10 :             pUnoCrsr->SetMark();
    2430         [ +  - ]:         10 :             pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
    2431         [ +  - ]:         10 :             pUnoCrsr->Move( fnMoveForward, fnGoNode );
    2432         [ -  + ]:         10 :             SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    2433         [ +  - ]:         10 :             pCrsr->MakeBoxSels();
    2434                 :            :             // pUnoCrsr wird uebergeben und nicht geloescht
    2435         [ +  - ]:         10 :             SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
    2436 [ +  - ][ +  - ]:         10 :             aRef = pCellRange;
    2437                 :            :         }
    2438                 :            :         else
    2439 [ #  # ][ #  # ]:         10 :             delete pUnoCrsr;
         [ +  - ][ +  - ]
    2440                 :            :     }
    2441 [ +  - ][ +  - ]:         10 :     return aRef;
                 [ +  - ]
    2442                 :            : }
    2443                 :            : 
    2444                 :         10 : uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop,
    2445                 :            :                 sal_Int32 nRight, sal_Int32 nBottom)
    2446                 :            :     throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
    2447                 :            : {
    2448         [ +  - ]:         10 :     SolarMutexGuard aGuard;
    2449                 :         10 :     uno::Reference< table::XCellRange >  aRef;
    2450                 :         10 :     SwFrmFmt* pFmt = GetFrmFmt();
    2451 [ +  - ][ +  - ]:         10 :     if(pFmt && nRight < USHRT_MAX && nBottom < USHRT_MAX &&
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    2452                 :            :         nLeft <= nRight && nTop <= nBottom &&
    2453                 :            :             nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
    2454                 :            :     {
    2455         [ +  - ]:          8 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2456 [ +  - ][ +  - ]:          8 :         if(!pTable->IsTblComplex())
    2457                 :            :         {
    2458                 :            :             SwRangeDescriptor aDesc;
    2459                 :          8 :             aDesc.nTop    = nTop;
    2460                 :          8 :             aDesc.nBottom = nBottom;
    2461                 :          8 :             aDesc.nLeft   = nLeft;
    2462                 :          8 :             aDesc.nRight  = nRight;
    2463         [ +  - ]:          8 :             String sTLName = lcl_GetCellName(aDesc.nLeft, aDesc.nTop);
    2464         [ +  - ]:          8 :             String sBRName = lcl_GetCellName(aDesc.nRight, aDesc.nBottom);
    2465                 :            : 
    2466                 :            :             // please note that according to the 'if' statement at the begin
    2467                 :            :             // sTLName:sBRName already denotes the normalized range string
    2468                 :            : 
    2469 [ +  - ][ +  - ]:          8 :             aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
         [ +  - ][ +  - ]
    2470                 :            :         }
    2471                 :            :     }
    2472         [ +  + ]:         10 :     if(!aRef.is())
    2473         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    2474         [ +  - ]:         10 :     return aRef;
    2475                 :            : }
    2476                 :            : 
    2477                 :          2 : uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByName(const OUString& aRange)
    2478                 :            :     throw( uno::RuntimeException )
    2479                 :            : {
    2480         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2481                 :          2 :     uno::Reference< table::XCellRange >  aRef;
    2482                 :          2 :     SwFrmFmt* pFmt = GetFrmFmt();
    2483         [ +  - ]:          2 :     if(pFmt)
    2484                 :            :     {
    2485         [ +  - ]:          2 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2486 [ +  - ][ +  - ]:          2 :         if(!pTable->IsTblComplex())
    2487                 :            :         {
    2488         [ +  - ]:          2 :             String sRange(aRange);
    2489         [ +  - ]:          2 :             String sTLName(sRange.GetToken(0, ':'));
    2490         [ +  - ]:          2 :             String sBRName(sRange.GetToken(1, ':'));
    2491 [ +  - ][ -  + ]:          2 :             if(!sTLName.Len() || !sBRName.Len())
                 [ -  + ]
    2492         [ #  # ]:          0 :                 throw uno::RuntimeException();
    2493                 :            :             SwRangeDescriptor aDesc;
    2494                 :          2 :             aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
    2495                 :          2 :             lcl_GetCellPosition(sTLName, aDesc.nLeft, aDesc.nTop );
    2496                 :          2 :             lcl_GetCellPosition(sBRName, aDesc.nRight, aDesc.nBottom );
    2497                 :            : 
    2498                 :            :             // we should normalize the range now (e.g. A5:C1 will become A1:C5)
    2499                 :            :             // since (depending on what is done later) it will be troublesome
    2500                 :            :             // elsewhere when the cursor in the implementation does not
    2501                 :            :             // point to the top-left and bottom-right cells
    2502                 :          2 :             aDesc.Normalize();
    2503                 :            : 
    2504 [ +  - ][ +  - ]:          2 :             aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
         [ +  - ][ +  - ]
                 [ +  - ]
    2505                 :            :         }
    2506                 :            :     }
    2507         [ -  + ]:          2 :     if(!aRef.is())
    2508         [ #  # ]:          0 :         throw uno::RuntimeException();
    2509         [ +  - ]:          2 :     return aRef;
    2510                 :            : }
    2511                 :            : 
    2512                 :          4 : uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
    2513                 :            :     throw (uno::RuntimeException)
    2514                 :            : {
    2515                 :            :     // see SwXTextTable::getData(...) also
    2516                 :            : 
    2517         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2518         [ +  - ]:          4 :     sal_Int16 nRowCount = getRowCount();
    2519         [ +  - ]:          4 :     sal_Int16 nColCount = getColumnCount();
    2520 [ +  - ][ -  + ]:          4 :     if(!nRowCount || !nColCount)
    2521                 :            :     {
    2522         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2523         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2524         [ #  # ]:          0 :         throw aRuntime;
    2525                 :            :     }
    2526                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    2527         [ +  - ]:          4 :     uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
    2528         [ +  - ]:          4 :     if(pFmt)
    2529                 :            :     {
    2530         [ +  - ]:          4 :         uno::Sequence< uno::Any > * pRowArray = aRowSeq.getArray();
    2531         [ +  + ]:         28 :         for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
    2532                 :            :         {
    2533         [ +  - ]:         24 :             uno::Sequence< uno::Any >  aColSeq(nColCount);
    2534         [ +  - ]:         24 :             uno::Any * pColArray = aColSeq.getArray();
    2535                 :         24 :             uno::Reference< table::XCell > xCellRef;
    2536         [ +  + ]:         72 :             for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
    2537                 :            :             {
    2538         [ +  - ]:         48 :                 SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
    2539                 :            :                 //! keep (additional) reference to object to prevent implicit destruction
    2540                 :            :                 //! in following UNO calls (when object will get referenced)
    2541 [ +  - ][ +  - ]:         48 :                 xCellRef = pXCell;
    2542         [ +  - ]:         48 :                 SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
    2543         [ -  + ]:         48 :                 if(!pBox)
    2544                 :            :                 {
    2545         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2546                 :            :                 }
    2547                 :            :                 else
    2548                 :            :                 {
    2549                 :            :                     // check if table box value item is set
    2550                 :         48 :                     SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
    2551         [ +  - ]:         48 :                     sal_Bool bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
    2552                 :            :                     //const SfxPoolItem* pItem;
    2553                 :            :                     //SwDoc* pDoc = pXCell->GetDoc();
    2554                 :            :                     //sal_Bool bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
    2555                 :            :                     //          ||  pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
    2556                 :            :                     //          ||  ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
    2557                 :            : 
    2558         [ +  + ]:         48 :                     if(!bIsNum/*bIsText*/)
    2559 [ +  - ][ +  - ]:         24 :                         pColArray[nCol] <<= lcl_getString(*pXCell);
    2560                 :            :                     else
    2561 [ +  - ][ +  - ]:         24 :                         pColArray[nCol] <<= lcl_getValue(*pXCell);
    2562                 :            :                 }
    2563                 :            :             }
    2564         [ +  - ]:         24 :             pRowArray[nRow] = aColSeq;
    2565         [ +  - ]:         24 :         }
    2566                 :            :     }
    2567                 :            :     else
    2568         [ #  # ]:          0 :         throw uno::RuntimeException();
    2569         [ +  - ]:          4 :     return aRowSeq;
    2570                 :            : }
    2571                 :            : 
    2572                 :          4 : void SAL_CALL SwXTextTable::setDataArray(
    2573                 :            :         const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
    2574                 :            :     throw (uno::RuntimeException)
    2575                 :            : {
    2576                 :            :     // see SwXTextTable::setData(...) also
    2577                 :            : 
    2578         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    2579         [ +  - ]:          4 :     sal_Int16 nRowCount = getRowCount();
    2580         [ +  - ]:          4 :     sal_Int16 nColCount = getColumnCount();
    2581                 :            : 
    2582                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    2583         [ +  - ]:          4 :     if(pFmt)
    2584                 :            :     {
    2585         [ +  - ]:          4 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2586 [ +  - ][ -  + ]:          4 :         if(pTable->IsTblComplex())
    2587                 :            :         {
    2588         [ #  # ]:          0 :             uno::RuntimeException aRuntime;
    2589         [ #  # ]:          0 :             aRuntime.Message = C2U("Table too complex");
    2590         [ #  # ]:          0 :             throw aRuntime;
    2591                 :            :         }
    2592                 :            : 
    2593         [ -  + ]:          4 :         if(rArray.getLength() != nRowCount)
    2594                 :            :         {
    2595         [ #  # ]:          0 :             throw uno::RuntimeException();
    2596                 :            :         }
    2597                 :          4 :         const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray();
    2598         [ +  + ]:         28 :         for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
    2599                 :            :         {
    2600                 :         24 :             const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow];
    2601         [ -  + ]:         24 :             if(rColSeq.getLength() != nColCount)
    2602                 :            :             {
    2603         [ #  # ]:          0 :                 throw uno::RuntimeException();
    2604                 :            :             }
    2605                 :         24 :             const uno::Any * pColArray = rColSeq.getConstArray();
    2606                 :         24 :             uno::Reference< table::XCell > xCellRef;
    2607         [ +  + ]:         72 :             for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
    2608                 :            :             {
    2609         [ +  - ]:         48 :                 SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
    2610                 :            :                 //! keep (additional) reference to object to prevent implicit destruction
    2611                 :            :                 //! in following UNO calls (when object will get referenced)
    2612 [ +  - ][ +  - ]:         48 :                 xCellRef = pXCell;
    2613         [ +  - ]:         48 :                 SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
    2614         [ -  + ]:         48 :                 if(!pBox)
    2615                 :            :                 {
    2616         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2617                 :            :                 }
    2618                 :            :                 else
    2619                 :            :                 {
    2620                 :         48 :                     const uno::Any &rAny = pColArray[nCol];
    2621         [ +  + ]:         48 :                     if (uno::TypeClass_STRING == rAny.getValueTypeClass())
    2622         [ +  - ]:         24 :                         lcl_setString( *pXCell, *(rtl::OUString *) rAny.getValue() );
    2623                 :            :                     else
    2624                 :            :                     {
    2625                 :         24 :                         double d = 0;
    2626                 :            :                         // #i20067# don't throw exception just do nothing if
    2627                 :            :                         // there is no value set
    2628         [ +  - ]:         24 :                         if( (rAny >>= d) )
    2629         [ +  - ]:         24 :                             lcl_setValue( *pXCell, d );
    2630                 :            :                         else
    2631         [ #  # ]:         24 :                             lcl_setString( *pXCell, OUString(), sal_True );
    2632                 :            : 
    2633                 :            :                     }
    2634                 :            :                 }
    2635                 :            :             }
    2636                 :         24 :         }
    2637         [ +  - ]:          4 :     }
    2638                 :          4 : }
    2639                 :            : 
    2640                 :          8 : uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
    2641                 :            :                                         throw( uno::RuntimeException )
    2642                 :            : {
    2643         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    2644         [ +  - ]:          8 :     sal_Int16 nRowCount = getRowCount();
    2645         [ +  - ]:          8 :     sal_Int16 nColCount = getColumnCount();
    2646 [ +  - ][ -  + ]:          8 :     if(!nRowCount || !nColCount)
    2647                 :            :     {
    2648         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2649         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2650         [ #  # ]:          0 :         throw aRuntime;
    2651                 :            :     }
    2652                 :            :     //
    2653                 :          8 :     SwFrmFmt* pFmt = GetFrmFmt();
    2654 [ +  - ][ +  - ]:          8 :     uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
    2655         [ +  - ]:          8 :     if(pFmt)
    2656                 :            :     {
    2657         [ +  - ]:          8 :         uno::Sequence< double >* pArray = aRowSeq.getArray();
    2658                 :            : 
    2659                 :          8 :         sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
    2660         [ +  + ]:         48 :         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
    2661                 :            :         {
    2662 [ +  - ][ +  - ]:         40 :             uno::Sequence< double >  aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
    2663         [ +  - ]:         40 :             double* pColArray = aColSeq.getArray();
    2664         [ +  - ]:         40 :             sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
    2665         [ +  + ]:         80 :             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
    2666                 :            :             {
    2667         [ +  - ]:         40 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
    2668         [ -  + ]:         40 :                 if(!xCell.is())
    2669                 :            :                 {
    2670         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2671                 :            :                 }
    2672 [ +  - ][ +  - ]:         40 :                 pColArray[nCol - nColStart] = xCell->getValue();
    2673                 :         40 :             }
    2674         [ +  - ]:         40 :             pArray[nRow - nRowStart] = aColSeq;
    2675         [ +  - ]:         40 :         }
    2676                 :            :     }
    2677                 :            :     else
    2678         [ #  # ]:          0 :         throw uno::RuntimeException();
    2679         [ +  - ]:          8 :     return aRowSeq;
    2680                 :            : }
    2681                 :            : 
    2682                 :          6 : void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData)
    2683                 :            :                                         throw( uno::RuntimeException )
    2684                 :            : {
    2685         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2686         [ +  - ]:          6 :     sal_Int16 nRowCount = getRowCount();
    2687         [ +  - ]:          6 :     sal_Int16 nColCount = getColumnCount();
    2688                 :          6 :     sal_Bool bChanged = sal_False;
    2689                 :            : 
    2690 [ +  - ][ -  + ]:          6 :     if(!nRowCount || !nColCount)
    2691                 :            :     {
    2692         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2693         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2694         [ #  # ]:          0 :         throw aRuntime;
    2695                 :            :     }
    2696                 :          6 :     SwFrmFmt* pFmt = GetFrmFmt();
    2697         [ +  - ]:          6 :     if(pFmt )
    2698                 :            :     {
    2699                 :          6 :         sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
    2700         [ -  + ]:          6 :         if(rData.getLength() < nRowCount - nRowStart)
    2701                 :            :         {
    2702         [ #  # ]:          0 :             throw uno::RuntimeException();
    2703                 :            :         }
    2704                 :          6 :         const uno::Sequence< double >* pRowArray = rData.getConstArray();
    2705         [ +  + ]:         36 :         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
    2706                 :            :         {
    2707                 :         30 :             const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
    2708         [ +  - ]:         30 :             sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
    2709         [ -  + ]:         30 :             if(rColSeq.getLength() < nColCount - nColStart)
    2710                 :            :             {
    2711         [ #  # ]:          0 :                 throw uno::RuntimeException();
    2712                 :            :             }
    2713                 :         30 :             const double * pColArray = rColSeq.getConstArray();
    2714         [ +  + ]:         60 :             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
    2715                 :            :             {
    2716         [ +  - ]:         30 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
    2717         [ -  + ]:         30 :                 if(!xCell.is())
    2718                 :            :                 {
    2719         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2720                 :            :                 }
    2721 [ +  - ][ +  - ]:         30 :                 xCell->setValue(pColArray[nCol - nColStart]);
    2722                 :         30 :                 bChanged=sal_True;
    2723                 :         30 :             }
    2724                 :            :         }
    2725         [ +  - ]:          6 :         if ( bChanged )
    2726         [ +  - ]:          6 :             aChartLstnrCntnr.ChartDataChanged();
    2727         [ +  - ]:          6 :     }
    2728                 :          6 : }
    2729                 :            : 
    2730                 :          6 : uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::RuntimeException )
    2731                 :            : {
    2732         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2733         [ +  - ]:          6 :     sal_Int16 nRowCount = getRowCount();
    2734         [ -  + ]:          6 :     if(!nRowCount)
    2735                 :            :     {
    2736         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2737         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2738         [ #  # ]:          0 :         throw aRuntime;
    2739                 :            :     }
    2740 [ +  - ][ +  - ]:          6 :     uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
    2741                 :          6 :     SwFrmFmt* pFmt = GetFrmFmt();
    2742         [ +  - ]:          6 :     if(pFmt)
    2743                 :            :     {
    2744         [ +  - ]:          6 :         OUString* pArray = aRet.getArray();
    2745         [ +  - ]:          6 :         if(bFirstColumnAsLabel)
    2746                 :            :         {
    2747                 :          6 :             sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
    2748         [ +  + ]:         36 :             for(sal_uInt16 i = nStart; i < nRowCount; i++)
    2749                 :            :             {
    2750         [ +  - ]:         30 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
    2751         [ -  + ]:         30 :                 if(!xCell.is())
    2752                 :            :                 {
    2753                 :            :                     //exception ...
    2754                 :            :                     break;
    2755                 :            :                 }
    2756         [ +  - ]:         30 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    2757 [ +  - ][ +  - ]:         30 :                 pArray[i - nStart] = xText->getString();
    2758         [ +  - ]:         30 :             }
    2759                 :            :         }
    2760                 :            :         else
    2761                 :            :         {
    2762                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    2763                 :            :         }
    2764                 :            :     }
    2765                 :            :     else
    2766         [ #  # ]:          0 :         throw uno::RuntimeException();
    2767         [ +  - ]:          6 :     return aRet;
    2768                 :            : }
    2769                 :            : 
    2770                 :          2 : void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) throw( uno::RuntimeException )
    2771                 :            : {
    2772         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2773                 :          2 :     SwFrmFmt* pFmt = GetFrmFmt();
    2774         [ +  - ]:          2 :     if(pFmt)
    2775                 :            :     {
    2776         [ +  - ]:          2 :         sal_Int16 nRowCount = getRowCount();
    2777 [ +  - ][ +  - ]:          2 :         if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
         [ -  + ][ -  + ]
    2778                 :            :         {
    2779         [ #  # ]:          0 :             throw uno::RuntimeException();
    2780                 :            :         }
    2781                 :          2 :         const OUString* pArray = rRowDesc.getConstArray();
    2782         [ +  - ]:          2 :         if(bFirstColumnAsLabel)
    2783                 :            :         {
    2784                 :          2 :             sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
    2785         [ +  + ]:         12 :             for(sal_uInt16 i = nStart; i < nRowCount; i++)
    2786                 :            :             {
    2787         [ +  - ]:         10 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
    2788         [ -  + ]:         10 :                 if(!xCell.is())
    2789                 :            :                 {
    2790         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2791                 :            :                 }
    2792         [ +  - ]:         10 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    2793 [ +  - ][ +  - ]:         10 :                 xText->setString(pArray[i - nStart]);
    2794                 :         10 :             }
    2795                 :            :         }
    2796                 :            :         else
    2797                 :            :         {
    2798                 :            :             OSL_FAIL("Wohin mit den Labels?");
    2799                 :            :         }
    2800                 :            :     }
    2801                 :            :     else
    2802 [ #  # ][ +  - ]:          2 :         throw uno::RuntimeException();
    2803                 :          2 : }
    2804                 :            : 
    2805                 :          6 : uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
    2806                 :            :                                                 throw( uno::RuntimeException )
    2807                 :            : {
    2808         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    2809         [ +  - ]:          6 :     sal_Int16 nColCount = getColumnCount();
    2810         [ -  + ]:          6 :     if(!nColCount)
    2811                 :            :     {
    2812         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2813         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2814         [ #  # ]:          0 :         throw aRuntime;
    2815                 :            :     }
    2816 [ +  - ][ +  - ]:          6 :     uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
    2817                 :          6 :     SwFrmFmt* pFmt = GetFrmFmt();
    2818         [ +  - ]:          6 :     if(pFmt)
    2819                 :            :     {
    2820         [ +  - ]:          6 :         OUString* pArray = aRet.getArray();
    2821         [ +  - ]:          6 :         if(bFirstRowAsLabel)
    2822                 :            :         {
    2823         [ +  - ]:          6 :             sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
    2824         [ +  + ]:         12 :             for(sal_uInt16 i = nStart; i < nColCount; i++)
    2825                 :            :             {
    2826         [ +  - ]:          6 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
    2827         [ -  + ]:          6 :                 if(!xCell.is())
    2828                 :            :                 {
    2829         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2830                 :            :                 }
    2831         [ +  - ]:          6 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    2832                 :            : 
    2833 [ +  - ][ +  - ]:          6 :                 pArray[i - nStart] = xText->getString();
    2834                 :          6 :             }
    2835                 :            :         }
    2836                 :            :         else
    2837                 :            :         {
    2838                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    2839                 :            :         }
    2840                 :            :     }
    2841                 :            :     else
    2842         [ #  # ]:          0 :         throw uno::RuntimeException();
    2843         [ +  - ]:          6 :     return aRet;
    2844                 :            : }
    2845                 :            : 
    2846                 :          2 : void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColumnDesc) throw( uno::RuntimeException )
    2847                 :            : {
    2848         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2849         [ +  - ]:          2 :     sal_Int16 nColCount = getColumnCount();
    2850         [ -  + ]:          2 :     if(!nColCount)
    2851                 :            :     {
    2852         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    2853         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    2854         [ #  # ]:          0 :         throw aRuntime;
    2855                 :            :     }
    2856                 :          2 :     SwFrmFmt* pFmt = GetFrmFmt();
    2857         [ +  - ]:          2 :     if(pFmt)
    2858                 :            :     {
    2859                 :          2 :         const OUString* pArray = rColumnDesc.getConstArray();
    2860 [ +  - ][ +  - ]:          2 :         if(bFirstRowAsLabel && rColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
                 [ +  - ]
    2861                 :            :         {
    2862         [ +  - ]:          2 :             sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
    2863         [ +  + ]:          4 :             for(sal_uInt16 i = nStart; i < nColCount; i++)
    2864                 :            :             {
    2865         [ +  - ]:          2 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
    2866         [ -  + ]:          2 :                 if(!xCell.is())
    2867                 :            :                 {
    2868         [ #  # ]:          0 :                     throw uno::RuntimeException();
    2869                 :            :                 }
    2870         [ +  - ]:          2 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    2871 [ +  - ][ +  - ]:          2 :                 xText->setString(pArray[i - nStart]);
    2872                 :          2 :             }
    2873                 :            :         }
    2874                 :            :         else
    2875                 :            :         {
    2876                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    2877                 :            :         }
    2878                 :            :     }
    2879                 :            :     else
    2880 [ #  # ][ +  - ]:          2 :         throw uno::RuntimeException();
    2881                 :          2 : }
    2882                 :            : 
    2883                 :          4 : void SwXTextTable::addChartDataChangeEventListener(
    2884                 :            :     const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
    2885                 :            :         throw( uno::RuntimeException )
    2886                 :            : {
    2887         [ -  + ]:          4 :     if(!GetRegisteredIn())
    2888         [ #  # ]:          0 :         throw uno::RuntimeException();
    2889         [ +  - ]:          4 :     aChartLstnrCntnr.AddListener(aListener.get());
    2890                 :          4 : }
    2891                 :            : 
    2892                 :          4 : void SwXTextTable::removeChartDataChangeEventListener(
    2893                 :            :     const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
    2894                 :            :         throw( uno::RuntimeException )
    2895                 :            : {
    2896 [ +  - ][ +  - ]:          4 :     if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
           [ -  +  #  # ]
    2897         [ #  # ]:          0 :         throw uno::RuntimeException();
    2898                 :          4 : }
    2899                 :            : 
    2900                 :          4 : sal_Bool SwXTextTable::isNotANumber(double nNumber) throw( uno::RuntimeException )
    2901                 :            : {
    2902                 :            :     // We use DBL_MIN because starcalc does (which uses it because chart
    2903                 :            :     // wants it that way!)
    2904                 :          4 :     return ( nNumber == DBL_MIN );
    2905                 :            : }
    2906                 :            : 
    2907                 :          2 : double SwXTextTable::getNotANumber(void) throw( uno::RuntimeException )
    2908                 :            : {
    2909                 :            :     // We use DBL_MIN because starcalc does (which uses it because chart
    2910                 :            :     // wants it that way!)
    2911                 :          2 :     return DBL_MIN;
    2912                 :            : }
    2913                 :            : 
    2914                 :          2 : uno::Sequence< beans::PropertyValue > SwXTextTable::createSortDescriptor(void)
    2915                 :            :     throw( uno::RuntimeException )
    2916                 :            : {
    2917         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    2918                 :            : 
    2919 [ +  - ][ +  - ]:          2 :     return SwUnoCursorHelper::CreateSortDescriptor(true);
    2920                 :            : }
    2921                 :            : 
    2922                 :          8 : void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
    2923                 :            :     throw( uno::RuntimeException )
    2924                 :            : {
    2925         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    2926         [ +  - ]:          8 :     SwSortOptions aSortOpt;
    2927                 :          8 :     SwFrmFmt* pFmt = GetFrmFmt();
    2928 [ +  - ][ +  - ]:         16 :     if(pFmt &&
                 [ +  - ]
    2929         [ +  - ]:          8 :         SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
    2930                 :            :     {
    2931         [ +  - ]:          8 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2932         [ +  - ]:          8 :         SwSelBoxes aBoxes;
    2933                 :          8 :         const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
    2934         [ +  + ]:        104 :         for( sal_uInt16 n = 0; n < rTBoxes.size(); ++n )
    2935                 :            :         {
    2936         [ +  - ]:         96 :             SwTableBox* pBox = rTBoxes[ n ];
    2937         [ +  - ]:         96 :             aBoxes.insert( pBox );
    2938                 :            :         }
    2939         [ +  - ]:          8 :         UnoActionContext aContext( pFmt->GetDoc() );
    2940 [ +  - ][ +  - ]:          8 :         pFmt->GetDoc()->SortTbl(aBoxes, aSortOpt);
    2941 [ +  - ][ +  - ]:          8 :     }
    2942                 :          8 : }
    2943                 :            : 
    2944                 :          0 : void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumentException, uno::RuntimeException )
    2945                 :            : {
    2946         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    2947                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    2948         [ #  # ]:          0 :     if(pFmt)
    2949                 :            :     {
    2950         [ #  # ]:          0 :         SwTable* pTable = SwTable::FindTable( pFmt );
    2951 [ #  # ][ #  # ]:          0 :         if(!pTable->IsTblComplex())
    2952                 :            :         {
    2953                 :            : 
    2954         [ #  # ]:          0 :             String sAutoFmtName(aName);
    2955         [ #  # ]:          0 :             SwTableAutoFmtTbl aAutoFmtTbl;
    2956         [ #  # ]:          0 :             aAutoFmtTbl.Load();
    2957 [ #  # ][ #  # ]:          0 :             for (sal_uInt16 i = aAutoFmtTbl.size(); i;)
    2958 [ #  # ][ #  # ]:          0 :                 if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
                 [ #  # ]
    2959                 :            :                 {
    2960         [ #  # ]:          0 :                     SwSelBoxes aBoxes;
    2961                 :          0 :                     const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
    2962         [ #  # ]:          0 :                     for( sal_uInt16 n = 0; n < rTBoxes.size(); ++n )
    2963                 :            :                     {
    2964         [ #  # ]:          0 :                         SwTableBox* pBox = rTBoxes[ n ];
    2965         [ #  # ]:          0 :                         aBoxes.insert( pBox );
    2966                 :            :                     }
    2967         [ #  # ]:          0 :                     UnoActionContext aContext( pFmt->GetDoc() );
    2968 [ #  # ][ #  # ]:          0 :                     pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] );
    2969         [ #  # ]:          0 :                     break;
    2970 [ #  # ][ #  # ]:          0 :                 }
    2971                 :            :         }
    2972                 :            :     }
    2973                 :            :     else
    2974 [ #  # ][ #  # ]:          0 :         throw uno::RuntimeException();
    2975                 :          0 : }
    2976                 :            : 
    2977                 :        112 : uno::Reference< beans::XPropertySetInfo >  SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException )
    2978                 :            : {
    2979 [ +  + ][ +  - ]:        112 :     static uno::Reference< beans::XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
         [ +  - ][ #  # ]
    2980                 :        112 :     return xRef;
    2981                 :            : }
    2982                 :            : 
    2983                 :        653 : void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
    2984                 :            :                                                     const uno::Any& aValue)
    2985                 :            :         throw( beans::UnknownPropertyException, beans::PropertyVetoException,
    2986                 :            :                 lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
    2987                 :            : {
    2988         [ +  - ]:        653 :     SolarMutexGuard aGuard;
    2989                 :        653 :     SwFrmFmt* pFmt = GetFrmFmt();
    2990         [ -  + ]:        653 :     if(!aValue.hasValue())
    2991         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
    2992                 :            :     const SfxItemPropertySimpleEntry* pEntry =
    2993         [ +  - ]:        653 :                                 m_pPropSet->getPropertyMap().getByName(rPropertyName);
    2994         [ +  + ]:        653 :     if( !pEntry )
    2995         [ +  - ]:        120 :         throw lang::IllegalArgumentException();
    2996         [ +  + ]:        533 :     if(pFmt)
    2997                 :            :     {
    2998         [ +  + ]:        531 :         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    2999 [ +  - ][ +  - ]:          8 :             throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ +  - ]
    3000                 :            : 
    3001         [ +  + ]:        523 :         if(0xFF == pEntry->nMemberId)
    3002                 :            :         {
    3003         [ +  - ]:        165 :             lcl_SetSpecialProperty(pFmt, pEntry, aValue);
    3004                 :            :         }
    3005                 :            :         else
    3006                 :            :         {
    3007   [ -  +  +  +  :        358 :             switch(pEntry->nWID)
             +  +  -  + ]
    3008                 :            :             {
    3009                 :            :                 case UNO_NAME_TABLE_NAME :
    3010                 :            :                 {
    3011                 :          0 :                     ::rtl::OUString sName;
    3012                 :          0 :                     aValue >>= sName;
    3013         [ #  # ]:          0 :                     setName( sName );
    3014                 :            :                 }
    3015                 :          0 :                 break;
    3016                 :            :                 case FN_UNO_RANGE_ROW_LABEL:
    3017                 :            :                 {
    3018                 :         14 :                     sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
    3019         [ +  - ]:         14 :                     if(bFirstRowAsLabel != bTmp)
    3020                 :            :                     {
    3021         [ +  - ]:         14 :                         aChartLstnrCntnr.ChartDataChanged();
    3022                 :         14 :                         bFirstRowAsLabel = bTmp;
    3023                 :            :                     }
    3024                 :            :                 }
    3025                 :         14 :                 break;
    3026                 :            :                 case FN_UNO_RANGE_COL_LABEL:
    3027                 :            :                 {
    3028                 :         14 :                     sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
    3029         [ +  - ]:         14 :                     if(bFirstColumnAsLabel != bTmp)
    3030                 :            :                     {
    3031         [ +  - ]:         14 :                         aChartLstnrCntnr.ChartDataChanged();
    3032                 :         14 :                         bFirstColumnAsLabel = bTmp;
    3033                 :            :                     }
    3034                 :            :                 }
    3035                 :         14 :                 break;
    3036                 :            :                 case FN_UNO_TABLE_BORDER:
    3037                 :            :                 case FN_UNO_TABLE_BORDER2:
    3038                 :            :                 {
    3039                 :         78 :                     table::TableBorder oldBorder;
    3040                 :         78 :                     table::TableBorder2 aBorder;
    3041         [ +  - ]:         78 :                     SvxBorderLine aTopLine;
    3042         [ +  - ]:         78 :                     SvxBorderLine aBottomLine;
    3043         [ +  - ]:         78 :                     SvxBorderLine aLeftLine;
    3044         [ +  - ]:         78 :                     SvxBorderLine aRightLine;
    3045         [ +  - ]:         78 :                     SvxBorderLine aHoriLine;
    3046         [ +  - ]:         78 :                     SvxBorderLine aVertLine;
    3047 [ +  - ][ +  + ]:         78 :                     if (aValue >>= oldBorder)
    3048                 :            :                     {
    3049                 :         76 :                         aBorder.IsTopLineValid = oldBorder.IsTopLineValid;
    3050                 :         76 :                         aBorder.IsBottomLineValid = oldBorder.IsBottomLineValid;
    3051                 :         76 :                         aBorder.IsLeftLineValid = oldBorder.IsLeftLineValid;
    3052                 :         76 :                         aBorder.IsRightLineValid = oldBorder.IsRightLineValid;
    3053                 :         76 :                         aBorder.IsHorizontalLineValid = oldBorder.IsHorizontalLineValid;
    3054                 :         76 :                         aBorder.IsVerticalLineValid = oldBorder.IsVerticalLineValid;
    3055                 :         76 :                         aBorder.Distance = oldBorder.Distance;
    3056                 :         76 :                         aBorder.IsDistanceValid = oldBorder.IsDistanceValid;
    3057                 :            :                         lcl_LineToSvxLine(
    3058         [ +  - ]:         76 :                                 oldBorder.TopLine, aTopLine);
    3059                 :            :                         lcl_LineToSvxLine(
    3060         [ +  - ]:         76 :                                 oldBorder.BottomLine, aBottomLine);
    3061                 :            :                         lcl_LineToSvxLine(
    3062         [ +  - ]:         76 :                                 oldBorder.LeftLine, aLeftLine);
    3063                 :            :                         lcl_LineToSvxLine(
    3064         [ +  - ]:         76 :                                 oldBorder.RightLine, aRightLine);
    3065                 :            :                         lcl_LineToSvxLine(
    3066         [ +  - ]:         76 :                                 oldBorder.HorizontalLine, aHoriLine);
    3067                 :            :                         lcl_LineToSvxLine(
    3068         [ +  - ]:         76 :                                 oldBorder.VerticalLine, aVertLine);
    3069                 :            :                     }
    3070 [ +  - ][ +  - ]:          2 :                     else if (aValue >>= aBorder)
    3071                 :            :                     {
    3072                 :            :                         SvxBoxItem::LineToSvxLine(
    3073         [ +  - ]:          2 :                                 aBorder.TopLine, aTopLine, true);
    3074                 :            :                         SvxBoxItem::LineToSvxLine(
    3075         [ +  - ]:          2 :                                 aBorder.BottomLine, aBottomLine, true);
    3076                 :            :                         SvxBoxItem::LineToSvxLine(
    3077         [ +  - ]:          2 :                                 aBorder.LeftLine, aLeftLine, true);
    3078                 :            :                         SvxBoxItem::LineToSvxLine(
    3079         [ +  - ]:          2 :                                 aBorder.RightLine, aRightLine, true);
    3080                 :            :                         SvxBoxItem::LineToSvxLine(
    3081         [ +  - ]:          2 :                                 aBorder.HorizontalLine, aHoriLine, true);
    3082                 :            :                         SvxBoxItem::LineToSvxLine(
    3083         [ +  - ]:          2 :                                 aBorder.VerticalLine, aVertLine, true);
    3084                 :            :                     }
    3085                 :            :                     else
    3086                 :            :                     {
    3087                 :            :                         break; // something else
    3088                 :            :                     }
    3089                 :         78 :                     SwDoc* pDoc = pFmt->GetDoc();
    3090         [ +  - ]:         78 :                     SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt );
    3091                 :            :                     // tables without layout (invisible header/footer?)
    3092         [ +  + ]:         78 :                     if (!pFrm)
    3093                 :            :                     {
    3094                 :            :                         break;
    3095                 :            :                     }
    3096         [ +  - ]:          6 :                     lcl_FormatTable(pFmt);
    3097         [ +  - ]:          6 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3098                 :          6 :                     SwTableLines &rLines = pTable->GetTabLines();
    3099                 :            : 
    3100                 :            : 
    3101                 :            :                     // hier muessen die Actions aufgehoben werden
    3102         [ +  - ]:          6 :                     UnoActionRemoveContext aRemoveContext(pDoc);
    3103         [ +  - ]:          6 :                     const SwTableBox* pTLBox = lcl_FindCornerTableBox(rLines, true);
    3104                 :          6 :                     const SwStartNode* pSttNd = pTLBox->GetSttNd();
    3105         [ +  - ]:          6 :                     SwPosition aPos(*pSttNd);
    3106                 :            :                     // set cursor to top left cell
    3107         [ +  - ]:          6 :                     SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
    3108         [ +  - ]:          6 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3109                 :          6 :                     pUnoCrsr->SetRemainInSection( sal_False );
    3110                 :            : 
    3111                 :            : 
    3112                 :            : 
    3113         [ +  - ]:          6 :                     const SwTableBox* pBRBox = lcl_FindCornerTableBox(rLines, false);
    3114         [ +  - ]:          6 :                     pUnoCrsr->SetMark();
    3115         [ +  - ]:          6 :                     pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
    3116         [ +  - ]:          6 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3117         [ -  + ]:          6 :                     SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    3118         [ +  - ]:          6 :                     pCrsr->MakeBoxSels();
    3119                 :            : 
    3120                 :          6 :                     SfxItemSet aSet(pDoc->GetAttrPool(),
    3121                 :            :                                     RES_BOX, RES_BOX,
    3122                 :            :                                     SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
    3123         [ +  - ]:          6 :                                     0);
    3124                 :            : 
    3125         [ +  - ]:          6 :                     SvxBoxItem aBox( RES_BOX );
    3126         [ +  - ]:          6 :                     SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
    3127                 :            : 
    3128 [ +  + ][ +  - ]:          6 :                     aBox.SetLine(aTopLine.isEmpty() ? 0 : &aTopLine, BOX_LINE_TOP);
    3129                 :          6 :                     aBoxInfo.SetValid(VALID_TOP, aBorder.IsTopLineValid);
    3130                 :            : 
    3131 [ +  - ][ +  + ]:          6 :                     aBox.SetLine(aBottomLine.isEmpty() ? 0 : &aBottomLine, BOX_LINE_BOTTOM);
    3132                 :          6 :                     aBoxInfo.SetValid(VALID_BOTTOM, aBorder.IsBottomLineValid);
    3133                 :            : 
    3134 [ +  - ][ +  + ]:          6 :                     aBox.SetLine(aLeftLine.isEmpty() ? 0 : &aLeftLine, BOX_LINE_LEFT);
    3135                 :          6 :                     aBoxInfo.SetValid(VALID_LEFT, aBorder.IsLeftLineValid);
    3136                 :            : 
    3137 [ +  - ][ +  + ]:          6 :                     aBox.SetLine(aRightLine.isEmpty() ? 0 : &aRightLine, BOX_LINE_RIGHT);
    3138                 :          6 :                     aBoxInfo.SetValid(VALID_RIGHT, aBorder.IsRightLineValid);
    3139                 :            : 
    3140 [ +  - ][ +  + ]:          6 :                     aBoxInfo.SetLine(aHoriLine.isEmpty() ? 0 : &aHoriLine, BOXINFO_LINE_HORI);
    3141                 :          6 :                     aBoxInfo.SetValid(VALID_HORI, aBorder.IsHorizontalLineValid);
    3142                 :            : 
    3143 [ +  - ][ +  + ]:          6 :                     aBoxInfo.SetLine(aVertLine.isEmpty() ? 0 : &aVertLine, BOXINFO_LINE_VERT);
    3144                 :          6 :                     aBoxInfo.SetValid(VALID_VERT, aBorder.IsVerticalLineValid);
    3145                 :            : 
    3146         [ +  - ]:          6 :                     aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(aBorder.Distance));
    3147                 :          6 :                     aBoxInfo.SetValid(VALID_DISTANCE, aBorder.IsDistanceValid);
    3148                 :            : 
    3149         [ +  - ]:          6 :                     aSet.Put(aBox);
    3150         [ +  - ]:          6 :                     aSet.Put(aBoxInfo);
    3151                 :            : 
    3152         [ +  - ]:          6 :                     pDoc->SetTabBorders(*pCrsr, aSet);
    3153 [ +  - ][ +  - ]:          6 :                     delete pUnoCrsr;
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3154                 :            :                 }
    3155                 :         78 :                 break;
    3156                 :            :                 case FN_UNO_TABLE_BORDER_DISTANCES:
    3157                 :            :                 {
    3158                 :         72 :                     table::TableBorderDistances aTableBorderDistances;
    3159 [ +  - ][ -  + ]:         72 :                     if( !(aValue >>= aTableBorderDistances) ||
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
                 [ +  - ]
    3160                 :         72 :                         (!aTableBorderDistances.IsLeftDistanceValid &&
    3161                 :          0 :                         !aTableBorderDistances.IsRightDistanceValid &&
    3162                 :          0 :                         !aTableBorderDistances.IsTopDistanceValid &&
    3163                 :          0 :                         !aTableBorderDistances.IsBottomDistanceValid ))
    3164                 :            :                         break;
    3165                 :            : 
    3166                 :         72 :                     sal_uInt16 nLeftDistance =     MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.LeftDistance);
    3167                 :         72 :                     sal_uInt16 nRightDistance =    MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.RightDistance);
    3168                 :         72 :                     sal_uInt16 nTopDistance =      MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.TopDistance);
    3169                 :         72 :                     sal_uInt16 nBottomDistance =   MM100_TO_TWIP_UNSIGNED( aTableBorderDistances.BottomDistance);
    3170                 :         72 :                     SwDoc* pDoc = pFmt->GetDoc();
    3171         [ +  - ]:         72 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3172                 :         72 :                     SwTableLines &rLines = pTable->GetTabLines();
    3173 [ +  - ][ +  - ]:         72 :                     pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL);
    3174         [ +  + ]:        151 :                     for(sal_uInt16 i = 0; i < rLines.size(); i++)
    3175                 :            :                     {
    3176                 :         79 :                         SwTableLine* pLine = rLines[i];
    3177                 :         79 :                         SwTableBoxes& rBoxes = pLine->GetTabBoxes();
    3178         [ +  + ]:        515 :                         for(sal_uInt16 k = 0; k < rBoxes.size(); k++)
    3179                 :            :                         {
    3180                 :        436 :                             SwTableBox* pBox = rBoxes[k];
    3181                 :        436 :                             const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
    3182         [ +  - ]:        436 :                             const SvxBoxItem& rBox = pBoxFmt->GetBox();
    3183 [ +  - ][ -  + ]:        872 :                             if(
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ +  - ]
    3184         [ +  - ]:        436 :                                 (aTableBorderDistances.IsLeftDistanceValid && nLeftDistance !=   rBox.GetDistance( BOX_LINE_LEFT )) ||
    3185         [ #  # ]:          0 :                                 (aTableBorderDistances.IsRightDistanceValid && nRightDistance !=  rBox.GetDistance( BOX_LINE_RIGHT )) ||
    3186         [ #  # ]:          0 :                                 (aTableBorderDistances.IsTopDistanceValid && nTopDistance !=    rBox.GetDistance( BOX_LINE_TOP )) ||
    3187         [ #  # ]:          0 :                                 (aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM )))
    3188                 :            :                             {
    3189         [ +  - ]:        436 :                                 SvxBoxItem aSetBox( rBox );
    3190         [ +  - ]:        436 :                                 SwFrmFmt* pSetBoxFmt = pBox->ClaimFrmFmt();
    3191         [ +  - ]:        436 :                                 if( aTableBorderDistances.IsLeftDistanceValid )
    3192         [ +  - ]:        436 :                                     aSetBox.SetDistance( nLeftDistance, BOX_LINE_LEFT );
    3193         [ +  - ]:        436 :                                 if( aTableBorderDistances.IsRightDistanceValid )
    3194         [ +  - ]:        436 :                                     aSetBox.SetDistance( nRightDistance, BOX_LINE_RIGHT );
    3195         [ +  - ]:        436 :                                 if( aTableBorderDistances.IsTopDistanceValid )
    3196         [ +  - ]:        436 :                                     aSetBox.SetDistance( nTopDistance, BOX_LINE_TOP );
    3197         [ +  - ]:        436 :                                 if( aTableBorderDistances.IsBottomDistanceValid )
    3198         [ +  - ]:        436 :                                     aSetBox.SetDistance( nBottomDistance, BOX_LINE_BOTTOM );
    3199 [ +  - ][ +  - ]:        436 :                                 pDoc->SetAttr( aSetBox, *pSetBoxFmt );
    3200                 :            :                             }
    3201                 :            :                         }
    3202                 :            :                     }
    3203 [ +  - ][ +  - ]:         72 :                     pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
    3204                 :            :                 }
    3205                 :         72 :                 break;
    3206                 :            :                 case FN_UNO_TABLE_COLUMN_SEPARATORS:
    3207                 :            :                 {
    3208         [ +  - ]:          2 :                     UnoActionContext aContext(pFmt->GetDoc());
    3209         [ +  - ]:          2 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3210 [ +  - ][ +  - ]:          2 :                     lcl_SetTblSeparators(aValue, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False, pFmt->GetDoc());
    3211                 :            :                 }
    3212                 :          2 :                 break;
    3213                 :          0 :                 case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:/*_readonly_*/ break;
    3214                 :            :                 default:
    3215                 :            :                 {
    3216         [ +  - ]:        178 :                     SwAttrSet aSet(pFmt->GetAttrSet());
    3217         [ +  - ]:        178 :                     m_pPropSet->setPropertyValue(*pEntry, aValue, aSet);
    3218 [ +  - ][ +  - ]:        523 :                     pFmt->GetDoc()->SetAttr(aSet, *pFmt);
    3219                 :            :                 }
    3220                 :            :             }
    3221                 :            :         }
    3222                 :            :     }
    3223         [ +  - ]:          2 :     else if(bIsDescriptor)
    3224                 :            :     {
    3225         [ +  - ]:          2 :         String aPropertyName(rPropertyName);
    3226 [ +  - ][ +  - ]:          2 :         pTableProps->SetProperty( pEntry->nWID, pEntry->nMemberId, aValue);
    3227                 :            :     }
    3228                 :            :     else
    3229 [ #  # ][ +  - ]:        653 :         throw uno::RuntimeException();
    3230                 :        525 : }
    3231                 :            : 
    3232                 :        127 : uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3233                 :            : {
    3234         [ +  - ]:        127 :     SolarMutexGuard aGuard;
    3235                 :        127 :     uno::Any aRet;
    3236                 :        127 :     SwFrmFmt* pFmt = GetFrmFmt();
    3237                 :            :     const SfxItemPropertySimpleEntry* pEntry =
    3238         [ +  - ]:        127 :                                 m_pPropSet->getPropertyMap().getByName(rPropertyName);
    3239         [ +  - ]:        127 :     if(pFmt)
    3240                 :            :     {
    3241         [ -  + ]:        127 :         if (!pEntry)
    3242 [ #  # ][ #  # ]:          0 :             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    3243                 :            : 
    3244         [ +  + ]:        127 :         if(0xFF == pEntry->nMemberId)
    3245                 :            :         {
    3246         [ +  - ]:         24 :             aRet = lcl_GetSpecialProperty(pFmt, pEntry );
    3247                 :            :         }
    3248                 :            :         else
    3249                 :            :         {
    3250   [ -  +  +  +  :        103 :             switch(pEntry->nWID)
          +  -  +  +  -  
                   -  + ]
    3251                 :            :             {
    3252                 :            :                 case UNO_NAME_TABLE_NAME:
    3253                 :            :                 {
    3254 [ #  # ][ #  # ]:          0 :                     aRet <<= getName();
    3255                 :            :                 }
    3256                 :          0 :                 break;
    3257                 :            :                 case  FN_UNO_ANCHOR_TYPES:
    3258                 :            :                 case  FN_UNO_TEXT_WRAP:
    3259                 :            :                 case  FN_UNO_ANCHOR_TYPE:
    3260                 :            :                     ::sw::GetDefaultTextContentValue(
    3261         [ +  - ]:          8 :                             aRet, OUString(), pEntry->nWID);
    3262                 :          8 :                 break;
    3263                 :            :                 case FN_UNO_RANGE_ROW_LABEL:
    3264                 :            :                 {
    3265                 :          6 :                     sal_Bool bTemp = bFirstRowAsLabel;
    3266         [ +  - ]:          6 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    3267                 :            :                 }
    3268                 :          6 :                 break;
    3269                 :            :                 case FN_UNO_RANGE_COL_LABEL:
    3270                 :            :                 {
    3271                 :          6 :                     sal_Bool bTemp = bFirstColumnAsLabel;
    3272         [ +  - ]:          6 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    3273                 :            :                 }
    3274                 :          6 :                 break;
    3275                 :            :                 case FN_UNO_TABLE_BORDER:
    3276                 :            :                 case FN_UNO_TABLE_BORDER2:
    3277                 :            :                 {
    3278                 :         15 :                     SwDoc* pDoc = pFmt->GetDoc();
    3279         [ +  - ]:         15 :                     SwFrm* pFrm = SwIterator<SwFrm,SwFmt>::FirstElement( *pFmt );
    3280                 :            :                     // tables without layout (invisible header/footer?)
    3281         [ +  - ]:         15 :                     if (!pFrm)
    3282                 :            :                     {
    3283                 :            :                         break;
    3284                 :            :                     }
    3285         [ +  - ]:         15 :                     lcl_FormatTable(pFmt);
    3286         [ +  - ]:         15 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3287                 :         15 :                     SwTableLines &rLines = pTable->GetTabLines();
    3288                 :            : 
    3289                 :            :                     // hier muessen die Actions aufgehoben werden
    3290         [ +  - ]:         15 :                     UnoActionRemoveContext aRemoveContext(pDoc);
    3291         [ +  - ]:         15 :                     const SwTableBox* pTLBox = lcl_FindCornerTableBox(rLines, true);
    3292                 :         15 :                     const SwStartNode* pSttNd = pTLBox->GetSttNd();
    3293         [ +  - ]:         15 :                     SwPosition aPos(*pSttNd);
    3294                 :            :                     // set cursor to top left cell
    3295         [ +  - ]:         15 :                     SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
    3296         [ +  - ]:         15 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3297                 :         15 :                     pUnoCrsr->SetRemainInSection( sal_False );
    3298                 :            : 
    3299         [ +  - ]:         15 :                     const SwTableBox* pBRBox = lcl_FindCornerTableBox(rLines, false);
    3300         [ +  - ]:         15 :                     pUnoCrsr->SetMark();
    3301                 :         15 :                     const SwStartNode* pLastNd = pBRBox->GetSttNd();
    3302         [ +  - ]:         15 :                     pUnoCrsr->GetPoint()->nNode = *pLastNd;
    3303                 :            : 
    3304         [ +  - ]:         15 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3305         [ -  + ]:         15 :                     SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    3306         [ +  - ]:         15 :                     pCrsr->MakeBoxSels();
    3307                 :            : 
    3308                 :         15 :                     SfxItemSet aSet(pDoc->GetAttrPool(),
    3309                 :            :                                     RES_BOX, RES_BOX,
    3310                 :            :                                     SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
    3311         [ +  - ]:         15 :                                     0);
    3312 [ +  - ][ +  - ]:         15 :                     aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER ));
                 [ +  - ]
    3313         [ +  - ]:         15 :                     pDoc->GetTabBorders(*pCrsr, aSet);
    3314                 :            :                     const SvxBoxInfoItem& rBoxInfoItem =
    3315         [ +  - ]:         15 :                         (const SvxBoxInfoItem&)aSet.Get(SID_ATTR_BORDER_INNER);
    3316         [ +  - ]:         15 :                     const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
    3317                 :            : 
    3318         [ +  + ]:         15 :                     if (FN_UNO_TABLE_BORDER == pEntry->nWID)
    3319                 :            :                     {
    3320                 :         11 :                         table::TableBorder aTableBorder;
    3321         [ +  - ]:         11 :                         aTableBorder.TopLine                = SvxBoxItem::SvxLineToLine(rBox.GetTop(), true);
    3322                 :         11 :                         aTableBorder.IsTopLineValid         = rBoxInfoItem.IsValid(VALID_TOP);
    3323         [ +  - ]:         11 :                         aTableBorder.BottomLine             = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), true);
    3324                 :         11 :                         aTableBorder.IsBottomLineValid      = rBoxInfoItem.IsValid(VALID_BOTTOM);
    3325         [ +  - ]:         11 :                         aTableBorder.LeftLine               = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), true);
    3326                 :         11 :                         aTableBorder.IsLeftLineValid        = rBoxInfoItem.IsValid(VALID_LEFT);
    3327         [ +  - ]:         11 :                         aTableBorder.RightLine              = SvxBoxItem::SvxLineToLine(rBox.GetRight(), true);
    3328                 :         11 :                         aTableBorder.IsRightLineValid       = rBoxInfoItem.IsValid(VALID_RIGHT );
    3329         [ +  - ]:         11 :                         aTableBorder.HorizontalLine         = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), true);
    3330                 :         11 :                         aTableBorder.IsHorizontalLineValid  = rBoxInfoItem.IsValid(VALID_HORI);
    3331         [ +  - ]:         11 :                         aTableBorder.VerticalLine           = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true);
    3332                 :         11 :                         aTableBorder.IsVerticalLineValid    = rBoxInfoItem.IsValid(VALID_VERT);
    3333         [ +  - ]:         11 :                         aTableBorder.Distance               = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() );
    3334                 :         11 :                         aTableBorder.IsDistanceValid        = rBoxInfoItem.IsValid(VALID_DISTANCE);
    3335         [ +  - ]:         11 :                         aRet <<= aTableBorder;
    3336                 :            :                     }
    3337                 :            :                     else
    3338                 :            :                     {
    3339                 :          4 :                         table::TableBorder2 aTableBorder;
    3340         [ +  - ]:          4 :                         aTableBorder.TopLine                = SvxBoxItem::SvxLineToLine(rBox.GetTop(), true);
    3341                 :          4 :                         aTableBorder.IsTopLineValid         = rBoxInfoItem.IsValid(VALID_TOP);
    3342         [ +  - ]:          4 :                         aTableBorder.BottomLine             = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), true);
    3343                 :          4 :                         aTableBorder.IsBottomLineValid      = rBoxInfoItem.IsValid(VALID_BOTTOM);
    3344         [ +  - ]:          4 :                         aTableBorder.LeftLine               = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), true);
    3345                 :          4 :                         aTableBorder.IsLeftLineValid        = rBoxInfoItem.IsValid(VALID_LEFT);
    3346         [ +  - ]:          4 :                         aTableBorder.RightLine              = SvxBoxItem::SvxLineToLine(rBox.GetRight(), true);
    3347                 :          4 :                         aTableBorder.IsRightLineValid       = rBoxInfoItem.IsValid(VALID_RIGHT );
    3348         [ +  - ]:          4 :                         aTableBorder.HorizontalLine         = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), true);
    3349                 :          4 :                         aTableBorder.IsHorizontalLineValid  = rBoxInfoItem.IsValid(VALID_HORI);
    3350         [ +  - ]:          4 :                         aTableBorder.VerticalLine           = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), true);
    3351                 :          4 :                         aTableBorder.IsVerticalLineValid    = rBoxInfoItem.IsValid(VALID_VERT);
    3352         [ +  - ]:          4 :                         aTableBorder.Distance               = TWIP_TO_MM100_UNSIGNED( rBox.GetDistance() );
    3353                 :          4 :                         aTableBorder.IsDistanceValid        = rBoxInfoItem.IsValid(VALID_DISTANCE);
    3354         [ +  - ]:          4 :                         aRet <<= aTableBorder;
    3355                 :            :                     }
    3356 [ +  - ][ +  - ]:         15 :                     delete pUnoCrsr;
         [ +  - ][ +  - ]
                 [ +  - ]
    3357                 :            :                 }
    3358                 :         15 :                 break;
    3359                 :            :                 case FN_UNO_TABLE_BORDER_DISTANCES :
    3360                 :            :                 {
    3361                 :          0 :                     table::TableBorderDistances aTableBorderDistances( 0, sal_True, 0, sal_True, 0, sal_True, 0, sal_True ) ;
    3362         [ #  # ]:          0 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3363                 :          0 :                     const SwTableLines &rLines = pTable->GetTabLines();
    3364                 :          0 :                     bool bFirst = true;
    3365                 :          0 :                     sal_uInt16 nLeftDistance = 0;
    3366                 :          0 :                     sal_uInt16 nRightDistance = 0;
    3367                 :          0 :                     sal_uInt16 nTopDistance = 0;
    3368                 :          0 :                     sal_uInt16 nBottomDistance = 0;
    3369                 :            : 
    3370         [ #  # ]:          0 :                     for(sal_uInt16 i = 0; i < rLines.size(); i++)
    3371                 :            :                     {
    3372                 :          0 :                         const SwTableLine* pLine = rLines[i];
    3373                 :          0 :                         const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
    3374         [ #  # ]:          0 :                         for(sal_uInt16 k = 0; k < rBoxes.size(); k++)
    3375                 :            :                         {
    3376                 :          0 :                             const SwTableBox* pBox = rBoxes[k];
    3377                 :          0 :                             SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
    3378         [ #  # ]:          0 :                             const SvxBoxItem& rBox = pBoxFmt->GetBox();
    3379         [ #  # ]:          0 :                             if( bFirst )
    3380                 :            :                             {
    3381         [ #  # ]:          0 :                                 nLeftDistance =     TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT   ));
    3382         [ #  # ]:          0 :                                 nRightDistance =    TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT  ));
    3383         [ #  # ]:          0 :                                 nTopDistance =      TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP    ));
    3384         [ #  # ]:          0 :                                 nBottomDistance =   TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM ));
    3385                 :          0 :                                 bFirst = false;
    3386                 :            :                             }
    3387                 :            :                             else
    3388                 :            :                             {
    3389 [ #  # ][ #  # ]:          0 :                                 if( aTableBorderDistances.IsLeftDistanceValid &&
                 [ #  # ]
    3390         [ #  # ]:          0 :                                     nLeftDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_LEFT   )))
    3391                 :          0 :                                     aTableBorderDistances.IsLeftDistanceValid = sal_False;
    3392 [ #  # ][ #  # ]:          0 :                                 if( aTableBorderDistances.IsRightDistanceValid &&
                 [ #  # ]
    3393         [ #  # ]:          0 :                                     nRightDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_RIGHT   )))
    3394                 :          0 :                                     aTableBorderDistances.IsRightDistanceValid = sal_False;
    3395 [ #  # ][ #  # ]:          0 :                                 if( aTableBorderDistances.IsTopDistanceValid &&
                 [ #  # ]
    3396         [ #  # ]:          0 :                                     nTopDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_TOP   )))
    3397                 :          0 :                                     aTableBorderDistances.IsTopDistanceValid = sal_False;
    3398 [ #  # ][ #  # ]:          0 :                                 if( aTableBorderDistances.IsBottomDistanceValid &&
                 [ #  # ]
    3399         [ #  # ]:          0 :                                     nBottomDistance != TWIP_TO_MM100_UNSIGNED( rBox.GetDistance( BOX_LINE_BOTTOM   )))
    3400                 :          0 :                                     aTableBorderDistances.IsBottomDistanceValid = sal_False;
    3401                 :            :                             }
    3402                 :            : 
    3403                 :            :                         }
    3404 [ #  # ][ #  # ]:          0 :                         if( !aTableBorderDistances.IsLeftDistanceValid &&
         [ #  # ][ #  # ]
    3405                 :          0 :                                 !aTableBorderDistances.IsRightDistanceValid &&
    3406                 :          0 :                                 !aTableBorderDistances.IsTopDistanceValid &&
    3407                 :          0 :                                 !aTableBorderDistances.IsBottomDistanceValid )
    3408                 :          0 :                             break;
    3409                 :            :                     }
    3410         [ #  # ]:          0 :                     if( aTableBorderDistances.IsLeftDistanceValid)
    3411                 :          0 :                         aTableBorderDistances.LeftDistance = nLeftDistance;
    3412         [ #  # ]:          0 :                     if( aTableBorderDistances.IsRightDistanceValid)
    3413                 :          0 :                         aTableBorderDistances.RightDistance  = nRightDistance;
    3414         [ #  # ]:          0 :                     if( aTableBorderDistances.IsTopDistanceValid)
    3415                 :          0 :                         aTableBorderDistances.TopDistance    = nTopDistance;
    3416         [ #  # ]:          0 :                     if( aTableBorderDistances.IsBottomDistanceValid)
    3417                 :          0 :                         aTableBorderDistances.BottomDistance = nBottomDistance;
    3418                 :            : 
    3419         [ #  # ]:          0 :                     aRet <<= aTableBorderDistances;
    3420                 :            :                 }
    3421                 :          0 :                 break;
    3422                 :            :                 case FN_UNO_TABLE_COLUMN_SEPARATORS:
    3423                 :            :                 {
    3424         [ +  - ]:          4 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3425         [ +  - ]:          4 :                     lcl_GetTblSeparators(aRet, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False);
    3426                 :            :                 }
    3427                 :          4 :                 break;
    3428                 :            :                 case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:
    3429         [ +  - ]:          4 :                     aRet <<= (sal_Int16) UNO_TABLE_COLUMN_SUM;
    3430                 :          4 :                 break;
    3431                 :            :                 case RES_ANCHOR:
    3432                 :            :                     //AnchorType ist readonly und maybevoid und wird nicht geliefert
    3433                 :          0 :                 break;
    3434                 :            :                 case FN_UNO_TEXT_SECTION:
    3435                 :            :                 {
    3436         [ #  # ]:          0 :                     SwTable* pTable = SwTable::FindTable( pFmt );
    3437         [ #  # ]:          0 :                     SwTableNode* pTblNode = pTable->GetTableNode();
    3438         [ #  # ]:          0 :                     SwSectionNode* pSectionNode =  pTblNode->FindSectionNode();
    3439         [ #  # ]:          0 :                     if(pSectionNode)
    3440                 :            :                     {
    3441                 :          0 :                         const SwSection& rSect = pSectionNode->GetSection();
    3442                 :            :                         uno::Reference< text::XTextSection >  xSect =
    3443         [ #  # ]:          0 :                                         SwXTextSections::GetObject( *rSect.GetFmt() );
    3444         [ #  # ]:          0 :                         aRet <<= xSect;
    3445                 :            :                     }
    3446                 :            :                 }
    3447                 :          0 :                 break;
    3448                 :            :                 default:
    3449                 :            :                 {
    3450                 :         60 :                     const SwAttrSet& rSet = pFmt->GetAttrSet();
    3451         [ +  - ]:        127 :                     m_pPropSet->getPropertyValue(*pEntry, rSet, aRet);
    3452                 :            :                 }
    3453                 :            :             }
    3454                 :            :         }
    3455                 :            :     }
    3456         [ #  # ]:          0 :     else if(bIsDescriptor)
    3457                 :            :     {
    3458                 :          0 :         const uno::Any* pAny = 0;
    3459         [ #  # ]:          0 :         String aPropertyName(rPropertyName);
    3460 [ #  # ][ #  # ]:          0 :         if(!pTableProps->GetProperty(pEntry->nWID, pEntry->nMemberId, pAny))
    3461         [ #  # ]:          0 :             throw lang::IllegalArgumentException();
    3462         [ #  # ]:          0 :         else if(pAny)
    3463         [ #  # ]:          0 :             aRet = *pAny;
    3464                 :            :     }
    3465                 :            :     else
    3466         [ #  # ]:          0 :         throw uno::RuntimeException();
    3467         [ +  - ]:        127 :     return aRet;
    3468                 :            : }
    3469                 :            : 
    3470                 :          0 : void SwXTextTable::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3471                 :            : {
    3472                 :            :     OSL_FAIL("not implemented");
    3473                 :          0 : }
    3474                 :            : 
    3475                 :          0 : void SwXTextTable::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3476                 :            : {
    3477                 :            :     OSL_FAIL("not implemented");
    3478                 :          0 : }
    3479                 :            : 
    3480                 :          0 : void SwXTextTable::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3481                 :            : {
    3482                 :            :     OSL_FAIL("not implemented");
    3483                 :          0 : }
    3484                 :            : 
    3485                 :          0 : void SwXTextTable::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3486                 :            : {
    3487                 :            :     OSL_FAIL("not implemented");
    3488                 :          0 : }
    3489                 :            : 
    3490                 :          6 : OUString SwXTextTable::getName(void) throw( uno::RuntimeException )
    3491                 :            : {
    3492         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    3493         [ +  - ]:          6 :     String sRet;
    3494                 :          6 :     SwFrmFmt* pFmt = GetFrmFmt();
    3495 [ #  # ][ -  + ]:          6 :     if(!pFmt && !bIsDescriptor)
    3496         [ #  # ]:          0 :         throw uno::RuntimeException();
    3497         [ +  - ]:          6 :     if(pFmt)
    3498                 :            :     {
    3499         [ +  - ]:          6 :         sRet = pFmt->GetName();
    3500                 :            :     }
    3501                 :            :     else
    3502         [ #  # ]:          0 :         sRet = m_sTableName;
    3503 [ +  - ][ +  - ]:          6 :     return sRet;
                 [ +  - ]
    3504                 :            : }
    3505                 :            : 
    3506                 :          8 : void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
    3507                 :            : {
    3508         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    3509                 :          8 :     SwFrmFmt* pFmt = GetFrmFmt();
    3510         [ +  - ]:          8 :     String sNewTblName(rName);
    3511         [ +  + ]:         32 :     if((!pFmt && !bIsDescriptor) ||
           [ +  -  +  - ]
         [ +  - ][ -  + ]
                 [ -  + ]
    3512                 :          8 :        !sNewTblName.Len() ||
    3513         [ +  - ]:          8 :        STRING_NOTFOUND != sNewTblName.Search('.') ||
    3514         [ +  - ]:          8 :        STRING_NOTFOUND != sNewTblName.Search(' ')  )
    3515         [ #  # ]:          0 :         throw uno::RuntimeException();
    3516                 :            : 
    3517         [ +  + ]:          8 :     if(pFmt)
    3518                 :            :     {
    3519         [ +  - ]:          4 :         const String aOldName( pFmt->GetName() );
    3520                 :          4 :         sal_Bool bNameFound = sal_False;
    3521                 :            :         SwFrmFmt* pTmpFmt;
    3522                 :          4 :         const SwFrmFmts* pTbl = pFmt->GetDoc()->GetTblFrmFmts();
    3523         [ +  + ]:          8 :         for( sal_uInt16 i = pTbl->size(); i; )
    3524 [ +  - ][ +  - ]:          8 :             if( !( pTmpFmt = (*pTbl)[ --i ] )->IsDefault() &&
         [ -  + ][ #  # ]
                 [ -  + ]
    3525         [ +  - ]:          4 :                 pTmpFmt->GetName() == sNewTblName &&
    3526         [ #  # ]:          0 :                             pFmt->GetDoc()->IsUsed( *pTmpFmt ))
    3527                 :            :             {
    3528                 :          0 :                 bNameFound = sal_True;
    3529                 :          0 :                 break;
    3530                 :            :             }
    3531                 :            : 
    3532         [ -  + ]:          4 :         if(bNameFound)
    3533                 :            :         {
    3534         [ #  # ]:          0 :             throw uno::RuntimeException();
    3535                 :            :         }
    3536         [ +  - ]:          4 :         pFmt->SetName( sNewTblName );
    3537                 :            : 
    3538                 :            : 
    3539                 :            :         SwStartNode *pStNd;
    3540 [ +  - ][ +  - ]:          4 :         SwNodeIndex aIdx( *pFmt->GetDoc()->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
    3541         [ -  + ]:          4 :         while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
    3542                 :            :         {
    3543         [ #  # ]:          0 :             aIdx++;
    3544                 :          0 :             SwNode *const pNd = & aIdx.GetNode();
    3545 [ #  # ][ #  # ]:          0 :             if ( pNd->IsOLENode() &&
                 [ #  # ]
    3546 [ #  # ][ #  # ]:          0 :                 aOldName == ((SwOLENode*)pNd)->GetChartTblName() )
    3547                 :            :             {
    3548 [ #  # ][ #  # ]:          0 :                 ((SwOLENode*)pNd)->SetChartTblName( sNewTblName );
    3549                 :            : 
    3550         [ #  # ]:          0 :                 ((SwOLENode*)pNd)->GetOLEObj();
    3551                 :            : 
    3552         [ #  # ]:          0 :                 SwTable* pTable = SwTable::FindTable( pFmt );
    3553                 :            :                 //TL_CHART2: chart needs to be notfied about name changes
    3554         [ #  # ]:          0 :                 pFmt->GetDoc()->UpdateCharts( pTable->GetFrmFmt()->GetName() );
    3555                 :            :             }
    3556         [ #  # ]:          0 :             aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
    3557                 :            :         }
    3558 [ +  - ][ +  - ]:          4 :         pFmt->GetDoc()->SetModified();
                 [ +  - ]
    3559                 :            :     }
    3560                 :            :     else
    3561 [ +  - ][ +  - ]:          8 :         m_sTableName = sNewTblName;
                 [ +  - ]
    3562                 :          8 : }
    3563                 :            : 
    3564                 :         30 : sal_uInt16 SwXTextTable::getRowCount(void)
    3565                 :            : {
    3566         [ +  - ]:         30 :     SolarMutexGuard aGuard;
    3567                 :         30 :     sal_Int16 nRet = 0;
    3568                 :         30 :     SwFrmFmt* pFmt = GetFrmFmt();
    3569         [ +  - ]:         30 :     if(pFmt)
    3570                 :            :     {
    3571         [ +  - ]:         30 :         SwTable* pTable = SwTable::FindTable( pFmt );
    3572 [ +  - ][ +  - ]:         30 :         if(!pTable->IsTblComplex())
    3573                 :            :         {
    3574                 :         30 :             nRet = pTable->GetTabLines().size();
    3575                 :            :         }
    3576                 :            :     }
    3577         [ +  - ]:         30 :     return nRet;
    3578                 :            : }
    3579                 :            : 
    3580                 :         30 : sal_uInt16 SwXTextTable::getColumnCount(void)
    3581                 :            : {
    3582         [ +  - ]:         30 :     SolarMutexGuard aGuard;
    3583                 :         30 :     SwFrmFmt* pFmt = GetFrmFmt();
    3584                 :         30 :     sal_Int16 nRet = 0;
    3585         [ +  - ]:         30 :     if(pFmt)
    3586                 :            :     {
    3587         [ +  - ]:         30 :         SwTable* pTable = SwTable::FindTable( pFmt );
    3588 [ +  - ][ +  - ]:         30 :         if(!pTable->IsTblComplex())
    3589                 :            :         {
    3590                 :         30 :             SwTableLines& rLines = pTable->GetTabLines();
    3591         [ +  - ]:         30 :             SwTableLine* pLine = rLines.front();
    3592                 :         30 :             nRet = pLine->GetTabBoxes().size();
    3593                 :            :         }
    3594                 :            :     }
    3595         [ +  - ]:         30 :     return nRet;
    3596                 :            : }
    3597                 :            : 
    3598                 :        414 : void SwXTextTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    3599                 :            : {
    3600         [ +  - ]:        478 :     if(pOld && pOld->Which() == RES_REMOVE_UNO_OBJECT &&
           [ +  +  +  - ]
                 [ +  + ]
    3601                 :         64 :         (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
    3602                 :         64 :             ((SwModify*)GetRegisteredIn())->Remove(this);
    3603                 :            :     else
    3604                 :        350 :         ClientModify(this, pOld, pNew);
    3605         [ +  + ]:        414 :     if(!GetRegisteredIn())
    3606                 :            :     {
    3607                 :         64 :         aLstnrCntnr.Disposing();
    3608                 :         64 :         aChartLstnrCntnr.Disposing();
    3609                 :            :     }
    3610                 :            :     else
    3611                 :        350 :         aChartLstnrCntnr.ChartDataChanged();
    3612                 :        414 : }
    3613                 :            : 
    3614                 :          0 : OUString SAL_CALL SwXTextTable::getImplementationName(void) throw( uno::RuntimeException )
    3615                 :            : {
    3616                 :          0 :     return C2U("SwXTextTable");
    3617                 :            : }
    3618                 :            : 
    3619                 :         79 : sal_Bool SwXTextTable::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    3620                 :            : {
    3621         [ +  - ]:         79 :     String sServiceName(rServiceName);
    3622         [ +  - ]:         79 :     return (sServiceName.EqualsAscii("com.sun.star.document.LinkTarget")  ||
    3623         [ +  - ]:         79 :             sServiceName.EqualsAscii("com.sun.star.text.TextTable")  ||
    3624         [ +  - ]:          2 :             sServiceName.EqualsAscii("com.sun.star.text.TextContent") ||
    3625 [ +  - ][ +  + ]:        160 :             sServiceName.EqualsAscii("com.sun.star.text.TextSortable"));
         [ -  + ][ #  # ]
         [ #  # ][ +  - ]
    3626                 :            : }
    3627                 :            : 
    3628                 :          0 : uno::Sequence< OUString > SwXTextTable::getSupportedServiceNames(void) throw( uno::RuntimeException )
    3629                 :            : {
    3630                 :          0 :     uno::Sequence< OUString > aRet(4);
    3631         [ #  # ]:          0 :     OUString* pArr = aRet.getArray();
    3632         [ #  # ]:          0 :     pArr[0] = C2U("com.sun.star.document.LinkTarget");
    3633         [ #  # ]:          0 :     pArr[1] = C2U("com.sun.star.text.TextTable");
    3634         [ #  # ]:          0 :     pArr[2] = C2U("com.sun.star.text.TextContent");
    3635         [ #  # ]:          0 :     pArr[2] = C2U("com.sun.star.text.TextSortable");
    3636                 :          0 :     return aRet;
    3637                 :            : }
    3638                 :            : 
    3639                 :            : namespace
    3640                 :            : {
    3641                 :            :     class theSwXCellRangeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXCellRangeUnoTunnelId > {};
    3642                 :            : }
    3643                 :            : 
    3644                 :          0 : const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId()
    3645                 :            : {
    3646                 :          0 :     return theSwXCellRangeUnoTunnelId::get().getSeq();
    3647                 :            : }
    3648                 :            : 
    3649                 :          0 : sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId )
    3650                 :            :     throw(uno::RuntimeException)
    3651                 :            : {
    3652   [ #  #  #  # ]:          0 :     if( rId.getLength() == 16
                 [ #  # ]
    3653                 :          0 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    3654                 :          0 :                                         rId.getConstArray(), 16 ) )
    3655                 :            :     {
    3656                 :          0 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    3657                 :            :     }
    3658                 :          0 :     return 0;
    3659                 :            : }
    3660                 :            : 
    3661 [ -  + ][ +  + ]:        888 : TYPEINIT1(SwXCellRange, SwClient);
    3662                 :            : 
    3663                 :          6 : OUString SwXCellRange::getImplementationName(void) throw( uno::RuntimeException )
    3664                 :            : {
    3665                 :          6 :     return C2U("SwXCellRange");
    3666                 :            : }
    3667                 :            : 
    3668                 :         10 : sal_Bool SwXCellRange::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    3669                 :            : {
    3670                 :            :     return
    3671                 :         20 :         rServiceName == "com.sun.star.text.CellRange" || rServiceName == "com.sun.star.style.CharacterProperties"
    3672                 :         14 :      || rServiceName == "com.sun.star.style.CharacterPropertiesAsian" || rServiceName == "com.sun.star.style.CharacterPropertiesComplex"
    3673                 :          8 :      || rServiceName == "com.sun.star.style.ParagraphProperties" || rServiceName == "com.sun.star.style.ParagraphPropertiesAsian"
    3674 [ +  - ][ +  -  :         42 :      || rServiceName == "com.sun.star.style.ParagraphPropertiesComplex";
          +  +  +  +  +  
             +  +  -  +  
                      + ]
    3675                 :            : }
    3676                 :            : 
    3677                 :          0 : uno::Sequence< OUString > SwXCellRange::getSupportedServiceNames(void) throw( uno::RuntimeException )
    3678                 :            : {
    3679                 :          0 :     uno::Sequence< OUString > aRet(7);
    3680         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    3681         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.CellRange");
    3682         [ #  # ]:          0 :      pArray[1] = C2U("com.sun.star.style.CharacterProperties");
    3683         [ #  # ]:          0 :     pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
    3684         [ #  # ]:          0 :     pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
    3685         [ #  # ]:          0 :     pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
    3686         [ #  # ]:          0 :     pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
    3687         [ #  # ]:          0 :     pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
    3688                 :          0 :     return aRet;
    3689                 :            : }
    3690                 :            : 
    3691                 :         14 : SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt,
    3692                 :            :     SwRangeDescriptor& rDesc)
    3693                 :            :     :
    3694                 :            :     SwClient(&rFrmFmt),
    3695                 :            :     aCursorDepend(this, pCrsr),
    3696                 :            :     aChartLstnrCntnr((cppu::OWeakObject*)this),
    3697                 :            :     aRgDesc(rDesc),
    3698         [ +  - ]:         14 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_RANGE)),
    3699                 :            :     pTblCrsr(pCrsr),
    3700                 :            :     bFirstRowAsLabel(sal_False),
    3701 [ +  - ][ +  - ]:         14 :     bFirstColumnAsLabel(sal_False)
                 [ +  - ]
    3702                 :            : {
    3703                 :         14 :     aRgDesc.Normalize();
    3704                 :         14 : }
    3705                 :            : 
    3706 [ +  - ][ +  - ]:         14 : SwXCellRange::~SwXCellRange()
                 [ +  - ]
    3707                 :            : {
    3708         [ +  - ]:         14 :     SolarMutexGuard aGuard;
    3709 [ -  + ][ #  # ]:         14 :     delete pTblCrsr;
                 [ +  - ]
    3710         [ -  + ]:         28 : }
    3711                 :            : 
    3712                 :        124 : uno::Reference< table::XCell >  SwXCellRange::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
    3713                 :            :     throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
    3714                 :            : {
    3715         [ +  - ]:        124 :     SolarMutexGuard aGuard;
    3716                 :        124 :     uno::Reference< table::XCell >  aRet;
    3717                 :        124 :     SwFrmFmt* pFmt = GetFrmFmt();
    3718         [ +  - ]:        124 :     if(pFmt)
    3719                 :            :     {
    3720 [ +  + ][ +  -  :        368 :         if(nColumn >= 0 && nRow >= 0 &&
             +  -  +  - ]
                 [ +  + ]
    3721                 :        244 :              getColumnCount() > nColumn && getRowCount() > nRow )
    3722                 :            :         {
    3723                 :            :             SwXCell* pXCell = lcl_CreateXCell(pFmt,
    3724         [ +  - ]:        122 :                     aRgDesc.nLeft + nColumn, aRgDesc.nTop + nRow);
    3725         [ +  - ]:        122 :             if(pXCell)
    3726 [ +  - ][ +  - ]:        122 :                 aRet = pXCell;
    3727                 :            :         }
    3728                 :            :     }
    3729         [ +  + ]:        124 :     if(!aRet.is())
    3730         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    3731         [ +  - ]:        124 :     return aRet;
    3732                 :            : }
    3733                 :            : 
    3734                 :          6 : uno::Reference< table::XCellRange >  SwXCellRange::getCellRangeByPosition(
    3735                 :            :         sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom)
    3736                 :            :     throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
    3737                 :            : {
    3738         [ +  - ]:          6 :     SolarMutexGuard aGuard;
    3739                 :          6 :     uno::Reference< table::XCellRange >  aRet;
    3740                 :          6 :     SwFrmFmt* pFmt = GetFrmFmt();
    3741 [ +  - ][ +  - ]:          6 :     if(pFmt && getColumnCount() > nRight && getRowCount() > nBottom &&
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
    3742                 :            :         nLeft <= nRight && nTop <= nBottom
    3743                 :            :         && nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
    3744                 :            :     {
    3745         [ +  - ]:          4 :         SwTable* pTable = SwTable::FindTable( pFmt );
    3746 [ +  - ][ +  - ]:          4 :         if(!pTable->IsTblComplex())
    3747                 :            :         {
    3748                 :            :             SwRangeDescriptor aNewDesc;
    3749                 :          4 :             aNewDesc.nTop    = nTop + aRgDesc.nTop;
    3750                 :          4 :             aNewDesc.nBottom = nBottom + aRgDesc.nTop;
    3751                 :          4 :             aNewDesc.nLeft   = nLeft + aRgDesc.nLeft;
    3752                 :          4 :             aNewDesc.nRight  = nRight + aRgDesc.nLeft;
    3753                 :          4 :             aNewDesc.Normalize();
    3754         [ +  - ]:          4 :             String sTLName = lcl_GetCellName(aNewDesc.nLeft, aNewDesc.nTop);
    3755         [ +  - ]:          4 :             String sBRName = lcl_GetCellName(aNewDesc.nRight, aNewDesc.nBottom);
    3756         [ +  - ]:          4 :             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    3757         [ +  - ]:          4 :             if(pTLBox)
    3758                 :            :             {
    3759                 :            :                 // hier muessen die Actions aufgehoben
    3760         [ +  - ]:          4 :                 UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
    3761                 :          4 :                 const SwStartNode* pSttNd = pTLBox->GetSttNd();
    3762         [ +  - ]:          4 :                 SwPosition aPos(*pSttNd);
    3763                 :            :                 // Cursor in die obere linke Zelle des Ranges setzen
    3764         [ +  - ]:          4 :                 SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    3765         [ +  - ]:          4 :                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3766                 :          4 :                 pUnoCrsr->SetRemainInSection( sal_False );
    3767         [ +  - ]:          4 :                 const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
    3768         [ +  - ]:          4 :                 if(pBRBox)
    3769                 :            :                 {
    3770         [ +  - ]:          4 :                     pUnoCrsr->SetMark();
    3771         [ +  - ]:          4 :                     pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
    3772         [ +  - ]:          4 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    3773         [ -  + ]:          4 :                     SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    3774         [ +  - ]:          4 :                     pCrsr->MakeBoxSels();
    3775                 :            :                     // pUnoCrsr wird uebergeben und nicht geloescht
    3776         [ +  - ]:          4 :                     SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, aNewDesc);
    3777 [ +  - ][ +  - ]:          4 :                     aRet = pCellRange;
    3778                 :            :                 }
    3779                 :            :                 else
    3780 [ #  # ][ #  # ]:          4 :                     delete pUnoCrsr;
         [ +  - ][ +  - ]
    3781 [ +  - ][ +  - ]:          4 :             }
    3782                 :            :         }
    3783                 :            :     }
    3784         [ +  + ]:          6 :     if(!aRet.is())
    3785         [ +  - ]:          2 :         throw lang::IndexOutOfBoundsException();
    3786         [ +  - ]:          6 :     return aRet;
    3787                 :            : 
    3788                 :            : }
    3789                 :            : 
    3790                 :          2 : uno::Reference< table::XCellRange >  SwXCellRange::getCellRangeByName(const OUString& rRange)
    3791                 :            :         throw( uno::RuntimeException )
    3792                 :            : {
    3793         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    3794         [ +  - ]:          2 :     String sRange(rRange);
    3795         [ +  - ]:          2 :     String sTLName(sRange.GetToken(0, ':'));
    3796         [ +  - ]:          2 :     String sBRName(sRange.GetToken(1, ':'));
    3797 [ +  - ][ -  + ]:          2 :     if(!sTLName.Len() || !sBRName.Len())
                 [ -  + ]
    3798         [ #  # ]:          0 :         throw uno::RuntimeException();
    3799                 :            :     SwRangeDescriptor aDesc;
    3800                 :          2 :     aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
    3801                 :          2 :     lcl_GetCellPosition( sTLName, aDesc.nLeft, aDesc.nTop );
    3802                 :          2 :     lcl_GetCellPosition( sBRName, aDesc.nRight, aDesc.nBottom );
    3803                 :          2 :     aDesc.Normalize();
    3804                 :            :     return getCellRangeByPosition(aDesc.nLeft - aRgDesc.nLeft, aDesc.nTop - aRgDesc.nTop,
    3805 [ +  - ][ +  - ]:          2 :                 aDesc.nRight - aRgDesc.nLeft, aDesc.nBottom - aRgDesc.nTop);
         [ +  - ][ +  - ]
                 [ +  - ]
    3806                 :            : }
    3807                 :            : 
    3808                 :        270 : uno::Reference< beans::XPropertySetInfo >  SwXCellRange::getPropertySetInfo(void) throw( uno::RuntimeException )
    3809                 :            : {
    3810 [ +  + ][ +  - ]:        270 :     static uno::Reference< beans::XPropertySetInfo >  xRef = m_pPropSet->getPropertySetInfo();
         [ +  - ][ #  # ]
    3811                 :        270 :     return xRef;
    3812                 :            : }
    3813                 :            : 
    3814                 :        126 : void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
    3815                 :            :     const uno::Any& aValue) throw( beans::UnknownPropertyException,
    3816                 :            :         beans::PropertyVetoException, lang::IllegalArgumentException,
    3817                 :            :             lang::WrappedTargetException, uno::RuntimeException )
    3818                 :            : {
    3819         [ +  - ]:        126 :     SolarMutexGuard aGuard;
    3820                 :        126 :     SwFrmFmt* pFmt = GetFrmFmt();
    3821         [ +  - ]:        126 :     if(pFmt)
    3822                 :            :     {
    3823                 :            :         /* ASK OLIVER
    3824                 :            :         lcl_FormatTable(pFmt);*/
    3825                 :            :         const SfxItemPropertySimpleEntry* pEntry =
    3826         [ +  - ]:        126 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    3827         [ +  - ]:        126 :         if(pEntry)
    3828                 :            :         {
    3829         [ -  + ]:        126 :             if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    3830 [ #  # ][ #  # ]:          0 :                 throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    3831                 :            : 
    3832                 :        126 :             SwDoc* pDoc = pTblCrsr->GetDoc();
    3833                 :            :             {
    3834                 :            :                 // remove actions to enable box selection
    3835 [ +  - ][ +  - ]:        126 :                 UnoActionRemoveContext aRemoveContext(pDoc);
    3836                 :            :             }
    3837         [ -  + ]:        126 :             SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
    3838         [ +  - ]:        126 :             pCrsr->MakeBoxSels();
    3839   [ -  -  -  -  :        126 :             switch(pEntry->nWID )
                -  -  + ]
    3840                 :            :             {
    3841                 :            :                 case FN_UNO_TABLE_CELL_BACKGROUND:
    3842                 :            :                 {
    3843         [ #  # ]:          0 :                     SvxBrushItem aBrush( RES_BACKGROUND );
    3844         [ #  # ]:          0 :                     pDoc->GetBoxAttr( *pTblCrsr, aBrush );
    3845         [ #  # ]:          0 :                     ((SfxPoolItem&)aBrush).PutValue(aValue, pEntry->nMemberId);
    3846 [ #  # ][ #  # ]:          0 :                     pDoc->SetBoxAttr( *pTblCrsr, aBrush );
    3847                 :            : 
    3848                 :            :                 }
    3849                 :          0 :                 break;
    3850                 :            :                 case RES_BOX :
    3851                 :            :                 {
    3852                 :          0 :                     SfxItemSet aSet(pDoc->GetAttrPool(),
    3853                 :            :                                     RES_BOX, RES_BOX,
    3854                 :            :                                     SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
    3855         [ #  # ]:          0 :                                     0);
    3856         [ #  # ]:          0 :                     SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
    3857                 :          0 :                     aBoxInfo.SetValid(0xff, sal_False);
    3858                 :          0 :                     sal_uInt8 nValid = 0;
    3859   [ #  #  #  #  :          0 :                     switch(pEntry->nMemberId & ~CONVERT_TWIPS)
                   #  # ]
    3860                 :            :                     {
    3861                 :          0 :                         case  LEFT_BORDER :             nValid = VALID_LEFT; break;
    3862                 :          0 :                         case  RIGHT_BORDER:             nValid = VALID_RIGHT; break;
    3863                 :          0 :                         case  TOP_BORDER  :             nValid = VALID_TOP; break;
    3864                 :          0 :                         case  BOTTOM_BORDER:            nValid = VALID_BOTTOM; break;
    3865                 :            :                         case  LEFT_BORDER_DISTANCE :
    3866                 :            :                         case  RIGHT_BORDER_DISTANCE:
    3867                 :            :                         case  TOP_BORDER_DISTANCE  :
    3868                 :            :                         case  BOTTOM_BORDER_DISTANCE:
    3869                 :          0 :                             nValid = VALID_DISTANCE;
    3870                 :          0 :                         break;
    3871                 :            :                     }
    3872                 :          0 :                     aBoxInfo.SetValid(nValid, sal_True);
    3873                 :            : 
    3874                 :            : 
    3875         [ #  # ]:          0 :                     aSet.Put(aBoxInfo);
    3876         [ #  # ]:          0 :                     pDoc->GetTabBorders(*pCrsr, aSet);
    3877                 :            : 
    3878         [ #  # ]:          0 :                     aSet.Put(aBoxInfo);
    3879 [ #  # ][ #  # ]:          0 :                     SvxBoxItem aBoxItem((const SvxBoxItem&)aSet.Get(RES_BOX));
    3880         [ #  # ]:          0 :                     ((SfxPoolItem&)aBoxItem).PutValue(aValue, pEntry->nMemberId);
    3881         [ #  # ]:          0 :                     aSet.Put(aBoxItem);
    3882 [ #  # ][ #  # ]:          0 :                     pDoc->SetTabBorders( *pTblCrsr, aSet );
         [ #  # ][ #  # ]
    3883                 :            :                 }
    3884                 :          0 :                 break;
    3885                 :            :                 case RES_BOXATR_FORMAT:
    3886                 :            :                 {
    3887         [ #  # ]:          0 :                     SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
    3888         [ #  # ]:          0 :                     ((SfxPoolItem&)aNumberFormat).PutValue(aValue, 0);
    3889 [ #  # ][ #  # ]:          0 :                     pDoc->SetBoxAttr( *pCrsr, aNumberFormat);
    3890                 :            :                 }
    3891                 :          0 :                 break;
    3892                 :            :                 case RES_VERT_ORIENT:
    3893                 :            :                 {
    3894                 :          0 :                     sal_Int16 nAlign = -1;
    3895                 :          0 :                     aValue >>= nAlign;
    3896 [ #  # ][ #  # ]:          0 :                     if( nAlign >= text::VertOrientation::NONE && nAlign <= text::VertOrientation::BOTTOM)
    3897         [ #  # ]:          0 :                         pDoc->SetBoxAlign( *pCrsr, nAlign );
    3898                 :            :                 }
    3899                 :          0 :                 break;
    3900                 :            :                 case FN_UNO_RANGE_ROW_LABEL:
    3901                 :            :                 {
    3902                 :          0 :                     sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
    3903         [ #  # ]:          0 :                     if(bFirstRowAsLabel != bTmp)
    3904                 :            :                     {
    3905         [ #  # ]:          0 :                         aChartLstnrCntnr.ChartDataChanged();
    3906                 :          0 :                         bFirstRowAsLabel = bTmp;
    3907                 :            :                     }
    3908                 :            :                 }
    3909                 :          0 :                 break;
    3910                 :            :                 case FN_UNO_RANGE_COL_LABEL:
    3911                 :            :                 {
    3912                 :          0 :                     sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
    3913         [ #  # ]:          0 :                     if(bFirstColumnAsLabel != bTmp)
    3914                 :            :                     {
    3915         [ #  # ]:          0 :                         aChartLstnrCntnr.ChartDataChanged();
    3916                 :          0 :                         bFirstColumnAsLabel = bTmp;
    3917                 :            :                     }
    3918                 :            :                 }
    3919                 :          0 :                 break;
    3920                 :            :                 default:
    3921                 :            :                 {
    3922         [ +  - ]:        126 :                     SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID );
    3923                 :        126 :                     SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(),
    3924         [ +  - ]:        126 :                             aItemSet);
    3925                 :            : 
    3926         [ +  + ]:        126 :                     if (!SwUnoCursorHelper::SetCursorPropertyValue(
    3927         [ +  - ]:        126 :                             *pEntry, aValue, pCrsr->GetSelRing(), aItemSet))
    3928                 :            :                     {
    3929         [ +  - ]:        124 :                         m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet);
    3930                 :            :                     }
    3931                 :        126 :                     SwUnoCursorHelper::SetCrsrAttr(pCrsr->GetSelRing(),
    3932 [ +  - ][ +  - ]:        126 :                             aItemSet, nsSetAttrMode::SETATTR_DEFAULT, true);
    3933                 :            :                 }
    3934                 :            :             }
    3935                 :            :         }
    3936                 :            :         else
    3937 [ #  # ][ #  # ]:          0 :             throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    3938         [ +  - ]:        126 :     }
    3939                 :        126 : }
    3940                 :            : 
    3941                 :        258 : uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3942                 :            : {
    3943         [ +  - ]:        258 :     SolarMutexGuard aGuard;
    3944                 :        258 :     uno::Any aRet;
    3945                 :        258 :     SwFrmFmt* pFmt = GetFrmFmt();
    3946         [ +  - ]:        258 :     if(pFmt)
    3947                 :            :     {
    3948                 :            :         /* ASK OLIVER
    3949                 :            :         lcl_FormatTable(pFmt);*/
    3950                 :            :         const SfxItemPropertySimpleEntry* pEntry =
    3951         [ +  - ]:        258 :                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
    3952         [ +  - ]:        258 :         if(pEntry)
    3953                 :            :         {
    3954   [ -  -  -  -  :        258 :             switch(pEntry->nWID )
             -  -  -  + ]
    3955                 :            :             {
    3956                 :            :                 case FN_UNO_TABLE_CELL_BACKGROUND:
    3957                 :            :                 {
    3958         [ #  # ]:          0 :                     SvxBrushItem aBrush( RES_BACKGROUND );
    3959 [ #  # ][ #  # ]:          0 :                     if(pTblCrsr->GetDoc()->GetBoxAttr( *pTblCrsr, aBrush ))
    3960 [ #  # ][ #  # ]:          0 :                         aBrush.QueryValue(aRet, pEntry->nMemberId);
    3961                 :            : 
    3962                 :            :                 }
    3963                 :          0 :                 break;
    3964                 :            :                 case RES_BOX :
    3965                 :            :                 {
    3966                 :          0 :                     SwDoc* pDoc = pTblCrsr->GetDoc();
    3967                 :          0 :                     SfxItemSet aSet(pDoc->GetAttrPool(),
    3968                 :            :                                     RES_BOX, RES_BOX,
    3969                 :            :                                     SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
    3970         [ #  # ]:          0 :                                     0);
    3971 [ #  # ][ #  # ]:          0 :                     aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER ));
                 [ #  # ]
    3972         [ #  # ]:          0 :                     pDoc->GetTabBorders(*pTblCrsr, aSet);
    3973         [ #  # ]:          0 :                     const SvxBoxItem& rBoxItem = ((const SvxBoxItem&)aSet.Get(RES_BOX));
    3974 [ #  # ][ #  # ]:          0 :                     rBoxItem.QueryValue(aRet, pEntry->nMemberId);
    3975                 :            :                 }
    3976                 :          0 :                 break;
    3977                 :            :                 case RES_VERT_ORIENT:
    3978                 :            :                 {
    3979         [ #  # ]:          0 :                     SwFmtVertOrient aVertOrient;
    3980 [ #  # ][ #  # ]:          0 :                     if( pTblCrsr->GetDoc()->GetBoxAttr( *pTblCrsr, aVertOrient ) )
    3981                 :            :                     {
    3982         [ #  # ]:          0 :                         aVertOrient.QueryValue( aRet, pEntry->nMemberId );
    3983         [ #  # ]:          0 :                     }
    3984                 :            :                 }
    3985                 :          0 :                 break;
    3986                 :            :                 case RES_BOXATR_FORMAT:
    3987                 :            :                     //GetAttr fuer Tabellenselektion am Doc fehlt noch
    3988                 :            :                     OSL_FAIL("not implemented");
    3989                 :          0 :                 break;
    3990                 :            :                 case FN_UNO_PARA_STYLE:
    3991                 :            :                 {
    3992                 :            :                     SwFmtColl *const pTmpFmt =
    3993         [ #  # ]:          0 :                         SwUnoCursorHelper::GetCurTxtFmtColl(*pTblCrsr, sal_False);
    3994                 :          0 :                     OUString sRet;
    3995         [ #  # ]:          0 :                     if(pFmt)
    3996         [ #  # ]:          0 :                         sRet = pTmpFmt->GetName();
    3997         [ #  # ]:          0 :                     aRet <<= sRet;
    3998                 :            :                 }
    3999                 :          0 :                 break;
    4000                 :            :                 case FN_UNO_RANGE_ROW_LABEL:
    4001                 :            :                 {
    4002                 :          0 :                     sal_Bool bTemp = bFirstRowAsLabel;
    4003         [ #  # ]:          0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    4004                 :            :                 }
    4005                 :          0 :                 break;
    4006                 :            :                 case FN_UNO_RANGE_COL_LABEL:
    4007                 :            :                 {
    4008                 :          0 :                     sal_Bool bTemp = bFirstColumnAsLabel;
    4009         [ #  # ]:          0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    4010                 :            :                 }
    4011                 :          0 :                 break;
    4012                 :            :                 default:
    4013                 :            :                 {
    4014                 :        258 :                     SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
    4015                 :            :                         RES_CHRATR_BEGIN,       RES_FRMATR_END -1,
    4016                 :            :                         RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
    4017                 :            :                         RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
    4018         [ +  - ]:        258 :                         0L);
    4019                 :            :                     // erstmal die Attribute des Cursors
    4020         [ -  + ]:        258 :                     SwUnoTableCrsr* pCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
    4021         [ +  - ]:        258 :                     SwUnoCursorHelper::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
    4022 [ +  - ][ +  - ]:        258 :                     m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
    4023                 :            :                 }
    4024                 :            :             }
    4025                 :            :         }
    4026                 :            :         else
    4027 [ #  # ][ #  # ]:          0 :            throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 [ #  # ]
    4028                 :            :     }
    4029         [ +  - ]:        258 :     return aRet;
    4030                 :            : }
    4031                 :            : 
    4032                 :          0 : void SwXCellRange::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    4033                 :            : {
    4034                 :            :     OSL_FAIL("not implemented");
    4035                 :          0 : }
    4036                 :            : 
    4037                 :          0 : void SwXCellRange::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    4038                 :            : {
    4039                 :            :     OSL_FAIL("not implemented");
    4040                 :          0 : }
    4041                 :            : 
    4042                 :          0 : void SwXCellRange::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    4043                 :            : {
    4044                 :            :     OSL_FAIL("not implemented");
    4045                 :          0 : }
    4046                 :            : 
    4047                 :          0 : void SwXCellRange::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    4048                 :            : {
    4049                 :            :     OSL_FAIL("not implemented");
    4050                 :          0 : }
    4051                 :            : 
    4052                 :          0 : void SwXCellRange::GetDataSequence(
    4053                 :            :         uno::Sequence< uno::Any >   *pAnySeq,   //-> first pointer != 0 is used
    4054                 :            :         uno::Sequence< OUString >   *pTxtSeq,   //-> as output sequence
    4055                 :            :         uno::Sequence< double >     *pDblSeq,   //-> (previous data gets overwritten)
    4056                 :            :         sal_Bool bForceNumberResults )          //-> when 'true' requires to make an
    4057                 :            :                                                 // extra effort to return a value different
    4058                 :            :                                                 // from 0 even if the cell is formatted to text
    4059                 :            :     throw (uno::RuntimeException)
    4060                 :            : {
    4061         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4062                 :            : 
    4063                 :            :     // compare to SwXCellRange::getDataArray (note different return types though)
    4064                 :            : 
    4065                 :          0 :     sal_Int16 nRowCount = getRowCount();
    4066                 :          0 :     sal_Int16 nColCount = getColumnCount();
    4067                 :            :     //
    4068 [ #  # ][ #  # ]:          0 :     if(!nRowCount || !nColCount)
    4069                 :            :     {
    4070         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4071         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4072         [ #  # ]:          0 :         throw aRuntime;
    4073                 :            :     }
    4074                 :            : 
    4075                 :          0 :     sal_Int32 nSize = nRowCount * nColCount;
    4076         [ #  # ]:          0 :     if (pAnySeq)
    4077         [ #  # ]:          0 :         pAnySeq->realloc( nSize );
    4078         [ #  # ]:          0 :     else if (pTxtSeq)
    4079         [ #  # ]:          0 :         pTxtSeq->realloc( nSize );
    4080         [ #  # ]:          0 :     else if (pDblSeq)
    4081         [ #  # ]:          0 :         pDblSeq->realloc( nSize );
    4082                 :            :     else
    4083                 :            :     {
    4084                 :            :         OSL_FAIL( "argument missing" );
    4085                 :          0 :         return;
    4086                 :            :     }
    4087 [ #  # ][ #  # ]:          0 :     uno::Any   *pAnyData = pAnySeq ? pAnySeq->getArray() : 0;
    4088 [ #  # ][ #  # ]:          0 :     OUString   *pTxtData = pTxtSeq ? pTxtSeq->getArray() : 0;
    4089 [ #  # ][ #  # ]:          0 :     double     *pDblData = pDblSeq ? pDblSeq->getArray() : 0;
    4090                 :            : 
    4091                 :          0 :     sal_Int32 nDtaCnt = 0;
    4092                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    4093         [ #  # ]:          0 :     if(pFmt)
    4094                 :            :     {
    4095                 :            :         double fNan;
    4096                 :          0 :         ::rtl::math::setNan( & fNan );
    4097                 :            : 
    4098                 :          0 :         uno::Reference< table::XCell > xCellRef;
    4099         [ #  # ]:          0 :         for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
    4100                 :            :         {
    4101         [ #  # ]:          0 :             for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
    4102                 :            :             {
    4103                 :            :                 SwXCell * pXCell = lcl_CreateXCell(pFmt,
    4104                 :            :                                     aRgDesc.nLeft + nCol,
    4105         [ #  # ]:          0 :                                     aRgDesc.nTop + nRow);
    4106                 :            :                 //! keep (additional) reference to object to prevent implicit destruction
    4107                 :            :                 //! in following UNO calls (when object will get referenced)
    4108 [ #  # ][ #  # ]:          0 :                 xCellRef = pXCell;
    4109         [ #  # ]:          0 :                 SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
    4110         [ #  # ]:          0 :                 if(!pBox)
    4111                 :            :                 {
    4112         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4113                 :            :                 }
    4114                 :            :                 else
    4115                 :            :                 {
    4116         [ #  # ]:          0 :                     if (pAnyData)
    4117                 :            :                     {
    4118                 :            :                         // check if table box value item is set
    4119         [ #  # ]:          0 :                         sal_Bool bIsNum = pBox->GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
    4120                 :            :                         //sal_uLong nNdPos = pBox->IsValidNumTxtNd( sal_True );
    4121         [ #  # ]:          0 :                         if (!bIsNum/* && ULONG_MAX == nNdPos*/)
    4122 [ #  # ][ #  # ]:          0 :                             pAnyData[nDtaCnt++] <<= lcl_getString(*pXCell);
    4123                 :            :                         else
    4124 [ #  # ][ #  # ]:          0 :                             pAnyData[nDtaCnt++] <<= lcl_getValue(*pXCell);
    4125                 :            :                     }
    4126         [ #  # ]:          0 :                     else if (pTxtData)
    4127         [ #  # ]:          0 :                         pTxtData[nDtaCnt++] = lcl_getString(*pXCell);
    4128         [ #  # ]:          0 :                     else if (pDblData)
    4129                 :            :                     {
    4130                 :          0 :                         double fVal = fNan;
    4131 [ #  # ][ #  # ]:          0 :                         if (!bForceNumberResults || table::CellContentType_TEXT != pXCell->getType())
         [ #  # ][ #  # ]
    4132         [ #  # ]:          0 :                             fVal = lcl_getValue(*pXCell);
    4133                 :            :                         else
    4134                 :            :                         {
    4135                 :            :                             OSL_ENSURE( table::CellContentType_TEXT == pXCell->getType(),
    4136                 :            :                                     "this branch of 'if' is only for text formatted cells" );
    4137                 :            : 
    4138                 :            :                             // now we'll try to get a useful numerical value
    4139                 :            :                             // from the text in the cell...
    4140                 :            : 
    4141                 :            :                             sal_uInt32 nFIndex;
    4142         [ #  # ]:          0 :                             SvNumberFormatter* pNumFormatter = pTblCrsr->GetDoc()->GetNumberFormatter();
    4143                 :            : 
    4144                 :            :                             // look for SwTblBoxNumFormat value in parents as well
    4145                 :            :                             const SfxPoolItem* pItem;
    4146                 :          0 :                             SwFrmFmt *pBoxFmt = pXCell->GetTblBox()->GetFrmFmt();
    4147         [ #  # ]:          0 :                             SfxItemState eState = pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem);
    4148                 :            : 
    4149         [ #  # ]:          0 :                             if (eState == SFX_ITEM_SET)
    4150                 :            :                             {
    4151                 :            :                                 // please note that the language of the numberformat
    4152                 :            :                                 // is implicitly coded into the below value as well
    4153                 :          0 :                                 nFIndex = ((SwTblBoxNumFormat*)pItem)->GetValue();
    4154                 :            : 
    4155                 :            :                                 // since the current value indicates a text format but the call
    4156                 :            :                                 // to 'IsNumberFormat' below won't work for text formats
    4157                 :            :                                 // we need to get rid of the part that indicates the text format.
    4158                 :            :                                 // According to ER this can be done like this:
    4159                 :          0 :                                 nFIndex -= (nFIndex % SV_COUNTRY_LANGUAGE_OFFSET);
    4160                 :            :                             }
    4161                 :            :                             else
    4162                 :            :                             {
    4163                 :            :                                 // system language is probably not the best possible choice
    4164                 :            :                                 // but since we have to guess anyway (because the language of at
    4165                 :            :                                 // the text is NOT the one used for the number format!)
    4166                 :            :                                 // it is at least conform to to what is used in
    4167                 :            :                                 // SwTableShell::Execute when
    4168                 :            :                                 // SID_ATTR_NUMBERFORMAT_VALUE is set...
    4169                 :          0 :                                 LanguageType eLang = LANGUAGE_SYSTEM;
    4170         [ #  # ]:          0 :                                 nFIndex = pNumFormatter->GetStandardIndex( eLang );
    4171                 :            :                             }
    4172                 :            : 
    4173         [ #  # ]:          0 :                             OUString aTxt( lcl_getString(*pXCell) );
    4174                 :            :                             double fTmp;
    4175 [ #  # ][ #  # ]:          0 :                             if (pNumFormatter->IsNumberFormat( aTxt, nFIndex, fTmp ))
         [ #  # ][ #  # ]
    4176                 :          0 :                                 fVal = fTmp;
    4177                 :            :                         }
    4178                 :          0 :                         pDblData[nDtaCnt++] = fVal;
    4179                 :            :                     }
    4180                 :            :                     else {
    4181                 :            :                         OSL_FAIL( "output sequence missing" );
    4182                 :            :                     }
    4183                 :            :                 }
    4184                 :            :             }
    4185                 :          0 :         }
    4186                 :            :     }
    4187                 :            :     OSL_ENSURE( nDtaCnt == nSize, "size mismatch. Invalid cell range?" );
    4188         [ #  # ]:          0 :     if (pAnySeq)
    4189         [ #  # ]:          0 :         pAnySeq->realloc( nDtaCnt );
    4190         [ #  # ]:          0 :     else if (pTxtSeq)
    4191         [ #  # ]:          0 :         pTxtSeq->realloc( nDtaCnt );
    4192         [ #  # ]:          0 :     else if (pDblSeq)
    4193 [ #  # ][ #  # ]:          0 :         pDblSeq->realloc( nDtaCnt );
                 [ #  # ]
    4194                 :            : }
    4195                 :            : 
    4196                 :          4 : uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
    4197                 :            :     throw (uno::RuntimeException)
    4198                 :            : {
    4199                 :            :     // see SwXCellRange::getData also
    4200                 :            :     // also see SwXCellRange::GetDataSequence
    4201                 :            : 
    4202         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4203                 :          4 :     sal_Int16 nRowCount = getRowCount();
    4204                 :          4 :     sal_Int16 nColCount = getColumnCount();
    4205                 :            :     //
    4206 [ -  + ][ +  - ]:          4 :     if(!nRowCount || !nColCount)
    4207                 :            :     {
    4208         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4209         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4210         [ #  # ]:          0 :         throw aRuntime;
    4211                 :            :     }
    4212         [ +  - ]:          4 :     uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
    4213                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    4214         [ +  - ]:          4 :     if(pFmt)
    4215                 :            :     {
    4216         [ +  - ]:          4 :         uno::Sequence< uno::Any >* pRowArray = aRowSeq.getArray();
    4217                 :          4 :         uno::Reference< table::XCell > xCellRef;
    4218         [ +  + ]:         24 :         for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
    4219                 :            :         {
    4220         [ +  - ]:         20 :             uno::Sequence< uno::Any > aColSeq(nColCount);
    4221         [ +  - ]:         20 :             uno::Any * pColArray = aColSeq.getArray();
    4222         [ +  + ]:        100 :             for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
    4223                 :            :             {
    4224                 :            :                 SwXCell * pXCell = lcl_CreateXCell(pFmt,
    4225                 :            :                                     aRgDesc.nLeft + nCol,
    4226         [ +  - ]:         80 :                                     aRgDesc.nTop + nRow);
    4227                 :            :                 //! keep (additional) reference to object to prevent implicit destruction
    4228                 :            :                 //! in following UNO calls (when object will get referenced)
    4229 [ +  - ][ +  - ]:         80 :                 xCellRef = pXCell;
    4230         [ +  - ]:         80 :                 SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
    4231         [ -  + ]:         80 :                 if(!pBox)
    4232                 :            :                 {
    4233         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4234                 :            :                 }
    4235                 :            :                 else
    4236                 :            :                 {
    4237                 :            :                     // check if table box value item is set
    4238                 :         80 :                     SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
    4239         [ +  - ]:         80 :                     sal_Bool bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
    4240                 :            :                     //const SfxPoolItem* pItem;
    4241                 :            :                     //SwDoc* pDoc = pXCell->GetDoc();
    4242                 :            :                     //sal_Bool bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
    4243                 :            :                     //          ||  pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
    4244                 :            :                     //          ||  ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
    4245                 :            : 
    4246         [ +  + ]:         80 :                     if(!bIsNum/*bIsText*/)
    4247 [ +  - ][ +  - ]:         40 :                         pColArray[nCol] <<= lcl_getString(*pXCell);
    4248                 :            :                     else
    4249 [ +  - ][ +  - ]:         40 :                         pColArray[nCol] <<= lcl_getValue(*pXCell);
    4250                 :            :                 }
    4251                 :            :             }
    4252         [ +  - ]:         20 :             pRowArray[nRow] = aColSeq;
    4253         [ +  - ]:         24 :         }
    4254                 :            :     }
    4255         [ +  - ]:          4 :     return aRowSeq;
    4256                 :            : }
    4257                 :            : 
    4258                 :          4 : void SAL_CALL SwXCellRange::setDataArray(
    4259                 :            :         const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
    4260                 :            :     throw (uno::RuntimeException)
    4261                 :            : {
    4262                 :            :     // see SwXCellRange::setData also
    4263                 :            : 
    4264         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4265                 :          4 :     sal_Int16 nRowCount = getRowCount();
    4266                 :          4 :     sal_Int16 nColCount = getColumnCount();
    4267 [ -  + ][ +  - ]:          4 :     if(!nRowCount || !nColCount)
    4268                 :            :     {
    4269         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4270         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4271         [ #  # ]:          0 :         throw aRuntime;
    4272                 :            :     }
    4273                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    4274         [ +  - ]:          4 :     if(pFmt )
    4275                 :            :     {
    4276         [ -  + ]:          4 :         if(rArray.getLength() != nRowCount)
    4277                 :            :         {
    4278         [ #  # ]:          0 :             throw uno::RuntimeException();
    4279                 :            :         }
    4280                 :          4 :         const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray();
    4281         [ +  + ]:         24 :         for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
    4282                 :            :         {
    4283                 :         20 :             const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow];
    4284         [ -  + ]:         20 :             if(rColSeq.getLength() != nColCount)
    4285                 :            :             {
    4286         [ #  # ]:          0 :                 throw uno::RuntimeException();
    4287                 :            :             }
    4288                 :         20 :             const uno::Any * pColArray = rColSeq.getConstArray();
    4289                 :         20 :             uno::Reference< table::XCell > xCellRef;
    4290         [ +  + ]:        100 :             for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
    4291                 :            :             {
    4292                 :            :                 SwXCell * pXCell = lcl_CreateXCell(pFmt,
    4293                 :            :                                     aRgDesc.nLeft + nCol,
    4294         [ +  - ]:         80 :                                     aRgDesc.nTop + nRow);
    4295                 :            :                 //! keep (additional) reference to object to prevent implicit destruction
    4296                 :            :                 //! in following UNO calls (when object will get referenced)
    4297 [ +  - ][ +  - ]:         80 :                 xCellRef = pXCell;
    4298         [ +  - ]:         80 :                 SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
    4299         [ -  + ]:         80 :                 if(!pBox)
    4300                 :            :                 {
    4301         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4302                 :            :                 }
    4303                 :            :                 else
    4304                 :            :                 {
    4305                 :         80 :                     const uno::Any &rAny = pColArray[nCol];
    4306         [ +  + ]:         80 :                     if (uno::TypeClass_STRING == rAny.getValueTypeClass())
    4307         [ +  - ]:         40 :                         lcl_setString( *pXCell, *(rtl::OUString *) rAny.getValue() );
    4308                 :            :                     else
    4309                 :            :                     {
    4310                 :         40 :                         double d = 0;
    4311                 :            :                         // #i20067# don't throw exception just do nothing if
    4312                 :            :                         // there is no value set
    4313         [ +  - ]:         40 :                         if( (rAny >>= d) )
    4314         [ +  - ]:         40 :                             lcl_setValue( *pXCell, d );
    4315                 :            :                         else
    4316         [ #  # ]:         40 :                             lcl_setString( *pXCell, OUString(), sal_True );
    4317                 :            :                     }
    4318                 :            :                 }
    4319                 :            :             }
    4320                 :         20 :         }
    4321         [ +  - ]:          4 :     }
    4322                 :          4 : }
    4323                 :            : 
    4324                 :          4 : uno::Sequence< uno::Sequence< double > > SwXCellRange::getData(void) throw( uno::RuntimeException )
    4325                 :            : {
    4326         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4327                 :          4 :     sal_Int16 nRowCount = getRowCount();
    4328                 :          4 :     sal_Int16 nColCount = getColumnCount();
    4329                 :            :     //
    4330 [ -  + ][ +  - ]:          4 :     if(!nRowCount || !nColCount)
    4331                 :            :     {
    4332         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4333         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4334         [ #  # ]:          0 :         throw aRuntime;
    4335                 :            :     }
    4336 [ -  + ][ +  - ]:          4 :     uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
    4337                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    4338         [ +  - ]:          4 :     if(pFmt)
    4339                 :            :     {
    4340         [ +  - ]:          4 :         uno::Sequence< double >* pRowArray = aRowSeq.getArray();
    4341                 :            : 
    4342                 :          4 :         sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
    4343         [ +  + ]:         24 :         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
    4344                 :            :         {
    4345 [ -  + ][ +  - ]:         20 :             uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
    4346         [ +  - ]:         20 :             double * pArray = aColSeq.getArray();
    4347         [ -  + ]:         20 :             sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
    4348         [ +  + ]:        100 :             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
    4349                 :            :             {
    4350         [ +  - ]:         80 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
    4351         [ -  + ]:         80 :                 if(!xCell.is())
    4352                 :            :                 {
    4353         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4354                 :            :                 }
    4355 [ +  - ][ +  - ]:         80 :                 pArray[nCol - nColStart] = xCell->getValue();
    4356                 :         80 :             }
    4357         [ +  - ]:         20 :             pRowArray[nRow - nRowStart] = aColSeq;
    4358         [ +  - ]:         20 :         }
    4359                 :            :     }
    4360         [ +  - ]:          4 :     return aRowSeq;
    4361                 :            : }
    4362                 :            : 
    4363                 :          2 : void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData)
    4364                 :            :                                                 throw( uno::RuntimeException )
    4365                 :            : {
    4366         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    4367                 :          2 :     sal_Int16 nRowCount = getRowCount();
    4368                 :          2 :     sal_Int16 nColCount = getColumnCount();
    4369 [ -  + ][ +  - ]:          2 :     if(!nRowCount || !nColCount)
    4370                 :            :     {
    4371         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4372         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4373         [ #  # ]:          0 :         throw aRuntime;
    4374                 :            :     }
    4375                 :          2 :     SwFrmFmt* pFmt = GetFrmFmt();
    4376         [ +  - ]:          2 :     if(pFmt )
    4377                 :            :     {
    4378                 :          2 :         sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
    4379         [ -  + ]:          2 :         if(rData.getLength() < nRowCount - nRowStart)
    4380                 :            :         {
    4381         [ #  # ]:          0 :             throw uno::RuntimeException();
    4382                 :            :         }
    4383                 :          2 :         const uno::Sequence< double >* pRowArray = rData.getConstArray();
    4384         [ +  + ]:         12 :         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
    4385                 :            :         {
    4386                 :         10 :             const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
    4387         [ -  + ]:         10 :             sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
    4388         [ -  + ]:         10 :             if(rColSeq.getLength() < nColCount - nColStart)
    4389                 :            :             {
    4390         [ #  # ]:          0 :                 throw uno::RuntimeException();
    4391                 :            :             }
    4392                 :         10 :             const double * pColArray = rColSeq.getConstArray();
    4393         [ +  + ]:         50 :             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
    4394                 :            :             {
    4395         [ +  - ]:         40 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
    4396         [ -  + ]:         40 :                 if(!xCell.is())
    4397                 :            :                 {
    4398         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4399                 :            :                 }
    4400 [ +  - ][ +  - ]:         40 :                 xCell->setValue(pColArray[nCol - nColStart]);
    4401                 :         40 :             }
    4402                 :            :         }
    4403         [ +  - ]:          2 :     }
    4404                 :          2 : }
    4405                 :            : 
    4406                 :          4 : uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
    4407                 :            :                                             throw( uno::RuntimeException )
    4408                 :            : {
    4409         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4410                 :          4 :     sal_Int16 nRowCount = getRowCount();
    4411         [ -  + ]:          4 :     if(!nRowCount)
    4412                 :            :     {
    4413         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4414         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4415         [ #  # ]:          0 :         throw aRuntime;
    4416                 :            :     }
    4417 [ -  + ][ +  - ]:          4 :     uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
    4418                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    4419         [ +  - ]:          4 :     if(pFmt)
    4420                 :            :     {
    4421         [ +  - ]:          4 :         OUString* pArray = aRet.getArray();
    4422         [ -  + ]:          4 :         if(bFirstColumnAsLabel)
    4423                 :            :         {
    4424                 :          0 :             sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
    4425         [ #  # ]:          0 :             for(sal_uInt16 i = nStart; i < nRowCount; i++)
    4426                 :            :             {
    4427         [ #  # ]:          0 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
    4428         [ #  # ]:          0 :                 if(!xCell.is())
    4429                 :            :                 {
    4430         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4431                 :            :                 }
    4432         [ #  # ]:          0 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    4433 [ #  # ][ #  # ]:          0 :                 pArray[i - nStart] = xText->getString();
    4434                 :          0 :             }
    4435                 :            :         }
    4436                 :            :         else
    4437                 :            :         {
    4438                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    4439                 :            :         }
    4440                 :            :     }
    4441                 :            :     else
    4442         [ #  # ]:          0 :         throw uno::RuntimeException();
    4443         [ +  - ]:          4 :     return aRet;
    4444                 :            : }
    4445                 :            : 
    4446                 :          0 : void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
    4447                 :            :                                                     throw( uno::RuntimeException )
    4448                 :            : {
    4449         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4450                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    4451         [ #  # ]:          0 :     if(pFmt)
    4452                 :            :     {
    4453                 :          0 :         sal_Int16 nRowCount = getRowCount();
    4454 [ #  # ][ #  # ]:          0 :         if(!nRowCount || rRowDesc.getLength() < bFirstRowAsLabel ? nRowCount - 1 : nRowCount)
                 [ #  # ]
    4455                 :            :         {
    4456         [ #  # ]:          0 :             throw uno::RuntimeException();
    4457                 :            :         }
    4458                 :          0 :         const OUString* pArray = rRowDesc.getConstArray();
    4459         [ #  # ]:          0 :         if(bFirstColumnAsLabel)
    4460                 :            :         {
    4461                 :          0 :             sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
    4462         [ #  # ]:          0 :             for(sal_uInt16 i = nStart; i < nRowCount; i++)
    4463                 :            :             {
    4464         [ #  # ]:          0 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
    4465         [ #  # ]:          0 :                 if(!xCell.is())
    4466                 :            :                 {
    4467         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4468                 :            :                 }
    4469         [ #  # ]:          0 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    4470 [ #  # ][ #  # ]:          0 :                 xText->setString(pArray[i - nStart]);
    4471                 :          0 :             }
    4472                 :            :         }
    4473                 :            :         else
    4474                 :            :         {
    4475                 :            :             OSL_FAIL("Wohin mit den Labels?");
    4476                 :            :         }
    4477         [ #  # ]:          0 :     }
    4478                 :          0 : }
    4479                 :            : 
    4480                 :          4 : uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
    4481                 :            :                                         throw( uno::RuntimeException )
    4482                 :            : {
    4483         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4484                 :          4 :     sal_Int16 nColCount = getColumnCount();
    4485         [ -  + ]:          4 :     if(!nColCount)
    4486                 :            :     {
    4487         [ #  # ]:          0 :         uno::RuntimeException aRuntime;
    4488         [ #  # ]:          0 :         aRuntime.Message = C2U("Table too complex");
    4489         [ #  # ]:          0 :         throw aRuntime;
    4490                 :            :     }
    4491 [ -  + ][ +  - ]:          4 :     uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
    4492                 :          4 :     SwFrmFmt* pFmt = GetFrmFmt();
    4493         [ +  - ]:          4 :     if(pFmt)
    4494                 :            :     {
    4495         [ +  - ]:          4 :         OUString* pArray = aRet.getArray();
    4496         [ -  + ]:          4 :         if(bFirstRowAsLabel)
    4497                 :            :         {
    4498         [ #  # ]:          0 :             sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
    4499         [ #  # ]:          0 :             for(sal_uInt16 i = nStart; i < nColCount; i++)
    4500                 :            :             {
    4501         [ #  # ]:          0 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
    4502         [ #  # ]:          0 :                 if(!xCell.is())
    4503                 :            :                 {
    4504         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4505                 :            :                 }
    4506         [ #  # ]:          0 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    4507 [ #  # ][ #  # ]:          0 :                 pArray[i - nStart] = xText->getString();
    4508                 :          0 :             }
    4509                 :            :         }
    4510                 :            :         else
    4511                 :            :         {
    4512                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    4513                 :            :         }
    4514                 :            :     }
    4515                 :            :     else
    4516         [ #  # ]:          0 :         throw uno::RuntimeException();
    4517         [ +  - ]:          4 :     return aRet;
    4518                 :            : }
    4519                 :            : 
    4520                 :          0 : void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
    4521                 :            :                                                         throw( uno::RuntimeException )
    4522                 :            : {
    4523         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4524                 :          0 :     sal_Int16 nColCount = getColumnCount();
    4525                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    4526         [ #  # ]:          0 :     if(pFmt)
    4527                 :            :     {
    4528                 :          0 :         const OUString* pArray = ColumnDesc.getConstArray();
    4529 [ #  # ][ #  # ]:          0 :         if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
                 [ #  # ]
    4530                 :            :         {
    4531         [ #  # ]:          0 :             sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
    4532         [ #  # ]:          0 :             for(sal_uInt16 i = nStart; i < nColCount; i++)
    4533                 :            :             {
    4534         [ #  # ]:          0 :                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
    4535         [ #  # ]:          0 :                 if(!xCell.is())
    4536                 :            :                 {
    4537         [ #  # ]:          0 :                     throw uno::RuntimeException();
    4538                 :            :                 }
    4539         [ #  # ]:          0 :                 uno::Reference< text::XText >  xText(xCell, uno::UNO_QUERY);
    4540                 :            : 
    4541 [ #  # ][ #  # ]:          0 :                 xText->setString(pArray[i - nStart]);
    4542                 :          0 :             }
    4543                 :            :         }
    4544                 :            :         else
    4545                 :            :         {
    4546                 :            :             OSL_FAIL("Wo kommen die Labels her?");
    4547                 :            :         }
    4548         [ #  # ]:          0 :     }
    4549                 :          0 : }
    4550                 :            : 
    4551                 :          0 : void SwXCellRange::addChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
    4552                 :            : {
    4553         [ #  # ]:          0 :     if(!GetRegisteredIn())
    4554         [ #  # ]:          0 :         throw uno::RuntimeException();
    4555         [ #  # ]:          0 :     aChartLstnrCntnr.AddListener(aListener.get());
    4556                 :          0 : }
    4557                 :            : 
    4558                 :          0 : void SwXCellRange::removeChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
    4559                 :            : {
    4560 [ #  # ][ #  # ]:          0 :     if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    4561         [ #  # ]:          0 :         throw uno::RuntimeException();
    4562                 :          0 : }
    4563                 :            : 
    4564                 :          0 : sal_Bool SwXCellRange::isNotANumber(double /*fNumber*/) throw( uno::RuntimeException )
    4565                 :            : {
    4566                 :            :     OSL_FAIL("not implemented");
    4567                 :          0 :     return sal_False;
    4568                 :            : 
    4569                 :            : }
    4570                 :            : 
    4571                 :          0 : double SwXCellRange::getNotANumber(void) throw( uno::RuntimeException )
    4572                 :            : {
    4573                 :            :     OSL_FAIL("not implemented");
    4574                 :          0 :     return 0.;
    4575                 :            : }
    4576                 :            : 
    4577                 :          0 : uno::Sequence< beans::PropertyValue > SwXCellRange::createSortDescriptor(void) throw( uno::RuntimeException )
    4578                 :            : {
    4579         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4580                 :            : 
    4581 [ #  # ][ #  # ]:          0 :     return SwUnoCursorHelper::CreateSortDescriptor(true);
    4582                 :            : }
    4583                 :            : 
    4584                 :          0 : void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
    4585                 :            :     throw( uno::RuntimeException )
    4586                 :            : {
    4587         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4588         [ #  # ]:          0 :     SwSortOptions aSortOpt;
    4589                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    4590 [ #  # ][ #  # ]:          0 :     if(pFmt &&
                 [ #  # ]
    4591         [ #  # ]:          0 :         SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
    4592                 :            :     {
    4593         [ #  # ]:          0 :         SwUnoTableCrsr* pTableCrsr = dynamic_cast<SwUnoTableCrsr*>(pTblCrsr);
    4594         [ #  # ]:          0 :         pTableCrsr->MakeBoxSels();
    4595         [ #  # ]:          0 :         UnoActionContext aContext( pFmt->GetDoc() );
    4596 [ #  # ][ #  # ]:          0 :         pFmt->GetDoc()->SortTbl(pTableCrsr->GetBoxes(), aSortOpt);
    4597 [ #  # ][ #  # ]:          0 :     }
    4598                 :          0 : }
    4599                 :            : 
    4600                 :        146 : sal_uInt16 SwXCellRange::getColumnCount(void)
    4601                 :            : {
    4602                 :        146 :     return static_cast< sal_uInt16 >(aRgDesc.nRight - aRgDesc.nLeft + 1);
    4603                 :            : }
    4604                 :            : 
    4605                 :        146 : sal_uInt16 SwXCellRange::getRowCount(void)
    4606                 :            : {
    4607                 :        146 :     return static_cast< sal_uInt16 >(aRgDesc.nBottom - aRgDesc.nTop + 1);
    4608                 :            : }
    4609                 :            : 
    4610                 :          0 : const SwUnoCrsr* SwXCellRange::GetTblCrsr() const
    4611                 :            : {
    4612                 :          0 :     const SwUnoCrsr* pRet = 0;
    4613                 :          0 :     SwFrmFmt* pFmt = GetFrmFmt();
    4614         [ #  # ]:          0 :     if(pFmt)
    4615                 :          0 :         pRet = pTblCrsr;
    4616                 :          0 :     return pRet;
    4617                 :            : }
    4618                 :            : 
    4619                 :         14 : void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    4620                 :            : {
    4621                 :         14 :     ClientModify(this, pOld, pNew );
    4622 [ #  # ][ +  - ]:         14 :     if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
                 [ -  + ]
    4623                 :            :     {
    4624                 :            :         /*
    4625                 :            :          * Not sure if this will cause a memory leak - this pTblCrsr
    4626                 :            :          * is deleted in SwDoc and GPFs here when deleted again
    4627                 :            :          * if(!aCursorDepend.GetRegisteredIn())
    4628                 :            :             delete pTblCrsr;
    4629                 :            :          */
    4630                 :         14 :         pTblCrsr = 0;
    4631                 :         14 :         aChartLstnrCntnr.Disposing();
    4632                 :            :     }
    4633                 :            :     else
    4634                 :          0 :         aChartLstnrCntnr.ChartDataChanged();
    4635                 :         14 : }
    4636                 :            : 
    4637                 :            : /******************************************************************
    4638                 :            :  *  SwXTableRows
    4639                 :            :  ******************************************************************/
    4640                 :          0 : OUString SwXTableRows::getImplementationName(void) throw( uno::RuntimeException )
    4641                 :            : {
    4642                 :          0 :     return C2U("SwXTableRows");
    4643                 :            : }
    4644                 :            : 
    4645                 :          0 : sal_Bool SwXTableRows::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    4646                 :            : {
    4647                 :          0 :     return C2U("com.sun.star.text.TableRows") == rServiceName;
    4648                 :            : }
    4649                 :            : 
    4650                 :          0 : uno::Sequence< OUString > SwXTableRows::getSupportedServiceNames(void) throw( uno::RuntimeException )
    4651                 :            : {
    4652                 :          0 :     uno::Sequence< OUString > aRet(1);
    4653         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    4654         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TableRows");
    4655                 :          0 :     return aRet;
    4656                 :            : }
    4657 [ -  + ][ +  + ]:       1689 : TYPEINIT1(SwXTableRows, SwClient);
    4658                 :            : 
    4659                 :         78 : SwXTableRows::SwXTableRows(SwFrmFmt& rFrmFmt) :
    4660         [ +  - ]:         78 :     SwClient(&rFrmFmt)
    4661                 :            : {
    4662                 :         78 : }
    4663                 :            : 
    4664         [ +  - ]:         78 : SwXTableRows::~SwXTableRows()
    4665                 :            : {
    4666         [ -  + ]:        156 : }
    4667                 :            : 
    4668                 :        157 : sal_Int32 SwXTableRows::getCount(void) throw( uno::RuntimeException )
    4669                 :            : {
    4670         [ +  - ]:        157 :     SolarMutexGuard aGuard;
    4671                 :        157 :     sal_Int32 nRet = 0;
    4672                 :        157 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4673         [ -  + ]:        157 :     if(!pFrmFmt)
    4674         [ #  # ]:          0 :         throw uno::RuntimeException();
    4675                 :            :     else
    4676                 :            :     {
    4677         [ +  - ]:        157 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4678                 :        157 :         nRet = pTable->GetTabLines().size();
    4679                 :            :     }
    4680         [ +  - ]:        157 :     return nRet;
    4681                 :            : }
    4682                 :            : 
    4683                 :         89 : uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
    4684                 :            :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
    4685                 :            : {
    4686         [ +  - ]:         89 :     SolarMutexGuard aGuard;
    4687                 :         89 :     uno::Any aRet;
    4688                 :         89 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4689 [ -  + ][ +  - ]:         89 :     if(!pFrmFmt || nIndex < 0 )
    4690         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    4691                 :            :     else
    4692                 :            :     {
    4693         [ +  - ]:         89 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4694         [ +  + ]:         89 :         if( (sal_uInt16)pTable->GetTabLines().size() > nIndex)
    4695                 :            :         {
    4696                 :         87 :             SwTableLine* pLine = pTable->GetTabLines()[(sal_uInt16)nIndex];
    4697         [ +  - ]:         87 :             SwIterator<SwXTextTableRow,SwFmt> aIter( *pFrmFmt );
    4698         [ +  - ]:         87 :             SwXTextTableRow* pXRow = aIter.First();
    4699         [ +  + ]:         89 :             while( pXRow )
    4700                 :            :             {
    4701                 :            :                 // gibt es eine passende Zelle bereits?
    4702         [ +  + ]:          4 :                 if(pXRow->GetTblRow() == pLine)
    4703                 :          2 :                     break;
    4704         [ +  - ]:          2 :                 pXRow = aIter.Next();
    4705                 :            :             }
    4706                 :            :             //sonst anlegen
    4707         [ +  + ]:         87 :             if(!pXRow)
    4708         [ +  - ]:         85 :                 pXRow = new SwXTextTableRow(pFrmFmt, pLine);
    4709                 :            :             uno::Reference< beans::XPropertySet >  xRet =
    4710 [ +  - ][ +  - ]:         87 :                                     (beans::XPropertySet*)pXRow;
    4711 [ +  - ][ +  - ]:         87 :             aRet.setValue(&xRet, ::getCppuType((const uno::Reference<beans::XPropertySet>*)0));
    4712                 :            :         }
    4713                 :            :         else
    4714         [ +  - ]:         89 :             throw lang::IndexOutOfBoundsException();
    4715                 :            :     }
    4716         [ +  - ]:        176 :     return aRet;
    4717                 :            : }
    4718                 :            : 
    4719                 :          2 : uno::Type SAL_CALL SwXTableRows::getElementType(void) throw( uno::RuntimeException )
    4720                 :            : {
    4721                 :          2 :     return ::getCppuType((const uno::Reference<beans::XPropertySet>*)0);
    4722                 :            : }
    4723                 :            : 
    4724                 :          2 : sal_Bool SwXTableRows::hasElements(void) throw( uno::RuntimeException )
    4725                 :            : {
    4726         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    4727                 :          2 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4728         [ -  + ]:          2 :     if(!pFrmFmt)
    4729         [ #  # ]:          0 :         throw uno::RuntimeException();
    4730                 :            :     //es gibt keine Tabelle ohne Zeilen
    4731         [ +  - ]:          2 :     return sal_True;
    4732                 :            : }
    4733                 :            : 
    4734                 :          4 : void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
    4735                 :            : {
    4736         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4737         [ -  + ]:          4 :     if (nCount == 0)
    4738                 :          2 :         return;
    4739                 :          4 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4740         [ -  + ]:          4 :     if(!pFrmFmt)
    4741         [ #  # ]:          0 :         throw uno::RuntimeException();
    4742                 :            :     else
    4743                 :            :     {
    4744         [ +  - ]:          4 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4745 [ +  - ][ +  - ]:          4 :         if(!pTable->IsTblComplex())
    4746                 :            :         {
    4747                 :          4 :             sal_uInt16 nRowCount = pTable->GetTabLines().size();
    4748 [ +  + ][ -  + ]:          4 :             if (nCount <= 0 || !(0 <= nIndex && nIndex <= nRowCount))
                 [ +  - ]
    4749                 :            :             {
    4750         [ +  - ]:          2 :                 uno::RuntimeException aExcept;
    4751         [ +  - ]:          2 :                 aExcept.Message = C2U("Illegal arguments");
    4752         [ +  - ]:          2 :                 throw aExcept;
    4753                 :            :             }
    4754                 :            : 
    4755         [ +  - ]:          2 :             String sTLName = lcl_GetCellName(0, nIndex);
    4756         [ +  - ]:          2 :             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    4757                 :          2 :             sal_Bool bAppend = sal_False;
    4758         [ -  + ]:          2 :             if(!pTLBox)
    4759                 :            :             {
    4760                 :          0 :                 bAppend = sal_True;
    4761                 :            :                 // am Ende anfuegen, dazu muss der Cursor in die letzte Zeile!
    4762                 :          0 :                 SwTableLines& rLines = pTable->GetTabLines();
    4763         [ #  # ]:          0 :                 SwTableLine* pLine = rLines.back();
    4764                 :          0 :                 SwTableBoxes& rBoxes = pLine->GetTabBoxes();
    4765         [ #  # ]:          0 :                 pTLBox = rBoxes.front();
    4766                 :            :             }
    4767         [ +  - ]:          2 :             if(pTLBox)
    4768                 :            :             {
    4769                 :          2 :                 const SwStartNode* pSttNd = pTLBox->GetSttNd();
    4770         [ +  - ]:          2 :                 SwPosition aPos(*pSttNd);
    4771                 :            :                 // Cursor in die obere linke Zelle des Ranges setzen
    4772         [ +  - ]:          2 :                 UnoActionContext aAction(pFrmFmt->GetDoc());
    4773         [ +  - ]:          2 :                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    4774         [ +  - ]:          2 :                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
    4775                 :            : 
    4776                 :            :                 {
    4777                 :            :                     // remove actions
    4778 [ +  - ][ +  - ]:          2 :                     UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
    4779                 :            :                 }
    4780                 :            : 
    4781         [ +  - ]:          2 :                 pFrmFmt->GetDoc()->InsertRow(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
    4782 [ +  - ][ +  - ]:          2 :                 delete pUnoCrsr;
         [ +  - ][ +  - ]
    4783         [ +  - ]:          4 :             }
    4784                 :            :         }
    4785 [ +  - ][ +  - ]:          4 :     }
    4786                 :            : }
    4787                 :            : 
    4788                 :          4 : void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
    4789                 :            : {
    4790         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4791         [ -  + ]:          4 :     if (nCount == 0)
    4792                 :          2 :         return;
    4793                 :          4 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4794 [ +  + ][ -  + ]:          4 :     if(!pFrmFmt || nIndex < 0 || nCount <=0 )
                 [ +  - ]
    4795         [ +  - ]:          2 :         throw uno::RuntimeException();
    4796                 :            :     else
    4797                 :            :     {
    4798                 :          2 :         sal_Bool bSuccess = sal_False;
    4799         [ +  - ]:          2 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4800 [ +  - ][ +  - ]:          2 :         if(!pTable->IsTblComplex())
    4801                 :            :         {
    4802         [ +  - ]:          2 :             String sTLName = lcl_GetCellName(0, nIndex);
    4803         [ +  - ]:          2 :             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    4804         [ +  - ]:          2 :             if(pTLBox)
    4805                 :            :             {
    4806                 :            :                 {
    4807                 :            :                     // hier muessen die Actions aufgehoben werden
    4808 [ +  - ][ +  - ]:          2 :                     UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
    4809                 :            :                 }
    4810                 :          2 :                 const SwStartNode* pSttNd = pTLBox->GetSttNd();
    4811         [ +  - ]:          2 :                 SwPosition aPos(*pSttNd);
    4812                 :            :                 // Cursor in die obere linke Zelle des Ranges setzen
    4813         [ +  - ]:          2 :                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    4814         [ +  - ]:          2 :                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
    4815                 :          2 :                 pUnoCrsr->SetRemainInSection( sal_False );
    4816         [ +  - ]:          2 :                 String sBLName = lcl_GetCellName(0, nIndex + nCount - 1);
    4817         [ +  - ]:          2 :                 const SwTableBox* pBLBox = pTable->GetTblBox( sBLName );
    4818         [ +  - ]:          2 :                 if(pBLBox)
    4819                 :            :                 {
    4820         [ +  - ]:          2 :                     pUnoCrsr->SetMark();
    4821         [ +  - ]:          2 :                     pUnoCrsr->GetPoint()->nNode = *pBLBox->GetSttNd();
    4822         [ +  - ]:          2 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    4823                 :            :                     SwUnoTableCrsr* pCrsr =
    4824         [ -  + ]:          2 :                         dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    4825         [ +  - ]:          2 :                     pCrsr->MakeBoxSels();
    4826                 :            :                     {   // Die Klammer ist wichtig
    4827         [ +  - ]:          2 :                         UnoActionContext aAction(pFrmFmt->GetDoc());
    4828         [ +  - ]:          2 :                         pFrmFmt->GetDoc()->DeleteRow(*pUnoCrsr);
    4829 [ +  - ][ +  - ]:          2 :                         delete pUnoCrsr;
    4830         [ +  - ]:          2 :                         bSuccess = sal_True;
    4831                 :            :                     }
    4832                 :            :                     {
    4833                 :            :                         // hier muessen die Actions aufgehoben werden
    4834 [ +  - ][ +  - ]:          2 :                         UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
    4835                 :            :                     }
    4836 [ +  - ][ +  - ]:          2 :                 }
    4837         [ +  - ]:          2 :             }
    4838                 :            :         }
    4839         [ -  + ]:          2 :         if(!bSuccess)
    4840                 :            :         {
    4841         [ #  # ]:          0 :             uno::RuntimeException aExcept;
    4842         [ #  # ]:          0 :             aExcept.Message = C2U("Illegal arguments");
    4843         [ #  # ]:          2 :             throw aExcept;
    4844                 :            :         }
    4845 [ +  - ][ +  - ]:          4 :     }
    4846                 :            : }
    4847                 :            : 
    4848                 :          6 : void SwXTableRows::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    4849                 :            : {
    4850                 :          6 :     ClientModify(this, pOld, pNew);
    4851                 :          6 : }
    4852                 :            : 
    4853                 :            : /******************************************************************
    4854                 :            :  * SwXTableColumns
    4855                 :            :  ******************************************************************/
    4856                 :          0 : OUString SwXTableColumns::getImplementationName(void) throw( uno::RuntimeException )
    4857                 :            : {
    4858                 :          0 :     return C2U("SwXTableColumns");
    4859                 :            : }
    4860                 :            : 
    4861                 :          0 : sal_Bool SwXTableColumns::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
    4862                 :            : {
    4863                 :          0 :     return C2U("com.sun.star.text.TableColumns") == rServiceName;
    4864                 :            : }
    4865                 :            : 
    4866                 :          0 : uno::Sequence< OUString > SwXTableColumns::getSupportedServiceNames(void) throw( uno::RuntimeException )
    4867                 :            : {
    4868                 :          0 :     uno::Sequence< OUString > aRet(1);
    4869         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    4870         [ #  # ]:          0 :     pArray[0] = C2U("com.sun.star.text.TableColumns");
    4871                 :          0 :     return aRet;
    4872                 :            : }
    4873                 :            : 
    4874 [ -  + ][ +  + ]:         22 : TYPEINIT1(SwXTableColumns, SwClient);
    4875                 :            : 
    4876                 :          4 : SwXTableColumns::SwXTableColumns(SwFrmFmt& rFrmFmt) :
    4877         [ +  - ]:          4 :     SwClient(&rFrmFmt)
    4878                 :            : {
    4879                 :          4 : }
    4880                 :            : 
    4881         [ +  - ]:          4 : SwXTableColumns::~SwXTableColumns()
    4882                 :            : {
    4883         [ -  + ]:          8 : }
    4884                 :            : 
    4885                 :          4 : sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException )
    4886                 :            : {
    4887         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    4888                 :          4 :     sal_Int32 nRet = 0;
    4889                 :          4 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4890         [ -  + ]:          4 :     if(!pFrmFmt)
    4891         [ #  # ]:          0 :         throw uno::RuntimeException();
    4892                 :            :     else
    4893                 :            :     {
    4894         [ +  - ]:          4 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4895 [ +  - ][ +  - ]:          4 :         if(!pTable->IsTblComplex())
    4896                 :            :         {
    4897                 :          4 :             SwTableLines& rLines = pTable->GetTabLines();
    4898         [ +  - ]:          4 :             SwTableLine* pLine = rLines.front();
    4899                 :          4 :             nRet = pLine->GetTabBoxes().size();
    4900                 :            :         }
    4901                 :            :     }
    4902         [ +  - ]:          4 :     return nRet;
    4903                 :            : }
    4904                 :            : 
    4905                 :          8 : uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex)
    4906                 :            :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
    4907                 :            : {
    4908         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    4909                 :          8 :     uno::Reference< uno::XInterface >  xRet;
    4910                 :          8 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4911         [ -  + ]:          8 :     if(!pFrmFmt)
    4912         [ #  # ]:          0 :         throw uno::RuntimeException();
    4913                 :            :     else
    4914                 :            :     {
    4915                 :          8 :         sal_uInt16 nCount = 0;
    4916         [ +  - ]:          8 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4917 [ +  - ][ +  - ]:          8 :         if(!pTable->IsTblComplex())
    4918                 :            :         {
    4919                 :          8 :             SwTableLines& rLines = pTable->GetTabLines();
    4920         [ +  - ]:          8 :             SwTableLine* pLine = rLines.front();
    4921                 :          8 :             nCount = pLine->GetTabBoxes().size();
    4922                 :            :         }
    4923 [ +  + ][ -  + ]:          8 :         if(nCount <= nIndex || nIndex < 0)
    4924         [ +  - ]:          2 :             throw lang::IndexOutOfBoundsException();
    4925         [ +  - ]:          6 :         xRet = uno::Reference<uno::XInterface>();   //!! writer tables do not have columns !!
    4926                 :            :     }
    4927 [ +  - ][ +  - ]:          8 :     return uno::Any(&xRet, ::getCppuType((const uno::Reference<uno::XInterface>*)0));
    4928                 :            : }
    4929                 :            : 
    4930                 :          2 : uno::Type SAL_CALL SwXTableColumns::getElementType(void) throw( uno::RuntimeException )
    4931                 :            : {
    4932                 :          2 :     return ::getCppuType((uno::Reference<uno::XInterface>*)0);
    4933                 :            : }
    4934                 :            : 
    4935                 :          2 : sal_Bool SwXTableColumns::hasElements(void) throw( uno::RuntimeException )
    4936                 :            : {
    4937         [ +  - ]:          2 :     SolarMutexGuard aGuard;
    4938                 :          2 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4939         [ -  + ]:          2 :     if(!pFrmFmt)
    4940         [ #  # ]:          0 :         throw uno::RuntimeException();
    4941         [ +  - ]:          2 :     return sal_True;
    4942                 :            : }
    4943                 :            : 
    4944                 :          0 : void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
    4945                 :            : {
    4946         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    4947         [ #  # ]:          0 :     if (nCount == 0)
    4948                 :          0 :         return;
    4949                 :          0 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    4950         [ #  # ]:          0 :     if(!pFrmFmt)
    4951         [ #  # ]:          0 :         throw uno::RuntimeException();
    4952                 :            :     else
    4953                 :            :     {
    4954         [ #  # ]:          0 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    4955 [ #  # ][ #  # ]:          0 :         if(!pTable->IsTblComplex())
    4956                 :            :         {
    4957                 :          0 :             SwTableLines& rLines = pTable->GetTabLines();
    4958         [ #  # ]:          0 :             SwTableLine* pLine = rLines.front();
    4959                 :          0 :             sal_uInt16 nColCount = pLine->GetTabBoxes().size();
    4960 [ #  # ][ #  # ]:          0 :             if (nCount <= 0 || !(0 <= nIndex && nIndex <= nColCount))
                 [ #  # ]
    4961                 :            :             {
    4962         [ #  # ]:          0 :                 uno::RuntimeException aExcept;
    4963         [ #  # ]:          0 :                 aExcept.Message = C2U("Illegal arguments");
    4964         [ #  # ]:          0 :                 throw aExcept;
    4965                 :            :             }
    4966                 :            : 
    4967         [ #  # ]:          0 :             String sTLName = lcl_GetCellName(nIndex, 0);
    4968         [ #  # ]:          0 :             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    4969                 :          0 :             sal_Bool bAppend = sal_False;
    4970         [ #  # ]:          0 :             if(!pTLBox)
    4971                 :            :             {
    4972                 :          0 :                 bAppend = sal_True;
    4973                 :            :                 // am Ende anfuegen, dazu muss der Cursor in die letzte Spalte!
    4974                 :          0 :                 SwTableBoxes& rBoxes = pLine->GetTabBoxes();
    4975         [ #  # ]:          0 :                 pTLBox = rBoxes.back();
    4976                 :            :             }
    4977         [ #  # ]:          0 :             if(pTLBox)
    4978                 :            :             {
    4979                 :          0 :                 const SwStartNode* pSttNd = pTLBox->GetSttNd();
    4980         [ #  # ]:          0 :                 SwPosition aPos(*pSttNd);
    4981         [ #  # ]:          0 :                 UnoActionContext aAction(pFrmFmt->GetDoc());
    4982         [ #  # ]:          0 :                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    4983         [ #  # ]:          0 :                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
    4984                 :            : 
    4985                 :            :                 {
    4986                 :            :                     // remove actions
    4987 [ #  # ][ #  # ]:          0 :                     UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
    4988                 :            :                 }
    4989                 :            : 
    4990         [ #  # ]:          0 :                 pFrmFmt->GetDoc()->InsertCol(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
    4991 [ #  # ][ #  # ]:          0 :                 delete pUnoCrsr;
         [ #  # ][ #  # ]
    4992         [ #  # ]:          0 :             }
    4993                 :            :         }
    4994 [ #  # ][ #  # ]:          0 :     }
    4995                 :            : }
    4996                 :            : 
    4997                 :          0 : void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
    4998                 :            : {
    4999         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    5000         [ #  # ]:          0 :     if (nCount == 0)
    5001                 :          0 :         return;
    5002                 :          0 :     SwFrmFmt* pFrmFmt = GetFrmFmt();
    5003 [ #  # ][ #  # ]:          0 :     if(!pFrmFmt|| nIndex < 0 || nCount <=0 )
                 [ #  # ]
    5004         [ #  # ]:          0 :         throw uno::RuntimeException();
    5005                 :            :     else
    5006                 :            :     {
    5007                 :          0 :         sal_Bool bSuccess = sal_False;
    5008         [ #  # ]:          0 :         SwTable* pTable = SwTable::FindTable( pFrmFmt );
    5009 [ #  # ][ #  # ]:          0 :         if(!pTable->IsTblComplex())
    5010                 :            :         {
    5011         [ #  # ]:          0 :             String sTLName = lcl_GetCellName(nIndex, 0);
    5012         [ #  # ]:          0 :             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
    5013         [ #  # ]:          0 :             if(pTLBox)
    5014                 :            :             {
    5015                 :            :                 {
    5016                 :            :                     // hier muessen die Actions aufgehoben werden
    5017 [ #  # ][ #  # ]:          0 :                     UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
    5018                 :            :                 }
    5019                 :          0 :                 const SwStartNode* pSttNd = pTLBox->GetSttNd();
    5020         [ #  # ]:          0 :                 SwPosition aPos(*pSttNd);
    5021                 :            :                 // Cursor in die obere linke Zelle des Ranges setzen
    5022         [ #  # ]:          0 :                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
    5023         [ #  # ]:          0 :                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
    5024                 :          0 :                 pUnoCrsr->SetRemainInSection( sal_False );
    5025         [ #  # ]:          0 :                 String sTRName = lcl_GetCellName(nIndex + nCount - 1, 0);
    5026         [ #  # ]:          0 :                 const SwTableBox* pTRBox = pTable->GetTblBox( sTRName );
    5027         [ #  # ]:          0 :                 if(pTRBox)
    5028                 :            :                 {
    5029         [ #  # ]:          0 :                     pUnoCrsr->SetMark();
    5030         [ #  # ]:          0 :                     pUnoCrsr->GetPoint()->nNode = *pTRBox->GetSttNd();
    5031         [ #  # ]:          0 :                     pUnoCrsr->Move( fnMoveForward, fnGoNode );
    5032                 :            :                     SwUnoTableCrsr* pCrsr =
    5033         [ #  # ]:          0 :                         dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
    5034         [ #  # ]:          0 :                     pCrsr->MakeBoxSels();
    5035                 :            :                     {   // Die Klammer ist wichtig
    5036         [ #  # ]:          0 :                         UnoActionContext aAction(pFrmFmt->GetDoc());
    5037         [ #  # ]:          0 :                         pFrmFmt->GetDoc()->DeleteCol(*pUnoCrsr);
    5038 [ #  # ][ #  # ]:          0 :                         delete pUnoCrsr;
    5039         [ #  # ]:          0 :                         bSuccess = sal_True;
    5040                 :            :                     }
    5041                 :            :                     {
    5042                 :            :                         // hier muessen die Actions aufgehoben werden
    5043 [ #  # ][ #  # ]:          0 :                         UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
    5044                 :            :                     }
    5045 [ #  # ][ #  # ]:          0 :                 }
    5046         [ #  # ]:          0 :             }
    5047                 :            :         }
    5048         [ #  # ]:          0 :         if(!bSuccess)
    5049                 :            :         {
    5050         [ #  # ]:          0 :             uno::RuntimeException aExcept;
    5051         [ #  # ]:          0 :             aExcept.Message = C2U("Illegal arguments");
    5052         [ #  # ]:          0 :             throw aExcept;
    5053                 :            :         }
    5054 [ #  # ][ #  # ]:          0 :     }
    5055                 :            : }
    5056                 :            : 
    5057                 :          4 : void SwXTableColumns::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    5058                 :            : {
    5059                 :          4 :     ClientModify(this, pOld, pNew);
    5060                 :          4 : }
    5061                 :            : 
    5062                 :        384 : void SwChartEventListenerContainer::ChartDataChanged()
    5063                 :            : {
    5064         [ +  + ]:        384 :     if(pListenerArr)
    5065                 :            :     {
    5066                 :            :         //TODO: find appropriate settings of the Event
    5067 [ +  - ][ +  - ]:          4 :         lang::EventObject aObj(pxParent);
    5068         [ +  - ]:          4 :         chart::ChartDataChangeEvent aEvent;
    5069                 :          4 :         aEvent.Type = chart::ChartDataChangeType_ALL;
    5070                 :          4 :         aEvent.StartColumn = 0;
    5071                 :          4 :         aEvent.EndColumn = 1;
    5072                 :          4 :         aEvent.StartRow = 0;
    5073                 :          4 :         aEvent.EndRow = 1;
    5074                 :            : 
    5075         [ +  + ]:         10 :         for(sal_uInt16 i = 0; i < pListenerArr->size(); i++)
    5076                 :            :         {
    5077                 :            :             try
    5078                 :            :             {
    5079                 :          6 :                 XEventListenerPtr pElem = (*pListenerArr)[i];
    5080                 :          6 :                 uno::Reference<lang::XEventListener> xEventListener = *pElem;
    5081 [ +  - ][ +  - ]:          6 :                 uno::Reference<chart::XChartDataChangeEventListener> xChartEventListener = (chart::XChartDataChangeEventListener*)(*pElem).get();
    5082 [ +  - ][ +  - ]:          6 :                 xChartEventListener->chartDataChanged( aEvent );
                 [ #  # ]
    5083                 :            :             }
    5084         [ #  # ]:          0 :             catch(uno::Exception const &)
    5085                 :            :             {
    5086                 :            :             }
    5087 [ +  - ][ +  - ]:          4 :         }
    5088                 :            :     }
    5089                 :        384 : }
    5090                 :            : 
    5091                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10