sd/qa/unit/tiledrendering/data/language-all-text.odp |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 31 +++++++++++++++++++ sd/source/ui/docshell/docshel3.cxx | 14 ++++++++ sw/source/uibase/shells/textsh1.cxx | 2 - 4 files changed, 46 insertions(+), 1 deletion(-)
New commits: commit 8caaacb057931b64cbea10e475379d3f655f5cf2 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri May 24 13:44:38 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jun 20 13:58:49 2019 +0200 sd: make Tools -> Language -> For All Text affect shape text The problem was that in case the shape text has an explicit language set, then the shape language will have no effect on shape text language; need to clear those attributes explicitly. The const_cast<> for the EditTextObject should be OK, since we change the shape's item set anyway, so we don't omit any needed notifications. (cherry picked from commit 863533ee2c00db3dde1f078b9f21f7e8e1d1333e) Conflicts: sd/qa/unit/tiledrendering/tiledrendering.cxx Change-Id: I721e3f0aefa103a6bfa320a671da2ee1e039fa38 diff --git a/sd/qa/unit/tiledrendering/data/language-all-text.odp b/sd/qa/unit/tiledrendering/data/language-all-text.odp new file mode 100644 index 000000000000..a484a6310e51 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/language-all-text.odp differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index f46b8ca0b63a..4accff83b9c2 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -115,6 +115,7 @@ public: void testTdf115873(); void testTdf115873Group(); void testCutSelectionChange(); + void testLanguageAllText(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -161,6 +162,7 @@ public: CPPUNIT_TEST(testTdf115873); CPPUNIT_TEST(testTdf115873Group); CPPUNIT_TEST(testCutSelectionChange); + CPPUNIT_TEST(testLanguageAllText); CPPUNIT_TEST_SUITE_END(); @@ -1956,6 +1958,35 @@ void SdTiledRenderingTest::testLanguageStatus() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testLanguageAllText() +{ + // Load the document, which has a single shape, with Hungarian text. + comphelper::LibreOfficeKit::setActive(); + createDoc("language-all-text.odp"); + + // Set tha language to English for all text. + uno::Sequence<beans::PropertyValue> aArgs = comphelper::InitPropertySequence({ + { "Language", uno::makeAny(OUString("Default_English (USA)")) }, + }); + comphelper::dispatchCommand(".uno:LanguageStatus", aArgs); + Scheduler::ProcessEventsToIdle(); + + // Assert that the shape text language was changed. + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xRun( + getRunFromParagraph(0, getParagraphFromShape(0, xShape)), uno::UNO_QUERY); + lang::Locale aLocale; + xRun->getPropertyValue("CharLocale") >>= aLocale; + // Without the accompanying fix in place, this test would have failed with 'Expected: en; + // Actual: hu', as the shape text language was not set. + CPPUNIT_ASSERT_EQUAL(OUString("en"), aLocale.Language); + + comphelper::LibreOfficeKit::setActive(false); +} + void SdTiledRenderingTest::testDefaultView() { // Load the document with notes view. diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index a9925bf5f13b..8aab98e8dd65 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -40,6 +40,8 @@ #include <editeng/unolingu.hxx> #include <editeng/langitem.hxx> #include <editeng/eeitem.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/editobj.hxx> #include <com/sun/star/i18n/TextConversionOption.hpp> #include <sfx2/notebookbar/SfxNotebookBar.hxx> @@ -93,6 +95,18 @@ static void lcl_setLanguageForObj( SdrObject *pObj, LanguageType nLang, bool bLa return; } pObj->SetMergedItem( SvxLanguageItem( nLang, nLangWhichId ) ); + + // Reset shape text language to default, so it inherits the shape language set above. + OutlinerParaObject* pOutliner = pObj->GetOutlinerParaObject(); + if (pOutliner) + { + EditTextObject& rEditTextObject + = const_cast<EditTextObject&>(pOutliner->GetTextObject()); + for (sal_uInt16 n : aLangWhichId_EE) + { + rEditTextObject.RemoveCharAttribs(n); + } + } } } else // Reset to default commit 677a02b66e578791e8b64ce3d61cd9c9f6df0497 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Feb 20 21:58:52 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jun 20 13:58:49 2019 +0200 sw: fix warning in SwTextShell::GetState() warn:sw.core:31398:31398:sw/source/core/bastyp/index.cxx:322: SwIndex::operator--() wraps around Change-Id: I5c37a6b5e1fe24bc3b6b84e762bad6577583f3d8 Reviewed-on: https://gerrit.libreoffice.org/68127 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 6415b0c49c8dffc3d27920b9422531d5debcf767) diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index b95e5b9fcc76..f6746fe0579e 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1928,7 +1928,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) // Enable it if we have a valid object other than what form shell knows SwPosition aPos(*GetShell().GetCursor()->GetPoint()); sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos); - if ( !pFieldBM ) + if ( !pFieldBM && aPos.nContent.GetIndex() > 0) { --aPos.nContent; pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits