summaryrefslogtreecommitdiff
path: root/sd/source/ui/docshell/docshell.cxx
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2017-10-13 20:47:29 -0400
committerJan Holesovsky <kendy@collabora.com>2017-10-26 21:07:22 +0200
commit514c93d9741ce4bc12edf38eadb0e268aae80a90 (patch)
tree272cec0e326f63dd6b3d11ad51bc212c207cbda3 /sd/source/ui/docshell/docshell.cxx
parent091beaf3c558984c0630757eecabbb3cb4127b9e (diff)
sd lok: fix spell checking languages in Impress
Change-Id: I133c9b91521fa7f2b5f7e3a47396f7efa31e1a86 Reviewed-on: https://gerrit.libreoffice.org/43382 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/43388 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd/source/ui/docshell/docshell.cxx')
-rw-r--r--sd/source/ui/docshell/docshell.cxx49
1 files changed, 47 insertions, 2 deletions
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index f07eb0fbac75..6553474cedf2 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -26,9 +26,13 @@
#include <svx/svxids.hrc>
#include <svl/srchitem.hxx>
#include <svx/srchdlg.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svditer.hxx>
#include <editeng/flstitem.hxx>
+#include <editeng/eeitem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <svl/slstitm.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/docfile.hxx>
#include <svx/drawitem.hxx>
@@ -36,8 +40,10 @@
#include <svl/whiter.hxx>
#include <svl/itempool.hxx>
#include <svtools/ctrltool.hxx>
+#include <svtools/langtab.hxx>
#include <vcl/graphicfilter.hxx>
#include <comphelper/classids.hxx>
+#include <comphelper/lok.hxx>
#include <svl/cjkoptions.hxx>
#include <svl/visitem.hxx>
@@ -267,8 +273,47 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
break;
case SID_LANGUAGE_STATUS:
{
- // Keeping this enabled for the time being
- rSet.Put(SfxVisibilityItem(nWhich, true));
+ 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++ )
+ {
+ SdrObjListIter aListIter(*mpDoc->GetPage(itPage), SdrIterMode::DeepWithGroups);
+ while ( aListIter.IsMore() && !bLanguageFound )
+ {
+ pObj = aListIter.Next();
+ if ( pObj )
+ {
+ pParaObj = pObj->GetOutlinerParaObject();
+ if ( pParaObj )
+ {
+ 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);
+ }
+ else
+ // Keeping this enabled for the time being
+ rSet.Put(SfxVisibilityItem(nWhich, true));
}
break;