2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 21:39:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "kernihdl.hxx"
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
// --
|
2007-06-27 14:40:42 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
|
|
|
#include <xmloff/xmluconv.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-03-12 09:52:07 +00:00
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::rtl::OUStringBuffer;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// class XMLKerningPropHdl
|
|
|
|
//
|
|
|
|
|
|
|
|
XMLKerningPropHdl::~XMLKerningPropHdl()
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool XMLKerningPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_True;
|
|
|
|
sal_Int32 nKerning = 0;
|
|
|
|
|
2001-06-29 20:07:26 +00:00
|
|
|
if( ! IsXMLToken( rStrImpValue, XML_KERNING_NORMAL ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-10-11 14:19:09 +02:00
|
|
|
bRet = rUnitConverter.convertMeasureToCore( nKerning, rStrImpValue );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-23 11:58:32 +00:00
|
|
|
rValue <<= (sal_Int16)nKerning;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool XMLKerningPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
2006-08-29 10:01:47 +00:00
|
|
|
sal_Int16 nValue = sal_Int16();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( rValue >>= nValue )
|
|
|
|
{
|
|
|
|
OUStringBuffer aOut;
|
|
|
|
|
|
|
|
if( nValue == 0 )
|
2001-06-29 20:07:26 +00:00
|
|
|
aOut.append( GetXMLToken(XML_KERNING_NORMAL) );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2011-10-11 14:19:09 +02:00
|
|
|
{
|
|
|
|
rUnitConverter.convertMeasureToXML( aOut, nValue );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
rStrExpValue = aOut.makeStringAndClear();
|
|
|
|
|
|
|
|
bRet = sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|