make ValueTransfer easier to understand
[LibreOffice.git] / include / svx / optgrid.hxx
blob1b86834ee8c87bb49e74f241f358147cc5cd9049
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 <svx/svxdllapi.h>
25 namespace weld { class CheckButton; }
26 namespace weld { class MetricSpinButton; }
27 namespace weld { class SpinButton; }
28 namespace weld { class ToggleButton; }
29 namespace weld { class Widget; }
31 class SVX_DLLPUBLIC SvxOptionsGrid
33 protected:
34 sal_uInt32 nFldDrawX;
35 sal_uInt32 nFldDivisionX;
36 sal_uInt32 nFldDrawY;
37 sal_uInt32 nFldDivisionY;
38 sal_uInt32 nFldSnapX;
39 sal_uInt32 nFldSnapY;
40 bool bUseGridsnap:1;
41 bool bSynchronize:1;
42 bool bGridVisible:1;
43 bool bEqualGrid: 1;
45 public:
46 SvxOptionsGrid();
48 void SetFieldDrawX( sal_uInt32 nSet){nFldDrawX = nSet;}
49 void SetFieldDivisionX(sal_uInt32 nSet){nFldDivisionX = nSet;}
50 void SetFieldDrawY ( sal_uInt32 nSet){nFldDrawY = nSet;}
51 void SetFieldDivisionY(sal_uInt32 nSet){nFldDivisionY = nSet;}
52 void SetFieldSnapX( sal_uInt32 nSet){nFldSnapX = nSet;}
53 void SetFieldSnapY ( sal_uInt32 nSet){nFldSnapY = nSet;}
54 void SetUseGridSnap( bool bSet ) {bUseGridsnap = bSet;}
55 void SetSynchronize( bool bSet ) {bSynchronize = bSet;}
56 void SetGridVisible( bool bSet ) {bGridVisible = bSet;}
57 void SetEqualGrid( bool bSet ) {bEqualGrid = bSet;}
59 sal_uInt32 GetFieldDrawX( ) const { return nFldDrawX; }
60 sal_uInt32 GetFieldDivisionX() const { return nFldDivisionX;}
61 sal_uInt32 GetFieldDrawY ( ) const { return nFldDrawY; }
62 sal_uInt32 GetFieldDivisionY() const { return nFldDivisionY;}
63 sal_uInt32 GetFieldSnapX( ) const { return nFldSnapX; }
64 sal_uInt32 GetFieldSnapY ( ) const { return nFldSnapY; }
65 bool GetUseGridSnap( ) const { return bUseGridsnap; }
66 bool GetSynchronize( ) const { return bSynchronize; }
67 bool GetGridVisible( ) const { return bGridVisible; }
68 bool GetEqualGrid() const { return bEqualGrid; }
71 class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
73 // #i9076#
74 friend class SvxGridTabPage;
76 public:
77 SvxGridItem( sal_uInt16 _nWhich) : SfxPoolItem(_nWhich){};
79 virtual SvxGridItem* Clone( SfxItemPool *pPool = nullptr ) const override;
80 virtual bool operator==( const SfxPoolItem& ) const override;
82 virtual bool GetPresentation( SfxItemPresentation ePres,
83 MapUnit eCoreMetric,
84 MapUnit ePresMetric,
85 OUString &rText, const IntlWrapper& ) const override;
89 class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
91 public:
92 SvxGridTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
93 virtual ~SvxGridTabPage() override;
95 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
97 virtual bool FillItemSet( SfxItemSet* rSet ) override;
98 virtual void Reset( const SfxItemSet* rSet ) override;
100 virtual void ActivatePage( const SfxItemSet& rSet ) override;
101 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
103 private:
104 bool bAttrModified;
106 std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
107 std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
108 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
109 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
110 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
111 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
112 std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
113 protected:
114 //these controls are used in draw and impress
115 std::unique_ptr<weld::Widget> m_xSnapFrames;
116 std::unique_ptr<weld::CheckButton> m_xCbxSnapHelplines;
117 std::unique_ptr<weld::CheckButton> m_xCbxSnapBorder;
118 std::unique_ptr<weld::CheckButton> m_xCbxSnapFrame;
119 std::unique_ptr<weld::CheckButton> m_xCbxSnapPoints;
120 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldSnapArea;
121 std::unique_ptr<weld::CheckButton> m_xCbxOrtho;
122 std::unique_ptr<weld::CheckButton> m_xCbxBigOrtho;
123 std::unique_ptr<weld::CheckButton> m_xCbxRotate;
124 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle;
125 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
127 DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
128 private:
129 DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
130 DECL_DLLPRIVATE_LINK(ChangeGridsnapHdl_Impl, weld::Toggleable&, void);
131 DECL_DLLPRIVATE_LINK(ChangeDivisionHdl_Impl, weld::SpinButton&, void);
134 #endif
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */