LCOV - code coverage report
Current view: top level - sc/source/ui/undo - undoutil.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 47 21.3 %
Date: 2014-11-03 Functions: 4 7 57.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 "undoutil.hxx"
      21             : 
      22             : #include "docsh.hxx"
      23             : #include "tabvwsh.hxx"
      24             : #include "document.hxx"
      25             : #include "dbdata.hxx"
      26             : #include "globstr.hrc"
      27             : #include "globalnames.hxx"
      28             : #include "global.hxx"
      29             : #include "markdata.hxx"
      30             : 
      31          42 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      32             :                                 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
      33             :                                 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ )
      34             : {
      35          42 :     if ( pDocShell->IsPaintLocked() )
      36          42 :         return;
      37             : 
      38          42 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
      39          42 :     if (pViewShell)
      40             :     {
      41           0 :         SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
      42           0 :         if ( nViewTab < nStartZ || nViewTab > nEndZ )
      43           0 :             pViewShell->SetTabNo( nStartZ );
      44             : 
      45           0 :         pViewShell->DoneBlockMode();
      46           0 :         pViewShell->MoveCursorAbs( nStartX, nStartY, SC_FOLLOW_JUMP, false, false );
      47           0 :         pViewShell->InitOwnBlockMode();
      48           0 :         pViewShell->GetViewData().GetMarkData().
      49           0 :                 SetMarkArea( ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ) );
      50           0 :         pViewShell->MarkDataChanged();
      51             :     }
      52             : }
      53             : 
      54           0 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      55             :                                 const ScAddress& rBlockStart,
      56             :                                 const ScAddress& rBlockEnd )
      57             : {
      58           0 :     MarkSimpleBlock( pDocShell, rBlockStart.Col(), rBlockStart.Row(), rBlockStart.Tab(),
      59           0 :                                 rBlockEnd.Col(), rBlockEnd.Row(), rBlockEnd.Tab() );
      60           0 : }
      61             : 
      62          42 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      63             :                                 const ScRange& rRange )
      64             : {
      65          84 :     MarkSimpleBlock( pDocShell, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
      66         126 :                                 rRange.aEnd.Col(),   rRange.aEnd.Row(),   rRange.aEnd.Tab()   );
      67          42 : }
      68             : 
      69           0 : ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
      70             :                                     SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
      71             : {
      72           0 :     ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
      73             : 
      74           0 :     if (!pRet)
      75             :     {
      76           0 :         bool bWasTemp = false;
      77           0 :         if ( pUndoData )
      78             :         {
      79           0 :             const OUString& aName = pUndoData->GetName();
      80           0 :             if ( aName == STR_DB_LOCAL_NONAME )
      81           0 :                 bWasTemp = true;
      82             :         }
      83             :         OSL_ENSURE(bWasTemp, "Undo: didn't find database range");
      84             :         (void)bWasTemp;
      85           0 :         pRet = pDoc->GetAnonymousDBData(nTab);
      86           0 :         if (!pRet)
      87             :         {
      88             :             pRet = new ScDBData( OUString(STR_DB_LOCAL_NONAME), nTab,
      89             :                                 nCol1,nRow1, nCol2,nRow2, true,
      90           0 :                                 pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
      91           0 :             pDoc->SetAnonymousDBData(nTab,pRet);
      92             :         }
      93             :     }
      94             : 
      95           0 :     return pRet;
      96             : }
      97             : 
      98           0 : void ScUndoUtil::PaintMore( ScDocShell* pDocShell,
      99             :                                 const ScRange& rRange )
     100             : {
     101           0 :     SCCOL nCol1 = rRange.aStart.Col();
     102           0 :     SCROW nRow1 = rRange.aStart.Row();
     103           0 :     SCCOL nCol2 = rRange.aEnd.Col();
     104           0 :     SCROW nRow2 = rRange.aEnd.Row();
     105           0 :     if (nCol1 > 0) --nCol1;
     106           0 :     if (nRow1 > 0) --nRow1;
     107           0 :     if (nCol2<MAXCOL) ++nCol2;
     108           0 :     if (nRow2<MAXROW) ++nRow2;
     109             : 
     110           0 :     pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(),
     111           0 :                           nCol2,nRow2,rRange.aEnd.Tab(), PAINT_GRID );
     112         228 : }
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10