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_XMLDDELINKSCONTEXT_HXX
21 : #define INCLUDED_SC_SOURCE_FILTER_XML_XMLDDELINKSCONTEXT_HXX
22 :
23 : #include <xmloff/xmlictxt.hxx>
24 : #include "xmlimprt.hxx"
25 : #include <list>
26 :
27 : class ScXMLDDELinksContext : public SvXMLImportContext
28 : {
29 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
30 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
31 : public:
32 : ScXMLDDELinksContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
33 : const OUString& rLName,
34 : const ::com::sun::star::uno::Reference<
35 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
36 :
37 : virtual ~ScXMLDDELinksContext();
38 :
39 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
40 : const OUString& rLocalName,
41 : const ::com::sun::star::uno::Reference<
42 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
43 :
44 : virtual void EndElement() SAL_OVERRIDE;
45 : };
46 :
47 0 : struct ScDDELinkCell
48 : {
49 : OUString sValue;
50 : double fValue;
51 : bool bString;
52 : bool bEmpty;
53 : };
54 :
55 : typedef std::list<ScDDELinkCell> ScDDELinkCells;
56 :
57 : class ScXMLDDELinkContext : public SvXMLImportContext
58 : {
59 : ScDDELinkCells aDDELinkTable;
60 : ScDDELinkCells aDDELinkRow;
61 : OUString sApplication;
62 : OUString sTopic;
63 : OUString sItem;
64 : sal_Int32 nPosition;
65 : sal_Int32 nColumns;
66 : sal_Int32 nRows;
67 : sal_uInt8 nMode;
68 :
69 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
70 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
71 : public:
72 : ScXMLDDELinkContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
73 : const OUString& rLName,
74 : const ::com::sun::star::uno::Reference<
75 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
76 :
77 : virtual ~ScXMLDDELinkContext();
78 :
79 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
80 : const OUString& rLocalName,
81 : const ::com::sun::star::uno::Reference<
82 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
83 :
84 0 : void SetApplication(const OUString& sValue) { sApplication = sValue; }
85 0 : void SetTopic(const OUString& sValue) { sTopic = sValue; }
86 0 : void SetItem(const OUString& sValue) { sItem = sValue; }
87 0 : void SetMode(const sal_uInt8 nValue) { nMode = nValue; }
88 : void CreateDDELink();
89 0 : void AddColumns(const sal_Int32 nValue) { nColumns += nValue; }
90 0 : void AddRows(const sal_Int32 nValue) { nRows += nValue; }
91 : void AddCellToRow(const ScDDELinkCell& aCell);
92 : void AddRowsToTable(const sal_Int32 nRows);
93 :
94 : virtual void EndElement() SAL_OVERRIDE;
95 : };
96 :
97 : class ScXMLDDESourceContext : public SvXMLImportContext
98 : {
99 : ScXMLDDELinkContext* pDDELink;
100 :
101 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
102 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
103 : public:
104 : ScXMLDDESourceContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
105 : const OUString& rLName,
106 : const ::com::sun::star::uno::Reference<
107 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
108 : ScXMLDDELinkContext* pDDELink);
109 :
110 : virtual ~ScXMLDDESourceContext();
111 :
112 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
113 : const OUString& rLocalName,
114 : const ::com::sun::star::uno::Reference<
115 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
116 :
117 : virtual void EndElement() SAL_OVERRIDE;
118 : };
119 :
120 : class ScXMLDDETableContext : public SvXMLImportContext
121 : {
122 : ScXMLDDELinkContext* pDDELink;
123 :
124 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
125 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
126 : public:
127 : ScXMLDDETableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
128 : const OUString& rLName,
129 : const ::com::sun::star::uno::Reference<
130 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
131 : ScXMLDDELinkContext* pDDELink);
132 :
133 : virtual ~ScXMLDDETableContext();
134 :
135 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
136 : const OUString& rLocalName,
137 : const ::com::sun::star::uno::Reference<
138 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
139 :
140 : virtual void EndElement() SAL_OVERRIDE;
141 : };
142 :
143 : class ScXMLDDEColumnContext : public SvXMLImportContext
144 : {
145 : ScXMLDDELinkContext* pDDELink;
146 :
147 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
148 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
149 : public:
150 : ScXMLDDEColumnContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
151 : const OUString& rLName,
152 : const ::com::sun::star::uno::Reference<
153 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
154 : ScXMLDDELinkContext* pDDELink);
155 :
156 : virtual ~ScXMLDDEColumnContext();
157 :
158 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
159 : const OUString& rLocalName,
160 : const ::com::sun::star::uno::Reference<
161 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
162 :
163 : virtual void EndElement() SAL_OVERRIDE;
164 : };
165 :
166 : class ScXMLDDERowContext : public SvXMLImportContext
167 : {
168 : ScXMLDDELinkContext* pDDELink;
169 : sal_Int32 nRows;
170 :
171 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
172 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
173 : public:
174 : ScXMLDDERowContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
175 : const OUString& rLName,
176 : const ::com::sun::star::uno::Reference<
177 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
178 : ScXMLDDELinkContext* pDDELink);
179 :
180 : virtual ~ScXMLDDERowContext();
181 :
182 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
183 : const OUString& rLocalName,
184 : const ::com::sun::star::uno::Reference<
185 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
186 :
187 : virtual void EndElement() SAL_OVERRIDE;
188 : };
189 :
190 : class ScXMLDDECellContext : public SvXMLImportContext
191 : {
192 : OUString sValue;
193 : double fValue;
194 : sal_Int32 nCells;
195 : bool bString;
196 : bool bString2;
197 : bool bEmpty;
198 :
199 : ScXMLDDELinkContext* pDDELink;
200 :
201 : const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
202 0 : ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
203 : public:
204 : ScXMLDDECellContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
205 : const OUString& rLName,
206 : const ::com::sun::star::uno::Reference<
207 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
208 : ScXMLDDELinkContext* pDDELink);
209 :
210 : virtual ~ScXMLDDECellContext();
211 :
212 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
213 : const OUString& rLocalName,
214 : const ::com::sun::star::uno::Reference<
215 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
216 :
217 : virtual void EndElement() SAL_OVERRIDE;
218 : };
219 :
220 : #endif
221 :
222 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|