Fix typo in code
[LibreOffice.git] / include / svx / optgrid.hxx
blob7cdcdf8399f3d3219030959dff2382bde8219026
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SVX_OPTGRID_HXX
20 #define INCLUDED_SVX_OPTGRID_HXX
22 #include <sfx2/tabdlg.hxx>
23 #include <sfx2/htmlmode.hxx>
24 #include <svx/svxdllapi.h>
26 namespace weld { class CheckButton; }
27 namespace weld { class MetricSpinButton; }
28 namespace weld { class SpinButton; }
29 namespace weld { class ToggleButton; }
30 namespace weld { class Widget; }
32 class SVX_DLLPUBLIC SvxOptionsGrid
34 protected:
35 sal_uInt32 nFldDrawX;
36 sal_uInt32 nFldDivisionX;
37 sal_uInt32 nFldDrawY;
38 sal_uInt32 nFldDivisionY;
39 bool bUseGridsnap:1;
40 bool bSynchronize:1;
41 bool bGridVisible:1;
42 bool bEqualGrid: 1;
44 public:
45 SvxOptionsGrid();
47 void SetFieldDrawX( sal_uInt32 nSet){nFldDrawX = nSet;}
48 void SetFieldDivisionX(sal_uInt32 nSet){nFldDivisionX = nSet;}
49 void SetFieldDrawY ( sal_uInt32 nSet){nFldDrawY = nSet;}
50 void SetFieldDivisionY(sal_uInt32 nSet){nFldDivisionY = nSet;}
51 void SetUseGridSnap( bool bSet ) {bUseGridsnap = bSet;}
52 void SetSynchronize( bool bSet ) {bSynchronize = bSet;}
53 void SetGridVisible( bool bSet ) {bGridVisible = bSet;}
54 void SetEqualGrid( bool bSet ) {bEqualGrid = bSet;}
56 sal_uInt32 GetFieldDrawX( ) const { return nFldDrawX; }
57 sal_uInt32 GetFieldDivisionX() const { return nFldDivisionX;}
58 sal_uInt32 GetFieldDrawY ( ) const { return nFldDrawY; }
59 sal_uInt32 GetFieldDivisionY() const { return nFldDivisionY;}
60 bool GetUseGridSnap( ) const { return bUseGridsnap; }
61 bool GetSynchronize( ) const { return bSynchronize; }
62 bool GetGridVisible( ) const { return bGridVisible; }
63 bool GetEqualGrid() const { return bEqualGrid; }
66 class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
68 // #i9076#
69 friend class SvxGridTabPage;
71 public:
72 SvxGridItem( TypedWhichId<SvxGridItem> _nWhich) : SfxPoolItem(_nWhich){};
74 virtual SvxGridItem* Clone( SfxItemPool *pPool = nullptr ) const override;
75 virtual bool operator==( const SfxPoolItem& ) const override;
77 virtual bool GetPresentation( SfxItemPresentation ePres,
78 MapUnit eCoreMetric,
79 MapUnit ePresMetric,
80 OUString &rText, const IntlWrapper& ) const override;
84 class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
86 public:
87 SvxGridTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
88 virtual ~SvxGridTabPage() override;
90 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
92 virtual OUString GetAllStrings() override;
94 virtual bool FillItemSet( SfxItemSet* rSet ) override;
95 virtual void Reset( const SfxItemSet* rSet ) override;
97 virtual void ActivatePage( const SfxItemSet& rSet ) override;
98 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
100 private:
101 enum ModuleMode
103 WRITER_MODE = 0,
104 CALC_MODE = 1,
105 IMPRESS_MODE = 2,
106 DRAW_MODE = 3,
107 HTML_MODE = 4
109 bool bAttrModified;
110 ModuleMode m_Emode;
112 std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
113 std::unique_ptr<weld::Widget> m_xCbxUseGridsnapImg;
114 std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
115 std::unique_ptr<weld::Widget> m_xCbxGridVisibleImg;
116 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
117 std::unique_ptr<weld::Widget> m_xMtrFldDrawXImg;
118 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
119 std::unique_ptr<weld::Widget> m_xMtrFldDrawYImg;
120 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
121 std::unique_ptr<weld::Widget> m_xNumFldDivisionXImg;
122 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
123 std::unique_ptr<weld::Widget> m_xNumFldDivisionYImg;
124 std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
125 std::unique_ptr<weld::Widget> m_xCbxSynchronizeImg;
126 protected:
127 //these controls are used in draw and impress
128 std::unique_ptr<weld::Widget> m_xSnapFrames;
129 std::unique_ptr<weld::CheckButton> m_xCbxSnapHelplines;
130 std::unique_ptr<weld::Widget> m_xCbxSnapHelplinesImg;
131 std::unique_ptr<weld::CheckButton> m_xCbxSnapBorder;
132 std::unique_ptr<weld::Widget> m_xCbxSnapBorderImg;
133 std::unique_ptr<weld::CheckButton> m_xCbxSnapFrame;
134 std::unique_ptr<weld::Widget> m_xCbxSnapFrameImg;
135 std::unique_ptr<weld::CheckButton> m_xCbxSnapPoints;
136 std::unique_ptr<weld::Widget> m_xCbxSnapPointsImg;
137 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldSnapArea;
138 std::unique_ptr<weld::Widget> m_xMtrFldSnapAreaImg;
139 std::unique_ptr<weld::CheckButton> m_xCbxOrtho;
140 std::unique_ptr<weld::Widget> m_xCbxOrthoImg;
141 std::unique_ptr<weld::CheckButton> m_xCbxBigOrtho;
142 std::unique_ptr<weld::Widget> m_xCbxBigOrthoImg;
143 std::unique_ptr<weld::CheckButton> m_xCbxRotate;
144 std::unique_ptr<weld::Widget> m_xCbxRotateImg;
145 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle;
146 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
147 std::unique_ptr<weld::Widget> m_xMtrFldBezAngleImg;
149 bool IsDrawMode() const { return m_Emode == DRAW_MODE; }
151 DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
152 private:
153 DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
154 DECL_DLLPRIVATE_LINK(ChangeGridsnapHdl_Impl, weld::Toggleable&, void);
155 DECL_DLLPRIVATE_LINK(ChangeDivisionHdl_Impl, weld::SpinButton&, void);
158 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */