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 "XMLCellRangeSourceContext.hxx"
24 #include "importcontext.hxx"
25 #include <formula/grammar.hxx>
26 #include <svl/itemset.hxx>
27 #include <editeng/editdata.hxx>
28 #include <editeng/flditem.hxx>
30 #include <boost/optional.hpp>
31 #include <boost/scoped_ptr.hpp>
32 #include <boost/ptr_container/ptr_vector.hpp>
33 #include <boost/noncopyable.hpp>
37 class ScEditEngineDefaulter
;
38 struct ScXMLAnnotationData
;
40 class ScXMLTableRowCellContext
: public ScXMLImportContext
45 ESelection maSelection
;
47 ParaFormat(ScEditEngineDefaulter
& rEditEngine
);
50 struct Field
: boost::noncopyable
53 ESelection maSelection
;
55 Field(SvxFieldData
* pData
);
59 typedef boost::ptr_vector
<ParaFormat
> ParaFormatsType
;
60 typedef boost::ptr_vector
<Field
> FieldsType
;
61 typedef std::pair
<OUString
, OUString
> FormulaWithNamespace
;
63 boost::optional
<FormulaWithNamespace
> maFormula
; /// table:formula attribute
64 boost::optional
<OUString
> maStringValue
; /// office:string-value attribute
65 boost::optional
<OUString
> maContentValidationName
;
66 boost::optional
<OUString
> maFirstParagraph
; /// unformatted first paragraph, for better performance.
68 ScEditEngineDefaulter
* mpEditEngine
;
69 OUStringBuffer maParagraph
;
70 sal_Int32 mnCurParagraph
;
72 ParaFormatsType maFormats
;
75 boost::scoped_ptr
< ScXMLAnnotationData
> mxAnnotationData
;
76 ScMyImpDetectiveObjVec
* pDetectiveObjVec
;
77 ScMyImpCellRangeSource
* pCellRangeSource
;
79 SCROW nMergedRows
, nMatrixRows
, nRepeatedRows
;
80 SCCOL nMergedCols
, nMatrixCols
, nColsRepeated
;
81 ScXMLImport
& rXMLImport
;
82 formula::FormulaGrammar::Grammar eGrammar
;
90 bool bIsFirstTextImport
;
91 bool bSolarMutexLocked
;
92 bool bFormulaTextResult
;
93 bool mbPossibleErrorCell
;
94 bool mbCheckWithCompilerForError
;
95 bool mbEditEngineHasText
;
99 sal_Int16
GetCellType(const OUString
& sOUValue
) const;
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();
107 void UnlockSolarMutex();
109 bool HasSpecialContent() const;
110 bool CellsAreRepeated() const;
112 void SetFormulaCell ( ScFormulaCell
* pFCell
) const;
113 void PutTextCell ( const ScAddress
& rScCurrentPos
, const SCCOL nCurrentCol
,
114 const ::boost::optional
< OUString
>& pOUText
);
115 void PutValueCell ( const ScAddress
& rScCurrentPos
);
116 void AddTextAndValueCell ( const ScAddress
& rScCellPos
,
117 const ::boost::optional
< OUString
>& pOUText
, ScAddress
& rScCurrentPos
);
118 void AddNonFormulaCell ( const ScAddress
& rScCellPos
);
119 void PutFormulaCell ( const ScAddress
& rScCurrentPos
);
120 void AddFormulaCell ( const ScAddress
& rScCellPos
);
122 void HasSpecialCaseFormulaText();
124 bool IsPossibleErrorString() const;
126 void PushParagraphField(SvxFieldData
* pData
, const OUString
& rStyleName
);
128 void PushFormat(sal_Int32 nBegin
, sal_Int32 nEnd
, const OUString
& rStyleName
);
130 OUString
GetFirstParagraph() const;
134 ScXMLTableRowCellContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
135 const OUString
& rLName
,
136 const ::com::sun::star::uno::Reference
<
137 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
138 const bool bIsCovered
, const sal_Int32 nRepeatedRows
);
140 virtual ~ScXMLTableRowCellContext();
142 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
143 const OUString
& rLocalName
,
144 const ::com::sun::star::uno::Reference
<
145 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
147 void PushParagraphSpan(const OUString
& rSpan
, const OUString
& rStyleName
);
148 void PushParagraphFieldDate(const OUString
& rStyleName
);
149 void PushParagraphFieldSheetName(const OUString
& rStyleName
);
150 void PushParagraphFieldDocTitle(const OUString
& rStyleName
);
151 void PushParagraphFieldURL(const OUString
& rURL
, const OUString
& rRep
, const OUString
& rStyleName
);
152 void PushParagraphEnd();
154 void SetAnnotation( const ScAddress
& rPosition
);
155 void SetDetectiveObj( const ScAddress
& rPosition
);
156 void SetCellRangeSource( const ScAddress
& rPosition
);
158 virtual void EndElement() SAL_OVERRIDE
;
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */