sd/qa/unit/tiledrendering/tiledrendering.cxx | 4 +- sd/source/ui/docshell/docshel3.cxx | 3 - sd/source/ui/docshell/docshell.cxx | 54 +++++++++++---------------- sd/source/ui/view/ViewShellBase.cxx | 14 +++++++ sd/uiconfig/simpress/statusbar/statusbar.xml | 1 5 files changed, 40 insertions(+), 36 deletions(-)
New commits: commit f25e0008a0a18c4894891587337a204805173e0c Author: Henry Castro <hcas...@collabora.com> Date: Thu Nov 16 22:13:27 2017 -0400 sd: enable language status bar item Change-Id: I7cb725cdcfc92366694fc8cb24c1443dd74d102e Reviewed-on: https://gerrit.libreoffice.org/44851 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/45448 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 6b27320bc0d0..03d756e5a260 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1838,8 +1838,8 @@ void SdTiledRenderingTest::testLanguageStatus() std::unique_ptr<SfxPoolItem> pItem2; pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem1); pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem2); - CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem1.get())); - CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem2.get())); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem1.get())); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem2.get())); } comphelper::LibreOfficeKit::setActive(false); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index f9c5eb47b5ee..a22f3376c16a 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -315,8 +315,6 @@ void DrawDocShell::Execute( SfxRequest& rReq ) else lcl_setLanguage( pDoc, aNewLangTxt ); - mpViewShell->GetFrame()->GetBindings().Invalidate( SID_LANGUAGE_STATUS ); - if ( pDoc->GetOnlineSpell() ) { pDoc->StartOnlineSpelling(); @@ -324,6 +322,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) } } } + Broadcast(SfxHint(SFX_HINT_LANGUAGECHANGED)); } break; diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 6553474cedf2..0ec666309be0 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -273,47 +273,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 0261657f1c60..6ba3aabfc3e2 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -444,6 +444,20 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) break; } } + else + { + switch ( rHint.GetId() ) + { + case SFX_HINT_LANGUAGECHANGED: + { + GetViewFrame()->GetBindings().Invalidate(SID_LANGUAGE_STATUS); + } + break; + + default: + break; + } + } } void ViewShellBase::InitializeFramework() diff --git a/sd/uiconfig/simpress/statusbar/statusbar.xml b/sd/uiconfig/simpress/statusbar/statusbar.xml index 78042ef3d523..10081eea81a8 100644 --- a/sd/uiconfig/simpress/statusbar/statusbar.xml +++ b/sd/uiconfig/simpress/statusbar/statusbar.xml @@ -24,6 +24,7 @@ <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/> <statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124"/> <statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54"/> + <statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100"/> <statusbar:statusbaritem xlink:href=".uno:ZoomPage" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/> <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/> <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="36"/> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits