LCOV - code coverage report
Current view: top level - sc/source/filter/xml - XMLChangeTrackingImportHelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 14 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_XMLCHANGETRACKINGIMPORTHELPER_HXX
      30                 :            : #define SC_XMLCHANGETRACKINGIMPORTHELPER_HXX
      31                 :            : 
      32                 :            : #include "chgtrack.hxx"
      33                 :            : #include <list>
      34                 :            : #include <com/sun/star/util/DateTime.hpp>
      35                 :            : 
      36                 :            : class ScBaseCell;
      37                 :            : class ScDocument;
      38                 :            : class DateTime;
      39                 :            : 
      40                 :          0 : struct ScMyActionInfo
      41                 :            : {
      42                 :            :     rtl::OUString sUser;
      43                 :            :     rtl::OUString sComment;
      44                 :            :     com::sun::star::util::DateTime aDateTime;
      45                 :            : };
      46                 :            : 
      47                 :            : struct ScMyCellInfo
      48                 :            : {
      49                 :            :     ScBaseCell*        pCell;
      50                 :            :     rtl::OUString      sFormulaAddress;
      51                 :            :     rtl::OUString      sFormula;
      52                 :            :     String             sInputString;
      53                 :            :     double             fValue;
      54                 :            :     sal_Int32          nMatrixCols;
      55                 :            :     sal_Int32          nMatrixRows;
      56                 :            :     formula::FormulaGrammar::Grammar eGrammar;
      57                 :            :     sal_uInt16         nType;
      58                 :            :     sal_uInt8          nMatrixFlag;
      59                 :            : 
      60                 :            :     ScMyCellInfo(ScBaseCell* pCell, const rtl::OUString& sFormulaAddress, const rtl::OUString& sFormula,
      61                 :            :                 const formula::FormulaGrammar::Grammar eGrammar, const rtl::OUString& sInputString,
      62                 :            :                 const double& fValue, const sal_uInt16 nType, const sal_uInt8 nMatrixFlag, const sal_Int32 nMatrixCols,
      63                 :            :                 const sal_Int32 nMatrixRows);
      64                 :            :     ~ScMyCellInfo();
      65                 :            : 
      66                 :            :     ScBaseCell* CreateCell(ScDocument* pDoc);
      67                 :            : };
      68                 :            : 
      69                 :            : struct ScMyDeleted
      70                 :            : {
      71                 :            :     sal_uInt32 nID;
      72                 :            :     ScMyCellInfo* pCellInfo;
      73                 :            : 
      74                 :            :     ScMyDeleted();
      75                 :            :     ~ScMyDeleted();
      76                 :            : };
      77                 :            : 
      78                 :            : typedef std::list<ScMyDeleted*> ScMyDeletedList;
      79                 :            : 
      80                 :            : struct ScMyGenerated
      81                 :            : {
      82                 :            :     ScBigRange      aBigRange;
      83                 :            :     sal_uInt32      nID;
      84                 :            :     ScMyCellInfo*   pCellInfo;
      85                 :            : 
      86                 :            :     ScMyGenerated(ScMyCellInfo* pCellInfo, const ScBigRange& aBigRange);
      87                 :            :     ~ScMyGenerated();
      88                 :            : };
      89                 :            : 
      90                 :            : typedef std::list<ScMyGenerated*> ScMyGeneratedList;
      91                 :            : 
      92                 :            : struct ScMyInsertionCutOff
      93                 :            : {
      94                 :            :     sal_uInt32 nID;
      95                 :            :     sal_Int32 nPosition;
      96                 :            : 
      97                 :          0 :     ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition) :
      98                 :          0 :             nID(nTempID), nPosition(nTempPosition) {}
      99                 :            : };
     100                 :            : 
     101                 :            : struct ScMyMoveCutOff
     102                 :            : {
     103                 :            :     sal_uInt32 nID;
     104                 :            :     sal_Int32 nStartPosition;
     105                 :            :     sal_Int32 nEndPosition;
     106                 :            : 
     107                 :          0 :     ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos) :
     108                 :          0 :             nID(nTempID), nStartPosition(nStartPos), nEndPosition(nEndPos) {}
     109                 :            : };
     110                 :            : 
     111                 :            : typedef std::list<ScMyMoveCutOff> ScMyMoveCutOffs;
     112                 :            : 
     113                 :            : struct ScMyMoveRanges
     114                 :            : {
     115                 :            :     ScBigRange aSourceRange;
     116                 :            :     ScBigRange aTargetRange;
     117                 :            : 
     118                 :          0 :     ScMyMoveRanges(const ScBigRange& aSource, const ScBigRange aTarget) :
     119                 :          0 :             aSourceRange(aSource), aTargetRange(aTarget) {}
     120                 :            : };
     121                 :            : 
     122                 :            : typedef std::list<sal_uInt32> ScMyDependencies;
     123                 :            : 
     124                 :            : struct ScMyBaseAction
     125                 :            : {
     126                 :            :     ScMyActionInfo aInfo;
     127                 :            :     ScBigRange aBigRange;
     128                 :            :     ScMyDependencies aDependencies;
     129                 :            :     ScMyDeletedList aDeletedList;
     130                 :            :     sal_uInt32 nActionNumber;
     131                 :            :     sal_uInt32 nRejectingNumber;
     132                 :            :     sal_uInt32 nPreviousAction;
     133                 :            :     ScChangeActionType nActionType;
     134                 :            :     ScChangeActionState nActionState;
     135                 :            : 
     136                 :            :     ScMyBaseAction(const ScChangeActionType nActionType);
     137                 :            :     virtual ~ScMyBaseAction();
     138                 :            : };
     139                 :            : 
     140                 :            : struct ScMyInsAction : public ScMyBaseAction
     141                 :            : {
     142                 :            :     ScMyInsAction(const ScChangeActionType nActionType);
     143                 :            :     ~ScMyInsAction();
     144                 :            : };
     145                 :            : 
     146                 :            : struct ScMyDelAction : public ScMyBaseAction
     147                 :            : {
     148                 :            :     ScMyGeneratedList aGeneratedList;
     149                 :            :     ScMyInsertionCutOff* pInsCutOff;
     150                 :            :     ScMyMoveCutOffs aMoveCutOffs;
     151                 :            :     sal_Int32 nD;
     152                 :            : 
     153                 :            :     ScMyDelAction(const ScChangeActionType nActionType);
     154                 :            :     ~ScMyDelAction();
     155                 :            : };
     156                 :            : 
     157                 :            : struct ScMyMoveAction : public ScMyBaseAction
     158                 :            : {
     159                 :            :     ScMyGeneratedList aGeneratedList;
     160                 :            :     ScMyMoveRanges* pMoveRanges;
     161                 :            : 
     162                 :            :     ScMyMoveAction();
     163                 :            :     ~ScMyMoveAction();
     164                 :            : };
     165                 :            : 
     166                 :            : struct ScMyContentAction : public ScMyBaseAction
     167                 :            : {
     168                 :            :     ScMyCellInfo*   pCellInfo;
     169                 :            : 
     170                 :            :     ScMyContentAction();
     171                 :            :     ~ScMyContentAction();
     172                 :            : };
     173                 :            : 
     174                 :            : struct ScMyRejAction : public ScMyBaseAction
     175                 :            : {
     176                 :            :     ScMyRejAction();
     177                 :            :     ~ScMyRejAction();
     178                 :            : };
     179                 :            : 
     180                 :            : typedef std::list<ScMyBaseAction*> ScMyActions;
     181                 :            : 
     182                 :            : class ScXMLChangeTrackingImportHelper
     183                 :            : {
     184                 :            :     std::set<rtl::OUString> aUsers;
     185                 :            :     ScMyActions         aActions;
     186                 :            :     com::sun::star::uno::Sequence<sal_Int8> aProtect;
     187                 :            :     ScDocument*         pDoc;
     188                 :            :     ScChangeTrack*      pTrack;
     189                 :            :     ScMyBaseAction*     pCurrentAction;
     190                 :            :     rtl::OUString       sIDPrefix;
     191                 :            :     sal_uInt32          nPrefixLength;
     192                 :            :     sal_Int16           nMultiSpanned;
     193                 :            :     sal_Int16           nMultiSpannedSlaveCount;
     194                 :            :     bool            bChangeTrack;
     195                 :            : 
     196                 :            : private:
     197                 :            :     void ConvertInfo(const ScMyActionInfo& aInfo, String& rUser, DateTime& aDateTime);
     198                 :            :     ScChangeAction* CreateInsertAction(ScMyInsAction* pAction);
     199                 :            :     ScChangeAction* CreateDeleteAction(ScMyDelAction* pAction);
     200                 :            :     ScChangeAction* CreateMoveAction(ScMyMoveAction* pAction);
     201                 :            :     ScChangeAction* CreateRejectionAction(ScMyRejAction* pAction);
     202                 :            :     ScChangeAction* CreateContentAction(ScMyContentAction* pAction);
     203                 :            : 
     204                 :            :     void CreateGeneratedActions(ScMyGeneratedList& rList);
     205                 :            : 
     206                 :            : public:
     207                 :            :     ScXMLChangeTrackingImportHelper();
     208                 :            :     ~ScXMLChangeTrackingImportHelper();
     209                 :            : 
     210                 :          0 :     void SetChangeTrack(bool bValue) { bChangeTrack = bValue; }
     211                 :          0 :     void SetProtection(const com::sun::star::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
     212                 :            :     void StartChangeAction(const ScChangeActionType nActionType);
     213                 :            : 
     214                 :            :     sal_uInt32 GetIDFromString(const rtl::OUString& sID);
     215                 :            : 
     216                 :          0 :     void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
     217                 :          0 :     void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
     218                 :          0 :     void SetRejectingNumber(const sal_uInt32 nRejectingNumber) { pCurrentAction->nRejectingNumber = nRejectingNumber; }
     219                 :            :     void SetActionInfo(const ScMyActionInfo& aInfo);
     220                 :          0 :     void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; }
     221                 :            :     void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo);
     222                 :            :     void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable);
     223                 :          0 :     void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_front(nID); }
     224                 :            :     void AddDeleted(const sal_uInt32 nID);
     225                 :            :     void AddDeleted(const sal_uInt32 nID, ScMyCellInfo* pCellInfo);
     226                 :            :     void SetMultiSpanned(const sal_Int16 nMultiSpanned);
     227                 :            :     void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition);
     228                 :            :     void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition);
     229                 :            :     void SetMoveRanges(const ScBigRange& aSourceRange, const ScBigRange& aTargetRange);
     230                 :            :     void GetMultiSpannedRange();
     231                 :            :     void AddGenerated(ScMyCellInfo* pCellInfo, const ScBigRange& aBigRange);
     232                 :            : 
     233                 :            :     void EndChangeAction();
     234                 :            : 
     235                 :            :     void SetDeletionDependencies(ScMyDelAction* pAction, ScChangeActionDel* pDelAct);
     236                 :            :     void SetMovementDependencies(ScMyMoveAction* pAction, ScChangeActionMove* pMoveAct);
     237                 :            :     void SetContentDependencies(ScMyContentAction* pAction, ScChangeActionContent* pActContent);
     238                 :            :     void SetDependencies(ScMyBaseAction* pAction);
     239                 :            : 
     240                 :            :     void SetNewCell(ScMyContentAction* pAction);
     241                 :            : 
     242                 :            :     void CreateChangeTrack(ScDocument* pDoc);
     243                 :            : };
     244                 :            : 
     245                 :            : #endif
     246                 :            : 
     247                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10