LCOV - code coverage report
Current view: top level - sw/source/core/edit - edredln.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 70 28.6 %
Date: 2015-06-13 12:38:46 Functions: 7 16 43.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 <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        2643 : sal_uInt16 SwEditShell::GetRedlineMode() const
      30             : {
      31        2643 :     return GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
      32             : }
      33             : 
      34           0 : void SwEditShell::SetRedlineMode( sal_uInt16 eMode )
      35             : {
      36           0 :     if( eMode != GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() )
      37             :     {
      38           0 :         SET_CURR_SHELL( this );
      39           0 :         StartAllAction();
      40           0 :         GetDoc()->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)eMode );
      41           0 :         EndAllAction();
      42             :     }
      43           0 : }
      44             : 
      45         870 : bool SwEditShell::IsRedlineOn() const
      46             : {
      47         870 :     return GetDoc()->getIDocumentRedlineAccess().IsRedlineOn();
      48             : }
      49             : 
      50          13 : sal_uInt16 SwEditShell::GetRedlineCount() const
      51             : {
      52          13 :     return GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size();
      53             : }
      54             : 
      55           0 : const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
      56             : {
      57           0 :     return *GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nPos ];
      58             : }
      59             : 
      60           1 : static void lcl_InvalidateAll( SwViewShell* pSh )
      61             : {
      62           2 :     for(SwViewShell& rCurrentShell : pSh->GetRingContainer())
      63             :     {
      64           1 :         if ( rCurrentShell.GetWin() )
      65           1 :             rCurrentShell.GetWin()->Invalidate();
      66             :     }
      67           1 : }
      68             : 
      69          10 : bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
      70             : {
      71          10 :     SET_CURR_SHELL( this );
      72          10 :     StartAllAction();
      73          10 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().AcceptRedline( nPos, true );
      74          10 :     if( !nPos && !::IsExtraData( GetDoc() ) )
      75           1 :         lcl_InvalidateAll( this );
      76          10 :     EndAllAction();
      77          10 :     return bRet;
      78             : }
      79             : 
      80           0 : bool SwEditShell::RejectRedline( sal_uInt16 nPos )
      81             : {
      82           0 :     SET_CURR_SHELL( this );
      83           0 :     StartAllAction();
      84           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( nPos, true );
      85           0 :     if( !nPos && !::IsExtraData( GetDoc() ) )
      86           0 :         lcl_InvalidateAll( this );
      87           0 :     EndAllAction();
      88           0 :     return bRet;
      89             : }
      90             : 
      91           0 : bool SwEditShell::AcceptRedlinesInSelection()
      92             : {
      93           0 :     SET_CURR_SHELL( this );
      94           0 :     StartAllAction();
      95           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().AcceptRedline( *GetCrsr(), true );
      96           0 :     EndAllAction();
      97           0 :     return bRet;
      98             : }
      99             : 
     100           0 : bool SwEditShell::RejectRedlinesInSelection()
     101             : {
     102           0 :     SET_CURR_SHELL( this );
     103           0 :     StartAllAction();
     104           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( *GetCrsr(), true );
     105           0 :     EndAllAction();
     106           0 :     return bRet;
     107             : }
     108             : 
     109             : // Set the comment at the Redline
     110           0 : bool SwEditShell::SetRedlineComment( const OUString& rS )
     111             : {
     112           0 :     bool bRet = false;
     113           0 :     for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
     114             :     {
     115           0 :         bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( rPaM, rS );
     116             :     }
     117             : 
     118           0 :     return bRet;
     119             : }
     120             : 
     121           0 : const SwRangeRedline* SwEditShell::GetCurrRedline() const
     122             : {
     123           0 :     return GetDoc()->getIDocumentRedlineAccess().GetRedline( *GetCrsr()->GetPoint(), 0 );
     124             : }
     125             : 
     126           0 : void SwEditShell::UpdateRedlineAttr()
     127             : {
     128           0 :     if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) ==
     129           0 :         ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() ))
     130             :     {
     131           0 :         SET_CURR_SHELL( this );
     132           0 :         StartAllAction();
     133             : 
     134           0 :         GetDoc()->getIDocumentRedlineAccess().UpdateRedlineAttr();
     135             : 
     136           0 :         EndAllAction();
     137             :     }
     138           0 : }
     139             : 
     140             : /** Search the Redline of the data given
     141             :  *
     142             :  * @return Returns the Pos of the Array, or USHRT_MAX if not present
     143             :  */
     144           0 : sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
     145             : {
     146           0 :     const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
     147             : 
     148           0 :     for( sal_uInt16 i = 0, nCnt = rTable.size(); i < nCnt; ++i )
     149           0 :         if( &rTable[ i ]->GetRedlineData() == &rData )
     150           0 :             return i;
     151           0 :     return USHRT_MAX;
     152         177 : }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11