xref: /aoo4110/main/sc/inc/chgviset.hxx (revision b1cdbd2c)
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 
ScChangeViewSettings()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 
ShowChanges() const85 	sal_Bool				ShowChanges() const {return bShowIt;}
SetShowChanges(sal_Bool nFlag=sal_True)86 	void				SetShowChanges(sal_Bool nFlag=sal_True){bShowIt=nFlag;}
87 
HasDate() const88 	sal_Bool				HasDate() const {return bIsDate;}
SetHasDate(sal_Bool nFlag=sal_True)89 	void				SetHasDate(sal_Bool nFlag=sal_True) {bIsDate=nFlag;}
90 
SetTheDateMode(ScChgsDateMode eDatMod)91 	void				SetTheDateMode(ScChgsDateMode eDatMod){ eDateMode=eDatMod; }
GetTheDateMode() const92 	ScChgsDateMode		GetTheDateMode() const { return eDateMode; }
93 
SetTheFirstDateTime(const DateTime & aDateTime)94 	void				SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;}
GetTheFirstDateTime() const95 	const DateTime&		GetTheFirstDateTime()const {return aFirstDateTime;}
96 
SetTheLastDateTime(const DateTime & aDateTime)97 	void				SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;}
GetTheLastDateTime() const98 	const DateTime&		GetTheLastDateTime()const {return aLastDateTime;}
99 
100 
HasAuthor() const101 	sal_Bool				HasAuthor() const {return bIsAuthor;}
SetHasAuthor(sal_Bool nFlag=sal_True)102 	void				SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;}
103 
GetTheAuthorToShow() const104 	String				GetTheAuthorToShow()const {return aAuthorToShow;}
SetTheAuthorToShow(const String & aString)105 	void				SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;}
106 
HasComment() const107 	sal_Bool				HasComment() const {return bIsComment;}
SetHasComment(sal_Bool nFlag=sal_True)108 	void				SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;}
109 
GetTheComment() const110 	String				GetTheComment()const {return aComment;}
111 	void				SetTheComment(const String& aString);
112 
113 	sal_Bool				IsValidComment(const String* pCommentStr) const;
114 
IsEveryoneButMe() const115 	sal_Bool				IsEveryoneButMe() const {return bEveryoneButMe;}
SetEveryoneButMe(sal_Bool nFlag=sal_True)116 	void				SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;}
117 
118 
HasRange() const119 	sal_Bool				HasRange() const {return bIsRange;}
SetHasRange(sal_Bool nFlag=sal_True)120 	void				SetHasRange(sal_Bool nFlag=sal_True) {bIsRange=nFlag;}
121 
GetTheRangeList() const122 	const ScRangeList&	GetTheRangeList()const {return aRangeList;}
SetTheRangeList(const ScRangeList & aRl)123 	void 				SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;}
124 
IsShowAccepted() const125 	sal_Bool				IsShowAccepted() const { return bShowAccepted; }
SetShowAccepted(sal_Bool bVal)126 	void				SetShowAccepted( sal_Bool bVal ) { bShowAccepted = bVal; }
127 
IsShowRejected() const128 	sal_Bool				IsShowRejected() const { return bShowRejected; }
SetShowRejected(sal_Bool bVal)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 
HasActionRange() const136     bool                HasActionRange() const { return mbIsActionRange; }
SetHasActionRange(bool nFlag=true)137     void                SetHasActionRange( bool nFlag = true ) { mbIsActionRange = nFlag; }
GetTheActionRange(sal_uLong & nFirst,sal_uLong & nLast) const138     void                GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; }
SetTheActionRange(sal_uLong nFirst,sal_uLong nLast)139     void                SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; }
140 };
141 
142 
143 
144 #endif
145 
146