Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_DOCOPTIO_HXX
30 : : #define SC_DOCOPTIO_HXX
31 : :
32 : : #include <unotools/configitem.hxx>
33 : : #include <svl/poolitem.hxx>
34 : : #include <svl/itemprop.hxx>
35 : : #include "scdllapi.h"
36 : : #include "scmod.hxx"
37 : : #include "optutil.hxx"
38 : :
39 : : #include "formula/grammar.hxx"
40 : :
41 : : class SC_DLLPUBLIC ScDocOptions
42 : : {
43 : : double fIterEps; // epsilon value dazu
44 : : sal_uInt16 nIterCount; // number
45 : : sal_uInt16 nPrecStandardFormat; // precision for standard format
46 : : sal_uInt16 nDay; // Null date:
47 : : sal_uInt16 nMonth;
48 : : sal_uInt16 nYear;
49 : : sal_uInt16 nYear2000; // earlier 19YY is assumed, 20YY otherwise (if only YY of year is given)
50 : : sal_uInt16 nTabDistance; // distance of standard tabs
51 : : sal_Bool bIsIgnoreCase; // ignore case for comparisons?
52 : : sal_Bool bIsIter; // iterations for circular refs
53 : : sal_Bool bCalcAsShown; // calculate as shown (wrt precision)
54 : : sal_Bool bMatchWholeCell; // search criteria must match the whole cell
55 : : sal_Bool bDoAutoSpell; // auto-spelling
56 : : sal_Bool bLookUpColRowNames; // determine column-/row titles automagically
57 : : sal_Bool bFormulaRegexEnabled; // regular expressions in formulas enabled
58 : : public:
59 : : ScDocOptions();
60 : : ScDocOptions( const ScDocOptions& rCpy );
61 : : ~ScDocOptions();
62 : :
63 : 45 : sal_Bool IsLookUpColRowNames() const { return bLookUpColRowNames; }
64 : 256 : void SetLookUpColRowNames( sal_Bool bVal ) { bLookUpColRowNames = bVal; }
65 : 3637 : sal_Bool IsAutoSpell() const { return bDoAutoSpell; }
66 : 418 : void SetAutoSpell( sal_Bool bVal ) { bDoAutoSpell = bVal; }
67 : 1761 : sal_Bool IsMatchWholeCell() const { return bMatchWholeCell; }
68 : 150 : void SetMatchWholeCell( sal_Bool bVal ){ bMatchWholeCell = bVal; }
69 : 78 : sal_Bool IsIgnoreCase() const { return bIsIgnoreCase; }
70 : 229 : void SetIgnoreCase( sal_Bool bVal ) { bIsIgnoreCase = bVal; }
71 : 27 : sal_Bool IsIter() const { return bIsIter; }
72 : 336 : void SetIter( sal_Bool bVal ) { bIsIter = bVal; }
73 : 18 : sal_uInt16 GetIterCount() const { return nIterCount; }
74 : 336 : void SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; }
75 : 18 : double GetIterEps() const { return fIterEps; }
76 : 336 : void SetIterEps( double fEps ) { fIterEps = fEps; }
77 : :
78 : 1599 : void GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const
79 : 1599 : { rD = nDay; rM = nMonth; rY = nYear;}
80 : 225 : void SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY)
81 : 225 : { nDay = nD; nMonth = nM; nYear = nY; }
82 : 340 : sal_uInt16 GetTabDistance() const { return nTabDistance;}
83 : 150 : void SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;}
84 : :
85 : : void ResetDocOptions();
86 : :
87 : : inline const ScDocOptions& operator=( const ScDocOptions& rOpt );
88 : : inline bool operator==( const ScDocOptions& rOpt ) const;
89 : : inline bool operator!=( const ScDocOptions& rOpt ) const;
90 : :
91 : 1601 : sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; }
92 : 162 : void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
93 : :
94 : 6718 : sal_Bool IsCalcAsShown() const { return bCalcAsShown; }
95 : 220 : void SetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; }
96 : :
97 : 505 : void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; }
98 : 1542 : sal_uInt16 GetYear2000() const { return nYear2000; }
99 : :
100 : 229 : void SetFormulaRegexEnabled( sal_Bool bVal ) { bFormulaRegexEnabled = bVal; }
101 : 69 : sal_Bool IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; }
102 : :
103 : : };
104 : :
105 : 2928 : inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
106 : : {
107 : 2928 : bIsIgnoreCase = rCpy.bIsIgnoreCase;
108 : 2928 : bIsIter = rCpy.bIsIter;
109 : 2928 : nIterCount = rCpy.nIterCount;
110 : 2928 : fIterEps = rCpy.fIterEps;
111 : 2928 : nPrecStandardFormat = rCpy.nPrecStandardFormat;
112 : 2928 : nDay = rCpy.nDay;
113 : 2928 : nMonth = rCpy.nMonth;
114 : 2928 : nYear = rCpy.nYear;
115 : 2928 : nYear2000 = rCpy.nYear2000;
116 : 2928 : nTabDistance = rCpy.nTabDistance;
117 : 2928 : bCalcAsShown = rCpy.bCalcAsShown;
118 : 2928 : bMatchWholeCell = rCpy.bMatchWholeCell;
119 : 2928 : bDoAutoSpell = rCpy.bDoAutoSpell;
120 : 2928 : bLookUpColRowNames = rCpy.bLookUpColRowNames;
121 : 2928 : bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
122 : :
123 : 2928 : return *this;
124 : : }
125 : :
126 : 1692 : inline bool ScDocOptions::operator==( const ScDocOptions& rOpt ) const
127 : : {
128 : : return (
129 : : rOpt.bIsIgnoreCase == bIsIgnoreCase
130 : : && rOpt.bIsIter == bIsIter
131 : : && rOpt.nIterCount == nIterCount
132 : : && rOpt.fIterEps == fIterEps
133 : : && rOpt.nPrecStandardFormat == nPrecStandardFormat
134 : : && rOpt.nDay == nDay
135 : : && rOpt.nMonth == nMonth
136 : : && rOpt.nYear == nYear
137 : : && rOpt.nYear2000 == nYear2000
138 : : && rOpt.nTabDistance == nTabDistance
139 : : && rOpt.bCalcAsShown == bCalcAsShown
140 : : && rOpt.bMatchWholeCell == bMatchWholeCell
141 : : && rOpt.bDoAutoSpell == bDoAutoSpell
142 : : && rOpt.bLookUpColRowNames == bLookUpColRowNames
143 : : && rOpt.bFormulaRegexEnabled == bFormulaRegexEnabled
144 [ + + ][ + + ]: 1692 : );
[ + + ][ + + ]
[ + + ][ + + ]
[ + - ][ + - ]
[ + - ][ + + ]
[ + + ][ + + ]
[ + + ][ + + ]
[ + + ]
145 : : }
146 : :
147 : 1692 : inline bool ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
148 : : {
149 : 1692 : return !(operator==(rOpt));
150 : : }
151 : :
152 : : //==================================================================
153 : : // Item for preferences dialog - calculation
154 : : //==================================================================
155 : :
156 : : class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem
157 : : {
158 : : public:
159 : : TYPEINFO();
160 : : ScTpCalcItem( sal_uInt16 nWhich,
161 : : const ScDocOptions& rOpt );
162 : : ScTpCalcItem( const ScTpCalcItem& rItem );
163 : : ~ScTpCalcItem();
164 : :
165 : : virtual String GetValueText() const;
166 : : virtual int operator==( const SfxPoolItem& ) const;
167 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
168 : :
169 : 0 : const ScDocOptions& GetDocOptions() const { return theOptions; }
170 : :
171 : : private:
172 : : ScDocOptions theOptions;
173 : : };
174 : :
175 : : //==================================================================
176 : : // Config Item containing document options
177 : : //==================================================================
178 : :
179 [ + - ][ + - ]: 18 : class ScDocCfg : public ScDocOptions
180 : : {
181 : : ScLinkConfigItem aCalcItem;
182 : : ScLinkConfigItem aLayoutItem;
183 : :
184 : : DECL_LINK( CalcCommitHdl, void* );
185 : : DECL_LINK( LayoutCommitHdl, void* );
186 : :
187 : : com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
188 : : com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
189 : :
190 : : public:
191 : : ScDocCfg();
192 : :
193 : : void SetOptions( const ScDocOptions& rNew );
194 : : };
195 : :
196 : :
197 : : #endif
198 : :
199 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|