xref: /aoo41x/main/svx/inc/svx/optgrid.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_OPTGRID_HXX
28 #define _SVX_OPTGRID_HXX
29 
30 // include ---------------------------------------------------------------
31 
32 #include <sfx2/tabdlg.hxx>
33 #include <svl/eitem.hxx>
34 #include <vcl/group.hxx>
35 #include <vcl/fixed.hxx>
36 #include <vcl/field.hxx>
37 #include "svx/svxdllapi.h"
38 
39 class SvxGridTabPage;
40 
41 // class SvxOptionsGrid --------------------------------------------------
42 
43 class SVX_DLLPUBLIC SvxOptionsGrid
44 {
45 protected:
46 	sal_uInt32	nFldDrawX;
47 	sal_uInt32 	nFldDivisionX;
48 	sal_uInt32	nFldDrawY;
49 	sal_uInt32 	nFldDivisionY;
50 	sal_uInt32	nFldSnapX;
51 	sal_uInt32	nFldSnapY;
52 	sal_Bool	bUseGridsnap:1;
53 	sal_Bool	bSynchronize:1;
54 	sal_Bool	bGridVisible:1;
55 	sal_Bool	bEqualGrid:	 1;
56 
57 public:
58 	SvxOptionsGrid();
59 	~SvxOptionsGrid();
60 
61 	void 	SetFldDrawX(	sal_uInt32 nSet){nFldDrawX 		= nSet;}
62 	void 	SetFldDivisionX(sal_uInt32 nSet){nFldDivisionX  = nSet;}
63 	void 	SetFldDrawY   (	sal_uInt32 nSet){nFldDrawY      = nSet;}
64 	void 	SetFldDivisionY(sal_uInt32 nSet){nFldDivisionY  = nSet;}
65 	void 	SetFldSnapX(	sal_uInt32 nSet){nFldSnapX 		= nSet;}
66 	void 	SetFldSnapY   (	sal_uInt32 nSet){nFldSnapY      = nSet;}
67 	void 	SetUseGridSnap( sal_Bool bSet ) {bUseGridsnap	= bSet;}
68 	void 	SetSynchronize( sal_Bool bSet ) {bSynchronize	= bSet;}
69 	void 	SetGridVisible( sal_Bool bSet ) {bGridVisible	= bSet;}
70 	void 	SetEqualGrid( sal_Bool bSet )	{bEqualGrid		= bSet;}
71 
72 	sal_uInt32	GetFldDrawX(	) const {  return nFldDrawX;    }
73 	sal_uInt32 	GetFldDivisionX() const {  return nFldDivisionX;}
74 	sal_uInt32	GetFldDrawY   (	) const {  return nFldDrawY;    }
75 	sal_uInt32 	GetFldDivisionY() const {  return nFldDivisionY;}
76 	sal_uInt32	GetFldSnapX(	) const {  return nFldSnapX;    }
77 	sal_uInt32	GetFldSnapY   (	) const {  return nFldSnapY;    }
78 	sal_Bool	GetUseGridSnap( ) const {  return bUseGridsnap; }
79 	sal_Bool	GetSynchronize( ) const {  return bSynchronize; }
80 	sal_Bool	GetGridVisible( ) const {  return bGridVisible; }
81 	sal_Bool	GetEqualGrid()	  const {  return bEqualGrid;   }
82 };
83 
84 // class SvxGridItem -----------------------------------------------------
85 
86 class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
87 {
88 	// #i9076#
89 	friend class SvxGridTabPage;
90 
91 public:
92 	SvxGridItem( sal_uInt16 _nWhich) : SfxPoolItem(_nWhich){};
93 	SvxGridItem( const SvxGridItem& pTestItem );
94 
95 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
96 	virtual int             operator==( const SfxPoolItem& ) const;
97 
98 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
99 									SfxMapUnit eCoreMetric,
100 									SfxMapUnit ePresMetric,
101                                     String &rText, const IntlWrapper * = 0 ) const;
102 
103 };
104 
105 // class SvxGridTabPage --------------------------------------------------
106 
107 class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
108 {
109 	using TabPage::ActivatePage;
110 	using TabPage::DeactivatePage;
111 
112 public:
113 	SvxGridTabPage( Window* pParent, const SfxItemSet& rSet );
114 
115 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& rAttrSet );
116 
117 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
118 	virtual	void 		Reset( const SfxItemSet& rSet );
119 
120 	virtual void 		ActivatePage( const SfxItemSet& rSet );
121 	virtual int  		DeactivatePage( SfxItemSet* pSet );
122 
123 private:
124 	CheckBox			aCbxUseGridsnap;
125 	CheckBox			aCbxGridVisible;
126 
127     FixedLine           aFlResolution;
128 	FixedText			aFtDrawX;
129 	MetricField			aMtrFldDrawX;
130 	FixedText			aFtDrawY;
131 	MetricField			aMtrFldDrawY;
132 
133     FixedLine           aFlDivision;
134     FixedText           aFtDivisionX;
135     NumericField        aNumFldDivisionX;
136     FixedText           aDivisionPointX;
137 
138     FixedText           aFtDivisionY;
139     NumericField        aNumFldDivisionY;
140     FixedText           aDivisionPointY;
141 
142     CheckBox            aCbxSynchronize;
143     FixedLine           aGrpDrawGrid; // Neu
144 
145 protected:
146     //these controls are used in draw and impress
147     FixedLine       aGrpSnap;
148     CheckBox        aCbxSnapHelplines;
149 	CheckBox		aCbxSnapBorder;
150 	CheckBox		aCbxSnapFrame;
151 	CheckBox		aCbxSnapPoints;
152 	FixedText		aFtSnapArea;
153 	MetricField 	aMtrFldSnapArea;
154 
155     FixedLine       aSeparatorFL;
156 
157     FixedLine       aGrpOrtho;
158     CheckBox        aCbxOrtho;
159 	CheckBox		aCbxBigOrtho;
160 	CheckBox		aCbxRotate;
161 	MetricField 	aMtrFldAngle;
162 	FixedText		aFtBezAngle;
163 	MetricField 	aMtrFldBezAngle;
164 
165 private:
166     sal_Bool                bAttrModified;
167 //	sal_Bool				bEqualGrid; // Neu
168 
169 #ifdef _SVX_OPTGRID_CXX
170     DECL_LINK( ClickRotateHdl_Impl, void * );
171     DECL_LINK( ChangeDrawHdl_Impl, MetricField * );
172     DECL_LINK( ChangeGridsnapHdl_Impl, void * );
173     DECL_LINK( ChangeDivisionHdl_Impl, NumericField * );
174 
175 #endif
176 };
177 
178 
179 #endif
180 
181