summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2009-11-20 11:58:22 +0100
committerIngrid Halama <iha@openoffice.org>2009-11-20 11:58:22 +0100
commitec712408961a4a2efc667a7af83a21209907f9eb (patch)
tree6bdfbee52a5927062ffa85c42fe37da5af3ff17e
parentcc423d4be4338cbd81eed9f96f7c7a277da0ee88 (diff)
chartpositioning: #i100778# chart positioning excluding labels
-rw-r--r--xmloff/inc/SchXMLExport.hxx2
-rw-r--r--xmloff/inc/SchXMLImport.hxx1
-rw-r--r--xmloff/inc/xmloff/SchXMLExportHelper.hxx181
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx4
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx351
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx1
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx194
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.hxx59
-rw-r--r--xmloff/source/core/xmltoken.cxx3
-rw-r--r--xmloff/source/draw/shapeexport2.cxx22
10 files changed, 502 insertions, 316 deletions
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx
index 6c2966d811df..3b878ad82498 100644
--- a/xmloff/inc/SchXMLExport.hxx
+++ b/xmloff/inc/SchXMLExport.hxx
@@ -85,7 +85,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 ebecb4d19bb5..c784fbac48f1 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -72,6 +72,7 @@ enum SchXMLChartElemTokenMap
enum SchXMLPlotAreaElemTokenMap
{
+ XML_TOK_PA_EXCLUDING_POSITION,
XML_TOK_PA_AXIS,
XML_TOK_PA_SERIES,
XML_TOK_PA_WALL,
diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
index 2082ce59de03..bbea850ac55b 100644
--- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx
+++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx
@@ -43,42 +43,9 @@
#include <queue>
#include <vector>
-namespace com { namespace sun { namespace star {
- namespace chart {
- class XDiagram;
- class XChartDocument;
- class XChartDataArray;
- 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
@@ -88,154 +55,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;
-
- /** 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 );
- /// interchanges rows and columns of the sequence given
- SAL_DLLPRIVATE void swapDataArray( com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< double > >& rSequence );
- /// 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 70e8ed82ca49..b2ae1d8374ce 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3094,6 +3094,10 @@ namespace xmloff { namespace token {
XML_ENDS_WITH,
XML_DOES_NOT_END_WITH,
+ //chart
+ XML_EXCLUDING_POSITION,
+ XML_PREFER_EXCLUDING_POSITION,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index f7cf82abe974..5232c757ccb7 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -81,6 +81,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>
@@ -120,6 +121,162 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
+// ========================================
+// 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 exportExcludingPosition( 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 );
+ /// interchanges rows and columns of the sequence given
+ void swapDataArray( com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< double > >& rSequence );
+ /// 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;
+};
+
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
@@ -369,7 +526,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;
@@ -386,7 +543,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;
@@ -468,10 +625,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->first.is())
@@ -610,7 +767,7 @@ template< class T >
};
-typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair >
+typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair >
lcl_DataSequenceMap;
struct lcl_SequenceToMapElement :
@@ -642,7 +799,7 @@ private:
};
void lcl_PrepareInternalSequencesForTableExport(
- SchXMLExportHelper::tDataSequenceCont & rInOutSequences, bool bHasCategories )
+ SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences, bool bHasCategories )
{
lcl_DataSequenceMap aIndexSequenceMap;
const sal_Int32 nOffset = bHasCategories ? 1 : 0;
@@ -660,7 +817,7 @@ void lcl_PrepareInternalSequencesForTableExport(
// 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 );
}
@@ -668,21 +825,21 @@ void lcl_PrepareInternalSequencesForTableExport(
lcl_TableData lcl_getDataForLocalTable(
- const SchXMLExportHelper::tDataSequenceCont & aPassedSequences, bool bHasCategoryLabels,
+ const SchXMLExportHelper_Impl::tDataSequenceCont & aPassedSequences, bool bHasCategoryLabels,
bool bSwap,
bool bHasOwnData,
const Reference< chart2::data::XRangeXMLConversion > & xRangeConversion )
{
lcl_TableData aResult;
- SchXMLExportHelper::tDataSequenceCont aSequencesToExport( aPassedSequences );
+ SchXMLExportHelper_Impl::tDataSequenceCont aSequencesToExport( aPassedSequences );
if( bHasOwnData )
lcl_PrepareInternalSequencesForTableExport( aSequencesToExport, bHasCategoryLabels );
- 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 );
if( bHasCategoryLabels )
{
@@ -876,7 +1033,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 ),
@@ -945,56 +1148,22 @@ SchXMLExportHelper::SchXMLExportHelper(
String( 'T' ));
}
-SchXMLExportHelper::~SchXMLExportHelper() {}
-
-const OUString& SchXMLExportHelper::getChartCLSID()
+SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl()
{
- return msCLSID;
}
-void SchXMLExportHelper::exportAutoStyles()
+void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc )
{
- 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 )
-{
- 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();
@@ -1019,7 +1188,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 )
{
@@ -1455,7 +1624,7 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha
delete pElChart;
}
-void SchXMLExportHelper::exportTable()
+void SchXMLExportHelper_Impl::exportTable()
{
// table element
// -------------
@@ -1593,7 +1762,7 @@ void SchXMLExportHelper::exportTable()
OSL_ASSERT( bHasOwnData || (aFirstColumnRangeIter == aFirstColumnRangeEndIter) );
}
-void SchXMLExportHelper::exportPlotArea(
+void SchXMLExportHelper_Impl::exportPlotArea(
Reference< chart::XDiagram > xDiagram,
Reference< chart2::XDiagram > xNewDiagram,
const awt::Size & rPageSize,
@@ -1753,9 +1922,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
+ exportExcludingPosition( xDiagram );
+
// light sources (inside plot area element)
if( bIs3DChart &&
rShapeExport.is())
@@ -1916,7 +2088,27 @@ void SchXMLExportHelper::exportPlotArea(
delete pElPlotArea;
}
-void SchXMLExportHelper::exportAxes(
+void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< chart::XDiagram >& xDiagram )
+{
+ 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) );
+
+ sal_Bool bPreferExcludingPositioning = xDiaPos->isExcludingDiagramPositioning();
+ rtl::OUStringBuffer sStringBuffer;
+ SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning );
+ String aString( sStringBuffer.makeStringAndClear() );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION, aString );
+
+ SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, sal_True, sal_True );
+}
+
+void SchXMLExportHelper_Impl::exportAxes(
const Reference< chart::XDiagram > & xDiagram,
const Reference< chart2::XDiagram > & xNewDiagram,
sal_Bool bExportContent )
@@ -2518,7 +2710,7 @@ void SchXMLExportHelper::exportAxes(
}
}
-void SchXMLExportHelper::exportSeries(
+void SchXMLExportHelper_Impl::exportSeries(
const Reference< chart2::XDiagram > & xNewDiagram,
const awt::Size & rPageSize,
sal_Bool bExportContent,
@@ -2887,7 +3079,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,
@@ -2994,7 +3186,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,
@@ -3112,7 +3304,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,
@@ -3360,7 +3552,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 )
@@ -3380,7 +3572,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();
@@ -3391,13 +3583,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();
@@ -3408,13 +3600,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 );
@@ -3425,7 +3617,7 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume
return aSize;
}
-void SchXMLExportHelper::swapDataArray( Sequence< Sequence< double > >& rSequence )
+void SchXMLExportHelper_Impl::swapDataArray( Sequence< Sequence< double > >& rSequence )
{
sal_Int32 nOuterSize = rSequence.getLength();
sal_Int32 nInnerSize = rSequence[0].getLength(); // assume that all subsequences have same length
@@ -3443,13 +3635,13 @@ void SchXMLExportHelper::swapDataArray( Sequence< Sequence< double > >& rSequenc
rSequence = aResult;
}
-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() )
{
@@ -3460,7 +3652,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 );
}
@@ -3493,7 +3685,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 );
}
@@ -3516,8 +3708,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
{
@@ -3566,13 +3758,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);
@@ -3585,7 +3777,7 @@ void SchXMLExport::_ExportContent()
}
}
}
- maExportHelper.exportChart( xChartDoc, bIncludeTable );
+ maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable );
}
else
{
@@ -3600,7 +3792,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 dd955e6d69d5..1087845f965e 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -285,6 +285,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap()
{
static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] =
{
+ { XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION },
{ 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 },
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 8bb4712b4159..37fa8249d9c8 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -64,6 +64,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>
@@ -202,8 +203,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),
@@ -299,15 +300,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();
@@ -323,20 +315,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;
@@ -372,9 +354,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 );
@@ -429,14 +408,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() ) )
@@ -551,6 +523,12 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
switch( rTokenMap.Get( nPrefix, rLocalName ))
{
+ case XML_TOK_PA_EXCLUDING_POSITION:
+ {
+ pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning );
+ }
+ break;
+
case XML_TOK_PA_AXIS:
{
bool bAddMissingXAxisForNetCharts = false;
@@ -714,13 +692,14 @@ 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_aInnerPositioning.hasPosSize() )
+ xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() );
+ else if( m_aOuterPositioning.hasPosSize() )
+ xDiaPos->setDiagramPositionIncludingAxesAndAxesTitles( m_aOuterPositioning.getRectangle() );
}
CorrectAxisPositions();
@@ -1680,6 +1659,143 @@ 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 && !m_bAutoSize;
+}
+bool SchXMLPositonAttributesHelper::hasPosition() const
+{
+ return m_bHasPositionX && m_bHasPositionY && !m_bAutoPosition;
+}
+bool SchXMLPositonAttributesHelper::hasPosSize() const
+{
+ return hasPosition() && hasSize();
+}
+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 if( XML_NAMESPACE_CHART == nPrefix )
+ {
+ //Attribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION
+
+ sal_Bool bPreferExcludingPosition = false;
+ if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue );
+ m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition;
+ }
+ 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;
+ }
+}
+
+// ========================================
+
+SchXMLExcludingPositionContext::SchXMLExcludingPositionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning )
+ : SvXMLImportContext( rImport, nPrefix, rLocalName )
+ , m_rPositioning( rPositioning )
+{
+}
+
+SchXMLExcludingPositionContext::~SchXMLExcludingPositionContext()
+{
+}
+
+void SchXMLExcludingPositionContext::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 ed01ad2fa8da..af6f600200d5 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -69,6 +69,42 @@ 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;
+ ::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:
@@ -113,10 +149,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;
@@ -219,6 +253,23 @@ public:
// ----------------------------------------
+class SchXMLExcludingPositionContext : public SvXMLImportContext
+{
+public:
+ SchXMLExcludingPositionContext(
+ SvXMLImport& rImport
+ , sal_uInt16 nPrefix
+ , const rtl::OUString& rLocalName
+ , SchXMLPositonAttributesHelper& rPositioning );
+ virtual ~SchXMLExcludingPositionContext();
+ 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/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index ae95763f1936..8b0155d1b08a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3095,6 +3095,9 @@ namespace xmloff { namespace token {
TOKEN( "ends-with", XML_ENDS_WITH ),
TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+ TOKEN( "excluding-position", XML_EXCLUDING_POSITION ),
+ TOKEN( "prefer-excluding-position", XML_PREFER_EXCLUDING_POSITION ),
+
#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 b2e81d333fba..b55942cfb00c 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -34,7 +34,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>
@@ -1250,27 +1249,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);
- }
- }
-*/
}
//////////////////////////////////////////////////////////////////////////////