Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/svdmodel.hxx>
30 : : #include <sfx2/app.hxx>
31 : : #include <sfx2/sfx.hrc>
32 : : #include <tools/helpers.hxx>
33 : : #include <unotools/syslocale.hxx>
34 : :
35 : : #include "app.hxx"
36 : : #include "optsitem.hxx"
37 : : #include "cfgids.hxx"
38 : : #include "FrameView.hxx"
39 : :
40 : : using namespace ::rtl;
41 : : using namespace ::utl;
42 : : using namespace ::com::sun::star::uno;
43 : :
44 : : #define B2U(_def_aStr) (OUString::createFromAscii(_def_aStr))
45 : :
46 : 34 : template< class T > T getSafeValue( const Any& rAny )
47 : : {
48 : 34 : T value = T();
49 : 34 : bool bOk = (rAny >>= value);
50 : :
51 : : DBG_ASSERT( bOk, "SdOptionsItem, wrong type from configuration!" );
52 : : (void)bOk;
53 : :
54 : 34 : return value;
55 : : }
56 : :
57 : : // -----------------
58 : : // - SdOptionsItem -
59 : : // -----------------
60 : :
61 : 142 : SdOptionsItem::SdOptionsItem( const SdOptionsGeneric& rParent, const OUString rSubTree ) :
62 : : ConfigItem ( rSubTree ),
63 : 142 : mrParent ( rParent )
64 : : {
65 : 142 : }
66 : :
67 : : // -----------------------------------------------------------------------------
68 : :
69 : 112 : SdOptionsItem::~SdOptionsItem()
70 : : {
71 [ - + ]: 224 : }
72 : :
73 : : // -----------------------------------------------------------------------------
74 : :
75 : 0 : void SdOptionsItem::Commit()
76 : : {
77 [ # # ]: 0 : if( IsModified() )
78 : 0 : mrParent.Commit( *this );
79 : 0 : };
80 : :
81 : 0 : void SdOptionsItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
82 : 0 : {}
83 : :
84 : :
85 : : // -----------------------------------------------------------------------------
86 : :
87 : 142 : Sequence< Any > SdOptionsItem::GetProperties( const Sequence< OUString >& rNames )
88 : : {
89 : 142 : return ConfigItem::GetProperties( rNames );
90 : : }
91 : :
92 : : // -----------------------------------------------------------------------------
93 : :
94 : 0 : sal_Bool SdOptionsItem::PutProperties( const Sequence< OUString >& rNames, const Sequence< Any>& rValues )
95 : : {
96 : 0 : return ConfigItem::PutProperties( rNames, rValues );
97 : : }
98 : :
99 : : // -----------------------------------------------------------------------------
100 : :
101 : 0 : void SdOptionsItem::SetModified()
102 : : {
103 : 0 : ConfigItem::SetModified();
104 : 0 : }
105 : :
106 : : // --------------------
107 : : // - SdOptionsGeneric -
108 : : // --------------------
109 : :
110 : 937 : SdOptionsGeneric::SdOptionsGeneric( sal_uInt16 nConfigId, const OUString& rSubTree ) :
111 : : maSubTree ( rSubTree ),
112 : : mpCfgItem ( NULL ),
113 : : mnConfigId ( nConfigId ),
114 : 937 : mbInit ( rSubTree.isEmpty() )
115 : : {
116 : 937 : }
117 : :
118 : : // -----------------------------------------------------------------------------
119 : :
120 : 29461 : void SdOptionsGeneric::Init() const
121 : : {
122 [ + + ]: 29461 : if( !mbInit )
123 : : {
124 : 142 : SdOptionsGeneric* pThis = const_cast<SdOptionsGeneric*>(this);
125 : :
126 [ + - ]: 142 : if( !mpCfgItem )
127 [ + - ][ + - ]: 142 : pThis->mpCfgItem = new SdOptionsItem( *this, maSubTree );
128 : :
129 [ + - ]: 142 : const Sequence< OUString > aNames( GetPropertyNames() );
130 [ + - ]: 142 : const Sequence< Any > aValues = mpCfgItem->GetProperties( aNames );
131 : :
132 [ + - ][ + - ]: 142 : if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
[ + - ]
133 : : {
134 : 142 : const Any* pValues = aValues.getConstArray();
135 : :
136 : 142 : pThis->EnableModify( sal_False );
137 [ + - ]: 142 : pThis->mbInit = pThis->ReadData( pValues );
138 : 142 : pThis->EnableModify( sal_True );
139 : : }
140 : : else
141 [ + - ][ + - ]: 142 : pThis->mbInit = sal_True;
142 : : }
143 : 29461 : }
144 : :
145 : : // -----------------------------------------------------------------------------
146 : :
147 : 874 : SdOptionsGeneric::~SdOptionsGeneric()
148 : : {
149 [ + + ]: 874 : if( mpCfgItem )
150 [ + - ][ + - ]: 112 : delete mpCfgItem;
151 [ - + ]: 874 : }
152 : :
153 : : // -----------------------------------------------------------------------------
154 : :
155 : 0 : void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const
156 : : {
157 [ # # ]: 0 : const Sequence< OUString > aNames( GetPropertyNames() );
158 [ # # ]: 0 : Sequence< Any > aValues( aNames.getLength() );
159 : :
160 [ # # ][ # # ]: 0 : if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) )
[ # # ]
161 : : {
162 [ # # ][ # # ]: 0 : if( (const_cast<SdOptionsGeneric*>(this))->WriteData( aValues.getArray() ) )
[ # # ]
163 [ # # ]: 0 : rCfgItem.PutProperties( aNames, aValues );
164 : : else
165 : : {
166 : : OSL_FAIL( "PutProperties failed" );
167 : : }
168 [ # # ][ # # ]: 0 : }
169 : 0 : }
170 : :
171 : : // -----------------------------------------------------------------------------
172 : :
173 : 142 : Sequence< OUString > SdOptionsGeneric::GetPropertyNames() const
174 : : {
175 : : sal_uLong nCount;
176 : : const char** ppPropNames;
177 : :
178 [ + - ]: 142 : GetPropNameArray( ppPropNames, nCount );
179 : :
180 [ + - ]: 142 : Sequence< OUString > aNames( nCount );
181 [ + - ]: 142 : OUString* pNames = aNames.getArray();
182 : :
183 [ + + ]: 1654 : for( sal_uLong i = 0; i < nCount; i++ )
184 : 1512 : pNames[ i ] = OUString::createFromAscii( ppPropNames[ i ] );
185 : :
186 : 142 : return aNames;
187 : : }
188 : :
189 : : // -----------------------------------------------------------------------------
190 : :
191 : 0 : void SdOptionsGeneric::Store()
192 : : {
193 [ # # ]: 0 : if( mpCfgItem )
194 : 0 : mpCfgItem->Commit();
195 : 0 : }
196 : :
197 : : // -----------------------------------------------------------------------------
198 : :
199 : 96 : bool SdOptionsGeneric::isMetricSystem()
200 : : {
201 [ + - ]: 96 : SvtSysLocale aSysLocale;
202 [ + - ][ + - ]: 96 : MeasurementSystem eSys = aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum();
203 : :
204 [ + - ]: 96 : return ( eSys == MEASURE_METRIC );
205 : : }
206 : :
207 : : /*************************************************************************
208 : : |*
209 : : |* SdOptionsLayout
210 : : |*
211 : : \************************************************************************/
212 : :
213 : 33 : SdOptionsLayout::SdOptionsLayout( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
214 : : SdOptionsGeneric( nConfigId, bUseConfig ?
215 : : ( ( SDCFG_DRAW == nConfigId ) ?
216 : : B2U( "Office.Draw/Layout" ) :
217 : : B2U( "Office.Impress/Layout" ) ) :
218 : : OUString() ),
219 : : bRuler( sal_True ),
220 : : bMoveOutline( sal_True ),
221 : : bDragStripes( sal_False ),
222 : : bHandlesBezier( sal_False ),
223 : : bHelplines( sal_True ),
224 [ + - ]: 33 : nMetric((sal_uInt16)(isMetricSystem() ? FUNIT_CM : FUNIT_INCH)),
225 [ + - ][ + + ]: 66 : nDefTab( 1250 )
[ + - ][ - + ]
226 : : {
227 : 33 : EnableModify( sal_True );
228 : 33 : }
229 : :
230 : : // -----------------------------------------------------------------------------
231 : :
232 : 0 : sal_Bool SdOptionsLayout::operator==( const SdOptionsLayout& rOpt ) const
233 : : {
234 : 0 : return( IsRulerVisible() == rOpt.IsRulerVisible() &&
235 : 0 : IsMoveOutline() == rOpt.IsMoveOutline() &&
236 : 0 : IsDragStripes() == rOpt.IsDragStripes() &&
237 : 0 : IsHandlesBezier() == rOpt.IsHandlesBezier() &&
238 : 0 : IsHelplines() == rOpt.IsHelplines() &&
239 : 0 : GetMetric() == rOpt.GetMetric() &&
240 [ # # ][ # # : 0 : GetDefTab() == rOpt.GetDefTab() );
# # # # #
# # # #
# ]
241 : : }
242 : :
243 : : // -----------------------------------------------------------------------------
244 : :
245 : 33 : void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
246 : : {
247 : : static const char* aPropNamesMetric[] =
248 : : {
249 : : "Display/Ruler",
250 : : "Display/Bezier",
251 : : "Display/Contour",
252 : : "Display/Guide",
253 : : "Display/Helpline",
254 : : "Other/MeasureUnit/Metric",
255 : : "Other/TabStop/Metric"
256 : : };
257 : :
258 : : static const char* aPropNamesNonMetric[] =
259 : : {
260 : : "Display/Ruler",
261 : : "Display/Bezier",
262 : : "Display/Contour",
263 : : "Display/Guide",
264 : : "Display/Helpline",
265 : : "Other/MeasureUnit/NonMetric",
266 : : "Other/TabStop/NonMetric"
267 : : };
268 : :
269 : 33 : rCount = 7;
270 : :
271 [ - + ]: 33 : if( isMetricSystem() )
272 : 0 : ppNames = aPropNamesMetric;
273 : : else
274 : 33 : ppNames = aPropNamesNonMetric;
275 : 33 : }
276 : :
277 : : // -----------------------------------------------------------------------------
278 : :
279 : 33 : sal_Bool SdOptionsLayout::ReadData( const Any* pValues )
280 : : {
281 [ + - ]: 33 : if( pValues[0].hasValue() ) SetRulerVisible( *(sal_Bool*) pValues[ 0 ].getValue() );
282 [ + - ]: 33 : if( pValues[1].hasValue() ) SetHandlesBezier( *(sal_Bool*) pValues[ 1 ].getValue() );
283 [ + - ]: 33 : if( pValues[2].hasValue() ) SetMoveOutline( *(sal_Bool*) pValues[ 2 ].getValue() );
284 [ + - ]: 33 : if( pValues[3].hasValue() ) SetDragStripes( *(sal_Bool*) pValues[ 3 ].getValue() );
285 [ + - ]: 33 : if( pValues[4].hasValue() ) SetHelplines( *(sal_Bool*) pValues[ 4 ].getValue() );
286 [ + - ]: 33 : if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *(sal_Int32*) pValues[ 5 ].getValue() );
287 [ + - ]: 33 : if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *(sal_Int32*) pValues[ 6 ].getValue() );
288 : :
289 : 33 : return sal_True;
290 : : }
291 : :
292 : : // -----------------------------------------------------------------------------
293 : :
294 : 0 : sal_Bool SdOptionsLayout::WriteData( Any* pValues ) const
295 : : {
296 [ # # ]: 0 : pValues[ 0 ] <<= IsRulerVisible();
297 [ # # ]: 0 : pValues[ 1 ] <<= IsHandlesBezier();
298 [ # # ]: 0 : pValues[ 2 ] <<= IsMoveOutline();
299 [ # # ]: 0 : pValues[ 3 ] <<= IsDragStripes();
300 [ # # ]: 0 : pValues[ 4 ] <<= IsHelplines();
301 [ # # ]: 0 : pValues[ 5 ] <<= (sal_Int32) GetMetric();
302 [ # # ]: 0 : pValues[ 6 ] <<= (sal_Int32) GetDefTab();
303 : :
304 : 0 : return sal_True;
305 : : }
306 : :
307 : : /*************************************************************************
308 : : |*
309 : : |* SdOptionsLayoutItem
310 : : |*
311 : : \************************************************************************/
312 : :
313 : 0 : SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich )
314 : : : SfxPoolItem ( _nWhich )
315 [ # # ]: 0 : , maOptionsLayout ( 0, sal_False )
316 : : {
317 : 0 : }
318 : :
319 : : // ----------------------------------------------------------------------
320 : :
321 : 0 : SdOptionsLayoutItem::SdOptionsLayoutItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
322 : : : SfxPoolItem ( _nWhich )
323 [ # # ]: 0 : , maOptionsLayout ( 0, sal_False )
324 : : {
325 [ # # ]: 0 : if( pOpts )
326 : : {
327 [ # # ][ # # ]: 0 : maOptionsLayout.SetMetric( pOpts->GetMetric() );
328 [ # # ][ # # ]: 0 : maOptionsLayout.SetDefTab( pOpts->GetDefTab() );
329 : : }
330 : :
331 [ # # ]: 0 : if( pView )
332 : : {
333 [ # # ]: 0 : maOptionsLayout.SetRulerVisible( pView->HasRuler() );
334 [ # # ]: 0 : maOptionsLayout.SetMoveOutline( !pView->IsNoDragXorPolys() );
335 [ # # ]: 0 : maOptionsLayout.SetDragStripes( pView->IsDragStripes() );
336 [ # # ]: 0 : maOptionsLayout.SetHandlesBezier( pView->IsPlusHandlesAlwaysVisible() );
337 [ # # ]: 0 : maOptionsLayout.SetHelplines( pView->IsHlplVisible() );
338 : : }
339 [ # # ]: 0 : else if( pOpts )
340 : : {
341 [ # # ][ # # ]: 0 : maOptionsLayout.SetRulerVisible( pOpts->IsRulerVisible() );
342 [ # # ][ # # ]: 0 : maOptionsLayout.SetMoveOutline( pOpts->IsMoveOutline() );
343 [ # # ][ # # ]: 0 : maOptionsLayout.SetDragStripes( pOpts->IsDragStripes() );
344 [ # # ][ # # ]: 0 : maOptionsLayout.SetHandlesBezier( pOpts->IsHandlesBezier() );
345 [ # # ][ # # ]: 0 : maOptionsLayout.SetHelplines( pOpts->IsHelplines() );
346 : : }
347 : 0 : }
348 : :
349 : : // ----------------------------------------------------------------------
350 : :
351 : 0 : SfxPoolItem* SdOptionsLayoutItem::Clone( SfxItemPool* ) const
352 : : {
353 [ # # ]: 0 : return new SdOptionsLayoutItem( *this );
354 : : }
355 : :
356 : :
357 : : // ----------------------------------------------------------------------
358 : :
359 : 0 : int SdOptionsLayoutItem::operator==( const SfxPoolItem& rAttr ) const
360 : : {
361 : 0 : const bool bSameType = SfxPoolItem::operator==( rAttr );
362 : : DBG_ASSERT( bSameType, "SdOptionsLayoutItem::operator==(), different pool item type!" );
363 [ # # ][ # # ]: 0 : return bSameType && ( maOptionsLayout == static_cast< const SdOptionsLayoutItem& >( rAttr ).maOptionsLayout );
364 : : }
365 : :
366 : : // -----------------------------------------------------------------------
367 : :
368 : 0 : void SdOptionsLayoutItem::SetOptions( SdOptions* pOpts ) const
369 : : {
370 [ # # ]: 0 : if( pOpts )
371 : : {
372 : 0 : pOpts->SetRulerVisible( maOptionsLayout.IsRulerVisible() );
373 : 0 : pOpts->SetMoveOutline( maOptionsLayout.IsMoveOutline() );
374 : 0 : pOpts->SetDragStripes( maOptionsLayout.IsDragStripes() );
375 : 0 : pOpts->SetHandlesBezier( maOptionsLayout.IsHandlesBezier() );
376 : 0 : pOpts->SetHelplines( maOptionsLayout.IsHelplines() );
377 : 0 : pOpts->SetMetric( maOptionsLayout.GetMetric() );
378 : 0 : pOpts->SetDefTab( maOptionsLayout.GetDefTab() );
379 : : }
380 : 0 : }
381 : :
382 : : /*************************************************************************
383 : : |*
384 : : |* SdOptionsContents
385 : : |*
386 : : \************************************************************************/
387 : :
388 : 33 : SdOptionsContents::SdOptionsContents( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
389 : : SdOptionsGeneric( nConfigId, bUseConfig ?
390 : : ( ( SDCFG_DRAW == nConfigId ) ?
391 : : B2U( "Office.Draw/Content" ) :
392 : : B2U( "Office.Impress/Content" ) ) :
393 [ + - ][ + + ]: 33 : OUString() )
[ + - ]
394 : : {
395 : 33 : EnableModify( sal_True );
396 : 33 : }
397 : :
398 : : // -----------------------------------------------------------------------------
399 : :
400 : 0 : sal_Bool SdOptionsContents::operator==(const SdOptionsContents&) const
401 : : {
402 : 0 : return true;
403 : : }
404 : :
405 : : // -----------------------------------------------------------------------------
406 : :
407 : 0 : void SdOptionsContents::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
408 : : {
409 : : static const char* aPropNames[] =
410 : : {
411 : : "Display/PicturePlaceholder",
412 : : "Display/ContourMode",
413 : : "Display/LineContour",
414 : : "Display/TextPlaceholder"
415 : : };
416 : :
417 : 0 : rCount = 4;
418 : 0 : ppNames = aPropNames;
419 : 0 : }
420 : :
421 : : // -----------------------------------------------------------------------------
422 : :
423 : 0 : sal_Bool SdOptionsContents::ReadData(const Any*)
424 : : {
425 : 0 : return sal_True;
426 : : }
427 : :
428 : : // -----------------------------------------------------------------------------
429 : :
430 : 0 : sal_Bool SdOptionsContents::WriteData( Any* pValues ) const
431 : : {
432 : : //#i80528# no draft anymore
433 [ # # ]: 0 : pValues[ 0 ] <<= (sal_Bool)false;
434 [ # # ]: 0 : pValues[ 1 ] <<= (sal_Bool)false;
435 [ # # ]: 0 : pValues[ 2 ] <<= (sal_Bool)false;
436 [ # # ]: 0 : pValues[ 3 ] <<= (sal_Bool)false;
437 : :
438 : 0 : return sal_True;
439 : : }
440 : :
441 : : /*************************************************************************
442 : : |*
443 : : |* SdOptionsContentsItem
444 : : |*
445 : : \************************************************************************/
446 : :
447 : 0 : SdOptionsContentsItem::SdOptionsContentsItem(sal_uInt16 _nWhich, SdOptions*, ::sd::FrameView*)
448 : : : SfxPoolItem ( _nWhich )
449 [ # # ]: 0 : , maOptionsContents ( 0, sal_False )
450 : : {
451 : 0 : }
452 : :
453 : : // ----------------------------------------------------------------------
454 : :
455 : 0 : SfxPoolItem* SdOptionsContentsItem::Clone( SfxItemPool* ) const
456 : : {
457 [ # # ]: 0 : return new SdOptionsContentsItem( *this );
458 : : }
459 : :
460 : : // ----------------------------------------------------------------------
461 : :
462 : 0 : int SdOptionsContentsItem::operator==( const SfxPoolItem& rAttr ) const
463 : : {
464 : 0 : const bool bSameType = SfxPoolItem::operator==(rAttr);
465 : : DBG_ASSERT( bSameType, "SdOptionsContentsItem::operator==(), different pool item type!" );
466 [ # # ][ # # ]: 0 : return bSameType && ( maOptionsContents == static_cast<const SdOptionsContentsItem&>( rAttr ).maOptionsContents );
467 : : }
468 : :
469 : : // -----------------------------------------------------------------------
470 : :
471 : 0 : void SdOptionsContentsItem::SetOptions(SdOptions*) const
472 : : {
473 : 0 : }
474 : :
475 : : /*************************************************************************
476 : : |*
477 : : |* SdOptionsMisc
478 : : |*
479 : : \************************************************************************/
480 : :
481 : 33 : SdOptionsMisc::SdOptionsMisc( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
482 : : SdOptionsGeneric( nConfigId, bUseConfig ?
483 : : ( ( SDCFG_DRAW == nConfigId ) ?
484 : : B2U( "Office.Draw/Misc" ) :
485 : : B2U( "Office.Impress/Misc" ) ) :
486 : : OUString() ),
487 : : nDefaultObjectSizeWidth(8000),
488 : : nDefaultObjectSizeHeight(5000),
489 : : bStartWithTemplate( sal_False ),
490 : : bMarkedHitMovesAlways( sal_True ),
491 : : bMoveOnlyDragging( sal_False ),
492 : : bCrookNoContortion( sal_False ),
493 : 33 : bQuickEdit( GetConfigId() != SDCFG_DRAW ),
494 : : bMasterPageCache( sal_True ),
495 : : bDragWithCopy( sal_False ),
496 : : bPickThrough( sal_True ),
497 : : bDoubleClickTextEdit( sal_True ),
498 : : bClickChangeRotation( sal_False ),
499 : : bStartWithActualPage( sal_False ),
500 : : bSolidDragging( sal_True ),
501 : : bSummationOfParagraphs( sal_False ),
502 : : bShowUndoDeleteWarning( sal_True ),
503 : : bSlideshowRespectZOrder( sal_True ),
504 : : bShowComments( sal_True ),
505 : : bPreviewNewEffects( sal_True ),
506 : : bPreviewChangedEffects( sal_False ),
507 : : bPreviewTransitions( sal_True ),
508 : : mnDisplay( 0 ),
509 : : mnPenColor( 0xff0000 ),
510 : : mnPenWidth( 150.0 ),
511 : :
512 : : // The default for 6.1-and-above documents is to use printer-independent
513 : : // formatting.
514 [ + - ][ + + ]: 33 : mnPrinterIndependentLayout (1)
[ + - ]
515 : : {
516 : 33 : EnableModify( sal_True );
517 : 33 : }
518 : :
519 : : // -----------------------------------------------------------------------------
520 : :
521 : 0 : sal_Bool SdOptionsMisc::operator==( const SdOptionsMisc& rOpt ) const
522 : : {
523 : 0 : return( IsStartWithTemplate() == rOpt.IsStartWithTemplate() &&
524 : 0 : IsMarkedHitMovesAlways() == rOpt.IsMarkedHitMovesAlways() &&
525 : 0 : IsMoveOnlyDragging() == rOpt.IsMoveOnlyDragging() &&
526 : 0 : IsCrookNoContortion() == rOpt.IsCrookNoContortion() &&
527 : 0 : IsQuickEdit() == rOpt.IsQuickEdit() &&
528 : 0 : IsMasterPagePaintCaching() == rOpt.IsMasterPagePaintCaching() &&
529 : 0 : IsDragWithCopy() == rOpt.IsDragWithCopy() &&
530 : 0 : IsPickThrough() == rOpt.IsPickThrough() &&
531 : 0 : IsDoubleClickTextEdit() == rOpt.IsDoubleClickTextEdit() &&
532 : 0 : IsClickChangeRotation() == rOpt.IsClickChangeRotation() &&
533 : 0 : IsStartWithActualPage() == rOpt.IsStartWithActualPage() &&
534 : 0 : IsSummationOfParagraphs() == rOpt.IsSummationOfParagraphs() &&
535 : 0 : IsSolidDragging() == rOpt.IsSolidDragging() &&
536 : 0 : IsShowUndoDeleteWarning() == rOpt.IsShowUndoDeleteWarning() &&
537 : 0 : IsSlideshowRespectZOrder() == rOpt.IsSlideshowRespectZOrder() &&
538 : 0 : GetPrinterIndependentLayout() == rOpt.GetPrinterIndependentLayout() &&
539 : 0 : GetDefaultObjectSizeWidth() == rOpt.GetDefaultObjectSizeWidth() &&
540 : 0 : GetDefaultObjectSizeHeight() == rOpt.GetDefaultObjectSizeHeight() &&
541 : :
542 : 0 : IsPreviewNewEffects() == rOpt.IsPreviewNewEffects() &&
543 : 0 : IsPreviewChangedEffects() == rOpt.IsPreviewChangedEffects() &&
544 : 0 : IsPreviewTransitions() == rOpt.IsPreviewTransitions() &&
545 : 0 : GetDisplay() == rOpt.GetDisplay() &&
546 : 0 : IsShowComments() == rOpt.IsShowComments() &&
547 : 0 : GetPresentationPenColor() == rOpt.GetPresentationPenColor() &&
548 : 0 : GetPresentationPenWidth() == rOpt.GetPresentationPenWidth()
549 [ # # # # : 0 : );
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# ]
550 : : }
551 : :
552 : : // -----------------------------------------------------------------------------
553 : :
554 : 33 : void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
555 : : {
556 : : static const char* aPropNames[] =
557 : : {
558 : : "ObjectMoveable",
559 : : "NoDistort",
560 : : "TextObject/QuickEditing",
561 : : "BackgroundCache",
562 : : "CopyWhileMoving",
563 : : "TextObject/Selectable",
564 : : "DclickTextedit",
565 : : "RotateClick",
566 : : "Preview",
567 : : "ModifyWithAttributes",
568 : : "DefaultObjectSize/Width",
569 : : "DefaultObjectSize/Height",
570 : :
571 : : "Compatibility/PrinterIndependentLayout",
572 : :
573 : : "ShowComments",
574 : :
575 : : // just for impress
576 : : "NewDoc/AutoPilot",
577 : : "Start/CurrentPage",
578 : : "Compatibility/AddBetween",
579 : : "ShowUndoDeleteWarning",
580 : : "SlideshowRespectZOrder",
581 : :
582 : : "PreviewNewEffects",
583 : : "PreviewChangedEffects",
584 : : "PreviewTransitions",
585 : :
586 : : "Display",
587 : :
588 : : "PenColor",
589 : : "PenWidth"
590 : : };
591 : :
592 [ + + ]: 33 : rCount = ( ( GetConfigId() == SDCFG_IMPRESS ) ? 25 : 14 );
593 : 33 : ppNames = aPropNames;
594 : 33 : }
595 : :
596 : : // -----------------------------------------------------------------------------
597 : :
598 : 33 : sal_Bool SdOptionsMisc::ReadData( const Any* pValues )
599 : : {
600 [ + - ]: 33 : if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *(sal_Bool*) pValues[ 0 ].getValue() );
601 [ + - ]: 33 : if( pValues[1].hasValue() ) SetCrookNoContortion( *(sal_Bool*) pValues[ 1 ].getValue() );
602 [ + - ]: 33 : if( pValues[2].hasValue() ) SetQuickEdit( *(sal_Bool*)pValues[ 2 ].getValue() );
603 [ + - ]: 33 : if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *(sal_Bool*) pValues[ 3 ].getValue() );
604 [ + - ]: 33 : if( pValues[4].hasValue() ) SetDragWithCopy( *(sal_Bool*) pValues[ 4 ].getValue() );
605 [ + - ]: 33 : if( pValues[5].hasValue() ) SetPickThrough( *(sal_Bool*) pValues[ 5 ].getValue() );
606 [ + - ]: 33 : if( pValues[6].hasValue() ) SetDoubleClickTextEdit( *(sal_Bool*) pValues[ 6 ].getValue() );
607 [ + - ]: 33 : if( pValues[7].hasValue() ) SetClickChangeRotation( *(sal_Bool*) pValues[ 7 ].getValue() );
608 [ + - ]: 33 : if( pValues[9].hasValue() ) SetSolidDragging( *(sal_Bool*) pValues[ 9 ].getValue() );
609 [ + - ]: 33 : if( pValues[10].hasValue() ) SetDefaultObjectSizeWidth( *(sal_uInt32*) pValues[ 10 ].getValue() );
610 [ + - ]: 33 : if( pValues[11].hasValue() ) SetDefaultObjectSizeHeight( *(sal_uInt32*) pValues[ 11 ].getValue() );
611 [ + - ]: 33 : if( pValues[12].hasValue() ) SetPrinterIndependentLayout( *(sal_uInt16*) pValues[ 12 ].getValue() );
612 : :
613 [ + - ]: 33 : if( pValues[13].hasValue() )
614 : 33 : SetShowComments( *(sal_Bool*) pValues[ 13 ].getValue() );
615 : :
616 : : // just for Impress
617 [ + + ]: 33 : if( GetConfigId() == SDCFG_IMPRESS )
618 : : {
619 [ + - ]: 17 : if( pValues[14].hasValue() )
620 : 17 : SetStartWithTemplate( *(sal_Bool*) pValues[ 14 ].getValue() );
621 [ + - ]: 17 : if( pValues[15].hasValue() )
622 : 17 : SetStartWithActualPage( *(sal_Bool*) pValues[ 15 ].getValue() );
623 [ + - ]: 17 : if( pValues[16].hasValue() )
624 : 17 : SetSummationOfParagraphs( *(sal_Bool*) pValues[ 16 ].getValue() );
625 [ + - ]: 17 : if( pValues[17].hasValue() )
626 : 17 : SetShowUndoDeleteWarning( *(sal_Bool*) pValues[ 17 ].getValue() );
627 : :
628 [ + - ]: 17 : if( pValues[18].hasValue() )
629 : 17 : SetSlideshowRespectZOrder(*(sal_Bool*) pValues[ 18 ].getValue());
630 : :
631 [ + - ]: 17 : if( pValues[19].hasValue() )
632 : 17 : SetPreviewNewEffects(*(sal_Bool*) pValues[ 19 ].getValue());
633 : :
634 [ + - ]: 17 : if( pValues[20].hasValue() )
635 : 17 : SetPreviewChangedEffects(*(sal_Bool*) pValues[ 20 ].getValue());
636 : :
637 [ + - ]: 17 : if( pValues[21].hasValue() )
638 : 17 : SetPreviewTransitions(*(sal_Bool*) pValues[ 21 ].getValue());
639 : :
640 [ + - ]: 17 : if( pValues[22].hasValue() )
641 : 17 : SetDisplay(*(sal_Int32*) pValues[ 22 ].getValue());
642 : :
643 [ + - ]: 17 : if( pValues[23].hasValue() )
644 : 17 : SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 23 ] ) );
645 : :
646 [ + - ]: 17 : if( pValues[24].hasValue() )
647 : 17 : SetPresentationPenWidth( getSafeValue< double >( pValues[ 24 ] ) );
648 : : }
649 : :
650 : 33 : return sal_True;
651 : : }
652 : :
653 : : // -----------------------------------------------------------------------------
654 : :
655 : 0 : sal_Bool SdOptionsMisc::WriteData( Any* pValues ) const
656 : : {
657 [ # # ]: 0 : pValues[ 0 ] <<= IsMarkedHitMovesAlways();
658 [ # # ]: 0 : pValues[ 1 ] <<= IsCrookNoContortion();
659 [ # # ]: 0 : pValues[ 2 ] <<= IsQuickEdit();
660 [ # # ]: 0 : pValues[ 3 ] <<= IsMasterPagePaintCaching();
661 [ # # ]: 0 : pValues[ 4 ] <<= IsDragWithCopy();
662 [ # # ]: 0 : pValues[ 5 ] <<= IsPickThrough();
663 [ # # ]: 0 : pValues[ 6 ] <<= IsDoubleClickTextEdit();
664 [ # # ]: 0 : pValues[ 7 ] <<= IsClickChangeRotation();
665 : : // The preview is not supported anymore. Use a dummy value.
666 [ # # ]: 0 : pValues[ 8 ] <<= (double)0;// GetPreviewQuality();
667 [ # # ]: 0 : pValues[ 9 ] <<= IsSolidDragging();
668 [ # # ]: 0 : pValues[ 10 ] <<= GetDefaultObjectSizeWidth();
669 [ # # ]: 0 : pValues[ 11 ] <<= GetDefaultObjectSizeHeight();
670 [ # # ]: 0 : pValues[ 12 ] <<= GetPrinterIndependentLayout();
671 [ # # ]: 0 : pValues[ 13 ] <<= (sal_Bool)IsShowComments();
672 : :
673 : : // just for Impress
674 [ # # ]: 0 : if( GetConfigId() == SDCFG_IMPRESS )
675 : : {
676 [ # # ]: 0 : pValues[ 14 ] <<= IsStartWithTemplate();
677 [ # # ]: 0 : pValues[ 15 ] <<= IsStartWithActualPage();
678 [ # # ]: 0 : pValues[ 16 ] <<= IsSummationOfParagraphs();
679 [ # # ]: 0 : pValues[ 17 ] <<= IsShowUndoDeleteWarning();
680 [ # # ]: 0 : pValues[ 18 ] <<= IsSlideshowRespectZOrder();
681 : :
682 [ # # ]: 0 : pValues[ 19 ] <<= IsPreviewNewEffects();
683 [ # # ]: 0 : pValues[ 20 ] <<= IsPreviewChangedEffects();
684 [ # # ]: 0 : pValues[ 21 ] <<= IsPreviewTransitions();
685 : :
686 [ # # ]: 0 : pValues[ 22 ] <<= GetDisplay();
687 : :
688 [ # # ]: 0 : pValues[ 23 ] <<= GetPresentationPenColor();
689 [ # # ]: 0 : pValues[ 24 ] <<= GetPresentationPenWidth();
690 : : }
691 : :
692 : 0 : return sal_True;
693 : : }
694 : :
695 : : /*************************************************************************
696 : : |*
697 : : |* SdOptionsMiscItem
698 : : |*
699 : : \************************************************************************/
700 : :
701 : 0 : SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich )
702 : : : SfxPoolItem ( _nWhich )
703 [ # # ]: 0 : , maOptionsMisc ( 0, sal_False )
704 : : {
705 : 0 : }
706 : :
707 : : // ----------------------------------------------------------------------
708 : :
709 : 0 : SdOptionsMiscItem::SdOptionsMiscItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
710 : : : SfxPoolItem ( _nWhich )
711 [ # # ]: 0 : , maOptionsMisc ( 0, sal_False )
712 : : {
713 [ # # ]: 0 : if( pOpts )
714 : : {
715 [ # # ][ # # ]: 0 : maOptionsMisc.SetStartWithTemplate( pOpts->IsStartWithTemplate() );
716 [ # # ][ # # ]: 0 : maOptionsMisc.SetStartWithActualPage( pOpts->IsStartWithActualPage() );
717 [ # # ][ # # ]: 0 : maOptionsMisc.SetSummationOfParagraphs( pOpts->IsSummationOfParagraphs() );
718 [ # # ][ # # ]: 0 : maOptionsMisc.SetShowUndoDeleteWarning( pOpts->IsShowUndoDeleteWarning() );
719 [ # # ][ # # ]: 0 : maOptionsMisc.SetPrinterIndependentLayout( pOpts->GetPrinterIndependentLayout() );
720 [ # # ][ # # ]: 0 : maOptionsMisc.SetDefaultObjectSizeWidth( pOpts->GetDefaultObjectSizeWidth() );
721 [ # # ][ # # ]: 0 : maOptionsMisc.SetDefaultObjectSizeHeight( pOpts->GetDefaultObjectSizeHeight() );
722 : :
723 [ # # ][ # # ]: 0 : maOptionsMisc.SetPreviewNewEffects(pOpts->IsPreviewNewEffects());
724 [ # # ][ # # ]: 0 : maOptionsMisc.SetPreviewChangedEffects(pOpts->IsPreviewChangedEffects());
725 [ # # ][ # # ]: 0 : maOptionsMisc.SetPreviewTransitions(pOpts->IsPreviewTransitions());
726 : :
727 [ # # ][ # # ]: 0 : maOptionsMisc.SetDisplay(pOpts->GetDisplay());
728 [ # # ][ # # ]: 0 : maOptionsMisc.SetShowComments( pOpts->IsShowComments() );
729 : :
730 [ # # ][ # # ]: 0 : maOptionsMisc.SetPresentationPenColor(pOpts->GetPresentationPenColor() );
731 [ # # ][ # # ]: 0 : maOptionsMisc.SetPresentationPenWidth(pOpts->GetPresentationPenWidth() );
732 : : }
733 : :
734 [ # # ]: 0 : if( pView )
735 : : {
736 [ # # ]: 0 : maOptionsMisc.SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
737 [ # # ]: 0 : maOptionsMisc.SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
738 [ # # ]: 0 : maOptionsMisc.SetCrookNoContortion( pView->IsCrookNoContortion() );
739 [ # # ]: 0 : maOptionsMisc.SetQuickEdit( pView->IsQuickEdit() );
740 : :
741 : : // #i26631#
742 [ # # ]: 0 : maOptionsMisc.SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
743 : :
744 [ # # ]: 0 : maOptionsMisc.SetDragWithCopy( pView->IsDragWithCopy() );
745 [ # # ]: 0 : maOptionsMisc.SetPickThrough( (sal_Bool)pView->GetModel()->IsPickThroughTransparentTextFrames() );
746 [ # # ]: 0 : maOptionsMisc.SetDoubleClickTextEdit( pView->IsDoubleClickTextEdit() );
747 [ # # ]: 0 : maOptionsMisc.SetClickChangeRotation( pView->IsClickChangeRotation() );
748 [ # # ][ # # ]: 0 : maOptionsMisc.SetSolidDragging( pView->IsSolidDragging() );
749 : : }
750 [ # # ]: 0 : else if( pOpts )
751 : : {
752 [ # # ][ # # ]: 0 : maOptionsMisc.SetMarkedHitMovesAlways( pOpts->IsMarkedHitMovesAlways() );
753 [ # # ][ # # ]: 0 : maOptionsMisc.SetMoveOnlyDragging( pOpts->IsMoveOnlyDragging() );
754 [ # # ][ # # ]: 0 : maOptionsMisc.SetCrookNoContortion( pOpts->IsCrookNoContortion() );
755 [ # # ][ # # ]: 0 : maOptionsMisc.SetQuickEdit( pOpts->IsQuickEdit() );
756 [ # # ][ # # ]: 0 : maOptionsMisc.SetMasterPagePaintCaching( pOpts->IsMasterPagePaintCaching() );
757 [ # # ][ # # ]: 0 : maOptionsMisc.SetDragWithCopy( pOpts->IsDragWithCopy() );
758 [ # # ][ # # ]: 0 : maOptionsMisc.SetPickThrough( pOpts->IsPickThrough() );
759 [ # # ][ # # ]: 0 : maOptionsMisc.SetDoubleClickTextEdit( pOpts->IsDoubleClickTextEdit() );
760 [ # # ][ # # ]: 0 : maOptionsMisc.SetClickChangeRotation( pOpts->IsClickChangeRotation() );
761 [ # # ][ # # ]: 0 : maOptionsMisc.SetSolidDragging( pOpts->IsSolidDragging() );
762 : : }
763 : 0 : }
764 : :
765 : : // ----------------------------------------------------------------------
766 : :
767 : 0 : SfxPoolItem* SdOptionsMiscItem::Clone( SfxItemPool* ) const
768 : : {
769 [ # # ]: 0 : return new SdOptionsMiscItem( *this );
770 : : }
771 : :
772 : :
773 : : // ----------------------------------------------------------------------
774 : :
775 : 0 : int SdOptionsMiscItem::operator==( const SfxPoolItem& rAttr ) const
776 : : {
777 : 0 : const bool bSameType = SfxPoolItem::operator==(rAttr);
778 : : DBG_ASSERT( bSameType, "SdOptionsMiscItem::operator==(), different pool item type!" );
779 [ # # ][ # # ]: 0 : return bSameType && ( maOptionsMisc == static_cast< const SdOptionsMiscItem& >(rAttr).maOptionsMisc );
780 : : }
781 : :
782 : : // -----------------------------------------------------------------------
783 : :
784 : 0 : void SdOptionsMiscItem::SetOptions( SdOptions* pOpts ) const
785 : : {
786 [ # # ]: 0 : if( pOpts )
787 : : {
788 : 0 : pOpts->SetStartWithTemplate( maOptionsMisc.IsStartWithTemplate() );
789 : 0 : pOpts->SetMarkedHitMovesAlways( maOptionsMisc.IsMarkedHitMovesAlways() );
790 : 0 : pOpts->SetMoveOnlyDragging( maOptionsMisc.IsMoveOnlyDragging() );
791 : 0 : pOpts->SetCrookNoContortion( maOptionsMisc.IsCrookNoContortion() );
792 : 0 : pOpts->SetQuickEdit( maOptionsMisc.IsQuickEdit() );
793 : 0 : pOpts->SetMasterPagePaintCaching( maOptionsMisc.IsMasterPagePaintCaching() );
794 : 0 : pOpts->SetDragWithCopy( maOptionsMisc.IsDragWithCopy() );
795 : 0 : pOpts->SetPickThrough( maOptionsMisc.IsPickThrough() );
796 : 0 : pOpts->SetDoubleClickTextEdit( maOptionsMisc.IsDoubleClickTextEdit() );
797 : 0 : pOpts->SetClickChangeRotation( maOptionsMisc.IsClickChangeRotation() );
798 : 0 : pOpts->SetStartWithActualPage( maOptionsMisc.IsStartWithActualPage() );
799 : 0 : pOpts->SetSummationOfParagraphs( maOptionsMisc.IsSummationOfParagraphs() );
800 : 0 : pOpts->SetSolidDragging( maOptionsMisc.IsSolidDragging() );
801 : 0 : pOpts->SetShowUndoDeleteWarning( maOptionsMisc.IsShowUndoDeleteWarning() );
802 : 0 : pOpts->SetPrinterIndependentLayout( maOptionsMisc.GetPrinterIndependentLayout() );
803 : 0 : pOpts->SetShowComments( maOptionsMisc.IsShowComments() );
804 : 0 : pOpts->SetDefaultObjectSizeWidth( maOptionsMisc.GetDefaultObjectSizeWidth() );
805 : 0 : pOpts->SetDefaultObjectSizeHeight( maOptionsMisc.GetDefaultObjectSizeHeight() );
806 : :
807 : 0 : pOpts->SetPreviewNewEffects( maOptionsMisc.IsPreviewNewEffects() );
808 : 0 : pOpts->SetPreviewChangedEffects( maOptionsMisc.IsPreviewChangedEffects() );
809 : 0 : pOpts->SetPreviewTransitions( maOptionsMisc.IsPreviewTransitions() );
810 : :
811 : 0 : pOpts->SetDisplay( maOptionsMisc.GetDisplay() );
812 : :
813 : 0 : pOpts->SetPresentationPenColor( maOptionsMisc.GetPresentationPenColor() );
814 : 0 : pOpts->SetPresentationPenWidth( maOptionsMisc.GetPresentationPenWidth() );
815 : : }
816 : 0 : }
817 : :
818 : : /*************************************************************************
819 : : |*
820 : : |* SdOptionsSnap
821 : : |*
822 : : \************************************************************************/
823 : :
824 : 33 : SdOptionsSnap::SdOptionsSnap( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
825 : : SdOptionsGeneric( nConfigId, bUseConfig ?
826 : : ( ( SDCFG_DRAW == nConfigId ) ?
827 : : B2U( "Office.Draw/Snap" ) :
828 : : B2U( "Office.Impress/Snap" ) ) :
829 : : OUString() ),
830 : : bSnapHelplines( sal_True ),
831 : : bSnapBorder( sal_True ),
832 : : bSnapFrame( sal_False ),
833 : : bSnapPoints( sal_False ),
834 : : bOrtho( sal_False ),
835 : : bBigOrtho( sal_True ),
836 : : bRotate( sal_False ),
837 : : nSnapArea( 5 ),
838 : : nAngle( 1500 ),
839 [ + - ][ + + ]: 33 : nBezAngle( 1500 )
[ + - ]
840 : :
841 : : {
842 : 33 : EnableModify( sal_True );
843 : 33 : }
844 : :
845 : : // -----------------------------------------------------------------------------
846 : :
847 : 0 : sal_Bool SdOptionsSnap::operator==( const SdOptionsSnap& rOpt ) const
848 : : {
849 : 0 : return( IsSnapHelplines() == rOpt.IsSnapHelplines() &&
850 : 0 : IsSnapBorder() == rOpt.IsSnapBorder() &&
851 : 0 : IsSnapFrame() == rOpt.IsSnapFrame() &&
852 : 0 : IsSnapPoints() == rOpt.IsSnapPoints() &&
853 : 0 : IsOrtho() == rOpt.IsOrtho() &&
854 : 0 : IsBigOrtho() == rOpt.IsBigOrtho() &&
855 : 0 : IsRotate() == rOpt.IsRotate() &&
856 : 0 : GetSnapArea() == rOpt.GetSnapArea() &&
857 : 0 : GetAngle() == rOpt.GetAngle() &&
858 [ # # ][ # # : 0 : GetEliminatePolyPointLimitAngle() == rOpt.GetEliminatePolyPointLimitAngle() );
# # # # #
# # # # #
# # # # #
# ]
859 : : }
860 : :
861 : : // -----------------------------------------------------------------------------
862 : :
863 : 30 : void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
864 : : {
865 : : static const char* aPropNames[] =
866 : : {
867 : : "Object/SnapLine",
868 : : "Object/PageMargin",
869 : : "Object/ObjectFrame",
870 : : "Object/ObjectPoint",
871 : : "Position/CreatingMoving",
872 : : "Position/ExtendEdges",
873 : : "Position/Rotating",
874 : : "Object/Range",
875 : : "Position/RotatingValue",
876 : : "Position/PointReduction"
877 : : };
878 : :
879 : 30 : rCount = 10;
880 : 30 : ppNames = aPropNames;
881 : 30 : }
882 : :
883 : : // -----------------------------------------------------------------------------
884 : :
885 : 30 : sal_Bool SdOptionsSnap::ReadData( const Any* pValues )
886 : : {
887 [ + - ]: 30 : if( pValues[0].hasValue() ) SetSnapHelplines( *(sal_Bool*) pValues[ 0 ].getValue() );
888 [ + - ]: 30 : if( pValues[1].hasValue() ) SetSnapBorder( *(sal_Bool*)pValues[ 1 ].getValue() );
889 [ + - ]: 30 : if( pValues[2].hasValue() ) SetSnapFrame( *(sal_Bool*) pValues[ 2 ].getValue() );
890 [ + - ]: 30 : if( pValues[3].hasValue() ) SetSnapPoints( *(sal_Bool*) pValues[ 3 ].getValue() );
891 [ + - ]: 30 : if( pValues[4].hasValue() ) SetOrtho( *(sal_Bool*) pValues[ 4 ].getValue() );
892 [ + - ]: 30 : if( pValues[5].hasValue() ) SetBigOrtho( *(sal_Bool*) pValues[ 5 ].getValue() );
893 [ + - ]: 30 : if( pValues[6].hasValue() ) SetRotate( *(sal_Bool*) pValues[ 6 ].getValue() );
894 [ + - ]: 30 : if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *(sal_Int32*) pValues[ 7 ].getValue() );
895 [ + - ]: 30 : if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *(sal_Int32*) pValues[ 8 ].getValue() );
896 [ + - ]: 30 : if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *(sal_Int32*) pValues[ 9 ].getValue() );
897 : :
898 : 30 : return sal_True;
899 : : }
900 : :
901 : : // -----------------------------------------------------------------------------
902 : :
903 : 0 : sal_Bool SdOptionsSnap::WriteData( Any* pValues ) const
904 : : {
905 [ # # ]: 0 : pValues[ 0 ] <<= IsSnapHelplines();
906 [ # # ]: 0 : pValues[ 1 ] <<= IsSnapBorder();
907 [ # # ]: 0 : pValues[ 2 ] <<= IsSnapFrame();
908 [ # # ]: 0 : pValues[ 3 ] <<= IsSnapPoints();
909 [ # # ]: 0 : pValues[ 4 ] <<= IsOrtho();
910 [ # # ]: 0 : pValues[ 5 ] <<= IsBigOrtho();
911 [ # # ]: 0 : pValues[ 6 ] <<= IsRotate();
912 [ # # ]: 0 : pValues[ 7 ] <<= (sal_Int32) GetSnapArea();
913 [ # # ]: 0 : pValues[ 8 ] <<= (sal_Int32) GetAngle();
914 [ # # ]: 0 : pValues[ 9 ] <<= (sal_Int32) GetEliminatePolyPointLimitAngle();
915 : :
916 : 0 : return sal_True;
917 : : }
918 : :
919 : : /*************************************************************************
920 : : |*
921 : : |* SdOptionsSnapItem
922 : : |*
923 : : \************************************************************************/
924 : :
925 : 0 : SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich )
926 : : : SfxPoolItem ( _nWhich )
927 [ # # ]: 0 : , maOptionsSnap ( 0, sal_False )
928 : : {
929 : 0 : }
930 : :
931 : : // ----------------------------------------------------------------------
932 : :
933 : 0 : SdOptionsSnapItem::SdOptionsSnapItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView )
934 : : : SfxPoolItem ( _nWhich )
935 [ # # ]: 0 : , maOptionsSnap ( 0, sal_False )
936 : : {
937 [ # # ]: 0 : if( pView )
938 : : {
939 [ # # ]: 0 : maOptionsSnap.SetSnapHelplines( pView->IsHlplSnap() );
940 [ # # ]: 0 : maOptionsSnap.SetSnapBorder( pView->IsBordSnap() );
941 [ # # ]: 0 : maOptionsSnap.SetSnapFrame( pView->IsOFrmSnap() );
942 [ # # ]: 0 : maOptionsSnap.SetSnapPoints( pView->IsOPntSnap() );
943 [ # # ]: 0 : maOptionsSnap.SetOrtho( pView->IsOrtho() );
944 [ # # ]: 0 : maOptionsSnap.SetBigOrtho( pView->IsBigOrtho() );
945 [ # # ]: 0 : maOptionsSnap.SetRotate( pView->IsAngleSnapEnabled() );
946 [ # # ]: 0 : maOptionsSnap.SetSnapArea( pView->GetSnapMagneticPixel() );
947 [ # # ]: 0 : maOptionsSnap.SetAngle( (sal_Int16) pView->GetSnapAngle() );
948 [ # # ]: 0 : maOptionsSnap.SetEliminatePolyPointLimitAngle( (sal_Int16) pView->GetEliminatePolyPointLimitAngle() );
949 : : }
950 [ # # ]: 0 : else if( pOpts )
951 : : {
952 [ # # ][ # # ]: 0 : maOptionsSnap.SetSnapHelplines( pOpts->IsSnapHelplines() );
953 [ # # ][ # # ]: 0 : maOptionsSnap.SetSnapBorder( pOpts->IsSnapBorder() );
954 [ # # ][ # # ]: 0 : maOptionsSnap.SetSnapFrame( pOpts->IsSnapFrame() );
955 [ # # ][ # # ]: 0 : maOptionsSnap.SetSnapPoints( pOpts->IsSnapPoints() );
956 [ # # ][ # # ]: 0 : maOptionsSnap.SetOrtho( pOpts->IsOrtho() );
957 [ # # ][ # # ]: 0 : maOptionsSnap.SetBigOrtho( pOpts->IsBigOrtho() );
958 [ # # ][ # # ]: 0 : maOptionsSnap.SetRotate( pOpts->IsRotate() );
959 [ # # ][ # # ]: 0 : maOptionsSnap.SetSnapArea( pOpts->GetSnapArea() );
960 [ # # ][ # # ]: 0 : maOptionsSnap.SetAngle( pOpts->GetAngle() );
961 [ # # ][ # # ]: 0 : maOptionsSnap.SetEliminatePolyPointLimitAngle( pOpts->GetEliminatePolyPointLimitAngle() );
962 : : }
963 : 0 : }
964 : :
965 : : // ----------------------------------------------------------------------
966 : :
967 : 0 : SfxPoolItem* SdOptionsSnapItem::Clone( SfxItemPool* ) const
968 : : {
969 [ # # ]: 0 : return new SdOptionsSnapItem( *this );
970 : : }
971 : :
972 : :
973 : : // ----------------------------------------------------------------------
974 : :
975 : 0 : int SdOptionsSnapItem::operator==( const SfxPoolItem& rAttr ) const
976 : : {
977 : 0 : const bool bSameType = SfxPoolItem::operator==(rAttr);
978 : : DBG_ASSERT( bSameType, "SdOptionsSnapItem::operator==(), different pool item type!" );
979 [ # # ][ # # ]: 0 : return bSameType && ( maOptionsSnap == static_cast< const SdOptionsSnapItem& >(rAttr).maOptionsSnap );
980 : : }
981 : :
982 : : // -----------------------------------------------------------------------
983 : :
984 : 0 : void SdOptionsSnapItem::SetOptions( SdOptions* pOpts ) const
985 : : {
986 [ # # ]: 0 : if( pOpts )
987 : : {
988 : 0 : pOpts->SetSnapHelplines( maOptionsSnap.IsSnapHelplines() );
989 : 0 : pOpts->SetSnapBorder( maOptionsSnap.IsSnapBorder() );
990 : 0 : pOpts->SetSnapFrame( maOptionsSnap.IsSnapFrame() );
991 : 0 : pOpts->SetSnapPoints( maOptionsSnap.IsSnapPoints() );
992 : 0 : pOpts->SetOrtho( maOptionsSnap.IsOrtho() );
993 : 0 : pOpts->SetBigOrtho( maOptionsSnap.IsBigOrtho() );
994 : 0 : pOpts->SetRotate( maOptionsSnap.IsRotate() );
995 : 0 : pOpts->SetSnapArea( maOptionsSnap.GetSnapArea() );
996 : 0 : pOpts->SetAngle( maOptionsSnap.GetAngle() );
997 : 0 : pOpts->SetEliminatePolyPointLimitAngle( maOptionsSnap.GetEliminatePolyPointLimitAngle() );
998 : : }
999 : 0 : }
1000 : :
1001 : : /*************************************************************************
1002 : : |*
1003 : : |* SdOptionsZoom
1004 : : |*
1005 : : \************************************************************************/
1006 : :
1007 : 33 : SdOptionsZoom::SdOptionsZoom( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1008 : : SdOptionsGeneric( nConfigId, ( bUseConfig && ( SDCFG_DRAW == nConfigId ) ) ?
1009 : : B2U( "Office.Draw/Zoom" ) :
1010 : : OUString() ),
1011 : : nX( 1 ),
1012 [ + - ][ + + ]: 33 : nY( 1 )
[ + - ]
1013 : :
1014 : : {
1015 : 33 : EnableModify( sal_True );
1016 : 33 : }
1017 : :
1018 : : // -----------------------------------------------------------------------------
1019 : :
1020 : 0 : sal_Bool SdOptionsZoom::operator==( const SdOptionsZoom& rOpt ) const
1021 : : {
1022 : : sal_Int32 nX1, nX2, nY1, nY2;
1023 : :
1024 [ # # ]: 0 : GetScale( nX1, nY1 );
1025 [ # # ]: 0 : rOpt.GetScale( nX2, nY2 );
1026 : :
1027 : : return( ( nX1 == nX2 ) &&
1028 [ # # ][ # # ]: 0 : ( nY1 == nY2 ) );
1029 : : }
1030 : :
1031 : : // -----------------------------------------------------------------------------
1032 : :
1033 : 16 : void SdOptionsZoom::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1034 : : {
1035 : : static const char* aPropNames[] =
1036 : : {
1037 : : "ScaleX",
1038 : : "ScaleY"
1039 : : };
1040 : :
1041 [ + - ]: 16 : rCount = ( GetConfigId() == SDCFG_DRAW ) ? 2 : 0;
1042 : 16 : ppNames = aPropNames;
1043 : 16 : }
1044 : :
1045 : : // -----------------------------------------------------------------------------
1046 : :
1047 : 16 : sal_Bool SdOptionsZoom::ReadData( const Any* pValues )
1048 : : {
1049 : 16 : sal_Int32 x = 1, y = 1;
1050 : :
1051 [ + - ]: 16 : if( pValues[0].hasValue() ) x = ( *(sal_Int32*) pValues[ 0 ].getValue() );
1052 [ + - ]: 16 : if( pValues[1].hasValue() ) y = ( *(sal_Int32*) pValues[ 1 ].getValue() );
1053 : :
1054 : 16 : SetScale( x, y );
1055 : :
1056 : 16 : return sal_True;
1057 : : }
1058 : :
1059 : : // -----------------------------------------------------------------------------
1060 : :
1061 : 0 : sal_Bool SdOptionsZoom::WriteData( Any* pValues ) const
1062 : : {
1063 : : sal_Int32 x, y;
1064 : :
1065 [ # # ]: 0 : GetScale( x, y );
1066 : :
1067 [ # # ]: 0 : pValues[ 0 ] <<= (sal_Int32) x;
1068 [ # # ]: 0 : pValues[ 1 ] <<= (sal_Int32) y;
1069 : :
1070 : 0 : return sal_True;
1071 : : }
1072 : :
1073 : : /*************************************************************************
1074 : : |*
1075 : : |* SdOptionsGrid
1076 : : |*
1077 : : \************************************************************************/
1078 : :
1079 : 33 : SdOptionsGrid::SdOptionsGrid( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1080 : : SdOptionsGeneric( nConfigId, bUseConfig ?
1081 : : ( ( SDCFG_DRAW == nConfigId ) ?
1082 : : B2U( "Office.Draw/Grid" ) :
1083 : : B2U( "Office.Impress/Grid" ) ) :
1084 [ + - ][ + + ]: 33 : OUString() )
[ + - ][ + - ]
1085 : : {
1086 : 33 : EnableModify( sal_False );
1087 [ + - ]: 33 : SetDefaults();
1088 : 33 : EnableModify( sal_True );
1089 : 33 : }
1090 : :
1091 : : // -----------------------------------------------------------------------------
1092 : :
1093 [ + - ]: 24 : SdOptionsGrid::~SdOptionsGrid()
1094 : : {
1095 [ - + ]: 24 : }
1096 : :
1097 : : // -----------------------------------------------------------------------------
1098 : :
1099 : 33 : void SdOptionsGrid::SetDefaults()
1100 : : {
1101 : 33 : const sal_uInt32 nVal = 1000;
1102 : :
1103 : 33 : SetFldDivisionX( nVal );
1104 : 33 : SetFldDivisionY( nVal );
1105 : 33 : SetFldDrawX( nVal );
1106 : 33 : SetFldDrawY( nVal );
1107 : 33 : SetFldSnapX( nVal );
1108 : 33 : SetFldSnapY( nVal );
1109 : 33 : SetUseGridSnap( sal_False );
1110 : 33 : SetSynchronize( sal_True );
1111 : 33 : SetGridVisible( sal_False );
1112 : 33 : SetEqualGrid( sal_True );
1113 : 33 : }
1114 : :
1115 : : // -----------------------------------------------------------------------------
1116 : :
1117 : 0 : sal_Bool SdOptionsGrid::operator==( const SdOptionsGrid& rOpt ) const
1118 : : {
1119 : 0 : return( GetFldDrawX() == rOpt.GetFldDrawX() &&
1120 : 0 : GetFldDivisionX() == rOpt.GetFldDivisionX() &&
1121 : 0 : GetFldDrawY() == rOpt.GetFldDrawY() &&
1122 : 0 : GetFldDivisionY() == rOpt.GetFldDivisionY() &&
1123 : 0 : GetFldSnapX() == rOpt.GetFldSnapX() &&
1124 : 0 : GetFldSnapY() == rOpt.GetFldSnapY() &&
1125 : 0 : IsUseGridSnap() == rOpt.IsUseGridSnap() &&
1126 : 0 : IsSynchronize() == rOpt.IsSynchronize() &&
1127 : 0 : IsGridVisible() == rOpt.IsGridVisible() &&
1128 [ # # ][ # # : 0 : IsEqualGrid() == rOpt.IsEqualGrid() );
# # # # #
# # # # #
# # # # #
# ]
1129 : : }
1130 : :
1131 : : // -----------------------------------------------------------------------------
1132 : :
1133 : 30 : void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1134 : : {
1135 : : static const char* aPropNamesMetric[] =
1136 : : {
1137 : : "Resolution/XAxis/Metric",
1138 : : "Resolution/YAxis/Metric",
1139 : : "Subdivision/XAxis",
1140 : : "Subdivision/YAxis",
1141 : : "SnapGrid/XAxis/Metric",
1142 : : "SnapGrid/YAxis/Metric",
1143 : : "Option/SnapToGrid",
1144 : : "Option/Synchronize",
1145 : : "Option/VisibleGrid",
1146 : : "SnapGrid/Size"
1147 : : };
1148 : :
1149 : : static const char* aPropNamesNonMetric[] =
1150 : : {
1151 : : "Resolution/XAxis/NonMetric",
1152 : : "Resolution/YAxis/NonMetric",
1153 : : "Subdivision/XAxis",
1154 : : "Subdivision/YAxis",
1155 : : "SnapGrid/XAxis/NonMetric",
1156 : : "SnapGrid/YAxis/NonMetric",
1157 : : "Option/SnapToGrid",
1158 : : "Option/Synchronize",
1159 : : "Option/VisibleGrid",
1160 : : "SnapGrid/Size"
1161 : : };
1162 : :
1163 : 30 : rCount = 10;
1164 : :
1165 [ - + ]: 30 : if( isMetricSystem() )
1166 : 0 : ppNames = aPropNamesMetric;
1167 : : else
1168 : 30 : ppNames = aPropNamesNonMetric;
1169 : 30 : }
1170 : :
1171 : : // -----------------------------------------------------------------------------
1172 : :
1173 : 30 : sal_Bool SdOptionsGrid::ReadData( const Any* pValues )
1174 : : {
1175 [ + - ]: 30 : if( pValues[0].hasValue() ) SetFldDrawX( *(sal_Int32*) pValues[ 0 ].getValue() );
1176 [ + - ]: 30 : if( pValues[1].hasValue() ) SetFldDrawY( *(sal_Int32*) pValues[ 1 ].getValue() );
1177 : :
1178 [ + - ]: 30 : if( pValues[2].hasValue() )
1179 : : {
1180 : 30 : const sal_uInt32 nDivX = FRound( *(double*) pValues[ 2 ].getValue() );
1181 : 30 : SetFldDivisionX( SvxOptionsGrid::GetFldDrawX() / ( nDivX + 1 ) );
1182 : : }
1183 : :
1184 [ + - ]: 30 : if( pValues[3].hasValue() )
1185 : : {
1186 : 30 : const sal_uInt32 nDivY = FRound( *(double*) pValues[ 3 ].getValue() );
1187 : 30 : SetFldDivisionY( SvxOptionsGrid::GetFldDrawY() / ( nDivY + 1 ) );
1188 : : }
1189 : :
1190 [ + - ]: 30 : if( pValues[4].hasValue() ) SetFldSnapX( *(sal_Int32*) pValues[ 4 ].getValue() );
1191 [ + - ]: 30 : if( pValues[5].hasValue() ) SetFldSnapY( *(sal_Int32*) pValues[ 5 ].getValue() );
1192 [ + - ]: 30 : if( pValues[6].hasValue() ) SetUseGridSnap( *(sal_Bool*) pValues[ 6 ].getValue() );
1193 [ + - ]: 30 : if( pValues[7].hasValue() ) SetSynchronize( *(sal_Bool*) pValues[ 7 ].getValue() );
1194 [ + - ]: 30 : if( pValues[8].hasValue() ) SetGridVisible( *(sal_Bool*) pValues[ 8 ].getValue() );
1195 [ + - ]: 30 : if( pValues[9].hasValue() ) SetEqualGrid( *(sal_Bool*) pValues[ 9 ].getValue() );
1196 : :
1197 : 30 : return sal_True;
1198 : : }
1199 : :
1200 : : // -----------------------------------------------------------------------------
1201 : :
1202 : 0 : sal_Bool SdOptionsGrid::WriteData( Any* pValues ) const
1203 : : {
1204 [ # # ]: 0 : pValues[ 0 ] <<= (sal_Int32) GetFldDrawX();
1205 [ # # ]: 0 : pValues[ 1 ] <<= (sal_Int32) GetFldDrawY();
1206 [ # # ][ # # ]: 0 : pValues[ 2 ] <<= ( GetFldDivisionX() ? ( (double) GetFldDrawX() / GetFldDivisionX() - 1.0 ) : (double) 0 );
1207 [ # # ][ # # ]: 0 : pValues[ 3 ] <<= ( GetFldDivisionY() ? ( (double) GetFldDrawY() / GetFldDivisionY() - 1.0 ) : (double) 0 );
1208 [ # # ]: 0 : pValues[ 4 ] <<= (sal_Int32) GetFldSnapX();
1209 [ # # ]: 0 : pValues[ 5 ] <<= (sal_Int32) GetFldSnapY();
1210 [ # # ]: 0 : pValues[ 6 ] <<= IsUseGridSnap();
1211 [ # # ]: 0 : pValues[ 7 ] <<= IsSynchronize();
1212 [ # # ]: 0 : pValues[ 8 ] <<= IsGridVisible();
1213 [ # # ]: 0 : pValues[ 9 ] <<= IsEqualGrid();
1214 : :
1215 : 0 : return sal_True;
1216 : : }
1217 : :
1218 : : /*************************************************************************
1219 : : |*
1220 : : |* SdOptionsGridItem
1221 : : |*
1222 : : \************************************************************************/
1223 : :
1224 : 0 : SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* pView ) :
1225 : 0 : SvxGridItem( _nWhich )
1226 : : {
1227 [ # # ]: 0 : SetSynchronize( pOpts->IsSynchronize() );
1228 [ # # ]: 0 : SetEqualGrid( pOpts->IsEqualGrid() );
1229 : :
1230 [ # # ]: 0 : if( pView )
1231 : : {
1232 : 0 : SetFldDrawX( pView->GetGridCoarse().Width() );
1233 : 0 : SetFldDrawY( pView->GetGridCoarse().Height() );
1234 [ # # ]: 0 : SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 );
1235 [ # # ]: 0 : SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 );
1236 [ # # ]: 0 : SetFldSnapX( long(pView->GetSnapGridWidthX()) );
1237 [ # # ]: 0 : SetFldSnapY( long(pView->GetSnapGridWidthY()) );
1238 : 0 : SetUseGridSnap( pView->IsGridSnap() );
1239 : 0 : SetGridVisible( pView->IsGridVisible() );
1240 : : }
1241 : : else
1242 : : {
1243 [ # # ]: 0 : SetFldDrawX( pOpts->GetFldDrawX() );
1244 [ # # ]: 0 : SetFldDrawY( pOpts->GetFldDrawY() );
1245 [ # # ][ # # ]: 0 : SetFldDivisionX( pOpts->GetFldDivisionX() ? ( pOpts->GetFldDrawX() / pOpts->GetFldDivisionX() - 1 ) : 0 );
[ # # ][ # # ]
1246 [ # # ][ # # ]: 0 : SetFldDivisionY( pOpts->GetFldDivisionY() ? ( pOpts->GetFldDrawY() / pOpts->GetFldDivisionY() - 1 ) : 0 );
[ # # ][ # # ]
1247 [ # # ]: 0 : SetFldSnapX( pOpts->GetFldSnapX() );
1248 [ # # ]: 0 : SetFldSnapY( pOpts->GetFldSnapY() );
1249 [ # # ]: 0 : SetUseGridSnap( pOpts->IsUseGridSnap() );
1250 [ # # ]: 0 : SetGridVisible( pOpts->IsGridVisible() );
1251 : : }
1252 : 0 : }
1253 : :
1254 : : // -----------------------------------------------------------------------
1255 : :
1256 : 0 : void SdOptionsGridItem::SetOptions( SdOptions* pOpts ) const
1257 : : {
1258 : 0 : pOpts->SetFldDrawX( GetFldDrawX() );
1259 : 0 : pOpts->SetFldDivisionX( GetFldDrawX() / ( GetFldDivisionX() + 1 ) );
1260 : 0 : pOpts->SetFldDrawY( GetFldDrawY() );
1261 : 0 : pOpts->SetFldDivisionY( GetFldDrawY() / ( GetFldDivisionY() + 1 ) );
1262 : 0 : pOpts->SetFldSnapX( GetFldSnapX() );
1263 : 0 : pOpts->SetFldSnapY( GetFldSnapY() );
1264 : 0 : pOpts->SetUseGridSnap( GetUseGridSnap() );
1265 : 0 : pOpts->SetSynchronize( GetSynchronize() );
1266 : 0 : pOpts->SetGridVisible( GetGridVisible() );
1267 : 0 : pOpts->SetEqualGrid( GetEqualGrid() );
1268 : 0 : }
1269 : :
1270 : : /*************************************************************************
1271 : : |*
1272 : : |* SdOptionsPrint
1273 : : |*
1274 : : \************************************************************************/
1275 : :
1276 : 739 : SdOptionsPrint::SdOptionsPrint( sal_uInt16 nConfigId, sal_Bool bUseConfig ) :
1277 : : SdOptionsGeneric( nConfigId, bUseConfig ?
1278 : : ( ( SDCFG_DRAW == nConfigId ) ?
1279 : : B2U( "Office.Draw/Print" ) :
1280 : : B2U( "Office.Impress/Print" ) ) :
1281 : : OUString() ),
1282 : : bDraw( sal_True ),
1283 : : bNotes( sal_False ),
1284 : : bHandout( sal_False ),
1285 : : bOutline( sal_False ),
1286 : : bDate( sal_False ),
1287 : : bTime( sal_False ),
1288 : : bPagename( sal_False ),
1289 : : bHiddenPages( sal_True ),
1290 : : bPagesize( sal_False ),
1291 : : bPagetile( sal_False ),
1292 : : bWarningPrinter( sal_True ),
1293 : : bWarningSize( sal_False ),
1294 : : bWarningOrientation( sal_False ),
1295 : : bBooklet( sal_False ),
1296 : : bFront( sal_True ),
1297 : : bBack( sal_True ),
1298 : : bCutPage( sal_False ),
1299 : : bPaperbin( sal_False ),
1300 : : mbHandoutHorizontal( sal_True ),
1301 : : mnHandoutPages( 6 ),
1302 [ + + ][ + + ]: 739 : nQuality( 0 )
[ + - ]
1303 : : {
1304 : 739 : EnableModify( sal_True );
1305 : 739 : }
1306 : :
1307 : : // -----------------------------------------------------------------------------
1308 : :
1309 : 0 : sal_Bool SdOptionsPrint::operator==( const SdOptionsPrint& rOpt ) const
1310 : : {
1311 : 0 : return( IsDraw() == rOpt.IsDraw() &&
1312 : 0 : IsNotes() == rOpt.IsNotes() &&
1313 : 0 : IsHandout() == rOpt.IsHandout() &&
1314 : 0 : IsOutline() == rOpt.IsOutline() &&
1315 : 0 : IsDate() == rOpt.IsDate() &&
1316 : 0 : IsTime() == rOpt.IsTime() &&
1317 : 0 : IsPagename() == rOpt.IsPagename() &&
1318 : 0 : IsHiddenPages() == rOpt.IsHiddenPages() &&
1319 : 0 : IsPagesize() == rOpt.IsPagesize() &&
1320 : 0 : IsPagetile() == rOpt.IsPagetile() &&
1321 : 0 : IsWarningPrinter() == rOpt.IsWarningPrinter() &&
1322 : 0 : IsWarningSize() == rOpt.IsWarningSize() &&
1323 : 0 : IsWarningOrientation() == rOpt.IsWarningOrientation() &&
1324 : 0 : IsBooklet() == rOpt.IsBooklet() &&
1325 : 0 : IsFrontPage() == rOpt.IsFrontPage() &&
1326 : 0 : IsBackPage() == rOpt.IsBackPage() &&
1327 : 0 : IsCutPage() == rOpt.IsCutPage() &&
1328 : 0 : IsPaperbin() == rOpt.IsPaperbin() &&
1329 : 0 : GetOutputQuality() == rOpt.GetOutputQuality() &&
1330 : 0 : IsHandoutHorizontal() == rOpt.IsHandoutHorizontal() &&
1331 [ # # ][ # # : 0 : GetHandoutPages() == rOpt.GetHandoutPages() );
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # ]
1332 : : }
1333 : :
1334 : : // -----------------------------------------------------------------------------
1335 : :
1336 : 0 : void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const
1337 : : {
1338 : : static const char* aDrawPropNames[] =
1339 : : {
1340 : : "Other/Date",
1341 : : "Other/Time",
1342 : : "Other/PageName",
1343 : : "Other/HiddenPage",
1344 : : "Page/PageSize",
1345 : : "Page/PageTile",
1346 : : // bWarningPrinter
1347 : : // bWarningSize
1348 : : // bWarningOrientation
1349 : : "Page/Booklet",
1350 : : "Page/BookletFront",
1351 : : "Page/BookletBack",
1352 : : // bCutPage
1353 : : "Other/FromPrinterSetup",
1354 : : "Other/Quality",
1355 : : "Content/Drawing",
1356 : : };
1357 : : static const char* aImpressPropNames[] =
1358 : : {
1359 : : "Other/Date",
1360 : : "Other/Time",
1361 : : "Other/PageName",
1362 : : "Other/HiddenPage",
1363 : : "Page/PageSize",
1364 : : "Page/PageTile",
1365 : : // bWarningPrinter
1366 : : // bWarningSize
1367 : : // bWarningOrientation
1368 : : "Page/Booklet",
1369 : : "Page/BookletFront",
1370 : : "Page/BookletBack",
1371 : : // bCutPage
1372 : : "Other/FromPrinterSetup",
1373 : : "Other/Quality",
1374 : : "Content/Presentation",
1375 : : "Content/Note",
1376 : : "Content/Handout",
1377 : : "Content/Outline",
1378 : : "Other/HandoutHorizontal",
1379 : : "Other/PagesPerHandout"
1380 : : };
1381 : :
1382 [ # # ]: 0 : if( GetConfigId() == SDCFG_IMPRESS )
1383 : : {
1384 : 0 : rCount = 17;
1385 : 0 : ppNames = aImpressPropNames;
1386 : : }
1387 : : else
1388 : : {
1389 : 0 : rCount = 12;
1390 : 0 : ppNames = aDrawPropNames;
1391 : : }
1392 : 0 : }
1393 : :
1394 : : // -----------------------------------------------------------------------------
1395 : :
1396 : 0 : sal_Bool SdOptionsPrint::ReadData( const Any* pValues )
1397 : : {
1398 [ # # ]: 0 : if( pValues[0].hasValue() ) SetDate( *(sal_Bool*) pValues[ 0 ].getValue() );
1399 [ # # ]: 0 : if( pValues[1].hasValue() ) SetTime( *(sal_Bool*) pValues[ 1 ].getValue() );
1400 [ # # ]: 0 : if( pValues[2].hasValue() ) SetPagename( *(sal_Bool*) pValues[ 2 ].getValue() );
1401 [ # # ]: 0 : if( pValues[3].hasValue() ) SetHiddenPages( *(sal_Bool*) pValues[ 3 ].getValue() );
1402 [ # # ]: 0 : if( pValues[4].hasValue() ) SetPagesize( *(sal_Bool*) pValues[ 4 ].getValue() );
1403 [ # # ]: 0 : if( pValues[5].hasValue() ) SetPagetile( *(sal_Bool*) pValues[ 5 ].getValue() );
1404 [ # # ]: 0 : if( pValues[6].hasValue() ) SetBooklet( *(sal_Bool*) pValues[ 6 ].getValue() );
1405 [ # # ]: 0 : if( pValues[7].hasValue() ) SetFrontPage( *(sal_Bool*) pValues[ 7 ].getValue() );
1406 [ # # ]: 0 : if( pValues[8].hasValue() ) SetBackPage( *(sal_Bool*) pValues[ 8 ].getValue() );
1407 [ # # ]: 0 : if( pValues[9].hasValue() ) SetPaperbin( *(sal_Bool*) pValues[ 9 ].getValue() );
1408 [ # # ]: 0 : if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *(sal_Int32*) pValues[ 10 ].getValue() );
1409 [ # # ]: 0 : if( pValues[11].hasValue() ) SetDraw( *(sal_Bool*) pValues[ 11 ].getValue() );
1410 : :
1411 : : // just for impress
1412 [ # # ]: 0 : if( GetConfigId() == SDCFG_IMPRESS )
1413 : : {
1414 [ # # ]: 0 : if( pValues[12].hasValue() ) SetNotes( *(sal_Bool*) pValues[ 12 ].getValue() );
1415 [ # # ]: 0 : if( pValues[13].hasValue() ) SetHandout( *(sal_Bool*) pValues[ 13 ].getValue() );
1416 [ # # ]: 0 : if( pValues[14].hasValue() ) SetOutline( *(sal_Bool*) pValues[ 14 ].getValue() );
1417 [ # # ]: 0 : if( pValues[15].hasValue() ) SetHandoutHorizontal( *(sal_Bool*) pValues[15].getValue() );
1418 [ # # ]: 0 : if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*(sal_Int32*) pValues[16].getValue() );
1419 : : }
1420 : :
1421 : 0 : return sal_True;
1422 : : }
1423 : :
1424 : : // -----------------------------------------------------------------------------
1425 : :
1426 : 0 : sal_Bool SdOptionsPrint::WriteData( Any* pValues ) const
1427 : : {
1428 [ # # ]: 0 : pValues[ 0 ] <<= IsDate();
1429 [ # # ]: 0 : pValues[ 1 ] <<= IsTime();
1430 [ # # ]: 0 : pValues[ 2 ] <<= IsPagename();
1431 [ # # ]: 0 : pValues[ 3 ] <<= IsHiddenPages();
1432 [ # # ]: 0 : pValues[ 4 ] <<= IsPagesize();
1433 [ # # ]: 0 : pValues[ 5 ] <<= IsPagetile();
1434 [ # # ]: 0 : pValues[ 6 ] <<= IsBooklet();
1435 [ # # ]: 0 : pValues[ 7 ] <<= IsFrontPage();
1436 [ # # ]: 0 : pValues[ 8 ] <<= IsBackPage();
1437 [ # # ]: 0 : pValues[ 9 ] <<= IsPaperbin();
1438 [ # # ]: 0 : pValues[ 10 ] <<= (sal_Int32) GetOutputQuality();
1439 [ # # ]: 0 : pValues[ 11 ] <<= IsDraw();
1440 : :
1441 : : // just for impress
1442 [ # # ]: 0 : if( GetConfigId() == SDCFG_IMPRESS )
1443 : : {
1444 [ # # ]: 0 : pValues[ 12 ] <<= IsNotes();
1445 [ # # ]: 0 : pValues[ 13 ] <<= IsHandout();
1446 [ # # ]: 0 : pValues[ 14 ] <<= IsOutline();
1447 [ # # ]: 0 : pValues[ 15 ] <<= IsHandoutHorizontal();
1448 [ # # ]: 0 : pValues[ 16 ] <<= GetHandoutPages();
1449 : : }
1450 : :
1451 : 0 : return sal_True;
1452 : : }
1453 : :
1454 : : /*************************************************************************
1455 : : |*
1456 : : |* SdOptionsPrintItem
1457 : : |*
1458 : : \************************************************************************/
1459 : :
1460 : 706 : SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich )
1461 : : : SfxPoolItem ( _nWhich )
1462 [ + - ]: 706 : , maOptionsPrint ( 0, sal_False )
1463 : : {
1464 : 706 : }
1465 : :
1466 : : // ----------------------------------------------------------------------
1467 : :
1468 : 0 : SdOptionsPrintItem::SdOptionsPrintItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd::FrameView* )
1469 : : : SfxPoolItem ( _nWhich )
1470 [ # # ]: 0 : , maOptionsPrint ( 0, sal_False )
1471 : : {
1472 [ # # ]: 0 : if( pOpts )
1473 : : {
1474 [ # # ][ # # ]: 0 : maOptionsPrint.SetDraw( pOpts->IsDraw() );
1475 [ # # ][ # # ]: 0 : maOptionsPrint.SetNotes( pOpts->IsNotes() );
1476 [ # # ][ # # ]: 0 : maOptionsPrint.SetHandout( pOpts->IsHandout() );
1477 [ # # ][ # # ]: 0 : maOptionsPrint.SetOutline( pOpts->IsOutline() );
1478 [ # # ][ # # ]: 0 : maOptionsPrint.SetDate( pOpts->IsDate() );
1479 [ # # ][ # # ]: 0 : maOptionsPrint.SetTime( pOpts->IsTime() );
1480 [ # # ][ # # ]: 0 : maOptionsPrint.SetPagename( pOpts->IsPagename() );
1481 [ # # ][ # # ]: 0 : maOptionsPrint.SetHiddenPages( pOpts->IsHiddenPages() );
1482 [ # # ][ # # ]: 0 : maOptionsPrint.SetPagesize( pOpts->IsPagesize() );
1483 [ # # ][ # # ]: 0 : maOptionsPrint.SetPagetile( pOpts->IsPagetile() );
1484 [ # # ][ # # ]: 0 : maOptionsPrint.SetWarningPrinter( pOpts->IsWarningPrinter() );
1485 [ # # ][ # # ]: 0 : maOptionsPrint.SetWarningSize( pOpts->IsWarningSize() );
1486 [ # # ][ # # ]: 0 : maOptionsPrint.SetWarningOrientation( pOpts->IsWarningOrientation() );
1487 [ # # ][ # # ]: 0 : maOptionsPrint.SetBooklet( pOpts->IsBooklet() );
1488 [ # # ][ # # ]: 0 : maOptionsPrint.SetFrontPage( pOpts->IsFrontPage() );
1489 [ # # ][ # # ]: 0 : maOptionsPrint.SetBackPage( pOpts->IsBackPage() );
1490 [ # # ][ # # ]: 0 : maOptionsPrint.SetCutPage( pOpts->IsCutPage() );
1491 [ # # ][ # # ]: 0 : maOptionsPrint.SetPaperbin( pOpts->IsPaperbin() );
1492 [ # # ][ # # ]: 0 : maOptionsPrint.SetOutputQuality( pOpts->GetOutputQuality() );
1493 : : }
1494 : 0 : }
1495 : :
1496 : : // ----------------------------------------------------------------------
1497 : :
1498 : 0 : SfxPoolItem* SdOptionsPrintItem::Clone( SfxItemPool* ) const
1499 : : {
1500 [ # # ]: 0 : return new SdOptionsPrintItem( *this );
1501 : : }
1502 : :
1503 : : // ----------------------------------------------------------------------
1504 : :
1505 : 0 : int SdOptionsPrintItem::operator==( const SfxPoolItem& rAttr ) const
1506 : : {
1507 : 0 : const bool bSameType = SfxPoolItem::operator==(rAttr);
1508 : : DBG_ASSERT( bSameType, "SdOptionsPrintItem::operator==(), different pool item type!" );
1509 [ # # ][ # # ]: 0 : return bSameType && ( maOptionsPrint == static_cast< const SdOptionsPrintItem& >( rAttr ).maOptionsPrint );
1510 : : }
1511 : :
1512 : : // -----------------------------------------------------------------------
1513 : :
1514 : 697 : void SdOptionsPrintItem::SetOptions( SdOptions* pOpts ) const
1515 : : {
1516 [ + - ]: 697 : if( pOpts )
1517 : : {
1518 : 697 : pOpts->SetDraw( maOptionsPrint.IsDraw() );
1519 : 697 : pOpts->SetNotes( maOptionsPrint.IsNotes() );
1520 : 697 : pOpts->SetHandout( maOptionsPrint.IsHandout() );
1521 : 697 : pOpts->SetOutline( maOptionsPrint.IsOutline() );
1522 : 697 : pOpts->SetDate( maOptionsPrint.IsDate() );
1523 : 697 : pOpts->SetTime( maOptionsPrint.IsTime() );
1524 : 697 : pOpts->SetPagename( maOptionsPrint.IsPagename() );
1525 : 697 : pOpts->SetHiddenPages( maOptionsPrint.IsHiddenPages() );
1526 : 697 : pOpts->SetPagesize( maOptionsPrint.IsPagesize() );
1527 : 697 : pOpts->SetPagetile( maOptionsPrint.IsPagetile() );
1528 : 697 : pOpts->SetWarningPrinter( maOptionsPrint.IsWarningPrinter() );
1529 : 697 : pOpts->SetWarningSize( maOptionsPrint.IsWarningSize() );
1530 : 697 : pOpts->SetWarningOrientation( maOptionsPrint.IsWarningOrientation() );
1531 : 697 : pOpts->SetBooklet( maOptionsPrint.IsBooklet() );
1532 : 697 : pOpts->SetFrontPage( maOptionsPrint.IsFrontPage() );
1533 : 697 : pOpts->SetBackPage( maOptionsPrint.IsBackPage() );
1534 : 697 : pOpts->SetCutPage( maOptionsPrint.IsCutPage() );
1535 : 697 : pOpts->SetPaperbin( maOptionsPrint.IsPaperbin() );
1536 : 697 : pOpts->SetOutputQuality( maOptionsPrint.GetOutputQuality() );
1537 : : }
1538 : 697 : }
1539 : :
1540 : : /*************************************************************************
1541 : : |*
1542 : : |* SdOptions
1543 : : |*
1544 : : \************************************************************************/
1545 : :
1546 : 33 : SdOptions::SdOptions( sal_uInt16 nConfigId ) :
1547 : : SdOptionsLayout( nConfigId, sal_True ),
1548 : : SdOptionsContents( nConfigId, sal_True ),
1549 : : SdOptionsMisc( nConfigId, sal_True ),
1550 : : SdOptionsSnap( nConfigId, sal_True ),
1551 : : SdOptionsZoom( nConfigId, sal_True ),
1552 : : SdOptionsGrid( nConfigId, sal_True ),
1553 [ + - ][ + - ]: 33 : SdOptionsPrint( nConfigId, sal_True )
[ + - ][ + - ]
[ + - ][ + - ]
1554 : : {
1555 : 33 : }
1556 : :
1557 : : // ----------------------------------------------------------------------
1558 : :
1559 [ + - ][ + - ]: 24 : SdOptions::~SdOptions()
[ + - ][ + - ]
[ + - ][ + - ]
1560 : : {
1561 [ - + ]: 48 : }
1562 : :
1563 : : // ----------------------------------------------------------------------
1564 : :
1565 : 0 : void SdOptions::StoreConfig( sal_uLong nOptionsRange )
1566 : : {
1567 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_LAYOUT )
1568 : 0 : SdOptionsLayout::Store();
1569 : :
1570 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_CONTENTS )
1571 : 0 : SdOptionsContents::Store();
1572 : :
1573 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_MISC )
1574 : 0 : SdOptionsMisc::Store();
1575 : :
1576 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_SNAP )
1577 : 0 : SdOptionsSnap::Store();
1578 : :
1579 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_ZOOM )
1580 : 0 : SdOptionsZoom::Store();
1581 : :
1582 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_GRID )
1583 : 0 : SdOptionsGrid::Store();
1584 : :
1585 [ # # ]: 0 : if( nOptionsRange & SD_OPTIONS_PRINT )
1586 : 0 : SdOptionsPrint::Store();
1587 : 0 : }
1588 : :
1589 : 0 : sal_Int32 SdOptionsMisc::GetDisplay() const
1590 : : {
1591 : 0 : Init();
1592 : 0 : return mnDisplay;
1593 : : }
1594 : :
1595 : 17 : void SdOptionsMisc::SetDisplay( sal_Int32 nDisplay )
1596 : : {
1597 [ - + ]: 17 : if( mnDisplay != nDisplay )
1598 : : {
1599 : 0 : OptionsChanged();
1600 : 0 : mnDisplay = nDisplay;
1601 : : }
1602 : 17 : }
1603 : :
1604 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|