summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/Library_xo.mk2
-rw-r--r--xmloff/inc/SchXMLImport.hxx8
-rw-r--r--xmloff/inc/xmloff/SchXMLImportHelper.hxx2
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx6
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx128
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx15
-rwxr-xr-xxmloff/source/chart/SchXMLEnumConverter.cxx104
-rwxr-xr-xxmloff/source/chart/SchXMLEnumConverter.hxx39
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx230
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx22
-rwxr-xr-xxmloff/source/chart/SchXMLLegendContext.cxx229
-rwxr-xr-xxmloff/source/chart/SchXMLLegendContext.hxx46
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx9
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx2
-rw-r--r--xmloff/source/chart/makefile.mk2
-rw-r--r--xmloff/source/core/xmlexp.cxx9
-rw-r--r--xmloff/source/core/xmltoken.cxx6
-rw-r--r--xmloff/source/draw/shapeexport.cxx2
-rw-r--r--xmloff/source/style/xmlnume.cxx24
-rw-r--r--xmloff/source/style/xmlnumi.cxx16
-rw-r--r--xmloff/source/text/XMLAutoTextEventExport.cxx3
-rw-r--r--xmloff/source/text/txtprhdl.cxx3
-rw-r--r--xmloff/source/transform/PropertyActionsOOo.cxx2
23 files changed, 641 insertions, 268 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index 9576341f0ffb..0544171dbfbd 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -69,8 +69,10 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/chart/SchXMLAxisContext \
xmloff/source/chart/SchXMLCalculationSettingsContext \
xmloff/source/chart/SchXMLChartContext \
+ xmloff/source/chart/SchXMLEnumConverter \
xmloff/source/chart/SchXMLExport \
xmloff/source/chart/SchXMLImport \
+ xmloff/source/chart/SchXMLLegendContext \
xmloff/source/chart/SchXMLParagraphContext \
xmloff/source/chart/SchXMLPlotAreaContext \
xmloff/source/chart/SchXMLSeries2Context \
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 936217fb8dc5..6b11e885f72e 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -127,14 +127,6 @@ enum SchXMLPlotAreaAttrTokenMap
XML_TOK_PA_LIGHTING_MODE
};
-enum SchXMLLegendAttrMap
-{
- XML_TOK_LEGEND_POSITION,
- XML_TOK_LEGEND_X,
- XML_TOK_LEGEND_Y,
- XML_TOK_LEGEND_STYLE_NAME
-};
-
enum SchXMLAutoStyleAttrMap
{
XML_TOK_AS_FAMILY,
diff --git a/xmloff/inc/xmloff/SchXMLImportHelper.hxx b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
index a618d363137f..afc637aead74 100644
--- a/xmloff/inc/xmloff/SchXMLImportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLImportHelper.hxx
@@ -83,7 +83,6 @@ private:
SvXMLTokenMap* mpChartAttrTokenMap;
SvXMLTokenMap* mpPlotAreaAttrTokenMap;
- SvXMLTokenMap* mpLegendAttrTokenMap;
SvXMLTokenMap* mpAutoStyleAttrTokenMap;
SvXMLTokenMap* mpCellAttrTokenMap;
SvXMLTokenMap* mpSeriesAttrTokenMap;
@@ -124,7 +123,6 @@ public:
const SvXMLTokenMap& GetChartAttrTokenMap();
const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
- const SvXMLTokenMap& GetLegendAttrTokenMap();
const SvXMLTokenMap& GetAutoStyleAttrTokenMap();
const SvXMLTokenMap& GetCellAttrTokenMap();
const SvXMLTokenMap& GetSeriesAttrTokenMap();
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index ecadbbdc196f..ca321245fdb2 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3113,6 +3113,12 @@ namespace xmloff { namespace token {
XML_OUTSIDE_MINIMUM,//#i114142#
XML_OUTSIDE_MAXIMUM,//#i114142#
+ XML_LEGEND_EXPANSION, //#i28760#
+ XML_LEGEND_EXPANSION_ASPECT_RATIO, //#i28760#
+ XML_BALANCED, //#i28760#
+ XML_HIGH, //#i28760#
+ XML_WIDE, //#i28760#
+
XML_AXIS_TYPE, //#i25706#
XML_DATE_SCALE,
XML_BASE_TIME_UNIT,
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 6b42b2e629df..9f9d1cf2bb1d 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -30,6 +30,7 @@
#include "SchXMLChartContext.hxx"
#include "SchXMLImport.hxx"
+#include "SchXMLLegendContext.hxx"
#include "SchXMLPlotAreaContext.hxx"
#include "SchXMLParagraphContext.hxx"
#include "SchXMLTableContext.hxx"
@@ -52,7 +53,6 @@
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagram.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <com/sun/star/chart/ChartLegendPosition.hpp>
#include <com/sun/star/util/XStringMapping.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
@@ -60,7 +60,6 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/XVisualObject.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp>
@@ -234,19 +233,6 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const ::rtl::OUStrin
} // anonymous namespace
-static __FAR_DATA SvXMLEnumMapEntry aXMLLegendAlignmentMap[] =
-{
-// { XML_LEFT, chart::ChartLegendPosition_LEFT },
- // #i35421#
- { XML_START, chart::ChartLegendPosition_LEFT },
- { XML_TOP, chart::ChartLegendPosition_TOP },
-// { XML_RIGHT, chart::ChartLegendPosition_RIGHT },
- // #i35421#
- { XML_END, chart::ChartLegendPosition_RIGHT },
- { XML_BOTTOM, chart::ChartLegendPosition_BOTTOM },
- { XML_TOKEN_INVALID, 0 }
-};
-
// ----------------------------------------
SchXMLChartContext::SchXMLChartContext( SchXMLImportHelper& rImpHelper,
@@ -1273,115 +1259,3 @@ SvXMLImportContext* SchXMLTitleContext::CreateChildContext(
}
// ----------------------------------------
-
-SchXMLLegendContext::SchXMLLegendContext( SchXMLImportHelper& rImpHelper,
- SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
- SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
- mrImportHelper( rImpHelper )
-{
-}
-
-void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
- if( ! xDoc.is())
- return;
-
- // turn on legend
- uno::Reference< beans::XPropertySet > xDocProp( xDoc, uno::UNO_QUERY );
- if( xDocProp.is())
- {
- uno::Any aTrueBool;
- aTrueBool <<= (sal_Bool)(sal_True);
- try
- {
- xDocProp->setPropertyValue( rtl::OUString::createFromAscii( "HasLegend" ), aTrueBool );
- }
- catch( beans::UnknownPropertyException )
- {
- DBG_ERROR( "Property HasLegend not found" );
- }
- }
-
- // parse attributes
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetLegendAttrTokenMap();
-
- awt::Point aLegendPos;
- bool bHasXPosition=false;
- bool bHasYPosition=false;
-
- rtl::OUString sAutoStyleName;
-
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
- {
- rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
- rtl::OUString aLocalName;
- rtl::OUString aValue = xAttrList->getValueByIndex( i );
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
- {
- case XML_TOK_LEGEND_POSITION:
- {
- // set anchor position
- uno::Reference< beans::XPropertySet > xProp( xDoc->getLegend(), uno::UNO_QUERY );
- if( xProp.is())
- {
- try
- {
- sal_uInt16 nEnumVal;
- if( GetImport().GetMM100UnitConverter().convertEnum( nEnumVal, aValue, aXMLLegendAlignmentMap ))
- {
- uno::Any aAny;
- aAny <<= (chart::ChartLegendPosition)(nEnumVal);
- xProp->setPropertyValue( rtl::OUString::createFromAscii( "Alignment" ), aAny );
- }
- }
- catch( beans::UnknownPropertyException )
- {
- DBG_ERROR( "Property Alignment (legend) not found" );
- }
- }
- }
- break;
-
- case XML_TOK_LEGEND_X:
- GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.X, aValue );
- bHasXPosition = true;
- break;
- case XML_TOK_LEGEND_Y:
- GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.Y, aValue );
- bHasYPosition = true;
- break;
- case XML_TOK_LEGEND_STYLE_NAME:
- sAutoStyleName = aValue;
- }
- }
-
- uno::Reference< drawing::XShape > xLegendShape( xDoc->getLegend(), uno::UNO_QUERY );
- if( xLegendShape.is() && bHasXPosition && bHasYPosition )
- xLegendShape->setPosition( aLegendPos );
-
- // set auto-styles for Legend
- uno::Reference< beans::XPropertySet > xProp( xLegendShape, uno::UNO_QUERY );
- if( xProp.is())
- {
- // the fill style has the default "none" in XML, but "solid" in the model.
- xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )),
- uno::makeAny( drawing::FillStyle_NONE ));
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- if( pStylesCtxt )
- {
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- mrImportHelper.GetChartFamilyID(), sAutoStyleName );
-
- if( pStyle && pStyle->ISA( XMLPropStyleContext ))
- (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp );
- }
- }
-}
-
-SchXMLLegendContext::~SchXMLLegendContext()
-{
-}
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index 41f84f783a67..e34b50c4f62d 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -171,19 +171,4 @@ public:
const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
};
-// ----------------------------------------
-
-class SchXMLLegendContext : public SvXMLImportContext
-{
-private:
- SchXMLImportHelper& mrImportHelper;
-
-public:
- SchXMLLegendContext( SchXMLImportHelper& rImpHelper,
- SvXMLImport& rImport, const rtl::OUString& rLocalName );
- virtual ~SchXMLLegendContext();
-
- virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
-};
-
#endif // _SCH_XMLCHARTCONTEXT_HXX_
diff --git a/xmloff/source/chart/SchXMLEnumConverter.cxx b/xmloff/source/chart/SchXMLEnumConverter.cxx
new file mode 100755
index 000000000000..fd4d7914a2fe
--- /dev/null
+++ b/xmloff/source/chart/SchXMLEnumConverter.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "SchXMLEnumConverter.hxx"
+
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+// header for rtl::Static
+#include <rtl/instance.hxx>
+
+using ::rtl::OUString;
+using namespace ::xmloff::token;
+using namespace ::com::sun::star;
+
+namespace
+{
+//-----------------------------------------------------------------------
+
+SvXMLEnumMapEntry aXMLLegendPositionEnumMap[] =
+{
+ { XML_START, chart::ChartLegendPosition_LEFT },
+ { XML_TOP, chart::ChartLegendPosition_TOP },
+ { XML_END, chart::ChartLegendPosition_RIGHT },
+ { XML_BOTTOM, chart::ChartLegendPosition_BOTTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLLegendPositionPropertyHdl : public XMLEnumPropertyHdl
+{
+public:
+ XMLLegendPositionPropertyHdl()
+ : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap, ::getCppuType((const chart::ChartLegendPosition*)0) ) {}
+ virtual ~XMLLegendPositionPropertyHdl() {};
+};
+
+struct TheLegendPositionPropertyHdl : public rtl::Static< XMLLegendPositionPropertyHdl, TheLegendPositionPropertyHdl >
+{
+};
+
+//-----------------------------------------------------------------------
+
+SvXMLEnumMapEntry aXMLLegendExpansionEnumMap[] =
+{
+ { XML_WIDE, chart::ChartLegendExpansion_WIDE },
+ { XML_HIGH, chart::ChartLegendExpansion_HIGH },
+ { XML_BALANCED, chart::ChartLegendExpansion_BALANCED },
+ { XML_CUSTOM, chart::ChartLegendExpansion_CUSTOM },
+ { XML_TOKEN_INVALID, 0 }
+};
+
+class XMLLegendExpansionPropertyHdl : public XMLEnumPropertyHdl
+{
+public:
+ XMLLegendExpansionPropertyHdl()
+ : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap, ::getCppuType((const chart::ChartLegendExpansion*)0) ) {}
+ virtual ~XMLLegendExpansionPropertyHdl() {};
+};
+
+struct TheLegendExpansionPropertyHdl : public rtl::Static< XMLLegendExpansionPropertyHdl, TheLegendExpansionPropertyHdl >
+{
+};
+
+//-----------------------------------------------------------------------
+
+}//end anonymous namespace
+
+//-----------------------------------------------------------------------
+
+XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter()
+{
+ return TheLegendPositionPropertyHdl::get();
+}
+XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter()
+{
+ return TheLegendExpansionPropertyHdl::get();
+}
diff --git a/xmloff/source/chart/SchXMLEnumConverter.hxx b/xmloff/source/chart/SchXMLEnumConverter.hxx
new file mode 100755
index 000000000000..63a9fb7ffb95
--- /dev/null
+++ b/xmloff/source/chart/SchXMLEnumConverter.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _XML_CHART_ENUM_CONVERTER_HXX_
+#define _XML_CHART_ENUM_CONVERTER_HXX_
+
+#include <xmloff/EnumPropertyHdl.hxx>
+
+class SchXMLEnumConverter
+{
+public:
+ static XMLEnumPropertyHdl& getLegendPositionConverter();//returns a singleton
+ static XMLEnumPropertyHdl& getLegendExpansionConverter();//returns a singleton
+};
+
+#endif // _XML_CHART_ENUM_CONVERTER_HXX_
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index cc13eb2de733..9e9ea12d40e2 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -35,6 +35,8 @@
#include "SchXMLSeriesHelper.hxx"
#include "ColorPropertySet.hxx"
#include "SchXMLTools.hxx"
+#include "SchXMLEnumConverter.hxx"
+
#include <tools/debug.hxx>
#include <rtl/logfile.hxx>
#include <comphelper/processfactory.hxx>
@@ -68,6 +70,7 @@
#include <com/sun/star/chart/XAxisSupplier.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/ChartAxisAssign.hpp>
#include <com/sun/star/chart/ChartAxisType.hpp>
@@ -245,8 +248,8 @@ public:
void addPosition( const ::com::sun::star::awt::Point & rPosition );
void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
/// add svg size as attribute for current element
- void addSize( const ::com::sun::star::awt::Size & rSize );
- void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
+ void addSize( const ::com::sun::star::awt::Size & rSize, bool bIsOOoNamespace = false );
+ void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, bool bIsOOoNamespace = false );
/// fills the member msString with the appropriate String (i.e. "A3")
void getCellAddress( sal_Int32 nCol, sal_Int32 nRow );
/// exports a string as a paragraph element
@@ -599,24 +602,20 @@ OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence )
return aResult.makeStringAndClear();
}
-OUString lcl_getLabelString( const Reference< chart2::data::XDataSequence > & xLabelSeq )
+void lcl_getLabelStringSequence( Sequence< OUString >& rOutLabels, const Reference< chart2::data::XDataSequence > & xLabelSeq )
{
- Sequence< OUString > aLabels;
-
uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xLabelSeq, uno::UNO_QUERY );
if( xTextualDataSequence.is())
{
- aLabels = xTextualDataSequence->getTextualData();
+ rOutLabels = xTextualDataSequence->getTextualData();
}
else if( xLabelSeq.is())
{
Sequence< uno::Any > aAnies( xLabelSeq->getData());
- aLabels.realloc( aAnies.getLength());
+ rOutLabels.realloc( aAnies.getLength());
for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
- aAnies[i] >>= aLabels[i];
+ aAnies[i] >>= rOutLabels[i];
}
-
- return lcl_flattenStringSequence( aLabels );
}
sal_Int32 lcl_getMaxSequenceLength(
@@ -636,46 +635,96 @@ sal_Int32 lcl_getMaxSequenceLength(
return nResult;
}
-double lcl_getValueFromSequence( const Reference< chart2::data::XDataSequence > & xSeq, sal_Int32 nIndex )
+uno::Sequence< rtl::OUString > lcl_DataSequenceToStringSequence(
+ const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
{
- double fResult = 0.0;
- ::rtl::math::setNan( &fResult );
- Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
- if( xNumSeq.is())
+ uno::Sequence< rtl::OUString > aResult;
+ if(!xDataSequence.is())
+ return aResult;
+
+ uno::Reference< chart2::data::XTextualDataSequence > xTextualDataSequence( xDataSequence, uno::UNO_QUERY );
+ if( xTextualDataSequence.is() )
{
- Sequence< double > aValues( xNumSeq->getNumericalData());
- if( nIndex < aValues.getLength() )
- fResult = aValues[nIndex];
+ aResult = xTextualDataSequence->getTextualData();
}
else
{
- Sequence< uno::Any > aAnies( xSeq->getData());
- if( nIndex < aAnies.getLength() )
- aAnies[nIndex] >>= fResult;
+ uno::Sequence< uno::Any > aValues = xDataSequence->getData();
+ aResult.realloc(aValues.getLength());
+
+ for(sal_Int32 nN=aValues.getLength();nN--;)
+ aValues[nN] >>= aResult[nN];
}
- return fResult;
-}
+ return aResult;
+}
::std::vector< double > lcl_getAllValuesFromSequence( const Reference< chart2::data::XDataSequence > & xSeq )
{
double fNan = 0.0;
::rtl::math::setNan( &fNan );
::std::vector< double > aResult;
+ if(!xSeq.is())
+ return aResult;
+ uno::Sequence< double > aValuesSequence;
Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
- if( xNumSeq.is())
+ if( xNumSeq.is() )
{
- Sequence< double > aValues( xNumSeq->getNumericalData());
- ::std::copy( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(),
- ::std::back_inserter( aResult ));
+ aValuesSequence = xNumSeq->getNumericalData();
}
- else if( xSeq.is())
+ else
{
- Sequence< uno::Any > aAnies( xSeq->getData());
- aResult.resize( aAnies.getLength(), fNan );
+ Sequence< uno::Any > aAnies( xSeq->getData() );
+ aValuesSequence.realloc( aAnies.getLength() );
for( sal_Int32 i=0; i<aAnies.getLength(); ++i )
- aAnies[i] >>= aResult[i];
+ aAnies[i] >>= aValuesSequence[i];
}
+
+ //special handling for x-values (if x-values do point to categories, indices are used instead )
+ Reference< beans::XPropertySet > xProp( xSeq, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ OUString aRole;
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Role") ) ) >>= aRole;
+ if( aRole.match( OUString( RTL_CONSTASCII_USTRINGPARAM( "values-x") ) ) )
+ {
+ //lcl_clearIfNoValuesButTextIsContained - replace by indices if the values are not appropriate
+ bool bHasValue=false;
+ bool bHasText=false;
+ sal_Int32 nCount = aValuesSequence.getLength();
+ for( sal_Int32 j = 0; j < nCount; ++j )
+ {
+ if( !::rtl::math::isNan( aValuesSequence[j] ) )
+ {
+ bHasValue=true;
+ break;
+ }
+ }
+ if(!bHasValue)
+ {
+ //no double value is countained
+ //is there any text?
+ uno::Sequence< rtl::OUString > aStrings( lcl_DataSequenceToStringSequence( xSeq ) );
+ sal_Int32 nTextCount = aStrings.getLength();
+ for( sal_Int32 j = 0; j < nTextCount; ++j )
+ {
+ if( aStrings[j].getLength() )
+ {
+ bHasText=true;
+ break;
+ }
+ }
+ }
+ if( !bHasValue && bHasText )
+ {
+ for( sal_Int32 j = 0; j < nCount; ++j )
+ aValuesSequence[j] = j+1;
+ }
+ }
+ }
+
+ ::std::copy( aValuesSequence.getConstArray(), aValuesSequence.getConstArray() + aValuesSequence.getLength(),
+ ::std::back_inserter( aResult ));
return aResult;
}
@@ -800,15 +849,20 @@ lcl_TableData lcl_getDataForLocalTable(
Sequence< OUString > aSimpleCategories;
if( xAnyDescriptionAccess.is() )
{
+ //categories
if( bSeriesFromColumns )
+ {
aSimpleCategories = xAnyDescriptionAccess->getRowDescriptions();
+ aResult.aComplexRowDescriptions = xAnyDescriptionAccess->getAnyRowDescriptions();
+ }
else
+ {
aSimpleCategories = xAnyDescriptionAccess->getColumnDescriptions();
-
- aResult.aComplexColumnDescriptions = xAnyDescriptionAccess->getAnyColumnDescriptions();
- aResult.aComplexRowDescriptions = xAnyDescriptionAccess->getAnyRowDescriptions();
+ aResult.aComplexColumnDescriptions = xAnyDescriptionAccess->getAnyColumnDescriptions();
+ }
}
+ //series values and series labels
SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size();
SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin());
SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end());
@@ -853,19 +907,25 @@ lcl_TableData lcl_getDataForLocalTable(
// iterate over all sequences
size_t nSeqIdx = 0;
+ Sequence< Sequence< OUString > > aComplexLabels(nNumSequences);
for( ; aIt != aEnd; ++aIt, ++nSeqIdx )
{
OUString aRange;
+ Sequence< OUString >& rCurrentComplexLabel = aComplexLabels[nSeqIdx];
if( aIt->first.is())
{
- rLabels[nSeqIdx] = lcl_getLabelString( aIt->first );
+ lcl_getLabelStringSequence( rCurrentComplexLabel, aIt->first );
+ rLabels[nSeqIdx] = lcl_flattenStringSequence( rCurrentComplexLabel );
aRange = aIt->first->getSourceRangeRepresentation();
if( xRangeConversion.is())
aRange = xRangeConversion->convertRangeToXML( aRange );
}
else if( aIt->second.is())
- rLabels[nSeqIdx] = lcl_flattenStringSequence(
+ {
+ rCurrentComplexLabel.realloc(1);
+ rLabels[nSeqIdx] = rCurrentComplexLabel[0] = lcl_flattenStringSequence(
aIt->second->generateLabel( chart2::data::LabelOrigin_SHORT_SIDE ));
+ }
if( bSeriesFromColumns )
aResult.aColumnDescriptions_Ranges.push_back( aRange );
else
@@ -893,6 +953,16 @@ lcl_TableData lcl_getDataForLocalTable(
if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) )
aResult.aHiddenColumns.push_back(nSeqIdx);
}
+ Sequence< Sequence< Any > >& rComplexAnyLabels = bSeriesFromColumns ? aResult.aComplexColumnDescriptions : aResult.aComplexRowDescriptions;//#i116544#
+ rComplexAnyLabels.realloc(aComplexLabels.getLength());
+ for( sal_Int32 nN=0; nN<aComplexLabels.getLength();nN++ )
+ {
+ Sequence< OUString >& rSource = aComplexLabels[nN];
+ Sequence< Any >& rTarget = rComplexAnyLabels[nN];
+ rTarget.realloc( rSource.getLength() );
+ for( sal_Int32 i=0; i<rSource.getLength(); i++ )
+ rTarget[i] = uno::makeAny( rSource[i] );
+ }
}
catch( uno::Exception & rEx )
{
@@ -1427,51 +1497,50 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >&
Reference< beans::XPropertySet > xProp( rChartDoc->getLegend(), uno::UNO_QUERY );
if( xProp.is())
{
- chart::ChartLegendPosition aLegendPos = chart::ChartLegendPosition_NONE;
+ // export legend anchor position
try
{
- Any aAny( xProp->getPropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "Alignment" ))));
- aAny >>= aLegendPos;
+ Any aAny( xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Alignment" ))));
+ if( SchXMLEnumConverter::getLegendPositionConverter().exportXML( msString, aAny, mrExport.GetMM100UnitConverter() ) )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LEGEND_POSITION, msString );
}
catch( beans::UnknownPropertyException & )
{
DBG_WARNING( "Property Align not found in ChartLegend" );
}
- switch( aLegendPos )
+ // export absolute legend position
+ Reference< drawing::XShape > xLegendShape( xProp, uno::UNO_QUERY );
+ addPosition( xLegendShape );
+
+ // export legend size
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( xLegendShape.is() && nCurrentODFVersion >= SvtSaveOptions::ODFVER_012 && nCurrentODFVersion == SvtSaveOptions::ODFVER_LATEST )//do not export legend-expansion to ODF 1.0 and export size only if extensions are enabled //#i28670# todo: change this dependent on fileformat evolution
{
- case chart::ChartLegendPosition_LEFT:
-// msString = GetXMLToken(XML_LEFT);
- // #i35421# change left->start (not clear why this was done)
- msString = GetXMLToken(XML_START);
- break;
- case chart::ChartLegendPosition_RIGHT:
-// msString = GetXMLToken(XML_RIGHT);
- // #i35421# change right->end (not clear why this was done)
- msString = GetXMLToken(XML_END);
- break;
- case chart::ChartLegendPosition_TOP:
- msString = GetXMLToken(XML_TOP);
- break;
- case chart::ChartLegendPosition_BOTTOM:
- msString = GetXMLToken(XML_BOTTOM);
- break;
- case chart::ChartLegendPosition_NONE:
- case chart::ChartLegendPosition_MAKE_FIXED_SIZE:
- // nothing
- break;
+ try
+ {
+ chart::ChartLegendExpansion nLegendExpansion = chart::ChartLegendExpansion_HIGH;
+ OUString aExpansionString;
+ Any aAny( xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Expansion" ))));
+ bool bHasExpansion = (aAny >>= nLegendExpansion);
+ if( bHasExpansion && SchXMLEnumConverter::getLegendExpansionConverter().exportXML( aExpansionString, aAny, mrExport.GetMM100UnitConverter() ) )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, aExpansionString );
+ if( nLegendExpansion == chart::ChartLegendExpansion_CUSTOM)
+ {
+ awt::Size aSize( xLegendShape->getSize() );
+ addSize( aSize, true );
+ rtl::OUStringBuffer aAspectRatioString;
+ SvXMLUnitConverter::convertDouble(aAspectRatioString, double(aSize.Width)/double(aSize.Height));
+ mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, aAspectRatioString.makeStringAndClear() );
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_WARNING( "Property Expansion not found in ChartLegend" );
+ }
}
-
- // export anchor position
- if( msString.getLength())
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LEGEND_POSITION, msString );
-
- // export absolute position
- msString = OUString();
- Reference< drawing::XShape > xShape( xProp, uno::UNO_QUERY );
- if( xShape.is())
- addPosition( xShape );
}
// write style name
@@ -1767,7 +1836,7 @@ void SchXMLExportHelper_Impl::exportTable()
for( t2DNumberContainer::const_iterator aRowIt( aData.aDataInRows.begin())
; aRowIt != aData.aDataInRows.end()
- ; aRowIt++, nC++, aRowDescriptionsIter++ )
+ ; ++aRowIt, ++nC )
{
SvXMLElementExport aRow( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True );
@@ -1805,8 +1874,10 @@ void SchXMLExportHelper_Impl::exportTable()
if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd )
{
// remind the original range to allow a correct re-association when copying via clipboard
- SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter++ );
+ SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter );
+ ++aRowDescriptions_RangeIter;
}
+ ++aRowDescriptionsIter;
}
}
@@ -3535,21 +3606,22 @@ void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape )
addPosition( xShape->getPosition());
}
-void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize )
+void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize, bool bIsOOoNamespace)
{
mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width );
msString = msStringBuffer.makeStringAndClear();
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, msString );
+ mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG , XML_WIDTH, msString );
+
- mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height );
+ mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height);
msString = msStringBuffer.makeStringAndClear();
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, msString );
+ mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG, XML_HEIGHT, msString );
}
-void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape )
+void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape, bool bIsOOoNamespace )
{
if( xShape.is())
- addSize( xShape->getSize() );
+ addSize( xShape->getSize(), bIsOOoNamespace );
}
awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index a033dcb60e7d..12bea7e50e1b 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -146,7 +146,6 @@ SchXMLImportHelper::SchXMLImportHelper() :
mpChartAttrTokenMap( 0 ),
mpPlotAreaAttrTokenMap( 0 ),
- mpLegendAttrTokenMap( 0 ),
mpAutoStyleAttrTokenMap( 0 ),
mpCellAttrTokenMap( 0 ),
mpSeriesAttrTokenMap( 0 ),
@@ -172,8 +171,6 @@ SchXMLImportHelper::~SchXMLImportHelper()
delete mpChartAttrTokenMap;
if( mpPlotAreaAttrTokenMap )
delete mpPlotAreaAttrTokenMap;
- if( mpLegendAttrTokenMap )
- delete mpLegendAttrTokenMap;
if( mpAutoStyleAttrTokenMap )
delete mpAutoStyleAttrTokenMap;
if( mpCellAttrTokenMap )
@@ -371,25 +368,6 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaAttrTokenMap()
return *mpPlotAreaAttrTokenMap;
}
-const SvXMLTokenMap& SchXMLImportHelper::GetLegendAttrTokenMap()
-{
- if( ! mpLegendAttrTokenMap )
- {
- static __FAR_DATA SvXMLTokenMapEntry aLegendAttrTokenMap[] =
-{
- { XML_NAMESPACE_CHART, XML_LEGEND_POSITION, XML_TOK_LEGEND_POSITION },
- { XML_NAMESPACE_SVG, XML_X, XML_TOK_LEGEND_X },
- { XML_NAMESPACE_SVG, XML_Y, XML_TOK_LEGEND_Y },
- { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_LEGEND_STYLE_NAME },
- XML_TOKEN_MAP_END
-};
-
- mpLegendAttrTokenMap = new SvXMLTokenMap( aLegendAttrTokenMap );
- } // if( ! mpLegendAttrTokenMap )
-
- return *mpLegendAttrTokenMap;
-}
-
const SvXMLTokenMap& SchXMLImportHelper::GetAutoStyleAttrTokenMap()
{
if( ! mpAutoStyleAttrTokenMap )
diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx
new file mode 100755
index 000000000000..6220fdfca46a
--- /dev/null
+++ b/xmloff/source/chart/SchXMLLegendContext.cxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "SchXMLLegendContext.hxx"
+#include "SchXMLEnumConverter.hxx"
+
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+using namespace ::xmloff::token;
+using namespace com::sun::star;
+
+using rtl::OUString;
+using com::sun::star::uno::Reference;
+
+//----------------------------------------
+
+namespace
+{
+
+enum LegendAttributeTokens
+{
+ XML_TOK_LEGEND_POSITION,
+ XML_TOK_LEGEND_X,
+ XML_TOK_LEGEND_Y,
+ XML_TOK_LEGEND_STYLE_NAME,
+ XML_TOK_LEGEND_EXPANSION,
+ XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO,
+ XML_TOK_LEGEND_WIDTH,
+ XML_TOK_LEGEND_WIDTH_EXT,
+ XML_TOK_LEGEND_HEIGHT,
+ XML_TOK_LEGEND_HEIGHT_EXT
+};
+
+SvXMLTokenMapEntry aLegendAttributeTokenMap[] =
+{
+ { XML_NAMESPACE_CHART, XML_LEGEND_POSITION, XML_TOK_LEGEND_POSITION },
+ { XML_NAMESPACE_SVG, XML_X, XML_TOK_LEGEND_X },
+ { XML_NAMESPACE_SVG, XML_Y, XML_TOK_LEGEND_Y },
+ { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_LEGEND_STYLE_NAME },
+ { XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, XML_TOK_LEGEND_EXPANSION },
+ { XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION_ASPECT_RATIO, XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO },
+ { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_LEGEND_WIDTH },
+ { XML_NAMESPACE_CHART_EXT, XML_WIDTH, XML_TOK_LEGEND_WIDTH_EXT },
+ { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_LEGEND_HEIGHT },
+ { XML_NAMESPACE_CHART_EXT, XML_HEIGHT, XML_TOK_LEGEND_HEIGHT_EXT },
+ XML_TOKEN_MAP_END
+};
+
+class LegendAttributeTokenMap : public SvXMLTokenMap
+{
+public:
+ LegendAttributeTokenMap(): SvXMLTokenMap( aLegendAttributeTokenMap ) {}
+ virtual ~LegendAttributeTokenMap() {}
+};
+
+//a LegendAttributeTokenMap Singleton
+struct theLegendAttributeTokenMap : public rtl::Static< LegendAttributeTokenMap, theLegendAttributeTokenMap > {};
+
+}//end anonymous namespace
+
+//----------------------------------------
+
+SchXMLLegendContext::SchXMLLegendContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName ) :
+ SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ),
+ mrImportHelper( rImpHelper )
+{
+}
+
+void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+ if( !xDoc.is() )
+ return;
+
+ // turn on legend
+ uno::Reference< beans::XPropertySet > xDocProp( xDoc, uno::UNO_QUERY );
+ if( xDocProp.is() )
+ {
+ try
+ {
+ xDocProp->setPropertyValue( rtl::OUString::createFromAscii( "HasLegend" ), uno::makeAny( sal_True ) );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ DBG_ERROR( "Property HasLegend not found" );
+ }
+ }
+
+ uno::Reference< drawing::XShape > xLegendShape( xDoc->getLegend(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xLegendProps( xLegendShape, uno::UNO_QUERY );
+ if( !xLegendShape.is() || !xLegendProps.is() )
+ {
+ DBG_ERROR( "legend could not be created" );
+ return;
+ }
+
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ const SvXMLTokenMap& rAttrTokenMap = theLegendAttributeTokenMap::get();
+
+ awt::Point aLegendPos;
+ bool bHasXPosition=false;
+ bool bHasYPosition=false;
+ awt::Size aLegendSize;
+ bool bHasWidth=false;
+ bool bHasHeight=false;
+ chart::ChartLegendExpansion nLegendExpansion = chart::ChartLegendExpansion_HIGH;
+ bool bHasExpansion=false;
+
+ rtl::OUString sAutoStyleName;
+ uno::Any aAny;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_LEGEND_POSITION:
+ {
+ try
+ {
+ if( SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() ) )
+ xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Alignment" ), aAny );
+ }
+ catch( beans::UnknownPropertyException )
+ {
+ DBG_ERROR( "Property Alignment (legend) not found" );
+ }
+ }
+ break;
+
+ case XML_TOK_LEGEND_X:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.X, aValue );
+ bHasXPosition = true;
+ break;
+ case XML_TOK_LEGEND_Y:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.Y, aValue );
+ bHasYPosition = true;
+ break;
+ case XML_TOK_LEGEND_STYLE_NAME:
+ sAutoStyleName = aValue;
+ break;
+ case XML_TOK_LEGEND_EXPANSION:
+ SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() );
+ bHasExpansion = (aAny>>=nLegendExpansion);
+ break;
+ case XML_TOK_LEGEND_EXPANSION_ASPECT_RATIO:
+ break;
+ case XML_TOK_LEGEND_WIDTH:
+ case XML_TOK_LEGEND_WIDTH_EXT:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Width, aValue );
+ bHasWidth = true;
+ break;
+ case XML_TOK_LEGEND_HEIGHT:
+ case XML_TOK_LEGEND_HEIGHT_EXT:
+ GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Height, aValue );
+ bHasHeight = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if( bHasXPosition && bHasYPosition )
+ xLegendShape->setPosition( aLegendPos );
+
+ if( bHasExpansion && nLegendExpansion!= chart::ChartLegendExpansion_CUSTOM )
+ xLegendProps->setPropertyValue( rtl::OUString::createFromAscii( "Expansion" ), uno::makeAny(nLegendExpansion) );
+ else if( bHasHeight && bHasWidth )
+ xLegendShape->setSize( aLegendSize );
+
+ // the fill style has the default "none" in XML, but "solid" in the model.
+ xLegendProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )), uno::makeAny( drawing::FillStyle_NONE ));
+
+ // set auto-styles for Legend
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+
+ if( pStyle && pStyle->ISA( XMLPropStyleContext ))
+ (( XMLPropStyleContext* )pStyle )->FillPropertySet( xLegendProps );
+ }
+}
+
+SchXMLLegendContext::~SchXMLLegendContext()
+{
+}
diff --git a/xmloff/source/chart/SchXMLLegendContext.hxx b/xmloff/source/chart/SchXMLLegendContext.hxx
new file mode 100755
index 000000000000..1841b0cef24b
--- /dev/null
+++ b/xmloff/source/chart/SchXMLLegendContext.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _SCH_XMLLEGENDCONTEXT_HXX_
+#define _SCH_XMLLEGENDCONTEXT_HXX_
+
+#include "SchXMLImport.hxx"
+
+// ----------------------------------------
+
+class SchXMLLegendContext : public SvXMLImportContext
+{
+public:
+ SchXMLLegendContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const rtl::OUString& rLocalName );
+ virtual ~SchXMLLegendContext();
+
+ virtual void StartElement( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+};
+
+#endif // _SCH_XMLLEGENDCONTEXT_HXX_
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index d106398a0fcd..f45f9a5e5f48 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -423,7 +423,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
// values
Reference< chart2::data::XDataSequence > xSeq;
- if( bHasRange )
+ if( bHasRange && m_aSeriesRange.getLength() )
xSeq = SchXMLTools::CreateDataSequence( m_aSeriesRange, mxNewDoc );
Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
@@ -442,7 +442,7 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib
tSchXMLIndexWithPart( m_rGlobalSeriesImportInfo.nCurrentDataIndex, SCH_XML_PART_VALUES ), xLabeledSeq ));
// label
- if( bHasLabelRange )
+ if( bHasLabelRange && m_aSeriesLabelRange.getLength() )
{
Reference< chart2::data::XDataSequence > xLabelSequence =
SchXMLTools::CreateDataSequence( m_aSeriesLabelRange, mxNewDoc );
@@ -581,6 +581,11 @@ void SchXMLSeries2Context::EndElement()
aDomainInfos.push_back( aDomainInfo );
m_rGlobalSeriesImportInfo.nCurrentDataIndex++;
}
+ else if( m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress.getLength() )
+ {
+ DomainInfo aDomainInfo( OUString::createFromAscii("values-y"), m_rGlobalSeriesImportInfo.aFirstFirstDomainAddress, m_rGlobalSeriesImportInfo.nFirstFirstDomainIndex ) ;
+ aDomainInfos.push_back( aDomainInfo );
+ }
}
if( bDeleteSeries )
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index a0be5f4ec6a8..2aed07dca617 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -419,7 +419,7 @@ Reference< chart2::data::XDataSequence > CreateDataSequence(
DBG_ERROR( "could not create data sequence" );
}
- if( !xRet.is() && !xChartDoc->hasInternalDataProvider() )
+ if( !xRet.is() && !xChartDoc->hasInternalDataProvider() && rRange.getLength() )
{
//#i103911# switch to internal data in case the parent cannot provide the requested data
xChartDoc->createInternalDataProvider( sal_True /* bCloneExistingData */ );
diff --git a/xmloff/source/chart/makefile.mk b/xmloff/source/chart/makefile.mk
index 2f61a3d6f0e5..3151d633d13f 100644
--- a/xmloff/source/chart/makefile.mk
+++ b/xmloff/source/chart/makefile.mk
@@ -45,12 +45,14 @@ SLOFILES = $(SLO)$/ColorPropertySet.obj \
$(SLO)$/contexts.obj \
$(SLO)$/SchXMLTableContext.obj \
$(SLO)$/SchXMLChartContext.obj \
+ $(SLO)$/SchXMLLegendContext.obj \
$(SLO)$/SchXMLPlotAreaContext.obj \
$(SLO)$/SchXMLAxisContext.obj \
$(SLO)$/SchXMLParagraphContext.obj \
$(SLO)$/SchXMLTextListContext.obj \
$(SLO)$/SchXMLSeriesHelper.obj \
$(SLO)$/SchXMLSeries2Context.obj \
+ $(SLO)$/SchXMLEnumConverter.obj \
$(SLO)$/PropertyMaps.obj \
$(SLO)$/XMLChartStyleContext.obj \
$(SLO)$/XMLErrorIndicatorPropertyHdl.obj \
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 50e0447d4a9d..32b4d322bba2 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -117,8 +117,8 @@ sal_Char __READONLY_DATA sXML_1_2[] = "1.2";
const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project";
-const sal_Char s_grddl_xsl[] =
- "http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl";
+// #i115030#: the XSLT is not finished, and not available via HTTP
+const sal_Char s_grddl_xsl[] = "http://FIXME";
#define LOGFILE_AUTHOR "mb93740"
@@ -1315,7 +1315,7 @@ void SvXMLExport::SetBodyAttributes()
}
static void
-lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 nExportMode)
+lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 /*nExportMode*/)
{
// check version >= 1.2
switch (rExport.getDefaultVersion()) {
@@ -1324,11 +1324,14 @@ lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 nExportMode)
default: break;
}
+ // #i115030#: disabled
+#if 0
if (EXPORT_SETTINGS != nExportMode) // meta, content, styles
{
rExport.AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
OUString::createFromAscii(s_grddl_xsl) );
}
+#endif
}
sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 824d28a51a5c..bc1e40114c5f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3113,6 +3113,12 @@ namespace xmloff { namespace token {
TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ),
TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ),
+ TOKEN( "legend-expansion", XML_LEGEND_EXPANSION),
+ TOKEN( "legend-expansion-aspect-ratio", XML_LEGEND_EXPANSION_ASPECT_RATIO),
+ TOKEN( "balanced", XML_BALANCED),
+ TOKEN( "high", XML_HIGH),
+ TOKEN( "wide", XML_WIDE),
+
TOKEN( "axis-type", XML_AXIS_TYPE ), //#i25706#
TOKEN( "date-scale", XML_DATE_SCALE ),
TOKEN( "base-time-unit", XML_BASE_TIME_UNIT ),
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index aebd513995e3..a8f09f2d99bd 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -711,7 +711,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) )
{
if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
- aShapeInfo.meShapeType != XmlShapeTypeHandoutShape )
+ aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape )
try
{
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index d4e880f09b52..59849df1a20e 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -298,15 +298,25 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
sTmp.append( nLevel + 1 );
GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
// #i110694#: no style-name on list-level-style-image
- if ((sTextStyleName.getLength() > 0) && (NumberingType::BITMAP != eType))
+ // #i116149#: neither prefix/suffix
+ if (NumberingType::BITMAP != eType)
{
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
- GetExport().EncodeStyleName( sTextStyleName ) );
+ if (sTextStyleName.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ GetExport().EncodeStyleName( sTextStyleName ) );
+ }
+ if (sPrefix.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
+ sPrefix );
+ }
+ if (sSuffix.getLength() > 0)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
+ sSuffix );
+ }
}
- if( sPrefix.getLength() > 0 )
- GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sPrefix );
- if( sSuffix.getLength() > 0 )
- GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, sSuffix );
enum XMLTokenEnum eElem = XML_LIST_LEVEL_STYLE_NUMBER;
if( NumberingType::CHAR_SPECIAL == eType )
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 0d45fdc289d0..1417f239082a 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -501,6 +501,22 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
nCount++;
}
+ if (bBullet && sSuffix.getLength())
+ {
+ sal_uInt16 const nVersion(GetImport().getGeneratorVersion());
+ sal_Int32 nUPD;
+ sal_Int32 nBuildId;
+ if (GetImport().getBuildIds(nUPD, nBuildId)
+ && ( (SvXMLImport::OOo_1x == nVersion)
+ || (SvXMLImport::OOo_2x == nVersion)
+ || (310 == nUPD) || (320 == nUPD) || (330 == nUPD)
+ || ((300 == nUPD) && (nBuildId <= 9573))))
+ {
+ // #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars
+ sSuffix = ::rtl::OUString(); // clear it
+ }
+ }
+
Sequence<beans::PropertyValue> aPropSeq( nCount );
if( nCount > 0 )
{
diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx
index dcef23ba5734..eab3c77efc7f 100644
--- a/xmloff/source/text/XMLAutoTextEventExport.cxx
+++ b/xmloff/source/text/XMLAutoTextEventExport.cxx
@@ -221,6 +221,9 @@ void XMLAutoTextEventExport::addNamespaces()
GetAttrList().AddAttribute(
GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_OOO ),
GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_OOO ) );
+ GetAttrList().AddAttribute(
+ GetNamespaceMap().GetAttrNameByIndex( XML_NAMESPACE_XLINK ),
+ GetNamespaceMap().GetNameByIndex( XML_NAMESPACE_XLINK ) );
}
void XMLAutoTextEventExport::exportEvents()
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 3a26fe37c794..9c3d50d6f9ed 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -1039,7 +1039,8 @@ sal_Bool XMLTextCombineCharPropHdl_Impl::exportXML(
{
rValue >>= rStrExpValue;
- return sal_True;
+ // #i114107# attribute of type "character": export only if length is 1
+ return (1 == rStrExpValue.getLength()) ? sal_True : sal_False;
}
XMLTextCombineCharPropHdl_Impl::~XMLTextCombineCharPropHdl_Impl()
diff --git a/xmloff/source/transform/PropertyActionsOOo.cxx b/xmloff/source/transform/PropertyActionsOOo.cxx
index bc91561de206..e0b9259787eb 100644
--- a/xmloff/source/transform/PropertyActionsOOo.cxx
+++ b/xmloff/source/transform/PropertyActionsOOo.cxx
@@ -649,6 +649,8 @@ XMLTransformerActionInit aTextPropertyOOoAttrActionTable[] =
NO_PARAMS }, /* #i113645# */
{ XML_NAMESPACE_STYLE, XML_TEXT_OVERLINE_COLOR, XML_ATACTION_REMOVE,
NO_PARAMS }, /* #i113645# */
+ { XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_ATACTION_REMOVE,
+ NO_PARAMS }, /* #i116555# */
{ XML_NAMESPACE_OFFICE, XML_TOKEN_INVALID, XML_ATACTION_EOT, NO_PARAMS }
};