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 SC_XMLDETECTIVECONTEXT_HXX
21 : #define SC_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 :
28 : #include <list>
29 :
30 : class ScXMLImport;
31 :
32 :
33 0 : struct ScMyImpDetectiveObj
34 : {
35 : ScRange aSourceRange;
36 : ScDetectiveObjType eObjType;
37 : bool bHasError;
38 :
39 : ScMyImpDetectiveObj();
40 : };
41 :
42 : typedef ::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec;
43 :
44 :
45 0 : struct ScMyImpDetectiveOp
46 : {
47 : ScAddress aPosition;
48 : ScDetOpType eOpType;
49 : sal_Int32 nIndex;
50 :
51 107 : inline ScMyImpDetectiveOp() : nIndex( -1 ) {}
52 : bool operator<(const ScMyImpDetectiveOp& rDetOp) const;
53 : };
54 :
55 : typedef ::std::list< ScMyImpDetectiveOp > ScMyImpDetectiveOpList;
56 :
57 107 : class ScMyImpDetectiveOpArray
58 : {
59 : private:
60 : ScMyImpDetectiveOpList aDetectiveOpList;
61 :
62 : public:
63 107 : inline ScMyImpDetectiveOpArray() :
64 107 : aDetectiveOpList() {}
65 :
66 0 : inline void AddDetectiveOp( const ScMyImpDetectiveOp& rDetOp )
67 0 : { aDetectiveOpList.push_back( rDetOp ); }
68 :
69 : void Sort();
70 : bool GetFirstOp( ScMyImpDetectiveOp& rDetOp );
71 : };
72 :
73 :
74 : class ScXMLDetectiveContext : public SvXMLImportContext
75 : {
76 : private:
77 : ScMyImpDetectiveObjVec* pDetectiveObjVec;
78 :
79 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
80 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
81 :
82 : public:
83 : ScXMLDetectiveContext(
84 : ScXMLImport& rImport,
85 : sal_uInt16 nPrfx,
86 : const OUString& rLName,
87 : ScMyImpDetectiveObjVec* pNewDetectiveObjVec
88 : );
89 : virtual ~ScXMLDetectiveContext();
90 :
91 : virtual SvXMLImportContext* CreateChildContext(
92 : sal_uInt16 nPrefix,
93 : const OUString& rLocalName,
94 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
95 : ) SAL_OVERRIDE;
96 : virtual void EndElement() SAL_OVERRIDE;
97 : };
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 (const ScXMLImport&)GetImport(); }
108 0 : ScXMLImport& GetScImport() { return (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 :
129 : class ScXMLDetectiveOperationContext : public SvXMLImportContext
130 : {
131 : private:
132 : ScMyImpDetectiveOp aDetectiveOp;
133 : bool bHasType;
134 :
135 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
136 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
137 :
138 : public:
139 : ScXMLDetectiveOperationContext(
140 : ScXMLImport& rImport,
141 : sal_uInt16 nPrfx,
142 : const OUString& rLName,
143 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
144 : );
145 : virtual ~ScXMLDetectiveOperationContext();
146 :
147 : virtual SvXMLImportContext* CreateChildContext(
148 : sal_uInt16 nPrefix,
149 : const OUString& rLocalName,
150 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList
151 : ) SAL_OVERRIDE;
152 : virtual void EndElement() SAL_OVERRIDE;
153 : };
154 :
155 :
156 : #endif
157 :
158 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|