xref: /trunk/main/sc/inc/chgviset.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SC_CHGVISET_HXX
28 #define SC_CHGVISET_HXX
29 
30 #include <tools/datetime.hxx>
31 #include <tools/string.hxx>
32 #include "rangelst.hxx"
33 #include "scdllapi.h"
34 
35 enum ScChgsDateMode{	SCDM_DATE_BEFORE=0,SCDM_DATE_SINCE=1,SCDM_DATE_EQUAL=2,
36 						SCDM_DATE_NOTEQUAL=3,SCDM_DATE_BETWEEN=4, SCDM_DATE_SAVE=5,
37 						SCDM_NO_DATEMODE=6};
38 
39 namespace utl {
40 	class TextSearch;
41 }
42 
43 class ScDocument;
44 
45 class SC_DLLPUBLIC ScChangeViewSettings
46 {
47 private:
48 
49 	utl::TextSearch*	pCommentSearcher;
50 	DateTime			aFirstDateTime;
51 	DateTime			aLastDateTime;
52 	String				aAuthorToShow;
53 	String				aComment;
54 	ScRangeList			aRangeList;
55 	ScChgsDateMode 		eDateMode;
56 	sal_Bool				bShowIt;
57 	sal_Bool				bIsDate;
58 	sal_Bool				bIsAuthor;
59 	sal_Bool				bIsComment;
60 	sal_Bool				bIsRange;
61 	sal_Bool				bEveryoneButMe;
62 	sal_Bool				bShowAccepted;
63 	sal_Bool				bShowRejected;
64     bool                mbIsActionRange;
65     sal_uLong               mnFirstAction;
66     sal_uLong               mnLastAction;
67 
68 public:
69 
70 						ScChangeViewSettings()
71 						{
72 							pCommentSearcher=NULL;
73 							bIsDate=sal_False;
74 							bIsAuthor=sal_False;
75 							bIsRange=sal_False;
76 							bIsComment=sal_False;
77 							bShowIt=sal_False;
78 							eDateMode=SCDM_DATE_BEFORE;
79 							bEveryoneButMe=sal_False;
80 							bShowAccepted=sal_False;
81 							bShowRejected=sal_False;
82                             mbIsActionRange = false;
83 						}
84 
85 						ScChangeViewSettings( const ScChangeViewSettings& r );
86 
87 						~ScChangeViewSettings();
88 
89 	sal_Bool				ShowChanges() const {return bShowIt;}
90 	void				SetShowChanges(sal_Bool nFlag=sal_True){bShowIt=nFlag;}
91 
92 	sal_Bool				HasDate() const {return bIsDate;}
93 	void				SetHasDate(sal_Bool nFlag=sal_True) {bIsDate=nFlag;}
94 
95 	void				SetTheDateMode(ScChgsDateMode eDatMod){ eDateMode=eDatMod; }
96 	ScChgsDateMode		GetTheDateMode() const { return eDateMode; }
97 
98 	void				SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;}
99 	const DateTime&		GetTheFirstDateTime()const {return aFirstDateTime;}
100 
101 	void				SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;}
102 	const DateTime&		GetTheLastDateTime()const {return aLastDateTime;}
103 
104 
105 	sal_Bool				HasAuthor() const {return bIsAuthor;}
106 	void				SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;}
107 
108 	String				GetTheAuthorToShow()const {return aAuthorToShow;}
109 	void				SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;}
110 
111 	sal_Bool				HasComment() const {return bIsComment;}
112 	void				SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;}
113 
114 	String				GetTheComment()const {return aComment;}
115 	void				SetTheComment(const String& aString);
116 
117 	sal_Bool				IsValidComment(const String* pCommentStr) const;
118 
119 	sal_Bool				IsEveryoneButMe() const {return bEveryoneButMe;}
120 	void				SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;}
121 
122 
123 	sal_Bool				HasRange() const {return bIsRange;}
124 	void				SetHasRange(sal_Bool nFlag=sal_True) {bIsRange=nFlag;}
125 
126 	const ScRangeList&	GetTheRangeList()const {return aRangeList;}
127 	void 				SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;}
128 
129 	sal_Bool				IsShowAccepted() const { return bShowAccepted; }
130 	void				SetShowAccepted( sal_Bool bVal ) { bShowAccepted = bVal; }
131 
132 	sal_Bool				IsShowRejected() const { return bShowRejected; }
133 	void				SetShowRejected( sal_Bool bVal ) { bShowRejected = bVal; }
134 
135 	ScChangeViewSettings&	operator=	( const ScChangeViewSettings& r );
136 
137                         /// Adjust dates according to selected DateMode
138     void                AdjustDateMode( const ScDocument& rDoc );
139 
140     bool                HasActionRange() const { return mbIsActionRange; }
141     void                SetHasActionRange( bool nFlag = true ) { mbIsActionRange = nFlag; }
142     void                GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; }
143     void                SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; }
144 };
145 
146 
147 
148 #endif
149 
150