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 :
21 : #include "XMLTrackedChangesContext.hxx"
22 : #include "xmlimprt.hxx"
23 : #include "xmlconti.hxx"
24 : #include "XMLConverter.hxx"
25 : #include "formulacell.hxx"
26 : #include "textuno.hxx"
27 : #include "editutil.hxx"
28 : #include "document.hxx"
29 : #include <xmloff/xmltoken.hxx>
30 : #include <xmloff/xmlnmspe.hxx>
31 : #include <xmloff/nmspmap.hxx>
32 : #include <xmloff/xmluconv.hxx>
33 : #include <sax/tools/converter.hxx>
34 : #include <svl/zforlist.hxx>
35 : #include <com/sun/star/text/XTextCursor.hpp>
36 : #include <com/sun/star/text/ControlCharacter.hpp>
37 :
38 : using namespace com::sun::star;
39 : using namespace xmloff::token;
40 :
41 :
42 : //-----------------------------------------------------------------------------
43 :
44 : class ScXMLChangeInfoContext : public SvXMLImportContext
45 : {
46 : ScMyActionInfo aInfo;
47 : OUStringBuffer sAuthorBuffer;
48 : OUStringBuffer sDateTimeBuffer;
49 : OUStringBuffer sCommentBuffer;
50 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
51 : sal_uInt32 nParagraphCount;
52 :
53 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
54 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
55 :
56 : public:
57 : ScXMLChangeInfoContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
58 : const ::com::sun::star::uno::Reference<
59 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
60 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
61 : virtual ~ScXMLChangeInfoContext();
62 :
63 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
64 : const OUString& rLocalName,
65 : const ::com::sun::star::uno::Reference<
66 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
67 :
68 : virtual void EndElement();
69 : };
70 :
71 : //-----------------------------------------------------------------------------
72 :
73 : class ScXMLBigRangeContext : public SvXMLImportContext
74 : {
75 : ScBigRange& rBigRange;
76 :
77 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
78 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
79 :
80 : public:
81 : ScXMLBigRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
82 : const ::com::sun::star::uno::Reference<
83 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
84 : ScBigRange& rBigRange);
85 : virtual ~ScXMLBigRangeContext();
86 :
87 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
88 : const OUString& rLocalName,
89 : const ::com::sun::star::uno::Reference<
90 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
91 :
92 : virtual void EndElement();
93 : };
94 :
95 : //-----------------------------------------------------------------------------
96 :
97 : class ScXMLCellContentDeletionContext : public SvXMLImportContext
98 : {
99 : OUString sFormulaAddress;
100 : OUString sFormula;
101 : OUString sFormulaNmsp;
102 : OUString sInputString;
103 : ScBigRange aBigRange;
104 : double fValue;
105 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
106 : ScCellValue maCell;
107 : sal_uInt32 nID;
108 : sal_Int32 nMatrixCols;
109 : sal_Int32 nMatrixRows;
110 : formula::FormulaGrammar::Grammar eGrammar;
111 : sal_uInt16 nType;
112 : sal_uInt8 nMatrixFlag;
113 : sal_Bool bBigRange;
114 : sal_Bool bContainsCell;
115 :
116 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
117 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
118 :
119 : public:
120 : ScXMLCellContentDeletionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
121 : const ::com::sun::star::uno::Reference<
122 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
123 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
124 : virtual ~ScXMLCellContentDeletionContext();
125 :
126 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
127 : const OUString& rLocalName,
128 : const ::com::sun::star::uno::Reference<
129 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
130 :
131 : virtual void EndElement();
132 : };
133 :
134 : //-----------------------------------------------------------------------------
135 :
136 : class ScXMLDependenceContext : public SvXMLImportContext
137 : {
138 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
139 :
140 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
141 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
142 :
143 : public:
144 : ScXMLDependenceContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
145 : const ::com::sun::star::uno::Reference<
146 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
147 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
148 : virtual ~ScXMLDependenceContext();
149 :
150 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
151 : const OUString& rLocalName,
152 : const ::com::sun::star::uno::Reference<
153 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
154 :
155 : virtual void EndElement();
156 : };
157 :
158 : //-----------------------------------------------------------------------------
159 :
160 : class ScXMLDependingsContext : public SvXMLImportContext
161 : {
162 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
163 :
164 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
165 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
166 :
167 : public:
168 : ScXMLDependingsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
169 : const ::com::sun::star::uno::Reference<
170 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
171 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
172 : virtual ~ScXMLDependingsContext();
173 :
174 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
175 : const OUString& rLocalName,
176 : const ::com::sun::star::uno::Reference<
177 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
178 :
179 : virtual void EndElement();
180 : };
181 :
182 : //-----------------------------------------------------------------------------
183 :
184 : class ScXMLChangeDeletionContext : public SvXMLImportContext
185 : {
186 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
187 :
188 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
189 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
190 :
191 : public:
192 : ScXMLChangeDeletionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
193 : const ::com::sun::star::uno::Reference<
194 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
195 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
196 : virtual ~ScXMLChangeDeletionContext();
197 :
198 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
199 : const OUString& rLocalName,
200 : const ::com::sun::star::uno::Reference<
201 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
202 :
203 : virtual void EndElement();
204 : };
205 :
206 : //-----------------------------------------------------------------------------
207 :
208 : class ScXMLDeletionsContext : public SvXMLImportContext
209 : {
210 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
211 :
212 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
213 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
214 :
215 : public:
216 : ScXMLDeletionsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
217 : const ::com::sun::star::uno::Reference<
218 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
219 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
220 : virtual ~ScXMLDeletionsContext();
221 :
222 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
223 : const OUString& rLocalName,
224 : const ::com::sun::star::uno::Reference<
225 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
226 :
227 : virtual void EndElement();
228 : };
229 :
230 : //-----------------------------------------------------------------------------
231 :
232 : class ScXMLChangeCellContext;
233 :
234 : class ScXMLChangeTextPContext : public SvXMLImportContext
235 : {
236 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> xAttrList;
237 : OUString sLName;
238 : OUStringBuffer sText;
239 : ScXMLChangeCellContext* pChangeCellContext;
240 : SvXMLImportContext* pTextPContext;
241 : sal_uInt16 nPrefix;
242 :
243 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
244 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
245 :
246 : public:
247 :
248 : ScXMLChangeTextPContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
249 : const OUString& rLName,
250 : const ::com::sun::star::uno::Reference<
251 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
252 : ScXMLChangeCellContext* pChangeCellContext);
253 :
254 : virtual ~ScXMLChangeTextPContext();
255 :
256 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
257 : const OUString& rLocalName,
258 : const ::com::sun::star::uno::Reference<
259 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
260 :
261 : virtual void Characters( const OUString& rChars );
262 :
263 : virtual void EndElement();
264 : };
265 :
266 : //-----------------------------------------------------------------------------
267 :
268 : class ScXMLChangeCellContext : public SvXMLImportContext
269 : {
270 : ScCellValue& mrOldCell;
271 :
272 : OUString sText;
273 : OUString& rInputString;
274 : ScEditEngineTextObj* pEditTextObj;
275 : double& rDateTimeValue;
276 : double fValue;
277 : sal_uInt16& rType;
278 : sal_Bool bEmpty;
279 : sal_Bool bFirstParagraph;
280 : sal_Bool bString;
281 : sal_Bool bFormula;
282 :
283 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
284 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
285 :
286 : public:
287 : ScXMLChangeCellContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
288 : const ::com::sun::star::uno::Reference<
289 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
290 : ScCellValue& rOldCell, OUString& sAddress,
291 : OUString& rFormula, OUString& rFormulaNmsp,
292 : formula::FormulaGrammar::Grammar& rGrammar,
293 : OUString& rInputString, double& fValue, sal_uInt16& nType,
294 : sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows);
295 : virtual ~ScXMLChangeCellContext();
296 :
297 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
298 : const OUString& rLocalName,
299 : const ::com::sun::star::uno::Reference<
300 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
301 :
302 : void CreateTextPContext(sal_Bool bIsNewParagraph);
303 0 : sal_Bool IsEditCell() { return pEditTextObj != 0; }
304 0 : void SetText(const OUString& sTempText) { sText = sTempText; }
305 :
306 : virtual void EndElement();
307 : };
308 :
309 : //-----------------------------------------------------------------------------
310 :
311 : class ScXMLPreviousContext : public SvXMLImportContext
312 : {
313 : OUString sFormulaAddress;
314 : OUString sFormula;
315 : OUString sFormulaNmsp;
316 : OUString sInputString;
317 : double fValue;
318 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
319 : ScCellValue maOldCell;
320 : sal_uInt32 nID;
321 : sal_Int32 nMatrixCols;
322 : sal_Int32 nMatrixRows;
323 : formula::FormulaGrammar::Grammar eGrammar;
324 : sal_uInt16 nType;
325 : sal_uInt8 nMatrixFlag;
326 :
327 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
328 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
329 :
330 : public:
331 : ScXMLPreviousContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
332 : const ::com::sun::star::uno::Reference<
333 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
334 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
335 : virtual ~ScXMLPreviousContext();
336 :
337 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
338 : const OUString& rLocalName,
339 : const ::com::sun::star::uno::Reference<
340 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
341 :
342 : virtual void EndElement();
343 : };
344 :
345 : //-----------------------------------------------------------------------------
346 :
347 : class ScXMLContentChangeContext : public SvXMLImportContext
348 : {
349 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
350 : ScBigRange aBigRange;
351 :
352 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
353 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
354 :
355 : public:
356 : ScXMLContentChangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
357 : const ::com::sun::star::uno::Reference<
358 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
359 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
360 : virtual ~ScXMLContentChangeContext();
361 :
362 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
363 : const OUString& rLocalName,
364 : const ::com::sun::star::uno::Reference<
365 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
366 : virtual void EndElement();
367 : };
368 :
369 : //-----------------------------------------------------------------------------
370 :
371 : class ScXMLInsertionContext : public SvXMLImportContext
372 : {
373 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
374 :
375 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
376 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
377 :
378 : public:
379 : ScXMLInsertionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
380 : const ::com::sun::star::uno::Reference<
381 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
382 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
383 : virtual ~ScXMLInsertionContext();
384 :
385 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
386 : const OUString& rLocalName,
387 : const ::com::sun::star::uno::Reference<
388 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
389 : virtual void EndElement();
390 : };
391 :
392 : //-----------------------------------------------------------------------------
393 :
394 : class ScXMLInsertionCutOffContext : public SvXMLImportContext
395 : {
396 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
397 :
398 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
399 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
400 :
401 : public:
402 : ScXMLInsertionCutOffContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
403 : const ::com::sun::star::uno::Reference<
404 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
405 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
406 : virtual ~ScXMLInsertionCutOffContext();
407 :
408 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
409 : const OUString& rLocalName,
410 : const ::com::sun::star::uno::Reference<
411 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
412 : virtual void EndElement();
413 : };
414 :
415 : //-----------------------------------------------------------------------------
416 :
417 : class ScXMLMovementCutOffContext : public SvXMLImportContext
418 : {
419 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
420 :
421 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
422 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
423 :
424 : public:
425 : ScXMLMovementCutOffContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
426 : const ::com::sun::star::uno::Reference<
427 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
428 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
429 : virtual ~ScXMLMovementCutOffContext();
430 :
431 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
432 : const OUString& rLocalName,
433 : const ::com::sun::star::uno::Reference<
434 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
435 : virtual void EndElement();
436 : };
437 :
438 : //-----------------------------------------------------------------------------
439 :
440 : class ScXMLCutOffsContext : public SvXMLImportContext
441 : {
442 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
443 :
444 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
445 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
446 :
447 : public:
448 : ScXMLCutOffsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
449 : const ::com::sun::star::uno::Reference<
450 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
451 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
452 : virtual ~ScXMLCutOffsContext();
453 :
454 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
455 : const OUString& rLocalName,
456 : const ::com::sun::star::uno::Reference<
457 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
458 : virtual void EndElement();
459 : };
460 :
461 : //-----------------------------------------------------------------------------
462 :
463 : class ScXMLDeletionContext : public SvXMLImportContext
464 : {
465 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
466 :
467 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
468 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
469 :
470 : public:
471 : ScXMLDeletionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
472 : const ::com::sun::star::uno::Reference<
473 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
474 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
475 : virtual ~ScXMLDeletionContext();
476 :
477 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
478 : const OUString& rLocalName,
479 : const ::com::sun::star::uno::Reference<
480 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
481 : virtual void EndElement();
482 : };
483 :
484 : //-----------------------------------------------------------------------------
485 :
486 : class ScXMLMovementContext : public SvXMLImportContext
487 : {
488 : ScBigRange aSourceRange;
489 : ScBigRange aTargetRange;
490 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
491 :
492 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
493 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
494 :
495 : public:
496 : ScXMLMovementContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
497 : const ::com::sun::star::uno::Reference<
498 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
499 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
500 : virtual ~ScXMLMovementContext();
501 :
502 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
503 : const OUString& rLocalName,
504 : const ::com::sun::star::uno::Reference<
505 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
506 : virtual void EndElement();
507 : };
508 :
509 : //-----------------------------------------------------------------------------
510 :
511 : class ScXMLRejectionContext : public SvXMLImportContext
512 : {
513 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper;
514 :
515 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
516 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
517 :
518 : public:
519 : ScXMLRejectionContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
520 : const ::com::sun::star::uno::Reference<
521 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
522 : ScXMLChangeTrackingImportHelper* pChangeTrackingImportHelper);
523 : virtual ~ScXMLRejectionContext();
524 :
525 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
526 : const OUString& rLocalName,
527 : const ::com::sun::star::uno::Reference<
528 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
529 : virtual void EndElement();
530 : };
531 :
532 : //------------------------------------------------------------------
533 :
534 0 : ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport,
535 : sal_uInt16 nPrfx,
536 : const OUString& rLName,
537 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
538 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
539 : SvXMLImportContext( rImport, nPrfx, rLName ),
540 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
541 : {
542 0 : rImport.LockSolarMutex();
543 0 : pChangeTrackingImportHelper->SetChangeTrack(sal_True);
544 :
545 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
546 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
547 : {
548 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
549 0 : OUString aLocalName;
550 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
551 0 : sAttrName, &aLocalName ));
552 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
553 0 : if (nPrefix == XML_NAMESPACE_TABLE)
554 : {
555 0 : if (IsXMLToken(aLocalName, XML_PROTECTION_KEY))
556 : {
557 0 : if (!sValue.isEmpty())
558 : {
559 0 : uno::Sequence<sal_Int8> aPass;
560 0 : ::sax::Converter::decodeBase64(aPass, sValue);
561 0 : pChangeTrackingImportHelper->SetProtection(aPass);
562 : }
563 : }
564 : }
565 0 : }
566 0 : }
567 :
568 0 : ScXMLTrackedChangesContext::~ScXMLTrackedChangesContext()
569 : {
570 0 : GetScImport().UnlockSolarMutex();
571 0 : }
572 :
573 0 : SvXMLImportContext *ScXMLTrackedChangesContext::CreateChildContext( sal_uInt16 nPrefix,
574 : const OUString& rLocalName,
575 : const ::com::sun::star::uno::Reference<
576 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
577 : {
578 0 : SvXMLImportContext *pContext(0);
579 :
580 0 : if (nPrefix == XML_NAMESPACE_TABLE)
581 : {
582 0 : if (IsXMLToken(rLocalName, XML_CELL_CONTENT_CHANGE))
583 : {
584 0 : pContext = new ScXMLContentChangeContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
585 : }
586 0 : else if (IsXMLToken(rLocalName, XML_INSERTION))
587 : {
588 0 : pContext = new ScXMLInsertionContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
589 : }
590 0 : else if (IsXMLToken(rLocalName, XML_DELETION))
591 : {
592 0 : pContext = new ScXMLDeletionContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
593 : }
594 0 : else if (IsXMLToken(rLocalName, XML_MOVEMENT))
595 : {
596 0 : pContext = new ScXMLMovementContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
597 : }
598 0 : else if (IsXMLToken(rLocalName, XML_REJECTION))
599 : {
600 0 : pContext = new ScXMLRejectionContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
601 : }
602 : }
603 :
604 0 : if( !pContext )
605 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
606 :
607 0 : return pContext;
608 : }
609 :
610 0 : void ScXMLTrackedChangesContext::EndElement()
611 : {
612 0 : }
613 :
614 0 : ScXMLChangeInfoContext::ScXMLChangeInfoContext( ScXMLImport& rImport,
615 : sal_uInt16 nPrfx,
616 : const OUString& rLName,
617 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
618 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
619 : SvXMLImportContext( rImport, nPrfx, rLName ),
620 : aInfo(),
621 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper),
622 0 : nParagraphCount(0)
623 : {
624 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
625 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
626 : {
627 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
628 0 : OUString aLocalName;
629 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
630 0 : sAttrName, &aLocalName ));
631 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
632 :
633 0 : if (nPrefix == XML_NAMESPACE_OFFICE)
634 : {
635 0 : if (IsXMLToken(aLocalName, XML_CHG_AUTHOR))
636 : {
637 0 : sAuthorBuffer = sValue;
638 : }
639 0 : else if (IsXMLToken(aLocalName, XML_CHG_DATE_TIME))
640 : {
641 0 : sDateTimeBuffer = sValue;
642 : }
643 : }
644 0 : }
645 0 : }
646 :
647 0 : ScXMLChangeInfoContext::~ScXMLChangeInfoContext()
648 : {
649 0 : }
650 :
651 0 : SvXMLImportContext *ScXMLChangeInfoContext::CreateChildContext( sal_uInt16 nPrefix,
652 : const OUString& rLocalName,
653 : const ::com::sun::star::uno::Reference<
654 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
655 : {
656 0 : SvXMLImportContext *pContext(0);
657 :
658 0 : if( XML_NAMESPACE_DC == nPrefix )
659 : {
660 0 : if( IsXMLToken( rLocalName, XML_CREATOR ) )
661 : pContext = new ScXMLContentContext(GetScImport(), nPrefix,
662 0 : rLocalName, xAttrList, sAuthorBuffer);
663 0 : else if( IsXMLToken( rLocalName, XML_DATE ) )
664 : pContext = new ScXMLContentContext(GetScImport(), nPrefix,
665 0 : rLocalName, xAttrList, sDateTimeBuffer);
666 : }
667 0 : else if ((nPrefix == XML_NAMESPACE_TEXT) && (IsXMLToken(rLocalName, XML_P)) )
668 : {
669 0 : if(nParagraphCount)
670 0 : sCommentBuffer.append(static_cast<sal_Unicode>('\n'));
671 0 : ++nParagraphCount;
672 0 : pContext = new ScXMLContentContext( GetScImport(), nPrefix, rLocalName, xAttrList, sCommentBuffer);
673 : }
674 :
675 0 : if( !pContext )
676 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
677 :
678 0 : return pContext;
679 : }
680 :
681 0 : void ScXMLChangeInfoContext::EndElement()
682 : {
683 0 : aInfo.sUser = sAuthorBuffer.makeStringAndClear();
684 : ::sax::Converter::convertDateTime(aInfo.aDateTime,
685 0 : sDateTimeBuffer.makeStringAndClear());
686 0 : aInfo.sComment = sCommentBuffer.makeStringAndClear();
687 0 : pChangeTrackingImportHelper->SetActionInfo(aInfo);
688 0 : }
689 :
690 0 : ScXMLBigRangeContext::ScXMLBigRangeContext( ScXMLImport& rImport,
691 : sal_uInt16 nPrfx,
692 : const OUString& rLName,
693 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
694 : ScBigRange& rTempBigRange ) :
695 : SvXMLImportContext( rImport, nPrfx, rLName ),
696 0 : rBigRange(rTempBigRange)
697 : {
698 0 : sal_Bool bColumn(false);
699 0 : sal_Bool bRow(false);
700 0 : sal_Bool bTable(false);
701 0 : sal_Int32 nColumn(0);
702 0 : sal_Int32 nRow(0);
703 0 : sal_Int32 nTable(0);
704 0 : sal_Int32 nStartColumn(0);
705 0 : sal_Int32 nEndColumn(0);
706 0 : sal_Int32 nStartRow(0);
707 0 : sal_Int32 nEndRow(0);
708 0 : sal_Int32 nStartTable(0);
709 0 : sal_Int32 nEndTable(0);
710 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
711 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
712 : {
713 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
714 0 : OUString aLocalName;
715 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
716 0 : sAttrName, &aLocalName ));
717 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
718 :
719 0 : if (nPrefix == XML_NAMESPACE_TABLE)
720 : {
721 0 : if (IsXMLToken(aLocalName, XML_COLUMN))
722 : {
723 0 : ::sax::Converter::convertNumber(nColumn, sValue);
724 0 : bColumn = sal_True;
725 : }
726 0 : else if (IsXMLToken(aLocalName, XML_ROW))
727 : {
728 0 : ::sax::Converter::convertNumber(nRow, sValue);
729 0 : bRow = sal_True;
730 : }
731 0 : else if (IsXMLToken(aLocalName, XML_TABLE))
732 : {
733 0 : ::sax::Converter::convertNumber(nTable, sValue);
734 0 : bTable = sal_True;
735 : }
736 0 : else if (IsXMLToken(aLocalName, XML_START_COLUMN))
737 0 : ::sax::Converter::convertNumber(nStartColumn, sValue);
738 0 : else if (IsXMLToken(aLocalName, XML_END_COLUMN))
739 0 : ::sax::Converter::convertNumber(nEndColumn, sValue);
740 0 : else if (IsXMLToken(aLocalName, XML_START_ROW))
741 0 : ::sax::Converter::convertNumber(nStartRow, sValue);
742 0 : else if (IsXMLToken(aLocalName, XML_END_ROW))
743 0 : ::sax::Converter::convertNumber(nEndRow, sValue);
744 0 : else if (IsXMLToken(aLocalName, XML_START_TABLE))
745 0 : ::sax::Converter::convertNumber(nStartTable, sValue);
746 0 : else if (IsXMLToken(aLocalName, XML_END_TABLE))
747 0 : ::sax::Converter::convertNumber(nEndTable, sValue);
748 : }
749 0 : }
750 0 : if (bColumn)
751 0 : nStartColumn = nEndColumn = nColumn;
752 0 : if (bRow)
753 0 : nStartRow = nEndRow = nRow;
754 0 : if (bTable)
755 0 : nStartTable = nEndTable = nTable;
756 : rBigRange.Set(nStartColumn, nStartRow, nStartTable,
757 0 : nEndColumn, nEndRow, nEndTable);
758 0 : }
759 :
760 0 : ScXMLBigRangeContext::~ScXMLBigRangeContext()
761 : {
762 0 : }
763 :
764 0 : SvXMLImportContext *ScXMLBigRangeContext::CreateChildContext( sal_uInt16 nPrefix,
765 : const OUString& rLocalName,
766 : const ::com::sun::star::uno::Reference<
767 : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
768 : {
769 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
770 : }
771 :
772 0 : void ScXMLBigRangeContext::EndElement()
773 : {
774 0 : }
775 :
776 0 : ScXMLCellContentDeletionContext::ScXMLCellContentDeletionContext( ScXMLImport& rImport,
777 : sal_uInt16 nPrfx,
778 : const OUString& rLName,
779 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
780 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper) :
781 : SvXMLImportContext( rImport, nPrfx, rLName ),
782 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper),
783 : nID(0),
784 : nMatrixCols(0),
785 : nMatrixRows(0),
786 : nType(NUMBERFORMAT_ALL),
787 : nMatrixFlag(MM_NONE),
788 : bBigRange(false),
789 0 : bContainsCell(false)
790 : {
791 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
792 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
793 : {
794 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
795 0 : OUString aLocalName;
796 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
797 0 : sAttrName, &aLocalName ));
798 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
799 :
800 0 : if (nPrefix == XML_NAMESPACE_TABLE)
801 : {
802 0 : if (IsXMLToken(aLocalName, XML_ID))
803 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
804 : }
805 0 : }
806 0 : }
807 :
808 0 : ScXMLCellContentDeletionContext::~ScXMLCellContentDeletionContext()
809 : {
810 0 : }
811 :
812 0 : SvXMLImportContext *ScXMLCellContentDeletionContext::CreateChildContext( sal_uInt16 nPrefix,
813 : const OUString& rLocalName,
814 : const ::com::sun::star::uno::Reference<
815 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
816 : {
817 0 : SvXMLImportContext *pContext(0);
818 :
819 0 : if (nPrefix == XML_NAMESPACE_TABLE)
820 : {
821 0 : if (IsXMLToken(rLocalName, XML_CHANGE_TRACK_TABLE_CELL))
822 : {
823 0 : bContainsCell = true;
824 : pContext = new ScXMLChangeCellContext(GetScImport(), nPrefix, rLocalName, xAttrList,
825 0 : maCell, sFormulaAddress, sFormula, sFormulaNmsp, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows );
826 : }
827 0 : else if (IsXMLToken(rLocalName, XML_CELL_ADDRESS))
828 : {
829 : OSL_ENSURE(!nID, "a action with a ID should not contain a BigRange");
830 0 : bBigRange = sal_True;
831 0 : pContext = new ScXMLBigRangeContext(GetScImport(), nPrefix, rLocalName, xAttrList, aBigRange);
832 : }
833 : }
834 :
835 0 : if( !pContext )
836 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
837 :
838 0 : return pContext;
839 : }
840 :
841 0 : void ScXMLCellContentDeletionContext::EndElement()
842 : {
843 : ScMyCellInfo* pCellInfo(new ScMyCellInfo(maCell, sFormulaAddress, sFormula, eGrammar, sInputString, fValue, nType,
844 0 : nMatrixFlag, nMatrixCols, nMatrixRows));
845 0 : if (nID)
846 0 : pChangeTrackingImportHelper->AddDeleted(nID, pCellInfo);
847 : else
848 0 : pChangeTrackingImportHelper->AddGenerated(pCellInfo, aBigRange);
849 0 : }
850 :
851 0 : ScXMLDependenceContext::ScXMLDependenceContext( ScXMLImport& rImport,
852 : sal_uInt16 nPrfx,
853 : const OUString& rLName,
854 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
855 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
856 : SvXMLImportContext( rImport, nPrfx, rLName ),
857 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
858 : {
859 0 : sal_uInt32 nID(0);
860 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
861 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
862 : {
863 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
864 0 : OUString aLocalName;
865 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
866 0 : sAttrName, &aLocalName ));
867 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
868 :
869 0 : if (nPrefix == XML_NAMESPACE_TABLE)
870 : {
871 0 : if (IsXMLToken(aLocalName, XML_ID))
872 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
873 : }
874 0 : }
875 0 : pChangeTrackingImportHelper->AddDependence(nID);
876 0 : }
877 :
878 0 : ScXMLDependenceContext::~ScXMLDependenceContext()
879 : {
880 0 : }
881 :
882 0 : SvXMLImportContext *ScXMLDependenceContext::CreateChildContext( sal_uInt16 nPrefix,
883 : const OUString& rLocalName,
884 : const ::com::sun::star::uno::Reference<
885 : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
886 : {
887 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
888 : }
889 :
890 0 : void ScXMLDependenceContext::EndElement()
891 : {
892 0 : }
893 :
894 0 : ScXMLDependingsContext::ScXMLDependingsContext( ScXMLImport& rImport,
895 : sal_uInt16 nPrfx,
896 : const OUString& rLName,
897 : const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */,
898 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
899 : SvXMLImportContext( rImport, nPrfx, rLName ),
900 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
901 : {
902 : // here are no attributes
903 0 : }
904 :
905 0 : ScXMLDependingsContext::~ScXMLDependingsContext()
906 : {
907 0 : }
908 :
909 0 : SvXMLImportContext *ScXMLDependingsContext::CreateChildContext( sal_uInt16 nPrefix,
910 : const OUString& rLocalName,
911 : const ::com::sun::star::uno::Reference<
912 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
913 : {
914 0 : SvXMLImportContext *pContext(0);
915 :
916 0 : if (nPrefix == XML_NAMESPACE_TABLE)
917 : {
918 : // #i80033# read both old (dependence) and new (dependency) elements
919 0 : if (IsXMLToken(rLocalName, XML_DEPENDENCE) || IsXMLToken(rLocalName, XML_DEPENDENCY))
920 0 : pContext = new ScXMLDependenceContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
921 : }
922 :
923 0 : if( !pContext )
924 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
925 :
926 0 : return pContext;
927 : }
928 :
929 0 : void ScXMLDependingsContext::EndElement()
930 : {
931 0 : }
932 :
933 0 : ScXMLChangeDeletionContext::ScXMLChangeDeletionContext( ScXMLImport& rImport,
934 : sal_uInt16 nPrfx,
935 : const OUString& rLName,
936 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
937 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
938 : SvXMLImportContext( rImport, nPrfx, rLName ),
939 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
940 : {
941 0 : sal_uInt32 nID(0);
942 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
943 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
944 : {
945 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
946 0 : OUString aLocalName;
947 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
948 0 : sAttrName, &aLocalName ));
949 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
950 :
951 0 : if (nPrefix == XML_NAMESPACE_TABLE)
952 : {
953 0 : if (IsXMLToken(aLocalName, XML_ID))
954 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
955 : }
956 0 : }
957 0 : pChangeTrackingImportHelper->AddDeleted(nID);
958 0 : }
959 :
960 0 : ScXMLChangeDeletionContext::~ScXMLChangeDeletionContext()
961 : {
962 0 : }
963 :
964 0 : SvXMLImportContext *ScXMLChangeDeletionContext::CreateChildContext( sal_uInt16 nPrefix,
965 : const OUString& rLocalName,
966 : const ::com::sun::star::uno::Reference<
967 : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
968 : {
969 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
970 : }
971 :
972 0 : void ScXMLChangeDeletionContext::EndElement()
973 : {
974 0 : }
975 :
976 0 : ScXMLDeletionsContext::ScXMLDeletionsContext( ScXMLImport& rImport,
977 : sal_uInt16 nPrfx,
978 : const OUString& rLName,
979 : const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */,
980 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
981 : SvXMLImportContext( rImport, nPrfx, rLName ),
982 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
983 : {
984 : // here are no attributes
985 0 : }
986 :
987 0 : ScXMLDeletionsContext::~ScXMLDeletionsContext()
988 : {
989 0 : }
990 :
991 0 : SvXMLImportContext *ScXMLDeletionsContext::CreateChildContext( sal_uInt16 nPrefix,
992 : const OUString& rLocalName,
993 : const ::com::sun::star::uno::Reference<
994 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
995 : {
996 0 : SvXMLImportContext *pContext(0);
997 :
998 0 : if (nPrefix == XML_NAMESPACE_TABLE)
999 : {
1000 0 : if (IsXMLToken(rLocalName, XML_CHANGE_DELETION))
1001 0 : pContext = new ScXMLChangeDeletionContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1002 0 : else if (IsXMLToken(rLocalName, XML_CELL_CONTENT_DELETION))
1003 0 : pContext = new ScXMLCellContentDeletionContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1004 : }
1005 :
1006 0 : if( !pContext )
1007 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1008 :
1009 0 : return pContext;
1010 : }
1011 :
1012 0 : void ScXMLDeletionsContext::EndElement()
1013 : {
1014 0 : }
1015 :
1016 0 : ScXMLChangeTextPContext::ScXMLChangeTextPContext( ScXMLImport& rImport,
1017 : sal_uInt16 nPrfx,
1018 : const OUString& rLName,
1019 : const ::com::sun::star::uno::Reference<
1020 : ::com::sun::star::xml::sax::XAttributeList>& xTempAttrList,
1021 : ScXMLChangeCellContext* pTempChangeCellContext) :
1022 : SvXMLImportContext( rImport, nPrfx, rLName ),
1023 : xAttrList(xTempAttrList),
1024 : sLName(rLName),
1025 : sText(),
1026 : pChangeCellContext(pTempChangeCellContext),
1027 : pTextPContext(NULL),
1028 0 : nPrefix(nPrfx)
1029 : {
1030 : // here are no attributes
1031 0 : }
1032 :
1033 0 : ScXMLChangeTextPContext::~ScXMLChangeTextPContext()
1034 : {
1035 0 : if (pTextPContext)
1036 0 : delete pTextPContext;
1037 0 : }
1038 :
1039 0 : SvXMLImportContext *ScXMLChangeTextPContext::CreateChildContext( sal_uInt16 nTempPrefix,
1040 : const OUString& rLName,
1041 : const ::com::sun::star::uno::Reference<
1042 : ::com::sun::star::xml::sax::XAttributeList>& xTempAttrList )
1043 : {
1044 0 : SvXMLImportContext *pContext(0);
1045 :
1046 0 : if ((nPrefix == XML_NAMESPACE_TEXT) && (IsXMLToken(rLName, XML_S)) && !pTextPContext)
1047 : {
1048 0 : sal_Int32 nRepeat(0);
1049 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1050 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1051 : {
1052 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1053 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1054 0 : OUString aLocalName;
1055 0 : sal_uInt16 nPrfx(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1056 0 : sAttrName, &aLocalName ));
1057 0 : if ((nPrfx == XML_NAMESPACE_TEXT) && (IsXMLToken(aLocalName, XML_C)))
1058 0 : nRepeat = sValue.toInt32();
1059 0 : }
1060 0 : if (nRepeat)
1061 0 : for (sal_Int32 j = 0; j < nRepeat; ++j)
1062 0 : sText.append(static_cast<sal_Unicode>(' '));
1063 : else
1064 0 : sText.append(static_cast<sal_Unicode>(' '));
1065 : }
1066 : else
1067 : {
1068 0 : if (!pChangeCellContext->IsEditCell())
1069 0 : pChangeCellContext->CreateTextPContext(false);
1070 0 : sal_Bool bWasContext (sal_True);
1071 0 : if (!pTextPContext)
1072 : {
1073 0 : bWasContext = false;
1074 0 : pTextPContext = GetScImport().GetTextImport()->CreateTextChildContext(
1075 0 : GetScImport(), nPrefix, sLName, xAttrList);
1076 : }
1077 0 : if (pTextPContext)
1078 : {
1079 0 : if (!bWasContext)
1080 0 : pTextPContext->Characters(sText.makeStringAndClear());
1081 0 : pContext = pTextPContext->CreateChildContext(nTempPrefix, rLName, xTempAttrList);
1082 : }
1083 : }
1084 :
1085 0 : if( !pContext )
1086 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
1087 :
1088 0 : return pContext;
1089 : }
1090 :
1091 0 : void ScXMLChangeTextPContext::Characters( const OUString& rChars )
1092 : {
1093 0 : if (!pTextPContext)
1094 0 : sText.append(rChars);
1095 : else
1096 0 : pTextPContext->Characters(rChars);
1097 0 : }
1098 :
1099 0 : void ScXMLChangeTextPContext::EndElement()
1100 : {
1101 0 : if (!pTextPContext)
1102 0 : pChangeCellContext->SetText(sText.makeStringAndClear());
1103 0 : }
1104 :
1105 0 : ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
1106 : sal_uInt16 nPrfx,
1107 : const OUString& rLName,
1108 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1109 : ScCellValue& rOldCell, OUString& rAddress,
1110 : OUString& rFormula, OUString& rFormulaNmsp,
1111 : formula::FormulaGrammar::Grammar& rGrammar,
1112 : OUString& rTempInputString, double& fDateTimeValue, sal_uInt16& nType,
1113 : sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows ) :
1114 : SvXMLImportContext( rImport, nPrfx, rLName ),
1115 : mrOldCell(rOldCell),
1116 : rInputString(rTempInputString),
1117 : pEditTextObj(NULL),
1118 : rDateTimeValue(fDateTimeValue),
1119 : rType(nType),
1120 : bEmpty(sal_True),
1121 : bFirstParagraph(sal_True),
1122 : bString(sal_True),
1123 0 : bFormula(false)
1124 : {
1125 0 : sal_Bool bIsMatrix(false);
1126 0 : sal_Bool bIsCoveredMatrix(false);
1127 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1128 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1129 : {
1130 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1131 0 : OUString aLocalName;
1132 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1133 0 : sAttrName, &aLocalName ));
1134 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1135 :
1136 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1137 : {
1138 0 : if (IsXMLToken(aLocalName, XML_FORMULA))
1139 : {
1140 0 : bEmpty = false;
1141 0 : GetScImport().ExtractFormulaNamespaceGrammar( rFormula, rFormulaNmsp, rGrammar, sValue );
1142 0 : bFormula = sal_True;
1143 : }
1144 0 : else if (IsXMLToken(aLocalName, XML_CELL_ADDRESS))
1145 : {
1146 0 : rAddress = sValue;
1147 : }
1148 0 : else if (IsXMLToken(aLocalName, XML_MATRIX_COVERED))
1149 : {
1150 0 : bIsCoveredMatrix = IsXMLToken(sValue, XML_TRUE);
1151 : }
1152 0 : else if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_COLUMNS_SPANNED))
1153 : {
1154 0 : bIsMatrix = sal_True;
1155 0 : ::sax::Converter::convertNumber(nMatrixCols, sValue);
1156 : }
1157 0 : else if (IsXMLToken(aLocalName, XML_NUMBER_MATRIX_ROWS_SPANNED))
1158 : {
1159 0 : bIsMatrix = sal_True;
1160 0 : ::sax::Converter::convertNumber(nMatrixRows, sValue);
1161 : }
1162 : }
1163 0 : else if (nPrefix == XML_NAMESPACE_OFFICE)
1164 : {
1165 0 : if (IsXMLToken(aLocalName, XML_VALUE_TYPE))
1166 : {
1167 0 : if (IsXMLToken(sValue, XML_FLOAT))
1168 0 : bString = false;
1169 0 : else if (IsXMLToken(sValue, XML_DATE))
1170 : {
1171 0 : rType = NUMBERFORMAT_DATE;
1172 0 : bString = false;
1173 : }
1174 0 : else if (IsXMLToken(sValue, XML_TIME))
1175 : {
1176 0 : rType = NUMBERFORMAT_TIME;
1177 0 : bString = false;
1178 : }
1179 : }
1180 0 : else if (IsXMLToken(aLocalName, XML_VALUE))
1181 : {
1182 0 : ::sax::Converter::convertDouble(fValue, sValue);
1183 0 : bEmpty = false;
1184 : }
1185 0 : else if (IsXMLToken(aLocalName, XML_DATE_VALUE))
1186 : {
1187 0 : bEmpty = false;
1188 0 : if (GetScImport().GetMM100UnitConverter().setNullDate(GetScImport().GetModel()))
1189 0 : GetScImport().GetMM100UnitConverter().convertDateTime(rDateTimeValue, sValue);
1190 0 : fValue = rDateTimeValue;
1191 : }
1192 0 : else if (IsXMLToken(aLocalName, XML_TIME_VALUE))
1193 : {
1194 0 : bEmpty = false;
1195 0 : ::sax::Converter::convertDuration(rDateTimeValue, sValue);
1196 0 : fValue = rDateTimeValue;
1197 : }
1198 : }
1199 0 : }
1200 0 : if (bIsCoveredMatrix)
1201 0 : nMatrixFlag = MM_REFERENCE;
1202 0 : else if (bIsMatrix && nMatrixRows && nMatrixCols)
1203 0 : nMatrixFlag = MM_FORMULA;
1204 0 : }
1205 :
1206 0 : ScXMLChangeCellContext::~ScXMLChangeCellContext()
1207 : {
1208 0 : }
1209 :
1210 0 : SvXMLImportContext *ScXMLChangeCellContext::CreateChildContext( sal_uInt16 nPrefix,
1211 : const OUString& rLocalName,
1212 : const ::com::sun::star::uno::Reference<
1213 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1214 : {
1215 0 : SvXMLImportContext *pContext(0);
1216 :
1217 0 : if ((nPrefix == XML_NAMESPACE_TEXT) && (IsXMLToken(rLocalName, XML_P)))
1218 : {
1219 0 : bEmpty = false;
1220 0 : if (bFirstParagraph)
1221 : {
1222 0 : pContext = new ScXMLChangeTextPContext(GetScImport(), nPrefix, rLocalName, xAttrList, this);
1223 0 : bFirstParagraph = false;
1224 : }
1225 : else
1226 : {
1227 0 : if (!pEditTextObj)
1228 0 : CreateTextPContext(sal_True);
1229 0 : pContext = GetScImport().GetTextImport()->CreateTextChildContext(
1230 0 : GetScImport(), nPrefix, rLocalName, xAttrList);
1231 : }
1232 : }
1233 :
1234 0 : if( !pContext )
1235 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1236 :
1237 0 : return pContext;
1238 : }
1239 :
1240 0 : void ScXMLChangeCellContext::CreateTextPContext(sal_Bool bIsNewParagraph)
1241 : {
1242 0 : if (GetScImport().GetDocument())
1243 : {
1244 0 : pEditTextObj = new ScEditEngineTextObj();
1245 0 : pEditTextObj->acquire();
1246 0 : pEditTextObj->GetEditEngine()->SetEditTextObjectPool(GetScImport().GetDocument()->GetEditPool());
1247 0 : uno::Reference <text::XText> xText(pEditTextObj);
1248 0 : if (xText.is())
1249 : {
1250 0 : uno::Reference<text::XTextCursor> xTextCursor(xText->createTextCursor());
1251 0 : if (bIsNewParagraph)
1252 : {
1253 0 : xText->setString(sText);
1254 0 : xTextCursor->gotoEnd(false);
1255 0 : uno::Reference < text::XTextRange > xTextRange (xTextCursor, uno::UNO_QUERY);
1256 0 : if (xTextRange.is())
1257 0 : xText->insertControlCharacter(xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, false);
1258 : }
1259 0 : GetScImport().GetTextImport()->SetCursor(xTextCursor);
1260 0 : }
1261 : }
1262 0 : }
1263 :
1264 0 : void ScXMLChangeCellContext::EndElement()
1265 : {
1266 0 : if (!bEmpty)
1267 : {
1268 0 : if (pEditTextObj)
1269 : {
1270 0 : if (GetImport().GetTextImport()->GetCursor().is())
1271 : {
1272 : //GetImport().GetTextImport()->GetCursor()->gotoEnd(sal_False);
1273 0 : if( GetImport().GetTextImport()->GetCursor()->goLeft( 1, sal_True ) )
1274 : {
1275 0 : OUString sEmpty;
1276 0 : GetImport().GetTextImport()->GetText()->insertString(
1277 0 : GetImport().GetTextImport()->GetCursorAsRange(), sEmpty,
1278 0 : sal_True );
1279 : }
1280 : }
1281 0 : if (GetScImport().GetDocument())
1282 : {
1283 : // The cell will own the text object instance.
1284 0 : mrOldCell.meType = CELLTYPE_EDIT;
1285 0 : mrOldCell.mpEditText = pEditTextObj->CreateTextObject();
1286 : }
1287 0 : GetScImport().GetTextImport()->ResetCursor();
1288 0 : pEditTextObj->release();
1289 : }
1290 : else
1291 : {
1292 0 : if (!bFormula)
1293 : {
1294 0 : if (!sText.isEmpty() && bString)
1295 : {
1296 0 : mrOldCell.meType = CELLTYPE_STRING;
1297 0 : mrOldCell.mpString = new OUString(sText);
1298 : }
1299 : else
1300 : {
1301 0 : mrOldCell.meType = CELLTYPE_VALUE;
1302 0 : mrOldCell.mfValue = fValue;
1303 : }
1304 0 : if (rType == NUMBERFORMAT_DATE || rType == NUMBERFORMAT_TIME)
1305 0 : rInputString = sText;
1306 : }
1307 : }
1308 : }
1309 : else
1310 0 : mrOldCell.clear();
1311 0 : }
1312 :
1313 0 : ScXMLPreviousContext::ScXMLPreviousContext( ScXMLImport& rImport,
1314 : sal_uInt16 nPrfx,
1315 : const OUString& rLName,
1316 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1317 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1318 : SvXMLImportContext( rImport, nPrfx, rLName ),
1319 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper),
1320 : nID(0),
1321 : nMatrixCols(0),
1322 : nMatrixRows(0),
1323 : eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
1324 : nType(NUMBERFORMAT_ALL),
1325 0 : nMatrixFlag(MM_NONE)
1326 : {
1327 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1328 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1329 : {
1330 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1331 0 : OUString aLocalName;
1332 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1333 0 : sAttrName, &aLocalName ));
1334 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1335 :
1336 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1337 : {
1338 0 : if (IsXMLToken(aLocalName, XML_ID))
1339 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
1340 : }
1341 0 : }
1342 0 : }
1343 :
1344 0 : ScXMLPreviousContext::~ScXMLPreviousContext()
1345 : {
1346 0 : }
1347 :
1348 0 : SvXMLImportContext *ScXMLPreviousContext::CreateChildContext( sal_uInt16 nPrefix,
1349 : const OUString& rLocalName,
1350 : const ::com::sun::star::uno::Reference<
1351 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1352 : {
1353 0 : SvXMLImportContext *pContext(0);
1354 :
1355 0 : if ((nPrefix == XML_NAMESPACE_TABLE) && (IsXMLToken(rLocalName, XML_CHANGE_TRACK_TABLE_CELL)))
1356 : pContext = new ScXMLChangeCellContext(GetScImport(), nPrefix, rLocalName, xAttrList,
1357 0 : maOldCell, sFormulaAddress, sFormula, sFormulaNmsp, eGrammar, sInputString, fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows);
1358 :
1359 0 : if( !pContext )
1360 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1361 :
1362 0 : return pContext;
1363 : }
1364 :
1365 0 : void ScXMLPreviousContext::EndElement()
1366 : {
1367 : pChangeTrackingImportHelper->SetPreviousChange(nID, new ScMyCellInfo(maOldCell, sFormulaAddress, sFormula, eGrammar, sInputString,
1368 0 : fValue, nType, nMatrixFlag, nMatrixCols, nMatrixRows));
1369 0 : }
1370 :
1371 0 : ScXMLContentChangeContext::ScXMLContentChangeContext( ScXMLImport& rImport,
1372 : sal_uInt16 nPrfx,
1373 : const OUString& rLName,
1374 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1375 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1376 : SvXMLImportContext( rImport, nPrfx, rLName ),
1377 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1378 : {
1379 0 : sal_uInt32 nActionNumber(0);
1380 0 : sal_uInt32 nRejectingNumber(0);
1381 0 : ScChangeActionState nActionState(SC_CAS_VIRGIN);
1382 :
1383 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1384 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1385 : {
1386 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1387 0 : OUString aLocalName;
1388 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1389 0 : sAttrName, &aLocalName ));
1390 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1391 :
1392 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1393 : {
1394 0 : if (IsXMLToken(aLocalName, XML_ID))
1395 : {
1396 0 : nActionNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1397 : }
1398 0 : else if (IsXMLToken(aLocalName, XML_ACCEPTANCE_STATE))
1399 : {
1400 0 : if (IsXMLToken(sValue, XML_ACCEPTED))
1401 0 : nActionState = SC_CAS_ACCEPTED;
1402 0 : else if (IsXMLToken(sValue, XML_REJECTED))
1403 0 : nActionState = SC_CAS_REJECTED;
1404 : }
1405 0 : else if (IsXMLToken(aLocalName, XML_REJECTING_CHANGE_ID))
1406 : {
1407 0 : nRejectingNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1408 : }
1409 : }
1410 0 : }
1411 :
1412 0 : pChangeTrackingImportHelper->StartChangeAction(SC_CAT_CONTENT);
1413 0 : pChangeTrackingImportHelper->SetActionNumber(nActionNumber);
1414 0 : pChangeTrackingImportHelper->SetActionState(nActionState);
1415 0 : pChangeTrackingImportHelper->SetRejectingNumber(nRejectingNumber);
1416 0 : }
1417 :
1418 0 : ScXMLContentChangeContext::~ScXMLContentChangeContext()
1419 : {
1420 0 : }
1421 :
1422 0 : SvXMLImportContext *ScXMLContentChangeContext::CreateChildContext( sal_uInt16 nPrefix,
1423 : const OUString& rLocalName,
1424 : const ::com::sun::star::uno::Reference<
1425 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1426 : {
1427 0 : SvXMLImportContext *pContext(0);
1428 :
1429 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && (IsXMLToken(rLocalName, XML_CHANGE_INFO)))
1430 : {
1431 0 : pContext = new ScXMLChangeInfoContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1432 : }
1433 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
1434 : {
1435 0 : if (IsXMLToken(rLocalName, XML_CELL_ADDRESS))
1436 : {
1437 0 : pContext = new ScXMLBigRangeContext(GetScImport(), nPrefix, rLocalName, xAttrList, aBigRange);
1438 : }
1439 0 : else if (IsXMLToken(rLocalName, XML_DEPENDENCIES))
1440 : {
1441 0 : pContext = new ScXMLDependingsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1442 : }
1443 0 : else if (IsXMLToken(rLocalName, XML_DELETIONS))
1444 0 : pContext = new ScXMLDeletionsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1445 0 : else if (IsXMLToken(rLocalName, XML_PREVIOUS))
1446 : {
1447 0 : pContext = new ScXMLPreviousContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1448 : }
1449 : }
1450 :
1451 0 : if( !pContext )
1452 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1453 :
1454 0 : return pContext;
1455 : }
1456 :
1457 0 : void ScXMLContentChangeContext::EndElement()
1458 : {
1459 0 : pChangeTrackingImportHelper->SetBigRange(aBigRange);
1460 0 : pChangeTrackingImportHelper->EndChangeAction();
1461 0 : }
1462 :
1463 0 : ScXMLInsertionContext::ScXMLInsertionContext( ScXMLImport& rImport,
1464 : sal_uInt16 nPrfx,
1465 : const OUString& rLName,
1466 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1467 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1468 : SvXMLImportContext( rImport, nPrfx, rLName ),
1469 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1470 : {
1471 0 : sal_uInt32 nActionNumber(0);
1472 0 : sal_uInt32 nRejectingNumber(0);
1473 0 : sal_Int32 nPosition(0);
1474 0 : sal_Int32 nCount(1);
1475 0 : sal_Int32 nTable(0);
1476 0 : ScChangeActionState nActionState(SC_CAS_VIRGIN);
1477 0 : ScChangeActionType nActionType(SC_CAT_INSERT_COLS);
1478 :
1479 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1480 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1481 : {
1482 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1483 0 : OUString aLocalName;
1484 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1485 0 : sAttrName, &aLocalName ));
1486 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1487 :
1488 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1489 : {
1490 0 : if (IsXMLToken(aLocalName, XML_ID))
1491 : {
1492 0 : nActionNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1493 : }
1494 0 : else if (IsXMLToken(aLocalName, XML_ACCEPTANCE_STATE))
1495 : {
1496 0 : if (IsXMLToken(sValue, XML_ACCEPTED))
1497 0 : nActionState = SC_CAS_ACCEPTED;
1498 0 : else if (IsXMLToken(sValue, XML_REJECTED))
1499 0 : nActionState = SC_CAS_REJECTED;
1500 : }
1501 0 : else if (IsXMLToken(aLocalName, XML_REJECTING_CHANGE_ID))
1502 : {
1503 0 : nRejectingNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1504 : }
1505 0 : else if (IsXMLToken(aLocalName, XML_TYPE))
1506 : {
1507 0 : if (IsXMLToken(sValue, XML_ROW))
1508 0 : nActionType = SC_CAT_INSERT_ROWS;
1509 0 : else if (IsXMLToken(sValue, XML_TABLE))
1510 0 : nActionType = SC_CAT_INSERT_TABS;
1511 : }
1512 0 : else if (IsXMLToken(aLocalName, XML_POSITION))
1513 : {
1514 0 : ::sax::Converter::convertNumber(nPosition, sValue);
1515 : }
1516 0 : else if (IsXMLToken(aLocalName, XML_TABLE))
1517 : {
1518 0 : ::sax::Converter::convertNumber(nTable, sValue);
1519 : }
1520 0 : else if (IsXMLToken(aLocalName, XML_COUNT))
1521 : {
1522 0 : ::sax::Converter::convertNumber(nCount, sValue);
1523 : }
1524 : }
1525 0 : }
1526 :
1527 0 : pChangeTrackingImportHelper->StartChangeAction(nActionType);
1528 0 : pChangeTrackingImportHelper->SetActionNumber(nActionNumber);
1529 0 : pChangeTrackingImportHelper->SetActionState(nActionState);
1530 0 : pChangeTrackingImportHelper->SetRejectingNumber(nRejectingNumber);
1531 0 : pChangeTrackingImportHelper->SetPosition(nPosition, nCount, nTable);
1532 0 : }
1533 :
1534 0 : ScXMLInsertionContext::~ScXMLInsertionContext()
1535 : {
1536 0 : }
1537 :
1538 0 : SvXMLImportContext *ScXMLInsertionContext::CreateChildContext( sal_uInt16 nPrefix,
1539 : const OUString& rLocalName,
1540 : const ::com::sun::star::uno::Reference<
1541 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1542 : {
1543 0 : SvXMLImportContext *pContext(0);
1544 :
1545 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && (IsXMLToken(rLocalName, XML_CHANGE_INFO)))
1546 : {
1547 0 : pContext = new ScXMLChangeInfoContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1548 : }
1549 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
1550 : {
1551 0 : if (IsXMLToken(rLocalName, XML_DEPENDENCIES))
1552 0 : pContext = new ScXMLDependingsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1553 0 : else if (IsXMLToken(rLocalName, XML_DELETIONS))
1554 0 : pContext = new ScXMLDeletionsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1555 : }
1556 :
1557 0 : if( !pContext )
1558 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1559 :
1560 0 : return pContext;
1561 : }
1562 :
1563 0 : void ScXMLInsertionContext::EndElement()
1564 : {
1565 0 : pChangeTrackingImportHelper->EndChangeAction();
1566 0 : }
1567 :
1568 0 : ScXMLInsertionCutOffContext::ScXMLInsertionCutOffContext( ScXMLImport& rImport,
1569 : sal_uInt16 nPrfx,
1570 : const OUString& rLName,
1571 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1572 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1573 : SvXMLImportContext( rImport, nPrfx, rLName ),
1574 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1575 : {
1576 0 : sal_uInt32 nID(0);
1577 0 : sal_Int32 nPosition(0);
1578 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1579 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1580 : {
1581 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1582 0 : OUString aLocalName;
1583 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1584 0 : sAttrName, &aLocalName ));
1585 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1586 :
1587 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1588 : {
1589 0 : if (IsXMLToken(aLocalName, XML_ID))
1590 : {
1591 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
1592 : }
1593 0 : else if (IsXMLToken(aLocalName, XML_POSITION))
1594 : {
1595 0 : ::sax::Converter::convertNumber(nPosition, sValue);
1596 : }
1597 : }
1598 0 : }
1599 0 : pChangeTrackingImportHelper->SetInsertionCutOff(nID, nPosition);
1600 0 : }
1601 :
1602 0 : ScXMLInsertionCutOffContext::~ScXMLInsertionCutOffContext()
1603 : {
1604 0 : }
1605 :
1606 0 : SvXMLImportContext *ScXMLInsertionCutOffContext::CreateChildContext( sal_uInt16 nPrefix,
1607 : const OUString& rLocalName,
1608 : const ::com::sun::star::uno::Reference<
1609 : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
1610 : {
1611 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1612 : }
1613 :
1614 0 : void ScXMLInsertionCutOffContext::EndElement()
1615 : {
1616 0 : }
1617 :
1618 0 : ScXMLMovementCutOffContext::ScXMLMovementCutOffContext( ScXMLImport& rImport,
1619 : sal_uInt16 nPrfx,
1620 : const OUString& rLName,
1621 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1622 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1623 : SvXMLImportContext( rImport, nPrfx, rLName ),
1624 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1625 : {
1626 0 : sal_uInt32 nID(0);
1627 0 : sal_Int32 nPosition(0);
1628 0 : sal_Int32 nStartPosition(0);
1629 0 : sal_Int32 nEndPosition(0);
1630 0 : sal_Bool bPosition(false);
1631 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1632 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1633 : {
1634 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1635 0 : OUString aLocalName;
1636 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1637 0 : sAttrName, &aLocalName ));
1638 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1639 :
1640 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1641 : {
1642 0 : if (IsXMLToken(aLocalName, XML_ID))
1643 : {
1644 0 : nID = pChangeTrackingImportHelper->GetIDFromString(sValue);
1645 : }
1646 0 : else if (IsXMLToken(aLocalName, XML_POSITION))
1647 : {
1648 0 : bPosition = sal_True;
1649 0 : ::sax::Converter::convertNumber(nPosition, sValue);
1650 : }
1651 0 : else if (IsXMLToken(aLocalName, XML_START_POSITION))
1652 : {
1653 0 : ::sax::Converter::convertNumber(nStartPosition, sValue);
1654 : }
1655 0 : else if (IsXMLToken(aLocalName, XML_END_POSITION))
1656 : {
1657 0 : ::sax::Converter::convertNumber(nEndPosition, sValue);
1658 : }
1659 : }
1660 0 : }
1661 0 : if (bPosition)
1662 0 : nStartPosition = nEndPosition = nPosition;
1663 0 : pChangeTrackingImportHelper->AddMoveCutOff(nID, nStartPosition, nEndPosition);
1664 0 : }
1665 :
1666 0 : ScXMLMovementCutOffContext::~ScXMLMovementCutOffContext()
1667 : {
1668 0 : }
1669 :
1670 0 : SvXMLImportContext *ScXMLMovementCutOffContext::CreateChildContext( sal_uInt16 nPrefix,
1671 : const OUString& rLocalName,
1672 : const ::com::sun::star::uno::Reference<
1673 : ::com::sun::star::xml::sax::XAttributeList>& /* xAttrList */ )
1674 : {
1675 0 : return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1676 : }
1677 :
1678 0 : void ScXMLMovementCutOffContext::EndElement()
1679 : {
1680 0 : }
1681 :
1682 0 : ScXMLCutOffsContext::ScXMLCutOffsContext( ScXMLImport& rImport,
1683 : sal_uInt16 nPrfx,
1684 : const OUString& rLName,
1685 : const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */,
1686 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1687 : SvXMLImportContext( rImport, nPrfx, rLName ),
1688 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1689 : {
1690 : // here are no attributes
1691 0 : }
1692 :
1693 0 : ScXMLCutOffsContext::~ScXMLCutOffsContext()
1694 : {
1695 0 : }
1696 :
1697 0 : SvXMLImportContext *ScXMLCutOffsContext::CreateChildContext( sal_uInt16 nPrefix,
1698 : const OUString& rLocalName,
1699 : const ::com::sun::star::uno::Reference<
1700 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1701 : {
1702 0 : SvXMLImportContext *pContext(0);
1703 :
1704 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1705 : {
1706 0 : if (IsXMLToken(rLocalName, XML_INSERTION_CUT_OFF))
1707 0 : pContext = new ScXMLInsertionCutOffContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1708 0 : else if (IsXMLToken(rLocalName, XML_MOVEMENT_CUT_OFF))
1709 0 : pContext = new ScXMLMovementCutOffContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1710 : }
1711 :
1712 0 : if( !pContext )
1713 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1714 :
1715 0 : return pContext;
1716 : }
1717 :
1718 0 : void ScXMLCutOffsContext::EndElement()
1719 : {
1720 0 : }
1721 :
1722 0 : ScXMLDeletionContext::ScXMLDeletionContext( ScXMLImport& rImport,
1723 : sal_uInt16 nPrfx,
1724 : const OUString& rLName,
1725 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1726 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1727 : SvXMLImportContext( rImport, nPrfx, rLName ),
1728 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1729 : {
1730 0 : sal_uInt32 nActionNumber(0);
1731 0 : sal_uInt32 nRejectingNumber(0);
1732 0 : sal_Int32 nPosition(0);
1733 0 : sal_Int32 nMultiSpanned(0);
1734 0 : sal_Int32 nTable(0);
1735 0 : ScChangeActionState nActionState(SC_CAS_VIRGIN);
1736 0 : ScChangeActionType nActionType(SC_CAT_DELETE_COLS);
1737 :
1738 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1739 0 : for( sal_Int16 i=0; i < nAttrCount; i++ )
1740 : {
1741 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1742 0 : OUString aLocalName;
1743 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1744 0 : sAttrName, &aLocalName ));
1745 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1746 :
1747 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1748 : {
1749 0 : if (IsXMLToken(aLocalName, XML_ID))
1750 : {
1751 0 : nActionNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1752 : }
1753 0 : else if (IsXMLToken(aLocalName, XML_ACCEPTANCE_STATE))
1754 : {
1755 0 : if (IsXMLToken(sValue, XML_ACCEPTED))
1756 0 : nActionState = SC_CAS_ACCEPTED;
1757 0 : else if (IsXMLToken(sValue, XML_REJECTED))
1758 0 : nActionState = SC_CAS_REJECTED;
1759 : }
1760 0 : else if (IsXMLToken(aLocalName, XML_REJECTING_CHANGE_ID))
1761 : {
1762 0 : nRejectingNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1763 : }
1764 0 : else if (IsXMLToken(aLocalName, XML_TYPE))
1765 : {
1766 0 : if (IsXMLToken(sValue, XML_ROW))
1767 : {
1768 0 : nActionType = SC_CAT_DELETE_ROWS;
1769 : }
1770 0 : else if (IsXMLToken(aLocalName, XML_TABLE))
1771 : {
1772 0 : nActionType = SC_CAT_DELETE_TABS;
1773 : }
1774 : }
1775 0 : else if (IsXMLToken(aLocalName, XML_POSITION))
1776 : {
1777 0 : ::sax::Converter::convertNumber(nPosition, sValue);
1778 : }
1779 0 : else if (IsXMLToken(aLocalName, XML_TABLE))
1780 : {
1781 0 : ::sax::Converter::convertNumber(nTable, sValue);
1782 : }
1783 0 : else if (IsXMLToken(aLocalName, XML_MULTI_DELETION_SPANNED))
1784 : {
1785 0 : ::sax::Converter::convertNumber(nMultiSpanned, sValue);
1786 : }
1787 : }
1788 0 : }
1789 :
1790 0 : pChangeTrackingImportHelper->StartChangeAction(nActionType);
1791 0 : pChangeTrackingImportHelper->SetActionNumber(nActionNumber);
1792 0 : pChangeTrackingImportHelper->SetActionState(nActionState);
1793 0 : pChangeTrackingImportHelper->SetRejectingNumber(nRejectingNumber);
1794 0 : pChangeTrackingImportHelper->SetPosition(nPosition, 1, nTable);
1795 0 : pChangeTrackingImportHelper->SetMultiSpanned(static_cast<sal_Int16>(nMultiSpanned));
1796 0 : }
1797 :
1798 0 : ScXMLDeletionContext::~ScXMLDeletionContext()
1799 : {
1800 0 : }
1801 :
1802 0 : SvXMLImportContext *ScXMLDeletionContext::CreateChildContext( sal_uInt16 nPrefix,
1803 : const OUString& rLocalName,
1804 : const ::com::sun::star::uno::Reference<
1805 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1806 : {
1807 0 : SvXMLImportContext *pContext(0);
1808 :
1809 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && (IsXMLToken(rLocalName, XML_CHANGE_INFO)))
1810 : {
1811 0 : pContext = new ScXMLChangeInfoContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1812 : }
1813 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
1814 : {
1815 0 : if (IsXMLToken(rLocalName, XML_DEPENDENCIES))
1816 0 : pContext = new ScXMLDependingsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1817 0 : else if (IsXMLToken(rLocalName, XML_DELETIONS))
1818 0 : pContext = new ScXMLDeletionsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1819 0 : else if (IsXMLToken(rLocalName, XML_CUT_OFFS) || rLocalName.equalsAsciiL("cut_offs", 8))
1820 0 : pContext = new ScXMLCutOffsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1821 : else
1822 : {
1823 : OSL_FAIL("don't know this");
1824 : }
1825 : }
1826 :
1827 0 : if( !pContext )
1828 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1829 :
1830 0 : return pContext;
1831 : }
1832 :
1833 0 : void ScXMLDeletionContext::EndElement()
1834 : {
1835 0 : pChangeTrackingImportHelper->EndChangeAction();
1836 0 : }
1837 :
1838 0 : ScXMLMovementContext::ScXMLMovementContext( ScXMLImport& rImport,
1839 : sal_uInt16 nPrfx,
1840 : const OUString& rLName,
1841 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1842 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1843 : SvXMLImportContext( rImport, nPrfx, rLName ),
1844 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1845 : {
1846 0 : sal_uInt32 nActionNumber(0);
1847 0 : sal_uInt32 nRejectingNumber(0);
1848 0 : ScChangeActionState nActionState(SC_CAS_VIRGIN);
1849 :
1850 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1851 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1852 : {
1853 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1854 0 : OUString aLocalName;
1855 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1856 0 : sAttrName, &aLocalName ));
1857 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1858 :
1859 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1860 : {
1861 0 : if (IsXMLToken(aLocalName, XML_ID))
1862 : {
1863 0 : nActionNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1864 : }
1865 0 : else if (IsXMLToken(aLocalName, XML_ACCEPTANCE_STATE))
1866 : {
1867 0 : if (IsXMLToken(sValue, XML_ACCEPTED))
1868 0 : nActionState = SC_CAS_ACCEPTED;
1869 0 : else if (IsXMLToken(sValue, XML_REJECTED))
1870 0 : nActionState = SC_CAS_REJECTED;
1871 : }
1872 0 : else if (IsXMLToken(aLocalName, XML_REJECTING_CHANGE_ID))
1873 : {
1874 0 : nRejectingNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1875 : }
1876 : }
1877 0 : }
1878 :
1879 0 : pChangeTrackingImportHelper->StartChangeAction(SC_CAT_MOVE);
1880 0 : pChangeTrackingImportHelper->SetActionNumber(nActionNumber);
1881 0 : pChangeTrackingImportHelper->SetActionState(nActionState);
1882 0 : pChangeTrackingImportHelper->SetRejectingNumber(nRejectingNumber);
1883 0 : }
1884 :
1885 0 : ScXMLMovementContext::~ScXMLMovementContext()
1886 : {
1887 0 : }
1888 :
1889 0 : SvXMLImportContext *ScXMLMovementContext::CreateChildContext( sal_uInt16 nPrefix,
1890 : const OUString& rLocalName,
1891 : const ::com::sun::star::uno::Reference<
1892 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1893 : {
1894 0 : SvXMLImportContext *pContext(0);
1895 :
1896 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && (IsXMLToken(rLocalName, XML_CHANGE_INFO)))
1897 : {
1898 0 : pContext = new ScXMLChangeInfoContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1899 : }
1900 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
1901 : {
1902 0 : if (IsXMLToken(rLocalName, XML_DEPENDENCIES))
1903 0 : pContext = new ScXMLDependingsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1904 0 : else if (IsXMLToken(rLocalName, XML_DELETIONS))
1905 0 : pContext = new ScXMLDeletionsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1906 0 : else if (IsXMLToken(rLocalName, XML_SOURCE_RANGE_ADDRESS))
1907 0 : pContext = new ScXMLBigRangeContext(GetScImport(), nPrefix, rLocalName, xAttrList, aSourceRange);
1908 0 : else if (IsXMLToken(rLocalName, XML_TARGET_RANGE_ADDRESS))
1909 0 : pContext = new ScXMLBigRangeContext(GetScImport(), nPrefix, rLocalName, xAttrList, aTargetRange);
1910 : }
1911 :
1912 0 : if( !pContext )
1913 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1914 :
1915 0 : return pContext;
1916 : }
1917 :
1918 0 : void ScXMLMovementContext::EndElement()
1919 : {
1920 0 : pChangeTrackingImportHelper->SetMoveRanges(aSourceRange, aTargetRange);
1921 0 : pChangeTrackingImportHelper->EndChangeAction();
1922 0 : }
1923 :
1924 0 : ScXMLRejectionContext::ScXMLRejectionContext( ScXMLImport& rImport,
1925 : sal_uInt16 nPrfx,
1926 : const OUString& rLName,
1927 : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
1928 : ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) :
1929 : SvXMLImportContext( rImport, nPrfx, rLName ),
1930 0 : pChangeTrackingImportHelper(pTempChangeTrackingImportHelper)
1931 : {
1932 0 : sal_uInt32 nActionNumber(0);
1933 0 : sal_uInt32 nRejectingNumber(0);
1934 0 : ScChangeActionState nActionState(SC_CAS_VIRGIN);
1935 :
1936 0 : sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
1937 0 : for( sal_Int16 i=0; i < nAttrCount; ++i )
1938 : {
1939 0 : const OUString& sAttrName(xAttrList->getNameByIndex( i ));
1940 0 : OUString aLocalName;
1941 0 : sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName(
1942 0 : sAttrName, &aLocalName ));
1943 0 : const OUString& sValue(xAttrList->getValueByIndex( i ));
1944 :
1945 0 : if (nPrefix == XML_NAMESPACE_TABLE)
1946 : {
1947 0 : if (IsXMLToken(aLocalName, XML_ID))
1948 : {
1949 0 : nActionNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1950 : }
1951 0 : else if (IsXMLToken(aLocalName, XML_ACCEPTANCE_STATE))
1952 : {
1953 0 : if (IsXMLToken(sValue, XML_ACCEPTED))
1954 0 : nActionState = SC_CAS_ACCEPTED;
1955 0 : else if (IsXMLToken(sValue, XML_REJECTED))
1956 0 : nActionState = SC_CAS_REJECTED;
1957 : }
1958 0 : else if (IsXMLToken(aLocalName, XML_REJECTING_CHANGE_ID))
1959 : {
1960 0 : nRejectingNumber = pChangeTrackingImportHelper->GetIDFromString(sValue);
1961 : }
1962 : }
1963 0 : }
1964 :
1965 0 : pChangeTrackingImportHelper->StartChangeAction(SC_CAT_MOVE);
1966 0 : pChangeTrackingImportHelper->SetActionNumber(nActionNumber);
1967 0 : pChangeTrackingImportHelper->SetActionState(nActionState);
1968 0 : pChangeTrackingImportHelper->SetRejectingNumber(nRejectingNumber);
1969 0 : }
1970 :
1971 0 : ScXMLRejectionContext::~ScXMLRejectionContext()
1972 : {
1973 0 : }
1974 :
1975 0 : SvXMLImportContext *ScXMLRejectionContext::CreateChildContext( sal_uInt16 nPrefix,
1976 : const OUString& rLocalName,
1977 : const ::com::sun::star::uno::Reference<
1978 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
1979 : {
1980 0 : SvXMLImportContext *pContext(0);
1981 :
1982 0 : if ((nPrefix == XML_NAMESPACE_OFFICE) && (IsXMLToken(rLocalName, XML_CHANGE_INFO)))
1983 : {
1984 0 : pContext = new ScXMLChangeInfoContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1985 : }
1986 0 : else if (nPrefix == XML_NAMESPACE_TABLE)
1987 : {
1988 0 : if (IsXMLToken(rLocalName, XML_DEPENDENCIES))
1989 0 : pContext = new ScXMLDependingsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1990 0 : else if (IsXMLToken(rLocalName, XML_DELETIONS))
1991 0 : pContext = new ScXMLDeletionsContext(GetScImport(), nPrefix, rLocalName, xAttrList, pChangeTrackingImportHelper);
1992 : }
1993 :
1994 0 : if( !pContext )
1995 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
1996 :
1997 0 : return pContext;
1998 : }
1999 :
2000 0 : void ScXMLRejectionContext::EndElement()
2001 : {
2002 0 : pChangeTrackingImportHelper->EndChangeAction();
2003 0 : }
2004 :
2005 :
2006 :
2007 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|