[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/inc sc/source
sc/inc/formulacell.hxx |2 ++ sc/source/core/data/formulacell.cxx |5 + sc/source/core/tool/interpr7.cxx| 26 -- 3 files changed, 31 insertions(+), 2 deletions(-) New commits: commit 0cbf9ce40e1e8de3658cd22770b8f701e7b47e62 Author: Eike Rathke AuthorDate: Wed Jul 18 18:02:58 2018 +0200 Commit: Thorsten Behrens CommitDate: Sun Jul 28 00:21:51 2019 +0200 Related: tdf#118735 WEBSERVICE preserve the hybrid string result, if possible Possible only for constant literal URI arguments, as otherwise we wouldn't know whether the hybrid string result actually matches the call, and possible only for the very first recalc as the hybrid string result will be replaced by the calculated result. However, executing an initial recalc is necessary to add the (then determined and maybe calculated) URI to the link manager after having loaded a document. Change-Id: I67738c13ecce54b43ebb52ea8a8282aebee5f03a Reviewed-on: https://gerrit.libreoffice.org/57696 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit d2e5283f0caeb87e316040e2db1aade8cc408f62) Reviewed-on: https://gerrit.libreoffice.org/76301 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 78eb1f6265b8..af781894b299 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -396,6 +396,8 @@ public: svl::SharedString GetResultString() const; +bool HasHybridStringResult() const; + /* Sets the shared code array to error state in addition to the cell result */ void SetErrCode( FormulaError n ); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index b43e908352ed..4e64de30c000 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2485,6 +2485,11 @@ svl::SharedString ScFormulaCell::GetResultString() const return aResult.GetString(); } +bool ScFormulaCell::HasHybridStringResult() const +{ +return aResult.GetType() == formula::svHybridCell && !aResult.GetString().isEmpty(); +} + void ScFormulaCell::SetResultMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef& pMat, const formula::FormulaToken* pUL ) { aResult.SetMatrix(nCols, nRows, pMat, pUL); diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 7b11e6faddab..fcd579a8419b 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -320,6 +320,7 @@ void ScInterpreter::ScWebservice() ScWebServiceLink* pLink = lcl_GetWebServiceLink(mpLinkManager, aURI); bool bWasError = (pMyFormulaCell && pMyFormulaCell->GetRawError() != FormulaError::NONE); +bool bLinkFormulaNeedingCheck = false; if (!pLink) { @@ -335,7 +336,8 @@ void ScInterpreter::ScWebservice() //if the document was just loaded, but the ScDdeLink entry was missing, then //don't update this link until the links are updated in response to the users //decision -if (!pDok->HasLinkFormulaNeedingCheck()) +bLinkFormulaNeedingCheck = pDok->HasLinkFormulaNeedingCheck(); +if (!bLinkFormulaNeedingCheck) { pLink->Update(); } @@ -360,7 +362,27 @@ void ScInterpreter::ScWebservice() if (pLink->HasResult()) PushString(pLink->GetResult()); else -PushError(FormulaError::NoValue); +{ +// If this formula cell is recalculated just after load and the +// expression is exactly WEBSERVICE("literal_URI") (i.e. no other +// calculation involved, not even a cell reference) and a cached +// result is set as hybrid string then use that as result value to +// prevent a #VALUE! result due to the "Automatic update of +// external links has been disabled." +// This will work only once, as the new formula cell result won't +// be a hybrid anymore. +if (bLinkFormulaNeedingCheck && pMyFormulaCell && pMyFormulaCell->GetCode()->GetCodeLen() == 2 && +pMyFormulaCell->HasHybridStringResult()) +{ +formula::FormulaToken const * const * pRPN = pMyFormulaCell->GetCode()->GetCode(); +if (pRPN[0]->GetType() == formula::svString && pRPN[1]->GetOpCode() == ocWebservice) +PushString( pMyFormulaCell->GetResultString()); +else +PushError(FormulaError::NoValue); +} +else +PushError(FormulaError::NoValue); +} pDok->EnableIdle(bOldEnabled); mpLinkManager->CloseCachedComps(); ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/inc sc/source
sc/inc/strings.hrc |1 + sc/source/ui/miscdlgs/linkarea.cxx |9 - 2 files changed, 9 insertions(+), 1 deletion(-) New commits: commit b3c11020b7e54a258b2d4ebe20c6b5256f9401cf Author: Katarina Behrens AuthorDate: Thu May 9 20:46:45 2019 +0200 Commit: Thorsten Behrens CommitDate: Fri Jun 21 12:13:48 2019 +0200 Make it more obvious that there are no named ranges and thus the selected doc can't be used as the source of external data for this sheet. In other words, help the user figure out why is OK button disabled Change-Id: Ie1b999c9c3640397e9f6f6ee321d3a5a5d63fa3b Reviewed-on: https://gerrit.libreoffice.org/72075 Tested-by: Jenkins Reviewed-by: Katarina Behrens Reviewed-on: https://gerrit.libreoffice.org/74432 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index ed0fc8df5663..1b52acabdd12 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -334,6 +334,7 @@ #define STR_ANCHOR_TO_CELL NC_("STR_ANCHOR_TO_CELL", "To cell") #define STR_ANCHOR_TO_CELL_RESIZE NC_("STR_ANCHOR_TO_CELL_RESIZE", "To cell (resize with cell)") #define STR_ANCHOR_TO_PAGE NC_("STR_ANCHOR_TO_PAGE", "To page") +#define STR_NO_NAMED_RANGES_AVAILABLE NC_("STR_NO_NAMED_RANGES_AVAILABLE", "No named ranges available in the selected document") #endif diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 002bf482fd7e..6d413ad91146 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -35,6 +35,8 @@ #include #include #include +#include +#include ScLinkedAreaDlg::ScLinkedAreaDlg(weld::Window* pParent) : GenericDialogController(pParent, "modules/scalc/ui/externaldata.ui", "ExternalDataDialog") @@ -257,8 +259,13 @@ void ScLinkedAreaDlg::UpdateSourceRanges() m_xLbRanges->thaw(); -if (m_xLbRanges->n_children() == 1) +if (m_xLbRanges->n_children() >= 1) m_xLbRanges->select(0); +else +{ +m_xLbRanges->append_text(ScResId(STR_NO_NAMED_RANGES_AVAILABLE)); +m_xLbRanges->set_sensitive(false); +} } void ScLinkedAreaDlg::UpdateEnable() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/inc sc/source
sc/inc/document.hxx |2 +- sc/inc/drwlayer.hxx |2 +- sc/source/core/data/documen9.cxx |4 ++-- sc/source/core/data/drwlayer.cxx | 19 ++- sc/source/ui/docshell/docfunc.cxx | 17 + sc/source/ui/view/viewfunc.cxx| 11 +-- 6 files changed, 44 insertions(+), 11 deletions(-) New commits: commit f10f83bde06b0303a0d56dac120ecb53349250f2 Author: Ilhan Yesil AuthorDate: Mon Mar 18 15:29:11 2019 +0100 Commit: Thorsten Behrens CommitDate: Mon May 27 17:58:08 2019 +0200 tdf#123762 Cell anchored object is deleted if cell is deleted If an object is anchored to a cell, then it is expected that this object belongs to this cell and it's survive after a deletion of the cell makes no sense. So the anchored object will be deleted together with the cell. Objects anchored to the page are not affected. Reviewed-on: https://gerrit.libreoffice.org/69390 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit d2fa9c0d657877c967e41fdd0091f81d1b7ca048) Change-Id: I91f24bf92ab5329aba1d053b3cf5fba77bf16e4f Reviewed-on: https://gerrit.libreoffice.org/72800 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index dff46dffd699..be7630b13461 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1469,7 +1469,7 @@ public: bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = nullptr ); void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScMarkData& rMark ); + const ScMarkData& rMark, bool bAnchored = false ); void DeleteObjectsInSelection( const ScMarkData& rMark ); void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark, diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 48741497ac0e..1713d3b94120 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -143,7 +143,7 @@ public: boolHasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow ); voidDeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, -SCCOL nCol2,SCROW nRow2 ); +SCCOL nCol2,SCROW nRow2, bool bAnchored = false ); voidDeleteObjectsInSelection( const ScMarkData& rMark ); voidCopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rectangle& rRange ); diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 5433142df41a..179b54eae0f3 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -260,7 +260,7 @@ bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) } void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, -const ScMarkData& rMark ) +const ScMarkData& rMark, bool bAnchored) { if (!mpDrawLayer) return; @@ -269,7 +269,7 @@ void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) if (maTabs[*itr]) -mpDrawLayer->DeleteObjectsInArea( *itr, nCol1, nRow1, nCol2, nRow2 ); +mpDrawLayer->DeleteObjectsInArea( *itr, nCol1, nRow1, nCol2, nRow2, bAnchored); } void ScDocument::DeleteObjectsInSelection( const ScMarkData& rMark ) diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 8739d3b195c0..7dc7c6a4e62c 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1359,7 +1359,7 @@ bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow ) } void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, -SCCOL nCol2,SCROW nRow2 ) +SCCOL nCol2,SCROW nRow2, bool bAnchored ) { OSL_ENSURE( pDoc, "ScDrawLayer::DeleteObjectsInArea without document" ); if ( !pDoc ) @@ -1389,8 +1389,17 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, if (!IsNoteCaption( pObject )) { tools::Rectangle aObjRect = pObject->GetCurrentBoundRect(); -if ( aDelRect.IsInside( aObjRect ) ) -ppObj[nDelCount++] = pObject; +if (aDelRect.IsInside(aObjRect)) +{ +if (bAnchored) +{ +