From f141fd351034d8e7210cf95973052149c84c2234 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 20 Oct 2015 18:12:22 +0200
Subject: [PATCH 220/398] sc: initial png export
Change-Id: Iae0e89646eab794879529274f09839ad34aa4696
(cherry picked from commit 03bb5d52fecd6c613c6cc36508eb44e5e1c3456a)
---
desktop/qa/desktop_lib/test_desktop_lib.cxx | 10 ++++++++++
desktop/source/lib/init.cxx | 1 +
filter/Configuration_filter.mk | 9 +++++++++
.../config/fragments/filters/calc_png_Export.xcu | 20 ++++++++++++++++++++
postprocess/CustomTarget_registry.mk | 2 ++
svtools/source/filter/DocumentToGraphicRenderer.cxx | 2 ++
6 files changed, 44 insertions(+)
create mode 100644 filter/source/config/fragments/filters/calc_png_Export.xcu
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index c3464a243a3c..3730fd106362 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -64,6 +64,7 @@ public:
void testSearchCalc();
void testPaintTile();
void testSaveAs();
+ void testSaveAsCalc();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
CPPUNIT_TEST(testGetStyles);
@@ -74,6 +75,7 @@ public:
CPPUNIT_TEST(testSearchCalc);
CPPUNIT_TEST(testPaintTile);
CPPUNIT_TEST(testSaveAs);
+ CPPUNIT_TEST(testSaveAsCalc);
CPPUNIT_TEST_SUITE_END();
uno::Reference<lang::XComponent> mxComponent;
@@ -320,6 +322,14 @@ void DesktopLOKTest::testSaveAs()
CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0));
}
+void DesktopLOKTest::testSaveAsCalc()
+{
+ LibLODocument_Impl* pDocument = loadDoc("search.ods");
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", 0));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 97fb6f6a235c..01fe099ccbe9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -131,6 +131,7 @@ static const ExtensionMap aCalcExtensionMap[] =
{ "xhtml", "XHTML Calc File" },
{ "xls", "MS Excel 97" },
{ "xlsx", "Calc MS Excel 2007 XML" },
+ { "png", "calc_png_Export" },
{ NULL, NULL }
};
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 29e672bee4d2..0a0dddbe4c5a 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -837,6 +837,15 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics
writer_png_Export \
))
+# fcfg_calcgraphics
+$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calcgraphics_types.xcu,filter/source/config/fragments/types,\
+ png_Portable_Network_Graphic \
+))
+
+$(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_filters.xcu,filter/source/config/fragments/filters,\
+ calc_png_Export \
+))
+
# fcfg_internalgraphics
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\
bmp_MS_Windows \
diff --git a/filter/source/config/fragments/filters/calc_png_Export.xcu b/filter/source/config/fragments/filters/calc_png_Export.xcu
new file mode 100644
index 000000000000..999bef299a75
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_png_Export.xcu
@@ -0,0 +1,20 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-->
+ <node oor:name="calc_png_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.comp.GraphicExportDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">PNG - Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>png_Portable_Network_Graphic</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk
index 2502011863f8..0a46d6650052 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -87,6 +87,8 @@ postprocess_FILES_graphicfilter := \
$(call gb_XcuFilterTypesTarget_get_target,fcfg_drawgraphics_types.xcu) \
$(call gb_XcuFilterFiltersTarget_get_target,fcfg_impressgraphics_filters.xcu) \
$(call gb_XcuFilterTypesTarget_get_target,fcfg_impressgraphics_types.xcu) \
+ $(call gb_XcuFilterFiltersTarget_get_target,fcfg_calcgraphics_filters.xcu) \
+ $(call gb_XcuFilterTypesTarget_get_target,fcfg_calcgraphics_types.xcu) \
$(call gb_XcuFilterFiltersTarget_get_target,fcfg_writergraphics_filters.xcu) \
$(call gb_XcuFilterTypesTarget_get_target,fcfg_writergraphics_types.xcu)
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index e33a94ec416e..e78b0f1ad8ab 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -148,6 +148,8 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
sal_Int32 DocumentToGraphicRenderer::getCurrentPageWriter()
{
Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(mxModel->getCurrentController(), UNO_QUERY);
+ if (!xTextViewCursorSupplier.is())
+ return 1;
Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), UNO_QUERY);
return xCursor->getPage();
}
--
2.12.0