summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2024-01-15 13:50:41 -0400
committerHenry Castro <hcastro@collabora.com>2024-01-26 19:40:36 +0100
commitb8bc9518d523cff59e238f1eefc4ce7e7c844196 (patch)
treeb33ea42207a3a91dcc22bc2ea4113f9edf7aaac5 /sc
parente7186b49a9a0b24ddc3b1c5384b5d9facb03518c (diff)
tdf#34142: fix cell language status
Now the status bar will show the current cell language instead of the document language. Change-Id: I8b6d17b37e7c7bd69abd949a901499613f100649 Signed-off-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162123 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docsh4.cxx51
-rw-r--r--sc/source/ui/view/tabview3.cxx2
2 files changed, 49 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 9396b59518fe..813d86785a7a 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2207,16 +2207,59 @@ void ScDocShell::GetState( SfxItemSet &rSet )
case SID_LANGUAGE_STATUS:
{
- LanguageType eLatin, eCjk, eCtl;
+ OUString sLanguage;
+ sal_uInt16 nLangWhich = 0;
+ LanguageType eLatin = LANGUAGE_DONTKNOW, eCjk = LANGUAGE_DONTKNOW,
+ eCtl = LANGUAGE_DONTKNOW;
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ GetDocument().GetLanguage( eLatin, eCjk, eCtl );
+ sLanguage = SvtLanguageTable::GetLanguageString(eLatin);
- GetDocument().GetLanguage( eLatin, eCjk, eCtl );
- OUString sLanguage = SvtLanguageTable::GetLanguageString(eLatin);
- if (comphelper::LibreOfficeKit::isActive()) {
if (eLatin == LANGUAGE_NONE)
sLanguage += ";-";
else
sLanguage += ";" + LanguageTag(eLatin).getBcp47(false);
}
+ else if (ScTabViewShell* pViewShell = GetBestViewShell())
+ {
+ ScMarkData aMark = pViewShell->GetViewData().GetMarkData();
+ SCCOL nCol = pViewShell->GetViewData().GetCurX();
+ SCROW nRow = pViewShell->GetViewData().GetCurY();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
+
+ aMark.SetMarkArea(ScRange(nCol, nRow, nTab));
+ const ScPatternAttr* pSelAttrs = GetDocument().GetSelectionPattern(aMark);
+ if (pSelAttrs)
+ {
+ const SfxItemSet& rItemSet = pSelAttrs->GetItemSet();
+ nLangWhich = rItemSet.GetPool()->GetWhich(SID_ATTR_CHAR_LANGUAGE);
+ if (SfxItemState::SET == rItemSet.GetItemState(nLangWhich))
+ eLatin = static_cast<const SvxLanguageItem&>(rItemSet.Get(nLangWhich)).GetLanguage();
+
+ nLangWhich = rItemSet.GetPool()->GetWhich(SID_ATTR_CHAR_CJK_LANGUAGE);
+ if (SfxItemState::SET == rItemSet.GetItemState(nLangWhich))
+ eCjk = static_cast<const SvxLanguageItem&>(rItemSet.Get(nLangWhich)).GetLanguage();
+
+ nLangWhich = rItemSet.GetPool()->GetWhich(SID_ATTR_CHAR_CTL_LANGUAGE);
+ if (SfxItemState::SET == rItemSet.GetItemState(nLangWhich))
+ eCtl = static_cast<const SvxLanguageItem&>(rItemSet.Get(nLangWhich)).GetLanguage();
+
+ if (eLatin != LANGUAGE_NONE && eLatin != LANGUAGE_DONTKNOW)
+ sLanguage = SvtLanguageTable::GetLanguageString(eLatin);
+ if (eCjk != LANGUAGE_NONE && eCjk != LANGUAGE_DONTKNOW)
+ sLanguage = SvtLanguageTable::GetLanguageString(eCjk);
+ if (eCtl != LANGUAGE_NONE && eCtl != LANGUAGE_DONTKNOW)
+ sLanguage = SvtLanguageTable::GetLanguageString(eCtl);
+
+ if (sLanguage.isEmpty())
+ {
+ GetDocument().GetLanguage(eLatin, eCjk, eCtl);
+ sLanguage = SvtLanguageTable::GetLanguageString(eLatin);
+ }
+ }
+ }
rSet.Put(SfxStringItem(nWhich, sLanguage));
}
break;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index fe78ab3e8385..7de940ce24a9 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -621,6 +621,8 @@ void ScTabView::SelectionChanged(bool bFromPaste)
rBindings.Invalidate( SID_SORT_ASCENDING );
rBindings.Invalidate( SID_SORT_DESCENDING );
rBindings.Invalidate( SID_SELECT_UNPROTECTED_CELLS );
+ if (!comphelper::LibreOfficeKit::isActive())
+ rBindings.Invalidate( SID_LANGUAGE_STATUS );
if (aViewData.GetViewShell()->HasAccessibilityObjects())
aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccCursorChanged));