From 900891c3b42e80e8d3970fd5fc02b67022ae3795 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Mon, 16 May 2022 15:55:35 +0200 Subject: Revert "sw: restore UI language to en while saving" This reverts commit f4ef1e3e580f7a590496d62aaa3dc7e092510a9c. Reason: T35383 Writer: Page breaks saved in German UI/locale turn into line breaks Change-Id: Iea7c41b361beb0bc6f455e72ab48cef3604305d6 --- sfx2/source/doc/objstor.cxx | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 238369b746e6..7ccee4f3a970 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -91,7 +91,6 @@ #include #include #include -#include #include #include @@ -3169,11 +3168,6 @@ bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) return false; } -namespace -{ -static LanguageTag g_defaultLanguageTag("en-US", true); -} - bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) { uno::Reference< embed::XStorage > xStorage = rMedium.GetStorage(); @@ -3196,31 +3190,6 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) pImpl->aBasicManager.storeLibrariesToStorage( xStorage ); } #endif - - // Because XMLTextFieldExport::ExportFieldDeclarations (called from SwXMLExport) - // calls SwXTextFieldMasters::getByName, which in turn maps property names by - // calling SwStyleNameMapper::GetTextUINameArray, which uses - // SvtSysLocale().GetUILanguageTag() to do the mapping, saving indirectly depends - // on the UI language. This is an unfortunate depenency. - // Here we restore to English - const auto viewLanguage = comphelper::LibreOfficeKit::getLanguageTag(); - - // Use the default language for saving and restore later if necessary. - bool restoreLanguage = false; - if (comphelper::LibreOfficeKit::isActive() && viewLanguage != g_defaultLanguageTag) - { - restoreLanguage = true; - comphelper::LibreOfficeKit::setLanguageTag(g_defaultLanguageTag); - } - - // Restore the view's original language automatically and as necessary. - const ::comphelper::ScopeGuard aGuard( - [&viewLanguage, restoreLanguage]() - { - if (restoreLanguage && viewLanguage != comphelper::LibreOfficeKit::getLanguageTag()) - comphelper::LibreOfficeKit::setLanguageTag(viewLanguage); - }); - return SaveAs( rMedium ); } else return false; -- cgit