1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlcelli.hxx,v $
10 * $Revision: 1.26.128.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SC_XMLCELLI_HXX
31 #define SC_XMLCELLI_HXX
34 #include "XMLDetectiveContext.hxx"
35 #include "XMLCellRangeSourceContext.hxx"
36 #include <xmloff/xmlictxt.hxx>
37 #include <xmloff/xmlimp.hxx>
38 #include <com/sun/star/table/XCell.hpp>
39 #include <tools/time.hxx>
40 #include <com/sun/star/util/DateTime.hpp>
41 #include <com/sun/star/table/XCellRange.hpp>
42 #include <com/sun/star/table/CellRangeAddress.hpp>
43 #include <com/sun/star/table/CellAddress.hpp>
44 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
45 #include <com/sun/star/document/XActionLockable.hpp>
47 #include "formula/grammar.hxx"
48 #include <boost/optional.hpp>
51 struct ScXMLAnnotationData
;
53 class ScXMLTableRowCellContext
: public SvXMLImportContext
55 typedef ::std::pair
< ::rtl::OUString
, ::rtl::OUString
> FormulaWithNamespace
;
56 com::sun::star::uno::Reference
<com::sun::star::table::XCell
> xBaseCell
;
57 com::sun::star::uno::Reference
<com::sun::star::document::XActionLockable
> xLockable
;
58 ::boost::optional
< rtl::OUString
> pOUTextValue
;
59 ::boost::optional
< rtl::OUString
> pOUTextContent
;
60 ::boost::optional
< FormulaWithNamespace
> pOUFormula
;
61 rtl::OUString
* pContentValidationName
;
62 ::std::auto_ptr
< ScXMLAnnotationData
> mxAnnotationData
;
63 ScMyImpDetectiveObjVec
* pDetectiveObjVec
;
64 ScMyImpCellRangeSource
* pCellRangeSource
;
66 sal_Int32 nMergedRows
, nMergedCols
;
67 sal_Int32 nMatrixRows
, nMatrixCols
;
68 sal_Int32 nRepeatedRows
;
69 sal_Int32 nCellsRepeated
;
70 ScXMLImport
& rXMLImport
;
71 formula::FormulaGrammar::Grammar eGrammar
;
75 sal_Bool bHasSubTable
;
78 sal_Bool bHasTextImport
;
79 sal_Bool bIsFirstTextImport
;
80 sal_Bool bSolarMutexLocked
;
81 sal_Bool bFormulaTextResult
;
83 const ScXMLImport
& GetScImport() const { return (const ScXMLImport
&)GetImport(); }
84 ScXMLImport
& GetScImport() { return (ScXMLImport
&)GetImport(); }
86 sal_Int16
GetCellType(const rtl::OUString
& sOUValue
) const;
88 sal_Bool
IsMerged (const com::sun::star::uno::Reference
<com::sun::star::table::XCellRange
>& xCellRange
,
89 const sal_Int32 nCol
, const sal_Int32 nRow
,
90 com::sun::star::table::CellRangeAddress
& aCellAddress
) const;
91 void DoMerge(const com::sun::star::table::CellAddress
& aCellPos
,
92 const sal_Int32 nCols
, const sal_Int32 nRows
);
94 void SetContentValidation(com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySet
>& xPropSet
);
95 void SetCellProperties(const com::sun::star::uno::Reference
<com::sun::star::table::XCellRange
>& xCellRange
,
96 const com::sun::star::table::CellAddress
& aCellAddress
);
97 void SetCellProperties(const com::sun::star::uno::Reference
<com::sun::star::table::XCell
>& xCell
);
99 void LockSolarMutex();
100 void UnlockSolarMutex();
102 sal_Bool
CellExists(const com::sun::star::table::CellAddress
& aCellPos
) const
104 return (aCellPos
.Column
<= MAXCOL
&& aCellPos
.Row
<= MAXROW
);
109 ScXMLTableRowCellContext( ScXMLImport
& rImport
, USHORT nPrfx
,
110 const ::rtl::OUString
& rLName
,
111 const ::com::sun::star::uno::Reference
<
112 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
113 const sal_Bool bIsCovered
, const sal_Int32 nRepeatedRows
);
115 virtual ~ScXMLTableRowCellContext();
117 virtual SvXMLImportContext
*CreateChildContext( USHORT nPrefix
,
118 const ::rtl::OUString
& rLocalName
,
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
122 inline void SetString(const rtl::OUString
& rOUTempText
) { pOUTextContent
.reset(rOUTempText
); }
123 void SetCursorOnTextImport(const rtl::OUString
& rOUTempText
);
125 void SetAnnotation(const ::com::sun::star::table::CellAddress
& rPosition
);
126 void SetDetectiveObj( const ::com::sun::star::table::CellAddress
& rPosition
);
127 void SetCellRangeSource( const ::com::sun::star::table::CellAddress
& rPosition
);
129 virtual void EndElement();