LCOV - code coverage report
Current view: top level - sc/source/core/tool - chgviset.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 81 0.0 %
Date: 2014-04-14 Functions: 0 6 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 <unotools/textsearch.hxx>
      21             : 
      22             : #include "chgviset.hxx"
      23             : #include "rechead.hxx"
      24             : #include "chgtrack.hxx"
      25             : #include "document.hxx"
      26             : 
      27           0 : ScChangeViewSettings::~ScChangeViewSettings()
      28             : {
      29           0 :     delete pCommentSearcher;
      30           0 : }
      31             : 
      32           0 : ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r ):
      33             :     pCommentSearcher(NULL),
      34             :     aFirstDateTime( DateTime::EMPTY ),
      35           0 :     aLastDateTime( DateTime::EMPTY )
      36             : {
      37           0 :     SetTheComment(r.aComment);
      38             : 
      39           0 :     aFirstDateTime  =r.aFirstDateTime;
      40           0 :     aLastDateTime   =r.aLastDateTime;
      41           0 :     aAuthorToShow   =r.aAuthorToShow;
      42           0 :     aRangeList      =r.aRangeList;
      43           0 :     eDateMode       =r.eDateMode;
      44           0 :     bShowIt         =r.bShowIt;
      45           0 :     bIsDate         =r.bIsDate;
      46           0 :     bIsAuthor       =r.bIsAuthor;
      47           0 :     bIsComment      =r.bIsComment;
      48           0 :     bIsRange        =r.bIsRange;
      49           0 :     bEveryoneButMe  =r.bEveryoneButMe;
      50           0 :     bShowAccepted   =r.bShowAccepted;
      51           0 :     bShowRejected   =r.bShowRejected;
      52           0 :     mbIsActionRange = r.mbIsActionRange;
      53           0 :     mnFirstAction   = r.mnFirstAction;
      54           0 :     mnLastAction    = r.mnLastAction;
      55             : 
      56           0 : }
      57             : 
      58           0 : ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSettings& r )
      59             : {
      60           0 :     pCommentSearcher = NULL;
      61           0 :     SetTheComment(r.aComment);
      62             : 
      63           0 :     aFirstDateTime  =r.aFirstDateTime;
      64           0 :     aLastDateTime   =r.aLastDateTime;
      65           0 :     aAuthorToShow   =r.aAuthorToShow;
      66           0 :     aRangeList      =r.aRangeList;
      67           0 :     eDateMode       =r.eDateMode;
      68           0 :     bShowIt         =r.bShowIt;
      69           0 :     bIsDate         =r.bIsDate;
      70           0 :     bIsAuthor       =r.bIsAuthor;
      71           0 :     bIsComment      =r.bIsComment;
      72           0 :     bIsRange        =r.bIsRange;
      73           0 :     bEveryoneButMe  =r.bEveryoneButMe;
      74           0 :     bShowAccepted   =r.bShowAccepted;
      75           0 :     bShowRejected   =r.bShowRejected;
      76           0 :     mbIsActionRange = r.mbIsActionRange;
      77           0 :     mnFirstAction   = r.mnFirstAction;
      78           0 :     mnLastAction    = r.mnLastAction;
      79             : 
      80           0 :     return *this;
      81             : }
      82             : 
      83           0 : bool ScChangeViewSettings::IsValidComment(const OUString* pCommentStr) const
      84             : {
      85           0 :     bool nTheFlag = true;
      86             : 
      87           0 :     if(pCommentSearcher)
      88             :     {
      89           0 :         sal_Int32 nStartPos = 0;
      90           0 :         sal_Int32 nEndPos = pCommentStr->getLength();
      91           0 :         nTheFlag = pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
      92             :     }
      93           0 :     return nTheFlag;
      94             : }
      95             : 
      96           0 : void ScChangeViewSettings::SetTheComment(const OUString& rString)
      97             : {
      98           0 :     aComment = rString;
      99           0 :     if(pCommentSearcher)
     100             :     {
     101           0 :         delete pCommentSearcher;
     102           0 :         pCommentSearcher=NULL;
     103             :     }
     104             : 
     105           0 :     if(!rString.isEmpty())
     106             :     {
     107             :         utl::SearchParam aSearchParam( rString,
     108           0 :             utl::SearchParam::SRCH_REGEXP,false,false,false );
     109             : 
     110           0 :         pCommentSearcher = new utl::TextSearch( aSearchParam, *ScGlobal::pCharClass );
     111             :     }
     112           0 : }
     113             : 
     114           0 : void ScChangeViewSettings::AdjustDateMode( const ScDocument& rDoc )
     115             : {
     116           0 :     switch ( eDateMode )
     117             :     {   // corresponds with ScViewUtil::IsActionShown
     118             :         case SCDM_DATE_EQUAL :
     119             :         case SCDM_DATE_NOTEQUAL :
     120           0 :             aFirstDateTime.SetTime( 0 );
     121           0 :             aLastDateTime = aFirstDateTime;
     122           0 :             aLastDateTime.SetTime( 23595999 );
     123           0 :             break;
     124             :         case SCDM_DATE_SAVE:
     125             :         {
     126           0 :             const ScChangeAction* pLast = 0;
     127           0 :             ScChangeTrack* pTrack = rDoc.GetChangeTrack();
     128           0 :             if ( pTrack )
     129             :             {
     130           0 :                 pLast = pTrack->GetLastSaved();
     131           0 :                 if ( pLast )
     132             :                 {
     133           0 :                     aFirstDateTime = pLast->GetDateTime();
     134             : 
     135             :                     // Set the next minute as the start time and assume that
     136             :                     // the document isn't saved, reloaded, edited and filter set
     137             :                     // all together during the gap between those two times.
     138           0 :                     aFirstDateTime += Time( 0, 1 );
     139           0 :                     aFirstDateTime.SetSec(0);
     140           0 :                     aFirstDateTime.SetNanoSec(0);
     141             :                 }
     142             :             }
     143           0 :             if ( !pLast )
     144             :             {
     145           0 :                 aFirstDateTime.SetDate( 18990101 );
     146           0 :                 aFirstDateTime.SetTime( 0 );
     147             :             }
     148           0 :             aLastDateTime = Date( Date::SYSTEM );
     149           0 :             aLastDateTime.SetYear( aLastDateTime.GetYear() + 100 );
     150             :         }
     151           0 :         break;
     152             :         default:
     153             :         {
     154             :             // added to avoid warnings
     155             :         }
     156             :     }
     157           0 : }
     158             : 
     159             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10