LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLExportSharedData.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 75 0.0 %
Date: 2014-04-14 Functions: 0 16 0.0 %
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           0 : 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           0 :     nTableCount(nTempTableCount)
      34             : {
      35           0 : }
      36             : 
      37           0 : ScMySharedData::~ScMySharedData()
      38             : {
      39           0 :     if (pShapesContainer)
      40           0 :         delete pShapesContainer;
      41           0 :     if (pTableShapes)
      42           0 :         delete pTableShapes;
      43           0 :     if (pDrawPages)
      44           0 :         delete pDrawPages;
      45           0 :     if (pDetectiveObjContainer)
      46           0 :         delete pDetectiveObjContainer;
      47           0 :     if (pNoteShapes)
      48           0 :         delete pNoteShapes;
      49           0 : }
      50             : 
      51           0 : void ScMySharedData::SetLastColumn(const sal_Int32 nTable, const sal_Int32 nCol)
      52             : {
      53           0 :     if(nCol > nLastColumns[nTable]) nLastColumns[nTable] = nCol;
      54           0 : }
      55             : 
      56           0 : sal_Int32 ScMySharedData::GetLastColumn(const sal_Int32 nTable) const
      57             : {
      58           0 :     return nLastColumns[nTable];
      59             : }
      60             : 
      61           0 : void ScMySharedData::SetLastRow(const sal_Int32 nTable, const sal_Int32 nRow)
      62             : {
      63           0 :     if(nRow > nLastRows[nTable]) nLastRows[nTable] = nRow;
      64           0 : }
      65             : 
      66           0 : sal_Int32 ScMySharedData::GetLastRow(const sal_Int32 nTable) const
      67             : {
      68           0 :     return nLastRows[nTable];
      69             : }
      70             : 
      71           0 : void ScMySharedData::AddDrawPage(const ScMyDrawPage& aDrawPage, const sal_Int32 nTable)
      72             : {
      73           0 :     if (!pDrawPages)
      74           0 :         pDrawPages = new ScMyDrawPages(nTableCount, ScMyDrawPage());
      75           0 :     (*pDrawPages)[nTable] = aDrawPage;
      76           0 : }
      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           0 : uno::Reference<drawing::XDrawPage> ScMySharedData::GetDrawPage(const sal_Int32 nTable)
      86             : {
      87             :     OSL_ENSURE(pDrawPages, "DrawPages not collected");
      88           0 :     if (pDrawPages)
      89           0 :         return (*pDrawPages)[nTable].xDrawPage;
      90             :     else
      91           0 :         return uno::Reference<drawing::XDrawPage>();
      92             : }
      93             : 
      94           0 : bool ScMySharedData::HasForm(const sal_Int32 nTable, uno::Reference<drawing::XDrawPage>& xDrawPage)
      95             : {
      96           0 :     bool bResult(false);
      97           0 :     if (pDrawPages)
      98             :     {
      99           0 :         if ((*pDrawPages)[nTable].bHasForms)
     100             :         {
     101           0 :             bResult = true;
     102           0 :             xDrawPage = (*pDrawPages)[nTable].xDrawPage;
     103             :         }
     104             :     }
     105           0 :     return bResult;
     106             : }
     107             : 
     108           0 : void ScMySharedData::AddNewShape(const ScMyShape& aMyShape)
     109             : {
     110           0 :     if (!pShapesContainer)
     111           0 :         pShapesContainer = new ScMyShapesContainer();
     112           0 :     pShapesContainer->AddNewShape(aMyShape);
     113           0 : }
     114             : 
     115           0 : void ScMySharedData::SortShapesContainer()
     116             : {
     117           0 :     if (pShapesContainer)
     118           0 :         pShapesContainer->Sort();
     119           0 : }
     120             : 
     121           0 : bool ScMySharedData::HasShapes()
     122             : {
     123           0 :     return ((pShapesContainer && pShapesContainer->HasShapes()) ||
     124           0 :             (pTableShapes && !pTableShapes->empty()));
     125             : }
     126             : 
     127           0 : void ScMySharedData::AddTableShape(const sal_Int32 nTable, const uno::Reference<drawing::XShape>& xShape)
     128             : {
     129           0 :     if (!pTableShapes)
     130           0 :         pTableShapes = new ScMyTableShapes(nTableCount);
     131           0 :     (*pTableShapes)[nTable].push_back(xShape);
     132           0 : }
     133             : 
     134           0 : void ScMySharedData::AddNoteObj(const uno::Reference<drawing::XShape>& xShape, const ScAddress& rPos)
     135             : {
     136           0 :     if (!pNoteShapes)
     137           0 :         pNoteShapes = new ScMyNoteShapesContainer();
     138           0 :     ScMyNoteShape aNote;
     139           0 :     aNote.xShape = xShape;
     140           0 :     aNote.aPos = rPos;
     141           0 :     pNoteShapes->AddNewNote(aNote);
     142           0 : }
     143             : 
     144           0 : void ScMySharedData::SortNoteShapes()
     145             : {
     146           0 :     if (pNoteShapes)
     147           0 :         pNoteShapes->Sort();
     148           0 : }
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10