diff options
author | Hossein <hossein@libreoffice.org> | 2023-04-17 13:17:00 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-04-26 11:09:10 +0200 |
commit | 1466e2a58f40c869d8c2590a4479e85c093b3468 (patch) | |
tree | 1e0ebd848c2e7807a59c9add3cee56034f5760b7 | |
parent | e898f95bfab16ddd9b04e516293cb6eb7e0a3847 (diff) |
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 <vmiklos@collabora.com>
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
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(); |