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 #pragma once
20 
21 #include <memory>
22 #include <tools/datetime.hxx>
23 #include <tools/solar.h>
24 #include <unotools/textsearch.hxx>
25 #include <svx/ctredlin.hxx>
26 #include "rangelst.hxx"
27 #include "scdllapi.h"
28 
29 class ScDocument;
30 
31 class SC_DLLPUBLIC ScChangeViewSettings
32 {
33 private:
34 
35     std::unique_ptr<utl::TextSearch>
36                         pCommentSearcher;
37     DateTime            aFirstDateTime;
38     DateTime            aLastDateTime;
39     OUString            aAuthorToShow;
40     OUString            aComment;
41     ScRangeList         aRangeList;
42     SvxRedlinDateMode   eDateMode;
43     bool                bShowIt;
44     bool                bIsDate;
45     bool                bIsAuthor;
46     bool                bIsComment;
47     bool                bIsRange;
48     bool                bShowAccepted;
49     bool                bShowRejected;
50     bool                mbIsActionRange;
51     sal_uLong           mnFirstAction;
52     sal_uLong           mnLastAction;
53 
54 public:
55 
ScChangeViewSettings()56     ScChangeViewSettings()
57         : aFirstDateTime(DateTime::EMPTY)
58         , aLastDateTime(DateTime::EMPTY)
59         , eDateMode(SvxRedlinDateMode::BEFORE)
60         , bShowIt(false)
61         , bIsDate(false)
62         , bIsAuthor(false)
63         , bIsComment(false)
64         , bIsRange(false)
65         , bShowAccepted(false)
66         , bShowRejected(false)
67         , mbIsActionRange(false)
68         , mnFirstAction(0)
69         , mnLastAction(0)
70     {
71     }
72 
73     ScChangeViewSettings( const ScChangeViewSettings& r );
74 
75     ~ScChangeViewSettings();
76 
ShowChanges() const77     bool                ShowChanges() const {return bShowIt;}
SetShowChanges(bool bFlag)78     void                SetShowChanges(bool bFlag) {bShowIt=bFlag;}
79 
HasDate() const80     bool                HasDate() const {return bIsDate;}
SetHasDate(bool bFlag)81     void                SetHasDate(bool bFlag) {bIsDate=bFlag;}
82 
SetTheDateMode(SvxRedlinDateMode eDatMod)83     void                SetTheDateMode(SvxRedlinDateMode eDatMod){ eDateMode=eDatMod; }
GetTheDateMode() const84     SvxRedlinDateMode   GetTheDateMode() const { return eDateMode; }
85 
SetTheFirstDateTime(const DateTime & aDateTime)86     void                SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;}
GetTheFirstDateTime() const87     const DateTime&     GetTheFirstDateTime()const {return aFirstDateTime;}
88 
SetTheLastDateTime(const DateTime & aDateTime)89     void                SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;}
GetTheLastDateTime() const90     const DateTime&     GetTheLastDateTime()const {return aLastDateTime;}
91 
HasAuthor() const92     bool                HasAuthor() const {return bIsAuthor;}
SetHasAuthor(bool bFlag)93     void                SetHasAuthor(bool bFlag) {bIsAuthor=bFlag;}
94 
GetTheAuthorToShow() const95     const OUString&     GetTheAuthorToShow()const {return aAuthorToShow;}
SetTheAuthorToShow(const OUString & aString)96     void                SetTheAuthorToShow(const OUString& aString){aAuthorToShow=aString;}
97 
HasComment() const98     bool                HasComment() const {return bIsComment;}
SetHasComment(bool bFlag)99     void                SetHasComment(bool bFlag) {bIsComment=bFlag;}
100 
GetTheComment() const101     const OUString&     GetTheComment()const {return aComment;}
102     void                SetTheComment(const OUString& aString);
103 
104     bool                IsValidComment(const OUString* pCommentStr) const;
105 
HasRange() const106     bool                HasRange() const {return bIsRange;}
SetHasRange(bool bFlag)107     void                SetHasRange(bool bFlag) {bIsRange=bFlag;}
108 
GetTheRangeList() const109     const ScRangeList&  GetTheRangeList()const {return aRangeList;}
SetTheRangeList(const ScRangeList & aRl)110     void                SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;}
111 
IsShowAccepted() const112     bool                IsShowAccepted() const { return bShowAccepted; }
SetShowAccepted(bool bVal)113     void                SetShowAccepted( bool bVal ) { bShowAccepted = bVal; }
114 
IsShowRejected() const115     bool                IsShowRejected() const { return bShowRejected; }
SetShowRejected(bool bVal)116     void                SetShowRejected( bool bVal ) { bShowRejected = bVal; }
117 
118     ScChangeViewSettings&   operator=   ( const ScChangeViewSettings& r );
119 
120                         /// Adjust dates according to selected DateMode
121     void                AdjustDateMode( const ScDocument& rDoc );
122 
HasActionRange() const123     bool                HasActionRange() const { return mbIsActionRange; }
SetHasActionRange()124     void                SetHasActionRange() { mbIsActionRange = true; }
GetTheActionRange(sal_uLong & nFirst,sal_uLong & nLast) const125     void                GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; }
SetTheActionRange(sal_uLong nFirst,sal_uLong nLast)126     void                SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; }
127 };
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
130