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  bVertRuler =
94  bCrosshair =
96  bTable =
97  bGraphic =
98  bDrawing =
99  bFieldName =
100  bNotes = false;
101  bShowInlineTooltips = true;
103  bShowHiddenPara = false;
104 }
105 
108 {
109  bVertRuler = rVOpt.IsViewVRuler(true);
110  bVertRulerRight = rVOpt.IsVRulerRight();
111  bCrosshair = rVOpt.IsCrossHair();
112  bSmoothScroll = rVOpt.IsSmoothScroll();
113  bTable = rVOpt.IsTable();
114  bGraphic = rVOpt.IsGraphic();
115  bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
116  bFieldName = rVOpt.IsFieldName();
117  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 ( bVertRuler == rItem.bVertRuler &&
136  bCrosshair == rItem.bCrosshair &&
137  bSmoothScroll == rItem.bSmoothScroll &&
138  bTable == rItem.bTable &&
139  bGraphic == rItem.bGraphic &&
140  bDrawing == rItem.bDrawing &&
141  bFieldName == rItem.bFieldName &&
142  bNotes == rItem.bNotes &&
146 }
147 
149 {
150  rVOpt.SetViewVRuler(bVertRuler );
152  rVOpt.SetCrossHair(bCrosshair );
154  rVOpt.SetTable (bTable );
155  rVOpt.SetGraphic (bGraphic );
156  rVOpt.SetDraw (bDrawing );
157  rVOpt.SetControl (bDrawing );
158  rVOpt.SetFieldName (bFieldName );
159  rVOpt.SetPostIts (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 IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
216  GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
217 }
218 
220 {
221  rVOpt.SetShadowCursor( bOn );
222  rVOpt.SetShdwCursorFillMode( eMode );
223 }
224 
225 #ifdef DBG_UTIL
227 {
228  return new SwTestItem( *this );
229 }
230 
231 bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
232 {
233  assert(SfxPoolItem::operator==(rAttr));
234 
235  const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
236 
237  return ( bTest1==rItem.bTest1&&
238  bTest2==rItem.bTest2&&
239  bTest3==rItem.bTest3&&
240  bTest4==rItem.bTest4&&
241  bTest5==rItem.bTest5&&
242  bTest6==rItem.bTest6&&
243  bTest7==rItem.bTest7&&
244  bTest8==rItem.bTest8&&
245  bTest9==rItem.bTest9&&
246  bTest10==rItem.bTest10);
247 }
248 
249 #endif
250 
251 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:237
bool IsSmoothScroll() const
Definition: viewopt.hxx:357
bool bTest3
Definition: cfgitems.hxx:148
void SetSoftHyph(bool b)
Definition: viewopt.hxx:248
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:213
bool bGraphic
Definition: cfgitems.hxx:76
#define FN_PARAM_ELEM
Definition: cmdid.h:737
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:58
bool IsGraphic() const
Definition: viewopt.hxx:287
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:148
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:266
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:178
sal_uInt8 GetMode() const
Definition: cfgitems.hxx:130
bool IsPostIts() const
Definition: viewopt.hxx:255
bool bShowHiddenPara
Definition: cfgitems.hxx:82
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:128
bool IsHardBlank() const
Definition: viewopt.hxx:223
bool bTest8
Definition: cfgitems.hxx:153
#define FN_PARAM_SHADOWCURSOR
Definition: cmdid.h:775
void SetHardBlank(bool b)
Definition: viewopt.hxx:225
bool IsShowHiddenPara() const
Definition: viewopt.hxx:351
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:735
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:279
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:183
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:226
#define FN_PARAM_DOCDISP
Definition: cmdid.h:736
bool IsFieldName() const
Definition: viewopt.hxx:251
void SetParagraph(bool b)
Definition: viewopt.hxx:231
default, fill with tabs
Definition: crstate.hxx:28
bool bTest7
Definition: cfgitems.hxx:152
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:354
bool bTest1
Definition: cfgitems.hxx:146
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:217
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:360
bool IsDraw() const
Definition: viewopt.hxx:302
bool IsCrossHair() const
Definition: viewopt.hxx:339
void SetDraw(bool b)
Definition: viewopt.hxx:304
bool bFieldHiddenText
Definition: cfgitems.hxx:81
bool bSmoothScroll
Definition: cfgitems.hxx:71
void SetTable(bool b)
Definition: viewopt.hxx:299
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:284
void SetTab(bool b)
Definition: viewopt.hxx:214
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:228
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:63
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:560
bool bVertRuler
Definition: cfgitems.hxx:69
bool IsControl() const
Definition: viewopt.hxx:307
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:211
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:78
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:234
void SetGraphic(bool b)
Definition: viewopt.hxx:289
bool bCrosshair
Definition: cfgitems.hxx:73
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:123
bool IsTable() const
Definition: viewopt.hxx:297
void SetFieldName(bool b)
Definition: viewopt.hxx:252
void SetCrossHair(bool b)
Definition: viewopt.hxx:341
bool bTest6
Definition: cfgitems.hxx:151
bool bFieldName
Definition: cfgitems.hxx:78
bool bTest10
Definition: cfgitems.hxx:155
bool IsVRulerRight() const
Definition: viewopt.hxx:581
bool bDrawing
Definition: cfgitems.hxx:77
SwPrintData & operator=(SwPrintData const &)=default
bool bTable
Definition: cfgitems.hxx:75
bool bCharHiddenText
Definition: cfgitems.hxx:52
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:264
bool bNotes
Definition: cfgitems.hxx:79
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:208
void SetShdwCursorFillMode(sal_uInt8 nMode)
Definition: viewopt.hxx:593
void SetPostIts(bool b)
Definition: viewopt.hxx:257
bool bVertRulerRight
Definition: cfgitems.hxx:70
bool bTest5
Definition: cfgitems.hxx:150
bool IsOn() const
Definition: cfgitems.hxx:131
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:219
void SetVRulerRight(bool b)
Definition: viewopt.hxx:583
void SetShadowCursor(bool b)
Definition: viewopt.hxx:577
bool bTest4
Definition: cfgitems.hxx:149
bool bNonbreakingSpace
Definition: cfgitems.hxx:50
bool IsSoftHyph() const
Definition: viewopt.hxx:246
bool operator==(const SwPrintData &rData) const
Definition: printdata.hxx:103
void SetViewVRuler(bool b)
Definition: viewopt.hxx:571
void SetControl(bool b)
Definition: viewopt.hxx:309
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:275
bool IsShowHiddenField() const
Definition: viewopt.hxx:282
bool bShowInlineTooltips
Definition: cfgitems.hxx:80
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:231
bool bTest9
Definition: cfgitems.hxx:154
bool bTest2
Definition: cfgitems.hxx:147
void SetBlank(bool b)
Definition: viewopt.hxx:220