LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLExportIterator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 140 522 26.8 %
Date: 2012-08-25 Functions: 33 84 39.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 79 536 14.7 %

           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                 :            : #include "XMLExportIterator.hxx"
      30                 :            : #include <com/sun/star/text/XSimpleText.hpp>
      31                 :            : #include <com/sun/star/sheet/XCellAddressable.hpp>
      32                 :            : #include <com/sun/star/sheet/CellFlags.hpp>
      33                 :            : #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
      34                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      35                 :            : #include <xmloff/xmlnmspe.hxx>
      36                 :            : #include "dociter.hxx"
      37                 :            : #include "convuno.hxx"
      38                 :            : #include "xmlexprt.hxx"
      39                 :            : #include "XMLExportSharedData.hxx"
      40                 :            : #include "XMLStylesExportHelper.hxx"
      41                 :            : #include "document.hxx"
      42                 :            : 
      43                 :            : #include <algorithm>
      44                 :            : 
      45                 :            : using ::rtl::OUString;
      46                 :            : using namespace ::com::sun::star;
      47                 :            : 
      48                 :            : //==============================================================================
      49                 :            : 
      50                 :         22 : ScMyIteratorBase::ScMyIteratorBase()
      51                 :            : {
      52                 :         22 : }
      53                 :            : 
      54                 :         22 : ScMyIteratorBase::~ScMyIteratorBase()
      55                 :            : {
      56         [ -  + ]:         22 : }
      57                 :            : 
      58                 :         20 : void ScMyIteratorBase::UpdateAddress( table::CellAddress& rCellAddress )
      59                 :            : {
      60                 :         20 :     table::CellAddress aNewAddr( rCellAddress );
      61 [ +  - ][ -  + ]:         20 :     if( GetFirstAddress( aNewAddr ) )
      62                 :            :     {
      63 [ #  # ][ #  # ]:          0 :         if( (aNewAddr.Sheet == rCellAddress.Sheet) &&
         [ #  # ][ #  # ]
      64                 :            :             ((aNewAddr.Row < rCellAddress.Row) ||
      65                 :            :             ((aNewAddr.Row == rCellAddress.Row) && (aNewAddr.Column < rCellAddress.Column))) )
      66                 :          0 :             rCellAddress = aNewAddr;
      67                 :            :     }
      68                 :         20 : }
      69                 :            : 
      70                 :            : 
      71                 :            : //==============================================================================
      72                 :            : 
      73                 :          0 : bool ScMyShape::operator<(const ScMyShape& aShape) const
      74                 :            : {
      75         [ #  # ]:          0 :     if( aAddress.Tab() != aShape.aAddress.Tab() )
      76                 :          0 :         return (aAddress.Tab() < aShape.aAddress.Tab());
      77         [ #  # ]:          0 :     else if( aAddress.Row() != aShape.aAddress.Row() )
      78                 :          0 :         return (aAddress.Row() < aShape.aAddress.Row());
      79                 :            :     else
      80                 :          0 :         return (aAddress.Col() < aShape.aAddress.Col());
      81                 :            : }
      82                 :            : 
      83                 :          0 : ScMyShapesContainer::ScMyShapesContainer()
      84         [ #  # ]:          0 :     : aShapeList()
      85                 :            : {
      86                 :          0 : }
      87                 :            : 
      88                 :          0 : ScMyShapesContainer::~ScMyShapesContainer()
      89                 :            : {
      90         [ #  # ]:          0 : }
      91                 :            : 
      92                 :          0 : void ScMyShapesContainer::AddNewShape( const ScMyShape& aShape )
      93                 :            : {
      94                 :          0 :     aShapeList.push_back(aShape);
      95                 :          0 : }
      96                 :            : 
      97                 :          0 : bool ScMyShapesContainer::GetFirstAddress( table::CellAddress& rCellAddress )
      98                 :            : {
      99                 :          0 :     sal_Int32 nTable(rCellAddress.Sheet);
     100         [ #  # ]:          0 :     if( !aShapeList.empty() )
     101                 :            :     {
     102                 :          0 :         ScUnoConversion::FillApiAddress( rCellAddress, aShapeList.begin()->aAddress );
     103                 :          0 :         return (nTable == rCellAddress.Sheet);
     104                 :            :     }
     105                 :          0 :     return false;
     106                 :            : }
     107                 :            : 
     108                 :          0 : void ScMyShapesContainer::SetCellData( ScMyCell& rMyCell )
     109                 :            : {
     110                 :          0 :     rMyCell.aShapeList.clear();
     111                 :          0 :     ScAddress aAddress;
     112                 :          0 :     ScUnoConversion::FillScAddress( aAddress, rMyCell.aCellAddress );
     113                 :            : 
     114                 :          0 :     ScMyShapeList::iterator aItr(aShapeList.begin());
     115                 :          0 :     ScMyShapeList::iterator aEndItr(aShapeList.end());
     116 [ #  # ][ #  # ]:          0 :     while( (aItr != aEndItr) && (aItr->aAddress == aAddress) )
                 [ #  # ]
     117                 :            :     {
     118         [ #  # ]:          0 :         rMyCell.aShapeList.push_back(*aItr);
     119         [ #  # ]:          0 :         aItr = aShapeList.erase(aItr);
     120                 :            :     }
     121                 :          0 :     rMyCell.bHasShape = !rMyCell.aShapeList.empty();
     122                 :          0 : }
     123                 :            : 
     124                 :          0 : void ScMyShapesContainer::SkipTable(SCTAB nSkip)
     125                 :            : {
     126                 :          0 :     ScMyShapeList::iterator aItr = aShapeList.begin();
     127 [ #  # ][ #  # ]:          0 :     while( (aItr != aShapeList.end()) && (aItr->aAddress.Tab() == nSkip) )
         [ #  # ][ #  # ]
     128         [ #  # ]:          0 :         aItr = aShapeList.erase(aItr);
     129                 :          0 : }
     130                 :            : 
     131                 :          0 : void ScMyShapesContainer::Sort()
     132                 :            : {
     133                 :          0 :     aShapeList.sort();
     134                 :          0 : }
     135                 :            : 
     136                 :          0 : bool ScMyNoteShape::operator<(const ScMyNoteShape& aNote) const
     137                 :            : {
     138         [ #  # ]:          0 :     if( aPos.Tab() != aNote.aPos.Tab() )
     139                 :          0 :         return (aPos.Tab() < aNote.aPos.Tab());
     140         [ #  # ]:          0 :     else if( aPos.Row() != aNote.aPos.Row() )
     141                 :          0 :         return (aPos.Row() < aNote.aPos.Row());
     142                 :            :     else
     143                 :          0 :         return (aPos.Col() < aNote.aPos.Col());
     144                 :            : }
     145                 :            : 
     146                 :          0 : ScMyNoteShapesContainer::ScMyNoteShapesContainer()
     147         [ #  # ]:          0 :     : aNoteShapeList()
     148                 :            : {
     149                 :          0 : }
     150                 :            : 
     151                 :          0 : ScMyNoteShapesContainer::~ScMyNoteShapesContainer()
     152                 :            : {
     153         [ #  # ]:          0 : }
     154                 :            : 
     155                 :          0 : void ScMyNoteShapesContainer::AddNewNote( const ScMyNoteShape& aNote )
     156                 :            : {
     157                 :          0 :     aNoteShapeList.push_back(aNote);
     158                 :          0 : }
     159                 :            : 
     160                 :          0 : bool ScMyNoteShapesContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     161                 :            : {
     162                 :          0 :     sal_Int16 nTable = rCellAddress.Sheet;
     163         [ #  # ]:          0 :     if( !aNoteShapeList.empty() )
     164                 :            :     {
     165                 :          0 :         ScUnoConversion::FillApiAddress( rCellAddress, aNoteShapeList.begin()->aPos );
     166                 :          0 :         return (nTable == rCellAddress.Sheet);
     167                 :            :     }
     168                 :          0 :     return false;
     169                 :            : }
     170                 :            : 
     171                 :          0 : void ScMyNoteShapesContainer::SetCellData( ScMyCell& rMyCell )
     172                 :            : {
     173                 :          0 :     rMyCell.xNoteShape.clear();
     174                 :          0 :     ScAddress aAddress;
     175                 :          0 :     ScUnoConversion::FillScAddress( aAddress, rMyCell.aCellAddress );
     176                 :            : 
     177                 :          0 :     ScMyNoteShapeList::iterator aItr = aNoteShapeList.begin();
     178 [ #  # ][ #  # ]:          0 :     while( (aItr != aNoteShapeList.end()) && (aItr->aPos == aAddress) )
         [ #  # ][ #  # ]
     179                 :            :     {
     180         [ #  # ]:          0 :         rMyCell.xNoteShape = aItr->xShape;
     181         [ #  # ]:          0 :         aItr = aNoteShapeList.erase(aItr);
     182                 :            :     }
     183                 :          0 : }
     184                 :            : 
     185                 :          0 : void ScMyNoteShapesContainer::SkipTable(SCTAB nSkip)
     186                 :            : {
     187                 :          0 :     ScMyNoteShapeList::iterator aItr = aNoteShapeList.begin();
     188 [ #  # ][ #  # ]:          0 :     while( (aItr != aNoteShapeList.end()) && (aItr->aPos.Tab() == nSkip) )
         [ #  # ][ #  # ]
     189         [ #  # ]:          0 :         aItr = aNoteShapeList.erase(aItr);
     190                 :          0 : }
     191                 :            : 
     192                 :          0 : void ScMyNoteShapesContainer::Sort()
     193                 :            : {
     194                 :          0 :     aNoteShapeList.sort();
     195                 :          0 : }
     196                 :            : 
     197                 :            : //==============================================================================
     198                 :            : 
     199                 :          0 : bool ScMyMergedRange::operator<(const ScMyMergedRange& aRange) const
     200                 :            : {
     201         [ #  # ]:          0 :     if( aCellRange.Sheet != aRange.aCellRange.Sheet )
     202                 :          0 :         return (aCellRange.Sheet < aRange.aCellRange.Sheet);
     203         [ #  # ]:          0 :     else if( aCellRange.StartRow != aRange.aCellRange.StartRow )
     204                 :          0 :         return (aCellRange.StartRow < aRange.aCellRange.StartRow);
     205                 :            :     else
     206                 :          0 :         return (aCellRange.StartColumn < aRange.aCellRange.StartColumn);
     207                 :            : }
     208                 :            : 
     209                 :            : 
     210                 :          6 : ScMyMergedRangesContainer::ScMyMergedRangesContainer()
     211         [ +  - ]:          6 :     : aRangeList()
     212                 :            : {
     213                 :          6 : }
     214                 :            : 
     215                 :          6 : ScMyMergedRangesContainer::~ScMyMergedRangesContainer()
     216                 :            : {
     217         [ -  + ]:         12 : }
     218                 :            : 
     219                 :          0 : void ScMyMergedRangesContainer::AddRange(const table::CellRangeAddress aMergedRange)
     220                 :            : {
     221                 :          0 :     sal_Int32 nStartRow(aMergedRange.StartRow);
     222                 :          0 :     sal_Int32 nEndRow(aMergedRange.EndRow);
     223                 :            : 
     224                 :          0 :     ScMyMergedRange aRange;
     225                 :          0 :     aRange.bIsFirst = true;
     226                 :          0 :     aRange.aCellRange = aMergedRange;
     227                 :          0 :     aRange.aCellRange.EndRow = nStartRow;
     228                 :          0 :     aRange.nRows = nEndRow - nStartRow + 1;
     229         [ #  # ]:          0 :     aRangeList.push_back( aRange );
     230                 :            : 
     231                 :          0 :     aRange.bIsFirst = false;
     232                 :          0 :     aRange.nRows = 0;
     233         [ #  # ]:          0 :     for( sal_Int32 nRow = nStartRow + 1; nRow <= nEndRow; ++nRow )
     234                 :            :     {
     235                 :          0 :         aRange.aCellRange.StartRow = aRange.aCellRange.EndRow = nRow;
     236         [ #  # ]:          0 :         aRangeList.push_back(aRange);
     237                 :            :     }
     238                 :          0 : }
     239                 :            : 
     240                 :          4 : bool ScMyMergedRangesContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     241                 :            : {
     242                 :          4 :     sal_Int32 nTable(rCellAddress.Sheet);
     243         [ -  + ]:          4 :     if( !aRangeList.empty() )
     244                 :            :     {
     245                 :          0 :         ScUnoConversion::FillApiStartAddress( rCellAddress, aRangeList.begin()->aCellRange );
     246                 :          0 :         return (nTable == rCellAddress.Sheet);
     247                 :            :     }
     248                 :          4 :     return false;
     249                 :            : }
     250                 :            : 
     251                 :          0 : void ScMyMergedRangesContainer::SetCellData( ScMyCell& rMyCell )
     252                 :            : {
     253                 :          0 :     rMyCell.bIsMergedBase = rMyCell.bIsCovered = false;
     254                 :          0 :     ScMyMergedRangeList::iterator aItr(aRangeList.begin());
     255         [ #  # ]:          0 :     if( aItr != aRangeList.end() )
     256                 :            :     {
     257                 :          0 :         table::CellAddress aFirstAddress;
     258                 :          0 :         ScUnoConversion::FillApiStartAddress( aFirstAddress, aItr->aCellRange );
     259         [ #  # ]:          0 :         if( aFirstAddress == rMyCell.aCellAddress )
     260                 :            :         {
     261                 :          0 :             rMyCell.aMergeRange = aItr->aCellRange;
     262         [ #  # ]:          0 :             if (aItr->bIsFirst)
     263                 :          0 :                 rMyCell.aMergeRange.EndRow = rMyCell.aMergeRange.StartRow + aItr->nRows - 1;
     264                 :          0 :             rMyCell.bIsMergedBase = aItr->bIsFirst;
     265                 :          0 :             rMyCell.bIsCovered = !aItr->bIsFirst;
     266         [ #  # ]:          0 :             if( aItr->aCellRange.StartColumn < aItr->aCellRange.EndColumn )
     267                 :            :             {
     268                 :          0 :                 ++(aItr->aCellRange.StartColumn);
     269                 :          0 :                 aItr->bIsFirst = false;
     270                 :            :             }
     271                 :            :             else
     272         [ #  # ]:          0 :                 aRangeList.erase(aItr);
     273                 :            :         }
     274                 :            :     }
     275                 :          0 : }
     276                 :            : 
     277                 :          0 : void ScMyMergedRangesContainer::SkipTable(SCTAB nSkip)
     278                 :            : {
     279                 :          0 :     ScMyMergedRangeList::iterator aItr = aRangeList.begin();
     280 [ #  # ][ #  # ]:          0 :     while( (aItr != aRangeList.end()) && (aItr->aCellRange.Sheet == nSkip) )
         [ #  # ][ #  # ]
     281         [ #  # ]:          0 :         aItr = aRangeList.erase(aItr);
     282                 :          0 : }
     283                 :            : 
     284                 :          4 : void ScMyMergedRangesContainer::Sort()
     285                 :            : {
     286                 :          4 :     aRangeList.sort();
     287                 :          4 : }
     288                 :            : 
     289                 :            : //==============================================================================
     290                 :            : 
     291                 :          0 : bool ScMyAreaLink::Compare( const ScMyAreaLink& rAreaLink ) const
     292                 :            : {
     293                 :          0 :     return  (GetRowCount() == rAreaLink.GetRowCount()) &&
     294                 :          0 :             (sFilter == rAreaLink.sFilter) &&
     295                 :          0 :             (sFilterOptions == rAreaLink.sFilterOptions) &&
     296                 :          0 :             (sURL == rAreaLink.sURL) &&
     297 [ #  # ][ #  #  :          0 :             (sSourceStr == rAreaLink.sSourceStr);
          #  #  #  #  #  
                      # ]
     298                 :            : }
     299                 :            : 
     300                 :          0 : bool ScMyAreaLink::operator<(const ScMyAreaLink& rAreaLink ) const
     301                 :            : {
     302         [ #  # ]:          0 :     if( aDestRange.Sheet != rAreaLink.aDestRange.Sheet )
     303                 :          0 :         return (aDestRange.Sheet < rAreaLink.aDestRange.Sheet);
     304         [ #  # ]:          0 :     else if( aDestRange.StartRow != rAreaLink.aDestRange.StartRow )
     305                 :          0 :         return (aDestRange.StartRow < rAreaLink.aDestRange.StartRow);
     306                 :            :     else
     307                 :          0 :         return (aDestRange.StartColumn < rAreaLink.aDestRange.StartColumn);
     308                 :            : }
     309                 :            : 
     310                 :          4 : ScMyAreaLinksContainer::ScMyAreaLinksContainer() :
     311         [ +  - ]:          4 :     aAreaLinkList()
     312                 :            : {
     313                 :          4 : }
     314                 :            : 
     315                 :          4 : ScMyAreaLinksContainer::~ScMyAreaLinksContainer()
     316                 :            : {
     317         [ -  + ]:          4 : }
     318                 :            : 
     319                 :          4 : bool ScMyAreaLinksContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     320                 :            : {
     321                 :          4 :     sal_Int32 nTable(rCellAddress.Sheet);
     322         [ -  + ]:          4 :     if( !aAreaLinkList.empty() )
     323                 :            :     {
     324                 :          0 :         ScUnoConversion::FillApiStartAddress( rCellAddress, aAreaLinkList.begin()->aDestRange );
     325                 :          0 :         return (nTable == rCellAddress.Sheet);
     326                 :            :     }
     327                 :          4 :     return false;
     328                 :            : }
     329                 :            : 
     330                 :          0 : void ScMyAreaLinksContainer::SetCellData( ScMyCell& rMyCell )
     331                 :            : {
     332                 :          0 :     rMyCell.bHasAreaLink = false;
     333                 :          0 :     ScMyAreaLinkList::iterator aItr(aAreaLinkList.begin());
     334         [ #  # ]:          0 :     if( aItr != aAreaLinkList.end() )
     335                 :            :     {
     336                 :          0 :         table::CellAddress aAddress;
     337                 :          0 :         ScUnoConversion::FillApiStartAddress( aAddress, aItr->aDestRange );
     338         [ #  # ]:          0 :         if( aAddress == rMyCell.aCellAddress )
     339                 :            :         {
     340                 :          0 :             rMyCell.bHasAreaLink = true;
     341                 :          0 :             rMyCell.aAreaLink = *aItr;
     342         [ #  # ]:          0 :             aItr = aAreaLinkList.erase( aItr );
     343                 :          0 :             bool bFound = true;
     344 [ #  # ][ #  # ]:          0 :             while (aItr != aAreaLinkList.end() && bFound)
         [ #  # ][ #  # ]
     345                 :            :             {
     346                 :          0 :                 ScUnoConversion::FillApiStartAddress( aAddress, aItr->aDestRange );
     347         [ #  # ]:          0 :                 if (aAddress == rMyCell.aCellAddress)
     348                 :            :                 {
     349                 :            :                     OSL_FAIL("more than one linked range on one cell");
     350         [ #  # ]:          0 :                     aItr = aAreaLinkList.erase( aItr );
     351                 :            :                 }
     352                 :            :                 else
     353                 :          0 :                     bFound = false;
     354                 :            :             }
     355                 :            :         }
     356                 :            :     }
     357                 :          0 : }
     358                 :            : 
     359                 :          0 : void ScMyAreaLinksContainer::SkipTable(SCTAB nSkip)
     360                 :            : {
     361                 :          0 :     ScMyAreaLinkList::iterator aItr = aAreaLinkList.begin();
     362 [ #  # ][ #  # ]:          0 :     while( (aItr != aAreaLinkList.end()) && (aItr->aDestRange.Sheet == nSkip) )
         [ #  # ][ #  # ]
     363         [ #  # ]:          0 :         aItr = aAreaLinkList.erase(aItr);
     364                 :          0 : }
     365                 :            : 
     366                 :          4 : void ScMyAreaLinksContainer::Sort()
     367                 :            : {
     368                 :          4 :     aAreaLinkList.sort();
     369                 :          4 : }
     370                 :            : 
     371                 :            : //==============================================================================
     372                 :            : 
     373                 :          0 : ScMyCellRangeAddress::ScMyCellRangeAddress(const table::CellRangeAddress& rRange)
     374                 :          0 :     : table::CellRangeAddress(rRange)
     375                 :            : {
     376                 :          0 : }
     377                 :            : 
     378                 :          0 : bool ScMyCellRangeAddress::operator<(const ScMyCellRangeAddress& rRange ) const
     379                 :            : {
     380         [ #  # ]:          0 :     if( Sheet != rRange.Sheet )
     381                 :          0 :         return (Sheet < rRange.Sheet);
     382         [ #  # ]:          0 :     else if( StartRow != rRange.StartRow )
     383                 :          0 :         return (StartRow < rRange.StartRow);
     384                 :            :     else
     385                 :          0 :         return (StartColumn < rRange.StartColumn);
     386                 :            : }
     387                 :            : 
     388                 :          4 : ScMyEmptyDatabaseRangesContainer::ScMyEmptyDatabaseRangesContainer()
     389         [ +  - ]:          4 :     : aDatabaseList()
     390                 :            : {
     391                 :          4 : }
     392                 :            : 
     393                 :          4 : ScMyEmptyDatabaseRangesContainer::~ScMyEmptyDatabaseRangesContainer()
     394                 :            : {
     395         [ -  + ]:          4 : }
     396                 :            : 
     397                 :          0 : void ScMyEmptyDatabaseRangesContainer::AddNewEmptyDatabaseRange(const table::CellRangeAddress& aCellRange)
     398                 :            : {
     399                 :          0 :     sal_Int32 nStartRow(aCellRange.StartRow);
     400                 :          0 :     sal_Int32 nEndRow(aCellRange.EndRow);
     401                 :          0 :     ScMyCellRangeAddress aRange( aCellRange );
     402         [ #  # ]:          0 :     for( sal_Int32 nRow = nStartRow; nRow <= nEndRow; ++nRow )
     403                 :            :     {
     404                 :          0 :         aRange.StartRow = aRange.EndRow = nRow;
     405         [ #  # ]:          0 :         aDatabaseList.push_back( aRange );
     406                 :            :     }
     407                 :          0 : }
     408                 :            : 
     409                 :          4 : bool ScMyEmptyDatabaseRangesContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     410                 :            : {
     411                 :          4 :     sal_Int32 nTable(rCellAddress.Sheet);
     412         [ -  + ]:          4 :     if( !aDatabaseList.empty() )
     413                 :            :     {
     414                 :          0 :         ScUnoConversion::FillApiStartAddress( rCellAddress, *(aDatabaseList.begin()) );
     415                 :          0 :         return (nTable == rCellAddress.Sheet);
     416                 :            :     }
     417                 :          4 :     return false;
     418                 :            : }
     419                 :            : 
     420                 :          0 : void ScMyEmptyDatabaseRangesContainer::SetCellData( ScMyCell& rMyCell )
     421                 :            : {
     422                 :          0 :     rMyCell.bHasEmptyDatabase = false;
     423                 :          0 :     ScMyEmptyDatabaseRangeList::iterator aItr(aDatabaseList.begin());
     424         [ #  # ]:          0 :     if( aItr != aDatabaseList.end() )
     425                 :            :     {
     426                 :          0 :         table::CellAddress aFirstAddress;
     427                 :          0 :         ScUnoConversion::FillApiStartAddress( aFirstAddress, *aItr );
     428         [ #  # ]:          0 :         if( aFirstAddress == rMyCell.aCellAddress )
     429                 :            :         {
     430                 :          0 :             rMyCell.bHasEmptyDatabase = true;
     431         [ #  # ]:          0 :             if( aItr->StartColumn < aItr->EndColumn )
     432                 :          0 :                 ++(aItr->StartColumn);
     433                 :            :             else
     434         [ #  # ]:          0 :                 aDatabaseList.erase(aItr);
     435                 :            :         }
     436                 :            :     }
     437                 :          0 : }
     438                 :            : 
     439                 :          0 : void ScMyEmptyDatabaseRangesContainer::SkipTable(SCTAB nSkip)
     440                 :            : {
     441                 :          0 :     ScMyEmptyDatabaseRangeList::iterator aItr = aDatabaseList.begin();
     442 [ #  # ][ #  # ]:          0 :     while( (aItr != aDatabaseList.end()) && (aItr->Sheet == nSkip) )
         [ #  # ][ #  # ]
     443         [ #  # ]:          0 :         aItr = aDatabaseList.erase(aItr);
     444                 :          0 : }
     445                 :            : 
     446                 :          0 : void ScMyEmptyDatabaseRangesContainer::Sort()
     447                 :            : {
     448                 :          0 :     aDatabaseList.sort();
     449                 :          0 : }
     450                 :            : 
     451                 :            : //==============================================================================
     452                 :            : 
     453                 :          0 : bool ScMyDetectiveObj::operator<( const ScMyDetectiveObj& rDetObj) const
     454                 :            : {
     455         [ #  # ]:          0 :     if( aPosition.Sheet != rDetObj.aPosition.Sheet )
     456                 :          0 :         return (aPosition.Sheet < rDetObj.aPosition.Sheet);
     457         [ #  # ]:          0 :     else if( aPosition.Row != rDetObj.aPosition.Row )
     458                 :          0 :         return (aPosition.Row < rDetObj.aPosition.Row);
     459                 :            :     else
     460                 :          0 :         return (aPosition.Column < rDetObj.aPosition.Column);
     461                 :            : }
     462                 :            : 
     463                 :          4 : ScMyDetectiveObjContainer::ScMyDetectiveObjContainer() :
     464         [ +  - ]:          4 :     aDetectiveObjList()
     465                 :            : {
     466                 :          4 : }
     467                 :            : 
     468                 :          4 : ScMyDetectiveObjContainer::~ScMyDetectiveObjContainer()
     469                 :            : {
     470         [ -  + ]:          8 : }
     471                 :            : 
     472                 :          0 : void ScMyDetectiveObjContainer::AddObject( ScDetectiveObjType eObjType, const SCTAB nSheet,
     473                 :            :                                             const ScAddress& rPosition, const ScRange& rSourceRange,
     474                 :            :                                             bool bHasError )
     475                 :            : {
     476 [ #  # ][ #  # ]:          0 :     if( (eObjType == SC_DETOBJ_ARROW) ||
         [ #  # ][ #  # ]
     477                 :            :         (eObjType == SC_DETOBJ_FROMOTHERTAB) ||
     478                 :            :         (eObjType == SC_DETOBJ_TOOTHERTAB) ||
     479                 :            :         (eObjType == SC_DETOBJ_CIRCLE) )
     480                 :            :     {
     481                 :          0 :         ScMyDetectiveObj aDetObj;
     482                 :          0 :         aDetObj.eObjType = eObjType;
     483         [ #  # ]:          0 :         if( eObjType == SC_DETOBJ_TOOTHERTAB )
     484                 :          0 :             ScUnoConversion::FillApiAddress( aDetObj.aPosition, rSourceRange.aStart );
     485                 :            :         else
     486                 :          0 :             ScUnoConversion::FillApiAddress( aDetObj.aPosition, rPosition );
     487                 :          0 :         ScUnoConversion::FillApiRange( aDetObj.aSourceRange, rSourceRange );
     488                 :            : 
     489                 :            :         // #111064#; take the sheet where the object is found and not the sheet given in the ranges, because they are not always true
     490         [ #  # ]:          0 :         if (eObjType != SC_DETOBJ_FROMOTHERTAB)
     491                 :            :         {
     492                 :            :             // if the ObjType == SC_DETOBJ_FROMOTHERTAB then the SourceRange is not used and so it has not to be tested and changed
     493                 :            :             OSL_ENSURE(aDetObj.aPosition.Sheet == aDetObj.aSourceRange.Sheet, "It seems to be possible to have different sheets");
     494                 :          0 :             aDetObj.aSourceRange.Sheet = nSheet;
     495                 :            :         }
     496                 :          0 :         aDetObj.aPosition.Sheet = nSheet;
     497                 :            : 
     498                 :          0 :         aDetObj.bHasError = bHasError;
     499         [ #  # ]:          0 :         aDetectiveObjList.push_back( aDetObj );
     500                 :            :     }
     501                 :          0 : }
     502                 :            : 
     503                 :          4 : bool ScMyDetectiveObjContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     504                 :            : {
     505                 :          4 :     sal_Int32 nTable(rCellAddress.Sheet);
     506         [ -  + ]:          4 :     if( !aDetectiveObjList.empty() )
     507                 :            :     {
     508                 :          0 :         rCellAddress = aDetectiveObjList.begin()->aPosition;
     509                 :          0 :         return (nTable == rCellAddress.Sheet);
     510                 :            :     }
     511                 :          4 :     return false;
     512                 :            : }
     513                 :            : 
     514                 :          0 : void ScMyDetectiveObjContainer::SetCellData( ScMyCell& rMyCell )
     515                 :            : {
     516                 :          0 :     rMyCell.aDetectiveObjVec.clear();
     517                 :          0 :     ScMyDetectiveObjList::iterator aItr(aDetectiveObjList.begin());
     518                 :          0 :     ScMyDetectiveObjList::iterator aEndItr(aDetectiveObjList.end());
     519 [ #  # ][ #  # ]:          0 :     while( (aItr != aEndItr) && (aItr->aPosition == rMyCell.aCellAddress) )
                 [ #  # ]
     520                 :            :     {
     521         [ #  # ]:          0 :         rMyCell.aDetectiveObjVec.push_back( *aItr );
     522         [ #  # ]:          0 :         aItr = aDetectiveObjList.erase( aItr );
     523                 :            :     }
     524                 :          0 :     rMyCell.bHasDetectiveObj = (rMyCell.aDetectiveObjVec.size() != 0);
     525                 :          0 : }
     526                 :            : 
     527                 :          0 : void ScMyDetectiveObjContainer::SkipTable(SCTAB nSkip)
     528                 :            : {
     529                 :          0 :     ScMyDetectiveObjList::iterator aItr = aDetectiveObjList.begin();
     530 [ #  # ][ #  # ]:          0 :     while( (aItr != aDetectiveObjList.end()) && (aItr->aPosition.Sheet == nSkip) )
         [ #  # ][ #  # ]
     531         [ #  # ]:          0 :         aItr = aDetectiveObjList.erase(aItr);
     532                 :          0 : }
     533                 :            : 
     534                 :          4 : void ScMyDetectiveObjContainer::Sort()
     535                 :            : {
     536                 :          4 :     aDetectiveObjList.sort();
     537                 :          4 : }
     538                 :            : 
     539                 :            : //==============================================================================
     540                 :            : 
     541                 :          0 : bool ScMyDetectiveOp::operator<( const ScMyDetectiveOp& rDetOp) const
     542                 :            : {
     543         [ #  # ]:          0 :     if( aPosition.Sheet != rDetOp.aPosition.Sheet )
     544                 :          0 :         return (aPosition.Sheet < rDetOp.aPosition.Sheet);
     545         [ #  # ]:          0 :     else if( aPosition.Row != rDetOp.aPosition.Row )
     546                 :          0 :         return (aPosition.Row < rDetOp.aPosition.Row);
     547                 :            :     else
     548                 :          0 :         return (aPosition.Column < rDetOp.aPosition.Column);
     549                 :            : }
     550                 :            : 
     551                 :          4 : ScMyDetectiveOpContainer::ScMyDetectiveOpContainer() :
     552         [ +  - ]:          4 :     aDetectiveOpList()
     553                 :            : {
     554                 :          4 : }
     555                 :            : 
     556                 :          4 : ScMyDetectiveOpContainer::~ScMyDetectiveOpContainer()
     557                 :            : {
     558         [ -  + ]:          4 : }
     559                 :            : 
     560                 :          0 : void ScMyDetectiveOpContainer::AddOperation( ScDetOpType eOpType, const ScAddress& rPosition, sal_uInt32 nIndex )
     561                 :            : {
     562                 :          0 :     ScMyDetectiveOp aDetOp;
     563                 :          0 :     aDetOp.eOpType = eOpType;
     564                 :          0 :     ScUnoConversion::FillApiAddress( aDetOp.aPosition, rPosition );
     565                 :          0 :     aDetOp.nIndex = nIndex;
     566         [ #  # ]:          0 :     aDetectiveOpList.push_back( aDetOp );
     567                 :          0 : }
     568                 :            : 
     569                 :          4 : bool ScMyDetectiveOpContainer::GetFirstAddress( table::CellAddress& rCellAddress )
     570                 :            : {
     571                 :          4 :     sal_Int32 nTable(rCellAddress.Sheet);
     572         [ -  + ]:          4 :     if( !aDetectiveOpList.empty() )
     573                 :            :     {
     574                 :          0 :         rCellAddress = aDetectiveOpList.begin()->aPosition;
     575                 :          0 :         return (nTable == rCellAddress.Sheet);
     576                 :            :     }
     577                 :          4 :     return false;
     578                 :            : }
     579                 :            : 
     580                 :          0 : void ScMyDetectiveOpContainer::SetCellData( ScMyCell& rMyCell )
     581                 :            : {
     582                 :          0 :     rMyCell.aDetectiveOpVec.clear();
     583                 :          0 :     ScMyDetectiveOpList::iterator aItr(aDetectiveOpList.begin());
     584                 :          0 :     ScMyDetectiveOpList::iterator aEndItr(aDetectiveOpList.end());
     585 [ #  # ][ #  # ]:          0 :     while( (aItr != aEndItr) && (aItr->aPosition == rMyCell.aCellAddress) )
                 [ #  # ]
     586                 :            :     {
     587         [ #  # ]:          0 :         rMyCell.aDetectiveOpVec.push_back( *aItr );
     588         [ #  # ]:          0 :         aItr = aDetectiveOpList.erase( aItr );
     589                 :            :     }
     590                 :          0 :     rMyCell.bHasDetectiveOp = (rMyCell.aDetectiveOpVec.size() != 0);
     591                 :          0 : }
     592                 :            : 
     593                 :          0 : void ScMyDetectiveOpContainer::SkipTable(SCTAB nSkip)
     594                 :            : {
     595                 :          0 :     ScMyDetectiveOpList::iterator aItr = aDetectiveOpList.begin();
     596 [ #  # ][ #  # ]:          0 :     while( (aItr != aDetectiveOpList.end()) && (aItr->aPosition.Sheet == nSkip) )
         [ #  # ][ #  # ]
     597         [ #  # ]:          0 :         aItr = aDetectiveOpList.erase(aItr);
     598                 :          0 : }
     599                 :            : 
     600                 :          0 : void ScMyDetectiveOpContainer::Sort()
     601                 :            : {
     602                 :          0 :     aDetectiveOpList.sort();
     603                 :          0 : }
     604                 :            : 
     605                 :            : //==============================================================================
     606                 :            : 
     607                 :          8 : ScMyCell::ScMyCell() :
     608                 :            :     aShapeList(),
     609                 :            :     aDetectiveObjVec(),
     610                 :            :     fValue(0.0),
     611                 :            :     nValidationIndex(-1),
     612                 :            :     pBaseCell(NULL),
     613                 :            :     bIsAutoStyle( false ),
     614                 :            :     bHasShape( false ),
     615                 :            :     bIsMergedBase( false ),
     616                 :            :     bIsCovered( false ),
     617                 :            :     bHasAreaLink( false ),
     618                 :            :     bHasEmptyDatabase( false ),
     619                 :            :     bHasDetectiveObj( false ),
     620                 :            :     bHasDetectiveOp( false ),
     621                 :            :     bIsEditCell( false ),
     622                 :            :     bKnowWhetherIsEditCell( false ),
     623                 :            :     bHasStringValue( false ),
     624                 :            :     bHasDoubleValue( false ),
     625                 :            :     bHasXText( false ),
     626                 :            :     bIsMatrixBase( false ),
     627                 :            :     bIsMatrixCovered( false ),
     628 [ +  - ][ +  - ]:          8 :     bHasAnnotation( false )
                 [ +  - ]
     629                 :            : {
     630                 :          8 : }
     631                 :            : 
     632                 :          8 : ScMyCell::~ScMyCell()
     633                 :            : {
     634                 :          8 : }
     635                 :            : 
     636                 :            : //==============================================================================
     637                 :            : 
     638                 :          0 : bool ScMyExportAnnotation::operator<(const ScMyExportAnnotation& rAnno) const
     639                 :            : {
     640         [ #  # ]:          0 :     if( aCellAddress.Row != rAnno.aCellAddress.Row )
     641                 :          0 :         return (aCellAddress.Row < rAnno.aCellAddress.Row);
     642                 :            :     else
     643                 :          0 :         return (aCellAddress.Column < rAnno.aCellAddress.Column);
     644                 :            : }
     645                 :            : 
     646                 :            : 
     647                 :          6 : ScMyNotEmptyCellsIterator::ScMyNotEmptyCellsIterator(ScXMLExport& rTempXMLExport)
     648                 :            :     : pShapes(NULL),
     649                 :            :     pNoteShapes(NULL),
     650                 :            :     pEmptyDatabaseRanges(NULL),
     651                 :            :     pMergedRanges(NULL),
     652                 :            :     pAreaLinks(NULL),
     653                 :            :     pDetectiveObj(NULL),
     654                 :            :     pDetectiveOp(NULL),
     655                 :            :     rExport(rTempXMLExport),
     656                 :            :     pCellItr(NULL),
     657 [ +  - ][ +  - ]:          6 :     nCurrentTable(SCTAB_MAX)
     658                 :            : {
     659                 :          6 : }
     660                 :            : 
     661                 :          6 : ScMyNotEmptyCellsIterator::~ScMyNotEmptyCellsIterator()
     662                 :            : {
     663         [ +  - ]:          6 :     Clear();
     664                 :          6 : }
     665                 :            : 
     666                 :         10 : void ScMyNotEmptyCellsIterator::Clear()
     667                 :            : {
     668         [ +  + ]:         10 :     if (pCellItr)
     669         [ +  - ]:          4 :         delete pCellItr;
     670         [ -  + ]:         10 :     if (!aAnnotations.empty())
     671                 :            :     {
     672                 :            :         OSL_FAIL("not all Annotations saved");
     673                 :          0 :         aAnnotations.clear();
     674                 :            :     }
     675                 :         10 :     maNoteExportList.clear();
     676                 :         10 :     pCellItr = NULL;
     677                 :         10 :     pShapes = NULL;
     678                 :         10 :     pNoteShapes = NULL;
     679                 :         10 :     pMergedRanges = NULL;
     680                 :         10 :     pAreaLinks = NULL;
     681                 :         10 :     pEmptyDatabaseRanges = NULL;
     682                 :         10 :     pDetectiveObj = NULL;
     683                 :         10 :     pDetectiveOp = NULL;
     684                 :         10 :     nCurrentTable = SCTAB_MAX;
     685                 :         10 : }
     686                 :            : 
     687                 :          4 : void ScMyNotEmptyCellsIterator::UpdateAddress( table::CellAddress& rAddress )
     688                 :            : {
     689         [ -  + ]:          4 :     if( pCellItr->ReturnNext( nCellCol, nCellRow ) )
     690                 :            :     {
     691                 :          0 :         rAddress.Column = nCellCol;
     692                 :          0 :         rAddress.Row = nCellRow;
     693                 :            :     }
     694                 :          4 : }
     695                 :            : 
     696                 :          0 : void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, table::CellAddress& rAddress )
     697                 :            : {
     698                 :          0 :     rMyCell.aCellAddress = rAddress;
     699                 :          0 :     rMyCell.bHasStringValue = false;
     700                 :          0 :     rMyCell.bHasDoubleValue = false;
     701                 :          0 :     rMyCell.bHasXText = false;
     702                 :          0 :     rMyCell.bKnowWhetherIsEditCell = false;
     703                 :          0 :     rMyCell.bIsEditCell = false;
     704 [ #  # ][ #  # ]:          0 :     if( (nCellCol == rAddress.Column) && (nCellRow == rAddress.Row) )
     705                 :          0 :         pCellItr->GetNext( nCellCol, nCellRow );
     706                 :          0 : }
     707                 :            : 
     708                 :          0 : void ScMyNotEmptyCellsIterator::SetMatrixCellData( ScMyCell& rMyCell )
     709                 :            : {
     710                 :          0 :     rMyCell.bIsMatrixCovered = false;
     711                 :          0 :     rMyCell.bIsMatrixBase = false;
     712                 :            : 
     713                 :          0 :     bool bIsMatrixBase(false);
     714                 :            : 
     715                 :          0 :     ScAddress aScAddress;
     716                 :          0 :     ScUnoConversion::FillScAddress( aScAddress, rMyCell.aCellAddress );
     717         [ #  # ]:          0 :     CellType eCalcType = rExport.GetDocument()->GetCellType( aScAddress );
     718   [ #  #  #  # ]:          0 :     switch (eCalcType)
     719                 :            :     {
     720                 :            :         case CELLTYPE_VALUE:
     721                 :          0 :             rMyCell.nType = table::CellContentType_VALUE;
     722                 :          0 :             break;
     723                 :            :         case CELLTYPE_STRING:
     724                 :            :         case CELLTYPE_EDIT:
     725                 :          0 :             rMyCell.nType = table::CellContentType_TEXT;
     726                 :          0 :             break;
     727                 :            :         case CELLTYPE_FORMULA:
     728                 :          0 :             rMyCell.nType = table::CellContentType_FORMULA;
     729                 :          0 :             break;
     730                 :            :         default:
     731                 :          0 :             rMyCell.nType = table::CellContentType_EMPTY;
     732                 :            :     }
     733                 :            : 
     734         [ #  # ]:          0 :     if (rMyCell.nType == table::CellContentType_FORMULA)
     735 [ #  # ][ #  # ]:          0 :         if( rExport.IsMatrix( aScAddress, rMyCell.aMatrixRange, bIsMatrixBase ) )
     736                 :            :         {
     737                 :          0 :             rMyCell.bIsMatrixBase = bIsMatrixBase;
     738                 :          0 :             rMyCell.bIsMatrixCovered = !bIsMatrixBase;
     739                 :            :         }
     740                 :          0 : }
     741                 :            : 
     742                 :          0 : void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell)
     743                 :            : {
     744                 :          0 :     aCell.bHasAnnotation = false;
     745         [ #  # ]:          0 :     if (!aAnnotations.empty())
     746                 :            :     {
     747                 :          0 :         ScMyExportAnnotationList::iterator aItr(aAnnotations.begin());
     748         [ #  # ]:          0 :         if ((aCell.aCellAddress.Column == aItr->aCellAddress.Column) &&
           [ #  #  #  # ]
     749                 :          0 :             (aCell.aCellAddress.Row == aItr->aCellAddress.Row))
     750                 :            :         {
     751         [ #  # ]:          0 :             aCell.xAnnotation.set(aItr->xAnnotation);
     752         [ #  # ]:          0 :             uno::Reference<text::XSimpleText> xSimpleText(aCell.xAnnotation, uno::UNO_QUERY);
     753 [ #  # ][ #  # ]:          0 :             if (aCell.xAnnotation.is() && xSimpleText.is())
                 [ #  # ]
     754                 :            :             {
     755 [ #  # ][ #  # ]:          0 :                 aCell.sAnnotationText = xSimpleText->getString();
     756         [ #  # ]:          0 :                 if (!aCell.sAnnotationText.isEmpty())
     757                 :          0 :                     aCell.bHasAnnotation = true;
     758                 :            :             }
     759         [ #  # ]:          0 :             aAnnotations.erase(aItr);
     760                 :            :         }
     761                 :            :     }
     762                 :            : 
     763                 :            :     // test - bypass the API
     764                 :            :     // if (xCellRange.is())
     765                 :            :     //  aCell.xCell.set(xCellRange->getCellByPosition(aCell.aCellAddress.Column, aCell.aCellAddress.Row));
     766                 :          0 : }
     767                 :            : 
     768                 :            : 
     769                 :          4 : void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable,
     770                 :            :     uno::Reference<sheet::XSpreadsheet>& rxTable)
     771                 :            : {
     772                 :            :     OSL_ENSURE(aAnnotations.empty(), "not all Annotations saved");
     773                 :          4 :     aLastAddress.Row = 0;
     774                 :          4 :     aLastAddress.Column = 0;
     775                 :          4 :     aLastAddress.Sheet = nTable;
     776         [ +  - ]:          4 :     if (nCurrentTable != nTable)
     777                 :            :     {
     778                 :          4 :         maNoteExportList.clear();
     779                 :          4 :         nCurrentTable = nTable;
     780         [ -  + ]:          4 :         if (pCellItr)
     781 [ #  # ][ #  # ]:          0 :             delete pCellItr;
     782                 :          4 :         pCellItr = new ScHorizontalCellIterator(rExport.GetDocument(), nCurrentTable, 0, 0,
     783 [ +  - ][ +  - ]:          4 :             static_cast<SCCOL>(rExport.GetSharedData()->GetLastColumn(nCurrentTable)), static_cast<SCROW>(rExport.GetSharedData()->GetLastRow(nCurrentTable)));
         [ +  - ][ +  - ]
     784                 :            : 
     785         [ +  - ]:          4 :         ScNotes* pNotes = rExport.GetDocument()->GetNotes(nTable);
     786         [ +  - ]:          4 :         if(pNotes)
     787                 :            :         {
     788 [ +  - ][ +  - ]:          4 :             for(ScNotes::iterator itr = pNotes->begin(), itrEnd = pNotes->end(); itr != itrEnd; ++itr)
         [ #  # ][ +  - ]
                 [ -  + ]
     789                 :            :             {
     790                 :            :                 ScNoteExportData aExportData;
     791         [ #  # ]:          0 :                 aExportData.nCol = itr->first.first;
     792         [ #  # ]:          0 :                 aExportData.nRow = itr->first.second;
     793         [ #  # ]:          0 :                 aExportData.pNote = itr->second;
     794         [ #  # ]:          0 :                 maNoteExportList.insert( aExportData );
     795                 :            :             }
     796                 :            :         }
     797                 :          4 :         maNoteExportListItr = maNoteExportList.begin();
     798                 :            : 
     799         [ +  - ]:          4 :         xTable.set(rxTable);
     800         [ +  - ]:          4 :         xCellRange.set(xTable, uno::UNO_QUERY);
     801         [ +  - ]:          4 :         uno::Reference<sheet::XSheetAnnotationsSupplier> xSheetAnnotationsSupplier (xTable, uno::UNO_QUERY);
     802         [ +  - ]:          4 :         if (xSheetAnnotationsSupplier.is())
     803                 :            :         {
     804 [ +  - ][ +  - ]:          4 :             uno::Reference<container::XEnumerationAccess> xAnnotationAccess ( xSheetAnnotationsSupplier->getAnnotations(), uno::UNO_QUERY);
                 [ +  - ]
     805         [ +  - ]:          4 :             if (xAnnotationAccess.is())
     806                 :            :             {
     807 [ +  - ][ +  - ]:          4 :                 uno::Reference<container::XEnumeration> xAnnotations(xAnnotationAccess->createEnumeration());
     808         [ +  - ]:          4 :                 if (xAnnotations.is())
     809                 :            :                 {
     810 [ +  - ][ +  - ]:          4 :                     while (xAnnotations->hasMoreElements())
                 [ -  + ]
     811                 :            :                     {
     812         [ #  # ]:          0 :                         ScMyExportAnnotation aAnnotation;
     813 [ #  # ][ #  # ]:          0 :                         aAnnotation.xAnnotation.set(xAnnotations->nextElement(), uno::UNO_QUERY);
                 [ #  # ]
     814         [ #  # ]:          0 :                         if (aAnnotation.xAnnotation.is())
     815                 :            :                         {
     816 [ #  # ][ #  # ]:          0 :                             aAnnotation.aCellAddress = aAnnotation.xAnnotation->getPosition();
     817         [ #  # ]:          0 :                             aAnnotations.push_back(aAnnotation);
     818                 :            :                         }
     819         [ #  # ]:          0 :                     }
     820         [ -  + ]:          4 :                     if (!aAnnotations.empty())
     821         [ #  # ]:          0 :                         aAnnotations.sort();
     822                 :          4 :                 }
     823                 :          4 :             }
     824                 :          4 :         }
     825                 :            :     }
     826                 :          4 : }
     827                 :            : 
     828                 :          0 : void ScMyNotEmptyCellsIterator::SkipTable(SCTAB nSkip)
     829                 :            : {
     830                 :            :     // Skip entries for a sheet that is copied instead of saving normally.
     831                 :            :     // Cells (including aAnnotations) are handled separately in SetCurrentTable.
     832                 :            : 
     833         [ #  # ]:          0 :     if( pShapes )
     834                 :          0 :         pShapes->SkipTable(nSkip);
     835         [ #  # ]:          0 :     if( pNoteShapes )
     836                 :          0 :         pNoteShapes->SkipTable(nSkip);
     837         [ #  # ]:          0 :     if( pEmptyDatabaseRanges )
     838                 :          0 :         pEmptyDatabaseRanges->SkipTable(nSkip);
     839         [ #  # ]:          0 :     if( pMergedRanges )
     840                 :          0 :         pMergedRanges->SkipTable(nSkip);
     841         [ #  # ]:          0 :     if( pAreaLinks )
     842                 :          0 :         pAreaLinks->SkipTable(nSkip);
     843         [ #  # ]:          0 :     if( pDetectiveObj )
     844                 :          0 :         pDetectiveObj->SkipTable(nSkip);
     845         [ #  # ]:          0 :     if( pDetectiveOp )
     846                 :          0 :         pDetectiveOp->SkipTable(nSkip);
     847                 :          0 : }
     848                 :            : 
     849                 :            : namespace {
     850                 :            : 
     851                 :          0 : bool IsNoteBeforeNextCell(const SCCOL nCol, const SCROW nRow, const table::CellAddress& rAddress)
     852                 :            : {
     853         [ #  # ]:          0 :     if(nRow < rAddress.Row)
     854                 :          0 :         return true;
     855         [ #  # ]:          0 :     else if(nRow > rAddress.Row)
     856                 :          0 :         return false;
     857                 :            :     else
     858                 :            :     {
     859         [ #  # ]:          0 :         if(nCol < rAddress.Column)
     860                 :          0 :             return true;
     861                 :            :         else
     862                 :          0 :             return false;
     863                 :            :     }
     864                 :            : }
     865                 :            : 
     866                 :            : }
     867                 :            : 
     868                 :          4 : bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, ScFormatRangeStyles* pCellStyles)
     869                 :            : {
     870                 :          4 :     table::CellAddress  aAddress( nCurrentTable, MAXCOL + 1, MAXROW + 1 );
     871                 :            : 
     872         [ +  - ]:          4 :     UpdateAddress( aAddress );
     873 [ -  + ][ #  # ]:          4 :     if( (maNoteExportListItr != maNoteExportList.end()) && IsNoteBeforeNextCell(maNoteExportListItr->nCol, maNoteExportListItr->nRow, aAddress) )
         [ +  - ][ -  + ]
     874                 :            :     {
     875                 :            :         //we have a note before the new cell
     876                 :          0 :         aAddress.Column = maNoteExportListItr->nCol;
     877                 :          0 :         aAddress.Row = maNoteExportListItr->nRow;
     878                 :          0 :         ++maNoteExportListItr;
     879                 :            :     }
     880                 :            :     else
     881                 :            :     {
     882 [ -  + ][ #  # ]:          4 :         if(maNoteExportListItr != maNoteExportList.end() && maNoteExportListItr->nCol == aAddress.Column && maNoteExportListItr->nRow == aAddress.Row)
         [ #  # ][ +  - ]
                 [ -  + ]
     883                 :          0 :             ++maNoteExportListItr;
     884                 :            : 
     885         [ -  + ]:          4 :         if( pShapes )
     886         [ #  # ]:          0 :             pShapes->UpdateAddress( aAddress );
     887         [ -  + ]:          4 :         if( pNoteShapes )
     888         [ #  # ]:          0 :             pNoteShapes->UpdateAddress( aAddress );
     889         [ +  - ]:          4 :         if( pEmptyDatabaseRanges )
     890         [ +  - ]:          4 :             pEmptyDatabaseRanges->UpdateAddress( aAddress );
     891         [ +  - ]:          4 :         if( pMergedRanges )
     892         [ +  - ]:          4 :             pMergedRanges->UpdateAddress( aAddress );
     893         [ +  - ]:          4 :         if( pAreaLinks )
     894         [ +  - ]:          4 :             pAreaLinks->UpdateAddress( aAddress );
     895         [ +  - ]:          4 :         if( pDetectiveObj )
     896         [ +  - ]:          4 :             pDetectiveObj->UpdateAddress( aAddress );
     897         [ +  - ]:          4 :         if( pDetectiveOp )
     898         [ +  - ]:          4 :             pDetectiveOp->UpdateAddress( aAddress );
     899                 :            :     }
     900                 :            : 
     901 [ -  + ][ #  # ]:          4 :     bool bFoundCell((aAddress.Column <= MAXCOL) && (aAddress.Row <= MAXROW));
     902         [ -  + ]:          4 :     if( bFoundCell )
     903                 :            :     {
     904         [ #  # ]:          0 :         SetCellData( aCell, aAddress );
     905         [ #  # ]:          0 :         if( pShapes )
     906         [ #  # ]:          0 :             pShapes->SetCellData( aCell );
     907         [ #  # ]:          0 :         if( pNoteShapes )
     908         [ #  # ]:          0 :             pNoteShapes->SetCellData( aCell );
     909         [ #  # ]:          0 :         if( pEmptyDatabaseRanges )
     910         [ #  # ]:          0 :             pEmptyDatabaseRanges->SetCellData( aCell );
     911         [ #  # ]:          0 :         if( pMergedRanges )
     912         [ #  # ]:          0 :             pMergedRanges->SetCellData( aCell );
     913         [ #  # ]:          0 :         if( pAreaLinks )
     914         [ #  # ]:          0 :             pAreaLinks->SetCellData( aCell );
     915         [ #  # ]:          0 :         if( pDetectiveObj )
     916         [ #  # ]:          0 :             pDetectiveObj->SetCellData( aCell );
     917         [ #  # ]:          0 :         if( pDetectiveOp )
     918         [ #  # ]:          0 :             pDetectiveOp->SetCellData( aCell );
     919                 :            : 
     920         [ #  # ]:          0 :         HasAnnotation( aCell );
     921         [ #  # ]:          0 :         SetMatrixCellData( aCell );
     922                 :            :         bool bIsAutoStyle;
     923                 :            :         // Ranges before the previous cell are not needed by ExportFormatRanges anymore and can be removed
     924                 :          0 :         sal_Int32 nRemoveBeforeRow = aLastAddress.Row;
     925                 :            :         aCell.nStyleIndex = pCellStyles->GetStyleNameIndex(aCell.aCellAddress.Sheet,
     926                 :            :             aCell.aCellAddress.Column, aCell.aCellAddress.Row,
     927         [ #  # ]:          0 :             bIsAutoStyle, aCell.nValidationIndex, aCell.nNumberFormat, nRemoveBeforeRow);
     928                 :          0 :         aLastAddress = aCell.aCellAddress;
     929                 :          0 :         aCell.bIsAutoStyle = bIsAutoStyle;
     930                 :            : 
     931                 :            :         //#102799#; if the cell is in a DatabaseRange which should saved empty, the cell should have the type empty
     932         [ #  # ]:          0 :         if (aCell.bHasEmptyDatabase)
     933                 :          0 :             aCell.nType = table::CellContentType_EMPTY;
     934                 :            :     }
     935                 :          4 :     return bFoundCell;
     936 [ +  - ][ +  - ]:        153 : }
     937                 :            : 
     938                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10