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

Generated by: LCOV version 1.10