editeng/source/editeng/editdbg.cxx | 4 + editeng/source/editeng/eerdll.cxx | 2 editeng/source/editeng/impedit2.cxx | 5 - editeng/source/editeng/impedit5.cxx | 4 + editeng/source/items/paraitem.cxx | 2 include/editeng/autodiritem.hxx | 1 sd/source/ui/view/drtxtob1.cxx | 5 + sw/qa/extras/odfexport/data/tdf162120-style-writing-mode-automatic.fodt | 14 ++-- sw/qa/extras/odfexport/odfexport4.cxx | 10 ++ sw/qa/extras/uiwriter/data/tdf133589.fodt | 2 sw/qa/extras/uiwriter/data/tdf164140.fodt | 4 - sw/qa/extras/uiwriter/uiwriter11.cxx | 35 ++++++++++ sw/source/core/bastyp/init.cxx | 2 sw/source/core/edit/editsh.cxx | 8 +- sw/source/uibase/shells/annotsh.cxx | 9 ++ sw/source/uibase/shells/drwtxtex.cxx | 9 ++ 16 files changed, 93 insertions(+), 23 deletions(-)
New commits: commit ed76b5121a51e170cf8426f8999b22dc968dcf9d Author: Jonathan Clark <[email protected]> AuthorDate: Tue Jan 20 15:01:24 2026 -0700 Commit: Jonathan Clark <[email protected]> CommitDate: Wed Jan 21 23:06:09 2026 +0100 tdf#162120 Make style:writing-mode-automatic the default behavior Updates Writer and EE to enable style:writing-mode-automatic, unless specifically set to false in the ODF. In addition, this change updates the behavior of .uno:ParaLeftToRight and .uno:ParaRightToLeft to explicitly set style:writing-mode-automatic to false. This will prevent automatically overwriting the writing direction when the user has explicitly acted to control it. Change-Id: I85d092fdb28907a383605d16a9a608323e9127c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197714 Reviewed-by: Jonathan Clark <[email protected]> Tested-by: Jenkins diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 67979194701c..3c9798f90778 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -23,6 +23,7 @@ #include <vcl/weld/weld.hxx> #include <vcl/window.hxx> +#include <editeng/autodiritem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -197,6 +198,9 @@ static OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) DebOutBuffer buffer; switch ( rItem.Which() ) { + case EE_PARA_AUTOWRITINGDIR: + buffer.append("AutoWritingDir=", rItem.StaticWhichCast(EE_PARA_AUTOWRITINGDIR)); + break; case EE_PARA_WRITINGDIR: buffer.append("WritingDir=", rItem.StaticWhichCast(EE_PARA_WRITINGDIR)); break; diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index f961b722ead1..c064110c136b 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -119,7 +119,7 @@ ItemInfoPackage& getItemInfoPackageEditEngine() { EE_PARA_TABS, new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ), SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_NONE }, { EE_PARA_JUST_METHOD, new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ), SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, { EE_PARA_VER_JUST, new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ), SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, - { EE_PARA_AUTOWRITINGDIR, new SvxAutoFrameDirectionItem( false, EE_PARA_AUTOWRITINGDIR ), SID_ATTR_PARA_AUTOFRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_AUTOWRITINGDIR, new SvxAutoFrameDirectionItem( true, EE_PARA_AUTOWRITINGDIR ), SID_ATTR_PARA_AUTOFRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, { EE_CHAR_COLOR, new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_FONTINFO, EE_CHAR_FONTINFO_CJK and EE_CHAR_FONTINFO_CTL need on-demand initialization diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 6d64243e1ffe..68f93b6c6354 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2538,9 +2538,6 @@ EditPaM ImpEditEngine::ImpDeleteSelection(const EditSelection& rCurSel) UpdateSelectionsDelete(deleted); UpdateSelections(); - // tdf#162120: Automatically adjust paragraph directions after edit - UpdateAutoParaDirection(rCurSel); - TextModified(); return aStartPaM; } @@ -2788,7 +2785,7 @@ void ImpEditEngine::UpdateAutoParaDirection(const EditSelection& rCurSel) EditPaM aPaM(rCurSel.Min()); auto nPara = maEditDoc.GetPos(aPaM.GetNode()); - if (nPara >= GetParaPortions().Count() || !HasParaAttrib(nPara, EE_PARA_AUTOWRITINGDIR)) + if (nPara >= GetParaPortions().Count()) { return; } diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 898819998629..04c2007c2460 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -1116,6 +1116,10 @@ bool ImpEditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView pEditView->getImpl().DrawSelectionXOR(); UndoActionStart( EDITUNDO_DELETE ); aCurSel = DeleteLeftOrRight( aCurSel, nDel, nMode ); + + // tdf#162120: Automatically adjust paragraph directions after edit + UpdateAutoParaDirection(aCurSel); + UndoActionEnd(); bModified = true; bAllowIdle = false; diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index ee213d2f8415..9f0759add854 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star; - +SfxPoolItem* SvxAutoFrameDirectionItem::CreateDefault() { return new SvxAutoFrameDirectionItem(true, 0); } SfxPoolItem* SvxLineSpacingItem::CreateDefault() { return new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0);} SfxPoolItem* SvxAdjustItem::CreateDefault() { return new SvxAdjustItem(SvxAdjust::ParaStart, 0);} SfxPoolItem* SvxWidowsItem::CreateDefault() { return new SvxWidowsItem(0, 0);} diff --git a/include/editeng/autodiritem.hxx b/include/editeng/autodiritem.hxx index 2b3cf3c4715a..60e4f2136faa 100644 --- a/include/editeng/autodiritem.hxx +++ b/include/editeng/autodiritem.hxx @@ -24,6 +24,7 @@ class EDITENG_DLLPUBLIC SvxAutoFrameDirectionItem final : public SfxBoolItem { public: + static SfxPoolItem* CreateDefault(); DECLARE_ITEM_TYPE_FUNCTION(SvxAutoFrameDirectionItem) SvxAutoFrameDirectionItem(const bool bValue, const sal_uInt16 nId); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 3e1e29936a44..de9fe1bbb330 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -27,6 +27,7 @@ #include <editeng/ulspitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/adjustitem.hxx> +#include <editeng/autodiritem.hxx> #include <editeng/numitem.hxx> #include <svl/itempool.hxx> #include <svl/stritem.hxx> @@ -724,6 +725,10 @@ SET_ADJUST: aNewAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); } + // tdf#162120: The paragraph direction has been manually set by the user. + // Don't automatically adjust the paragraph direction anymore. + aNewAttr.Put(SvxAutoFrameDirectionItem{ false, EE_PARA_AUTOWRITINGDIR }); + rReq.Done( aNewAttr ); pArgs = rReq.GetArgs(); diff --git a/sw/qa/extras/odfexport/data/tdf162120-style-writing-mode-automatic.fodt b/sw/qa/extras/odfexport/data/tdf162120-style-writing-mode-automatic.fodt index bf3cc0283cf9..0ee2c76448cd 100644 --- a/sw/qa/extras/odfexport/data/tdf162120-style-writing-mode-automatic.fodt +++ b/sw/qa/extras/odfexport/data/tdf162120-style-writing-mode-automatic.fodt @@ -26,7 +26,7 @@ </style:default-style> <style:style style:name="Standard" style:family="paragraph" style:class="text"/> <style:style style:name="AutoStyle" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties style:writing-mode-automatic="true"/> + <style:paragraph-properties style:writing-mode-automatic="false"/> </style:style> <text:outline-style style:name="Outline"> <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> @@ -89,11 +89,11 @@ <style:text-properties/> </style:style> <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties style:writing-mode-automatic="true"/> + <style:paragraph-properties style:writing-mode-automatic="false"/> <style:text-properties/> </style:style> <style:style style:name="P3" style:family="paragraph"> - <style:paragraph-properties style:writing-mode-automatic="true"/> + <style:paragraph-properties style:writing-mode-automatic="false"/> </style:style> <style:style style:name="P4" style:family="paragraph"> <loext:graphic-properties draw:fill="none" draw:fill-color="#ffffff"/> @@ -127,21 +127,21 @@ </text:sequence-decls> <text:p text:style-name="P1">This paragraph is normal</text:p> <text:p text:style-name="P1"/> - <text:p text:style-name="P2">This paragraph is auto</text:p> + <text:p text:style-name="P2">This paragraph is auto-off</text:p> <text:p text:style-name="P1"/> <text:p text:style-name="P1">This paragraph is also normal</text:p> <text:p text:style-name="P1"/> - <text:p text:style-name="AutoStyle">This paragraph is auto by a named style</text:p> + <text:p text:style-name="AutoStyle">This paragraph is auto-off by a named style</text:p> <text:p text:style-name="P1"/> <text:p text:style-name="P1"><draw:frame text:anchor-type="paragraph" draw:z-index="0" draw:name="Text Frame 1" draw:style-name="gr1" draw:text-style-name="P4" svg:width="15.452cm" svg:height="11.933cm" svg:x="0.804cm" svg:y="1.589cm"> <draw:text-box> <text:p>This paragraph is normal too</text:p> <text:p/> - <text:p text:style-name="P3">But this one is auto</text:p> + <text:p text:style-name="P3">But this one is auto-off</text:p> <text:p/> <text:p>And finally, this one is normal</text:p> </draw:text-box> </draw:frame></text:p> </office:text> </office:body> -</office:document> \ No newline at end of file +</office:document> diff --git a/sw/qa/extras/odfexport/odfexport4.cxx b/sw/qa/extras/odfexport/odfexport4.cxx index e7cb22bcd3fb..a0f669944328 100644 --- a/sw/qa/extras/odfexport/odfexport4.cxx +++ b/sw/qa/extras/odfexport/odfexport4.cxx @@ -1736,11 +1736,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162120StyleWritingModeAutomaticSerialization) auto pStylesDoc = parseExport(u"styles.xml"_ustr); assertXPath(pStylesDoc, "//style:paragraph-properties[@style:writing-mode-automatic]", 1); + assertXPath(pStylesDoc, "//style:paragraph-properties[@style:writing-mode-automatic='true']", + 0); + assertXPath(pStylesDoc, "//style:paragraph-properties[@style:writing-mode-automatic='false']", + 1); assertXPath(pStylesDoc, "//style:style[@style:name='AutoStyle']/style:paragraph-properties", - "writing-mode-automatic", u"true"); + "writing-mode-automatic", u"false"); auto pContentDoc = parseExport(u"content.xml"_ustr); assertXPath(pContentDoc, "//style:paragraph-properties[@style:writing-mode-automatic]", 2); + assertXPath(pContentDoc, "//style:paragraph-properties[@style:writing-mode-automatic='true']", + 0); + assertXPath(pContentDoc, "//style:paragraph-properties[@style:writing-mode-automatic='false']", + 2); } CPPUNIT_TEST_FIXTURE(Test, testTdf169882) diff --git a/sw/qa/extras/uiwriter/data/tdf133589.fodt b/sw/qa/extras/uiwriter/data/tdf133589.fodt index 68fa94697dc6..af7eb5879bcf 100644 --- a/sw/qa/extras/uiwriter/data/tdf133589.fodt +++ b/sw/qa/extras/uiwriter/data/tdf133589.fodt @@ -8,7 +8,7 @@ </office:styles> <office:automatic-styles> <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" style:writing-mode="rl-tb"/> + <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" style:writing-mode="rl-tb" style:writing-mode-automatic="false"/> </style:style> </office:automatic-styles> <office:body> diff --git a/sw/qa/extras/uiwriter/data/tdf164140.fodt b/sw/qa/extras/uiwriter/data/tdf164140.fodt index ec37896c25b7..a5324174f421 100644 --- a/sw/qa/extras/uiwriter/data/tdf164140.fodt +++ b/sw/qa/extras/uiwriter/data/tdf164140.fodt @@ -85,7 +85,7 @@ </office:styles> <office:automatic-styles> <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties fo:text-align="justify" style:justify-single-word="false" style:writing-mode="rl-tb"/> + <style:paragraph-properties fo:text-align="justify" style:justify-single-word="false" style:writing-mode="rl-tb" style:writing-mode-automatic="false"/> <style:text-properties style:font-name="Noto Sans" style:font-name-complex="Noto Sans Arabic" style:language-complex="ar" style:country-complex="SA"/> </style:style> <style:page-layout style:name="pm1"> @@ -114,4 +114,4 @@ <text:p text:style-name="P1">متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن <text:s/>آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی متن آزمایشی</text:p> </office:text> </office:body> -</office:document> \ No newline at end of file +</office:document> diff --git a/sw/qa/extras/uiwriter/uiwriter11.cxx b/sw/qa/extras/uiwriter/uiwriter11.cxx index 86f1557e9a5a..c54fbe285588 100644 --- a/sw/qa/extras/uiwriter/uiwriter11.cxx +++ b/sw/qa/extras/uiwriter/uiwriter11.cxx @@ -397,6 +397,32 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf162120AutoRTL) getProperty<short>(getRun(getParagraph(1), 1), u"WritingMode"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf162120AutoRTLAfterDirSwitch) +{ + // Tests that Writer no longer tries to update the writing direction after + // an explicit override. + + createSwDoc("tdf162120-auto-rtl.fodt"); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + // The initial direction should be RTL + CPPUNIT_ASSERT_EQUAL(short(1), + getProperty<short>(getRun(getParagraph(1), 1), u"WritingMode"_ustr)); + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), u"WritingModeAutomatic"_ustr)); + + // Explicitly set the direction to RTL + // This should clear the auto writing mode flag + dispatchCommand(mxComponent, u".uno:ParaRightToLeft"_ustr, {}); + CPPUNIT_ASSERT(!getProperty<bool>(getRun(getParagraph(1), 1), u"WritingModeAutomatic"_ustr)); + + // Insert a strong LTR character at the start of the paragraph. + // Since the flag is gone, the writing mode should not automatically switch to LTR. + pWrtShell->Insert(u"a"_ustr); + CPPUNIT_ASSERT_EQUAL(short(1), + getProperty<short>(getRun(getParagraph(1), 1), u"WritingMode"_ustr)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testFontworkSelection) { // Load a document with a Fontwork shape and select the shape @@ -435,6 +461,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf169035ParaStartDefault) getProperty<short>(getRun(getParagraph(1), 1), u"ParaAdjust"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest11, testTdf162120AutoRTLDefault) +{ + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), u"WritingModeAutomatic"_ustr)); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 3ccf64762d53..9ceb9195a425 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -377,7 +377,7 @@ std::unique_ptr<ItemInfoPackage> createItemInfoPackageSwAttributes() { RES_PARATR_SNAPTOGRID, new SvxParaGridItem( true, RES_PARATR_SNAPTOGRID ), SID_ATTR_PARA_SNAPTOGRID, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_CONNECT_BORDER, new SwParaConnectBorderItem, SID_ATTR_BORDER_CONNECT, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_OUTLINELEVEL, new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 ), SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEMINFOFLAG_NONE }, - { RES_PARATR_AUTOFRAMEDIR, new SvxAutoFrameDirectionItem( false, RES_PARATR_AUTOFRAMEDIR ), SID_ATTR_PARA_AUTOFRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_AUTOFRAMEDIR, new SvxAutoFrameDirectionItem( true, RES_PARATR_AUTOFRAMEDIR ), SID_ATTR_PARA_AUTOFRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_RSID, new SvxRsidItem( 0, RES_PARATR_RSID ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_GRABBAG, new SfxGrabBagItem( RES_PARATR_GRABBAG ), SID_ATTR_PARA_GRABBAG, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 742f4c7e22cf..a67fa15fb8d9 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -72,9 +72,7 @@ void SwEditShell::UpdateSelectionAutoParaDirection() continue; } - const SvxAutoFrameDirectionItem* pAutoItem - = pNode->GetSwAttrSet().GetItemIfSet(RES_PARATR_AUTOFRAMEDIR); - if (!pAutoItem || !pAutoItem->GetValue()) + if (!pNode->GetSwAttrSet().GetItem(RES_PARATR_AUTOFRAMEDIR)->GetValue()) { continue; } @@ -83,6 +81,10 @@ void SwEditShell::UpdateSelectionAutoParaDirection() std::pair<Point, bool> const tmp(aPt, false); const SwTextFrame* pFrame = static_cast<SwTextFrame*>(pNode->getLayoutFrame(GetLayout(), rPaM.GetPoint(), &tmp)); + if (!pFrame) + { + continue; + } bool bIsAlreadyRtl = pFrame->IsRightToLeft(); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index e946d15c4306..cb7e6a09d101 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -316,6 +316,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break; case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break; case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break; + case SID_ATTR_PARA_AUTOFRAMEDIRECTION: nEEWhich = EE_PARA_AUTOWRITINGDIR; break; case SID_ATTR_PARA_ADJUST_LEFT: aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST)); break; @@ -602,7 +603,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } SfxItemSet aAttr(SfxItemSet::makeFixedSfxItemSet< EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, - EE_PARA_JUST, EE_PARA_JUST>(*aNewAttr.GetPool())); + EE_PARA_JUST, EE_PARA_JUST, + EE_PARA_AUTOWRITINGDIR, EE_PARA_AUTOWRITINGDIR>(*aNewAttr.GetPool())); SvxAdjust nAdjust = SvxAdjust::Left; if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST ) ) @@ -620,6 +622,11 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) if( nAdjust == SvxAdjust::Left ) aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); } + + // tdf#162120: The paragraph direction has been manually set by the user. + // Don't automatically adjust the paragraph direction anymore. + aAttr.Put(SvxAutoFrameDirectionItem{ false, EE_PARA_AUTOWRITINGDIR }); + pOLV->SetAttribs(aAttr); break; } diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 1924f8da68bc..d33074258223 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -217,6 +217,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break; case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break; case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break; + case SID_ATTR_PARA_AUTOFRAMEDIRECTION: nEEWhich = EE_PARA_AUTOWRITINGDIR; break; case SID_ATTR_PARA_ADJUST_LEFT: aNewAttr.Put(SvxAdjustItem(SvxAdjust::Left, EE_PARA_JUST)); break; @@ -621,7 +622,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } SfxItemSetFixed< EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, - EE_PARA_JUST, EE_PARA_JUST> aAttr( *aNewAttr.GetPool() ); + EE_PARA_JUST, EE_PARA_JUST, + EE_PARA_AUTOWRITINGDIR, EE_PARA_AUTOWRITINGDIR> aAttr( *aNewAttr.GetPool() ); SvxAdjust nAdjust = SvxAdjust::Left; if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST) ) @@ -639,6 +641,11 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if( nAdjust == SvxAdjust::Left ) aAttr.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); } + + // tdf#162120: The paragraph direction has been manually set by the user. + // Don't automatically adjust the paragraph direction anymore. + aAttr.Put(SvxAutoFrameDirectionItem{ false, EE_PARA_AUTOWRITINGDIR }); + pTmpView->SetAttributes( aAttr ); rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin() ); rSh.GetView().AttrChangedNotify(nullptr);
