2000-12-18 14:16:04 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 13:04:24 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2005-09-09 13:04:24 +00:00
|
|
|
* $RCSfile: controlpropertyhdl.cxx,v $
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2007-06-27 14:12:57 +00:00
|
|
|
* $Revision: 1.20 $
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2007-06-27 14:12:57 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2007-06-27 15:12:57 $
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2005-09-09 13:04:24 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 13:04:24 +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
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2005-09-09 13:04:24 +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.
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2005-09-09 13:04:24 +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.
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
2005-09-09 13:04:24 +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
|
2000-12-18 14:16:04 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 09:33:22 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_xmloff.hxx"
|
|
|
|
|
2000-12-18 14:16:04 +00:00
|
|
|
#ifndef _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_
|
2007-06-27 14:12:57 +00:00
|
|
|
#include <xmloff/controlpropertyhdl.hxx>
|
2000-12-18 14:16:04 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
|
|
|
|
#include <com/sun/star/awt/TextAlign.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_
|
|
|
|
#include <com/sun/star/awt/FontWidth.hpp>
|
|
|
|
#endif
|
2001-06-07 11:27:21 +00:00
|
|
|
#ifndef _COM_SUN_STAR_AWT_FONTEMPHASISMARK_HPP_
|
|
|
|
#include <com/sun/star/awt/FontEmphasisMark.hpp>
|
|
|
|
#endif
|
2000-12-18 14:16:04 +00:00
|
|
|
#ifndef _XMLOFF_XMLTYPES_HXX
|
2007-06-27 14:12:57 +00:00
|
|
|
#include <xmloff/xmltypes.hxx>
|
2000-12-18 14:16:04 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_FORMENUMS_HXX_
|
|
|
|
#include "formenums.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_XMLUCONV_HXX
|
2007-06-27 14:12:57 +00:00
|
|
|
#include <xmloff/xmluconv.hxx>
|
2000-12-18 14:16:04 +00:00
|
|
|
#endif
|
2001-06-29 20:07:26 +00:00
|
|
|
#ifndef _XMLOFF_XMLTOKEN_HXX
|
2007-06-27 14:12:57 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2000-12-19 11:13:57 +00:00
|
|
|
#endif
|
2000-12-18 14:16:04 +00:00
|
|
|
#ifndef _RTL_USTRBUF_HXX_
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#endif
|
2001-05-28 14:03:48 +00:00
|
|
|
#ifndef _OSL_DIAGNOSE_H_
|
|
|
|
#include <osl/diagnose.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _XMLOFF_FORMS_CALLBACKS_HXX_
|
|
|
|
#include "callbacks.hxx"
|
|
|
|
#endif
|
2001-06-07 11:27:21 +00:00
|
|
|
#ifndef _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX
|
2007-06-27 14:12:57 +00:00
|
|
|
#include <xmloff/XMLConstantsPropertyHandler.hxx>
|
2001-06-07 11:27:21 +00:00
|
|
|
#endif
|
2000-12-18 14:16:04 +00:00
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
namespace xmloff
|
|
|
|
{
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2001-06-15 11:35:28 +00:00
|
|
|
using namespace ::xmloff::token;
|
2000-12-18 14:16:04 +00:00
|
|
|
|
|
|
|
//=====================================================================
|
|
|
|
//= OControlPropertyHandlerFactory
|
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
OControlPropertyHandlerFactory::OControlPropertyHandlerFactory()
|
2001-05-28 14:03:48 +00:00
|
|
|
:m_pTextAlignHandler(NULL)
|
2004-07-05 15:06:44 +00:00
|
|
|
,m_pControlBorderStyleHandler(NULL)
|
|
|
|
,m_pControlBorderColorHandler(NULL)
|
2001-05-28 14:03:48 +00:00
|
|
|
,m_pRotationAngleHandler(NULL)
|
|
|
|
,m_pFontWidthHandler(NULL)
|
2001-07-16 06:34:21 +00:00
|
|
|
,m_pFontEmphasisHandler(NULL)
|
|
|
|
,m_pFontReliefHandler(NULL)
|
2000-12-18 14:16:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
OControlPropertyHandlerFactory::~OControlPropertyHandlerFactory()
|
|
|
|
{
|
2001-05-28 14:03:48 +00:00
|
|
|
delete m_pTextAlignHandler;
|
2004-07-05 15:06:44 +00:00
|
|
|
delete m_pControlBorderStyleHandler;
|
|
|
|
delete m_pControlBorderColorHandler;
|
2001-05-28 14:03:48 +00:00
|
|
|
delete m_pRotationAngleHandler;
|
|
|
|
delete m_pFontWidthHandler;
|
2001-07-16 06:34:21 +00:00
|
|
|
delete m_pFontEmphasisHandler;
|
|
|
|
delete m_pFontReliefHandler;
|
2000-12-18 14:16:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
const XMLPropertyHandler* OControlPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const
|
|
|
|
{
|
2001-05-28 14:03:48 +00:00
|
|
|
const XMLPropertyHandler* pHandler = NULL;
|
|
|
|
|
2000-12-18 14:16:04 +00:00
|
|
|
switch (_nType)
|
|
|
|
{
|
|
|
|
case XML_TYPE_TEXT_ALIGN:
|
2001-05-28 14:03:48 +00:00
|
|
|
if (!m_pTextAlignHandler)
|
2001-06-15 11:35:28 +00:00
|
|
|
m_pTextAlignHandler = new XMLConstantsPropertyHandler(OEnumMapper::getEnumMap(OEnumMapper::epTextAlign), XML_TOKEN_INVALID );
|
2001-05-28 14:03:48 +00:00
|
|
|
pHandler = m_pTextAlignHandler;
|
|
|
|
break;
|
|
|
|
|
2000-12-19 11:13:57 +00:00
|
|
|
case XML_TYPE_CONTROL_BORDER:
|
2004-07-05 15:06:44 +00:00
|
|
|
if (!m_pControlBorderStyleHandler)
|
|
|
|
m_pControlBorderStyleHandler = new OControlBorderStyleHandler;
|
|
|
|
pHandler = m_pControlBorderStyleHandler;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XML_TYPE_CONTROL_BORDER_COLOR:
|
|
|
|
if ( !m_pControlBorderColorHandler )
|
|
|
|
m_pControlBorderColorHandler = new OControlBorderColorHandler;
|
|
|
|
pHandler = m_pControlBorderColorHandler;
|
2001-05-28 14:03:48 +00:00
|
|
|
break;
|
|
|
|
|
2000-12-18 14:16:04 +00:00
|
|
|
case XML_TYPE_ROTATION_ANGLE:
|
2001-05-28 14:03:48 +00:00
|
|
|
if (!m_pRotationAngleHandler)
|
|
|
|
m_pRotationAngleHandler = new ORotationAngleHandler;
|
|
|
|
pHandler = m_pRotationAngleHandler;
|
|
|
|
break;
|
|
|
|
|
2000-12-19 11:13:57 +00:00
|
|
|
case XML_TYPE_FONT_WIDTH:
|
2001-05-28 14:03:48 +00:00
|
|
|
if (!m_pFontWidthHandler)
|
|
|
|
m_pFontWidthHandler = new OFontWidthHandler;
|
|
|
|
pHandler = m_pFontWidthHandler;
|
|
|
|
break;
|
2001-06-07 11:27:21 +00:00
|
|
|
|
|
|
|
case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
|
|
|
|
if (!m_pFontEmphasisHandler)
|
2001-06-15 11:35:28 +00:00
|
|
|
m_pFontEmphasisHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE );
|
2001-06-07 11:27:21 +00:00
|
|
|
pHandler = m_pFontEmphasisHandler;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XML_TYPE_TEXT_FONT_RELIEF:
|
|
|
|
if (!m_pFontReliefHandler)
|
2001-06-15 11:35:28 +00:00
|
|
|
m_pFontReliefHandler = new XMLConstantsPropertyHandler( OEnumMapper::getEnumMap(OEnumMapper::epFontRelief), XML_NONE );
|
2001-07-16 06:34:21 +00:00
|
|
|
pHandler = m_pFontReliefHandler;
|
2001-06-07 11:27:21 +00:00
|
|
|
break;
|
2000-12-18 14:16:04 +00:00
|
|
|
}
|
2001-05-28 14:03:48 +00:00
|
|
|
|
|
|
|
if (!pHandler)
|
|
|
|
pHandler = XMLPropertyHandlerFactory::GetPropertyHandler(_nType);
|
|
|
|
return pHandler;
|
2000-12-18 14:16:04 +00:00
|
|
|
}
|
|
|
|
|
2001-06-07 11:27:21 +00:00
|
|
|
//=====================================================================
|
|
|
|
//= OControlTextEmphasisHandler
|
|
|
|
//=====================================================================
|
|
|
|
OControlTextEmphasisHandler::OControlTextEmphasisHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OControlTextEmphasisHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
::rtl::OUStringBuffer aReturn;
|
|
|
|
sal_Bool bSuccess = sal_False;
|
2006-08-29 10:00:08 +00:00
|
|
|
sal_Int16 nFontEmphasis = sal_Int16();
|
2001-06-07 11:27:21 +00:00
|
|
|
if (_rValue >>= nFontEmphasis)
|
|
|
|
{
|
|
|
|
// the type
|
|
|
|
sal_Int16 nType = nFontEmphasis & ~(FontEmphasisMark::ABOVE | FontEmphasisMark::BELOW);
|
|
|
|
// the position of the mark
|
|
|
|
sal_Bool bBelow = 0 != (nFontEmphasis & FontEmphasisMark::BELOW);
|
|
|
|
|
|
|
|
// convert
|
2006-10-12 13:42:46 +00:00
|
|
|
bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE);
|
|
|
|
if (bSuccess)
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
aReturn.append( (sal_Unicode)' ' );
|
2001-06-29 20:07:26 +00:00
|
|
|
aReturn.append( GetXMLToken(bBelow ? XML_BELOW : XML_ABOVE) );
|
2001-06-07 11:27:21 +00:00
|
|
|
|
|
|
|
_rStrExpValue = aReturn.makeStringAndClear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OControlTextEmphasisHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
sal_Bool bSuccess = sal_True;
|
|
|
|
sal_uInt16 nEmphasis = FontEmphasisMark::NONE;
|
|
|
|
|
|
|
|
sal_Bool bBelow = sal_False;
|
|
|
|
sal_Bool bHasPos = sal_False, bHasType = sal_False;
|
|
|
|
|
|
|
|
::rtl::OUString sToken;
|
|
|
|
SvXMLTokenEnumerator aTokenEnum(_rStrImpValue);
|
|
|
|
while (aTokenEnum.getNextToken(sToken))
|
|
|
|
{
|
|
|
|
if (!bHasPos)
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
if (IsXMLToken(sToken, XML_ABOVE))
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
bBelow = sal_False;
|
|
|
|
bHasPos = sal_True;
|
|
|
|
}
|
2001-06-29 20:07:26 +00:00
|
|
|
else if (IsXMLToken(sToken, XML_BELOW))
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
bBelow = sal_True;
|
|
|
|
bHasPos = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!bHasType)
|
|
|
|
{
|
2006-10-12 13:42:46 +00:00
|
|
|
if (SvXMLUnitConverter::convertEnum(nEmphasis, sToken, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis)))
|
2001-06-07 11:27:21 +00:00
|
|
|
{
|
|
|
|
bHasType = sal_True;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bSuccess = sal_False;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bSuccess)
|
|
|
|
{
|
|
|
|
nEmphasis |= bBelow ? FontEmphasisMark::BELOW : FontEmphasisMark::ABOVE;
|
|
|
|
_rValue <<= (sal_Int16)nEmphasis;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
2000-12-19 11:13:57 +00:00
|
|
|
//=====================================================================
|
2004-07-05 15:06:44 +00:00
|
|
|
//= OControlBorderHandlerFactory
|
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
const XMLPropertyHandler* OControlBorderHandlerFactory::createBorderHandler()
|
|
|
|
{
|
|
|
|
return new OControlBorderStyleHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
const XMLPropertyHandler* OControlBorderHandlerFactory::createBorderColorHandler()
|
|
|
|
{
|
|
|
|
return new OControlBorderColorHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=====================================================================
|
|
|
|
//= OControlBorderHandlerBase
|
2000-12-19 11:13:57 +00:00
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
2004-07-05 15:06:44 +00:00
|
|
|
OControlBorderHandlerBase::OControlBorderHandlerBase()
|
2000-12-19 11:13:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OControlBorderHandlerBase::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-19 11:13:57 +00:00
|
|
|
{
|
|
|
|
::rtl::OUString sToken;
|
|
|
|
SvXMLTokenEnumerator aTokens(_rStrImpValue);
|
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
sal_uInt16 nStyle = 1;
|
|
|
|
Color aColor;
|
2000-12-19 11:13:57 +00:00
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
sal_Bool bFoundStyle = sal_False;
|
|
|
|
sal_Bool bFoundColor = sal_False;
|
|
|
|
|
|
|
|
while ( !( bFoundStyle && bFoundColor ) // did not yet find both aspects
|
2000-12-19 11:13:57 +00:00
|
|
|
&& aTokens.getNextToken(sToken) // have a new token
|
|
|
|
&& (0 != sToken.getLength()) // really have a new token
|
|
|
|
)
|
|
|
|
{
|
2004-07-05 15:06:44 +00:00
|
|
|
// is it a valid enum value?
|
|
|
|
if ( !bFoundStyle )
|
2006-10-12 13:42:46 +00:00
|
|
|
bFoundStyle = SvXMLUnitConverter::convertEnum(nStyle, sToken, OEnumMapper::getEnumMap(OEnumMapper::epBorderWidth));
|
2004-07-05 15:06:44 +00:00
|
|
|
// is it a color value?
|
|
|
|
if ( !bFoundColor )
|
2006-10-12 13:42:46 +00:00
|
|
|
bFoundColor = SvXMLUnitConverter::convertColor( aColor, sToken );
|
2000-12-19 11:13:57 +00:00
|
|
|
}
|
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
if ( !bFoundStyle && !bFoundColor )
|
2000-12-19 11:13:57 +00:00
|
|
|
return sal_False;
|
|
|
|
|
|
|
|
// if we're here, the string could have had more or less than the requested 3 tokens, but we ignore this.
|
2004-07-05 15:06:44 +00:00
|
|
|
// At least we have a valid style or a valid, which is everything we're interested in.
|
|
|
|
pickOne( aColor, (sal_Int16)nStyle, _rValue );
|
2000-12-19 11:13:57 +00:00
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
//=====================================================================
|
|
|
|
//= OControlBorderStyleHandler
|
|
|
|
//=====================================================================
|
2000-12-19 11:13:57 +00:00
|
|
|
//---------------------------------------------------------------------
|
2004-07-05 15:06:44 +00:00
|
|
|
OControlBorderStyleHandler::OControlBorderStyleHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OControlBorderStyleHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-19 11:13:57 +00:00
|
|
|
{
|
|
|
|
sal_Bool bSuccess = sal_False;
|
|
|
|
sal_Int16 nBorder = 0;
|
|
|
|
|
|
|
|
::rtl::OUStringBuffer aOut;
|
2001-05-15 13:02:13 +00:00
|
|
|
bSuccess = (_rValue >>= nBorder)
|
2006-10-12 13:42:46 +00:00
|
|
|
&& SvXMLUnitConverter::convertEnum(aOut, nBorder, OEnumMapper::getEnumMap(OEnumMapper::epBorderWidth));
|
2000-12-19 11:13:57 +00:00
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
if ( _rStrExpValue.getLength() )
|
|
|
|
_rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
|
|
|
|
_rStrExpValue += aOut.makeStringAndClear();
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-06-19 17:16:12 +00:00
|
|
|
void OControlBorderStyleHandler::pickOne( const Color&, sal_Int16 _nStyle, Any& _rValue ) const
|
2004-07-05 15:06:44 +00:00
|
|
|
{
|
|
|
|
_rValue <<= _nStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=====================================================================
|
|
|
|
//= OControlBorderColorHandler
|
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
OControlBorderColorHandler::OControlBorderColorHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OControlBorderColorHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
|
2004-07-05 15:06:44 +00:00
|
|
|
{
|
|
|
|
sal_Bool bSuccess = sal_False;
|
|
|
|
sal_Int32 nBorderColor = 0;
|
|
|
|
|
|
|
|
::rtl::OUStringBuffer aOut;
|
|
|
|
if ( _rValue >>= nBorderColor )
|
|
|
|
{
|
2006-10-12 13:42:46 +00:00
|
|
|
SvXMLUnitConverter::convertColor( aOut, Color( nBorderColor ) );
|
2004-07-05 15:06:44 +00:00
|
|
|
bSuccess = sal_True;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( _rStrExpValue.getLength() )
|
|
|
|
_rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
|
|
|
|
_rStrExpValue += aOut.makeStringAndClear();
|
2001-05-15 13:02:13 +00:00
|
|
|
return bSuccess;
|
2000-12-19 11:13:57 +00:00
|
|
|
}
|
|
|
|
|
2004-07-05 15:06:44 +00:00
|
|
|
//---------------------------------------------------------------------
|
2006-06-19 17:16:12 +00:00
|
|
|
void OControlBorderColorHandler::pickOne( const Color& _rColor, sal_Int16 /*_nStyle*/, Any& _rValue ) const
|
2004-07-05 15:06:44 +00:00
|
|
|
{
|
|
|
|
_rValue <<= (sal_Int32)_rColor.GetColor();
|
|
|
|
}
|
|
|
|
|
2000-12-19 11:13:57 +00:00
|
|
|
//=====================================================================
|
|
|
|
//= OFontWidthHandler
|
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
OFontWidthHandler::OFontWidthHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OFontWidthHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-19 11:13:57 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nWidth = 0;
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool bSuccess = SvXMLUnitConverter::convertMeasure(nWidth, _rStrImpValue, MAP_POINT);
|
|
|
|
if (bSuccess)
|
2000-12-19 11:13:57 +00:00
|
|
|
_rValue <<= (sal_Int16)nWidth;
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool OFontWidthHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-19 11:13:57 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nWidth = 0;
|
|
|
|
::rtl::OUStringBuffer aResult;
|
|
|
|
if (_rValue >>= nWidth)
|
2006-10-12 13:42:46 +00:00
|
|
|
SvXMLUnitConverter::convertMeasure(aResult, nWidth, MAP_POINT, MAP_POINT);
|
2000-12-19 11:13:57 +00:00
|
|
|
_rStrExpValue = aResult.makeStringAndClear();
|
|
|
|
|
|
|
|
return _rStrExpValue.getLength() != 0;
|
|
|
|
}
|
|
|
|
|
2000-12-18 14:16:04 +00:00
|
|
|
//=====================================================================
|
2001-05-28 14:03:48 +00:00
|
|
|
//= ORotationAngleHandler
|
2000-12-18 14:16:04 +00:00
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
ORotationAngleHandler::ORotationAngleHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool ORotationAngleHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-18 14:16:04 +00:00
|
|
|
{
|
|
|
|
double fValue;
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool bSucces =
|
|
|
|
SvXMLUnitConverter::convertDouble(fValue, _rStrImpValue);
|
|
|
|
if (bSucces)
|
2000-12-18 14:16:04 +00:00
|
|
|
{
|
|
|
|
fValue *= 10;
|
|
|
|
_rValue <<= (float)fValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSucces;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool ORotationAngleHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
|
2000-12-18 14:16:04 +00:00
|
|
|
{
|
2006-11-21 16:34:18 +00:00
|
|
|
float fAngle = 0;
|
2006-10-12 13:42:46 +00:00
|
|
|
sal_Bool bSuccess = (_rValue >>= fAngle);
|
2000-12-18 14:16:04 +00:00
|
|
|
|
2006-10-12 13:42:46 +00:00
|
|
|
if (bSuccess)
|
2000-12-18 14:16:04 +00:00
|
|
|
{
|
|
|
|
rtl::OUStringBuffer sValue;
|
2006-10-12 13:42:46 +00:00
|
|
|
SvXMLUnitConverter::convertDouble(sValue, ((double)fAngle) / 10);
|
2000-12-18 14:16:04 +00:00
|
|
|
_rStrExpValue = sValue.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
return bSuccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
} // namespace xmloff
|
|
|
|
//.........................................................................
|
|
|
|
|