LCOV - code coverage report
Current view: top level - sc/source/core/tool - chgviset.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 81 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 51 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <unotools/textsearch.hxx>
      30                 :            : 
      31                 :            : #include "chgviset.hxx"
      32                 :            : #include "rechead.hxx"
      33                 :            : #include "chgtrack.hxx"
      34                 :            : 
      35                 :            : // -----------------------------------------------------------------------
      36         [ #  # ]:          0 : ScChangeViewSettings::~ScChangeViewSettings()
      37                 :            : {
      38         [ #  # ]:          0 :     if(pCommentSearcher!=NULL)
      39 [ #  # ][ #  # ]:          0 :         delete pCommentSearcher;
      40                 :          0 : }
      41                 :            : 
      42                 :          0 : ScChangeViewSettings::ScChangeViewSettings( const ScChangeViewSettings& r )
      43                 :            :     :
      44                 :            :         aFirstDateTime( DateTime::EMPTY ),
      45         [ #  # ]:          0 :         aLastDateTime( DateTime::EMPTY )
      46                 :            : {
      47         [ #  # ]:          0 :     SetTheComment(r.aComment);
      48                 :            : 
      49         [ #  # ]:          0 :     aFirstDateTime  =r.aFirstDateTime;
      50         [ #  # ]:          0 :     aLastDateTime   =r.aLastDateTime;
      51                 :          0 :     aAuthorToShow   =r.aAuthorToShow;
      52         [ #  # ]:          0 :     aRangeList      =r.aRangeList;
      53                 :          0 :     eDateMode       =r.eDateMode;
      54                 :          0 :     bShowIt         =r.bShowIt;
      55                 :          0 :     bIsDate         =r.bIsDate;
      56                 :          0 :     bIsAuthor       =r.bIsAuthor;
      57                 :          0 :     bIsComment      =r.bIsComment;
      58                 :          0 :     bIsRange        =r.bIsRange;
      59                 :          0 :     bEveryoneButMe  =r.bEveryoneButMe;
      60                 :          0 :     bShowAccepted   =r.bShowAccepted;
      61                 :          0 :     bShowRejected   =r.bShowRejected;
      62                 :          0 :     mbIsActionRange = r.mbIsActionRange;
      63                 :          0 :     mnFirstAction   = r.mnFirstAction;
      64                 :          0 :     mnLastAction    = r.mnLastAction;
      65                 :            : 
      66                 :          0 : }
      67                 :            : 
      68                 :          0 : ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSettings& r )
      69                 :            : {
      70                 :          0 :     SetTheComment(r.aComment);
      71                 :            : 
      72                 :          0 :     aFirstDateTime  =r.aFirstDateTime;
      73                 :          0 :     aLastDateTime   =r.aLastDateTime;
      74                 :          0 :     aAuthorToShow   =r.aAuthorToShow;
      75                 :          0 :     aRangeList      =r.aRangeList;
      76                 :          0 :     eDateMode       =r.eDateMode;
      77                 :          0 :     bShowIt         =r.bShowIt;
      78                 :          0 :     bIsDate         =r.bIsDate;
      79                 :          0 :     bIsAuthor       =r.bIsAuthor;
      80                 :          0 :     bIsComment      =r.bIsComment;
      81                 :          0 :     bIsRange        =r.bIsRange;
      82                 :          0 :     bEveryoneButMe  =r.bEveryoneButMe;
      83                 :          0 :     bShowAccepted   =r.bShowAccepted;
      84                 :          0 :     bShowRejected   =r.bShowRejected;
      85                 :          0 :     mbIsActionRange = r.mbIsActionRange;
      86                 :          0 :     mnFirstAction   = r.mnFirstAction;
      87                 :          0 :     mnLastAction    = r.mnLastAction;
      88                 :            : 
      89                 :          0 :     return *this;
      90                 :            : }
      91                 :            : 
      92                 :          0 : sal_Bool ScChangeViewSettings::IsValidComment(const ::rtl::OUString* pCommentStr) const
      93                 :            : {
      94                 :          0 :     sal_Bool nTheFlag=sal_True;
      95                 :            : 
      96         [ #  # ]:          0 :     if(pCommentSearcher!=NULL)
      97                 :            :     {
      98                 :          0 :         sal_Int32 nStartPos = 0;
      99                 :          0 :         sal_Int32 nEndPos = pCommentStr->getLength();
     100         [ #  # ]:          0 :         nTheFlag=pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
     101                 :            :     }
     102                 :          0 :     return nTheFlag;
     103                 :            : }
     104                 :            : 
     105                 :          0 : void ScChangeViewSettings::SetTheComment(const ::rtl::OUString& rString)
     106                 :            : {
     107                 :          0 :     aComment=rString;
     108         [ #  # ]:          0 :     if(pCommentSearcher!=NULL)
     109                 :            :     {
     110         [ #  # ]:          0 :         delete pCommentSearcher;
     111                 :          0 :         pCommentSearcher=NULL;
     112                 :            :     }
     113                 :            : 
     114         [ #  # ]:          0 :     if(!rString.isEmpty())
     115                 :            :     {
     116                 :            :         utl::SearchParam aSearchParam( rString,
     117         [ #  # ]:          0 :             utl::SearchParam::SRCH_REGEXP,false,false,false );
     118                 :            : 
     119 [ #  # ][ #  # ]:          0 :         pCommentSearcher = new utl::TextSearch( aSearchParam, *ScGlobal::pCharClass );
                 [ #  # ]
     120                 :            :     }
     121                 :          0 : }
     122                 :            : 
     123                 :          0 : void ScChangeViewSettings::AdjustDateMode( const ScDocument& rDoc )
     124                 :            : {
     125      [ #  #  # ]:          0 :     switch ( eDateMode )
     126                 :            :     {   // corresponds with ScViewUtil::IsActionShown
     127                 :            :         case SCDM_DATE_EQUAL :
     128                 :            :         case SCDM_DATE_NOTEQUAL :
     129                 :          0 :             aFirstDateTime.SetTime( 0 );
     130                 :          0 :             aLastDateTime = aFirstDateTime;
     131                 :          0 :             aLastDateTime.SetTime( 23595999 );
     132                 :          0 :             break;
     133                 :            :         case SCDM_DATE_SAVE:
     134                 :            :         {
     135                 :          0 :             const ScChangeAction* pLast = 0;
     136                 :          0 :             ScChangeTrack* pTrack = rDoc.GetChangeTrack();
     137         [ #  # ]:          0 :             if ( pTrack )
     138                 :            :             {
     139                 :          0 :                 pLast = pTrack->GetLastSaved();
     140         [ #  # ]:          0 :                 if ( pLast )
     141                 :            :                 {
     142         [ #  # ]:          0 :                     aFirstDateTime = pLast->GetDateTime();
     143                 :            : 
     144                 :            :                     // Set the next minute as the start time and assume that
     145                 :            :                     // the document isn't saved, reloaded, edited and filter set
     146                 :            :                     // all together during the gap between those two times.
     147         [ #  # ]:          0 :                     aFirstDateTime += Time( 0, 1 );
     148                 :          0 :                     aFirstDateTime.SetSec(0);
     149                 :          0 :                     aFirstDateTime.Set100Sec(0);
     150                 :            :                 }
     151                 :            :             }
     152         [ #  # ]:          0 :             if ( !pLast )
     153                 :            :             {
     154                 :          0 :                 aFirstDateTime.SetDate( 18990101 );
     155                 :          0 :                 aFirstDateTime.SetTime( 0 );
     156                 :            :             }
     157         [ #  # ]:          0 :             aLastDateTime = Date( Date::SYSTEM );
     158                 :          0 :             aLastDateTime.SetYear( aLastDateTime.GetYear() + 100 );
     159                 :            :         }
     160                 :          0 :         break;
     161                 :            :         default:
     162                 :            :         {
     163                 :            :             // added to avoid warnings
     164                 :            :         }
     165                 :            :     }
     166                 :          0 : }
     167                 :            : 
     168                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10