diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-06-04 09:41:18 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-06-04 09:41:18 +0000 |
commit | 927c53ecf748677638e8722352b3710f349be912 (patch) | |
tree | ed3d689301dc574c9335569cb41c54d3b9b6e03a /oox | |
parent | d108d1ebd9a6eb5970cdea78efa18f1524e0fa8a (diff) |
CWS-TOOLING: integrate CWS chart37
2009-05-22 09:10:36 +0200 iha r272170 : #i102130# color of pies is not loaded correctly
2009-04-27 17:16:20 +0200 iha r271294 : #i24203# compiler problem
2009-04-27 16:43:21 +0200 iha r271292 : #i101281# missing API documentation for secondary axis title properties
2009-04-27 15:26:05 +0200 hde r271276 : #i100987
2009-04-27 15:24:42 +0200 hde r271273 : #i100987
2009-04-24 15:08:33 +0200 iha r271214 : #i100995# crash with some logarithmic scalings
2009-04-22 18:50:56 +0200 dr r271134 : #i82177# write out deleted point labels
2009-04-22 18:40:48 +0200 iha r271133 : #i101281# missing API documentation for secondary axis title properties
2009-04-22 16:39:42 +0200 dr r271128 : #i82177# extensions for bubble charts
2009-04-22 14:37:00 +0200 dr r271114 : #i82177# import/export data label type and separator
2009-04-22 14:36:24 +0200 dr r271113 : #i82177# import/export data label type and separator
2009-04-21 15:25:26 +0200 dr r271038 : #i82177# import data label type and separator from BIFF8 CHFR records
2009-04-21 14:37:16 +0200 dr r271037 : #i82177# dump BIFF8 chart future records
2009-04-20 17:44:27 +0200 iha r271002 : #i96898# reduce library exports
2009-04-20 13:01:13 +0200 iha r270975 : #i24203# rotate data labels - help ids
2009-04-20 11:40:33 +0200 dr r270969 : #i96600# export of axis scaling/positioning properties
2009-04-16 16:02:31 +0200 dr r270892 : #i69599# keep Y axis left in 3d charts
2009-04-15 18:16:46 +0200 dr r270859 : #i69599# import of axis position settings
2009-04-15 18:16:01 +0200 dr r270858 : #i69599# correct handling of logarithmic crossing axes
2009-04-14 16:27:48 +0200 dr r270794 : #i96599# handle auto axis position on logarithmic axes
2009-04-09 19:59:51 +0200 dr r270722 : #i96599# import axis crossing settings, fix import of logarithmic scaling settings
2009-04-09 18:26:00 +0200 iha r270720 : #i96898# reduce library exports
2009-04-09 15:17:04 +0200 iha r270710 : #i96898# reduce library exports
2009-04-09 10:50:14 +0200 dr r270682 : #i24203# import/export of data label rotation, fixed some other broken stuff too
2009-04-08 16:54:54 +0200 dr r270657 : #i24203# import rotation for data point labels
2009-04-06 18:19:17 +0200 iha r270571 : #i100876# Axis scaling settings dialog wrong after API usage (anys different from double type)
2009-04-06 15:57:05 +0200 iha r270567 : #i100105# #i58585# leftover ->
2009-04-06 15:55:48 +0200 iha r270564 : #i58585# leftover ->
2009-04-02 16:41:07 +0200 iha r270422 : #i99721# remove unused code
2009-04-02 14:29:03 +0200 iha r270407 : #i99721# remove unused code
2009-03-26 10:58:23 +0100 iha r270059 : #i96898# reduce library exports
2009-03-26 10:13:49 +0100 iha r270055 : #i96898# reduce library exports
2009-03-25 09:39:13 +0100 iha r269998 : CWS-TOOLING: rebase CWS chart37 to trunk@269781 (milestone: DEV300:m44)
2009-03-24 17:56:56 +0100 iha r269986 : #i96898# reduce library exports
2009-03-24 16:56:44 +0100 iha r269974 : #i99721# remove unused code
2009-03-24 16:48:48 +0100 iha r269970 : #i89731# remove unused string
2009-03-24 15:44:04 +0100 iha r269961 : remove unused code
2009-03-24 15:22:45 +0100 iha r269959 : remove unused code
2009-03-24 15:17:17 +0100 iha r269957 : remove unused code
2009-03-24 11:14:53 +0100 iha r269923 : #i24203# rotate data labels
2009-03-09 12:10:25 +0100 hde r269076 : #i99300#
2009-03-06 15:56:26 +0100 iha r269011 : #i93953# Source Format for secondary axis without data
2009-02-17 15:59:05 +0100 iha r268177 : avoid warning during build
2009-02-17 15:01:59 +0100 iha r268173 : avoid warning during build
2009-02-13 09:39:03 +0100 ufi r267693 : i96999
2009-02-11 15:12:35 +0100 iha r267604 : removed unused string
2009-02-11 14:00:29 +0100 iha r267600 : #i96999# Corrected wording from 'correlation coefficient' to 'coefficient of determination'
2009-02-11 10:56:45 +0100 iha r267584 : #i89731# typo in resource string
2009-02-11 10:01:29 +0100 iha r267582 : #i89031# compile error on asian windows systems
2009-02-10 16:15:16 +0100 iha r267552 : #i24203# rotate data labels
2009-02-04 18:00:33 +0100 iha r267395 : #i98893# don't export defaults to file
2009-02-04 15:48:15 +0100 iha r267390 : #i92128# asian typography for chart elements
2009-02-04 15:17:41 +0100 iha r267386 : #i92128# asian typography for chart elements
2009-01-30 14:41:10 +0100 iha r267197 : CWS-TOOLING: rebase CWS chart37 to trunk@267171 (milestone: DEV300:m41)
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/drawingml/chart/objectformatter.hxx | 3 | ||||
-rw-r--r-- | oox/inc/oox/dump/biffdumper.hxx | 1 | ||||
-rw-r--r-- | oox/inc/oox/dump/dumperbase.hxx | 44 | ||||
-rw-r--r-- | oox/inc/oox/helper/helper.hxx | 20 | ||||
-rw-r--r-- | oox/inc/oox/xls/biffhelper.hxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/chart/axisconverter.cxx | 114 | ||||
-rw-r--r-- | oox/source/drawingml/chart/objectformatter.cxx | 18 | ||||
-rw-r--r-- | oox/source/drawingml/chart/plotareaconverter.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titleconverter.cxx | 2 | ||||
-rw-r--r-- | oox/source/dump/biffdumper.cxx | 77 | ||||
-rw-r--r-- | oox/source/dump/biffdumper.ini | 42 |
12 files changed, 256 insertions, 80 deletions
diff --git a/oox/inc/oox/drawingml/chart/objectformatter.hxx b/oox/inc/oox/drawingml/chart/objectformatter.hxx index 15487a832051..8ee9397075ce 100644 --- a/oox/inc/oox/drawingml/chart/objectformatter.hxx +++ b/oox/inc/oox/drawingml/chart/objectformatter.hxx @@ -128,7 +128,8 @@ public: /** Sets text rotation properties to the passed property set. */ void convertTextRotation( PropertySet& rPropSet, - const ModelRef< TextBody >& rxTextProp ); + const ModelRef< TextBody >& rxTextProp, + bool bSupportsStacked ); /** Sets number format properties to the passed property set. */ void convertNumberFormat( diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx index 85f761e3e587..a7f021ed5244 100644 --- a/oox/inc/oox/dump/biffdumper.hxx +++ b/oox/inc/oox/dump/biffdumper.hxx @@ -216,6 +216,7 @@ protected: FormatType eFmtType = FORMATTYPE_DEC ); sal_uInt16 dumpRepeatedRecId(); + void dumpFrHeader( bool bWithFlags, bool bWithRange ); void dumpDffClientRect(); void dumpEmbeddedDff(); diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx index fea1726d787e..0c5314c4adc7 100644 --- a/oox/inc/oox/dump/dumperbase.hxx +++ b/oox/inc/oox/dump/dumperbase.hxx @@ -1408,6 +1408,11 @@ protected: template< typename Type > void writeValueItem( const ItemFormat& rItemFmt, Type nData ); + template< typename Type > + void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' ); + template< typename Type > + void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' ); + private: OutputRef mxOut; }; @@ -1503,6 +1508,24 @@ void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData ) writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName ); } +template< typename Type > +void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep ) +{ + ItemGuard aItem( *mxOut, rName ); + mxOut->writeDec( nData1 ); + mxOut->writeChar( cSep ); + mxOut->writeDec( nData2 ); +} + +template< typename Type > +void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep ) +{ + ItemGuard aItem( *mxOut, rName ); + mxOut->writeHex( nData1 ); + mxOut->writeChar( cSep ); + mxOut->writeHex( nData2 ); +} + // ============================================================================ // ============================================================================ @@ -1589,6 +1612,11 @@ protected: template< typename Type1, typename Type2 > Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt ); + template< typename Type > + void dumpDecPair( const String& rName, sal_Unicode cSep = ',' ); + template< typename Type > + void dumpHexPair( const String& rName, sal_Unicode cSep = ',' ); + private: BinaryInputStreamRef mxStrm; }; @@ -1702,6 +1730,22 @@ Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt ) return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) ); } +template< typename Type > +void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep ) +{ + Type nData1, nData2; + *mxStrm >> nData1 >> nData2; + writeDecPairItem( rName, nData1, nData2, cSep ); +} + +template< typename Type > +void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep ) +{ + Type nData1, nData2; + *mxStrm >> nData1 >> nData2; + writeHexPairItem( rName, nData1, nData2, cSep ); +} + // ============================================================================ // ============================================================================ diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index 53e3b903e35d..f22bc56e27bd 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -32,7 +32,10 @@ #define OOX_HELPER_HELPER_HXX #include <algorithm> +#include <limits> +#include <boost/static_assert.hpp> #include <osl/endian.h> +#include <rtl/math.hxx> #include <rtl/string.hxx> #include <rtl/ustring.hxx> #include <string.h> @@ -79,6 +82,23 @@ inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax ) return static_cast< ReturnType >( ::std::min( ::std::max( nValue, nMin ), nMax ) ); } +template< typename ReturnType, typename Type > +inline ReturnType getIntervalValue( Type nValue, Type nBegin, Type nEnd ) +{ + BOOST_STATIC_ASSERT( ::std::numeric_limits< Type >::is_integer ); + Type nInterval = nEnd - nBegin; + Type nCount = (nValue < nBegin) ? -((nBegin - nValue - 1) / nInterval + 1) : ((nValue - nBegin) / nInterval); + return static_cast< ReturnType >( nValue - nCount * nInterval ); +} + +template< typename ReturnType > +inline ReturnType getDoubleIntervalValue( double fValue, double fBegin, double fEnd ) +{ + double fInterval = fEnd - fBegin; + double fCount = (fValue < fBegin) ? -(::rtl::math::approxFloor( (fBegin - fValue - 1.0) / fInterval ) + 1.0) : ::rtl::math::approxFloor( (fValue - fBegin) / fInterval ); + return static_cast< ReturnType >( fValue - fCount * fInterval ); +} + // Read from bitfields -------------------------------------------------------- /** Returns true, if at least one of the bits set in nMask is set in nBitField. */ diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx index 09d3ffcba2b4..e2adab69d493 100644 --- a/oox/inc/oox/xls/biffhelper.hxx +++ b/oox/inc/oox/xls/biffhelper.hxx @@ -293,6 +293,12 @@ const sal_uInt16 BIFF_ID_CHFORMAT = 0x104E; const sal_uInt16 BIFF_ID_CHFORMATRUNS = 0x1050; const sal_uInt16 BIFF_ID_CHFRAME = 0x1032; const sal_uInt16 BIFF_ID_CHFRAMEPOS = 0x104F; +const sal_uInt16 BIFF_ID_CHFRBLOCKBEGIN = 0x0852; +const sal_uInt16 BIFF_ID_CHFRBLOCKEND = 0x0853; +const sal_uInt16 BIFF_ID_CHFRINFO = 0x0850; +const sal_uInt16 BIFF_ID_CHFRLABELPROPS = 0x086B; +const sal_uInt16 BIFF_ID_CHFRUNITPROPS = 0x0857; +const sal_uInt16 BIFF_ID_CHFRWRAPPER = 0x0851; const sal_uInt16 BIFF_ID_CHLABELRANGE = 0x1020; const sal_uInt16 BIFF_ID_CHLABELRANGE2 = 0x1062; const sal_uInt16 BIFF_ID_CHLEGEND = 0x1015; @@ -324,9 +330,7 @@ const sal_uInt16 BIFF_ID_CHSURFACE = 0x103F; const sal_uInt16 BIFF_ID_CHTEXT = 0x1025; const sal_uInt16 BIFF_ID_CHTICK = 0x101E; const sal_uInt16 BIFF_ID_CHTYPEGROUP = 0x1014; -const sal_uInt16 BIFF_ID_CHUNITPROPERTIES = 0x0857; const sal_uInt16 BIFF_ID_CHVALUERANGE = 0x101F; -const sal_uInt16 BIFF_ID_CHWRAPPEDRECORD = 0x0851; const sal_uInt16 BIFF_ID_CFHEADER = 0x01B0; const sal_uInt16 BIFF_ID_CFRULE = 0x01B1; const sal_uInt16 BIFF_ID_CODENAME = 0x01BA; diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 57fe9955305f..1fd8dbd61f31 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -30,6 +30,9 @@ ************************************************************************/ #include "oox/drawingml/chart/axisconverter.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/ChartAxisPosition.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart2/AxisType.hpp> @@ -80,6 +83,23 @@ void lclSetScaledValueOrClearAny( Any& orAny, const OptValue< double >& rofValue lclSetValueOrClearAny( orAny, rofValue ); } +bool lclIsLogarithmicScale( const AxisModel& rAxisModel ) +{ + return rAxisModel.mofLogBase.has() && (2.0 <= rAxisModel.mofLogBase.get()) && (rAxisModel.mofLogBase.get() <= 1000.0); +} + +::com::sun::star::chart::ChartAxisLabelPosition lclGetLabelPosition( sal_Int32 nToken ) +{ + using namespace ::com::sun::star::chart; + switch( nToken ) + { + case XML_high: return ChartAxisLabelPosition_OUTSIDE_END; + case XML_low: return ChartAxisLabelPosition_OUTSIDE_START; + case XML_nextTo: return ChartAxisLabelPosition_NEAR_AXIS; + } + return ChartAxisLabelPosition_NEAR_AXIS; +} + sal_Int32 lclGetTickMark( sal_Int32 nToken ) { using namespace ::com::sun::star::chart2::TickmarkStyle; @@ -127,17 +147,19 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // show axis labels aAxisProp.setProperty( PROP_DisplayLabels, mrModel.mnTickLabelPos != XML_none ); + aAxisProp.setProperty( PROP_LabelPosition, lclGetLabelPosition( mrModel.mnTickLabelPos ) ); // no X axis line in radar charts if( (nAxisIdx == API_X_AXIS) && (rTypeInfo.meTypeCategory == TYPECATEGORY_RADAR) ) mrModel.mxShapeProp.getOrCreate().getLineProperties().maLineFill.moFillType = XML_noFill; // axis line and tick label formatting rFormatter.convertFormatting( aAxisProp, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_AXIS ); // tick label rotation - rFormatter.convertTextRotation( aAxisProp, mrModel.mxTextProp ); + rFormatter.convertTextRotation( aAxisProp, mrModel.mxTextProp, true ); // tick mark style aAxisProp.setProperty( PROP_MajorTickmarks, lclGetTickMark( mrModel.mnMajorTickMark ) ); aAxisProp.setProperty( PROP_MinorTickmarks, lclGetTickMark( mrModel.mnMinorTickMark ) ); + aAxisProp.setProperty( PROP_MarkPosition, cssc::ChartAxisMarkPosition_AT_AXIS ); // main grid PropertySet aGridProp( xAxis->getGridProperties() ); @@ -159,7 +181,6 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo ScaleData aScaleData = xAxis->getScaleData(); // set axis type - namespace ApiAxisType = ::com::sun::star::chart2::AxisType; switch( nAxisIdx ) { case API_X_AXIS: @@ -167,23 +188,23 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo { OSL_ENSURE( (mrModel.mnTypeId == C_TOKEN( catAx )) || (mrModel.mnTypeId == C_TOKEN( dateAx )), "AxisConverter::convertFromModel - unexpected axis model type (must: c:catAx or c:dateEx)" ); - aScaleData.AxisType = ApiAxisType::CATEGORY; + aScaleData.AxisType = cssc2::AxisType::CATEGORY; aScaleData.Categories = rTypeGroup.createCategorySequence(); } else { OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( valAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:valAx)" ); - aScaleData.AxisType = ApiAxisType::REALNUMBER; + aScaleData.AxisType = cssc2::AxisType::REALNUMBER; } break; case API_Y_AXIS: OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( valAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:valAx)" ); - aScaleData.AxisType = rTypeGroup.isPercent() ? ApiAxisType::PERCENT : ApiAxisType::REALNUMBER; + aScaleData.AxisType = rTypeGroup.isPercent() ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER; break; case API_Z_AXIS: OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( serAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:serAx)" ); OSL_ENSURE( rTypeGroup.isDeep3dChart(), "AxisConverter::convertFromModel - series axis not supported by this chart type" ); - aScaleData.AxisType = ApiAxisType::SERIES; + aScaleData.AxisType = cssc2::AxisType::SERIES; break; } @@ -191,61 +212,62 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo switch( aScaleData.AxisType ) { - case ApiAxisType::CATEGORY: - case ApiAxisType::SERIES: + case cssc2::AxisType::CATEGORY: + case cssc2::AxisType::SERIES: { - // do not overlap text - aAxisProp.setProperty( PROP_TextOverlap, false ); + // do not overlap text unless all labels are visible + aAxisProp.setProperty( PROP_TextOverlap, mrModel.mnTickLabelSkip == 1 ); // do not break text into several lines aAxisProp.setProperty( PROP_TextBreak, false ); - // origin (min-cross or max-cross not supported, fall back to auto-cross) - if( pCrossingAxis && (mrModel.mnCrossAxisId == pCrossingAxis->mnAxisId) ) - lclSetValueOrClearAny( aScaleData.Origin, pCrossingAxis->mofCrossesAt ); + // do not stagger labels in two lines + aAxisProp.setProperty( PROP_ArrangeOrder, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE ); //! TODO #i58731# show n-th category } break; - case ApiAxisType::REALNUMBER: - case ApiAxisType::PERCENT: + case cssc2::AxisType::REALNUMBER: + case cssc2::AxisType::PERCENT: { // scaling algorithm - bool bLogScale = mrModel.mofLogBase.has() && (2.0 <= mrModel.mofLogBase.get()) && (mrModel.mofLogBase.get() <= 1000.0); + bool bLogScale = lclIsLogarithmicScale( mrModel ); OUString aScalingService = bLogScale ? CREATE_OUSTRING( "com.sun.star.chart2.LogarithmicScaling" ) : CREATE_OUSTRING( "com.sun.star.chart2.LinearScaling" ); - Reference< XScaling > xScaling( createInstance( aScalingService ), UNO_QUERY ); - Reference< XScaling > xLogScaling; - if( xScaling.is() ) - { - aScaleData.Scaling = xScaling; - if( bLogScale ) - xLogScaling = xScaling->getInverseScaling(); - } + aScaleData.Scaling.set( createInstance( aScalingService ), UNO_QUERY ); // min/max - lclSetScaledValueOrClearAny( aScaleData.Minimum, mrModel.mofMin, xLogScaling ); - lclSetScaledValueOrClearAny( aScaleData.Maximum, mrModel.mofMax, xLogScaling ); - // origin (min-cross or max-cross not supported, fall back to auto-cross) - if( pCrossingAxis && (mrModel.mnCrossAxisId == pCrossingAxis->mnAxisId) ) - lclSetScaledValueOrClearAny( aScaleData.Origin, pCrossingAxis->mofCrossesAt, xLogScaling ); + lclSetValueOrClearAny( aScaleData.Minimum, mrModel.mofMin ); + lclSetValueOrClearAny( aScaleData.Maximum, mrModel.mofMax ); // major increment IncrementData& rIncrementData = aScaleData.IncrementData; - lclSetValueOrClearAny( rIncrementData.Distance, mrModel.mofMajorUnit ); + lclSetScaledValueOrClearAny( rIncrementData.Distance, mrModel.mofMajorUnit, aScaleData.Scaling ); // minor increment Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements; rSubIncrementSeq.realloc( 1 ); - OptValue< sal_Int32 > onCount; - if( mrModel.mofMajorUnit.has() && mrModel.mofMinorUnit.has() && (0.0 < mrModel.mofMinorUnit.get()) && (mrModel.mofMinorUnit.get() <= mrModel.mofMajorUnit.get()) ) + Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount; + if( bLogScale ) + { + rIntervalCount <<= sal_Int32( 10 ); + } + else { - double fCount = mrModel.mofMajorUnit.get() / mrModel.mofMinorUnit.get() + 0.5; - if( (1.0 <= fCount) && (fCount < 1001.0) ) - onCount = static_cast< sal_Int32 >( fCount ); + OptValue< sal_Int32 > onCount; + if( mrModel.mofMajorUnit.has() && mrModel.mofMinorUnit.has() && (0.0 < mrModel.mofMinorUnit.get()) && (mrModel.mofMinorUnit.get() <= mrModel.mofMajorUnit.get()) ) + { + double fCount = mrModel.mofMajorUnit.get() / mrModel.mofMinorUnit.get() + 0.5; + if( (1.0 <= fCount) && (fCount < 1001.0) ) + onCount = static_cast< sal_Int32 >( fCount ); + } + lclSetValueOrClearAny( rIntervalCount, onCount ); } - lclSetValueOrClearAny( rSubIncrementSeq[ 0 ].IntervalCount, onCount ); } break; default: OSL_ENSURE( false, "AxisConverter::convertFromModel - unknown axis type" ); } + /* Do not set a value to the Origin member anymore (already done via + new axis properties 'CrossoverPosition' and 'CrossoverValue'). */ + aScaleData.Origin.clear(); + // axis orientation --------------------------------------------------- // #i85167# pie/donut charts need opposite direction at Y axis @@ -261,13 +283,25 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // number format ------------------------------------------------------ - if( (aScaleData.AxisType == ApiAxisType::REALNUMBER) || (aScaleData.AxisType == ApiAxisType::PERCENT) ) + if( (aScaleData.AxisType == cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == cssc2::AxisType::PERCENT) ) getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat ); - // axis position ------------------------------------------------------ + // position of crossing axis ------------------------------------------ + + bool bManualCrossing = mrModel.mofCrossesAt.has(); + cssc::ChartAxisPosition eAxisPos = cssc::ChartAxisPosition_VALUE; + if( !bManualCrossing ) switch( mrModel.mnCrossMode ) + { + case XML_min: eAxisPos = cssc::ChartAxisPosition_START; break; + case XML_max: eAxisPos = cssc::ChartAxisPosition_END; break; + case XML_autoZero: eAxisPos = cssc::ChartAxisPosition_VALUE; break; + } + aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos ); - cssc::ChartAxisPosition ePosition = (nAxesSetIdx == API_PRIM_AXESSET) ? cssc::ChartAxisPosition_START : cssc::ChartAxisPosition_END; - aAxisProp.setProperty( PROP_CrossoverPosition, ePosition ); + // calculate automatic origin depending on scaling mode of crossing axis + bool bCrossingLogScale = pCrossingAxis && lclIsLogarithmicScale( *pCrossingAxis ); + double fCrossingPos = bManualCrossing ? mrModel.mofCrossesAt.get() : (bCrossingLogScale ? 1.0 : 0.0); + aAxisProp.setProperty( PROP_CrossoverValue, fCrossingPos ); // axis title --------------------------------------------------------- diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index e758ebcda45c..36e245d6bb6b 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -1126,18 +1126,22 @@ void ObjectFormatter::convertTextFormatting( PropertySet& rPropSet, const TextCh pFormat->convertTextFormatting( rPropSet, rTextProps ); } -void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp ) +void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp, bool bSupportsStacked ) { if( rxTextProp.is() ) { - // Chart2 expects rotation angle as double value in range of [0,360) - double fAngle = static_cast< double >( rxTextProp->getTextProperties().moRotation.get( 0 ) ) / 60000.0; - while( fAngle < 0.0 ) fAngle += 360.0; + /* Chart2 expects rotation angle as double value in range of [0,360). + OOXML counts clockwise, Chart2 counts counterclockwise. */ + double fAngle = rxTextProp->getTextProperties().moRotation.get( 0 ); + fAngle = getDoubleIntervalValue< double >( -fAngle / 60000.0, 0.0, 360.0 ); rPropSet.setProperty( PROP_TextRotation, fAngle ); - sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); - bool bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); - rPropSet.setProperty( PROP_StackCharacters, bStacked ); + if( bSupportsStacked ) + { + sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz ); + bool bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl); + rPropSet.setProperty( PROP_StackCharacters, bStacked ); + } } } diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index 1790ff5a7ad5..3b29490853b7 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -172,15 +172,15 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, to the data provider attached to the chart document. */ if( xCoordSystem.is() ) { - // create missing axis models + // convert all axes (create missing axis models) ModelRef< AxisModel > xXAxis = lclGetOrCreateAxis( mrModel.maAxes, API_X_AXIS, rFirstTypeGroup.getTypeInfo().mbCategoryAxis ? C_TOKEN( catAx ) : C_TOKEN( valAx ) ); ModelRef< AxisModel > xYAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Y_AXIS, C_TOKEN( valAx ) ); - // convert all axes AxisConverter aXAxisConv( *this, *xXAxis ); aXAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xYAxis.get(), nAxesSetIdx, API_X_AXIS ); AxisConverter aYAxisConv( *this, *xYAxis ); aYAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xXAxis.get(), nAxesSetIdx, API_Y_AXIS ); + if( rFirstTypeGroup.isDeep3dChart() ) { ModelRef< AxisModel > xZAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Z_AXIS, C_TOKEN( serAx ) ); diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index c58cba9de8b2..9806dde43437 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -136,8 +136,9 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt // data label number format (percentage format wins over value format) rFormatter.convertNumberFormat( rPropSet, rDataLabel.maNumberFormat, bShowPercent ); - // data label text formatting (frame formatting and text rotation not supported by Chart2) + // data label text formatting (frame formatting not supported by Chart2) rFormatter.convertTextFormatting( rPropSet, rDataLabel.mxTextProp, OBJECTTYPE_DATALABEL ); + rFormatter.convertTextRotation( rPropSet, rDataLabel.mxTextProp, false ); // data label separator (do not overwrite series separator, if no explicit point separator is present) if( bDataSeriesLabel || rDataLabel.moaSeparator.has() ) diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index c31bb9e27f17..7c866666c844 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -175,7 +175,7 @@ void TitleConverter::convertFromModel( const Reference< XTitled >& rxTitled, con // frame rotation OSL_ENSURE( !mrModel.mxTextProp || !rText.mxTextBody, "TitleConverter::convertFromModel - multiple text properties" ); ModelRef< TextBody > xTextProp = mrModel.mxTextProp.is() ? mrModel.mxTextProp : rText.mxTextBody; - getFormatter().convertTextRotation( aPropSet, xTextProp ); + getFormatter().convertTextRotation( aPropSet, xTextProp, true ); } catch( Exception& ) { diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 3cf420d80bb8..110f0f5aca56 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -676,6 +676,19 @@ sal_uInt16 BiffObjectBase::dumpRepeatedRecId() return dumpHex< sal_uInt16 >( "repeated-rec-id", getRecNames() ); } +void BiffObjectBase::dumpFrHeader( bool bWithFlags, bool bWithRange ) +{ + dumpHex< sal_uInt16 >( "rec-id", getRecNames() ); + sal_Int16 nFlags = bWithFlags ? dumpHex< sal_uInt16 >( "flags", "FR-FLAGS" ) : 0x0001; + if( bWithRange ) + { + if( getFlag< sal_uInt16 >( nFlags, 0x0001 ) ) + dumpRange( "range" ); + else + dumpUnused( 8 ); + } +} + void BiffObjectBase::dumpDffClientRect() { lclDumpDffClientRect( out(), in() ); @@ -1736,6 +1749,50 @@ void WorkbookStreamObject::implDumpRecordBody() dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" ); break; + case BIFF_ID_CHFRBLOCKBEGIN: + dumpFrHeader( true, false ); + dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" ); + dumpDec< sal_uInt16 >( "context" ); + dumpDec< sal_uInt16 >( "value-1" ); + dumpDec< sal_uInt16 >( "value-2" ); + break; + + case BIFF_ID_CHFRBLOCKEND: + dumpFrHeader( true, false ); + dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" ); + if( rStrm.getRemaining() >= 6 ) + dumpUnused( 6 ); + break; + + case BIFF_ID_CHFRINFO: + { + dumpFrHeader( true, false ); + dumpDec< sal_uInt8 >( "creator", "CHFRINFO-APPVERSION" ); + dumpDec< sal_uInt8 >( "writer", "CHFRINFO-APPVERSION" ); + sal_uInt16 nCount = dumpDec< sal_uInt16 >( "rec-range-count" ); + out().resetItemIndex(); + for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex ) + dumpHexPair< sal_uInt16 >( "#rec-range", '-' ); + } + break; + + case BIFF_ID_CHFRLABELPROPS: + dumpFrHeader( true, true ); + dumpHex< sal_uInt16 >( "flags", "CHFRLABELPROPS-FLAGS" ); + dumpUniString( "separator", BIFF_STR_SMARTFLAGS ); + break; + + case BIFF_ID_CHFRUNITPROPS: + dumpFrHeader( true, false ); + dumpDec< sal_Int16 >( "preset", "CHFRUNITPROPS-PRESET" ); + dumpDec< double >( "unit" ); + dumpHex< sal_uInt16 >( "flags", "CHFRUNITPROPS-FLAGS" ); + break; + + case BIFF_ID_CHFRWRAPPER: + dumpFrHeader( true, false ); + break; + case BIFF_ID_CHLABELRANGE: dumpDec< sal_uInt16 >( "axis-crossing" ); dumpDec< sal_uInt16 >( "label-frequency" ); @@ -1884,14 +1941,6 @@ void WorkbookStreamObject::implDumpRecordBody() if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "label-rotation", "TEXTROTATION" ); break; - case BIFF_ID_CHUNITPROPERTIES: - dumpRepeatedRecId(); - dumpUnused( 2 ); - dumpDec< sal_Int16 >( "preset", "CHUNITPROPERTIES-PRESET" ); - dumpDec< double >( "unit" ); - dumpHex< sal_uInt16 >( "flags", "CHUNITPROPERTIES-FLAGS" ); - break; - case BIFF_ID_CHVALUERANGE: dumpDec< double >( "minimum" ); dumpDec< double >( "maximum" ); @@ -1901,11 +1950,6 @@ void WorkbookStreamObject::implDumpRecordBody() dumpHex< sal_uInt16 >( "flags", "CHVALUERANGE-FLAGS" ); break; - case BIFF_ID_CHWRAPPEDRECORD: - dumpRepeatedRecId(); - dumpUnused( 2 ); - break; - case BIFF_ID_CODENAME: dumpUniString( "codename" ); break; @@ -2511,8 +2555,7 @@ void WorkbookStreamObject::implDumpRecordBody() break; case BIFF_ID_SCREENTIP: - dumpRepeatedRecId(); - dumpRange(); + dumpFrHeader( false, true ); dumpNullUnicodeArray( "tooltip" ); break; @@ -2543,8 +2586,8 @@ void WorkbookStreamObject::implDumpRecordBody() break; case BIFF_ID_SHEETPROTECTION: - dumpRepeatedRecId(); - dumpUnused( 17 ); + dumpFrHeader( true, true ); + dumpUnused( 7 ); dumpHex< sal_uInt16 >( "allowed-flags", "SHEETPROTECTION-FLAGS" ); dumpUnused( 2 ); break; diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 3a3abfb17725..6c5bbb00df07 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -125,6 +125,11 @@ constlist=PIVOT-NAMELEN 0xFFFF=name-in-cache end +flagslist=FR-FLAGS + 0x0001=has-ref + 0x0002=alert-unsupported +end + # DFF ------------------------------------------------------------------------ flagslist=DFF-CLIENTANCHOR-FLAGS @@ -337,9 +342,10 @@ multilist=RECORD-NAMES-BIFF8 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,,DATAVALIDATION, 0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,, - 0x0850=,CHWRAPPEDRECORD,,,,,,CHUNITPROPERTIES + 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,,CHFRUNITPROPS 0x0858=CHPIVOTREF,,,,,,, 0x0860=,,SHEETLAYOUT,,,,,SHEETPROTECTION + 0x0868=,,,CHFRLABELPROPS,,,, # chart records 0x1058=,,,,,,,CH3DDATAFORMAT 0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT @@ -683,6 +689,32 @@ end shortlist=CHFRAMEPOS-OBJTYPE,2,any,,,legend shortlist=CHFRAMEPOS-SIZEMODE,1,manual,auto +# CHFRBLOCKBEGIN, CHFRBLOCKEND ----------------------------------------------- + +shortlist=CHFRBLOCK-TYPE,0,axes-set,,text,,axis,type-group,data-table,frame,,legend,legend-exception,,series,chart,data-format,drop-bar + +# CHFRINFO ------------------------------------------------------------------- + +shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,excel-2007 + +# CHFRLABELPROPS ------------------------------------------------------------- + +flagslist=CHFRLABELPROPS-FLAGS + 0x0001=show-series + 0x0002=show-categ + 0x0004=show-value + 0x0008=show-percent + 0x0010=show-bubble +end + +# CHFRUNITPROPS -------------------------------------------------------------- + +shortlist=CHFRUNITPROPS-PRESET,-1,manual,none,hundred,thousand,10000,100000,million,10-million,100-million,billion,trillion + +flagslist=CHFRUNITPROPS-FLAGS + 0x0002=show-unit +end + # CHLABELRANGE --------------------------------------------------------------- flagslist=CHLABELRANGE-FLAGS @@ -909,14 +941,6 @@ combilist=CHTICK-FLAGS-BIFF3 0x0020=auto-rotation end -# CHUNITPROPERTIES ----------------------------------------------------------- - -shortlist=CHUNITPROPERTIES-PRESET,-1,manual,none,hundred,thousand,(10000),(100000),million,(10million),(100million),billion,trillion - -flagslist=CHUNITPROPERTIES-FLAGS - 0x0002=show-unit -end - # CHVALUERANGE --------------------------------------------------------------- flagslist=CHVALUERANGE-FLAGS |