LCOV - code coverage report
Current view: top level - sw/source/core/edit - edredln.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 73 6.8 %
Date: 2014-11-03 Functions: 4 16 25.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()->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        1047 : bool SwEditShell::IsRedlineOn() const
      46             : {
      47        1047 :     return GetDoc()->getIDocumentRedlineAccess().IsRedlineOn();
      48             : }
      49             : 
      50           4 : sal_uInt16 SwEditShell::GetRedlineCount() const
      51             : {
      52           4 :     return GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl().size();
      53             : }
      54             : 
      55           0 : const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
      56             : {
      57           0 :     return *GetDoc()->getIDocumentRedlineAccess().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 : bool SwEditShell::AcceptRedline( sal_uInt16 nPos )
      73             : {
      74           0 :     SET_CURR_SHELL( this );
      75           0 :     StartAllAction();
      76           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().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 : bool SwEditShell::RejectRedline( sal_uInt16 nPos )
      84             : {
      85           0 :     SET_CURR_SHELL( this );
      86           0 :     StartAllAction();
      87           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( nPos, true );
      88           0 :     if( !nPos && !::IsExtraData( GetDoc() ) )
      89           0 :         lcl_InvalidateAll( this );
      90           0 :     EndAllAction();
      91           0 :     return bRet;
      92             : }
      93             : 
      94           0 : bool SwEditShell::AcceptRedlinesInSelection()
      95             : {
      96           0 :     SET_CURR_SHELL( this );
      97           0 :     StartAllAction();
      98           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().AcceptRedline( *GetCrsr(), true );
      99           0 :     EndAllAction();
     100           0 :     return bRet;
     101             : }
     102             : 
     103           0 : bool SwEditShell::RejectRedlinesInSelection()
     104             : {
     105           0 :     SET_CURR_SHELL( this );
     106           0 :     StartAllAction();
     107           0 :     bool bRet = GetDoc()->getIDocumentRedlineAccess().RejectRedline( *GetCrsr(), true );
     108           0 :     EndAllAction();
     109           0 :     return bRet;
     110             : }
     111             : 
     112             : // Set the comment at the Redline
     113           0 : bool SwEditShell::SetRedlineComment( const OUString& rS )
     114             : {
     115           0 :     bool bRet = false;
     116           0 :     FOREACHPAM_START(GetCrsr())
     117           0 :         bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( *PCURCRSR, rS );
     118           0 :     FOREACHPAM_END()
     119             : 
     120           0 :     return bRet;
     121             : }
     122             : 
     123           0 : const SwRangeRedline* SwEditShell::GetCurrRedline() const
     124             : {
     125           0 :     return GetDoc()->getIDocumentRedlineAccess().GetRedline( *GetCrsr()->GetPoint(), 0 );
     126             : }
     127             : 
     128           0 : void SwEditShell::UpdateRedlineAttr()
     129             : {
     130           0 :     if( ( nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) ==
     131           0 :         ( nsRedlineMode_t::REDLINE_SHOW_MASK & GetDoc()->getIDocumentRedlineAccess().GetRedlineMode() ))
     132             :     {
     133           0 :         SET_CURR_SHELL( this );
     134           0 :         StartAllAction();
     135             : 
     136           0 :         GetDoc()->getIDocumentRedlineAccess().UpdateRedlineAttr();
     137             : 
     138           0 :         EndAllAction();
     139             :     }
     140           0 : }
     141             : 
     142             : /** Search the Redline of the data given
     143             :  *
     144             :  * @return Returns the Pos of the Array, or USHRT_MAX if not present
     145             :  */
     146           0 : sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
     147             : {
     148           0 :     const SwRedlineTbl& rTbl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTbl();
     149             : 
     150           0 :     for( sal_uInt16 i = 0, nCnt = rTbl.size(); i < nCnt; ++i )
     151           0 :         if( &rTbl[ i ]->GetRedlineData() == &rData )
     152           0 :             return i;
     153           0 :     return USHRT_MAX;
     154         270 : }
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10