1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <viewopt.hxx>
22 #include <cfgitems.hxx>
23 #include <crstate.hxx>
26 SwDocDisplayItem::SwDocDisplayItem() :
27 SfxPoolItem(FN_PARAM_DOCDISP
)
36 m_bManualBreak
= true;
37 m_xDefaultAnchor
= 1; //FLY_TO_CHAR
40 // Item for the Settings dialog, page document view
41 SwDocDisplayItem::SwDocDisplayItem(const SwViewOption
& rVOpt
) :
42 SfxPoolItem( FN_PARAM_DOCDISP
)
44 m_bParagraphEnd
= rVOpt
.IsParagraph(true);
45 m_bTab
= rVOpt
.IsTab(true);
46 m_bSpace
= rVOpt
.IsBlank(true);
47 m_bNonbreakingSpace
= rVOpt
.IsHardBlank();
48 m_bSoftHyphen
= rVOpt
.IsSoftHyph();
49 m_bCharHiddenText
= rVOpt
.IsShowHiddenChar(true);
50 m_bBookmarks
= rVOpt
.IsShowBookmarks(true);
51 m_bManualBreak
= rVOpt
.IsLineBreak(true);
52 m_xDefaultAnchor
= rVOpt
.GetDefaultAnchor();
55 SwDocDisplayItem
* SwDocDisplayItem::Clone( SfxItemPool
* ) const
57 return new SwDocDisplayItem( *this );
60 bool SwDocDisplayItem::operator==( const SfxPoolItem
& rAttr
) const
62 assert(SfxPoolItem::operator==(rAttr
));
64 const SwDocDisplayItem
& rItem
= static_cast<const SwDocDisplayItem
&>(rAttr
);
66 return ( m_bParagraphEnd
== rItem
.m_bParagraphEnd
&&
67 m_bTab
== rItem
.m_bTab
&&
68 m_bSpace
== rItem
.m_bSpace
&&
69 m_bNonbreakingSpace
== rItem
.m_bNonbreakingSpace
&&
70 m_bSoftHyphen
== rItem
.m_bSoftHyphen
&&
71 m_bCharHiddenText
== rItem
.m_bCharHiddenText
&&
72 m_bBookmarks
== rItem
.m_bBookmarks
&&
73 m_bManualBreak
== rItem
.m_bManualBreak
&&
74 m_xDefaultAnchor
== rItem
.m_xDefaultAnchor
);
77 void SwDocDisplayItem::FillViewOptions( SwViewOption
& rVOpt
) const
79 rVOpt
.SetParagraph (m_bParagraphEnd
);
80 rVOpt
.SetTab (m_bTab
);
81 rVOpt
.SetBlank (m_bSpace
);
82 rVOpt
.SetHardBlank (m_bNonbreakingSpace
);
83 rVOpt
.SetSoftHyph (m_bSoftHyphen
);
84 rVOpt
.SetShowHiddenChar(m_bCharHiddenText
);
85 rVOpt
.SetShowBookmarks(m_bBookmarks
);
86 rVOpt
.SetLineBreak (m_bManualBreak
);
87 rVOpt
.SetDefaultAnchor( m_xDefaultAnchor
);
90 SwElemItem::SwElemItem() :
91 SfxPoolItem(FN_PARAM_ELEM
)
101 m_bShowInlineTooltips
= true;
102 m_bShowOutlineContentVisibilityButton
=
103 m_bTreatSubOutlineLevelsAsContent
=
104 m_bShowChangesInMargin
=
106 m_bShowHiddenPara
= false;
109 SwElemItem::SwElemItem(const SwViewOption
& rVOpt
) :
110 SfxPoolItem( FN_PARAM_ELEM
)
112 m_bVertRuler
= rVOpt
.IsViewVRuler(true);
113 m_bVertRulerRight
= rVOpt
.IsVRulerRight();
114 m_bCrosshair
= rVOpt
.IsCrossHair();
115 m_bSmoothScroll
= rVOpt
.IsSmoothScroll();
116 m_bTable
= rVOpt
.IsTable();
117 m_bGraphic
= rVOpt
.IsGraphic();
118 m_bDrawing
= rVOpt
.IsDraw() && rVOpt
.IsControl();
119 m_bNotes
= rVOpt
.IsPostIts();
120 m_bShowInlineTooltips
= rVOpt
.IsShowInlineTooltips();
121 m_bShowOutlineContentVisibilityButton
= rVOpt
.IsShowOutlineContentVisibilityButton();
122 m_bTreatSubOutlineLevelsAsContent
= rVOpt
.IsTreatSubOutlineLevelsAsContent();
123 m_bShowChangesInMargin
= rVOpt
.IsShowChangesInMargin();
124 m_bFieldHiddenText
= rVOpt
.IsShowHiddenField();
125 m_bShowHiddenPara
= rVOpt
.IsShowHiddenPara();
128 SwElemItem
* SwElemItem::Clone( SfxItemPool
* ) const
130 return new SwElemItem( *this );
133 bool SwElemItem::operator==( const SfxPoolItem
& rAttr
) const
135 assert(SfxPoolItem::operator==(rAttr
));
137 const SwElemItem
& rItem
= static_cast<const SwElemItem
&>(rAttr
);
139 return ( m_bVertRuler
== rItem
.m_bVertRuler
&&
140 m_bVertRulerRight
== rItem
.m_bVertRulerRight
&&
141 m_bCrosshair
== rItem
.m_bCrosshair
&&
142 m_bSmoothScroll
== rItem
.m_bSmoothScroll
&&
143 m_bTable
== rItem
.m_bTable
&&
144 m_bGraphic
== rItem
.m_bGraphic
&&
145 m_bDrawing
== rItem
.m_bDrawing
&&
146 m_bNotes
== rItem
.m_bNotes
&&
147 m_bShowInlineTooltips
== rItem
.m_bShowInlineTooltips
&&
148 m_bShowOutlineContentVisibilityButton
== rItem
.m_bShowOutlineContentVisibilityButton
&&
149 m_bTreatSubOutlineLevelsAsContent
== rItem
.m_bTreatSubOutlineLevelsAsContent
&&
150 m_bShowChangesInMargin
== rItem
.m_bShowChangesInMargin
&&
151 m_bFieldHiddenText
== rItem
.m_bFieldHiddenText
&&
152 m_bShowHiddenPara
== rItem
.m_bShowHiddenPara
);
155 void SwElemItem::FillViewOptions( SwViewOption
& rVOpt
) const
157 rVOpt
.SetViewVRuler(m_bVertRuler
);
158 rVOpt
.SetVRulerRight(m_bVertRulerRight
);
159 rVOpt
.SetCrossHair(m_bCrosshair
);
160 rVOpt
.SetSmoothScroll(m_bSmoothScroll
);
161 rVOpt
.SetTable (m_bTable
);
162 rVOpt
.SetGraphic (m_bGraphic
);
163 rVOpt
.SetDraw (m_bDrawing
);
164 rVOpt
.SetControl (m_bDrawing
);
165 rVOpt
.SetPostIts (m_bNotes
);
166 rVOpt
.SetShowInlineTooltips( m_bShowInlineTooltips
);
167 rVOpt
.SetShowOutlineContentVisibilityButton(m_bShowOutlineContentVisibilityButton
);
168 rVOpt
.SetTreatSubOutlineLevelsAsContent(m_bTreatSubOutlineLevelsAsContent
);
169 rVOpt
.SetShowChangesInMargin( m_bShowChangesInMargin
);
170 rVOpt
.SetShowHiddenField(m_bFieldHiddenText
);
171 rVOpt
.SetShowHiddenPara(m_bShowHiddenPara
);
174 // CTOR for empty Item
175 SwAddPrinterItem::SwAddPrinterItem():
176 SfxPoolItem(FN_PARAM_ADDPRINTER
)
180 // CTOR from SwPrintOptions
181 SwAddPrinterItem::SwAddPrinterItem( const SwPrintData
& rPrtData
) :
182 SfxPoolItem(FN_PARAM_ADDPRINTER
)
184 SwPrintData::operator=(rPrtData
);
187 SwAddPrinterItem
* SwAddPrinterItem::Clone( SfxItemPool
* ) const
189 return new SwAddPrinterItem( *this );
192 bool SwAddPrinterItem::operator==( const SfxPoolItem
& rAttr
) const
194 assert(SfxPoolItem::operator==(rAttr
));
196 const SwAddPrinterItem
& rItem
= static_cast<const SwAddPrinterItem
&>(rAttr
);
198 return SwPrintData::operator==(rItem
);
201 // Item for Settings dialog, ShadowCursorPage
202 SwShadowCursorItem::SwShadowCursorItem()
203 : SfxPoolItem( FN_PARAM_SHADOWCURSOR
),
204 m_eMode( SwFillMode::Tab
)
209 SwShadowCursorItem::SwShadowCursorItem( const SwViewOption
& rVOpt
)
210 : SfxPoolItem( FN_PARAM_SHADOWCURSOR
),
211 m_eMode( rVOpt
.GetShdwCursorFillMode() )
212 ,m_bOn( rVOpt
.IsShadowCursor() )
217 SwShadowCursorItem
* SwShadowCursorItem::Clone( SfxItemPool
* ) const
219 return new SwShadowCursorItem( *this );
222 bool SwShadowCursorItem::operator==( const SfxPoolItem
& rCmp
) const
224 return SfxPoolItem::operator==(rCmp
) &&
225 IsOn() == static_cast<const SwShadowCursorItem
&>(rCmp
).IsOn() &&
226 GetMode() == static_cast<const SwShadowCursorItem
&>(rCmp
).GetMode();
229 void SwShadowCursorItem::FillViewOptions( SwViewOption
& rVOpt
) const
231 rVOpt
.SetShadowCursor( m_bOn
);
232 rVOpt
.SetShdwCursorFillMode( m_eMode
);
236 SwTestItem
* SwTestItem::Clone( SfxItemPool
* ) const
238 return new SwTestItem( *this );
241 bool SwTestItem::operator==( const SfxPoolItem
& rAttr
) const
243 assert(SfxPoolItem::operator==(rAttr
));
245 const SwTestItem
& rItem
= static_cast<const SwTestItem
&>( rAttr
);
247 return ( m_bTest1
==rItem
.m_bTest1
&&
248 m_bTest2
==rItem
.m_bTest2
&&
249 m_bTest3
==rItem
.m_bTest3
&&
250 m_bTest4
==rItem
.m_bTest4
&&
251 m_bTest5
==rItem
.m_bTest5
&&
252 m_bTest6
==rItem
.m_bTest6
&&
253 m_bTest7
==rItem
.m_bTest7
&&
254 m_bTest8
==rItem
.m_bTest8
&&
255 m_bTest9
==rItem
.m_bTest9
&&
256 m_bTest10
==rItem
.m_bTest10
);
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */