LibreOffice Module sc (master) 1
XMLExportSharedData.cxx
Go to the documentation of this file.
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
21#include "XMLExportIterator.hxx"
22#include <osl/diagnose.h>
23
24using namespace com::sun::star;
25
26ScMySharedData::ScMySharedData(const sal_Int32 nTempTableCount) :
27 nLastColumns(nTempTableCount, 0),
28 nLastRows(nTempTableCount, 0),
29 pDetectiveObjContainer(new ScMyDetectiveObjContainer()),
30 nTableCount(nTempTableCount)
31{
32}
33
35{
36 pShapesContainer.reset();
37 pTableShapes.reset();
38 pDrawPages.reset();
40 pNoteShapes.reset();
41}
42
43void ScMySharedData::SetLastColumn(const sal_Int32 nTable, const sal_Int32 nCol)
44{
45 if(nCol > nLastColumns[nTable]) nLastColumns[nTable] = nCol;
46}
47
48sal_Int32 ScMySharedData::GetLastColumn(const sal_Int32 nTable) const
49{
50 return nLastColumns[nTable];
51}
52
53void ScMySharedData::SetLastRow(const sal_Int32 nTable, const sal_Int32 nRow)
54{
55 if(nRow > nLastRows[nTable]) nLastRows[nTable] = nRow;
56}
57
58sal_Int32 ScMySharedData::GetLastRow(const sal_Int32 nTable) const
59{
60 return nLastRows[nTable];
61}
62
63void ScMySharedData::AddDrawPage(const ScMyDrawPage& aDrawPage, const sal_Int32 nTable)
64{
65 if (!pDrawPages)
67 (*pDrawPages)[nTable] = aDrawPage;
68}
69
70void ScMySharedData::SetDrawPageHasForms(const sal_Int32 nTable, bool bHasForms)
71{
72 OSL_ENSURE(pDrawPages, "DrawPages not collected");
73 if (pDrawPages)
74 (*pDrawPages)[nTable].bHasForms = bHasForms;
75}
76
77uno::Reference<drawing::XDrawPage> ScMySharedData::GetDrawPage(const sal_Int32 nTable)
78{
79 OSL_ENSURE(pDrawPages, "DrawPages not collected");
80 if (pDrawPages)
81 return (*pDrawPages)[nTable].xDrawPage;
82 else
83 return uno::Reference<drawing::XDrawPage>();
84}
85
86bool ScMySharedData::HasForm(const sal_Int32 nTable, uno::Reference<drawing::XDrawPage>& xDrawPage)
87{
88 bool bResult(false);
89 if (pDrawPages)
90 {
91 if ((*pDrawPages)[nTable].bHasForms)
92 {
93 bResult = true;
94 xDrawPage = (*pDrawPages)[nTable].xDrawPage;
95 }
96 }
97 return bResult;
98}
99
101{
102 if (!pShapesContainer)
104 pShapesContainer->AddNewShape(aMyShape);
105}
106
108{
110 pShapesContainer->Sort();
111}
112
113void ScMySharedData::AddTableShape(const sal_Int32 nTable, const uno::Reference<drawing::XShape>& xShape)
114{
115 if (!pTableShapes)
117 (*pTableShapes)[nTable].push_back(xShape);
118}
119
120void ScMySharedData::AddNoteObj(const uno::Reference<drawing::XShape>& xShape, const ScAddress& rPos)
121{
122 if (!pNoteShapes)
124 ScMyNoteShape aNote;
125 aNote.xShape = xShape;
126 aNote.aPos = rPos;
127 pNoteShapes->AddNewNote(aNote);
128}
129
131{
132 if (pNoteShapes)
133 pNoteShapes->Sort();
134}
135
136/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< ScMyTableXShapes > ScMyTableShapes
std::vector< ScMyDrawPage > ScMyDrawPages
std::unique_ptr< ScMyShapesContainer > pShapesContainer
sal_Int32 GetLastRow(const sal_Int32 nTable) const
sal_Int32 GetLastColumn(const sal_Int32 nTable) const
void SetDrawPageHasForms(const sal_Int32 nTable, bool bHasForms)
bool HasForm(const sal_Int32 nTable, css::uno::Reference< css::drawing::XDrawPage > &xDrawPage)
std::vector< sal_Int32 > nLastColumns
ScMySharedData(const sal_Int32 nTableCount)
void SetLastColumn(const sal_Int32 nTable, const sal_Int32 nCol)
std::vector< sal_Int32 > nLastRows
css::uno::Reference< css::drawing::XDrawPage > GetDrawPage(const sal_Int32 nTable)
void AddDrawPage(const ScMyDrawPage &aDrawPage, const sal_Int32 nTable)
std::unique_ptr< ScMyTableShapes > pTableShapes
std::unique_ptr< ScMyDrawPages > pDrawPages
void AddTableShape(const sal_Int32 nTable, const css::uno::Reference< css::drawing::XShape > &xShape)
void SetLastRow(const sal_Int32 nTable, const sal_Int32 nRow)
std::unique_ptr< ScMyNoteShapesContainer > pNoteShapes
void AddNewShape(const ScMyShape &aMyShape)
std::unique_ptr< ScMyDetectiveObjContainer > pDetectiveObjContainer
void AddNoteObj(const css::uno::Reference< css::drawing::XShape > &xShape, const ScAddress &rPos)
css::uno::Reference< css::drawing::XShape > xShape