diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/picture_colormode_black_white.odt | bin | 0 -> 32725 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/picture_colormode_grayscale.docx | bin | 0 -> 36515 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/picture_colormode_watermark.odt | bin | 0 -> 32345 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 30 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 19 |
5 files changed, 47 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/picture_colormode_black_white.odt b/sw/qa/extras/ooxmlexport/data/picture_colormode_black_white.odt Binary files differnew file mode 100644 index 000000000000..b2166bdd36ce --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/picture_colormode_black_white.odt diff --git a/sw/qa/extras/ooxmlexport/data/picture_colormode_grayscale.docx b/sw/qa/extras/ooxmlexport/data/picture_colormode_grayscale.docx Binary files differnew file mode 100644 index 000000000000..2bc6458eda50 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/picture_colormode_grayscale.docx diff --git a/sw/qa/extras/ooxmlexport/data/picture_colormode_watermark.odt b/sw/qa/extras/ooxmlexport/data/picture_colormode_watermark.odt Binary files differnew file mode 100644 index 000000000000..70dd5e9089e2 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/picture_colormode_watermark.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 6dec1e137b11..03afe283e368 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -948,6 +948,36 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength()); } +DECLARE_OOXMLEXPORT_TEST(testPictureColormodeGrayscale, "picture_colormode_grayscale.docx") +{ + // THe problem was that the grayscale was not exported + xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:grayscl", 1); +} + +DECLARE_OOXMLEXPORT_TEST(testPictureColormodeBlackWhite, "picture_colormode_black_white.odt") +{ + xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:biLevel", "thresh", "50000"); +} + +DECLARE_OOXMLEXPORT_TEST(testPictureColormodeWatermark, "picture_colormode_watermark.odt") +{ + xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "bright", "50000"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "contrast", "-70000"); +} + + DECLARE_OOXMLEXPORT_TEST(testExportShadow, "bnc637947.odt") { // The problem was that shadows of shapes from non-OOXML origin were not exported to DrawingML diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dcce02f40a02..59027ee1c173 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4192,13 +4192,28 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size completely discarding it. */ if ( aRelId.isEmpty() ) - m_pSerializer->singleElementNS( XML_a, XML_blip, + m_pSerializer->startElementNS( XML_a, XML_blip, FSEND ); else - m_pSerializer->singleElementNS( XML_a, XML_blip, + m_pSerializer->startElementNS( XML_a, XML_blip, FSNS( XML_r, nImageType ), aRelId.getStr(), FSEND ); + pItem = 0; + sal_uInt32 nMode = GRAPHICDRAWMODE_STANDARD; + + if ( pGrfNode && SfxItemState::SET == pGrfNode->GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE, true, &pItem)) + { + nMode = static_cast<const SfxEnumItem*>(pItem)->GetValue(); + if (nMode == GRAPHICDRAWMODE_GREYS) + m_pSerializer->singleElementNS (XML_a, XML_grayscl, FSEND); + else if (nMode == GRAPHICDRAWMODE_MONO) //black/white has a 0,5 threshold in LibreOffice + m_pSerializer->singleElementNS (XML_a, XML_biLevel, XML_thresh, OString::number(50000), FSEND); + else if (nMode == GRAPHICDRAWMODE_WATERMARK) //watermark has a brightness/luminance of 0,5 and contrast of -0.7 in LibreOffice + m_pSerializer->singleElementNS( XML_a, XML_lum, XML_bright, OString::number(50000), XML_contrast, OString::number(-70000), FSEND ); + } + m_pSerializer->endElementNS( XML_a, XML_blip ); + if (pSdrObj){ WriteSrcRect(pSdrObj); } |