xref: /AOO41X/main/sc/inc/chgviset.hxx (revision 707fc0d4d52eb4f69d89a98ffec6918ca5de6326)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SC_CHGVISET_HXX
24 #define SC_CHGVISET_HXX
25 
26 #include <tools/datetime.hxx>
27 #include <tools/string.hxx>
28 #include "rangelst.hxx"
29 #include "scdllapi.h"
30 
31 enum ScChgsDateMode{    SCDM_DATE_BEFORE=0,SCDM_DATE_SINCE=1,SCDM_DATE_EQUAL=2,
32                         SCDM_DATE_NOTEQUAL=3,SCDM_DATE_BETWEEN=4, SCDM_DATE_SAVE=5,
33                         SCDM_NO_DATEMODE=6};
34 
35 namespace utl {
36     class TextSearch;
37 }
38 
39 class ScDocument;
40 
41 class SC_DLLPUBLIC ScChangeViewSettings
42 {
43 private:
44 
45     utl::TextSearch*    pCommentSearcher;
46     DateTime            aFirstDateTime;
47     DateTime            aLastDateTime;
48     String              aAuthorToShow;
49     String              aComment;
50     ScRangeList         aRangeList;
51     ScChgsDateMode      eDateMode;
52     sal_Bool                bShowIt;
53     sal_Bool                bIsDate;
54     sal_Bool                bIsAuthor;
55     sal_Bool                bIsComment;
56     sal_Bool                bIsRange;
57     sal_Bool                bEveryoneButMe;
58     sal_Bool                bShowAccepted;
59     sal_Bool                bShowRejected;
60     bool                mbIsActionRange;
61     sal_uLong               mnFirstAction;
62     sal_uLong               mnLastAction;
63 
64 public:
65 
66                         ScChangeViewSettings()
67                         {
68                             pCommentSearcher=NULL;
69                             bIsDate=sal_False;
70                             bIsAuthor=sal_False;
71                             bIsRange=sal_False;
72                             bIsComment=sal_False;
73                             bShowIt=sal_False;
74                             eDateMode=SCDM_DATE_BEFORE;
75                             bEveryoneButMe=sal_False;
76                             bShowAccepted=sal_False;
77                             bShowRejected=sal_False;
78                             mbIsActionRange = false;
79                         }
80 
81                         ScChangeViewSettings( const ScChangeViewSettings& r );
82 
83                         ~ScChangeViewSettings();
84 
85     sal_Bool                ShowChanges() const {return bShowIt;}
86     void                SetShowChanges(sal_Bool nFlag=sal_True){bShowIt=nFlag;}
87 
88     sal_Bool                HasDate() const {return bIsDate;}
89     void                SetHasDate(sal_Bool nFlag=sal_True) {bIsDate=nFlag;}
90 
91     void                SetTheDateMode(ScChgsDateMode eDatMod){ eDateMode=eDatMod; }
92     ScChgsDateMode      GetTheDateMode() const { return eDateMode; }
93 
94     void                SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;}
95     const DateTime&     GetTheFirstDateTime()const {return aFirstDateTime;}
96 
97     void                SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;}
98     const DateTime&     GetTheLastDateTime()const {return aLastDateTime;}
99 
100 
101     sal_Bool                HasAuthor() const {return bIsAuthor;}
102     void                SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;}
103 
104     String              GetTheAuthorToShow()const {return aAuthorToShow;}
105     void                SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;}
106 
107     sal_Bool                HasComment() const {return bIsComment;}
108     void                SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;}
109 
110     String              GetTheComment()const {return aComment;}
111     void                SetTheComment(const String& aString);
112 
113     sal_Bool                IsValidComment(const String* pCommentStr) const;
114 
115     sal_Bool                IsEveryoneButMe() const {return bEveryoneButMe;}
116     void                SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;}
117 
118 
119     sal_Bool                HasRange() const {return bIsRange;}
120     void                SetHasRange(sal_Bool nFlag=sal_True) {bIsRange=nFlag;}
121 
122     const ScRangeList&  GetTheRangeList()const {return aRangeList;}
123     void                SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;}
124 
125     sal_Bool                IsShowAccepted() const { return bShowAccepted; }
126     void                SetShowAccepted( sal_Bool bVal ) { bShowAccepted = bVal; }
127 
128     sal_Bool                IsShowRejected() const { return bShowRejected; }
129     void                SetShowRejected( sal_Bool bVal ) { bShowRejected = bVal; }
130 
131     ScChangeViewSettings&   operator=   ( const ScChangeViewSettings& r );
132 
133                         /// Adjust dates according to selected DateMode
134     void                AdjustDateMode( const ScDocument& rDoc );
135 
136     bool                HasActionRange() const { return mbIsActionRange; }
137     void                SetHasActionRange( bool nFlag = true ) { mbIsActionRange = nFlag; }
138     void                GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; }
139     void                SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; }
140 };
141 
142 
143 
144 #endif
145 
146