diff options
author | Henry Castro <hcastro@collabora.com> | 2017-11-16 22:13:27 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-11-17 19:09:11 +0100 |
commit | 44badb1175dbe7906aec993e8f2cc90c81ae71fd (patch) | |
tree | c0cefe31ef3d4f25c00c82b11024e3a1e77c06fd /sd/source | |
parent | 95d9f596336ebf19dc367f618b3788a4ce0ba542 (diff) |
sd: enable language status bar item
Change-Id: I7cb725cdcfc92366694fc8cb24c1443dd74d102e
Reviewed-on: https://gerrit.libreoffice.org/44851
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 54 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 15 |
3 files changed, 38 insertions, 34 deletions
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index ab1cb41a1668..b7e1c5b33feb 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -314,8 +314,6 @@ void DrawDocShell::Execute( SfxRequest& rReq ) else lcl_setLanguage( pDoc, aNewLangTxt ); - mpViewShell->GetFrame()->GetBindings().Invalidate( SID_LANGUAGE_STATUS ); - if ( pDoc->GetOnlineSpell() ) { pDoc->StartOnlineSpelling(); @@ -323,6 +321,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) } } } + Broadcast(SfxHint(SfxHintId::LanguageChanged)); } break; diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 94a66e9bb18d..967f22552eaa 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -275,47 +275,37 @@ void DrawDocShell::GetState(SfxItemSet &rSet) break; case SID_LANGUAGE_STATUS: { - if ( comphelper::LibreOfficeKit::isActive() ) + SdrObject* pObj = nullptr; + bool bLanguageFound = false; + OutlinerParaObject* pParaObj = nullptr; + LanguageType eLanguage( LANGUAGE_DONTKNOW ); + sal_uInt16 nCount = mpDoc->GetPageCount(); + for ( sal_uInt16 itPage = 0; itPage < nCount && !bLanguageFound; itPage++ ) { - SdrObject* pObj = nullptr; - bool bLanguageFound = false; - OutlinerParaObject* pParaObj = nullptr; - LanguageType eLanguage( LANGUAGE_DONTKNOW ); - sal_uInt16 nCount = mpDoc->GetPageCount(); - for ( sal_uInt16 itPage = 0; itPage < nCount && !bLanguageFound; itPage++ ) + SdrObjListIter aListIter(*mpDoc->GetPage(itPage), SdrIterMode::DeepWithGroups); + while ( aListIter.IsMore() && !bLanguageFound ) { - SdrObjListIter aListIter(*mpDoc->GetPage(itPage), SdrIterMode::DeepWithGroups); - while ( aListIter.IsMore() && !bLanguageFound ) + pObj = aListIter.Next(); + if ( pObj ) { - pObj = aListIter.Next(); - if ( pObj ) + pParaObj = pObj->GetOutlinerParaObject(); + if ( pParaObj ) { - pParaObj = pObj->GetOutlinerParaObject(); - if ( pParaObj ) - { - SdrOutliner aOutliner(&mpDoc->GetPool(), OutlinerMode::TextObject); - aOutliner.SetText(*pParaObj); - eLanguage = aOutliner.GetLanguage(0, 0); - bLanguageFound = eLanguage != LANGUAGE_DONTKNOW; - } + SdrOutliner aOutliner(&mpDoc->GetPool(), OutlinerMode::TextObject); + aOutliner.SetText(*pParaObj); + eLanguage = aOutliner.GetLanguage(0, 0); + bLanguageFound = eLanguage != LANGUAGE_DONTKNOW; } } } + } - if ( eLanguage == LANGUAGE_DONTKNOW ) - { - eLanguage = mpDoc->GetLanguage( EE_CHAR_LANGUAGE ); - } - - css::uno::Sequence< OUString > aSeq( 1 ); - aSeq[0] = SvtLanguageTable::GetLanguageString(eLanguage); - SfxStringListItem aItem( SID_LANGUAGE_STATUS ); - aItem.SetStringList( aSeq ); - rSet.Put(aItem); + if ( eLanguage == LANGUAGE_DONTKNOW ) + { + eLanguage = mpDoc->GetLanguage( EE_CHAR_LANGUAGE ); } - else - // Keeping this enabled for the time being - rSet.Put(SfxVisibilityItem(nWhich, true)); + + rSet.Put(SfxStringItem(nWhich, SvtLanguageTable::GetLanguageString(eLanguage))); } break; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index f7d7a02538bf..3dbd3503b13a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -429,6 +429,21 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) break; } } + else + { + const SfxHintId nSlot = rHint.GetId(); + switch ( nSlot ) + { + case SfxHintId::LanguageChanged: + { + GetViewFrame()->GetBindings().Invalidate(SID_LANGUAGE_STATUS); + } + break; + + default: + break; + } + } } void ViewShellBase::InitializeFramework() |