Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / chgviset.hxx
blob88f817b970a5eebab471700dfe7cb73984bd9e35
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
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"
29 class ScDocument;
31 class SC_DLLPUBLIC ScChangeViewSettings
33 private:
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;
54 public:
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)
73 ScChangeViewSettings( const ScChangeViewSettings& r );
75 ~ScChangeViewSettings();
77 bool ShowChanges() const {return bShowIt;}
78 void SetShowChanges(bool bFlag) {bShowIt=bFlag;}
80 bool HasDate() const {return bIsDate;}
81 void SetHasDate(bool bFlag) {bIsDate=bFlag;}
83 void SetTheDateMode(SvxRedlinDateMode eDatMod){ eDateMode=eDatMod; }
84 SvxRedlinDateMode GetTheDateMode() const { return eDateMode; }
86 void SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;}
87 const DateTime& GetTheFirstDateTime()const {return aFirstDateTime;}
89 void SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;}
90 const DateTime& GetTheLastDateTime()const {return aLastDateTime;}
92 bool HasAuthor() const {return bIsAuthor;}
93 void SetHasAuthor(bool bFlag) {bIsAuthor=bFlag;}
95 const OUString& GetTheAuthorToShow()const {return aAuthorToShow;}
96 void SetTheAuthorToShow(const OUString& aString){aAuthorToShow=aString;}
98 bool HasComment() const {return bIsComment;}
99 void SetHasComment(bool bFlag) {bIsComment=bFlag;}
101 const OUString& GetTheComment()const {return aComment;}
102 void SetTheComment(const OUString& aString);
104 bool IsValidComment(const OUString* pCommentStr) const;
106 bool HasRange() const {return bIsRange;}
107 void SetHasRange(bool bFlag) {bIsRange=bFlag;}
109 const ScRangeList& GetTheRangeList()const {return aRangeList;}
110 void SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;}
112 bool IsShowAccepted() const { return bShowAccepted; }
113 void SetShowAccepted( bool bVal ) { bShowAccepted = bVal; }
115 bool IsShowRejected() const { return bShowRejected; }
116 void SetShowRejected( bool bVal ) { bShowRejected = bVal; }
118 ScChangeViewSettings& operator= ( const ScChangeViewSettings& r );
120 /// Adjust dates according to selected DateMode
121 void AdjustDateMode( const ScDocument& rDoc );
123 bool HasActionRange() const { return mbIsActionRange; }
124 void SetHasActionRange() { mbIsActionRange = true; }
125 void GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; }
126 void SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; }
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */