LCOV - code coverage report
Current view: top level - sc/source/ui/undo - undobase.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 170 337 50.4 %
Date: 2014-04-11 Functions: 34 87 39.1 %
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 <vcl/virdev.hxx>
      21             : 
      22             : #include "undobase.hxx"
      23             : #include "refundo.hxx"
      24             : #include "docsh.hxx"
      25             : #include "tabvwsh.hxx"
      26             : #include "undoolk.hxx"
      27             : #include "undodraw.hxx"
      28             : #include "dbdata.hxx"
      29             : #include "attrib.hxx"
      30             : #include "queryparam.hxx"
      31             : #include "subtotalparam.hxx"
      32             : #include "bcaslot.hxx"
      33             : #include "globstr.hrc"
      34             : #include <rowheightcontext.hxx>
      35             : 
      36             : // STATIC DATA -----------------------------------------------------------
      37             : 
      38           0 : TYPEINIT1(ScSimpleUndo,     SfxUndoAction);
      39           0 : TYPEINIT1(ScBlockUndo,      ScSimpleUndo);
      40           0 : TYPEINIT1(ScMultiBlockUndo, ScSimpleUndo);
      41           0 : TYPEINIT1(ScMoveUndo,       ScSimpleUndo);
      42           0 : TYPEINIT1(ScDBFuncUndo,     ScSimpleUndo);
      43           0 : TYPEINIT1(ScUndoWrapper,    SfxUndoAction);
      44             : 
      45        7200 : ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) :
      46             :     pDocShell( pDocSh ),
      47        7200 :     pDetectiveUndo( NULL )
      48             : {
      49        7200 : }
      50             : 
      51       14360 : ScSimpleUndo::~ScSimpleUndo()
      52             : {
      53        7180 :     delete pDetectiveUndo;
      54        7180 : }
      55             : 
      56           3 : bool ScSimpleUndo::SetViewMarkData( const ScMarkData& rMarkData )
      57             : {
      58           3 :     if ( IsPaintLocked() )
      59           0 :         return false;
      60             : 
      61           3 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
      62           3 :     if ( !pViewShell )
      63           3 :         return false;
      64             : 
      65           0 :     pViewShell->SetMarkData( rMarkData );
      66           0 :     return true;
      67             : }
      68             : 
      69           3 : bool ScSimpleUndo::Merge( SfxUndoAction *pNextAction )
      70             : {
      71             :     // A SdrUndoGroup for updating detective arrows can belong
      72             :     // to each Undo-Action.
      73             :     // DetectiveRefresh is always called next,
      74             :     // the SdrUndoGroup is encapsulated in a ScUndoDraw action.
      75             :     // AddUndoAction is only called with bTryMerg=sal_True
      76             :     // for automatic update.
      77             : 
      78           3 :     if ( !pDetectiveUndo && pNextAction->ISA(ScUndoDraw) )
      79             :     {
      80             :         // Take SdrUndoAction from ScUndoDraw Action,
      81             :         // ScUndoDraw is later deleted by the UndoManager
      82             : 
      83           3 :         ScUndoDraw* pCalcUndo = (ScUndoDraw*)pNextAction;
      84           3 :         pDetectiveUndo = pCalcUndo->GetDrawUndo();
      85           3 :         pCalcUndo->ForgetDrawUndo();
      86           3 :         return true;
      87             :     }
      88             : 
      89           0 :     return false;
      90             : }
      91             : 
      92          20 : void ScSimpleUndo::BeginUndo()
      93             : {
      94          20 :     pDocShell->SetInUndo( true );
      95             : 
      96          20 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
      97          20 :     if (pViewShell)
      98           0 :         pViewShell->HideAllCursors();       // for example due to merged cells
      99             : 
     100             :     //  detective updates happened last, must be undone first
     101          20 :     if (pDetectiveUndo)
     102           0 :         pDetectiveUndo->Undo();
     103          20 : }
     104             : 
     105          20 : void ScSimpleUndo::EndUndo()
     106             : {
     107          20 :     pDocShell->SetDocumentModified();
     108             : 
     109          20 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     110          20 :     if (pViewShell)
     111             :     {
     112           0 :         pViewShell->UpdateAutoFillMark();
     113           0 :         pViewShell->UpdateInputHandler();
     114           0 :         pViewShell->ShowAllCursors();
     115             :     }
     116             : 
     117          20 :     pDocShell->SetInUndo( false );
     118          20 : }
     119             : 
     120          10 : void ScSimpleUndo::BeginRedo()
     121             : {
     122          10 :     pDocShell->SetInUndo( true );   //! own Flag for Redo?
     123             : 
     124          10 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     125          10 :     if (pViewShell)
     126           0 :         pViewShell->HideAllCursors();       // for example due to merged cells
     127          10 : }
     128             : 
     129          10 : void ScSimpleUndo::EndRedo()
     130             : {
     131          10 :     if (pDetectiveUndo)
     132           0 :         pDetectiveUndo->Redo();
     133             : 
     134          10 :     pDocShell->SetDocumentModified();
     135             : 
     136          10 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     137          10 :     if (pViewShell)
     138             :     {
     139           0 :         pViewShell->UpdateAutoFillMark();
     140           0 :         pViewShell->UpdateInputHandler();
     141           0 :         pViewShell->ShowAllCursors();
     142             :     }
     143             : 
     144          10 :     pDocShell->SetInUndo( false );
     145          10 : }
     146             : 
     147           7 : void ScSimpleUndo::BroadcastChanges( const ScRange& rRange )
     148             : {
     149           7 :     ScDocument* pDoc = pDocShell->GetDocument();
     150           7 :     pDoc->BroadcastCells(rRange, SC_HINT_DATACHANGED);
     151           7 : }
     152             : 
     153           1 : void ScSimpleUndo::ShowTable( SCTAB nTab )
     154             : {
     155           1 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     156           1 :     if (pViewShell)
     157           0 :         pViewShell->SetTabNo( nTab );
     158           1 : }
     159             : 
     160           7 : void ScSimpleUndo::ShowTable( const ScRange& rRange )
     161             : {
     162           7 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     163           7 :     if (pViewShell)
     164             :     {
     165           0 :         SCTAB nStart = rRange.aStart.Tab();
     166           0 :         SCTAB nEnd   = rRange.aEnd.Tab();
     167           0 :         SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
     168           0 :         if ( nTab < nStart || nTab > nEnd )                     // if not in range:
     169           0 :             pViewShell->SetTabNo( nStart );                     // at beginning of the range
     170             :     }
     171           7 : }
     172             : 
     173          41 : ScBlockUndo::ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
     174             :                                             ScBlockUndoMode eBlockMode ) :
     175             :     ScSimpleUndo( pDocSh ),
     176             :     aBlockRange( rRange ),
     177          41 :     eMode( eBlockMode )
     178             : {
     179          41 :     pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
     180          41 : }
     181             : 
     182          74 : ScBlockUndo::~ScBlockUndo()
     183             : {
     184          37 :     DeleteSdrUndoAction( pDrawUndo );
     185          37 : }
     186             : 
     187           4 : void ScBlockUndo::BeginUndo()
     188             : {
     189           4 :     ScSimpleUndo::BeginUndo();
     190           4 :     EnableDrawAdjust( pDocShell->GetDocument(), false );
     191           4 : }
     192             : 
     193           4 : void ScBlockUndo::EndUndo()
     194             : {
     195           4 :     if (eMode == SC_UNDO_AUTOHEIGHT)
     196           4 :         AdjustHeight();
     197             : 
     198           4 :     EnableDrawAdjust( pDocShell->GetDocument(), true );
     199           4 :     DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
     200             : 
     201           4 :     ShowBlock();
     202           4 :     ScSimpleUndo::EndUndo();
     203           4 : }
     204             : 
     205           3 : void ScBlockUndo::EndRedo()
     206             : {
     207           3 :     if (eMode == SC_UNDO_AUTOHEIGHT)
     208           3 :         AdjustHeight();
     209             : 
     210           3 :     ShowBlock();
     211           3 :     ScSimpleUndo::EndRedo();
     212           3 : }
     213             : 
     214           7 : bool ScBlockUndo::AdjustHeight()
     215             : {
     216           7 :     ScDocument* pDoc = pDocShell->GetDocument();
     217             : 
     218           7 :     VirtualDevice aVirtDev;
     219           7 :     Fraction aZoomX( 1, 1 );
     220           7 :     Fraction aZoomY = aZoomX;
     221             :     double nPPTX, nPPTY;
     222           7 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     223           7 :     if (pViewShell)
     224             :     {
     225           0 :         ScViewData* pData = pViewShell->GetViewData();
     226           0 :         nPPTX = pData->GetPPTX();
     227           0 :         nPPTY = pData->GetPPTY();
     228           0 :         aZoomX = pData->GetZoomX();
     229           0 :         aZoomY = pData->GetZoomY();
     230             :     }
     231             :     else
     232             :     {
     233             :         // Leave zoom at 100
     234           7 :         nPPTX = ScGlobal::nScreenPPTX;
     235           7 :         nPPTY = ScGlobal::nScreenPPTY;
     236             :     }
     237             : 
     238          14 :     sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev);
     239             :     bool bRet = pDoc->SetOptimalHeight(
     240           7 :         aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
     241             : 
     242           7 :     if (bRet)
     243           0 :         pDocShell->PostPaint( 0,      aBlockRange.aStart.Row(), aBlockRange.aStart.Tab(),
     244           0 :                               MAXCOL, MAXROW,                   aBlockRange.aEnd.Tab(),
     245           0 :                               PAINT_GRID | PAINT_LEFT );
     246             : 
     247          14 :     return bRet;
     248             : }
     249             : 
     250           7 : void ScBlockUndo::ShowBlock()
     251             : {
     252           7 :     if ( IsPaintLocked() )
     253           7 :         return;
     254             : 
     255           7 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     256           7 :     if (pViewShell)
     257             :     {
     258           0 :         ShowTable( aBlockRange );       // with multiple sheets in range each of them is good
     259           0 :         pViewShell->MoveCursorAbs( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
     260           0 :                                    SC_FOLLOW_JUMP, false, false );
     261           0 :         SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
     262           0 :         ScRange aRange = aBlockRange;
     263           0 :         aRange.aStart.SetTab( nTab );
     264           0 :         aRange.aEnd.SetTab( nTab );
     265           0 :         pViewShell->MarkRange( aRange );
     266             : 
     267             :         // not through SetMarkArea to MarkData, due to possibly lacking paint
     268             :     }
     269             : }
     270             : 
     271          30 : ScMultiBlockUndo::ScMultiBlockUndo(
     272             :     ScDocShell* pDocSh, const ScRangeList& rRanges, ScBlockUndoMode eBlockMode) :
     273             :     ScSimpleUndo(pDocSh),
     274             :     maBlockRanges(rRanges),
     275          30 :     meMode(eBlockMode)
     276             : {
     277          30 :     mpDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
     278          30 : }
     279             : 
     280          60 : ScMultiBlockUndo::~ScMultiBlockUndo()
     281             : {
     282          30 :     DeleteSdrUndoAction( mpDrawUndo );
     283          30 : }
     284             : 
     285           4 : void ScMultiBlockUndo::BeginUndo()
     286             : {
     287           4 :     ScSimpleUndo::BeginUndo();
     288           4 :     EnableDrawAdjust(pDocShell->GetDocument(), false);
     289           4 : }
     290             : 
     291           4 : void ScMultiBlockUndo::EndUndo()
     292             : {
     293           4 :     if (meMode == SC_UNDO_AUTOHEIGHT)
     294           0 :         AdjustHeight();
     295             : 
     296           4 :     EnableDrawAdjust(pDocShell->GetDocument(), true);
     297           4 :     DoSdrUndoAction(mpDrawUndo, pDocShell->GetDocument());
     298             : 
     299           4 :     ShowBlock();
     300           4 :     ScSimpleUndo::EndUndo();
     301           4 : }
     302             : 
     303           3 : void ScMultiBlockUndo::EndRedo()
     304             : {
     305           3 :     if (meMode == SC_UNDO_AUTOHEIGHT)
     306           0 :         AdjustHeight();
     307             : 
     308           3 :     ShowBlock();
     309           3 :     ScSimpleUndo::EndRedo();
     310           3 : }
     311             : 
     312           0 : void ScMultiBlockUndo::AdjustHeight()
     313             : {
     314           0 :     ScDocument* pDoc = pDocShell->GetDocument();
     315             : 
     316           0 :     VirtualDevice aVirtDev;
     317           0 :     Fraction aZoomX( 1, 1 );
     318           0 :     Fraction aZoomY = aZoomX;
     319             :     double nPPTX, nPPTY;
     320           0 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     321           0 :     if (pViewShell)
     322             :     {
     323           0 :         ScViewData* pData = pViewShell->GetViewData();
     324           0 :         nPPTX = pData->GetPPTX();
     325           0 :         nPPTY = pData->GetPPTY();
     326           0 :         aZoomX = pData->GetZoomX();
     327           0 :         aZoomY = pData->GetZoomY();
     328             :     }
     329             :     else
     330             :     {
     331             :         // Leave zoom at 100
     332           0 :         nPPTX = ScGlobal::nScreenPPTX;
     333           0 :         nPPTY = ScGlobal::nScreenPPTY;
     334             :     }
     335             : 
     336           0 :     sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev);
     337           0 :     for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
     338             :     {
     339           0 :         const ScRange& r = *maBlockRanges[i];
     340           0 :         bool bRet = pDoc->SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
     341             : 
     342           0 :         if (bRet)
     343             :             pDocShell->PostPaint(
     344           0 :                 0, r.aStart.Row(), r.aStart.Tab(), MAXCOL, MAXROW, r.aEnd.Tab(),
     345           0 :                 PAINT_GRID | PAINT_LEFT);
     346           0 :     }
     347           0 : }
     348             : 
     349           7 : void ScMultiBlockUndo::ShowBlock()
     350             : {
     351           7 :     if ( IsPaintLocked() )
     352           7 :         return;
     353             : 
     354           7 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     355           7 :     if (!pViewShell)
     356           7 :         return;
     357             : 
     358           0 :     if (maBlockRanges.empty())
     359           0 :         return;
     360             : 
     361             :     // Move to the sheet of the first range.
     362           0 :     ScRange aRange = *maBlockRanges.front();
     363           0 :     ShowTable(aRange);
     364             :     pViewShell->MoveCursorAbs(
     365           0 :         aRange.aStart.Col(), aRange.aStart.Row(), SC_FOLLOW_JUMP, false, false);
     366           0 :     SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
     367           0 :     aRange.aStart.SetTab(nTab);
     368           0 :     aRange.aEnd.SetTab(nTab);
     369           0 :     pViewShell->MarkRange(aRange, false, false);
     370             : 
     371           0 :     for (size_t i = 1, n = maBlockRanges.size(); i < n; ++i)
     372             :     {
     373           0 :         aRange = *maBlockRanges[i];
     374           0 :         aRange.aStart.SetTab(nTab);
     375           0 :         aRange.aEnd.SetTab(nTab);
     376           0 :         pViewShell->MarkRange(aRange, false, true);
     377             :     }
     378             : }
     379             : 
     380          43 : ScMoveUndo::ScMoveUndo( ScDocShell* pDocSh, ScDocument* pRefDoc, ScRefUndoData* pRefData,
     381             :                                                 ScMoveUndoMode eRefMode ) :
     382             :     ScSimpleUndo( pDocSh ),
     383             :     pRefUndoDoc( pRefDoc ),
     384             :     pRefUndoData( pRefData ),
     385          43 :     eMode( eRefMode )
     386             : {
     387          43 :     ScDocument* pDoc = pDocShell->GetDocument();
     388          43 :     if (pRefUndoData)
     389          43 :         pRefUndoData->DeleteUnchanged(pDoc);
     390          43 :     pDrawUndo = GetSdrUndoAction( pDoc );
     391          43 : }
     392             : 
     393          70 : ScMoveUndo::~ScMoveUndo()
     394             : {
     395          35 :     delete pRefUndoData;
     396          35 :     delete pRefUndoDoc;
     397          35 :     DeleteSdrUndoAction( pDrawUndo );
     398          35 : }
     399             : 
     400          10 : void ScMoveUndo::UndoRef()
     401             : {
     402          10 :     ScDocument* pDoc = pDocShell->GetDocument();
     403          10 :     ScRange aRange(0,0,0, MAXCOL,MAXROW,pRefUndoDoc->GetTableCount()-1);
     404          10 :     pRefUndoDoc->CopyToDocument( aRange, IDF_FORMULA, false, pDoc, NULL, false );
     405          10 :     if (pRefUndoData)
     406          10 :         pRefUndoData->DoUndo( pDoc, (eMode == SC_UNDO_REFFIRST) );
     407             :         // HACK: ScDragDropUndo is the only one with REFFIRST.
     408             :         // If not, results possibly in a too frequent adjustment
     409             :         // of ChartRefs. Not that pretty, but not too bad either..
     410          10 : }
     411             : 
     412          10 : void ScMoveUndo::BeginUndo()
     413             : {
     414          10 :     ScSimpleUndo::BeginUndo();
     415             : 
     416          10 :     EnableDrawAdjust( pDocShell->GetDocument(), false );
     417             : 
     418          10 :     if (pRefUndoDoc && eMode == SC_UNDO_REFFIRST)
     419           3 :         UndoRef();
     420          10 : }
     421             : 
     422          10 : void ScMoveUndo::EndUndo()
     423             : {
     424          10 :     DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );     // must also be called when pointer is null
     425             : 
     426          10 :     if (pRefUndoDoc && eMode == SC_UNDO_REFLAST)
     427           7 :         UndoRef();
     428             : 
     429          10 :     EnableDrawAdjust( pDocShell->GetDocument(), true );
     430             : 
     431          10 :     ScSimpleUndo::EndUndo();
     432          10 : }
     433             : 
     434          10 : ScDBFuncUndo::ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo ) :
     435             :     ScSimpleUndo( pDocSh ),
     436             :     aOriginalRange( rOriginal ),
     437          10 :     mpDrawUndo( pDrawUndo )
     438             : {
     439          10 :     pAutoDBRange = pDocSh->GetOldAutoDBRange();
     440          10 : }
     441             : 
     442          20 : ScDBFuncUndo::~ScDBFuncUndo()
     443             : {
     444          10 :     DeleteSdrUndoAction( mpDrawUndo );
     445          10 :     delete pAutoDBRange;
     446          10 : }
     447             : 
     448           4 : void ScDBFuncUndo::SetDrawUndoAction( SdrUndoAction* pDrawUndo )
     449             : {
     450           4 :     DeleteSdrUndoAction( mpDrawUndo );
     451           4 :     mpDrawUndo = pDrawUndo;
     452           4 : }
     453             : 
     454           0 : void ScDBFuncUndo::BeginUndo()
     455             : {
     456           0 :     ScSimpleUndo::BeginUndo();
     457           0 :     DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
     458           0 : }
     459             : 
     460           0 : void ScDBFuncUndo::EndUndo()
     461             : {
     462           0 :     ScSimpleUndo::EndUndo();
     463             : 
     464           0 :     if ( pAutoDBRange )
     465             :     {
     466           0 :         ScDocument* pDoc = pDocShell->GetDocument();
     467           0 :         SCTAB nTab = pDoc->GetVisibleTab();
     468           0 :         ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
     469           0 :         if (pNoNameData )
     470             :         {
     471             :             SCCOL nRangeX1;
     472             :             SCROW nRangeY1;
     473             :             SCCOL nRangeX2;
     474             :             SCROW nRangeY2;
     475             :             SCTAB nRangeTab;
     476           0 :             pNoNameData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
     477           0 :             pDocShell->DBAreaDeleted( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
     478             : 
     479           0 :             *pNoNameData = *pAutoDBRange;
     480             : 
     481           0 :             if ( pAutoDBRange->HasAutoFilter() )
     482             :             {
     483             :                 // restore AutoFilter buttons
     484           0 :                 pAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
     485           0 :                 pDoc->ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
     486           0 :                 pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
     487             :             }
     488             :         }
     489             :     }
     490           0 : }
     491             : 
     492           0 : void ScDBFuncUndo::BeginRedo()
     493             : {
     494           0 :     RedoSdrUndoAction( mpDrawUndo );
     495           0 :     if ( pAutoDBRange )
     496             :     {
     497             :         // move the database range to this function's position again (see ScDocShell::GetDBData)
     498             : 
     499           0 :         ScDocument* pDoc = pDocShell->GetDocument();
     500           0 :         ScDBData* pNoNameData = pDoc->GetAnonymousDBData(aOriginalRange.aStart.Tab());
     501           0 :         if ( pNoNameData )
     502             :         {
     503             : 
     504             :             SCCOL nRangeX1;
     505             :             SCROW nRangeY1;
     506             :             SCCOL nRangeX2;
     507             :             SCROW nRangeY2;
     508             :             SCTAB nRangeTab;
     509           0 :             pNoNameData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
     510           0 :             pDocShell->DBAreaDeleted( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
     511             : 
     512           0 :             pNoNameData->SetSortParam( ScSortParam() );
     513           0 :             pNoNameData->SetQueryParam( ScQueryParam() );
     514           0 :             pNoNameData->SetSubTotalParam( ScSubTotalParam() );
     515             : 
     516           0 :             pNoNameData->SetArea( aOriginalRange.aStart.Tab(),
     517           0 :                                   aOriginalRange.aStart.Col(), aOriginalRange.aStart.Row(),
     518           0 :                                   aOriginalRange.aEnd.Col(), aOriginalRange.aEnd.Row() );
     519             : 
     520           0 :             pNoNameData->SetByRow( true );
     521           0 :             pNoNameData->SetAutoFilter( false );
     522             :             // header is always set with the operation in redo
     523             :         }
     524             :     }
     525             : 
     526           0 :     ScSimpleUndo::BeginRedo();
     527           0 : }
     528             : 
     529           0 : void ScDBFuncUndo::EndRedo()
     530             : {
     531           0 :     ScSimpleUndo::EndRedo();
     532           0 : }
     533             : 
     534           0 : ScUndoWrapper::ScUndoWrapper( SfxUndoAction* pUndo ) :
     535           0 :     pWrappedUndo( pUndo )
     536             : {
     537           0 : }
     538             : 
     539           0 : ScUndoWrapper::~ScUndoWrapper()
     540             : {
     541           0 :     delete pWrappedUndo;
     542           0 : }
     543             : 
     544           0 : void ScUndoWrapper::ForgetWrappedUndo()
     545             : {
     546           0 :     pWrappedUndo = NULL;    // don't delete in dtor - pointer must be stored outside
     547           0 : }
     548             : 
     549           0 : OUString ScUndoWrapper::GetComment() const
     550             : {
     551           0 :     if (pWrappedUndo)
     552           0 :         return pWrappedUndo->GetComment();
     553           0 :     return OUString();
     554             : }
     555             : 
     556           0 : OUString ScUndoWrapper::GetRepeatComment(SfxRepeatTarget& rTarget) const
     557             : {
     558           0 :     if (pWrappedUndo)
     559           0 :         return pWrappedUndo->GetRepeatComment(rTarget);
     560           0 :     return OUString();
     561             : }
     562             : 
     563           0 : sal_uInt16 ScUndoWrapper::GetId() const
     564             : {
     565           0 :     if (pWrappedUndo)
     566           0 :         return pWrappedUndo->GetId();
     567             :     else
     568           0 :         return 0;
     569             : }
     570             : 
     571           0 : void ScUndoWrapper::SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction)
     572             : {
     573           0 :     if (pWrappedUndo)
     574           0 :         pWrappedUndo->SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction);
     575             :     else
     576           0 :         SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction);
     577           0 : }
     578             : 
     579           0 : bool ScUndoWrapper::Merge( SfxUndoAction* pNextAction )
     580             : {
     581           0 :     if (pWrappedUndo)
     582           0 :         return pWrappedUndo->Merge(pNextAction);
     583             :     else
     584           0 :         return false;
     585             : }
     586             : 
     587           0 : void ScUndoWrapper::Undo()
     588             : {
     589           0 :     if (pWrappedUndo)
     590           0 :         pWrappedUndo->Undo();
     591           0 : }
     592             : 
     593           0 : void ScUndoWrapper::Redo()
     594             : {
     595           0 :     if (pWrappedUndo)
     596           0 :         pWrappedUndo->Redo();
     597           0 : }
     598             : 
     599           0 : void ScUndoWrapper::Repeat(SfxRepeatTarget& rTarget)
     600             : {
     601           0 :     if (pWrappedUndo)
     602           0 :         pWrappedUndo->Repeat(rTarget);
     603           0 : }
     604             : 
     605           0 : bool ScUndoWrapper::CanRepeat(SfxRepeatTarget& rTarget) const
     606             : {
     607           0 :     if (pWrappedUndo)
     608           0 :         return pWrappedUndo->CanRepeat(rTarget);
     609             :     else
     610           0 :         return false;
     611         102 : }
     612             : 
     613             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10