LibreOffice Module sc (master) 1
docoptio.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
23#include <svl/poolitem.hxx>
24#include "scdllapi.h"
25#include "optutil.hxx"
26
28{
29 double fIterEps; // epsilon value dazu
30 sal_uInt16 nIterCount;
32 sal_uInt16 nDay;
33 sal_uInt16 nMonth;
34 sal_uInt16 nYear;
35 sal_uInt16 nYear2000;
36 sal_uInt16 nTabDistance;
39 bool bIsIter;
44 mutable bool bFormulaRegexEnabled;
47
48public:
50
51 bool IsLookUpColRowNames() const { return bLookUpColRowNames; }
52 void SetLookUpColRowNames( bool bVal ) { bLookUpColRowNames = bVal; }
53 bool IsAutoSpell() const { return bDoAutoSpell; }
54 void SetAutoSpell( bool bVal ) { bDoAutoSpell = bVal; }
55 bool IsMatchWholeCell() const { return bMatchWholeCell; }
56 void SetMatchWholeCell( bool bVal ) { bMatchWholeCell = bVal; }
57 bool IsIgnoreCase() const { return bIsIgnoreCase; }
58 void SetIgnoreCase( bool bVal ) { bIsIgnoreCase = bVal; }
59 bool IsIter() const { return bIsIter; }
60 void SetIter( bool bVal ) { bIsIter = bVal; }
61 sal_uInt16 GetIterCount() const { return nIterCount; }
62 void SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; }
63 double GetIterEps() const { return fIterEps; }
64 void SetIterEps( double fEps ) { fIterEps = fEps; }
65
66 void GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_Int16& rY ) const
67 { rD = nDay; rM = nMonth; rY = nYear;}
68 void SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_Int16 nY)
69 { nDay = nD; nMonth = nM; nYear = nY; }
70 sal_uInt16 GetTabDistance() const { return nTabDistance;}
71 void SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;}
72
73 void ResetDocOptions();
74
75 inline bool operator==( const ScDocOptions& rOpt ) const;
76 inline bool operator!=( const ScDocOptions& rOpt ) const;
77
78 sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; }
79 void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
80
81 bool IsCalcAsShown() const { return bCalcAsShown; }
82 void SetCalcAsShown( bool bVal ) { bCalcAsShown = bVal; }
83
84 void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; }
85 sal_uInt16 GetYear2000() const { return nYear2000; }
86
88 {
89 if (eFormulaSearchType == utl::SearchParam::SearchType::Unknown || (bFormulaRegexEnabled && bFormulaWildcardsEnabled))
90 eFormulaSearchType = utl::SearchParam::ConvertToSearchType( bFormulaWildcardsEnabled, bFormulaRegexEnabled);
91 return eFormulaSearchType;
92 }
93
94 void SetFormulaRegexEnabled( bool bVal );
95 bool IsFormulaRegexEnabled() const { return GetFormulaSearchType() == utl::SearchParam::SearchType::Regexp; }
96
97 void SetFormulaWildcardsEnabled( bool bVal );
98 bool IsFormulaWildcardsEnabled() const { return GetFormulaSearchType() == utl::SearchParam::SearchType::Wildcard; }
99
100 void SetWriteCalcConfig( bool bVal ) { bWriteCalcConfig = bVal; }
101 bool IsWriteCalcConfig() const { return bWriteCalcConfig; }
102};
103
104inline bool ScDocOptions::operator==( const ScDocOptions& rOpt ) const
105{
106 return (
108 && rOpt.bIsIter == bIsIter
109 && rOpt.nIterCount == nIterCount
110 && rOpt.fIterEps == fIterEps
112 && rOpt.nDay == nDay
113 && rOpt.nMonth == nMonth
114 && rOpt.nYear == nYear
115 && rOpt.nYear2000 == nYear2000
116 && rOpt.nTabDistance == nTabDistance
117 && rOpt.bCalcAsShown == bCalcAsShown
119 && rOpt.bDoAutoSpell == bDoAutoSpell
125 );
126}
127
128inline bool ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
129{
130 return !(operator==(rOpt));
131}
132
133// Item for preferences dialog - calculation
134
136{
137public:
138 ScTpCalcItem( sal_uInt16 nWhich,
139 const ScDocOptions& rOpt );
140 virtual ~ScTpCalcItem() override;
141
142 ScTpCalcItem(ScTpCalcItem const &) = default;
144 ScTpCalcItem & operator =(ScTpCalcItem const &) = delete; // due to SfxPoolItem
145 ScTpCalcItem & operator =(ScTpCalcItem &&) = delete; // due to SfxPoolItem
146
147 virtual bool operator==( const SfxPoolItem& ) const override;
148 virtual ScTpCalcItem* Clone( SfxItemPool *pPool = nullptr ) const override;
149
150 const ScDocOptions& GetDocOptions() const { return theOptions; }
151
152private:
154};
155
156// Config Item containing document options
157
158class ScDocCfg : public ScDocOptions
159{
162
163 DECL_LINK( CalcCommitHdl, ScLinkConfigItem&, void );
164 DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void );
165
166 static css::uno::Sequence<OUString> GetCalcPropertyNames();
167 static css::uno::Sequence<OUString> GetLayoutPropertyNames();
168
169public:
170 ScDocCfg();
171
172 void SetOptions( const ScDocOptions& rNew );
173};
174
175/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScLinkConfigItem aCalcItem
Definition: docoptio.hxx:160
static css::uno::Sequence< OUString > GetCalcPropertyNames()
Definition: docoptio.cxx:155
DECL_LINK(LayoutCommitHdl, ScLinkConfigItem &, void)
static css::uno::Sequence< OUString > GetLayoutPropertyNames()
Definition: docoptio.cxx:172
DECL_LINK(CalcCommitHdl, ScLinkConfigItem &, void)
ScLinkConfigItem aLayoutItem
Definition: docoptio.hxx:161
void SetOptions(const ScDocOptions &rNew)
Definition: docoptio.cxx:363
sal_uInt16 GetYear2000() const
Definition: docoptio.hxx:85
bool operator!=(const ScDocOptions &rOpt) const
Definition: docoptio.hxx:128
bool bWriteCalcConfig
(subset of) Calc config will be written to user's profile
Definition: docoptio.hxx:46
sal_uInt16 nIterCount
number
Definition: docoptio.hxx:30
bool bMatchWholeCell
search criteria must match the whole cell
Definition: docoptio.hxx:41
void GetDate(sal_uInt16 &rD, sal_uInt16 &rM, sal_Int16 &rY) const
Definition: docoptio.hxx:66
bool bIsIter
iterations for circular refs
Definition: docoptio.hxx:39
bool bDoAutoSpell
auto-spelling
Definition: docoptio.hxx:42
bool IsFormulaWildcardsEnabled() const
Definition: docoptio.hxx:98
utl::SearchParam::SearchType eFormulaSearchType
wildcards or regular expressions or normal search
Definition: docoptio.hxx:37
bool IsIgnoreCase() const
Definition: docoptio.hxx:57
void SetTabDistance(sal_uInt16 nTabDist)
Definition: docoptio.hxx:71
sal_uInt16 nMonth
Definition: docoptio.hxx:33
void SetYear2000(sal_uInt16 nVal)
Definition: docoptio.hxx:84
bool bCalcAsShown
calculate as shown (wrt precision)
Definition: docoptio.hxx:40
void SetCalcAsShown(bool bVal)
Definition: docoptio.hxx:82
sal_uInt16 GetIterCount() const
Definition: docoptio.hxx:61
sal_uInt16 nYear2000
earlier 19YY is assumed, 20YY otherwise (if only YY of year is given)
Definition: docoptio.hxx:35
bool IsWriteCalcConfig() const
Definition: docoptio.hxx:101
bool bFormulaRegexEnabled
regular expressions in formulas enabled, only when reading settings
Definition: docoptio.hxx:44
void SetIgnoreCase(bool bVal)
Definition: docoptio.hxx:58
void SetAutoSpell(bool bVal)
Definition: docoptio.hxx:54
void SetWriteCalcConfig(bool bVal)
Definition: docoptio.hxx:100
void SetLookUpColRowNames(bool bVal)
Definition: docoptio.hxx:52
sal_uInt16 GetTabDistance() const
Definition: docoptio.hxx:70
void SetIter(bool bVal)
Definition: docoptio.hxx:60
double fIterEps
Definition: docoptio.hxx:29
bool IsAutoSpell() const
Definition: docoptio.hxx:53
bool bIsIgnoreCase
ignore case for comparisons?
Definition: docoptio.hxx:38
void SetIterEps(double fEps)
Definition: docoptio.hxx:64
bool bFormulaWildcardsEnabled
wildcards in formulas enabled, only when reading settings
Definition: docoptio.hxx:45
void SetMatchWholeCell(bool bVal)
Definition: docoptio.hxx:56
sal_uInt16 GetStdPrecision() const
Definition: docoptio.hxx:78
void SetStdPrecision(sal_uInt16 n)
Definition: docoptio.hxx:79
bool IsIter() const
Definition: docoptio.hxx:59
bool IsLookUpColRowNames() const
Definition: docoptio.hxx:51
utl::SearchParam::SearchType GetFormulaSearchType() const
Definition: docoptio.hxx:87
void SetDate(sal_uInt16 nD, sal_uInt16 nM, sal_Int16 nY)
Definition: docoptio.hxx:68
bool operator==(const ScDocOptions &rOpt) const
Definition: docoptio.hxx:104
bool IsMatchWholeCell() const
Definition: docoptio.hxx:55
bool bLookUpColRowNames
determine column-/row titles automagically
Definition: docoptio.hxx:43
bool IsFormulaRegexEnabled() const
Definition: docoptio.hxx:95
sal_uInt16 nYear
Definition: docoptio.hxx:34
sal_uInt16 nTabDistance
distance of standard tabs
Definition: docoptio.hxx:36
sal_uInt16 nDay
Null date:
Definition: docoptio.hxx:32
void SetIterCount(sal_uInt16 nCount)
Definition: docoptio.hxx:62
sal_uInt16 nPrecStandardFormat
precision for standard format
Definition: docoptio.hxx:31
bool IsCalcAsShown() const
Definition: docoptio.hxx:81
double GetIterEps() const
Definition: docoptio.hxx:63
ScTpCalcItem(ScTpCalcItem &&)=default
const ScDocOptions & GetDocOptions() const
Definition: docoptio.hxx:150
ScTpCalcItem(ScTpCalcItem const &)=default
ScDocOptions theOptions
Definition: docoptio.hxx:153
static SearchType ConvertToSearchType(bool bWildcard, bool &rbRegExp)
int nCount
sal_Int64 n
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
Definition: xestring.hxx:248
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518