LCOV - code coverage report
Current view: top level - sc/source/filter/rtf - expbase.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 22 29 75.9 %
Date: 2014-11-03 Functions: 7 9 77.8 %
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 "expbase.hxx"
      21             : #include "document.hxx"
      22             : #include "editutil.hxx"
      23             : 
      24           6 : ScExportBase::ScExportBase( SvStream& rStrmP, ScDocument* pDocP,
      25             :                 const ScRange& rRangeP )
      26             :             :
      27             :             rStrm( rStrmP ),
      28             :             aRange( rRangeP ),
      29             :             pDoc( pDocP ),
      30           6 :             pFormatter( pDocP->GetFormatTable() ),
      31          12 :             pEditEngine( NULL )
      32             : {
      33           6 : }
      34             : 
      35           6 : ScExportBase::~ScExportBase()
      36             : {
      37           6 :     delete pEditEngine;
      38           6 : }
      39             : 
      40          12 : bool ScExportBase::GetDataArea( SCTAB nTab, SCCOL& nStartCol,
      41             :             SCROW& nStartRow, SCCOL& nEndCol, SCROW& nEndRow ) const
      42             : {
      43          12 :     pDoc->GetDataStart( nTab, nStartCol, nStartRow );
      44          12 :     pDoc->GetPrintArea( nTab, nEndCol, nEndRow, true );
      45          12 :     return TrimDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
      46             : }
      47             : 
      48          12 : bool ScExportBase::TrimDataArea( SCTAB nTab, SCCOL& nStartCol,
      49             :             SCROW& nStartRow, SCCOL& nEndCol, SCROW& nEndRow ) const
      50             : {
      51          24 :     while ( nStartCol <= nEndCol && pDoc->ColHidden(nStartCol, nTab))
      52           0 :         ++nStartCol;
      53          24 :     while ( nStartCol <= nEndCol && pDoc->ColHidden(nEndCol, nTab))
      54           0 :         --nEndCol;
      55          12 :     nStartRow = pDoc->FirstVisibleRow(nStartRow, nEndRow, nTab);
      56          12 :     nEndRow = pDoc->LastVisibleRow(nStartRow, nEndRow, nTab);
      57          24 :     return nStartCol <= nEndCol && nStartRow <= nEndRow && nEndRow !=
      58          24 :         ::std::numeric_limits<SCROW>::max();
      59             : }
      60             : 
      61           6 : bool ScExportBase::IsEmptyTable( SCTAB nTab ) const
      62             : {
      63           6 :     if ( !pDoc->HasTable( nTab ) || !pDoc->IsVisible( nTab ) )
      64           0 :         return true;
      65             :     SCCOL nStartCol, nEndCol;
      66             :     SCROW nStartRow, nEndRow;
      67           6 :     return !GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow );
      68             : }
      69             : 
      70           0 : ScFieldEditEngine& ScExportBase::GetEditEngine() const
      71             : {
      72           0 :     if ( !pEditEngine )
      73           0 :         ((ScExportBase*)this)->pEditEngine = new ScFieldEditEngine(pDoc, pDoc->GetEditPool());
      74           0 :     return *pEditEngine;
      75          48 : }
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10