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 <viewopt.hxx>
21 #include <cmdid.h>
22 #include <cfgitems.hxx>
23 #include <crstate.hxx>
24 
25 
28 {
30  bTab =
31  bSpace =
33  bSoftHyphen =
35  bManualBreak = true;
36 };
37 
38 // Item for the Settings dialog, page document view
41 {
42  bParagraphEnd = rVOpt.IsParagraph(true);
43  bTab = rVOpt.IsTab(true);
44  bSpace = rVOpt.IsBlank(true);
46  bSoftHyphen = rVOpt.IsSoftHyph();
47  bCharHiddenText = rVOpt.IsShowHiddenChar(true);
48  bManualBreak = rVOpt.IsLineBreak(true);
49 }
50 
52 {
53  return new SwDocDisplayItem( *this );
54 }
55 
56 bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
57 {
58  assert(SfxPoolItem::operator==(rAttr));
59 
60  const SwDocDisplayItem& rItem = static_cast<const SwDocDisplayItem&>(rAttr);
61 
62  return ( bParagraphEnd == rItem.bParagraphEnd &&
63  bTab == rItem.bTab &&
64  bSpace == rItem.bSpace &&
66  bSoftHyphen == rItem.bSoftHyphen &&
68  bManualBreak == rItem.bManualBreak );
69 }
70 
72 {
73  rVOpt.SetParagraph (bParagraphEnd );
74  rVOpt.SetTab (bTab );
75  rVOpt.SetBlank (bSpace );
77  rVOpt.SetSoftHyph (bSoftHyphen );
79  rVOpt.SetLineBreak (bManualBreak );
80 }
81 
84 {
85  m_bVertRuler =
87  m_bCrosshair =
89  m_bTable =
90  m_bGraphic =
91  m_bDrawing =
92  m_bNotes = false;
93  m_bShowInlineTooltips = true;
95  m_bShowHiddenPara = false;
96 }
97 
100 {
101  m_bVertRuler = rVOpt.IsViewVRuler(true);
103  m_bCrosshair = rVOpt.IsCrossHair();
105  m_bTable = rVOpt.IsTable();
106  m_bGraphic = rVOpt.IsGraphic();
107  m_bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
108  m_bNotes = rVOpt.IsPostIts();
112 }
113 
115 {
116  return new SwElemItem( *this );
117 }
118 
119 bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
120 {
121  assert(SfxPoolItem::operator==(rAttr));
122 
123  const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
124 
125  return ( m_bVertRuler == rItem.m_bVertRuler &&
127  m_bCrosshair == rItem.m_bCrosshair &&
128  m_bSmoothScroll == rItem.m_bSmoothScroll &&
129  m_bTable == rItem.m_bTable &&
130  m_bGraphic == rItem.m_bGraphic &&
131  m_bDrawing == rItem.m_bDrawing &&
132  m_bNotes == rItem.m_bNotes &&
136 }
137 
139 {
140  rVOpt.SetViewVRuler(m_bVertRuler );
142  rVOpt.SetCrossHair(m_bCrosshair );
144  rVOpt.SetTable (m_bTable );
145  rVOpt.SetGraphic (m_bGraphic );
146  rVOpt.SetDraw (m_bDrawing );
147  rVOpt.SetControl (m_bDrawing );
148  rVOpt.SetPostIts (m_bNotes );
152 }
153 
154 // CTOR for empty Item
157 {
158 }
159 
160 // CTOR from SwPrintOptions
163 {
164  SwPrintData::operator=(rPrtData);
165 }
166 
168 {
169  return new SwAddPrinterItem( *this );
170 }
171 
172 bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
173 {
174  assert(SfxPoolItem::operator==(rAttr));
175 
176  const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
177 
178  return SwPrintData::operator==(rItem);
179 }
180 
181 // Item for Settings dialog, ShadowCursorPage
184  eMode( FILL_TAB )
185  ,bOn( false )
186 {
187 }
188 
191  eMode( rVOpt.GetShdwCursorFillMode() )
192  ,bOn( rVOpt.IsShadowCursor() )
193 
194 {
195 }
196 
198 {
199  return new SwShadowCursorItem( *this );
200 }
201 
203 {
204  return SfxPoolItem::operator==(rCmp) &&
205  IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
206  GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
207 }
208 
210 {
211  rVOpt.SetShadowCursor( bOn );
212  rVOpt.SetShdwCursorFillMode( eMode );
213 }
214 
215 #ifdef DBG_UTIL
217 {
218  return new SwTestItem( *this );
219 }
220 
221 bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
222 {
223  assert(SfxPoolItem::operator==(rAttr));
224 
225  const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
226 
227  return ( m_bTest1==rItem.m_bTest1&&
228  m_bTest2==rItem.m_bTest2&&
229  m_bTest3==rItem.m_bTest3&&
230  m_bTest4==rItem.m_bTest4&&
231  m_bTest5==rItem.m_bTest5&&
232  m_bTest6==rItem.m_bTest6&&
233  m_bTest7==rItem.m_bTest7&&
234  m_bTest8==rItem.m_bTest8&&
235  m_bTest9==rItem.m_bTest9&&
236  m_bTest10==rItem.m_bTest10);
237 }
238 
239 #endif
240 
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:238
bool IsSmoothScroll() const
Definition: viewopt.hxx:364
void SetSoftHyph(bool b)
Definition: viewopt.hxx:249
bool m_bTest4
Definition: cfgitems.hxx:142
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:202
bool m_bDrawing
Definition: cfgitems.hxx:76
bool m_bTest7
Definition: cfgitems.hxx:145
virtual bool operator==(const SfxPoolItem &) const =0
#define FN_PARAM_ELEM
Definition: cmdid.h:752
bool IsGraphic() const
Definition: viewopt.hxx:294
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:138
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:273
sal_uInt8 GetMode() const
Definition: cfgitems.hxx:124
bool IsPostIts() const
Definition: viewopt.hxx:256
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:119
virtual SwShadowCursorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:197
bool m_bNotes
Definition: cfgitems.hxx:77
bool IsHardBlank() const
Definition: viewopt.hxx:224
#define FN_PARAM_SHADOWCURSOR
Definition: cmdid.h:790
void SetHardBlank(bool b)
Definition: viewopt.hxx:226
bool IsShowHiddenPara() const
Definition: viewopt.hxx:358
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:750
virtual SwAddPrinterItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:167
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:286
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:172
#define FN_PARAM_DOCDISP
Definition: cmdid.h:751
virtual SwElemItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:114
void SetParagraph(bool b)
Definition: viewopt.hxx:232
default, fill with tabs
Definition: crstate.hxx:30
bool m_bShowHiddenPara
Definition: cfgitems.hxx:80
Mode eMode
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:361
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:218
bool m_bTest8
Definition: cfgitems.hxx:146
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
virtual SwTestItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:216
void SetTable(bool b)
Definition: viewopt.hxx:306
bool m_bTest6
Definition: cfgitems.hxx:144
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:56
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:567
virtual SwDocDisplayItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:51
bool IsControl() const
Definition: viewopt.hxx:314
bool m_bTest9
Definition: cfgitems.hxx:147
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:212
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:71
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:235
void SetGraphic(bool b)
Definition: viewopt.hxx:296
bool m_bShowInlineTooltips
Definition: cfgitems.hxx:78
bool IsTable() const
Definition: viewopt.hxx:304
void SetCrossHair(bool b)
Definition: viewopt.hxx:348
bool m_bGraphic
Definition: cfgitems.hxx:75
bool m_bTest5
Definition: cfgitems.hxx:143
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:79
bool bCharHiddenText
Definition: cfgitems.hxx:51
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:271
bool m_bTest3
Definition: cfgitems.hxx:141
bool m_bTest10
Definition: cfgitems.hxx:148
void SetShdwCursorFillMode(sal_uInt8 nMode)
Definition: viewopt.hxx:600
void SetPostIts(bool b)
Definition: viewopt.hxx:258
bool IsOn() const
Definition: cfgitems.hxx:125
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:209
void SetVRulerRight(bool b)
Definition: viewopt.hxx:590
void SetShadowCursor(bool b)
Definition: viewopt.hxx:584
bool bNonbreakingSpace
Definition: cfgitems.hxx:49
bool m_bTest2
Definition: cfgitems.hxx:140
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:221
bool m_bTest1
Definition: cfgitems.hxx:139
void SetBlank(bool b)
Definition: viewopt.hxx:221