LCOV - code coverage report
Current view: top level - sw/source/core/edit - edredln.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 60 0.0 %
Date: 2014-04-14 Functions: 0 12 0.0 %
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 <docary.hxx>
      21             : #include <vcl/window.hxx>
      22             : #include "redline.hxx"
      23             : #include "doc.hxx"
      24             : #include "swundo.hxx"
      25             : #include "editsh.hxx"
      26             : #include "edimp.hxx"
      27             : #include "frmtool.hxx"
      28             : 
      29           0 : sal_uInt16 SwEditShell::GetRedlineMode() const
      30             : {
      31           0 :     return GetDoc()->GetRedlineMode();
      32             : }
      33             : 
      34           0 : void SwEditShell::SetRedlineMode( sal_uInt16 eMode )
      35             : {
      36           0 :     if( eMode != GetDoc()->GetRedlineMode() )
      37             :     {
      38           0 :         SET_CURR_SHELL( this );
      39           0 :         StartAllAction();
      40           0 :         GetDoc()->SetRedlineMode( (RedlineMode_t)eMode );
      41           0 :         EndAllAction();
      42             :     }
      43           0 : }
      44             : 
      45           0 : sal_Bool SwEditShell::IsRedlineOn() const
      46             : {
      47           0 :     return GetDoc()->IsRedlineOn();
      48             : }
      49             : 
      50           0 : sal_uInt16 SwEditShell::GetRedlineCount() const
      51             : {
      52           0 :     return GetDoc()->GetRedlineTbl().size();
      53             : }
      54             : 
      55           0 : const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
      56             : {
      57           0 :     return *GetDoc()->GetRedlineTbl()[ nPos ];
      58             : }
      59             : 
      60           0 : static void lcl_InvalidateAll( SwViewShell* pSh )
      61             : {
      62           0 :     SwViewShell *pStop = pSh;
      63           0 :     do
      64             :     {
      65           0 :         if ( pSh->GetWin() )
      66           0 :             pSh->GetWin()->Invalidate();
      67           0 :         pSh = (SwViewShell*)pSh->GetNext();
      68             : 
      69             :     } while ( pSh != pStop );
      70           0 : }
      71             : 
      72           0 : sal_Bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
      73             : {
      74           0 :     SET_CURR_SHELL( this );
      75           0 :     StartAllAction();
      76           0 :     sal_Bool bRet = GetDoc()->AcceptRedline( nPos, true );
      77           0 :     if( !nPos && !::IsExtraData( GetDoc() ) )
      78           0 :         lcl_InvalidateAll( this );
      79           0 :     EndAllAction();
      80           0 :     return bRet;
      81             : }
      82             : 
      83           0 : sal_Bool SwEditShell::RejectRedline( sal_uInt16 nPos )
      84             : {
      85           0 :     SET_CURR_SHELL( this );
      86           0 :     StartAllAction();
      87           0 :     sal_Bool bRet = GetDoc()->RejectRedline( nPos, true );
      88           0 :     if( !nPos && !::IsExtraData( GetDoc() ) )
      89           0 :         lcl_InvalidateAll( this );
      90           0 :     EndAllAction();
      91           0 :     return bRet;
      92             : }
      93             : 
      94             : // Set the comment at the Redline
      95           0 : sal_Bool SwEditShell::SetRedlineComment( const OUString& rS )
      96             : {
      97           0 :     sal_Bool bRet = sal_False;
      98           0 :     FOREACHPAM_START(GetCrsr())
      99           0 :         bRet = bRet || GetDoc()->SetRedlineComment( *PCURCRSR, rS );
     100           0 :     FOREACHPAM_END()
     101             : 
     102           0 :     return bRet;
     103             : }
     104             : 
     105           0 : const SwRangeRedline* SwEditShell::GetCurrRedline() const
     106             : {
     107           0 :     return GetDoc()->GetRedline( *GetCrsr()->GetPoint(), 0 );
     108             : }
     109             : 
     110           0 : void SwEditShell::UpdateRedlineAttr()
     111             : {
     112           0 :     if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) ==
     113           0 :         ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->GetRedlineMode() ))
     114             :     {
     115           0 :         SET_CURR_SHELL( this );
     116           0 :         StartAllAction();
     117             : 
     118           0 :         GetDoc()->UpdateRedlineAttr();
     119             : 
     120           0 :         EndAllAction();
     121             :     }
     122           0 : }
     123             : 
     124             : /** Search the Redline of the data given
     125             :  *
     126             :  * @return Returns the Pos of the Array, or USHRT_MAX if not present
     127             :  */
     128           0 : sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
     129             : {
     130           0 :     const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
     131             : 
     132           0 :     for( sal_uInt16 i = 0, nCnt = rTbl.size(); i < nCnt; ++i )
     133           0 :         if( &rTbl[ i ]->GetRedlineData() == &rData )
     134           0 :             return i;
     135           0 :     return USHRT_MAX;
     136             : }
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10