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  bBookmarks =
36  bManualBreak = true;
37 };
38 
39 // Item for the Settings dialog, page document view
42 {
43  bParagraphEnd = rVOpt.IsParagraph(true);
44  bTab = rVOpt.IsTab(true);
45  bSpace = rVOpt.IsBlank(true);
47  bSoftHyphen = rVOpt.IsSoftHyph();
48  bCharHiddenText = rVOpt.IsShowHiddenChar(true);
49  bBookmarks = rVOpt.IsShowBookmarks(true);
50  bManualBreak = rVOpt.IsLineBreak(true);
51 }
52 
54 {
55  return new SwDocDisplayItem( *this );
56 }
57 
58 bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
59 {
60  assert(SfxPoolItem::operator==(rAttr));
61 
62  const SwDocDisplayItem& rItem = static_cast<const SwDocDisplayItem&>(rAttr);
63 
64  return ( bParagraphEnd == rItem.bParagraphEnd &&
65  bTab == rItem.bTab &&
66  bSpace == rItem.bSpace &&
68  bSoftHyphen == rItem.bSoftHyphen &&
70  bBookmarks == rItem.bBookmarks &&
71  bManualBreak == rItem.bManualBreak );
72 }
73 
75 {
76  rVOpt.SetParagraph (bParagraphEnd );
77  rVOpt.SetTab (bTab );
78  rVOpt.SetBlank (bSpace );
80  rVOpt.SetSoftHyph (bSoftHyphen );
83  rVOpt.SetLineBreak (bManualBreak );
84 }
85 
88 {
89  m_bVertRuler =
91  m_bCrosshair =
93  m_bTable =
94  m_bGraphic =
95  m_bDrawing =
96  m_bNotes = false;
97  m_bShowInlineTooltips = true;
99  m_bShowHiddenPara = false;
100 }
101 
104 {
105  m_bVertRuler = rVOpt.IsViewVRuler(true);
107  m_bCrosshair = rVOpt.IsCrossHair();
109  m_bTable = rVOpt.IsTable();
110  m_bGraphic = rVOpt.IsGraphic();
111  m_bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
112  m_bNotes = rVOpt.IsPostIts();
116 }
117 
119 {
120  return new SwElemItem( *this );
121 }
122 
123 bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
124 {
125  assert(SfxPoolItem::operator==(rAttr));
126 
127  const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
128 
129  return ( m_bVertRuler == rItem.m_bVertRuler &&
131  m_bCrosshair == rItem.m_bCrosshair &&
132  m_bSmoothScroll == rItem.m_bSmoothScroll &&
133  m_bTable == rItem.m_bTable &&
134  m_bGraphic == rItem.m_bGraphic &&
135  m_bDrawing == rItem.m_bDrawing &&
136  m_bNotes == rItem.m_bNotes &&
140 }
141 
143 {
144  rVOpt.SetViewVRuler(m_bVertRuler );
146  rVOpt.SetCrossHair(m_bCrosshair );
148  rVOpt.SetTable (m_bTable );
149  rVOpt.SetGraphic (m_bGraphic );
150  rVOpt.SetDraw (m_bDrawing );
151  rVOpt.SetControl (m_bDrawing );
152  rVOpt.SetPostIts (m_bNotes );
156 }
157 
158 // CTOR for empty Item
161 {
162 }
163 
164 // CTOR from SwPrintOptions
167 {
168  SwPrintData::operator=(rPrtData);
169 }
170 
172 {
173  return new SwAddPrinterItem( *this );
174 }
175 
176 bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
177 {
178  assert(SfxPoolItem::operator==(rAttr));
179 
180  const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
181 
182  return SwPrintData::operator==(rItem);
183 }
184 
185 // Item for Settings dialog, ShadowCursorPage
188  eMode( SwFillMode::Tab )
189  ,bOn( false )
190 {
191 }
192 
195  eMode( rVOpt.GetShdwCursorFillMode() )
196  ,bOn( rVOpt.IsShadowCursor() )
197 
198 {
199 }
200 
202 {
203  return new SwShadowCursorItem( *this );
204 }
205 
207 {
208  return SfxPoolItem::operator==(rCmp) &&
209  IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
210  GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
211 }
212 
214 {
215  rVOpt.SetShadowCursor( bOn );
216  rVOpt.SetShdwCursorFillMode( eMode );
217 }
218 
219 #ifdef DBG_UTIL
221 {
222  return new SwTestItem( *this );
223 }
224 
225 bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
226 {
227  assert(SfxPoolItem::operator==(rAttr));
228 
229  const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
230 
231  return ( m_bTest1==rItem.m_bTest1&&
232  m_bTest2==rItem.m_bTest2&&
233  m_bTest3==rItem.m_bTest3&&
234  m_bTest4==rItem.m_bTest4&&
235  m_bTest5==rItem.m_bTest5&&
236  m_bTest6==rItem.m_bTest6&&
237  m_bTest7==rItem.m_bTest7&&
238  m_bTest8==rItem.m_bTest8&&
239  m_bTest9==rItem.m_bTest9&&
240  m_bTest10==rItem.m_bTest10);
241 }
242 
243 #endif
244 
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:250
bool IsSmoothScroll() const
Definition: viewopt.hxx:376
void SetSoftHyph(bool b)
Definition: viewopt.hxx:261
bool m_bTest4
Definition: cfgitems.hxx:144
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:206
bool m_bDrawing
Definition: cfgitems.hxx:78
bool m_bTest7
Definition: cfgitems.hxx:147
virtual bool operator==(const SfxPoolItem &) const =0
#define FN_PARAM_ELEM
Definition: cmdid.h:757
bool IsGraphic() const
Definition: viewopt.hxx:306
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:142
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:285
bool IsPostIts() const
Definition: viewopt.hxx:268
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:123
virtual SwShadowCursorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:201
bool m_bNotes
Definition: cfgitems.hxx:79
bool IsHardBlank() const
Definition: viewopt.hxx:226
#define FN_PARAM_SHADOWCURSOR
Definition: cmdid.h:795
void SetHardBlank(bool b)
Definition: viewopt.hxx:228
bool IsShowHiddenPara() const
Definition: viewopt.hxx:370
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:755
virtual SwAddPrinterItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:171
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:298
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:176
void SetShdwCursorFillMode(SwFillMode nMode)
Definition: viewopt.hxx:612
#define FN_PARAM_DOCDISP
Definition: cmdid.h:756
virtual SwElemItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:118
void SetParagraph(bool b)
Definition: viewopt.hxx:234
bool m_bShowHiddenPara
Definition: cfgitems.hxx:82
Mode eMode
SwFillMode
Definition: crstate.hxx:28
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:373
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:220
bool m_bTest8
Definition: cfgitems.hxx:148
bool m_bTable
Definition: cfgitems.hxx:76
SwFillMode eMode
Definition: cfgitems.hxx:115
SwFillMode GetMode() const
Definition: cfgitems.hxx:126
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:379
bool IsDraw() const
Definition: viewopt.hxx:321
bool IsCrossHair() const
Definition: viewopt.hxx:358
void SetDraw(bool b)
Definition: viewopt.hxx:323
bool m_bVertRuler
Definition: cfgitems.hxx:70
virtual SwTestItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:220
void SetTable(bool b)
Definition: viewopt.hxx:318
bool m_bTest6
Definition: cfgitems.hxx:146
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:303
void SetTab(bool b)
Definition: viewopt.hxx:217
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:231
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:58
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:579
virtual SwDocDisplayItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:53
bool IsControl() const
Definition: viewopt.hxx:326
bool m_bTest9
Definition: cfgitems.hxx:149
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:214
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:74
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:247
void SetGraphic(bool b)
Definition: viewopt.hxx:308
bool m_bShowInlineTooltips
Definition: cfgitems.hxx:80
bool IsTable() const
Definition: viewopt.hxx:316
void SetCrossHair(bool b)
Definition: viewopt.hxx:360
bool m_bGraphic
Definition: cfgitems.hxx:77
bool m_bTest5
Definition: cfgitems.hxx:145
bool IsVRulerRight() const
Definition: viewopt.hxx:600
SwPrintData & operator=(SwPrintData const &)=default
bool m_bSmoothScroll
Definition: cfgitems.hxx:72
bool m_bFieldHiddenText
Definition: cfgitems.hxx:81
bool bCharHiddenText
Definition: cfgitems.hxx:52
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:283
bool m_bTest3
Definition: cfgitems.hxx:143
bool m_bTest10
Definition: cfgitems.hxx:150
void SetPostIts(bool b)
Definition: viewopt.hxx:270
bool IsOn() const
Definition: cfgitems.hxx:127
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:213
void SetVRulerRight(bool b)
Definition: viewopt.hxx:602
void SetShadowCursor(bool b)
Definition: viewopt.hxx:596
bool bNonbreakingSpace
Definition: cfgitems.hxx:50
bool m_bTest2
Definition: cfgitems.hxx:142
bool IsSoftHyph() const
Definition: viewopt.hxx:259
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:241
bool operator==(const SwPrintData &rData) const
Definition: printdata.hxx:103
void SetViewVRuler(bool b)
Definition: viewopt.hxx:590
void SetControl(bool b)
Definition: viewopt.hxx:328
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:294
bool IsShowHiddenField() const
Definition: viewopt.hxx:301
bool m_bCrosshair
Definition: cfgitems.hxx:74
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:237
bool m_bVertRulerRight
Definition: cfgitems.hxx:71
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:225
bool m_bTest1
Definition: cfgitems.hxx:141
void SetBlank(bool b)
Definition: viewopt.hxx:223