LCOV - code coverage report
Current view: top level - xmloff/source/chart - PropertyMaps.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 298 0.0 %
Date: 2014-04-14 Functions: 0 19 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : // include PropertyMap.hxx with this define
      21             : // to create the maps
      22             : #ifndef _PROPERTYMAP_HXX_
      23             : #define XML_SCH_CREATE_GLOBAL_MAPS
      24             : #include "PropertyMap.hxx"
      25             : #undef XML_SCH_CREATE_GLOBAL_MAPS
      26             : #endif
      27             : 
      28             : #include <sax/tools/converter.hxx>
      29             : 
      30             : #include "SchXMLTools.hxx"
      31             : #include "XMLChartPropertySetMapper.hxx"
      32             : #include "XMLErrorIndicatorPropertyHdl.hxx"
      33             : #include "XMLErrorBarStylePropertyHdl.hxx"
      34             : #include "XMLTextOrientationHdl.hxx"
      35             : #include "XMLSymbolTypePropertyHdl.hxx"
      36             : #include "XMLAxisPositionPropertyHdl.hxx"
      37             : 
      38             : #include <xmloff/EnumPropertyHdl.hxx>
      39             : #include <xmloff/XMLConstantsPropertyHandler.hxx>
      40             : #include <xmloff/attrlist.hxx>
      41             : #include <xmloff/nmspmap.hxx>
      42             : #include <xmloff/xmluconv.hxx>
      43             : #include <xmloff/shapeimport.hxx>
      44             : #include <xmloff/NamedBoolPropertyHdl.hxx>
      45             : #include <xmloff/xmlexp.hxx>
      46             : #include <xmloff/xmltoken.hxx>
      47             : 
      48             : #include <com/sun/star/drawing/LineStyle.hpp>
      49             : #include <com/sun/star/drawing/FillStyle.hpp>
      50             : #include <com/sun/star/drawing/LineJoint.hpp>
      51             : #include <com/sun/star/chart/ChartAxisMarks.hpp>
      52             : #include <com/sun/star/chart/ChartDataCaption.hpp>
      53             : #include <com/sun/star/chart/ChartSymbolType.hpp>
      54             : #include <com/sun/star/chart/ChartDataRowSource.hpp>
      55             : #include <com/sun/star/chart/ChartAxisPosition.hpp>
      56             : #include <com/sun/star/chart2/XChartDocument.hpp>
      57             : #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
      58             : 
      59             : // header for any2enum
      60             : #include <comphelper/extract.hxx>
      61             : #include <rtl/ustrbuf.hxx>
      62             : #include <rtl/math.hxx>
      63             : 
      64             : #define SCH_XML_SETFLAG( status, flag )     (status)|= (flag)
      65             : #define SCH_XML_UNSETFLAG( status, flag )   (status) = ((status) | (flag)) - (flag)
      66             : 
      67             : using namespace com::sun::star;
      68             : using namespace ::xmloff::token;
      69             : 
      70             : // the following class implementations are in this file:
      71             : 
      72             : // * XMLChartPropHdlFactory
      73             : // * XMLChartPropertySetMapper
      74             : // * XMLChartExportPropertyMapper
      75             : // * XMLChartImportPropertyMapper
      76             : // * SchXMLStyleExport
      77             : 
      78           0 : XMLChartPropHdlFactory::~XMLChartPropHdlFactory()
      79             : {
      80           0 : }
      81             : 
      82           0 : const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
      83             : {
      84           0 :     const XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
      85           0 :     if( ! pHdl )
      86             :     {
      87           0 :         switch( nType )
      88             :         {
      89             :             case XML_SCH_TYPE_AXIS_POSITION:
      90           0 :                 pHdl = new XMLAxisPositionPropertyHdl( false );
      91           0 :                 break;
      92             :             case XML_SCH_TYPE_AXIS_POSITION_VALUE:
      93           0 :                 pHdl = new XMLAxisPositionPropertyHdl( true );
      94           0 :                 break;
      95             : 
      96             :             case XML_SCH_TYPE_AXIS_LABEL_POSITION:
      97             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisLabelPositionEnumMap,
      98           0 :                                                ::getCppuType((const chart::ChartAxisLabelPosition*)0) );
      99           0 :                 break;
     100             : 
     101             :             case XML_SCH_TYPE_TICK_MARK_POSITION:
     102             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisMarkPositionEnumMap,
     103           0 :                                                ::getCppuType((const chart::ChartAxisMarkPosition*)0) );
     104           0 :                 break;
     105             : 
     106             :             case XML_SCH_TYPE_AXIS_ARRANGEMENT:
     107             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartAxisArrangementEnumMap,
     108           0 :                                                ::getCppuType((const chart::ChartAxisArrangeOrderType*)0) );
     109           0 :                 break;
     110             : 
     111             :             case XML_SCH_TYPE_ERROR_BAR_STYLE:
     112             :                 // here we have a constant rather than an enum
     113             :                 pHdl = new XMLErrorBarStylePropertyHdl( aXMLChartErrorBarStyleEnumMap,
     114           0 :                                                ::getCppuType((const sal_Int32*)0) );
     115           0 :                 break;
     116             : 
     117             :             case XML_SCH_TYPE_ERROR_INDICATOR_LOWER:
     118           0 :                 pHdl = new XMLErrorIndicatorPropertyHdl( false );
     119           0 :                 break;
     120             :             case XML_SCH_TYPE_ERROR_INDICATOR_UPPER:
     121           0 :                 pHdl = new XMLErrorIndicatorPropertyHdl( true );
     122           0 :                 break;
     123             : 
     124             :             case XML_SCH_TYPE_SOLID_TYPE:
     125             :                 // here we have a constant rather than an enum
     126             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartSolidTypeEnumMap,
     127           0 :                                                ::getCppuType((const sal_Int32*)0) );
     128           0 :                 break;
     129             :             case XML_SCH_TYPE_LABEL_PLACEMENT_TYPE:
     130             :                 // here we have a constant rather than an enum
     131             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartDataLabelPlacementEnumMap,
     132           0 :                                                 ::getCppuType((const sal_Int32*)0) );
     133           0 :                 break;
     134             :             case XML_SCH_TYPE_DATAROWSOURCE:
     135             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartDataRowSourceTypeEnumMap,
     136           0 :                                                ::getCppuType((const chart::ChartDataRowSource*)0) );
     137           0 :                 break;
     138             :             case XML_SCH_TYPE_TEXT_ORIENTATION:
     139           0 :                 pHdl = new XMLTextOrientationHdl();
     140           0 :                 break;
     141             : 
     142             :             case XML_SCH_TYPE_INTERPOLATION:
     143             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartInterpolationTypeEnumMap,
     144           0 :                                                ::getCppuType((const sal_Int32*)0) );
     145           0 :                 break;
     146             :             case XML_SCH_TYPE_SYMBOL_TYPE:
     147           0 :                 pHdl = new XMLSymbolTypePropertyHdl( false );
     148           0 :                 break;
     149             : 
     150             :             case XML_SCH_TYPE_NAMED_SYMBOL:
     151           0 :                 pHdl = new XMLSymbolTypePropertyHdl( true );
     152           0 :                 break;
     153             : 
     154             :             case XML_SCH_TYPE_MISSING_VALUE_TREATMENT:
     155             :                 pHdl = new XMLEnumPropertyHdl( aXMLChartMissingValueTreatmentEnumMap,
     156           0 :                                                ::getCppuType((const sal_Int32*)0) );
     157           0 :                 break;
     158             :         }
     159           0 :         if( pHdl )
     160           0 :             PutHdlCache( nType, pHdl );
     161             :     }
     162             : 
     163           0 :     return pHdl;
     164             : }
     165             : 
     166           0 : XMLChartPropertySetMapper::XMLChartPropertySetMapper( bool bForExport ) :
     167           0 :         XMLPropertySetMapper( aXMLChartPropMap, new XMLChartPropHdlFactory, bForExport )
     168             : {
     169           0 : }
     170             : 
     171           0 : XMLChartPropertySetMapper::~XMLChartPropertySetMapper()
     172             : {
     173           0 : }
     174             : 
     175           0 : XMLChartExportPropertyMapper::XMLChartExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
     176             :                                                             SvXMLExport& rExport) :
     177             :         SvXMLExportPropertyMapper( rMapper ),
     178           0 :         msTrue( GetXMLToken( XML_TRUE )),
     179           0 :         msFalse( GetXMLToken( XML_FALSE )),
     180           0 :         mrExport( rExport )
     181             : {
     182             :     // chain draw properties
     183           0 :     ChainExportMapper( XMLShapeExport::CreateShapePropMapper( rExport ));
     184             : 
     185             :     // chain text properties
     186           0 :     ChainExportMapper( XMLTextParagraphExport::CreateParaExtPropMapper( rExport ));
     187           0 : }
     188             : 
     189           0 : XMLChartExportPropertyMapper::~XMLChartExportPropertyMapper()
     190             : {
     191           0 : }
     192             : 
     193           0 : void XMLChartExportPropertyMapper::ContextFilter(
     194             :     bool bEnableFoFontFamily,
     195             :     std::vector< XMLPropertyState >& rProperties,
     196             :     uno::Reference< beans::XPropertySet > rPropSet ) const
     197             : {
     198           0 :     OUString aAutoPropName;
     199           0 :     bool bCheckAuto = false;
     200             : 
     201             :     // filter properties
     202           0 :     for( std::vector< XMLPropertyState >::iterator property = rProperties.begin();
     203           0 :          property != rProperties.end();
     204             :          ++property )
     205             :     {
     206             :         // find properties with context
     207             :         // to prevent writing this property set mnIndex member to -1
     208           0 :         switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ))
     209             :         {
     210             :             // if Auto... is set the corresponding properties mustn't be exported
     211             :             case XML_SCH_CONTEXT_MIN:
     212           0 :                 bCheckAuto = true;
     213           0 :                 aAutoPropName = "AutoMin";
     214           0 :                 break;
     215             :             case XML_SCH_CONTEXT_MAX:
     216           0 :                 bCheckAuto = true;
     217           0 :                 aAutoPropName = "AutoMax";
     218           0 :                 break;
     219             :             case XML_SCH_CONTEXT_STEP_MAIN:
     220           0 :                 bCheckAuto = true;
     221           0 :                 aAutoPropName = "AutoStepMain";
     222           0 :                 break;
     223             :             case XML_SCH_CONTEXT_STEP_HELP_COUNT:
     224           0 :                 bCheckAuto = true;
     225           0 :                 aAutoPropName = "AutoStepHelp";
     226           0 :                 break;
     227             : 
     228             :             case XML_SCH_CONTEXT_ORIGIN:
     229           0 :                 bCheckAuto = true;
     230           0 :                 aAutoPropName = "AutoOrigin";
     231           0 :                 break;
     232             : 
     233             :             // the following property is deprecated
     234             :             // elemet-item symbol-image is used now
     235             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
     236           0 :                 property->mnIndex = -1;
     237           0 :                 break;
     238             : 
     239             :             case XML_SCH_CONTEXT_STOCK_WITH_VOLUME:
     240             :             case XML_SCH_CONTEXT_LINES_USED:
     241             :                 // note this avoids export of the properties in OASIS format,
     242             :                 // but also for the OOo XML Flat format (used by binfilter),
     243             :                 // because there, the transformation to OOo is done after the
     244             :                 // complete export of the chart in OASIS format.
     245           0 :                 if( mrExport.getExportFlags() & EXPORT_OASIS )
     246           0 :                     property->mnIndex = -1;
     247           0 :                 break;
     248             :         }
     249             : 
     250           0 :         if( bCheckAuto )
     251             :         {
     252           0 :             if( rPropSet.is())
     253             :             {
     254             :                 try
     255             :                 {
     256           0 :                     sal_Bool bAuto = false;
     257           0 :                     uno::Any aAny = rPropSet->getPropertyValue( aAutoPropName );
     258           0 :                     aAny >>= bAuto;
     259           0 :                     if( bAuto )
     260           0 :                         property->mnIndex = -1;
     261             :                 }
     262           0 :                 catch(const beans::UnknownPropertyException&)
     263             :                 {
     264             :                 }
     265             :             }
     266           0 :             bCheckAuto = false;
     267             :         }
     268             :     }
     269             : 
     270           0 :     SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
     271           0 : }
     272             : 
     273           0 : void XMLChartExportPropertyMapper::handleElementItem(
     274             :     SvXMLExport& rExport,
     275             :     const XMLPropertyState& rProperty, sal_uInt16 nFlags,
     276             :     const ::std::vector< XMLPropertyState > *pProperties,
     277             :     sal_uInt32 nIdx ) const
     278             : {
     279           0 :     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ))
     280             :     {
     281             :         case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
     282             :             {
     283           0 :                 OUString aURLStr;
     284           0 :                 rProperty.maValue >>= aURLStr;
     285             : 
     286             :                 // export as XLink reference into the package
     287             :                 // if embedding is off
     288           0 :                 OUString sTempURL( mrExport.AddEmbeddedGraphicObject( aURLStr ));
     289           0 :                 if( !sTempURL.isEmpty() )
     290             :                 {
     291           0 :                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sTempURL );
     292             :                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
     293           0 :                                               XML_SIMPLE );
     294             :                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
     295           0 :                                               XML_ONLOAD );
     296             :                 }
     297             : 
     298             :                 {
     299           0 :                     sal_uInt32 nPropIndex = rProperty.mnIndex;
     300             :                     // this is the element that has to live until the next statement
     301             :                     SvXMLElementExport aElem( mrExport,
     302           0 :                                               getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
     303           0 :                                               getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
     304           0 :                                               true, true );
     305             : 
     306             :                     // export as Base64 embedded graphic
     307             :                     // if embedding is on
     308           0 :                     if( !aURLStr.isEmpty())
     309           0 :                         mrExport.AddEmbeddedGraphicObjectAsBase64( aURLStr );
     310           0 :                 }
     311             :             }
     312           0 :             break;
     313             : 
     314             :         case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
     315             :             {
     316           0 :                 OUString aSeparator;
     317           0 :                 rProperty.maValue >>= aSeparator;
     318             : 
     319           0 :                 if( !aSeparator.isEmpty() )
     320             :                 {
     321           0 :                     sal_uInt32 nPropIndex = rProperty.mnIndex;
     322             :                     SvXMLElementExport aElem( mrExport,
     323           0 :                                               getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
     324           0 :                                               getPropertySetMapper()->GetEntryXMLName( nPropIndex ),
     325           0 :                                               true, true );
     326             : 
     327           0 :                     SchXMLTools::exportText( mrExport, aSeparator, true );
     328           0 :                 }
     329             :             }
     330           0 :             break;
     331             : 
     332             :         default:
     333             :             // call parent
     334             :             SvXMLExportPropertyMapper::handleElementItem( rExport, rProperty,
     335           0 :                                                           nFlags, pProperties, nIdx );
     336           0 :             break;
     337             :     }
     338           0 : }
     339             : 
     340             : namespace {
     341             : 
     342           0 : OUString convertRange( const OUString & rRange, const uno::Reference< chart2::XChartDocument > & xDoc )
     343             : {
     344           0 :     OUString aResult = rRange;
     345           0 :     if( !xDoc.is() )
     346           0 :         return aResult;
     347             :     uno::Reference< chart2::data::XRangeXMLConversion > xConversion(
     348           0 :         xDoc->getDataProvider(), uno::UNO_QUERY );
     349           0 :     if( xConversion.is())
     350           0 :         aResult = xConversion->convertRangeToXML( rRange );
     351           0 :     return aResult;
     352             : }
     353             : 
     354             : }
     355             : 
     356           0 : void XMLChartExportPropertyMapper::handleSpecialItem(
     357             :     SvXMLAttributeList& rAttrList, const XMLPropertyState& rProperty,
     358             :     const SvXMLUnitConverter& rUnitConverter,
     359             :     const SvXMLNamespaceMap& rNamespaceMap,
     360             :     const ::std::vector< XMLPropertyState > *pProperties,
     361             :     sal_uInt32 nIdx ) const
     362             : {
     363           0 :     bool bHandled = false;
     364             : 
     365           0 :     sal_Int32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
     366             : 
     367           0 :     if( nContextId )
     368             :     {
     369           0 :         bHandled = true;
     370             : 
     371           0 :         OUString sAttrName = getPropertySetMapper()->GetEntryXMLName( rProperty.mnIndex );
     372           0 :         sal_uInt16 nNameSpace = getPropertySetMapper()->GetEntryNameSpace( rProperty.mnIndex );
     373           0 :         OUStringBuffer sValueBuffer;
     374           0 :         OUString sValue;
     375             : 
     376           0 :         sal_Int32 nValue = 0;
     377           0 :         bool bValue = false;
     378             : 
     379           0 :         switch( nContextId )
     380             :         {
     381             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
     382             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
     383           0 :                 rProperty.maValue >>= nValue;
     384           0 :                 bValue = (( nValue & chart::ChartAxisMarks::INNER ) == chart::ChartAxisMarks::INNER );
     385           0 :                 ::sax::Converter::convertBool( sValueBuffer, bValue );
     386           0 :                 break;
     387             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
     388             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
     389           0 :                 rProperty.maValue >>= nValue;
     390           0 :                 bValue = (( nValue & chart::ChartAxisMarks::OUTER ) == chart::ChartAxisMarks::OUTER );
     391           0 :                 ::sax::Converter::convertBool( sValueBuffer, bValue );
     392           0 :                 break;
     393             :             case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
     394             :                 {
     395             :                     // convert from 100th degrees to degrees (double)
     396           0 :                     rProperty.maValue >>= nValue;
     397           0 :                     double fVal = (double)(nValue) / 100.0;
     398           0 :                     ::sax::Converter::convertDouble( sValueBuffer, fVal );
     399             :                 }
     400           0 :                 break;
     401             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
     402             :                 {
     403           0 :                     rProperty.maValue >>= nValue;
     404           0 :                     if((( nValue & chart::ChartDataCaption::VALUE ) == chart::ChartDataCaption::VALUE ))
     405             :                     {
     406           0 :                         if( ( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
     407             :                         {
     408           0 :                             const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
     409           0 :                             if( nCurrentVersion < SvtSaveOptions::ODFVER_012 )
     410           0 :                                 sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
     411             :                             else
     412           0 :                                 sValueBuffer.append( GetXMLToken( XML_VALUE_AND_PERCENTAGE ));
     413             :                         }
     414             :                         else
     415           0 :                             sValueBuffer.append( GetXMLToken( XML_VALUE ));
     416             :                     }
     417           0 :                     else if(( nValue & chart::ChartDataCaption::PERCENT ) == chart::ChartDataCaption::PERCENT )
     418           0 :                         sValueBuffer.append( GetXMLToken( XML_PERCENTAGE ));
     419             :                     else
     420           0 :                         sValueBuffer.append( GetXMLToken( XML_NONE ));
     421             :                 }
     422           0 :                 break;
     423             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
     424           0 :                 rProperty.maValue >>= nValue;
     425           0 :                 bValue = (( nValue & chart::ChartDataCaption::TEXT ) == chart::ChartDataCaption::TEXT );
     426           0 :                 ::sax::Converter::convertBool( sValueBuffer, bValue );
     427           0 :                 break;
     428             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
     429           0 :                 rProperty.maValue >>= nValue;
     430           0 :                 bValue = (( nValue & chart::ChartDataCaption::SYMBOL ) == chart::ChartDataCaption::SYMBOL );
     431           0 :                 ::sax::Converter::convertBool( sValueBuffer, bValue );
     432           0 :                 break;
     433             : 
     434             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
     435             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
     436             :                 {
     437           0 :                     awt::Size aSize;
     438           0 :                     rProperty.maValue >>= aSize;
     439             :                     rUnitConverter.convertMeasureToXML( sValueBuffer,
     440             :                                                    nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH
     441             :                                                    ? aSize.Width
     442           0 :                                                    : aSize.Height );
     443             :                 }
     444           0 :                 break;
     445             : 
     446             :             case XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT:
     447             :                 {
     448             :                     // just for import
     449           0 :                     break;
     450             :                 }
     451             : 
     452             :             case XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE:
     453             :                 {
     454           0 :                     OUString aRangeStr;
     455           0 :                     rProperty.maValue >>= aRangeStr;
     456           0 :                     sValueBuffer.append(convertRange(aRangeStr, mxChartDoc));
     457             :                 }
     458           0 :                 break;
     459             :             case XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE:
     460             :                 {
     461           0 :                     OUString aServiceName;
     462           0 :                     rProperty.maValue >>= aServiceName;
     463           0 :                     if      (aServiceName == "com.sun.star.chart2.LinearRegressionCurve")
     464           0 :                         sValueBuffer.append( GetXMLToken( XML_LINEAR ));
     465           0 :                     else if (aServiceName == "com.sun.star.chart2.LogarithmicRegressionCurve")
     466           0 :                         sValueBuffer.append( GetXMLToken( XML_LOGARITHMIC ));
     467           0 :                     else if (aServiceName == "com.sun.star.chart2.ExponentialRegressionCurve")
     468           0 :                         sValueBuffer.append( GetXMLToken( XML_EXPONENTIAL ));
     469           0 :                     else if (aServiceName == "com.sun.star.chart2.PotentialRegressionCurve")
     470           0 :                         sValueBuffer.append( GetXMLToken( XML_POWER ));
     471           0 :                     else if (aServiceName == "com.sun.star.chart2.PolynomialRegressionCurve")
     472           0 :                         sValueBuffer.append( GetXMLToken( XML_POLYNOMIAL ));
     473           0 :                     else if (aServiceName == "com.sun.star.chart2.MovingAverageRegressionCurve")
     474           0 :                         sValueBuffer.append( GetXMLToken( XML_MOVING_AVERAGE ));
     475             :                 }
     476           0 :                 break;
     477             : 
     478             :             default:
     479           0 :                 bHandled = false;
     480           0 :                 break;
     481             :         }
     482             : 
     483           0 :         if( !sValueBuffer.isEmpty())
     484             :         {
     485           0 :             sValue = sValueBuffer.makeStringAndClear();
     486           0 :             sAttrName = rNamespaceMap.GetQNameByKey( nNameSpace, sAttrName );
     487           0 :             rAttrList.AddAttribute( sAttrName, sValue );
     488           0 :         }
     489             :     }
     490             : 
     491           0 :     if( !bHandled )
     492             :     {
     493             :         // call parent
     494           0 :         SvXMLExportPropertyMapper::handleSpecialItem( rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
     495             :     }
     496           0 : }
     497             : 
     498           0 : void XMLChartExportPropertyMapper::setChartDoc( uno::Reference< chart2::XChartDocument > xChartDoc )
     499             : {
     500           0 :     mxChartDoc = xChartDoc;
     501           0 : }
     502             : 
     503           0 : XMLChartImportPropertyMapper::XMLChartImportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper,
     504             :                                                             const SvXMLImport& _rImport ) :
     505             :         SvXMLImportPropertyMapper( rMapper, const_cast< SvXMLImport & >( _rImport )),
     506           0 :         mrImport( const_cast< SvXMLImport & > ( _rImport ))
     507             : {
     508             :     // chain shape mapper for drawing properties
     509             : 
     510             :     // give an empty model. It is only used for numbering rules that don't exist in chart
     511           0 :     uno::Reference< frame::XModel > xEmptyModel;
     512           0 :     ChainImportMapper( XMLShapeImportHelper::CreateShapePropMapper( xEmptyModel, mrImport ));
     513             : 
     514             :     //#i14365# save and load writing-mode for chart elements
     515             :     //The property TextWritingMode is mapped wrongly in the underlying draw mapper, but for draw it is necessary
     516             :     //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')
     517           0 :     sal_Int32 nUnwantedWrongEntry = maPropMapper->FindEntryIndex( "TextWritingMode", XML_NAMESPACE_STYLE, GetXMLToken(XML_WRITING_MODE) );
     518           0 :     maPropMapper->RemoveEntry(nUnwantedWrongEntry);
     519             : 
     520             :     // do not chain text properties: on import this is done by shape mapper
     521             :     // to import old documents
     522           0 : }
     523             : 
     524           0 : XMLChartImportPropertyMapper::~XMLChartImportPropertyMapper()
     525             : {
     526           0 : }
     527             : 
     528           0 : bool XMLChartImportPropertyMapper::handleSpecialItem(
     529             :     XMLPropertyState& rProperty,
     530             :     ::std::vector< XMLPropertyState >& rProperties,
     531             :     const OUString& rValue,
     532             :     const SvXMLUnitConverter& rUnitConverter,
     533             :     const SvXMLNamespaceMap& rNamespaceMap ) const
     534             : {
     535           0 :     sal_Int32 nContextId = maPropMapper->GetEntryContextId( rProperty.mnIndex );
     536           0 :     bool bRet = (nContextId != 0);
     537             : 
     538           0 :     if( nContextId )
     539             :     {
     540           0 :         sal_Int32 nValue = 0;
     541           0 :         bool bValue = false;
     542             : 
     543           0 :         switch( nContextId )
     544             :         {
     545             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER:
     546             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER:
     547           0 :                 ::sax::Converter::convertBool( bValue, rValue );
     548             :                 // modify old value
     549           0 :                 rProperty.maValue >>= nValue;
     550           0 :                 if( bValue )
     551           0 :                     SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::INNER );
     552             :                 else
     553           0 :                     SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::INNER );
     554           0 :                 rProperty.maValue <<= nValue;
     555           0 :                 break;
     556             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER:
     557             :             case XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER:
     558           0 :                 ::sax::Converter::convertBool( bValue, rValue );
     559             :                 // modify old value
     560           0 :                 rProperty.maValue >>= nValue;
     561           0 :                 if( bValue )
     562           0 :                     SCH_XML_SETFLAG( nValue, chart::ChartAxisMarks::OUTER );
     563             :                 else
     564           0 :                     SCH_XML_UNSETFLAG( nValue, chart::ChartAxisMarks::OUTER );
     565           0 :                 rProperty.maValue <<= nValue;
     566           0 :                 break;
     567             :             case XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION:
     568             :                 {
     569             :                     // convert from degrees (double) to 100th degrees (integer)
     570             :                     double fVal;
     571           0 :                     ::sax::Converter::convertDouble( fVal, rValue );
     572           0 :                     nValue = (sal_Int32)( fVal * 100.0 );
     573           0 :                     rProperty.maValue <<= nValue;
     574             :                 }
     575           0 :                 break;
     576             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER:
     577             :                 {
     578             :                     // modify old value
     579           0 :                     rProperty.maValue >>= nValue;
     580           0 :                     if( IsXMLToken( rValue, XML_NONE ))
     581           0 :                         SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
     582           0 :                     else if( IsXMLToken( rValue, XML_VALUE_AND_PERCENTAGE ) )
     583           0 :                         SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE | chart::ChartDataCaption::PERCENT );
     584           0 :                     else if( IsXMLToken( rValue, XML_VALUE ) )
     585           0 :                         SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::VALUE );
     586             :                     else // must be XML_PERCENTAGE
     587           0 :                         SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::PERCENT );
     588           0 :                     rProperty.maValue <<= nValue;
     589             :                 }
     590           0 :                 break;
     591             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT:
     592           0 :                 rProperty.maValue >>= nValue;
     593           0 :                 ::sax::Converter::convertBool( bValue, rValue );
     594           0 :                 if( bValue )
     595           0 :                     SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::TEXT );
     596             :                 else
     597           0 :                     SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::TEXT );
     598           0 :                 rProperty.maValue <<= nValue;
     599           0 :                 break;
     600             :             case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL:
     601           0 :                 rProperty.maValue >>= nValue;
     602           0 :                 ::sax::Converter::convertBool( bValue, rValue );
     603           0 :                 if( bValue )
     604           0 :                     SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
     605             :                 else
     606           0 :                     SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::SYMBOL );
     607           0 :                 rProperty.maValue <<= nValue;
     608           0 :                 break;
     609             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH:
     610             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT:
     611             :                 {
     612           0 :                     awt::Size aSize;
     613           0 :                     rProperty.maValue >>= aSize;
     614             :                     rUnitConverter.convertMeasureToCore(
     615             :                         (nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH)
     616             :                                                    ? aSize.Width
     617             :                                                    : aSize.Height,
     618           0 :                                                    rValue );
     619           0 :                     rProperty.maValue <<= aSize;
     620             :                 }
     621           0 :                 break;
     622             : 
     623             :             case XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE:
     624             :                 {
     625           0 :                     rProperty.maValue <<= rValue;
     626             :                 }
     627           0 :                 break;
     628             : 
     629             :             // deprecated from 6.0 beta on
     630             :             case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME:
     631           0 :                 rProperty.maValue <<= mrImport.ResolveGraphicObjectURL( rValue, false );
     632           0 :                 break;
     633             : 
     634             :             case XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE:
     635             :             {
     636           0 :                 if      (IsXMLToken( rValue, XML_LINEAR ))
     637           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.LinearRegressionCurve");
     638           0 :                 else if (IsXMLToken( rValue, XML_LOGARITHMIC))
     639           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.LogarithmicRegressionCurve");
     640           0 :                 else if (IsXMLToken( rValue, XML_EXPONENTIAL))
     641           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.ExponentialRegressionCurve");
     642           0 :                 else if (IsXMLToken( rValue, XML_POWER))
     643           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.PotentialRegressionCurve");
     644           0 :                 else if (IsXMLToken( rValue, XML_POLYNOMIAL))
     645           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.PolynomialRegressionCurve");
     646           0 :                 else if (IsXMLToken( rValue, XML_MOVING_AVERAGE))
     647           0 :                     rProperty.maValue <<= OUString("com.sun.star.chart2.MovingAverageRegressionCurve");
     648             :             }
     649           0 :             break;
     650             : 
     651             :             default:
     652           0 :                 bRet = false;
     653           0 :                 break;
     654             :         }
     655             :     }
     656             : 
     657             :     // if we didn't handle it, the parent should
     658           0 :     if( !bRet )
     659             :     {
     660             :         // call parent
     661           0 :         bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, rProperties, rValue, rUnitConverter, rNamespaceMap );
     662             :     }
     663             : 
     664           0 :     return bRet;
     665             : }
     666             : 
     667           0 : void XMLChartImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& /*rProperties*/, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
     668             : {
     669           0 : }
     670             : 
     671             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10