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

2023-11-19 Thread Stephan Bergmann (via logerrit)
 filter/qa/unit/svg.cxx  |   49 
 filter/source/msfilter/util.cxx |2 -
 filter/source/svg/svgexport.cxx |2 -
 filter/source/xsltfilter/OleHandler.cxx |   10 +++---
 4 files changed, 33 insertions(+), 30 deletions(-)

New commits:
commit 1b19c6b7d03b0f7098f43131358227df28e59d84
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 20:42:51 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 20 07:27:05 2023 +0100

Extended loplugin:ostr: filter

Change-Id: I1c45cecb97789a3fc229084de1b7b4968d6069c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159699
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 4c1ddd10b58a..6297e1856a06 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg)
 
 // Make sure that the original JPG data is reused and we don't perform a 
PNG re-compress.
 xmlDocUniquePtr pXmlDoc = parseXmlStream();
-OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image", "href");
+OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image"_ostr, 
"href"_ostr);
 
 // Without the accompanying fix in place, this test would have failed with:
 // - Expression: aAttributeValue.startsWith("data:image/jpeg")
@@ -93,7 +93,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
 // Get the style of the group around the actual  element.
 xmlDocUniquePtr pXmlDoc = parseXmlStream();
 OUString aStyle = getXPath(
-pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g", "style");
+pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g"_ostr, 
"style"_ostr);
 // Without the accompanying fix in place, this test would have failed, as 
the style was
 // "mask:url(#mask1)", not "opacity: ".
 CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", ));
@@ -119,8 +119,9 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentFillWithTransparentLine)
 
 // Get the style of the group around the actual  element.
 xmlDocUniquePtr pXmlDoc = parseXmlStream();
-OUString aStyle = getXPath(
-pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g", "style");
+OUString aStyle
+= getXPath(pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g"_ostr,
+   "style"_ostr);
 CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", ));
 int nPercent = std::round(aStyle.toDouble() * 100);
 // Make sure that the line is still 50% opaque
@@ -128,7 +129,8 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentFillWithTransparentLine)
 
 // Get the stroke of the fill of the EllipseShape (it must be "none")
 OUString aStroke = getXPath(
-pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path", "stroke");
+pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path"_ostr,
+"stroke"_ostr);
 // Without the accompanying fix in place, this test would have failed, as 
the stroke was
 // "rgb(255,255,255)", not "none".
 CPPUNIT_ASSERT_EQUAL(OUString("none"), aStroke);
@@ -163,13 +165,13 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentText)
 // - Actual  : 1
 // i.e. the 2nd shape lots its text.
 
-assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text", 2);
+assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text"_ostr, 2);
 
 // First shape has semi-transparent text.
-assertXPath(pXmlDoc, 
"//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']");
+assertXPath(pXmlDoc, 
"//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']"_ostr);
 
 // Second shape has normal text.
-assertXPath(pXmlDoc, 
"//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
+assertXPath(pXmlDoc, 
"//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]"_ostr, 0);
 }
 
 CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentMultiParaText)
@@ -207,20 +209,20 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentMultiParaText)
 
 // Then make sure that the two semi-transparent paragraphs have the same X 
position:
 xmlDocUniquePtr pXmlDoc = parseXmlStream();
-assertXPath(pXmlDoc, 
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]", "x",
-"250");
+assertXPath(pXmlDoc, 
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]"_ostr,
+"x"_ostr, "250");
 assertXPath(pXmlDoc,
-
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan",
-"fill-opacity", "0.8");
+
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan"_ostr,
+"fill-opacity"_ostr, "0.8");
 // Without the 

[Libreoffice-commits] core.git: filter/qa filter/source filter/uiconfig include/vcl officecfg/registry sw/source vcl/source

2022-11-28 Thread Samuel Mehrbrodt (via logerrit)
 filter/qa/data/commentsInMargin.odt|binary
 filter/qa/pdf.cxx  |   39 +
 filter/source/pdf/impdialog.cxx|   12 
 filter/source/pdf/impdialog.hxx|2 
 filter/source/pdf/pdfexport.cxx|7 ++
 filter/source/pdf/pdfexport.hxx|1 
 filter/source/pdf/pdffilter.cxx|1 
 filter/uiconfig/ui/pdfgeneralpage.ui   |   36 +---
 include/vcl/pdfextoutdevdata.hxx   |4 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |6 ++
 sw/source/uibase/uno/unotxdoc.cxx  |7 +-
 vcl/source/gdi/pdfextoutdevdata.cxx|4 +
 12 files changed, 108 insertions(+), 11 deletions(-)

New commits:
commit 19e3bab1a8def52d9a60f67bd87697e828e37773
Author: Samuel Mehrbrodt 
AuthorDate: Thu Nov 24 15:19:17 2022 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Nov 28 11:24:57 2022 +0100

tdf#77650 Add option to place comments in margin (PDF Export)

This was somehow possible already when the document was printed with
comments in margin before - but it was not possible to set this option
when exporting a PDF via dialog or API.

To use this setting via API, set the "ExportNotesInMargin" property.

Change-Id: I97a80c5b3b3b2cde669496fd881a41ea0acc5c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143234
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/filter/qa/data/commentsInMargin.odt 
b/filter/qa/data/commentsInMargin.odt
new file mode 100644
index ..3286f9e01899
Binary files /dev/null and b/filter/qa/data/commentsInMargin.odt differ
diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
index b631a3f8a4a8..cc83f59e1652 100644
--- a/filter/qa/pdf.cxx
+++ b/filter/qa/pdf.cxx
@@ -37,6 +37,7 @@ public:
 
 void setUp() override;
 void tearDown() override;
+void doTestCommentsInMargin(bool commentsInMarginEnabled);
 };
 
 void Test::setUp()
@@ -144,6 +145,44 @@ CPPUNIT_TEST_FIXTURE(Test, testPdfDecompositionSize)
 #endif
 }
 
+void Test::doTestCommentsInMargin(bool commentsInMarginEnabled)
+{
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+return;
+
+loadFromURL(u"commentsInMargin.odt");
+uno::Reference xFactory = 
getMultiServiceFactory();
+uno::Reference xFilter(
+xFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
+uno::Reference xExporter(xFilter, uno::UNO_QUERY);
+xExporter->setSourceDocument(mxComponent);
+SvMemoryStream aStream;
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(aStream));
+uno::Sequence aFilterData{ 
comphelper::makePropertyValue(
+"ExportNotesInMargin", commentsInMarginEnabled) };
+uno::Sequence aDescriptor{
+comphelper::makePropertyValue("FilterName", 
OUString("writer_pdf_Export")),
+comphelper::makePropertyValue("FilterData", aFilterData),
+comphelper::makePropertyValue("OutputStream", xOutputStream),
+};
+xFilter->filter(aDescriptor);
+
+// Make sure the number of objects is correct
+std::unique_ptr pPdfDocument
+= pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), 
OString());
+CPPUNIT_ASSERT(pPdfDocument);
+CPPUNIT_ASSERT_EQUAL(commentsInMarginEnabled ? 9 : 1,
+ pPdfDocument->openPage(0)->getObjectCount());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testCommentsInMargin)
+{
+// Test that setting/unsetting the "ExportNotesInMargin" property works 
correctly
+doTestCommentsInMargin(true);
+doTestCommentsInMargin(false);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testWatermarkColor)
 {
 // Given an empty Writer document:
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 16b4b8a00616..fd68322f1a23 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -67,6 +67,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const 
Sequence< Property
 mbUseTaggedPDF( false ),
 mbUseTaggedPDFUserSelection( false ),
 mbExportNotes( true ),
+mbExportNotesInMargin( false ),
 mbViewPDF( false ),
 mbUseReferenceXObject( false ),
 mbExportNotesPages( false ),
@@ -191,6 +192,8 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, 
const Sequence< Property
 mbExportOnlyNotesPages = maConfigItem.ReadBool( 
"ExportOnlyNotesPages", false );
 }
 mbExportNotes = maConfigItem.ReadBool( "ExportNotes", false );
+if (mbIsWriter)
+mbExportNotesInMargin = maConfigItem.ReadBool( "ExportNotesInMargin", 
false );
 mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false );
 
 mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", true );
@@ -417,6 +420,8 @@ 

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

2022-11-23 Thread Miklos Vajna (via logerrit)
 filter/qa/pdf.cxx   |   49 ++--
 filter/source/pdf/pdfexport.cxx |   11 
 filter/source/pdf/pdfexport.hxx |1 
 3 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit d1dd9b9733511ff451e264169537c08fa14c574f
Author: Miklos Vajna 
AuthorDate: Wed Nov 23 13:39:40 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 23 15:47:03 2022 +0100

Related: tdf#54053 PDF export: add UNO API to customize the watermark font 
name

The font name of the watermark text is currently hardwired to Helvetica,
a sans-serif font.

The problem is that this looks bad in case your document uses serif or
monospace fonts. Or perhaps your document uses a single font and you
want to make sure that the watermark uses exactly the same font.

Fix the problem by adding a new "WatermarkFontName" PDF export filter
option to specify the font name explicitly.

Example cmdline usage:

soffice --convert-to 
pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, 
"WatermarkFontName":{"type":"string","value":"Times"}}' test.odt

Change-Id: I2f065e1517236695b0a95369bdcd803125018587
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143143
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
index 4c8a9a2dc7dc..c3edb1c5f841 100644
--- a/filter/qa/pdf.cxx
+++ b/filter/qa/pdf.cxx
@@ -196,7 +196,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontHeight)
 return;
 mxComponent.set(loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument"));
 
-// When exporting that as PDF with a red watermark:
+// When exporting that as PDF with a 100pt-sized watermark:
 uno::Reference xFactory = 
getMultiServiceFactory();
 uno::Reference xFilter(
 xFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
@@ -216,7 +216,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontHeight)
 };
 xFilter->filter(aDescriptor);
 
-// Then make sure that the watermark color is correct:
+// Then make sure that the watermark font size is correct:
 std::unique_ptr pPdfDocument
 = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), 
OString());
 CPPUNIT_ASSERT(pPdfDocument);
@@ -232,6 +232,51 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontHeight)
 // i.e. the font size was automatic, could not specify an explicit size.
 CPPUNIT_ASSERT_EQUAL(nExpectedFontSize, nFontSize);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontName)
+{
+// Given an empty Writer document:
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+return;
+mxComponent.set(loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument"));
+
+// When exporting that as PDF with a serif watermark:
+uno::Reference xFactory = 
getMultiServiceFactory();
+uno::Reference xFilter(
+xFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
+uno::Reference xExporter(xFilter, uno::UNO_QUERY);
+xExporter->setSourceDocument(mxComponent);
+SvMemoryStream aStream;
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(aStream));
+OUString aExpectedFontName("Liberation Serif");
+uno::Sequence aFilterData{
+comphelper::makePropertyValue("Watermark", OUString("X")),
+comphelper::makePropertyValue("WatermarkFontName", aExpectedFontName),
+};
+uno::Sequence aDescriptor{
+comphelper::makePropertyValue("FilterName", 
OUString("writer_pdf_Export")),
+comphelper::makePropertyValue("FilterData", aFilterData),
+comphelper::makePropertyValue("OutputStream", xOutputStream),
+};
+xFilter->filter(aDescriptor);
+
+// Then make sure that the watermark font name is correct:
+std::unique_ptr pPdfDocument
+= pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), 
OString());
+CPPUNIT_ASSERT(pPdfDocument);
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+std::unique_ptr pPageObject = 
pPage->getObject(0);
+CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+std::unique_ptr pFormObject = 
pPageObject->getFormObject(0);
+OUString aFontName = pFormObject->getFontName();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Liberation Serif
+// - Actual  : Helvetica
+// i.e. the font name was sans, could not specify an explicit name.
+CPPUNIT_ASSERT_EQUAL(aExpectedFontName, aFontName);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index df86ab46393d..5bb6f0baa2fe 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -109,6 +109,7 @@ PDFExport::PDFExport( const Reference< 

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

2022-11-23 Thread Miklos Vajna (via logerrit)
 filter/qa/pdf.cxx   |   45 
 filter/source/pdf/pdfexport.cxx |   35 ++-
 filter/source/pdf/pdfexport.hxx |1 
 3 files changed, 71 insertions(+), 10 deletions(-)

New commits:
commit 175e514c93b3696faa8c331c8b8f56e832ceb4c1
Author: Miklos Vajna 
AuthorDate: Wed Nov 23 09:59:05 2022 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 23 10:42:55 2022 +0100

Related: tdf#54053 PDF export: add UNO API to customize the watermark font 
size

The font height of the watermark text is currently automatic: we start
with a value based on the page size and then decrease it till the text
fits.

The problem is that sometimes you want a smaller value, but specifying
this was not possible.

Fix the problem by adding a new "WatermarkFontHeight" PDF export filter
option to specify the font size explicitly.

Example cmdline usage:

soffice --convert-to 
pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, 
"WatermarkFontHeight":{"type":"long","value":"100"}}' test.odt

Change-Id: Iceab943b7a995badfcdc6b12ecc9264e39e4a3a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143135
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
index 8b9b0d4db788..4c8a9a2dc7dc 100644
--- a/filter/qa/pdf.cxx
+++ b/filter/qa/pdf.cxx
@@ -187,6 +187,51 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermarkColor)
 // i.e. the color was the (default) green, not red.
 CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xff), aFillColor);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontHeight)
+{
+// Given an empty Writer document:
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+return;
+mxComponent.set(loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument"));
+
+// When exporting that as PDF with a red watermark:
+uno::Reference xFactory = 
getMultiServiceFactory();
+uno::Reference xFilter(
+xFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
+uno::Reference xExporter(xFilter, uno::UNO_QUERY);
+xExporter->setSourceDocument(mxComponent);
+SvMemoryStream aStream;
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(aStream));
+sal_Int32 nExpectedFontSize = 100;
+uno::Sequence aFilterData{
+comphelper::makePropertyValue("Watermark", OUString("X")),
+comphelper::makePropertyValue("WatermarkFontHeight", 
nExpectedFontSize),
+};
+uno::Sequence aDescriptor{
+comphelper::makePropertyValue("FilterName", 
OUString("writer_pdf_Export")),
+comphelper::makePropertyValue("FilterData", aFilterData),
+comphelper::makePropertyValue("OutputStream", xOutputStream),
+};
+xFilter->filter(aDescriptor);
+
+// Then make sure that the watermark color is correct:
+std::unique_ptr pPdfDocument
+= pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), 
OString());
+CPPUNIT_ASSERT(pPdfDocument);
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+std::unique_ptr pPageObject = 
pPage->getObject(0);
+CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+std::unique_ptr pFormObject = 
pPageObject->getFormObject(0);
+sal_Int32 nFontSize = pFormObject->getFontSize();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 100
+// - Actual  : 594
+// i.e. the font size was automatic, could not specify an explicit size.
+CPPUNIT_ASSERT_EQUAL(nExpectedFontSize, nFontSize);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 9633919da14f..df86ab46393d 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -568,6 +568,14 @@ bool PDFExport::Export( const OUString& rFile, const 
Sequence< PropertyValue >&
 maWatermarkColor = Color(ColorTransparency, nColor);
 }
 }
+else if (rProp.Name == "WatermarkFontHeight")
+{
+sal_Int32 nFontHeight{};
+if (rProp.Value >>= nFontHeight)
+{
+moWatermarkFontHeight = nFontHeight;
+}
+}
 else if ( rProp.Name == "TiledWatermark" )
 rProp.Value >>= msTiledWatermark;
 // now all the security related properties...
@@ -1160,7 +1168,7 @@ void PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, 
vcl::PDFExtOutDevData&
 
 void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& 
rPageSize )
 {
-vcl::Font aFont( "Helvetica", Size( 0, 3*rPageSize.Height()/4 ) );
+vcl::Font aFont( "Helvetica", 

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

2022-11-20 Thread László Németh (via logerrit)
 filter/qa/unit/data/semi-transparent-fill.odg |binary
 filter/qa/unit/svg.cxx|   32 ++
 filter/source/svg/svgwriter.cxx   |6 
 3 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit 07711c8482714f970c57688629c591f8f3aa135f
Author: László Németh 
AuthorDate: Sun Nov 20 16:18:45 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 21 08:08:26 2022 +0100

tdf#149800 SVG export: remove extra white line of semi-transparent shape

A shape is exported using two svg:paths, first one is for the
fill, and the second one is for the line. Semi-transparency of
shapes enabled the disabled stroke of the first path, resulting
an ~1 pt width extra white line behind the normal line of the
shape. It was visible only, if the normal shape line was thinner
than 1 pt, or if the normal line was semi-transparent or disabled.
The extra line got the same transparency value, as the fill,
so its visibility depended on that, too.

Change-Id: Idc40971cc73ec9e4f241974ae29c876d06cc0658
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143003
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/filter/qa/unit/data/semi-transparent-fill.odg 
b/filter/qa/unit/data/semi-transparent-fill.odg
new file mode 100644
index ..713f48991bcb
Binary files /dev/null and b/filter/qa/unit/data/semi-transparent-fill.odg 
differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index a650deb1fc72..824b73383af4 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -105,6 +105,38 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentLine)
 CPPUNIT_ASSERT_EQUAL(30, nPercent);
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentFillWithTransparentLine)
+{
+// Load a document with a shape with semi-transparent fill and line
+loadFromURL(u"semi-transparent-fill.odg");
+
+// Export it to SVG.
+uno::Reference xStorable(mxComponent, 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("draw_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+// Get the style of the group around the actual  element.
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+OUString aStyle = getXPath(
+pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g", "style");
+CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", ));
+int nPercent = std::round(aStyle.toDouble() * 100);
+// Make sure that the line is still 50% opaque
+CPPUNIT_ASSERT_EQUAL(50, nPercent);
+
+// Get the stroke of the fill of the EllipseShape (it must be "none")
+OUString aStroke = getXPath(
+pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path", "stroke");
+// Without the accompanying fix in place, this test would have failed, as 
the stroke was
+// "rgb(255,255,255)", not "none".
+CPPUNIT_ASSERT_EQUAL(OUString("none"), aStroke);
+}
+
 CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
 {
 // Two shapes, one with transparent text and the other one with
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index ec976ccb6f12..65ccab68bbb0 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3329,7 +3329,11 @@ void SVGActionWriter::ImplWriteActions( const 
GDIMetaFile& rMtf,
 {
 Color aNewLineColor( mpVDev->GetLineColor() ), 
aNewFillColor( mpVDev->GetFillColor() );
 
-aNewLineColor.SetAlpha( 255 - 
sal::static_int_cast( FRound( pA->GetTransparence() * 2.55 ) ) );
+// tdf#149800 do not change transparency of fully 
transparent
+// i.e. invisible line, because it makes it visible,
+// resulting an extra line behind the normal shape line
+if ( aNewLineColor.GetAlpha() > 0 )
+aNewLineColor.SetAlpha( 255 - 
sal::static_int_cast( FRound( pA->GetTransparence() * 2.55 ) ) );
 aNewFillColor.SetAlpha( 255 - 
sal::static_int_cast( FRound( pA->GetTransparence() * 2.55 ) ) );
 
 maAttributeWriter.AddPaintAttr( aNewLineColor, 
aNewFillColor );


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

2022-11-17 Thread Miklos Vajna (via logerrit)
 filter/qa/pdf.cxx   |   44 
 filter/source/pdf/pdfexport.cxx |   11 +-
 filter/source/pdf/pdfexport.hxx |1 
 3 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit 21c4749d0205d1ba90494edc2527ff9d11f86f87
Author: Miklos Vajna 
AuthorDate: Thu Nov 17 13:11:27 2022 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 17 14:50:07 2022 +0100

Related: tdf#54053 PDF export: add UNO API to customize the watermark color

PDF export has a watermark feature, but its color is hardcoded to light
green, which won't fit all documents.

On the other hand, the input from Heiko in
 is to
keep the dialog clean, so adding one more UI option is not great.

Fix the problem by only adding the option at an UNO API level for now,
this relaxes the hardcoded color without cluttering the UI.

Also available on the cmdline for e.g. 0xff / red color:

soffice --convert-to 
pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, 
"WatermarkColor":{"type":"long","value":"16711680"}}' test.odt

Change-Id: I38a3650df86fd34dfc09e3a5643511baa371aa83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142835
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
index 601f62a16bdb..8b9b0d4db788 100644
--- a/filter/qa/pdf.cxx
+++ b/filter/qa/pdf.cxx
@@ -143,6 +143,50 @@ CPPUNIT_TEST_FIXTURE(Test, testPdfDecompositionSize)
 CPPUNIT_ASSERT_DOUBLES_EQUAL(9437, aRange.getWidth(), 20.0);
 #endif
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkColor)
+{
+// Given an empty Writer document:
+std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get();
+if (!pPDFium)
+return;
+mxComponent.set(loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument"));
+
+// When exporting that as PDF with a red watermark:
+uno::Reference xFactory = 
getMultiServiceFactory();
+uno::Reference xFilter(
+xFactory->createInstance("com.sun.star.document.PDFFilter"), 
uno::UNO_QUERY);
+uno::Reference xExporter(xFilter, uno::UNO_QUERY);
+xExporter->setSourceDocument(mxComponent);
+SvMemoryStream aStream;
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(aStream));
+uno::Sequence aFilterData{
+comphelper::makePropertyValue("Watermark", OUString("X")),
+comphelper::makePropertyValue("WatermarkColor", 
static_cast(0xff)),
+};
+uno::Sequence aDescriptor{
+comphelper::makePropertyValue("FilterName", 
OUString("writer_pdf_Export")),
+comphelper::makePropertyValue("FilterData", aFilterData),
+comphelper::makePropertyValue("OutputStream", xOutputStream),
+};
+xFilter->filter(aDescriptor);
+
+// Then make sure that the watermark color is correct:
+std::unique_ptr pPdfDocument
+= pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), 
OString());
+CPPUNIT_ASSERT(pPdfDocument);
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+std::unique_ptr pPageObject = 
pPage->getObject(0);
+CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+std::unique_ptr pFormObject = 
pPageObject->getFormObject(0);
+Color aFillColor = pFormObject->getFillColor();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: rgba[ffff]
+// - Actual  : rgba[00ff00ff]
+// i.e. the color was the (default) green, not red.
+CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xff), aFillColor);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index b02c200e7e85..9633919da14f 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -108,6 +108,7 @@ PDFExport::PDFExport( const Reference< XComponent >& 
rxSrcDoc,
 mbRemoveTransparencies  ( false ),
 
 mbIsRedactMode  ( false ),
+maWatermarkColor( COL_LIGHTGREEN ),
 
 mbHideViewerToolbar ( false ),
 mbHideViewerMenubar ( false ),
@@ -559,6 +560,14 @@ bool PDFExport::Export( const OUString& rFile, const 
Sequence< PropertyValue >&
 rProp.Value >>= mbAddStream;
 else if ( rProp.Name == "Watermark" )
 rProp.Value >>= msWatermark;
+else if ( rProp.Name == "WatermarkColor" )
+{
+sal_Int32 nColor{};
+if (rProp.Value >>= nColor)
+{
+maWatermarkColor = Color(ColorTransparency, nColor);
+}
+}
 else if ( rProp.Name == "TiledWatermark" )
 rProp.Value >>= msTiledWatermark;
 // 

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

2022-11-11 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/svg.cxx  |   53 
 filter/source/svg/svgwriter.cxx |5 +++
 2 files changed, 58 insertions(+)

New commits:
commit c725028f15c36fc626d9ad8cdc288eb73c3e2643
Author: Miklos Vajna 
AuthorDate: Fri Nov 11 15:58:11 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 11 19:35:55 2022 +0100

SVG export: fix handling of semi-transparent, multi-para shape text

The bugdoc had a shape with two paragraphs. The export of the second 
paragraph
went wrong: the position & size of the text was larger than expected.

This problem was specific to semi-transparent text.
SVGTextWriter::setTextPosition() is recursive in this case. The 
non-transparent
case left nCurAction unchanged in the outer setTextPosition() and it 
returned 1
("text is found"). The semi-transparent case changed nCurAction by +2 and
returned 0 ("text is not found"). This led to all sorts of trouble, 
including
mismatching Push() and Pop() calls on the output device when replaying the
metafile.

Fix the problem by routing the empty state from the inner setTextPosition() 
to
the outer one: if we return 1 ("text is found"), then we know that the 
state is
non-empty. Once the empty state is correct in the outer setTextPosition(), 
then
even the transparent case also leaves nCurAction unchanged and the whole 
shape
text has the correct position and size.

I forgot to update this empty state in ther outer setTextPosition() in 
commit
666f252457bdb4371d15380a0289e107b2dfbe84 (SVG export: fix lost 
semi-transparent
text on shapes, 2020-07-17).

Change-Id: I7dc93fe13c4510220bf09a388e742799ed042510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142590
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 90de658cf50f..ea31a74447f0 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -19,6 +19,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -141,6 +143,57 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentText)
 assertXPath(pXmlDoc, 
"//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentMultiParaText)
+{
+// Given a shape with semi-transparent, multi-paragraph text:
+mxComponent
+= loadFromDesktop("private:factory/simpress", 
"com.sun.star.drawing.DrawingDocument");
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.TextShape"), 
uno::UNO_QUERY);
+uno::Reference 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+   uno::UNO_QUERY);
+xDrawPage->add(xShape);
+xShape->setSize(awt::Size(1, 1));
+uno::Reference xShapeText(xShape, uno::UNO_QUERY);
+uno::Reference xCursor = xShapeText->createTextCursor();
+xShapeText->insertString(xCursor, "foo", /*bAbsorb=*/false);
+xShapeText->insertControlCharacter(xCursor, 
text::ControlCharacter::APPEND_PARAGRAPH,
+   /*bAbsorb=*/false);
+xShapeText->insertString(xCursor, "bar", /*bAbsorb=*/false);
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+xShapeProps->setPropertyValue("CharColor", 
uno::Any(static_cast(0xff)));
+xShapeProps->setPropertyValue("CharTransparence", 
uno::Any(static_cast(20)));
+
+// When exporting to SVG:
+uno::Reference xStorable(mxComponent, 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("draw_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+// Then make sure that the two semi-tranparent paragraphs have the same X 
position:
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+assertXPath(pXmlDoc, 
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]", "x",
+"250");
+assertXPath(pXmlDoc,
+
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan",
+"fill-opacity", "0.8");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 250
+// - Actual  : 8819
+// i.e. the X position of the second paragraph was wrong.
+assertXPath(pXmlDoc, 
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]", "x",
+"250");
+assertXPath(pXmlDoc,
+

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

2022-10-06 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/svg.cxx  |   39 +++
 filter/source/svg/svgwriter.cxx |6 ++
 2 files changed, 45 insertions(+)

New commits:
commit e7ca10a35fd665722c67eea85e15f71c11c66248
Author: Miklos Vajna 
AuthorDate: Thu Oct 6 15:27:24 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 6 16:12:07 2022 +0200

SVG export: don't loose tab portions

Impress slides are exported to SVG via a metafile. In case shape text
has a string like "A\tB", that was exported as "AB", loosing the tab
character.

The relevant shape is exported as a metafile, with two text array
metafile actions (one for "A", one for "B") and the tab needs no
explicit action as both "A" and "B" has an explicit position. The SVG
contained no explicit position for "B", so the tab was lost visually.

Fix the problem by detecting when the doc model has a "\t" without a
matching metafile action and emitting the explicit position in that
case.

An alternative would be to use implWriteTextPortion() to write a 
for the tab, but that doesn't guarantee that the width of the tab in the
SVG is the same as in Impress.

Change-Id: Ie21bffce9d09194159e460fb28ab23fbefd52102
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141014
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 8cb696efa170..5506d1601cda 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -18,6 +18,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -251,6 +255,41 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest)
 assertXPath(pXmlDoc, xPath + "[4]", "id", "id7");
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab)
+{
+// Given a shape with "A\tB" text:
+getComponent() = loadFromDesktop("private:factory/simpress",
+ 
"com.sun.star.presentation.PresentationDocument");
+uno::Reference xFactory(getComponent(), 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.TextShape"), 
uno::UNO_QUERY);
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+   uno::UNO_QUERY);
+xDrawPage->add(xShape);
+xShape->setSize(awt::Size(1, 1));
+uno::Reference xShapeText(xShape, uno::UNO_QUERY);
+xShapeText->setString("A\tB");
+
+// When exporting that document to SVG:
+uno::Reference xStorable(getComponent(), 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+
+// Then make sure the the tab is not lost:
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 1
+// i.e. the 2nd text portion was not positioned, which looked as if the 
tab is lost.
+assertXPath(pXmlDoc, 
"//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 9f889924cfb6..fb0193e15418 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1624,6 +1624,12 @@ void SVGTextWriter::writeTextPortion( const Point& rPos,
 continue;
 if( sContent == "\n" )
 mbLineBreak = true;
+else if (sContent == "\t")
+{
+// Need to emit position for the next text portion after a 
tab, otherwise the tab
+// would appear as if it has 0 width.
+mbPositioningNeeded = true;
+}
 if( sContent.match( rText, nStartPos ) )
 bNotSync = false;
 }


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

2022-02-08 Thread Miklos Vajna (via logerrit)
 filter/qa/data/picture.pdf  |binary
 filter/qa/pdf.cxx   |   39 
 filter/source/pdf/pdfdecomposer.cxx |8 +++
 3 files changed, 43 insertions(+), 4 deletions(-)

New commits:
commit 4df75c2a2f9abbf2621a9aacd0c4f9fe8841b051
Author: Miklos Vajna 
AuthorDate: Mon Feb 7 19:58:20 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 8 13:42:45 2022 +0100

sw: fix size of inserted PDF image

We used to multiply the pixel size with the DPI, which resulted in some
large enough mm100 width that the inserted image was as wide as the body
frame allowed it.

Change-Id: I97b81f23166889006363b9241a572f6afde99ee3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129640
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/data/picture.pdf b/filter/qa/data/picture.pdf
new file mode 100644
index ..79af2b349dd2
Binary files /dev/null and b/filter/qa/data/picture.pdf differ
diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
index 07025c1b1c2e..8eb64b08cc7a 100644
--- a/filter/qa/pdf.cxx
+++ b/filter/qa/pdf.cxx
@@ -14,6 +14,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -52,6 +55,8 @@ void Test::tearDown()
 test::BootstrapFixture::tearDown();
 }
 
+constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/data/";
+
 CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName)
 {
 uno::Reference xSEInitializer
@@ -101,6 +106,40 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName)
 CPPUNIT_ASSERT(pPdfDocument);
 CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getSignatureCount());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testPdfDecompositionSize)
+{
+// Given an empty Writer document:
+getComponent().set(
+loadFromDesktop("private:factory/swriter", 
"com.sun.star.text.TextDocument"));
+
+// When inserting a 267 points wide PDF image into the document:
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("FileName",
+  
m_directories.getURLFromSrc(DATA_DIRECTORY) + "picture.pdf"),
+};
+dispatchCommand(getComponent(), ".uno:InsertGraphic", aArgs);
+
+// Then make sure that its size is correct:
+uno::Reference 
xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+auto xGraphic = 
xShape->getPropertyValue("Graphic").get>();
+CPPUNIT_ASSERT(xGraphic.is());
+Graphic aGraphic(xGraphic);
+basegfx::B2DRange aRange = aGraphic.getVectorGraphicData()->getRange();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 9419
+// - Actual  : 34176
+// i.e. the width was too large, it used all width of the body frame.
+// 9419 mm100 is 267 points from the file.
+#if defined MACOSX
+// TODO the bitmap size is larger (75486) on macOS, but that should not 
affect the logic size.
+(void)aRange;
+#else
+CPPUNIT_ASSERT_EQUAL(static_cast(9419), aRange.getWidth());
+#endif
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/pdf/pdfdecomposer.cxx 
b/filter/source/pdf/pdfdecomposer.cxx
index f861b4eaf86e..7a032bf3688a 100644
--- a/filter/source/pdf/pdfdecomposer.cxx
+++ b/filter/source/pdf/pdfdecomposer.cxx
@@ -82,12 +82,12 @@ XPdfDecomposer::getDecomposition(const 
uno::ReferenceLogicToPixel(Size(1, 1), 
MapMode(MapUnit::MapInch)));
 const Size aBitmapSize(aReplacement.GetSizePixel());
+// ImpGraphic::getPrefMapMode() requires mm100 for bitmaps rendered from 
vector graphic data.
+const Size aMM100(
+Application::GetDefaultDevice()->PixelToLogic(aBitmapSize, 
MapMode(MapUnit::Map100thMM)));
 const basegfx::B2DHomMatrix 
aBitmapTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(
-aBitmapSize.getWidth() * aDPI.getWidth(), aBitmapSize.getHeight() * 
aDPI.getHeight(), 0,
-0));
+aMM100.getWidth(), aMM100.getHeight(), 0, 0));
 
 // create primitive
 return drawinglayer::primitive2d::Primitive2DContainer{


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

2022-01-26 Thread Rash419 (via logerrit)
 filter/qa/unit/data/attributeRedefinedTest.odp |binary
 filter/qa/unit/svg.cxx |   42 +
 filter/source/svg/svgwriter.cxx|   14 +++-
 3 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit b37e3e8c8c545a0776a9fcdbad3cb752162d2e3d
Author: Rash419 
AuthorDate: Mon Jan 24 15:56:15 2022 +0530
Commit: Andras Timar 
CommitDate: Wed Jan 26 12:01:48 2022 +0100

svgexport: fix: attribute id redefined

If there is a id for empty paragraph exist we need to create a empty
text paragraph to accomodate the id if we don't do that then we
get multiple id attribute on same element for example:


Change-Id: I41c21dc94deef93e423aaff2248f6931fa6ca8de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128856
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128924
Tested-by: Jenkins

diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp 
b/filter/qa/unit/data/attributeRedefinedTest.odp
new file mode 100644
index ..dfb814bfb9ec
Binary files /dev/null and b/filter/qa/unit/data/attributeRedefinedTest.odp 
differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 3e3508fd52ca..a93d92c7d1ea 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -209,6 +209,48 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet)
 CPPUNIT_ASSERT(!getXPath(pXmlDoc, 
"//svg:g[@class='BulletChars']//svg:path", "d").isEmpty());
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest)
+{
+// Load document containing empty paragraphs with ids.
+load(u"attributeRedefinedTest.odp");
+
+// Export to SVG.
+uno::Reference xStorable(getComponent(), 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+
+// We expect four paragraph
+// 2 empty paragraphs with ids
+// 2 paragraphs with text
+// Without the accompanying fix the test would have failed with
+// Expected : 4
+// Actual : 2
+// i.e. 2 of the empty paragraph do not get generated even if there
+// is id imported for the paragraphs
+// If we don't create the empty paragraphs the id attribute attribute gets 
redefined like this:
+// 
+
+OString xPath = 
"//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//"
+"svg:tspan[@class='TextParagraph']";
+assertXPath(pXmlDoc, xPath, 4);
+
+//assert that each tspan element with TextParagraph class has id and the 
tspan element of
+//each empty paragraph doesnot contain tspan element with class 
TextPosition
+assertXPath(pXmlDoc, xPath + "[1]", "id", "id4");
+assertXPath(pXmlDoc, xPath + "[2]", "id", "id5");
+assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0);
+assertXPath(pXmlDoc, xPath + "[3]", "id", "id6");
+assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0);
+assertXPath(pXmlDoc, xPath + "[4]", "id", "id7");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index e066806cea9a..3d8183ebb2fd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1099,7 +1099,19 @@ bool SVGTextWriter::nextParagraph()
 const OUString& rParagraphId = implGetValidIDFromInterface( 
Reference(xTextContent, UNO_QUERY) );
 if( !rParagraphId.isEmpty() )
 {
-mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId );
+// if there is id for empty paragraph we need to create a empty 
text paragraph
+Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW );
+if ( xRange.is() && xRange->getString().isEmpty() )
+{
+endTextParagraph();
+mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", 
"TextParagraph" );
+mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId 
);
+mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, 
XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ));
+}
+else
+{
+mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId 
);
+}
 }
 return true;
 }


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

2022-01-17 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/data/custom-bullet.fodp |   36 +
 filter/qa/unit/svg.cxx |   27 
 filter/source/svg/svgexport.cxx|   12 +++
 filter/source/svg/svgfilter.hxx|4 +++
 filter/source/svg/svgwriter.cxx|   24 ++
 filter/source/svg/svgwriter.hxx|2 -
 6 files changed, 100 insertions(+), 5 deletions(-)

New commits:
commit bbc4360b5beb012adf1e2652328d3e18d66224aa
Author: Miklos Vajna 
AuthorDate: Mon Jan 17 11:47:14 2022 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 17 13:23:57 2022 +0100

SVG export: fix missing custom bullets

It seems this was broken since b76628acb1ae4fc06f8c1b70ec2e0cf39356deef
(text export support for bullets and hyperlinks, 2012-08-11), the
problem is that SVGFilter::implEmbedBulletGlyphs() has a fixed list of
characters that are typically used as bullets, but e.g. "-" is missing
from that list.

Fix this by improving SVGTextWriter::implWriteBulletChars() to continue
working from those shared glyph paths when the glyph is in the fixed
list, but otherwise call GetTextOutline() to look up the path for the
custom bullet.

Change-Id: I3de8fab8dc6c78e273629d13566d1f9f289eb752
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128495
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/data/custom-bullet.fodp 
b/filter/qa/unit/data/custom-bullet.fodp
new file mode 100644
index ..4139260f9780
--- /dev/null
+++ b/filter/qa/unit/data/custom-bullet.fodp
@@ -0,0 +1,36 @@
+
+
+  
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+  
+  
+
+
+  
+  
+
+  
+
+  
+
+  
+hello
+  
+
+  
+
+  
+
+  
+
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index e1b54fb2a294..3e3508fd52ca 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -182,6 +182,33 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
 xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet)
+{
+// Given a presentation with a custom bullet:
+load(u"custom-bullet.fodp");
+
+// When exporting that to SVG:
+uno::Reference xStorable(getComponent(), 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+
+// Then make sure the bullet glyph is not lost:
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+xmlDocUniquePtr pXmlDoc = parseXmlStream();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// - XPath '//svg:g[@class='BulletChars']//svg:path' number of nodes is 
incorrect
+// i.e. the custom bullet used '', but nobody produced a 
bullet-char-template-45,
+// instead we need the path of the glyph inline.
+CPPUNIT_ASSERT(!getXPath(pXmlDoc, 
"//svg:g[@class='BulletChars']//svg:path", "d").isEmpty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 170b2cf1437b..ef0c1ea37a80 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1524,6 +1524,7 @@ void SVGFilter::implEmbedBulletGlyph( sal_Unicode 
cBullet, const OUString & sPat
 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "d", sPathData );
 SvXMLElementExport aPathElem( *mpSVGExport, XML_NAMESPACE_NONE, "path", 
true, true );
 
+mpSVGExport->SetEmbeddedBulletGlyph(cBullet);
 }
 
 void SVGFilter::implExportBackgroundBitmaps()
@@ -2858,4 +2859,15 @@ void SVGExport::writeMtf( const GDIMetaFile& rMtf )
 }
 }
 
+void SVGExport::SetEmbeddedBulletGlyph(sal_Unicode cBullet)
+{
+maEmbeddedBulletGlyphs.insert(cBullet);
+}
+
+bool SVGExport::IsEmbeddedBulletGlyph(sal_Unicode cBullet) const
+{
+auto it = maEmbeddedBulletGlyphs.find(cBullet);
+return it != maEmbeddedBulletGlyphs.end();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 1a8796bd9046..eb889e81662e 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -66,6 +66,7 @@ class SVGExport : public SvXMLExport
 boolmbIsUseOpacity;
 boolmbIsUseNativeTextDecoration;
 boolmbIsUsePositionedCharacters;
+std::set maEmbeddedBulletGlyphs;
 
 public:
 
@@ -84,6 +85,9 @@ 

[Libreoffice-commits] core.git: filter/qa filter/source sfx2/source

2021-12-21 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/textfilterdetect.cxx |   19 +++
 filter/source/textfilterdetect/filterdetect.cxx |6 +-
 sfx2/source/doc/objstor.cxx |   10 +-
 3 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit e519d7465f38367205b37bc80f0244029e352306
Author: Miklos Vajna 
AuthorDate: Tue Dec 21 14:31:34 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 21 17:04:51 2021 +0100

filter: try to detect 0-byte DOC files based on extension

Commit ae1f51b4888a3aa14837ac6e4083f33b2176ca45 (tdf#123476 filter: try
to detect 0-byte files based on extension, 2020-10-28), already
implemented this UNO-based import filters, do the same for built-in
filters as well.

Another problem in filter/ was to pick the WW6 filter for .doc --
require export+preferred support in the filter to get WW8 instead.

An additional filter that may kick in is MS Word 2003 XML: this is
avoided by requiring "preferred".

Change-Id: I46e280beb5341213b0fe7a09a549b52c0c1ea3f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127219
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/data/empty.doc b/filter/qa/unit/data/empty.doc
new file mode 100644
index ..e69de29bb2d1
diff --git a/filter/qa/unit/textfilterdetect.cxx 
b/filter/qa/unit/textfilterdetect.cxx
index 95c2b7697159..62d0d60a23a7 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -112,6 +112,25 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testEmptyFile)
 // Writer instead.
 
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument"));
 getComponent()->dispose();
+
+// ... and DOC
+aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "empty.doc";
+// Without the accompanying fix in place, this test would have failed, the 
import filter aborted
+// loading.
+getComponent() = loadFromDesktop(aURL);
+xServiceInfo.set(getComponent(), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xServiceInfo.is());
+
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument"));
+uno::Reference xModel(getComponent(), uno::UNO_QUERY);
+uno::Sequence aArgs = xModel->getArgs();
+comphelper::SequenceAsHashMap aMap(aArgs);
+OUString aFilterName;
+aMap["FilterName"] >>= aFilterName;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: MS Word 97
+// - Actual  : MS WinWord 6.0
+// i.e. opening worked, but saving back failed instead of producing a WW8 
binary file.
+CPPUNIT_ASSERT_EQUAL(OUString("MS Word 97"), aFilterName);
 }
 }
 
diff --git a/filter/source/textfilterdetect/filterdetect.cxx 
b/filter/source/textfilterdetect/filterdetect.cxx
index 22db169b36e5..f8fc5cb865eb 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -148,7 +148,11 @@ bool HandleEmptyFileUrlByExtension(MediaDescriptor& 
rMediaDesc, const OUString&
 return false;
 }
 
-std::shared_ptr 
pFilter(SfxFilterMatcher().GetFilter4Extension(rExt));
+// Requiring the export+preferred flags helps to find the relevant filter, 
e.g. .doc -> WW8 (and
+// not WW6 or Mac_Word).
+SfxFilterFlags nMust
+= SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | 
SfxFilterFlags::PREFERED;
+std::shared_ptr 
pFilter(SfxFilterMatcher().GetFilter4Extension(rExt, nMust));
 if (!pFilter)
 {
 return false;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 8b3c8f6d3e9d..0dc1b0f7d452 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -754,7 +754,15 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
 }
 else
 {
-bOk = ConvertFrom(*pMedium);
+if (tools::isEmptyFileUrl(pMedium->GetName()))
+{
+// The import filter would fail with empty input.
+bOk = true;
+}
+else
+{
+bOk = ConvertFrom(*pMedium);
+}
 InitOwnModel_Impl();
 }
 }


[Libreoffice-commits] core.git: filter/qa filter/source sd/qa

2021-03-09 Thread Marco Cecchetti (via logerrit)
 filter/qa/unit/svg.cxx   |4 ++--
 filter/source/svg/presentation_engine.js |4 ++--
 filter/source/svg/svgexport.cxx  |2 ++
 filter/source/svg/svgwriter.cxx  |2 +-
 sd/qa/unit/SVGExportTests.cxx|   12 ++--
 5 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit e3f62ee770afe34dceb467eb8ccda55eba0a2243
Author: Marco Cecchetti 
AuthorDate: Wed Feb 17 13:21:07 2021 +0100
Commit: Marco Cecchetti 
CommitDate: Tue Mar 9 15:36:09 2021 +0100

filter: svg: export: renaming class attributes related to TextShape

TextShape => SVGTextShape
com.sun.star.drawing.TextShape => TextShape

Change-Id: I4bbb465e0f65aa328527ac3022c0b68546fb5db6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111224
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111846
Tested-by: Jenkins
Reviewed-by: Marco Cecchetti 

diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index be11dc57c631..4c37dac61548 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -148,14 +148,14 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentText)
 
 xmlDocUniquePtr pXmlDoc = parseXmlStream();
 
-// We expect 2 groups of class "com.sun.star.drawing.TextShape" that
+// We expect 2 groups of class "TextShape" that
 // have some svg:text node inside.
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 2
 // - Actual  : 1
 // i.e. the 2nd shape lots its text.
 
-assertXPath(pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.TextShape']//svg:text", 2);
+assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text", 2);
 
 // First shape has semi-transparent text.
 assertXPath(pXmlDoc, 
"//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']");
diff --git a/filter/source/svg/presentation_engine.js 
b/filter/source/svg/presentation_engine.js
index 884d3430f4bd..275d455ca4e5 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -5371,7 +5371,7 @@ function getTextFieldType ( elem )
 {
 var sFieldType = null;
 var sClass = elem.getAttribute('class');
-if( sClass.endsWith( 'TextShape' ) )
+if( sClass == 'TextShape' )
 {
 var aPlaceholderElement = getElementByClassName( elem, 
'PlaceholderText' );
 if (aPlaceholderElement)
@@ -14725,7 +14725,7 @@ function AnimatedTextElement( aElement, 
aEventMultiplexer )
 }
 var aTextShapeElement = aElement.parentNode;
 sTextType = aTextShapeElement.getAttribute( 'class' );
-if( sTextType !== 'TextShape' )
+if( sTextType !== 'SVGTextShape' )
 {
 log( 'AnimatedTextElement: element parent is not a text shape.' );
 return;
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 3e2da0cd0cb9..96da555f5279 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -2575,6 +2575,8 @@ OUString SVGFilter::implGetClassFromShape( const 
Reference< css::drawing::XShape
 aRet = "Graphic";
 else if( aShapeType.lastIndexOf( "drawing.OLE2Shape" ) != -1 )
 aRet = "OLE2";
+else if( aShapeType.lastIndexOf( "drawing.TextShape" ) != -1 )
+aRet = "TextShape";
 else if( aShapeType.lastIndexOf( "presentation.HeaderShape" ) != -1 )
 aRet = "Header";
 else if( aShapeType.lastIndexOf( "presentation.FooterShape" ) != -1 )
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index b7eab491429d..08ad2c5781ce 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1275,7 +1275,7 @@ void SVGTextWriter::startTextShape()
 {
 mbIsTextShapeStarted = true;
 maParentFont = vcl::Font();
-mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextShape" );
+mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "SVGTextShape" );
 
 // if text is rotated, set transform matrix at text element
 const vcl::Font& rFont = mpVDev->GetFont();
diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx
index 49bba87e90a0..7e7a8a2a620e 100644
--- a/sd/qa/unit/SVGExportTests.cxx
+++ b/sd/qa/unit/SVGExportTests.cxx
@@ -142,11 +142,11 @@ public:
 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2] ), "class", 
"SlideGroup");
 assertXPath(svgDoc, SAL_STRINGIFY( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G 
), "class", "Slide");
 assertXPath(svgDoc, SAL_STRINGIFY( 
/SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1] ), "class", "TitleText");
-assertXPath(svgDoc, SAL_STRINGIFY( 
/SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT ), "class", 
"TextShape");
+assertXPath(svgDoc, SAL_STRINGIFY( 
/SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT ), "class", 

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

2020-09-07 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/data/shape-nographic.odp |binary
 filter/qa/unit/svg.cxx  |   19 +++
 filter/source/svg/svgexport.cxx |3 ++-
 filter/source/svg/svgwriter.cxx |5 -
 4 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit fbcdbfef8664430e15b9429187b58dede992accf
Author: Miklos Vajna 
AuthorDate: Mon Sep 7 17:00:44 2020 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 7 18:59:05 2020 +0200

SVG export: fix failure on trying to read graphic of a 3D shape

Regression from commit 8fc1b60f62c213a0476f3acc9f89cd5eccbf335d (sw SVG
export: try to reuse original bitmap data for JPG and PNG bitmaps,
2020-02-27), which generalized the code that tries to get the original
bitmap of shapes for performance reasons. Originally this worked with
SdrGrafObj, but now we try every XShape which has a Graphic property.

Add the missing check, so shapes without a graphic property just miss
the fast path, but doesn't fail the entire SVG export.

Change-Id: I6b20083110f3269337b9df6a23bd193cc6f7d13b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102187
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/data/shape-nographic.odp 
b/filter/qa/unit/data/shape-nographic.odp
new file mode 100644
index ..43186d614986
Binary files /dev/null and b/filter/qa/unit/data/shape-nographic.odp differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 5dcb1af0eb90..792964cb00d9 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -160,6 +160,25 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentText)
 assertXPath(pXmlDoc, 
"//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
+{
+// Load a document containing a 3D shape.
+load("shape-nographic.odp");
+
+// Export to SVG.
+uno::Reference xStorable(getComponent(), 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+
+// Without the accompanying fix in place, this test would have failed with:
+// An uncaught exception of type com.sun.star.io.IOException
+// - SfxBaseModel::impl_store  failed: 0xc10(Error Area:Io 
Class:Write Code:16)
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 615c60004c2b..dea16cf90d1f 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -59,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -608,7 +609,7 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< 
XOutputStream >& rxOSt
 {
 delete mpSVGDoc;
 mpSVGDoc = nullptr;
-OSL_FAIL( "Exception caught" );
+SAL_WARN("filter.svg", "Exception caught");
 }
 
 if( nullptr != pSdrModel )
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index ba6bdfd534cd..4a35b01e9dfd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2758,7 +2758,10 @@ void GetGraphicFromXShape(const 
css::uno::Reference* pShap
 }
 
 uno::Reference xGraphic;
-xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
+if (xPropertySet->getPropertySetInfo()->hasPropertyByName("Graphic"))
+{
+xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
+}
 rGraphic= Graphic(xGraphic);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: filter/qa filter/source slideshow/source svgio/source sw/inc sw/source vcl/source xmloff/source

2020-08-27 Thread Andrea Gelmini (via logerrit)
 filter/qa/complex/filter/detection/typeDetection/Helper.java |2 +-
 filter/source/xslt/export/spreadsheetml/table.xsl|4 ++--
 filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl |2 +-
 slideshow/source/engine/slideview.cxx|2 +-
 slideshow/source/engine/tools.cxx|2 +-
 slideshow/source/engine/transitions/slidechangebase.cxx  |2 +-
 svgio/source/svgreader/svgsvgnode.cxx|4 ++--
 sw/inc/IDocumentSettingAccess.hxx|8 

 sw/source/core/layout/dbg_lay.cxx|2 +-
 vcl/source/filter/jpeg/transupp.c|2 +-
 xmloff/source/draw/animationexport.cxx   |2 +-
 xmloff/source/transform/PropertyActionsOASIS.cxx |2 +-
 12 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 8a2136443929ac0215b3aa4008de272b6d576050
Author: Andrea Gelmini 
AuthorDate: Wed Aug 26 22:49:55 2020 +0200
Commit: Julien Nabet 
CommitDate: Thu Aug 27 09:15:00 2020 +0200

Fix typos

Change-Id: Ieebf8bc3051d1f6b99cf72629aa411e27de21640
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101403
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/filter/qa/complex/filter/detection/typeDetection/Helper.java 
b/filter/qa/complex/filter/detection/typeDetection/Helper.java
index d74105590144..23eb07fc48bf 100644
--- a/filter/qa/complex/filter/detection/typeDetection/Helper.java
+++ b/filter/qa/complex/filter/detection/typeDetection/Helper.java
@@ -365,7 +365,7 @@ public class Helper  {
 
 /**
  *  Fills the Hashtable m_hFileURLs with all file names and their URL
- *  and the Hashtable m_hFilesTypes with all file names and their file
+ *  and the Hashtable m_hFileTypes with all file names and their file
  *  type name. This information is extracted from "files.csv"
  *  This is for faster access to get fileURL and fileType of fileAlias
  */
diff --git a/filter/source/xslt/export/spreadsheetml/table.xsl 
b/filter/source/xslt/export/spreadsheetml/table.xsl
index 1c2c13809554..f1a563596b37 100644
--- a/filter/source/xslt/export/spreadsheetml/table.xsl
+++ b/filter/source/xslt/export/spreadsheetml/table.xsl
@@ -269,7 +269,7 @@
 
 
 
-
+
 
 
 
@@ -465,7 +465,7 @@
 
 
 
- 
+ 
  
 
 
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl 
b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
index 53a649f357e9..3c884138b74d 100644
--- a/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
@@ -69,7 +69,7 @@
 to get the adequate column styles during later cell creation,
 or hiding the cell when @table:visibility is not set to 'visible'.
 
-The position is archieved by adding up all 
table:number-columns-repeated of the preceding cells.
+The position is archived by adding up all 
table:number-columns-repeated of the preceding cells.
 Step1: creating 
'$precedingCells/quantity/@table:number-columns-repeated').
 Step2: sum(xxx:nodeset($precedingCells)/quantity) + 1-->
 
diff --git a/slideshow/source/engine/slideview.cxx 
b/slideshow/source/engine/slideview.cxx
index 979ab06424fa..013e089a065c 100644
--- a/slideshow/source/engine/slideview.cxx
+++ b/slideshow/source/engine/slideview.cxx
@@ -157,7 +157,7 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas,
 pCanvas->setClip( aClipPoly );
 }
 
-// set transformation to identitiy (->device pixel)
+// set transformation to identity (->device pixel)
 pCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
 
 // #i42440# Fill the _full_ background in
diff --git a/slideshow/source/engine/tools.cxx 
b/slideshow/source/engine/tools.cxx
index 1fbb673ff61e..3de893ae9ee0 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -674,7 +674,7 @@ namespace slideshow::internal
 {
 ::cppcanvas::CanvasSharedPtr pCanvas( rCanvas->clone() );
 
-// set transformation to identitiy (->device pixel)
+// set transformation to identity (->device pixel)
 pCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
 
 // #i42440# Fill the _full_ background in
diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx 
b/slideshow/source/engine/transitions/slidechangebase.cxx
index bee40c9480aa..460f53cf4090 100644
--- a/slideshow/source/engine/transitions/slidechangebase.cxx
+++ b/slideshow/source/engine/transitions/slidechangebase.cxx

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

2020-07-17 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/svg.cxx  |   12 +++-
 filter/source/svg/svgwriter.cxx |  113 
 filter/source/svg/svgwriter.hxx |   11 +++
 3 files changed, 98 insertions(+), 38 deletions(-)

New commits:
commit 666f252457bdb4371d15380a0289e107b2dfbe84
Author: Miklos Vajna 
AuthorDate: Fri Jul 17 09:23:16 2020 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 17 10:07:11 2020 +0200

SVG export: fix lost semi-transparent text on shapes

Extend SVGTextWriter::setTextPosition(), so when it looks for a text
action in a metafile, it recurses into transparency groups, so the text
is not lost.

Extract part of SVGActionWriter::ImplWriteMask() into a new StartMask(),
so we can detect the case when the transparency group has a constant
alpha, i.e. no complex mask is needed, just an opacity value.

When looking for text, remember if we saw a request for text opacity and
make the transparency group writing in SVGActionWriter::ImplWriteMask()
conditional to avoid duplication. This is needed because once we're
inside , we don't want to write an invalid transparency group via
, rather we want a fill-opacity on the existing .

With this, the SVG export is on par with PDF export for semi-transparent
shape text.

Change-Id: If43b0ab3446015299acc4b37590358867c5fac5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98937
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 4589b417a0c2..5dcb1af0eb90 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -146,12 +146,18 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, 
testSemiTransparentText)
 
 // We expect 2 groups of class "com.sun.star.drawing.TextShape" that
 // have some svg:text node inside.
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 1
+// i.e. the 2nd shape lots its text.
 
-// TODO: fix the bug
+assertXPath(pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.TextShape']//svg:text", 2);
 
-// assertXPath(pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.TextShape']//svg:text", 2);
+// First shape has semi-transparent text.
+assertXPath(pXmlDoc, 
"//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']");
 
-// TODO: assert we the text has correctly transparent text (20%)
+// Second shape has normal text.
+assertXPath(pXmlDoc, 
"//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index ce446a48d92c..86854235d938 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -454,9 +454,11 @@ void SVGAttributeWriter::setFontFamily()
 }
 }
 
-SVGTextWriter::SVGTextWriter( SVGExport& rExport,  SVGAttributeWriter& 
rAttributeWriter  )
+SVGTextWriter::SVGTextWriter(SVGExport& rExport, SVGAttributeWriter& 
rAttributeWriter,
+ SVGActionWriter& rActionWriter)
 : mrExport( rExport ),
   mrAttributeWriter( rAttributeWriter ),
+  mrActionWriter(rActionWriter),
   mpVDev( nullptr ),
   mbIsTextShapeStarted( false ),
   mrTextShape(),
@@ -592,7 +594,8 @@ bool SVGTextWriter::implGetTextPositionFromBitmap( const 
MetaAction* pAction, Po
  * 0 if no text found and end of text shape is reached
  * 1 if text found!
  */
-sal_Int32 SVGTextWriter::setTextPosition( const GDIMetaFile& rMtf, sal_uLong& 
nCurAction )
+sal_Int32 SVGTextWriter::setTextPosition(const GDIMetaFile& rMtf, sal_uLong& 
nCurAction,
+ sal_uInt32 nWriteFlags)
 {
 Point aPos;
 sal_uLong nCount = rMtf.GetActionSize();
@@ -628,6 +631,22 @@ sal_Int32 SVGTextWriter::setTextPosition( const 
GDIMetaFile& rMtf, sal_uLong& nC
 }
 break;
 
+case MetaActionType::FLOATTRANSPARENT:
+{
+const MetaFloatTransparentAction* pA
+= static_cast(pAction);
+GDIMetaFile aTmpMtf(pA->GetGDIMetaFile());
+sal_uLong nTmpAction = 0;
+if (setTextPosition(aTmpMtf, nTmpAction, nWriteFlags) == 1)
+{
+// Text is found in the inner metafile.
+bConfigured = true;
+mrActionWriter.StartMask(pA->GetPoint(), pA->GetSize(), 
pA->GetGradient(),
+ nWriteFlags, );
+}
+}
+break;
+
 case MetaActionType::STRETCHTEXT:
 {
 bConfigured = implGetTextPosition( 
pAction, aPos, bEmpty );
@@ -1253,6 +1272,7 @@ void SVGTextWriter::endTextShape()
 mrParagraphEnumeration.clear();
 mrCurrentTextParagraph.clear();
 mpTextShapeElem.reset();
+maTextOpacity.clear();
 

[Libreoffice-commits] core.git: filter/qa filter/source test/source

2020-04-08 Thread Miklos Vajna (via logerrit)
 filter/qa/unit/data/semi-transparent-line.odg |binary
 filter/qa/unit/svg.cxx|   34 +++---
 filter/source/svg/svgwriter.cxx   |   47 --
 test/source/xmltesttools.cxx  |5 ++
 4 files changed, 61 insertions(+), 25 deletions(-)

New commits:
commit ea52d24b5a19bb54f91cd679a977332ec330880d
Author: Miklos Vajna 
AuthorDate: Wed Apr 8 17:47:24 2020 +0200
Commit: Miklos Vajna 
CommitDate: Wed Apr 8 18:25:18 2020 +0200

SVG export: fix lost semi-transparent line shapes

The line shape itself didn't really have a height, rather it had a
stroke. For some reason, the SVG mask then decides that nothing has to
be painted there, so unless the line is entirely opaque, the line shape
gets lost on export.

Fix the problem by handling transparency similar to the PDF export,
which detects if the whole purpose of the transparency gradient is to
pass around a transparency percentage. We don't need a mask in that
case, we can just use opacity as described at e.g.
.

Change-Id: I0355b9b09b6dd48bbacc5b7cc54fb71866304ef1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91932
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/filter/qa/unit/data/semi-transparent-line.odg 
b/filter/qa/unit/data/semi-transparent-line.odg
new file mode 100644
index ..2d28a694cea5
Binary files /dev/null and b/filter/qa/unit/data/semi-transparent-line.odg 
differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index d6bb68283b74..8e6524c688ba 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -20,9 +20,7 @@
 
 using namespace ::com::sun::star;
 
-#if !defined MACOSX
 char const DATA_DIRECTORY[] = "/filter/qa/unit/data/";
-#endif
 
 /// SVG filter tests.
 class SvgFilterTest : public test::BootstrapFixture, public 
unotest::MacrosTest, public XmlTestTools
@@ -34,10 +32,8 @@ public:
 void setUp() override;
 void tearDown() override;
 void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
-#if !defined MACOSX
 uno::Reference& getComponent() { return mxComponent; }
 void load(const OUString& rURL);
-#endif
 };
 
 void SvgFilterTest::setUp()
@@ -55,13 +51,11 @@ void SvgFilterTest::tearDown()
 test::BootstrapFixture::tearDown();
 }
 
-#if !defined MACOSX
 void SvgFilterTest::load(const OUString& rFileName)
 {
 OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + rFileName;
 mxComponent = loadFromDesktop(aURL);
 }
-#endif
 
 void SvgFilterTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
 {
@@ -100,6 +94,34 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
+{
+// Load a document with a semi-transparent line shape.
+load("semi-transparent-line.odg");
+
+// Export it to SVG.
+uno::Reference xStorable(getComponent(), 
uno::UNO_QUERY_THROW);
+SvMemoryStream aStream;
+uno::Reference xOut = new 
utl::OOutputStreamWrapper(aStream);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString("draw_svg_Export");
+aMediaDescriptor["OutputStream"] <<= xOut;
+xStorable->storeToURL("private:stream", 
aMediaDescriptor.getAsConstPropertyValueList());
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+// Get the style of the group around the actual  element.
+xmlDocPtr pXmlDoc = parseXmlStream();
+OUString aStyle = getXPath(
+pXmlDoc, 
"//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g", "style");
+OUString aPrefix("opacity: ");
+// Without the accompanying fix in place, this test would have failed, as 
the style was
+// "mask:url(#mask1)", not "opacity: ".
+CPPUNIT_ASSERT(aStyle.startsWith(aPrefix));
+int nPercent = std::round(aStyle.copy(aPrefix.getLength()).toDouble() * 
100);
+// Make sure that the line is still 30% opaque, rather than completely 
invisible.
+CPPUNIT_ASSERT_EQUAL(30, nPercent);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 8d491d122d0b..c276fd903048 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2382,32 +2382,43 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf,
 if( nMoveX || nMoveY )
 rMtf.Move( nMoveX, nMoveY );
 
-OUString aMaskId = "mask" + OUString::number( mnCurMaskId++ );
-
+OUString aStyle;
+if (rGradient.GetStartColor() == rGradient.GetEndColor())
 {
-SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, 
aXMLElemDefs, true, true );
+// Special case: constant alpha value.
+const Color& rColor = rGradient.GetStartColor();
+const double fOpacity = 1.0 - 

[Libreoffice-commits] core.git: filter/qa filter/source forms/source formula/source fpicker/source framework/source helpcompiler/source i18nlangtag/qa i18nlangtag/source idl/source include/canvas incl

2018-07-30 Thread Libreoffice Gerrit user
 filter/qa/cppunit/xslt-test.cxx   |1 +
 filter/source/config/cache/filtercache.cxx|1 +
 filter/source/config/cache/typedetection.cxx  |1 +
 filter/source/flash/swfwriter1.cxx|1 +
 filter/source/graphicfilter/icgm/cgm.cxx  |1 +
 filter/source/graphicfilter/ieps/ieps.cxx |1 +
 filter/source/graphicfilter/ios2met/ios2met.cxx   |1 +
 filter/source/graphicfilter/ipict/ipict.cxx   |1 +
 filter/source/graphicfilter/ipsd/ipsd.cxx |1 +
 filter/source/graphicfilter/iras/iras.cxx |1 +
 filter/source/graphicfilter/itiff/itiff.cxx   |1 +
 filter/source/graphicfilter/itiff/lzwdecom.cxx|1 +
 filter/source/msfilter/escherex.cxx   |1 +
 filter/source/msfilter/eschesdo.cxx   |1 +
 filter/source/msfilter/msdffimp.cxx   |1 +
 filter/source/msfilter/mstoolbar.cxx  |1 +
 filter/source/msfilter/msvbahelper.cxx|1 +
 filter/source/msfilter/rtfutil.cxx|1 +
 filter/source/msfilter/svdfppt.cxx|1 +
 filter/source/odfflatxml/OdfFlatXml.cxx   |1 +
 filter/source/pdf/impdialog.cxx   |1 +
 filter/source/svg/svgfilter.cxx   |1 +
 filter/source/svg/svgwriter.cxx   |1 +
 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx   |1 +
 filter/source/xsltfilter/XSLTFilter.cxx   |1 +
 forms/source/component/Edit.cxx   |1 +
 forms/source/component/FormComponent.cxx  |1 +
 forms/source/component/FormsCollection.cxx|1 +
 forms/source/component/ListBox.cxx|1 +
 forms/source/component/errorbroadcaster.cxx   |1 +
 forms/source/component/formcontrolfont.cxx|1 +
 forms/source/misc/InterfaceContainer.cxx  |1 +
 forms/source/richtext/attributedispatcher.cxx |1 +
 forms/source/richtext/richtextcontrol.cxx |1 +
 forms/source/richtext/richtextimplcontrol.cxx |1 +
 forms/source/runtime/formoperations.cxx   |1 +
 forms/source/xforms/datatypes.cxx |1 +
 forms/source/xforms/submission/replace.cxx|1 +
 formula/source/core/api/FormulaCompiler.cxx   |1 +
 formula/source/core/api/token.cxx |1 +
 formula/source/core/api/vectortoken.cxx   |1 +
 formula/source/ui/dlg/formula.cxx |1 +
 formula/source/ui/dlg/parawin.cxx |1 +
 fpicker/source/office/OfficeControlAccess.cxx |1 +
 fpicker/source/office/OfficeFilePicker.cxx|1 +
 fpicker/source/office/commonpicker.cxx|1 +
 fpicker/source/office/fpinteraction.cxx   |2 ++
 fpicker/source/office/iodlg.cxx   |1 +
 fpicker/source/win32/folderpicker/MtaFop.cxx  |1 +
 framework/source/accelerators/acceleratorconfiguration.cxx|1 +
 framework/source/accelerators/storageholder.cxx   |1 +
 framework/source/classes/framecontainer.cxx   |1 +
 framework/source/dispatch/dispatchprovider.cxx|1 +
 framework/source/dispatch/loaddispatcher.cxx  |1 +
 framework/source/dispatch/popupmenudispatcher.cxx |1 +
 framework/source/dispatch/servicehandler.cxx  |1 +
 framework/source/fwe/classes/addonsoptions.cxx|1 +
 framework/source/fwe/classes/framelistanalyzer.cxx|1 +
 framework/source/fwi/classes/protocolhandlercache.cxx |1 +
 framework/source/fwi/helper/mischelper.cxx|1 +
 framework/source/fwi/jobs/configaccess.cxx|1 +
 framework/source/fwi/threadhelp/transactionmanager.cxx|1 +
 framework/source/helper/ocomponentaccess.cxx  |1 +
 framework/source/helper/ocomponentenumeration.cxx |1 +
 framework/source/helper/oframes.cxx   |1 +
 framework/source/jobs/job.cxx

[Libreoffice-commits] core.git: filter/qa filter/source framework/source package/source qadevOOo/runner qadevOOo/tests sc/source sd/source sw/source

2017-12-11 Thread Ilmari Lauhakangas
 filter/qa/complex/filter/detection/typeDetection/TypeDetection.java |   26 
+-
 filter/source/msfilter/msdffimp.cxx |2 
 filter/source/xslt/import/wordml/wordml2ooo_draw.xsl|2 
 framework/source/services/frame.cxx |2 
 package/source/zippackage/ZipPackage.cxx|2 
 qadevOOo/runner/lib/MultiMethodTest.java|2 
 qadevOOo/tests/java/ifc/frame/_XDispatchRecorder.java   |2 
 qadevOOo/tests/java/ifc/text/_XTextRangeCompare.java|8 +--
 sc/source/filter/excel/xiescher.cxx |   16 
+++---
 sd/source/ui/func/fudraw.cxx|2 
 sd/source/ui/slidesorter/cache/SlsCacheCompactor.hxx|2 
 sw/source/core/docnode/nodes.cxx|2 
 sw/source/core/docnode/swbaslnk.cxx |2 
 sw/source/core/layout/wsfrm.cxx |2 
 14 files changed, 36 insertions(+), 36 deletions(-)

New commits:
commit 7d202623b007979d9d0f93f6cd62c3c031d6d1d4
Author: Ilmari Lauhakangas 
Date:   Mon Dec 11 19:14:07 2017 +0200

Fix typos and grammar

Change-Id: I4143da3c5a809118d57849664f6ab1d2e775837f
Reviewed-on: https://gerrit.libreoffice.org/46253
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git 
a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java 
b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index c7def3cd16e8..44a5d2de9ad0 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -60,8 +60,8 @@ import util.utils;
  * of the TypeDetection must match with an expected type.
  *
  *
- * To get information which test file should support which type, filter and
- * document service, this information was collect from configuration files:
+ * To get information on which test file should support which type, filter and
+ * document service, this information was collected from configuration files:
  * 
  * TypeDetection.props
  * files.csv
@@ -72,7 +72,7 @@ import util.utils;
  * 
  * 
  * typeDetection.props
- * At fist there will be the typeDetection.props. Here the 
following
+ * At first there will be the typeDetection.props. Here the 
following
  * properties should be set (with example values):
  *
  * TestDocumentPath=file:///path/to/my/testdocuments
@@ -100,7 +100,7 @@ import util.utils;
  * this file
  *
  * The second example displays two document types for
- * XInputStream (generic_Text). This
+ * XInputStream (generic_Text). These
  * two document types are listed by a colon ':' as separator.
  * This is needed because XInputStream can detect a text file as
  * generic_Text.
@@ -112,9 +112,9 @@ import util.utils;
  * filter to detect the document. This make sense ie. for csv-files: You can
  * open csv files as Writer or as Calc. To check this case you have to specify
  * in csv.files a fileAlias like ?csv_writer? and ?csv_calc? with
- * the same fileURL and it's specific defaultFileType.
- * The returned file type by TypeDetection must equal to
- * correspond defaultFileType from csv.files
+ * the same fileURL and its specific defaultFileType.
+ * The returned file type by TypeDetection must be equal to the
+ * corresponding defaultFileType from csv.files
  *
  * Syntax: fileAlias;FilterName;FilterOptions;FilterData
  * Example: Writer6_1;%SO6productname %SO6formatversion Textdocument;
@@ -125,18 +125,18 @@ import util.utils;
  * name which should be used. Here we have a special: %SO6productname
  * %SO6formatversion will be replaced by the equals of
  * typeDetection.props. The filter names depends on the Office
- * name and version. So a future Office could called ?StarSuite 8?.
+ * name and version. So a future Office could be called ?StarSuite 8?.
  * FilterOptions is not relevant for this filter. But ie. for csv
  * filter this entry could be used to specify the separator of the csv file.
  * FilterData if filter needs some FilterData arguments you can
- * specify it here
+ * specify them here
  *
  * 
  * 
  * preselectedType.csv
  * In this file you can preselect the type
  * TypeDetection should use.
- * The returned file type by TypeDetection must equal to the
+ * The file type returned by TypeDetection must be equal to the
  * preselected file type.
  * Note: If you try to use invalid types you will get a failed test because
  * TypeDetection tries to find out the type itself.
@@ -153,8 +153,8 @@ import util.utils;
  * 
  * 
  * serviceName.csv In this file you can preselect a service 
name
- * to detect the file type. The returned file type by
- * TypeDetection must equal to correspond
+ * to detect 

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

2017-09-11 Thread Stephan Bergmann
 filter/qa/cppunit/xslt-test.cxx |   44 +++-
 filter/source/xsltfilter/LibXSLTTransformer.cxx |   21 +--
 filter/source/xsltfilter/LibXSLTTransformer.hxx |3 +
 3 files changed, 48 insertions(+), 20 deletions(-)

New commits:
commit cd8aeed1569222edd8bfd05d9d833f74b679fcd0
Author: Stephan Bergmann 
Date:   Mon Sep 11 17:58:13 2017 +0200

Fix data races during CppunitTest_filter_xslt

Change-Id: I140ac8a24326959ba341adddbbf505ff16616283

diff --git a/filter/qa/cppunit/xslt-test.cxx b/filter/qa/cppunit/xslt-test.cxx
index 65de2667e493..7354cc85374f 100644
--- a/filter/qa/cppunit/xslt-test.cxx
+++ b/filter/qa/cppunit/xslt-test.cxx
@@ -7,7 +7,11 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -19,7 +23,6 @@
 #include 
 
 #include 
-#include 
 
 #include 
 #include 
@@ -51,22 +54,37 @@ public:
 CPPUNIT_TEST_SUITE_END();
 };
 
-struct Listener : public ::cppu::WeakImplHelper
+class Listener : public ::cppu::WeakImplHelper
 {
-bool m_bDone;
-
+public:
 Listener() : m_bDone(false) {}
 
+void wait() {
+std::unique_lock g(m_mutex);
+m_cond.wait(g, [this]() { return m_bDone; });
+}
+
+private:
+std::mutex m_mutex;
+std::condition_variable m_cond;
+bool m_bDone;
+
 virtual void SAL_CALL disposing(const lang::EventObject&) throw() override 
{}
-virtual void SAL_CALL started() throw() override { m_bDone = false; }
-virtual void SAL_CALL closed() throw() override { m_bDone = true; }
-virtual void SAL_CALL terminated() throw() override { m_bDone = true; }
+virtual void SAL_CALL started() throw() override {}
+virtual void SAL_CALL closed() throw() override { notifyDone(); }
+virtual void SAL_CALL terminated() throw() override { notifyDone(); }
 virtual void SAL_CALL error(const uno::Any& e) override
 {
-m_bDone = true; // set on error too, otherwise main thread waits 
forever
+notifyDone(); // set on error too, otherwise main thread waits forever
 SAL_WARN("filter.xslt", "exception " << e);
 CPPUNIT_FAIL("exception while in XSLT");
 }
+
+void notifyDone() {
+std::unique_lock g(m_mutex);
+m_bDone = true;
+m_cond.notify_all();
+}
 };
 
 void XsltFilterTest::testXsltCopyNew()
@@ -109,10 +127,7 @@ void XsltFilterTest::testXsltCopyNew()
 
 xXslt->start();
 
-TimeValue delay;
-delay.Seconds = 0;
-delay.Nanosec = 100;
-while (!xListener->m_bDone) { osl_waitThread(); }
+xListener->wait();
 
 xIn->closeInput();
 xOut->closeOutput();
@@ -171,10 +186,7 @@ void XsltFilterTest::testXsltCopyOld()
 
 xXslt->start();
 
-TimeValue delay;
-delay.Seconds = 0;
-delay.Nanosec = 100;
-while (!xListener->m_bDone) { osl_waitThread(); }
+xListener->wait();
 
 xIn->closeInput();
 xOut->closeOutput();
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx 
b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 33719eb5e4c6..35d3dfcc8242 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -298,7 +298,12 @@ namespace XSLT
 std::unique_ptr oh(new 
OleHandler(m_transformer->getComponentContext()));
 if (styleSheet)
 {
-m_tcontext = xsltNewTransformContext(styleSheet, doc);
+xsltTransformContextPtr tcontext = xsltNewTransformContext(
+styleSheet, doc);
+{
+std::unique_lock g(m_mutex);
+m_tcontext = tcontext;
+}
 oh->registercontext(m_tcontext);
 xsltQuoteUserParams(m_tcontext, [0]);
 result = xsltApplyStylesheetUser(styleSheet, doc, nullptr, 
nullptr, nullptr,
@@ -331,7 +336,10 @@ namespace XSLT
 oh.reset();
 xsltFreeStylesheet(styleSheet);
 xsltFreeTransformContext(m_tcontext);
-m_tcontext = nullptr;
+{
+std::unique_lock g(m_mutex);
+m_tcontext = nullptr;
+}
 xmlFreeDoc(doc);
 xmlFreeDoc(result);
 }
@@ -354,12 +362,17 @@ namespace XSLT
 
 void Reader::forceStateStopped()
 {
-if (!m_tcontext)
+xsltTransformContextPtr tcontext;
+{
+std::unique_lock g(m_mutex);
+tcontext = m_tcontext;
+}
+if (!tcontext)
 return;
 //tdf#100057 If we force a cancel, libxslt will of course just keep on 
going unless something
 //tells it to stop. Here we force the stopped state so that libxslt 
will stop processing
 //and so Reader::execute will complete and we can join cleanly
-m_tcontext->state = XSLT_STATE_STOPPED;
+tcontext->state = XSLT_STATE_STOPPED;
 }
 
 Reader::~Reader()
diff --git 

[Libreoffice-commits] core.git: filter/qa filter/source forms/qa forms/source formula/source fpicker/source framework/source

2017-05-20 Thread Johnny_M
 filter/qa/complex/filter/detection/typeDetection/TypeDetection.java |4 +-
 filter/source/graphicfilter/idxf/dxftblrd.hxx   |2 -
 filter/source/graphicfilter/ipcd/ipcd.cxx   |2 -
 filter/source/graphicfilter/ipsd/ipsd.cxx   |2 -
 filter/source/graphicfilter/iras/iras.cxx   |   14 
+-
 filter/source/graphicfilter/itga/itga.cxx   |2 -
 filter/source/msfilter/escherex.cxx |2 -
 filter/source/msfilter/eschesdo.hxx |1 
 filter/source/msfilter/msdffimp.cxx |8 
++---
 filter/source/msfilter/svdfppt.cxx  |8 
++---
 forms/qa/integration/forms/CellBinding.java |2 -
 forms/source/component/DatabaseForm.cxx |2 -
 forms/source/component/EventThread.hxx  |2 -
 forms/source/component/ListBox.hxx  |6 ++--
 forms/source/inc/FormComponent.hxx  |2 -
 forms/source/inc/property.hrc   |2 -
 forms/source/richtext/richtextunowrapper.cxx|2 -
 formula/source/core/resource/core_resource.src  |4 +-
 formula/source/ui/dlg/formdlgs.hrc  |2 -
 formula/source/ui/dlg/funcutl.cxx   |7 
++---
 formula/source/ui/dlg/parawin.hxx   |2 -
 fpicker/source/office/OfficeFilePicker.cxx  |2 -
 fpicker/source/office/OfficeFolderPicker.cxx|2 -
 framework/source/services/pathsettings.cxx  |4 +-
 24 files changed, 42 insertions(+), 44 deletions(-)

New commits:
commit fd48f39a7ec080c868b314e06bc91efd160e87c9
Author: Johnny_M 
Date:   Fri May 19 21:55:00 2017 +0200

Translate German comments and debug strings (leftovers in f... dirs)

Translates all (leftovers) found using a custom regex, in directories not
shown by /bin/find-german-comments and beginning with "f".

Additionally:
- Fixed translation in formula/source/ui/dlg/funcutl.cxx (translated in

https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=5e04331fc0a6434c61d3d18843cb4f80a44e5989
 ),
because clearing an event is quite the opposite of its triggering.

Change-Id: I0fd62193a29883796cd05e5a80ce8a2900636b6c
Reviewed-on: https://gerrit.libreoffice.org/37839
Reviewed-by: Chris Sherlock 
Tested-by: Chris Sherlock 

diff --git 
a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java 
b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index d487c2176a84..c7def3cd16e8 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -491,8 +491,8 @@ public class TypeDetection extends ComplexTestCase {
  try{
 
 /*
- *als Dateien die typeDetection.props und eine der csv-Dateien
- *benutzten. diese können per dmake einfach auf andere Rechte 
setzten
+ * As files, use the typeDetection.props and one of the csv files.
+ * Those can, via dmake, simply set rights on others.
  *
  */
 log.println("### checkStreamLoader() ###");
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx 
b/filter/source/graphicfilter/idxf/dxftblrd.hxx
index 824b03bf2993..3dd5edc7aa60 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.hxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.hxx
@@ -137,7 +137,7 @@ public:
 };
 
 
-//-- Tabellen 
+//-- Tables --
 
 
 class DXFTables {
diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx 
b/filter/source/graphicfilter/ipcd/ipcd.cxx
index c78101ebddca..77ab89ddedb7 100644
--- a/filter/source/graphicfilter/ipcd/ipcd.cxx
+++ b/filter/source/graphicfilter/ipcd/ipcd.cxx
@@ -195,7 +195,7 @@ void PCDReader::ReadImage()
 sal_uInt8 * pL0; // luminance for each pixel of the 1st row of the current 
pair of rows
 sal_uInt8 * pL1; // luminance for each pixel of the 2nd row of the current 
pair of rows
 sal_uInt8 * pCb; // blue chrominance for each 2x2 pixel of the current 
pair of rows
-sal_uInt8 * pCr; // red chrominance fuer je 2x2 pixel of the current pair 
of rows
+sal_uInt8 * pCr; // red chrominance for each 2x2 pixel of the current pair 
of rows
 sal_uInt8 * pL0N, * pL1N, * pCbN, * pCrN; // like above, but for the next 
pair of rows
 
 if ( 

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

2017-03-30 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff |binary
 filter/source/graphicfilter/itiff/ccidecom.cxx |   37 +++--
 filter/source/graphicfilter/itiff/ccidecom.hxx |   18 +++---
 filter/source/graphicfilter/itiff/itiff.cxx|   22 ++--
 4 files changed, 53 insertions(+), 24 deletions(-)

New commits:
commit bb3715b6283f0d828be92065016d7b65d8671088
Author: Caolán McNamara 
Date:   Thu Mar 30 21:10:46 2017 +0100

ofz#967 optimize tiff import if line is the same as previous line

Change-Id: Ided61679a579a73481320f85c05b03e3ce3d762a

diff --git a/filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff 
b/filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff
new file mode 100644
index ..8eb7c8078054
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/pass/multi-page-1.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx 
b/filter/source/graphicfilter/itiff/ccidecom.cxx
index b5f3ab4cf529..a7d0ffc49f14 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -624,18 +624,17 @@ void CCIDecompressor::StartDecompression( SvStream & 
rIStream )
 return;
 }
 
-
-bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong 
nTargetBits, bool bLastLine )
+DecompressStatus CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, 
sal_uLong nTargetBits, bool bLastLine )
 {
 //Read[1|2]DScanlineData take a sal_uInt16, so its either limit here or 
expand there
 if (nTargetBits > SAL_MAX_UINT16)
-return false;
+return DecompressStatus(false, true);
 
 if ( nEOLCount >= 5 )   // RTC (Return To Controller)
-return true;
+return DecompressStatus(true, true);
 
 if ( !bStatus )
-return false;
+return DecompressStatus(false, true);
 
 // If EOL-Codes exist, the EOL-Code also appeared in front of the first 
line.
 // (and I thought it means 'End of Line'...)
@@ -660,13 +659,13 @@ bool CCIDecompressor::DecompressScanline( sal_uInt8 * 
pTarget, sal_uLong nTarget
 {
 if ( !ReadEOL( nTargetBits ) )
 {
-return bStatus;
+return DecompressStatus(bStatus, true);
 }
 }
 }
 
 if ( nEOLCount >= 5 )   // RTC (Return To Controller)
-return true;
+return DecompressStatus(true, true);
 
 // should the situation arise, generate a white previous line for 2D:
 if ( nOptions & CCI_OPTION_2D )
@@ -696,11 +695,12 @@ bool CCIDecompressor::DecompressScanline( sal_uInt8 * 
pTarget, sal_uLong nTarget
 else
 b2D = false;
 
+bool bUnchanged;
 // read scanline:
 if ( b2D )
-Read2DScanlineData( pTarget, (sal_uInt16)nTargetBits );
+bUnchanged = Read2DScanlineData(pTarget, nTargetBits);
 else
-Read1DScanlineData( pTarget, (sal_uInt16)nTargetBits );
+bUnchanged = Read1DScanlineData(pTarget, nTargetBits);
 
 // if we're in 2D mode we have to remember the line:
 if ( nOptions & CCI_OPTION_2D && bStatus )
@@ -717,7 +717,7 @@ bool CCIDecompressor::DecompressScanline( sal_uInt8 * 
pTarget, sal_uLong nTarget
 if ( pIStream->GetError() )
 bStatus = false;
 
-return bStatus;
+return DecompressStatus(bStatus, bUnchanged);
 }
 
 
@@ -923,8 +923,9 @@ sal_uInt16 CCIDecompressor::CountBits(const sal_uInt8 * 
pData, sal_uInt16 nDataS
 return nPos-nBitPos;
 }
 
-void CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 
nTargetBits)
+bool CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 
nBitsToRead)
 {
+sal_uInt16 nTargetBits = nBitsToRead;
 sal_uInt16 nCode,nCodeBits,nDataBits,nTgtFreeByteBits;
 sal_uInt8 nByte;
 sal_uInt8 nBlackOrWhite; // is 0xff for black or 0x00 for white
@@ -962,11 +963,11 @@ void CCIDecompressor::Read1DScanlineData(sal_uInt8 * 
pTarget, sal_uInt16 nTarget
 // is that an invalid code?
 if ( nDataBits ==  )
 {
-return;
+return nTargetBits == nBitsToRead;
 }
 if ( nCodeBits == 0 )
 {
-return; // could be filling bits now
+return nTargetBits == nBitsToRead;  // could be filling bits now
 }
 nEOLCount = 0;
 // too much data?
@@ -1017,10 +1018,11 @@ void CCIDecompressor::Read1DScanlineData(sal_uInt8 * 
pTarget, sal_uInt16 nTarget
 if (bTerminatingCode) nBlackOrWhite = ~nBlackOrWhite;
 
 } while (nTargetBits>0 || !bTerminatingCode);
-}
 
+return nTargetBits == nBitsToRead;
+}
 
-void CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 
nTargetBits)
+bool CCIDecompressor::Read2DScanlineData(sal_uInt8 * pTarget, sal_uInt16 
nTargetBits)
 {
 sal_uInt16 n2DMode,nBitPos,nUncomp,nRun,nRun2,nt;
 sal_uInt8 nBlackOrWhite;
@@ -1032,7 +1034,7 @@ void 

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

2017-02-28 Thread Caolán McNamara
 filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf |  143 +
 filter/source/graphicfilter/idxf/dxf2mtf.cxx   |   12 --
 2 files changed, 148 insertions(+), 7 deletions(-)

New commits:
commit b018021d5a5e644f1d8aafd20432562621b33554
Author: Caolán McNamara 
Date:   Tue Feb 28 20:45:49 2017 +

ofz: timeout on clamping big double to 0..360

Change-Id: Ica2aedc5275e5f523302f5793e3f3816b3ff65b4

diff --git a/filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf 
b/filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf
new file mode 100644
index 000..3c47414
--- /dev/null
+++ b/filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf
@@ -0,0 +1,143 @@
+99
+170141183460469231731687303715884105718
+  2
+BL0C
+  0
+SECTION
+  2
+ENTITIES
+  0111
N9.0
+0
+ARC
+111
N9
+  1
+I
+
39
+9 
+130
+
+  51
+1758770265ded1a13ecce6855794837535bf766a7fRC
+111
N9.0007
+
39
+9 
+130
+10
+  2
+BL0C
+  0
+SECTION
+  2
+ENTITIES
+  0111
N9.0
+0
+ARC
+111
N9
+  1
+I
+
39
+9 
+130
+
+  51
+9705
+0
+ARC
+111

39
+9 
+130
+
+  51
+183460469231731687303715884105718
+  2
+BL0C
+  0
+SECTION
+  2
+ENTITIES
+  0111
N9.0
+0
+ARC
+111
N9
+  1
+I
+
39
+9 
+130
+
+  51
+1758770265ded1a13ecce6855794837535bf766a7fRC
+111
N9.0007
+
39
+9 
+130
+10
+  2
+BL0C
+  0
+SECTION
+  2
+ENTITIES
+  0111
N9.0
+0
+ARC
+111
N9
+  1
+I
+
39
+9 
+130
+
+  51
+9705
+0
+ARC
+111

39
+9 
+130
+
+  51
+197
+0
+ARC
+111
N9.00÷dL07
+
39
+9 
+130
+
+  56
+15
+  8
+
+0
+EOF
+111
N9.0
+  56*
+15
+  8
+
+0
+EO?
+111
197
+0
+ARC
+111
N9.00÷dL07
+
39
+9 
+130
+
+  56
+15
+  8
+
+0
+EOF
+111
N9.0
+  56*
+15
+  8
+
+0
+EO?
+111
N9.000
+3
N 2S 79 799
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx 
b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index 9255fb9..64ce94c 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -296,19 +296,18 @@ void DXF2GDIMetaFile::DrawCircleEntity(const 
DXFCircleEntity & rE, const DXFTran
 }
 }
 
-
 void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & rE, const 
DXFTransform & rTransform)
 {
-double frx,fry,fA1,fdA;
+double frx,fry;
 sal_uInt16 nPoints,i;
 DXFVector aC;
 Point aPS,aPE;
 
 if (!SetLineAttribute(rE)) return;
-fA1=rE.fStart;
-fdA=rE.fEnd-fA1;
-while (fdA>=360.0) fdA-=360.0;
-while (fdA<=0) fdA+=360.0;
+double fA1=rE.fStart;
+double fdA=rE.fEnd-fA1;
+fdA = fmod(fdA, 360.0);
+if (fdA<=0) fdA+=360.0;
 rTransform.Transform(rE.aP0,aC);
 if (rE.fThickness==0 && fdA>5.0 && 
rTransform.TransCircleToEllipse(rE.fRadius,frx,fry)) {
 DXFVector 
aVS(cos(fA1/180.0*3.14159265359),sin(fA1/180.0*3.14159265359),0.0);
@@ -359,7 +358,6 @@ void DXF2GDIMetaFile::DrawArcEntity(const DXFArcEntity & 
rE, const DXFTransform
 }
 }
 
-
 void DXF2GDIMetaFile::DrawTraceEntity(const DXFTraceEntity & rE, const 
DXFTransform & rTransform)
 {
 if (SetLineAttribute(rE)) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-13 Thread Caolán McNamara
 filter/qa/cppunit/data/dxf/pass/loop-2.dxf|13974 ++
 filter/source/graphicfilter/idxf/dxfreprd.cxx |7 
 filter/source/graphicfilter/idxf/dxfreprd.hxx |2 
 3 files changed, 13982 insertions(+), 1 deletion(-)

New commits:
commit 7420e350906558556881afc213f942d45d3e0b60
Author: Caolán McNamara 
Date:   Fri Jan 13 15:12:18 2017 +

guard against self-recursive GetBoundingBox

Change-Id: If33f0e5e326604bf731d6ad50644e3a0b24ccf51

diff --git a/filter/qa/cppunit/data/dxf/pass/loop-2.dxf 
b/filter/qa/cppunit/data/dxf/pass/loop-2.dxf
new file mode 100644
index 000..961dd35
--- /dev/null
+++ b/filter/qa/cppunit/data/dxf/pass/loop-2.dxf
@@ -0,0 +1,13974 @@
+  0
+SECTION*
+  2
+HEADER
+  9
+$ACADVER
+  1
+AC1015
+  9
+$ACADMAINTVER
+ 70
+ 6
+  9
+$DWGCODEPAGE
+  3
+ANSI_1252
+  9
+$INSBASE
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$EXTMIN
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$EXTMAX
+ 10
+297.0
+ 20
+420.0
+ 30
+0.0
+  9
+$LIMMIN
+ 10
+0.0
+ 20
+0.0
+  9
+$LIMMAX
+ 10
+297.0
+ 20
+420.0
+  9
+$ORTHOMODE
+ 70
+ 0
+  9
+$REGENMODE
+ 70
+ 1
+  9
+$FILL«ODE
+ 70
+ 1
+  9
+$QTEXTMODE
+ 70
+ 0
+  9
+$MIRRTEXT
+ 70
+ 1
+  0
+DIMSTYLE
+105
+501
+102
+{ACAD_REACTORS
+330
+500
+102
+}
+330
+A
+100
+AcDbSymbolTableRecord
+100
+AcDbDimStyleTableRecord
+  2
+SLDDIMSTYLE0
+ 70
+ 0
+ 41
+3.0
+ 44
+0.0
+ 45
+0.1
+ 73
+ 0
+ 74
+ 0
+ 77
+ 1
+ 78
+12
+ 79
+ 3
+140
+3.5
+144
+2.5
+147
+0.875
+172
+ 1
+173
+ 1
+178
+ 0
+271
+ 3
+272
+ 3
+276
+ 2
+284
+12
+289
+ 0
+340
+54
+  0
+DIMSTYLE
+105
+50E
+102
+{ACAD_REACTORS
+330
+50D
+330
+51A
+330
+526
+330
+56C
+330
+578
+330
+584
+102
+}
+330
+A
+100
+AcDbSymbolTableRecord
+100
+AcDbDimStyleTableRecord
+  2
+SLDDIMSTYLE1
+ 70
+ 0
+ 41
+3.0
+ 44
+0.0
+ 45
+0.1
+ 73
+ 0
+ 74
+ 0
+ 77
+ 1
+ 78
+12
+ 79
+ 3
+140
+3.5
+144
+2.5
+147
+0.875
+172
+ 1
+173
+ 1
+178
+ 0
+271
+ 0
+272
+ 0
+276
+ 2
+284
+12
+289
+ 0
+340
+54
+  0
+DIMSTYLE
+105
+533
+102
+{ACAD_REACTORS
+330
+532
+330
+53C
+330
+545
+330
+54E
+330
+557
+330
+561
+102
+}
+330
+A
+100
+AcDbSymbolTableRecord
+100
+AcDbDimStyleTableRecord
+  2
+SLDDIMSTYLE2
+ 70
+ 0
+ 41
+3.0
+ 44
+0.0
+ 45
+0.1
+ 73
+ 0
+ 74
+ 0
+ 77
+ 1
+ 78
+12
+ 79
+ 3
+140
+3.5
+144
+2.5
+147
+0.875
+173
+ 1
+178
+ 0
+271
+ 3
+272
+ 3
+276
+ 2
+284
+12
+340
+54
+  0
+ENDTAB
+  0
+TABLE
+  2
+BLOCK_RECORD
+  5
+1
+330
+0
+100
+AcDbSymbolTable
+ 70
+15
+  0
+BLOCK_RECORD
+  5
+1F
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Model_Space
+340
+22
+  0
+BLOCK_RECORD
+  5
+1B
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Paper_Space
+340
+1E
+  0
+BLOCK_RECORD
+  5
+23
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+*Paper_Space0
+340
+26
+  0
+BLOCK_RECORD
+  5
+56
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+SW_BROKEN_VIEW_0
+340
+0
+102
+{BLKREFS
+331
+59
+102
+}
+  0
+BLOCK_RECORD
+  5
+502
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D
+340
+0
+  0
+BLOCK_RECORD
+  5
+50F
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_1
+340
+0
+  0
+BLOCK_RECORD
+  5
+51B
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_2
+340
+0
+  0
+BLOCK_RECORD
+  5
+527
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_3
+340
+0
+  0
+BLOCK_RECORD
+  5
+534
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_4
+340
+0
+  0
+BLOCK_RECORD
+  5
+53D
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_5
+340
+0
+  0
+BLOCK_RECORD
+  5
+546
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_6
+340
+0
+  0
+BLOCK_RECORD
+  5
+54F
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_7
+340
+0
+  0
+BLOCK_RECORD
+  5
+558
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_8
+340
+0
+  0
+BLOCK_RECORD
+  5
+562
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_9
+340
+0
+  0
+BLOCK_RECORD
+  5
+56D
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_10
+340
+0
+  0
+BLOCK_RECORD
+  5
+579
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_11
+340
+0
+  0
+BLOCK_RECORD
+  5
+585
+330
+1
+100
+AcDbSymbolTableRecord
+100
+AcDbBlockTableRecord
+  2
+_D_12
+340
+0
+  0
+ENDTAB
+  0
+ENDSEC
+  0
+SECTION
+  2
+BLOCKS
+  0
+BLOCK
+  5
+20
+330
+1F
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockBegin
+  2
+*Model_Space
+ 70
+ 0
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  3
+*Model_Space
+  1
+
+  0
+ENDBLK
+  5
+21
+330
+1F
+100
+AcDbEntity
+  8
+0
+100
+AcDbBlockEnd
+  0
+BLOCK
+  5
+1C
+330
+1B
+100
+AcDbEntity
+ 67
+ 1
+  8
+0
+100
+AcDbBlockBegin
+  2
+*Paper_Space
+ 70
+ 0
+ 10
+0.0
+ 20
+0.0
+ 

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

2017-01-13 Thread Caolán McNamara
 filter/qa/cppunit/data/dxf/pass/loop-1.dxf|17320 ++
 filter/source/graphicfilter/idxf/dxf2mtf.cxx  |6 
 filter/source/graphicfilter/idxf/dxfentrd.hxx |   25 
 3 files changed, 17337 insertions(+), 14 deletions(-)

New commits:
commit 57779b5f3a49fedd952aed70ddcce22f48b98ea5
Author: Caolán McNamara 
Date:   Fri Jan 13 13:18:53 2017 +

avoid infinite loops in dxf rendering

Change-Id: Id2eb5540241f0792cde35c444fc2c0c5b7778353

diff --git a/filter/qa/cppunit/data/dxf/pass/loop-1.dxf 
b/filter/qa/cppunit/data/dxf/pass/loop-1.dxf
new file mode 100644
index 000..e3277e6
--- /dev/null
+++ b/filter/qa/cppunit/data/dxf/pass/loop-1.dxf
@@ -0,0 +1,17320 @@
+  0
+SECTION
+  2
+HEADER
+  9
+$ACADVER
+  1
+AC1015
+  9
+$ACADMAINTVER
+ 70
+ 6
+  9
+$DWGCODEPAGE
+  3
+ANSI_1252
+  9
+$INSBASE
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$EXTMIN
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$EXTMAX
+ 10
+297.0
+ 20
+420.0
+ 30
+0.0
+  9
+$LIMMIN
+ 10
+0.0
+ 20
+0.0
+  9
+$LIMMAX
+ 10
+297.0
+ 20
+420.0
+  9
+$ORTHOMODE
+ 70
+ 0
+  9
+$REGENMODE
+ 70
+ 1
+  9
+$FILL«ODE
+ 70
+ 1
+  9
+$QTEXTMODE
+ 70
+ 0
+  9
+$MIRRTEXT
+ 70
+ 1
+  9
+$LTSCALE
+ 40
+1.0
+  9
+$ATTMODE
+ 70
+ 1
+  9
+$TEXTSIZE
+ 40
+3.5
+  9
+$TRACEWID
+ 40
+1.0
+  9
+$TEXTSTYLE
+  7
+Standard
+  9
+$CLAYER
+  8
+0
+  9
+$CELTYPE
+  6
+ByLayer
+  9
+$CECOLOR
+ 62
+   256
+  9
+$CELTSCALE
+ 40
+1.0
+  9
+$DISPSILH
+ 70
+ 0
+  9
+$DIMSCALE
+ 40
+1.0
+  9
+$DIMASZ
+ 40
+3.0
+  9
+$DIMEXO
+ 40
+1.0
+  9
+$DIMDLI
+ 40
+3.75
+  9
+$DIMRND
+ 40
+0.0
+  9
+$DIMDLE
+ 40
+0.0
+  9
+$DIMEXE
+ 40
+1.0
+  9
+$DIMTP
+ 40
+0.0
+  9
+$DIMTM
+ 40
+0.0
+  9
+$DIMTXT
+ 40
+3.5
+  9
+$DIMCEN
+ 40
+2.5
+  9
+$DIMTSZ
+ 40
+0.0
+  9
+$DIMTOL
+ 70
+ 0
+  9
+$DIMLIM
+ 70
+ 0
+  9
+$DIMTIH
+ 70
+ 1
+  9
+$DIMTOH
+ 70
+ 1
+  9
+$DIMSE1
+ 70
+ 0
+  9
+$DIMSE2
+ 70
+ 0
+  9
+$DIMTAD
+ 70
+ 1
+  9
+$DIMZIN
+ 70
+ 0
+  9
+$DIMBLK
+  1
+
+  9
+$DIMASO
+ 70
+ 1
+  9
+$DIMSHO
+ 70
+ 1
+  9
+$DIMPOST
+  1
+
+  9
+$DIMAPOST
+  1
+
+  9
+$DIMALT
+ 70
+ 0
+  9
+$DIMALTD
+ 70
+ 3
+  9
+$DIMALTF
+ 40
+0.0393700787
+  9
+$DIMLFAC
+ 40
+100.0
+  9
+$DIMTOFL
+ 70
+ 1
+  9
+$DIMTVP
+ 40
+0.0
+  9
+$DIMTIX
+ 70
+ 0
+  9
+$DIMSOXD
+ 70
+ 0
+  9
+$DIMSAH
+ 70
+ 0
+  9
+$DIMBLK1
+  1
+
+  9
+$DIMBLK2
+  1
+
+  9
+$DIMSTYLE
+  2
+ISO-25
+  9
+$DIMCLRD
+ 70
+ 0
+  9
+$DIMCLRE
+ 70
+ 0
+  9
+$DIMCLRT
+ 70
+ 0
+  9
+$DIMTFAC
+ 40
+1.0
+  9
+$DIMGAP
+ 40
+1.524
+  9
+$DIMJUST
+ 70
+ 0
+  9
+$DIMSD1
+ 70
+ 0
+  9
+$DIMSD2
+ 70
+ 0
+  9
+$DIMTOLJ
+ 70
+ 0
+  9
+$DIMTZIN
+ 70
+ 0
+  9
+$DIMALTZ
+ 70
+ 0
+  9
+$DIMALTTZ
+ 70
+ 0
+  9
+$DIMUPT
+ 70
+ 0
+  9
+$DIMDEC
+ 70
+ 3
+  9
+$DIMTDEC
+ 70
+ 3
+  9
+$DIMALTU
+ 70
+ 2
+  9
+$DIMALTTD
+ 70
+ 3
+  9
+$DIMTXSTY
+  7
+Standard
+  9
+$DIMAUNIT
+ 70
+ 0
+  9
+$DIMADEC
+ 70
+ 2
+  9
+$DIMALTRND
+ 40
+0.0
+  9
+$DIMAZIN
+ 70
+ 0
+  9
+$DIMDSEP
+ 70
+44
+  9
+$DIMATFIT
+ 70
+ 3
+  9
+$DIMFRAC
+ 70
+ 0
+  9
+$DIMLDRBLK
+  1
+
+  9
+$DIMLUNIT
+ 70
+ 2
+  9
+$DIMLWD
+ 70
+-2
+  9
+$DIMLWE
+ 70
+-2
+  9
+$DIMTMOVE
+ 70
+ 0
+  9
+$LUNITS
+ 70
+ 2
+  9
+$LUPREC
+ 70
+ 2
+  9
+$SKETCHINC
+ 40
+1.0
+  9
+$FILLETRAD
+ 40
+10.0
+  9
+$AUNITS
+ 70
+ 0
+  9
+$AUPREC
+ 70
+ 2
+  9
+$MENU
+  1
+.
+  9
+$ELEVATION
+ 40
+0.0
+  9
+$PELEVATION
+ 40
+0.0
+  9
+$THICKNESS
+ 40
+0.0
+  9
+$LIMCHECK
+ 70
+ 0
+  9
+$CHAMFERA
+ 40
+10.0
+  9
+$CHAMFERB
+ 40
+10.0
+  9
+$CHAMFERC
+ 40
+20.0
+  9
+$CHAMFERD
+ 40
+0.0
+  9
+$SKPOLY
+ 70
+ 0
+  9
+$TDCREATE
+ 40
+2456962.662635255
+  9
+$TDUCREATE
+ 40
+2456962.620968588
+  9
+$TDUPDATE
+ 40
+2456962.662636401
+  9
+$TDUUPDATE
+ 40
+2456962.620969734
+  9
+$TDINDWG
+ 40
+0.000116
+  9
+$TDUSRTIMER
+ 40
+0.000116
+  9
+$USRTIMER
+ 70
+ 1
+  9
+$ANGBASE
+ 50
+0.0
+  9
+$ANGDIR
+ 70
+ 0
+  9
+$PDMODE
+ 70
+ 0
+  9
+$PDSIZE
+ 40
+-1.0
+  9
+$PLINEWID
+ 40
+0.0
+  9
+$SPLFRAME
+ 70
+ 0
+  9
+$SPLINETYPE
+ 70
+ 6
+  9
+$SPLINESEGS
+ 70
+ 8
+  9
+$HANDSEED
+  5
+5C0
+  9
+$SURFTAB1
+ 70
+ 6
+  9
+$SURFTAB2
+ 70
+ 6
+  9
+$SURFTYPE
+ 70
+ 6
+  9
+$SURFU
+ 70
+ 6
+  9
+$SURFV
+ 70
+ 6
+  9
+$UCSBASE
+  2
+
+  9
+$UCSNAME
+  2
+
+  9
+$UCSORG
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSXDIR
+ 10
+1.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSYDIR
+ 10
+0.0
+ 20
+1.0
+ 30
+0.0
+  9
+$UCSORTHOREF
+  2
+
+  9
+$UCSORTHOVIEW
+ 70
+ 0
+  9
+$UCSORGTOP
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSORGBOTTOM
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSORGLEFT
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSORGRIGHT
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSORGFRONT
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$UCSORGBACK
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$PUCSBASE
+  2
+
+  9
+$PUCSNAME
+  2
+
+  9
+$PUCSORG
+ 10
+0.0
+ 20
+0.0
+ 30
+0.0
+  9
+$PUCSXDIR
+ 10
+1.0
+ 20
+0.0
+ 30

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

2015-10-03 Thread Andrea Gelmini
 filter/qa/complex/filter/detection/typeDetection/TypeDetection.java |4 +-
 filter/qa/complex/filter/misc/FinalizedMandatoryTest.java   |2 -
 filter/source/config/cache/basecontainer.cxx|2 -
 filter/source/config/cache/cacheitem.cxx|   20 
+-
 filter/source/config/cache/cacheitem.hxx|4 +-
 filter/source/config/cache/contenthandlerfactory.cxx|2 -
 filter/source/config/cache/filtercache.cxx  |   10 
++---
 filter/source/config/cache/filtercache.hxx  |8 ++--
 filter/source/config/cache/filterfactory.cxx|6 +--
 filter/source/config/cache/frameloaderfactory.cxx   |2 -
 filter/source/config/cache/typedetection.cxx|   10 
++---
 filter/source/config/cache/typedetection.hxx|2 -
 filter/source/flash/swfexporter.cxx |2 -
 filter/source/graphicfilter/eos2met/eos2met.cxx |2 -
 filter/source/graphicfilter/eps/eps.cxx |2 -
 15 files changed, 39 insertions(+), 39 deletions(-)

New commits:
commit ba65cb97bc806cad3bfa1a0cf443b41eff518059
Author: Andrea Gelmini 
Date:   Fri Oct 2 13:04:33 2015 +0200

Fix typos

Change-Id: Icde566ef79dc4ed8cb67a89c743f0a6c1b3c8f14

diff --git 
a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java 
b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index 72fb166..5c87c22 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -224,7 +224,7 @@ public class TypeDetection extends ComplexTestCase {
 String kName = k.next();
 log.println(kName + ":" + param.get(kName).toString());
 }
-// create instrace of helper class
+// create instance of helper class
 helper = new Helper(param, log);
 
 }
@@ -543,4 +543,4 @@ public class TypeDetection extends ComplexTestCase {
 }
 
  }
-}
\ No newline at end of file
+}
diff --git a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java 
b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java
index 5967a7e..1fed782 100644
--- a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java
+++ b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java
@@ -121,7 +121,7 @@ public class FinalizedMandatoryTest
 
 /**
  * test the given service serviceName.
- * For every filter a new instace was created and the tests started.
+ * For every filter a new instance was created and the tests started.
  * @param serviceName the name of the service to test
  */
 private void checkReadonlySupport(String serviceName) throws Exception
diff --git a/filter/source/config/cache/basecontainer.cxx 
b/filter/source/config/cache/basecontainer.cxx
index fa2a468..03f8c0f 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -92,7 +92,7 @@ void BaseContainer::impl_loadOnDemand()
 
 // A generic container needs all items of a set of our cache!
 // Of course it can block for a while, till the cache is really filled.
-// Note: dont load all sets supported by the cache here!
+// Note: don't load all sets supported by the cache here!
 
 FilterCache::EFillState eRequiredState = FilterCache::E_CONTAINS_NOTHING;
 switch(m_eType)
diff --git a/filter/source/config/cache/cacheitem.cxx 
b/filter/source/config/cache/cacheitem.cxx
index 36420be..ed235ca 100644
--- a/filter/source/config/cache/cacheitem.cxx
+++ b/filter/source/config/cache/cacheitem.cxx
@@ -244,7 +244,7 @@ bool isSubSet(const css::uno::Any& aSubSet,
 {
 if (::std::find(stl_s2.begin(), stl_s2.end(), *it1) == 
stl_s2.end())
 {
-_FILTER_CONFIG_LOG_1_("isSubSet() ... check for list 
types [OUString] ... dont found \"%s\" => return FALSE\n", 
_FILTER_CONFIG_TO_ASCII_(*it1))
+_FILTER_CONFIG_LOG_1_("isSubSet() ... check for list 
types [OUString] ... didn't found \"%s\" => return FALSE\n", 
_FILTER_CONFIG_TO_ASCII_(*it1))
 return false;
 }
 _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types 
[OUString] ... found \"%s\" => continue loop\n", _FILTER_CONFIG_TO_ASCII_(*it1))
@@ -271,7 +271,7 @@ bool isSubSet(const css::uno::Any& aSubSet,
 ::comphelper::SequenceAsHashMap::const_iterator it2 = 
stl_p2.find(it1->first);
 if (it2 == stl_p2.end())
 {
-_FILTER_CONFIG_LOG_1_("isSubSet() ... check for list 
types [PropertyValue] ... dont found \"%s\" => return FALSE\n", 

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

2015-09-11 Thread Caolán McNamara
 filter/qa/cppunit/data/ras/fail/hang-1.ras |binary
 filter/source/graphicfilter/iras/iras.cxx  |   47 +++--
 2 files changed, 32 insertions(+), 15 deletions(-)

New commits:
commit b43e03353aeb04ed74a272d98df03dd7c20f3478
Author: Caolán McNamara 
Date:   Fri Sep 11 15:38:01 2015 +0100

check stream status more often

Change-Id: I233c2fff9c06a81117f8114ccee83b53ea4026db

diff --git a/filter/qa/cppunit/data/ras/fail/hang-1.ras 
b/filter/qa/cppunit/data/ras/fail/hang-1.ras
new file mode 100644
index 000..44dec67
Binary files /dev/null and b/filter/qa/cppunit/data/ras/fail/hang-1.ras differ
diff --git a/filter/source/graphicfilter/iras/iras.cxx 
b/filter/source/graphicfilter/iras/iras.cxx
index 5877fa2..e3209bd 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -222,31 +222,43 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 case 1 :
 for (y = 0; y < mnHeight && mbStatus; ++y)
 {
-for ( x = 0; x < mnWidth; x++ )
+for (x = 0; x < mnWidth && mbStatus; ++x)
 {
 if (!(x & 7))
+{
 nDat = ImplGetByte();
+if (!m_rRAS.good())
+mbStatus = false;
+}
 pAcc->SetPixelIndex( y, x,
 sal::static_int_cast< sal_uInt8 >(
 nDat >> ( ( x & 7 ) ^ 7 )) );
 }
-if (!( ( x - 1 ) & 0x8 ) ) ImplGetByte();   // WORD 
ALIGNMENT ???
-if (!m_rRAS.good())
-mbStatus = false;
+if (!( ( x - 1 ) & 0x8 ) )
+{
+ImplGetByte();   // WORD ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
+}
 }
 break;
 
 case 8 :
 for (y = 0; y < mnHeight && mbStatus; ++y)
 {
-for ( x = 0; x < mnWidth; x++ )
+for (x = 0; x < mnWidth && mbStatus; ++x)
 {
 nDat = ImplGetByte();
 pAcc->SetPixelIndex( y, x, nDat );
+if (!m_rRAS.good())
+mbStatus = false;
+}
+if ( x & 1 )
+{
+ImplGetByte(); // WORD ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
 }
-if ( x & 1 ) ImplGetByte(); // WORD 
ALIGNMENT ???
-if (!m_rRAS.good())
-mbStatus = false;
 }
 break;
 
@@ -257,7 +269,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 case 24 :
 for (y = 0; y < mnHeight && mbStatus; ++y)
 {
-for ( x = 0; x < mnWidth; x++ )
+for (x = 0; x < mnWidth && mbStatus; ++x)
 {
 if ( mnType == RAS_TYPE_RGB_FORMAT )
 {
@@ -272,17 +284,22 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 nRed = ImplGetByte();
 }
 pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, 
nBlue ) );
+if (!m_rRAS.good())
+mbStatus = false;
+}
+if ( x & 1 )
+{
+ImplGetByte(); // WORD 
ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
 }
-if ( x & 1 ) ImplGetByte(); // 
WORD ALIGNMENT ???
-if (!m_rRAS.good())
-mbStatus = false;
 }
 break;
 
 case 32 :
 for (y = 0; y < mnHeight && mbStatus; ++y)
 {
-for ( x = 0; x < mnWidth; x++ )
+for (x = 0; x < mnWidth && mbStatus; ++x)
 {
 nDat = ImplGetByte();   // pad byte > 
nil
 if ( mnType == RAS_TYPE_RGB_FORMAT )
@@ -298,9 +315,9 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 nRed = ImplGetByte();
 }
 pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, 
nBlue ) );
+if (!m_rRAS.good())
+mbStatus = false;
 }
- 

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

2015-09-10 Thread Caolán McNamara
 filter/qa/cppunit/data/psd/pass/hang-1.psd |binary
 filter/source/graphicfilter/ipsd/ipsd.cxx  |   19 ++-
 2 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit b02f1c58e7bb8b6c9381107431557d3f39794fe0
Author: Caolán McNamara 
Date:   Thu Sep 10 09:24:13 2015 +0100

fix size check related hang

Change-Id: I3e8aa5c48ba802cd363688502b44e27bfdf67f01

diff --git a/filter/qa/cppunit/data/psd/pass/hang-1.psd 
b/filter/qa/cppunit/data/psd/pass/hang-1.psd
new file mode 100644
index 000..8f557dd
Binary files /dev/null and b/filter/qa/cppunit/data/psd/pass/hang-1.psd differ
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx 
b/filter/source/graphicfilter/ipsd/ipsd.cxx
index 0e256ae..9d92ab5 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -172,9 +172,6 @@ bool PSDReader::ReadPSD(Graphic & rGraphic )
 
 bool PSDReader::ImplReadHeader()
 {
-sal_uInt16  nCompression;
-sal_uInt32  nColorLength, nResourceLength, nLayerMaskLength;
-
 mpFileHeader = new PSDFileHeader;
 
 m_rPSD.ReadUInt32( mpFileHeader->nSignature ).ReadUInt16( 
mpFileHeader->nVersion ).ReadUInt32( mpFileHeader->nPad1 ).ReadUInt16( 
mpFileHeader->nPad2 ).ReadUInt16( mpFileHeader->nChannels ).ReadUInt32( 
mpFileHeader->nRows ).ReadUInt32( mpFileHeader->nColumns 
).ReadUInt16( mpFileHeader->nDepth ).ReadUInt16( mpFileHeader->nMode );
@@ -194,6 +191,7 @@ bool PSDReader::ImplReadHeader()
 
 mnDestBitDepth = ( nDepth == 16 ) ? 8 : nDepth;
 
+sal_uInt32 nColorLength(0);
 m_rPSD.ReadUInt32( nColorLength );
 if ( mpFileHeader->nMode == PSD_CMYK )
 {
@@ -270,7 +268,10 @@ bool PSDReader::ImplReadHeader()
 default:
 return false;
 }
-m_rPSD.ReadUInt32( nResourceLength );
+sal_uInt32 nResourceLength(0);
+m_rPSD.ReadUInt32(nResourceLength);
+if (nResourceLength > m_rPSD.remainingSize())
+return false;
 sal_uInt32 nLayerPos = m_rPSD.Tell() + nResourceLength;
 
 // this is a loop over the resource entries to get the resolution info
@@ -291,8 +292,8 @@ bool PSDReader::ImplReadHeader()
 if ( nResEntryLen & 1 )
 nResEntryLen++; // the resource entries are padded
 sal_uInt32 nCurrentPos = m_rPSD.Tell();
-if ( ( nResEntryLen + nCurrentPos ) > nLayerPos )   // check if size
-break;  // is possible
+if (nResEntryLen > (nLayerPos - nCurrentPos))   // check if size
+break;  // is possible
 switch( nUniqueID )
 {
 case 0x3ed :// UID for the resolution info
@@ -307,10 +308,12 @@ bool PSDReader::ImplReadHeader()
 m_rPSD.Seek( nCurrentPos + nResEntryLen );  // set the stream 
to the next
 }   // resource entry
 m_rPSD.Seek( nLayerPos );
+sal_uInt32 nLayerMaskLength(0);
 m_rPSD.ReadUInt32( nLayerMaskLength );
 m_rPSD.SeekRel( nLayerMaskLength );
 
-m_rPSD.ReadUInt16( nCompression );
+sal_uInt16 nCompression(0);
+m_rPSD.ReadUInt16(nCompression);
 if ( nCompression == 0 )
 {
 mbCompression = false;
@@ -326,8 +329,6 @@ bool PSDReader::ImplReadHeader()
 return true;
 }
 
-
-
 bool PSDReader::ImplReadBody()
 {
 sal_uLong   nX, nY;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-31 Thread Caolán McNamara
 filter/qa/cppunit/data/pict/fail/hang-1.pct |binary
 filter/source/graphicfilter/ipict/ipict.cxx |   10 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit a8fe085f973b4ccf846fe231af0fa25eda59911e
Author: Caolán McNamara 
Date:   Mon Aug 31 09:55:37 2015 +0100

check stream status

Change-Id: I65ed5979d35d8739367294a71620782b832cfd71

diff --git a/filter/qa/cppunit/data/pict/fail/hang-1.pct 
b/filter/qa/cppunit/data/pict/fail/hang-1.pct
new file mode 100644
index 000..735ce0a
Binary files /dev/null and b/filter/qa/cppunit/data/pict/fail/hang-1.pct differ
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx 
b/filter/source/graphicfilter/ipict/ipict.cxx
index 8518410..5caa437 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -824,8 +824,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap , bool 
bBaseAddr, bool bColo
 // read and write Bitmap bits:
 if ( nPixelSize == 1 || nPixelSize == 2 || nPixelSize == 4 || nPixelSize 
== 8 )
 {
-sal_uInt8   nByteCountAsByte, nFlagCounterByte;
-sal_uInt16  nByteCount, nSrcBPL, nDestBPL;
+sal_uInt16  nSrcBPL, nDestBPL;
 size_t nCount;
 
 if  ( nPixelSize == 1 ) nSrcBPL = ( nWidth + 7 ) >> 3;
@@ -851,6 +850,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap , bool 
bBaseAddr, bool bColo
 }
 else
 {
+sal_uInt16 nByteCount(0);
 if ( nRowBytes > 250 )
 {
 pPict->ReadUInt16( nByteCount );
@@ -858,14 +858,16 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap , 
bool bBaseAddr, bool bColo
 }
 else
 {
+sal_uInt8 nByteCountAsByte(0);
 pPict->ReadUChar( nByteCountAsByte );
 nByteCount = ( (sal_uInt16)nByteCountAsByte ) & 0x00ff;
 nDataSize += 1 + (sal_uLong)nByteCount;
 }
 
-while ( nByteCount )
+while (pPict->good() && nByteCount)
 {
-pPict->ReadUChar( nFlagCounterByte );
+sal_uInt8 nFlagCounterByte(0);
+pPict->ReadUChar(nFlagCounterByte);
 if ( ( nFlagCounterByte & 0x80 ) == 0 )
 {
 nCount = ( (sal_uInt16)nFlagCounterByte ) + 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-31 Thread Caolán McNamara
 filter/qa/cppunit/data/met/fail/hang-2.met  |binary
 filter/source/graphicfilter/ios2met/ios2met.cxx |   25 ++--
 2 files changed, 19 insertions(+), 6 deletions(-)

New commits:
commit ad6d83defb33c414885ce6d4bfa85571d463f3c3
Author: Caolán McNamara 
Date:   Mon Aug 31 11:11:27 2015 +0100

check for legal field sizes before reading

Change-Id: I3cdb647e1a057be5bb4b32d119ee5bcbbedf7473

diff --git a/filter/qa/cppunit/data/met/fail/hang-2.met 
b/filter/qa/cppunit/data/met/fail/hang-2.met
new file mode 100644
index 000..e807d58
Binary files /dev/null and b/filter/qa/cppunit/data/met/fail/hang-2.met differ
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx 
b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 5ab71b9..bbf2728 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2660,21 +2660,34 @@ void OS2METReader::ReadOS2MET( SvStream & 
rStreamOS2MET, GDIMetaFile & rGDIMetaF
 pOS2MET->ReadUInt16(nFieldType);
 
 pOS2MET->SeekRel(3);
-nPos+=8; nFieldSize-=8;
 
-if (pOS2MET->GetError()) break;
-if (pOS2MET->IsEof()) {
+if (pOS2MET->GetError())
+break;
+
+if (nFieldType==EndDocumnMagic)
+break;
+
+if (pOS2MET->IsEof() || nFieldSize < 8)
+{
 pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
 ErrorCode=8;
 break;
 }
 
-if (nFieldType==EndDocumnMagic) break;
+nPos+=8; nFieldSize-=8;
+
+if (nFieldSize > pOS2MET->remainingSize())
+{
+pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
+ErrorCode=8;
+break;
+}
 
 ReadField(nFieldType, nFieldSize);
+nPos += nFieldSize;
 
-nPos+=(sal_uLong)nFieldSize;
-if (pOS2MET->Tell()>nPos)  {
+if (pOS2MET->Tell() > nPos)
+{
 pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
 ErrorCode=9;
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-24 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/hang-10.tiff  |binary
 filter/source/graphicfilter/itiff/lzwdecom.cxx |   12 
 2 files changed, 12 insertions(+)

New commits:
commit 6b82437dca30eba0f0c9dde6fdc84cb8f7740f8f
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Aug 24 15:31:41 2015 +0100

detect and reject loop in tif

Change-Id: I77d315fa432a3eb1a65539489a2ba6da8508b283

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-10.tiff 
b/filter/qa/cppunit/data/tiff/fail/hang-10.tiff
new file mode 100644
index 000..e5e9ebc
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-10.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx 
b/filter/source/graphicfilter/itiff/lzwdecom.cxx
index 82f6acc..5fb7514 100644
--- a/filter/source/graphicfilter/itiff/lzwdecom.cxx
+++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx
@@ -19,6 +19,8 @@
 
 
 #include lzwdecom.hxx
+#include algorithm
+#include vector
 
 #define MAX_TABLE_SIZE 4096
 
@@ -161,8 +163,18 @@ void LZWDecompressor::AddToTable(sal_uInt16 nPrevCode, 
sal_uInt16 nCodeFirstData
 return;
 }
 
+std::vectorsal_uInt16 aSeenIndexes;
 while (pTable[nCodeFirstData].nDataCount1)
+{
+if (std::find(aSeenIndexes.begin(), aSeenIndexes.end(), 
nCodeFirstData) != aSeenIndexes.end())
+{
+SAL_WARN(filter.tiff, Loop in chain);
+bEOIFound = true;
+return;
+}
+aSeenIndexes.push_back(nCodeFirstData);
 nCodeFirstData=pTable[nCodeFirstData].nPrevCode;
+}
 
 pTable[nTableSize].nPrevCode=nPrevCode;
 pTable[nTableSize].nDataCount=pTable[nPrevCode].nDataCount+1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-08-24 Thread Caolán McNamara
 filter/qa/cppunit/data/pbm/fail/crash-1.pbm |6 ++
 filter/source/graphicfilter/ipbm/ipbm.cxx   |   11 ++-
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 0a76c1fd6875bd094ebe2bfbed3d01c98dc0c19e
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Aug 24 20:43:37 2015 +0100

in reality we are limited to max sal_Int32 here

so accept that and test if the values were accepted or limited

Change-Id: Iaed5ebc2f12b52055506147c71117a2ad88d28ac

diff --git a/filter/qa/cppunit/data/pbm/fail/crash-1.pbm 
b/filter/qa/cppunit/data/pbm/fail/crash-1.pbm
new file mode 100644
index 000..9ddcddf
--- /dev/null
+++ b/filter/qa/cppunit/data/pbm/fail/crash-1.pbm
@@ -0,0 +1,6 @@
+P3
+3000 1
+255
+103  79  59
+ 95  7P  55
+ 87  67  51
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx 
b/filter/source/graphicfilter/ipbm/ipbm.cxx
index e545334..18b3249 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -37,7 +37,7 @@ private:
 sal_uLong   mnMode; // 0-PBM, 1-PGM, 2-PPM
 Bitmap  maBmp;
 BitmapWriteAccess*  mpAcc;
-sal_uLong   mnWidth, mnHeight;  // dimensions in pixel
+sal_Int32   mnWidth, mnHeight;  // dimensions in pixel
 sal_uLong   mnCol;
 sal_uLong   mnMaxVal;   // max value in the missing 
comment
 boolImplReadBody();
@@ -83,7 +83,7 @@ bool PBMReader::ReadPBM(Graphic  rGraphic )
 if ( !( mbStatus = ImplReadHeader() ) )
 return false;
 
-if ( ( mnMaxVal == 0 ) || ( mnWidth == 0 ) || ( mnHeight == 0 ) )
+if ( ( mnMaxVal == 0 ) || ( mnWidth = 0 ) || ( mnHeight = 0 ) )
 return false;
 
 // 0-PBM, 1-PGM, 2-PPM
@@ -91,7 +91,8 @@ bool PBMReader::ReadPBM(Graphic  rGraphic )
 {
 case 0 :
 maBmp = Bitmap( Size( mnWidth, mnHeight ), 1 );
-if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 )
+mpAcc = maBmp.AcquireWriteAccess();
+if (!mpAcc || mpAcc-Width() != mnWidth || mpAcc-Height() != 
mnHeight)
 return false;
 mpAcc-SetPaletteEntryCount( 2 );
 mpAcc-SetPaletteColor( 0, BitmapColor( 0xff, 0xff, 0xff ) );
@@ -242,8 +243,8 @@ bool PBMReader::ImplReadBody()
 boolbPara, bFinished = false;
 sal_uInt8   nDat = 0, nCount;
 sal_uLong   nGrey, nRGB[3];
-sal_uLong   nWidth = 0;
-sal_uLong   nHeight = 0;
+sal_Int32 nWidth = 0;
+sal_Int32 nHeight = 0;
 
 if ( mbRaw )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: filter/qa filter/source include/filter

2015-08-11 Thread Takeshi Abe
 filter/qa/cppunit/xslt-test.cxx   |4 ++--
 filter/source/config/cache/basecontainer.hxx  |8 
 filter/source/config/cache/cacheupdatelistener.hxx|4 ++--
 filter/source/config/cache/configflush.hxx|4 ++--
 filter/source/config/cache/contenthandlerfactory.hxx  |4 ++--
 filter/source/config/cache/filterfactory.hxx  |4 ++--
 filter/source/config/cache/frameloaderfactory.hxx |4 ++--
 filter/source/config/cache/typedetection.hxx  |4 ++--
 filter/source/flash/swffilter.cxx |7 +++
 filter/source/graphic/GraphicExportDialog.hxx |4 ++--
 filter/source/graphic/GraphicExportFilter.hxx |4 ++--
 filter/source/pdf/pdfdialog.hxx   |4 ++--
 filter/source/pdf/pdfexport.cxx   |4 ++--
 filter/source/pdf/pdffilter.hxx   |7 ++-
 filter/source/pdf/pdfinteract.hxx |4 ++--
 filter/source/placeware/filter.cxx|4 ++--
 filter/source/storagefilterdetect/filterdetect.hxx|4 ++--
 filter/source/svg/svgfilter.hxx   |4 ++--
 filter/source/svg/svgwriter.hxx   |4 ++--
 filter/source/svg/test/odfserializer.cxx  |4 ++--
 filter/source/svg/test/svg2odf.cxx|4 ++--
 filter/source/t602/t602filter.hxx |7 +++
 filter/source/textfilterdetect/filterdetect.hxx   |4 ++--
 filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx   |4 ++--
 filter/source/xmlfilteradaptor/streamwrap.hxx |4 ++--
 filter/source/xmlfilterdetect/filterdetect.hxx|4 ++--
 filter/source/xsltdialog/typedetectionimport.hxx  |4 ++--
 filter/source/xsltdialog/xmlfilterdialogcomponent.cxx |2 +-
 filter/source/xsltdialog/xmlfiltertestdialog.cxx  |2 +-
 filter/source/xsltfilter/LibXSLTTransformer.cxx   |1 -
 filter/source/xsltfilter/LibXSLTTransformer.hxx   |4 ++--
 filter/source/xsltfilter/OleHandler.hxx   |1 -
 filter/source/xsltfilter/XSLTFilter.cxx   |4 ++--
 include/filter/msfilter/mstoolbar.hxx |1 -
 include/filter/msfilter/msvbahelper.hxx   |4 ++--
 35 files changed, 66 insertions(+), 74 deletions(-)

New commits:
commit 678bb5135bf99a295c38060aa003e81a8c3b435a
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Sat Aug 8 10:53:34 2015 +0900

tdf#88206 replace cppu::WeakImplHelper* etc.

with the variadic variants, for filter.

Change-Id: I30dcd7cfb3e484034f6cceceb1ff7cd9d3f4b7a6
Reviewed-on: https://gerrit.libreoffice.org/17585
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Noel Grandin noelgran...@gmail.com

diff --git a/filter/qa/cppunit/xslt-test.cxx b/filter/qa/cppunit/xslt-test.cxx
index f9945ea..a424c98 100644
--- a/filter/qa/cppunit/xslt-test.cxx
+++ b/filter/qa/cppunit/xslt-test.cxx
@@ -27,7 +27,7 @@
 #include com/sun/star/ucb/SimpleFileAccess.hpp
 #include com/sun/star/xml/xslt/XSLTTransformer.hpp
 
-#include cppuhelper/implbase1.hxx
+#include cppuhelper/implbase.hxx
 
 #include test/bootstrapfixture.hxx
 
@@ -51,7 +51,7 @@ public:
 CPPUNIT_TEST_SUITE_END();
 };
 
-struct Listener : public ::cppu::WeakImplHelper1io::XStreamListener
+struct Listener : public ::cppu::WeakImplHelperio::XStreamListener
 {
 bool m_bDone;
 
diff --git a/filter/source/config/cache/basecontainer.hxx 
b/filter/source/config/cache/basecontainer.hxx
index 2e38542..cf42c40 100644
--- a/filter/source/config/cache/basecontainer.hxx
+++ b/filter/source/config/cache/basecontainer.hxx
@@ -29,7 +29,7 @@
 #include com/sun/star/util/XFlushable.hpp
 #include cppuhelper/interfacecontainer.h
 #include salhelper/singletonref.hxx
-#include cppuhelper/implbase4.hxx
+#include cppuhelper/implbase.hxx
 #include cppuhelper/weakref.hxx
 #include rtl/ustring.hxx
 
@@ -54,7 +54,7 @@ namespace filter{
 ctor as first!
  */
 class BaseContainer : public BaseLock
-, public ::cppu::WeakImplHelper4 css::lang::XServiceInfo  
   ,
+, public ::cppu::WeakImplHelper css::lang::XServiceInfo   
  ,
   
css::container::XNameContainer  , // = XNameReplace = XNameAccess = 
XElementAccess
   
css::container::XContainerQuery ,
   css::util::XFlushable
   
@@ -114,7 +114,7 @@ class BaseContainer : public BaseLock
 /** @short  standard ctor.
 
 @descr  Because mostly this class is used as base class for own 
service
-implementations in combination with a 
ImplInheritanceHelper2 template ...
+implementations in combination with a 
ImplInheritanceHelper template ...
 

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

2015-07-21 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-7.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit 34d062147c16090fa42c27ac7960e3f5e3b65d2b
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Jul 21 10:10:50 2015 +0100

reject invalid tiff dimensions

Change-Id: I64e77f12cb016a7f4a9d21c732aaeaae7959da76

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-7.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-7.tiff
new file mode 100644
index 000..0056f9d
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-7.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 180b1c3..c730e81 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1330,6 +1330,8 @@ bool TIFFReader::ReadTIFF(SvStream  rTIFF, Graphic  
rGraphic )
 }
 if ( !nBitsPerSample || ( nBitsPerSample  32 ) )
 bStatus = false;
+if (nImageWidth  0 || nImageLength  0)
+bStatus = false;
 if ( bStatus )
 {
 if ( nMaxSampleValue == 0 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/hang-5.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx  |7 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 33d43205c341e0cce36b6a1b3082c3927490cbde
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 09:20:33 2015 +0100

test that nNumStripByteCounts value is within bounds of file

Change-Id: If119628d7f510a7db30ed2180111063781cde887

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-5.tiff 
b/filter/qa/cppunit/data/tiff/fail/hang-5.tiff
new file mode 100644
index 000..f1be3fa
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-5.tiff differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 7a5d487..89de8e0 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -422,14 +422,17 @@ void TIFFReader::ReadTagData( sal_uInt16 nTagType, 
sal_uInt32 nDataLen)
 nNumStripByteCounts = 0; // to be on the safe side
 nOldNumSBC = nNumStripByteCounts;
 nDataLen += nOldNumSBC;
-if ( ( nDataLen  nOldNumSBC )  ( nDataLen  SAL_MAX_UINT32 / 
sizeof( sal_uInt32 ) ) )
+size_t nMaxAllocAllowed = SAL_MAX_UINT32 / sizeof(sal_uInt32);
+size_t nMaxRecordsAvailable = pTIFF-remainingSize() / 
DataTypeSize();
+if (nDataLen  nOldNumSBC  nDataLen  nMaxAllocAllowed 
+(nDataLen - nOldNumSBC) = nMaxRecordsAvailable)
 {
 nNumStripByteCounts = nDataLen;
 try
 {
 pStripByteCounts = new sal_uLong[ nNumStripByteCounts ];
 }
-catch (const std::bad_alloc )
+catch (const std::bad_alloc )
 {
 pStripByteCounts = NULL;
 nNumStripByteCounts = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-5.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit bca4d6f896fb12ceff37476c43ea8892898dd385
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 08:50:27 2015 +0100

check np bounds yet again

Change-Id: Id3f6fdc0ebed9711acec5d71f404e7a6072b765c

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-5.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-5.tiff
new file mode 100644
index 000..4849edf
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-5.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index b18db6b..7a5d487 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -669,6 +669,8 @@ bool TIFFReader::ReadMap()
 pTIFF-Seek(pStripOffsets[nStrip]);
 }
 nRowBytesLeft = nBytesPerRow;
+if (np = SAL_N_ELEMENTS(pMap))
+return false;
 pdst=pMap[ np ];
 do
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-4.tiff  |binary
 filter/source/graphicfilter/itiff/ccidecom.cxx |9 ++---
 2 files changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 5d32a4ac5c166264c2d44e8df625eb768eb42fbe
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 08:35:26 2015 +0100

reduce scope, etc, don't loop endlessly

Change-Id: I86e4e94392527b5faf5d9cdb4251853f35813f4e

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-4.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-4.tiff
new file mode 100644
index 000..ef0fe27
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-4.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx 
b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 892f247..2f76777 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -628,8 +628,6 @@ void CCIDecompressor::StartDecompression( SvStream  
rIStream )
 
 bool CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong 
nTargetBits, bool bLastLine )
 {
-sal_uInt16 i;
-sal_uInt8 * pDst;
 bool b2D;
 
 if ( nEOLCount = 5 )   // RTC (Return To Controller)
@@ -678,8 +676,7 @@ bool CCIDecompressor::DecompressScanline( sal_uInt8 * 
pTarget, sal_uLong nTarget
 delete[] pLastLine;
 nLastLineSize = ( nTargetBits + 7 )  3;
 pLastLine = new sal_uInt8[ nLastLineSize ];
-pDst = pLastLine;
-for ( i = 0; i  nLastLineSize; i++ ) *( pDst++ ) = 0x00;
+memset(pLastLine, 0, nLastLineSize);
 }
 }
 // conditionally align start of line to next byte:
@@ -706,9 +703,7 @@ bool CCIDecompressor::DecompressScanline( sal_uInt8 * 
pTarget, sal_uLong nTarget
 // if we're in 2D mode we have to remember the line:
 if ( nOptions  CCI_OPTION_2D  bStatus )
 {
-sal_uInt8 *pSrc = pTarget;
-pDst = pLastLine;
-for ( i = 0; i  nLastLineSize; i++ ) *(pDst++)=*(pSrc++);
+memcpy(pLastLine, pTarget, nLastLineSize);
 }
 
 // #i122984#
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-6.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit dcbbe7741a08f6076f9e020f90cbb730c1edafb9
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 09:24:48 2015 +0100

final check np bounds

Change-Id: I9213bb2cc059e05e286598edac03bd72c84db876

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-6.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-6.tiff
new file mode 100644
index 000..907b510
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-6.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 89de8e0..f0c5d1e 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -554,6 +554,8 @@ bool TIFFReader::ReadMap()
 if ( nStrip = nNumStripOffsets )
 return false;
 pTIFF-Seek( pStripOffsets[ nStrip ] + ( ny % 
GetRowsPerStrip() ) * nStripBytesPerRow );
+if (np = SAL_N_ELEMENTS(pMap))
+return false;
 pTIFF-Read( pMap[ np ], nBytesPerRow );
 if ( pTIFF-GetError() )
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/hang-7.tiff   |binary
 filter/source/graphicfilter/itiff/ccidecom.cxx |5 -
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 6964f67d0dd44c8a3c68caf194075ba5c649bf4b
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 11:20:45 2015 +0100

don't hang on a bad ReadCodeAndDecode

Change-Id: I999012d428fa84e21fe9e9f851a016eacc96a686

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-7.tiff 
b/filter/qa/cppunit/data/tiff/fail/hang-7.tiff
new file mode 100644
index 000..61a5f2d
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-7.tiff differ
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx 
b/filter/source/graphicfilter/itiff/ccidecom.cxx
index 4a49f73..025240c 100644
--- a/filter/source/graphicfilter/itiff/ccidecom.cxx
+++ b/filter/source/graphicfilter/itiff/ccidecom.cxx
@@ -1026,11 +1026,14 @@ void CCIDecompressor::Read2DScanlineData(sal_uInt8 * 
pTarget, sal_uInt16 nTarget
 while (nBitPosnTargetBits  bStatus) {
 
 n2DMode=ReadCodeAndDecode(p2DModeLookUp,10);
-if (!bStatus) return;
+if (!bStatus)
+return;
 
 if (n2DMode==CCI2DMODE_UNCOMP) {
 for (;;) {
 nUncomp=ReadCodeAndDecode(pUncompLookUp,11);
+if (!bStatus)
+break;
 if ( nUncomp = CCIUNCOMP_4White_1Black ) {
 nRun=nUncomp-CCIUNCOMP_0White_1Black;
 FillBits(pTarget,nTargetBits,nBitPos,nRun,0x00);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-20 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/hang-8.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx  |6 --
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8eaef6b5217eecaa111c80e426bdf225481a71fb
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 20 11:40:34 2015 +0100

fail on short read

Change-Id: I7215cf8d8b1e4a4156c87507018de3c2b7ed08d8

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-8.tiff 
b/filter/qa/cppunit/data/tiff/fail/hang-8.tiff
new file mode 100644
index 000..c458597
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-8.tiff differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index f0c5d1e..769c57e 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -656,7 +656,7 @@ bool TIFFReader::ReadMap()
 }
 else if ( nCompression == 32773 )
 {
-sal_uLong nStrip,nRecCount,nRowBytesLeft,np,i;
+sal_uLong nStrip,nRecCount,np,i;
 sal_uInt8 * pdst;
 nStrip = 0;
 if ( nStrip = nNumStripOffsets )
@@ -673,7 +673,7 @@ bool TIFFReader::ReadMap()
 return false;
 pTIFF-Seek(pStripOffsets[nStrip]);
 }
-nRowBytesLeft = nBytesPerRow;
+sal_uLong nRowBytesLeft = nBytesPerRow;
 if (np = SAL_N_ELEMENTS(pMap))
 return false;
 pdst=pMap[ np ];
@@ -687,6 +687,8 @@ bool TIFFReader::ReadMap()
 if ( nRecCount  nRowBytesLeft )
 return false;
 pTIFF-Read(pdst,nRecCount);
+if (!pTIFF-good())
+return false;
 pdst+=nRecCount;
 nRowBytesLeft-=nRecCount;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-19 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-1.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |   54 +-
 2 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit 80c591ea9c320fee9e975ac7b0e4e2df1bf5e447
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Jul 19 21:09:25 2015 +0100

in reality we are limited to max sal_Int32 here

so accept that and test if the values were accepted or limited

Change-Id: I599cf8065a6f8786d380fdba03135857766770f3

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-1.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-1.tiff
new file mode 100644
index 000..4fa0bb9
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-1.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index aed15f6..bd0cf6e 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -65,8 +65,8 @@ private:
 
 sal_uLong   nNewSubFile;
 sal_uLong   nSubFile;
-sal_uLong   nImageWidth;// picture width in 
pixels
-sal_uLong   nImageLength;   // picture height in 
pixels
+sal_Int32   nImageWidth;// picture width in 
pixels
+sal_Int32   nImageLength;   // picture height in 
pixels
 sal_uLong   nBitsPerSample; // bits per pixel per 
layer
 sal_uLong   nCompression;   // kind of compression
 sal_uLong   nPhotometricInterpretation;
@@ -116,7 +116,7 @@ private:
 // Create the bitmap from the temporary bitmap pMap
 // and partly deletes pMap while doing this.
 
-boolConvertScanline( sal_uLong nY );
+boolConvertScanline(sal_Int32 nY);
 // converts a Scanline to the Windows-BMP format
 
 bool HasAlphaChannel() const;
@@ -537,13 +537,13 @@ bool TIFFReader::ReadMap()
 {
 if ( nCompression == 1 || nCompression == 32771 )
 {
-sal_uLong ny, np, nStrip, nStripBytesPerRow;
+sal_uLong np, nStrip, nStripBytesPerRow;
 
 if ( nCompression == 1 )
 nStripBytesPerRow = nBytesPerRow;
 else
 nStripBytesPerRow = ( nBytesPerRow + 1 )  0xfffe;
-for ( ny = 0; ny  nImageLength; ny++ )
+for (sal_Int32 ny = 0; ny  nImageLength; ++ny)
 {
 for ( np = 0; np  nPlanes; np++ )
 {
@@ -561,7 +561,7 @@ bool TIFFReader::ReadMap()
 }
 else if ( nCompression == 2 || nCompression == 3 || nCompression == 4 )
 {
-sal_uLong ny, np, nStrip, nOptions;
+sal_uLong np, nStrip, nOptions;
 if ( nCompression == 2 )
 {
 nOptions = CCI_OPTION_BYTEALIGNROW;
@@ -596,7 +596,7 @@ bool TIFFReader::ReadMap()
 
 aCCIDecom.StartDecompression( *pTIFF );
 
-for ( ny = 0; ny  nImageLength; ny++ )
+for (sal_Int32 ny = 0; ny  nImageLength; ++ny)
 {
 for ( np = 0; np  nPlanes; np++ )
 {
@@ -620,13 +620,13 @@ bool TIFFReader::ReadMap()
 else if ( nCompression == 5 )
 {
 LZWDecompressor aLZWDecom;
-sal_uLong ny, np, nStrip;
+sal_uLong np, nStrip;
 nStrip=0;
 if ( nStrip = nNumStripOffsets )
 return false;
 pTIFF-Seek(pStripOffsets[nStrip]);
 aLZWDecom.StartDecompression(*pTIFF);
-for ( ny = 0; ny  nImageLength; ny++ )
+for (sal_Int32 ny = 0; ny  nImageLength; ++ny)
 {
 for ( np = 0; np  nPlanes; np++ )
 {
@@ -647,13 +647,13 @@ bool TIFFReader::ReadMap()
 }
 else if ( nCompression == 32773 )
 {
-sal_uLong nStrip,nRecCount,nRowBytesLeft,ny,np,i;
+sal_uLong nStrip,nRecCount,nRowBytesLeft,np,i;
 sal_uInt8 * pdst;
 nStrip = 0;
 if ( nStrip = nNumStripOffsets )
 return false;
 pTIFF-Seek(pStripOffsets[nStrip]);
-for ( ny = 0; ny  nImageLength; ny++ )
+for (sal_Int32 ny = 0; ny  nImageLength; ++ny)
 {
 for ( np = 0; np  nPlanes; np++ )
 {
@@ -767,9 +767,9 @@ sal_uLong TIFFReader::GetBits( const sal_uInt8 * pSrc, 
sal_uLong nBitsPos, sal_u
 
 
 
-bool TIFFReader::ConvertScanline( sal_uLong nY )
+bool TIFFReader::ConvertScanline(sal_Int32 nY)
 {
-sal_uInt32  nRed, nGreen, nBlue, ns, nx, nVal, nByteCount;
+sal_uInt32  nRed, nGreen, nBlue, ns, nVal, nByteCount;
 sal_uInt8   nByteVal;
 
 if ( nDstBitsPerPixel == 24 )
@@ -786,7 +786,7 @@ bool TIFFReader::ConvertScanline( sal_uLong nY )
 sal_uInt8  nLGreen = 0;
 sal_uInt8  nLBlue = 0;
 sal_uInt8  nLAlpha = 0;
-for ( nx = 0; nx  nImageWidth; nx++, pt += nSamplesPerPixel )
+for (sal_Int32 nx = 0; nx  nImageWidth; nx++, pt += 

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

2015-07-19 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-3.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit fcdddbd30a8b5cf6a5cc4d2ff28b7d4a20f8ec6b
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Jul 19 21:32:05 2015 +0100

check np bounds again

Change-Id: I0fb61954b2eaf0c015d7bdefe9f03bd459b31501

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-3.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-3.tiff
new file mode 100644
index 000..4aa2393
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-3.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 0913fd1..b18db6b 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -640,6 +640,8 @@ bool TIFFReader::ReadMap()
 pTIFF-Seek(pStripOffsets[nStrip]);
 aLZWDecom.StartDecompression(*pTIFF);
 }
+if (np = SAL_N_ELEMENTS(pMap))
+return false;
 if ( ( aLZWDecom.Decompress( pMap[ np ], nBytesPerRow ) != 
nBytesPerRow ) || pTIFF-GetError() )
 return false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-19 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/crash-2.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit be4e1141be7cd54cf5362d3de534050db5505437
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Jul 19 21:25:46 2015 +0100

check np bounds

Change-Id: Id16ae9325f3c67792941b9c88d83435aa98282ca

diff --git a/filter/qa/cppunit/data/tiff/fail/crash-2.tiff 
b/filter/qa/cppunit/data/tiff/fail/crash-2.tiff
new file mode 100644
index 000..aadd99f
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/crash-2.tiff 
differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index bd0cf6e..0913fd1 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -608,6 +608,8 @@ bool TIFFReader::ReadMap()
 pTIFF-Seek( pStripOffsets[ nStrip ] );
 aCCIDecom.StartDecompression( *pTIFF );
 }
+if (np = SAL_N_ELEMENTS(pMap))
+return false;
 if ( !aCCIDecom.DecompressScanline( pMap[ np ], nImageWidth * 
nBitsPerSample * nSamplesPerPixel / nPlanes, np + 1 == nPlanes ) )
 return false;
 if ( pTIFF-GetError() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-17 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/loop.tif   |binary
 filter/source/graphicfilter/itiff/itiff.cxx |   12 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 290465b0effecb6d620adc20ca279f8057eeab9a
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jul 17 09:23:17 2015 +0100

detect loop in tif format

Change-Id: I27645566cd9fc0ac8cf753f0217ae6cf0fa9929e

diff --git a/filter/qa/cppunit/data/tiff/fail/loop.tif 
b/filter/qa/cppunit/data/tiff/fail/loop.tif
new file mode 100644
index 000..6d8cee7
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/loop.tif differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 84bff73..9ae2a06 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1210,9 +1210,19 @@ bool TIFFReader::ReadTIFF(SvStream  rTIFF, Graphic  
rGraphic )
 }
 while( nOffset );
 
+std::vectorsal_uInt32 aSeenIfds;
+
 for ( sal_uInt32 nNextIfd = nFirstIfd; nNextIfd  bStatus; )
 {
-pTIFF-Seek( nOrigPos + nNextIfd );
+if (std::find(aSeenIfds.begin(), aSeenIfds.end(), nNextIfd) != 
aSeenIfds.end())
+{
+SAL_WARN(filter.tiff, Parsing error:   nNextIfd 
+  already processed, format loop);
+bStatus = false;
+break;
+}
+pTIFF-Seek(nOrigPos + nNextIfd);
+aSeenIfds.push_back(nNextIfd);
 {
 bByteSwap = false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-17 Thread Caolán McNamara
 filter/qa/cppunit/data/tiff/fail/hang-1.tiff |binary
 filter/source/graphicfilter/itiff/itiff.cxx  |7 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit feedb957310fc3282ca47d5ffc1482dbb944a36e
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jul 17 09:45:26 2015 +0100

test that nNumStripOffsets value is within bounds of file

Change-Id: I1483ea3671420be5349692374641e10b344d

diff --git a/filter/qa/cppunit/data/tiff/fail/hang-1.tiff 
b/filter/qa/cppunit/data/tiff/fail/hang-1.tiff
new file mode 100644
index 000..9cd2aa2
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-1.tiff differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index 9ae2a06..e132fab 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -373,14 +373,17 @@ void TIFFReader::ReadTagData( sal_uInt16 nTagType, 
sal_uInt32 nDataLen)
 nNumStripOffsets = 0;
 nOldNumSO = nNumStripOffsets;
 nDataLen += nOldNumSO;
-if ( ( nDataLen  nOldNumSO )  ( nDataLen  SAL_MAX_UINT32 / 
sizeof( sal_uInt32 ) ) )
+size_t nMaxAllocAllowed = SAL_MAX_UINT32 / sizeof(sal_uInt32);
+size_t nMaxRecordsAvailable = pTIFF-remainingSize() / 
DataTypeSize();
+if (nDataLen  nOldNumSO  nDataLen  nMaxAllocAllowed 
+(nDataLen - nOldNumSO) = nMaxRecordsAvailable)
 {
 nNumStripOffsets = nDataLen;
 try
 {
 pStripOffsets = new sal_uLong[ nNumStripOffsets ];
 }
-catch (const std::bad_alloc )
+catch (const std::bad_alloc )
 {
 pStripOffsets = NULL;
 nNumStripOffsets = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-16 Thread Caolán McNamara
 filter/qa/cppunit/data/pict/fail/exception-1.pct |binary
 filter/source/graphicfilter/ipict/ipict.cxx  |5 +
 2 files changed, 5 insertions(+)

New commits:
commit cf4159e16c13a13d0bedccebb50bb08f1662bc1c
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 16 10:01:24 2015 +0100

exception on div by 0

Change-Id: Id33d6a5e3df5812babd28ebfc65b95ce97219ad3

diff --git a/filter/qa/cppunit/data/pict/fail/exception-1.pct 
b/filter/qa/cppunit/data/pict/fail/exception-1.pct
new file mode 100644
index 000..f9cd85a
Binary files /dev/null and b/filter/qa/cppunit/data/pict/fail/exception-1.pct 
differ
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx 
b/filter/source/graphicfilter/ipict/ipict.cxx
index e6b7fd0..0c1960b 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -1859,6 +1859,7 @@ sal_uLong PictReader::ReadData(sal_uInt16 nOpcode)
 
 void PictReader::ReadPict( SvStream  rStreamPict, GDIMetaFile  rGDIMetaFile )
 {
+try {
 sal_uInt16  nOpcode;
 sal_uInt8   nOneByteOpcode;
 sal_uLong   nSize, nPercent, nLastPercent;
@@ -1950,6 +1951,10 @@ void PictReader::ReadPict( SvStream  rStreamPict, 
GDIMetaFile  rGDIMetaFile )
 pPict-SetEndian(nOrigNumberFormat);
 
 if (pPict-GetError()) pPict-Seek(nOrigPos);
+} catch (...)
+{
+rStreamPict.SetError(SVSTREAM_FILEFORMAT_ERROR);
+}
 }
 
 namespace pict {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-16 Thread Caolán McNamara
 filter/qa/cppunit/data/eps/fail/short-1.eps |binary
 filter/source/graphicfilter/ieps/ieps.cxx   |   16 +---
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit bf02304a0ea4771e01f39dd0032cbf276997ca00
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 16 10:50:58 2015 +0100

min size of eps for a preview is 32

Change-Id: Icb82d9dd0a3918f2bdc4cb768c566774cd0d8ac4

diff --git a/filter/qa/cppunit/data/eps/fail/short-1.eps 
b/filter/qa/cppunit/data/eps/fail/short-1.eps
new file mode 100644
index 000..4b38b78
Binary files /dev/null and b/filter/qa/cppunit/data/eps/fail/short-1.eps differ
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index 634983f..ddabfc7 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -69,7 +69,7 @@ static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, 
sal_uInt8 const * pDest,
 
 
 // SecurityCount is the buffersize of the buffer in which we will parse for a 
number
-static long ImplGetNumber( sal_uInt8 **pBuf, int nSecurityCount )
+static long ImplGetNumber( sal_uInt8 **pBuf, sal_uInt32 nSecurityCount )
 {
 boolbValid = true;
 boolbNegative = false;
@@ -502,7 +502,7 @@ void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead,
 if ( pDest )
 {
 pDest += 16;
-int nCount = 4;
+sal_uInt32 nCount = 4;
 long nNumber = ImplGetNumber( pDest, nCount );
 if ( nCount  ( (sal_uInt32)nNumber  10 ) )
 {
@@ -595,14 +595,16 @@ GraphicImport( SvStream  rStream, Graphic  rGraphic, 
FilterConfigItem* )
 rStream.Seek( nPSStreamPos );
 sal_uInt8* pBuf = new sal_uInt8[ nPSSize ];
 
-sal_uInt32  nBufStartPos = rStream.Tell();
-sal_uInt32  nBytesRead = rStream.Read( pBuf, nPSSize );
+sal_uInt32 nBufStartPos = rStream.Tell();
+sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize );
 if ( nBytesRead == nPSSize )
 {
-int nSecurityCount = 32;
-if ( !bHasPreview ) // if there is no tiff/wmf preview, we 
will parse for an preview in the eps prolog
+sal_uInt32 nSecurityCount = 32;
+// if there is no tiff/wmf preview, we will parse for an preview in
+// the eps prolog
+if (!bHasPreview  nBytesRead = nSecurityCount)
 {
-sal_uInt8* pDest = ImplSearchEntry( pBuf, 
reinterpret_castsal_uInt8 const *(%%BeginPreview:), nBytesRead - 32, 15 );
+sal_uInt8* pDest = ImplSearchEntry( pBuf, 
reinterpret_castsal_uInt8 const *(%%BeginPreview:), nBytesRead - 
nSecurityCount, 15 );
 if ( pDest  )
 {
 pDest += 15;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 filter/qa/cppunit/data/ras/fail/crash-1.ras |binary
 filter/source/graphicfilter/iras/iras.cxx   |   18 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 8a60e78769ebf6fc73ddc8ed7e43991fcb30fff4
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 11:02:13 2015 +0100

file format documentation states these are signed

Change-Id: Iaca58dda19d24a767333ff642759414951a03e6d

diff --git a/filter/qa/cppunit/data/ras/fail/crash-1.ras 
b/filter/qa/cppunit/data/ras/fail/crash-1.ras
new file mode 100644
index 000..d1abbae
Binary files /dev/null and b/filter/qa/cppunit/data/ras/fail/crash-1.ras differ
diff --git a/filter/source/graphicfilter/iras/iras.cxx 
b/filter/source/graphicfilter/iras/iras.cxx
index cca5bc8..6916daa 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -44,12 +44,12 @@ private:
 
 boolmbStatus;
 Bitmap  maBmp;
-sal_uInt32  mnWidth, mnHeight;  // Bildausmass in Pixeln
-sal_uInt16  mnDstBitsPerPix;
-sal_uInt16  mnDstColors;
-sal_uInt32  mnDepth, mnImageDatSize, mnType;
-sal_uInt32  mnColorMapType, mnColorMapSize;
-sal_uInt8   mnRepCount, mnRepVal;   // RLE Decoding
+sal_Int32   mnWidth, mnHeight;  // Bildausmass in Pixeln
+sal_uInt16  mnDstBitsPerPix;
+sal_uInt16  mnDstColors;
+sal_Int32   mnDepth, mnImageDatSize, mnType;
+sal_Int32   mnColorMapType, mnColorMapSize;
+sal_uInt8   mnRepCount, mnRepVal;   // RLE Decoding
 boolmbPalette;
 
 boolImplReadBody(BitmapWriteAccess * pAcc);
@@ -178,9 +178,9 @@ bool RASReader::ReadRAS(Graphic  rGraphic)
 
 bool RASReader::ImplReadHeader()
 {
-m_rRAS.ReadUInt32( mnWidth ).ReadUInt32( mnHeight ).ReadUInt32( mnDepth 
).ReadUInt32( mnImageDatSize ).ReadUInt32( mnType ).ReadUInt32( 
mnColorMapType ).ReadUInt32( mnColorMapSize );
+
m_rRAS.ReadInt32(mnWidth).ReadInt32(mnHeight).ReadInt32(mnDepth).ReadInt32(mnImageDatSize).ReadInt32(mnType).ReadInt32(mnColorMapType).ReadInt32(mnColorMapSize);
 
-if ( mnWidth == 0 || mnHeight == 0 )
+if ( mnWidth = 0 || mnHeight = 0 || mnImageDatSize = 0 )
 mbStatus = false;
 
 switch ( mnDepth )
@@ -216,7 +216,7 @@ bool RASReader::ImplReadHeader()
 
 bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 {
-sal_uLong   x, y;
+sal_Int32 x, y;
 sal_uInt8   nDat = 0;
 sal_uInt8nRed, nGreen, nBlue;
 switch ( mnDstBitsPerPix )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 filter/qa/cppunit/data/pbm/fail/hang-1.pbm  |binary
 filter/qa/cppunit/data/pbm/indeterminate/.gitignore |1 +
 filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm|binary
 filter/qa/cppunit/filters-ppm-test.cxx  |4 
 filter/source/graphicfilter/ipbm/ipbm.cxx   |2 +-
 5 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit b8637e67d6d39e47d22cfce496000288f0dc58d8
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 14:01:46 2015 +0100

avoid hang in short pbm

Change-Id: I9b7f0832a4dc231e1e8f963858c155e3cd392667

diff --git a/filter/qa/cppunit/data/pbm/fail/.gitignore 
b/filter/qa/cppunit/data/pbm/fail/.gitignore
new file mode 100644
index 000..e69de29
diff --git a/filter/qa/cppunit/data/pbm/fail/hang-1.pbm 
b/filter/qa/cppunit/data/pbm/fail/hang-1.pbm
new file mode 100644
index 000..21742d2
Binary files /dev/null and b/filter/qa/cppunit/data/pbm/fail/hang-1.pbm differ
diff --git a/filter/qa/cppunit/data/pbm/indeterminate/.gitignore 
b/filter/qa/cppunit/data/pbm/indeterminate/.gitignore
new file mode 100644
index 000..e9c5b17
--- /dev/null
+++ b/filter/qa/cppunit/data/pbm/indeterminate/.gitignore
@@ -0,0 +1 @@
+*.ppm-*
diff --git a/filter/qa/cppunit/data/pbm/pass/.gitignore 
b/filter/qa/cppunit/data/pbm/pass/.gitignore
new file mode 100644
index 000..e69de29
diff --git a/filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm 
b/filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm
new file mode 100644
index 000..d6e3fc6
Binary files /dev/null and b/filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm 
differ
diff --git a/filter/qa/cppunit/filters-ppm-test.cxx 
b/filter/qa/cppunit/filters-ppm-test.cxx
index e98ce6f..10f2658 100644
--- a/filter/qa/cppunit/filters-ppm-test.cxx
+++ b/filter/qa/cppunit/filters-ppm-test.cxx
@@ -62,6 +62,10 @@ void PpmFilterTest::testCVEs()
 testDir(OUString(),
 getURLFromSrc(/filter/qa/cppunit/data/ppm/),
 OUString());
+
+testDir(OUString(),
+getURLFromSrc(/filter/qa/cppunit/data/pbm/),
+OUString());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PpmFilterTest);
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx 
b/filter/source/graphicfilter/ipbm/ipbm.cxx
index 248d4df..e545334 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -179,7 +179,7 @@ bool PBMReader::ImplReadHeader()
 }
 while ( !bFinished )
 {
-if ( mrPBM.GetError() )
+if (!mrPBM.good())
 return false;
 
 mrPBM.ReadUChar( nDat );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 dev/null|binary
 filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras |binary
 filter/source/graphicfilter/iras/iras.cxx   |   24 +++-
 3 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit adfa89b5ffc3589b3a19a32e707a134cee232429
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 11:31:18 2015 +0100

check stream state more often for failures

Change-Id: Ie45d858021c3123ec21829cbf4742cf30ce46665

diff --git a/filter/qa/cppunit/data/ras/pass/CVE-2008-1097-1.ras 
b/filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/pass/CVE-2008-1097-1.ras
rename to filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras
diff --git a/filter/source/graphicfilter/iras/iras.cxx 
b/filter/source/graphicfilter/iras/iras.cxx
index 6916daa..5877fa2 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -54,7 +54,7 @@ private:
 
 boolImplReadBody(BitmapWriteAccess * pAcc);
 boolImplReadHeader();
-sal_uInt8   ImplGetByte();
+sal_uInt8   ImplGetByte();
 
 public:
 RASReader(SvStream rRAS);
@@ -174,13 +174,11 @@ bool RASReader::ReadRAS(Graphic  rGraphic)
 return mbStatus;
 }
 
-
-
 bool RASReader::ImplReadHeader()
 {
 
m_rRAS.ReadInt32(mnWidth).ReadInt32(mnHeight).ReadInt32(mnDepth).ReadInt32(mnImageDatSize).ReadInt32(mnType).ReadInt32(mnColorMapType).ReadInt32(mnColorMapSize);
 
-if ( mnWidth = 0 || mnHeight = 0 || mnImageDatSize = 0 )
+if (mnWidth = 0 || mnHeight = 0 || mnImageDatSize = 0 || !m_rRAS.good())
 mbStatus = false;
 
 switch ( mnDepth )
@@ -222,7 +220,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 switch ( mnDstBitsPerPix )
 {
 case 1 :
-for ( y = 0; y  mnHeight; y++ )
+for (y = 0; y  mnHeight  mbStatus; ++y)
 {
 for ( x = 0; x  mnWidth; x++ )
 {
@@ -233,11 +231,13 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 nDat  ( ( x  7 ) ^ 7 )) );
 }
 if (!( ( x - 1 )  0x8 ) ) ImplGetByte();   // WORD 
ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
 }
 break;
 
 case 8 :
-for ( y = 0; y  mnHeight; y++ )
+for (y = 0; y  mnHeight  mbStatus; ++y)
 {
 for ( x = 0; x  mnWidth; x++ )
 {
@@ -245,6 +245,8 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 pAcc-SetPixelIndex( y, x, nDat );
 }
 if ( x  1 ) ImplGetByte(); // WORD 
ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
 }
 break;
 
@@ -253,7 +255,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 {
 
 case 24 :
-for ( y = 0; y  mnHeight; y++ )
+for (y = 0; y  mnHeight  mbStatus; ++y)
 {
 for ( x = 0; x  mnWidth; x++ )
 {
@@ -272,11 +274,13 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 pAcc-SetPixel ( y, x, BitmapColor( nRed, nGreen, 
nBlue ) );
 }
 if ( x  1 ) ImplGetByte(); // 
WORD ALIGNMENT ???
+if (!m_rRAS.good())
+mbStatus = false;
 }
 break;
 
 case 32 :
-for ( y = 0; y  mnHeight; y++ )
+for (y = 0; y  mnHeight  mbStatus; ++y)
 {
 for ( x = 0; x  mnWidth; x++ )
 {
@@ -295,6 +299,8 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 }
 pAcc-SetPixel ( y, x, BitmapColor( nRed, nGreen, 
nBlue ) );
 }
+if (!m_rRAS.good())
+mbStatus = false;
 }
 break;
 }
@@ -307,8 +313,6 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 return mbStatus;
 }
 
-
-
 sal_uInt8 RASReader::ImplGetByte()
 {
 sal_uInt8 nRetVal;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 filter/qa/cppunit/data/met/fail/hang-2.met  |binary
 filter/source/graphicfilter/ios2met/ios2met.cxx |   29 +++-
 2 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 89857aacac98f0f8e5dca4718affec493951f904
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 12:59:55 2015 +0100

tools polygons limited to 16bit indexes

Change-Id: Ib0f727a3681492c15b807ca159d8bf7675ee8f29

diff --git a/filter/qa/cppunit/data/met/fail/hang-2.met 
b/filter/qa/cppunit/data/met/fail/hang-2.met
new file mode 100644
index 000..84b432e
Binary files /dev/null and b/filter/qa/cppunit/data/met/fail/hang-2.met differ
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx 
b/filter/source/graphicfilter/ios2met/ios2met.cxx
index f152963..f59567b 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -1172,18 +1172,35 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, 
sal_uInt16 nOrderSize)
 
 void OS2METReader::ReadPolygons()
 {
-sal_uInt32 i,j,nNumPolys, nNumPoints;
 tools::PolyPolygon aPolyPoly;
 Polygon aPoly;
 Point aPoint;
-sal_uInt8 nFlags;
 
-pOS2MET-ReadUChar( nFlags ).ReadUInt32( nNumPolys );
-for (i=0; inNumPolys; i++) {
-pOS2MET-ReadUInt32( nNumPoints );
+sal_uInt8 nFlags(0);
+sal_uInt32 nNumPolys(0);
+pOS2MET-ReadUChar(nFlags).ReadUInt32(nNumPolys);
+
+if (nNumPolys  SAL_MAX_UINT16)
+{
+pOS2MET-SetError(SVSTREAM_FILEFORMAT_ERROR);
+ErrorCode=11;
+return;
+}
+
+for (sal_uInt32 i=0; inNumPolys; ++i)
+{
+sal_uInt32 nNumPoints(0);
+pOS2MET-ReadUInt32(nNumPoints);
+if (nNumPoints  (i == 0) ? SAL_MAX_UINT16-1 : SAL_MAX_UINT16)
+{
+pOS2MET-SetError(SVSTREAM_FILEFORMAT_ERROR);
+ErrorCode=11;
+return;
+}
 if (i==0) nNumPoints++;
 aPoly.SetSize((short)nNumPoints);
-for (j=0; jnNumPoints; j++) {
+for (sal_uInt32 j=0; jnNumPoints; ++j)
+{
 if (i==0  j==0) aPoint=aAttr.aCurPos;
 else aPoint=ReadPoint();
 aPoly.SetPoint(aPoint,(short)j);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 dev/null|binary
 filter/qa/cppunit/data/met/pass/hang-2.met  |binary
 filter/source/graphicfilter/ios2met/ios2met.cxx |6 --
 3 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8547c336b3253d90daae1c79a2b1a57996a39102
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 21:12:51 2015 +0100

WaE: C2220

Change-Id: Ibf9fa7ffc3beb237a470952c265fb1bce313a08a

diff --git a/filter/qa/cppunit/data/met/fail/hang-2.met 
b/filter/qa/cppunit/data/met/pass/hang-2.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-2.met
rename to filter/qa/cppunit/data/met/pass/hang-2.met
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx 
b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 0120a90..e58a069 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -1192,13 +1192,15 @@ void OS2METReader::ReadPolygons()
 {
 sal_uInt32 nNumPoints(0);
 pOS2MET-ReadUInt32(nNumPoints);
-if (nNumPoints  (i == 0) ? SAL_MAX_UINT16-1 : SAL_MAX_UINT16)
+sal_uInt32 nLimit = SAL_MAX_UINT16;
+if (i==0) --nLimit;
+if (nNumPoints  nLimit)
 {
 pOS2MET-SetError(SVSTREAM_FILEFORMAT_ERROR);
 ErrorCode=11;
 return;
 }
-if (i==0) nNumPoints++;
+if (i==0) ++nNumPoints;
 aPoly.SetSize((short)nNumPoints);
 for (sal_uInt32 j=0; jnNumPoints; ++j)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-15 Thread Caolán McNamara
 filter/qa/cppunit/data/dxf/fail/hang-1.dxf|1 
 filter/qa/cppunit/data/dxf/pass/pyramid.dxf   |25008 ++
 filter/source/graphicfilter/idxf/dxfgrprd.cxx |3 
 3 files changed, 25010 insertions(+), 2 deletions(-)

New commits:
commit 5c8325325868753d2891556400c91651bce58402
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 15 17:10:24 2015 +0100

don't hang if at end of stream

Change-Id: I497a30041ec667237c2aa64963dcefb67753e87c

diff --git a/filter/qa/cppunit/data/dxf/fail/hang-1.dxf 
b/filter/qa/cppunit/data/dxf/fail/hang-1.dxf
new file mode 100644
index 000..d97edbb29
--- /dev/null
+++ b/filter/qa/cppunit/data/dxf/fail/hang-1.dxf
@@ -0,0 +1 @@
+99
\ No newline at end of file
diff --git a/filter/qa/cppunit/data/dxf/pass/pyramid.dxf 
b/filter/qa/cppunit/data/dxf/pass/pyramid.dxf
new file mode 100644
index 000..65cd5f83
--- /dev/null
+++ b/filter/qa/cppunit/data/dxf/pass/pyramid.dxf
@@ -0,0 +1,25008 @@
+0
+SECTION
+2
+HEADER
+9
+$ACADVER
+1
+AC1014
+9
+$ACADMAINTVER
+70
+8
+9
+$DWGCODEPAGE
+3
+ANSI_1252
+9
+$INSBASE
+10
+0.0
+20
+0.0
+30
+0.0
+9
+$EXTMIN
+10
+1.00E+20
+20
+1.00E+20
+30
+1.00E+20
+9
+$EXTMAX
+10
+-1.00E+20
+20
+-1.00E+20
+30
+-1.00E+20
+9
+$LIMMIN
+10
+0.0
+20
+0.0
+9
+$LIMMAX
+10
+12.0
+20
+9.0
+9
+$ORTHOMODE
+70
+0
+9
+$REGENMODE
+70
+1
+9
+$FILLMODE
+70
+1
+9
+$QTEXTMODE
+70
+0
+9
+$MIRRTEXT
+70
+1
+9
+$DRAGMODE
+70
+2
+9
+$LTSCALE
+40
+1.0
+9
+$OSMODE
+70
+0
+9
+$ATTMODE
+70
+1
+9
+$TEXTSIZE
+40
+0.2
+9
+$TRACEWID
+40
+0.05
+9
+$TEXTSTYLE
+7
+STANDARD
+9
+$CLAYER
+8
+0
+9
+$CELTYPE
+6
+BYLAYER
+9
+$CECOLOR
+62
+256
+9
+$CELTSCALE
+40
+1.0
+9
+$DELOBJ
+70
+1
+9
+$DISPSILH
+70
+0
+9
+$DIMSCALE
+40
+1.0
+9
+$DIMASZ
+40
+0.18
+9
+$DIMEXO
+40
+0.0625
+9
+$DIMDLI
+40
+0.38
+9
+$DIMRND
+40
+0.0
+9
+$DIMDLE
+40
+0.0
+9
+$DIMEXE
+40
+0.18
+9
+$DIMTP
+40
+0.0
+9
+$DIMTM
+40
+0.0
+9
+$DIMTXT
+40
+0.18
+9
+$DIMCEN
+40
+0.09
+9
+$DIMTSZ
+40
+0.0
+9
+$DIMTOL
+70
+0
+9
+$DIMLIM
+70
+0
+9
+$DIMTIH
+70
+1
+9
+$DIMTOH
+70
+1
+9
+$DIMSE1
+70
+0
+9
+$DIMSE2
+70
+0
+9
+$DIMTAD
+70
+0
+9
+$DIMZIN
+70
+0
+9
+$DIMBLK
+1
+
+9
+$DIMASO
+70
+1
+9
+$DIMSHO
+70
+1
+9
+$DIMPOST
+1
+
+9
+$DIMAPOST
+1
+
+9
+$DIMALT
+70
+0
+9
+$DIMALTD
+70
+2
+9
+$DIMALTF
+40
+25.4
+9
+$DIMLFAC
+40
+1.0
+9
+$DIMTOFL
+70
+0
+9
+$DIMTVP
+40
+0.0
+9
+$DIMTIX
+70
+0
+9
+$DIMSOXD
+70
+0
+9
+$DIMSAH
+70
+0
+9
+$DIMBLK1
+1
+
+9
+$DIMBLK2
+1
+
+9
+$DIMSTYLE
+2
+STANDARD
+9
+$DIMCLRD
+70
+0
+9
+$DIMCLRE
+70
+0
+9
+$DIMCLRT
+70
+0
+9
+$DIMTFAC
+40
+1.0
+9
+$DIMGAP
+40
+0.09
+9
+$DIMJUST
+70
+0
+9
+$DIMSD1
+70
+0
+9
+$DIMSD2
+70
+0
+9
+$DIMTOLJ
+70
+1
+9
+$DIMTZIN
+70
+0
+9
+$DIMALTZ
+70
+0
+9
+$DIMALTTZ
+70
+0
+9
+$DIMFIT
+70
+3
+9
+$DIMUPT
+70
+0
+9
+$DIMUNIT
+70
+2
+9
+$DIMDEC
+70
+4
+9
+$DIMTDEC
+70
+4
+9
+$DIMALTU
+70
+2
+9
+$DIMALTTD
+70
+2
+9
+$DIMTXSTY
+7
+STANDARD
+9
+$DIMAUNIT
+70
+0
+9
+$LUNITS
+70
+2
+9
+$LUPREC
+70
+4
+9
+$SKETCHINC
+40
+0.1
+9
+$FILLETRAD
+40
+0.5
+9
+$AUNITS
+70
+0
+9
+$AUPREC
+70
+0
+9
+$MENU
+1
+.
+9
+$ELEVATION
+40
+0.0
+9
+$PELEVATION
+40
+0.0
+9
+$THICKNESS
+40
+0.0
+9
+$LIMCHECK
+70
+0
+9
+$BLIPMODE
+70
+0
+9
+$CHAMFERA
+40
+0.5
+9
+$CHAMFERB
+40
+0.5
+9
+$CHAMFERC
+40
+1.0
+9
+$CHAMFERD
+40
+0.0
+9
+$SKPOLY
+70
+1
+9
+$TDCREATE
+40
+2451008.519973958
+9
+$TDUPDATE
+40
+2451008.523538426
+9
+$TDINDWG
+40
+0.002406
+9
+$TDUSRTIMER
+40
+0.002406
+9
+$USRTIMER
+70
+1
+9
+$ANGBASE
+50
+0.0
+9
+$ANGDIR
+70
+0
+9
+$PDMODE
+70
+0
+9
+$PDSIZE
+40
+0.0
+9
+$PLINEWID
+40
+0.0
+9
+$COORDS
+70
+1
+9
+$SPLFRAME
+70
+0
+9
+$SPLINETYPE
+70
+6
+9
+$SPLINESEGS
+70
+8
+9
+$ATTDIA
+70
+0
+9
+$ATTREQ
+70
+1
+9
+$HANDLING
+70
+1
+9
+$HANDSEED
+5
+5B
+9
+$SURFTAB1
+70
+6
+9
+$SURFTAB2
+70
+6
+9
+$SURFTYPE
+70
+6
+9
+$SURFU
+70
+6
+9
+$SURFV
+70
+6
+9
+$UCSNAME
+2
+
+9
+$UCSORG
+10
+0.0
+20
+0.0
+30
+0.0
+9
+$UCSXDIR
+10
+1.0
+20
+0.0
+30
+0.0
+9
+$UCSYDIR
+10
+0.0
+20
+1.0
+30
+0.0
+9
+$PUCSNAME
+2
+
+9
+$PUCSORG
+10
+0.0
+20
+0.0
+30
+0.0
+9
+$PUCSXDIR
+10
+1.0
+20
+0.0
+30
+0.0
+9
+$PUCSYDIR
+10
+0.0
+20
+1.0
+30
+0.0
+9
+$USERI1
+70
+0
+9
+$USERI2
+70
+0
+9
+$USERI3
+70
+0
+9
+$USERI4
+70
+0
+9
+$USERI5
+70
+0
+9
+$USERR1
+40
+0.0
+9
+$USERR2
+40
+0.0
+9
+$USERR3
+40
+0.0
+9
+$USERR4
+40
+0.0
+9
+$USERR5
+40
+0.0
+9
+$WORLDVIEW
+70
+1
+9
+$SHADEDGE
+70
+3
+9
+$SHADEDIF
+70
+70
+9
+$TILEMODE
+70
+1
+9
+$MAXACTVP
+70
+48
+9
+$PINSBASE
+10
+0.0
+20
+0.0
+30
+0.0
+9
+$PLIMCHECK
+70
+0
+9
+$PEXTMIN
+10
+1.00E+20
+20
+1.00E+20
+30
+1.00E+20
+9
+$PEXTMAX
+10
+-1.00E+20
+20
+-1.00E+20
+30
+-1.00E+20
+9
+$PLIMMIN
+10
+0.0
+20
+0.0
+9
+$PLIMMAX
+10
+12.0
+20
+9.0
+9
+$UNITMODE
+70
+0
+9
+$VISRETAIN
+70
+1
+9
+$PLINEGEN
+70
+0
+9
+$PSLTSCALE
+70
+1
+9
+$TREEDEPTH
+70
+3020
+9
+$PICKSTYLE
+70
+1
+9
+$CMLSTYLE
+2
+STANDARD
+9
+$CMLJUST
+70
+0
+9
+$CMLSCALE
+40
+1.0
+9
+$PROXYGRAPHICS
+70
+1
+9
+$MEASUREMENT
+70
+0
+0
+ENDSEC
+0
+SECTION
+2
+CLASSES
+0
+ENDSEC
+0
+SECTION
+2
+TABLES
+0
+TABLE
+2
+VPORT
+5
+8
+100

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

2014-11-17 Thread Caolán McNamara
 filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met |binary
 filter/source/graphicfilter/ios2met/ios2met.cxx   |9 -
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit eb6d27321d2d5f9d069c4a3cbcc9bc6e5b4c98ab
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Nov 17 15:22:08 2014 +

afl: divide-by-zero

Change-Id: Ided311873f654c0f40dae57c8876a6412ee97d3e

diff --git a/filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met 
b/filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met
new file mode 100644
index 000..62ccf48
Binary files /dev/null and 
b/filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met differ
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx 
b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 5f1d17f..aa29380 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2357,7 +2357,14 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, 
sal_uInt16 nFieldSize)
 pOS2MET-SeekRel(4);
 nStartIndex=ReadBigEndianWord();
 pOS2MET-SeekRel(3);
-pOS2MET-ReadUChar( nbyte ); 
nBytesPerCol=((sal_uInt16)nbyte)  0x00ff;
+pOS2MET-ReadUChar( nbyte );
+nBytesPerCol=((sal_uInt16)nbyte)  0x00ff;
+if (nBytesPerCol == 0)
+{
+pOS2MET-SetError(SVSTREAM_FILEFORMAT_ERROR);
+ErrorCode=4;
+break;
+}
 nEndIndex=nStartIndex+(nElemLen-11)/nBytesPerCol;
 for (i=nStartIndex; inEndIndex; i++) {
 if (nBytesPerCol  3) pOS2MET-SeekRel(nBytesPerCol-3);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits