1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cfgitems.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #ifndef __SBX_SBXVARIABLE_HXX //autogen
36 #include <basic/sbxvar.hxx>
39 #ifndef _SVX_SVXIDS_HRC //autogen
40 #include <svx/svxids.hrc>
42 #include <svx/svxenum.hxx>
45 #include "viewopt.hxx"
46 #include "swtypes.hxx"
49 #include "cfgitems.hxx"
50 #include "crstate.hxx"
54 TYPEINIT1_AUTOFACTORY(SwDocDisplayItem
, SfxPoolItem
)
55 TYPEINIT1_AUTOFACTORY(SwElemItem
, SfxPoolItem
)
56 TYPEINIT1_AUTOFACTORY(SwAddPrinterItem
, SfxPoolItem
)
57 TYPEINIT1_AUTOFACTORY(SwShadowCursorItem
, SfxPoolItem
)
60 SwDocDisplayItem::SwDocDisplayItem( USHORT _nWhich
) :
62 aIndexBackgrndCol(COL_GRAY
)
72 bShowHiddenPara
= FALSE
;
76 /*------------OS 12.01.95 -------------------------------------------
77 Item fuer Einstellungsdialog, Seite Dokumentansicht
78 --------------------------------------------------------------------*/
80 SwDocDisplayItem::SwDocDisplayItem( const SwDocDisplayItem
& rDocDisplayItem
):
81 SfxPoolItem(rDocDisplayItem
)
83 *this = rDocDisplayItem
;
86 /*----------------------- -------------------------------------------
88 --------------------------------------------------------------------*/
90 SwDocDisplayItem::SwDocDisplayItem(const SwViewOption
& rVOpt
, USHORT _nWhich
) :
91 SfxPoolItem( _nWhich
)
93 bParagraphEnd
= rVOpt
.IsParagraph(TRUE
);
94 bTab
= rVOpt
.IsTab(TRUE
);
95 bSpace
= rVOpt
.IsBlank(TRUE
);
96 bNonbreakingSpace
= rVOpt
.IsHardBlank();
97 bSoftHyphen
= rVOpt
.IsSoftHyph();
98 bCharHiddenText
= rVOpt
.IsShowHiddenChar(TRUE
);
99 bFldHiddenText
= rVOpt
.IsShowHiddenField();
100 bManualBreak
= rVOpt
.IsLineBreak(TRUE
);
101 bShowHiddenPara
= rVOpt
.IsShowHiddenPara();
104 /*--------------------------------------------------------------------
106 --------------------------------------------------------------------*/
108 SfxPoolItem
* SwDocDisplayItem::Clone( SfxItemPool
* ) const
110 return new SwDocDisplayItem( *this );
113 /*--------------------------------------------------------------------
115 --------------------------------------------------------------------*/
117 int SwDocDisplayItem::operator==( const SfxPoolItem
& rAttr
) const
119 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unterschiedliche Typen" );
121 const SwDocDisplayItem
& rItem
= (SwDocDisplayItem
&)rAttr
;
123 return ( bParagraphEnd
== rItem
.bParagraphEnd
&&
124 bTab
== rItem
.bTab
&&
125 bSpace
== rItem
.bSpace
&&
126 bNonbreakingSpace
== rItem
.bNonbreakingSpace
&&
127 bSoftHyphen
== rItem
.bSoftHyphen
&&
128 bCharHiddenText
== rItem
.bCharHiddenText
&&
129 bFldHiddenText
== rItem
.bFldHiddenText
&&
130 bManualBreak
== rItem
.bManualBreak
&&
131 bShowHiddenPara
== rItem
.bShowHiddenPara
);
135 /*-----------------31.08.96 14.14-------------------
137 --------------------------------------------------*/
140 void SwDocDisplayItem::operator=( const SwDocDisplayItem
& rDocDisplayItem
)
142 bParagraphEnd
= rDocDisplayItem
.bParagraphEnd
;
143 bTab
= rDocDisplayItem
.bTab
;
144 bSpace
= rDocDisplayItem
.bSpace
;
145 bNonbreakingSpace
= rDocDisplayItem
.bNonbreakingSpace
;
146 bSoftHyphen
= rDocDisplayItem
.bSoftHyphen
;
147 bCharHiddenText
= rDocDisplayItem
.bCharHiddenText
;
148 bFldHiddenText
= rDocDisplayItem
.bFldHiddenText
;
149 bManualBreak
= rDocDisplayItem
.bManualBreak
;
150 bShowHiddenPara
= rDocDisplayItem
.bShowHiddenPara
;
153 /*--------------------------------------------------------------------
155 --------------------------------------------------------------------*/
156 void SwDocDisplayItem::FillViewOptions( SwViewOption
& rVOpt
) const
158 rVOpt
.SetParagraph (bParagraphEnd
);
159 rVOpt
.SetTab (bTab
);
160 rVOpt
.SetBlank (bSpace
);
161 rVOpt
.SetHardBlank (bNonbreakingSpace
);
162 rVOpt
.SetSoftHyph (bSoftHyphen
);
163 rVOpt
.SetShowHiddenChar(bCharHiddenText
);
164 rVOpt
.SetShowHiddenField(bFldHiddenText
);
165 rVOpt
.SetLineBreak (bManualBreak
);
166 rVOpt
.SetShowHiddenPara(bShowHiddenPara
);
170 /*--------------------------------------------------------------------
172 --------------------------------------------------------------------*/
173 SwElemItem::SwElemItem( USHORT _nWhich
) :
192 /*--------------------------------------------------------------------
194 --------------------------------------------------------------------*/
196 SwElemItem::SwElemItem( const SwElemItem
& rElemItem
):
197 SfxPoolItem(rElemItem
)
201 /*--------------------------------------------------------------------
203 --------------------------------------------------------------------*/
205 SwElemItem::SwElemItem(const SwViewOption
& rVOpt
, USHORT _nWhich
) :
206 SfxPoolItem( _nWhich
)
208 bHorzScrollbar
= rVOpt
.IsViewHScrollBar();
209 bVertScrollbar
= rVOpt
.IsViewVScrollBar();
210 bAnyRuler
= rVOpt
.IsViewAnyRuler();
211 bHorzRuler
= rVOpt
.IsViewHRuler(TRUE
);
212 bVertRuler
= rVOpt
.IsViewVRuler(TRUE
);
213 bVertRulerRight
= rVOpt
.IsVRulerRight();
214 bCrosshair
= rVOpt
.IsCrossHair();
215 bHandles
= rVOpt
.IsSolidMarkHdl();
216 bBigHandles
= rVOpt
.IsBigMarkHdl();
217 bSmoothScroll
= rVOpt
.IsSmoothScroll();
218 bTable
= rVOpt
.IsTable();
219 bGraphic
= rVOpt
.IsGraphic();
220 bDrawing
= rVOpt
.IsDraw() && rVOpt
.IsControl();
221 bFieldName
= rVOpt
.IsFldName();
222 bNotes
= rVOpt
.IsPostIts();
226 /*--------------------------------------------------------------------
228 --------------------------------------------------------------------*/
230 SfxPoolItem
* SwElemItem::Clone( SfxItemPool
* ) const
232 return new SwElemItem( *this );
235 /*--------------------------------------------------------------------
237 --------------------------------------------------------------------*/
239 int SwElemItem::operator==( const SfxPoolItem
& rAttr
) const
241 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unterschiedliche Typen" );
243 const SwElemItem
& rItem
= (SwElemItem
&)rAttr
;
245 return ( bHorzScrollbar
== rItem
.bHorzScrollbar
&&
246 bVertScrollbar
== rItem
.bVertScrollbar
&&
247 bAnyRuler
== rItem
.bAnyRuler
&&
248 bHorzRuler
== rItem
.bHorzRuler
&&
249 bVertRuler
== rItem
.bVertRuler
&&
250 bVertRulerRight
== rItem
.bVertRulerRight
&&
251 bCrosshair
== rItem
.bCrosshair
&&
252 bHandles
== rItem
.bHandles
&&
253 bBigHandles
== rItem
.bBigHandles
&&
254 bSmoothScroll
== rItem
.bSmoothScroll
&&
255 bTable
== rItem
.bTable
&&
256 bGraphic
== rItem
.bGraphic
&&
257 bDrawing
== rItem
.bDrawing
&&
258 bFieldName
== rItem
.bFieldName
&&
259 bNotes
== rItem
.bNotes
);
262 /*-----------------31.08.96 14.13-------------------
264 --------------------------------------------------*/
267 void SwElemItem::operator=( const SwElemItem
& rElemItem
)
269 bHorzScrollbar
= rElemItem
. bHorzScrollbar
;
270 bVertScrollbar
= rElemItem
. bVertScrollbar
;
271 bAnyRuler
= rElemItem
. bAnyRuler
;
272 bHorzRuler
= rElemItem
. bHorzRuler
;
273 bVertRuler
= rElemItem
. bVertRuler
;
274 bVertRulerRight
= rElemItem
. bVertRulerRight
;
275 bCrosshair
= rElemItem
. bCrosshair
;
276 bHandles
= rElemItem
. bHandles
;
277 bBigHandles
= rElemItem
. bBigHandles
;
278 bSmoothScroll
= rElemItem
. bSmoothScroll
;
279 bTable
= rElemItem
.bTable
;
280 bGraphic
= rElemItem
.bGraphic
;
281 bDrawing
= rElemItem
.bDrawing
;
282 bFieldName
= rElemItem
.bFieldName
;
283 bNotes
= rElemItem
.bNotes
;
286 /*--------------------------------------------------------------------
288 --------------------------------------------------------------------*/
290 void SwElemItem::FillViewOptions( SwViewOption
& rVOpt
) const
292 rVOpt
.SetViewHScrollBar(bHorzScrollbar
);
293 rVOpt
.SetViewVScrollBar(bVertScrollbar
);
294 rVOpt
.SetViewAnyRuler(bAnyRuler
);
295 rVOpt
.SetViewHRuler(bHorzRuler
);
296 rVOpt
.SetViewVRuler(bVertRuler
);
297 rVOpt
.SetVRulerRight(bVertRulerRight
);
298 rVOpt
.SetCrossHair(bCrosshair
);
299 rVOpt
.SetSolidMarkHdl(bHandles
);
300 rVOpt
.SetBigMarkHdl(bBigHandles
);
301 rVOpt
.SetSmoothScroll(bSmoothScroll
);
302 rVOpt
.SetTable (bTable
);
303 rVOpt
.SetGraphic (bGraphic
);
304 rVOpt
.SetDraw (bDrawing
);
305 rVOpt
.SetControl (bDrawing
);
306 rVOpt
.SetFldName (bFieldName
);
307 rVOpt
.SetPostIts (bNotes
);
311 /*--------------------------------------------------------------------
312 Beschreibung: CopyCTOR
313 --------------------------------------------------------------------*/
315 SwAddPrinterItem::SwAddPrinterItem( const SwAddPrinterItem
& rAddPrinterItem
):
316 SfxPoolItem(rAddPrinterItem
),
317 SwPrintData( rAddPrinterItem
)
321 /*--------------------------------------------------------------------
322 Beschreibung: CTOR fuer leeres Item
323 --------------------------------------------------------------------*/
325 SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich
):
329 /*--------------------------------------------------------------------
330 Beschreibung: CTOR aus SwPrintOptions
331 --------------------------------------------------------------------*/
333 SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich
, const SwPrintData
& rPrtData
) :
336 SwPrintData::operator=(rPrtData
);
338 /*--------------------------------------------------------------------
340 --------------------------------------------------------------------*/
342 SfxPoolItem
* SwAddPrinterItem::Clone( SfxItemPool
* ) const
344 return new SwAddPrinterItem( *this );
347 /*--------------------------------------------------------------------
349 --------------------------------------------------------------------*/
351 int SwAddPrinterItem::operator==( const SfxPoolItem
& rAttr
) const
353 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unterschiedliche Typen" );
355 const SwAddPrinterItem
& rItem
= (SwAddPrinterItem
&)rAttr
;
357 return SwPrintData::operator==(rItem
);
359 /*-----------------03.11.97 10:00-------------------
360 Item fuer Einstellungsdialog, ShadowCursorSeite
361 --------------------------------------------------*/
363 SwShadowCursorItem::SwShadowCursorItem( USHORT _nWhich
)
364 : SfxPoolItem( _nWhich
),
370 SwShadowCursorItem::SwShadowCursorItem( const SwShadowCursorItem
& rCpy
)
371 : SfxPoolItem( rCpy
.Which() ),
372 eMode( rCpy
.GetMode() )
378 SwShadowCursorItem::SwShadowCursorItem( const SwViewOption
& rVOpt
, USHORT _nWhich
)
379 : SfxPoolItem( _nWhich
),
380 eMode( rVOpt
.GetShdwCrsrFillMode() )
381 ,bOn( rVOpt
.IsShadowCursor() )
386 SfxPoolItem
* SwShadowCursorItem::Clone( SfxItemPool
* ) const
388 return new SwShadowCursorItem( *this );
391 int SwShadowCursorItem::operator==( const SfxPoolItem
& rCmp
) const
393 return IsOn() == ((SwShadowCursorItem
&)rCmp
).IsOn() &&
394 GetMode() == ((SwShadowCursorItem
&)rCmp
).GetMode();
397 void SwShadowCursorItem::operator=( const SwShadowCursorItem
& rCpy
)
399 SetOn( rCpy
.IsOn() );
400 SetMode( rCpy
.GetMode() );
404 void SwShadowCursorItem::FillViewOptions( SwViewOption
& rVOpt
) const
406 rVOpt
.SetShadowCursor( bOn
);
407 rVOpt
.SetShdwCrsrFillMode( eMode
);
411 /*--------------------------------------------------------------------
413 --------------------------------------------------------------------*/
415 SwTestItem::SwTestItem( const SwTestItem
& rTestItem
):
416 SfxPoolItem(rTestItem
)
418 bTest1
=rTestItem
.bTest1
;
419 bTest2
=rTestItem
.bTest2
;
420 bTest3
=rTestItem
.bTest3
;
421 bTest4
=rTestItem
.bTest4
;
422 bTest5
=rTestItem
.bTest5
;
423 bTest6
=rTestItem
.bTest6
;
424 bTest7
=rTestItem
.bTest7
;
425 bTest8
=rTestItem
.bTest8
;
426 bTest9
=rTestItem
.bTest9
;
427 bTest10
=rTestItem
.bTest10
;
430 /*--------------------------------------------------------------------
432 --------------------------------------------------------------------*/
434 SfxPoolItem
* SwTestItem::Clone( SfxItemPool
* ) const
436 return new SwTestItem( *this );
439 /*--------------------------------------------------------------------
441 --------------------------------------------------------------------*/
443 int SwTestItem::operator==( const SfxPoolItem
& rAttr
) const
445 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unterschiedliche Typen" );
447 const SwTestItem
& rItem
= (const SwTestItem
&) rAttr
;
449 return ( bTest1
==rItem
.bTest1
&&
450 bTest2
==rItem
.bTest2
&&
451 bTest3
==rItem
.bTest3
&&
452 bTest4
==rItem
.bTest4
&&
453 bTest5
==rItem
.bTest5
&&
454 bTest6
==rItem
.bTest6
&&
455 bTest7
==rItem
.bTest7
&&
456 bTest8
==rItem
.bTest8
&&
457 bTest9
==rItem
.bTest9
&&
458 bTest10
==rItem
.bTest10
);