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 #pragma once
20 
21 #include "XMLDetectiveContext.hxx"
22 #include "importcontext.hxx"
23 #include <formula/grammar.hxx>
24 #include <svl/itemset.hxx>
25 #include <editeng/editdata.hxx>
26 
27 #include <optional>
28 #include <memory>
29 #include <vector>
30 
31 class ScXMLImport;
32 class ScFormulaCell;
34 class SvxFieldData;
35 struct ScXMLAnnotationData;
37 
39 {
40  struct ParaFormat
41  {
44 
45  explicit ParaFormat(const ScEditEngineDefaulter& rEditEngine);
46  };
47 
48  struct Field
49  {
50  std::unique_ptr<SvxFieldData> mpData;
52 
53  Field(const Field&) = delete;
54  const Field& operator=(const Field&) = delete;
55 
56  explicit Field(std::unique_ptr<SvxFieldData> pData);
57  ~Field();
58  };
59 
60  typedef std::vector<std::unique_ptr<Field> > FieldsType;
61  typedef std::pair<OUString, OUString> FormulaWithNamespace;
62 
63  std::optional<FormulaWithNamespace> maFormula;
64  std::optional<OUString> maStringValue;
65  std::optional<OUString> maContentValidationName;
66  std::optional<OUString> maFirstParagraph;
67 
69  OUStringBuffer maParagraph{32};
70  sal_Int32 mnCurParagraph;
71 
72  std::vector<std::unique_ptr<ParaFormat> > maFormats;
73  FieldsType maFields;
74 
75  std::unique_ptr< ScXMLAnnotationData > mxAnnotationData;
76  std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec;
77  std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource;
78  double fValue;
83  sal_Int16 nCellType;
84  bool bIsMerged;
85  bool bIsMatrix;
86  bool bIsCovered;
87  bool bIsEmpty;
96  bool mbHasStyle;
98 
99  void DoMerge(const ScAddress& rScCellPos, const SCCOL nCols, const SCROW nRows);
100 
101  void SetContentValidation( const ScRange& rScRange );
102  void SetContentValidation( const ScAddress& rScCellPos );
103 
104  void LockSolarMutex();
105 
106  bool CellsAreRepeated() const;
107 
108  void SetFormulaCell ( ScFormulaCell* pFCell ) const;
109  void PutTextCell ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
110  const ::std::optional< OUString >& pOUText );
111  void PutValueCell ( const ScAddress& rScCurrentPos );
112  void AddTextAndValueCell ( const ScAddress& rScCellPos,
113  const ::std::optional< OUString >& pOUText, ScAddress& rScCurrentPos );
114  void AddNonFormulaCell ( const ScAddress& rScCellPos );
115  void PutFormulaCell ( const ScAddress& rScCurrentPos );
116  void AddFormulaCell ( const ScAddress& rScCellPos );
117 
119 
120  bool IsPossibleErrorString() const;
121 
122  void PushParagraphField(std::unique_ptr<SvxFieldData> pData, const OUString& rStyleName);
123 
124  void PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString& rStyleName);
125 
126  OUString GetFirstParagraph() const;
127 
128 public:
129 
132  const bool bIsCovered, const sal_Int32 nRepeatedRows );
133 
134  virtual ~ScXMLTableRowCellContext() override;
135 
136  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
137  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
138 
139  void PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName);
140  void PushParagraphFieldDate(const OUString& rStyleName);
141  void PushParagraphFieldSheetName(const OUString& rStyleName);
142  void PushParagraphFieldDocTitle(const OUString& rStyleName);
143  void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame);
144  void PushParagraphEnd();
145 
146  void SetAnnotation( const ScAddress& rPosition );
147  void SetDetectiveObj( const ScAddress& rPosition );
148  void SetCellRangeSource( const ScAddress& rPosition );
149 
150  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
151 };
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool CellsAreRepeated() const
Definition: xmlcelli.cxx:1252
OUString GetFirstParagraph() const
Definition: xmlcelli.cxx:569
virtual ~ScXMLTableRowCellContext() override
Definition: xmlcelli.cxx:290
void AddTextAndValueCell(const ScAddress &rScCellPos, const ::std::optional< OUString > &pOUText, ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1160
void PutFormulaCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1330
ScXMLTableRowCellContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, const bool bIsCovered, const sal_Int32 nRepeatedRows)
Definition: xmlcelli.cxx:115
ScEditEngineDefaulter * mpEditEngine
unformatted first paragraph, for better performance.
Definition: xmlcelli.hxx:68
void SetAnnotation(const ScAddress &rPosition)
Definition: xmlcelli.cxx:824
void PutValueCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1118
void PushParagraphSpan(const OUString &rSpan, const OUString &rStyleName)
Definition: xmlcelli.cxx:313
std::unique_ptr< SvxFieldData > mpData
Definition: xmlcelli.hxx:50
std::optional< OUString > maContentValidationName
office:string-value attribute
Definition: xmlcelli.hxx:65
formula::FormulaGrammar::Grammar eGrammar
Definition: xmlcelli.hxx:82
void SetDetectiveObj(const ScAddress &rPosition)
Definition: xmlcelli.cxx:938
void PushParagraphFieldDocTitle(const OUString &rStyleName)
Definition: xmlcelli.cxx:588
void DoMerge(const ScAddress &rScCellPos, const SCCOL nCols, const SCROW nRows)
Definition: xmlcelli.cxx:714
This class exists only to provide GetScImport() to its derived classes.
std::optional< FormulaWithNamespace > maFormula
Definition: xmlcelli.hxx:63
void PushParagraphField(std::unique_ptr< SvxFieldData > pData, const OUString &rStyleName)
Definition: xmlcelli.cxx:322
sal_Int16 SCCOL
Definition: types.hxx:21
std::pair< OUString, OUString > FormulaWithNamespace
Definition: xmlcelli.hxx:61
std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec
Definition: xmlcelli.hxx:76
void PutTextCell(const ScAddress &rScCurrentPos, const SCCOL nCurrentCol, const ::std::optional< OUString > &pOUText)
Definition: xmlcelli.cxx:1021
ScXMLImport & rXMLImport
Definition: xmlcelli.hxx:81
OUStringBuffer maParagraph
Definition: xmlcelli.hxx:69
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:632
std::vector< std::unique_ptr< Field > > FieldsType
Definition: xmlcelli.hxx:60
void AddNonFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1293
std::optional< OUString > maStringValue
table:formula attribute
Definition: xmlcelli.hxx:64
sal_Int32 SCROW
Definition: types.hxx:17
void PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString &rStyleName)
Definition: xmlcelli.cxx:338
void SetContentValidation(const ScRange &rScRange)
Definition: xmlcelli.cxx:763
void SetCellRangeSource(const ScAddress &rPosition)
Definition: xmlcelli.cxx:960
std::vector< std::unique_ptr< ParaFormat > > maFormats
Definition: xmlcelli.hxx:72
void AddFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1377
void PushParagraphFieldURL(const OUString &rURL, const OUString &rRep, const OUString &rStyleName, const OUString &rTargetFrame)
Definition: xmlcelli.cxx:593
std::unique_ptr< ScXMLAnnotationData > mxAnnotationData
Definition: xmlcelli.hxx:75
void PushParagraphFieldSheetName(const OUString &rStyleName)
Definition: xmlcelli.cxx:582
std::optional< OUString > maFirstParagraph
Definition: xmlcelli.hxx:66
Field(const Field &)=delete
void PushParagraphFieldDate(const OUString &rStyleName)
Definition: xmlcelli.cxx:577
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlcelli.cxx:1485
std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource
Definition: xmlcelli.hxx:77
const Field & operator=(const Field &)=delete
void SetFormulaCell(ScFormulaCell *pFCell) const
Definition: xmlcelli.cxx:979
bool IsPossibleErrorString() const
Definition: xmlcelli.cxx:1475
ParaFormat(const ScEditEngineDefaulter &rEditEngine)
Definition: xmlcelli.cxx:106