Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SC_XMLCELLI_HXX
29 : : #define SC_XMLCELLI_HXX
30 : :
31 : : #include <memory>
32 : : #include "XMLDetectiveContext.hxx"
33 : : #include "XMLCellRangeSourceContext.hxx"
34 : : #include <xmloff/xmlictxt.hxx>
35 : : #include <xmloff/xmlimp.hxx>
36 : : #include <com/sun/star/table/XCell.hpp>
37 : : #include <com/sun/star/util/DateTime.hpp>
38 : : #include <com/sun/star/table/XCellRange.hpp>
39 : : #include <com/sun/star/table/CellRangeAddress.hpp>
40 : : #include <com/sun/star/table/CellAddress.hpp>
41 : : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
42 : : #include <com/sun/star/document/XActionLockable.hpp>
43 : :
44 : : #include "formula/grammar.hxx"
45 : : #include <boost/optional.hpp>
46 : :
47 : : class ScXMLImport;
48 : : class ScFormulaCell;
49 : : struct ScXMLAnnotationData;
50 : :
51 : : class ScXMLTableRowCellContext : public SvXMLImportContext
52 : : {
53 : : typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > FormulaWithNamespace;
54 : : com::sun::star::uno::Reference<com::sun::star::table::XCell> xBaseCell;
55 : : com::sun::star::uno::Reference<com::sun::star::document::XActionLockable> xLockable;
56 : : ::boost::optional< rtl::OUString > pOUTextValue;
57 : : ::boost::optional< rtl::OUString > pOUTextContent;
58 : : ::boost::optional< FormulaWithNamespace > pOUFormula;
59 : : rtl::OUString* pContentValidationName;
60 : : ::std::auto_ptr< ScXMLAnnotationData > mxAnnotationData;
61 : : ScMyImpDetectiveObjVec* pDetectiveObjVec;
62 : : ScMyImpCellRangeSource* pCellRangeSource;
63 : : double fValue;
64 : : SCROW nMergedRows, nMatrixRows, nRepeatedRows;
65 : : SCCOL nMergedCols, nMatrixCols, nColsRepeated;
66 : : ScXMLImport& rXMLImport;
67 : : formula::FormulaGrammar::Grammar eGrammar;
68 : : sal_Int16 nCellType;
69 : : bool bIsMerged;
70 : : bool bIsMatrix;
71 : : bool bIsCovered;
72 : : bool bIsEmpty;
73 : : bool bHasTextImport;
74 : : bool bIsFirstTextImport;
75 : : bool bSolarMutexLocked;
76 : : bool bFormulaTextResult;
77 : :
78 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
79 : 5930 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
80 : :
81 : : sal_Int16 GetCellType(const rtl::OUString& sOUValue) const;
82 : :
83 : : void DoMerge(const ScAddress& rScCellPos, const SCCOL nCols, const SCROW nRows);
84 : :
85 : : void SetContentValidation( const ScRange& rScRange );
86 : : void SetContentValidation( const ScAddress& rScCellPos );
87 : :
88 : : void LockSolarMutex();
89 : : void UnlockSolarMutex();
90 : :
91 : : bool HasSpecialContent() const;
92 : : bool CellsAreRepeated() const;
93 : :
94 : : void SetFormulaCell ( ScFormulaCell* pFCell ) const;
95 : : void PutTextCell ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
96 : : const ::boost::optional< rtl::OUString >& pOUText );
97 : : void PutValueCell ( const ScAddress& rScCurrentPos );
98 : : void AddTextAndValueCells ( const ScAddress& rScCellPos,
99 : : const ::boost::optional< rtl::OUString >& pOUText, ScAddress& rScCurrentPos );
100 : : void AddNonFormulaCells ( const ScAddress& rScCellPos );
101 : : void PutFormulaCell ( const ScAddress& rScCurrentPos );
102 : : void AddFormulaCell ( const ScAddress& rScCellPos );
103 : :
104 : : bool HasSpecialCaseFormulaText() const;
105 : :
106 : : public:
107 : :
108 : : ScXMLTableRowCellContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
109 : : const ::rtl::OUString& rLName,
110 : : const ::com::sun::star::uno::Reference<
111 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
112 : : const bool bIsCovered, const sal_Int32 nRepeatedRows );
113 : :
114 : : virtual ~ScXMLTableRowCellContext();
115 : :
116 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
117 : : const ::rtl::OUString& rLocalName,
118 : : const ::com::sun::star::uno::Reference<
119 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
120 : :
121 : 972 : inline void SetString(const rtl::OUString& rOUTempText) { pOUTextContent.reset(rOUTempText); }
122 : : void SetCursorOnTextImport(const rtl::OUString& rOUTempText);
123 : :
124 : : void SetAnnotation( const ScAddress& rPosition );
125 : : void SetDetectiveObj( const ScAddress& rPosition );
126 : : void SetCellRangeSource( const ScAddress& rPosition );
127 : :
128 : : virtual void EndElement();
129 : : };
130 : :
131 : : #endif
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|