Let a test use a copy of a SRCDIR test doc
[LibreOffice.git] / include / svx / optgrid.hxx
blob6876d0c25b30cecc9fb5ac333c7695cf7a0f7421
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)
73 : SfxPoolItem(_nWhich, SfxItemType::SvxGridItemType){};
75 virtual SvxGridItem* Clone( SfxItemPool *pPool = nullptr ) const override;
76 virtual bool operator==( const SfxPoolItem& ) const override;
78 virtual bool GetPresentation( SfxItemPresentation ePres,
79 MapUnit eCoreMetric,
80 MapUnit ePresMetric,
81 OUString &rText, const IntlWrapper& ) const override;
85 class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
87 public:
88 SvxGridTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
89 virtual ~SvxGridTabPage() override;
91 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
93 virtual OUString GetAllStrings() override;
95 virtual bool FillItemSet( SfxItemSet* rSet ) override;
96 virtual void Reset( const SfxItemSet* rSet ) override;
98 virtual void ActivatePage( const SfxItemSet& rSet ) override;
99 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
101 private:
102 enum ModuleMode
104 WRITER_MODE = 0,
105 CALC_MODE = 1,
106 IMPRESS_MODE = 2,
107 DRAW_MODE = 3,
108 HTML_MODE = 4
110 bool bAttrModified;
111 ModuleMode m_Emode;
113 std::unique_ptr<weld::CheckButton> m_xCbxUseGridsnap;
114 std::unique_ptr<weld::Widget> m_xCbxUseGridsnapImg;
115 std::unique_ptr<weld::CheckButton> m_xCbxGridVisible;
116 std::unique_ptr<weld::Widget> m_xCbxGridVisibleImg;
117 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawX;
118 std::unique_ptr<weld::Widget> m_xMtrFldDrawXImg;
119 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldDrawY;
120 std::unique_ptr<weld::Widget> m_xMtrFldDrawYImg;
121 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionX;
122 std::unique_ptr<weld::Widget> m_xNumFldDivisionXImg;
123 std::unique_ptr<weld::SpinButton> m_xNumFldDivisionY;
124 std::unique_ptr<weld::Widget> m_xNumFldDivisionYImg;
125 std::unique_ptr<weld::CheckButton> m_xCbxSynchronize;
126 std::unique_ptr<weld::Widget> m_xCbxSynchronizeImg;
127 protected:
128 //these controls are used in draw and impress
129 std::unique_ptr<weld::Widget> m_xSnapFrames;
130 std::unique_ptr<weld::CheckButton> m_xCbxSnapHelplines;
131 std::unique_ptr<weld::Widget> m_xCbxSnapHelplinesImg;
132 std::unique_ptr<weld::CheckButton> m_xCbxSnapBorder;
133 std::unique_ptr<weld::Widget> m_xCbxSnapBorderImg;
134 std::unique_ptr<weld::CheckButton> m_xCbxSnapFrame;
135 std::unique_ptr<weld::Widget> m_xCbxSnapFrameImg;
136 std::unique_ptr<weld::CheckButton> m_xCbxSnapPoints;
137 std::unique_ptr<weld::Widget> m_xCbxSnapPointsImg;
138 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldSnapArea;
139 std::unique_ptr<weld::Widget> m_xMtrFldSnapAreaImg;
140 std::unique_ptr<weld::CheckButton> m_xCbxOrtho;
141 std::unique_ptr<weld::Widget> m_xCbxOrthoImg;
142 std::unique_ptr<weld::CheckButton> m_xCbxBigOrtho;
143 std::unique_ptr<weld::Widget> m_xCbxBigOrthoImg;
144 std::unique_ptr<weld::CheckButton> m_xCbxRotate;
145 std::unique_ptr<weld::Widget> m_xCbxRotateImg;
146 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle;
147 std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBezAngle;
148 std::unique_ptr<weld::Widget> m_xMtrFldBezAngleImg;
150 bool IsDrawMode() const { return m_Emode == DRAW_MODE; }
152 DECL_LINK(ClickRotateHdl_Impl, weld::Toggleable&, void);
153 private:
154 DECL_DLLPRIVATE_LINK(ChangeDrawHdl_Impl, weld::MetricSpinButton&, void);
155 DECL_DLLPRIVATE_LINK(ChangeGridsnapHdl_Impl, weld::Toggleable&, void);
156 DECL_DLLPRIVATE_LINK(ChangeDivisionHdl_Impl, weld::SpinButton&, void);
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */