LibreOffice Module sw (master)  1
usrpref.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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_USRPREF_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_USRPREF_HXX
21 
22 #include <memory>
23 #include <unotools/configitem.hxx>
24 #include <fldupde.hxx>
25 #include <viewopt.hxx>
26 #include <tools/fldunit.hxx>
27 
28 class SwMasterUsrPref;
29 
31 {
32 private:
34  bool const bWeb;
35 
36  css::uno::Sequence<OUString> GetPropertyNames() const;
37 
38  virtual void ImplCommit() override;
39 
40 public:
41  SwContentViewConfig(bool bWeb, SwMasterUsrPref& rParent);
42  virtual ~SwContentViewConfig() override;
43 
44  // utl::ConfigItem
45  virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override;
46 
47  void Load();
48  using ConfigItem::SetModified;
49 };
50 
52 {
53 private:
55  bool const bWeb;
56 
57  css::uno::Sequence<OUString> GetPropertyNames() const;
58 
59  virtual void ImplCommit() override;
60 
61 public:
62  SwLayoutViewConfig(bool bWeb, SwMasterUsrPref& rParent);
63  virtual ~SwLayoutViewConfig() override;
64 
65  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
66  void Load();
67  using ConfigItem::SetModified;
68 };
69 
71 {
72 private:
74 
75  static css::uno::Sequence<OUString> GetPropertyNames();
76 
77  virtual void ImplCommit() override;
78 
79 public:
80  SwGridConfig(bool bWeb, SwMasterUsrPref& rParent);
81  virtual ~SwGridConfig() override;
82 
83  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
84  void Load();
85  using ConfigItem::SetModified;
86 };
87 
89 {
90 private:
92 
93  static css::uno::Sequence<OUString> GetPropertyNames();
94 
95  virtual void ImplCommit() override;
96 
97 public:
99  virtual ~SwCursorConfig() override;
100 
101  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
102  void Load();
103  using ConfigItem::SetModified;
104 };
105 
107 {
108 private:
110  css::uno::Sequence<OUString> aPropNames;
111 
112  virtual void ImplCommit() override;
113 
114 public:
116  virtual ~SwWebColorConfig() override;
117 
118  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
119  void Load();
120  using ConfigItem::SetModified;
121 };
122 
124 {
125  friend class SwContentViewConfig;
126  friend class SwLayoutViewConfig;
127  friend class SwGridConfig;
128  friend class SwCursorConfig;
129  friend class SwWebColorConfig;
130 
131  SwFieldUpdateFlags m_eFieldUpdateFlags; //update of fields and charts
132  sal_Int32 m_nLinkUpdateMode;
138 
139  sal_Int32 m_nDefTabInMm100; //default tab stop distance, in 1/100 mm
140 
141  bool m_bIsSquaredPageMode; //default page mode for text grid
143 
148  std::unique_ptr<SwWebColorConfig> m_pWebColorConfig;
149 
150  bool m_bApplyCharUnit; // apply_char_unit
151 public:
152  SwMasterUsrPref(bool bWeb);
154 
155  void SetUsrPref(const SwViewOption &rCopy);
156 
157  void SetModified()
158  {
159  m_aContentConfig.SetModified();
160  m_aLayoutConfig.SetModified();
161  m_aGridConfig.SetModified();
162  m_aCursorConfig.SetModified();
163  if(m_pWebColorConfig)
164  m_pWebColorConfig->SetModified();
165  }
166 
167  void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify = false)
168  {
169  m_nLinkUpdateMode = nSet;
170  if(!bNoModify)
171  m_aContentConfig.SetModified();
172  }
173  sal_Int32 GetUpdateLinkMode() const {return m_nLinkUpdateMode; }
174 
175  void SetUpdateFields(bool bSet)
176  {
177  if(bSet && m_eFieldUpdateFlags == AUTOUPD_OFF)
178  {
179  m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
180  }
181  else if(!bSet)
182  {
183  m_eFieldUpdateFlags = AUTOUPD_OFF;
184  }
185  };
186  bool IsUpdateFields()const {return m_eFieldUpdateFlags != AUTOUPD_OFF; }
187 
190  {
191  m_eFieldUpdateFlags = eSet;
192  m_aContentConfig.SetModified();
193  }
194 
195  void SetUpdateCharts(bool bSet)
196  {
197  if(bSet)
198  {
199  m_eFieldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
200  }
201  else if(m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
202  {
203  m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
204  }
205  };
206  bool IsUpdateCharts()const {return m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
207 
208  FieldUnit GetMetric() const { return m_eUserMetric;}
209  void SetMetric(FieldUnit eSet, bool bNoModify = false)
210  {
211  m_eUserMetric = eSet;
212  if(!bNoModify)
213  m_aLayoutConfig.SetModified();
214  }
215 
217  FieldUnit GetHScrollMetric() const { return m_bIsHScrollMetricSet ? m_eHScrollMetric : m_eUserMetric;}
219  {
220  m_eHScrollMetric = eSet; m_bIsHScrollMetricSet = true;
221  m_aLayoutConfig.SetModified();
222  }
223 
225  FieldUnit GetVScrollMetric() const { return m_bIsVScrollMetricSet ? m_eVScrollMetric : m_eUserMetric;}
227  {
228  m_eVScrollMetric = eSet; m_bIsVScrollMetricSet = true;
229  m_aLayoutConfig.SetModified();
230  }
231 
232  bool IsApplyCharUnit() const
233  {
234  return m_bApplyCharUnit;
235  }
236  void SetApplyCharUnit(bool bSet, bool noModify = false)
237  {
238  m_bApplyCharUnit = bSet;
239  if (!noModify) {
240  m_aLayoutConfig.SetModified();
241  }
242  }
243 
244  sal_Int32 GetDefTabInMm100() const { return m_nDefTabInMm100;}
245  void SetDefTabInMm100( sal_Int32 nSet, bool bNoModify = false )
246  {
247  m_nDefTabInMm100 = nSet;
248  if(!bNoModify)
249  m_aLayoutConfig.SetModified();
250  }
251 
252  //default page mode for text grid
254  void SetDefaultPageMode( bool bVal, bool bNoModify = false )
255  {
256  m_bIsSquaredPageMode = bVal;
257  if(!bNoModify)
258  m_aLayoutConfig.SetModified();
259  }
260 
262  void SetAlignMathObjectsToBaseline( bool bVal, bool noModify = false )
263  {
264  m_bIsAlignMathObjectsToBaseline = bVal;
265  if (!noModify) {
266  m_aLayoutConfig.SetModified();
267  }
268  }
269 };
270 
271 #endif
272 
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bIsSquaredPageMode
Definition: usrpref.hxx:141
virtual void ImplCommit() override
Definition: usrpref.cxx:410
SwMasterUsrPref(bool bWeb)
Definition: usrpref.cxx:49
FieldUnit
bool const bWeb
Definition: usrpref.hxx:34
void SetUsrPref(const SwViewOption &rCopy)
Definition: usrpref.cxx:44
FieldUnit GetVScrollMetric() const
Definition: usrpref.hxx:225
css::uno::Sequence< OUString > aPropNames
Definition: usrpref.hxx:110
SwFieldUpdateFlags
Definition: fldupde.hxx:22
SwFieldUpdateFlags m_eFieldUpdateFlags
Definition: usrpref.hxx:131
virtual void Notify(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: usrpref.cxx:134
void SetUpdateFields(bool bSet)
Definition: usrpref.hxx:175
SwLayoutViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:263
bool IsUpdateCharts() const
Definition: usrpref.hxx:206
std::unique_ptr< SwWebColorConfig > m_pWebColorConfig
Definition: usrpref.hxx:148
SwMasterUsrPref & rParent
Definition: usrpref.hxx:33
sal_Int32 m_nDefTabInMm100
Definition: usrpref.hxx:139
void SetHScrollMetric(FieldUnit eSet)
Definition: usrpref.hxx:218
virtual ~SwCursorConfig() override
Definition: usrpref.cxx:490
bool IsApplyCharUnit() const
Definition: usrpref.hxx:232
void SetDefaultPageMode(bool bVal, bool bNoModify=false)
Definition: usrpref.hxx:254
void SetVScrollMetric(FieldUnit eSet)
Definition: usrpref.hxx:226
void SetAlignMathObjectsToBaseline(bool bVal, bool noModify=false)
Definition: usrpref.hxx:262
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:375
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:85
FieldUnit GetHScrollMetric() const
Definition: usrpref.hxx:217
bool const bWeb
Definition: usrpref.hxx:55
sal_Int32 GetDefTabInMm100() const
Definition: usrpref.hxx:244
SwLayoutViewConfig m_aLayoutConfig
Definition: usrpref.hxx:145
SwMasterUsrPref & rParent
Definition: usrpref.hxx:91
void Load()
Definition: usrpref.cxx:433
virtual void ImplCommit() override
Definition: usrpref.cxx:558
virtual ~SwLayoutViewConfig() override
Definition: usrpref.cxx:271
void SetUpdateCharts(bool bSet)
Definition: usrpref.hxx:195
bool m_bIsAlignMathObjectsToBaseline
Definition: usrpref.hxx:142
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:377
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:572
SwCursorConfig m_aCursorConfig
Definition: usrpref.hxx:147
sal_Int32 GetUpdateLinkMode() const
Definition: usrpref.hxx:173
SwGridConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:399
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:544
virtual ~SwWebColorConfig() override
Definition: usrpref.cxx:554
SwContentViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:121
bool IsUpdateFields() const
Definition: usrpref.hxx:186
SwMasterUsrPref & rParent
Definition: usrpref.hxx:109
void SetApplyCharUnit(bool bSet, bool noModify=false)
Definition: usrpref.hxx:236
virtual ~SwGridConfig() override
Definition: usrpref.cxx:406
void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify=false)
Definition: usrpref.hxx:167
virtual void ImplCommit() override
Definition: usrpref.cxx:139
virtual ~SwContentViewConfig() override
Definition: usrpref.cxx:130
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:468
FieldUnit GetMetric() const
Definition: usrpref.hxx:208
FieldUnit m_eHScrollMetric
Definition: usrpref.hxx:134
bool IsSquaredPageMode() const
Definition: usrpref.hxx:253
SwFieldUpdateFlags GetFieldUpdateFlags() const
Definition: usrpref.hxx:188
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:466
void SetFieldUpdateFlags(SwFieldUpdateFlags eSet)
Definition: usrpref.hxx:189
bool IsVScrollMetric() const
Definition: usrpref.hxx:224
virtual void ImplCommit() override
Definition: usrpref.cxx:494
SwGridConfig m_aGridConfig
Definition: usrpref.hxx:146
bool IsHScrollMetric() const
Definition: usrpref.hxx:216
SwMasterUsrPref & rParent
Definition: usrpref.hxx:73
virtual void ImplCommit() override
Definition: usrpref.cxx:275
SwWebColorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:546
bool m_bIsHScrollMetricSet
Definition: usrpref.hxx:135
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:227
FieldUnit m_eUserMetric
Definition: usrpref.hxx:133
sal_Int32 m_nLinkUpdateMode
Definition: usrpref.hxx:132
void SetModified()
Definition: usrpref.hxx:157
SwCursorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:484
FieldUnit m_eVScrollMetric
Definition: usrpref.hxx:136
bool m_bIsVScrollMetricSet
Definition: usrpref.hxx:137
SwMasterUsrPref & rParent
Definition: usrpref.hxx:54
SwContentViewConfig m_aContentConfig
Definition: usrpref.hxx:144
void SetDefTabInMm100(sal_Int32 nSet, bool bNoModify=false)
Definition: usrpref.hxx:245
bool IsAlignMathObjectsToBaseline() const
Definition: usrpref.hxx:261
bool m_bApplyCharUnit
Definition: usrpref.hxx:150
void SetMetric(FieldUnit eSet, bool bNoModify=false)
Definition: usrpref.hxx:209