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
33 #include "XMLDetectiveContext.hxx"
34 #include "XMLCellRangeSourceContext.hxx"
35 #include <xmloff/xmlictxt.hxx>
36 #include <xmloff/xmlimp.hxx>
37 #include <com/sun/star/table/XCell.hpp>
38 #include <tools/time.hxx>
39 #include <com/sun/star/util/DateTime.hpp>
40 #include <sal/types.h>
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 class OutlinerParaObject
;
53 struct ScMyImportAnnotation
55 rtl::OUString sAuthor
;
56 rtl::OUString sCreateDate
;
61 OutlinerParaObject
* pOPO
;
63 ScMyImportAnnotation() : bDisplay(sal_False
), pRect(NULL
), pItemSet(NULL
), pOPO(NULL
) {}
64 ~ScMyImportAnnotation();
67 class ScXMLTableRowCellContext
: public SvXMLImportContext
69 com::sun::star::uno::Reference
<com::sun::star::table::XCell
> xBaseCell
;
70 com::sun::star::uno::Reference
<com::sun::star::document::XActionLockable
> xLockable
;
71 ::boost::optional
< rtl::OUString
> pOUTextValue
;
72 ::boost::optional
< rtl::OUString
> pOUTextContent
;
73 ::boost::optional
< rtl::OUString
> pOUFormula
;
74 ::boost::optional
< rtl::OUString
> pOUPhoneticText
;
75 rtl::OUString
* pContentValidationName
;
76 ScMyImportAnnotation
* pMyAnnotation
;
77 ScMyImpDetectiveObjVec
* pDetectiveObjVec
;
78 ScMyImpCellRangeSource
* pCellRangeSource
;
80 sal_Int32 nMergedRows
, nMergedCols
;
81 sal_Int32 nMatrixRows
, nMatrixCols
;
82 sal_Int32 nRepeatedRows
;
83 sal_Int32 nCellsRepeated
;
84 ScXMLImport
& rXMLImport
;
85 formula::FormulaGrammar::Grammar eGrammar
;
89 sal_Bool bHasSubTable
;
92 sal_Bool bHasTextImport
;
93 sal_Bool bIsFirstTextImport
;
94 sal_Bool bSolarMutexLocked
;
95 sal_Bool bFormulaTextResult
;
97 const ScXMLImport
& GetScImport() const { return (const ScXMLImport
&)GetImport(); }
98 ScXMLImport
& GetScImport() { return (ScXMLImport
&)GetImport(); }
100 sal_Int16
GetCellType(const rtl::OUString
& sOUValue
) const;
102 sal_Bool
IsMerged (const com::sun::star::uno::Reference
<com::sun::star::table::XCellRange
>& xCellRange
,
103 const sal_Int32 nCol
, const sal_Int32 nRow
,
104 com::sun::star::table::CellRangeAddress
& aCellAddress
) const;
105 void DoMerge(const com::sun::star::table::CellAddress
& aCellPos
,
106 const sal_Int32 nCols
, const sal_Int32 nRows
);
108 void SetContentValidation(com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySet
>& xPropSet
);
109 void SetCellProperties(const com::sun::star::uno::Reference
<com::sun::star::table::XCellRange
>& xCellRange
,
110 const com::sun::star::table::CellAddress
& aCellAddress
);
111 void SetCellProperties(const com::sun::star::uno::Reference
<com::sun::star::table::XCell
>& xCell
);
113 void LockSolarMutex();
114 void UnlockSolarMutex();
116 sal_Bool
CellExists(const com::sun::star::table::CellAddress
& aCellPos
) const
118 return (aCellPos
.Column
<= MAXCOL
&& aCellPos
.Row
<= MAXROW
);
123 ScXMLTableRowCellContext( ScXMLImport
& rImport
, USHORT nPrfx
,
124 const ::rtl::OUString
& rLName
,
125 const ::com::sun::star::uno::Reference
<
126 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
127 const sal_Bool bIsCovered
, const sal_Int32 nRepeatedRows
);
129 virtual ~ScXMLTableRowCellContext();
131 virtual SvXMLImportContext
*CreateChildContext( USHORT nPrefix
,
132 const ::rtl::OUString
& rLocalName
,
133 const ::com::sun::star::uno::Reference
<
134 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
136 inline void SetString(const rtl::OUString
& rOUTempText
) { pOUTextContent
.reset(rOUTempText
); }
137 void SetCursorOnTextImport(const rtl::OUString
& rOUTempText
);
139 void SetAnnotation(const ::com::sun::star::table::CellAddress
& rPosition
);
140 void SetDetectiveObj( const ::com::sun::star::table::CellAddress
& rPosition
);
141 void SetCellRangeSource( const ::com::sun::star::table::CellAddress
& rPosition
);
143 virtual void EndElement();
145 void AddAnnotation(ScMyImportAnnotation
* pValue
) { pMyAnnotation
= pValue
; }
150 * @param rOUPhoneticText the phonetic text
152 void SetPhoneticText(const rtl::OUString
& rOUPhoneticText
);