LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLExportSharedData.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 67 75 89.3 %
Date: 2014-04-11 Functions: 15 16 93.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "XMLExportSharedData.hxx"
      21             : #include "XMLExportIterator.hxx"
      22             : 
      23             : using namespace com::sun::star;
      24             : 
      25          18 : ScMySharedData::ScMySharedData(const sal_Int32 nTempTableCount) :
      26             :     nLastColumns(nTempTableCount, 0),
      27             :     nLastRows(nTempTableCount, 0),
      28             :     pTableShapes(NULL),
      29             :     pDrawPages(NULL),
      30             :     pShapesContainer(NULL),
      31           0 :     pDetectiveObjContainer(new ScMyDetectiveObjContainer()),
      32             :     pNoteShapes(NULL),
      33          18 :     nTableCount(nTempTableCount)
      34             : {
      35          18 : }
      36             : 
      37          36 : ScMySharedData::~ScMySharedData()
      38             : {
      39          18 :     if (pShapesContainer)
      40           2 :         delete pShapesContainer;
      41          18 :     if (pTableShapes)
      42           3 :         delete pTableShapes;
      43          18 :     if (pDrawPages)
      44          18 :         delete pDrawPages;
      45          18 :     if (pDetectiveObjContainer)
      46          18 :         delete pDetectiveObjContainer;
      47          18 :     if (pNoteShapes)
      48           1 :         delete pNoteShapes;
      49          18 : }
      50             : 
      51          88 : void ScMySharedData::SetLastColumn(const sal_Int32 nTable, const sal_Int32 nCol)
      52             : {
      53          88 :     if(nCol > nLastColumns[nTable]) nLastColumns[nTable] = nCol;
      54          88 : }
      55             : 
      56        2307 : sal_Int32 ScMySharedData::GetLastColumn(const sal_Int32 nTable) const
      57             : {
      58        2307 :     return nLastColumns[nTable];
      59             : }
      60             : 
      61          88 : void ScMySharedData::SetLastRow(const sal_Int32 nTable, const sal_Int32 nRow)
      62             : {
      63          88 :     if(nRow > nLastRows[nTable]) nLastRows[nTable] = nRow;
      64          88 : }
      65             : 
      66          88 : sal_Int32 ScMySharedData::GetLastRow(const sal_Int32 nTable) const
      67             : {
      68          88 :     return nLastRows[nTable];
      69             : }
      70             : 
      71          22 : void ScMySharedData::AddDrawPage(const ScMyDrawPage& aDrawPage, const sal_Int32 nTable)
      72             : {
      73          22 :     if (!pDrawPages)
      74          18 :         pDrawPages = new ScMyDrawPages(nTableCount, ScMyDrawPage());
      75          22 :     (*pDrawPages)[nTable] = aDrawPage;
      76          22 : }
      77             : 
      78           0 : void ScMySharedData::SetDrawPageHasForms(const sal_Int32 nTable, bool bHasForms)
      79             : {
      80             :     OSL_ENSURE(pDrawPages, "DrawPages not collected");
      81           0 :     if (pDrawPages)
      82           0 :         (*pDrawPages)[nTable].bHasForms = bHasForms;
      83           0 : }
      84             : 
      85          44 : uno::Reference<drawing::XDrawPage> ScMySharedData::GetDrawPage(const sal_Int32 nTable)
      86             : {
      87             :     OSL_ENSURE(pDrawPages, "DrawPages not collected");
      88          44 :     if (pDrawPages)
      89          44 :         return (*pDrawPages)[nTable].xDrawPage;
      90             :     else
      91           0 :         return uno::Reference<drawing::XDrawPage>();
      92             : }
      93             : 
      94          22 : bool ScMySharedData::HasForm(const sal_Int32 nTable, uno::Reference<drawing::XDrawPage>& xDrawPage)
      95             : {
      96          22 :     bool bResult(false);
      97          22 :     if (pDrawPages)
      98             :     {
      99          22 :         if ((*pDrawPages)[nTable].bHasForms)
     100             :         {
     101           0 :             bResult = true;
     102           0 :             xDrawPage = (*pDrawPages)[nTable].xDrawPage;
     103             :         }
     104             :     }
     105          22 :     return bResult;
     106             : }
     107             : 
     108           2 : void ScMySharedData::AddNewShape(const ScMyShape& aMyShape)
     109             : {
     110           2 :     if (!pShapesContainer)
     111           2 :         pShapesContainer = new ScMyShapesContainer();
     112           2 :     pShapesContainer->AddNewShape(aMyShape);
     113           2 : }
     114             : 
     115          18 : void ScMySharedData::SortShapesContainer()
     116             : {
     117          18 :     if (pShapesContainer)
     118           2 :         pShapesContainer->Sort();
     119          18 : }
     120             : 
     121          18 : bool ScMySharedData::HasShapes()
     122             : {
     123          23 :     return ((pShapesContainer && pShapesContainer->HasShapes()) ||
     124          21 :             (pTableShapes && !pTableShapes->empty()));
     125             : }
     126             : 
     127           3 : void ScMySharedData::AddTableShape(const sal_Int32 nTable, const uno::Reference<drawing::XShape>& xShape)
     128             : {
     129           3 :     if (!pTableShapes)
     130           3 :         pTableShapes = new ScMyTableShapes(nTableCount);
     131           3 :     (*pTableShapes)[nTable].push_back(xShape);
     132           3 : }
     133             : 
     134           2 : void ScMySharedData::AddNoteObj(const uno::Reference<drawing::XShape>& xShape, const ScAddress& rPos)
     135             : {
     136           2 :     if (!pNoteShapes)
     137           1 :         pNoteShapes = new ScMyNoteShapesContainer();
     138           2 :     ScMyNoteShape aNote;
     139           2 :     aNote.xShape = xShape;
     140           2 :     aNote.aPos = rPos;
     141           2 :     pNoteShapes->AddNewNote(aNote);
     142           2 : }
     143             : 
     144          36 : void ScMySharedData::SortNoteShapes()
     145             : {
     146          36 :     if (pNoteShapes)
     147           2 :         pNoteShapes->Sort();
     148          36 : }
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10