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 : #ifndef SC_XMLCELLI_HXX
20 : #define SC_XMLCELLI_HXX
21 :
22 : #include <memory>
23 : #include "XMLDetectiveContext.hxx"
24 : #include "XMLCellRangeSourceContext.hxx"
25 : #include <xmloff/xmlictxt.hxx>
26 : #include <xmloff/xmlimp.hxx>
27 : #include <com/sun/star/table/XCell.hpp>
28 : #include <com/sun/star/util/DateTime.hpp>
29 : #include <com/sun/star/table/XCellRange.hpp>
30 : #include <com/sun/star/table/CellRangeAddress.hpp>
31 : #include <com/sun/star/table/CellAddress.hpp>
32 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
33 : #include <com/sun/star/document/XActionLockable.hpp>
34 :
35 : #include "formula/grammar.hxx"
36 : #include <boost/optional.hpp>
37 :
38 : class ScXMLImport;
39 : class ScFormulaCell;
40 : struct ScXMLAnnotationData;
41 :
42 : class ScXMLTableRowCellContext : public SvXMLImportContext
43 : {
44 : typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > FormulaWithNamespace;
45 : com::sun::star::uno::Reference<com::sun::star::table::XCell> xBaseCell;
46 : com::sun::star::uno::Reference<com::sun::star::document::XActionLockable> xLockable;
47 : ::boost::optional< rtl::OUString > pOUTextValue;
48 : ::boost::optional< rtl::OUString > pOUTextContent;
49 : ::boost::optional< FormulaWithNamespace > pOUFormula;
50 : rtl::OUString* pContentValidationName;
51 : ::std::auto_ptr< ScXMLAnnotationData > mxAnnotationData;
52 : ScMyImpDetectiveObjVec* pDetectiveObjVec;
53 : ScMyImpCellRangeSource* pCellRangeSource;
54 : double fValue;
55 : SCROW nMergedRows, nMatrixRows, nRepeatedRows;
56 : SCCOL nMergedCols, nMatrixCols, nColsRepeated;
57 : ScXMLImport& rXMLImport;
58 : formula::FormulaGrammar::Grammar eGrammar;
59 : sal_Int16 nCellType;
60 : bool bIsMerged;
61 : bool bIsMatrix;
62 : bool bIsCovered;
63 : bool bIsEmpty;
64 : bool bHasTextImport;
65 : bool bIsFirstTextImport;
66 : bool bSolarMutexLocked;
67 : bool bFormulaTextResult;
68 :
69 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
70 1821 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
71 :
72 : sal_Int16 GetCellType(const rtl::OUString& sOUValue) const;
73 :
74 : void DoMerge(const ScAddress& rScCellPos, const SCCOL nCols, const SCROW nRows);
75 :
76 : void SetContentValidation( const ScRange& rScRange );
77 : void SetContentValidation( const ScAddress& rScCellPos );
78 :
79 : void LockSolarMutex();
80 : void UnlockSolarMutex();
81 :
82 : bool HasSpecialContent() const;
83 : bool CellsAreRepeated() const;
84 :
85 : void SetFormulaCell ( ScFormulaCell* pFCell ) const;
86 : void PutTextCell ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
87 : const ::boost::optional< rtl::OUString >& pOUText );
88 : void PutValueCell ( const ScAddress& rScCurrentPos );
89 : void AddTextAndValueCells ( const ScAddress& rScCellPos,
90 : const ::boost::optional< rtl::OUString >& pOUText, ScAddress& rScCurrentPos );
91 : void AddNonFormulaCells ( const ScAddress& rScCellPos );
92 : void PutFormulaCell ( const ScAddress& rScCurrentPos );
93 : void AddFormulaCell ( const ScAddress& rScCellPos );
94 :
95 : bool HasSpecialCaseFormulaText() const;
96 :
97 : public:
98 :
99 : ScXMLTableRowCellContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
100 : const ::rtl::OUString& rLName,
101 : const ::com::sun::star::uno::Reference<
102 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
103 : const bool bIsCovered, const sal_Int32 nRepeatedRows );
104 :
105 : virtual ~ScXMLTableRowCellContext();
106 :
107 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
108 : const ::rtl::OUString& rLocalName,
109 : const ::com::sun::star::uno::Reference<
110 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
111 :
112 321 : inline void SetString(const rtl::OUString& rOUTempText) { pOUTextContent.reset(rOUTempText); }
113 : void SetCursorOnTextImport(const rtl::OUString& rOUTempText);
114 :
115 : void SetAnnotation( const ScAddress& rPosition );
116 : void SetDetectiveObj( const ScAddress& rPosition );
117 : void SetCellRangeSource( const ScAddress& rPosition );
118 :
119 : virtual void EndElement();
120 : };
121 :
122 : #endif
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|