[Libreoffice-commits] core.git: sd/qa sd/source sd/uiconfig

Henry Castro hcastro at collabora.com
Fri Nov 17 18:09:34 UTC 2017


 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          |   15 +++++++
 sd/uiconfig/simpress/statusbar/statusbar.xml |    1 
 5 files changed, 41 insertions(+), 36 deletions(-)

New commits:
commit 44badb1175dbe7906aec993e8f2cc90c81ae71fd
Author: Henry Castro <hcastro at 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 <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 9622946a4743..b4110b79a4aa 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1856,8 +1856,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 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()
diff --git a/sd/uiconfig/simpress/statusbar/statusbar.xml b/sd/uiconfig/simpress/statusbar/statusbar.xml
index f7493de6fa74..6d0ba163f474 100644
--- a/sd/uiconfig/simpress/statusbar/statusbar.xml
+++ b/sd/uiconfig/simpress/statusbar/statusbar.xml
@@ -24,6 +24,7 @@
  <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="400"/>
  <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
  <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
+ <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"/>


More information about the Libreoffice-commits mailing list