1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fmtwrapinfluenceonobjpos.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <fmtwrapinfluenceonobjpos.hxx>
39 using namespace ::com::sun::star
;
40 using namespace ::com::sun::star::uno
;
42 TYPEINIT1(SwFmtWrapInfluenceOnObjPos
, SfxPoolItem
);
44 SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
45 sal_Int16 _nWrapInfluenceOnPosition
)
46 : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS
),
47 mnWrapInfluenceOnPosition( _nWrapInfluenceOnPosition
)
51 SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos(
52 const SwFmtWrapInfluenceOnObjPos
& _rCpy
)
53 : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS
),
54 mnWrapInfluenceOnPosition( _rCpy
.GetWrapInfluenceOnObjPos() )
58 SwFmtWrapInfluenceOnObjPos::~SwFmtWrapInfluenceOnObjPos()
62 SwFmtWrapInfluenceOnObjPos
& SwFmtWrapInfluenceOnObjPos::operator=(
63 const SwFmtWrapInfluenceOnObjPos
& _rSource
)
65 mnWrapInfluenceOnPosition
= _rSource
.GetWrapInfluenceOnObjPos();
70 int SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem
& _rAttr
) const
72 ASSERT( SfxPoolItem::operator==( _rAttr
), "keine gleichen Attribute" );
73 return ( mnWrapInfluenceOnPosition
==
74 static_cast<const SwFmtWrapInfluenceOnObjPos
&>(_rAttr
).
75 GetWrapInfluenceOnObjPos() );
78 SfxPoolItem
* SwFmtWrapInfluenceOnObjPos::Clone( SfxItemPool
* ) const
80 return new SwFmtWrapInfluenceOnObjPos(*this);
83 BOOL
SwFmtWrapInfluenceOnObjPos::QueryValue( Any
& rVal
, BYTE nMemberId
) const
85 nMemberId
&= ~CONVERT_TWIPS
;
86 sal_Bool bRet
= sal_True
;
89 case MID_WRAP_INFLUENCE
:
91 rVal
<<= GetWrapInfluenceOnObjPos();
95 ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
102 BOOL
SwFmtWrapInfluenceOnObjPos::PutValue( const Any
& rVal
, BYTE nMemberId
)
104 nMemberId
&= ~CONVERT_TWIPS
;
105 sal_Bool bRet
= sal_True
;
109 case MID_WRAP_INFLUENCE
:
111 sal_Int16 nNewWrapInfluence
= 0;
112 rVal
>>= nNewWrapInfluence
;
113 // --> OD 2004-10-18 #i35017# - constant names have changed and
114 // <ITERATIVE> has been added
115 if ( nNewWrapInfluence
== text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE
||
116 nNewWrapInfluence
== text::WrapInfluenceOnPosition::ONCE_CONCURRENT
||
117 nNewWrapInfluence
== text::WrapInfluenceOnPosition::ITERATIVE
)
120 SetWrapInfluenceOnObjPos( nNewWrapInfluence
);
124 ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
130 ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
137 void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition
)
139 // --> OD 2004-10-18 #i35017# - constant names have changed and consider
140 // new value <ITERATIVE>
141 if ( _nWrapInfluenceOnPosition
== text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE
||
142 _nWrapInfluenceOnPosition
== text::WrapInfluenceOnPosition::ONCE_CONCURRENT
||
143 _nWrapInfluenceOnPosition
== text::WrapInfluenceOnPosition::ITERATIVE
)
146 mnWrapInfluenceOnPosition
= _nWrapInfluenceOnPosition
;
150 ASSERT( false, "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" );
154 // --> OD 2004-10-18 #i35017# - add parameter <_bIterativeAsOnceConcurrent>
155 // to control, if value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
156 sal_Int16
SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
157 const bool _bIterativeAsOnceConcurrent
) const
159 sal_Int16
nWrapInfluenceOnPosition( mnWrapInfluenceOnPosition
);
161 if ( _bIterativeAsOnceConcurrent
&&
162 nWrapInfluenceOnPosition
== text::WrapInfluenceOnPosition::ITERATIVE
)
164 nWrapInfluenceOnPosition
= text::WrapInfluenceOnPosition::ONCE_CONCURRENT
;
167 return nWrapInfluenceOnPosition
;