LibreOffice Module sw (master)  1
cfgitems.cxx
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 #include <basic/sbxvar.hxx>
21 
22 #include <svx/svxids.hrc>
23 #include <editeng/svxenum.hxx>
24 
25 #include <viewopt.hxx>
26 #include <swtypes.hxx>
27 #include <cmdid.h>
28 #include <prtopt.hxx>
29 #include <cfgitems.hxx>
30 #include <crstate.hxx>
31 
32 
35 {
37  bTab =
38  bSpace =
40  bSoftHyphen =
42  bManualBreak = true;
43 };
44 
45 // Item for the Settings dialog, page document view
48 {
49  bParagraphEnd = rVOpt.IsParagraph(true);
50  bTab = rVOpt.IsTab(true);
51  bSpace = rVOpt.IsBlank(true);
53  bSoftHyphen = rVOpt.IsSoftHyph();
54  bCharHiddenText = rVOpt.IsShowHiddenChar(true);
55  bManualBreak = rVOpt.IsLineBreak(true);
56 }
57 
59 {
60  return new SwDocDisplayItem( *this );
61 }
62 
63 bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
64 {
65  assert(SfxPoolItem::operator==(rAttr));
66 
67  const SwDocDisplayItem& rItem = static_cast<const SwDocDisplayItem&>(rAttr);
68 
69  return ( bParagraphEnd == rItem.bParagraphEnd &&
70  bTab == rItem.bTab &&
71  bSpace == rItem.bSpace &&
73  bSoftHyphen == rItem.bSoftHyphen &&
75  bManualBreak == rItem.bManualBreak );
76 }
77 
79 {
80  rVOpt.SetParagraph (bParagraphEnd );
81  rVOpt.SetTab (bTab );
82  rVOpt.SetBlank (bSpace );
84  rVOpt.SetSoftHyph (bSoftHyphen );
86  rVOpt.SetLineBreak (bManualBreak );
87 }
88 
91 {
92  m_bVertRuler =
94  m_bCrosshair =
96  m_bTable =
97  m_bGraphic =
98  m_bDrawing =
99  m_bFieldName =
100  m_bNotes = false;
101  m_bShowInlineTooltips = true;
103  m_bShowHiddenPara = false;
104 }
105 
108 {
109  m_bVertRuler = rVOpt.IsViewVRuler(true);
111  m_bCrosshair = rVOpt.IsCrossHair();
113  m_bTable = rVOpt.IsTable();
114  m_bGraphic = rVOpt.IsGraphic();
115  m_bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
116  m_bFieldName = rVOpt.IsFieldName();
117  m_bNotes = rVOpt.IsPostIts();
121 }
122 
124 {
125  return new SwElemItem( *this );
126 }
127 
128 bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
129 {
130  assert(SfxPoolItem::operator==(rAttr));
131 
132  const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
133 
134  return ( m_bVertRuler == rItem.m_bVertRuler &&
136  m_bCrosshair == rItem.m_bCrosshair &&
137  m_bSmoothScroll == rItem.m_bSmoothScroll &&
138  m_bTable == rItem.m_bTable &&
139  m_bGraphic == rItem.m_bGraphic &&
140  m_bDrawing == rItem.m_bDrawing &&
141  m_bFieldName == rItem.m_bFieldName &&
142  m_bNotes == rItem.m_bNotes &&
146 }
147 
149 {
150  rVOpt.SetViewVRuler(m_bVertRuler );
152  rVOpt.SetCrossHair(m_bCrosshair );
154  rVOpt.SetTable (m_bTable );
155  rVOpt.SetGraphic (m_bGraphic );
156  rVOpt.SetDraw (m_bDrawing );
157  rVOpt.SetControl (m_bDrawing );
158  rVOpt.SetFieldName (m_bFieldName );
159  rVOpt.SetPostIts (m_bNotes );
163 }
164 
165 // CTOR for empty Item
168 {
169 }
170 
171 // CTOR from SwPrintOptions
174 {
175  SwPrintData::operator=(rPrtData);
176 }
177 
179 {
180  return new SwAddPrinterItem( *this );
181 }
182 
183 bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
184 {
185  assert(SfxPoolItem::operator==(rAttr));
186 
187  const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
188 
189  return SwPrintData::operator==(rItem);
190 }
191 
192 // Item for Settings dialog, ShadowCursorPage
195  eMode( FILL_TAB )
196  ,bOn( false )
197 {
198 }
199 
202  eMode( rVOpt.GetShdwCursorFillMode() )
203  ,bOn( rVOpt.IsShadowCursor() )
204 
205 {
206 }
207 
209 {
210  return new SwShadowCursorItem( *this );
211 }
212 
214 {
215  return SfxPoolItem::operator==(rCmp) &&
216  IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
217  GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
218 }
219 
221 {
222  rVOpt.SetShadowCursor( bOn );
223  rVOpt.SetShdwCursorFillMode( eMode );
224 }
225 
226 #ifdef DBG_UTIL
228 {
229  return new SwTestItem( *this );
230 }
231 
232 bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
233 {
234  assert(SfxPoolItem::operator==(rAttr));
235 
236  const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
237 
238  return ( bTest1==rItem.bTest1&&
239  bTest2==rItem.bTest2&&
240  bTest3==rItem.bTest3&&
241  bTest4==rItem.bTest4&&
242  bTest5==rItem.bTest5&&
243  bTest6==rItem.bTest6&&
244  bTest7==rItem.bTest7&&
245  bTest8==rItem.bTest8&&
246  bTest9==rItem.bTest9&&
247  bTest10==rItem.bTest10);
248 }
249 
250 #endif
251 
252 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:238
bool IsSmoothScroll() const
Definition: viewopt.hxx:364
bool bTest3
Definition: cfgitems.hxx:147
void SetSoftHyph(bool b)
Definition: viewopt.hxx:249
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:213
bool m_bDrawing
Definition: cfgitems.hxx:76
virtual bool operator==(const SfxPoolItem &) const =0
#define FN_PARAM_ELEM
Definition: cmdid.h:743
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:58
bool IsGraphic() const
Definition: viewopt.hxx:294
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:148
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:273
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:178
sal_uInt8 GetMode() const
Definition: cfgitems.hxx:129
bool IsPostIts() const
Definition: viewopt.hxx:256
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:128
bool m_bNotes
Definition: cfgitems.hxx:78
bool IsHardBlank() const
Definition: viewopt.hxx:224
bool bTest8
Definition: cfgitems.hxx:152
#define FN_PARAM_SHADOWCURSOR
Definition: cmdid.h:781
void SetHardBlank(bool b)
Definition: viewopt.hxx:226
bool IsShowHiddenPara() const
Definition: viewopt.hxx:358
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:741
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:286
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:183
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:227
#define FN_PARAM_DOCDISP
Definition: cmdid.h:742
bool IsFieldName() const
Definition: viewopt.hxx:252
void SetParagraph(bool b)
Definition: viewopt.hxx:232
default, fill with tabs
Definition: crstate.hxx:30
bool m_bShowHiddenPara
Definition: cfgitems.hxx:81
bool bTest7
Definition: cfgitems.hxx:151
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:361
bool bTest1
Definition: cfgitems.hxx:145
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:218
bool m_bTable
Definition: cfgitems.hxx:74
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:367
bool IsDraw() const
Definition: viewopt.hxx:309
bool IsCrossHair() const
Definition: viewopt.hxx:346
void SetDraw(bool b)
Definition: viewopt.hxx:311
bool m_bVertRuler
Definition: cfgitems.hxx:68
void SetTable(bool b)
Definition: viewopt.hxx:306
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:291
void SetTab(bool b)
Definition: viewopt.hxx:215
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:229
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:63
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:567
bool IsControl() const
Definition: viewopt.hxx:314
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:212
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:78
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:235
void SetGraphic(bool b)
Definition: viewopt.hxx:296
bool m_bShowInlineTooltips
Definition: cfgitems.hxx:79
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:123
bool IsTable() const
Definition: viewopt.hxx:304
void SetFieldName(bool b)
Definition: viewopt.hxx:253
void SetCrossHair(bool b)
Definition: viewopt.hxx:348
bool bTest6
Definition: cfgitems.hxx:150
bool m_bGraphic
Definition: cfgitems.hxx:75
bool bTest10
Definition: cfgitems.hxx:154
bool IsVRulerRight() const
Definition: viewopt.hxx:588
SwPrintData & operator=(SwPrintData const &)=default
bool m_bSmoothScroll
Definition: cfgitems.hxx:70
bool m_bFieldHiddenText
Definition: cfgitems.hxx:80
bool bCharHiddenText
Definition: cfgitems.hxx:51
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:271
bool m_bFieldName
Definition: cfgitems.hxx:77
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:208
void SetShdwCursorFillMode(sal_uInt8 nMode)
Definition: viewopt.hxx:600
void SetPostIts(bool b)
Definition: viewopt.hxx:258
bool bTest5
Definition: cfgitems.hxx:149
bool IsOn() const
Definition: cfgitems.hxx:130
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:220
void SetVRulerRight(bool b)
Definition: viewopt.hxx:590
void SetShadowCursor(bool b)
Definition: viewopt.hxx:584
bool bTest4
Definition: cfgitems.hxx:148
bool bNonbreakingSpace
Definition: cfgitems.hxx:49
bool IsSoftHyph() const
Definition: viewopt.hxx:247
bool operator==(const SwPrintData &rData) const
Definition: printdata.hxx:103
void SetViewVRuler(bool b)
Definition: viewopt.hxx:578
void SetControl(bool b)
Definition: viewopt.hxx:316
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:282
bool IsShowHiddenField() const
Definition: viewopt.hxx:289
bool m_bCrosshair
Definition: cfgitems.hxx:72
bool m_bVertRulerRight
Definition: cfgitems.hxx:69
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:232
bool bTest9
Definition: cfgitems.hxx:153
bool bTest2
Definition: cfgitems.hxx:146
void SetBlank(bool b)
Definition: viewopt.hxx:221