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

Miklos Vajna vmiklos at collabora.co.uk
Mon Apr 4 08:12:08 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 8b97d64e24721e9df3647b7b1cfde5feff9904e2
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/text/txtfrm.cxx
    
    Change-Id: Idc5cad7d86662008a92ff3bf5fbb3806aa2c7b07
    Reviewed-on: https://gerrit.libreoffice.org/23733
    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 08359a2..e02cbce 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 d72ba4d..2b3e0873 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 59290bc..246201e 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -182,6 +182,8 @@ public:
     void testTdf96961();
     void testTdf88453();
     void testTdf88453Table();
+    void testTdf98987();
+    void testTdf99004();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -270,6 +272,8 @@ public:
     CPPUNIT_TEST(testTdf96961);
     CPPUNIT_TEST(testTdf88453);
     CPPUNIT_TEST(testTdf88453Table);
+    CPPUNIT_TEST(testTdf98987);
+    CPPUNIT_TEST(testTdf99004);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3123,6 +3127,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 5a32cc4..ac6c219 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -54,6 +54,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),
@@ -143,6 +144,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);
@@ -214,6 +216,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 33c3ad0..576bf98d 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 4e08d01..eebd1db 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 5547e3c..d50c0a5 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 SwFrame& _rFrame,
+        SwTwips _GetTopForObjPos( const SwFrame& _rFrame,
                                   const SwRectFn& _fnRect,
-                                  const bool _bVert );
+                                  const bool _bVert ) const;
 
         void _GetVertAlignmentValues( const SwFrame& _rVertOrientFrame,
                                       const SwFrame& _rPageAlignLayFrame,
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index d662ac8..2b113a8 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -68,6 +68,8 @@ class SwTextFrame: public SwContentFrame
     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)
@@ -621,6 +623,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 4e2958c..9354af9 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 SwFrame& _rFrame,
                                                     const SwRectFn& _fnRect,
-                                                    const bool _bVert )
+                                                    const bool _bVert ) const
 {
     SwTwips nTopOfFrameForObjPos = (_rFrame.Frame().*_fnRect->fnGetTop)();
 
@@ -172,6 +173,17 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrame& _rFrame,
         {
             nTopOfFrameForObjPos +=
                 rTextFrame.GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
+
+            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.
+            nTopOfFrameForObjPos += rTextFrame.GetBaseVertOffsetForFly(!bWrapThrough);
         }
     }
 
@@ -685,10 +697,12 @@ void SwAnchoredObjectPosition::_GetHoriAlignmentValues( const SwFrame&  _rHoriOr
         {
             nWidth = (_rHoriOrientFrame.Frame().*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 = _rHoriOrientFrame.IsTextFrame() ?
                    static_cast<const SwTextFrame&>(_rHoriOrientFrame).GetBaseOfstForFly( bIgnoreFlysAnchoredAtFrame ) :
                    0;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 8e13867..0027dd2 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -354,6 +354,7 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib )
     , mnThisLines( 0 )
     , mnFlyAnchorOfst( 0 )
     , mnFlyAnchorOfstNoWrap( 0 )
+    , mnFlyAnchorVertOfstNoWrap( 0 )
     , mnFootnoteLine( 0 )
     , mnHeightOfLastLine( 0 ) // OD 2004-03-17 #i11860#
     , mnAdditionalFirstLineOffset( 0 )
@@ -2650,6 +2651,7 @@ void SwTextFrame::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();
@@ -2657,6 +2659,7 @@ void SwTextFrame::CalcBaseOfstForFly()
         while( pLay && pLay->IsDummy() && pLay->GetNext() )
         {
             nTop += pLay->Height();
+            nFlyAnchorVertOfstNoWrap += pLay->Height();
             pLay = pLay->GetNext();
         }
         if ( pLay )
@@ -2683,6 +2686,16 @@ void SwTextFrame::CalcBaseOfstForFly()
 
     mnFlyAnchorOfst = nRet1 - nLeft;
     mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
+
+    if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+        return;
+
+    mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
+}
+
+SwTwips SwTextFrame::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 83adb1f..f3b7a8e 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
 {
@@ -358,6 +359,14 @@ void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) const
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", Frame().Width() );
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", Frame().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
@@ -417,6 +426,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 df09645..6964cba 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -86,6 +86,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,
     HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
@@ -159,6 +160,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
         { OUString("PrinterIndependentLayout"),   HANDLE_PRINTER_INDEPENDENT_LAYOUT,      cppu::UnoType<sal_Int16>::get(),             0},
         { OUString("IsLabelDocument"),            HANDLE_IS_LABEL_DOC,                    cppu::UnoType<bool>::get(),           0},
         { OUString("AddFrameOffsets"),            HANDLE_IS_ADD_FLY_OFFSET,               cppu::UnoType<bool>::get(),           0},
+        { OUString("AddVerticalFrameOffsets"),    HANDLE_IS_ADD_VERTICAL_FLY_OFFSET,      cppu::UnoType<bool>::get(),           0},
         { OUString("AddExternalLeading"),         HANDLE_IS_ADD_EXTERNAL_LEADING,         cppu::UnoType<bool>::get(),           0},
         { OUString("UseOldNumbering"),            HANDLE_OLD_NUMBERING,                   cppu::UnoType<bool>::get(),           0},
         { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(),           0},
@@ -553,6 +555,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());
@@ -1021,6 +1029,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 de6199f..9b4bcbf 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -286,6 +286,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