2002-04-25 08:41:55 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* $RCSfile: writingmodeitem.cxx,v $
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2006-11-21 16:11:29 +00:00
|
|
|
* $Revision: 1.5 $
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2006-11-21 16:11:29 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2006-11-21 17:11:29 $
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
2005-09-08 22:41:55 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-04-25 08:41:55 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 04:24:17 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_svx.hxx"
|
|
|
|
|
2002-04-25 08:41:55 +00:00
|
|
|
// include ---------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _SVX_WRITINGMODEITEM_HXX
|
|
|
|
#include "writingmodeitem.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVX_DIALMGR_HXX
|
|
|
|
#include "dialmgr.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SVXITEMS_HRC
|
|
|
|
#include "svxitems.hrc"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::text;
|
|
|
|
|
|
|
|
// class SvxWritingModeItem -------------------------------------------------
|
|
|
|
|
|
|
|
TYPEINIT1_AUTOFACTORY(SvxWritingModeItem, SfxUInt16Item);
|
|
|
|
|
2006-06-19 15:16:30 +00:00
|
|
|
SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, USHORT _nWhich )
|
|
|
|
: SfxUInt16Item( _nWhich, (sal_uInt16)eValue )
|
2002-04-25 08:41:55 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxWritingModeItem::~SvxWritingModeItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int SvxWritingModeItem::operator==( const SfxPoolItem& rCmp ) const
|
|
|
|
{
|
|
|
|
DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
|
|
|
|
|
|
|
|
return GetValue() == ((SvxWritingModeItem&)rCmp).GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const
|
|
|
|
{
|
|
|
|
return new SvxWritingModeItem( *this );
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:30 +00:00
|
|
|
SfxPoolItem* SvxWritingModeItem::Create( SvStream & , USHORT ) const
|
2002-04-25 08:41:55 +00:00
|
|
|
{
|
|
|
|
DBG_ERROR("SvxWritingModeItem should not be streamed!");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:30 +00:00
|
|
|
SvStream& SvxWritingModeItem::Store( SvStream & rStrm, USHORT ) const
|
2002-04-25 08:41:55 +00:00
|
|
|
{
|
|
|
|
DBG_ERROR("SvxWritingModeItem should not be streamed!");
|
|
|
|
return rStrm;
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:30 +00:00
|
|
|
USHORT SvxWritingModeItem::GetVersion( USHORT /*nFVer*/ ) const
|
2002-04-25 08:41:55 +00:00
|
|
|
{
|
|
|
|
return USHRT_MAX;
|
|
|
|
}
|
|
|
|
|
2006-06-19 15:16:30 +00:00
|
|
|
SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres,
|
|
|
|
SfxMapUnit /*eCoreMetric*/,
|
|
|
|
SfxMapUnit /*ePresMetric*/,
|
|
|
|
String &rText,
|
|
|
|
const IntlWrapper * ) const
|
2002-04-25 08:41:55 +00:00
|
|
|
{
|
|
|
|
SfxItemPresentation eRet = ePres;
|
|
|
|
switch( ePres )
|
|
|
|
{
|
|
|
|
case SFX_ITEM_PRESENTATION_NONE:
|
|
|
|
rText.Erase();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SFX_ITEM_PRESENTATION_NAMELESS:
|
|
|
|
case SFX_ITEM_PRESENTATION_COMPLETE:
|
|
|
|
rText = SVX_RESSTR( RID_SVXITEMS_FRMDIR_BEGIN + GetValue() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
eRet = SFX_ITEM_PRESENTATION_NONE;
|
|
|
|
}
|
|
|
|
return eRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
|
|
|
|
{
|
2006-11-21 16:11:29 +00:00
|
|
|
sal_Int32 nVal = 0;
|
2002-04-25 08:41:55 +00:00
|
|
|
sal_Bool bRet = ( rVal >>= nVal );
|
|
|
|
|
|
|
|
if( !bRet )
|
|
|
|
{
|
|
|
|
WritingMode eMode;
|
|
|
|
bRet = rVal >>= eMode;
|
|
|
|
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
nVal = (sal_Int32)eMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
switch( nVal )
|
|
|
|
{
|
|
|
|
case WritingMode_LR_TB:
|
|
|
|
case WritingMode_RL_TB:
|
|
|
|
case WritingMode_TB_RL:
|
|
|
|
SetValue( (sal_uInt16)nVal );
|
|
|
|
bRet = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bRet = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal,
|
|
|
|
BYTE ) const
|
|
|
|
{
|
|
|
|
rVal <<= (WritingMode)GetValue();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rItem )
|
|
|
|
{
|
|
|
|
SetValue( rItem.GetValue() );
|
|
|
|
return *this;
|
|
|
|
}
|