diff options
Diffstat (limited to 'sd/source/ui/docshell')
-rw-r--r-- | sd/source/ui/docshell/docshel3.cxx | 17 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 49 |
2 files changed, 60 insertions, 6 deletions
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 35f8a38ebe0d..f9c5eb47b5ee 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -121,7 +121,8 @@ static void lcl_setLanguage( const SdDrawDocument *pDoc, const OUString &rLangua for( size_t nObj = 0; nObj < nObjCount; ++nObj ) { SdrObject *pObj = pPage->GetObj( nObj ); - lcl_setLanguageForObj( pObj, nLang, bLanguageNone ); + if (pObj->GetObjIdentifier() != OBJ_PAGE) + lcl_setLanguageForObj( pObj, nLang, bLanguageNone ); } } } @@ -297,6 +298,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) const OUString aDocumentLangPrefix("Default_"); const OUString aStrNone("LANGUAGE_NONE"); const OUString aStrResetLangs("RESET_LANGUAGES"); + SdDrawDocument* pDoc = mpViewShell->GetDoc(); sal_Int32 nPos = -1; if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix ))) { @@ -307,11 +309,18 @@ void DrawDocShell::Execute( SfxRequest& rReq ) break; } if (aNewLangTxt == aStrNone) - lcl_setLanguage( mpViewShell->GetDoc(), OUString() ); + lcl_setLanguage( pDoc, OUString(), true ); else if (aNewLangTxt == aStrResetLangs) - lcl_setLanguage( mpViewShell->GetDoc(), OUString(), true ); + lcl_setLanguage( pDoc, OUString() ); else - lcl_setLanguage( mpViewShell->GetDoc(), aNewLangTxt ); + lcl_setLanguage( pDoc, aNewLangTxt ); + + mpViewShell->GetFrame()->GetBindings().Invalidate( SID_LANGUAGE_STATUS ); + + if ( pDoc->GetOnlineSpell() ) + { + pDoc->StartOnlineSpelling(); + } } } } 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; |