diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-12 12:17:17 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-12 12:17:17 +0000 |
commit | 1f9f07c848ae33cd9cd301da6d8ea00cd31359d0 (patch) | |
tree | 7ec197834e9c46eb9acc0c3bbb9dd0fe3709f8af /xmloff | |
parent | 60665ef5d2fd8e3df4509c723dbad5393b6eb0b2 (diff) |
CWS-TOOLING: integrate CWS rtlchart02
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 11 | ||||
-rw-r--r-- | xmloff/source/chart/PropertyMap.hxx | 82 | ||||
-rw-r--r-- | xmloff/source/chart/PropertyMaps.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLPlotAreaContext.cxx | 220 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLPlotAreaContext.hxx | 9 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.cxx | 29 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx | 131 | ||||
-rw-r--r-- | xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx | 48 | ||||
-rw-r--r-- | xmloff/source/chart/makefile.mk | 1 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 11 |
11 files changed, 522 insertions, 40 deletions
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index be883e9de461..ce8d0063e1e1 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3054,6 +3054,17 @@ namespace xmloff { namespace token { XML_ISOTROPIC, XML_ANISOTROPIC, + XML_AXIS_POSITION, + XML_AXIS_LABEL_POSITION, + XML_NEAR_AXIS, + XML_NEAR_AXIS_OTHER_SIDE, + XML_OUTSIDE_START, + XML_OUTSIDE_END, + XML_TICK_MARK_POSITION, + XML_AT_LABELS, + XML_AT_AXIS, + XML_AT_LABELS_AND_AXIS, + XML_TOKEN_END }; diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index c64aea895c92..4608d6043d72 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -37,6 +37,8 @@ #include <xmloff/contextid.hxx> #include <xmloff/xmlement.hxx> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/ChartErrorIndicatorType.hpp> #include <com/sun/star/chart/ChartRegressionCurveType.hpp> @@ -59,6 +61,10 @@ #define XML_SCH_TYPE_NAMED_SYMBOL ( XML_SCH_TYPES_START + 10 ) #define XML_SCH_TYPE_LABEL_PLACEMENT_TYPE ( XML_SCH_TYPES_START + 11 ) #define XML_SCH_TYPE_MISSING_VALUE_TREATMENT ( XML_SCH_TYPES_START + 12 ) +#define XML_SCH_TYPE_AXIS_POSITION ( XML_SCH_TYPES_START + 13 ) +#define XML_SCH_TYPE_AXIS_POSITION_VALUE ( XML_SCH_TYPES_START + 14 ) +#define XML_SCH_TYPE_AXIS_LABEL_POSITION ( XML_SCH_TYPES_START + 15 ) +#define XML_SCH_TYPE_TICK_MARK_POSITION ( XML_SCH_TYPES_START + 16 ) // context ids #define XML_SCH_CONTEXT_USER_SYMBOL ( XML_SCH_CTF_START + 0 ) @@ -87,12 +93,12 @@ #define XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ( XML_SCH_CTF_START + 23 ) #define XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ( XML_SCH_CTF_START + 24 ) +#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, EarliestODFVersionForExport ) { ApiName, sizeof(ApiName)-1, XML_NAMESPACE_##NameSpace, xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, EarliestODFVersionForExport } #define MAP_ENTRY( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_010 } #define MAP_ENTRY_ODF12( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_012 } -#define MAP_CONTEXT( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, XML_SCH_CONTEXT_##c, SvtSaveOptions::ODFVER_010 } -#define MAP_SPECIAL( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, XML_SCH_CONTEXT_SPECIAL_##c, SvtSaveOptions::ODFVER_010 } -#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, XML_SCH_CONTEXT_SPECIAL_##c, SvtSaveOptions::ODFVER_012 } -#define MAP_SPECIAL_IMP( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM_IMPORT, XML_SCH_CONTEXT_SPECIAL_##c, SvtSaveOptions::ODFVER_010 } +#define MAP_CONTEXT( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFVER_010 } +#define MAP_SPECIAL( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_010 } +#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_012 } #define MAP_ENTRY_END { 0,0,0,xmloff::token::XML_TOKEN_INVALID,0,0,SvtSaveOptions::ODFVER_010 } // --------------------------------------------------------- @@ -110,7 +116,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = { // chart subtypes MAP_ENTRY( "UpDown", CHART, XML_JAPANESE_CANDLE_STICK, XML_TYPE_BOOL ), // formerly XML_STOCK_UPDOWN_BARS - MAP_CONTEXT( "Volume", CHART, XML_STOCK_WITH_VOLUME, XML_TYPE_BOOL, STOCK_WITH_VOLUME ), + MAP_CONTEXT( "Volume", CHART, XML_STOCK_WITH_VOLUME, XML_TYPE_BOOL, XML_SCH_CONTEXT_STOCK_WITH_VOLUME ), MAP_ENTRY( "Dim3D", CHART, XML_THREE_DIMENSIONAL, XML_TYPE_BOOL ), MAP_ENTRY( "Deep", CHART, XML_DEEP, XML_TYPE_BOOL ), MAP_ENTRY( "Lines", CHART, XML_LINES, XML_TYPE_BOOL ), @@ -123,13 +129,13 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = // if type=="named-symbol" => name of symbol (square, diamond, ...) MAP_ENTRY( "SymbolType", CHART, XML_SYMBOL_NAME, XML_SCH_TYPE_NAMED_SYMBOL | MID_FLAG_MULTI_PROPERTY ), // if type=="image" => an xlink:href element with a linked (package) URI - MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, SYMBOL_IMAGE ), - MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_WIDTH, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, SYMBOL_WIDTH ), - MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_HEIGHT, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, SYMBOL_HEIGHT ), + MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE ), + MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_WIDTH, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ), + MAP_SPECIAL( "SymbolSize", CHART, XML_SYMBOL_HEIGHT, XML_TYPE_MEASURE | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT ), MAP_ENTRY( "Vertical", CHART, XML_VERTICAL, XML_TYPE_BOOL ), // #i32368# property should no longer be used as XML-property (in OASIS // format), but is still ex-/imported for compatibility with the OOo file format - MAP_CONTEXT( "NumberOfLines", CHART, XML_LINES_USED, XML_TYPE_NUMBER, LINES_USED ), + MAP_CONTEXT( "NumberOfLines", CHART, XML_LINES_USED, XML_TYPE_NUMBER, XML_SCH_CONTEXT_LINES_USED ), MAP_ENTRY( "StackedBarsConnected", CHART, XML_CONNECT_BARS, XML_TYPE_BOOL ), MAP_ENTRY_ODF12( "GroupBarsPerAxis", CHART, XML_GROUP_BARS_PER_AXIS, XML_TYPE_BOOL ), @@ -150,26 +156,31 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = // axis properties MAP_ENTRY( "DisplayLabels", CHART, XML_DISPLAY_LABEL, XML_TYPE_BOOL ), - MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, TICKS_MAJ_INNER ), // convert one constant - MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, TICKS_MAJ_OUTER ), // to two bools - MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, TICKS_MIN_INNER ), // see above - MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, TICKS_MIN_OUTER ), - MAP_CONTEXT( "Logarithmic", CHART, XML_LOGARITHMIC, XML_TYPE_BOOL, LOGARITHMIC ), - MAP_CONTEXT( "Min", CHART, XML_MINIMUM, XML_TYPE_DOUBLE, MIN ), - MAP_CONTEXT( "Max", CHART, XML_MAXIMUM, XML_TYPE_DOUBLE, MAX ), - MAP_CONTEXT( "Origin", CHART, XML_ORIGIN, XML_TYPE_DOUBLE, ORIGIN ), - MAP_CONTEXT( "StepMain", CHART, XML_INTERVAL_MAJOR, XML_TYPE_DOUBLE, STEP_MAIN ), - MAP_CONTEXT( "StepHelpCount", CHART, XML_INTERVAL_MINOR_DIVISOR, XML_TYPE_NUMBER, STEP_HELP_COUNT ), + MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_INNER ), // convert one constant + MAP_SPECIAL( "Marks", CHART, XML_TICK_MARKS_MAJOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MAJ_OUTER ), // to two bools + MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_INNER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_INNER ), // see above + MAP_SPECIAL( "HelpMarks", CHART, XML_TICK_MARKS_MINOR_OUTER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_TICKS_MIN_OUTER ), + MAP_CONTEXT( "Logarithmic", CHART, XML_LOGARITHMIC, XML_TYPE_BOOL, XML_SCH_CONTEXT_LOGARITHMIC ), + MAP_CONTEXT( "Min", CHART, XML_MINIMUM, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_MIN ), + MAP_CONTEXT( "Max", CHART, XML_MAXIMUM, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_MAX ), + MAP_CONTEXT( "Origin", CHART, XML_ORIGIN, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_ORIGIN ), + MAP_CONTEXT( "StepMain", CHART, XML_INTERVAL_MAJOR, XML_TYPE_DOUBLE, XML_SCH_CONTEXT_STEP_MAIN ), + MAP_CONTEXT( "StepHelpCount", CHART, XML_INTERVAL_MINOR_DIVISOR, XML_TYPE_NUMBER, XML_SCH_CONTEXT_STEP_HELP_COUNT ), MAP_ENTRY( "GapWidth", CHART, XML_GAP_WIDTH, XML_TYPE_NUMBER ), MAP_ENTRY( "Overlap", CHART, XML_OVERLAP, XML_TYPE_NUMBER ), MAP_ENTRY( "TextCanOverlap", CHART, XML_TEXT_OVERLAP, XML_TYPE_BOOL ), MAP_ENTRY_ODF12( "ReverseDirection", CHART, XML_REVERSE_DIRECTION, XML_TYPE_BOOL ), MAP_ENTRY( "TextBreak", TEXT, XML_LINE_BREAK, XML_TYPE_BOOL ), MAP_ENTRY( "ArrangeOrder", CHART, XML_LABEL_ARRANGEMENT, XML_SCH_TYPE_AXIS_ARRANGEMENT ), - MAP_SPECIAL( "NumberFormat", STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER, NUMBER_FORMAT ), + MAP_SPECIAL( "NumberFormat", STYLE, XML_DATA_STYLE_NAME, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT ), MAP_ENTRY( "LinkNumberFormatToSource", CHART, XML_LINK_DATA_STYLE_TO_SOURCE, XML_TYPE_BOOL ), MAP_ENTRY( "Visible", CHART, XML_VISIBLE, XML_TYPE_BOOL ), + MAP_FULL( "CrossoverPosition", CHART, XML_AXIS_POSITION, XML_SCH_TYPE_AXIS_POSITION|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0, SvtSaveOptions::ODFVER_012 ), + MAP_FULL( "CrossoverValue", CHART, XML_AXIS_POSITION, XML_SCH_TYPE_AXIS_POSITION_VALUE|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0, SvtSaveOptions::ODFVER_012 ), + MAP_FULL( "LabelPosition", CHART, XML_AXIS_LABEL_POSITION, XML_SCH_TYPE_AXIS_LABEL_POSITION, 0, SvtSaveOptions::ODFVER_012 ), + MAP_FULL( "MarkPosition", CHART, XML_TICK_MARK_POSITION, XML_SCH_TYPE_TICK_MARK_POSITION, 0, SvtSaveOptions::ODFVER_012 ), + // statistical properties MAP_ENTRY( "MeanValue", CHART, XML_MEAN_VALUE, XML_TYPE_BOOL ), MAP_ENTRY( "ErrorMargin", CHART, XML_ERROR_MARGIN, XML_TYPE_DOUBLE ), @@ -184,20 +195,20 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = MAP_ENTRY_ODF12( "ErrorBarRangeNegative", CHART, XML_ERROR_LOWER_RANGE, XML_TYPE_STRING ), // series/data-point properties - MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, DATA_LABEL_NUMBER ), // convert one constant - MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_TEXT, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, DATA_LABEL_TEXT ), // to 'tristate' and two bools - MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_SYMBOL, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, DATA_LABEL_SYMBOL ), - MAP_SPECIAL_ODF12( "LabelSeparator", CHART, XML_LABEL_SEPARATOR, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, LABEL_SEPARATOR ), + MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant + MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_TEXT, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT ), // to 'tristate' and two bools + MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_SYMBOL, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL ), + MAP_SPECIAL_ODF12( "LabelSeparator", CHART, XML_LABEL_SEPARATOR, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ), MAP_ENTRY_ODF12( "LabelPlacement", CHART, XML_LABEL_POSITION, XML_SCH_TYPE_LABEL_PLACEMENT_TYPE ), MAP_ENTRY( "SegmentOffset", CHART, XML_PIE_OFFSET, XML_TYPE_NUMBER ), - MAP_SPECIAL_ODF12( "PercentageNumberFormat", STYLE, XML_PERCENTAGE_DATA_STYLE_NAME, XML_TYPE_NUMBER, NUMBER_FORMAT ), + MAP_SPECIAL_ODF12( "PercentageNumberFormat", STYLE, XML_PERCENTAGE_DATA_STYLE_NAME, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT ), // text properties for titles - MAP_SPECIAL( "TextRotation", STYLE, XML_ROTATION_ANGLE, XML_TYPE_NUMBER, TEXT_ROTATION ), // convert 1/100th degrees to degrees + MAP_SPECIAL( "TextRotation", STYLE, XML_ROTATION_ANGLE, XML_TYPE_NUMBER, XML_SCH_CONTEXT_SPECIAL_TEXT_ROTATION ), // convert 1/100th degrees to degrees MAP_ENTRY( "StackedText", STYLE, XML_DIRECTION, XML_SCH_TYPE_TEXT_ORIENTATION ), // for compatability to pre 6.0beta documents -// MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE_NAME, XML_TYPE_STRING, SYMBOL_IMAGE_NAME ), +// MAP_SPECIAL( "SymbolBitmapURL", CHART, XML_SYMBOL_IMAGE_NAME, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE_NAME ), MAP_ENTRY( "ChartUserDefinedAttributes", TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM ), @@ -208,6 +219,23 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = // maps for enums to XML attributes // ---------------------------------------- +SvXMLEnumMapEntry aXMLChartAxisLabelPositionEnumMap[] = +{ + { ::xmloff::token::XML_NEAR_AXIS, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS }, + { ::xmloff::token::XML_NEAR_AXIS_OTHER_SIDE, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE }, + { ::xmloff::token::XML_OUTSIDE_START, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START }, + { ::xmloff::token::XML_OUTSIDE_END, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END }, + { ::xmloff::token::XML_TOKEN_INVALID, 0 } +}; + +SvXMLEnumMapEntry aXMLChartAxisMarkPositionEnumMap[] = +{ + { ::xmloff::token::XML_AT_LABELS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS }, + { ::xmloff::token::XML_AT_AXIS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS }, + { ::xmloff::token::XML_AT_LABELS_AND_AXIS, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS }, + { ::xmloff::token::XML_TOKEN_INVALID, 0 } +}; + SvXMLEnumMapEntry aXMLChartAxisArrangementEnumMap[] = { { ::xmloff::token::XML_SIDE_BY_SIDE, ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE }, diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 9ec7e327d076..14794da9d43f 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -54,6 +54,7 @@ #include "XMLErrorBarStylePropertyHdl.hxx" #include "XMLTextOrientationHdl.hxx" #include "XMLSymbolTypePropertyHdl.hxx" +#include "XMLAxisPositionPropertyHdl.hxx" #include <com/sun/star/chart/ChartAxisMarks.hpp> #include <com/sun/star/chart/ChartDataCaption.hpp> #include <com/sun/star/chart/ChartSymbolType.hpp> @@ -61,6 +62,7 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> // header for any2enum #include <comphelper/extract.hxx> @@ -94,6 +96,23 @@ const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32 { switch( nType ) { + case XML_SCH_TYPE_AXIS_POSITION: + pHdl = new XMLAxisPositionPropertyHdl( false ); + break; + case XML_SCH_TYPE_AXIS_POSITION_VALUE: + pHdl = new XMLAxisPositionPropertyHdl( true ); + break; + + case XML_SCH_TYPE_AXIS_LABEL_POSITION: + pHdl = new XMLEnumPropertyHdl( aXMLChartAxisLabelPositionEnumMap, + ::getCppuType((const chart::ChartAxisLabelPosition*)0) ); + break; + + case XML_SCH_TYPE_TICK_MARK_POSITION: + pHdl = new XMLEnumPropertyHdl( aXMLChartAxisMarkPositionEnumMap, + ::getCppuType((const chart::ChartAxisMarkPosition*)0) ); + break; + case XML_SCH_TYPE_AXIS_ARRANGEMENT: pHdl = new XMLEnumPropertyHdl( aXMLChartAxisArrangementEnumMap, ::getCppuType((const chart::ChartAxisArrangeOrderType*)0) ); diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 8b18a74a9bc0..bcf1f7abb3bf 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -51,15 +51,20 @@ #include "xexptran.hxx" #include <cppuhelper/implbase1.hxx> -#include <com/sun/star/xml/sax/XAttributeList.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> + +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> #include <com/sun/star/chart/XAxisZSupplier.hpp> -#include <com/sun/star/util/XStringMapping.hpp> +#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> + #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> @@ -67,18 +72,19 @@ #include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> + #include <com/sun/star/drawing/CameraGeometry.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> - -#include <com/sun/star/awt/Point.hpp> -#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XStringMapping.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> using namespace com::sun::star; using namespace ::xmloff::token; using ::rtl::OUString; +using com::sun::star::uno::Reference; static __FAR_DATA SvXMLEnumMapEntry aXMLAxisClassMap[] = { @@ -109,6 +115,19 @@ OUString lcl_ConvertRange( const ::rtl::OUString & rRange, const uno::Reference< return aResult; } +Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSystem > xCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) +{ + Reference< chart2::XAxis > xAxis; + try + { + xAxis = xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ); + } + catch( uno::Exception & ) + { + } + return xAxis; +} + } // anonymous namespace SchXML3DSceneAttributesHelper::SchXML3DSceneAttributesHelper( SvXMLImport& rImporter ) @@ -184,6 +203,7 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( mbHasSize(false), mbHasPosition(false), mbPercentStacked(false), + m_bAxisPositionAttributeImported(false), mrChartAddress( rChartAddress ), mrHasOwnTable( rHasOwnTable ), mrAllRangeAddressesAvailable( rAllRangeAddressesAvailable ), @@ -537,8 +557,16 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( bAdaptWrongPercentScaleValues = true; } - pContext = new SchXMLAxisContext( mrImportHelper, GetImport(), rLocalName, - mxDiagram, maAxes, mrCategoriesAddress, bAddMissingXAxisForNetCharts, bAdaptWrongPercentScaleValues ); + bool bAdaptXAxisOrientationForOld2DBarCharts = false; + if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_4( GetImport().GetModel() ) ) + { + //issue74660 + if( maChartTypeServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ColumnChartType" )) ) + bAdaptXAxisOrientationForOld2DBarCharts = true; + } + + pContext = new SchXMLAxisContext( mrImportHelper, GetImport(), rLocalName, mxDiagram, maAxes, mrCategoriesAddress, + bAddMissingXAxisForNetCharts, bAdaptWrongPercentScaleValues, bAdaptXAxisOrientationForOld2DBarCharts, m_bAxisPositionAttributeImported ); } break; @@ -692,6 +720,129 @@ void SchXMLPlotAreaContext::EndElement() if( mbHasPosition ) xDiaShape->setPosition( maPosition ); } + + CorrectAxisPositions(); +} + +void SchXMLPlotAreaContext::CorrectAxisPositions() +{ + ::rtl::OUString aODFVersionOfFile( GetImport().GetODFVersion() ); + + if( ( !aODFVersionOfFile.getLength() || aODFVersionOfFile.equalsAscii("1.0") + || aODFVersionOfFile.equalsAscii("1.1") + || ( aODFVersionOfFile.equalsAscii("1.2") && !m_bAxisPositionAttributeImported ) ) ) + { + uno::Reference< chart2::XChartDocument > xNewDoc( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ); + + try + { + Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW ); + uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); + if( aCooSysSeq.getLength() ) + { + Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); + if( xCooSys.is() ) + { + Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 ); + Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 ); + //Reference< chart2::XAxis > xMajorZAxis = lcl_getAxis( xCooSys, 2, 0 ); + Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 ); + Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 ); + + uno::Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY ); + + if( xMainXAxisProp.is() && xMainYAxisProp.is() ) + { + chart2::ScaleData aMainXScale = xMainXAxis->getScaleData(); + if( 0 == maChartTypeServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.chart2.ScatterChartType" ) ) ) + { + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); + double fCrossoverValue = 0.0; + aMainXScale.Origin >>= fCrossoverValue; + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverValue") + , uno::makeAny( fCrossoverValue ) ); + + if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) + { + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("LabelPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("MarkPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); + if( xSecondaryYAxisProp.is() ) + xSecondaryYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); + } + else + { + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("LabelPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("MarkPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); + if( xSecondaryYAxisProp.is() ) + xSecondaryYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); + } + } + else + { + if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE ) + { + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); + if( xSecondaryYAxisProp.is() ) + xSecondaryYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); + } + else + { + xMainYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); + if( xSecondaryYAxisProp.is() ) + xSecondaryYAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); + } + } + + chart2::ScaleData aMainYScale = xMainYAxis->getScaleData(); + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE) ); + double fCrossoverValue = 0.0; + aMainYScale.Origin >>= fCrossoverValue; + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverValue") + , uno::makeAny( fCrossoverValue ) ); + + if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE ) + { + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("LabelPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END) ); + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("MarkPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); + if( xSecondaryXAxisProp.is() ) + xSecondaryXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START) ); + } + else + { + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("LabelPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) ); + xMainXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("MarkPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS) ); + if( xSecondaryXAxisProp.is() ) + xSecondaryXAxisProp->setPropertyValue( rtl::OUString::createFromAscii("CrossoverPosition") + , uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_END) ); + } + } + } + } + } + catch( uno::Exception & ) + { + } + } } // ======================================== @@ -702,14 +853,18 @@ SchXMLAxisContext::SchXMLAxisContext( SchXMLImportHelper& rImpHelper, std::vector< SchXMLAxis >& aAxes, ::rtl::OUString & rCategoriesAddress, bool bAddMissingXAxisForNetCharts, - bool bAdaptWrongPercentScaleValues ) : + bool bAdaptWrongPercentScaleValues, + bool bAdaptXAxisOrientationForOld2DBarCharts, + bool& rbAxisPositionAttributeImported ) : SvXMLImportContext( rImport, XML_NAMESPACE_CHART, rLocalName ), mrImportHelper( rImpHelper ), mxDiagram( xDiagram ), maAxes( aAxes ), mrCategoriesAddress( rCategoriesAddress ), mbAddMissingXAxisForNetCharts( bAddMissingXAxisForNetCharts ), - mbAdaptWrongPercentScaleValues( bAdaptWrongPercentScaleValues ) + mbAdaptWrongPercentScaleValues( bAdaptWrongPercentScaleValues ), + mbAdaptXAxisOrientationForOld2DBarCharts( bAdaptXAxisOrientationForOld2DBarCharts ), + m_rbAxisPositionAttributeImported( rbAxisPositionAttributeImported ) { } @@ -1132,7 +1287,10 @@ void SchXMLAxisContext::CreateAxis() if( pStyle && pStyle->ISA( XMLPropStyleContext )) { - (( XMLPropStyleContext* )pStyle )->FillPropertySet( xProp ); + // note: SvXMLStyleContext::FillPropertySet is not const + XMLPropStyleContext * pPropStyleContext = const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle )); + if( pPropStyleContext ) + pPropStyleContext->FillPropertySet( xProp ); if( mbAdaptWrongPercentScaleValues && maCurrentAxis.eClass==SCH_XML_AXIS_Y ) { @@ -1177,6 +1335,44 @@ void SchXMLAxisContext::CreateAxis() , uno::makeAny(drawing::LineStyle_NONE)); } } + + if( mbAdaptXAxisOrientationForOld2DBarCharts && maCurrentAxis.eClass == SCH_XML_AXIS_X ) + { + bool bIs3DChart = false; + if( xDiaProp.is() && ( xDiaProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dim3D"))) >>= bIs3DChart ) + && !bIs3DChart ) + { + uno::Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY ); + if( xChart2Document.is() ) + { + uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY ); + if( xCooSysCnt.is() ) + { + uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); + if( aCooSysSeq.getLength() ) + { + bool bSwapXandYAxis = false; + uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] ); + uno::Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); + if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwapXAndYAxis"))) >>= bSwapXandYAxis ) + && bSwapXandYAxis ) + { + uno::Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, maCurrentAxis.nIndexInCategory ); + if( xAxis.is() ) + { + chart2::ScaleData aScaleData = xAxis->getScaleData(); + aScaleData.Orientation = chart2::AxisOrientation_REVERSE; + xAxis->setScaleData( aScaleData ); + } + } + } + } + } + } + } + + m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CrossoverPosition")), pPropStyleContext, pStylesCtxt ).hasValue(); } } } diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index b9757daa7d0b..2d14f9c644dc 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -96,6 +96,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); virtual void EndElement(); + void CorrectAxisPositions(); + private: SchXMLImportHelper& mrImportHelper; ::com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram; @@ -115,6 +117,7 @@ private: bool mbHasSize; bool mbHasPosition; bool mbPercentStacked; + bool m_bAxisPositionAttributeImported; ::rtl::OUString msAutoStyleName; ::rtl::OUString& mrChartAddress; sal_Bool & mrHasOwnTable; @@ -146,6 +149,8 @@ private: rtl::OUString& mrCategoriesAddress; bool mbAddMissingXAxisForNetCharts; //to correct errors from older versions bool mbAdaptWrongPercentScaleValues; //to correct errors from older versions + bool mbAdaptXAxisOrientationForOld2DBarCharts; //to correct different behaviour from older versions + bool& m_rbAxisPositionAttributeImported; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTitleShape(); void CreateGrid( ::rtl::OUString sAutoStyleName, sal_Bool bIsMajor ); @@ -159,7 +164,9 @@ public: std::vector< SchXMLAxis >& aAxes, ::rtl::OUString& rCategoriesAddress, bool bAddMissingXAxisForNetCharts, - bool bAdaptWrongPercentScaleValues ); + bool bAdaptWrongPercentScaleValues, + bool bAdaptXAxisOrientationForOld2DBarCharts, + bool& rbAxisPositionAttributeImported ); virtual ~SchXMLAxisContext(); virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 364c7edb534c..1650da2e3623 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -108,6 +108,21 @@ rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >& return aGenerator; } +sal_Int32 lcl_getBuildIDFromGenerator( const ::rtl::OUString& rGenerator ) +{ + //returns -1 if nothing found + sal_Int32 nBuildId = -1; + const OUString sBuildCompare( RTL_CONSTASCII_USTRINGPARAM( "$Build-" ) ); + sal_Int32 nEnd = -1; + sal_Int32 nBegin = rGenerator.indexOf( sBuildCompare, nEnd ); + if( nBegin != -1 ) + { + OUString sBuildId( rGenerator.copy( nBegin + sBuildCompare.getLength() ) ); + nBuildId = sBuildId.toInt32(); + } + return nBuildId; +} + } // anonymous namespace // ---------------------------------------- @@ -580,6 +595,20 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame: return bResult; } +bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const uno::Reference< frame::XModel >& xChartModel ) +{ + if( isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ) ) + return true; + + if( isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ) ) + { + sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( nBuilId>0 && nBuilId<=9238 ) //9238 is build id of OpenOffice.org 2.3.1 + return true; + } + return false; +} + bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame::XModel >& xChartModel ) { bool bResult = false; diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 378eedc1ac77..dad5a396b6c4 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -54,6 +54,7 @@ class SvXMLExport; 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); enum SchXMLChartTypeEnum diff --git a/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx b/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx new file mode 100644 index 000000000000..45b62f0cea04 --- /dev/null +++ b/xmloff/source/chart/XMLAxisPositionPropertyHdl.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XMLAxisPositionPropertyHdl.cxx,v $ + * $Revision: 1.1.2.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_xmloff.hxx" +#include "XMLAxisPositionPropertyHdl.hxx" +#include <xmloff/xmluconv.hxx> +#include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <rtl/ustrbuf.hxx> + +using namespace ::xmloff::token; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +using namespace com::sun::star; + +XMLAxisPositionPropertyHdl::XMLAxisPositionPropertyHdl( bool bCrossingValue ) + : m_bCrossingValue( bCrossingValue ) +{} + +XMLAxisPositionPropertyHdl::~XMLAxisPositionPropertyHdl() +{} + +sal_Bool XMLAxisPositionPropertyHdl::importXML( const OUString& rStrImpValue, + uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const +{ + sal_Bool bResult = false; + + if( rStrImpValue.equals( GetXMLToken(XML_START) ) ) + { + if( !m_bCrossingValue ) + { + rValue <<= ::com::sun::star::chart::ChartAxisPosition_START; + bResult = true; + } + } + else if( rStrImpValue.equals( GetXMLToken(XML_END) ) ) + { + if( !m_bCrossingValue ) + { + rValue <<= ::com::sun::star::chart::ChartAxisPosition_END; + bResult = true; + } + } + else + { + if( !m_bCrossingValue ) + { + rValue <<= ::com::sun::star::chart::ChartAxisPosition_VALUE; + bResult = true; + } + else + { + double fDblValue=0.0; + bResult = SvXMLUnitConverter::convertDouble( fDblValue, rStrImpValue ); + rValue <<= fDblValue; + } + } + + return bResult; +} + +sal_Bool XMLAxisPositionPropertyHdl::exportXML( OUString& rStrExpValue, + const uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const +{ + sal_Bool bResult = sal_False; + + rtl::OUStringBuffer sValueBuffer; + if( m_bCrossingValue ) + { + if(rStrExpValue.getLength() == 0) + { + double fValue = 0.0; + rValue >>= fValue; + SvXMLUnitConverter::convertDouble( sValueBuffer, fValue ); + rStrExpValue = sValueBuffer.makeStringAndClear(); + bResult = true; + } + } + else + { + ::com::sun::star::chart::ChartAxisPosition ePosition( ::com::sun::star::chart::ChartAxisPosition_ZERO ); + rValue >>= ePosition; + switch(ePosition) + { + case ::com::sun::star::chart::ChartAxisPosition_START: + rStrExpValue = GetXMLToken( XML_START ); + bResult = true; + break; + case ::com::sun::star::chart::ChartAxisPosition_END: + rStrExpValue = GetXMLToken( XML_END ); + bResult = true; + break; + case ::com::sun::star::chart::ChartAxisPosition_ZERO: + SvXMLUnitConverter::convertDouble( sValueBuffer, 0.0 ); + rStrExpValue = sValueBuffer.makeStringAndClear(); + bResult = true; + break; + default: + break; + } + } + return bResult; +} diff --git a/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx b/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx new file mode 100644 index 000000000000..592973ddd3bd --- /dev/null +++ b/xmloff/source/chart/XMLAxisPositionPropertyHdl.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XMLAxisPositionPropertyHdl.hxx,v $ + * $Revision: 1.1.2.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _XMLAXISPOSITIONPROPERTYHDL_HXX_ +#define _XMLAXISPOSITIONPROPERTYHDL_HXX_ + +#include <xmloff/xmlprhdl.hxx> + +class XMLAxisPositionPropertyHdl : public XMLPropertyHandler +{ +public: + XMLAxisPositionPropertyHdl( bool bCrossingValue ); + virtual ~XMLAxisPositionPropertyHdl(); + + virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + +private: + bool m_bCrossingValue; +}; + +#endif // _XMLAXISPOSITIONPROPERTYHDL_HXX_ diff --git a/xmloff/source/chart/makefile.mk b/xmloff/source/chart/makefile.mk index d2231d3e3d1d..9fa346e8916e 100644 --- a/xmloff/source/chart/makefile.mk +++ b/xmloff/source/chart/makefile.mk @@ -63,6 +63,7 @@ SLOFILES = $(SLO)$/ColorPropertySet.obj \ $(SLO)$/XMLLabelSeparatorContext.obj \ $(SLO)$/XMLTextOrientationHdl.obj \ $(SLO)$/XMLSymbolTypePropertyHdl.obj \ + $(SLO)$/XMLAxisPositionPropertyHdl.obj \ $(SLO)$/transporttypes.obj # --- Targets -------------------------------------------------------------- diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index fd096851ea05..ad7ea20cd2f5 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3056,6 +3056,17 @@ namespace xmloff { namespace token { TOKEN( "isotropic", XML_ISOTROPIC ), TOKEN( "anisotropic", XML_ANISOTROPIC ), + TOKEN( "axis-position", XML_AXIS_POSITION ), + TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ), + TOKEN( "near-axis", XML_NEAR_AXIS ), + TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ), + TOKEN( "outside-minimum", XML_OUTSIDE_START ), + TOKEN( "outside-maximum", XML_OUTSIDE_END ), + TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ), + TOKEN( "at-labels", XML_AT_LABELS ), + TOKEN( "at-axis", XML_AT_AXIS ), + TOKEN( "at-labels-and-axis", XML_AT_LABELS_AND_AXIS ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else |