xref: /aoo41x/main/sw/source/ui/inc/frmpage.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 
28 #ifndef _FRMPAGE_HXX
29 #define _FRMPAGE_HXX
30 
31 #include <vcl/fixed.hxx>
32 #include <vcl/button.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <vcl/field.hxx>
35 #include <sfx2/tabdlg.hxx>
36 #include <svx/swframeposstrings.hxx>
37 #include <swtypes.hxx>
38 #include <bmpwin.hxx>
39 #include <svx/swframeexample.hxx>
40 #include <prcntfld.hxx>
41 #include <globals.hrc>
42 
43 
44 namespace sfx2{class FileDialogHelper;}
45 class SwWrtShell;
46 struct FrmMap;
47 // OD 12.11.2003 #i22341#
48 struct SwPosition;
49 
50 /*--------------------------------------------------------------------
51 	 Beschreibung:	Rahmendialog
52  --------------------------------------------------------------------*/
53 
54 class SwFrmPage: public SfxTabPage
55 {
56 	// Size
57 	FixedLine       aSizeFL;
58 	FixedText		aWidthFT;
59 	FixedText		aWidthAutoFT;
60 	PercentField 	aWidthED;
61 	CheckBox		aRelWidthCB;
62 	CheckBox		aAutoWidthCB;
63 	FixedText		aHeightFT;
64 	FixedText		aHeightAutoFT;
65 	PercentField 	aHeightED;
66 	CheckBox		aRelHeightCB;
67 	CheckBox		aAutoHeightCB;
68 	CheckBox		aFixedRatioCB;
69 	PushButton		aRealSizeBT;
70 
71 	// Anker
72     FixedLine       aTypeSepFL;
73 	FixedLine       aTypeFL;
74 	RadioButton		aAnchorAtPageRB;
75 	RadioButton		aAnchorAtParaRB;
76 	RadioButton		aAnchorAtCharRB;
77 	RadioButton		aAnchorAsCharRB;
78 	RadioButton		aAnchorAtFrameRB;
79 
80 	// Position
81 	FixedLine       aPositionFL;
82 	FixedText		aHorizontalFT;
83 	ListBox 		aHorizontalDLB;
84 	FixedText		aAtHorzPosFT;
85 	MetricField 	aAtHorzPosED;
86 	FixedText		aHoriRelationFT;
87 	ListBox			aHoriRelationLB;
88 	CheckBox		aMirrorPagesCB;
89 	FixedText		aVerticalFT;
90 	ListBox 		aVerticalDLB;
91 	FixedText		aAtVertPosFT;
92 	MetricField 	aAtVertPosED;
93 	FixedText		aVertRelationFT;
94 	ListBox			aVertRelationLB;
95     // OD 02.10.2003 #i18732# - check box for new option 'FollowTextFlow'
96     CheckBox        aFollowTextFlowCB;
97 
98 	// Example
99     SvxSwFrameExample   aExampleWN;
100 
101     //'string provider'
102     SvxSwFramePosString aFramePosString;
103 
104     sal_Bool            bAtHorzPosModified;
105     sal_Bool            bAtVertPosModified;
106 
107     sal_Bool            bFormat;
108 	sal_Bool			bNew;
109 	sal_Bool			bNoModifyHdl;
110     sal_Bool            bVerticalChanged;  //check done whether frame is in vertical environment
111     sal_Bool            bIsVerticalFrame;  //current frame is in vertical environment - strings are exchanged
112     // --> OD 2009-08-31 #mongolianlayou#
113     sal_Bool            bIsVerticalL2R;
114     // <--
115     sal_Bool            bIsInRightToLeft; // current frame is in right-to-left environment - strings are exchanged
116     sal_Bool            bHtmlMode;
117     sal_uInt16          nHtmlMode;
118 	sal_uInt16			nDlgType;
119 	Size			aGrfSize;
120 	Size			aWrap;
121 	SwTwips			nUpperBorder;
122 	SwTwips			nLowerBorder;
123     double          fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
124 
125     // OD 12.11.2003 #i22341# - keep content position of character for
126     // to character anchored objects.
127     const SwPosition* mpToCharCntntPos;
128 
129 	// Die alten Ausrichtungen
130     short        nOldH;
131     short    nOldHRel;
132     short        nOldV;
133     short    nOldVRel;
134 
135     FrmMap* pVMap;
136     FrmMap* pHMap;
137 
138     bool    m_bAllowVertPositioning;
139     bool    m_bIsMathOLE;
140     bool    m_bIsMathBaselineAlignment;
141 
142     virtual void    ActivatePage(const SfxItemSet& rSet);
143 	virtual int 	DeactivatePage(SfxItemSet *pSet);
144 
145 
146 	DECL_LINK( RangeModifyHdl, Edit * );
147 	DECL_LINK( AnchorTypeHdl, RadioButton * );
148 	DECL_LINK( PosHdl, ListBox * );
149 	DECL_LINK( RelHdl, ListBox * );
150     void            InitPos(RndStdIds eId, sal_uInt16 nH, sal_uInt16 nHRel,
151 							sal_uInt16 nV,	sal_uInt16 nVRel,
152 							long   nX,	long   nY);
153 
154 	DECL_LINK( RealSizeHdl, Button * );
155 	DECL_LINK( RelSizeClickHdl, CheckBox * );
156 	DECL_LINK( MirrorHdl, CheckBox * );
157 
158 	DECL_LINK( AutoWidthClickHdl, void* );
159 	DECL_LINK( AutoHeightClickHdl, void* );
160 
161 	// Beispiel aktualisieren
162 	void			UpdateExample();
163 	DECL_LINK( ModifyHdl, Edit * );
164 
165 	void			Init(const SfxItemSet& rSet, sal_Bool bReset = sal_False);
166     // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambigous
167     //                          in the alignment.
168     sal_uInt16          FillPosLB( const FrmMap* _pMap,
169                                const sal_uInt16 _nAlign,
170                                const sal_uInt16 _nRel,
171                                ListBox& _rLB );
172     // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambigous
173     //                          in their string entries.
174     sal_uLong           FillRelLB( const FrmMap* _pMap,
175                                const sal_uInt16 _nLBSelPos,
176                                const sal_uInt16 _nAlign,
177                                sal_uInt16 _nRel,
178                                ListBox& _rLB,
179                                FixedText& _rFT );
180     sal_uInt16          GetMapPos( const FrmMap *pMap, ListBox &rAlignLB );
181     short           GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
182     short           GetRelation(FrmMap *pMap, ListBox &rRelationLB);
183     RndStdIds       GetAnchor();
184 
185 	void			EnableGraficMode( void );	// hides auto check boxes and re-org controls for "Real Size" button
186 
187 	SwFrmPage(Window *pParent, const SfxItemSet &rSet);
188 	~SwFrmPage();
189 
190     using SfxTabPage::ActivatePage;
191     using SfxTabPage::DeactivatePage;
192 
193 public:
194 
195     static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
196 	static sal_uInt16* GetRanges();
197 
198 	virtual sal_Bool FillItemSet(SfxItemSet &rSet);
199 	virtual void Reset(const SfxItemSet &rSet);
200 
201 	void 			SetNewFrame(sal_Bool bNewFrame) { bNew		= bNewFrame; }
202 	void			SetFormatUsed(sal_Bool bFmt);
203 	void			SetFrmType(sal_uInt16 nType) 	{ nDlgType 	= nType;	 }
204 	inline sal_Bool		IsInGraficMode( void )		{ return nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE; }
205     void            EnableVerticalPositioning( bool bEnable );
206 };
207 
208 class SwGrfExtPage: public SfxTabPage
209 {
210 	// Spiegeln
211     FixedLine       aMirrorFL;
212 	CheckBox		aMirrorVertBox;
213 	CheckBox		aMirrorHorzBox;
214 	RadioButton 	aAllPagesRB;
215 	RadioButton 	aLeftPagesRB;
216 	RadioButton 	aRightPagesRB;
217 	BmpWindow		aBmpWin;
218 
219     FixedLine       aConnectFL;
220 	FixedText		aConnectFT;
221 	Edit			aConnectED;
222 	PushButton		aBrowseBT;
223 
224 	String			aFilterName;
225 	String			aGrfName, aNewGrfName;
226 
227     ::sfx2::FileDialogHelper*     pGrfDlg;
228 
229 	sal_Bool 			bHtmlMode;
230 
231 	// Handler fuer Spiegeln
232 	DECL_LINK( MirrorHdl, CheckBox * );
233 	DECL_LINK( BrowseHdl, Button * );
234 
235 	virtual void 	ActivatePage(const SfxItemSet& rSet);
236 	SwGrfExtPage(Window *pParent, const SfxItemSet &rSet);
237 	~SwGrfExtPage();
238 
239     using SfxTabPage::ActivatePage;
240     using SfxTabPage::DeactivatePage;
241 
242 public:
243 
244     static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
245 
246 	virtual sal_Bool FillItemSet(SfxItemSet &rSet);
247 	virtual void Reset(const SfxItemSet &rSet);
248 	virtual int  DeactivatePage(SfxItemSet *pSet);
249 };
250 
251 
252 class SwFrmURLPage : public SfxTabPage
253 {
254 	//Hyperlink
255     FixedLine       aHyperLinkFL;
256 	FixedText		aURLFT;
257 	Edit			aURLED;
258 	PushButton		aSearchPB;
259 	FixedText		aNameFT;
260 	Edit			aNameED;
261 	FixedText		aFrameFT;
262 	ComboBox		aFrameCB;
263 
264 	//Image map
265     FixedLine       aImageFL;
266 	CheckBox		aServerCB;
267 	CheckBox		aClientCB;
268 
269 	DECL_LINK( InsertFileHdl, PushButton * );
270 
271 
272 	SwFrmURLPage(Window *pParent, const SfxItemSet &rSet);
273 	~SwFrmURLPage();
274 
275     using SfxTabPage::ActivatePage;
276     using SfxTabPage::DeactivatePage;
277 
278 public:
279 
280     static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
281 
282 	virtual sal_Bool FillItemSet(SfxItemSet &rSet);
283 	virtual void Reset(const SfxItemSet &rSet);
284 };
285 
286 /*-----------------13.11.96 12.59-------------------
287 
288 --------------------------------------------------*/
289 
290 class SwFrmAddPage : public SfxTabPage
291 {
292       FixedLine   aNamesFL;
293 	FixedText 	aNameFT;
294 	Edit		aNameED;
295 	FixedText	aAltNameFT;
296 	Edit		aAltNameED;
297 	FixedText 	aPrevFT;
298     ListBox     aPrevLB;
299 	FixedText 	aNextFT;
300     ListBox     aNextLB;
301     	FixedLine   aProtectFL;
302 
303 	CheckBox	aProtectContentCB;
304 	CheckBox	aProtectFrameCB;
305 	CheckBox	aProtectSizeCB;
306 	FixedLine   aExtFL;
307 
308 	CheckBox	aEditInReadonlyCB;
309 	CheckBox	aPrintFrameCB;
310 	FixedText   aTextFlowFT;
311 	ListBox     aTextFlowLB;
312 
313 
314 	SwWrtShell* pWrtSh;
315 
316 	sal_uInt16		nDlgType;
317 	sal_Bool 		bHtmlMode;
318 	sal_Bool 		bFormat;
319 	sal_Bool 		bNew;
320 
321 	DECL_LINK(EditModifyHdl, Edit*);
322     DECL_LINK(ChainModifyHdl, ListBox*);
323 
324 	SwFrmAddPage(Window *pParent, const SfxItemSet &rSet);
325 	~SwFrmAddPage();
326 
327 public:
328 
329 	static SfxTabPage*	Create(Window *pParent, const SfxItemSet &rSet);
330 	static sal_uInt16* 		GetRanges();
331 
332 	virtual sal_Bool FillItemSet(SfxItemSet &rSet);
333 	virtual void Reset(const SfxItemSet &rSet);
334 
335 	void			SetFormatUsed(sal_Bool bFmt);
336 	void			SetFrmType(sal_uInt16 nType) { nDlgType = nType; }
337 	void 			SetNewFrame(sal_Bool bNewFrame) { bNew  = bNewFrame; }
338 	void			SetShell(SwWrtShell* pSh) { pWrtSh  = pSh; }
339 
340 };
341 
342 #endif // _FRMPAGE_HXX
343