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