[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - chart2/source include/comphelper sw/source writerfilter/CppunitTest_writerfilter_dmapper.mk writerfilter/qa writerfilter/source

2023-10-24 Thread Miklos Vajna (via logerrit)
 chart2/source/model/main/ChartModel.cxx
|4 
 chart2/source/view/main/ChartView.cxx  
|4 
 include/comphelper/dumpxmltostring.hxx 
|2 
 sw/source/uibase/inc/unotxvw.hxx   
|7 +
 sw/source/uibase/uno/unotxvw.cxx   
|   13 +++
 writerfilter/CppunitTest_writerfilter_dmapper.mk   
|1 
 writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx 
|   32 ++-
 writerfilter/qa/cppunittests/dmapper/data/floattable-vertical-frame-offset.rtf 
|   43 ++
 writerfilter/source/dmapper/SettingsTable.cxx  
|2 
 writerfilter/source/filter/WriterFilter.cxx
|1 
 10 files changed, 99 insertions(+), 10 deletions(-)

New commits:
commit 7eb93c24002f2f9ee2731e250a7404145c81df6d
Author: Miklos Vajna 
AuthorDate: Tue Oct 24 09:06:54 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 24 12:29:15 2023 +0200

tdf#155040 sw floattable, RTF: fix table is overlapped by subsequent inline 
one

The document had overlapping text on load since commit
05425f73bfa41d3f7591461e2ad0beb4fafc39b4 (sw floatable: teach the RTF
import about SwFormatFlySplit, 2023-04-21).

Interestingly the DOCX equivalent was fine, there the inline table is
shifted down, below the floating table, so the overlap doesn't happen.

Fix the problem by moving the AddVerticalFrameOffsets=true code from the
DOCX filter to the shared dmapper, because RTF needs the same.

See commit 50223ea6e212b60b7d33839c2753c5601fb50f95 (tdf#98987 sw: add
AddVerticalFrameOffsets compat mode, 2016-03-31) for more details about
this compat flag. It was already enabled for DOC, too.

Change-Id: I948b179c9ec5fa24377014b0e86826568c417b6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158372
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158378

diff --git a/chart2/source/model/main/ChartModel.cxx 
b/chart2/source/model/main/ChartModel.cxx
index 7c319603a0cc..f63f8c97a01d 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -37,7 +37,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -1287,7 +1287,7 @@ uno::Sequence< Reference< 
chart2::data::XLabeledDataSequence > > SAL_CALL ChartM
 OUString SAL_CALL ChartModel::dump(OUString const & kind)
 {
 if (kind.isEmpty()) {
-return dumpXmlToString([this](auto writer) { return dumpAsXml(writer); 
});
+return comphelper::dumpXmlToString([this](auto writer) { return 
dumpAsXml(writer); });
 }
 
 // kind == "shapes":
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index d499aae6f298..2a282b08a6f3 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -56,7 +56,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1789,7 +1789,7 @@ uno::Sequence< OUString > 
ChartView::getAvailableServiceNames()
 OUString ChartView::dump(OUString const & kind)
 {
 if (kind.isEmpty()) {
-return dumpXmlToString([this](auto writer) { return dumpAsXml(writer); 
});
+return comphelper::dumpXmlToString([this](auto writer) { return 
dumpAsXml(writer); });
 }
 
 // kind == "shapes":
diff --git a/chart2/source/inc/dumpxmltostring.hxx 
b/include/comphelper/dumpxmltostring.hxx
similarity index 98%
rename from chart2/source/inc/dumpxmltostring.hxx
rename to include/comphelper/dumpxmltostring.hxx
index b5cfe5a1fab8..72cdafee35fe 100644
--- a/chart2/source/inc/dumpxmltostring.hxx
+++ b/include/comphelper/dumpxmltostring.hxx
@@ -16,7 +16,7 @@
 
 #include 
 
-namespace chart
+namespace comphelper
 {
 template  OUString dumpXmlToString(F f)
 {
diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx
index 2ceb49215704..d55c02f78d57 100644
--- a/sw/source/uibase/inc/unotxvw.hxx
+++ b/sw/source/uibase/inc/unotxvw.hxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -59,7 +60,8 @@ typedef cppu::ImplInheritanceHelper<
 css::view::XViewSettingsSupplier,
 css::beans::XPropertySet,
 css::datatransfer::XTransferableSupplier,
-css::datatransfer::XTransferableTextSupplier> SwXTextView_Base;
+css::datatransfer::XTransferableTextSupplier,
+css::qa::XDumper> SwXTextView_Base;
 class SwXTextView final : public SwXTextView_Base
 {
 
::comphelper::OInterfaceContainerHelper3 
m_SelChangedListeners;
@@ -132,6 +134,9 @@ public:
 // XTransferableTextSupplier
  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - chart2/source cui/source cui/uiconfig include/cui include/svl include/svx offapi/com sc/source sd/source svx/source sw/inc sw/source xmloff/s

2023-07-05 Thread Michael Stahl (via logerrit)
 chart2/source/controller/main/ShapeController.cxx |5 +-
 cui/source/dialogs/dlgname.cxx|6 ++
 cui/source/factory/dlgfact.cxx|9 +++-
 cui/source/factory/dlgfact.hxx|3 -
 cui/uiconfig/ui/objecttitledescdialog.ui  |   20 
 include/cui/dlgname.hxx   |6 ++
 include/svl/solar.hrc |2 
 include/svx/strings.hrc   |1 
 include/svx/svdobj.hxx|2 
 include/svx/svdovirt.hxx  |2 
 include/svx/svdundo.hxx   |   16 +++
 include/svx/svxdlg.hxx|3 -
 include/svx/unoshprp.hxx  |4 +
 offapi/com/sun/star/drawing/Shape.idl |9 
 sc/source/ui/drawfunc/drawsh5.cxx |5 +-
 sd/source/ui/view/drviews2.cxx|5 +-
 svx/source/inc/svdobjplusdata.hxx |1 
 svx/source/sdr/contact/viewobjectcontact.cxx  |2 
 svx/source/svdraw/svdobj.cxx  |   34 +++
 svx/source/svdraw/svdobjplusdata.cxx  |1 
 svx/source/svdraw/svdovirt.cxx|   10 
 svx/source/svdraw/svdundo.cxx |   31 +
 svx/source/unodraw/unoprov.cxx|7 +++
 svx/source/unodraw/unoshape.cxx   |   17 +++
 sw/inc/doc.hxx|2 
 sw/inc/fesh.hxx   |2 
 sw/inc/frmfmt.hxx |1 
 sw/inc/strings.hrc|1 
 sw/inc/swundo.hxx |1 
 sw/source/core/doc/docfly.cxx |   22 +
 sw/source/core/frmedt/fefly1.cxx  |   49 ++
 sw/source/core/inc/undoflystrattr.hxx |   17 +++
 sw/source/core/layout/atrfrm.cxx  |   15 ++
 sw/source/core/undo/undobj.cxx|3 +
 sw/source/core/undo/undoflystrattr.cxx|   31 +
 sw/source/uibase/shells/drwbassh.cxx  |5 +-
 sw/source/uibase/shells/frmsh.cxx |5 +-
 xmloff/source/draw/sdpropls.cxx   |2 
 38 files changed, 342 insertions(+), 15 deletions(-)

New commits:
commit 9c3475e1dc42b6992af58aeb585ebe58afbf8ea9
Author: Michael Stahl 
AuthorDate: Wed Jul 5 14:04:17 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Jul 6 00:15:57 2023 +0200

tdf#138504 svx,etc.: decorative flag on SdrObject shapes

* SdrObject new member m_IsDecorative
* new Undo SdrUndoObjDecorative
* surprising amount of changes in sw including additional 
SwUndoFlyDecorative
* svx API SvxShape property "Decorative"
* UI checkbox "Decorative"
* ODF import/export as loext:decorative on style:graphic-properties
* PDF/UA export: ViewObjectContcat tag shapes with this flag as Artifact

Change-Id: I37f7a0597eab92c6c6aff94fad6c16c59b231c80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154063
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 6efc72b99a08384e56c5a4da7918177be60b3b09)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154042

diff --git a/chart2/source/controller/main/ShapeController.cxx 
b/chart2/source/controller/main/ShapeController.cxx
index 817df9ef414d..65a24ab1c22e 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -402,16 +402,19 @@ void 
ShapeController::executeDispatch_ObjectTitleDescription()
 
 OUString aTitle( pSelectedObj->GetTitle() );
 OUString aDescription( pSelectedObj->GetDescription() );
+bool isDecorative(pSelectedObj->IsDecorative());
 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
 weld::Window* pChartWindow(m_pChartController->GetChartFrame());
 ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg(
-pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, 
aDescription));
+pFact->CreateSvxObjectTitleDescDialog(pChartWindow, aTitle, 
aDescription, isDecorative));
 if ( pDlg->Execute() == RET_OK )
 {
 pDlg->GetTitle( aTitle );
 pDlg->GetDescription( aDescription );
+pDlg->IsDecorative(isDecorative);
 pSelectedObj->SetTitle( aTitle );
 pSelectedObj->SetDescription( aDescription );
+pSelectedObj->SetDecorative(isDecorative);
 }
 }
 
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index da0a3f49..84f21a86d616 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -87,10 +87,12 @@ IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, 
weld::Entry&, void)
 // Dialog for editing Object Title and Description
 
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - chart2/source

2023-06-29 Thread Laurent Balland (via logerrit)
 chart2/source/controller/dialogs/ObjectNameProvider.cxx |   48 +---
 1 file changed, 28 insertions(+), 20 deletions(-)

New commits:
commit 2e04c00f21cf2566c3de34d9dd828cc1615329fd
Author: Laurent Balland 
AuthorDate: Tue Jun 27 21:23:19 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 15:19:17 2023 +0200

tdf#155526 Restore status bar for moving average

Previous commit dc03f59374d4fc74dd44ddedc903bb9c00a74bb7 broke text in
status bar when a moving average trend line is selected

Change-Id: I259fb9aee1eccf9fac93038c6dd2755490769f88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153677
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 125b0f6609332523d30bef600979b698c2d216f8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153706

diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx 
b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 41eae9e7f1a8..2097e43c2130 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -597,33 +597,41 @@ OUString ObjectNameProvider::getHelpText( 
std::u16string_view rObjectCID, const
 if ( !(xEqProp->getPropertyValue( "YName") >>= 
aYName) )
 aYName = "f(x)";
 }
-xCalculator->setRegressionProperties(aDegree, 
bForceIntercept, aInterceptValue, 2, aMovingType);
+xCalculator->setRegressionProperties(aDegree, 
bForceIntercept, aInterceptValue, aPeriod, aMovingType);
 xCalculator->setXYNames ( aXName, aYName );
 RegressionCurveHelper::initializeCurveCalculator( 
xCalculator, xSeries, xChartModel );
 
-// replace formula
-OUString aWildcard = "%FORMULA";
-sal_Int32 nIndex = aRet.indexOf( aWildcard );
-if( nIndex != -1 )
+// change text for Moving Average
+if ( RegressionCurveHelper::getRegressionType( xCurve 
) == SvxChartRegress::MovingAverage )
+{
+aRet = xCalculator->getRepresentation();
+}
+else
 {
-OUString aFormula ( 
xCalculator->getRepresentation() );
-if ( cDecSeparator != '.' )
+// replace formula
+OUString aWildcard = "%FORMULA";
+sal_Int32 nIndex = aRet.indexOf( aWildcard );
+if( nIndex != -1 )
 {
-aFormula = aFormula.replace( '.', 
cDecSeparator );
+OUString aFormula ( 
xCalculator->getRepresentation() );
+if ( cDecSeparator != '.' )
+{
+aFormula = aFormula.replace( '.', 
cDecSeparator );
+}
+aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), aFormula );
 }
-aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), aFormula );
-}
 
-// replace r^2
-aWildcard = "%RSQUARED";
-nIndex = aRet.indexOf( aWildcard );
-if( nIndex != -1 )
-{
-double fR( 
xCalculator->getCorrelationCoefficient());
-aRet = aRet.replaceAt(
-nIndex, aWildcard.getLength(),
-::rtl::math::doubleToUString(
-fR*fR, rtl_math_StringFormat_G, 4, 
cDecSeparator, true ));
+// replace r^2
+aWildcard = "%RSQUARED";
+nIndex = aRet.indexOf( aWildcard );
+if( nIndex != -1 )
+{
+double fR( 
xCalculator->getCorrelationCoefficient());
+aRet = aRet.replaceAt(
+nIndex, aWildcard.getLength(),
+::rtl::math::doubleToUString(
+fR*fR, rtl_math_StringFormat_G, 4, 
cDecSeparator, true ));
+}
 }
 }
 catch( const uno::Exception & )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - chart2/source

2023-06-29 Thread Laurent Balland (via logerrit)
 chart2/source/controller/dialogs/ObjectNameProvider.cxx|   13 
+-
 chart2/source/controller/dialogs/res_Trendline.cxx |4 ---
 chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx |   10 ++-
 3 files changed, 11 insertions(+), 16 deletions(-)

New commits:
commit 917aff51c9f119105eacb527b7829c67ffe044bb
Author: Laurent Balland 
AuthorDate: Mon Jun 12 21:48:13 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 12:34:56 2023 +0200

tdf#155526 Add Period to trend line equation

Insert Period value earlier to have it ready for representation
Allow Moving average equation in dialog UI

Change-Id: I1d20572c39462e60b60ab7eec1f174a3cf934d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153094
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit dc03f59374d4fc74dd44ddedc903bb9c00a74bb7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153707

diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx 
b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index e4ec234362bc..41eae9e7f1a8 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -601,18 +601,9 @@ OUString ObjectNameProvider::getHelpText( 
std::u16string_view rObjectCID, const
 xCalculator->setXYNames ( aXName, aYName );
 RegressionCurveHelper::initializeCurveCalculator( 
xCalculator, xSeries, xChartModel );
 
-// change text for Moving Average
-OUString aWildcard( "%PERIOD" );
-sal_Int32 nIndex = 
xCalculator->getRepresentation().indexOf( aWildcard );
-if( nIndex != -1 )
-{  // replace period
-aRet = xCalculator->getRepresentation();
-aRet = aRet.replaceAt( nIndex, 
aWildcard.getLength(), OUString::number(aPeriod) );
-}
-
 // replace formula
-aWildcard = "%FORMULA";
-nIndex = aRet.indexOf( aWildcard );
+OUString aWildcard = "%FORMULA";
+sal_Int32 nIndex = aRet.indexOf( aWildcard );
 if( nIndex != -1 )
 {
 OUString aFormula ( 
xCalculator->getRepresentation() );
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx 
b/chart2/source/controller/dialogs/res_Trendline.cxx
index 647c071b1040..58ef6497a538 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -372,10 +372,8 @@ void TrendlineResources::UpdateControlStates()
 m_xFmtFld_InterceptValue->set_sensitive( bInterceptAvailable );
 if( bMovingAverage )
 {
-m_xCB_ShowEquation->set_state(TRISTATE_FALSE);
 m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_FALSE);
 }
-m_xCB_ShowEquation->set_sensitive( !bMovingAverage );
 m_xCB_ShowCorrelationCoeff->set_sensitive( !bMovingAverage );
 m_xCB_RegressionMovingType->set_sensitive(bMovingAverage);
 m_xNF_Period->set_sensitive(bMovingAverage);
@@ -428,8 +426,6 @@ void TrendlineResources::SetNbPoints( sal_Int32 nNbPoints )
 
 IMPL_LINK_NOARG(TrendlineResources, ShowEquation, weld::Toggleable&, void)
 {
-m_xEE_XName->set_sensitive(m_xCB_ShowEquation->get_active());
-m_xEE_YName->set_sensitive(m_xCB_ShowEquation->get_active());
 UpdateControlStates();
 }
 
diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx 
b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
index 6726d9d78b36..f71262f738b9 100644
--- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx
@@ -157,7 +157,15 @@ OUString 
MovingAverageRegressionCurveCalculator::ImplGetRepresentation(
 const uno::Reference< util::XNumberFormatter >& /*xNumFormatter*/,
 sal_Int32 /*nNumberFormatKey*/, sal_Int32* /*pFormulaLength = nullptr */ ) 
const
 {
-return SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+OUString aRet = SchResId( STR_OBJECT_MOVING_AVERAGE_WITH_PARAMETERS );
+// change text for Moving Average
+OUString aWildcard( "%PERIOD" );
+sal_Int32 nIndex = aRet.indexOf( aWildcard );
+if( nIndex != -1 )
+{  // replace period
+aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), 
OUString::number(mPeriod) );
+}
+return aRet;
 }
 
 } //  namespace chart


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - chart2/source

2023-06-29 Thread Laurent Balland (via logerrit)
 chart2/source/controller/main/ControllerCommandDispatch.cxx |   13 ---
 chart2/source/inc/RegressionCurveHelper.hxx |1 
 chart2/source/tools/RegressionCurveHelper.cxx   |   14 
 chart2/source/tools/RegressionCurveModel.cxx|1 
 chart2/source/tools/RegressionEquation.cxx  |8 ++
 5 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 439e2fb0ccc8fc75fb9239a7370db9dd56ee9c55
Author: Laurent Balland 
AuthorDate: Sun Jun 18 19:25:39 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 09:41:56 2023 +0200

tdf#155526 Moving average: remove Insert R2

Moving average trend line does not R² value.
This change remove "Insert R²" from context menu when the trend is of
type "Moving average"

Change-Id: I729a6421df34859e7176c798a2b68a6f13cfb544
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153294
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit aa86e7e8c22527eb5da0b8a05dbd4bd749f7a2b8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153700

diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx 
b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index 9e03e495827d..98468a138c3f 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -283,23 +283,28 @@ void ControllerState::update(
 // Trendline Equation
 bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = 
RegressionCurveHelper::hasEquation( xRegCurve );
 bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
+bMayAddR2Value = RegressionCurveHelper::MayHaveCorrelationCoefficient( 
xRegCurve ) && bMayAddTrendlineEquation;
 }
 else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
 {
 bMayFormatTrendlineEquation = true;
 bool bHasR2Value = false;
+bool bMayHaveR2 = true;
 try
 {
 uno::Reference< beans::XPropertySet > xEquationProperties =
 ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel );
 if( xEquationProperties.is() )
+{
 xEquationProperties->getPropertyValue( 
"ShowCorrelationCoefficient" ) >>= bHasR2Value;
+xEquationProperties->getPropertyValue( 
"MayHaveCorrelationCoefficient" ) >>= bMayHaveR2;
+}
 }
 catch(const uno::RuntimeException&)
 {
 TOOLS_WARN_EXCEPTION("chart2", "" );
 }
-bMayAddR2Value = !bHasR2Value;
+bMayAddR2Value = !bHasR2Value && bMayHaveR2;
 bMayDeleteR2Value = bHasR2Value;
 }
 }
@@ -674,8 +679,10 @@ void ControllerCommandDispatch::updateCommandAvailability()
 m_aCommandAvailability[ ".uno:InsertMeanValue" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddMeanValue;
 m_aCommandAvailability[ ".uno:InsertTrendline" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddTrendline;
 m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
-m_aCommandAvailability[ ".uno:InsertTrendlineEquationAndR2" ] = 
m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ];
-m_aCommandAvailability[ ".uno:InsertR2Value" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddR2Value;
+m_aCommandAvailability[ ".uno:InsertTrendlineEquationAndR2" ] =
+m_aCommandAvailability[ ".uno:InsertTrendlineEquation" ] && 
m_apControllerState->bMayAddR2Value;
+m_aCommandAvailability[ ".uno:InsertR2Value" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddR2Value
+&& !m_apControllerState->bMayAddTrendlineEquation;
 m_aCommandAvailability[ ".uno:DeleteR2Value" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value;
 
 m_aCommandAvailability[ ".uno:InsertXErrorBars" ] = bIsWritable && 
bControllerStateIsValid && m_apControllerState->bMayAddXErrorBars;
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx 
b/chart2/source/inc/RegressionCurveHelper.hxx
index 9f1b935c0d01..f9d919506460 100644
--- a/chart2/source/inc/RegressionCurveHelper.hxx
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -195,6 +195,7 @@ namespace chart::RegressionCurveHelper
 const rtl::Reference<::chart::RegressionCurveModel>& xCurve );
 
 OOO_DLLPUBLIC_CHARTTOOLS bool hasEquation(const 
css::uno::Reference& xCurve );
+OOO_DLLPUBLIC_CHARTTOOLS bool MayHaveCorrelationCoefficient(const 
css::uno::Reference& xCurve );
 
 } //  namespace chart
 
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx 
b/chart2/source/tools/RegressionCurveHelper.cxx
index 0bed3ca19e16..ef4c2091b4c2 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++