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: writingmodeitem.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_svx.hxx"
34 // include ---------------------------------------------------------------
37 #include <svx/writingmodeitem.hxx>
38 #include <svx/dialmgr.hxx>
41 #include <svx/svxitems.hrc>
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::text
;
47 // class SvxWritingModeItem -------------------------------------------------
49 TYPEINIT1_FACTORY(SvxWritingModeItem
, SfxUInt16Item
, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB
, 0));
51 SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue
, USHORT _nWhich
)
52 : SfxUInt16Item( _nWhich
, (sal_uInt16
)eValue
)
56 SvxWritingModeItem::~SvxWritingModeItem()
60 int SvxWritingModeItem::operator==( const SfxPoolItem
& rCmp
) const
62 DBG_ASSERT( SfxPoolItem::operator==(rCmp
), "unequal types" );
64 return GetValue() == ((SvxWritingModeItem
&)rCmp
).GetValue();
67 SfxPoolItem
* SvxWritingModeItem::Clone( SfxItemPool
* ) const
69 return new SvxWritingModeItem( *this );
72 SfxPoolItem
* SvxWritingModeItem::Create( SvStream
& , USHORT
) const
74 DBG_ERROR("SvxWritingModeItem should not be streamed!");
78 SvStream
& SvxWritingModeItem::Store( SvStream
& rStrm
, USHORT
) const
80 DBG_ERROR("SvxWritingModeItem should not be streamed!");
84 USHORT
SvxWritingModeItem::GetVersion( USHORT
/*nFVer*/ ) const
89 SfxItemPresentation
SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres
,
90 SfxMapUnit
/*eCoreMetric*/,
91 SfxMapUnit
/*ePresMetric*/,
93 const IntlWrapper
* ) const
95 SfxItemPresentation eRet
= ePres
;
98 case SFX_ITEM_PRESENTATION_NONE
:
102 case SFX_ITEM_PRESENTATION_NAMELESS
:
103 case SFX_ITEM_PRESENTATION_COMPLETE
:
104 rText
= SVX_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN
+ GetValue() );
108 eRet
= SFX_ITEM_PRESENTATION_NONE
;
113 sal_Bool
SvxWritingModeItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
)
116 sal_Bool bRet
= ( rVal
>>= nVal
);
121 bRet
= rVal
>>= eMode
;
125 nVal
= (sal_Int32
)eMode
;
133 case WritingMode_LR_TB
:
134 case WritingMode_RL_TB
:
135 case WritingMode_TB_RL
:
136 SetValue( (sal_uInt16
)nVal
);
148 sal_Bool
SvxWritingModeItem::QueryValue( com::sun::star::uno::Any
& rVal
,
151 rVal
<<= (WritingMode
)GetValue();
155 SvxWritingModeItem
& SvxWritingModeItem::operator=( const SvxWritingModeItem
& rItem
)
157 SetValue( rItem
.GetValue() );