[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 31 17:49:21 UTC 2016


 sw/inc/IDocumentSettingAccess.hxx                                   |    1 
 sw/qa/extras/uiwriter/data/tdf98987.docx                            |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                                  |   19 +++++++++
 sw/source/core/doc/DocumentSettingManager.cxx                       |    5 ++
 sw/source/core/inc/DocumentSettingManager.hxx                       |    1 
 sw/source/core/inc/anchoredobjectposition.hxx                       |    7 ++-
 sw/source/core/inc/txtfrm.hxx                                       |    4 ++
 sw/source/core/objectpositioning/anchoredobjectposition.cxx         |   16 ++++++--
 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx  |   20 +++++-----
 sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx |    4 +-
 sw/source/core/text/txtfrm.cxx                                      |   13 ++++++
 sw/source/uibase/uno/SwXDocumentSettings.cxx                        |   13 ++++++
 writerfilter/source/filter/WriterFilter.cxx                         |    1 
 13 files changed, 87 insertions(+), 17 deletions(-)

New commits:
commit 50223ea6e212b60b7d33839c2753c5601fb50f95
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.
    
    Change-Id: Idc5cad7d86662008a92ff3bf5fbb3806aa2c7b07
    Reviewed-on: https://gerrit.libreoffice.org/23702
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

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/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/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 135e1e9..b450520 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -194,6 +194,7 @@ public:
     void testTdf88453();
     void testTdf88453Table();
     void testClassificationPaste();
+    void testTdf98987();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -290,6 +291,7 @@ public:
     CPPUNIT_TEST(testTdf88453);
     CPPUNIT_TEST(testTdf88453Table);
     CPPUNIT_TEST(testClassificationPaste);
+    CPPUNIT_TEST(testTdf98987);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3573,6 +3575,23 @@ void SwUiWriterTest::testClassificationPaste()
     xSourceComponent->dispose();
 }
 
+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);
+}
+
 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 b2d251c..bdcc1ea 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/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..d6c6224 100644
--- a/sw/source/core/inc/anchoredobjectposition.hxx
+++ b/sw/source/core/inc/anchoredobjectposition.hxx
@@ -128,13 +128,15 @@ namespace objectpositioning
         */
         static SwTwips _GetTopForObjPos( const SwFrame& _rFrame,
                                   const SwRectFn& _fnRect,
-                                  const bool _bVert );
+                                  const bool _bVert,
+                                  bool bWrapThrough );
 
         void _GetVertAlignmentValues( const SwFrame& _rVertOrientFrame,
                                       const SwFrame& _rPageAlignLayFrame,
                                       const sal_Int16 _eRelOrient,
                                       SwTwips&      _orAlignAreaHeight,
-                                      SwTwips&      _orAlignAreaOffset ) const;
+                                      SwTwips&      _orAlignAreaOffset,
+                                      bool bWrapThrough ) const;
 
         // #i26791# - add output parameter <_roVertOffsetToFrameAnchorPos>
         SwTwips _GetVertRelPos( const SwFrame& _rVertOrientFrame,
@@ -144,6 +146,7 @@ namespace objectpositioning
                                 const SwTwips          _nVertPos,
                                 const SvxLRSpaceItem& _rLRSpacing,
                                 const SvxULSpaceItem& _rULSpacing,
+                                bool bWrapThrough,
                                 SwTwips& _roVertOffsetToFrameAnchorPos ) const;
 
         /** adjust calculated vertical in order to keep object inside
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 09e1b38..7c021ea 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 e690385..fbadb3a 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -156,7 +156,8 @@ SwTwips SwAnchoredObjectPosition::ToCharTopOfLine() const
 */
 SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrame& _rFrame,
                                                     const SwRectFn& _fnRect,
-                                                    const bool _bVert )
+                                                    const bool _bVert,
+                                                    bool bWrapThrough )
 {
     SwTwips nTopOfFrameForObjPos = (_rFrame.Frame().*_fnRect->fnGetTop)();
 
@@ -172,6 +173,11 @@ SwTwips SwAnchoredObjectPosition::_GetTopForObjPos( const SwFrame& _rFrame,
         {
             nTopOfFrameForObjPos +=
                 rTextFrame.GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
+
+            // 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);
         }
     }
 
@@ -183,13 +189,14 @@ void SwAnchoredObjectPosition::_GetVertAlignmentValues(
                                         const SwFrame& _rPageAlignLayFrame,
                                         const sal_Int16 _eRelOrient,
                                         SwTwips&      _orAlignAreaHeight,
-                                        SwTwips&      _orAlignAreaOffset ) const
+                                        SwTwips&      _orAlignAreaOffset,
+                                        bool bWrapThrough ) const
 {
     SwTwips nHeight = 0;
     SwTwips nOffset = 0;
     SWRECTFN( (&_rVertOrientFrame) )
     // #i11860# - top of <_rVertOrientFrame> for object positioning
-    const SwTwips nVertOrientTop = _GetTopForObjPos( _rVertOrientFrame, fnRect, bVert );
+    const SwTwips nVertOrientTop = _GetTopForObjPos( _rVertOrientFrame, fnRect, bVert, bWrapThrough );
     // #i11860# - upper space amount of <_rVertOrientFrame> considered
     // for previous frame
     const SwTwips nVertOrientUpperSpaceForPrevFrameAndPageGrid =
@@ -320,6 +327,7 @@ SwTwips SwAnchoredObjectPosition::_GetVertRelPos(
                                     const SwTwips          _nVertPos,
                                     const SvxLRSpaceItem& _rLRSpacing,
                                     const SvxULSpaceItem& _rULSpacing,
+                                    bool bWrapThrough,
                                     SwTwips& _roVertOffsetToFrameAnchorPos ) const
 {
     SwTwips nRelPosY = 0;
@@ -328,7 +336,7 @@ SwTwips SwAnchoredObjectPosition::_GetVertRelPos(
     SwTwips nAlignAreaHeight;
     SwTwips nAlignAreaOffset;
     _GetVertAlignmentValues( _rVertOrientFrame, _rPageAlignLayFrame,
-                             _eRelOrient, nAlignAreaHeight, nAlignAreaOffset );
+                             _eRelOrient, nAlignAreaHeight, nAlignAreaOffset, bWrapThrough );
 
     nRelPosY = nAlignAreaOffset;
     const SwRect aObjBoundRect( GetAnchoredObj().GetObjRect() );
diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index f51d061..5abf15b 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -248,7 +248,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
             SwTwips nAlignAreaOffset;
             _GetVertAlignmentValues( *pOrientFrame, rPageAlignLayFrame,
                                      aVert.GetRelationOrient(),
-                                     nAlignAreaHeight, nAlignAreaOffset );
+                                     nAlignAreaHeight, nAlignAreaOffset, bWrapThrough );
 
             // determine relative vertical position
             SwTwips nRelPosY = nAlignAreaOffset;
@@ -380,16 +380,16 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
             {
                 // #i11860# - use new method <_GetTopForObjPos>
                 // to get top of frame for object positioning.
-                const SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+                const SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
                 nRelPosY += (*fnRect->fnYDiff)( nTopOfOrient,
-                                      _GetTopForObjPos( rAnchorTextFrame, fnRect, bVert ) );
+                                      _GetTopForObjPos( rAnchorTextFrame, fnRect, bVert, bWrapThrough ) );
             }
 
             // #i42124# - capture object inside vertical
             // layout environment.
             {
                 const SwTwips nTopOfAnch =
-                                _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+                                _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
                 const SwLayoutFrame& rVertEnvironLayFrame =
                     aEnvOfObj.GetVertEnvironmentLayoutFrame(
                                             *(pOrientFrame->GetUpper()) );
@@ -486,7 +486,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
             {
                 // #i11860# - use new method <_GetTopForObjPos>
                 // to get top of frame for object positioning.
-                SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert );
+                SwTwips nTopOfOrient = _GetTopForObjPos( *pOrientFrame, fnRect, bVert, bWrapThrough );
                 if ( aVert.GetRelationOrient() == text::RelOrientation::CHAR )
                 {
                     nVertOffsetToFrameAnchorPos = (*fnRect->fnYDiff)(
@@ -509,7 +509,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
                 // #i11860# - use new method <_GetTopForObjPos>
                 // to get top of frame for object positioning.
                 const SwTwips nTopOfOrient =
-                        _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+                        _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
                 // Increase <nRelPosY> by margin height,
                 // if position is vertical aligned to "paragraph text area"
                 if ( aVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA )
@@ -562,7 +562,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
                 maOffsetToFrameAnchorPos.Y() = nVertOffsetToFrameAnchorPos;
             // #i11860# - use new method <_GetTopForObjPos>
             // to get top of frame for object positioning.
-            const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+            const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
             if( nRelPosY <= 0 )
             {
                 // Allow negative position, but keep it
@@ -717,7 +717,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
         // We need to calculate the part's absolute position, in order for
         // it to be put onto the right page and to be pulled into the
         // LayLeaf's PrtArea
-        const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+        const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
         if( bVert )
         {
             // --> OD 2009-08-31 #monglianlayout#
@@ -979,7 +979,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
 
         // set calculated vertical position in order to determine correct
         // frame, the horizontal position is oriented at.
-        const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+        const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
         if( bVert )
         {
             // --> OD 2009-08-31 #mongolianlayout#
@@ -1039,7 +1039,7 @@ void SwToContentAnchoredObjectPosition::CalcPosition()
     }
 
     // set absolute position at object
-    const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert );
+    const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrameForVertPos, fnRect, bVert, bWrapThrough );
     if( bVert )
     {
         // --> OD 2009-08-31 #mongolianlayout#
diff --git a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
index 45d8f09..09b6172 100644
--- a/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx
@@ -81,10 +81,12 @@ void SwToLayoutAnchoredObjectPosition::CalcPosition()
         }
         // #i26791# - get vertical offset to frame anchor position.
         SwTwips nVertOffsetToFrameAnchorPos( 0L );
+        const SwFormatSurround& rSurround = rFrameFormat.GetSurround();
+        const bool bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
         SwTwips nRelPosY =
                 _GetVertRelPos( GetAnchorFrame(), GetAnchorFrame(), eVertOrient,
                                 aVert.GetRelationOrient(), aVert.GetPos(),
-                                rLR, rUL, nVertOffsetToFrameAnchorPos );
+                                rLR, rUL, bWrapThrough, nVertOffsetToFrameAnchorPos );
 
         // keep the calculated relative vertical position - needed for filters
         // (including the xml-filter)
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 49028e0..cd1decb 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 )
     , mnAdditionalFirstLineOffset( 0 )
@@ -2647,6 +2648,7 @@ void SwTextFrame::CalcBaseOfstForFly()
     // Get first 'real' line and adjust position and height of line rectangle.
     // 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();
@@ -2654,6 +2656,7 @@ void SwTextFrame::CalcBaseOfstForFly()
         while( pLay && pLay->IsDummy() && pLay->GetNext() )
         {
             nTop += pLay->Height();
+            nFlyAnchorVertOfstNoWrap += pLay->Height();
             pLay = pLay->GetNext();
         }
         if ( pLay )
@@ -2680,6 +2683,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/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 09bdde2..0ef134d 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},
@@ -552,6 +554,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());
@@ -1020,6 +1028,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 f3c370c..65cd9b3 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -276,6 +276,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