Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/sw/source/uibase/config/cfgitems.cxx
Line
Count
Source (jump to first uncovered line)
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
26
SwDocDisplayItem::SwDocDisplayItem() :
27
0
        SfxPoolItem(FN_PARAM_DOCDISP)
28
0
{
29
0
    m_bParagraphEnd       =
30
0
    m_bTab                =
31
0
    m_bSpace              =
32
0
    m_bNonbreakingSpace   =
33
0
    m_bSoftHyphen         =
34
0
    m_bCharHiddenText     =
35
0
    m_bBookmarks          =
36
0
    m_bManualBreak        = true;
37
0
    m_bTextBoundaries     = true;
38
0
    m_bTextBoundariesFull = false; // default is crop
39
0
    m_bSectionBoundaries  = true;
40
0
    m_bTableBoundaries    = true;
41
0
    m_xDefaultAnchor      = 1; //FLY_TO_CHAR
42
0
};
43
44
// Item for the Settings dialog, page document view
45
SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt ) :
46
0
            SfxPoolItem( FN_PARAM_DOCDISP )
47
0
{
48
0
    m_bParagraphEnd       = rVOpt.IsParagraph(true);
49
0
    m_bTab                = rVOpt.IsTab(true);
50
0
    m_bSpace              = rVOpt.IsBlank(true);
51
0
    m_bNonbreakingSpace   = rVOpt.IsHardBlank();
52
0
    m_bSoftHyphen         = rVOpt.IsSoftHyph();
53
0
    m_bCharHiddenText     = rVOpt.IsShowHiddenChar(true);
54
0
    m_bBookmarks          = rVOpt.IsShowBookmarks(true);
55
0
    m_bManualBreak        = rVOpt.IsLineBreak(true);
56
0
    m_bTextBoundaries     = rVOpt.IsTextBoundaries();
57
0
    m_bTextBoundariesFull = rVOpt.IsTextBoundariesFull();
58
0
    m_bSectionBoundaries  = rVOpt.IsSectionBoundaries();
59
0
    m_bTableBoundaries    = rVOpt.IsTableBoundaries();
60
0
    m_xDefaultAnchor      = rVOpt.GetDefaultAnchor();
61
0
}
62
63
SwDocDisplayItem* SwDocDisplayItem::Clone( SfxItemPool*  ) const
64
0
{
65
0
    return new SwDocDisplayItem( *this );
66
0
}
67
68
bool SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
69
0
{
70
0
    assert(SfxPoolItem::operator==(rAttr));
71
72
0
    const SwDocDisplayItem& rItem = static_cast<const SwDocDisplayItem&>(rAttr);
73
74
0
    return (  m_bParagraphEnd         == rItem.m_bParagraphEnd       &&
75
0
              m_bTab                  == rItem.m_bTab                &&
76
0
              m_bSpace                == rItem.m_bSpace              &&
77
0
              m_bNonbreakingSpace     == rItem.m_bNonbreakingSpace   &&
78
0
              m_bSoftHyphen           == rItem.m_bSoftHyphen         &&
79
0
              m_bCharHiddenText       == rItem.m_bCharHiddenText     &&
80
0
              m_bBookmarks            == rItem.m_bBookmarks          &&
81
0
              m_bManualBreak          == rItem.m_bManualBreak        &&
82
0
              m_bTextBoundaries       == rItem.m_bTextBoundaries     &&
83
0
              m_bTextBoundariesFull   == rItem.m_bTextBoundariesFull &&
84
0
              m_bSectionBoundaries    == rItem.m_bSectionBoundaries  &&
85
0
              m_bTableBoundaries      == rItem.m_bTableBoundaries    &&
86
0
              m_xDefaultAnchor        == rItem.m_xDefaultAnchor);
87
0
}
88
89
void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const
90
0
{
91
0
    rVOpt.SetParagraph  (m_bParagraphEnd      );
92
0
    rVOpt.SetTab        (m_bTab               );
93
0
    rVOpt.SetBlank      (m_bSpace             );
94
0
    rVOpt.SetHardBlank  (m_bNonbreakingSpace  );
95
0
    rVOpt.SetSoftHyph   (m_bSoftHyphen        );
96
0
    rVOpt.SetShowHiddenChar(m_bCharHiddenText );
97
0
    rVOpt.SetShowBookmarks(m_bBookmarks       );
98
0
    rVOpt.SetLineBreak  (m_bManualBreak       );
99
0
    rVOpt.SetTextBoundaries(m_bTextBoundaries);
100
0
    rVOpt.SetTextBoundariesFull(m_bTextBoundariesFull);
101
0
    rVOpt.SetSectionBoundaries(m_bSectionBoundaries);
102
0
    rVOpt.SetTableBoundaries(m_bTableBoundaries);
103
0
    rVOpt.SetDefaultAnchor( m_xDefaultAnchor  );
104
0
}
105
106
SwElemItem::SwElemItem() :
107
0
    SfxPoolItem(FN_PARAM_ELEM)
108
0
{
109
0
    m_bVertRuler     =
110
0
    m_bVertRulerRight=
111
0
    m_bCrosshair     =
112
0
    m_bSmoothScroll  =
113
0
    m_bTable              =
114
0
    m_bGraphic            =
115
0
    m_bDrawing            =
116
0
    m_bNotes              = false;
117
0
    m_bShowInlineTooltips = true;
118
0
    m_bShowOutlineContentVisibilityButton =
119
0
    m_bTreatSubOutlineLevelsAsContent =
120
0
    m_bShowChangesInMargin =
121
0
    m_bFieldHiddenText =
122
0
    m_bShowHiddenPara  = false;
123
0
    m_bDefaultZoom = true;
124
0
    m_eDefaultZoomType = SvxZoomType::PERCENT;
125
0
    m_nDefaultZoomValue = 100;
126
0
}
127
128
SwElemItem::SwElemItem(const SwViewOption& rVOpt) :
129
0
            SfxPoolItem( FN_PARAM_ELEM )
130
0
{
131
0
    m_bVertRuler      = rVOpt.IsViewVRuler(true);
132
0
    m_bVertRulerRight = rVOpt.IsVRulerRight();
133
0
    m_bCrosshair      = rVOpt.IsCrossHair();
134
0
    m_bSmoothScroll   = rVOpt.IsSmoothScroll();
135
0
    m_bTable              = rVOpt.IsTable();
136
0
    m_bGraphic            = rVOpt.IsGraphic();
137
0
    m_bDrawing            = rVOpt.IsDraw() && rVOpt.IsControl();
138
0
    m_bNotes              = rVOpt.IsPostIts();
139
0
    m_bShowInlineTooltips = rVOpt.IsShowInlineTooltips();
140
0
    m_bShowOutlineContentVisibilityButton = rVOpt.IsShowOutlineContentVisibilityButton();
141
0
    m_bTreatSubOutlineLevelsAsContent = rVOpt.IsTreatSubOutlineLevelsAsContent();
142
0
    m_bShowChangesInMargin = rVOpt.IsShowChangesInMargin();
143
0
    m_bFieldHiddenText = rVOpt.IsShowHiddenField();
144
0
    m_bShowHiddenPara  = rVOpt.IsShowHiddenPara();
145
0
    m_bDefaultZoom = false;
146
0
    m_eDefaultZoomType = rVOpt.GetZoomType();
147
0
    m_nDefaultZoomValue = rVOpt.GetZoom();
148
0
}
149
150
SwElemItem* SwElemItem::Clone( SfxItemPool* ) const
151
0
{
152
0
    return new SwElemItem( *this );
153
0
}
154
155
bool SwElemItem::operator==( const SfxPoolItem& rAttr ) const
156
0
{
157
0
    assert(SfxPoolItem::operator==(rAttr));
158
159
0
    const SwElemItem& rItem = static_cast<const SwElemItem&>(rAttr);
160
161
0
    return (    m_bVertRuler      == rItem.m_bVertRuler     &&
162
0
                m_bVertRulerRight == rItem.m_bVertRulerRight&&
163
0
                m_bCrosshair      == rItem.m_bCrosshair     &&
164
0
                m_bSmoothScroll   == rItem.m_bSmoothScroll  &&
165
0
                m_bTable                == rItem.m_bTable              &&
166
0
                m_bGraphic              == rItem.m_bGraphic            &&
167
0
                m_bDrawing              == rItem.m_bDrawing            &&
168
0
                m_bNotes                == rItem.m_bNotes              &&
169
0
                m_bShowInlineTooltips   == rItem.m_bShowInlineTooltips &&
170
0
                m_bShowOutlineContentVisibilityButton == rItem.m_bShowOutlineContentVisibilityButton &&
171
0
                m_bTreatSubOutlineLevelsAsContent == rItem.m_bTreatSubOutlineLevelsAsContent &&
172
0
                m_bShowChangesInMargin  == rItem.m_bShowChangesInMargin &&
173
0
                m_bFieldHiddenText == rItem.m_bFieldHiddenText &&
174
0
                m_bShowHiddenPara  == rItem.m_bShowHiddenPara &&
175
0
                m_bDefaultZoom == rItem.m_bDefaultZoom &&
176
0
                m_eDefaultZoomType == rItem.m_eDefaultZoomType &&
177
0
                m_nDefaultZoomValue == rItem.m_nDefaultZoomValue );
178
0
}
179
180
void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const
181
0
{
182
0
    rVOpt.SetViewVRuler(m_bVertRuler    );
183
0
    rVOpt.SetVRulerRight(m_bVertRulerRight );
184
0
    rVOpt.SetCrossHair(m_bCrosshair     );
185
0
    rVOpt.SetSmoothScroll(m_bSmoothScroll);
186
0
    rVOpt.SetTable      (m_bTable             );
187
0
    rVOpt.SetGraphic    (m_bGraphic           );
188
0
    rVOpt.SetDraw       (m_bDrawing           );
189
0
    rVOpt.SetControl    (m_bDrawing           );
190
0
    rVOpt.SetPostIts    (m_bNotes             );
191
0
    rVOpt.SetShowInlineTooltips( m_bShowInlineTooltips );
192
0
    rVOpt.SetShowOutlineContentVisibilityButton(m_bShowOutlineContentVisibilityButton);
193
0
    rVOpt.SetTreatSubOutlineLevelsAsContent(m_bTreatSubOutlineLevelsAsContent);
194
0
    rVOpt.SetShowChangesInMargin( m_bShowChangesInMargin );
195
0
    rVOpt.SetShowHiddenField(m_bFieldHiddenText );
196
0
    rVOpt.SetShowHiddenPara(m_bShowHiddenPara );
197
0
    if (!m_bDefaultZoom)
198
0
    {
199
0
        rVOpt.SetZoomType(m_eDefaultZoomType);
200
0
        if (m_eDefaultZoomType == SvxZoomType::PERCENT)
201
0
            rVOpt.SetZoom(m_nDefaultZoomValue);
202
0
    }
203
0
}
204
205
// CTOR for empty Item
206
SwAddPrinterItem::SwAddPrinterItem():
207
0
                SfxPoolItem(FN_PARAM_ADDPRINTER)
208
0
{
209
0
}
210
211
// CTOR from SwPrintOptions
212
SwAddPrinterItem::SwAddPrinterItem( const SwPrintData& rPrtData ) :
213
7.11k
    SfxPoolItem(FN_PARAM_ADDPRINTER)
214
7.11k
{
215
7.11k
    SwPrintData::operator=(rPrtData);
216
7.11k
}
217
218
SwAddPrinterItem* SwAddPrinterItem::Clone( SfxItemPool* ) const
219
14.7k
{
220
14.7k
    return new SwAddPrinterItem( *this );
221
14.7k
}
222
223
bool SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
224
0
{
225
0
    assert(SfxPoolItem::operator==(rAttr));
226
227
0
    const SwAddPrinterItem& rItem = static_cast<const SwAddPrinterItem&>(rAttr);
228
229
0
    return  SwPrintData::operator==(rItem);
230
0
}
231
232
// Item for Settings dialog, ShadowCursorPage
233
SwShadowCursorItem::SwShadowCursorItem()
234
0
    : SfxPoolItem( FN_PARAM_SHADOWCURSOR ),
235
0
    m_eMode( SwFillMode::Tab )
236
0
    ,m_bOn( false )
237
0
{
238
0
}
239
240
SwShadowCursorItem::SwShadowCursorItem( const SwViewOption& rVOpt )
241
0
    : SfxPoolItem( FN_PARAM_SHADOWCURSOR ),
242
0
    m_eMode( rVOpt.GetShdwCursorFillMode() )
243
0
    ,m_bOn( rVOpt.IsShadowCursor() )
244
245
0
{
246
0
}
247
248
SwShadowCursorItem* SwShadowCursorItem::Clone( SfxItemPool* ) const
249
0
{
250
0
    return new SwShadowCursorItem( *this );
251
0
}
252
253
bool SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const
254
0
{
255
0
    return SfxPoolItem::operator==(rCmp) &&
256
0
        IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
257
0
        GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
258
0
}
259
260
void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const
261
0
{
262
0
    rVOpt.SetShadowCursor( m_bOn );
263
0
    rVOpt.SetShdwCursorFillMode( m_eMode );
264
0
}
265
266
SwFmtAidsAutoComplItem::SwFmtAidsAutoComplItem()
267
0
    : SfxPoolItem(FN_PARAM_FMT_AIDS_AUTOCOMPL)
268
0
    , m_bEncloseWithCharactersOn(true)
269
0
{
270
0
}
271
272
SwFmtAidsAutoComplItem::SwFmtAidsAutoComplItem(const SwViewOption& rVOpt)
273
0
    : SfxPoolItem(FN_PARAM_FMT_AIDS_AUTOCOMPL)
274
0
    , m_bEncloseWithCharactersOn(rVOpt.IsEncloseWithCharactersOn())
275
0
{
276
0
}
277
278
SwFmtAidsAutoComplItem* SwFmtAidsAutoComplItem::Clone(SfxItemPool*) const
279
0
{
280
0
    return new SwFmtAidsAutoComplItem(*this);
281
0
}
282
283
bool SwFmtAidsAutoComplItem::operator==(const SfxPoolItem& rCmp) const
284
0
{
285
0
    assert(SfxPoolItem::operator==(rCmp));
286
0
    const SwFmtAidsAutoComplItem& rItem = static_cast<const SwFmtAidsAutoComplItem&>(rCmp);
287
288
0
    return m_bEncloseWithCharactersOn == rItem.m_bEncloseWithCharactersOn;
289
0
}
290
291
#ifdef DBG_UTIL
292
SwTestItem* SwTestItem::Clone( SfxItemPool* ) const
293
{
294
    return new SwTestItem( *this );
295
}
296
297
bool SwTestItem::operator==( const SfxPoolItem& rAttr ) const
298
{
299
    assert(SfxPoolItem::operator==(rAttr));
300
301
    const SwTestItem& rItem = static_cast<const SwTestItem&>( rAttr);
302
303
    return ( m_bTest1==rItem.m_bTest1&&
304
             m_bTest2==rItem.m_bTest2&&
305
             m_bTest3==rItem.m_bTest3&&
306
             m_bTest4==rItem.m_bTest4&&
307
             m_bTest5==rItem.m_bTest5&&
308
             m_bTest6==rItem.m_bTest6&&
309
             m_bTest7==rItem.m_bTest7&&
310
             m_bTest8==rItem.m_bTest8&&
311
             m_bTest9==rItem.m_bTest9&&
312
             m_bTest10==rItem.m_bTest10);
313
}
314
315
#endif
316
317
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */