diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-11-16 15:03:23 +0100 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-11-16 15:03:23 +0100 |
commit | e26194b675380ad6b6a1287f97bce93006be176c (patch) | |
tree | 5a7f6a86a63f4a46b235cf07f575bbbfe9a9ec71 /xmloff/source | |
parent | 5e379068126df168bbd809fb97aaf9eca7e8776c (diff) |
chart52: #28670# make the legend within charts resizeable - part 1 - patch from hackfest2010
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 36 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 5 |
2 files changed, 33 insertions, 8 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index e6f6fc6d9340..9450eb383d1c 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -66,6 +66,7 @@ #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/ChartLegendPosition.hpp> +#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> #include <com/sun/star/chart/XAxisZSupplier.hpp> @@ -234,8 +235,8 @@ public: void addPosition( const ::com::sun::star::awt::Point & rPosition ); void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); /// add svg size as attribute for current element - void addSize( const ::com::sun::star::awt::Size & rSize ); - void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + void addSize( const ::com::sun::star::awt::Size & rSize, bool bIsOOoNamespace = false ); + void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, bool bIsOOoNamespace = false ); /// fills the member msString with the appropriate String (i.e. "A3") void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); /// exports a string as a paragraph element @@ -1460,6 +1461,24 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& Reference< drawing::XShape > xShape( xProp, uno::UNO_QUERY ); if( xShape.is()) addPosition( xShape ); + + // export size + chart2::LegendExpansion aLegendExpansion = chart2::LegendExpansion_HIGH; + try + { + Any aAny( xProp->getPropertyValue( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Expansion" )))); + bool bHasExpansion = (aAny >>= aLegendExpansion); + //todo + //if (bHasExpansion) + // mrExport.AddAttribute( XML_NAMESPACE_STYLE, XML_LEGEND_EXPANSION, ); + } + catch( beans::UnknownPropertyException & ) + { + DBG_WARNING( "Property Expansion not found in ChartLegend" ); + } + + } // write style name @@ -3591,21 +3610,22 @@ void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape ) addPosition( xShape->getPosition()); } -void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize ) +void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize, bool bIsOOoNamespace) { mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width ); msString = msStringBuffer.makeStringAndClear(); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, msString ); + mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG , XML_WIDTH, msString ); + - mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height ); + mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height); msString = msStringBuffer.makeStringAndClear(); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, msString ); + mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG, XML_HEIGHT, msString ); } -void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape ) +void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape, bool bIsOOoNamespace ) { if( xShape.is()) - addSize( xShape->getSize() ); + addSize( xShape->getSize(), bIsOOoNamespace ); } awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 6cfacbd93905..6c077ff1e4d8 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3113,6 +3113,11 @@ namespace xmloff { namespace token { TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ), TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ), + TOKEN( "legend-expansion", XML_LEGEND_EXPANSION), + TOKEN( "balanced", XML_BALANCED), + TOKEN( "high", XML_HIGH), + TOKEN( "wide", XML_WIDE), + TOKEN( "min-value", XML_MIN_VALUE ), TOKEN( "max-value", XML_MAX_VALUE ), |