sw/source/core/text/itrform2.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
New commits: commit 1466e2a58f40c869d8c2590a4479e85c093b3468 Author: Hossein <hoss...@libreoffice.org> AuthorDate: Mon Apr 17 13:17:00 2023 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Apr 26 11:09:10 2023 +0200 tdf#152246 Fix RTL content control field position With this patch, the horizonal position of the content control fields are corrected. Previously, they were calculated just like the fields in the LTR paragraphs. To implement this, I've used the GetTextFrame()->SwitchLTRtoRTL method. The remaining issue is that The exported fileds in the PDF are still LTR themselves. For example, the combo box will still be LTR. It should be pointed that handling vertical text is still an issue that should be addressed later. If you rotate the paragraph with content control field, the output does not obey, which is incorrect. Change-Id: I927d14f9ca90434b4397dcf175dbb9531dda0c7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150515 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index f2c130ac4194..f754e13c63a4 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1064,11 +1064,19 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co auto pTextFrame = const_cast<SwTextFrame*>(rInf.GetTextFrame()); SwTextSizeInfo aInf(pTextFrame); SwTextCursor aLine(pTextFrame, &aInf); - SwRect aStartRect; + SwRect aStartRect, aEndRect; aLine.GetCharRect(&aStartRect, nViewStart); - aLocation = aStartRect; - SwRect aEndRect; aLine.GetCharRect(&aEndRect, nViewEnd); + + // Handling RTL text direction + if(rInf.GetTextFrame()->IsRightToLeft()) + { + rInf.GetTextFrame()->SwitchLTRtoRTL( aStartRect ); + rInf.GetTextFrame()->SwitchLTRtoRTL( aEndRect ); + } + // TODO: handle rInf.GetTextFrame()->IsVertical() + + aLocation = aStartRect; aLocation.Union(aEndRect); pDescriptor->Location = aLocation.SVRect();