1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLCELLI_HXX
20 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLCELLI_HXX
22 #include "XMLDetectiveContext.hxx"
23 #include "importcontext.hxx"
24 #include <formula/grammar.hxx>
25 #include <svl/itemset.hxx>
26 #include <editeng/editdata.hxx>
28 #include <boost/optional.hpp>
34 class ScEditEngineDefaulter
;
36 struct ScXMLAnnotationData
;
37 struct ScMyImpCellRangeSource
;
39 class ScXMLTableRowCellContext
: public ScXMLImportContext
44 ESelection maSelection
;
46 explicit ParaFormat(ScEditEngineDefaulter
& rEditEngine
);
51 std::unique_ptr
<SvxFieldData
> mpData
;
52 ESelection maSelection
;
54 Field(const Field
&) = delete;
55 const Field
& operator=(const Field
&) = delete;
57 explicit Field(std::unique_ptr
<SvxFieldData
> pData
);
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
;
65 boost::optional
<FormulaWithNamespace
> maFormula
; /// table:formula attribute
66 boost::optional
<OUString
> maStringValue
; /// office:string-value attribute
67 boost::optional
<OUString
> maContentValidationName
;
68 boost::optional
<OUString
> maFirstParagraph
; /// unformatted first paragraph, for better performance.
70 ScEditEngineDefaulter
* mpEditEngine
;
71 OUStringBuffer maParagraph
{32};
72 sal_Int32 mnCurParagraph
;
74 ParaFormatsType maFormats
;
77 std::unique_ptr
< ScXMLAnnotationData
> mxAnnotationData
;
78 std::unique_ptr
< ScMyImpDetectiveObjVec
> pDetectiveObjVec
;
79 std::unique_ptr
< ScMyImpCellRangeSource
> pCellRangeSource
;
81 SCROW nMergedRows
, nMatrixRows
, nRepeatedRows
;
82 SCCOL nMergedCols
, nMatrixCols
, nColsRepeated
;
83 ScXMLImport
& rXMLImport
;
84 formula::FormulaGrammar::Grammar eGrammar
;
88 bool const bIsCovered
;
92 bool bSolarMutexLocked
;
93 bool bFormulaTextResult
;
94 bool mbPossibleErrorCell
;
95 bool mbCheckWithCompilerForError
;
96 bool mbEditEngineHasText
;
99 bool mbPossibleEmptyDisplay
;
101 void DoMerge(const ScAddress
& rScCellPos
, const SCCOL nCols
, const SCROW nRows
);
103 void SetContentValidation( const ScRange
& rScRange
);
104 void SetContentValidation( const ScAddress
& rScCellPos
);
106 void LockSolarMutex();
108 bool CellsAreRepeated() const;
110 void SetFormulaCell ( ScFormulaCell
* pFCell
) const;
111 void PutTextCell ( const ScAddress
& rScCurrentPos
, const SCCOL nCurrentCol
,
112 const ::boost::optional
< OUString
>& pOUText
);
113 void PutValueCell ( const ScAddress
& rScCurrentPos
);
114 void AddTextAndValueCell ( const ScAddress
& rScCellPos
,
115 const ::boost::optional
< OUString
>& pOUText
, ScAddress
& rScCurrentPos
);
116 void AddNonFormulaCell ( const ScAddress
& rScCellPos
);
117 void PutFormulaCell ( const ScAddress
& rScCurrentPos
);
118 void AddFormulaCell ( const ScAddress
& rScCellPos
);
120 void HasSpecialCaseFormulaText();
122 bool IsPossibleErrorString() const;
124 void PushParagraphField(std::unique_ptr
<SvxFieldData
> pData
, const OUString
& rStyleName
);
126 void PushFormat(sal_Int32 nBegin
, sal_Int32 nEnd
, const OUString
& rStyleName
);
128 OUString
GetFirstParagraph() const;
132 ScXMLTableRowCellContext( ScXMLImport
& rImport
,
133 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
134 const bool bIsCovered
, const sal_Int32 nRepeatedRows
);
136 virtual ~ScXMLTableRowCellContext() override
;
138 virtual SvXMLImportContextRef
CreateChildContext( sal_uInt16 nPrefix
,
139 const OUString
& rLocalName
,
140 const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttrList
) override
;
142 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
143 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
145 void PushParagraphSpan(const OUString
& rSpan
, const OUString
& rStyleName
);
146 void PushParagraphFieldDate(const OUString
& rStyleName
);
147 void PushParagraphFieldSheetName(const OUString
& rStyleName
);
148 void PushParagraphFieldDocTitle(const OUString
& rStyleName
);
149 void PushParagraphFieldURL(const OUString
& rURL
, const OUString
& rRep
, const OUString
& rStyleName
, const OUString
& rTargetFrame
);
150 void PushParagraphEnd();
152 void SetAnnotation( const ScAddress
& rPosition
);
153 void SetDetectiveObj( const ScAddress
& rPosition
);
154 void SetCellRangeSource( const ScAddress
& rPosition
);
156 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */