xref: /aoo42x/main/sw/source/ui/config/cfgitems.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #ifndef __SBX_SBXVARIABLE_HXX //autogen
33 #include <basic/sbxvar.hxx>
34 #endif
35 
36 #ifndef _SVX_SVXIDS_HRC //autogen
37 #include <svx/svxids.hrc>
38 #endif
39 #include <editeng/svxenum.hxx>
40 
41 
42 #include "viewopt.hxx"
43 #include "swtypes.hxx"
44 #include "cmdid.h"
45 #include "prtopt.hxx"
46 #include "cfgitems.hxx"
47 #include "crstate.hxx"
48 
49 
50 
51 TYPEINIT1_AUTOFACTORY(SwDocDisplayItem, SfxPoolItem)
52 TYPEINIT1_AUTOFACTORY(SwElemItem, SfxPoolItem)
53 TYPEINIT1_AUTOFACTORY(SwAddPrinterItem, SfxPoolItem)
54 TYPEINIT1_AUTOFACTORY(SwShadowCursorItem, SfxPoolItem)
55 
56 
57 SwDocDisplayItem::SwDocDisplayItem( sal_uInt16 _nWhich ) :
58         SfxPoolItem(_nWhich),
59 		aIndexBackgrndCol(COL_GRAY)
60 {
61 	bParagraphEnd	  	=
62 	bTab 				=
63 	bSpace				=
64 	bNonbreakingSpace	=
65 	bSoftHyphen			=
66     bFldHiddenText      =
67     bCharHiddenText     =
68 	bManualBreak 		=
69     bShowHiddenPara     = sal_False;
70 
71 };
72 
73 /*------------OS 12.01.95 -------------------------------------------
74 	Item fuer Einstellungsdialog, Seite Dokumentansicht
75 --------------------------------------------------------------------*/
76 
77 SwDocDisplayItem::SwDocDisplayItem( const SwDocDisplayItem& rDocDisplayItem ):
78 			SfxPoolItem(rDocDisplayItem)
79 {
80 	*this = rDocDisplayItem;
81 };
82 
83 /*----------------------- -------------------------------------------
84 
85 --------------------------------------------------------------------*/
86 
87 SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt, sal_uInt16 _nWhich ) :
88             SfxPoolItem( _nWhich )
89 {
90 	bParagraphEnd	  	= rVOpt.IsParagraph(sal_True);
91 	bTab 				= rVOpt.IsTab(sal_True);
92 	bSpace				= rVOpt.IsBlank(sal_True);
93 	bNonbreakingSpace	= rVOpt.IsHardBlank();
94 	bSoftHyphen			= rVOpt.IsSoftHyph();
95     bCharHiddenText     = rVOpt.IsShowHiddenChar(sal_True);
96     bFldHiddenText      = rVOpt.IsShowHiddenField();
97 	bManualBreak 		= rVOpt.IsLineBreak(sal_True);
98     bShowHiddenPara     = rVOpt.IsShowHiddenPara();
99 
100 }
101 /*--------------------------------------------------------------------
102 	Beschreibung:
103  --------------------------------------------------------------------*/
104 
105 SfxPoolItem* SwDocDisplayItem::Clone( SfxItemPool*	) const
106 {
107 	return new SwDocDisplayItem( *this );
108 }
109 
110 /*--------------------------------------------------------------------
111 	Beschreibung:
112  --------------------------------------------------------------------*/
113 
114 int SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
115 {
116 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
117 
118 	const SwDocDisplayItem& rItem = (SwDocDisplayItem&)rAttr;
119 
120 	return (  bParagraphEnd	  	  	== rItem.bParagraphEnd	  	 &&
121 			  bTab 				  	== rItem.bTab 				 &&
122 			  bSpace				== rItem.bSpace				 &&
123 			  bNonbreakingSpace	  	== rItem.bNonbreakingSpace	 &&
124 			  bSoftHyphen		  	== rItem.bSoftHyphen		 &&
125               bCharHiddenText       == rItem.bCharHiddenText         &&
126               bFldHiddenText        == rItem.bFldHiddenText         &&
127 			  bManualBreak 		  	== rItem.bManualBreak 		 &&
128               bShowHiddenPara       == rItem.bShowHiddenPara );
129 }
130 
131 
132 /*-----------------31.08.96 14.14-------------------
133 
134 --------------------------------------------------*/
135 
136 
137 void  SwDocDisplayItem::operator=( const SwDocDisplayItem& rDocDisplayItem)
138 {
139 	bParagraphEnd	  	= rDocDisplayItem.bParagraphEnd	  		;
140 	bTab 				= rDocDisplayItem.bTab 					;
141 	bSpace				= rDocDisplayItem.bSpace				;
142 	bNonbreakingSpace	= rDocDisplayItem.bNonbreakingSpace		;
143 	bSoftHyphen			= rDocDisplayItem.bSoftHyphen			;
144     bCharHiddenText     = rDocDisplayItem.bCharHiddenText           ;
145     bFldHiddenText      = rDocDisplayItem.bFldHiddenText           ;
146 	bManualBreak 		= rDocDisplayItem.bManualBreak 			;
147     bShowHiddenPara     = rDocDisplayItem.bShowHiddenPara       ;
148 }
149 
150 /*--------------------------------------------------------------------
151 	Beschreibung:
152  --------------------------------------------------------------------*/
153 void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const
154 {
155 	rVOpt.SetParagraph	(bParagraphEnd		);
156 	rVOpt.SetTab		(bTab				);
157 	rVOpt.SetBlank		(bSpace				);
158 	rVOpt.SetHardBlank	(bNonbreakingSpace	);
159 	rVOpt.SetSoftHyph	(bSoftHyphen		);
160     rVOpt.SetShowHiddenChar(bCharHiddenText );
161     rVOpt.SetShowHiddenField(bFldHiddenText        );
162 	rVOpt.SetLineBreak	(bManualBreak 		);
163     rVOpt.SetShowHiddenPara(bShowHiddenPara );
164 }
165 
166 
167 /*--------------------------------------------------------------------
168 	Beschreibung:
169  --------------------------------------------------------------------*/
170 SwElemItem::SwElemItem( sal_uInt16 _nWhich ) :
171     SfxPoolItem(_nWhich)
172 {
173 	bHorzScrollbar =
174 	bVertScrollbar =
175     bAnyRuler =
176     bHorzRuler     =
177 	bVertRuler	   =
178     bVertRulerRight=
179 	bCrosshair	   =
180 	bHandles	   =
181 	bBigHandles 	=
182     bSmoothScroll  =
183 	bTable				=
184 	bGraphic 			=
185 	bDrawing 			=
186 	bFieldName			=
187     bNotes              = sal_False;
188 }
189 /*--------------------------------------------------------------------
190 	Beschreibung:
191  --------------------------------------------------------------------*/
192 
193 SwElemItem::SwElemItem( const SwElemItem& rElemItem ):
194 			SfxPoolItem(rElemItem)
195 {
196 	*this = rElemItem;
197 }
198 /*--------------------------------------------------------------------
199 	Beschreibung:
200  --------------------------------------------------------------------*/
201 
202 SwElemItem::SwElemItem(const SwViewOption& rVOpt, sal_uInt16 _nWhich) :
203             SfxPoolItem( _nWhich )
204 {
205 	bHorzScrollbar	= rVOpt.IsViewHScrollBar();
206 	bVertScrollbar	= rVOpt.IsViewVScrollBar();
207     bAnyRuler       = rVOpt.IsViewAnyRuler();
208     bHorzRuler      = rVOpt.IsViewHRuler(sal_True);
209     bVertRuler      = rVOpt.IsViewVRuler(sal_True);
210     bVertRulerRight = rVOpt.IsVRulerRight();
211 	bCrosshair		= rVOpt.IsCrossHair();
212 	bHandles		= rVOpt.IsSolidMarkHdl();
213 	bBigHandles     = rVOpt.IsBigMarkHdl();
214 	bSmoothScroll	= rVOpt.IsSmoothScroll();
215 	bTable				= rVOpt.IsTable();
216 	bGraphic 			= rVOpt.IsGraphic();
217 	bDrawing 			= rVOpt.IsDraw() && rVOpt.IsControl();
218 	bFieldName			= rVOpt.IsFldName();
219 	bNotes				= rVOpt.IsPostIts();
220 
221 }
222 
223 /*--------------------------------------------------------------------
224 	Beschreibung:
225  --------------------------------------------------------------------*/
226 
227 SfxPoolItem* SwElemItem::Clone( SfxItemPool* ) const
228 {
229 	return new SwElemItem( *this );
230 }
231 
232 /*--------------------------------------------------------------------
233 	Beschreibung:
234  --------------------------------------------------------------------*/
235 
236 int SwElemItem::operator==( const SfxPoolItem& rAttr ) const
237 {
238 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
239 
240 	const SwElemItem& rItem = (SwElemItem&)rAttr;
241 
242 	return (	bHorzScrollbar	== rItem.bHorzScrollbar &&
243 				bVertScrollbar	== rItem.bVertScrollbar &&
244                 bAnyRuler       == rItem.bAnyRuler &&
245                 bHorzRuler      == rItem.bHorzRuler     &&
246 				bVertRuler		== rItem.bVertRuler		&&
247                 bVertRulerRight == rItem.bVertRulerRight&&
248 				bCrosshair		== rItem.bCrosshair		&&
249 				bHandles		== rItem.bHandles		&&
250 				bBigHandles  	== rItem.bBigHandles    &&
251                 bSmoothScroll   == rItem.bSmoothScroll  &&
252                 bTable                == rItem.bTable              &&
253                 bGraphic              == rItem.bGraphic            &&
254                 bDrawing              == rItem.bDrawing            &&
255                 bFieldName            == rItem.bFieldName          &&
256                 bNotes                == rItem.bNotes             );
257 }
258 
259 /*-----------------31.08.96 14.13-------------------
260 
261 --------------------------------------------------*/
262 
263 
264 void  SwElemItem::operator=( const SwElemItem& rElemItem)
265 {
266 	bHorzScrollbar	= rElemItem.  bHorzScrollbar	;
267 	bVertScrollbar	= rElemItem.  bVertScrollbar	;
268     bAnyRuler       = rElemItem.  bAnyRuler;
269     bHorzRuler      = rElemItem.  bHorzRuler        ;
270 	bVertRuler		= rElemItem.  bVertRuler		;
271     bVertRulerRight = rElemItem.  bVertRulerRight   ;
272 	bCrosshair		= rElemItem.  bCrosshair		;
273 	bHandles		= rElemItem.  bHandles			;
274 	bBigHandles  	= rElemItem.  bBigHandles 		;
275 	bSmoothScroll	= rElemItem.  bSmoothScroll		;
276     bTable              = rElemItem.bTable                ;
277     bGraphic            = rElemItem.bGraphic              ;
278     bDrawing            = rElemItem.bDrawing              ;
279     bFieldName          = rElemItem.bFieldName            ;
280     bNotes              = rElemItem.bNotes                ;
281 }
282 
283 /*--------------------------------------------------------------------
284 	Beschreibung:
285  --------------------------------------------------------------------*/
286 
287 void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const
288 {
289 	rVOpt.SetViewHScrollBar(bHorzScrollbar );
290 	rVOpt.SetViewVScrollBar(bVertScrollbar );
291     rVOpt.SetViewAnyRuler(bAnyRuler);
292     rVOpt.SetViewHRuler(bHorzRuler    );
293     rVOpt.SetViewVRuler(bVertRuler    );
294     rVOpt.SetVRulerRight(bVertRulerRight );
295 	rVOpt.SetCrossHair(bCrosshair	  );
296 	rVOpt.SetSolidMarkHdl(bHandles	  );
297 	rVOpt.SetBigMarkHdl(bBigHandles );
298 	rVOpt.SetSmoothScroll(bSmoothScroll);
299 	rVOpt.SetTable		(bTable			   	);
300 	rVOpt.SetGraphic	(bGraphic 		   	);
301 	rVOpt.SetDraw		(bDrawing 			);
302 	rVOpt.SetControl	(bDrawing 			);
303 	rVOpt.SetFldName	(bFieldName			);
304 	rVOpt.SetPostIts	(bNotes				);
305 }
306 
307 
308 /*--------------------------------------------------------------------
309 	Beschreibung: CopyCTOR
310  --------------------------------------------------------------------*/
311 
312 SwAddPrinterItem::SwAddPrinterItem( const SwAddPrinterItem& rAddPrinterItem ):
313             SfxPoolItem(rAddPrinterItem),
314             SwPrintData( rAddPrinterItem )
315 {
316 }
317 
318 /*--------------------------------------------------------------------
319 	Beschreibung: CTOR fuer leeres Item
320  --------------------------------------------------------------------*/
321 
322 SwAddPrinterItem::SwAddPrinterItem( sal_uInt16 _nWhich):
323                 SfxPoolItem(_nWhich)
324 {
325 }
326 /*--------------------------------------------------------------------
327 	Beschreibung: CTOR aus SwPrintOptions
328  --------------------------------------------------------------------*/
329 
330 SwAddPrinterItem::SwAddPrinterItem( sal_uInt16 _nWhich, const SwPrintData& rPrtData ) :
331     SfxPoolItem(_nWhich)
332 {
333     SwPrintData::operator=(rPrtData);
334 }
335 /*--------------------------------------------------------------------
336 	Beschreibung:
337  --------------------------------------------------------------------*/
338 
339 SfxPoolItem* SwAddPrinterItem::Clone( SfxItemPool* ) const
340 {
341 	return new SwAddPrinterItem( *this );
342 }
343 
344 /*--------------------------------------------------------------------
345 	Beschreibung:
346  --------------------------------------------------------------------*/
347 
348 int SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
349 {
350 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
351 
352 	const SwAddPrinterItem& rItem = (SwAddPrinterItem&)rAttr;
353 
354     return  SwPrintData::operator==(rItem);
355 }
356 /*-----------------03.11.97 10:00-------------------
357  Item fuer Einstellungsdialog, ShadowCursorSeite
358 --------------------------------------------------*/
359 
360 SwShadowCursorItem::SwShadowCursorItem( sal_uInt16 _nWhich )
361     : SfxPoolItem( _nWhich ),
362     eMode( FILL_TAB )
363     ,bOn( sal_False )
364 {
365 }
366 
367 SwShadowCursorItem::SwShadowCursorItem( const SwShadowCursorItem& rCpy )
368 	: SfxPoolItem( rCpy.Which() ),
369     eMode( rCpy.GetMode() )
370     ,bOn( rCpy.IsOn() )
371 
372 {
373 }
374 
375 SwShadowCursorItem::SwShadowCursorItem( const SwViewOption& rVOpt, sal_uInt16 _nWhich )
376     : SfxPoolItem( _nWhich ),
377     eMode( rVOpt.GetShdwCrsrFillMode() )
378     ,bOn( rVOpt.IsShadowCursor() )
379 
380 {
381 }
382 
383 SfxPoolItem* SwShadowCursorItem::Clone( SfxItemPool* ) const
384 {
385 	return new SwShadowCursorItem( *this );
386 }
387 
388 int SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const
389 {
390 	return	IsOn() == ((SwShadowCursorItem&)rCmp).IsOn() &&
391             GetMode() == ((SwShadowCursorItem&)rCmp).GetMode();
392 }
393 
394 void SwShadowCursorItem::operator=( const SwShadowCursorItem& rCpy )
395 {
396 	SetOn( rCpy.IsOn() );
397 	SetMode( rCpy.GetMode() );
398 }
399 
400 
401 void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const
402 {
403 	rVOpt.SetShadowCursor( bOn );
404 	rVOpt.SetShdwCrsrFillMode( eMode );
405 }
406 
407 #ifdef DBG_UTIL
408 /*--------------------------------------------------------------------
409 	Beschreibung:
410  --------------------------------------------------------------------*/
411 
412 SwTestItem::SwTestItem( const SwTestItem& rTestItem ):
413 			SfxPoolItem(rTestItem)
414 {
415 	bTest1=rTestItem.bTest1;
416 	bTest2=rTestItem.bTest2;
417 	bTest3=rTestItem.bTest3;
418 	bTest4=rTestItem.bTest4;
419 	bTest5=rTestItem.bTest5;
420 	bTest6=rTestItem.bTest6;
421 	bTest7=rTestItem.bTest7;
422 	bTest8=rTestItem.bTest8;
423 	bTest9=rTestItem.bTest9;
424 	bTest10=rTestItem.bTest10;
425 };
426 
427 /*--------------------------------------------------------------------
428 	Beschreibung:
429  --------------------------------------------------------------------*/
430 
431 SfxPoolItem* SwTestItem::Clone( SfxItemPool* ) const
432 {
433 	return new SwTestItem( *this );
434 }
435 
436 /*--------------------------------------------------------------------
437 	Beschreibung:
438  --------------------------------------------------------------------*/
439 
440 int SwTestItem::operator==( const SfxPoolItem& rAttr ) const
441 {
442 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
443 
444 	const SwTestItem& rItem = (const SwTestItem&) rAttr;
445 
446 	return ( bTest1==rItem.bTest1&&
447 			 bTest2==rItem.bTest2&&
448 			 bTest3==rItem.bTest3&&
449 			 bTest4==rItem.bTest4&&
450 			 bTest5==rItem.bTest5&&
451 			 bTest6==rItem.bTest6&&
452 			 bTest7==rItem.bTest7&&
453 			 bTest8==rItem.bTest8&&
454 			 bTest9==rItem.bTest9&&
455 			 bTest10==rItem.bTest10);
456 }
457 
458 #endif
459 
460 
461