LibreOffice Module sc (master)  1
xmlcelli.hxx
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 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLCELLI_HXX
20 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLCELLI_HXX
21 
22 #include "XMLDetectiveContext.hxx"
23 #include "importcontext.hxx"
24 #include <formula/grammar.hxx>
25 #include <svl/itemset.hxx>
26 #include <editeng/editdata.hxx>
27 
28 #include <optional>
29 #include <memory>
30 #include <vector>
31 
32 class ScXMLImport;
33 class ScFormulaCell;
35 class SvxFieldData;
36 struct ScXMLAnnotationData;
38 
40 {
41  struct ParaFormat
42  {
45 
46  explicit ParaFormat(const ScEditEngineDefaulter& rEditEngine);
47  };
48 
49  struct Field
50  {
51  std::unique_ptr<SvxFieldData> mpData;
53 
54  Field(const Field&) = delete;
55  const Field& operator=(const Field&) = delete;
56 
57  explicit Field(std::unique_ptr<SvxFieldData> pData);
58  ~Field();
59  };
60 
61  typedef std::vector<std::unique_ptr<ParaFormat> > ParaFormatsType;
62  typedef std::vector<std::unique_ptr<Field> > FieldsType;
63  typedef std::pair<OUString, OUString> FormulaWithNamespace;
64 
65  std::optional<FormulaWithNamespace> maFormula;
66  std::optional<OUString> maStringValue;
67  std::optional<OUString> maContentValidationName;
68  std::optional<OUString> maFirstParagraph;
69 
71  OUStringBuffer maParagraph{32};
72  sal_Int32 mnCurParagraph;
73 
74  ParaFormatsType maFormats;
75  FieldsType maFields;
76 
77  std::unique_ptr< ScXMLAnnotationData > mxAnnotationData;
78  std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec;
79  std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource;
80  double fValue;
85  sal_Int16 nCellType;
86  bool bIsMerged;
87  bool bIsMatrix;
88  bool bIsCovered;
89  bool bIsEmpty;
98  bool mbHasStyle;
100 
101  void DoMerge(const ScAddress& rScCellPos, const SCCOL nCols, const SCROW nRows);
102 
103  void SetContentValidation( const ScRange& rScRange );
104  void SetContentValidation( const ScAddress& rScCellPos );
105 
106  void LockSolarMutex();
107 
108  bool CellsAreRepeated() const;
109 
110  void SetFormulaCell ( ScFormulaCell* pFCell ) const;
111  void PutTextCell ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
112  const ::std::optional< OUString >& pOUText );
113  void PutValueCell ( const ScAddress& rScCurrentPos );
114  void AddTextAndValueCell ( const ScAddress& rScCellPos,
115  const ::std::optional< OUString >& pOUText, ScAddress& rScCurrentPos );
116  void AddNonFormulaCell ( const ScAddress& rScCellPos );
117  void PutFormulaCell ( const ScAddress& rScCurrentPos );
118  void AddFormulaCell ( const ScAddress& rScCellPos );
119 
121 
122  bool IsPossibleErrorString() const;
123 
124  void PushParagraphField(std::unique_ptr<SvxFieldData> pData, const OUString& rStyleName);
125 
126  void PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString& rStyleName);
127 
128  OUString GetFirstParagraph() const;
129 
130 public:
131 
134  const bool bIsCovered, const sal_Int32 nRepeatedRows );
135 
136  virtual ~ScXMLTableRowCellContext() override;
137 
138  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
139  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
140 
141  void PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName);
142  void PushParagraphFieldDate(const OUString& rStyleName);
143  void PushParagraphFieldSheetName(const OUString& rStyleName);
144  void PushParagraphFieldDocTitle(const OUString& rStyleName);
145  void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame);
146  void PushParagraphEnd();
147 
148  void SetAnnotation( const ScAddress& rPosition );
149  void SetDetectiveObj( const ScAddress& rPosition );
150  void SetCellRangeSource( const ScAddress& rPosition );
151 
152  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
153 };
154 
155 #endif
156 
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool CellsAreRepeated() const
Definition: xmlcelli.cxx:1251
OUString GetFirstParagraph() const
Definition: xmlcelli.cxx:568
virtual ~ScXMLTableRowCellContext() override
Definition: xmlcelli.cxx:289
void AddTextAndValueCell(const ScAddress &rScCellPos, const ::std::optional< OUString > &pOUText, ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1159
void PutFormulaCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1331
ScXMLTableRowCellContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, const bool bIsCovered, const sal_Int32 nRepeatedRows)
Definition: xmlcelli.cxx:112
ScEditEngineDefaulter * mpEditEngine
unformatted first paragraph, for better performance.
Definition: xmlcelli.hxx:70
void SetAnnotation(const ScAddress &rPosition)
Definition: xmlcelli.cxx:823
void PutValueCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1117
void PushParagraphSpan(const OUString &rSpan, const OUString &rStyleName)
Definition: xmlcelli.cxx:312
std::vector< std::unique_ptr< ParaFormat > > ParaFormatsType
Definition: xmlcelli.hxx:61
ParaFormatsType maFormats
Definition: xmlcelli.hxx:74
std::unique_ptr< SvxFieldData > mpData
Definition: xmlcelli.hxx:51
std::optional< OUString > maContentValidationName
office:string-value attribute
Definition: xmlcelli.hxx:67
formula::FormulaGrammar::Grammar eGrammar
Definition: xmlcelli.hxx:84
void SetDetectiveObj(const ScAddress &rPosition)
Definition: xmlcelli.cxx:937
void PushParagraphFieldDocTitle(const OUString &rStyleName)
Definition: xmlcelli.cxx:587
void DoMerge(const ScAddress &rScCellPos, const SCCOL nCols, const SCROW nRows)
Definition: xmlcelli.cxx:713
This class exists only to provide GetScImport() to its derived classes.
std::optional< FormulaWithNamespace > maFormula
Definition: xmlcelli.hxx:65
void PushParagraphField(std::unique_ptr< SvxFieldData > pData, const OUString &rStyleName)
Definition: xmlcelli.cxx:321
sal_Int16 SCCOL
Definition: types.hxx:22
std::pair< OUString, OUString > FormulaWithNamespace
Definition: xmlcelli.hxx:63
std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec
Definition: xmlcelli.hxx:78
void PutTextCell(const ScAddress &rScCurrentPos, const SCCOL nCurrentCol, const ::std::optional< OUString > &pOUText)
Definition: xmlcelli.cxx:1020
ScXMLImport & rXMLImport
Definition: xmlcelli.hxx:83
OUStringBuffer maParagraph
Definition: xmlcelli.hxx:71
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlcelli.cxx:631
std::vector< std::unique_ptr< Field > > FieldsType
Definition: xmlcelli.hxx:62
void AddNonFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1294
std::optional< OUString > maStringValue
table:formula attribute
Definition: xmlcelli.hxx:66
sal_Int32 SCROW
Definition: types.hxx:18
void PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString &rStyleName)
Definition: xmlcelli.cxx:337
void SetContentValidation(const ScRange &rScRange)
Definition: xmlcelli.cxx:762
void SetCellRangeSource(const ScAddress &rPosition)
Definition: xmlcelli.cxx:959
void AddFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1378
void PushParagraphFieldURL(const OUString &rURL, const OUString &rRep, const OUString &rStyleName, const OUString &rTargetFrame)
Definition: xmlcelli.cxx:592
std::unique_ptr< ScXMLAnnotationData > mxAnnotationData
Definition: xmlcelli.hxx:77
void PushParagraphFieldSheetName(const OUString &rStyleName)
Definition: xmlcelli.cxx:581
std::optional< OUString > maFirstParagraph
Definition: xmlcelli.hxx:68
Field(const Field &)=delete
void PushParagraphFieldDate(const OUString &rStyleName)
Definition: xmlcelli.cxx:576
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlcelli.cxx:1486
std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource
Definition: xmlcelli.hxx:79
const Field & operator=(const Field &)=delete
void SetFormulaCell(ScFormulaCell *pFCell) const
Definition: xmlcelli.cxx:978
bool IsPossibleErrorString() const
Definition: xmlcelli.cxx:1476
ParaFormat(const ScEditEngineDefaulter &rEditEngine)
Definition: xmlcelli.cxx:103