summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorSzabolcs Toth <szabolcs450@gmail.com>2020-06-04 15:43:42 +0200
committerLászló Németh <nemeth@numbertext.org>2020-06-23 16:20:13 +0200
commit7380905abc0833d9e4c4fe731d76174db8a8724c (patch)
treeabc818e5f2fb2884f1041e9626115e69cde766d5 /sw/source
parent29cb36cbee9c3ff5e73bc7a6d6a2f365c5c62da7 (diff)
tdf#132976 DOCX import: fix shape width relative to left margin
using UNO API RelativeWidthRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Balázs Regényi Change-Id: I2dada8ad764a1fba33d241117cc4bc5eddae74ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95525 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 5f60d769a44a..4789ae807239 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -632,13 +632,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const
long nTargetWidth = aCurrObjRect.GetWidth( );
if ( GetDrawObj( )->GetRelativeWidth( ) )
{
- tools::Rectangle aPageRect;
+ long nWidth = 0;
if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME)
// Exclude margins.
- aPageRect = GetPageFrame()->getFramePrintArea().SVRect();
+ nWidth = GetPageFrame()->getFramePrintArea().SVRect().GetWidth();
+ // Here we handle the relative size of the width of some shape.
+ // The size of the shape's width is going to be relative to the size of the left margin.
+ // E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12.
+ else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT)
+ nWidth = GetPageFrame()->GetLeftMargin();
else
- aPageRect = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect();
- nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth());
+ nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth();
+ nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth());
}
long nTargetHeight = aCurrObjRect.GetHeight( );