summaryrefslogtreecommitdiff
path: root/xmloff/source/chart/SchXMLPlotAreaContext.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/chart/SchXMLPlotAreaContext.cxx')
-rwxr-xr-x[-rw-r--r--]xmloff/source/chart/SchXMLPlotAreaContext.cxx1002
1 files changed, 26 insertions, 976 deletions
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 15d4568cfc40..66cc842761bf 100644..100755
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -31,6 +31,7 @@
#include "SchXMLPlotAreaContext.hxx"
#include "SchXMLImport.hxx"
+#include "SchXMLAxisContext.hxx"
#include "SchXMLSeries2Context.hxx"
#include "SchXMLTools.hxx"
#include <tools/debug.hxx>
@@ -39,8 +40,7 @@
#endif
#include <comphelper/processfactory.hxx>
-#include "xmlnmspe.hxx"
-#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
#include <xmloff/xmlement.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmluconv.hxx>
@@ -52,29 +52,18 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
-#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
-#include <com/sun/star/chart/ChartAxisPosition.hpp>
-#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
-#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
-#include <com/sun/star/chart/XAxisZSupplier.hpp>
-#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/X3DDisplay.hpp>
#include <com/sun/star/chart/XStatisticDisplay.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/drawing/CameraGeometry.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XStringMapping.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
@@ -85,14 +74,6 @@ using namespace ::xmloff::token;
using ::rtl::OUString;
using com::sun::star::uno::Reference;
-static SvXMLEnumMapEntry aXMLAxisClassMap[] =
-{
- { XML_X, SCH_XML_AXIS_X },
- { XML_Y, SCH_XML_AXIS_Y },
- { XML_Z, SCH_XML_AXIS_Z },
- { XML_TOKEN_INVALID, 0 }
-};
-
namespace
{
@@ -116,19 +97,6 @@ OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference<
return aResult;
}
-Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem > xCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
-{
- Reference< chart2::XAxis > xAxis;
- try
- {
- xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex );
- }
- catch( uno::Exception & )
- {
- }
- return xAxis;
-}
-
} // anonymous namespace
SchXML3DSceneAttributesHelper::SchXML3DSceneAttributesHelper( SvXMLImport& rImporter )
@@ -240,47 +208,33 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
{
try
{
- if( xInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartAxisXSupplier" ))))
- {
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisGrid" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisDescription" )), aFalseBool );
- }
- if( xInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartTwoAxisXSupplier" ))))
- {
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxis" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxisDescription" )), aFalseBool );
- }
- if( xInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartAxisYSupplier" ))))
- {
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxis" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisGrid" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisDescription" )), aFalseBool );
- }
- if( xInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartTwoAxisYSupplier" ))))
- {
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxis" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxisDescription" )), aFalseBool );
- }
- if( xInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartAxisZSupplier" ))))
- {
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxis" )), aFalseBool );
- xProp->setPropertyValue(
+ xProp->setPropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisDescription" )), aFalseBool );
- }
+
uno::Any aAny;
chart::ChartDataRowSource eSource = chart::ChartDataRowSource_COLUMNS;
aAny <<= eSource;
@@ -308,7 +262,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
rtl::OUString aValue = xAttrList->getValueByIndex( i );
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
{
@@ -512,7 +466,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
}
SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
- USHORT nPrefix,
+ sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
@@ -624,7 +578,7 @@ void SchXMLPlotAreaContext::EndElement()
::std::vector< SchXMLAxis >::const_iterator aIt(
::std::find_if( maAxes.begin(), maAxes.end(), lcl_AxisHasCategories()));
if( aIt != maAxes.end())
- nDimension = static_cast< sal_Int32 >( (*aIt).eClass );
+ nDimension = static_cast< sal_Int32 >( (*aIt).eDimension );
SchXMLTools::CreateCategories(
xDataProvider, mxNewDoc, mrCategoriesAddress,
0 /* nCooSysIndex */,
@@ -709,874 +663,7 @@ void SchXMLPlotAreaContext::EndElement()
}
}
- CorrectAxisPositions();
-}
-
-void SchXMLPlotAreaContext::CorrectAxisPositions()
-{
- ::rtl::OUString aODFVersionOfFile( GetImport().GetODFVersion() );
-
- if( ( !aODFVersionOfFile.getLength() || aODFVersionOfFile.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("1.0"))
- || aODFVersionOfFile.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("1.1"))
- || ( aODFVersionOfFile.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("1.2")) && !m_bAxisPositionAttributeImported ) ) )
- {
- uno::Reference< chart2::XChartDocument > xNewDoc( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
-
- try
- {
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
- uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- if( aCooSysSeq.getLength() )
- {
- Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
- if( xCooSys.is() )
- {
- Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 );
- Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 );
- Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 );
- Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 );
-
- uno::Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY );
-
- if( xMainXAxisProp.is() && xMainYAxisProp.is() )
- {
- chart2::ScaleData aMainXScale = xMainXAxis->getScaleData();
- if( 0 == maChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) )
- {
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) );
- double fCrossoverValue = 0.0;
- aMainXScale.Origin >>= fCrossoverValue;
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverValue" ))
- , uno::makeAny( fCrossoverValue ) );
-
- if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
- {
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LabelPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) );
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MarkPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
- }
- else
- {
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LabelPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) );
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MarkPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
- }
- }
- else
- {
- if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
- {
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
- }
- else
- {
- xMainYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
- }
- }
-
- chart2::ScaleData aMainYScale = xMainYAxis->getScaleData();
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) );
- double fCrossoverValue = 0.0;
- aMainYScale.Origin >>= fCrossoverValue;
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverValue" ))
- , uno::makeAny( fCrossoverValue ) );
-
- if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE )
- {
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LabelPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) );
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MarkPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryXAxisProp.is() )
- xSecondaryXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) );
- }
- else
- {
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LabelPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) );
- xMainXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MarkPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryXAxisProp.is() )
- xSecondaryXAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CrossoverPosition" ))
- , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) );
- }
- }
- }
- }
- }
- catch( uno::Exception & )
- {
- }
- }
-}
-
-// ========================================
-
-SchXMLAxisContext::SchXMLAxisContext( SchXMLImportHelper& rImpHelper,
- SvXMLImport& rImport, const rtl::OUString& rLocalName,
- uno::Reference< chart::XDiagram > xDiagram,
- std::vector< SchXMLAxis >& aAxes,
- ::rtl::OUString & rCategoriesAddress,
- bool bAddMissingXAxisForNetCharts,
- bool bAdaptWrongPercentScaleValues,
- bool bAdaptXAxisOrientationForOld2DBarCharts,
- bool& rbAxisPositionAttributeImported ) :
- SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
- mrImportHelper( rImpHelper ),
- mxDiagram( xDiagram ),
- maAxes( aAxes ),
- mrCategoriesAddress( rCategoriesAddress ),
- mbAddMissingXAxisForNetCharts( bAddMissingXAxisForNetCharts ),
- mbAdaptWrongPercentScaleValues( bAdaptWrongPercentScaleValues ),
- mbAdaptXAxisOrientationForOld2DBarCharts( bAdaptXAxisOrientationForOld2DBarCharts ),
- m_rbAxisPositionAttributeImported( rbAxisPositionAttributeImported )
-{
-}
-
-SchXMLAxisContext::~SchXMLAxisContext()
-{}
-
-/* returns a shape for the current axis's title. The property
- "Has...AxisTitle" is set to "True" to get the shape
- */
-uno::Reference< drawing::XShape > SchXMLAxisContext::getTitleShape()
-{
- uno::Reference< drawing::XShape > xResult;
- uno::Any aTrueBool;
- aTrueBool <<= (sal_Bool)(sal_True);
- uno::Reference< beans::XPropertySet > xDiaProp( mxDiagram, uno::UNO_QUERY );
-
- switch( maCurrentAxis.eClass )
- {
- case SCH_XML_AXIS_X:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- uno::Reference< chart::XAxisXSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisTitle" )), aTrueBool );
- xResult = uno::Reference< drawing::XShape >( xSuppl->getXAxisTitle(), uno::UNO_QUERY );
- }
- }
- else
- {
- uno::Reference< chart::XSecondAxisTitleSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() )
- {
- if( xDiaProp.is() )
- xDiaProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxisTitle" )), aTrueBool );
- xResult = uno::Reference< drawing::XShape >( xSuppl->getSecondXAxisTitle(), uno::UNO_QUERY );
- }
- }
- break;
- case SCH_XML_AXIS_Y:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- uno::Reference< chart::XAxisYSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisTitle" )), aTrueBool );
- xResult = uno::Reference< drawing::XShape >( xSuppl->getYAxisTitle(), uno::UNO_QUERY );
- }
- }
- else
- {
- uno::Reference< chart::XSecondAxisTitleSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() )
- {
- if( xDiaProp.is() )
- xDiaProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxisTitle" )), aTrueBool );
- xResult = uno::Reference< drawing::XShape >( xSuppl->getSecondYAxisTitle(), uno::UNO_QUERY );
- }
- }
- break;
- case SCH_XML_AXIS_Z:
- {
- uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisTitle" )), aTrueBool );
- xResult = uno::Reference< drawing::XShape >( xSuppl->getZAxisTitle(), uno::UNO_QUERY );
- }
- break;
- }
- case SCH_XML_AXIS_UNDEF:
- OSL_FAIL( "Invalid axis" );
- break;
- }
-
- return xResult;
-}
-
-void SchXMLAxisContext::CreateGrid( ::rtl::OUString sAutoStyleName,
- sal_Bool bIsMajor )
-{
- uno::Reference< chart::XDiagram > xDia = mrImportHelper.GetChartDocument()->getDiagram();
- uno::Reference< beans::XPropertySet > xGridProp;
- ::rtl::OUString sPropertyName;
- DBG_ASSERT( xDia.is(), "diagram object is invalid!" );
-
- uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY );
- uno::Any aTrueBool( uno::makeAny( true ));
-
- switch( maCurrentAxis.eClass )
- {
- case SCH_XML_AXIS_X:
- {
- uno::Reference< chart::XAxisXSupplier > xSuppl( xDia, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( bIsMajor )
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisGrid" )), aTrueBool );
- xGridProp = xSuppl->getXMainGrid();
- }
- else
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxisHelpGrid" )), aTrueBool );
- xGridProp = xSuppl->getXHelpGrid();
- }
- }
- }
- break;
- case SCH_XML_AXIS_Y:
- {
- uno::Reference< chart::XAxisYSupplier > xSuppl( xDia, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( bIsMajor )
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisGrid" )), aTrueBool );
- xGridProp = xSuppl->getYMainGrid();
- }
- else
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxisHelpGrid" )), aTrueBool );
- xGridProp = xSuppl->getYHelpGrid();
- }
- }
- }
- break;
- case SCH_XML_AXIS_Z:
- {
- uno::Reference< chart::XAxisZSupplier > xSuppl( xDia, uno::UNO_QUERY );
- if( xSuppl.is())
- {
- if( bIsMajor )
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisGrid" )), aTrueBool );
- xGridProp = xSuppl->getZMainGrid();
- }
- else
- {
- if( xDiaProp.is())
- xDiaProp->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxisHelpGrid" )), aTrueBool );
- xGridProp = xSuppl->getZHelpGrid();
- }
- }
- }
- break;
- case SCH_XML_AXIS_UNDEF:
- OSL_FAIL( "Invalid axis" );
- break;
- }
-
- // set properties
- if( xGridProp.is())
- {
- // the line color is black as default, in the model it is a light gray
- xGridProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )),
- uno::makeAny( COL_BLACK ));
- if( sAutoStyleName.getLength())
- {
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- if( pStylesCtxt )
- {
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- mrImportHelper.GetChartFamilyID(), sAutoStyleName );
-
- if( pStyle && pStyle->ISA( XMLPropStyleContext ))
- (( XMLPropStyleContext* )pStyle )->FillPropertySet( xGridProp );
- }
- }
- }
-}
-
-void SchXMLAxisContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- // parse attributes
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- SchXMLImport& rImport = ( SchXMLImport& )GetImport();
- const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetAxisAttrTokenMap();
-
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
- {
- rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
- rtl::OUString aLocalName;
- rtl::OUString aValue = xAttrList->getValueByIndex( i );
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
- {
- case XML_TOK_AXIS_DIMENSION:
- {
- USHORT nEnumVal;
- if( rImport.GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLAxisClassMap ))
- maCurrentAxis.eClass = ( SchXMLAxisClass )nEnumVal;
- }
- break;
- case XML_TOK_AXIS_NAME:
- maCurrentAxis.aName = aValue;
- break;
- case XML_TOK_AXIS_STYLE_NAME:
- msAutoStyleName = aValue;
- break;
- }
- }
-
- // check for number of axes with same category
- maCurrentAxis.nIndexInCategory = 0;
- sal_Int32 nNumOfAxes = maAxes.size();
- for( sal_Int32 nCurrent = 0; nCurrent < nNumOfAxes; nCurrent++ )
- {
- if( maAxes[ nCurrent ].eClass == maCurrentAxis.eClass )
- maCurrentAxis.nIndexInCategory++;
- }
- CreateAxis();
-}
-namespace
-{
-
-uno::Reference< chart2::XAxis > lcl_getAxis( const uno::Reference< frame::XModel >& xChartModel,
- sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
-{
- uno::Reference< chart2::XAxis > xAxis;
-
- try
- {
- uno::Reference< chart2::XChartDocument > xChart2Document( xChartModel, uno::UNO_QUERY );
- if( xChart2Document.is() )
- {
- uno::Reference< chart2::XDiagram > xDiagram( xChart2Document->getFirstDiagram());
- uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Reference< chart2::XCoordinateSystem > >
- aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- sal_Int32 nCooSysIndex = 0;
- if( nCooSysIndex < aCooSysSeq.getLength() )
- {
- uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] );
- if( xCooSys.is() && nDimensionIndex < xCooSys->getDimension() )
- {
- const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
- if( nAxisIndex <= nMaxAxisIndex )
- xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex );
- }
- }
- }
- }
- catch( uno::Exception & )
- {
- OSL_FAIL( "Couldn't get axis" );
- }
-
- return xAxis;
-}
-
-bool lcl_divideBy100( uno::Any& rDoubleAny )
-{
- bool bChanged = false;
- double fValue=0.0;
- if( (rDoubleAny>>=fValue) && (fValue!=0.0) )
- {
- fValue/=100.0;
- rDoubleAny = uno::makeAny(fValue);
- bChanged = true;
- }
- return bChanged;
-}
-
-bool lcl_AdaptWrongPercentScaleValues(chart2::ScaleData& rScaleData)
-{
- bool bChanged = lcl_divideBy100( rScaleData.Minimum );
- bChanged = lcl_divideBy100( rScaleData.Maximum ) || bChanged;
- bChanged = lcl_divideBy100( rScaleData.Origin ) || bChanged;
- bChanged = lcl_divideBy100( rScaleData.IncrementData.Distance ) || bChanged;
- return bChanged;
-}
-
-}//end anonymous namespace
-
-void SchXMLAxisContext::CreateAxis()
-{
- // add new Axis to list
- maAxes.push_back( maCurrentAxis );
-
- // set axis at chart
- uno::Reference< beans::XPropertySet > xDiaProp( mxDiagram, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xProp;
- uno::Any aTrueBool;
- aTrueBool <<= (sal_Bool)(sal_True);
- uno::Any aFalseBool;
- aFalseBool <<= (sal_Bool)(sal_False);
- uno::Reference< frame::XModel > xDoc( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
-
- switch( maCurrentAxis.eClass )
- {
- case SCH_XML_AXIS_X:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- try
- {
- xDiaProp->setPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" )), aTrueBool );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on x axis" );
- }
- uno::Reference< chart::XAxisXSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getXAxis();
- }
- else
- {
- try
- {
- xDiaProp->setPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryXAxis" )), aTrueBool );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on second x axis" );
- }
- uno::Reference< chart::XTwoAxisXSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getSecondaryXAxis();
- }
- break;
-
- case SCH_XML_AXIS_Y:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- try
- {
- xDiaProp->setPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasYAxis" )), aTrueBool );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on y axis" );
- }
- uno::Reference< chart::XAxisYSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getYAxis();
-
-
- if( mbAddMissingXAxisForNetCharts )
- {
- if( xDiaProp.is() )
- {
- try
- {
- xDiaProp->setPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasXAxis" )), uno::makeAny(sal_True) );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on x axis" );
- }
- }
- }
- }
- else
- {
- try
- {
- xDiaProp->setPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasSecondaryYAxis" )), aTrueBool );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on second y axis" );
- }
- uno::Reference< chart::XTwoAxisYSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getSecondaryYAxis();
- }
- break;
-
- case SCH_XML_AXIS_Z:
- {
- bool bSettingZAxisSuccedded = false;
- try
- {
- rtl::OUString sHasZAxis( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasZAxis" )) );
- xDiaProp->setPropertyValue( sHasZAxis, aTrueBool );
- xDiaProp->getPropertyValue( sHasZAxis ) >>= bSettingZAxisSuccedded;
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Couldn't turn on z axis" );
- }
- if( bSettingZAxisSuccedded )
- {
- uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is())
- xProp = xSuppl->getZAxis();
- }
- }
- break;
- case SCH_XML_AXIS_UNDEF:
- // nothing
- break;
- }
-
- // set properties
- if( xProp.is())
- {
- // #i109879# the line color is black as default, in the model it is a light gray
- xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineColor" )),
- uno::makeAny( COL_BLACK ));
-
- xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DisplayLabels" )), aFalseBool );
-
- // #88077# AutoOrigin 'on' is default
- xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoOrigin" )), aTrueBool );
-
- if( msAutoStyleName.getLength())
- {
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- if( pStylesCtxt )
- {
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- mrImportHelper.GetChartFamilyID(), msAutoStyleName );
-
- if( pStyle && pStyle->ISA( XMLPropStyleContext ))
- {
- // note: SvXMLStyleContext::FillPropertySet is not const
- XMLPropStyleContext * pPropStyleContext = const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
- if( pPropStyleContext )
- pPropStyleContext->FillPropertySet( xProp );
-
- if( mbAdaptWrongPercentScaleValues && maCurrentAxis.eClass==SCH_XML_AXIS_Y )
- {
- //set scale data of added x axis back to default
- uno::Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
- 1 /*nDimensionIndex*/, maCurrentAxis.nIndexInCategory /*nAxisIndex*/ ) );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData( xAxis->getScaleData());
- if( lcl_AdaptWrongPercentScaleValues(aScaleData) )
- xAxis->setScaleData( aScaleData );
- }
- }
-
- if( mbAddMissingXAxisForNetCharts )
- {
- //copy style from y axis to added x axis:
-
- uno::Reference< chart::XAxisXSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() )
- {
- uno::Reference< beans::XPropertySet > xXAxisProp( xSuppl->getXAxis() );
- (( XMLPropStyleContext* )pStyle )->FillPropertySet( xXAxisProp );
- }
-
- //set scale data of added x axis back to default
- uno::Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
- 0 /*nDimensionIndex*/, 0 /*nAxisIndex*/ ) );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData;
- aScaleData.AxisType = chart2::AxisType::CATEGORY;
- aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
- xAxis->setScaleData( aScaleData );
- }
-
- //set line style of added x axis to invisible
- uno::Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY );
- if( xNewAxisProp.is() )
- {
- xNewAxisProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LineStyle" ))
- , uno::makeAny(drawing::LineStyle_NONE));
- }
- }
-
- if( mbAdaptXAxisOrientationForOld2DBarCharts && maCurrentAxis.eClass == SCH_XML_AXIS_X )
- {
- bool bIs3DChart = false;
- if( xDiaProp.is() && ( xDiaProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3DChart )
- && !bIs3DChart )
- {
- uno::Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY );
- if( xChart2Document.is() )
- {
- uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY );
- if( xCooSysCnt.is() )
- {
- uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if( aCooSysSeq.getLength() )
- {
- bool bSwapXandYAxis = false;
- uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
- uno::Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
- if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXandYAxis )
- && bSwapXandYAxis )
- {
- uno::Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, maCurrentAxis.nIndexInCategory );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData = xAxis->getScaleData();
- aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
- xAxis->setScaleData( aScaleData );
- }
- }
- }
- }
- }
- }
- }
-
- m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")), pPropStyleContext, pStylesCtxt ).hasValue();
- }
- }
- }
- }
-}
-
-void SchXMLAxisContext::SetAxisTitle()
-{
- // add new Axis to list
- maAxes.push_back( maCurrentAxis );
-
- // set axis at chart
- sal_Bool bHasTitle = ( maCurrentAxis.aTitle.getLength() > 0 );
- uno::Reference< frame::XModel > xDoc( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
-
- switch( maCurrentAxis.eClass )
- {
- case SCH_XML_AXIS_X:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- uno::Reference< chart::XAxisXSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() &&
- bHasTitle )
- {
- uno::Reference< beans::XPropertySet > xTitleProp( xSuppl->getXAxisTitle(), uno::UNO_QUERY );
- if( xTitleProp.is())
- {
- try
- {
- uno::Any aAny;
- aAny <<= maCurrentAxis.aTitle;
- xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Property String for Title not available" );
- }
- }
- }
- }
- else
- {
- uno::Reference< chart::XSecondAxisTitleSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() &&
- bHasTitle )
- {
- uno::Reference< beans::XPropertySet > xTitleProp( xSuppl->getSecondXAxisTitle(), uno::UNO_QUERY );
- if( xTitleProp.is())
- {
- try
- {
- uno::Any aAny;
- aAny <<= maCurrentAxis.aTitle;
- xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Property String for Title not available" );
- }
- }
- }
- }
- break;
-
- case SCH_XML_AXIS_Y:
- if( maCurrentAxis.nIndexInCategory == 0 )
- {
- uno::Reference< chart::XAxisYSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() &&
- bHasTitle )
- {
- uno::Reference< beans::XPropertySet > xTitleProp( xSuppl->getYAxisTitle(), uno::UNO_QUERY );
- if( xTitleProp.is())
- {
- try
- {
- uno::Any aAny;
- aAny <<= maCurrentAxis.aTitle;
- xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Property String for Title not available" );
- }
- }
- }
- }
- else
- {
- uno::Reference< chart::XSecondAxisTitleSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() &&
- bHasTitle )
- {
- uno::Reference< beans::XPropertySet > xTitleProp( xSuppl->getSecondYAxisTitle(), uno::UNO_QUERY );
- if( xTitleProp.is())
- {
- try
- {
- uno::Any aAny;
- aAny <<= maCurrentAxis.aTitle;
- xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Property String for Title not available" );
- }
- }
- }
- }
- break;
-
- case SCH_XML_AXIS_Z:
- {
- uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY );
- if( xSuppl.is() &&
- bHasTitle )
- {
- uno::Reference< beans::XPropertySet > xTitleProp( xSuppl->getZAxisTitle(), uno::UNO_QUERY );
- if( xTitleProp.is())
- {
- try
- {
- uno::Any aAny;
- aAny <<= maCurrentAxis.aTitle;
- xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny );
- }
- catch( beans::UnknownPropertyException & )
- {
- OSL_FAIL( "Property String for Title not available" );
- }
- }
- }
- }
- break;
- case SCH_XML_AXIS_UNDEF:
- // nothing
- break;
- }
-}
-
-SvXMLImportContext* SchXMLAxisContext::CreateChildContext(
- USHORT p_nPrefix,
- const rtl::OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- SvXMLImportContext* pContext = 0;
- const SvXMLTokenMap& rTokenMap = mrImportHelper.GetAxisElemTokenMap();
-
- switch( rTokenMap.Get( p_nPrefix, rLocalName ))
- {
- case XML_TOK_AXIS_TITLE:
- {
- uno::Reference< drawing::XShape > xTitleShape = getTitleShape();
- pContext = new SchXMLTitleContext( mrImportHelper, GetImport(), rLocalName,
- maCurrentAxis.aTitle,
- xTitleShape );
- }
- break;
-
- case XML_TOK_AXIS_CATEGORIES:
- pContext = new SchXMLCategoriesContext( mrImportHelper, GetImport(),
- p_nPrefix, rLocalName,
- mrCategoriesAddress );
- maCurrentAxis.bHasCategories = true;
- break;
-
- case XML_TOK_AXIS_GRID:
- {
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- sal_Bool bIsMajor = sal_True; // default value for class is "major"
- rtl::OUString sAutoStyleName;
-
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
- {
- rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
- rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_CHART )
- {
- if( IsXMLToken( aLocalName, XML_CLASS ) )
- {
- if( IsXMLToken( xAttrList->getValueByIndex( i ), XML_MINOR ) )
- bIsMajor = sal_False;
- }
- else if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
- sAutoStyleName = xAttrList->getValueByIndex( i );
- }
- }
-
- CreateGrid( sAutoStyleName, bIsMajor );
-
- // don't create a context => use default context. grid elements are empty
- pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
- }
- break;
-
- default:
- pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
- break;
- }
-
- return pContext;
-}
-
-void SchXMLAxisContext::EndElement()
-{
- SetAxisTitle();
+ SchXMLAxisContext::CorrectAxisPositions( uno::Reference< chart2::XChartDocument >( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ), maChartTypeServiceName, GetImport().GetODFVersion(), m_bAxisPositionAttributeImported );
}
// ========================================
@@ -1612,7 +699,7 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr
{
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
if( nPrefix == XML_NAMESPACE_CHART )
{
@@ -1636,43 +723,6 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr
// ========================================
-SchXMLCategoriesContext::SchXMLCategoriesContext(
- SchXMLImportHelper& rImpHelper,
- SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const rtl::OUString& rLocalName,
- rtl::OUString& rAddress ) :
- SvXMLImportContext( rImport, nPrefix, rLocalName ),
- mrImportHelper( rImpHelper ),
- mrAddress( rAddress )
-{
-}
-
-SchXMLCategoriesContext::~SchXMLCategoriesContext()
-{
-}
-
-void SchXMLCategoriesContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
-
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
- {
- rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
- rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_TABLE &&
- IsXMLToken( aLocalName, XML_CELL_RANGE_ADDRESS ) )
- {
- uno::Reference< chart2::XChartDocument > xNewDoc( GetImport().GetModel(), uno::UNO_QUERY );
- mrAddress = xAttrList->getValueByIndex( i );
- }
- }
-}
-
-// ========================================
-
SchXMLPositonAttributesHelper::SchXMLPositonAttributesHelper( SvXMLImport& rImporter )
: m_rImport( rImporter )
, m_aPosition(0,0)
@@ -1794,7 +844,7 @@ void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
rtl::OUString aValue = xAttrList->getValueByIndex( i );
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
}
}
@@ -1830,7 +880,7 @@ void SchXMLWallFloorContext::StartElement( const uno::Reference< xml::sax::XAttr
{
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
if( nPrefix == XML_NAMESPACE_CHART &&
IsXMLToken( aLocalName, XML_STYLE_NAME ) )
@@ -1893,7 +943,7 @@ void SchXMLStockContext::StartElement( const uno::Reference< xml::sax::XAttribut
{
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
if( nPrefix == XML_NAMESPACE_CHART &&
IsXMLToken( aLocalName, XML_STYLE_NAME ) )
@@ -1970,7 +1020,7 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
{
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
- USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
if( nPrefix == XML_NAMESPACE_CHART )
{
@@ -2003,7 +1053,7 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
}
SvXMLImportContext* SchXMLStatisticsObjectContext::CreateChildContext(
- USHORT nPrefix,
+ sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
@@ -2063,7 +1113,7 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri
rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
rtl::OUString aLocalName;
rtl::OUString aValue = xAttrList->getValueByIndex( i );
- USHORT nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
{