Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLDETECTIVECONTEXT_HXX
21 : #define INCLUDED_SC_SOURCE_FILTER_XML_XMLDETECTIVECONTEXT_HXX
22 :
23 : #include <xmloff/xmlimp.hxx>
24 : #include <com/sun/star/table/CellRangeAddress.hpp>
25 : #include "detfunc.hxx"
26 : #include "detdata.hxx"
27 : #include "xmlimprt.hxx"
28 :
29 : #include <list>
30 :
31 0 : struct ScMyImpDetectiveObj
32 : {
33 : ScRange aSourceRange;
34 : ScDetectiveObjType eObjType;
35 : bool bHasError;
36 :
37 : ScMyImpDetectiveObj();
38 : };
39 :
40 : typedef ::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec;
41 :
42 20 : struct ScMyImpDetectiveOp
43 : {
44 : ScAddress aPosition;
45 : ScDetOpType eOpType;
46 : sal_Int32 nIndex;
47 :
48 207 : ScMyImpDetectiveOp()
49 : : eOpType(SCDETOP_ADDSUCC)
50 207 : , nIndex(-1)
51 : {
52 207 : }
53 :
54 : bool operator<(const ScMyImpDetectiveOp& rDetOp) const;
55 : };
56 :
57 : typedef ::std::list< ScMyImpDetectiveOp > ScMyImpDetectiveOpList;
58 :
59 197 : class ScMyImpDetectiveOpArray
60 : {
61 : private:
62 : ScMyImpDetectiveOpList aDetectiveOpList;
63 :
64 : public:
65 197 : inline ScMyImpDetectiveOpArray() :
66 197 : aDetectiveOpList() {}
67 :
68 10 : inline void AddDetectiveOp( const ScMyImpDetectiveOp& rDetOp )
69 10 : { aDetectiveOpList.push_back( rDetOp ); }
70 :
71 : void Sort();
72 : bool GetFirstOp( ScMyImpDetectiveOp& rDetOp );
73 : };
74 :
75 : class ScXMLDetectiveContext : public SvXMLImportContext
76 : {
77 : private:
78 : ScMyImpDetectiveObjVec* pDetectiveObjVec;
79 :
80 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
81 20 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
82 :
83 : public:
84 : ScXMLDetectiveContext(
85 : ScXMLImport& rImport,
86 : sal_uInt16 nPrfx,
87 : const OUString& rLName,
88 : ScMyImpDetectiveObjVec* pNewDetectiveObjVec
89 : );
90 : virtual ~ScXMLDetectiveContext();
91 :
92 : virtual SvXMLImportContext* CreateChildContext(
93 : sal_uInt16 nPrefix,
94 : const OUString& rLocalName,
95 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
96 : ) SAL_OVERRIDE;
97 : virtual void EndElement() SAL_OVERRIDE;
98 : };
99 :
100 : class ScXMLDetectiveHighlightedContext : public SvXMLImportContext
101 : {
102 : private:
103 : ScMyImpDetectiveObjVec* pDetectiveObjVec;
104 : ScMyImpDetectiveObj aDetectiveObj;
105 : bool bValid;
106 :
107 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
108 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
109 :
110 : public:
111 : ScXMLDetectiveHighlightedContext(
112 : ScXMLImport& rImport,
113 : sal_uInt16 nPrfx,
114 : const OUString& rLName,
115 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
116 : ScMyImpDetectiveObjVec* pNewDetectiveObjVec
117 : );
118 : virtual ~ScXMLDetectiveHighlightedContext();
119 :
120 : virtual SvXMLImportContext* CreateChildContext(
121 : sal_uInt16 nPrefix,
122 : const OUString& rLocalName,
123 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
124 : ) SAL_OVERRIDE;
125 : virtual void EndElement() SAL_OVERRIDE;
126 : };
127 :
128 : class ScXMLDetectiveOperationContext : public SvXMLImportContext
129 : {
130 : private:
131 : ScMyImpDetectiveOp aDetectiveOp;
132 : bool bHasType;
133 :
134 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
135 40 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
136 :
137 : public:
138 : ScXMLDetectiveOperationContext(
139 : ScXMLImport& rImport,
140 : sal_uInt16 nPrfx,
141 : const OUString& rLName,
142 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
143 : );
144 : virtual ~ScXMLDetectiveOperationContext();
145 :
146 : virtual SvXMLImportContext* CreateChildContext(
147 : sal_uInt16 nPrefix,
148 : const OUString& rLocalName,
149 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
150 : ) SAL_OVERRIDE;
151 : virtual void EndElement() SAL_OVERRIDE;
152 : };
153 :
154 : #endif
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|