LCOV - code coverage report
Current view: top level - libreoffice/sc/source/core/tool - chgviset.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 81 0.0 %
Date: 2012-12-27 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             : 
      26             : // -----------------------------------------------------------------------
      27           0 : ScChangeViewSettings::~ScChangeViewSettings()
      28             : {
      29           0 :     if(pCommentSearcher!=NULL)
      30           0 :         delete pCommentSearcher;
      31           0 : }
      32             : 
      33           0 : ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r )
      34             :     :
      35             :         aFirstDateTime( DateTime::EMPTY ),
      36           0 :         aLastDateTime( DateTime::EMPTY )
      37             : {
      38           0 :     SetTheComment(r.aComment);
      39             : 
      40           0 :     aFirstDateTime  =r.aFirstDateTime;
      41           0 :     aLastDateTime   =r.aLastDateTime;
      42           0 :     aAuthorToShow   =r.aAuthorToShow;
      43           0 :     aRangeList      =r.aRangeList;
      44           0 :     eDateMode       =r.eDateMode;
      45           0 :     bShowIt         =r.bShowIt;
      46           0 :     bIsDate         =r.bIsDate;
      47           0 :     bIsAuthor       =r.bIsAuthor;
      48           0 :     bIsComment      =r.bIsComment;
      49           0 :     bIsRange        =r.bIsRange;
      50           0 :     bEveryoneButMe  =r.bEveryoneButMe;
      51           0 :     bShowAccepted   =r.bShowAccepted;
      52           0 :     bShowRejected   =r.bShowRejected;
      53           0 :     mbIsActionRange = r.mbIsActionRange;
      54           0 :     mnFirstAction   = r.mnFirstAction;
      55           0 :     mnLastAction    = r.mnLastAction;
      56             : 
      57           0 : }
      58             : 
      59           0 : ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSettings& r )
      60             : {
      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 : sal_Bool ScChangeViewSettings::IsValidComment(const ::rtl::OUString* pCommentStr) const
      84             : {
      85           0 :     sal_Bool nTheFlag=sal_True;
      86             : 
      87           0 :     if(pCommentSearcher!=NULL)
      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 ::rtl::OUString& rString)
      97             : {
      98           0 :     aComment=rString;
      99           0 :     if(pCommentSearcher!=NULL)
     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.Set100Sec(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