summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2011-01-31 17:20:05 +0100
committerVladimir Glazunov <vg@openoffice.org>2011-01-31 17:20:05 +0100
commit3726cd3d3e5e1bc0cd20d9c6fb4232b2dc2600fc (patch)
treea10c61edb8ce24da387523d35de6e98343eb343a /sc
parente4324cb9bdde38e2d4c96795b9953532dc2e6e6c (diff)
parentc98464c12853d3156350abc2af072dac2cd6b54e (diff)
CWS-TOOLING: integrate CWS chart46
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/chartpos.cxx24
-rw-r--r--sc/source/filter/excel/xechart.cxx201
-rw-r--r--[-rwxr-xr-x]sc/source/filter/excel/xichart.cxx143
-rwxr-xr-xsc/source/filter/excel/xlchart.cxx21
-rw-r--r--sc/source/filter/excel/xlroot.cxx6
-rw-r--r--sc/source/filter/inc/xechart.hxx17
-rw-r--r--sc/source/filter/inc/xichart.hxx5
-rwxr-xr-xsc/source/filter/inc/xlchart.hxx35
-rw-r--r--sc/source/filter/inc/xlroot.hxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx15
10 files changed, 406 insertions, 63 deletions
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index 56403e8a8..8be32b4ab 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -36,6 +36,22 @@
#include "document.hxx"
#include "rechead.hxx"
+namespace
+{
+ bool lcl_hasValueDataButNoDates( ScDocument* pDocument, SCCOL nCol, SCROW nRow, SCTAB nTab )
+ {
+ bool bReturn = false;
+ if (pDocument->HasValueData( nCol, nRow, nTab ))
+ {
+ //treat dates like text #i25706#
+ sal_uInt32 nNumberFormat = pDocument->GetNumberFormat( ScAddress( nCol, nRow, nTab ) );
+ short nType = pDocument->GetFormatTable()->GetType(nNumberFormat);
+ bool bIsDate = (nType & NUMBERFORMAT_DATE);
+ bReturn = !bIsDate;
+ }
+ return bReturn;
+ }
+}
ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartColP, SCROW nStartRowP, SCCOL nEndColP, SCROW nEndRowP) :
@@ -290,12 +306,12 @@ void ScChartPositioner::CheckColRowHeaders()
{
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
}
@@ -315,7 +331,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nCol1 <= nCol2 )
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
}
@@ -324,7 +340,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nRow1 <= nRow2 )
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 4295aca21..51444c1a6 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -39,6 +39,9 @@
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart/XAxisSupplier.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -169,6 +172,56 @@ bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogSc
return bIsAuto;
}
+sal_uInt16 lclGetTimeValue( const XclExpRoot& rRoot, double fSerialDate, sal_uInt16 nTimeUnit )
+{
+ DateTime aDateTime = rRoot.GetDateTimeFromDouble( fSerialDate );
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS:
+ return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
+ case EXC_CHDATERANGE_MONTHS:
+ return ::limit_cast< sal_uInt16, sal_uInt16 >( 12 * (aDateTime.GetYear() - rRoot.GetBaseYear()) + aDateTime.GetMonth() - 1, 0, SAL_MAX_INT16 );
+ case EXC_CHDATERANGE_YEARS:
+ return ::limit_cast< sal_uInt16, sal_uInt16 >( aDateTime.GetYear() - rRoot.GetBaseYear(), 0, SAL_MAX_INT16 );
+ default:
+ OSL_ENSURE( false, "lclGetTimeValue - unexpected time unit" );
+ }
+ return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
+}
+
+bool lclConvertTimeValue( const XclExpRoot& rRoot, sal_uInt16& rnValue, const Any& rAny, sal_uInt16 nTimeUnit )
+{
+ double fSerialDate;
+ bool bAuto = lclIsAutoAnyOrGetValue( fSerialDate, rAny );
+ if( !bAuto )
+ rnValue = lclGetTimeValue( rRoot, fSerialDate, nTimeUnit );
+ return bAuto;
+}
+
+sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit )
+{
+ switch( nApiTimeUnit )
+ {
+ case cssc::TimeUnit::DAY: return EXC_CHDATERANGE_DAYS;
+ case cssc::TimeUnit::MONTH: return EXC_CHDATERANGE_MONTHS;
+ case cssc::TimeUnit::YEAR: return EXC_CHDATERANGE_YEARS;
+ default: OSL_ENSURE( false, "lclGetTimeUnit - unexpected time unit" );
+ }
+ return EXC_CHDATERANGE_DAYS;
+}
+
+bool lclConvertTimeInterval( sal_uInt16 rnValue, sal_uInt16& rnTimeUnit, const Any& rAny )
+{
+ cssc::TimeInterval aInterval;
+ bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny );
+ if( !bAuto )
+ {
+ rnValue = ::limit_cast< sal_uInt16, sal_Int32 >( aInterval.Number, 1, SAL_MAX_UINT16 );
+ rnTimeUnit = lclGetTimeUnit( aInterval.TimeUnit );
+ }
+ return bAuto;
+}
+
} // namespace
// Common =====================================================================
@@ -1269,7 +1322,7 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet,
sal_uInt16 nLabelPos = EXC_CHTEXT_POS_AUTO;
if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) )
{
- using namespace ::com::sun::star::chart::DataLabelPlacement;
+ using namespace cssc::DataLabelPlacement;
if( nPlacement == rTypeInfo.mnDefaultLabelPos )
{
nLabelPos = EXC_CHTEXT_POS_DEFAULT;
@@ -1489,7 +1542,7 @@ void XclExpCh3dDataFormat::Convert( const ScfPropertySet& rPropSet )
sal_Int32 nApiType(0);
if( rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) )
{
- using namespace ::com::sun::star::chart2::DataPointGeometry3D;
+ using namespace cssc2::DataPointGeometry3D;
switch( nApiType )
{
case CUBOID:
@@ -2246,7 +2299,7 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet )
used by this property (in the RelativePosition.Anchor member)
it cannot be used to calculate the position easily. For this,
the Chart1 API will be used instead. */
- Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
+ Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW );
// coordinates in CHLEGEND record written but not used by Excel
mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE, EXC_CHFRAMEPOS_PARENT ) );
@@ -2348,9 +2401,9 @@ void XclExpChTypeGroup::ConvertType(
// spline - TODO: get from single series (#i66858#)
ScfPropertySet aTypeProp( xChartType );
- ::com::sun::star::chart2::CurveStyle eCurveStyle;
+ cssc2::CurveStyle eCurveStyle;
bool bSpline = aTypeProp.GetProperty( eCurveStyle, EXC_CHPROP_CURVESTYLE ) &&
- (eCurveStyle != ::com::sun::star::chart2::CurveStyle_LINES);
+ (eCurveStyle != cssc2::CurveStyle_LINES);
// extended type info
maTypeInfo.Set( maType.GetTypeInfo(), b3dChart, bSpline );
@@ -2546,16 +2599,53 @@ XclExpChLabelRange::XclExpChLabelRange( const XclExpChRoot& rRoot ) :
{
}
-void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrient )
+void XclExpChLabelRange::Convert( const ScaleData& rScaleData, const ScfPropertySet& rChart1Axis, bool bMirrorOrient )
{
+ /* Base time unit (using the property 'ExplicitTimeIncrement' from the old
+ chart API allows to detect axis type (date axis, if property exists),
+ and to receive the base time unit currently used in case the base time
+ unit is set to 'automatic'. */
+ cssc::TimeIncrement aTimeIncrement;
+ if( rChart1Axis.GetProperty( aTimeIncrement, EXC_CHPROP_EXPTIMEINCREMENT ) )
+ {
+ // property exists -> this is a date axis currently
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS );
+
+ // automatic base time unit, if the UNO Any 'rScaleData.TimeIncrement.TimeResolution' does not contain a valid value...
+ bool bAutoBase = !rScaleData.TimeIncrement.TimeResolution.has< cssc::TimeIncrement >();
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE, bAutoBase );
+
+ // ...but get the current base time unit from the property of the old chart API
+ sal_Int32 nApiTimeUnit = 0;
+ bool bValidBaseUnit = aTimeIncrement.TimeResolution >>= nApiTimeUnit;
+ DBG_ASSERT( bValidBaseUnit, "XclExpChLabelRange::Convert - cannot ghet base time unit" );
+ maDateData.mnBaseUnit = bValidBaseUnit ? lclGetTimeUnit( nApiTimeUnit ) : EXC_CHDATERANGE_DAYS;
+
+ /* Min/max values depend on base time unit, they specify the number of
+ days, months, or years starting from null date. */
+ bool bAutoMin = lclConvertTimeValue( GetRoot(), maDateData.mnMinDate, rScaleData.Minimum, maDateData.mnBaseUnit );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN, bAutoMin );
+ bool bAutoMax = lclConvertTimeValue( GetRoot(), maDateData.mnMaxDate, rScaleData.Maximum, maDateData.mnBaseUnit );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX, bAutoMax );
+ }
+
+ // automatic axis type detection
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE, rScaleData.AutoDateAxis );
+
+ // increment
+ bool bAutoMajor = lclConvertTimeInterval( maDateData.mnMajorStep, maDateData.mnMajorUnit, rScaleData.TimeIncrement.MajorTimeInterval );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR, bAutoMajor );
+ bool bAutoMinor = lclConvertTimeInterval( maDateData.mnMinorStep, maDateData.mnMinorUnit, rScaleData.TimeIncrement.MinorTimeInterval );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR, bAutoMinor );
+
// origin
double fOrigin = 0.0;
if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) )
- maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
+ maLabelData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
// reverse order
- if( (rScaleData.Orientation == ::com::sun::star::chart2::AxisOrientation_REVERSE) != bMirrorOrient )
- ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE );
+ if( (rScaleData.Orientation == cssc2::AxisOrientation_REVERSE) != bMirrorOrient )
+ ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE );
}
void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
@@ -2564,19 +2654,55 @@ void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION );
double fCrossingPos = 1.0;
rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE );
+
+ bool bDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS );
switch( eAxisPos )
{
- case cssc::ChartAxisPosition_ZERO: maData.mnCross = 1; break;
- case cssc::ChartAxisPosition_START: maData.mnCross = 1; break;
- case cssc::ChartAxisPosition_END: ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); break;
- case cssc::ChartAxisPosition_VALUE: maData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 ); break;
- default: maData.mnCross = 1;
+ case cssc::ChartAxisPosition_ZERO:
+ case cssc::ChartAxisPosition_START:
+ maLabelData.mnCross = 1;
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ break;
+ case cssc::ChartAxisPosition_END:
+ ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_MAXCROSS );
+ break;
+ case cssc::ChartAxisPosition_VALUE:
+ maLabelData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS, false );
+ if( bDateAxis )
+ maDateData.mnCross = lclGetTimeValue( GetRoot(), fCrossingPos, maDateData.mnBaseUnit );
+ break;
+ default:
+ maLabelData.mnCross = 1;
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ }
+}
+
+void XclExpChLabelRange::Save( XclExpStream& rStrm )
+{
+ // the CHLABELRANGE record
+ XclExpRecord::Save( rStrm );
+
+ // the CHDATERANGE record with date axis settings (BIFF8 only)
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 );
+ rStrm << maDateData.mnMinDate
+ << maDateData.mnMaxDate
+ << maDateData.mnMajorStep
+ << maDateData.mnMajorUnit
+ << maDateData.mnMinorStep
+ << maDateData.mnMinorUnit
+ << maDateData.mnBaseUnit
+ << maDateData.mnCross
+ << maDateData.mnFlags;
+ rStrm.EndRecord();
}
}
void XclExpChLabelRange::WriteBody( XclExpStream& rStrm )
{
- rStrm << maData.mnCross << maData.mnLabelFreq << maData.mnTickFreq << maData.mnFlags;
+ rStrm << maLabelData.mnCross << maLabelData.mnLabelFreq << maLabelData.mnTickFreq << maLabelData.mnFlags;
}
// ----------------------------------------------------------------------------
@@ -2661,7 +2787,7 @@ namespace {
sal_uInt8 lclGetXclTickPos( sal_Int32 nApiTickmarks )
{
- using namespace ::com::sun::star::chart2::TickmarkStyle;
+ using namespace cssc2::TickmarkStyle;
sal_uInt8 nXclTickPos = 0;
::set_flag( nXclTickPos, EXC_CHTICK_INSIDE, ::get_flag( nApiTickmarks, INNER ) );
::set_flag( nXclTickPos, EXC_CHTICK_OUTSIDE, ::get_flag( nApiTickmarks, OUTER ) );
@@ -2764,6 +2890,30 @@ Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > xCoordSystem,
return xAxis;
}
+Reference< cssc::XAxis > lclGetApiChart1Axis( Reference< XChartDocument > xChartDoc,
+ sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx )
+{
+ Reference< cssc::XAxis > xChart1Axis;
+ try
+ {
+ Reference< cssc::XChartDocument > xChart1Doc( xChartDoc, UNO_QUERY_THROW );
+ Reference< cssc::XAxisSupplier > xChart1AxisSupp( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
+ switch( nApiAxesSetIdx )
+ {
+ case EXC_CHART_AXESSET_PRIMARY:
+ xChart1Axis = xChart1AxisSupp->getAxis( nApiAxisDim );
+ break;
+ case EXC_CHART_AXESSET_SECONDARY:
+ xChart1Axis = xChart1AxisSupp->getSecondaryAxis( nApiAxisDim );
+ break;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return xChart1Axis;
+}
+
} // namespace
XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
@@ -2786,7 +2936,8 @@ void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
mxTick->SetRotation( nRotation );
}
-void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis, const XclChExtTypeInfo& rTypeInfo )
+void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis,
+ Reference< cssc::XAxis > xChart1Axis, const XclChExtTypeInfo& rTypeInfo )
{
ScfPropertySet aAxisProp( xAxis );
bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z);
@@ -2806,8 +2957,11 @@ void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossi
mxLabelRange.reset( new XclExpChLabelRange( GetChRoot() ) );
mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg );
if( xAxis.is() )
+ {
+ ScfPropertySet aChart1AxisProp( xChart1Axis );
// #i71684# radar charts have reversed rotation direction
- mxLabelRange->Convert( xAxis->getScaleData(), (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
+ mxLabelRange->Convert( xAxis->getScaleData(), aChart1AxisProp, (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
+ }
// get position of crossing axis on this axis from passed axis object
if( aCrossingProp.Is() )
mxLabelRange->ConvertAxisPosition( aCrossingProp );
@@ -2935,7 +3089,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
bool b3dChart = xCoordSystem.is() && (xCoordSystem->getDimension() == 3);
// percent charts
- namespace ApiAxisType = ::com::sun::star::chart2::AxisType;
+ namespace ApiAxisType = cssc2::AxisType;
Reference< XAxis > xApiYAxis = lclGetApiAxis( xCoordSystem, EXC_CHART_AXIS_Y, nApiAxesSetIdx );
bool bPercent = xApiYAxis.is() && (xApiYAxis->getScaleData().AxisType == ApiAxisType::PERCENT);
@@ -3042,8 +3196,8 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
// inner and outer plot area position and size
try
{
- Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
- Reference< ::com::sun::star::chart::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
+ Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
+ Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
// set manual flag in chart data
if( !xPositioning->isAutomaticDiagramPositioning() )
GetChartData().SetManualPlotArea();
@@ -3110,7 +3264,8 @@ void XclExpChAxesSet::ConvertAxis(
sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx );
Reference< XAxis > xCrossingAxis = lclGetApiAxis( xCoordSystem, nCrossingAxisDim, nApiAxesSetIdx );
- rxChAxis->Convert( xAxis, xCrossingAxis, rTypeInfo );
+ Reference< cssc::XAxis > xChart1Axis = lclGetApiChart1Axis( GetChartDocument(), nApiAxisDim, nApiAxesSetIdx );
+ rxChAxis->Convert( xAxis, xCrossingAxis, xChart1Axis, rTypeInfo );
// create and convert axis title
Reference< XTitled > xTitled( xAxis, UNO_QUERY );
@@ -3173,7 +3328,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
sal_Int32 nMissingValues = 0;
if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
{
- using namespace ::com::sun::star::chart::MissingValueTreatment;
+ using namespace cssc::MissingValueTreatment;
switch( nMissingValues )
{
case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index c4f44862c..54a1c9fef 100755..100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -43,6 +43,8 @@
#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/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -147,13 +149,12 @@ XclImpStream& operator>>( XclImpStream& rStrm, XclChRectangle& rRect )
return rStrm >> rRect.mnX >> rRect.mnY >> rRect.mnWidth >> rRect.mnHeight;
}
-template< typename Type >
-void lclSetValueOrClearAny( Any& rAny, const Type& rValue, bool bClear )
+inline void lclSetValueOrClearAny( Any& rAny, double fValue, bool bClear )
{
if( bClear )
rAny.clear();
else
- rAny <<= rValue;
+ rAny <<= fValue;
}
void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bClear )
@@ -163,6 +164,50 @@ void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bC
lclSetValueOrClearAny( rAny, fValue, bClear );
}
+double lclGetSerialDay( const XclImpRoot& rRoot, sal_uInt16 nValue, sal_uInt16 nTimeUnit )
+{
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS:
+ return nValue;
+ case EXC_CHDATERANGE_MONTHS:
+ return rRoot.GetDoubleFromDateTime( Date( 1, static_cast< sal_uInt16 >( 1 + nValue % 12 ), static_cast< USHORT >( rRoot.GetBaseYear() + nValue / 12 ) ) );
+ case EXC_CHDATERANGE_YEARS:
+ return rRoot.GetDoubleFromDateTime( Date( 1, 1, static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue ) ) );
+ default:
+ OSL_ENSURE( false, "lclGetSerialDay - unexpected time unit" );
+ }
+ return nValue;
+}
+
+void lclConvertTimeValue( const XclImpRoot& rRoot, Any& rAny, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit )
+{
+ if( bAuto )
+ rAny.clear();
+ else
+ rAny <<= lclGetSerialDay( rRoot, nValue, nTimeUnit );
+}
+
+sal_Int32 lclGetApiTimeUnit( sal_uInt16 nTimeUnit )
+{
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS: return cssc::TimeUnit::DAY;
+ case EXC_CHDATERANGE_MONTHS: return cssc::TimeUnit::MONTH;
+ case EXC_CHDATERANGE_YEARS: return cssc::TimeUnit::YEAR;
+ default: OSL_ENSURE( false, "lclGetApiTimeUnit - unexpected time unit" );
+ }
+ return cssc::TimeUnit::DAY;
+}
+
+void lclConvertTimeInterval( Any& rInterval, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit )
+{
+ if( bAuto || (nValue == 0) )
+ rInterval.clear();
+ else
+ rInterval <<= cssc::TimeInterval( nValue, lclGetApiTimeUnit( nTimeUnit ) );
+}
+
} // namespace
// Common =====================================================================
@@ -2828,20 +2873,60 @@ XclImpChLabelRange::XclImpChLabelRange( const XclImpChRoot& rRoot ) :
void XclImpChLabelRange::ReadChLabelRange( XclImpStream& rStrm )
{
- rStrm >> maData.mnCross >> maData.mnLabelFreq >> maData.mnTickFreq >> maData.mnFlags;
+ rStrm >> maLabelData.mnCross >> maLabelData.mnLabelFreq >> maLabelData.mnTickFreq >> maLabelData.mnFlags;
+}
+
+void XclImpChLabelRange::ReadChDateRange( XclImpStream& rStrm )
+{
+ rStrm >> maDateData.mnMinDate
+ >> maDateData.mnMaxDate
+ >> maDateData.mnMajorStep
+ >> maDateData.mnMajorUnit
+ >> maDateData.mnMinorStep
+ >> maDateData.mnMinorUnit
+ >> maDateData.mnBaseUnit
+ >> maDateData.mnCross
+ >> maDateData.mnFlags;
}
void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const
{
- // do not overlap text unless all labels are visible
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maData.mnLabelFreq == 1 );
- // do not break text into several lines unless all labels are visible
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maData.mnLabelFreq == 1 );
- // do not stagger labels in two lines
- rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE );
+ // automatic axis type detection
+ rScaleData.AutoDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE );
+
+ // the flag EXC_CHDATERANGE_DATEAXIS specifies whether this is a date axis
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) )
+ {
+ /* Chart2 requires axis type CATEGORY for automatic category/date axis
+ (even if it is a date axis currently). */
+ rScaleData.AxisType = rScaleData.AutoDateAxis ? cssc2::AxisType::CATEGORY : cssc2::AxisType::DATE;
+ rScaleData.Scaling.set( ScfApiHelper::CreateInstance( SERVICE_CHART2_LINEARSCALING ), UNO_QUERY );
+ /* Min/max values depend on base time unit, they specify the number of
+ days, months, or years starting from null date. */
+ lclConvertTimeValue( GetRoot(), rScaleData.Minimum, maDateData.mnMinDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN ), maDateData.mnBaseUnit );
+ lclConvertTimeValue( GetRoot(), rScaleData.Maximum, maDateData.mnMaxDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX ), maDateData.mnBaseUnit );
+ // increment
+ cssc::TimeIncrement& rTimeIncrement = rScaleData.TimeIncrement;
+ lclConvertTimeInterval( rTimeIncrement.MajorTimeInterval, maDateData.mnMajorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR ), maDateData.mnMajorUnit );
+ lclConvertTimeInterval( rTimeIncrement.MinorTimeInterval, maDateData.mnMinorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR ), maDateData.mnMinorUnit );
+ // base unit
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE ) )
+ rTimeIncrement.TimeResolution.clear();
+ else
+ rTimeIncrement.TimeResolution <<= lclGetApiTimeUnit( maDateData.mnBaseUnit );
+ }
+ else
+ {
+ // do not overlap text unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maLabelData.mnLabelFreq == 1 );
+ // do not break text into several lines unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maLabelData.mnLabelFreq == 1 );
+ // do not stagger labels in two lines
+ rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE );
+ }
// reverse order
- bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient;
+ bool bReverse = ::get_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient;
rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL;
//! TODO #i58731# show n-th category
@@ -2853,13 +2938,29 @@ void XclImpChLabelRange::ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3d
does not move the Y axis in 3D charts, regardless of actual settings.
But: the Y axis has to be moved to "end", if the X axis is mirrored,
to keep it at the left end of the chart. */
- bool bMaxCross = ::get_flag( maData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS );
+ bool bMaxCross = ::get_flag( maLabelData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS );
cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE;
rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos );
- // crossing position
- double fCrossingPos = b3dChart ? 1.0 : maData.mnCross;
- rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ // crossing position (depending on axis type text/date)
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) )
+ {
+ bool bAutoCross = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ /* Crossing position value depends on base time unit, it specifies the
+ number of days, months, or years from null date. Note that Excel
+ 2007/2010 write broken BIFF8 files, they always stores the number
+ of days cregardless of the base time unit (and they are reading it
+ the same way, thus wrongly displaying files written by Excel
+ 97-2003). This filter sticks to the correct behaviour of Excel
+ 97-2003. */
+ double fCrossingPos = bAutoCross ? 1.0 : lclGetSerialDay( GetRoot(), maDateData.mnCross, maDateData.mnBaseUnit );
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ }
+ else
+ {
+ double fCrossingPos = b3dChart ? 1.0 : maLabelData.mnCross;
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ }
}
// ----------------------------------------------------------------------------
@@ -2900,6 +3001,7 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
rSubIncrementSeq.realloc( 1 );
Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount;
+ rIntervalCount.clear();
if( bLogScale )
{
if( !bAutoMinor )
@@ -2907,14 +3009,12 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
}
else
{
- sal_Int32 nCount = 0;
if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
{
double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
- if( fCount < 1001.0 )
- nCount = static_cast< sal_Int32 >( fCount );
+ if( (1.0 <= fCount) && (fCount < 1001.0) )
+ rIntervalCount <<= static_cast< sal_Int32 >( fCount );
}
- lclSetValueOrClearAny( rIntervalCount, nCount, nCount == 0 );
}
// reverse order
@@ -3035,6 +3135,11 @@ void XclImpChAxis::ReadSubRecord( XclImpStream& rStrm )
mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) );
mxLabelRange->ReadChLabelRange( rStrm );
break;
+ case EXC_ID_CHDATERANGE:
+ if( !mxLabelRange )
+ mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) );
+ mxLabelRange->ReadChDateRange( rStrm );
+ break;
case EXC_ID_CHVALUERANGE:
mxValueRange.reset( new XclImpChValueRange( GetChRoot() ) );
mxValueRange->ReadChValueRange( rStrm );
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index ead167999..a069a9a54 100755
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -329,6 +329,24 @@ XclChLabelRange::XclChLabelRange() :
// ----------------------------------------------------------------------------
+XclChDateRange::XclChDateRange() :
+ mnMinDate( 0 ),
+ mnMaxDate( 0 ),
+ mnMajorStep( 0 ),
+ mnMajorUnit( EXC_CHDATERANGE_DAYS ),
+ mnMinorStep( 0 ),
+ mnMinorUnit( EXC_CHDATERANGE_DAYS ),
+ mnBaseUnit( EXC_CHDATERANGE_DAYS ),
+ mnCross( 0 ),
+ mnFlags( EXC_CHDATERANGE_AUTOMIN | EXC_CHDATERANGE_AUTOMAX |
+ EXC_CHDATERANGE_AUTOMAJOR | EXC_CHDATERANGE_AUTOMINOR |
+ EXC_CHDATERANGE_AUTOBASE | EXC_CHDATERANGE_AUTOCROSS |
+ EXC_CHDATERANGE_AUTODATE )
+{
+}
+
+// ----------------------------------------------------------------------------
+
XclChValueRange::XclChValueRange() :
mfMin( 0.0 ),
mfMax( 0.0 ),
@@ -336,7 +354,8 @@ XclChValueRange::XclChValueRange() :
mfMinorStep( 0.0 ),
mfCross( 0.0 ),
mnFlags( EXC_CHVALUERANGE_AUTOMIN | EXC_CHVALUERANGE_AUTOMAX |
- EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR | EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 )
+ EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR |
+ EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 )
{
}
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 7ad19b9a3..b37497596 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -326,6 +326,12 @@ DateTime XclRoot::GetNullDate() const
return *GetFormatter().GetNullDate();
}
+sal_uInt16 XclRoot::GetBaseYear() const
+{
+ // return 1904 for 1904-01-01, and 1900 for 1899-12-30
+ return (GetNullDate().GetYear() == 1904) ? 1904 : 1900;
+}
+
double XclRoot::GetDoubleFromDateTime( const DateTime& rDateTime ) const
{
double fValue = rDateTime - GetNullDate();
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index 2bcdb996d..13489f1e4 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -47,6 +47,10 @@ namespace com { namespace sun { namespace star {
{
class XModel;
}
+ namespace chart
+ {
+ class XAxis;
+ }
namespace chart2
{
struct ScaleData;
@@ -1011,18 +1015,21 @@ public:
explicit XclExpChLabelRange( const XclExpChRoot& rRoot );
/** Converts category axis scaling settings. */
- void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData, bool bMirrorOrient );
+ void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData,
+ const ScfPropertySet& rChart1Axis, bool bMirrorOrient );
/** Converts position settings of a crossing axis at this axis. */
void ConvertAxisPosition( const ScfPropertySet& rPropSet );
/** Sets flag for tickmark position between categories or on categories. */
inline void SetTicksBetweenCateg( bool bTicksBetween )
- { ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
+ { ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
private:
+ virtual void Save( XclExpStream& rStrm );
virtual void WriteBody( XclExpStream& rStrm );
private:
- XclChLabelRange maData; /// Contents of the CHLABELRANGE record.
+ XclChLabelRange maLabelData; /// Contents of the CHLABELRANGE record.
+ XclChDateRange maDateData; /// Contents of the CHDATERANGE record.
};
typedef ScfRef< XclExpChLabelRange > XclExpChLabelRangeRef;
@@ -1085,6 +1092,7 @@ class XclExpChAxis : public XclExpChGroupBase, public XclExpChFontBase
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > XAxisRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxis > XChart1AxisRef;
public:
explicit XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType );
@@ -1095,7 +1103,8 @@ public:
virtual void SetRotation( sal_uInt16 nRotation );
/** Converts formatting and scaling settings from the passed axis. */
- void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis, const XclChExtTypeInfo& rTypeInfo );
+ void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis,
+ XChart1AxisRef xChart1Axis, const XclChExtTypeInfo& rTypeInfo );
/** Converts and writes 3D wall/floor properties from the passed diagram. */
void ConvertWall( XDiagramRef xDiagram );
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index 72e5d8c12..8e4ce1f0a 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -1134,13 +1134,16 @@ public:
explicit XclImpChLabelRange( const XclImpChRoot& rRoot );
/** Reads the CHLABELRANGE record (category axis scaling properties). */
void ReadChLabelRange( XclImpStream& rStrm );
+ /** Reads the CHDATERANGE record (date axis scaling properties). */
+ void ReadChDateRange( XclImpStream& rStrm );
/** Converts category axis scaling settings. */
void Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const;
/** Converts position settings of this axis at a crossing axis. */
void ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3dChart ) const;
private:
- XclChLabelRange maData; /// Contents of the CHLABELRANGE record.
+ XclChLabelRange maLabelData; /// Contents of the CHLABELRANGE record.
+ XclChDateRange maDateData; /// Contents of the CHDATERANGE record.
};
typedef ScfRef< XclImpChLabelRange > XclImpChLabelRangeRef;
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index f039c74ae..1b7ff6531 100755
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -101,6 +101,7 @@ class XclRoot;
#define EXC_CHPROP_ERRORBARX CREATE_OUSTRING( "ErrorBarX" )
#define EXC_CHPROP_ERRORBARY CREATE_OUSTRING( "ErrorBarY" )
#define EXC_CHPROP_EXPANSION CREATE_OUSTRING( "Expansion" )
+#define EXC_CHPROP_EXPTIMEINCREMENT CREATE_OUSTRING( "ExplicitTimeIncrement" )
#define EXC_CHPROP_FILLBITMAPMODE CREATE_OUSTRING( "FillBitmapMode" )
#define EXC_CHPROP_FILLSTYLE CREATE_OUSTRING( "FillStyle" )
#define EXC_CHPROP_GAPWIDTHSEQ CREATE_OUSTRING( "GapwidthSequence" )
@@ -721,6 +722,23 @@ const sal_uInt8 EXC_CH3DDATAFORMAT_TRUNC = 2; /// Shart top, trunc
const sal_uInt16 EXC_ID_CHPIEEXT = 0x1061;
+// (0x1062) CHDATERANGE -------------------------------------------------------
+
+const sal_uInt16 EXC_ID_CHDATERANGE = 0x1062;
+
+const sal_uInt16 EXC_CHDATERANGE_AUTOMIN = 0x0001;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMAX = 0x0002;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMAJOR = 0x0004;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMINOR = 0x0008;
+const sal_uInt16 EXC_CHDATERANGE_DATEAXIS = 0x0010;
+const sal_uInt16 EXC_CHDATERANGE_AUTOBASE = 0x0020;
+const sal_uInt16 EXC_CHDATERANGE_AUTOCROSS = 0x0040; /// Other axis crosses at own maximum.
+const sal_uInt16 EXC_CHDATERANGE_AUTODATE = 0x0080; /// Recognize date/text automatically.
+
+const sal_uInt16 EXC_CHDATERANGE_DAYS = 0;
+const sal_uInt16 EXC_CHDATERANGE_MONTHS = 1;
+const sal_uInt16 EXC_CHDATERANGE_YEARS = 2;
+
// (0x1066) CHESCHERFORMAT ----------------------------------------------------
const sal_uInt16 EXC_ID_CHESCHERFORMAT = 0x1066;
@@ -1054,6 +1072,23 @@ struct XclChLabelRange
// ----------------------------------------------------------------------------
+struct XclChDateRange
+{
+ sal_uInt16 mnMinDate; /// Minimum value on axis.
+ sal_uInt16 mnMaxDate; /// Maximum value on axis.
+ sal_uInt16 mnMajorStep; /// Distance for major grid lines.
+ sal_uInt16 mnMajorUnit; /// Time unit for major step.
+ sal_uInt16 mnMinorStep; /// Distance for minor grid lines.
+ sal_uInt16 mnMinorUnit; /// Time unit for minor step.
+ sal_uInt16 mnBaseUnit; /// Time unit for axis values.
+ sal_uInt16 mnCross; /// Crossing position of other axis.
+ sal_uInt16 mnFlags; /// Additional flags.
+
+ explicit XclChDateRange();
+};
+
+// ----------------------------------------------------------------------------
+
struct XclChValueRange
{
double mfMin; /// Minimum value on axis.
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 3a273711e..4153b2dd4 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -239,6 +239,8 @@ public:
SvNumberFormatter& GetFormatter() const;
/** Returns the null date of the current number formatter. */
DateTime GetNullDate() const;
+ /** Returns the base year depending on the current null date (1900 or 1904). */
+ sal_uInt16 GetBaseYear() const;
/** Converts a date/time value to a floating-point value. */
double GetDoubleFromDateTime( const DateTime& rDateTime ) const;
/** Converts a floating-point value to a date/time value. */
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 6debac200..2dd8f1c8f 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -108,6 +108,7 @@ using namespace ::com::sun::star;
#include "chgviset.hxx"
#include "reffact.hxx"
#include "chartlis.hxx"
+#include "chartpos.hxx"
#include "waitoff.hxx"
#include "tablink.hxx" // ScDocumentLoader statics
#include "drwlayer.hxx"
@@ -377,19 +378,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
BOOL bOk = TRUE;
if ( !bAddRange && ( !bColInit || !bRowInit ) )
{
- // Spalten/Zeilenkoepfe testen wie in chartarr
+ ScChartPositioner aChartPositioner( &aDocument, nTab, nCol1,nRow1, nCol2,nRow2 );
if (!bColInit)
- {
- for (SCCOL i=nCol1; i<=nCol2 && bColHeaders; i++)
- if (aDocument.HasValueData( i, nRow1, nTab ))
- bColHeaders = FALSE;
- }
+ bColHeaders = aChartPositioner.HasColHeaders();
if (!bRowInit)
- {
- for (SCROW i=nRow1; i<=nRow2 && bRowHeaders; i++)
- if (aDocument.HasValueData( nCol1, i, nTab ))
- bRowHeaders = FALSE;
- }
+ bRowHeaders = aChartPositioner.HasRowHeaders();
//CHINA001 ScColRowLabelDlg aDlg( pParent, bRowHeaders, bColHeaders );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();