[Libreoffice-commits] core.git: Branch 'feature/BorderlineFix' - 136 commits - android/Bootstrap android/CustomTarget_lo_android.mk android/source autogen.sh basctl/source basic/source bin/get-bugzilla-attachments-by-mimetype bridges/Library_cpp_uno.mk bridges/source canvas/source chart2/source codemaker/source comphelper/source config_host.mk.in configure.ac connectivity/source cppcanvas/source cppuhelper/source cppu/source cui/source dbaccess/source desktop/qa desktop/source dictionaries distro-configs/LibreOfficeAndroid.conf distro-configs/LibreOfficeAndroidX86.conf drawinglayer/source external/boost external/cppunit external/harfbuzz external/icu external/libepubgen external/liborcus external/nss filter/source framework/inc framework/qa framework/source helpcontent2 hwpfilter/source i18npool/source i18nutil/source idlc/inc idlc/source idl/inc idl/source include/android include/basic include/drawinglayer include/editeng include/o3tl include/oox include/osl include/rtl include/sal include/sfx2 include/svl include/svx include/typelib include/uno include/vcl ios/CustomTarget_iOS_setup.mk ios/LibreOfficeLight io/test jurt/com lotuswordpro/source odk/examples offapi/com oox/source package/source qadevOOo/runner qadevOOo/tests reportdesign/source sal/android sal/osl sal/qa sal/rtl sax/test sccomp/source sc/inc sc/qa sc/source sd/CppunitTest_sd_import_tests.mk sdext/source sd/qa sd/source sfx2/source slideshow/source solenv/bin solenv/clang-format solenv/gbuild starmath/source stoc/source svtools/source svx/source sw/inc sw/qa sw/source sysui/desktop testtools/source tools/source translations ucbhelper/source vbahelper/source vcl/headless vcl/opengl vcl/source vcl/unx winaccessibility/source writerfilter/source writerperfect/qa writerperfect/source xmloff/source xmlsecurity/source

Armin Le Grand Armin.Le.Grand at cib.de
Fri Jan 19 13:48:39 UTC 2018


Rebased ref, commits from common ancestor:
commit 7a8d18ffe54b974c71f52ebb43c1e1d4faa2ac59
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Fri Jan 19 14:43:24 2018 +0100

    BorderlineFix: Corrected missing borders in print
    
    In Print/PDF/PrintPreview border lines were missing, this
    happened for merged cells. It has to do with access to the
    involved Styles and/or 'Clip' set (to avoid creating everything).
    Thus a 'mixed' usage of cell and merged-cell stuff was needed.
    As it turns out support for this is already there, need to use
    it.
    
    Change-Id: Ic16085b97eef5c79a4501279432f43491bca350e

diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index 2feaab5af8bf..9b532a2d0d29 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -143,10 +143,6 @@ private:
     /// the impl class holding the data
     std::shared_ptr< implStyle >        maImplStyle;
 
-    /// pointer to Cell using this style. Not member of the
-    /// impl class since multiple Cells may use the same style
-    const Cell*                         mpUsingCell;
-
     /// call to set maImplStyle on demand
     void implEnsureImplStyle();
 
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index ecb3eaace1c6..ac47053155ec 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -1055,17 +1055,14 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
         for (size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol)
         {
             // get Cell and CoordinateSystem (*only* for this Cell), check if used (not empty)
-            const Cell& rCell = CELL(nCol, nRow);
+            const Cell& rCell(CELL(nCol, nRow));
             basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this, nCol, nRow, false));
             basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
             basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
 
             if(!aX.equalZero() && !aY.equalZero())
             {
-                // for getting correct Style(s) for merged Cells, we need the First(Col/Row)
-                // for access (see accessing Styles below)
-                const size_t _nFirstCol(mxImpl->GetMergedFirstCol(nCol, nRow));
-                const size_t _nFirstRow(mxImpl->GetMergedFirstRow(nCol, nRow));
+                // get needed local values
                 basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
                 const bool bOverlapX(rCell.mbOverlapX);
                 const bool bOverlapY(rCell.mbOverlapY);
@@ -1078,7 +1075,9 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 if (!bOverlapY      // true for first line in merged cells or cells
                     || bFirstRow)   // true for non_Calc usages of this tooling
                 {
-                    const Style& rTop = GetCellStyleTop(_nFirstCol, _nFirstRow);
+                    // get CellStyle - method will take care to get the correct one, e.g.
+                    // for merged cells (it uses ORIGCELL that works with topLeft's of these)
+                    const Style& rTop(GetCellStyleTop(nCol, nRow));
 
                     if(rTop.IsUsed())
                     {
@@ -1089,7 +1088,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 // create lower line for this Cell
                 if (bLastRow)       // true for non_Calc usages of this tooling
                 {
-                    const Style& rBottom = GetCellStyleBottom(_nFirstCol, _nFirstRow);
+                    const Style& rBottom(GetCellStyleBottom(nCol, nRow));
 
                     if(rBottom.IsUsed())
                     {
@@ -1101,7 +1100,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 if (!bOverlapX      // true for first column in merged cells or cells
                     || bFirstCol)   // true for non_Calc usages of this tooling
                 {
-                    const Style& rLeft(GetCellStyleLeft(_nFirstCol, _nFirstRow));
+                    const Style& rLeft(GetCellStyleLeft(nCol, nRow));
 
                     if(rLeft.IsUsed())
                     {
@@ -1112,7 +1111,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 // create right line for this Cell
                 if (bLastCol)       // true for non_Calc usages of this tooling
                 {
-                    const Style& rRight(GetCellStyleRight(_nFirstCol, _nFirstRow));
+                    const Style& rRight(GetCellStyleRight(nCol, nRow));
 
                     if(rRight.IsUsed())
                     {
@@ -1122,8 +1121,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
 
                 // check for crossed lines, these need special treatment, especially
                 // for merged cells, see below
-                const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
-                const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);
+                const Style& rTLBR(GetCellStyleTLBR(nCol, nRow));
+                const Style& rBLTR(GetCellStyleBLTR(nCol, nRow));
 
                 if(rTLBR.IsUsed() || rBLTR.IsUsed())
                 {
@@ -1131,8 +1130,11 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
 
                     if(rCell.IsMerged())
                     {
-                        // first check if this merged cell was already handled
-                        const size_t nIndexOfMergedCell(mxImpl->GetIndex(_nFirstCol, _nFirstRow));
+                        // first check if this merged cell was already handled. To do so,
+                        // calculate and use the index of the TopLeft cell
+                        const size_t _nMergedFirstCol(mxImpl->GetMergedFirstCol(nCol, nRow));
+                        const size_t _nMergedFirstRow(mxImpl->GetMergedFirstRow(nCol, nRow));
+                        const size_t nIndexOfMergedCell(mxImpl->GetIndex(_nMergedFirstCol, _nMergedFirstRow));
                         bContinue = (aMergedCells.end() == aMergedCells.find(nIndexOfMergedCell));
 
                         if(bContinue)
@@ -1140,7 +1142,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                             // not found, add now to mark as handled
                             aMergedCells.insert(nIndexOfMergedCell);
 
-                            // when merged, get extended coordinate system and dependent values
+                            // when merged, get extended coordinate system and derived values
+                            // for the full range of this merged cell
                             aCoordinateSystem = rCell.CreateCoordinateSystem(*this, nCol, nRow, true);
                             aX = basegfx::utils::getColumn(aCoordinateSystem, 0);
                             aY = basegfx::utils::getColumn(aCoordinateSystem, 1);
@@ -1157,8 +1160,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                         {
                             /// top-left and bottom-right Style Tables
                             /// Fill top-left Style Table
-                            const Style& rTLFromRight(GetCellStyleTop(_nFirstCol, _nFirstRow));
-                            const Style& rTLFromBottom(GetCellStyleLeft(_nFirstCol, _nFirstRow));
+                            const Style& rTLFromRight(GetCellStyleTop(nCol, nRow));
+                            const Style& rTLFromBottom(GetCellStyleLeft(nCol, nRow));
                             StyleVectorTable aStart;
                             const basegfx::B2DVector aAxisA(aX + aY);
 
@@ -1167,8 +1170,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                             aStart.sort();
 
                             /// Fill bottom-right Style Table
-                            const Style& rBRFromBottom(GetCellStyleRight(_nLastCol, _nLastRow));
-                            const Style& rBRFromLeft(GetCellStyleBottom(_nLastCol, _nLastRow));
+                            const Style& rBRFromBottom(GetCellStyleRight(nCol, nRow));
+                            const Style& rBRFromLeft(GetCellStyleBottom(nCol, nRow));
                             StyleVectorTable aEnd;
                             const basegfx::B2DVector aAxisB(-aX -aY);
 
@@ -1191,8 +1194,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                         {
                             /// bottom-left and top-right Style Tables
                             /// Fill bottom-left Style Table
-                            const Style& rBLFromTop(GetCellStyleLeft(_nFirstCol, _nLastRow));
-                            const Style& rBLFromBottom(GetCellStyleBottom(_nFirstCol, _nLastRow));
+                            const Style& rBLFromTop(GetCellStyleLeft(nCol, nRow));
+                            const Style& rBLFromBottom(GetCellStyleBottom(nCol, nRow));
                             StyleVectorTable aStart;
                             const basegfx::B2DVector aAxisA(aX - aY);
 
@@ -1201,8 +1204,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                             aStart.sort();
 
                             /// Fill top-right Style Table
-                            const Style& rTRFromLeft(GetCellStyleTop(_nLastCol, _nFirstRow));
-                            const Style& rTRFromBottom(GetCellStyleRight(_nLastCol, _nFirstRow));
+                            const Style& rTRFromLeft(GetCellStyleTop(nCol, nRow));
+                            const Style& rTRFromBottom(GetCellStyleRight(nCol, nRow));
                             StyleVectorTable aEnd;
                             const basegfx::B2DVector aAxisB(aY - aX);
 
commit 5b27823f43db8b5c3f72a1e059d9fa998445437f
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Thu Jan 18 17:07:43 2018 +0100

    BorderlineFix: Need to redesign Borderline paint for Calc
    
    To fix some errors, need to change svx::frame::Array conversion
    to Primitives, especially regarding handling of merged cells.
    These make problems in the currtent form where the full extended
    merged cell tries to be converted. This is bad for cropped stuff
    and also wrong for double-line stuff attaching to a merged cell.
    The solution is to handle cells single and merge created primitives
    which is more expensive but will work. This will involve special
    handling for X-Ed (crossed) and 'roated' Cells. Also need to be
    very careful since all this is used in the meantime for all
    visualizations of Tables in multiple apps/situations.
    
    Change-Id: If0652a3ba97a6f27dd5d782ea22b1514303f3710

diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index ce7f09345a80..2feaab5af8bf 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -150,11 +150,6 @@ private:
     /// call to set maImplStyle on demand
     void implEnsureImplStyle();
 
-    /// need information which cell this style info comes from due to needed
-    /// rotation info (which is in the cell). Rotation depends on the cell.
-    friend class Cell;
-    void SetUsingCell(const Cell* pCell) { mpUsingCell = pCell; }
-
 public:
     /** Constructs an invisible frame style. */
     explicit Style();
@@ -203,9 +198,6 @@ public:
     /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
     Style& MirrorSelf();
 
-    /** return the Cell using this style (if set) */
-    const Cell* GetUsingCell() const { return mpUsingCell; }
-
     bool operator==( const Style& rOther) const;
     bool operator<( const Style& rOther) const;
 };
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 2b06d29a41b2..e135e371319c 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -291,8 +291,7 @@ public:
 
     /** Returns the output range of the cell (nCol,nRow).
         Returns total output range of merged ranges. */
-    basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow ) const;
-    basegfx::B2DRange GetCellRange( size_t nCellIndex ) const;
+    basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const;
 
     // mirroring --------------------------------------------------------------
 
@@ -312,9 +311,6 @@ public:
     /** Draws the part of the array, that is inside the clipping range. */
     drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const;
 
-    // fill the Cell::maCellIndex entries to allow referencing back from Cell to Array Col/Row coordinates
-    void AddCellIndices() const;
-
 private:
     std::unique_ptr<ArrayImpl>        mxImpl;
 };
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index a6ffdfe75389..f8f2dae645a6 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -250,7 +250,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
 
         Size aStrSize;
         sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
-        const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow ));
+        const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
         Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
         sal_uInt16 nRightX = 0;
         bool bJustify = pCurData->GetIncludeJustify();
@@ -374,7 +374,7 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
                 rRenderContext.SetLineColor();
                 rRenderContext.SetFillColor( pItem->GetColor() );
 
-                const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+                const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
                 rRenderContext.DrawRect(
                     tools::Rectangle(
                         basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 827def10ed2f..50ddd110fa04 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -51,14 +51,12 @@ void Style::implEnsureImplStyle()
 }
 
 Style::Style() :
-    maImplStyle(),
-    mpUsingCell(nullptr)
+    maImplStyle()
 {
 }
 
 Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
-    maImplStyle(new implStyle()),
-    mpUsingCell(nullptr)
+    maImplStyle(new implStyle())
 {
     maImplStyle->mnType = nType;
     maImplStyle->mfPatternScale = fScale;
@@ -66,8 +64,7 @@ Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double
 }
 
 Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
-    maImplStyle(new implStyle()),
-    mpUsingCell(nullptr)
+    maImplStyle(new implStyle())
 {
     maImplStyle->mnType = nType;
     maImplStyle->mfPatternScale = fScale;
@@ -75,8 +72,7 @@ Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rCo
 }
 
 Style::Style( const editeng::SvxBorderLine* pBorder, double fScale ) :
-    maImplStyle(),
-    mpUsingCell(nullptr)
+    maImplStyle()
 {
     if(nullptr != pBorder)
     {
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 560eefd775ce..ecb3eaace1c6 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -45,10 +45,8 @@ public:
     long                mnAddTop;
     long                mnAddBottom;
 
-    SvxRotateMode           meRotMode;
-    double                  mfOrientation;
-    basegfx::B2DHomMatrix   maCoordinateSystem;
-    size_t                  maCellIndex;
+    SvxRotateMode       meRotMode;
+    double              mfOrientation;
 
     bool                mbMergeOrig;
     bool                mbOverlapX;
@@ -57,12 +55,12 @@ public:
 public:
     explicit            Cell();
 
-    void SetStyleLeft(const Style& rStyle) { maLeft = rStyle; maLeft.SetUsingCell(this); }
-    void SetStyleRight(const Style& rStyle) { maRight = rStyle; maRight.SetUsingCell(this); }
-    void SetStyleTop(const Style& rStyle) { maTop = rStyle; maTop.SetUsingCell(this); }
-    void SetStyleBottom(const Style& rStyle) { maBottom = rStyle; maBottom.SetUsingCell(this); }
-    void SetStyleTLBR(const Style& rStyle) { maTLBR = rStyle; maTLBR.SetUsingCell(this); }
-    void SetStyleBLTR(const Style& rStyle) { maBLTR = rStyle; maBLTR.SetUsingCell(this); }
+    void SetStyleLeft(const Style& rStyle) { maLeft = rStyle; }
+    void SetStyleRight(const Style& rStyle) { maRight = rStyle; }
+    void SetStyleTop(const Style& rStyle) { maTop = rStyle; }
+    void SetStyleBottom(const Style& rStyle) { maBottom = rStyle; }
+    void SetStyleTLBR(const Style& rStyle) { maTLBR = rStyle; }
+    void SetStyleBLTR(const Style& rStyle) { maBLTR = rStyle; }
 
     const Style& GetStyleLeft() const { return maLeft; }
     const Style& GetStyleRight() const { return maRight; }
@@ -76,74 +74,54 @@ public:
 
     void                MirrorSelfX();
 
-    basegfx::B2DHomMatrix const & CreateCoordinateSystem(const Array& rArray) const;
-    size_t GetCellIndex(const Array& rArray) const;
+    basegfx::B2DHomMatrix CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const;
 };
 
 typedef std::vector< long >     LongVec;
 typedef std::vector< Cell >     CellVec;
 
-size_t Cell::GetCellIndex(const Array& rArray) const
+basegfx::B2DHomMatrix Cell::CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const
 {
-    if(static_cast<size_t>(-1) == maCellIndex)
-    {
-        rArray.AddCellIndices();
-    }
-
-    return maCellIndex;
-}
+    basegfx::B2DHomMatrix aRetval;
+    const basegfx::B2DRange aRange(rArray.GetCellRange(nCol, nRow, bExpandMerged));
 
-basegfx::B2DHomMatrix const & Cell::CreateCoordinateSystem(const Array& rArray) const
-{
-    if(!maCoordinateSystem.isIdentity())
+    if(!aRange.isEmpty())
     {
-        return maCoordinateSystem;
-    }
-
-    const size_t nCellIndex(GetCellIndex(rArray));
+        basegfx::B2DPoint aOrigin(aRange.getMinimum());
+        basegfx::B2DVector aX(aRange.getWidth(), 0.0);
+        basegfx::B2DVector aY(0.0, aRange.getHeight());
 
-    if(static_cast<size_t>(-1) != nCellIndex)
-    {
-        const basegfx::B2DRange aRange(rArray.GetCellRange(nCellIndex));
-
-        if(!aRange.isEmpty())
+        if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != meRotMode)
         {
-            basegfx::B2DPoint aOrigin(aRange.getMinimum());
-            basegfx::B2DVector aX(aRange.getWidth(), 0.0);
-            basegfx::B2DVector aY(0.0, aRange.getHeight());
+            // when rotated, adapt values. Get Skew (cos/sin == 1/tan)
+            const double fSkew(aY.getY() * (cos(mfOrientation) / sin(mfOrientation)));
 
-            if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != meRotMode)
+            switch (meRotMode)
             {
-                // when rotated, adapt values. Get Skew (cos/sin == 1/tan)
-                const double fSkew(aY.getY() * (cos(mfOrientation) / sin(mfOrientation)));
-
-                switch (meRotMode)
-                {
-                case SvxRotateMode::SVX_ROTATE_MODE_TOP:
-                    // shear Y-Axis
-                    aY.setX(-fSkew);
-                    break;
-                case SvxRotateMode::SVX_ROTATE_MODE_CENTER:
-                    // shear origin half, Y full
-                    aOrigin.setX(aOrigin.getX() + (fSkew * 0.5));
-                    aY.setX(-fSkew);
-                    break;
-                case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
-                    // shear origin full, Y full
-                    aOrigin.setX(aOrigin.getX() + fSkew);
-                    aY.setX(-fSkew);
-                    break;
-                default: // SvxRotateMode::SVX_ROTATE_MODE_STANDARD, already excluded above
-                    break;
-                }
+            case SvxRotateMode::SVX_ROTATE_MODE_TOP:
+                // shear Y-Axis
+                aY.setX(-fSkew);
+                break;
+            case SvxRotateMode::SVX_ROTATE_MODE_CENTER:
+                // shear origin half, Y full
+                aOrigin.setX(aOrigin.getX() + (fSkew * 0.5));
+                aY.setX(-fSkew);
+                break;
+            case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
+                // shear origin full, Y full
+                aOrigin.setX(aOrigin.getX() + fSkew);
+                aY.setX(-fSkew);
+                break;
+            default: // SvxRotateMode::SVX_ROTATE_MODE_STANDARD, already excluded above
+                break;
             }
-
-            // use column vectors as coordinate axes, homogen column for translation
-            const_cast<Cell*>(this)->maCoordinateSystem = basegfx::utils::createCoordinateSystemTransform(aOrigin, aX, aY);
         }
+
+        // use column vectors as coordinate axes, homogen column for translation
+        aRetval = basegfx::utils::createCoordinateSystemTransform(aOrigin, aX, aY);
     }
 
-    return maCoordinateSystem;
+    return aRetval;
 }
 
 Cell::Cell() :
@@ -153,8 +131,6 @@ Cell::Cell() :
     mnAddBottom( 0 ),
     meRotMode(SvxRotateMode::SVX_ROTATE_MODE_STANDARD ),
     mfOrientation( 0.0 ),
-    maCoordinateSystem(),
-    maCellIndex(static_cast<size_t>(-1)),
     mbMergeOrig( false ),
     mbOverlapX( false ),
     mbOverlapY( false )
@@ -168,8 +144,6 @@ void Cell::MirrorSelfX()
     maLeft.MirrorSelf();
     maRight.MirrorSelf();
     mfOrientation = -mfOrientation;
-    maCoordinateSystem.identity();
-    maCellIndex = static_cast<size_t>(-1);
 }
 
 
@@ -864,17 +838,12 @@ long Array::GetHeight() const
     return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 );
 }
 
-basegfx::B2DRange Array::GetCellRange( size_t nCellIndex ) const
-{
-    return GetCellRange(nCellIndex % GetColCount(), nCellIndex / GetColCount());
-}
-
-basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow ) const
+basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const
 {
-    size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
-    size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
-    size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
-    size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+    size_t nFirstCol = bExpandMerged ? mxImpl->GetMergedFirstCol( nCol, nRow ) : nCol;
+    size_t nFirstRow = bExpandMerged ? mxImpl->GetMergedFirstRow( nCol, nRow ) : nRow;
+    size_t nLastCol = bExpandMerged ? mxImpl->GetMergedLastCol( nCol, nRow ) : nCol;
+    size_t nLastRow = bExpandMerged ? mxImpl->GetMergedLastRow( nCol, nRow ) : nRow;
     const Point aPoint( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
     const Size aSize( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
     tools::Rectangle aRect(aPoint, aSize);
@@ -1023,45 +992,6 @@ void HelperCreateVerticalEntry(
     );
 }
 
-void HelperCreateEntry(const Array& rArray, const Style& rStyle, drawinglayer::primitive2d::Primitive2DContainer& rSequence, const Color* pForceColor)
-{
-    const Cell* pCell = rStyle.GetUsingCell();
-
-    if(nullptr != pCell)
-    {
-        const size_t nCellIndex(pCell->GetCellIndex(rArray));
-
-        if(static_cast<size_t>(-1) != nCellIndex)
-        {
-            size_t col(nCellIndex % rArray.GetColCount());
-            size_t row(nCellIndex / rArray.GetColCount());
-            const bool bL(&rStyle == &pCell->GetStyleLeft());
-            const bool bR(&rStyle == &pCell->GetStyleRight());
-            const bool bT(&rStyle == &pCell->GetStyleTop());
-            const bool bB(&rStyle == &pCell->GetStyleBottom());
-
-            if(bL || bR || bT || bB)
-            {
-                const basegfx::B2DHomMatrix aCoordinateSystem(pCell->CreateCoordinateSystem(rArray));
-                const basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
-                const basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
-                const basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
-
-                if(bL || bR)
-                {
-                    // left/right
-                    HelperCreateVerticalEntry(rArray, rStyle, bL ? col : col + 1, row, aOrigin, aX, aY, rSequence, bL, pForceColor);
-                }
-                else if(bT || bB)
-                {
-                    // top/bottom
-                    HelperCreateHorizontalEntry(rArray, rStyle, col, bT ? row : row + 1, aOrigin, aX, aY, rSequence, bT, pForceColor);
-                }
-            }
-        }
-    }
-}
-
 void HelperMergeInB2DPrimitiveArray(
     const drawinglayer::primitive2d::Primitive2DContainer& rSource,
     drawinglayer::primitive2d::Primitive2DContainer& rTarget)
@@ -1116,23 +1046,27 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
     std::vector< drawinglayer::primitive2d::Primitive2DContainer > aVerticalSequences(nLastCol - nFirstCol + 1);
     drawinglayer::primitive2d::Primitive2DContainer aCrossSequence;
 
+    // remember for which merged cells crossed lines were already created. To
+    // do so, hold the size_t cell index in a set for fast check
+    std::set< size_t > aMergedCells;
+
     for (size_t nRow = nFirstRow; nRow <= nLastRow; ++nRow)
     {
         for (size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol)
         {
+            // get Cell and CoordinateSystem (*only* for this Cell), check if used (not empty)
             const Cell& rCell = CELL(nCol, nRow);
-            const basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this));
-            const basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
-            const basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
+            basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this, nCol, nRow, false));
+            basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
+            basegfx::B2DVector aY(basegfx::utils::getColumn(aCoordinateSystem, 1));
 
             if(!aX.equalZero() && !aY.equalZero())
             {
-                size_t _nFirstCol = mxImpl->GetMergedFirstCol(nCol, nRow);
-                size_t _nFirstRow = mxImpl->GetMergedFirstRow(nCol, nRow);
-                size_t _nLastCol = mxImpl->GetMergedLastCol(nCol, nRow);
-                size_t _nLastRow = mxImpl->GetMergedLastRow(nCol, nRow);
-                const basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
-
+                // for getting correct Style(s) for merged Cells, we need the First(Col/Row)
+                // for access (see accessing Styles below)
+                const size_t _nFirstCol(mxImpl->GetMergedFirstCol(nCol, nRow));
+                const size_t _nFirstRow(mxImpl->GetMergedFirstRow(nCol, nRow));
+                basegfx::B2DPoint aOrigin(basegfx::utils::getColumn(aCoordinateSystem, 2));
                 const bool bOverlapX(rCell.mbOverlapX);
                 const bool bOverlapY(rCell.mbOverlapY);
                 const bool bFirstCol(nCol == nFirstCol);
@@ -1140,116 +1074,152 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
                 const bool bFirstRow(nRow == nFirstRow);
                 const bool bLastRow(nRow == nLastRow);
 
-                if (!bOverlapX || bFirstRow)
+                // create upper line for this Cell
+                if (!bOverlapY      // true for first line in merged cells or cells
+                    || bFirstRow)   // true for non_Calc usages of this tooling
                 {
                     const Style& rTop = GetCellStyleTop(_nFirstCol, _nFirstRow);
 
                     if(rTop.IsUsed())
                     {
-                        HelperCreateEntry(*this, rTop, aHorizontalSequence, pForceColor);
+                        HelperCreateHorizontalEntry(*this, rTop, nCol, nRow, aOrigin, aX, aY, aHorizontalSequence, true, pForceColor);
                     }
                 }
 
-                if (bLastRow)
+                // create lower line for this Cell
+                if (bLastRow)       // true for non_Calc usages of this tooling
                 {
                     const Style& rBottom = GetCellStyleBottom(_nFirstCol, _nFirstRow);
 
                     if(rBottom.IsUsed())
                     {
-                        HelperCreateEntry(*this, rBottom, aHorizontalSequence, pForceColor);
+                        HelperCreateHorizontalEntry(*this, rBottom, nCol, nRow + 1, aOrigin, aX, aY, aHorizontalSequence, false, pForceColor);
                     }
                 }
 
-                if (!bOverlapY || bFirstCol)
+                // create left line for this Cell
+                if (!bOverlapX      // true for first column in merged cells or cells
+                    || bFirstCol)   // true for non_Calc usages of this tooling
                 {
                     const Style& rLeft(GetCellStyleLeft(_nFirstCol, _nFirstRow));
 
                     if(rLeft.IsUsed())
                     {
-                        HelperCreateEntry(*this, rLeft, aVerticalSequences[nCol - nFirstCol], pForceColor);
+                        HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, aVerticalSequences[nCol - nFirstCol], true, pForceColor);
                     }
                 }
 
-                if (bLastCol)
+                // create right line for this Cell
+                if (bLastCol)       // true for non_Calc usages of this tooling
                 {
                     const Style& rRight(GetCellStyleRight(_nFirstCol, _nFirstRow));
 
                     if(rRight.IsUsed())
                     {
-                        HelperCreateEntry(*this, rRight, aVerticalSequences[nCol - nFirstCol], pForceColor);
+                        HelperCreateVerticalEntry(*this, rRight, nCol + 1, nRow, aOrigin, aX, aY, aVerticalSequences[nCol - nFirstCol], false, pForceColor);
                     }
                 }
 
-                if ((!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) || (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow))
+                // check for crossed lines, these need special treatment, especially
+                // for merged cells, see below
+                const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
+                const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);
+
+                if(rTLBR.IsUsed() || rBLTR.IsUsed())
                 {
-                    const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
-                    if(rTLBR.IsUsed())
+                    bool bContinue(true);
+
+                    if(rCell.IsMerged())
                     {
-                        /// top-left and bottom-right Style Tables
-                        /// Fill top-left Style Table
-                        const Style& rTLFromRight(GetCellStyleTop(_nFirstCol, _nFirstRow));
-                        const Style& rTLFromBottom(GetCellStyleLeft(_nFirstCol, _nFirstRow));
-                        StyleVectorTable aStart;
-                        const basegfx::B2DVector aAxisA(aX + aY);
-
-                        aStart.add(rTLFromRight, aAxisA, aX, false);
-                        aStart.add(rTLFromBottom, aAxisA, aY, false);
-                        aStart.sort();
-
-                        /// Fill bottom-right Style Table
-                        const Style& rBRFromBottom(GetCellStyleRight(_nLastCol, _nLastRow));
-                        const Style& rBRFromLeft(GetCellStyleBottom(_nLastCol, _nLastRow));
-                        StyleVectorTable aEnd;
-                        const basegfx::B2DVector aAxisB(-aX -aY);
-
-                        aEnd.add(rBRFromBottom, aAxisB, -aY, true);
-                        aEnd.add(rBRFromLeft, aAxisB, -aX, true);
-                        aEnd.sort();
-
-                        CreateBorderPrimitives(
-                            aCrossSequence,
-                            aOrigin,
-                            aX + aY,
-                            rTLBR,
-                            aStart,
-                            aEnd,
-                            pForceColor
-                        );
+                        // first check if this merged cell was already handled
+                        const size_t nIndexOfMergedCell(mxImpl->GetIndex(_nFirstCol, _nFirstRow));
+                        bContinue = (aMergedCells.end() == aMergedCells.find(nIndexOfMergedCell));
+
+                        if(bContinue)
+                        {
+                            // not found, add now to mark as handled
+                            aMergedCells.insert(nIndexOfMergedCell);
+
+                            // when merged, get extended coordinate system and dependent values
+                            aCoordinateSystem = rCell.CreateCoordinateSystem(*this, nCol, nRow, true);
+                            aX = basegfx::utils::getColumn(aCoordinateSystem, 0);
+                            aY = basegfx::utils::getColumn(aCoordinateSystem, 1);
+                            aOrigin = basegfx::utils::getColumn(aCoordinateSystem, 2);
+                        }
                     }
 
-                    const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);
-                    if(rBLTR.IsUsed())
+                    if(bContinue)
                     {
-                        /// bottom-left and top-right Style Tables
-                        /// Fill bottom-left Style Table
-                        const Style& rBLFromTop(GetCellStyleLeft(_nFirstCol, _nLastRow));
-                        const Style& rBLFromBottom(GetCellStyleBottom(_nFirstCol, _nLastRow));
-                        StyleVectorTable aStart;
-                        const basegfx::B2DVector aAxisA(aX - aY);
-
-                        aStart.add(rBLFromTop, aAxisA, -aY, true);
-                        aStart.add(rBLFromBottom, aAxisA, aX, false);
-                        aStart.sort();
-
-                        /// Fill top-right Style Table
-                        const Style& rTRFromLeft(GetCellStyleTop(_nLastCol, _nFirstRow));
-                        const Style& rTRFromBottom(GetCellStyleRight(_nLastCol, _nFirstRow));
-                        StyleVectorTable aEnd;
-                        const basegfx::B2DVector aAxisB(aY - aX);
-
-                        aEnd.add(rTRFromLeft, aAxisB, -aX, true);
-                        aEnd.add(rTRFromBottom, aAxisB, aY, false);
-                        aEnd.sort();
-
-                        CreateBorderPrimitives(
-                            aCrossSequence,
-                            aOrigin + aY,
-                            aX - aY,
-                            rBLTR,
-                            aStart,
-                            aEnd,
-                            pForceColor
-                        );
+                        const size_t _nLastCol(mxImpl->GetMergedLastCol(nCol, nRow));
+                        const size_t _nLastRow(mxImpl->GetMergedLastRow(nCol, nRow));
+
+                        if(rTLBR.IsUsed())
+                        {
+                            /// top-left and bottom-right Style Tables
+                            /// Fill top-left Style Table
+                            const Style& rTLFromRight(GetCellStyleTop(_nFirstCol, _nFirstRow));
+                            const Style& rTLFromBottom(GetCellStyleLeft(_nFirstCol, _nFirstRow));
+                            StyleVectorTable aStart;
+                            const basegfx::B2DVector aAxisA(aX + aY);
+
+                            aStart.add(rTLFromRight, aAxisA, aX, false);
+                            aStart.add(rTLFromBottom, aAxisA, aY, false);
+                            aStart.sort();
+
+                            /// Fill bottom-right Style Table
+                            const Style& rBRFromBottom(GetCellStyleRight(_nLastCol, _nLastRow));
+                            const Style& rBRFromLeft(GetCellStyleBottom(_nLastCol, _nLastRow));
+                            StyleVectorTable aEnd;
+                            const basegfx::B2DVector aAxisB(-aX -aY);
+
+                            aEnd.add(rBRFromBottom, aAxisB, -aY, true);
+                            aEnd.add(rBRFromLeft, aAxisB, -aX, true);
+                            aEnd.sort();
+
+                            CreateBorderPrimitives(
+                                aCrossSequence,
+                                aOrigin,
+                                aX + aY,
+                                rTLBR,
+                                aStart,
+                                aEnd,
+                                pForceColor
+                            );
+                        }
+
+                        if(rBLTR.IsUsed())
+                        {
+                            /// bottom-left and top-right Style Tables
+                            /// Fill bottom-left Style Table
+                            const Style& rBLFromTop(GetCellStyleLeft(_nFirstCol, _nLastRow));
+                            const Style& rBLFromBottom(GetCellStyleBottom(_nFirstCol, _nLastRow));
+                            StyleVectorTable aStart;
+                            const basegfx::B2DVector aAxisA(aX - aY);
+
+                            aStart.add(rBLFromTop, aAxisA, -aY, true);
+                            aStart.add(rBLFromBottom, aAxisA, aX, false);
+                            aStart.sort();
+
+                            /// Fill top-right Style Table
+                            const Style& rTRFromLeft(GetCellStyleTop(_nLastCol, _nFirstRow));
+                            const Style& rTRFromBottom(GetCellStyleRight(_nLastCol, _nFirstRow));
+                            StyleVectorTable aEnd;
+                            const basegfx::B2DVector aAxisB(aY - aX);
+
+                            aEnd.add(rTRFromLeft, aAxisB, -aX, true);
+                            aEnd.add(rTRFromBottom, aAxisB, aY, false);
+                            aEnd.sort();
+
+                            CreateBorderPrimitives(
+                                aCrossSequence,
+                                aOrigin + aY,
+                                aX - aY,
+                                rBLTR,
+                                aStart,
+                                aEnd,
+                                pForceColor
+                            );
+                        }
                     }
                 }
             }
@@ -1259,6 +1229,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
     // to stay compatible, create order as it was formally. Also try to
     // merge primitives as far as possible
     HelperMergeInB2DPrimitiveArray(aHorizontalSequence, aCrossSequence);
+
     for(const auto& aVert : aVerticalSequences)
     {
         HelperMergeInB2DPrimitiveArray(aVert, aCrossSequence);
@@ -1279,19 +1250,9 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveArray()
     return aPrimitives;
 }
 
-void Array::AddCellIndices() const
-{
-    for (size_t a(0); a < mxImpl->maCells.size(); a++)
-    {
-        const_cast<Array*>(this)->mxImpl->maCells[a].maCellIndex = a;
-    }
-}
-
 #undef ORIGCELL
 #undef CELLACC
 #undef CELL
-
-
 #undef DBG_FRAME_CHECK_ROW_1
 #undef DBG_FRAME_CHECK_COL_1
 #undef DBG_FRAME_CHECK_COLROW
@@ -1299,7 +1260,6 @@ void Array::AddCellIndices() const
 #undef DBG_FRAME_CHECK_COL
 #undef DBG_FRAME_CHECK
 
-
 }
 }
 
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index d54e1b083e65..f65693d44b58 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -410,7 +410,7 @@ void FrameSelectorImpl::InitBorderGeometry()
     {
         for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
         {
-            const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+            const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
             const tools::Rectangle aRect(
                 basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
                 basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
@@ -469,7 +469,7 @@ void FrameSelectorImpl::InitBorderGeometry()
             for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
             {
                 // the usable area between horizonal/vertical frame borders of current quadrant
-                const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+                const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
                 const tools::Rectangle aRect(
                     basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1,
                     basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1);
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 7a342f1ff83e..5336024736fa 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -716,7 +716,7 @@ MAKENUMSTR:
     SvtScriptedTextHelper aScriptedText(rRenderContext);
     Size aStrSize;
     sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
-    const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+    const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
     const tools::Rectangle cellRect(
         basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
         basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
@@ -811,7 +811,7 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
             rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
             rRenderContext.SetLineColor();
             rRenderContext.SetFillColor(aBrushItem.GetColor());
-            const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+            const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
             rRenderContext.DrawRect(
                 tools::Rectangle(
                     basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
commit cc4d41fb7c3566177e30c9e6b5e2bb5c2191e5fb
Author: Andrea Gelmini <andrea.gelmini at gelma.net>
Date:   Fri Jan 19 09:58:05 2018 +0100

    Fix typos
    
    Change-Id: Icadf5cb88024b8889d49dc9c5210d0de8deaed3b
    Reviewed-on: https://gerrit.libreoffice.org/48172
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index b0c70999767b..16e2dd089d20 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1149,7 +1149,7 @@ void ScColumn::CopyStaticToDocument(
             break;
     }
 
-    // Dont' forget to copy the number formats over.  Charts may reference them.
+    // Don't forget to copy the number formats over. Charts may reference them.
     for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
     {
         sal_uInt32 nNumFmt = GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 6571b24f27de..0cab8a26e096 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -424,7 +424,7 @@ opts.add_option("-C", "--pure-c", action="store_true", help="do not print extern
 
 (options, args) = opts.parse_args()
 
-# dict of all the contructors that we need according to -g's
+# dict of all the constructors that we need according to -g's
 full_constructor_map = {}
 if options.groups:
     for constructor_group in options.groups:
commit acab4a99dcab546927712657c3ca4399a1b06fbb
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Jan 18 15:01:29 2018 +0100

    Unit test for tdf#114488
    
    Change-Id: Ib9430d2c1cc05c7b73273270f8f96e716fc4dc3f
    Reviewed-on: https://gerrit.libreoffice.org/48129
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk
index f12e200a29d6..27c7f9181b71 100644
--- a/sd/CppunitTest_sd_import_tests.mk
+++ b/sd/CppunitTest_sd_import_tests.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
     configmgr/source/configmgr \
     dbaccess/util/dba \
     desktop/source/deployment/deployment \
+    drawinglayer/drawinglayer \
     embeddedobj/util/embobj \
     emfio/emfio \
     filter/source/config/cache/filterconfig1 \
@@ -108,6 +109,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
     unoxml/source/rdf/unordf \
     unoxml/source/service/unoxml \
     uui/util/uui \
+    xmlscript/util/xmlscript \
     xmloff/util/xo \
     xmlsecurity/util/xmlsecurity \
 ))
diff --git a/sd/qa/unit/data/odg/tdf114488.fodg b/sd/qa/unit/data/odg/tdf114488.fodg
new file mode 100644
index 000000000000..41a3c497d380
--- /dev/null
+++ b/sd/qa/unit/data/odg/tdf114488.fodg
@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr
 ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xml
 ns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.graphics">
+ <office:meta><dc:date>2016-12-14T10:36:44.079000000</dc:date><meta:editing-duration>PT2M21S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:generator>LibreOfficeDev/6.1.0.0.alpha0$Linux_X86_64 LibreOffice_project/d36007ffd98bc9ed2f8ca6151a5283bd46a92485</meta:generator><meta:document-statistic meta:object-count="1"/></office:meta>
+ <office:settings>
+  <config:config-item-set config:name="ooo:view-settings">
+   <config:config-item config:name="VisibleAreaTop" config:type="int">-817</config:config-item>
+   <config:config-item config:name="VisibleAreaLeft" config:type="int">-127</config:config-item>
+   <config:config-item config:name="VisibleAreaWidth" config:type="int">10457</config:config-item>
+   <config:config-item config:name="VisibleAreaHeight" config:type="int">6649</config:config-item>
+   <config:config-item-map-indexed config:name="Views">
+    <config:config-item-map-entry>
+     <config:config-item config:name="ViewId" config:type="string">view1</config:config-item>
+     <config:config-item config:name="GridIsVisible" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="GridIsFront" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IsSnapToGrid" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="IsSnapToPageMargins" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="IsSnapToSnapLines" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IsSnapToObjectFrame" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IsSnapToObjectPoints" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IsPlusHandlesAlwaysVisible" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IsFrameDragSingles" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="EliminatePolyPointLimitAngle" config:type="int">1500</config:config-item>
+     <config:config-item config:name="IsEliminatePolyPoints" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="VisibleLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+     <config:config-item config:name="PrintableLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+     <config:config-item config:name="LockedLayers" config:type="base64Binary"/>
+     <config:config-item config:name="NoAttribs" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="NoColors" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="RulerIsVisible" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="PageKind" config:type="short">0</config:config-item>
+     <config:config-item config:name="SelectedPage" config:type="short">0</config:config-item>
+     <config:config-item config:name="IsLayerMode" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="IsDoubleClickTextEdit" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="IsClickChangeRotation" config:type="boolean">true</config:config-item>
+     <config:config-item config:name="SlidesPerRow" config:type="short">4</config:config-item>
+     <config:config-item config:name="EditMode" config:type="int">0</config:config-item>
+     <config:config-item config:name="VisibleAreaTop" config:type="int">-940</config:config-item>
+     <config:config-item config:name="VisibleAreaLeft" config:type="int">787</config:config-item>
+     <config:config-item config:name="VisibleAreaWidth" config:type="int">8624</config:config-item>
+     <config:config-item config:name="VisibleAreaHeight" config:type="int">6889</config:config-item>
+     <config:config-item config:name="GridCoarseWidth" config:type="int">1270</config:config-item>
+     <config:config-item config:name="GridCoarseHeight" config:type="int">1270</config:config-item>
+     <config:config-item config:name="GridFineWidth" config:type="int">127</config:config-item>
+     <config:config-item config:name="GridFineHeight" config:type="int">127</config:config-item>
+     <config:config-item config:name="GridSnapWidthXNumerator" config:type="int">127</config:config-item>
+     <config:config-item config:name="GridSnapWidthXDenominator" config:type="int">1</config:config-item>
+     <config:config-item config:name="GridSnapWidthYNumerator" config:type="int">127</config:config-item>
+     <config:config-item config:name="GridSnapWidthYDenominator" config:type="int">1</config:config-item>
+     <config:config-item config:name="IsAngleSnapEnabled" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="SnapAngle" config:type="int">1500</config:config-item>
+     <config:config-item config:name="ZoomOnPage" config:type="boolean">false</config:config-item>
+     <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
+    </config:config-item-map-entry>
+   </config:config-item-map-indexed>
+  </config:config-item-set>
+  <config:config-item-set config:name="ooo:configuration-settings">
+   <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+   <config:config-item config:name="BitmapTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sob</config:config-item>
+   <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+   <config:config-item config:name="ColorTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soc</config:config-item>
+   <config:config-item config:name="DashTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sod</config:config-item>
+   <config:config-item config:name="DefaultTabStop" config:type="int">1270</config:config-item>
+   <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="GradientTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.sog</config:config-item>
+   <config:config-item config:name="HatchTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soh</config:config-item>
+   <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintBooklet" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintBookletBack" config:type="boolean">true</config:config-item>
+   <config:config-item config:name="IsPrintBookletFront" config:type="boolean">true</config:config-item>
+   <config:config-item config:name="IsPrintDate" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintFitPage" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintHiddenPages" config:type="boolean">true</config:config-item>
+   <config:config-item config:name="IsPrintPageName" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintTilePage" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsPrintTime" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="LineEndTableURL" config:type="string">$(brandbaseurl)/share/palette%3B$(userpath)/config/standard.soe</config:config-item>
+   <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="MeasureUnit" config:type="short">7</config:config-item>
+   <config:config-item config:name="PageNumberFormat" config:type="int">4</config:config-item>
+   <config:config-item config:name="ParagraphSummation" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintQuality" config:type="int">0</config:config-item>
+   <config:config-item config:name="PrinterIndependentLayout" config:type="string">low-resolution</config:config-item>
+   <config:config-item config:name="PrinterName" config:type="string"/>
+   <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+   <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ScaleDenominator" config:type="int">1</config:config-item>
+   <config:config-item config:name="ScaleNumerator" config:type="int">1</config:config-item>
+   <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
+  </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+  <office:script script:language="ooo:Basic">
+   <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans CJK SC Regular" svg:font-family="'Noto Sans CJK SC Regular'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Segoe UI" svg:font-family="'Segoe UI'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <draw:marker draw:name="Arrow" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="24pt" fo:language="en" fo:country="US" style:font-name-asian="Segoe UI" style:font-size-asian="24pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Tahoma" style:font-size-complex="24pt" style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:style style:name="standard" style:family="graphic">
+   <style:graphic-properties draw:stroke="solid" svg:stroke-width="0cm" svg:stroke-color="#3465a4" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:marker-end-width="0.2cm" draw:marker-end-center="false" draw:fill="solid" draw:fill-color="#729fcf" draw:textarea-horizontal-align="justify" fo:padding-top="0.125cm" fo:padding-bottom="0.125cm" fo:padding-left="0.25cm" fo:padding-right="0.25cm" draw:shadow="hidden" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080">
+    <text:list-style style:name="standard">
+     <text:list-level-style-bullet text:level="1" text:bullet-char="●">
+      <style:list-level-properties text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="2" text:bullet-char="●">
+      <style:list-level-properties text:space-before="0.6cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="3" text:bullet-char="●">
+      <style:list-level-properties text:space-before="1.2cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="4" text:bullet-char="●">
+      <style:list-level-properties text:space-before="1.8cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="5" text:bullet-char="●">
+      <style:list-level-properties text:space-before="2.4cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="6" text:bullet-char="●">
+      <style:list-level-properties text:space-before="3cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="7" text:bullet-char="●">
+      <style:list-level-properties text:space-before="3.6cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="8" text:bullet-char="●">
+      <style:list-level-properties text:space-before="4.2cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="9" text:bullet-char="●">
+      <style:list-level-properties text:space-before="4.8cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+     <text:list-level-style-bullet text:level="10" text:bullet-char="●">
+      <style:list-level-properties text:space-before="5.4cm" text:min-label-width="0.6cm"/>
+      <style:text-properties fo:font-family="StarSymbol" style:use-window-font-color="true" fo:font-size="45%"/>
+     </text:list-level-style-bullet>
+    </text:list-style>
+   </style:graphic-properties>
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:line-height="100%" fo:text-indent="0cm"/>
+   <style:text-properties fo:font-variant="normal" fo:text-transform="none" style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:letter-kerning="true" style:font-name-asian="Microsoft YaHei" style:font-family-asian="'Microsoft YaHei'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="18pt" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-name-complex="Lucida Sans" style:font-family-complex="'Lucida Sans'" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="18pt" style:font-style-complex="norma
 l" style:font-weight-complex="normal" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/>
+  </style:style>
+  <style:style style:name="objectwitharrow" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="solid" svg:stroke-width="0.15cm" svg:stroke-color="#000000" draw:marker-start="Arrow" draw:marker-start-width="0.7cm" draw:marker-start-center="true" draw:marker-end-width="0.3cm"/>
+  </style:style>
+  <style:style style:name="objectwithshadow" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+  </style:style>
+  <style:style style:name="objectwithoutfill" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties svg:stroke-color="#000000" draw:fill="none"/>
+  </style:style>
+  <style:style style:name="Object_20_with_20_no_20_fill_20_and_20_no_20_line" style:display-name="Object with no fill and no line" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+  </style:style>
+  <style:style style:name="text" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+  </style:style>
+  <style:style style:name="textbody" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:text-properties fo:font-size="16pt"/>
+  </style:style>
+  <style:style style:name="textbodyjustfied" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:paragraph-properties fo:text-align="justify"/>
+  </style:style>
+  <style:style style:name="textbodyindent" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-indent="0.6cm"/>
+  </style:style>
+  <style:style style:name="title" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:text-properties fo:font-size="44pt"/>
+  </style:style>
+  <style:style style:name="title1" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="solid" draw:fill-color="#008080" draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+   <style:paragraph-properties fo:text-align="center"/>
+   <style:text-properties fo:font-size="24pt"/>
+  </style:style>
+  <style:style style:name="title2" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties svg:stroke-width="0.05cm" draw:fill-color="#ffcc99" draw:shadow="visible" draw:shadow-offset-x="0.2cm" draw:shadow-offset-y="0.2cm" draw:shadow-color="#808080"/>
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0.2cm" fo:margin-top="0.1cm" fo:margin-bottom="0.1cm" fo:text-align="center" fo:text-indent="0cm"/>
+   <style:text-properties fo:font-size="36pt"/>
+  </style:style>
+  <style:style style:name="headline" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+   <style:text-properties fo:font-size="24pt"/>
+  </style:style>
+  <style:style style:name="headline1" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+   <style:text-properties fo:font-size="18pt" fo:font-weight="bold"/>
+  </style:style>
+  <style:style style:name="headline2" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="none" draw:fill="none"/>
+   <style:paragraph-properties fo:margin-top="0.42cm" fo:margin-bottom="0.21cm"/>
+   <style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold"/>
+  </style:style>
+  <style:style style:name="measure" style:family="graphic" style:parent-style-name="standard">
+   <style:graphic-properties draw:stroke="solid" svg:stroke-color="#000000" draw:marker-start="Arrow" draw:marker-start-width="0.2cm" draw:marker-end="Arrow" draw:marker-end-width="0.2cm" draw:fill="none" draw:show-unit="true"/>
+   <style:text-properties fo:font-size="12pt"/>
+  </style:style>
+ </office:styles>
+ <office:automatic-styles>
+  <style:page-layout style:name="PM0">
+   <style:page-layout-properties fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:page-width="10.16cm" fo:page-height="5.08cm" style:print-orientation="portrait"/>
+  </style:page-layout>
+  <style:style style:name="dp1" style:family="drawing-page">
+   <style:drawing-page-properties draw:background-size="border" draw:fill="none"/>
+  </style:style>
+  <style:style style:name="dp2" style:family="drawing-page"/>
+  <style:style style:name="gr1" style:family="graphic" style:parent-style-name="Object_20_with_20_no_20_fill_20_and_20_no_20_line">
+   <style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:image-opacity="100%" style:mirror="none"/>
+  </style:style>
+  <style:style style:name="P1" style:family="paragraph">
+   <loext:graphic-properties draw:fill="none"/>
+   <style:paragraph-properties fo:text-align="center"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <draw:layer-set>
+   <draw:layer draw:name="layout"/>
+   <draw:layer draw:name="background"/>
+   <draw:layer draw:name="backgroundobjects"/>
+   <draw:layer draw:name="controls"/>
+   <draw:layer draw:name="measurelines"/>
+  </draw:layer-set>
+  <style:master-page style:name="Default" style:page-layout-name="PM0" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+  <office:drawing>
+   <draw:page draw:name="page1" draw:style-name="dp2" draw:master-page-name="Default">
+    <draw:frame draw:style-name="gr1" draw:text-style-name="P1" draw:layer="layout" svg:width="4.69cm" svg:height="0.776cm" svg:x="2.413cm" svg:y="2.272cm">
+     <draw:image xlink:href="" loext:mime-type="image/x-wmf">
+      <office:binary-data>183GmgAAAAAAAKAQwAIBCQAAAABwTAEACQAAAz0CAAACABwAAAAAAAUAAAAJAgAAAAAFAAAA
+       AgEBAAAABQAAAAEC////AAUAAAAuARgAAAAFAAAACwIAAAAABQAAAAwCwAKgEBIAAAAmBg8A
+       GgD/////AAAQAAAAwP///8D///9gEAAAgAIAAAsAAAAmBg8ADABNYXRoVHlwZQAAgAAcAAAA
+       +wKA/gAAAAAAAJABAQAAAAQCABBUaW1lcyBOZXcgUm9tYW4AdPEtAIlAg30gAIZ9IAdmwAQA
+       AAAtAQAACAAAADIKwAHCDwEAAAByeQgAAAAyCsABUA4BAAAAZHkIAAAAMgrAARgNAQAAAHJ5
+       CAAAADIKwAFDCgEAAABoeQgAAAAyCsABKQkBAAAAcnkIAAAAMgrAAdwDAQAAAGp5CAAAADIK
+       wAHwAQEAAABoeQgAAAAyCsABmgABAAAAaXkcAAAA+wIg/wAAAAAAAJABAQAAAAQCABBUaW1l
+       cyBOZXcgUm9tYW4AdPEtAIlAg30gAIZ9IAdmwAQAAAAtAQEABAAAAPABAAAIAAAAMgogAvsL
+       AQAAAGp5CAAAADIKIALnBwEAAABpeRwAAAD7AiD/AAAAAAAAkAEAAAAABAIAEFRpbWVzIE5l
+       dyBSb21hbgB08S0AiUCDfSAAhn0gB2bABAAAAC0BAAAEAAAA8AEBAAgAAAAyChQBRA8BAAAA
+       M3kIAAAAMgoUAQwIAQAAACp5HAAAAPsCgP4AAAAAAACQAQAAAAAEAgAQVGltZXMgTmV3IFJv
+       bWFuAHTxLQCJQIN9IACGfSAHZsAEAAAALQEBAAQAAADwAQAACAAAADIKwAHGDQEAAAApeQgA
+       AAAyCsABjgwBAAAAKHkIAAAAMgpOAYMKAQAAAIh5CAAAADIKwAHXCQEAAAApeQgAAAAyCsAB
+       nwgBAAAAKHkIAAAAMgrAAVoEAQAAAF15CAAAADIKwAH4AgEAAAB8eQgAAAAyCk4BMAIBAAAA
+       iHkIAAAAMgrAAVQBAQAAAHx5CAAAADIKwAEcAAEAAABbeRwAAAD7AoD+AAAAAAAAkAEBAAAC
+       BAIAEFN5bWJvbAAABQcK/CAAhn108S0AiUCDfSAAhn0gB2bABAAAAC0BAAAEAAAA8AEBAAgA
+       AAAyCsABAwsBAAAAZnkIAAAAMgrAAR8HAQAAAGZ5HAAAAPsCwP0AAAAAAACQAQAAAAIAAgAQ
+       U3ltYm9sAACsAgoAIACGfXTxLQCJQIN9IACGfSAHZsAEAAAALQEBAAQAAADwAQAACAAAADIK
+       SgJeBgEAAADyeRwAAAD7AoD+AAAAAAAAkAEAAAACAAIAEFN5bWJvbAAABQcK/SAAhn108S0A
+       iUCDfSAAhn0gB2bABAAAAC0BAAAEAAAA8AEBAAgAAAAyCsABJgUBAAAAPXkKAAAAJgYPAAoA
+       /////wEAAAAAABwAAAD7AhAABwAAAAAAvAIAAAAAAQICIlN5c3RlbQDAIAdmwAAACgAhAIoB
+       AAAAAAEAAACQ8y0ABAAAAC0BAQAEAAAA8AEAAAMAAAAAAA==
+      </office:binary-data>
+      <text:p/>
+     </draw:image>
+     <draw:image loext:mime-type="image/png">
+      <office:binary-data>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
+      </office:binary-data>
+     </draw:image>
+    </draw:frame>
+   </draw:page>
+  </office:drawing>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index ea237604bf4e..73bf57049128 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -75,6 +75,7 @@
 #include <stlpool.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/graphicmimetype.hxx>
 #include <vcl/pngread.hxx>
 #include <vcl/bitmapaccess.hxx>
 #include <vcl/dibtools.hxx>
@@ -169,6 +170,7 @@ public:
     void testTdf108926();
     void testTdf100065();
     void testTdf90626();
+    void testTdf114488();
 
     bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
     void testPatternImport();
@@ -243,6 +245,7 @@ public:
     CPPUNIT_TEST(testTdf108926);
     CPPUNIT_TEST(testTdf100065);
     CPPUNIT_TEST(testTdf90626);
+    CPPUNIT_TEST(testTdf114488);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2301,6 +2304,18 @@ void SdImportTest::testTdf90626()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf114488()
+{
+    // This doc has two images - one WMF and the other PNG (fallback image).
+    // When loading this doc, the WMF image should be prefered over the PNG image.
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odg/tdf114488.fodg"), FODG);
+    uno::Reference< beans::XPropertySet > xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
+    OUString sGraphicUrl;
+    xShape->getPropertyValue("GraphicURL") >>= sGraphicUrl;
+    OUString sMimeType(comphelper::GraphicMimeTypeHelper::GetMimeTypeForImageUrl(sGraphicUrl));
+    CPPUNIT_ASSERT_EQUAL(OUString("image/x-wmf"), sMimeType);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 0f46830130bfd139af35a787133b778b85c96b89
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Jan 18 18:05:59 2018 +0100

    Remove noop
    
    IsTableNode() is true when m_pTableCursor is not nullptr.
    So, GetCursor() is only called when it is nullptr.
    In turn, GetCursor() only does something if m_pTableCursor is not nullptr.
    
    This is so from the beginning (commit 84a3db80 from 2000 already has it).
    
    Change-Id: I258129fc1bab0e3e5591702af1158c1ec2579d8d
    Reviewed-on: https://gerrit.libreoffice.org/48144
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 3de36c61ad2d..e5a7728c9f19 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1215,9 +1215,6 @@ bool SwFEShell::UpdateTableStyleFormatting(SwTableNode *pTableNode,
 
     SwSelBoxes aBoxes;
 
-    if ( !IsTableMode() )       // if cursors are not current
-        GetCursor();
-
     // whole table or only current selection
     if( IsTableMode() )
         ::GetTableSelCrs( *this, aBoxes );
commit a86db7b2b6f7bc8125db5d9c87348d6a9591c872
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 18 20:49:13 2018 +0100

    sw: HTMLTable::m_pTopTable is always "this"
    
    Ever since commit cc144e5544a41acdc703f7d243ad1747b0a2b33d fix for
    i#76959 the pTopTable parameter of HTMLTable was always null.
    
    Simplify HTMLTable by removing dead code.
    
    Change-Id: Ie13313f54d6ee656e56a209bc29bcc77132de269

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index d3fdc714b5c7..8a52695029fc 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -433,7 +433,6 @@ class HTMLTable
     bool m_bPrcWidth;                 // width is declared in %
 
     SwHTMLParser *m_pParser;          // the current parser
-    HTMLTable *m_pTopTable;           // the table on the Top-Level
     std::unique_ptr<HTMLTableCnts> m_xParentContents;
 
     HTMLTableContext *m_pContext;    // the context of the table
@@ -518,7 +517,7 @@ public:
 
     bool m_bFirstCell;                // is there a cell created already?
 
-    HTMLTable(SwHTMLParser* pPars, HTMLTable *pTopTab,
+    HTMLTable(SwHTMLParser* pPars,
               bool bParHead, bool bHasParentSec,
               bool bHasToFly,
               const HTMLTableOptions& rOptions);
@@ -1015,7 +1014,7 @@ void HTMLTable::InitCtor(const HTMLTableOptions& rOptions)
     m_aDir = rOptions.aDir;
 }
 
-HTMLTable::HTMLTable(SwHTMLParser* pPars, HTMLTable *pTopTab,
+HTMLTable::HTMLTable(SwHTMLParser* pPars,
                      bool bParHead,
                      bool bHasParentSec, bool bHasToFlw,
                      const HTMLTableOptions& rOptions) :
@@ -1026,22 +1025,21 @@ HTMLTable::HTMLTable(SwHTMLParser* pPars, HTMLTable *pTopTab,
     m_nCellSpacing(rOptions.nCellSpacing),
     m_nBoxes( 1 ),
     m_pCaptionStartNode( nullptr ),
-    m_bTableAdjustOfTag( !pTopTab && rOptions.bTableAdjust ),
+    m_bTableAdjustOfTag( rOptions.bTableAdjust ),
     m_bIsParentHead( bParHead ),
     m_bHasParentSection( bHasParentSec ),
     m_bHasToFly( bHasToFlw ),
     m_bFixedCols( rOptions.nCols>0 ),
     m_bPrcWidth( rOptions.bPrcWidth ),
     m_pParser( pPars ),
-    m_pTopTable( pTopTab ? pTopTab : this ),
     m_nWidth( rOptions.nWidth ),
-    m_nHeight( pTopTab ? 0 : rOptions.nHeight ),
+    m_nHeight( rOptions.nHeight ),
     m_eTableAdjust( rOptions.eAdjust ),
     m_eVertOrientation( rOptions.eVertOri ),
     m_eFrame( rOptions.eFrame ),
     m_eRules( rOptions.eRules ),
     m_bTopCaption( false ),
-    m_bFirstCell( !pTopTab )
+    m_bFirstCell(true)
 {
     InitCtor(rOptions);
     m_pParser->RegisterHTMLTable(this);
@@ -1270,18 +1268,9 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
         if( !pBGBrushItem )
         {
             // If a cell spans multiple rows, a background to that row should be copied to the cell.
-            // If it's a table in a table and that cell goes over the whole height of that table,
-            // the row's background has to be copied to the cell as well,
-            // since the line is gonna be GC-ed (correctly).
-            if( nRowSpan > 1 || (this != m_pTopTable && nRowSpan==m_nRows) )
+            if (nRowSpan > 1)
             {
                 pBGBrushItem = m_aRows[nRow].GetBGBrush().get();
-                if( !pBGBrushItem && this != m_pTopTable )
-                {
-                    pBGBrushItem = GetBGBrush().get();
-                    if( !pBGBrushItem )
-                        pBGBrushItem = GetInhBGBrush().get();
-                }
             }
         }
 
@@ -1507,10 +1496,10 @@ SwTableBox *HTMLTable::NewTableBox( const SwStartNode *pStNd,
 {
     SwTableBox *pBox;
 
-    if (m_pTopTable->m_xBox1 && m_pTopTable->m_xBox1->GetSttNd() == pStNd)
+    if (m_xBox1 && m_xBox1->GetSttNd() == pStNd)
     {
         // If the StartNode is the StartNode of the initially created box, we take that box
-        pBox = m_pTopTable->m_xBox1.release();
+        pBox = const_cast<HTMLTable*>(this)->m_xBox1.release();
         pBox->SetUpper(pUpper);
     }
     else
@@ -1534,7 +1523,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
                                        sal_uInt16 nBottomRow, sal_uInt16 nRightCol )
 {
     SwTableLine *pLine;
-    if( this==m_pTopTable && !pUpper && 0==nTopRow )
+    if (!pUpper && 0 == nTopRow)
         pLine = (m_pSwTable->GetTabLines())[0];
     else
         pLine = new SwTableLine( m_pLineFrameFormatNoHeight ? m_pLineFrameFormatNoHeight
@@ -1544,20 +1533,11 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
     const HTMLTableRow& rTopRow = m_aRows[nTopRow];
     sal_uInt16 nRowHeight = rTopRow.GetHeight();
     const SvxBrushItem *pBGBrushItem = nullptr;
-    if( this == m_pTopTable || nTopRow>0 || nBottomRow<m_nRows )
+    if (nTopRow > 0 || nBottomRow < m_nRows)
     {
         // It doesn't make sense to set a color on a line,
         // if it's the outermost and simultaneously sole line of a table in a table
         pBGBrushItem = rTopRow.GetBGBrush().get();
-
-        if( !pBGBrushItem && this != m_pTopTable )
-        {
-            // A background that's set on a table in a table is set on the rows.
-            // It's the same for the background of the cell where that table is
-            pBGBrushItem = GetBGBrush().get();
-            if( !pBGBrushItem )
-                pBGBrushItem = GetInhBGBrush().get();
-        }
     }
     if( nTopRow==nBottomRow-1 && (nRowHeight || pBGBrushItem) )
     {
@@ -1795,7 +1775,7 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent,
 
     // The child table has to inherit the color of the cell it's contained in, if it doesn't have one
     const SvxBrushItem *pInhBG = pParent->GetCell(nRow, nCol).GetBGBrush().get();
-    if( !pInhBG && pParent != m_pTopTable &&
+    if( !pInhBG && pParent != this &&
         pParent->GetCell(nRow,nCol).GetRowSpan() == pParent->m_nRows )
     {
         // the whole surrounding table is a table in a table and consists only of a single line
@@ -2292,22 +2272,18 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
     OSL_ENSURE( m_nRows>0 && m_nCols>0 && m_nCurrentRow==m_nRows,
             "Was CloseTable not called?" );
 
-    OSL_ENSURE( (m_xLayoutInfo.get()==nullptr) == (this==m_pTopTable),
-            "Top-Table has no layout info or vice versa" );
+    OSL_ENSURE(m_xLayoutInfo.get() == nullptr, "Table already has layout info");
 
-    if( this==m_pTopTable )
-    {
-        // Calculate borders of the table and all contained tables
-        SetBorders();
+    // Calculate borders of the table and all contained tables
+    SetBorders();
 
-        // Step 1: needed layout structures are created (including tables in tables)
-        CreateLayoutInfo();
+    // Step 1: needed layout structures are created (including tables in tables)
+    CreateLayoutInfo();
 
-        // Step 2: the minimal and maximal column width is calculated
-        // (including tables in tables). Since we don't have boxes yet,
-        // we'll work on the start nodes
-        m_xLayoutInfo->AutoLayoutPass1();
-    }
+    // Step 2: the minimal and maximal column width is calculated
+    // (including tables in tables). Since we don't have boxes yet,
+    // we'll work on the start nodes
+    m_xLayoutInfo->AutoLayoutPass1();
 
     // Step 3: the actual column widths of this table are calculated (not tables in tables)
     // We need this now to decide if we need filler cells
@@ -2315,184 +2291,70 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
     m_xLayoutInfo->AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace,
                                   nAbsRightSpace, nInhAbsSpace );
 
-    if( this!=m_pTopTable )
+    // Set adjustment for the top table
+    sal_Int16 eHoriOri;
+    if (m_bForceFrame)
     {
-        // the right and left border of this table can be finally defined
-        if (m_xLayoutInfo->GetRelRightFill() == 0)
-        {
-            if( !m_bRightBorder )
-            {
-                // inherit left border of the outer table
-                if( m_bInheritedRightBorder )
-                {
-                    m_bRightBorder = true;
-                    m_aRightBorderLine = m_aInheritedRightBorderLine;
-                }
-            }
-            else
-            {
-                // Only set border if allowed
-                m_bRightBorder = m_bRightAllowed;
-            }
-        }
-
-        if( m_xLayoutInfo->GetRelLeftFill() == 0 &&
-            !m_aColumns[0].bLeftBorder &&
-            m_bInheritedLeftBorder )
-        {
-            // If applicable, inherit right border of outer table
-            m_aColumns[0].bLeftBorder = true;
-            m_aLeftBorderLine = m_aInheritedLeftBorderLine;
-        }
+        // The table should go in a text frame and it's narrower than the
+        // available space and not 100% wide. So it gets a border
+        eHoriOri = m_bPrcWidth ? text::HoriOrientation::FULL : text::HoriOrientation::LEFT;
     }
-
-    // Set adjustment for the top table
-    if( this==m_pTopTable )
+    else switch (m_eTableAdjust)
     {
-        sal_Int16 eHoriOri;
-        if( m_bForceFrame )
-        {
-            // The table should go in a text frame and it's narrower than the
-            // available space and not 100% wide. So it gets a border
-            eHoriOri = m_bPrcWidth ? text::HoriOrientation::FULL : text::HoriOrientation::LEFT;
-        }
-        else switch( m_eTableAdjust )
-        {
-            // The table either fits the page but shouldn't get a text frame,
-            // or it's wider than the page so it doesn't need a text frame
+        // The table either fits the page but shouldn't get a text frame,
+        // or it's wider than the page so it doesn't need a text frame
 
-        case SvxAdjust::Right:
-            // Don't be considerate of the right margin in right-adjusted tables
-            eHoriOri = text::HoriOrientation::RIGHT;
-            break;
-        case SvxAdjust::Center:
-            // Centred tables are not considerate of margins
-            eHoriOri = text::HoriOrientation::CENTER;
-            break;
-        case SvxAdjust::Left:
-        default:
-            // left-adjusted tables are only considerate of the left margin
-            eHoriOri = m_nLeftMargin ? text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::LEFT;
-            break;
-        }
-
-        // get the table format and adapt it
-        SwFrameFormat *pFrameFormat = m_pSwTable->GetFrameFormat();
-        pFrameFormat->SetFormatAttr( SwFormatHoriOrient(0,eHoriOri) );
-        if( text::HoriOrientation::LEFT_AND_WIDTH==eHoriOri )
-        {
-            OSL_ENSURE( m_nLeftMargin || m_nRightMargin,
-                    "There are still leftovers from relative margins" );
-
-            // The right margin will be ignored anyway.
-            SvxLRSpaceItem aLRItem( m_pSwTable->GetFrameFormat()->GetLRSpace() );
-            aLRItem.SetLeft( m_nLeftMargin );
-            aLRItem.SetRight( m_nRightMargin );
-            pFrameFormat->SetFormatAttr( aLRItem );
-        }
-
-        if( m_bPrcWidth && text::HoriOrientation::FULL!=eHoriOri )
-        {
-            pFrameFormat->LockModify();
-            SwFormatFrameSize aFrameSize( pFrameFormat->GetFrameSize() );
-            aFrameSize.SetWidthPercent( static_cast<sal_uInt8>(m_nWidth) );
-            pFrameFormat->SetFormatAttr( aFrameSize );
-            pFrameFormat->UnlockModify();
-        }
+    case SvxAdjust::Right:
+        // Don't be considerate of the right margin in right-adjusted tables
+        eHoriOri = text::HoriOrientation::RIGHT;
+        break;
+    case SvxAdjust::Center:
+        // Centred tables are not considerate of margins
+        eHoriOri = text::HoriOrientation::CENTER;
+        break;
+    case SvxAdjust::Left:
+    default:
+        // left-adjusted tables are only considerate of the left margin
+        eHoriOri = m_nLeftMargin ? text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::LEFT;
+        break;
     }
 
-    // get the default line and box format
-    if( this==m_pTopTable )
+    // get the table format and adapt it
+    SwFrameFormat *pFrameFormat = m_pSwTable->GetFrameFormat();
+    pFrameFormat->SetFormatAttr( SwFormatHoriOrient(0, eHoriOri) );
+    if (text::HoriOrientation::LEFT_AND_WIDTH == eHoriOri)
     {
-        // remember the first box and unlist it from the first row
-        SwTableLine *pLine1 = (m_pSwTable->GetTabLines())[0];
-        m_xBox1.reset((pLine1->GetTabBoxes())[0]);
-        pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin());
+        OSL_ENSURE( m_nLeftMargin || m_nRightMargin,
+                "There are still leftovers from relative margins" );
 
-        m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat());
-        m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_xBox1->GetFrameFormat());
-    }
-    else
-    {
-        m_pLineFormat = m_pTopTable->m_pLineFormat;
-        m_pBoxFormat = m_pTopTable->m_pBoxFormat;
+        // The right margin will be ignored anyway.
+        SvxLRSpaceItem aLRItem( m_pSwTable->GetFrameFormat()->GetLRSpace() );
+        aLRItem.SetLeft( m_nLeftMargin );
+        aLRItem.SetRight( m_nRightMargin );
+        pFrameFormat->SetFormatAttr( aLRItem );
     }
 
-    // If applicable, add filler cells for tables in tables
-    if( this != m_pTopTable &&
-        ( m_xLayoutInfo->GetRelLeftFill() > 0  ||
-          m_xLayoutInfo->GetRelRightFill() > 0 ) )
+    if (m_bPrcWidth && text::HoriOrientation::FULL != eHoriOri)
     {
-        OSL_ENSURE( pBox, "No TableBox for table in table" );
-
-        SwTableLines& rLines = pBox->GetTabLines();
-
-        // first, we need a new table line in the box
-        SwTableLine *pLine =
-            new SwTableLine( m_pLineFrameFormatNoHeight ? m_pLineFrameFormatNoHeight
-                                                 : m_pLineFormat, 0, pBox );
-        rLines.push_back( pLine );
-
-        // Check that we have a format without height
-        if( !m_pLineFrameFormatNoHeight )
-        {
-            // Otherwise, we need to remove the height from the attributes
-            // and remember that format
-            m_pLineFrameFormatNoHeight = static_cast<SwTableLineFormat*>(pLine->ClaimFrameFormat());
-
-            ResetLineFrameFormatAttrs( m_pLineFrameFormatNoHeight );
-        }
-
-        SwTableBoxes& rBoxes = pLine->GetTabBoxes();
-        SwTableBox *pNewBox;
-
-        // If applicable, add a cell to the left
-        if (m_xLayoutInfo->GetRelLeftFill() > 0)
-        {
-            // pPrevStNd is the predecessor start node of the table
-            // We'll add the filler node just behind
-            m_pPrevStartNode = m_pParser->InsertTableSection( m_pPrevStartNode );
-
-            pNewBox = NewTableBox( m_pPrevStartNode, pLine );
-            rBoxes.push_back( pNewBox );
-            FixFillerFrameFormat( pNewBox, false );
-            m_xLayoutInfo->SetLeftFillerBox(pNewBox);
-        }
-
-        // modify the table now
-        pNewBox = new SwTableBox( m_pBoxFormat, 0, pLine );
-        rBoxes.push_back( pNewBox );
-
-        SwFrameFormat *pFrameFormat = pNewBox->ClaimFrameFormat();
-        pFrameFormat->ResetFormatAttr( RES_BOX );
-        pFrameFormat->ResetFormatAttr( RES_BACKGROUND );
-        pFrameFormat->ResetFormatAttr( RES_VERT_ORIENT );
-        pFrameFormat->ResetFormatAttr( RES_BOXATR_FORMAT );
-
-        MakeTable_( pNewBox );
+        pFrameFormat->LockModify();
+        SwFormatFrameSize aFrameSize( pFrameFormat->GetFrameSize() );
+        aFrameSize.SetWidthPercent( static_cast<sal_uInt8>(m_nWidth) );
+        pFrameFormat->SetFormatAttr( aFrameSize );
+        pFrameFormat->UnlockModify();
+    }
 
-        // and add a cell to the right if applicable
-        if (m_xLayoutInfo->GetRelRightFill() > 0)
-        {
-            const SwStartNode *pStNd =
-                GetPrevBoxStartNode( USHRT_MAX, USHRT_MAX );
-            pStNd = m_pParser->InsertTableSection( pStNd );
+    // get the default line and box format
+    // remember the first box and unlist it from the first row
+    SwTableLine *pLine1 = (m_pSwTable->GetTabLines())[0];
+    m_xBox1.reset((pLine1->GetTabBoxes())[0]);
+    pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin());
 
-            pNewBox = NewTableBox( pStNd, pLine );
-            rBoxes.push_back( pNewBox );
+    m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat());
+    m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_xBox1->GetFrameFormat());
 
-            FixFillerFrameFormat( pNewBox, true );
-            m_xLayoutInfo->SetRightFillerBox( pNewBox );
-        }
-    }
-    else
-    {
-        MakeTable_( pBox );
-    }
+    MakeTable_( pBox );
 
     // Finally, we'll do a garbage collection for the top level table
-    if( this!=m_pTopTable )
-        return;
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list