Kaydet (Commit) 4fc923a1 authored tarafından Christian Lippka's avatar Christian Lippka

#86616# added missing caption styles

üst 0b0fb05d
/*************************************************************************
*
* $RCSfile: XMLIsPercentagePropertyHandler.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cl $ $Date: 2001-05-18 07:01:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
#define _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
#include <xmlprhdl.hxx>
#endif
/**
This is a handler that returns true for import if the attribute string
contains a '%' value. For export this is only usable for filtering.
*/
class XMLIsPercentagePropertyHandler : public XMLPropertyHandler
{
public:
virtual ~XMLIsPercentagePropertyHandler ();
virtual sal_Bool importXML(
const ::rtl::OUString& rStrImpValue,
::com::sun::star::uno::Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const;
virtual sal_Bool exportXML(
::rtl::OUString& rStrExpValue,
const ::com::sun::star::uno::Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const;
};
#endif
/*************************************************************************
*
* $RCSfile: XMLPercentOrMeasurePropertyHandler.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cl $ $Date: 2001-05-18 07:01:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
#define _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
#include <xmlprhdl.hxx>
#endif
/**
This is a handler either only import/exports percent or measure.
*/
class XMLPercentOrMeasurePropertyHandler : public XMLPropertyHandler
{
private:
sal_Bool mbPercent;
public:
XMLPercentOrMeasurePropertyHandler( sal_Bool bPercent );
virtual ~XMLPercentOrMeasurePropertyHandler ();
virtual sal_Bool importXML(
const ::rtl::OUString& rStrImpValue,
::com::sun::star::uno::Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const;
virtual sal_Bool exportXML(
::rtl::OUString& rStrExpValue,
const ::com::sun::star::uno::Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const;
};
#endif
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmlkywd.hxx,v $
*
* $Revision: 1.158 $
* $Revision: 1.159 $
*
* last change: $Author: dvo $ $Date: 2001-05-16 15:20:59 $
* last change: $Author: cl $ $Date: 2001-05-18 07:01:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -1991,4 +1991,18 @@ XML_CONSTASCII_ACTION( sXML_button2, "button2" );
XML_CONSTASCII_ACTION( sXML_button3, "button3" );
XML_CONSTASCII_ACTION( sXML_button4, "button4" );
XML_CONSTASCII_ACTION( sXML_caption_type, "caption-type" );
XML_CONSTASCII_ACTION( sXML_caption_angle_type, "caption-angle-type" );
XML_CONSTASCII_ACTION( sXML_caption_angle, "caption-angle" );
XML_CONSTASCII_ACTION( sXML_caption_gap, "caption-gap" );
XML_CONSTASCII_ACTION( sXML_caption_escape_direction, "caption-escape-direction" );
XML_CONSTASCII_ACTION( sXML_caption_escape, "caption-escape" );
XML_CONSTASCII_ACTION( sXML_caption_line_length, "caption-line-length" );
XML_CONSTASCII_ACTION( sXML_caption_fit_line_length, "caption-fit-line-length" );
XML_CONSTASCII_ACTION( sXML_free, "free" );
XML_CONSTASCII_ACTION( sXML_straight_line, "straight-line" );
XML_CONSTASCII_ACTION( sXML_angled_line, "angled-line" );
XML_CONSTASCII_ACTION( sXML_angled_connector_line, "angled-connector-line" );
#endif
......@@ -2,9 +2,9 @@
*
* $RCSfile: sdpropls.cxx,v $
*
* $Revision: 1.36 $
* $Revision: 1.37 $
*
* last change: $Author: cl $ $Date: 2001-05-16 13:36:17 $
* last change: $Author: cl $ $Date: 2001-05-18 07:03:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -209,6 +209,14 @@
#include "XMLClipPropertyHandler.hxx"
#endif
#ifndef _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
#include "XMLIsPercentagePropertyHandler.hxx"
#endif
#ifndef _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
#include "XMLPercentOrMeasurePropertyHandler.hxx"
#endif
using namespace ::rtl;
using namespace ::com::sun::star;
......@@ -377,6 +385,18 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
{ "VisibleArea", XML_NAMESPACE_DRAW, sXML_visible_area_height, XML_TYPE_RECTANGLE_HEIGHT|MID_FLAG_MERGE_PROPERTY, CTF_SD_OLE_VIS_AREA_HEIGHT },
{ "IsInternal", XML_NAMESPACE_DRAW, NULL, XML_TYPE_BUILDIN_CMP_ONLY, CTF_SD_OLE_ISINTERNAL },
// caption properties
{ "CaptionType", XML_NAMESPACE_DRAW, sXML_caption_type, XML_SD_TYPE_CAPTION_TYPE, 0 },
{ "CaptionIsFixedAngle", XML_NAMESPACE_DRAW, sXML_caption_angle_type, XML_SD_TYPE_CAPTION_ANGLE_TYPE, 0 },
{ "CaptionAngle", XML_NAMESPACE_DRAW, sXML_caption_angle, XML_TYPE_NUMBER, 0 },
{ "CaptionGap", XML_NAMESPACE_DRAW, sXML_caption_gap, XML_TYPE_MEASURE, 0 },
{ "CaptionEscapeDirection", XML_NAMESPACE_DRAW, sXML_caption_escape_direction, XML_SD_TYPE_CAPTION_ESC_DIR, 0 },
{ "CaptionIsEscapeRelative", XML_NAMESPACE_DRAW, sXML_caption_escape, XML_SD_TYPE_CAPTION_IS_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ISESCREL },
{ "CaptionEscapeRelative", XML_NAMESPACE_DRAW, sXML_caption_escape, XML_SD_TYPE_CAPTION_ESC_REL|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCREL },
{ "CaptionEscapeAbsolute", XML_NAMESPACE_DRAW, sXML_caption_escape, XML_SD_TYPE_CAPTION_ESC_ABS|MID_FLAG_MULTI_PROPERTY, CTF_CAPTION_ESCABS },
{ "CaptionLineLength", XML_NAMESPACE_DRAW, sXML_caption_line_length, XML_TYPE_MEASURE, 0 },
{ "CaptionIsFitLineLength", XML_NAMESPACE_DRAW, sXML_caption_fit_line_length, XML_TYPE_BOOL, 0 },
// misc object properties
{ "MoveProtect", XML_NAMESPACE_DRAW, sXML_move_protect, XML_TYPE_BOOL, CTF_SD_MOVE_PROTECT },
{ "SizeProtect", XML_NAMESPACE_DRAW, sXML_size_protect, XML_TYPE_BOOL, CTF_SD_SIZE_PROTECT },
......@@ -738,6 +758,22 @@ SvXMLEnumMapEntry __READONLY_DATA pXML_Fontwork_Form_Enum[] =
{ 0,0 }
};
SvXMLEnumMapEntry __READONLY_DATA pXML_Caption_Esc_Dir_Enum[] =
{
{ sXML_horizontal, 0 }, //SDRCAPT_ESCHORIZONTAL,
{ sXML_vertical, 1 }, //SDRCAPT_ESCVERTICAL,
{ sXML_auto, 2 }, //SDRCAPT_ESCBESTFIT,
{ 0,0 }
};
SvXMLEnumMapEntry __READONLY_DATA pXML_Caption_Type_Enum[] =
{
{ sXML_straight_line, 0 }, //SDRCAPT_TYPE1,
{ sXML_angled_line, 1 }, //SDRCAPT_TYPE2,
{ sXML_angled_connector_line, 2 }, //SDRCAPT_TYPE3,
{ 0,0 }
};
//////////////////////////////////////////////////////////////////////////////
XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > xModel )
......@@ -967,6 +1003,29 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
case XML_SD_TYPE_CONTROL_BORDER:
pHdl = new xmloff::OControlBorderHandler();
break;
case XML_SD_TYPE_CAPTION_ANGLE_TYPE:
{
const OUString aTrueStr( OUString::createFromAscii(sXML_fixed) );
const OUString aFalseStr( OUString::createFromAscii(sXML_free) );
pHdl = new XMLNamedBoolPropertyHdl( aTrueStr, aFalseStr );
break;
}
case XML_SD_TYPE_CAPTION_IS_ESC_REL:
pHdl = new XMLIsPercentagePropertyHandler();
break;
case XML_SD_TYPE_CAPTION_ESC_REL:
pHdl = new XMLPercentOrMeasurePropertyHandler( sal_True );
break;
case XML_SD_TYPE_CAPTION_ESC_ABS:
pHdl = new XMLPercentOrMeasurePropertyHandler( sal_False );
break;
case XML_SD_TYPE_CAPTION_ESC_DIR:
pHdl = new XMLEnumPropertyHdl( pXML_Caption_Esc_Dir_Enum , ::getCppuType((const sal_Int32*)0));
break;
case XML_SD_TYPE_CAPTION_TYPE:
pHdl = new XMLEnumPropertyHdl( pXML_Caption_Type_Enum , ::getCppuType((const sal_Int32*)0));
break;
}
if(pHdl)
......@@ -1036,6 +1095,11 @@ void XMLShapeExportPropertyMapper::ContextFilter(
XMLPropertyState* pOLEVisAreaHeight = NULL;
XMLPropertyState* pOLEIsInternal = NULL;
// caption
XMLPropertyState* pCaptionIsEscRel = NULL;
XMLPropertyState* pCaptionEscRel = NULL;
XMLPropertyState* pCaptionEscAbs = NULL;
// filter properties
for( std::vector< XMLPropertyState >::iterator property = rProperties.begin();
property != rProperties.end();
......@@ -1150,6 +1214,9 @@ void XMLShapeExportPropertyMapper::ContextFilter(
property->mnIndex = -1;
}
break;
case CTF_CAPTION_ISESCREL: pCaptionIsEscRel = property; break;
case CTF_CAPTION_ESCREL: pCaptionEscRel = property; break;
case CTF_CAPTION_ESCABS: pCaptionEscAbs = property; break;
}
}
......@@ -1228,6 +1295,25 @@ void XMLShapeExportPropertyMapper::ContextFilter(
}
}
if( pCaptionIsEscRel )
{
sal_Bool bIsRel;
pCaptionIsEscRel->maValue >>= bIsRel;
if( bIsRel )
{
if( pCaptionEscAbs )
pCaptionEscAbs->mnIndex = -1;
}
else
{
if( pCaptionEscRel )
pCaptionEscRel->mnIndex = -1;
}
pCaptionIsEscRel->mnIndex = -1;
}
SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
}
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: sdpropls.hxx,v $
*
* $Revision: 1.21 $
* $Revision: 1.22 $
*
* last change: $Author: cl $ $Date: 2001-05-07 14:39:07 $
* last change: $Author: cl $ $Date: 2001-05-18 07:03:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -154,6 +154,22 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps[];
#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 )
#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 )
//////////////////////////////////////////////////////////////////////////////
// #FontWork# types
#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 )
#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 )
#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 )
#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 )
//////////////////////////////////////////////////////////////////////////////
// Caption types
#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 )
#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 )
#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 )
#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 )
#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 )
#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 )
//////////////////////////////////////////////////////////////////////////////
#define CTF_NUMBERINGRULES 1000
......@@ -206,11 +222,11 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps[];
#define CTF_SD_SIZE_PROTECT 1046
//////////////////////////////////////////////////////////////////////////////
// #FontWork# types
#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 )
#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 )
#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 )
#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 )
// caption
#define CTF_CAPTION_ISESCREL 1047
#define CTF_CAPTION_ESCREL 1048
#define CTF_CAPTION_ESCABS 1049
//////////////////////////////////////////////////////////////////////////////
// enum maps for attributes
......
/*************************************************************************
*
* $RCSfile: XMLIsPercentagePropertyHandler.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cl $ $Date: 2001-05-18 07:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
#include <com/sun/star/uno/Any.hxx>
#endif
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif
#ifndef _XMLOFF_XMLISPERCENTAGEPROPERTYHANDLER_HXX
#include "XMLIsPercentagePropertyHandler.hxx"
#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
XMLIsPercentagePropertyHandler::~XMLIsPercentagePropertyHandler()
{
}
sal_Bool XMLIsPercentagePropertyHandler::importXML(
const OUString& rStrImpValue,
Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const
{
rValue <<= (sal_Bool)(rStrImpValue.indexOf( sal_Unicode('%') ) != -1);
return sal_True;
}
sal_Bool XMLIsPercentagePropertyHandler::exportXML(
OUString& rStrExpValue,
const Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const
{
DBG_ERROR( "XMLIsPercentagePropertyHandler is not for export!" );
return sal_False;
}
/*************************************************************************
*
* $RCSfile: XMLPercentOrMeasurePropertyHandler.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cl $ $Date: 2001-05-18 07:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
#include <com/sun/star/uno/Any.hxx>
#endif
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif
#ifndef _XMLOFF_XMLPERCENTORMEASUREPROPERTYHANDLER_HXX
#include "XMLPercentOrMeasurePropertyHandler.hxx"
#endif
#ifndef _XMLOFF_XMLUCONV_HXX
#include "xmluconv.hxx"
#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
XMLPercentOrMeasurePropertyHandler::XMLPercentOrMeasurePropertyHandler( sal_Bool bPercent )
: mbPercent( bPercent )
{
}
XMLPercentOrMeasurePropertyHandler::~XMLPercentOrMeasurePropertyHandler()
{
}
sal_Bool XMLPercentOrMeasurePropertyHandler::importXML(
const OUString& rStrImpValue,
Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const
{
if( (rStrImpValue.indexOf( sal_Unicode('%') ) != -1) != mbPercent )
return sal_False;
sal_Int32 nValue;
if( mbPercent )
{
if( !rUnitConverter.convertPercent( nValue, rStrImpValue ) )
return sal_False;
}
else
{
if( !rUnitConverter.convertMeasure( nValue, rStrImpValue ) )
return sal_False;
}
rValue <<= nValue;
return sal_True;
}
sal_Bool XMLPercentOrMeasurePropertyHandler::exportXML(
OUString& rStrExpValue,
const Any& rValue,
const SvXMLUnitConverter& rUnitConverter ) const
{
OUStringBuffer aOut;
sal_Int32 nValue;
if( !(rValue >>= nValue ) )
return sal_False;
if( mbPercent )
{
rUnitConverter.convertPercent( aOut, nValue );
}
else
{
rUnitConverter.convertMeasure( aOut, nValue );
}
rStrExpValue = aOut.makeStringAndClear();
return sal_True;
}
......@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.19 $
# $Revision: 1.20 $
#
# last change: $Author: dvo $ $Date: 2001-05-14 13:04:53 $
# last change: $Author: cl $ $Date: 2001-05-18 07:02:39 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
......@@ -77,6 +77,8 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
CXXFILES = \
XMLPercentOrMeasurePropertyHandler.cxx \
XMLIsPrecentagePropertyHandler.cxx \
XMLRectangleMembersHandler.cxx \
adjushdl.cxx \
backhdl.cxx \
......@@ -167,6 +169,8 @@ CXXFILES = \
SLOFILES = \
$(SLO)$/XMLPercentOrMeasurePropertyHandler.obj \
$(SLO)$/XMLIsPercentagePropertyHandler.obj \
$(SLO)$/XMLRectangleMembersHandler.obj \
$(SLO)$/adjushdl.obj \
$(SLO)$/backhdl.obj \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment