summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/SchXMLExport.hxx2
-rw-r--r--xmloff/inc/SchXMLImport.hxx2
-rw-r--r--xmloff/inc/xmlnmspe.hxx3
-rw-r--r--xmloff/inc/xmloff/SchXMLExportHelper.hxx179
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx5
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx348
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx4
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx194
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.hxx60
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx23
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx4
-rw-r--r--xmloff/source/draw/shapeexport2.cxx22
13 files changed, 534 insertions, 313 deletions
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx
index da776a9934..bf9c909d4b 100644
--- a/xmloff/inc/SchXMLExport.hxx
+++ b/xmloff/inc/SchXMLExport.hxx
@@ -81,7 +81,7 @@ public:
void SetProgress( sal_Int32 nPercentage );
- UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return maExportHelper.GetPropertySetMapper(); }
+ UniReference< XMLPropertySetMapper > GetPropertySetMapper() const;
// XServiceInfo ( : SvXMLExport )
virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 773e439778..2b00decf57 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -69,6 +69,8 @@ enum SchXMLChartElemTokenMap
enum SchXMLPlotAreaElemTokenMap
{
+ XML_TOK_PA_COORDINATE_REGION_EXT,
+ XML_TOK_PA_COORDINATE_REGION,
XML_TOK_PA_AXIS,
XML_TOK_PA_SERIES,
XML_TOK_PA_WALL,
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index 1d6a96ef54..be3ba5e837 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -87,8 +87,9 @@ const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key;
XML_NAMESPACE_EXT( OFFICE, 37U )
XML_NAMESPACE_EXT( TABLE, 38U )
+XML_NAMESPACE_EXT( CHART, 39U )
-#define _XML_OLD_NAMESPACE_BASE 39U
+#define _XML_OLD_NAMESPACE_BASE 40U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
index e2d175c006..698ac3b0c8 100644
--- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
@@ -40,41 +40,9 @@
#include <queue>
#include <vector>
-namespace com { namespace sun { namespace star {
- namespace chart {
- class XDiagram;
- class XChartDocument;
- struct ChartSeriesAddress;
- }
- namespace chart2 {
- class XDiagram;
- class XChartDocument;
- class XDataSeries;
- namespace data
- {
- class XDataProvider;
- class XDataSequence;
- }
- }
- namespace drawing {
- class XShape;
- class XShapes;
- }
- namespace task {
- class XStatusIndicator;
- }
- namespace frame {
- class XModel;
- }
- namespace xml {
- namespace sax {
- class XAttributeList;
-}}}}}
-
class SvXMLAutoStylePoolP;
-class XMLChartExportPropertyMapper;
class SvXMLExport;
-class XMLPropertyHandlerFactory;
+class SchXMLExportHelper_Impl;
/** With this class you can export a <chart:chart> element containing
its data as <table:table> element or without internal table. In
@@ -84,153 +52,22 @@ class XMLPropertyHandlerFactory;
class XMLOFF_DLLPUBLIC SchXMLExportHelper : public UniRefBase
{
public:
- // first: data sequence for label, second: data sequence for values.
- typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >,
- ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair;
- typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont;
-
-private:
- SvXMLExport& mrExport;
- SvXMLAutoStylePoolP& mrAutoStylePool;
- UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory;
- UniReference< XMLPropertySetMapper > mxPropertySetMapper;
- UniReference< XMLChartExportPropertyMapper > mxExpPropMapper;
-
- rtl::OUString msTableName;
- rtl::OUStringBuffer msStringBuffer;
- rtl::OUString msString;
-
- // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
- sal_Bool mbHasSeriesLabels;
- sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
- sal_Bool mbRowSourceColumns;
- rtl::OUString msChartAddress;
- rtl::OUString msTableNumberList;
- ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
-
- rtl::OUString msCLSID;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
-
- tDataSequenceCont m_aDataSequencesToExport;
- rtl::OUString maCategoriesRange;
-
- /** first parseDocument: collect autostyles and store names in this queue
- second parseDocument: export content and use names from this queue
- */
- ::std::queue< ::rtl::OUString > maAutoStyleNameQueue;
- SAL_DLLPRIVATE void CollectAutoStyle(
- const std::vector< XMLPropertyState >& aStates );
- SAL_DLLPRIVATE void AddAutoStyleAttribute(
- const std::vector< XMLPropertyState >& aStates );
-
- SAL_DLLPRIVATE SvXMLAutoStylePoolP& GetAutoStylePoolP()
- { return mrAutoStylePool; }
-
- /// if bExportContent is false the auto-styles are collected
- SAL_DLLPRIVATE void parseDocument( com::sun::star::uno::Reference<
- com::sun::star::chart::XChartDocument >& rChartDoc,
- sal_Bool bExportContent,
- sal_Bool bIncludeTable = sal_False );
- SAL_DLLPRIVATE void exportTable();
- SAL_DLLPRIVATE void exportPlotArea(
- com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram,
- com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram,
- const ::com::sun::star::awt::Size & rPageSize,
- sal_Bool bExportContent,
- sal_Bool bIncludeTable );
- SAL_DLLPRIVATE void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram,
- const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
- sal_Bool bExportContent );
-
- SAL_DLLPRIVATE void exportSeries(
- const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
- const ::com::sun::star::awt::Size & rPageSize,
- sal_Bool bExportContent,
- sal_Bool bHasTwoYAxes );
- SAL_DLLPRIVATE void exportCandleStickSeries(
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDiagram > & xDiagram,
- sal_Bool bJapaneseCandleSticks,
- sal_Bool bExportContent );
- SAL_DLLPRIVATE void exportDataPoints(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
- sal_Int32 nSeriesLength,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDiagram > & xDiagram,
- sal_Bool bExportContent );
- SAL_DLLPRIVATE void exportRegressionCurve(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries > & xSeries,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > & xSeriesProp,
- const ::com::sun::star::awt::Size & rPageSize,
- sal_Bool bExportContent );
-
- /// add svg position as attribute for current element
- SAL_DLLPRIVATE void addPosition( const ::com::sun::star::awt::Point & rPosition );
- SAL_DLLPRIVATE void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
- /// add svg size as attribute for current element
- SAL_DLLPRIVATE void addSize( const ::com::sun::star::awt::Size & rSize );
- SAL_DLLPRIVATE void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
- /// fills the member msString with the appropriate String (i.e. "A3")
- SAL_DLLPRIVATE void getCellAddress( sal_Int32 nCol, sal_Int32 nRow );
- /// exports a string as a paragraph element
- SAL_DLLPRIVATE void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false );
- SAL_DLLPRIVATE void exportErrorBarRanges();
-
- SAL_DLLPRIVATE SchXMLExportHelper(SchXMLExportHelper &); // not defined
- SAL_DLLPRIVATE void operator =(SchXMLExportHelper &); // not defined
-
-public:
SchXMLExportHelper( SvXMLExport& rExport,
SvXMLAutoStylePoolP& rASPool );
virtual ~SchXMLExportHelper();
- // auto-styles
- /// parse chart and collect all auto-styles used in current pool
- void collectAutoStyles( com::sun::star::uno::Reference<
- com::sun::star::chart::XChartDocument > rChartDoc );
- /// write the styles collected into the current pool as <style:style> elements
- void exportAutoStyles();
-
- /** export the <chart:chart> element corresponding to rChartDoc
- if bIncludeTable is true, the chart data is exported as <table:table>
- element (inside the chart element).
-
- Otherwise the external references stored in the chart document are used
- for writing the corresponding attributes at series
-
- All attributes contained in xAttrList are written at the chart element,
- which ist the outer element of a chart. So these attributes can easily
- be parsed again by the container
- */
- void exportChart( com::sun::star::uno::Reference<
- com::sun::star::chart::XChartDocument > rChartDoc,
- sal_Bool bIncludeTable );
-
/// returns the string corresponding to the current FileFormat CLSID for Chart
const rtl::OUString& getChartCLSID();
- UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return mxPropertySetMapper; }
-
- void SetChartRangeAddress( const ::rtl::OUString& rAddress )
- { msChartAddress = rAddress; }
- void SetTableNumberList( const ::rtl::OUString& rList )
- { msTableNumberList = rList; }
-
- void InitRangeSegmentationProperties(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+private:
+ SchXMLExportHelper(); // not defined
+ SchXMLExportHelper(SchXMLExportHelper &); // not defined
+ void operator =(SchXMLExportHelper &); // not defined
- ::com::sun::star::awt::Size getPageSize(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
+private:
+ SchXMLExportHelper_Impl* m_pImpl;
+ friend class SchXMLExport;
};
#endif // _XMLOFF_SCH_XMLEXPORTHELPER_HXX_
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 44c5f364ff..b80b4b2e0c 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3095,6 +3095,11 @@ namespace xmloff { namespace token {
XML_ENDS_WITH,
XML_DOES_NOT_END_WITH,
+ //chart
+ XML_NP_CHART_EXT,
+ XML_N_CHART_EXT,
+ XML_COORDINATE_REGION,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index e8245b3d0d..6d897c5e0f 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -76,6 +76,7 @@
#include <com/sun/star/chart/X3DDisplay.hpp>
#include <com/sun/star/chart/XStatisticDisplay.hpp>
#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
+#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
@@ -116,6 +117,161 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::std::vector;
+// ========================================
+// class SchXMLExportHelper_Impl
+// ========================================
+
+class SchXMLExportHelper_Impl
+{
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >,
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair;
+ typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont;
+
+public:
+ SchXMLExportHelper_Impl( SvXMLExport& rExport,
+ SvXMLAutoStylePoolP& rASPool );
+
+ virtual ~SchXMLExportHelper_Impl();
+
+ // auto-styles
+ /// parse chart and collect all auto-styles used in current pool
+ void collectAutoStyles( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+
+ /// write the styles collected into the current pool as <style:style> elements
+ void exportAutoStyles();
+
+ /** export the <chart:chart> element corresponding to rChartDoc
+ if bIncludeTable is true, the chart data is exported as <table:table>
+ element (inside the chart element).
+
+ Otherwise the external references stored in the chart document are used
+ for writing the corresponding attributes at series
+
+ All attributes contained in xAttrList are written at the chart element,
+ which ist the outer element of a chart. So these attributes can easily
+ be parsed again by the container
+ */
+ void exportChart( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable );
+
+ UniReference< XMLPropertySetMapper > GetPropertySetMapper() const;
+
+ void SetChartRangeAddress( const ::rtl::OUString& rAddress )
+ { msChartAddress = rAddress; }
+ void SetTableNumberList( const ::rtl::OUString& rList )
+ { msTableNumberList = rList; }
+
+ void InitRangeSegmentationProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+
+ ::com::sun::star::awt::Size getPageSize(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const;
+
+ /** first parseDocument: collect autostyles and store names in this queue
+ second parseDocument: export content and use names from this queue
+ */
+ ::std::queue< ::rtl::OUString > maAutoStyleNameQueue;
+ void CollectAutoStyle(
+ const std::vector< XMLPropertyState >& aStates );
+ void AddAutoStyleAttribute(
+ const std::vector< XMLPropertyState >& aStates );
+
+ SvXMLAutoStylePoolP& GetAutoStylePoolP()
+ { return mrAutoStylePool; }
+
+ /// if bExportContent is false the auto-styles are collected
+ void parseDocument( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument >& rChartDoc,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable = sal_False );
+ void exportTable();
+ void exportPlotArea(
+ com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram,
+ com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bIncludeTable );
+ void exportCoordinateRegion( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram );
+ void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram,
+ const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
+ sal_Bool bExportContent );
+
+ void exportSeries(
+ const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent,
+ sal_Bool bHasTwoYAxes );
+ void exportCandleStickSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Bool bJapaneseCandleSticks,
+ sal_Bool bExportContent );
+ void exportDataPoints(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProperties,
+ sal_Int32 nSeriesLength,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > & xDiagram,
+ sal_Bool bExportContent );
+ void exportRegressionCurve(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > & xSeries,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & xSeriesProp,
+ const ::com::sun::star::awt::Size & rPageSize,
+ sal_Bool bExportContent );
+
+ /// add svg position as attribute for current element
+ 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 );
+ /// 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
+ void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false );
+ void exportErrorBarRanges();
+
+ SchXMLExportHelper_Impl(SchXMLExportHelper_Impl &); // not defined
+ void operator =(SchXMLExportHelper_Impl &); // not defined
+
+public:
+ SvXMLExport& mrExport;
+ SvXMLAutoStylePoolP& mrAutoStylePool;
+ UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory;
+ UniReference< XMLPropertySetMapper > mxPropertySetMapper;
+ UniReference< XMLChartExportPropertyMapper > mxExpPropMapper;
+
+ rtl::OUString msTableName;
+ rtl::OUStringBuffer msStringBuffer;
+ rtl::OUString msString;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ sal_Bool mbHasSeriesLabels;
+ sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+ sal_Bool mbRowSourceColumns;
+ rtl::OUString msChartAddress;
+ rtl::OUString msTableNumberList;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+
+ rtl::OUString msCLSID;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
+
+ tDataSequenceCont m_aDataSequencesToExport;
+ rtl::OUString maCategoriesRange;
+};
+
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
@@ -354,7 +510,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole(
const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt,
const OUString & rRole,
const Reference< chart2::XChartDocument > & xDoc,
- SchXMLExportHelper::tDataSequenceCont & rOutSequencesToExport )
+ SchXMLExportHelper_Impl::tDataSequenceCont & rOutSequencesToExport )
{
tLabelAndValueRange aResult;
@@ -371,7 +527,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole(
aResult.second = lcl_ConvertRange( xValueSeq->getSourceRangeRepresentation(), xDoc );
if( xLabelSeq.is() || xValueSeq.is())
- rOutSequencesToExport.push_back( SchXMLExportHelper::tLabelValuesDataPair( xLabelSeq, xValueSeq ));
+ rOutSequencesToExport.push_back( SchXMLExportHelper_Impl::tLabelValuesDataPair( xLabelSeq, xValueSeq ));
}
return aResult;
@@ -453,10 +609,10 @@ OUString lcl_getLabelString( const Reference< chart2::data::XDataSequence > & xL
}
sal_Int32 lcl_getMaxSequenceLength(
- const SchXMLExportHelper::tDataSequenceCont & rContainer )
+ const SchXMLExportHelper_Impl::tDataSequenceCont & rContainer )
{
sal_Int32 nResult = 0;
- for( SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( rContainer.begin());
+ for( SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( rContainer.begin());
aIt != rContainer.end(); ++aIt )
{
if( aIt->second.is())
@@ -571,7 +727,7 @@ template< class T >
};
-typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair >
+typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair >
lcl_DataSequenceMap;
struct lcl_SequenceToMapElement :
@@ -594,7 +750,7 @@ struct lcl_SequenceToMapElement :
};
void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
- SchXMLExportHelper::tDataSequenceCont & rInOutSequences )
+ SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences )
{
lcl_DataSequenceMap aIndexSequenceMap;
::std::transform( rInOutSequences.begin(), rInOutSequences.end(),
@@ -611,7 +767,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
// fill empty columns
for( ; nIndex < aIt->first; ++nIndex )
rInOutSequences.push_back(
- SchXMLExportHelper::tDataSequenceCont::value_type( 0, 0 ));
+ SchXMLExportHelper_Impl::tDataSequenceCont::value_type( 0, 0 ));
OSL_ASSERT( nIndex == aIt->first );
rInOutSequences.push_back( aIt->second );
}
@@ -619,7 +775,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName(
lcl_TableData lcl_getDataForLocalTable(
- const SchXMLExportHelper::tDataSequenceCont & aSequencesToExport,
+ const SchXMLExportHelper_Impl::tDataSequenceCont & aSequencesToExport,
const Reference< chart::XComplexDescriptionAccess >& xComplexDescriptionAccess,
const OUString& rCategoriesRange,
bool bSeriesFromColumns,
@@ -641,10 +797,10 @@ lcl_TableData lcl_getDataForLocalTable(
aResult.aComplexRowDescriptions = xComplexDescriptionAccess->getComplexRowDescriptions();
}
- SchXMLExportHelper::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size();
- SchXMLExportHelper::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin());
- SchXMLExportHelper::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end());
- SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( aBegin );
+ SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size();
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin());
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end());
+ SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( aBegin );
size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport ));
size_t nCategoriesLength( aSimpleCategories.getLength() );
@@ -832,7 +988,53 @@ struct SchXMLDataPointStruct
// class SchXMLExportHelper
// ========================================
-SchXMLExportHelper::SchXMLExportHelper(
+SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool )
+ : m_pImpl( new SchXMLExportHelper_Impl( rExport, rASPool ) )
+{
+}
+
+SchXMLExportHelper::~SchXMLExportHelper()
+{
+ delete m_pImpl;
+}
+
+const OUString& SchXMLExportHelper::getChartCLSID()
+{
+ return m_pImpl->msCLSID;
+}
+
+UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const
+{
+ return mxPropertySetMapper;
+}
+
+void SchXMLExportHelper_Impl::exportAutoStyles()
+{
+ if( mxExpPropMapper.is())
+ {
+ //ToDo: when embedded in calc/writer this is not necessary because the
+ // numberformatter is shared between both documents
+ mrExport.exportAutoDataStyles();
+
+ // export chart auto styles
+ mrAutoStylePool.exportXML(
+ XML_STYLE_FAMILY_SCH_CHART_ID
+ , mrExport.GetDocHandler(),
+ mrExport.GetMM100UnitConverter(),
+ mrExport.GetNamespaceMap()
+ );
+
+ // export auto styles for additional shapes
+ mrExport.GetShapeExport()->exportAutoStyles();
+ // and for text in additional shapes
+ mrExport.GetTextParagraphExport()->exportTextAutoStyles();
+ }
+}
+
+// private methods
+// ---------------
+
+SchXMLExportHelper_Impl::SchXMLExportHelper_Impl(
SvXMLExport& rExport,
SvXMLAutoStylePoolP& rASPool ) :
mrExport( rExport ),
@@ -901,56 +1103,22 @@ SchXMLExportHelper::SchXMLExportHelper(
String( 'T' ));
}
-SchXMLExportHelper::~SchXMLExportHelper() {}
-
-const OUString& SchXMLExportHelper::getChartCLSID()
-{
- return msCLSID;
-}
-
-void SchXMLExportHelper::exportAutoStyles()
+SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl()
{
- if( mxExpPropMapper.is())
- {
- //ToDo: when embedded in calc/writer this is not necessary because the
- // numberformatter is shared between both documents
- mrExport.exportAutoDataStyles();
-
- // export chart auto styles
- mrAutoStylePool.exportXML(
- XML_STYLE_FAMILY_SCH_CHART_ID
- , mrExport.GetDocHandler(),
- mrExport.GetMM100UnitConverter(),
- mrExport.GetNamespaceMap()
- );
-
- // export auto styles for additional shapes
- mrExport.GetShapeExport()->exportAutoStyles();
- // and for text in additional shapes
- mrExport.GetTextParagraphExport()->exportTextAutoStyles();
- }
}
-void SchXMLExportHelper::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc )
+void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::collectAutoStyles" );
-
parseDocument( rChartDoc, sal_False );
}
-void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartDoc,
+void SchXMLExportHelper_Impl::exportChart( Reference< chart::XChartDocument > rChartDoc,
sal_Bool bIncludeTable )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::exportChart" );
-
parseDocument( rChartDoc, sal_True, bIncludeTable );
DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" );
}
-
-// private methods
-// ---------------
-
::rtl::OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ )
{
const sal_Int32* pArray = rSequenceMapping.getConstArray();
@@ -975,7 +1143,7 @@ void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartD
}
/// if bExportContent is false the auto-styles are collected
-void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rChartDoc,
+void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& rChartDoc,
sal_Bool bExportContent,
sal_Bool bIncludeTable )
{
@@ -1425,7 +1593,7 @@ void lcl_exportComplexLabel( const Sequence< OUString >& rComplexLabel, SvXMLExp
}
}
-void SchXMLExportHelper::exportTable()
+void SchXMLExportHelper_Impl::exportTable()
{
// table element
// -------------
@@ -1602,7 +1770,7 @@ void SchXMLExportHelper::exportTable()
OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) );
}
-void SchXMLExportHelper::exportPlotArea(
+void SchXMLExportHelper_Impl::exportPlotArea(
Reference< chart::XDiagram > xDiagram,
Reference< chart2::XDiagram > xNewDiagram,
const awt::Size & rPageSize,
@@ -1762,9 +1930,12 @@ void SchXMLExportHelper::exportPlotArea(
}
}
- // element
+ // plot-area element
pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True );
+ //inner position rectangle element
+ exportCoordinateRegion( xDiagram );
+
// light sources (inside plot area element)
if( bIs3DChart &&
rShapeExport.is())
@@ -1925,7 +2096,27 @@ void SchXMLExportHelper::exportPlotArea(
delete pElPlotArea;
}
-void SchXMLExportHelper::exportAxes(
+void SchXMLExportHelper_Impl::exportCoordinateRegion( const uno::Reference< chart::XDiagram >& xDiagram )
+{
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
+ return;
+ if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //#i100778# todo: change this dependent on fileformat evolution
+ return;
+
+ Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY );
+ DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" );
+ if( !xDiaPos.is() )
+ return;
+
+ awt::Rectangle aRect( xDiaPos->calculateDiagramPositionExcludingAxes() );
+ addPosition( awt::Point(aRect.X,aRect.Y) );
+ addSize( awt::Size(aRect.Width,aRect.Height) );
+
+ SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart namespace in future - dependent on fileformat
+}
+
+void SchXMLExportHelper_Impl::exportAxes(
const Reference< chart::XDiagram > & xDiagram,
const Reference< chart2::XDiagram > & xNewDiagram,
sal_Bool bExportContent )
@@ -2527,7 +2718,7 @@ void SchXMLExportHelper::exportAxes(
}
}
-void SchXMLExportHelper::exportSeries(
+void SchXMLExportHelper_Impl::exportSeries(
const Reference< chart2::XDiagram > & xNewDiagram,
const awt::Size & rPageSize,
sal_Bool bExportContent,
@@ -2896,7 +3087,7 @@ void SchXMLExportHelper::exportSeries(
}
}
-void SchXMLExportHelper::exportRegressionCurve(
+void SchXMLExportHelper_Impl::exportRegressionCurve(
const Reference< chart2::XDataSeries > & xSeries,
const Reference< beans::XPropertySet > & xSeriesProp,
const awt::Size & rPageSize,
@@ -3003,7 +3194,7 @@ void SchXMLExportHelper::exportRegressionCurve(
}
}
-void SchXMLExportHelper::exportCandleStickSeries(
+void SchXMLExportHelper_Impl::exportCandleStickSeries(
const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq,
const Reference< chart2::XDiagram > & xDiagram,
sal_Bool bJapaneseCandleSticks,
@@ -3121,7 +3312,7 @@ void SchXMLExportHelper::exportCandleStickSeries(
}
}
-void SchXMLExportHelper::exportDataPoints(
+void SchXMLExportHelper_Impl::exportDataPoints(
const uno::Reference< beans::XPropertySet > & xSeriesProperties,
sal_Int32 nSeriesLength,
const uno::Reference< chart2::XDiagram > & xDiagram,
@@ -3369,7 +3560,7 @@ void SchXMLExportHelper::exportDataPoints(
}
-void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow )
+void SchXMLExportHelper_Impl::getCellAddress( sal_Int32 nCol, sal_Int32 nRow )
{
msStringBuffer.append( (sal_Unicode)'.' );
if( nCol < 26 )
@@ -3389,7 +3580,7 @@ void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow )
msStringBuffer.append( nRow + (sal_Int32)1 );
}
-void SchXMLExportHelper::addPosition( const awt::Point & rPosition )
+void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition )
{
mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.X );
msString = msStringBuffer.makeStringAndClear();
@@ -3400,13 +3591,13 @@ void SchXMLExportHelper::addPosition( const awt::Point & rPosition )
mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString );
}
-void SchXMLExportHelper::addPosition( Reference< drawing::XShape > xShape )
+void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape )
{
if( xShape.is())
addPosition( xShape->getPosition());
}
-void SchXMLExportHelper::addSize( const awt::Size & rSize )
+void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize )
{
mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width );
msString = msStringBuffer.makeStringAndClear();
@@ -3417,13 +3608,13 @@ void SchXMLExportHelper::addSize( const awt::Size & rSize )
mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, msString );
}
-void SchXMLExportHelper::addSize( Reference< drawing::XShape > xShape )
+void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape )
{
if( xShape.is())
addSize( xShape->getSize() );
}
-awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const
+awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const
{
awt::Size aSize( 8000, 7000 );
uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY );
@@ -3434,13 +3625,13 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume
return aSize;
}
-void SchXMLExportHelper::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates )
+void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates )
{
if( !aStates.empty() )
maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates ));
}
-void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates )
+void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates )
{
if( !aStates.empty() )
{
@@ -3451,7 +3642,7 @@ void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertySt
}
}
-void SchXMLExportHelper::exportText( const OUString& rText, bool bConvertTabsLFs )
+void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTabsLFs )
{
SchXMLTools::exportText( mrExport, rText, bConvertTabsLFs );
}
@@ -3468,6 +3659,8 @@ SchXMLExport::SchXMLExport(
maAutoStylePool( *this ),
maExportHelper( *this, maAutoStylePool )
{
+ if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
}
@@ -3484,7 +3677,7 @@ SchXMLExport::~SchXMLExport()
sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
{
Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
- maExportHelper.InitRangeSegmentationProperties( xChartDoc );
+ maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
return SvXMLExport::exportDoc( eClass );
}
@@ -3507,8 +3700,8 @@ void SchXMLExport::_ExportAutoStyles()
Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
if( xChartDoc.is())
{
- maExportHelper.collectAutoStyles( xChartDoc );
- maExportHelper.exportAutoStyles();
+ maExportHelper.m_pImpl->collectAutoStyles( xChartDoc );
+ maExportHelper.m_pImpl->exportAutoStyles();
}
else
{
@@ -3557,13 +3750,13 @@ void SchXMLExport::_ExportContent()
aAny = xProp->getPropertyValue(
OUString::createFromAscii( "ChartRangeAddress" ));
aAny >>= sChartAddress;
- maExportHelper.SetChartRangeAddress( sChartAddress );
+ maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress );
OUString sTableNumberList;
aAny = xProp->getPropertyValue(
OUString::createFromAscii( "TableNumberList" ));
aAny >>= sTableNumberList;
- maExportHelper.SetTableNumberList( sTableNumberList );
+ maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList );
// do not include own table if there are external addresses
bIncludeTable = (sChartAddress.getLength() == 0);
@@ -3576,7 +3769,7 @@ void SchXMLExport::_ExportContent()
}
}
}
- maExportHelper.exportChart( xChartDoc, bIncludeTable );
+ maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable );
}
else
{
@@ -3591,7 +3784,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage )
mxStatusIndicator->setValue( nPercentage );
}
-void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
+UniReference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
+{
+ return maExportHelper.m_pImpl->GetPropertySetMapper();
+}
+
+void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
{
if( xChartDoc.is())
try
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index b8e06e3da8..85a9597b28 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -281,6 +281,8 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap()
{
static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] =
{
+ { XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION_EXT },
+ { XML_NAMESPACE_CHART, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION },
{ XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS },
{ XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES },
{ XML_NAMESPACE_CHART, XML_WALL, XML_TOK_PA_WALL },
@@ -657,6 +659,7 @@ SchXMLImport::SchXMLImport(
SvXMLImport( xServiceFactory, nImportFlags )
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
mbIsGraphicLoadOnDemandSupported = false;
}
@@ -670,6 +673,7 @@ SchXMLImport::SchXMLImport(
: SvXMLImport( xServiceFactory, xModel, rGrfContainer )
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
// get status indicator (if requested)
if( bShowProgress )
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 86a6a3469c..1000fd6443 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -61,6 +61,7 @@
#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>
@@ -199,8 +200,8 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
mnSeries( 0 ),
m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ),
maSceneImportHelper( rImport ),
- mbHasSize(false),
- mbHasPosition(false),
+ m_aOuterPositioning( rImport ),
+ m_aInnerPositioning( rImport ),
mbPercentStacked(false),
m_bAxisPositionAttributeImported(false),
m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider),
@@ -296,15 +297,6 @@ SchXMLPlotAreaContext::~SchXMLPlotAreaContext()
void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
- uno::Any aTransMatrixAny;
-
- // initialize size and position
- uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY );
- bool bHasSizeWidth = false;
- bool bHasSizeHeight = false;
- bool bHasPositionX = false;
- bool bHasPositionY = false;
-
// parse attributes
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPlotAreaAttrTokenMap();
@@ -320,20 +312,10 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
{
case XML_TOK_PA_X:
- GetImport().GetMM100UnitConverter().convertMeasure( maPosition.X, aValue );
- bHasPositionX = true;
- break;
case XML_TOK_PA_Y:
- GetImport().GetMM100UnitConverter().convertMeasure( maPosition.Y, aValue );
- bHasPositionY = true;
- break;
case XML_TOK_PA_WIDTH:
- GetImport().GetMM100UnitConverter().convertMeasure( maSize.Width, aValue );
- bHasSizeWidth = true;
- break;
case XML_TOK_PA_HEIGHT:
- GetImport().GetMM100UnitConverter().convertMeasure( maSize.Height, aValue );
- bHasSizeHeight = true;
+ m_aOuterPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
break;
case XML_TOK_PA_STYLE_NAME:
msAutoStyleName = aValue;
@@ -369,9 +351,6 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
}
}
- mbHasSize = bHasSizeWidth && bHasSizeHeight;
- mbHasPosition = bHasPositionX && bHasPositionY;
-
if( ! mxNewDoc.is())
{
uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY );
@@ -426,14 +405,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")), pPropStyleContext, pStylesCtxt );
//handle automatic position and size
- bool bAutoSize = false;
- bool bAutoPosition = false;
- SchXMLTools::getPropertyFromContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= bAutoSize;
- SchXMLTools::getPropertyFromContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= bAutoPosition;
- mbHasSize = mbHasSize && !bAutoSize;
- mbHasPosition = mbHasPosition && !bAutoPosition;
+ m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt );
//correct default starting angle for old 3D pies
if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_0( GetImport().GetModel() ) )
@@ -548,6 +520,13 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
switch( rTokenMap.Get( nPrefix, rLocalName ))
{
+ case XML_TOK_PA_COORDINATE_REGION_EXT:
+ case XML_TOK_PA_COORDINATE_REGION:
+ {
+ pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning );
+ }
+ break;
+
case XML_TOK_PA_AXIS:
{
bool bAddMissingXAxisForNetCharts = false;
@@ -711,13 +690,22 @@ void SchXMLPlotAreaContext::EndElement()
}
// set changed size and position after properties (esp. 3d)
- uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY );
- if( xDiaShape.is())
+
+ uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY );
+ if( xDiaPos.is())
{
- if( mbHasSize )
- xDiaShape->setSize( maSize );
- if( mbHasPosition )
- xDiaShape->setPosition( maPosition );
+ if( !m_aOuterPositioning.isAutomatic() )
+ {
+ if( m_aInnerPositioning.hasPosSize() )
+ xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() );
+ else if( m_aOuterPositioning.hasPosSize() )
+ {
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
+ xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() );
+ else
+ xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() );
+ }
+ }
}
CorrectAxisPositions();
@@ -1681,6 +1669,134 @@ void SchXMLCategoriesContext::StartElement( const uno::Reference< xml::sax::XAtt
// ========================================
+SchXMLPositonAttributesHelper::SchXMLPositonAttributesHelper( SvXMLImport& rImporter )
+ : m_rImport( rImporter )
+ , m_aPosition(0,0)
+ , m_aSize(0,0)
+ , m_bHasSizeWidth( false )
+ , m_bHasSizeHeight( false )
+ , m_bHasPositionX( false )
+ , m_bHasPositionY( false )
+ , m_bAutoSize( false )
+ , m_bAutoPosition( false )
+{
+}
+
+SchXMLPositonAttributesHelper::~SchXMLPositonAttributesHelper()
+{
+}
+
+bool SchXMLPositonAttributesHelper::hasSize() const
+{
+ return m_bHasSizeWidth && m_bHasSizeHeight;
+}
+bool SchXMLPositonAttributesHelper::hasPosition() const
+{
+ return m_bHasPositionX && m_bHasPositionY;
+}
+bool SchXMLPositonAttributesHelper::hasPosSize() const
+{
+ return hasPosition() && hasSize();
+}
+bool SchXMLPositonAttributesHelper::isAutomatic() const
+{
+ return m_bAutoSize || m_bAutoPosition;
+}
+awt::Point SchXMLPositonAttributesHelper::getPosition() const
+{
+ return m_aPosition;
+}
+awt::Size SchXMLPositonAttributesHelper::getSize() const
+{
+ return m_aSize;
+}
+awt::Rectangle SchXMLPositonAttributesHelper::getRectangle() const
+{
+ return awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height );
+}
+
+bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
+{
+ //returns true if the attribute was proccessed
+ bool bReturn = true;
+
+ if( XML_NAMESPACE_SVG == nPrefix )
+ {
+ if( IsXMLToken( rLocalName, XML_X ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.X, rValue );
+ m_bHasPositionX = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_Y ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.Y, rValue );
+ m_bHasPositionY = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_WIDTH ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Width, rValue );
+ m_bHasSizeWidth = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Height, rValue );
+ m_bHasSizeHeight = true;
+ }
+ else
+ bReturn = false;
+ }
+ else
+ bReturn = false;
+
+ return bReturn;
+}
+
+
+void SchXMLPositonAttributesHelper::readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
+{
+ if( pPropStyleContext && pStylesCtxt )
+ {
+ //handle automatic position and size
+ SchXMLTools::getPropertyFromContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize;
+ SchXMLTools::getPropertyFromContext(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition;
+ }
+}
+
+// ========================================
+
+SchXMLCoordinateRegionContext::SchXMLCoordinateRegionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning )
+ : SvXMLImportContext( rImport, nPrefix, rLocalName )
+ , m_rPositioning( rPositioning )
+{
+}
+
+SchXMLCoordinateRegionContext::~SchXMLCoordinateRegionContext()
+{
+}
+
+void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ 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;
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue );
+ }
+}
+
+// ========================================
+
SchXMLWallFloorContext::SchXMLWallFloorContext(
SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport,
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index 0a5d237b78..c7e55f9571 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -66,6 +66,43 @@ private:
SchXML3DSceneAttributesHelper();
};
+// ----------------------------------------
+
+class SchXMLPositonAttributesHelper
+{
+public:
+ SchXMLPositonAttributesHelper( SvXMLImport& rImporter );
+ ~SchXMLPositonAttributesHelper();
+
+ bool readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue );
+ void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
+
+ bool hasPosSize() const;
+ bool isAutomatic() const;
+ ::com::sun::star::awt::Rectangle getRectangle() const;
+
+
+private:
+ bool hasSize() const;
+ bool hasPosition() const;
+ ::com::sun::star::awt::Size getSize() const;
+ ::com::sun::star::awt::Point getPosition() const;
+
+ SvXMLImport& m_rImport;
+
+ ::com::sun::star::awt::Point m_aPosition;
+ ::com::sun::star::awt::Size m_aSize;
+
+ bool m_bHasSizeWidth;
+ bool m_bHasSizeHeight;
+ bool m_bHasPositionX;
+ bool m_bHasPositionY;
+ sal_Bool m_bAutoSize;
+ sal_Bool m_bAutoPosition;
+};
+
+// ----------------------------------------
+
class SchXMLPlotAreaContext : public SvXMLImportContext
{
public:
@@ -110,10 +147,8 @@ private:
GlobalSeriesImportInfo m_aGlobalSeriesImportInfo;
SchXML3DSceneAttributesHelper maSceneImportHelper;
- ::com::sun::star::awt::Size maSize;
- ::com::sun::star::awt::Point maPosition;
- bool mbHasSize;
- bool mbHasPosition;
+ SchXMLPositonAttributesHelper m_aOuterPositioning;//including axes and axes titles
+ SchXMLPositonAttributesHelper m_aInnerPositioning;//excluding axes and axes titles
bool mbPercentStacked;
bool m_bAxisPositionAttributeImported;
::rtl::OUString msAutoStyleName;
@@ -216,6 +251,23 @@ public:
// ----------------------------------------
+class SchXMLCoordinateRegionContext : public SvXMLImportContext
+{
+public:
+ SchXMLCoordinateRegionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning );
+ virtual ~SchXMLCoordinateRegionContext();
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLPositonAttributesHelper& m_rPositioning;
+};
+
+// ----------------------------------------
+
class SchXMLWallFloorContext : public SvXMLImportContext
{
public:
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index cd504d5485..dd477e67d9 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -757,6 +757,29 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference<
SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo );
}
+bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel )
+{
+ bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel );
+ if( !bResult )
+ {
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/3") ) ) != -1 )
+ {
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/300m") ) ) != -1 )
+ {
+ sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( nBuilId>0 && nBuilId<9491 ) //9491 is build id of dev300m76
+ bResult= true;
+ }
+ else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/310m") ) ) != -1 )
+ bResult= true;
+ else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 )
+ bResult= true;
+ }
+ }
+ return bResult;
+}
+
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index 8e797a6fa0..176618d002 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -54,6 +54,7 @@ namespace SchXMLTools
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7913bde7cd..d18b7c550a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3096,6 +3096,10 @@ namespace xmloff { namespace token {
TOKEN( "ends-with", XML_ENDS_WITH ),
TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+ TOKEN( "chartooo", XML_NP_CHART_EXT ),
+ TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
+ TOKEN( "coordinate-region", XML_COORDINATE_REGION ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
index 055736f67c..be5d6e2ef7 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -31,7 +31,6 @@
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/drawing/CircleKind.hpp>
#include <com/sun/star/drawing/ConnectorType.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
@@ -1247,27 +1246,6 @@ void XMLShapeExport::ImpExportChartShape(
SvXMLAttributeList* pAttrList )
{
ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
-/*
- // Transformation
- ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
-
- uno::Reference< chart::XChartDocument > xChartDoc;
- if( !bIsEmptyPresObj )
- xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xChartDoc;
-
- if( xChartDoc.is() )
- {
- // export chart data if the flag is not set (default)
- sal_Bool bExportOwnData = ( nFeatures & SEF_EXPORT_NO_CHART_DATA ) == 0;
- mrExport.GetChartExport()->exportChart( xChartDoc, bExportOwnData );
- }
- else
- {
- // write chart object (fake for now, replace later)
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_CHART, XML_CHART, sal_True, sal_True);
- }
- }
-*/
}
//////////////////////////////////////////////////////////////////////////////