chart2/source/controller/dialogs/DataBrowserModel.cxx | 41 ---- chart2/source/controller/dialogs/DataBrowserModel.hxx | 2 chart2/source/view/charttypes/VSeriesPlotter.cxx | 7 chart2/source/view/inc/VDataSeries.hxx | 2 chart2/source/view/main/VDataSeries.cxx | 15 + sc/inc/document.hxx | 4 sc/inc/table.hxx | 6 sc/source/core/data/documen3.cxx | 4 sc/source/core/data/table4.cxx | 68 ++++--- sc/source/ui/docshell/dbdocfun.cxx | 9 - sc/source/ui/docshell/dbdocimp.cxx | 8 sc/source/ui/docshell/docfunc.cxx | 41 ++++ sc/source/ui/undo/undoblk3.cxx | 18 +- xmloff/source/chart/SchXMLExport.cxx | 154 ++++++++++-------- 14 files changed, 228 insertions(+), 151 deletions(-)
New commits: commit f1c9be8706683075b581f85d34c1eafdd41be9b5 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Wed Apr 4 09:58:52 2012 -0430 Export chart X,Y errorbars. - Remove using older properties to get errorbars data. - Only export X errorbars when using ODF VERSION >= 1.2. - Use the dimension attribute to set errorbar direction. diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index b8d9935..0d253d2 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -248,8 +248,8 @@ public: sal_Bool bExportContent ); void exportErrorBar ( - const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp, - sal_Bool bExportContent ); + const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp, bool bYError, + bool bExportContent ); /// add svg position as attribute for current element void addPosition( const ::com::sun::star::awt::Point & rPosition ); @@ -2992,7 +2992,8 @@ void SchXMLExportHelper_Impl::exportSeries( exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent ); } - exportErrorBar( xPropSet,bExportContent ); + exportErrorBar( xPropSet,false, bExportContent ); // X ErrorBar + exportErrorBar( xPropSet,true, bExportContent ); // Y ErrorBar exportDataPoints( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), @@ -3116,24 +3117,40 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( } void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySet> &xSeriesProp, - sal_Bool bExportContent ) + bool bYError, bool bExportContent ) { assert(mxExpPropMapper.is()); + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + + /// Dont export X ErrorBars for older ODF versions. + if ( !bYError && nCurrentVersion < SvtSaveOptions::ODFVER_012 ) + return; + if (xSeriesProp.is()) { - Any aAny; - std::vector< XMLPropertyState > aPropertyStates; + bool bNegative = false, bPositive = false; sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE; - chart::ChartErrorIndicatorType eErrorType = chart::ChartErrorIndicatorType_NONE; + Reference< beans::XPropertySet > xErrorBarProp; try { - aAny = xSeriesProp->getPropertyValue("ErrorIndicator" ); - aAny >>= eErrorType; + Any aAny; - aAny = xSeriesProp->getPropertyValue("ErrorBarStyle" ); - aAny >>= nErrorBarStyle; + aAny = xSeriesProp->getPropertyValue( bYError ? "ErrorBarY" : "ErrorBarX" ); + aAny >>= xErrorBarProp; + + if ( xErrorBarProp.is() ) + { + aAny = xErrorBarProp->getPropertyValue("ShowNegativeError" ); + aAny >>= bNegative; + + aAny = xErrorBarProp->getPropertyValue("ShowPositiveError" ); + aAny >>= bPositive; + + aAny = xErrorBarProp->getPropertyValue("ErrorBarStyle" ); + aAny >>= nErrorBarStyle; + } } catch( const beans::UnknownPropertyException & rEx ) { @@ -3144,56 +3161,37 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe RTL_TEXTENCODING_ASCII_US ).getStr()); } - if( nErrorBarStyle != chart::ErrorBarStyle::NONE && - eErrorType != chart::ChartErrorIndicatorType_NONE) + if( nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive)) { - Reference< beans::XPropertySet > xErrorBarProp; - try - { - aAny = xSeriesProp->getPropertyValue("DataErrorProperties" ); - aAny >>= xErrorBarProp; - } - catch( const uno::Exception & rEx ) - { - (void)rEx; // avoid warning for pro build - OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s", - OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - } - - if( xErrorBarProp.is() ) + if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA ) { - if( bExportContent && - nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA ) + // register data ranges for error bars for export in local table + ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences( + lcl_getErrorBarSequences( xErrorBarProp )); + for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt( + aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt ) { - // register data ranges for error bars for export in local table - ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences( - lcl_getErrorBarSequences( xErrorBarProp )); - for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt( - aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt ) - { - m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt )); - } + m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt )); } + } - aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp ); + std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp ); - if( !aPropertyStates.empty() ) + if( !aPropertyStates.empty() ) + { + // write element + if( bExportContent ) { - // write element - if( bExportContent ) - { - // add style name attribute - AddAutoStyleAttribute( aPropertyStates ); + // add style name attribute + AddAutoStyleAttribute( aPropertyStates ); - const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) - mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# - SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); - } - else // autostyles - { - CollectAutoStyle( aPropertyStates ); - } + if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, bYError ? XML_Y : XML_X );//#i114149# + SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); + } + else // autostyles + { + CollectAutoStyle( aPropertyStates ); } } } commit 181a7d75129017c3107939da8aa8b5972b9d5ca9 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Tue Apr 3 17:41:52 2012 -0430 Move exporting chart errorbars code to its own method. diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index bb8011c..b8d9935 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -247,6 +247,10 @@ public: const ::com::sun::star::awt::Size & rPageSize, sal_Bool bExportContent ); + void exportErrorBar ( + const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp, + sal_Bool bExportContent ); + /// add svg position as attribute for current element void addPosition( const ::com::sun::star::awt::Point & rPosition ); void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); @@ -2748,8 +2752,6 @@ void SchXMLExportHelper_Impl::exportSeries( sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y; sal_Bool bHasMeanValueLine = false; chart::ChartRegressionCurveType eRegressionType( chart::ChartRegressionCurveType_NONE ); - chart::ChartErrorIndicatorType eErrorType( chart::ChartErrorIndicatorType_NONE ); - sal_Int32 nErrorBarStyle( chart::ErrorBarStyle::NONE ); Reference< beans::XPropertySet > xPropSet; tLabelValuesDataPair aSeriesLabelValuesPair; @@ -2817,14 +2819,6 @@ void SchXMLExportHelper_Impl::exportSeries( aAny = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RegressionCurves" ))); aAny >>= eRegressionType; - - aAny = xPropSet->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorIndicator" ))); - aAny >>= eErrorType; - - aAny = xPropSet->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorBarStyle" ))); - aAny >>= nErrorBarStyle; } catch( const beans::UnknownPropertyException & rEx ) { @@ -2998,62 +2992,7 @@ void SchXMLExportHelper_Impl::exportSeries( exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent ); } - if( nErrorBarStyle != chart::ErrorBarStyle::NONE && - eErrorType != chart::ChartErrorIndicatorType_NONE && - xPropSet.is() && - mxExpPropMapper.is() ) - { - Reference< beans::XPropertySet > xStatProp; - try - { - Any aPropAny( xPropSet->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM( "DataErrorProperties" )))); - aPropAny >>= xStatProp; - } - catch( const uno::Exception & rEx ) - { - (void)rEx; // avoid warning for pro build - OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s", - OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - } - - if( xStatProp.is() ) - { - if( bExportContent && - nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA ) - { - // register data ranges for error bars for export in local table - ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences( - lcl_getErrorBarSequences( xStatProp )); - for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt( - aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt ) - { - m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt )); - } - } - - aPropertyStates = mxExpPropMapper->Filter( xStatProp ); - - if( !aPropertyStates.empty() ) - { - // write element - if( bExportContent ) - { - // add style name attribute - AddAutoStyleAttribute( aPropertyStates ); - - const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); - if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) - mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# - SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); - } - else // autostyles - { - CollectAutoStyle( aPropertyStates ); - } - } - } - } + exportErrorBar( xPropSet,bExportContent ); exportDataPoints( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), @@ -3176,6 +3115,91 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( } } +void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySet> &xSeriesProp, + sal_Bool bExportContent ) +{ + assert(mxExpPropMapper.is()); + + if (xSeriesProp.is()) + { + Any aAny; + std::vector< XMLPropertyState > aPropertyStates; + sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE; + chart::ChartErrorIndicatorType eErrorType = chart::ChartErrorIndicatorType_NONE; + + try + { + aAny = xSeriesProp->getPropertyValue("ErrorIndicator" ); + aAny >>= eErrorType; + + aAny = xSeriesProp->getPropertyValue("ErrorBarStyle" ); + aAny >>= nErrorBarStyle; + } + catch( const beans::UnknownPropertyException & rEx ) + { + (void)rEx; // avoid warning for pro build + OSL_TRACE( + OUStringToOString(OUString("Required property not found in DataRowProperties: " ) + + rEx.Message, + RTL_TEXTENCODING_ASCII_US ).getStr()); + } + + if( nErrorBarStyle != chart::ErrorBarStyle::NONE && + eErrorType != chart::ChartErrorIndicatorType_NONE) + { + Reference< beans::XPropertySet > xErrorBarProp; + try + { + aAny = xSeriesProp->getPropertyValue("DataErrorProperties" ); + aAny >>= xErrorBarProp; + } + catch( const uno::Exception & rEx ) + { + (void)rEx; // avoid warning for pro build + OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s", + OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + } + + if( xErrorBarProp.is() ) + { + if( bExportContent && + nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA ) + { + // register data ranges for error bars for export in local table + ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences( + lcl_getErrorBarSequences( xErrorBarProp )); + for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt( + aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt ) + { + m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt )); + } + } + + aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp ); + + if( !aPropertyStates.empty() ) + { + // write element + if( bExportContent ) + { + // add style name attribute + AddAutoStyleAttribute( aPropertyStates ); + + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# + SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); + } + else // autostyles + { + CollectAutoStyle( aPropertyStates ); + } + } + } + } + } +} + void SchXMLExportHelper_Impl::exportCandleStickSeries( const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq, const Reference< chart2::XDiagram > & xDiagram, commit 67c45c9dbde0eb164df28d6f8cae935869de85d4 Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Apr 2 19:04:01 2012 -0430 Calculate correct standard deviation for XErrorBar. - Add method to calculate X standard deviation. - Set correct XErrorBar position when using standard deviation error type. diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 1c84ca0..c693a0b 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -823,7 +823,12 @@ void VSeriesPlotter::createErrorBar( drawing::Position3D aUnscaledLogicPosition(rUnscaledLogicPosition); if(nErrorBarStyle==::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION) - aUnscaledLogicPosition.PositionY = rVDataSeries.getYMeanValue(); + { + if (bYError) + aUnscaledLogicPosition.PositionY = rVDataSeries.getYMeanValue(); + else + aUnscaledLogicPosition.PositionX = rVDataSeries.getXMeanValue(); + } bool bCreateNegativeBorder = false;//make a vertical line at the negative end of the error bar bool bCreatePositiveBorder = false;//make a vertical line at the positive end of the error bar diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx index 64679cd..cb10cef 100644 --- a/chart2/source/view/inc/VDataSeries.hxx +++ b/chart2/source/view/inc/VDataSeries.hxx @@ -102,6 +102,7 @@ public: ::com::sun::star::uno::Sequence< double > getAllX() const; ::com::sun::star::uno::Sequence< double > getAllY() const; + double getXMeanValue() const; double getYMeanValue() const; bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const; @@ -216,6 +217,7 @@ private: //member VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection; + mutable double m_fXMeanValue; mutable double m_fYMeanValue; ::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 5cad9ca..25420ad 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -176,6 +176,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) , m_aValues_Bubble_Size() , m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y) + , m_fXMeanValue(1.0) , m_fYMeanValue(1.0) , m_aAttributedDataPointIndexList() @@ -207,6 +208,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) , m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) , m_bAllowPercentValueInDataLabel(false) { + ::rtl::math::setNan( & m_fXMeanValue ); ::rtl::math::setNan( & m_fYMeanValue ); uno::Reference<data::XDataSource> xDataSource = @@ -729,6 +731,19 @@ uno::Sequence< double > VDataSeries::getAllY() const return m_aValues_Y.Doubles; } +double VDataSeries::getXMeanValue() const +{ + if( ::rtl::math::isNan( m_fXMeanValue ) ) + { + uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( "com.sun.star.chart2.MeanValueRegressionCurve" ) ); + uno::Sequence< double > aXValuesDummy; + xCalculator->recalculateRegression( aXValuesDummy, getAllX() ); + double fXDummy = 1.0; + m_fXMeanValue = xCalculator->getCurveValue( fXDummy ); + } + return m_fXMeanValue; +} + double VDataSeries::getYMeanValue() const { if( ::rtl::math::isNan( m_fYMeanValue ) ) commit 0e3bd5c0c4e18d9daa6bc827996e860ede1f438b Author: Rafael Dominguez <venccsra...@gmail.com> Date: Mon Apr 2 18:21:51 2012 -0430 Display correct errorbars columns in chart data browser. diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 1ec9acf..b9ae25b 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -918,7 +918,10 @@ void DataBrowserModel::updateFromModel() // add ranges for error bars if present for a series if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx], /* bYError = */ true )) - addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd ); + addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true ); + + if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx], /* bYError = */ false )) + addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false ); m_aHeaders.push_back( tDataHeader( @@ -942,59 +945,31 @@ void DataBrowserModel::addErrorBarRanges( const Reference< chart2::XDataSeries > & xDataSeries, sal_Int32 nNumberFormatKey, sal_Int32 & rInOutSequenceIndex, - sal_Int32 & rInOutHeaderEnd ) + sal_Int32 & rInOutHeaderEnd, bool bYError ) { try { ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aSequences; - // x error bars - // ------------ Reference< chart2::data::XDataSource > xErrorSource( - StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ false ), uno::UNO_QUERY ); + StatisticsHelper::getErrorBars( xDataSeries, bYError ), uno::UNO_QUERY ); - // positive x error bars Reference< chart2::data::XLabeledDataSequence > xErrorLSequence( StatisticsHelper::getErrorLabeledDataSequenceFromDataSource( xErrorSource, /* bPositiveValue = */ true, - /* bYError = */ false )); + bYError )); if( xErrorLSequence.is()) aSequences.push_back( xErrorLSequence ); - // negative x error bars xErrorLSequence.set( StatisticsHelper::getErrorLabeledDataSequenceFromDataSource( xErrorSource, /* bPositiveValue = */ false, - /* bYError = */ false )); - if( xErrorLSequence.is()) - aSequences.push_back( xErrorLSequence ); - - // y error bars - // ------------ - xErrorSource.set( - StatisticsHelper::getErrorBars( xDataSeries, /* bYError = */ true ), uno::UNO_QUERY ); - - // positive y error bars - xErrorLSequence.set( - StatisticsHelper::getErrorLabeledDataSequenceFromDataSource( - xErrorSource, - /* bPositiveValue = */ true, - /* bYError = */ true )); + bYError )); if( xErrorLSequence.is()) aSequences.push_back( xErrorLSequence ); - // negative y error bars - xErrorLSequence.set( - StatisticsHelper::getErrorLabeledDataSequenceFromDataSource( - xErrorSource, - /* bPositiveValue = */ false, - /* bYError = */ true )); - if( xErrorLSequence.is()) - aSequences.push_back( xErrorLSequence ); - - for( ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aIt( aSequences.begin()); aIt != aSequences.end(); ++aIt ) { diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx index ee48fa0..7d6e99a 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.hxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx @@ -159,7 +159,7 @@ private: ::com::sun::star::chart2::XDataSeries > & xDataSeries, sal_Int32 nNumberFormatKey, sal_Int32 & rInOutSequenceIndex, - sal_Int32 & rInOutHeaderEnd ); + sal_Int32 & rInOutHeaderEnd, bool bYError ); sal_Int32 getCategoryColumnCount(); commit 883d20c5eb68893c73ab2fd5d3bfee528d0a02d1 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Apr 11 09:28:54 2012 +0200 move ScProgress outside of ScTable::Fill diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 99bbc54..42b2949 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1148,10 +1148,10 @@ public: void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScMarkData& rMark, + ScProgress* pProgress, const ScMarkData& rMark, sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM, FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY, - double nStepValue = 1.0, double nMaxValue = 1E307); + double nStepValue = 1.0, double nMaxValue = 1E307 ); rtl::OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); bool GetSelectionFunction( ScSubTotalFunc eFunc, diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0c440f9..2261718 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -477,7 +477,7 @@ public: const ScRangeData::IndexMap& rMap ); void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, - double nStepValue, double nMaxValue); + double nStepValue, double nMaxValue, ScProgress* pProgress); String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); void UpdateSelectionFunction( ScFunctionData& rData, @@ -792,13 +792,13 @@ private: sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue, sal_uInt16 nMinDigits, - bool bAttribs, ScProgress& rProgress ); + bool bAttribs, ScProgress* pProgress ); void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillCmd& rCmd, FillDateCmd& rDateCmd, double& rInc, sal_uInt16& rMinDigits, ScUserListData*& rListData, sal_uInt16& rListIndex); void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress ); + sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress ); bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark, bool bMarked, bool bUnprotected ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index e0d57a6..f016df5 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1100,7 +1100,7 @@ void ScDocument::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ) maTabs[i]->UpdateGrow( rArea, nGrowX, nGrowY ); } -void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, +void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProgress* pProgress, const ScMarkData& rMark, sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue) { @@ -1112,7 +1112,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const if (maTabs[*itr]) maTabs[*itr]->Fill(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, eFillCmd, eFillDateCmd, - nStepValue, nMaxValue); + nStepValue, nMaxValue, pProgress); } rtl::OUString ScDocument::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ) diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 44eb226..e3d57be 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -467,7 +467,7 @@ void ScTable::FillFormula(sal_uLong& /* nFormulaCounter */, bool /* bFirst */, S } void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress ) + sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress ) { if ( (nFillCount == 0) || !ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2) ) return; @@ -541,7 +541,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_AUTOFILL); } - sal_uLong nProgress = rProgress.GetState(); + sal_uLong nProgress = 0; + if (pProgress) + nProgress = pProgress->GetState(); // // ausfuehren @@ -701,8 +703,11 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (rInner == nIEnd) break; if (bPositive) ++rInner; else --rInner; } - nProgress += nIMax - nIMin + 1; - rProgress.SetStateOnPercent( nProgress ); + if(pProgress) + { + nProgress += nIMax - nIMin + 1; + pProgress->SetStateOnPercent( nProgress ); + } } else if (eFillCmd == FILL_SIMPLE) // Auffuellen mit Muster { @@ -871,11 +876,12 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, // und auch dann nicht fuer jede einzelne ++nProgress; - if ( eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT ) - rProgress.SetStateOnPercent( nProgress ); + if ( pProgress && (eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT) ) + pProgress->SetStateOnPercent( nProgress ); } - rProgress.SetStateOnPercent( nProgress ); + if (pProgress) + pProgress->SetStateOnPercent( nProgress ); } else { @@ -886,13 +892,14 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillSeries( static_cast<SCCOL>(nCol), nRow1, static_cast<SCCOL>(nCol), nRow2, nFillCount, eFillDir, eFillCmd, eDateCmd, nInc, nEndVal, nMinDigits, false, - rProgress ); + pProgress ); else FillSeries( nCol1, static_cast<SCROW>(nRow), nCol2, static_cast<SCROW>(nRow), nFillCount, eFillDir, eFillCmd, eDateCmd, nInc, nEndVal, nMinDigits, false, - rProgress ); - nProgress = rProgress.GetState(); + pProgress ); + if (pProgress) + nProgress = pProgress->GetState(); } nActFormCnt += nMaxFormCnt; @@ -1246,7 +1253,7 @@ void ScTable::IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillD void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue, sal_uInt16 nArgMinDigits, - bool bAttribs, ScProgress& rProgress ) + bool bAttribs, ScProgress* pProgress ) { // // Richtung auswerten @@ -1315,7 +1322,9 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, else DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, nDel); - sal_uLong nProgress = rProgress.GetState(); + sal_uLong nProgress = 0; + if (pProgress) + nProgress = pProgress->GetState(); // // ausfuehren @@ -1358,7 +1367,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillFormula(nInd, bFirst, (ScFormulaCell*)pSrcCell, static_cast<SCCOL>(nCol), nRow, (rInner == nIEnd) ); bFirst = false; - rProgress.SetStateOnPercent( ++nProgress ); + if(pProgress) + pProgress->SetStateOnPercent( ++nProgress ); } } else if (eCellType != CELLTYPE_NOTE) @@ -1371,7 +1381,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, aCol[nCol].Insert( aDestPos.Row(), pSrcCell->Clone( *pDocument ) ); } nProgress += nIMax - nIMin + 1; - rProgress.SetStateOnPercent( nProgress ); + if(pProgress) + pProgress->SetStateOnPercent( nProgress ); } } else if (eCellType == CELLTYPE_VALUE || eCellType == CELLTYPE_FORMULA) @@ -1449,7 +1460,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bPositive) ++rInner; else --rInner; } nProgress += nIMax - nIMin + 1; - rProgress.SetStateOnPercent( nProgress ); + if(pProgress) + pProgress->SetStateOnPercent( nProgress ); } else if (eCellType == CELLTYPE_STRING || eCellType == CELLTYPE_EDIT) { @@ -1554,14 +1566,17 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bPositive) ++rInner; else --rInner; } } - nProgress += nIMax - nIMin + 1; - rProgress.SetStateOnPercent( nProgress ); + if(pProgress) + { + nProgress += nIMax - nIMin + 1; + pProgress->SetStateOnPercent( nProgress ); + } } } - else + else if(pProgress) { nProgress += nIMax - nIMin + 1; - rProgress.SetStateOnPercent( nProgress ); + pProgress->SetStateOnPercent( nProgress ); } ++nActFormCnt; } @@ -1569,22 +1584,13 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, - double nStepValue, double nMaxValue) + double nStepValue, double nMaxValue, ScProgress* pProgress) { - sal_uLong nProgCount; - if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP) - nProgCount = nCol2 - nCol1 + 1; - else - nProgCount = nRow2 - nRow1 + 1; - nProgCount *= nFillCount; - ScProgress aProgress( pDocument->GetDocumentShell(), - ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); - if (eFillCmd == FILL_AUTO) - FillAuto(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, aProgress); + FillAuto(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, pProgress); else FillSeries(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, - eFillCmd, eFillDateCmd, nStepValue, nMaxValue, 0, true, aProgress); + eFillCmd, eFillDateCmd, nStepValue, nMaxValue, 0, true, pProgress); } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index f935ef9..0e25ee0 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -61,6 +61,7 @@ #include "hints.hxx" #include "queryentry.hxx" #include "markdata.hxx" +#include "progress.hxx" #include <set> @@ -886,8 +887,14 @@ sal_Bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, ScMarkData aMark; aMark.SelectOneTable(nDestTab); SCROW nFStartY = aLocalParam.nRow1 + ( aLocalParam.bHasHeader ? 1 : 0 ); + + sal_uLong nProgCount = nFormulaCols; + nProgCount *= aLocalParam.nRow2 - nFStartY; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( aLocalParam.nCol2+1, nFStartY, - aLocalParam.nCol2+nFormulaCols, nFStartY, aMark, + aLocalParam.nCol2+nFormulaCols, nFStartY, &aProgress, aMark, aLocalParam.nRow2 - nFStartY, FILL_TO_BOTTOM, FILL_SIMPLE ); } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 39b2b80..92f6b45 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -597,8 +597,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, // fill formulas ScMarkData aMark; aMark.SelectOneTable(nTab); + + sal_uLong nProgCount = nFormulaCols; + nProgCount *= nEndRow-rParam.nRow1-1; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1, - aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE ); + &aProgress, aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE ); } // if new range is smaller, clear old contents diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 973968d..379887f 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -100,6 +100,7 @@ #include "clipparam.hxx" #include "externalrefmgr.hxx" #include "undorangename.hxx" +#include "progress.hxx" #include <memory> #include <basic/basmgr.hxx> @@ -4078,9 +4079,18 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark, pDoc->CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark ); } + sal_uLong nProgCount; + if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP) + nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1; + else + nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1; + nProgCount *= nCount; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(), - aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark, - nCount, eDir, FILL_SIMPLE ); + aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress, + aMark, nCount, eDir, FILL_SIMPLE ); AdjustRowHeight(aRange); if ( bRecord ) // Draw-Undo erst jetzt verfuegbar @@ -4194,9 +4204,19 @@ sal_Bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMar SCTAB nTab = aDestArea.aStart.Tab(); pDoc->SetValue( nValX, nValY, nTab, fStart ); } + + sal_uLong nProgCount; + if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP) + nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1; + else + nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1; + nProgCount *= nCount; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(), - aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark, - nCount, eDir, eCmd, eDateCmd, fStep, fMax ); + aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress, + aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax ); AdjustRowHeight(rRange); rDocShell.PostPaintGridAll(); @@ -4325,9 +4345,18 @@ sal_Bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillD IDF_AUTOFILL, false, pUndoDoc, &aMark ); } + sal_uLong nProgCount; + if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP) + nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1; + else + nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1; + nProgCount *= nCount; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(), - aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark, - nCount, eDir, eCmd, eDateCmd, fStep, fMax ); + aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress, + aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax ); AdjustRowHeight(aDestArea); diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 3286614..78ea86b 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -60,6 +60,7 @@ #include "paramisc.hxx" #include "postit.hxx" #include "docuno.hxx" +#include "progress.hxx" // STATIC DATA --------------------------------------------------------------- @@ -714,11 +715,20 @@ void ScUndoAutoFill::Redo() SCTAB nTab = aSource.aStart.Tab(); pDoc->SetValue( nValX, nValY, nTab, fStartValue ); } + sal_uLong nProgCount; + if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP) + nProgCount = aSource.aEnd.Col() - aSource.aStart.Col() + 1; + else + nProgCount = aSource.aEnd.Row() - aSource.aStart.Row() + 1; + nProgCount *= nCount; + ScProgress aProgress( pDoc->GetDocumentShell(), + ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount ); + pDoc->Fill( aSource.aStart.Col(), aSource.aStart.Row(), - aSource.aEnd.Col(), aSource.aEnd.Row(), - aMarkData, nCount, - eFillDir, eFillCmd, eFillDateCmd, - fStepValue, fMaxValue ); + aSource.aEnd.Col(), aSource.aEnd.Row(), &aProgress, + aMarkData, nCount, + eFillDir, eFillCmd, eFillDateCmd, + fStepValue, fMaxValue ); SetChangeTrack(); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits