LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/undo - undoutil.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 47 2.1 %
Date: 2012-12-27 Functions: 2 7 28.6 %
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           0 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      32             :                                 SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
      33             :                                 SCCOL nEndX, SCROW nEndY, SCTAB nEndZ )
      34             : {
      35           0 :     if ( pDocShell->IsPaintLocked() )
      36           0 :         return;
      37             : 
      38           0 :     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
      39           0 :     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             : 
      55           0 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      56             :                                 const ScAddress& rBlockStart,
      57             :                                 const ScAddress& rBlockEnd )
      58             : {
      59           0 :     MarkSimpleBlock( pDocShell, rBlockStart.Col(), rBlockStart.Row(), rBlockStart.Tab(),
      60           0 :                                 rBlockEnd.Col(), rBlockEnd.Row(), rBlockEnd.Tab() );
      61           0 : }
      62             : 
      63             : 
      64           0 : void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
      65             :                                 const ScRange& rRange )
      66             : {
      67           0 :     MarkSimpleBlock( pDocShell, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
      68           0 :                                 rRange.aEnd.Col(),   rRange.aEnd.Row(),   rRange.aEnd.Tab()   );
      69           0 : }
      70             : 
      71             : 
      72             : 
      73           0 : ScDBData* ScUndoUtil::GetOldDBData( ScDBData* pUndoData, ScDocument* pDoc, SCTAB nTab,
      74             :                                     SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
      75             : {
      76           0 :     ScDBData* pRet = pDoc->GetDBAtArea( nTab, nCol1, nRow1, nCol2, nRow2 );
      77             : 
      78           0 :     if (!pRet)
      79             :     {
      80           0 :         bool bWasTemp = false;
      81           0 :         if ( pUndoData )
      82             :         {
      83           0 :             const ::rtl::OUString& aName = pUndoData->GetName();
      84           0 :             if ( aName == STR_DB_LOCAL_NONAME )
      85           0 :                 bWasTemp = true;
      86             :         }
      87             :         OSL_ENSURE(bWasTemp, "Undo: didn't find database range");
      88             :         (void)bWasTemp;
      89           0 :         pRet = pDoc->GetAnonymousDBData(nTab);
      90           0 :         if (!pRet)
      91             :         {
      92             :             pRet = new ScDBData( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME)), nTab,
      93             :                                 nCol1,nRow1, nCol2,nRow2, sal_True,
      94           0 :                                 pDoc->HasColHeader( nCol1,nRow1,nCol2,nRow2,nTab ) );
      95           0 :             pDoc->SetAnonymousDBData(nTab,pRet);
      96             :         }
      97             :     }
      98             : 
      99           0 :     return pRet;
     100             : }
     101             : 
     102             : 
     103           0 : void ScUndoUtil::PaintMore( ScDocShell* pDocShell,
     104             :                                 const ScRange& rRange )
     105             : {
     106           0 :     SCCOL nCol1 = rRange.aStart.Col();
     107           0 :     SCROW nRow1 = rRange.aStart.Row();
     108           0 :     SCCOL nCol2 = rRange.aEnd.Col();
     109           0 :     SCROW nRow2 = rRange.aEnd.Row();
     110           0 :     if (nCol1 > 0) --nCol1;
     111           0 :     if (nRow1 > 0) --nRow1;
     112           0 :     if (nCol2<MAXCOL) ++nCol2;
     113           0 :     if (nRow2<MAXROW) ++nRow2;
     114             : 
     115           0 :     pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(),
     116           0 :                           nCol2,nRow2,rRange.aEnd.Tab(), PAINT_GRID );
     117          15 : }
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10