tdf#107765: Use the correct sheet index.
This is a follow-up to f15e6293cf78d67963a6e512f60a11ae58da72c5.
Change-Id: I3f1e6bbb1fe83fab48a0c3889fb53c6919f6351d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133967
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f83b021..8e79d31 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1919,7 +1919,8 @@ public:
SCTAB nTab, ScMF nFlags );
SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr );
SC_DLLPUBLIC const ScPatternAttr* SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, std::unique_ptr<ScPatternAttr> );
SC_DLLPUBLIC const ScPatternAttr* SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, std::unique_ptr<ScPatternAttr> pAttr );
SC_DLLPUBLIC const ScPatternAttr* SetPattern( const ScAddress& rPos, std::unique_ptr<ScPatternAttr> pAttr );
SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr );
void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5acd603..1675f21 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5097,6 +5097,11 @@ const ScPatternAttr* ScDocument::SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
return nullptr;
}
const ScPatternAttr* ScDocument::SetPattern( const ScAddress& rPos, std::unique_ptr<ScPatternAttr> pAttr )
{
return SetPattern(rPos.Col(), rPos.Row(), rPos.Tab(), std::move(pAttr));
}
void ScDocument::SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr )
{
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 615960f..cb3c4f4 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -134,7 +134,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
// Set the new string and update the language with the cell.
mrDoc.SetString(aPos, aNewStr);
const ScPatternAttr* pAttr = mrDoc.GetPattern(mnCurrCol, mnCurrRow, mnStartTab);
const ScPatternAttr* pAttr = mrDoc.GetPattern(aPos);
std::unique_ptr<ScPatternAttr> pNewAttr;
if (pAttr)
@@ -143,7 +143,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
pNewAttr = std::make_unique<ScPatternAttr>(mrDoc.GetPool());
pNewAttr->GetItemSet().Put(SvxLanguageItem(aLang.nLang, EE_CHAR_LANGUAGE), ATTR_FONT_LANGUAGE);
mrDoc.SetPattern(mnCurrCol, mnCurrRow, mnStartTab, std::move(pNewAttr));
mrDoc.SetPattern(aPos, std::move(pNewAttr));
}
if (mpRedoDoc && !bEmptyCell)