Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / optgrid.hxx
blobf69ab59bc96395ef0559bb0adca8a5219d7a4c83
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 <svl/eitem.hxx>
24 #include <vcl/group.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/field.hxx>
27 #include <svx/svxdllapi.h>
29 class SvxGridTabPage;
31 // class SvxOptionsGrid --------------------------------------------------
33 class SVX_DLLPUBLIC SvxOptionsGrid
35 protected:
36 sal_uInt32 nFldDrawX;
37 sal_uInt32 nFldDivisionX;
38 sal_uInt32 nFldDrawY;
39 sal_uInt32 nFldDivisionY;
40 sal_uInt32 nFldSnapX;
41 sal_uInt32 nFldSnapY;
42 bool bUseGridsnap:1;
43 bool bSynchronize:1;
44 bool bGridVisible:1;
45 bool bEqualGrid: 1;
47 public:
48 SvxOptionsGrid();
50 void SetFieldDrawX( sal_uInt32 nSet){nFldDrawX = nSet;}
51 void SetFieldDivisionX(sal_uInt32 nSet){nFldDivisionX = nSet;}
52 void SetFieldDrawY ( sal_uInt32 nSet){nFldDrawY = nSet;}
53 void SetFieldDivisionY(sal_uInt32 nSet){nFldDivisionY = nSet;}
54 void SetFieldSnapX( sal_uInt32 nSet){nFldSnapX = nSet;}
55 void SetFieldSnapY ( sal_uInt32 nSet){nFldSnapY = nSet;}
56 void SetUseGridSnap( bool bSet ) {bUseGridsnap = bSet;}
57 void SetSynchronize( bool bSet ) {bSynchronize = bSet;}
58 void SetGridVisible( bool bSet ) {bGridVisible = bSet;}
59 void SetEqualGrid( bool bSet ) {bEqualGrid = bSet;}
61 sal_uInt32 GetFieldDrawX( ) const { return nFldDrawX; }
62 sal_uInt32 GetFieldDivisionX() const { return nFldDivisionX;}
63 sal_uInt32 GetFieldDrawY ( ) const { return nFldDrawY; }
64 sal_uInt32 GetFieldDivisionY() const { return nFldDivisionY;}
65 sal_uInt32 GetFieldSnapX( ) const { return nFldSnapX; }
66 sal_uInt32 GetFieldSnapY ( ) const { return nFldSnapY; }
67 bool GetUseGridSnap( ) const { return bUseGridsnap; }
68 bool GetSynchronize( ) const { return bSynchronize; }
69 bool GetGridVisible( ) const { return bGridVisible; }
70 bool GetEqualGrid() const { return bEqualGrid; }
73 // class SvxGridItem -----------------------------------------------------
75 class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
77 // #i9076#
78 friend class SvxGridTabPage;
80 public:
81 SvxGridItem( sal_uInt16 _nWhich) : SfxPoolItem(_nWhich){};
82 SvxGridItem( const SvxGridItem& pTestItem );
84 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
85 virtual bool operator==( const SfxPoolItem& ) const override;
87 virtual bool GetPresentation( SfxItemPresentation ePres,
88 MapUnit eCoreMetric,
89 MapUnit ePresMetric,
90 OUString &rText, const IntlWrapper * = nullptr ) const override;
94 // class SvxGridTabPage --------------------------------------------------
96 class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
98 using TabPage::ActivatePage;
99 using TabPage::DeactivatePage;
101 public:
102 SvxGridTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
103 virtual ~SvxGridTabPage() override;
104 virtual void dispose() override;
106 static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet& rAttrSet );
108 virtual bool FillItemSet( SfxItemSet* rSet ) override;
109 virtual void Reset( const SfxItemSet* rSet ) override;
111 virtual void ActivatePage( const SfxItemSet& rSet ) override;
112 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
114 private:
115 VclPtr<CheckBox> pCbxUseGridsnap;
116 VclPtr<CheckBox> pCbxGridVisible;
118 VclPtr<MetricField> pMtrFldDrawX;
119 VclPtr<MetricField> pMtrFldDrawY;
121 VclPtr<NumericField> pNumFldDivisionX;
122 VclPtr<NumericField> pNumFldDivisionY;
124 VclPtr<CheckBox> pCbxSynchronize;
125 protected:
126 //these controls are used in draw and impress
127 VclPtr<VclContainer> pSnapFrames;
128 VclPtr<CheckBox> pCbxSnapHelplines;
129 VclPtr<CheckBox> pCbxSnapBorder;
130 VclPtr<CheckBox> pCbxSnapFrame;
131 VclPtr<CheckBox> pCbxSnapPoints;
132 VclPtr<MetricField> pMtrFldSnapArea;
134 VclPtr<CheckBox> pCbxOrtho;
135 VclPtr<CheckBox> pCbxBigOrtho;
136 VclPtr<CheckBox> pCbxRotate;
137 VclPtr<MetricField> pMtrFldAngle;
138 VclPtr<MetricField> pMtrFldBezAngle;
140 private:
141 bool bAttrModified;
143 DECL_LINK( ClickRotateHdl_Impl, Button*, void );
144 DECL_LINK( ChangeDrawHdl_Impl, Edit&, void );
145 DECL_LINK( ChangeGridsnapHdl_Impl, Button*, void );
146 DECL_LINK( ChangeDivisionHdl_Impl, Edit&, void );
149 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */