update dev300-m58
[ooovba.git] / sc / source / filter / xml / XMLDetectiveContext.hxx
blob91c2f760a8a4e9de769e95e83ea582ff91f79936
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: XMLDetectiveContext.hxx,v $
10 * $Revision: 1.13 $
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 ************************************************************************/
31 #ifndef SC_XMLDETECTIVECONTEXT_HXX
32 #define SC_XMLDETECTIVECONTEXT_HXX
34 #include <xmloff/xmlimp.hxx>
35 #include <com/sun/star/table/CellRangeAddress.hpp>
36 #include "detfunc.hxx"
37 #include "detdata.hxx"
39 #include <list>
41 class ScXMLImport;
44 //___________________________________________________________________
46 struct ScMyImpDetectiveObj
48 ScRange aSourceRange;
49 ScDetectiveObjType eObjType;
50 sal_Bool bHasError;
52 ScMyImpDetectiveObj();
55 typedef ::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec;
58 //___________________________________________________________________
60 struct ScMyImpDetectiveOp
62 ScAddress aPosition;
63 ScDetOpType eOpType;
64 sal_Int32 nIndex;
66 inline ScMyImpDetectiveOp() : nIndex( -1 ) {}
67 sal_Bool operator<(const ScMyImpDetectiveOp& rDetOp) const;
70 typedef ::std::list< ScMyImpDetectiveOp > ScMyImpDetectiveOpList;
72 class ScMyImpDetectiveOpArray
74 private:
75 ScMyImpDetectiveOpList aDetectiveOpList;
77 public:
78 inline ScMyImpDetectiveOpArray() :
79 aDetectiveOpList() {}
81 inline void AddDetectiveOp( const ScMyImpDetectiveOp& rDetOp )
82 { aDetectiveOpList.push_back( rDetOp ); }
84 void Sort();
85 sal_Bool GetFirstOp( ScMyImpDetectiveOp& rDetOp );
89 //___________________________________________________________________
91 class ScXMLDetectiveContext : public SvXMLImportContext
93 private:
94 ScMyImpDetectiveObjVec* pDetectiveObjVec;
96 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
97 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
99 public:
100 ScXMLDetectiveContext(
101 ScXMLImport& rImport,
102 USHORT nPrfx,
103 const ::rtl::OUString& rLName,
104 ScMyImpDetectiveObjVec* pNewDetectiveObjVec
106 virtual ~ScXMLDetectiveContext();
108 virtual SvXMLImportContext* CreateChildContext(
109 USHORT nPrefix,
110 const ::rtl::OUString& rLocalName,
111 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
113 virtual void EndElement();
117 //___________________________________________________________________
119 class ScXMLDetectiveHighlightedContext : public SvXMLImportContext
121 private:
122 ScMyImpDetectiveObjVec* pDetectiveObjVec;
123 ScMyImpDetectiveObj aDetectiveObj;
124 sal_Bool bValid;
126 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
127 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
129 public:
130 ScXMLDetectiveHighlightedContext(
131 ScXMLImport& rImport,
132 USHORT nPrfx,
133 const ::rtl::OUString& rLName,
134 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
135 ScMyImpDetectiveObjVec* pNewDetectiveObjVec
137 virtual ~ScXMLDetectiveHighlightedContext();
139 virtual SvXMLImportContext* CreateChildContext(
140 USHORT nPrefix,
141 const ::rtl::OUString& rLocalName,
142 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
144 virtual void EndElement();
148 //___________________________________________________________________
150 class ScXMLDetectiveOperationContext : public SvXMLImportContext
152 private:
153 ScMyImpDetectiveOp aDetectiveOp;
154 sal_Bool bHasType;
156 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
157 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
159 public:
160 ScXMLDetectiveOperationContext(
161 ScXMLImport& rImport,
162 USHORT nPrfx,
163 const ::rtl::OUString& rLName,
164 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
166 virtual ~ScXMLDetectiveOperationContext();
168 virtual SvXMLImportContext* CreateChildContext(
169 USHORT nPrefix,
170 const ::rtl::OUString& rLocalName,
171 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
173 virtual void EndElement();
177 #endif