xref: /AOO41X/main/sd/source/ui/inc/optsitem.hxx (revision a61e83ff61863f58e2bc63f3d253fe349482bfcc)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SD_OPTSITEM_HXX
25 #define _SD_OPTSITEM_HXX
26 
27 #include <unotools/configitem.hxx>
28 #include <sfx2/module.hxx>
29 #include <sfx2/app.hxx>
30 #include <sfx2/sfxsids.hrc>
31 #include <svx/optgrid.hxx>
32 #include <svx/dlgutil.hxx>
33 #include "sddllapi.h"
34 
35 // -----------------
36 // - Option ranges -
37 // -----------------
38 
39 #define SD_OPTIONS_NONE		0x00000000
40 #define SD_OPTIONS_ALL		0xffffffff
41 
42 #define SD_OPTIONS_LAYOUT	0x00000001
43 #define SD_OPTIONS_CONTENTS 0x00000002
44 #define SD_OPTIONS_MISC		0x00000004
45 #define SD_OPTIONS_SNAP		0x00000008
46 #define SD_OPTIONS_ZOOM		0x00000010
47 #define SD_OPTIONS_GRID		0x00000020
48 #define SD_OPTIONS_PRINT	0x00000040
49 
50 // ------------
51 // - Forwards -
52 // ------------
53 
54 class SfxConfigItem;
55 class SdOptions;
56 
57 namespace sd {
58 class FrameView;
59 }
60 
61 // -----------------
62 // - SdOptionsItem -
63 // -----------------
64 
65 class SdOptionsGeneric;
66 
67 class SD_DLLPUBLIC SdOptionsItem : public ::utl::ConfigItem
68 {
69 
70 private:
71 
72 	const SdOptionsGeneric&	mrParent;
73 
74 
75 public:
76 
77 	SdOptionsItem( const SdOptionsGeneric& rParent, const ::rtl::OUString rSubTree );
78 	virtual ~SdOptionsItem();
79 
80 	virtual void			Commit();
81     virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
82 
83 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetProperties(
84 								const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames );
85 	sal_Bool                PutProperties( const com::sun::star::uno::Sequence< rtl::OUString >& rNames,
86 										   const com::sun::star::uno::Sequence< com::sun::star::uno::Any>& rValues );
87 	void					SetModified();
88 };
89 
90 // --------------------
91 // - SdOptionsGeneric -
92 // --------------------
93 
94 class SD_DLLPUBLIC SdOptionsGeneric
95 {
96 friend class SdOptionsItem;
97 
98 private:
99 
100 	::rtl::OUString			maSubTree;
101 	SdOptionsItem*			mpCfgItem;
102 	sal_uInt16 					mnConfigId;
103 	sal_Bool					mbInit			: 1;
104 	sal_Bool					mbEnableModify	: 1;
105 
106 	SD_DLLPRIVATE void Commit( SdOptionsItem& rCfgItem ) const;
107 	SD_DLLPRIVATE ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const;
108 
109 protected:
110 
111 	void					Init() const;
112 	void					OptionsChanged() { if( mpCfgItem && mbEnableModify ) mpCfgItem->SetModified(); }
113 
114 protected:
115 
116 	virtual void			GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const = 0;
117 	virtual sal_Bool			ReadData( const ::com::sun::star::uno::Any* pValues ) = 0;
118 	virtual sal_Bool			WriteData( ::com::sun::star::uno::Any* pValues ) const = 0;
119 
120 public:
121 
122 							SdOptionsGeneric( sal_uInt16 nConfigId, const ::rtl::OUString& rSubTree );
123 							virtual ~SdOptionsGeneric();
124 
125 	const ::rtl::OUString&	GetSubTree() const { return maSubTree; }
126 	sal_uInt16					GetConfigId() const { return mnConfigId; }
127 
128 	void					EnableModify( sal_Bool bModify ) { mbEnableModify = bModify; }
129 
130 	void					Store();
131 
132 
133 	static bool				isMetricSystem();
134 };
135 
136 // -------------------
137 // - SdOptionsLayout -
138 // -------------------
139 
140 class SD_DLLPUBLIC SdOptionsLayout : public SdOptionsGeneric
141 {
142 private:
143 
144 	sal_Bool	bRuler				: 1;	// Layout/Display/Ruler
145 	sal_Bool	bMoveOutline		: 1;	// Layout/Display/Contur
146 	sal_Bool	bDragStripes		: 1;	// Layout/Display/Guide
147 	sal_Bool	bHandlesBezier		: 1;	// Layout/Display/Bezier
148 	sal_Bool	bHelplines			: 1;	// Layout/Display/Helpline
149 	sal_uInt16	nMetric;					// Layout/Other/MeasureUnit
150 	sal_uInt16	nDefTab;					// Layout/Other/TabStop
151 
152 protected:
153 
154 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
155 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
156 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
157 
158 public:
159 			SdOptionsLayout( sal_uInt16 nConfigId, sal_Bool bUseConfig );
160 			virtual ~SdOptionsLayout() {}
161 
162 	sal_Bool	operator==( const SdOptionsLayout& rOpt ) const;
163 
164 	sal_Bool	IsRulerVisible() const { Init(); return (sal_Bool) bRuler; }
165 	sal_Bool	IsMoveOutline() const { Init(); return (sal_Bool) bMoveOutline; }
166 	sal_Bool	IsDragStripes() const { Init(); return (sal_Bool) bDragStripes; }
167 	sal_Bool	IsHandlesBezier() const { Init(); return (sal_Bool) bHandlesBezier; }
168 	sal_Bool	IsHelplines() const { Init(); return (sal_Bool) bHelplines; }
169 	sal_uInt16  GetMetric() const { Init(); return( ( 0xffff == nMetric ) ? (sal_uInt16)SfxModule::GetCurrentFieldUnit() : nMetric ); }
170 	sal_uInt16	GetDefTab() const { Init(); return nDefTab; }
171 
172 	void	SetRulerVisible( sal_Bool bOn = sal_True ) { if( bRuler != bOn ) { OptionsChanged(); bRuler = bOn; } }
173 	void	SetMoveOutline( sal_Bool bOn = sal_True ) { if( bMoveOutline != bOn ) { OptionsChanged(); bMoveOutline = bOn; } }
174 	void	SetDragStripes( sal_Bool bOn = sal_True ) { if( bDragStripes != bOn ) { OptionsChanged(); bDragStripes = bOn; } }
175 	void	SetHandlesBezier( sal_Bool bOn = sal_True ) { if( bHandlesBezier != bOn ) { OptionsChanged(); bHandlesBezier = bOn; } }
176 	void	SetHelplines( sal_Bool bOn = sal_True ) { if( bHelplines != bOn ) { OptionsChanged(); bHelplines = bOn; } }
177 	void	SetMetric( sal_uInt16 nInMetric ) { if( nMetric != nInMetric ) { OptionsChanged(); nMetric = nInMetric; } }
178 	void	SetDefTab( sal_uInt16 nTab ) { if( nDefTab != nTab ) { OptionsChanged(); nDefTab = nTab; } }
179 };
180 
181 // -----------------------------------------------------------------------------
182 
183 class SD_DLLPUBLIC SdOptionsLayoutItem : public SfxPoolItem
184 {
185 public:
186 
187 							SdOptionsLayoutItem( sal_uInt16 nWhich);
188 							SdOptionsLayoutItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
189 
190 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
191 	virtual int 			operator==( const SfxPoolItem& ) const;
192 
193 	void					SetOptions( SdOptions* pOpts ) const;
194 
195 	SdOptionsLayout&		GetOptionsLayout() { return maOptionsLayout; }
196 private:
197 	SdOptionsLayout maOptionsLayout;
198 };
199 
200 // ---------------------
201 // - SdOptionsContents -
202 // ---------------------
203 
204 class SD_DLLPUBLIC SdOptionsContents : public SdOptionsGeneric
205 {
206 private:
207 protected:
208 
209 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
210 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
211 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
212 
213 public:
214 
215 			SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig );
216 			virtual ~SdOptionsContents() {}
217 
218 	sal_Bool	operator==( const SdOptionsContents& rOpt ) const;
219 };
220 
221 // -----------------------------------------------------------------------------
222 
223 class SD_DLLPUBLIC SdOptionsContentsItem : public SfxPoolItem
224 {
225 public:
226 
227 							SdOptionsContentsItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
228 
229 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
230 	virtual int 			operator==( const SfxPoolItem& ) const;
231 
232 	void					SetOptions( SdOptions* pOpts ) const;
233 
234 	SdOptionsContents&		GetOptionsContents() { return maOptionsContents; }
235 private:
236 	SdOptionsContents		maOptionsContents;
237 };
238 
239 // -----------------
240 // - SdOptionsMisc -
241 // -----------------
242 
243 class SD_DLLPUBLIC SdOptionsMisc : public SdOptionsGeneric
244 {
245 private:
246 
247 	// #97016#
248 	sal_uLong	nDefaultObjectSizeWidth;
249 	sal_uLong	nDefaultObjectSizeHeight;
250 
251 	sal_Bool	bStartWithTemplate		: 1;	// Misc/NewDoc/AutoPilot
252 	sal_Bool	bMarkedHitMovesAlways	: 1;	// Misc/ObjectMoveable
253 	sal_Bool	bMoveOnlyDragging		: 1;	// Currently, not in use !!!
254 	sal_Bool	bCrookNoContortion		: 1;	// Misc/NoDistort
255 	sal_Bool	bQuickEdit				: 1;	// Misc/TextObject/QuickEditing
256 	sal_Bool	bMasterPageCache		: 1;	// Misc/BackgroundCache
257 	sal_Bool	bDragWithCopy			: 1;	// Misc/CopyWhileMoving
258 	sal_Bool	bPickThrough			: 1;	// Misc/TextObject/Selectable
259 	sal_Bool	bBigHandles 			: 1;	// Misc/BigHandles
260 	sal_Bool	bDoubleClickTextEdit	: 1;	// Misc/DclickTextedit
261 	sal_Bool	bClickChangeRotation	: 1;	// Misc/RotateClick
262 	sal_Bool	bStartWithActualPage	: 1;	// Misc/Start/CurrentPage
263     sal_Bool    bStartWithPresenterScreen : 1;  // Misc/Start/PresenterScreen
264 	sal_Bool	bSolidDragging			: 1;	// Misc/ModifyWithAttributes
265 	sal_Bool	bSolidMarkHdl			: 1;	// /Misc/SimpleHandles
266 	sal_Bool	bSummationOfParagraphs	: 1;	// misc/SummationOfParagraphs
267 	// #90356#
268 	sal_Bool	bShowUndoDeleteWarning	: 1;	// Misc/ShowUndoDeleteWarning
269 	// #i75315#
270 	sal_Bool	bSlideshowRespectZOrder	: 1;	// Misc/SlideshowRespectZOrder
271     sal_Bool    bShowComments           : 1;    // Misc/ShowComments
272 
273 	sal_Bool	bPreviewNewEffects;
274 	sal_Bool	bPreviewChangedEffects;
275 	sal_Bool	bPreviewTransitions;
276 
277 	sal_Int32	mnDisplay;
278 
279 	sal_Int32 mnPenColor;
280 	double mnPenWidth;
281 
282     /** This value controls the device to use for formatting documents.
283         The currently supported values are 0 for the current printer or 1
284         for the printer independent virtual device the can be retrieved from
285         the modules.
286     */
287 	sal_uInt16	mnPrinterIndependentLayout;     // Misc/Compatibility/PrinterIndependentLayout
288 // Misc
289 
290 protected:
291 
292 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
293 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
294 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
295 
296 public:
297 
298 			SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig );
299 			virtual ~SdOptionsMisc() {}
300 
301 	sal_Bool	operator==( const SdOptionsMisc& rOpt ) const;
302 
303 	sal_Bool	IsStartWithTemplate() const { Init(); return (sal_Bool) bStartWithTemplate; }
304 	sal_Bool	IsMarkedHitMovesAlways() const { Init(); return (sal_Bool) bMarkedHitMovesAlways; }
305 	sal_Bool	IsMoveOnlyDragging() const { Init(); return (sal_Bool) bMoveOnlyDragging; }
306 	sal_Bool	IsCrookNoContortion() const { Init(); return (sal_Bool) bCrookNoContortion; }
307 	sal_Bool	IsQuickEdit() const { Init(); return (sal_Bool) bQuickEdit; }
308 	sal_Bool	IsMasterPagePaintCaching() const { Init(); return (sal_Bool) bMasterPageCache; }
309 	sal_Bool	IsDragWithCopy() const { Init(); return (sal_Bool) bDragWithCopy; }
310 	sal_Bool	IsPickThrough() const { Init(); return (sal_Bool) bPickThrough; }
311 	sal_Bool	IsBigHandles() const { Init(); return (sal_Bool) bBigHandles; }
312 	sal_Bool	IsDoubleClickTextEdit() const { Init(); return (sal_Bool) bDoubleClickTextEdit; }
313 	sal_Bool	IsClickChangeRotation() const { Init(); return (sal_Bool) bClickChangeRotation; }
314 	sal_Bool	IsStartWithActualPage() const { Init(); return (sal_Bool) bStartWithActualPage; }
315     sal_Bool    IsStartWithPresenterScreen() const { Init(); return (sal_Bool) bStartWithPresenterScreen; }
316 	sal_Bool	IsSolidDragging() const { Init(); return (sal_Bool) bSolidDragging; }
317 	sal_Bool	IsSolidMarkHdl() const { Init(); return (sal_Bool) bSolidMarkHdl; }
318 	sal_Bool	IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs != 0; };
319 
320     /** Return the currently selected printer independent layout mode.
321         @return
322             Returns 1 for printer independent layout enabled and 0 when it
323             is disabled.  Other values are reserved for future use.
324     */
325 	sal_uInt16	GetPrinterIndependentLayout() const { Init(); return mnPrinterIndependentLayout; };
326 	// #90356#
327 	sal_Bool	IsShowUndoDeleteWarning() const { Init(); return (sal_Bool) bShowUndoDeleteWarning; }
328 	sal_Bool	IsSlideshowRespectZOrder() const { Init(); return (sal_Bool) bSlideshowRespectZOrder; }
329 	// #97016#
330 	sal_uLong	GetDefaultObjectSizeWidth() const { Init(); return nDefaultObjectSizeWidth; }
331 	sal_uLong	GetDefaultObjectSizeHeight() const { Init(); return nDefaultObjectSizeHeight; }
332 
333 	sal_Bool	IsPreviewNewEffects() const { Init(); return bPreviewNewEffects; }
334 	sal_Bool	IsPreviewChangedEffects() const { Init(); return bPreviewChangedEffects; }
335 	sal_Bool	IsPreviewTransitions() const { Init(); return bPreviewTransitions; }
336 
337 	sal_Int32	GetDisplay() const { Init(); return mnDisplay; }
338 	void		SetDisplay( sal_Int32 nDisplay = 0 ) { if( mnDisplay != nDisplay ) { OptionsChanged(); mnDisplay = nDisplay; } }
339 
340 	sal_Int32 GetPresentationPenColor() const { Init(); return mnPenColor; }
341 	void	  SetPresentationPenColor( sal_Int32 nPenColor ) { if( mnPenColor != nPenColor ) { OptionsChanged(); mnPenColor = nPenColor; } }
342 
343 	double	  GetPresentationPenWidth() const { Init(); return mnPenWidth; }
344 	void	  SetPresentationPenWidth( double nPenWidth ) { if( mnPenWidth != nPenWidth ) { OptionsChanged(); mnPenWidth = nPenWidth; } }
345 
346 	void	SetStartWithTemplate( sal_Bool bOn = sal_True ) { if( bStartWithTemplate != bOn ) { OptionsChanged(); bStartWithTemplate = bOn; } }
347 	void	SetMarkedHitMovesAlways( sal_Bool bOn = sal_True ) { if( bMarkedHitMovesAlways != bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } }
348 	void	SetMoveOnlyDragging( sal_Bool bOn = sal_True ) { if( bMoveOnlyDragging != bOn ) { OptionsChanged(); bMoveOnlyDragging = bOn; } }
349 	void	SetCrookNoContortion( sal_Bool bOn = sal_True ) { if( bCrookNoContortion != bOn ) { OptionsChanged(); bCrookNoContortion = bOn; } }
350 	void	SetQuickEdit( sal_Bool bOn = sal_True ) { if( bQuickEdit != bOn ) { OptionsChanged(); bQuickEdit = bOn; } }
351 	void	SetMasterPagePaintCaching( sal_Bool bOn = sal_True ) { if( bMasterPageCache != bOn ) { OptionsChanged(); bMasterPageCache = bOn; } }
352 	void	SetDragWithCopy( sal_Bool bOn = sal_True ) { if( bDragWithCopy != bOn ) { OptionsChanged(); bDragWithCopy = bOn; } }
353 	void	SetPickThrough( sal_Bool bOn = sal_True ) { if( bPickThrough != bOn ) { OptionsChanged(); bPickThrough = bOn; } }
354 	void	SetBigHandles( sal_Bool bOn = sal_True ) { if( bBigHandles != bOn ) { OptionsChanged(); bBigHandles = bOn; } }
355 	void	SetDoubleClickTextEdit( sal_Bool bOn = sal_True ) { if( bDoubleClickTextEdit != bOn ) { OptionsChanged(); bDoubleClickTextEdit = bOn; } }
356 	void	SetClickChangeRotation( sal_Bool bOn = sal_True ) { if( bClickChangeRotation != bOn ) { OptionsChanged(); bClickChangeRotation = bOn; } }
357 	void	SetStartWithActualPage( sal_Bool bOn = sal_True ) { if( bStartWithActualPage != bOn ) { OptionsChanged(); bStartWithActualPage = bOn; } }
358     void    SetStartWithPresenterScreen( sal_Bool bOn = sal_True ) { if( bStartWithPresenterScreen != bOn ) { OptionsChanged(); bStartWithPresenterScreen = bOn; } }
359 	void	SetSummationOfParagraphs( sal_Bool bOn = sal_True ){ if ( bOn != bSummationOfParagraphs ) { OptionsChanged(); bSummationOfParagraphs = bOn; } }
360     /** Set the printer independent layout mode.
361         @param nOn
362             The default value is to switch printer independent layout on,
363             hence the parameters name.  Use 0 for turning it off.  Other
364             values are reserved for future use.
365     */
366 	void	SetPrinterIndependentLayout (sal_uInt16 nOn = 1 ){ if ( nOn != mnPrinterIndependentLayout ) { OptionsChanged(); mnPrinterIndependentLayout = nOn; } }
367 	void	SetSolidDragging( sal_Bool bOn = sal_True ) { if( bSolidDragging != bOn ) { OptionsChanged(); bSolidDragging = bOn; } }
368 	void	SetSolidMarkHdl( sal_Bool bOn = sal_True ) { if( bSolidMarkHdl != bOn ) { OptionsChanged(); bSolidMarkHdl = bOn; } }
369 	// #90356#
370 	void	SetShowUndoDeleteWarning( sal_Bool bOn = sal_True ) { if( bShowUndoDeleteWarning != bOn ) { OptionsChanged(); bShowUndoDeleteWarning = bOn; } }
371 	void	SetSlideshowRespectZOrder( sal_Bool bOn = sal_True ) { if( bSlideshowRespectZOrder != bOn ) { OptionsChanged(); bSlideshowRespectZOrder = bOn; } }
372 	// #97016#
373 	void	SetDefaultObjectSizeWidth( sal_uLong nWidth ) { if( nDefaultObjectSizeWidth != nWidth ) { OptionsChanged(); nDefaultObjectSizeWidth = nWidth; } }
374 	void	SetDefaultObjectSizeHeight( sal_uLong nHeight ) { if( nDefaultObjectSizeHeight != nHeight ) { OptionsChanged(); nDefaultObjectSizeHeight = nHeight; } }
375 
376 	void	SetPreviewNewEffects( sal_Bool bOn )  { if( bPreviewNewEffects != bOn ) { OptionsChanged(); bPreviewNewEffects = bOn; } }
377 	void	SetPreviewChangedEffects( sal_Bool bOn )  { if( bPreviewChangedEffects != bOn ) { OptionsChanged(); bPreviewChangedEffects = bOn; } }
378 	void	SetPreviewTransitions( sal_Bool bOn )  { if( bPreviewTransitions != bOn ) { OptionsChanged(); bPreviewTransitions = bOn; } }
379 
380 	sal_Bool    IsShowComments() const { Init(); return bShowComments; }
381     void    SetShowComments( sal_Bool bShow )  { if( bShowComments != bShow ) { OptionsChanged(); bShowComments = bShow; } }
382 };
383 
384 // -----------------------------------------------------------------------------
385 
386 class SD_DLLPUBLIC SdOptionsMiscItem : public SfxPoolItem
387 {
388 public:
389 
390 							SdOptionsMiscItem( sal_uInt16 nWhich);
391 							SdOptionsMiscItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
392 
393 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
394 	virtual int 			operator==( const SfxPoolItem& ) const;
395 
396 	void					SetOptions( SdOptions* pOpts ) const;
397 
398 	SdOptionsMisc&			GetOptionsMisc() { return maOptionsMisc; }
399 	const SdOptionsMisc&	GetOptionsMisc() const { return maOptionsMisc; }
400 private:
401 	SdOptionsMisc			maOptionsMisc;
402 };
403 
404 // -----------------
405 // - SdOptionsSnap -
406 // -----------------
407 
408 class SD_DLLPUBLIC SdOptionsSnap : public SdOptionsGeneric
409 {
410 private:
411 
412 	sal_Bool	bSnapHelplines	: 1;	// Snap/Object/SnapLine
413 	sal_Bool	bSnapBorder 	: 1;	// Snap/Object/PageMargin
414 	sal_Bool	bSnapFrame		: 1;	// Snap/Object/ObjectFrame
415 	sal_Bool	bSnapPoints 	: 1;	// Snap/Object/ObjectPoint
416 	sal_Bool	bOrtho			: 1;	// Snap/Position/CreatingMoving
417 	sal_Bool	bBigOrtho		: 1;	// Snap/Position/ExtendEdges
418 	sal_Bool	bRotate 		: 1;	// Snap/Position/Rotating
419 	sal_Int16	nSnapArea;				// Snap/Object/Range
420 	sal_Int16	nAngle;					// Snap/Position/RotatingValue
421 	sal_Int16	nBezAngle;				// Snap/Position/PointReduction
422 
423 protected:
424 
425 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
426 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
427 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
428 
429 public:
430 
431 			SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig );
432 			virtual ~SdOptionsSnap() {}
433 
434 	sal_Bool	operator==( const SdOptionsSnap& rOpt ) const;
435 
436 	sal_Bool	IsSnapHelplines() const { Init(); return (sal_Bool) bSnapHelplines; }
437 	sal_Bool	IsSnapBorder() const { Init(); return (sal_Bool) bSnapBorder; }
438 	sal_Bool	IsSnapFrame() const { Init(); return (sal_Bool) bSnapFrame; }
439 	sal_Bool	IsSnapPoints() const { Init(); return (sal_Bool) bSnapPoints; }
440 	sal_Bool	IsOrtho() const { Init(); return (sal_Bool) bOrtho; }
441 	sal_Bool	IsBigOrtho() const { Init(); return (sal_Bool) bBigOrtho; }
442 	sal_Bool	IsRotate() const { Init(); return (sal_Bool) bRotate; }
443 	sal_Int16	GetSnapArea() const { Init(); return nSnapArea; }
444 	sal_Int16	GetAngle() const { Init(); return nAngle; }
445 	sal_Int16	GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; }
446 
447 	void	SetSnapHelplines( sal_Bool bOn = sal_True ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } }
448 	void	SetSnapBorder( sal_Bool bOn = sal_True ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } }
449 	void	SetSnapFrame( sal_Bool bOn = sal_True ) { if( bSnapFrame != bOn ) { OptionsChanged(); bSnapFrame = bOn; } }
450 	void	SetSnapPoints( sal_Bool bOn = sal_True ) { if( bSnapPoints != bOn ) { OptionsChanged(); bSnapPoints = bOn; } }
451 	void	SetOrtho( sal_Bool bOn = sal_True ) { if( bOrtho != bOn ) { OptionsChanged(); bOrtho = bOn; } }
452 	void	SetBigOrtho( sal_Bool bOn = sal_True ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } }
453 	void	SetRotate( sal_Bool bOn = sal_True ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } }
454 	void	SetSnapArea( sal_Int16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } }
455 	void	SetAngle( sal_Int16 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } }
456 	void	SetEliminatePolyPointLimitAngle( sal_Int16 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } }
457 };
458 
459 // -----------------------------------------------------------------------------
460 
461 class SD_DLLPUBLIC SdOptionsSnapItem : public SfxPoolItem
462 {
463 public:
464 
465 							SdOptionsSnapItem( sal_uInt16 nWhich);
466 							SdOptionsSnapItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
467 
468 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
469 	virtual int 			operator==( const SfxPoolItem& ) const;
470 
471 	void					SetOptions( SdOptions* pOpts ) const;
472 
473 	SdOptionsSnap&			GetOptionsSnap() { return maOptionsSnap; }
474 private:
475 	SdOptionsSnap			maOptionsSnap;
476 };
477 
478 // -----------------
479 // - SdOptionsZoom -
480 // -----------------
481 
482 class SdOptionsZoom : public SdOptionsGeneric
483 {
484 private:
485 
486 	sal_Int32	nX;	// Zoom/ScaleX
487 	sal_Int32	nY;	// Zoom/ScaleY
488 
489 protected:
490 
491 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
492 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
493 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
494 
495 public:
496 
497 			SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig );
498 			virtual ~SdOptionsZoom() {}
499 
500 	sal_Bool	operator==( const SdOptionsZoom& rOpt ) const;
501 
502 	void	GetScale( sal_Int32& rX, sal_Int32& rY ) const { Init(); rX = nX; rY = nY; }
503 	void	SetScale( sal_Int32 nInX, sal_Int32 nInY ) { if( nX != nInX || nY != nInY ) { OptionsChanged(); nX = nInX; nY = nInY; } }
504 };
505 
506 // -----------------------------------------------------------------------------
507 
508 // -----------------
509 // - SdOptionsGrid -
510 // -----------------
511 
512 class SdOptionsGrid : public SdOptionsGeneric, public SvxOptionsGrid
513 {
514 protected:
515 
516 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
517 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
518 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
519 
520 public:
521 
522 			SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig );
523 			virtual ~SdOptionsGrid();
524 
525 	void	SetDefaults();
526 	sal_Bool	operator==( const SdOptionsGrid& rOpt ) const;
527 
528 	sal_uInt32	GetFldDrawX() const { Init(); return SvxOptionsGrid::GetFldDrawX(); }
529 	sal_uInt32 	GetFldDivisionX() const { Init(); return SvxOptionsGrid::GetFldDivisionX(); }
530 	sal_uInt32	GetFldDrawY() const { Init(); return SvxOptionsGrid::GetFldDrawY(); }
531 	sal_uInt32 	GetFldDivisionY() const { Init(); return SvxOptionsGrid::GetFldDivisionY(); }
532 	sal_uInt32	GetFldSnapX() const { Init(); return SvxOptionsGrid::GetFldSnapX(); }
533 	sal_uInt32	GetFldSnapY() const { Init(); return SvxOptionsGrid::GetFldSnapY();	}
534 	sal_Bool	IsUseGridSnap() const { Init(); return SvxOptionsGrid::GetUseGridSnap(); }
535 	sal_Bool	IsSynchronize() const { Init(); return SvxOptionsGrid::GetSynchronize(); }
536 	sal_Bool	IsGridVisible() const { Init(); return SvxOptionsGrid::GetGridVisible(); }
537 	sal_Bool	IsEqualGrid() const { Init(); return SvxOptionsGrid::GetEqualGrid(); }
538 
539 	void 	SetFldDrawX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawX( nSet ); } }
540 	void 	SetFldDivisionX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionX() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionX( nSet ); } }
541 	void 	SetFldDrawY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDrawY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDrawY( nSet ); } }
542 	void 	SetFldDivisionY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldDivisionY() ) { OptionsChanged(); SvxOptionsGrid::SetFldDivisionY( nSet ); } }
543 	void 	SetFldSnapX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapX() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapX( nSet ); } }
544 	void 	SetFldSnapY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFldSnapY() ) { OptionsChanged(); SvxOptionsGrid::SetFldSnapY( nSet ); } }
545 	void 	SetUseGridSnap( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetUseGridSnap() ) { OptionsChanged(); SvxOptionsGrid::SetUseGridSnap( bSet ); } }
546 	void 	SetSynchronize( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetSynchronize() ) { OptionsChanged(); SvxOptionsGrid::SetSynchronize( bSet ); } }
547 	void 	SetGridVisible( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetGridVisible() ) { OptionsChanged(); SvxOptionsGrid::SetGridVisible( bSet ); } }
548 	void 	SetEqualGrid( sal_Bool bSet ) { if( bSet != SvxOptionsGrid::GetEqualGrid() ) { OptionsChanged(); SvxOptionsGrid::SetEqualGrid( bSet ); } }
549 };
550 
551 // -----------------------------------------------
552 
553 class SdOptionsGridItem : public SvxGridItem
554 {
555 
556 public:
557 							SdOptionsGridItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
558 
559 	void					SetOptions( SdOptions* pOpts ) const;
560 };
561 
562 // ------------------
563 // - SdOptionsPrint -
564 // ------------------
565 
566 class SD_DLLPUBLIC SdOptionsPrint : public SdOptionsGeneric
567 {
568 private:
569 
570 	sal_Bool	bDraw				: 1;	// Print/Content/Drawing
571 	sal_Bool	bNotes 				: 1;	// Print/Content/Note
572 	sal_Bool	bHandout			: 1;	// Print/Content/Handout
573 	sal_Bool	bOutline			: 1;	// Print/Content/Outline
574 	sal_Bool	bDate				: 1;	// Print/Other/Date
575 	sal_Bool	bTime				: 1;	// Print/Other/Time
576 	sal_Bool	bPagename			: 1;	// Print/Other/PageName
577 	sal_Bool	bHiddenPages		: 1;	// Print/Other/HiddenPage
578 	sal_Bool	bPagesize			: 1;	// Print/Page/PageSize
579 	sal_Bool	bPagetile			: 1;	// Print/Page/PageTile
580 	sal_Bool	bWarningPrinter		: 1;	//  These flags you get
581 	sal_Bool	bWarningSize		: 1;	//  from the common options,
582 	sal_Bool	bWarningOrientation	: 1;	//  currently org.openoffice.Office.Common.xml (class OfaMiscCfg ; sfx2/misccfg.hxx )
583 	sal_Bool	bBooklet			: 1;	// Print/Page/Booklet
584 	sal_Bool	bFront 				: 1;	// Print/Page/BookletFront
585 	sal_Bool	bBack				: 1;	// Print/Page/BookletFront
586 	sal_Bool	bCutPage   			: 1;	// NOT persistent !!!
587 	sal_Bool	bPaperbin  			: 1;	// Print/Other/FromPrinterSetup
588 	sal_Bool	mbHandoutHorizontal	: 1;	// Order Page previews on Handout Pages horizontal
589 	sal_uInt16	mnHandoutPages;				// Number of page previews on handout page (only 1/2/4/6/9 are supported)
590 	sal_uInt16	nQuality;					// Print/Other/Quality
591 
592 protected:
593 
594 	virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const;
595 	virtual sal_Bool ReadData( const ::com::sun::star::uno::Any* pValues );
596 	virtual sal_Bool WriteData( ::com::sun::star::uno::Any* pValues ) const;
597 
598 public:
599 
600 			SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig );
601 			virtual ~SdOptionsPrint() {}
602 
603 	sal_Bool	operator==( const SdOptionsPrint& rOpt ) const;
604 
605 	sal_Bool	IsDraw() const { Init(); return (sal_Bool) bDraw; }
606 	sal_Bool	IsNotes() const { Init(); return (sal_Bool) bNotes; }
607 	sal_Bool	IsHandout() const { Init(); return (sal_Bool) bHandout; }
608 	sal_Bool	IsOutline() const { Init(); return (sal_Bool) bOutline; }
609 	sal_Bool	IsDate() const { Init(); return (sal_Bool) bDate; }
610 	sal_Bool	IsTime() const { Init(); return (sal_Bool) bTime; }
611 	sal_Bool	IsPagename() const { Init(); return (sal_Bool) bPagename; }
612 	sal_Bool	IsHiddenPages() const { Init(); return (sal_Bool) bHiddenPages; }
613 	sal_Bool	IsPagesize() const { Init(); return (sal_Bool) bPagesize; }
614 	sal_Bool	IsPagetile() const { Init(); return (sal_Bool) bPagetile; }
615 	sal_Bool	IsWarningPrinter() const { Init(); return (sal_Bool) bWarningPrinter; }
616 	sal_Bool	IsWarningSize() const { Init(); return (sal_Bool) bWarningSize; }
617 	sal_Bool	IsWarningOrientation() const { Init(); return (sal_Bool) bWarningOrientation; }
618 	sal_Bool	IsBooklet() const { Init(); return (sal_Bool) bBooklet; }
619 	sal_Bool	IsFrontPage() const { Init(); return (sal_Bool) bFront; }
620 	sal_Bool	IsBackPage() const { Init(); return (sal_Bool) bBack; }
621 	sal_Bool	IsCutPage() const { Init(); return (sal_Bool) bCutPage; }
622 	sal_Bool	IsPaperbin() const { Init(); return (sal_Bool) bPaperbin; }
623 	sal_uInt16	GetOutputQuality() const { Init(); return nQuality; }
624 	sal_Bool	IsHandoutHorizontal() const { Init(); return mbHandoutHorizontal; }
625 	sal_uInt16	GetHandoutPages() const { Init(); return mnHandoutPages; }
626 
627 	void	SetDraw( sal_Bool bOn = sal_True ) { if( bDraw != bOn ) { OptionsChanged(); bDraw = bOn; } }
628 	void	SetNotes( sal_Bool bOn = sal_True ) { if( bNotes != bOn ) { OptionsChanged(); bNotes = bOn; } }
629 	void	SetHandout( sal_Bool bOn = sal_True ) { if( bHandout != bOn ) { OptionsChanged(); bHandout = bOn; } }
630 	void	SetOutline( sal_Bool bOn = sal_True ) { if( bOutline != bOn ) { OptionsChanged(); bOutline = bOn; } }
631 	void	SetDate( sal_Bool bOn = sal_True ) { if( bDate != bOn ) { OptionsChanged(); bDate = bOn; } }
632 	void	SetTime( sal_Bool bOn = sal_True ) { if( bTime != bOn ) { OptionsChanged(); bTime = bOn; } }
633 	void	SetPagename( sal_Bool bOn = sal_True ) { if( bPagename != bOn ) { OptionsChanged(); bPagename = bOn; } }
634 	void	SetHiddenPages( sal_Bool bOn = sal_True ) { if( bHiddenPages != bOn ) { OptionsChanged(); bHiddenPages = bOn; } }
635 	void	SetPagesize( sal_Bool bOn = sal_True ) { if( bPagesize != bOn ) { OptionsChanged(); bPagesize = bOn; } }
636 	void	SetPagetile( sal_Bool bOn = sal_True ) { if( bPagetile != bOn ) { OptionsChanged(); bPagetile = bOn; } }
637 	void	SetWarningPrinter( sal_Bool bOn = sal_True ) { if( bWarningPrinter != bOn ) { OptionsChanged(); bWarningPrinter = bOn; } }
638 	void	SetWarningSize( sal_Bool bOn = sal_True ) { if( bWarningSize != bOn ) { OptionsChanged(); bWarningSize = bOn; } }
639 	void	SetWarningOrientation( sal_Bool bOn = sal_True ) { if( bWarningOrientation != bOn ) { OptionsChanged(); bWarningOrientation = bOn; } }
640 	void	SetBooklet( sal_Bool bOn = sal_True ) { if( bBooklet != bOn ) { OptionsChanged(); bBooklet = bOn; } }
641 	void	SetFrontPage( sal_Bool bOn = sal_True ) { if( bFront != bOn ) { OptionsChanged(); bFront = bOn; } }
642 	void	SetBackPage( sal_Bool bOn = sal_True ) { if( bBack != bOn ) { OptionsChanged(); bBack = bOn; } }
643 	void	SetCutPage( sal_Bool bOn = sal_True ) { if( bCutPage != bOn ) { OptionsChanged(); bCutPage = bOn; } }
644 	void	SetPaperbin( sal_Bool bOn = sal_True ) { if( bPaperbin != bOn ) { OptionsChanged(); bPaperbin = bOn; } }
645 	void	SetOutputQuality( sal_uInt16 nInQuality ) { if( nQuality != nInQuality ) { OptionsChanged(); nQuality = nInQuality; } }
646 	void	SetHandoutHorizontal( sal_Bool bHandoutHorizontal ) { if( mbHandoutHorizontal != bHandoutHorizontal ) { OptionsChanged(); mbHandoutHorizontal = bHandoutHorizontal; } }
647 	void	SetHandoutPages( sal_uInt16 nHandoutPages ) { if( nHandoutPages != mnHandoutPages ) { OptionsChanged(); mnHandoutPages = nHandoutPages; } }
648 };
649 
650 // -----------------------------------------------------------------------------
651 
652 class SD_DLLPUBLIC SdOptionsPrintItem : public SfxPoolItem
653 {
654 public:
655 
656 							SdOptionsPrintItem( sal_uInt16 nWhich);
657 							SdOptionsPrintItem( sal_uInt16 nWhich, SdOptions* pOpts, ::sd::FrameView* pView = NULL );
658 
659 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
660 	virtual int 			operator==( const SfxPoolItem& ) const;
661 
662 	void					SetOptions( SdOptions* pOpts ) const;
663 
664 	SdOptionsPrint&			GetOptionsPrint() { return maOptionsPrint; }
665 	const SdOptionsPrint&	GetOptionsPrint() const { return maOptionsPrint; }
666 private:
667 	SdOptionsPrint	maOptionsPrint;
668 };
669 
670 // -------------
671 // - SdOptions -
672 // -------------
673 
674 class SdOptions : public SdOptionsLayout, public SdOptionsContents,
675 				  public SdOptionsMisc, public SdOptionsSnap,
676 				  public SdOptionsZoom, public SdOptionsGrid,
677 				  public SdOptionsPrint
678 {
679 public:
680 
681 						SdOptions( sal_uInt16 nConfigId );
682 						virtual ~SdOptions();
683 
684 	void				StoreConfig( sal_uLong nOptionRange = SD_OPTIONS_ALL );
685 };
686 
687 #endif // _SD_OPTSITEM_HXX
688