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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 14 09:03:03 UTC 2018


 oox/source/vml/vmlformatting.cxx          |   11 +++++++++--
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |    2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit ac43eb0fc9e19178257b601ba12b196625d696fe
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 14 08:28:51 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Nov 14 10:02:40 2018 +0100

    Map VML shadow more properly to css::table::ShadowFormat
    
    For one, CppunitTest_sw_ooxmlexport6 failed under
    -fsanitize=implicit-signed-integer-truncation when passing a negative
    ShadowFormat.ShadowWidth into a sal_uInt16 SvxShadowItem (see below).
    
    Fixing the mapping from VML shadow to ShadowFormat in
    ShadowModel::pushToPropMap caused ShadowModel::pushToPropMap to fail again,
    however, testing against 57811035 in testOuterShdw
    (sw/qa/extras/ooxmlexport/ooxmlexport6.cxx).
    fa9d574ae1656b64670fbbac64ddd85461698149 "Code changes for fdo#74107:File
    Corruption - Issue with outerShdw" doesn't explain how that value came about, so
    assume that it was just whatever value happened to be observed in LO at that
    time, and now adjust it accordingly.  And, for another, opening
    sw/qa/extras/ooxmlexport/data/testOuterShdw.docx in LO now produces a green bar
    with red shadow at the top of the first page that better resembles the original.
    
    > editeng/source/items/frmitems.cxx:1154:18: runtime error: implicit conversion from type 'long' of value -1160 (64-bit, signed) to type 'sal_uInt16' (aka 'unsigned short') changed the value to 64376 (16-bit, unsigned)
    >  #0 in SvxShadowItem::PutValue(com::sun::star::uno::Any const&, unsigned char) at editeng/source/items/frmitems.cxx:1154:18 (instdir/program/libeditenglo.so +0x16716ea)
    >  #1 in BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet&, SfxItemSet const&, bool&) at sw/source/core/unocore/unoframe.cxx:759:48 (instdir/program/libswlo.so +0xba32230)
    >  #2 in SwFrameProperties_Impl::AnyToItemSet(SwDoc*, SfxItemSet&, SfxItemSet&, bool&) at sw/source/core/unocore/unoframe.cxx:1004:19 (instdir/program/libswlo.so +0xba3cbb9)
    >  #3 in SwXFrame::attachToRange(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unoframe.cxx:2665:20 (instdir/program/libswlo.so +0xba78d71)
    >  #4 in SwXFrame::attach(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unoframe.cxx:3003:9 (instdir/program/libswlo.so +0xba877fa)
    >  #5 in SwXTextFrame::attach(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unoframe.cxx:3242:15 (instdir/program/libswlo.so +0xba926a2)
    >  #6 in SwXText::insertTextContent(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, unsigned char) at sw/source/core/unocore/unotext.cxx:619:15 (instdir/program/libswlo.so +0xc2dc17f)
    >  #7 in writerfilter::dmapper::DomainMapper_Impl::PushShapeContext(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/DomainMapper_Impl.cxx:2330:30 (instdir/program/libwriterfilterlo.so +0x14d2953)
    >  #8 in writerfilter::dmapper::DomainMapper::lcl_startShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/DomainMapper.cxx:2964:18 (instdir/program/libwriterfilterlo.so +0x132c46f)
    >  #9 in writerfilter::LoggedStream::startShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/LoggedResources.cxx:151:5 (instdir/program/libwriterfilterlo.so +0x1763e70)
    >  #10 in writerfilter::ooxml::OOXMLFastContextHandlerShape::sendShape(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1678:27 (instdir/program/libwriterfilterlo.so +0x1ad7fba)
    >  #11 in writerfilter::ooxml::OOXMLFastContextHandlerWrapper::lcl_createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1917:63 (instdir/program/libwriterfilterlo.so +0x1ae026e)
    >  #12 in writerfilter::ooxml::OOXMLFastContextHandler::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:208:21 (instdir/program/libwriterfilterlo.so +0x1aa90d7)
    >  #13 in non-virtual thunk to writerfilter::ooxml::OOXMLFastContextHandler::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx (instdir/program/libwriterfilterlo.so +0x1aa9378)
    >  #14 in (anonymous namespace)::Entity::startElement((anonymous namespace)::Event const*) at sax/source/fastparser/fastparser.cxx:439:44 (instdir/program/libexpwraplo.so +0x24df4c)
    >  #15 in sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, unsigned char const**) at sax/source/fastparser/fastparser.cxx:1254:21 (instdir/program/libexpwraplo.so +0x249499)
    >  #16 in (anonymous namespace)::call_callbackStartElement(void*, unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, int, unsigned char const**) at sax/source/fastparser/fastparser.cxx:310:18 (instdir/program/libexpwraplo.so +0x240fee)
    >  #17 in xmlParseStartTag2 at workdir/UnpackedTarball/libxml2/parser.c:9583:6 (instdir/program/libxml2.so.2 +0x6f9027)
    >  #18 in xmlParseTryOrFinish at workdir/UnpackedTarball/libxml2/parser.c:11342:14 (instdir/program/libxml2.so.2 +0x7300dc)
    >  #19 in xmlParseChunk__internal_alias at workdir/UnpackedTarball/libxml2/parser.c:12244:13 (instdir/program/libxml2.so.2 +0x72426a)
    >  #20 in sax_fastparser::FastSaxParserImpl::parse() at sax/source/fastparser/fastparser.cxx:1081:25 (instdir/program/libexpwraplo.so +0x23e8e7)
    >  #21 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:870:9 (instdir/program/libexpwraplo.so +0x237c3b)
    >  #22 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:1377:13 (instdir/program/libexpwraplo.so +0x2528eb)
    >  #23 in writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:503:22 (instdir/program/libwriterfilterlo.so +0x1a6a8d7)
    >  #24 in WriterFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/WriterFilter.cxx:186:24 (instdir/program/libwriterfilterlo.so +0x1a272bb)
    >  #25 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2251:34 (instdir/program/libsfxlo.so +0x38d811f)
    >  #26 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:772:23 (instdir/program/libsfxlo.so +0x38a1299)
    >  #27 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1795:36 (instdir/program/libsfxlo.so +0x3a4372e)
    >  #28 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) at sfx2/source/view/frmload.cxx:688:28 (instdir/program/libsfxlo.so +0x40c49f0)
    >  #29 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1149:37 (instdir/program/libfwklo.so +0x15212f1)
    >  #30 in framework::LoadEnv::startLoading() at framework/source/loadenv/loadenv.cxx:383:20 (instdir/program/libfwklo.so +0x1511cd6)
    >  #31 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/loadenv/loadenv.cxx:169:14 (instdir/program/libfwklo.so +0x150d988)
    >  #32 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:619:12 (instdir/program/libfwklo.so +0x16705ce)
    >  #33 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx (instdir/program/libfwklo.so +0x16707da)
    >  #34 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:50:60 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x8f1f6)
    >  #35 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:762:23 (workdir/LinkTarget/CppunitTest/libtest_sw_ooxmlexport6.so +0x2460b1)
    >  #36 in SwModelTestBase::load(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:717:16 (workdir/LinkTarget/CppunitTest/libtest_sw_ooxmlexport6.so +0x2449d6)
    >  #37 in SwModelTestBase::executeImportTest(char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:264:13 (workdir/LinkTarget/CppunitTest/libtest_sw_ooxmlexport6.so +0x2440bf)
    >  #38 in testOuterShdw::Import() at sw/qa/extras/ooxmlexport/ooxmlexport6.cxx:924:1 (workdir/LinkTarget/CppunitTest/libtest_sw_ooxmlexport6.so +0x33cf2d)
    [...]
    
    Change-Id: Ib26db2f175192c8756f825128fc5b852fcc24abf
    Reviewed-on: https://gerrit.libreoffice.org/63355
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 0dc6a766fee9..c215cc577c7b 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -16,6 +16,11 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
+
+#include <sal/config.h>
+
+#include <cstdlib>
+
 #include <oox/vml/vmlformatting.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
@@ -873,9 +878,11 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper&
 
     table::ShadowFormat aFormat;
     aFormat.Color = sal_Int32(aColor.getColor(rGraphicHelper));
-    aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
+    aFormat.Location = nOffsetX < 0
+        ? nOffsetY < 0 ? table::ShadowLocation_TOP_LEFT : table::ShadowLocation_BOTTOM_LEFT
+        : nOffsetY < 0 ? table::ShadowLocation_TOP_RIGHT : table::ShadowLocation_BOTTOM_RIGHT;
     // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet().
-    aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2);
+    aFormat.ShadowWidth = ((std::abs(nOffsetX) + std::abs(nOffsetY)) / 2);
     rPropMap.setProperty(PROP_ShadowFormat, aFormat);
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index fecd52d82737..7547d5a4f1c4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -926,7 +926,7 @@ DECLARE_OOXMLEXPORT_TEST(testOuterShdw,"testOuterShdw.docx")
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     if (!pXmlDoc)
         return;
-    assertXPath(pXmlDoc, "//mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "57811035");
+    assertXPath(pXmlDoc, "//mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "1041400");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")


More information about the Libreoffice-commits mailing list