https://bugs.documentfoundation.org/show_bug.cgi?id=115934
--- Comment #24 from Piotr Osada <[email protected]> --- Created attachment 208986 --> https://bugs.documentfoundation.org/attachment.cgi?id=208986&action=edit Rotated image cannot reach page border (screenshot comparison, 26.8.0.3) Still present in: Version: 26.8.0.3 (X86_64) Build ID: bce0998afefdbc355585ca324285661a2170ba77 CPU threads: 16; OS: Windows 11 X86_64 (build 26200); UI render: Skia/Raster; VCL: win Locale: pl-PL (pl_PL); UI: en-US Calc: CL threaded The position limits of a picture are computed for the UNROTATED W x H rectangle, so a picture (W > H) rotated by 90 deg stays (W - H)/2 away from the left/right page edge. Steps 1. Insert a picture whose width differs from its height. Anchor: To Paragraph. 2. Move it to the page edge (mouse or arrow keys): with Rotation 0 it reaches the edge. 3. Rotate: 90 deg. 4. If W > H, move it to the right page edge. If H > W, move it to the top page edge. Actual result: The picture stays (W - H)/2 (resp. (H - W)/2) away from the page edge. In the other direction (W > H at the top/bottom edge, H > W at the left/right edge) the picture can be pushed beyond the page edge by the same amount with Format > Align Objects > Top/Bottom, with a position entered in Format > Image > Properties > Type, or with Alt+arrow; the plain arrow keys stop it flush with the edge. An unrotated picture (W > H) flush with the top page edge protrudes above the page by (W - H)/2 as soon as it is rotated by 90 deg. Expected result: The rotated picture can be placed as far as an unrotated picture can: with its visible box flush with the page edge. Explanation (line numbers of current master in OpenGrok [1][2]): A rotated Draw object is positioned and clamped by its bounding box: SwAnchoredDrawObject::GetObjRect() returns GetDrawObj()->GetSnapRect() (sw/source/core/layout/anchoreddrawobject.cxx:635-640), and for a rotated object the snap rect is the bounding rectangle of the rotated shape (SdrTextObj::RecalcSnapRect, svx/source/svdraw/svdotext.cxx:1103-1111). A rotated picture frame is clamped by its unrotated rectangle: SwFlyFreeFrame::MakeAll() restores the unrotated frame area (sw/source/core/layout/flylay.cxx:177) before positioning; SwFlyFrame::GetObjRect() returns that frame area (fly.cxx:3442), so SwAnchoredObjectPosition::ImplAdjustHoriRelPos()/ImplAdjustVertRelPos() (sw/source/core/objectpositioning/anchoredobjectposition.cxx:674/504) and CheckClip() (flylay.cxx:471, right/bottom edge only) clamp the unrotated rectangle. The rotation is applied afterwards (flylay.cxx:272-275). [1] sw/source/core/layout/anchoreddrawobject.cxx, SwAnchoredDrawObject::GetObjRect(), lines 635-640 https://opengrok.libreoffice.org/xref/core/sw/source/core/layout/anchoreddrawobject.cxx?r=23e2a87a0a7907cddf21026f8b2f493a9c2b362e#635 635 SwRect SwAnchoredDrawObject::GetObjRect() const 636 { 637 // use geometry of drawing object 638 //return GetDrawObj()->GetCurrentBoundRect(); 639 return SwRect(GetDrawObj()->GetSnapRect()); 640 } [2] svx/source/svdraw/svdotext.cxx, SdrTextObj::RecalcSnapRect(), lines 1103-1111 https://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdotext.cxx?r=5519a3d4073ae4f04f8e1aa453fbc0ea9c8e19e4#1103 [3] sw/source/core/layout/flylay.cxx, SwFlyFreeFrame::MakeAll() lines 113-300 (restoreFrameAreas 177, CheckClip call 251, transformations 272-275), SwFlyFreeFrame::CheckClip() line 471 https://opengrok.libreoffice.org/xref/core/sw/source/core/layout/flylay.cxx?r=f198ec49448be3f8d094ab96c62e813605f80762#177 https://opengrok.libreoffice.org/xref/core/sw/source/core/layout/flylay.cxx?r=f198ec49448be3f8d094ab96c62e813605f80762#471 [4] sw/source/core/layout/fly.cxx, SwFlyFrame::GetObjRect(), line 3442 https://opengrok.libreoffice.org/xref/core/sw/source/core/layout/fly.cxx?r=2a64f606b5fea21b20439caf811731149c0e7a95#3442 [5] sw/source/core/objectpositioning/anchoredobjectposition.cxx, ImplAdjustVertRelPos() line 504 (aObjSize 522), ImplAdjustHoriRelPos() line 674 (aObjSize 686) https://opengrok.libreoffice.org/xref/core/sw/source/core/objectpositioning/anchoredobjectposition.cxx?r=15e902e8932295df2353f50d83e640890b898f0b#504 https://opengrok.libreoffice.org/xref/core/sw/source/core/objectpositioning/anchoredobjectposition.cxx?r=15e902e8932295df2353f50d83e640890b898f0b#674 -- You are receiving this mail because: You are the assignee for the bug.
