Revert "tdf#135843 Implement inside horizontal vertical borders."

This reverts commit 90f19b66d81b0a4958cacc40d2be0516f281d702.

Reason for revert: See tdf#147766. Reverting in 7.3 branch only

Change-Id: Ibda51d5cf4544383bdeb7896e1be31de759575a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131129
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/oox/inc/drawingml/table/tablecell.hxx b/oox/inc/drawingml/table/tablecell.hxx
index 988b0d0..d6e91da 100644
--- a/oox/inc/drawingml/table/tablecell.hxx
+++ b/oox/inc/drawingml/table/tablecell.hxx
@@ -82,8 +82,6 @@ private:
    oox::drawingml::LineProperties  maLinePropertiesRight;
    oox::drawingml::LineProperties  maLinePropertiesTop;
    oox::drawingml::LineProperties  maLinePropertiesBottom;
    oox::drawingml::LineProperties  maLinePropertiesInsideH;
    oox::drawingml::LineProperties  maLinePropertiesInsideV;
    oox::drawingml::LineProperties  maLinePropertiesTopLeftToBottomRight;
    oox::drawingml::LineProperties  maLinePropertiesBottomLeftToTopRight;

diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 15ab063..e5ab337 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -81,14 +81,6 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
        aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
        aBorderLine.LineDistance = 0;
    }
    else
    {
        aBorderLine.Color = sal_Int32( COL_AUTO );
        aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
        aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
        aBorderLine.LineWidth = 12700;
        aBorderLine.LineDistance = 0;
    }

    if ( rLineProperties.moPresetDash.has() )
    {
@@ -158,16 +150,9 @@ static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase,
                          oox::drawingml::LineProperties& rRightBorder,
                          oox::drawingml::LineProperties& rTopBorder,
                          oox::drawingml::LineProperties& rBottomBorder,
                          oox::drawingml::LineProperties& rInsideHBorder,
                          oox::drawingml::LineProperties& rInsideVBorder,
                          oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
                          oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
                          TableStylePart& rTableStylePart,
                          bool bIsWholeTable = false,
                          sal_Int32 nCol = 0,
                          sal_Int32 nMaxCol = 0,
                          sal_Int32 nRow = 0,
                          sal_Int32 nMaxRow = 0)
                          TableStylePart& rTableStylePart )
{
    ::oox::drawingml::FillPropertiesPtr& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() );
    if ( rPartFillPropertiesPtr )
@@ -184,35 +169,12 @@ static void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase,
        }
    }

    // Left, right, top and bottom side of the whole table should be mean outer frame of the whole table.
    // Without this check it means left top right and bottom of whole cells of whole table.
    if (bIsWholeTable)
    {
        if (nCol == 0)
            applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
        if (nCol == nMaxCol)
            applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
        if (nRow == 0)
            applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
        if (nRow == nMaxRow)
            applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );

        applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
    }
    else
    {
        applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder );
        applyBorder( rFilterBase, rTableStylePart, XML_insideV, rInsideVBorder );
    }
    applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
    applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder );
    applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
    applyBorder( rFilterBase, rTableStylePart, XML_bottom, rBottomBorder );
    applyBorder( rFilterBase, rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
    applyBorder( rFilterBase, rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );

    aTextCharProps.maLatinFont = rTableStylePart.getLatinFont();
    aTextCharProps.maAsianFont = rTableStylePart.getAsianFont();
@@ -271,8 +233,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
    oox::drawingml::LineProperties aLinePropertiesRight;
    oox::drawingml::LineProperties aLinePropertiesTop;
    oox::drawingml::LineProperties aLinePropertiesBottom;
    oox::drawingml::LineProperties aLinePropertiesInsideH;
    oox::drawingml::LineProperties aLinePropertiesInsideV;
    oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight;
    oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight;

@@ -281,16 +241,9 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
        aLinePropertiesRight,
        aLinePropertiesTop,
        aLinePropertiesBottom,
        aLinePropertiesInsideH,
        aLinePropertiesInsideV,
        aLinePropertiesTopLeftToBottomRight,
        aLinePropertiesBottomLeftToTopRight,
        rTable.getWholeTbl(),
        true,
        nColumn,
        nMaxColumn,
        nRow,
        nMaxRow );
        rTable.getWholeTbl() );

    if ( rProperties.isFirstRow() && ( nRow == 0 ) )
    {
@@ -299,8 +252,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getFirstRow() );
@@ -312,8 +263,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getLastRow() );
@@ -325,8 +274,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getFirstCol() );
@@ -338,8 +285,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getLastCol() );
@@ -361,8 +306,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
                    aLinePropertiesRight,
                    aLinePropertiesTop,
                    aLinePropertiesBottom,
                    aLinePropertiesInsideH,
                    aLinePropertiesInsideV,
                    aLinePropertiesTopLeftToBottomRight,
                    aLinePropertiesBottomLeftToTopRight,
                    rTable.getBand2H() );
@@ -374,8 +317,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
                    aLinePropertiesRight,
                    aLinePropertiesTop,
                    aLinePropertiesBottom,
                    aLinePropertiesInsideH,
                    aLinePropertiesInsideV,
                    aLinePropertiesTopLeftToBottomRight,
                    aLinePropertiesBottomLeftToTopRight,
                    rTable.getBand1H() );
@@ -389,8 +330,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getNwCell() );
@@ -402,8 +341,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getSwCell() );
@@ -415,8 +352,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getNeCell() );
@@ -428,8 +363,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
            aLinePropertiesRight,
            aLinePropertiesTop,
            aLinePropertiesBottom,
            aLinePropertiesInsideH,
            aLinePropertiesInsideV,
            aLinePropertiesTopLeftToBottomRight,
            aLinePropertiesBottomLeftToTopRight,
            rTable.getSeCell() );
@@ -451,8 +384,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
                    aLinePropertiesRight,
                    aLinePropertiesTop,
                    aLinePropertiesBottom,
                    aLinePropertiesInsideH,
                    aLinePropertiesInsideV,
                    aLinePropertiesTopLeftToBottomRight,
                    aLinePropertiesBottomLeftToTopRight,
                    rTable.getBand2V() );
@@ -464,8 +395,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
                    aLinePropertiesRight,
                    aLinePropertiesTop,
                    aLinePropertiesBottom,
                    aLinePropertiesInsideH,
                    aLinePropertiesInsideV,
                    aLinePropertiesTopLeftToBottomRight,
                    aLinePropertiesBottomLeftToTopRight,
                    rTable.getBand1V() );
@@ -476,11 +405,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
    aLinePropertiesRight.assignUsed( maLinePropertiesRight );
    aLinePropertiesTop.assignUsed( maLinePropertiesTop );
    aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
    aLinePropertiesInsideH.assignUsed( maLinePropertiesInsideH );
    aLinePropertiesInsideV.assignUsed( maLinePropertiesInsideV );
    aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
    aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );

    applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
    applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );
    applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder );
@@ -488,28 +414,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
    applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
    applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );

    // Convert insideH to Top and Bottom, InsideV to Left and Right. Exclude the outer borders.
    if(nRow != 0)
    {
        aLinePropertiesInsideH.assignUsed( aLinePropertiesTop );
        applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideH, PROP_TopBorder );
    }
    if(nRow != nMaxRow)
    {
        aLinePropertiesInsideH.assignUsed( aLinePropertiesBottom );
        applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideH, PROP_BottomBorder );
    }
    if(nColumn != 0)
    {
        aLinePropertiesInsideV.assignUsed( aLinePropertiesLeft );
        applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideV, PROP_LeftBorder );
    }
    if(nColumn != nMaxColumn)
    {
        aLinePropertiesInsideV.assignUsed( aLinePropertiesRight );
        applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesInsideV, PROP_RightBorder );
    }

    if (rProperties.getBgColor().isUsed() && !maFillProperties.maFillColor.isUsed() && maFillProperties.moFillType.get() == XML_noFill)
    {
        maFillProperties.moFillType = XML_solidFill;
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 2c45004..1622b8f 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -143,8 +143,7 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas
    {
        sal_Int32 nColumn = 0;
        sal_Int32 nColumnSize = tableRow.getTableCells().size();
        sal_Int32 nRemovedColumn = 0;
        sal_Int32 nRemovedRow = 0;
        sal_Int32 nRemovedColumn = 0; //

        for (sal_Int32 nColIndex = 0; nColIndex < nColumnSize; nColIndex++)
        {
@@ -170,9 +169,6 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas
                        // props with pushToXCell.
                        bMerged = true;
                    }

                    if (rTableCell.getRowSpan() > 1)
                        nRemovedRow = (rTableCell.getRowSpan() - 1);
                }

                Reference<XCellRange> xCellRange(xTable, UNO_QUERY_THROW);
@@ -194,17 +190,11 @@ void TableProperties::pushToPropSet(const ::oox::core::XmlFilterBase& rFilterBas
                else
                    xCell = xCellRange->getCellByPosition(nColumn, nRow);


                sal_Int32 nMaxCol = tableRow.getTableCells().size() - nRemovedColumn - 1;
                sal_Int32 nMaxRow =  mvTableRows.size() - nRemovedRow - 1;

                rTableCell.pushToXCell(rFilterBase, pMasterTextListStyle, xCell, *this, rTableStyle,
                                       nColumn, nMaxCol, nRow, nMaxRow);

                                       nColumn, tableRow.getTableCells().size() - 1, nRow,
                                       mvTableRows.size() - 1);
                if (bMerged)
                    nColumn += nRemovedColumn;

                nRemovedRow = 0;
            }
            ++nColumn;
        }
diff --git a/sd/qa/unit/data/pptx/bnc480256-2.pptx b/sd/qa/unit/data/pptx/bnc480256-2.pptx
deleted file mode 100644
index a622d77..0000000
--- a/sd/qa/unit/data/pptx/bnc480256-2.pptx
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf135843_insideH.pptx b/sd/qa/unit/data/pptx/tdf135843_insideH.pptx
deleted file mode 100644
index 9b7864a..0000000
--- a/sd/qa/unit/data/pptx/tdf135843_insideH.pptx
+++ /dev/null
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c7b508d..e49892d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1474,7 +1474,7 @@ void SdImportTest::testTableBorderLineStyle()
        xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
        xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
        xCell->getPropertyValue("TopBorder") >>= aBorderLine;
        if (aBorderLine.Color != -1) {
        if (aBorderLine.LineWidth > 0) {
            CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle);
        }
    }
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index f34e2fb..e4dfe0e 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -253,44 +253,6 @@ void SdLayoutTest::tdf143258_testTbRlLayout()

CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest);

CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf135843_InsideHBorders)
{
    sd::DrawDocShellRef xDocShRef = loadURL(
        m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf135843_insideH.pptx"), PPTX);

    std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
    MetafileXmlDump dumper;

    xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
    CPPUNIT_ASSERT(pXmlDoc);
    // Without the fix, the test fails with:
    //- Expected: 34
    //- Actual  : 36
    // We shouldn't see two vertical borders inside the table on ui.

    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push", 34);
    xDocShRef->DoClose();
}

CPPUNIT_TEST_FIXTURE(SdLayoutTest, testBnc480256)
{
    sd::DrawDocShellRef xDocShRef
        = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/bnc480256-2.pptx"), PPTX);

    std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
    MetafileXmlDump dumper;

    xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
    CPPUNIT_ASSERT(pXmlDoc);
    // Without the fix, the test fails with:
    //- Expected: #ff0000
    //- Actual  : #ffffff
    // We should see the red vertical border inside the table.

    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[8]/linecolor[1]", "color", "#ff0000");
    xDocShRef->DoClose();
}

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */