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  m_bTab =
31  m_bSpace =
35  m_bBookmarks =
36  m_bManualBreak = true;
37 };
38 
39 // Item for the Settings dialog, page document view
42 {
43  m_bParagraphEnd = rVOpt.IsParagraph(true);
44  m_bTab = rVOpt.IsTab(true);
45  m_bSpace = rVOpt.IsBlank(true);
47  m_bSoftHyphen = rVOpt.IsSoftHyph();
48  m_bCharHiddenText = rVOpt.IsShowHiddenChar(true);
49  m_bBookmarks = rVOpt.IsShowBookmarks(true);
50  m_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 ( m_bParagraphEnd == rItem.m_bParagraphEnd &&
65  m_bTab == rItem.m_bTab &&
66  m_bSpace == rItem.m_bSpace &&
68  m_bSoftHyphen == rItem.m_bSoftHyphen &&
70  m_bBookmarks == rItem.m_bBookmarks &&
71  m_bManualBreak == rItem.m_bManualBreak );
72 }
73 
75 {
77  rVOpt.SetTab (m_bTab );
78  rVOpt.SetBlank (m_bSpace );
80  rVOpt.SetSoftHyph (m_bSoftHyphen );
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;
101  m_bShowHiddenPara = false;
102 }
103 
106 {
107  m_bVertRuler = rVOpt.IsViewVRuler(true);
109  m_bCrosshair = rVOpt.IsCrossHair();
111  m_bTable = rVOpt.IsTable();
112  m_bGraphic = rVOpt.IsGraphic();
113  m_bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
114  m_bNotes = rVOpt.IsPostIts();
120 }
121 
123 {
124  return new SwElemItem( *this );
125 }
126 
127 bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
128 {
129  assert(SfxPoolItem::operator==(rAttr));
130 
131  const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
132 
133  return ( m_bVertRuler == rItem.m_bVertRuler &&
135  m_bCrosshair == rItem.m_bCrosshair &&
136  m_bSmoothScroll == rItem.m_bSmoothScroll &&
137  m_bTable == rItem.m_bTable &&
138  m_bGraphic == rItem.m_bGraphic &&
139  m_bDrawing == rItem.m_bDrawing &&
140  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.SetPostIts (m_bNotes );
164 }
165 
166 // CTOR for empty Item
169 {
170 }
171 
172 // CTOR from SwPrintOptions
175 {
176  SwPrintData::operator=(rPrtData);
177 }
178 
180 {
181  return new SwAddPrinterItem( *this );
182 }
183 
184 bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
185 {
186  assert(SfxPoolItem::operator==(rAttr));
187 
188  const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
189 
190  return SwPrintData::operator==(rItem);
191 }
192 
193 // Item for Settings dialog, ShadowCursorPage
196  m_eMode( SwFillMode::Tab )
197  ,m_bOn( false )
198 {
199 }
200 
203  m_eMode( rVOpt.GetShdwCursorFillMode() )
204  ,m_bOn( rVOpt.IsShadowCursor() )
205 
206 {
207 }
208 
210 {
211  return new SwShadowCursorItem( *this );
212 }
213 
215 {
216  return SfxPoolItem::operator==(rCmp) &&
217  IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
218  GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
219 }
220 
222 {
223  rVOpt.SetShadowCursor( m_bOn );
225 }
226 
227 #ifdef DBG_UTIL
229 {
230  return new SwTestItem( *this );
231 }
232 
233 bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
234 {
235  assert(SfxPoolItem::operator==(rAttr));
236 
237  const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
238 
239  return ( m_bTest1==rItem.m_bTest1&&
240  m_bTest2==rItem.m_bTest2&&
241  m_bTest3==rItem.m_bTest3&&
242  m_bTest4==rItem.m_bTest4&&
243  m_bTest5==rItem.m_bTest5&&
244  m_bTest6==rItem.m_bTest6&&
245  m_bTest7==rItem.m_bTest7&&
246  m_bTest8==rItem.m_bTest8&&
247  m_bTest9==rItem.m_bTest9&&
248  m_bTest10==rItem.m_bTest10);
249 }
250 
251 #endif
252 
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:252
bool IsSmoothScroll() const
Definition: viewopt.hxx:389
void SetSoftHyph(bool b)
Definition: viewopt.hxx:263
bool m_bTest4
Definition: cfgitems.hxx:145
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:214
bool m_bDrawing
Definition: cfgitems.hxx:77
bool m_bTest7
Definition: cfgitems.hxx:148
virtual bool operator==(const SfxPoolItem &) const =0
#define FN_PARAM_ELEM
Definition: cmdid.h:765
bool IsGraphic() const
Definition: viewopt.hxx:319
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:148
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:287
bool IsPostIts() const
Definition: viewopt.hxx:270
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:127
virtual SwShadowCursorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:209
bool m_bNotes
Definition: cfgitems.hxx:78
bool IsHardBlank() const
Definition: viewopt.hxx:228
bool m_bCharHiddenText
Definition: cfgitems.hxx:51
#define FN_PARAM_SHADOWCURSOR
Definition: cmdid.h:803
void SetHardBlank(bool b)
Definition: viewopt.hxx:230
bool IsShowHiddenPara() const
Definition: viewopt.hxx:383
#define FN_PARAM_ADDPRINTER
Definition: cmdid.h:763
virtual SwAddPrinterItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:179
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:311
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:184
void SetShdwCursorFillMode(SwFillMode nMode)
Definition: viewopt.hxx:625
#define FN_PARAM_DOCDISP
Definition: cmdid.h:764
virtual SwElemItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:122
void SetShowOutlineContentVisibilityButton(bool b)
Definition: viewopt.hxx:304
void SetParagraph(bool b)
Definition: viewopt.hxx:236
Item for settings dialog, ShadowCursorPage.
Definition: cfgitems.hxx:114
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool m_bShowHiddenPara
Definition: cfgitems.hxx:83
SwFillMode
Definition: crstate.hxx:28
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:293
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:386
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:222
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
bool m_bTest8
Definition: cfgitems.hxx:149
bool m_bTable
Definition: cfgitems.hxx:75
SwFillMode GetMode() const
Definition: cfgitems.hxx:127
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:392
bool IsDraw() const
Definition: viewopt.hxx:334
bool IsCrossHair() const
Definition: viewopt.hxx:371
void SetDraw(bool b)
Definition: viewopt.hxx:336
bool m_bVertRuler
Definition: cfgitems.hxx:69
virtual SwTestItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:228
void SetTable(bool b)
Definition: viewopt.hxx:331
bool m_bTest6
Definition: cfgitems.hxx:147
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:316
void SetTab(bool b)
Definition: viewopt.hxx:219
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:291
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:233
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:58
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:592
virtual SwDocDisplayItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: cfgitems.cxx:53
bool IsControl() const
Definition: viewopt.hxx:339
bool m_bTest9
Definition: cfgitems.hxx:150
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:216
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:74
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:249
void SetGraphic(bool b)
Definition: viewopt.hxx:321
bool m_bShowInlineTooltips
Definition: cfgitems.hxx:79
bool IsTable() const
Definition: viewopt.hxx:329
void SetCrossHair(bool b)
Definition: viewopt.hxx:373
bool m_bShowChangesInMargin
Definition: cfgitems.hxx:81
bool m_bGraphic
Definition: cfgitems.hxx:76
bool m_bTest5
Definition: cfgitems.hxx:146
bool IsVRulerRight() const
Definition: viewopt.hxx:613
SwPrintData & operator=(SwPrintData const &)=default
bool m_bSmoothScroll
Definition: cfgitems.hxx:71
bool m_bFieldHiddenText
Definition: cfgitems.hxx:82
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:285
Item for settings dialog - document view.
Definition: cfgitems.hxx:41
bool m_bTest3
Definition: cfgitems.hxx:144
bool m_bTest10
Definition: cfgitems.hxx:151
void SetPostIts(bool b)
Definition: viewopt.hxx:272
bool IsOn() const
Definition: cfgitems.hxx:128
void FillViewOptions(SwViewOption &rVOpt) const
Definition: cfgitems.cxx:221
void SetVRulerRight(bool b)
Definition: viewopt.hxx:615
void SetShadowCursor(bool b)
Definition: viewopt.hxx:609
bool m_bTest2
Definition: cfgitems.hxx:143
bool IsSoftHyph() const
Definition: viewopt.hxx:261
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:243
bool operator==(const SwPrintData &rData) const
Definition: printdata.hxx:103
bool m_bParagraphEnd
Definition: cfgitems.hxx:46
void SetViewVRuler(bool b)
Definition: viewopt.hxx:603
void SetControl(bool b)
Definition: viewopt.hxx:341
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:307
bool IsShowHiddenField() const
Definition: viewopt.hxx:314
bool m_bShowOutlineContentVisibilityButton
Definition: cfgitems.hxx:80
bool m_bCrosshair
Definition: cfgitems.hxx:73
SwFillMode m_eMode
Definition: cfgitems.hxx:116
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:239
bool m_bVertRulerRight
Definition: cfgitems.hxx:70
virtual bool operator==(const SfxPoolItem &) const override
Definition: cfgitems.cxx:233
bool m_bNonbreakingSpace
Definition: cfgitems.hxx:49
bool m_bTest1
Definition: cfgitems.hxx:142
void SetBlank(bool b)
Definition: viewopt.hxx:225