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 : :
29 : : #ifndef SC_XMLDETECTIVECONTEXT_HXX
30 : : #define SC_XMLDETECTIVECONTEXT_HXX
31 : :
32 : : #include <xmloff/xmlimp.hxx>
33 : : #include <com/sun/star/table/CellRangeAddress.hpp>
34 : : #include "detfunc.hxx"
35 : : #include "detdata.hxx"
36 : :
37 : : #include <list>
38 : :
39 : : class ScXMLImport;
40 : :
41 : :
42 : : //___________________________________________________________________
43 : :
44 : 0 : struct ScMyImpDetectiveObj
45 : : {
46 : : ScRange aSourceRange;
47 : : ScDetectiveObjType eObjType;
48 : : bool bHasError;
49 : :
50 : : ScMyImpDetectiveObj();
51 : : };
52 : :
53 : : typedef ::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec;
54 : :
55 : :
56 : : //___________________________________________________________________
57 : :
58 : 0 : struct ScMyImpDetectiveOp
59 : : {
60 : : ScAddress aPosition;
61 : : ScDetOpType eOpType;
62 : : sal_Int32 nIndex;
63 : :
64 : 93 : inline ScMyImpDetectiveOp() : nIndex( -1 ) {}
65 : : bool operator<(const ScMyImpDetectiveOp& rDetOp) const;
66 : : };
67 : :
68 : : typedef ::std::list< ScMyImpDetectiveOp > ScMyImpDetectiveOpList;
69 : :
70 : 93 : class ScMyImpDetectiveOpArray
71 : : {
72 : : private:
73 : : ScMyImpDetectiveOpList aDetectiveOpList;
74 : :
75 : : public:
76 : 93 : inline ScMyImpDetectiveOpArray() :
77 : 93 : aDetectiveOpList() {}
78 : :
79 : 0 : inline void AddDetectiveOp( const ScMyImpDetectiveOp& rDetOp )
80 : 0 : { aDetectiveOpList.push_back( rDetOp ); }
81 : :
82 : : void Sort();
83 : : bool GetFirstOp( ScMyImpDetectiveOp& rDetOp );
84 : : };
85 : :
86 : :
87 : : //___________________________________________________________________
88 : :
89 : : class ScXMLDetectiveContext : public SvXMLImportContext
90 : : {
91 : : private:
92 : : ScMyImpDetectiveObjVec* pDetectiveObjVec;
93 : :
94 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
95 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
96 : :
97 : : public:
98 : : ScXMLDetectiveContext(
99 : : ScXMLImport& rImport,
100 : : sal_uInt16 nPrfx,
101 : : const ::rtl::OUString& rLName,
102 : : ScMyImpDetectiveObjVec* pNewDetectiveObjVec
103 : : );
104 : : virtual ~ScXMLDetectiveContext();
105 : :
106 : : virtual SvXMLImportContext* CreateChildContext(
107 : : sal_uInt16 nPrefix,
108 : : const ::rtl::OUString& rLocalName,
109 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
110 : : );
111 : : virtual void EndElement();
112 : : };
113 : :
114 : :
115 : : //___________________________________________________________________
116 : :
117 : : class ScXMLDetectiveHighlightedContext : public SvXMLImportContext
118 : : {
119 : : private:
120 : : ScMyImpDetectiveObjVec* pDetectiveObjVec;
121 : : ScMyImpDetectiveObj aDetectiveObj;
122 : : bool bValid;
123 : :
124 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
125 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
126 : :
127 : : public:
128 : : ScXMLDetectiveHighlightedContext(
129 : : ScXMLImport& rImport,
130 : : sal_uInt16 nPrfx,
131 : : const ::rtl::OUString& rLName,
132 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
133 : : ScMyImpDetectiveObjVec* pNewDetectiveObjVec
134 : : );
135 : : virtual ~ScXMLDetectiveHighlightedContext();
136 : :
137 : : virtual SvXMLImportContext* CreateChildContext(
138 : : sal_uInt16 nPrefix,
139 : : const ::rtl::OUString& rLocalName,
140 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
141 : : );
142 : : virtual void EndElement();
143 : : };
144 : :
145 : :
146 : : //___________________________________________________________________
147 : :
148 : : class ScXMLDetectiveOperationContext : public SvXMLImportContext
149 : : {
150 : : private:
151 : : ScMyImpDetectiveOp aDetectiveOp;
152 : : bool bHasType;
153 : :
154 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
155 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
156 : :
157 : : public:
158 : : ScXMLDetectiveOperationContext(
159 : : ScXMLImport& rImport,
160 : : sal_uInt16 nPrfx,
161 : : const ::rtl::OUString& rLName,
162 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
163 : : );
164 : : virtual ~ScXMLDetectiveOperationContext();
165 : :
166 : : virtual SvXMLImportContext* CreateChildContext(
167 : : sal_uInt16 nPrefix,
168 : : const ::rtl::OUString& rLocalName,
169 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
170 : : );
171 : : virtual void EndElement();
172 : : };
173 : :
174 : :
175 : : #endif
176 : :
177 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|