[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/inc sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Apr 4 10:05:49 UTC 2016


 sw/inc/IDocumentSettingAccess.hxx                           |    1 
 sw/inc/textboxhelper.hxx                                    |    2 
 sw/qa/extras/uiwriter/data/tdf98987.docx                    |binary
 sw/qa/extras/uiwriter/data/tdf99004.docx                    |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                          |   36 ++++++++++++
 sw/source/core/doc/DocumentSettingManager.cxx               |    5 +
 sw/source/core/doc/textboxhelper.cxx                        |   10 +++
 sw/source/core/inc/DocumentSettingManager.hxx               |    1 
 sw/source/core/inc/anchoredobjectposition.hxx               |    4 -
 sw/source/core/inc/txtfrm.hxx                               |    4 +
 sw/source/core/objectpositioning/anchoredobjectposition.cxx |   24 ++++++--
 sw/source/core/text/txtfrm.cxx                              |   13 ++++
 sw/source/core/text/xmldump.cxx                             |   12 ++++
 sw/source/uibase/uno/SwXDocumentSettings.cxx                |   13 ++++
 writerfilter/source/filter/WriterFilter.cxx                 |    1 
 15 files changed, 119 insertions(+), 7 deletions(-)

New commits:
commit 3e242e732e0aba170870098e4ce51d49f979eab9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Mar 31 15:05:48 2016 +0200

    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 <ci at libreoffice.org>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 73a5d54..96a4d36 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -37,6 +37,7 @@ enum class DocumentSettingId
     TAB_COMPAT,
 
     ADD_FLY_OFFSETS,
+    ADD_VERTICAL_FLY_OFFSETS,
 
     OLD_NUMBERING,
 
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index f4fb97a..6f59786 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -87,6 +87,8 @@ public:
     static css::uno::Any getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set<const SwFrameFormat*>& rTextBoxes) throw(css::lang::IndexOutOfBoundsException);
     /// Get the order of the shape, excluding TextBoxes.
     static sal_Int32 getOrdNum(const SdrObject* pObject, std::set<const SwFrameFormat*>& rTextBoxes);
+    /// If pTextBox is a textbox, then set rWrapThrough to the surround of its shape.
+    static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough);
 
     /// Saves the current shape -> textbox links in a map, so they can be restored later.
     static void saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks);
diff --git a/sw/qa/extras/uiwriter/data/tdf98987.docx b/sw/qa/extras/uiwriter/data/tdf98987.docx
new file mode 100644
index 0000000..3b24e34
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf98987.docx differ
diff --git a/sw/qa/extras/uiwriter/data/tdf99004.docx b/sw/qa/extras/uiwriter/data/tdf99004.docx
new file mode 100644
index 0000000..ef86440
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf99004.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e386bcb..f727c21 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -107,6 +107,8 @@ public:
     void testTdf96479();
     void testTdf88453();
     void testTdf88453Table();
+    void testTdf98987();
+    void testTdf99004();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -152,6 +154,8 @@ public:
     CPPUNIT_TEST(testTdf96479);
     CPPUNIT_TEST(testTdf88453);
     CPPUNIT_TEST(testTdf88453Table);
+    CPPUNIT_TEST(testTdf98987);
+    CPPUNIT_TEST(testTdf99004);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1269,6 +1273,38 @@ void SwUiWriterTest::testTdf88453Table()
     CPPUNIT_ASSERT_EQUAL(3, getPages());
 }
 
+void SwUiWriterTest::testTdf98987()
+{
+    createDoc("tdf98987.docx");
+    calcLayout();
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/sdrObject", "name", "Rectangle 1");
+    sal_Int32 nRectangle1 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32();
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/sdrObject", "name", "Rectangle 2");
+    sal_Int32 nRectangle2 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32();
+    CPPUNIT_ASSERT(nRectangle1 < nRectangle2);
+
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/sdrObject", "name", "Rectangle 3");
+    sal_Int32 nRectangle3 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32();
+    // This failed: the 3rd rectangle had a smaller "top" value than the 2nd one, it even overlapped with the 1st one.
+    CPPUNIT_ASSERT(nRectangle2 < nRectangle3);
+}
+
+void SwUiWriterTest::testTdf99004()
+{
+    createDoc("tdf99004.docx");
+    calcLayout();
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    sal_Int32 nTextbox1Top = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "top").toInt32();
+    sal_Int32 nTextBox1Height = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32();
+    sal_Int32 nTextBox1Bottom = nTextbox1Top + nTextBox1Height;
+
+    assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/sdrObject", "name", "Rectangle 2");
+    sal_Int32 nRectangle2Top = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32();
+    // This was 3291 and 2531, should be now around 2472 and 2531, i.e. the two rectangles should not overlap anymore.
+    CPPUNIT_ASSERT(nTextBox1Bottom < nRectangle2Top);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 6970d1f..02b927a 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;
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 57c64f1..e50c238 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -27,6 +27,7 @@
 #include <mvsave.hxx>
 #include <sortedobjs.hxx>
 #include <cntfrm.hxx>
+#include <fmtsrnd.hxx>
 
 #include <editeng/unoprnms.hxx>
 #include <editeng/charrotateitem.hxx>
@@ -264,6 +265,15 @@ sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const Sw
     return pObject->GetOrdNum();
 }
 
+void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough)
+{
+    std::map<SwFrameFormat*, SwFrameFormat*> aMap = findShapes(pTextBox->GetDoc());
+    std::map<SwFrameFormat*, SwFrameFormat*>::iterator it = aMap.find(const_cast<SwFrameFormat*>(pTextBox));
+    if (it != aMap.end())
+        // pTextBox is indeed a TextBox, it->second is its shape.
+        rWrapThrough = it->second->GetSurround().GetSurround() == SURROUND_THROUGHT;
+}
+
 SwFrameFormat* SwTextBoxHelper::findTextBox(uno::Reference<drawing::XShape> xShape)
 {
     SwXShape* pShape = dynamic_cast<SwXShape*>(xShape.get());
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 9ff978c..c83d6d8 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -108,6 +108,7 @@ class DocumentSettingManager :
     bool mbTabCompat                        : 1;
     bool mbUseVirtualDevice                 : 1;
     bool mbAddFlyOffsets                    : 1;
+    bool mbAddVerticalFlyOffsets            : 1;
     bool mbAddExternalLeading               : 1;
     bool mbUseHiResolutionVirtualDevice     : 1;
     bool mbOldLineSpacing                   : 1;    // #i11859#
diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx
index ec9617a..0be1fac 100644
--- a/sw/source/core/inc/anchoredobjectposition.hxx
+++ b/sw/source/core/inc/anchoredobjectposition.hxx
@@ -126,9 +126,9 @@ namespace objectpositioning
 
             #i11860#
         */
-        static SwTwips _GetTopForObjPos( const SwFrm& _rFrm,
+        SwTwips _GetTopForObjPos( const SwFrm& _rFrm,
                                   const SwRectFn& _fnRect,
-                                  const bool _bVert );
+                                  const bool _bVert ) const;
 
         void _GetVertAlignmentValues( const SwFrm& _rVertOrientFrm,
                                       const SwFrm& _rPageAlignLayFrm,
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 824480a..690d924 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -68,6 +68,8 @@ class SwTextFrm: public SwContentFrm
     SwTwips mnFlyAnchorOfst;
     // The x position for wrap-through flys anchored at this paragraph.
     SwTwips mnFlyAnchorOfstNoWrap;
+    /// The y position for wrap-through flys anchored at this paragraph.
+    SwTwips mnFlyAnchorVertOfstNoWrap;
     SwTwips mnFootnoteLine;
     // OD 2004-03-17 #i11860# - re-factoring of #i11859#
     // member for height of last line (value needed for proportional line spacing)
@@ -642,6 +644,8 @@ public:
                  mnFlyAnchorOfstNoWrap );
     }
 
+    SwTwips GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const;
+
     inline SwTwips GetHeightOfLastLine() const
     {
         return mnHeightOfLastLine;
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index ee354ce..aed0003 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -37,6 +37,7 @@
 #include <ndtxt.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <textboxhelper.hxx>
+#include <fmtsrnd.hxx>
 
 using namespace ::com::sun::star;
 using namespace objectpositioning;
@@ -156,7 +157,7 @@ SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const
 */
 SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm,
                                                     const SwRectFn& _fnRect,
-                                                    const bool _bVert )
+                                                    const bool _bVert ) const
 {
     SwTwips nTopOfFrmForObjPos = (_rFrm.Frm().*_fnRect->fnGetTop)();
 
@@ -172,6 +173,17 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrm& _rFrm,
         {
             nTopOfFrmForObjPos +=
                 rTextFrm.GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid();
+
+            const SwFormatSurround& rSurround = mpFrameFormat->GetSurround();
+            bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
+            // If the frame format is a TextBox of a draw shape, then use the
+            // surround of the original shape.
+            SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough);
+
+            // Get the offset between the top of the text frame and the top of
+            // the first line inside the frame that has more than just fly
+            // portions.
+            nTopOfFrmForObjPos += rTextFrm.GetBaseVertOffsetForFly(!bWrapThrough);
         }
     }
 
@@ -685,10 +697,12 @@ void SwAnchoredObjectPosition::_GetHoriAlignmentValues( const SwFrm&  _rHoriOrie
         {
             nWidth = (_rHoriOrientFrm.Frm().*fnRect->fnGetWidth)();
 
-            // When positioning TextBoxes, always ignore flys anchored at the
-            // text frame, as we do want to have the textbox overlap with its
-            // draw shape.
-            bool bIgnoreFlysAnchoredAtFrame = !_bObjWrapThrough || SwTextBoxHelper::isTextBox(&GetObject());
+            bool bWrapThrough = _bObjWrapThrough;
+            // If the frame format is a TextBox of a draw shape, then use the
+            // surround of the original shape.
+            SwTextBoxHelper::getShapeWrapThrough(mpFrameFormat, bWrapThrough);
+
+            bool bIgnoreFlysAnchoredAtFrame = !bWrapThrough;
             nOffset = _rHoriOrientFrm.IsTextFrm() ?
                    static_cast<const SwTextFrm&>(_rHoriOrientFrm).GetBaseOfstForFly( bIgnoreFlysAnchoredAtFrame ) :
                    0;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a4a707f..8705945 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -355,6 +355,7 @@ SwTextFrm::SwTextFrm(SwTextNode * const pNode, SwFrm* pSib )
     , nThisLines( 0 )
     , mnFlyAnchorOfst( 0 )
     , mnFlyAnchorOfstNoWrap( 0 )
+    , mnFlyAnchorVertOfstNoWrap( 0 )
     , mnFootnoteLine( 0 )
     , mnHeightOfLastLine( 0 ) // OD 2004-03-17 #i11860#
     , mnAdditionalFirstLineOffset( 0 )
@@ -2657,6 +2658,7 @@ void SwTextFrm::CalcBaseOfstForFly()
     // Get first 'real' line and adjust position and height of line rectangle
     // OD 08.09.2003 #110978#, #108749#, #110354# - correct behaviour,
     // if no 'real' line exists (empty paragraph with and without a dummy portion)
+    SwTwips nFlyAnchorVertOfstNoWrap = 0;
     {
         SwTwips nTop = (aFlyRect.*fnRect->fnGetTop)();
         const SwLineLayout* pLay = GetPara();
@@ -2664,6 +2666,7 @@ void SwTextFrm::CalcBaseOfstForFly()
         while( pLay && pLay->IsDummy() && pLay->GetNext() )
         {
             nTop += pLay->Height();
+            nFlyAnchorVertOfstNoWrap += pLay->Height();
             pLay = pLay->GetNext();
         }
         if ( pLay )
@@ -2690,6 +2693,16 @@ void SwTextFrm::CalcBaseOfstForFly()
 
     mnFlyAnchorOfst = nRet1 - nLeft;
     mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
+
+    if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+        return;
+
+    mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
+}
+
+SwTwips SwTextFrm::GetBaseVertOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
+{
+    return bIgnoreFlysAnchoredAtThisFrame ? 0 : mnFlyAnchorVertOfstNoWrap;
 }
 
 /**
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 951b415..06d7044 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -22,6 +22,7 @@
 #include <anchoredobject.hxx>
 #include <libxml/xmlwriter.h>
 #include <SwPortionHandler.hxx>
+#include <svx/svdobj.hxx>
 
 class XmlPortionDumper:public SwPortionHandler
 {
@@ -360,6 +361,14 @@ void SwFrm::dumpInfosAsXml( xmlTextWriterPtr writer ) const
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Frm().Width() );
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Frm().Height() );
     xmlTextWriterEndElement( writer );
+
+    // output the Prt
+    xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) );
+    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", Prt().Left() );
+    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", Prt().Top() );
+    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Prt().Width() );
+    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Prt().Height() );
+    xmlTextWriterEndElement( writer );
 }
 
 // Hack: somehow conversion from "..." to va_list does
@@ -419,6 +428,9 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", GetObjBoundRect().Height() );
     xmlTextWriterEndElement( writer );
 
+    if (const SdrObject* pObject = GetDrawObj())
+        pObject->dumpAsXml(writer);
+
     xmlTextWriterEndElement( writer );
 
     if ( bCreateWriter )
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 7d513d4..a6e454e 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -85,6 +85,7 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_PRINTER_INDEPENDENT_LAYOUT,
     HANDLE_IS_LABEL_DOC,
     HANDLE_IS_ADD_FLY_OFFSET,
+    HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,
     HANDLE_IS_ADD_EXTERNAL_LEADING,
     HANDLE_OLD_NUMBERING, // #111955#
     HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
@@ -159,6 +160,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
         { OUString("PrinterIndependentLayout"),   HANDLE_PRINTER_INDEPENDENT_LAYOUT,      cppu::UnoType<sal_Int16>::get(),             0,   0},
         { OUString("IsLabelDocument"),            HANDLE_IS_LABEL_DOC,                    cppu::UnoType<bool>::get(),           0,   0},
         { OUString("AddFrameOffsets"),            HANDLE_IS_ADD_FLY_OFFSET,               cppu::UnoType<bool>::get(),           0,   0},
+        { OUString("AddVerticalFrameOffsets"),    HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,      cppu::UnoType<bool>::get(),           0,   0},
         { OUString("AddExternalLeading"),         HANDLE_IS_ADD_EXTERNAL_LEADING,         cppu::UnoType<bool>::get(),           0,   0},
         { OUString("UseOldNumbering"),            HANDLE_OLD_NUMBERING,                   cppu::UnoType<bool>::get(),           0,   0}, // #111955#
         { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(),           0,   0},
@@ -554,6 +556,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
             mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp);
         }
         break;
+        case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
+        {
+            bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+            mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp);
+        }
+        break;
         case HANDLE_IS_ADD_EXTERNAL_LEADING:
         {
             bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
@@ -1024,6 +1032,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
             rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS);
         }
         break;
+        case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
+        {
+            rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS);
+        }
+        break;
         case HANDLE_IS_ADD_EXTERNAL_LEADING:
         {
             rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING);
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 546b852..4dffb4c 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -288,6 +288,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x
     uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
 
     xSettings->setPropertyValue("AddFrameOffsets", uno::makeAny(sal_True));
+    xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::makeAny(sal_True));
     xSettings->setPropertyValue("UseOldNumbering", uno::makeAny(sal_False));
     xSettings->setPropertyValue("IgnoreFirstLineIndentInNumbering", uno::makeAny(sal_False));
     xSettings->setPropertyValue("DoNotResetParaAttrsForNumFont", uno::makeAny(sal_False));


More information about the Libreoffice-commits mailing list