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