[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/inc sc/qa sc/source
Szabolcs Toth (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 6 15:59:01 UTC 2021
sc/inc/detfunc.hxx | 5 +-
sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 16 +++++++++
sc/source/core/tool/detfunc.cxx | 14 ++++++--
sc/source/filter/xcl97/xcl97rec.cxx | 17 ++++++++++
5 files changed, 47 insertions(+), 5 deletions(-)
New commits:
commit 095035575d44bed6d6a6cad3f7fbb5bbd63eceb5
Author: Szabolcs Toth <szabolcs450 at gmail.com>
AuthorDate: Tue Sep 1 13:46:38 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Jan 6 16:58:26 2021 +0100
tdf#133688 tdf#125414 XLSX: don't export tracer arrows
(see Tools->Detective) as plain shapes.
Co-authored-by: Balázs Regényi
Change-Id: I920445637a6be12169ae7d70295e4460d7f9b26b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101845
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 14b40ec7be7ca8315848034591e3c3a246d5a8dd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108893
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx
index 28394627e913..b8d1d2c0bc81 100644
--- a/sc/inc/detfunc.hxx
+++ b/sc/inc/detfunc.hxx
@@ -42,10 +42,11 @@ enum ScDetectiveObjType
SC_DETOBJ_ARROW,
SC_DETOBJ_FROMOTHERTAB,
SC_DETOBJ_TOOTHERTAB,
- SC_DETOBJ_CIRCLE
+ SC_DETOBJ_CIRCLE,
+ SC_DETOBJ_RECTANGLE
};
-class ScDetectiveFunc
+class SC_DLLPUBLIC ScDetectiveFunc
{
static Color nArrowColor;
static Color nErrorColor;
diff --git a/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods
new file mode 100644
index 000000000000..3dfdee77f143
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 38231f8dab98..56f38a3697a9 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -262,6 +262,7 @@ public:
void testHeaderFontStyleXLSX();
void testTdf135828_Shape_Rect();
void testTdf123353();
+ void testTdf133688_precedents();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -418,6 +419,7 @@ public:
CPPUNIT_TEST(testHeaderFontStyleXLSX);
CPPUNIT_TEST(testTdf135828_Shape_Rect);
CPPUNIT_TEST(testTdf123353);
+ CPPUNIT_TEST(testTdf133688_precedents);
CPPUNIT_TEST_SUITE_END();
@@ -5294,6 +5296,20 @@ void ScExportTest::testTdf123353()
xShell->DoClose();
}
+void ScExportTest::testTdf133688_precedents()
+{
+ // tdf#133688 Check that we do not export detective shapes.
+ ScDocShellRef xShell = loadDoc("tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS);
+ CPPUNIT_ASSERT(xShell.is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+ xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
+ CPPUNIT_ASSERT(pDrawing);
+
+ // We do not export any shapes.
+ assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 4923a2f68345..3f0419364bac 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1605,16 +1605,24 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject,
if ( nObjColor == GetErrorColor() && nObjColor != GetArrowColor() )
rRedLine = true;
}
- else if ( dynamic_cast<const SdrCircObj*>( pObject) != nullptr )
+ else if (dynamic_cast<const SdrCircObj*>(pObject) != nullptr)
{
- if ( bValidStart )
+ if (bValidStart)
{
// cell position is returned in rPosition
-
rPosition = pData->maStart;
eType = SC_DETOBJ_CIRCLE;
}
}
+ else if (dynamic_cast<const SdrRectObj*>(pObject) != nullptr)
+ {
+ if (bValidStart)
+ {
+ // cell position is returned in rPosition
+ rPosition = pData->maStart;
+ eType = SC_DETOBJ_RECTANGLE;
+ }
+ }
}
}
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 6c05b87e871c..215c38055cd7 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -68,6 +68,7 @@
#include <oox/export/shapes.hxx>
#include <oox/export/utils.hxx>
#include <oox/export/vmlexport.hxx>
+#include <detfunc.hxx>
#include <memory>
@@ -1094,6 +1095,7 @@ ExcBof8_Base::ExcBof8_Base()
nRupBuild = 0x0dbb;
nRupYear = 0x07cc;
}
+
void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& rShape, SCTAB nTab )
{
sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
@@ -1273,6 +1275,21 @@ void XclObjAny::SaveXml( XclExpXmlStream& rStrm )
if( !mxShape.is() || mxShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
return;
+ // Do not output any of the detective shapes and validation circles.
+ SdrObject* pObject = GetSdrObjectFromXShape(mxShape);
+ if (pObject)
+ {
+ ScDocument& rDoc = rStrm.GetRoot().GetDoc();
+ ScDetectiveFunc aDetFunc(&rDoc, mnScTab);
+ ScAddress aPosition;
+ ScRange aSourceRange;
+ bool bRedLine;
+ ScDetectiveObjType eObjType = aDetFunc.GetDetectiveObjectType(pObject, mnScTab, aPosition, aSourceRange, bRedLine);
+
+ if (eObjType != SC_DETOBJ_NONE)
+ return;
+ }
+
sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream();
ShapeExport aDML(XML_xdr, pDrawing, nullptr, &rStrm, drawingml::DOCUMENT_XLSX);
More information about the Libreoffice-commits
mailing list