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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef SC_XMLCHANGETRACKINGIMPORTHELPER_HXX
      21             : #define SC_XMLCHANGETRACKINGIMPORTHELPER_HXX
      22             : 
      23             : #include "chgtrack.hxx"
      24             : #include <list>
      25             : #include <com/sun/star/util/DateTime.hpp>
      26             : 
      27             : class ScDocument;
      28             : class DateTime;
      29             : 
      30           0 : struct ScMyActionInfo
      31             : {
      32             :     OUString sUser;
      33             :     OUString sComment;
      34             :     com::sun::star::util::DateTime aDateTime;
      35             : };
      36             : 
      37             : struct ScMyCellInfo
      38             : {
      39             :     ScCellValue maCell;
      40             :     OUString      sFormulaAddress;
      41             :     OUString      sFormula;
      42             :     OUString          sInputString;
      43             :     double             fValue;
      44             :     sal_Int32          nMatrixCols;
      45             :     sal_Int32          nMatrixRows;
      46             :     formula::FormulaGrammar::Grammar eGrammar;
      47             :     sal_uInt16         nType;
      48             :     sal_uInt8          nMatrixFlag;
      49             : 
      50             :     ScMyCellInfo(
      51             :         const ScCellValue& rCell, const OUString& sFormulaAddress, const OUString& sFormula,
      52             :         const formula::FormulaGrammar::Grammar eGrammar, const OUString& sInputString,
      53             :         const double& fValue, const sal_uInt16 nType, const sal_uInt8 nMatrixFlag,
      54             :         const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows );
      55             :     ~ScMyCellInfo();
      56             : 
      57             :     const ScCellValue& CreateCell( ScDocument* pDoc );
      58             : };
      59             : 
      60             : struct ScMyDeleted
      61             : {
      62             :     sal_uInt32 nID;
      63             :     ScMyCellInfo* pCellInfo;
      64             : 
      65             :     ScMyDeleted();
      66             :     ~ScMyDeleted();
      67             : };
      68             : 
      69             : typedef std::list<ScMyDeleted*> ScMyDeletedList;
      70             : 
      71             : struct ScMyGenerated
      72             : {
      73             :     ScBigRange      aBigRange;
      74             :     sal_uInt32      nID;
      75             :     ScMyCellInfo*   pCellInfo;
      76             : 
      77             :     ScMyGenerated(ScMyCellInfo* pCellInfo, const ScBigRange& aBigRange);
      78             :     ~ScMyGenerated();
      79             : };
      80             : 
      81             : typedef std::list<ScMyGenerated*> ScMyGeneratedList;
      82             : 
      83             : struct ScMyInsertionCutOff
      84             : {
      85             :     sal_uInt32 nID;
      86             :     sal_Int32 nPosition;
      87             : 
      88           0 :     ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition) :
      89           0 :             nID(nTempID), nPosition(nTempPosition) {}
      90             : };
      91             : 
      92             : struct ScMyMoveCutOff
      93             : {
      94             :     sal_uInt32 nID;
      95             :     sal_Int32 nStartPosition;
      96             :     sal_Int32 nEndPosition;
      97             : 
      98           0 :     ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos) :
      99           0 :             nID(nTempID), nStartPosition(nStartPos), nEndPosition(nEndPos) {}
     100             : };
     101             : 
     102             : typedef std::list<ScMyMoveCutOff> ScMyMoveCutOffs;
     103             : 
     104             : struct ScMyMoveRanges
     105             : {
     106             :     ScBigRange aSourceRange;
     107             :     ScBigRange aTargetRange;
     108             : 
     109           0 :     ScMyMoveRanges(const ScBigRange& aSource, const ScBigRange aTarget) :
     110           0 :             aSourceRange(aSource), aTargetRange(aTarget) {}
     111             : };
     112             : 
     113             : typedef std::list<sal_uInt32> ScMyDependencies;
     114             : 
     115             : struct ScMyBaseAction
     116             : {
     117             :     ScMyActionInfo aInfo;
     118             :     ScBigRange aBigRange;
     119             :     ScMyDependencies aDependencies;
     120             :     ScMyDeletedList aDeletedList;
     121             :     sal_uInt32 nActionNumber;
     122             :     sal_uInt32 nRejectingNumber;
     123             :     sal_uInt32 nPreviousAction;
     124             :     ScChangeActionType nActionType;
     125             :     ScChangeActionState nActionState;
     126             : 
     127             :     ScMyBaseAction(const ScChangeActionType nActionType);
     128             :     virtual ~ScMyBaseAction();
     129             : };
     130             : 
     131             : struct ScMyInsAction : public ScMyBaseAction
     132             : {
     133             :     ScMyInsAction(const ScChangeActionType nActionType);
     134             :     virtual ~ScMyInsAction();
     135             : };
     136             : 
     137             : struct ScMyDelAction : public ScMyBaseAction
     138             : {
     139             :     ScMyGeneratedList aGeneratedList;
     140             :     ScMyInsertionCutOff* pInsCutOff;
     141             :     ScMyMoveCutOffs aMoveCutOffs;
     142             :     sal_Int32 nD;
     143             : 
     144             :     ScMyDelAction(const ScChangeActionType nActionType);
     145             :     virtual ~ScMyDelAction();
     146             : };
     147             : 
     148             : struct ScMyMoveAction : public ScMyBaseAction
     149             : {
     150             :     ScMyGeneratedList aGeneratedList;
     151             :     ScMyMoveRanges* pMoveRanges;
     152             : 
     153             :     ScMyMoveAction();
     154             :     virtual ~ScMyMoveAction();
     155             : };
     156             : 
     157             : struct ScMyContentAction : public ScMyBaseAction
     158             : {
     159             :     ScMyCellInfo*   pCellInfo;
     160             : 
     161             :     ScMyContentAction();
     162             :     virtual ~ScMyContentAction();
     163             : };
     164             : 
     165             : struct ScMyRejAction : public ScMyBaseAction
     166             : {
     167             :     ScMyRejAction();
     168             :     virtual ~ScMyRejAction();
     169             : };
     170             : 
     171             : typedef std::list<ScMyBaseAction*> ScMyActions;
     172             : 
     173             : class ScXMLChangeTrackingImportHelper
     174             : {
     175             :     std::set<OUString> aUsers;
     176             :     ScMyActions         aActions;
     177             :     com::sun::star::uno::Sequence<sal_Int8> aProtect;
     178             :     ScDocument*         pDoc;
     179             :     ScChangeTrack*      pTrack;
     180             :     ScMyBaseAction*     pCurrentAction;
     181             :     OUString       sIDPrefix;
     182             :     sal_uInt32          nPrefixLength;
     183             :     sal_Int16           nMultiSpanned;
     184             :     sal_Int16           nMultiSpannedSlaveCount;
     185             :     bool            bChangeTrack;
     186             : 
     187             : private:
     188             :     void ConvertInfo(const ScMyActionInfo& aInfo, OUString& rUser, DateTime& aDateTime);
     189             :     ScChangeAction* CreateInsertAction(ScMyInsAction* pAction);
     190             :     ScChangeAction* CreateDeleteAction(ScMyDelAction* pAction);
     191             :     ScChangeAction* CreateMoveAction(ScMyMoveAction* pAction);
     192             :     ScChangeAction* CreateRejectionAction(ScMyRejAction* pAction);
     193             :     ScChangeAction* CreateContentAction(ScMyContentAction* pAction);
     194             : 
     195             :     void CreateGeneratedActions(ScMyGeneratedList& rList);
     196             : 
     197             : public:
     198             :     ScXMLChangeTrackingImportHelper();
     199             :     ~ScXMLChangeTrackingImportHelper();
     200             : 
     201           0 :     void SetChangeTrack(bool bValue) { bChangeTrack = bValue; }
     202           0 :     void SetProtection(const com::sun::star::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
     203             :     void StartChangeAction(const ScChangeActionType nActionType);
     204             : 
     205             :     sal_uInt32 GetIDFromString(const OUString& sID);
     206             : 
     207           0 :     void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
     208           0 :     void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
     209           0 :     void SetRejectingNumber(const sal_uInt32 nRejectingNumber) { pCurrentAction->nRejectingNumber = nRejectingNumber; }
     210             :     void SetActionInfo(const ScMyActionInfo& aInfo);
     211           0 :     void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; }
     212             :     void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo);
     213             :     void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable);
     214           0 :     void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_front(nID); }
     215             :     void AddDeleted(const sal_uInt32 nID);
     216             :     void AddDeleted(const sal_uInt32 nID, ScMyCellInfo* pCellInfo);
     217             :     void SetMultiSpanned(const sal_Int16 nMultiSpanned);
     218             :     void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition);
     219             :     void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition);
     220             :     void SetMoveRanges(const ScBigRange& aSourceRange, const ScBigRange& aTargetRange);
     221             :     void GetMultiSpannedRange();
     222             :     void AddGenerated(ScMyCellInfo* pCellInfo, const ScBigRange& aBigRange);
     223             : 
     224             :     void EndChangeAction();
     225             : 
     226             :     void SetDeletionDependencies(ScMyDelAction* pAction, ScChangeActionDel* pDelAct);
     227             :     void SetMovementDependencies(ScMyMoveAction* pAction, ScChangeActionMove* pMoveAct);
     228             :     void SetContentDependencies(ScMyContentAction* pAction, ScChangeActionContent* pActContent);
     229             :     void SetDependencies(ScMyBaseAction* pAction);
     230             : 
     231             :     void SetNewCell(ScMyContentAction* pAction);
     232             : 
     233             :     void CreateChangeTrack(ScDocument* pDoc);
     234             : };
     235             : 
     236             : #endif
     237             : 
     238             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10