2000-09-18 16:07:07 +00:00
/*************************************************************************
*
2008-04-10 20:20:13 +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 20:20:13 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:20:13 +00:00
* This file is part of OpenOffice . org .
2000-09-18 16:07:07 +00:00
*
2008-04-10 20:20:13 +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 20:20:13 +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 20:20:13 +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
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-17 09:14:30 +00:00
// MARKER(update_precomp.py): autogen include statement, do not remove
# include "precompiled_xmloff.hxx"
2001-02-14 16:16:39 +00:00
// include PropertyMap.hxx with this define
// to create the maps
# ifndef _PROPERTYMAP_HXX_
# define XML_SCH_CREATE_GLOBAL_MAPS
# include "PropertyMap.hxx"
# undef XML_SCH_CREATE_GLOBAL_MAPS
# endif
2000-09-18 16:07:07 +00:00
# include "XMLChartPropertySetMapper.hxx"
2007-10-22 15:32:28 +00:00
# include "SchXMLTools.hxx"
2007-06-27 13:46:37 +00:00
# include <xmloff/EnumPropertyHdl.hxx>
# include <xmloff/XMLConstantsPropertyHandler.hxx>
# include <xmloff/attrlist.hxx>
# include <xmloff/nmspmap.hxx>
# include <xmloff/xmluconv.hxx>
# include <xmloff/shapeimport.hxx>
# include <xmloff/NamedBoolPropertyHdl.hxx>
# include <xmloff/xmlexp.hxx>
# include <xmloff/xmltoken.hxx>
2000-12-15 16:51:17 +00:00
# include "XMLErrorIndicatorPropertyHdl.hxx"
2008-06-04 08:47:23 +00:00
# include "XMLErrorBarStylePropertyHdl.hxx"
2001-10-30 13:53:54 +00:00
# include "XMLTextOrientationHdl.hxx"
2004-08-20 07:12:06 +00:00
# include "XMLSymbolTypePropertyHdl.hxx"
2008-12-12 12:17:17 +00:00
# include "XMLAxisPositionPropertyHdl.hxx"
2000-09-18 16:07:07 +00:00
# include <com/sun/star/chart/ChartAxisMarks.hpp>
# include <com/sun/star/chart/ChartDataCaption.hpp>
# include <com/sun/star/chart/ChartSymbolType.hpp>
2000-11-27 08:09:12 +00:00
# include <com/sun/star/drawing/LineStyle.hpp>
# include <com/sun/star/drawing/FillStyle.hpp>
# include <com/sun/star/drawing/LineJoint.hpp>
2001-04-25 15:36:55 +00:00
# include <com/sun/star/chart/ChartDataRowSource.hpp>
2008-12-12 12:17:17 +00:00
# include <com/sun/star/chart/ChartAxisPosition.hpp>
2000-09-18 16:07:07 +00:00
2001-04-25 15:36:55 +00:00
// header for any2enum
# include <comphelper/extract.hxx>
2000-09-18 16:07:07 +00:00
# include <rtl/ustrbuf.hxx>
2004-07-13 07:02:29 +00:00
# include <rtl/math.hxx>
2000-11-27 08:09:12 +00:00
# define SCH_XML_SETFLAG( status, flag ) (status)|= (flag)
# define SCH_XML_UNSETFLAG( status, flag ) (status) = ((status) | (flag)) - (flag)
2000-09-18 16:07:07 +00:00
using namespace com : : sun : : star ;
2001-06-29 20:07:26 +00:00
using namespace : : xmloff : : token ;
2000-09-18 16:07:07 +00:00
2001-02-14 16:16:39 +00:00
// the following class implementations are in this file:
//
// * XMLChartPropHdlFactory
// * XMLChartPropertySetMapper
// * XMLChartExportPropertyMapper
// * XMLChartImportPropertyMapper
// * SchXMLStyleExport
2000-11-27 08:09:12 +00:00
2000-09-18 16:07:07 +00:00
// ----------------------------------------
XMLChartPropHdlFactory : : ~ XMLChartPropHdlFactory ( )
{
}
const XMLPropertyHandler * XMLChartPropHdlFactory : : GetPropertyHandler ( sal_Int32 nType ) const
{
const XMLPropertyHandler * pHdl = XMLPropertyHandlerFactory : : GetPropertyHandler ( nType ) ;
if ( ! pHdl )
{
switch ( nType )
{
2008-12-12 12:17:17 +00:00
case XML_SCH_TYPE_AXIS_POSITION :
pHdl = new XMLAxisPositionPropertyHdl ( false ) ;
break ;
case XML_SCH_TYPE_AXIS_POSITION_VALUE :
pHdl = new XMLAxisPositionPropertyHdl ( true ) ;
break ;
case XML_SCH_TYPE_AXIS_LABEL_POSITION :
pHdl = new XMLEnumPropertyHdl ( aXMLChartAxisLabelPositionEnumMap ,
: : getCppuType ( ( const chart : : ChartAxisLabelPosition * ) 0 ) ) ;
break ;
case XML_SCH_TYPE_TICK_MARK_POSITION :
pHdl = new XMLEnumPropertyHdl ( aXMLChartAxisMarkPositionEnumMap ,
: : getCppuType ( ( const chart : : ChartAxisMarkPosition * ) 0 ) ) ;
break ;
2000-09-18 16:07:07 +00:00
case XML_SCH_TYPE_AXIS_ARRANGEMENT :
pHdl = new XMLEnumPropertyHdl ( aXMLChartAxisArrangementEnumMap ,
: : getCppuType ( ( const chart : : ChartAxisArrangeOrderType * ) 0 ) ) ;
break ;
2008-03-06 14:42:58 +00:00
case XML_SCH_TYPE_ERROR_BAR_STYLE :
// here we have a constant rather than an enum
2008-06-04 08:47:23 +00:00
pHdl = new XMLErrorBarStylePropertyHdl ( aXMLChartErrorBarStyleEnumMap ,
2008-03-06 14:42:58 +00:00
: : getCppuType ( ( const sal_Int32 * ) 0 ) ) ;
2000-09-18 16:07:07 +00:00
break ;
case XML_SCH_TYPE_REGRESSION_TYPE :
pHdl = new XMLEnumPropertyHdl ( aXMLChartRegressionCurveTypeEnumMap ,
: : getCppuType ( ( const chart : : ChartRegressionCurveType * ) 0 ) ) ;
break ;
2000-12-15 16:51:17 +00:00
case XML_SCH_TYPE_ERROR_INDICATOR_LOWER :
pHdl = new XMLErrorIndicatorPropertyHdl ( sal_False ) ;
break ;
case XML_SCH_TYPE_ERROR_INDICATOR_UPPER :
pHdl = new XMLErrorIndicatorPropertyHdl ( sal_True ) ;
break ;
2000-09-18 16:07:07 +00:00
case XML_SCH_TYPE_SOLID_TYPE :
// here we have a constant rather than an enum
2001-06-05 13:09:28 +00:00
pHdl = new XMLEnumPropertyHdl ( aXMLChartSolidTypeEnumMap ,
: : getCppuType ( ( const sal_Int32 * ) 0 ) ) ;
2000-09-18 16:07:07 +00:00
break ;
2007-11-23 10:35:00 +00:00
case XML_SCH_TYPE_LABEL_PLACEMENT_TYPE :
// here we have a constant rather than an enum
pHdl = new XMLEnumPropertyHdl ( aXMLChartDataLabelPlacementEnumMap ,
: : getCppuType ( ( const sal_Int32 * ) 0 ) ) ;
break ;
2001-05-11 17:17:56 +00:00
case XML_SCH_TYPE_DATAROWSOURCE :
pHdl = new XMLEnumPropertyHdl ( aXMLChartDataRowSourceTypeEnumMap ,
: : getCppuType ( ( const chart : : ChartDataRowSource * ) 0 ) ) ;
break ;
2001-10-30 13:53:54 +00:00
case XML_SCH_TYPE_TEXT_ORIENTATION :
pHdl = new XMLTextOrientationHdl ( ) ;
break ;
2004-07-13 07:02:29 +00:00
case XML_SCH_TYPE_INTERPOLATION :
pHdl = new XMLEnumPropertyHdl ( aXMLChartInterpolationTypeEnumMap ,
: : getCppuType ( ( const sal_Int32 * ) 0 ) ) ;
2004-08-20 07:12:06 +00:00
break ;
case XML_SCH_TYPE_SYMBOL_TYPE :
pHdl = new XMLSymbolTypePropertyHdl ( false ) ;
break ;
case XML_SCH_TYPE_NAMED_SYMBOL :
pHdl = new XMLSymbolTypePropertyHdl ( true ) ;
break ;
2008-07-30 10:45:31 +00:00
case XML_SCH_TYPE_MISSING_VALUE_TREATMENT :
pHdl = new XMLEnumPropertyHdl ( aXMLChartMissingValueTreatmentEnumMap ,
: : getCppuType ( ( const sal_Int32 * ) 0 ) ) ;
break ;
2001-10-30 13:53:54 +00:00
}
2000-09-18 16:07:07 +00:00
if ( pHdl )
PutHdlCache ( nType , pHdl ) ;
}
return pHdl ;
}
// ----------------------------------------
XMLChartPropertySetMapper : : XMLChartPropertySetMapper ( ) :
XMLPropertySetMapper ( aXMLChartPropMap , new XMLChartPropHdlFactory )
{
}
XMLChartPropertySetMapper : : ~ XMLChartPropertySetMapper ( )
{
}
2000-11-07 12:33:09 +00:00
// ----------------------------------------
2001-05-11 17:17:56 +00:00
XMLChartExportPropertyMapper : : XMLChartExportPropertyMapper ( const UniReference < XMLPropertySetMapper > & rMapper ,
SvXMLExport & rExport ) :
2000-11-07 12:33:09 +00:00
SvXMLExportPropertyMapper ( rMapper ) ,
2001-06-29 20:07:26 +00:00
msTrue ( GetXMLToken ( XML_TRUE ) ) ,
msFalse ( GetXMLToken ( XML_FALSE ) ) ,
2001-05-11 17:17:56 +00:00
mrExport ( rExport )
2000-11-07 12:33:09 +00:00
{
2001-06-01 11:35:30 +00:00
// chain draw properties
ChainExportMapper ( XMLShapeExport : : CreateShapePropMapper ( rExport ) ) ;
// chain text properties
ChainExportMapper ( XMLTextParagraphExport : : CreateParaExtPropMapper ( rExport ) ) ;
2000-11-07 12:33:09 +00:00
}
XMLChartExportPropertyMapper : : ~ XMLChartExportPropertyMapper ( )
{
}
void XMLChartExportPropertyMapper : : ContextFilter (
2000-09-18 16:07:07 +00:00
std : : vector < XMLPropertyState > & rProperties ,
uno : : Reference < beans : : XPropertySet > rPropSet ) const
{
2000-12-09 14:59:31 +00:00
: : rtl : : OUString aAutoPropName ;
sal_Bool bCheckAuto = sal_False ;
2000-09-18 16:07:07 +00:00
// filter properties
for ( std : : vector < XMLPropertyState > : : iterator property = rProperties . begin ( ) ;
property ! = rProperties . end ( ) ;
property + + )
{
// find properties with context
// to prevent writing this property set mnIndex member to -1
2000-11-07 12:33:09 +00:00
switch ( getPropertySetMapper ( ) - > GetEntryContextId ( property - > mnIndex ) )
2000-09-18 16:07:07 +00:00
{
2000-12-09 14:59:31 +00:00
// if Auto... is set the corresponding properties mustn't be exported
case XML_SCH_CONTEXT_MIN :
bCheckAuto = sal_True ;
aAutoPropName = : : rtl : : OUString : : createFromAscii ( " AutoMin " ) ;
break ;
case XML_SCH_CONTEXT_MAX :
bCheckAuto = sal_True ;
aAutoPropName = : : rtl : : OUString : : createFromAscii ( " AutoMax " ) ;
break ;
case XML_SCH_CONTEXT_STEP_MAIN :
bCheckAuto = sal_True ;
aAutoPropName = : : rtl : : OUString : : createFromAscii ( " AutoStepMain " ) ;
break ;
2008-07-02 10:35:35 +00:00
case XML_SCH_CONTEXT_STEP_HELP_COUNT :
bCheckAuto = sal_True ;
aAutoPropName = : : rtl : : OUString : : createFromAscii ( " AutoStepHelp " ) ;
break ;
2004-07-13 07:02:29 +00:00
2000-12-09 14:59:31 +00:00
case XML_SCH_CONTEXT_ORIGIN :
bCheckAuto = sal_True ;
aAutoPropName = : : rtl : : OUString : : createFromAscii ( " AutoOrigin " ) ;
break ;
2001-08-16 12:28:49 +00:00
// the following property is deprecated
// elemet-item symbol-image is used now
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME :
property - > mnIndex = - 1 ;
2004-07-13 07:02:29 +00:00
break ;
2007-04-16 12:32:48 +00:00
case XML_SCH_CONTEXT_STOCK_WITH_VOLUME :
case XML_SCH_CONTEXT_LINES_USED :
// note this avoids export of the properties in OASIS format,
// but also for the OOo XML Flat format (used by binfilter),
// because there, the transformation to OOo is done after the
// complete export of the chart in OASIS format.
if ( mrExport . getExportFlags ( ) & EXPORT_OASIS )
property - > mnIndex = - 1 ;
break ;
2000-12-09 14:59:31 +00:00
}
if ( bCheckAuto )
{
if ( rPropSet . is ( ) )
{
try
{
2006-07-19 15:34:02 +00:00
sal_Bool bAuto = false ;
2000-12-09 14:59:31 +00:00
uno : : Any aAny = rPropSet - > getPropertyValue ( aAutoPropName ) ;
aAny > > = bAuto ;
if ( bAuto )
property - > mnIndex = - 1 ;
}
catch ( beans : : UnknownPropertyException )
{
}
}
bCheckAuto = sal_False ;
2000-09-18 16:07:07 +00:00
}
}
2000-12-05 22:05:47 +00:00
SvXMLExportPropertyMapper : : ContextFilter ( rProperties , rPropSet ) ;
2000-09-18 16:07:07 +00:00
}
void XMLChartExportPropertyMapper : : handleElementItem (
2001-10-25 19:57:03 +00:00
SvXMLExport & rExport ,
const XMLPropertyState & rProperty , sal_uInt16 nFlags ,
2000-10-19 13:25:20 +00:00
const : : std : : vector < XMLPropertyState > * pProperties ,
sal_uInt32 nIdx ) const
2000-09-18 16:07:07 +00:00
{
2001-08-14 12:09:38 +00:00
switch ( getPropertySetMapper ( ) - > GetEntryContextId ( rProperty . mnIndex ) )
{
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE :
{
: : rtl : : OUString aURLStr ;
rProperty . maValue > > = aURLStr ;
// export as XLink reference into the package
// if embedding is off
: : rtl : : OUString sTempURL ( mrExport . AddEmbeddedGraphicObject ( aURLStr ) ) ;
if ( sTempURL . getLength ( ) )
{
mrExport . AddAttribute ( XML_NAMESPACE_XLINK , XML_HREF , sTempURL ) ;
mrExport . AddAttribute ( XML_NAMESPACE_XLINK , XML_TYPE ,
XML_SIMPLE ) ;
mrExport . AddAttribute ( XML_NAMESPACE_XLINK , XML_ACTUATE ,
XML_ONLOAD ) ;
}
{
sal_uInt32 nPropIndex = rProperty . mnIndex ;
// this is the element that has to live until the next statement
SvXMLElementExport aElem ( mrExport ,
getPropertySetMapper ( ) - > GetEntryNameSpace ( nPropIndex ) ,
getPropertySetMapper ( ) - > GetEntryXMLName ( nPropIndex ) ,
sal_True , sal_True ) ;
// export as Base64 embedded graphic
// if embedding is on
if ( aURLStr . getLength ( ) )
mrExport . AddEmbeddedGraphicObjectAsBase64 ( aURLStr ) ;
}
}
break ;
2007-10-22 15:32:28 +00:00
case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR :
{
: : rtl : : OUString aSeparator ;
rProperty . maValue > > = aSeparator ;
if ( aSeparator . getLength ( ) )
{
sal_uInt32 nPropIndex = rProperty . mnIndex ;
SvXMLElementExport aElem ( mrExport ,
getPropertySetMapper ( ) - > GetEntryNameSpace ( nPropIndex ) ,
getPropertySetMapper ( ) - > GetEntryXMLName ( nPropIndex ) ,
sal_True , sal_True ) ;
SchXMLTools : : exportText ( mrExport , aSeparator , true ) ;
}
}
break ;
2001-08-14 12:09:38 +00:00
default :
// call parent
2001-10-25 19:57:03 +00:00
SvXMLExportPropertyMapper : : handleElementItem ( rExport , rProperty ,
nFlags , pProperties , nIdx ) ;
2001-08-14 12:09:38 +00:00
break ;
}
2000-09-18 16:07:07 +00:00
}
void XMLChartExportPropertyMapper : : handleSpecialItem (
SvXMLAttributeList & rAttrList , const XMLPropertyState & rProperty ,
2000-10-19 13:25:20 +00:00
const SvXMLUnitConverter & rUnitConverter ,
const SvXMLNamespaceMap & rNamespaceMap ,
const : : std : : vector < XMLPropertyState > * pProperties ,
sal_uInt32 nIdx ) const
2000-09-18 16:07:07 +00:00
{
2001-08-10 12:37:45 +00:00
sal_Bool bHandled = sal_False ;
2000-09-18 16:07:07 +00:00
sal_Int32 nContextId = maPropMapper - > GetEntryContextId ( rProperty . mnIndex ) ;
if ( nContextId )
{
2001-08-10 12:37:45 +00:00
bHandled = sal_True ;
2000-09-18 16:07:07 +00:00
rtl : : OUString sAttrName = maPropMapper - > GetEntryXMLName ( rProperty . mnIndex ) ;
2001-02-14 16:16:39 +00:00
sal_uInt16 nNameSpace = maPropMapper - > GetEntryNameSpace ( rProperty . mnIndex ) ;
2000-09-18 16:07:07 +00:00
rtl : : OUStringBuffer sValueBuffer ;
rtl : : OUString sValue ;
sal_Int32 nValue = 0 ;
sal_Bool bValue = sal_False ;
switch ( nContextId )
{
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER :
case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER :
2000-09-18 16:07:07 +00:00
rProperty . maValue > > = nValue ;
bValue = ( ( nValue & chart : : ChartAxisMarks : : INNER ) = = chart : : ChartAxisMarks : : INNER ) ;
SvXMLUnitConverter : : convertBool ( sValueBuffer , bValue ) ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER :
case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER :
2000-09-18 16:07:07 +00:00
rProperty . maValue > > = nValue ;
bValue = ( ( nValue & chart : : ChartAxisMarks : : OUTER ) = = chart : : ChartAxisMarks : : OUTER ) ;
SvXMLUnitConverter : : convertBool ( sValueBuffer , bValue ) ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION :
2000-09-18 16:07:07 +00:00
{
// convert from 100th degrees to degrees (double)
rProperty . maValue > > = nValue ;
double fVal = ( double ) ( nValue ) / 100.0 ;
2001-02-26 09:24:47 +00:00
SvXMLUnitConverter : : convertDouble ( sValueBuffer , fVal ) ;
2000-09-18 16:07:07 +00:00
}
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER :
2000-09-18 16:07:07 +00:00
{
rProperty . maValue > > = nValue ;
if ( ( ( nValue & chart : : ChartDataCaption : : VALUE ) = = chart : : ChartDataCaption : : VALUE ) )
2007-10-22 15:32:28 +00:00
{
2008-06-04 08:47:23 +00:00
if ( ( nValue & chart : : ChartDataCaption : : PERCENT ) = = chart : : ChartDataCaption : : PERCENT )
{
const SvtSaveOptions : : ODFDefaultVersion nCurrentVersion ( SvtSaveOptions ( ) . GetODFDefaultVersion ( ) ) ;
if ( nCurrentVersion < SvtSaveOptions : : ODFVER_012 )
sValueBuffer . append ( GetXMLToken ( XML_PERCENTAGE ) ) ;
else
sValueBuffer . append ( GetXMLToken ( XML_VALUE_AND_PERCENTAGE ) ) ;
}
2007-10-22 15:32:28 +00:00
else
sValueBuffer . append ( GetXMLToken ( XML_VALUE ) ) ;
}
2000-09-18 16:07:07 +00:00
else if ( ( nValue & chart : : ChartDataCaption : : PERCENT ) = = chart : : ChartDataCaption : : PERCENT )
2001-06-29 20:07:26 +00:00
sValueBuffer . append ( GetXMLToken ( XML_PERCENTAGE ) ) ;
2000-09-18 16:07:07 +00:00
else
2001-06-29 20:07:26 +00:00
sValueBuffer . append ( GetXMLToken ( XML_NONE ) ) ;
2000-09-18 16:07:07 +00:00
}
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT :
2000-09-18 16:07:07 +00:00
rProperty . maValue > > = nValue ;
bValue = ( ( nValue & chart : : ChartDataCaption : : TEXT ) = = chart : : ChartDataCaption : : TEXT ) ;
SvXMLUnitConverter : : convertBool ( sValueBuffer , bValue ) ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL :
2000-09-18 16:07:07 +00:00
rProperty . maValue > > = nValue ;
bValue = ( ( nValue & chart : : ChartDataCaption : : SYMBOL ) = = chart : : ChartDataCaption : : SYMBOL ) ;
SvXMLUnitConverter : : convertBool ( sValueBuffer , bValue ) ;
break ;
2001-05-10 11:41:11 +00:00
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH :
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT :
{
awt : : Size aSize ;
rProperty . maValue > > = aSize ;
rUnitConverter . convertMeasure ( sValueBuffer ,
nContextId = = XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
? aSize . Width
: aSize . Height ) ;
}
break ;
2001-05-17 12:24:32 +00:00
2001-08-10 12:37:45 +00:00
case XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT :
{
// just for import
break ;
}
2004-07-13 07:02:29 +00:00
2001-08-10 12:37:45 +00:00
default :
bHandled = sal_False ;
break ;
2000-09-18 16:07:07 +00:00
}
2001-08-10 12:37:45 +00:00
2000-12-09 14:59:31 +00:00
if ( sValueBuffer . getLength ( ) )
{
sValue = sValueBuffer . makeStringAndClear ( ) ;
sAttrName = rNamespaceMap . GetQNameByKey ( nNameSpace , sAttrName ) ;
2003-03-27 17:21:03 +00:00
rAttrList . AddAttribute ( sAttrName , sValue ) ;
2000-12-09 14:59:31 +00:00
}
2000-09-18 16:07:07 +00:00
}
2001-08-10 12:37:45 +00:00
if ( ! bHandled )
2000-09-18 16:07:07 +00:00
{
// call parent
2000-10-19 13:25:20 +00:00
SvXMLExportPropertyMapper : : handleSpecialItem ( rAttrList , rProperty , rUnitConverter , rNamespaceMap , pProperties , nIdx ) ;
2000-09-18 16:07:07 +00:00
}
}
// ----------------------------------------
2001-05-11 17:17:56 +00:00
XMLChartImportPropertyMapper : : XMLChartImportPropertyMapper ( const UniReference < XMLPropertySetMapper > & rMapper ,
2006-06-19 17:00:40 +00:00
const SvXMLImport & _rImport ) :
SvXMLImportPropertyMapper ( rMapper , const_cast < SvXMLImport & > ( _rImport ) ) ,
mrImport ( const_cast < SvXMLImport & > ( _rImport ) )
2000-09-18 16:07:07 +00:00
{
2001-01-11 16:00:38 +00:00
// chain shape mapper for drawing properties
// give an empty model. It is only used for numbering rules that don't exist in chart
uno : : Reference < frame : : XModel > xEmptyModel ;
2002-02-22 10:33:00 +00:00
ChainImportMapper ( XMLShapeImportHelper : : CreateShapePropMapper ( xEmptyModel , mrImport ) ) ;
2001-06-01 11:35:30 +00:00
2008-11-26 15:19:48 +00:00
//#i14365# save and load writing-mode for chart elements
//The property TextWritingMode is mapped wrongly in the underlying draw mapper, but for draw it is necessary
//We remove that property here only for chart thus the chart can use the correct mapping from the writer paragraph settings (attribute 'writing-mode' <-> property 'WritingMode')
sal_Int32 nUnwantedWrongEntry = maPropMapper - > FindEntryIndex ( " TextWritingMode " , XML_NAMESPACE_STYLE , GetXMLToken ( XML_WRITING_MODE ) ) ;
maPropMapper - > RemoveEntry ( nUnwantedWrongEntry ) ;
2001-06-15 10:08:42 +00:00
// do not chain text properties: on import this is done by shape mapper
// to import old documents
// ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper());
2000-09-18 16:07:07 +00:00
}
XMLChartImportPropertyMapper : : ~ XMLChartImportPropertyMapper ( )
{
}
2010-10-04 15:36:52 +01:00
bool XMLChartImportPropertyMapper : : handleSpecialItem (
2000-09-18 16:07:07 +00:00
XMLPropertyState & rProperty ,
: : std : : vector < XMLPropertyState > & rProperties ,
const : : rtl : : OUString & rValue ,
const SvXMLUnitConverter & rUnitConverter ,
const SvXMLNamespaceMap & rNamespaceMap ) const
{
2001-05-11 17:17:56 +00:00
static const : : rtl : : OUString sPackageProtocol ( RTL_CONSTASCII_USTRINGPARAM ( " vnd.sun.star.Package: " ) ) ;
2000-11-27 08:09:12 +00:00
sal_Int32 nContextId = maPropMapper - > GetEntryContextId ( rProperty . mnIndex ) ;
sal_Bool bRet = ( nContextId ! = 0 ) ;
if ( nContextId )
{
sal_Int32 nValue = 0 ;
2010-10-04 15:36:52 +01:00
bool bValue = false ;
2000-11-27 08:09:12 +00:00
switch ( nContextId )
{
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER :
case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER :
2000-11-27 08:09:12 +00:00
SvXMLUnitConverter : : convertBool ( bValue , rValue ) ;
// modify old value
rProperty . maValue > > = nValue ;
if ( bValue )
SCH_XML_SETFLAG ( nValue , chart : : ChartAxisMarks : : INNER ) ;
else
SCH_XML_UNSETFLAG ( nValue , chart : : ChartAxisMarks : : INNER ) ;
rProperty . maValue < < = nValue ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER :
case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER :
2000-11-27 08:09:12 +00:00
SvXMLUnitConverter : : convertBool ( bValue , rValue ) ;
// modify old value
rProperty . maValue > > = nValue ;
if ( bValue )
SCH_XML_SETFLAG ( nValue , chart : : ChartAxisMarks : : OUTER ) ;
else
SCH_XML_UNSETFLAG ( nValue , chart : : ChartAxisMarks : : OUTER ) ;
rProperty . maValue < < = nValue ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION :
2000-11-27 08:09:12 +00:00
{
// convert from degrees (double) to 100th degrees (integer)
double fVal ;
2001-02-26 09:24:47 +00:00
SvXMLUnitConverter : : convertDouble ( fVal , rValue ) ;
2000-11-27 08:09:12 +00:00
nValue = ( sal_Int32 ) ( fVal * 100.0 ) ;
rProperty . maValue < < = nValue ;
}
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER :
2000-11-27 08:09:12 +00:00
{
// modify old value
rProperty . maValue > > = nValue ;
2001-06-29 20:07:26 +00:00
if ( IsXMLToken ( rValue , XML_NONE ) )
2000-11-27 08:09:12 +00:00
SCH_XML_UNSETFLAG ( nValue , chart : : ChartDataCaption : : VALUE | chart : : ChartDataCaption : : PERCENT ) ;
2007-10-22 15:32:28 +00:00
else if ( IsXMLToken ( rValue , XML_VALUE_AND_PERCENTAGE ) )
SCH_XML_SETFLAG ( nValue , chart : : ChartDataCaption : : VALUE | chart : : ChartDataCaption : : PERCENT ) ;
2001-06-29 20:07:26 +00:00
else if ( IsXMLToken ( rValue , XML_VALUE ) )
2000-11-27 08:09:12 +00:00
SCH_XML_SETFLAG ( nValue , chart : : ChartDataCaption : : VALUE ) ;
2001-06-29 20:07:26 +00:00
else // must be XML_PERCENTAGE
2000-11-27 08:09:12 +00:00
SCH_XML_SETFLAG ( nValue , chart : : ChartDataCaption : : PERCENT ) ;
rProperty . maValue < < = nValue ;
}
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT :
2000-11-27 08:09:12 +00:00
rProperty . maValue > > = nValue ;
SvXMLUnitConverter : : convertBool ( bValue , rValue ) ;
if ( bValue )
SCH_XML_SETFLAG ( nValue , chart : : ChartDataCaption : : TEXT ) ;
else
SCH_XML_UNSETFLAG ( nValue , chart : : ChartDataCaption : : TEXT ) ;
rProperty . maValue < < = nValue ;
break ;
2001-01-11 16:00:38 +00:00
case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL :
2000-11-27 08:09:12 +00:00
rProperty . maValue > > = nValue ;
SvXMLUnitConverter : : convertBool ( bValue , rValue ) ;
if ( bValue )
SCH_XML_SETFLAG ( nValue , chart : : ChartDataCaption : : SYMBOL ) ;
else
SCH_XML_UNSETFLAG ( nValue , chart : : ChartDataCaption : : SYMBOL ) ;
rProperty . maValue < < = nValue ;
break ;
2001-05-10 11:41:11 +00:00
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH :
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT :
{
awt : : Size aSize ;
rProperty . maValue > > = aSize ;
rUnitConverter . convertMeasure ( nContextId = = XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
? aSize . Width
: aSize . Height ,
rValue ) ;
rProperty . maValue < < = aSize ;
}
break ;
2001-08-14 12:09:38 +00:00
// deprecated from 6.0 beta on
2001-05-11 17:17:56 +00:00
case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME :
rProperty . maValue < < = mrImport . ResolveGraphicObjectURL ( rValue , sal_False ) ;
break ;
2001-08-14 12:09:38 +00:00
2000-11-27 08:09:12 +00:00
default :
bRet = sal_False ;
break ;
}
}
2001-08-10 12:37:45 +00:00
// if we didn't handle it, the parent should
if ( ! bRet )
2000-11-27 08:09:12 +00:00
{
// call parent
bRet = SvXMLImportPropertyMapper : : handleSpecialItem ( rProperty , rProperties , rValue , rUnitConverter , rNamespaceMap ) ;
}
return bRet ;
2000-09-18 16:07:07 +00:00
}
2006-06-19 17:00:40 +00:00
void XMLChartImportPropertyMapper : : finished ( : : std : : vector < XMLPropertyState > & /*rProperties*/ , sal_Int32 /*nStartIndex*/ , sal_Int32 /*nEndIndex*/ ) const
2000-09-18 16:07:07 +00:00
{
}