xref: /trunk/main/sc/source/ui/inc/editable.hxx (revision 38d50f7b)
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 
24 #ifndef SC_EDITABLE_HXX
25 #define SC_EDITABLE_HXX
26 
27 #include "address.hxx"
28 #include <tools/solar.h>
29 
30 class ScDocument;
31 class ScViewFunc;
32 class ScMarkData;
33 class ScRange;
34 
35 
36 class ScEditableTester
37 {
38 	sal_Bool	bIsEditable;
39 	sal_Bool	bOnlyMatrix;
40 
41 public:
42 			// no test in ctor
43 			ScEditableTester();
44 
45 			// calls TestBlock
46 			ScEditableTester( ScDocument* pDoc, SCTAB nTab,
47 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
48 
49 			// calls TestSelectedBlock
50 			ScEditableTester( ScDocument* pDoc,
51 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
52 						const ScMarkData& rMark );
53 
54 			// calls TestRange
55 			ScEditableTester( ScDocument* pDoc, const ScRange& rRange );
56 
57 			// calls TestSelection
58 			ScEditableTester( ScDocument* pDoc, const ScMarkData& rMark );
59 
60 			// calls TestView
61 			ScEditableTester( ScViewFunc* pView );
62 
~ScEditableTester()63 			~ScEditableTester() {}
64 
65 			// Several calls to the Test... methods check if *all* of the ranges
66 			// are editable. For several independent checks, Reset() has to be used.
67 	void	TestBlock( ScDocument* pDoc, SCTAB nTab,
68 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
69 	void	TestSelectedBlock( ScDocument* pDoc,
70 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
71 						const ScMarkData& rMark );
72 	void	TestRange( ScDocument* pDoc, const ScRange& rRange );
73 	void	TestSelection( ScDocument* pDoc, const ScMarkData& rMark );
74 	void	TestView( ScViewFunc* pView );
75 
IsEditable() const76 	sal_Bool	IsEditable() const			{ return bIsEditable; }
IsFormatEditable() const77 	sal_Bool	IsFormatEditable() const	{ return bIsEditable || bOnlyMatrix; }
78 	sal_uInt16	GetMessageId() const;
79 };
80 
81 #endif
82 
83