LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLTrackedChangesContext.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 799 0.0 %
Date: 2014-04-11 Functions: 0 117 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10