Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/optgrid.hxx
Line
Count
Source
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
#ifndef INCLUDED_SVX_OPTGRID_HXX
20
#define INCLUDED_SVX_OPTGRID_HXX
21
22
#include <sfx2/tabdlg.hxx>
23
#include <sfx2/htmlmode.hxx>
24
#include <svx/svxdllapi.h>
25
26
namespace weld
27
{
28
class CheckButton;
29
class MetricSpinButton;
30
class SpinButton;
31
class Toggleable;
32
class Widget;
33
}
34
35
class SVX_DLLPUBLIC SvxOptionsGrid
36
{
37
protected:
38
    sal_uInt32  m_nFldDrawX;
39
    sal_uInt32  m_nFldDivisionX;
40
    sal_uInt32  m_nFldDrawY;
41
    sal_uInt32  m_nFldDivisionY;
42
    bool        m_bUseGridsnap:1;
43
    bool        m_bSynchronize:1;
44
    bool        m_bGridVisible:1;
45
46
public:
47
    SvxOptionsGrid();
48
49
338
    void    SetFieldDrawX(    sal_uInt32 nSet){m_nFldDrawX      = nSet;}
50
412
    void    SetFieldDivisionX(sal_uInt32 nSet){m_nFldDivisionX  = nSet;}
51
348
    void    SetFieldDrawY   ( sal_uInt32 nSet){m_nFldDrawY      = nSet;}
52
389
    void    SetFieldDivisionY(sal_uInt32 nSet){m_nFldDivisionY  = nSet;}
53
368
    void    SetUseGridSnap( bool bSet ) {m_bUseGridsnap   = bSet;}
54
341
    void    SetSynchronize( bool bSet ) {m_bSynchronize   = bSet;}
55
333
    void    SetGridVisible( bool bSet ) {m_bGridVisible   = bSet;}
56
57
28.5k
    sal_uInt32  GetFieldDrawX(    ) const {  return m_nFldDrawX;    }
58
28.5k
    sal_uInt32  GetFieldDivisionX() const {  return m_nFldDivisionX;}
59
28.5k
    sal_uInt32  GetFieldDrawY   ( ) const {  return m_nFldDrawY;    }
60
28.5k
    sal_uInt32  GetFieldDivisionY() const {  return m_nFldDivisionY;}
61
9.51k
    bool        GetUseGridSnap( ) const {  return m_bUseGridsnap; }
62
5
    bool        GetSynchronize( ) const {  return m_bSynchronize; }
63
9.51k
    bool        GetGridVisible( ) const {  return m_bGridVisible; }
64
};
65
66
class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
67
{
68
    // #i9076#
69
    friend class SvxGridTabPage;
70
71
public:
72
    DECLARE_ITEM_TYPE_FUNCTION(SvxGridItem)
73
    SvxGridItem( TypedWhichId<SvxGridItem> _nWhich)
74
0
        : SfxPoolItem(_nWhich){};
75
76
    virtual SvxGridItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
77
    virtual bool            operator==( const SfxPoolItem& ) const override;
78
79
    virtual bool GetPresentation( SfxItemPresentation ePres,
80
                                  MapUnit eCoreMetric,
81
                                  MapUnit ePresMetric,
82
                                  OUString &rText, const IntlWrapper& ) const override;
83
84
};
85
86
class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
87
{
88
public:
89
    SvxGridTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
90
    virtual ~SvxGridTabPage() override;
91
92
    static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
93
94
    virtual OUString GetAllStrings() override;
95
96
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
97
    virtual void        Reset( const SfxItemSet* rSet ) override;
98
99
    virtual void        ActivatePage( const SfxItemSet& rSet ) override;
100
    virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
101
102
private:
103
    enum ModuleMode
104
    {
105
        WRITER_MODE = 0,
106
        CALC_MODE = 1,
107
        IMPRESS_MODE = 2,
108
        DRAW_MODE = 3,
109
        HTML_MODE = 4
110
    };
111
    bool                m_bAttrModified;
112
    ModuleMode          m_Emode;
113
114
    std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
115
    std::unique_ptr<weld::Widget> m_xCbxUseGridsnapImg;
116
    std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
117
    std::unique_ptr<weld::Widget> m_xCbxGridVisibleImg;
118
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
119
    std::unique_ptr<weld::Widget> m_xMtrFldDrawXImg;
120
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
121
    std::unique_ptr<weld::Widget> m_xMtrFldDrawYImg;
122
    std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
123
    std::unique_ptr<weld::Widget> m_xNumFldDivisionXImg;
124
    std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
125
    std::unique_ptr<weld::Widget> m_xNumFldDivisionYImg;
126
    std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
127
    std::unique_ptr<weld::Widget> m_xCbxSynchronizeImg;
128
protected:
129
    //these controls are used in draw and impress
130
    std::unique_ptr<weld::Widget> m_xSnapFrames;
131
    std::unique_ptr<weld::CheckButton> m_xCbxSnapHelplines;
132
    std::unique_ptr<weld::Widget> m_xCbxSnapHelplinesImg;
133
    std::unique_ptr<weld::CheckButton> m_xCbxSnapBorder;
134
    std::unique_ptr<weld::Widget> m_xCbxSnapBorderImg;
135
    std::unique_ptr<weld::CheckButton> m_xCbxSnapFrame;
136
    std::unique_ptr<weld::Widget> m_xCbxSnapFrameImg;
137
    std::unique_ptr<weld::CheckButton> m_xCbxSnapPoints;
138
    std::unique_ptr<weld::Widget> m_xCbxSnapPointsImg;
139
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldSnapArea;
140
    std::unique_ptr<weld::Widget> m_xMtrFldSnapAreaImg;
141
    std::unique_ptr<weld::CheckButton> m_xCbxOrtho;
142
    std::unique_ptr<weld::Widget> m_xCbxOrthoImg;
143
    std::unique_ptr<weld::CheckButton> m_xCbxBigOrtho;
144
    std::unique_ptr<weld::Widget> m_xCbxBigOrthoImg;
145
    std::unique_ptr<weld::CheckButton> m_xCbxRotate;
146
    std::unique_ptr<weld::Widget> m_xCbxRotateImg;
147
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle;
148
    std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
149
    std::unique_ptr<weld::Widget> m_xMtrFldBezAngleImg;
150
151
    // Writer-only baseline grid related items.
152
    std::unique_ptr<weld::Widget> m_xBaselineGrid;
153
    std::unique_ptr<weld::CheckButton> m_xCbxBaselineGridVisible;
154
    std::unique_ptr<weld::Widget> m_xCbxBaselineGridVisibleImg;
155
156
0
    bool IsDrawMode() const { return m_Emode == DRAW_MODE; }
157
158
    DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
159
private:
160
    DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
161
    DECL_DLLPRIVATE_LINK(ChangeGridsnapHdl_Impl, weld::Toggleable&, void);
162
    DECL_DLLPRIVATE_LINK(ChangeDivisionHdl_Impl, weld::SpinButton&, void);
163
};
164
165
#endif
166
167
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */