From 3e242e732e0aba170870098e4ce51d49f979eab9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 31 Mar 2016 15:05:48 +0200 Subject: tdf#98987 sw: add AddVerticalFrameOffsets compat mode The situation is the following: we have a text frame, with at least two anchored objects: one is wrapped not-wrap-through, the other is. In case the non-wrap-though one shifts the text content of the text frame right or down, then layout may or may not want to re-consider what is the top left corner of the text frame for anchoring purposes. Regarding the x position, sw layout repositioned the anchor point depending on the AddFrameOffsets compat mode: it's enabled for documents imported from Word, disabled otherwise. Regarding the y position, no repositioning was done, however the bugdoc shows that Word does the same repositioning on the vertical axis as well. Add a new AddVerticalFrameOffsets compat mode that enables vertical repositioning as well, and enable that mode for documents imported from DOCX. Also (squashed in, as the second commit partly undoes what the first one did): tdf#99004 SwAnchoredObjectPosition: handle textboxes when determining surround Writer TextBoxes are always wrapped "through", so that they can appear inside their shapes. However, the surround of the shape may influence its position. So when surround is asked for anchor position purposes, take the surround of the TextBox's "parent" shape instead of the one of the TextBox directly. With this, the textbox in the bugdoc is properly positioned inside its parent shape as expected. (The problem only happens when at least two shapes are anchored to the same paragraph.) (cherry picked from commits 911261a3a581b9f2f4262f1d5403d9be3bbecf63, f5e0236566b913aebb1376d97c7d37a23c69bd84, 50223ea6e212b60b7d33839c2753c5601fb50f95 and cd1b2f923e0b0be89a5d1c8cbc647133aac09ed5) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx sw/source/core/inc/anchoredobjectposition.hxx sw/source/core/objectpositioning/anchoredobjectposition.cxx sw/source/core/text/txtfrm.cxx sw/source/uibase/uno/SwXDocumentSettings.cxx Change-Id: Idc5cad7d86662008a92ff3bf5fbb3806aa2c7b07 Reviewed-on: https://gerrit.libreoffice.org/23739 Tested-by: Jenkins Reviewed-by: Andras Timar --- sw/source/core/doc/DocumentSettingManager.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sw/source/core/doc/DocumentSettingManager.cxx') diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 6970d1f8044e..02b927a55e3e 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -53,6 +53,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) // COMPATIBILITY FLAGS START mbAddFlyOffsets(false), + mbAddVerticalFlyOffsets(false), mbUseHiResolutionVirtualDevice(true), mbMathBaselineAlignment(false), // default for *old* documents is 'off' mbStylesNoDefault(false), @@ -125,6 +126,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::PARA_SPACE_MAX_AT_PAGES: return mbParaSpaceMaxAtPages; //(n8Dummy1 & DUMMY_PARASPACEMAX_AT_PAGES); case DocumentSettingId::TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT); case DocumentSettingId::ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS); + case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: return mbAddVerticalFlyOffsets; case DocumentSettingId::ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING); case DocumentSettingId::USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE); case DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV); @@ -196,6 +198,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::ADD_FLY_OFFSETS: mbAddFlyOffsets = value; break; + case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: + mbAddVerticalFlyOffsets = value; + break; case DocumentSettingId::ADD_EXT_LEADING: mbAddExternalLeading = value; break; -- cgit v1.2.3