summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/Configuration_filter.mk13
-rw-r--r--filter/CppunitTest_filter_pdf.mk47
-rw-r--r--filter/CppunitTest_filter_textfilterdetect.mk1
-rw-r--r--filter/Module_filter.mk1
-rw-r--r--filter/qa/complex/filter/detection/typeDetection/files.csv1
-rw-r--r--filter/qa/cppunit/xslt-test.cxx28
-rw-r--r--filter/qa/data/picture.pdfbin0 -> 13829 bytes
-rw-r--r--filter/qa/pdf.cxx149
-rw-r--r--filter/qa/unit/data/attributeRedefinedTest.odpbin0 -> 12610 bytes
-rw-r--r--filter/qa/unit/data/calc.otsbin0 -> 9564 bytes
-rw-r--r--filter/qa/unit/data/empty.ods0
-rw-r--r--filter/qa/unit/data/impress.otpbin0 -> 15382 bytes
-rw-r--r--filter/qa/unit/data/writer.ottbin0 -> 10017 bytes
-rw-r--r--filter/qa/unit/svg.cxx42
-rw-r--r--filter/qa/unit/textfilterdetect.cxx156
-rw-r--r--filter/source/config/cache/basecontainer.cxx24
-rw-r--r--filter/source/config/cache/basecontainer.hxx10
-rw-r--r--filter/source/config/cache/cacheitem.cxx241
-rw-r--r--filter/source/config/cache/cacheitem.hxx8
-rw-r--r--filter/source/config/cache/cacheupdatelistener.cxx20
-rw-r--r--filter/source/config/cache/cacheupdatelistener.hxx6
-rw-r--r--filter/source/config/cache/contenthandlerfactory.cxx5
-rw-r--r--filter/source/config/cache/filtercache.cxx72
-rw-r--r--filter/source/config/cache/filtercache.hxx15
-rw-r--r--filter/source/config/cache/filterfactory.cxx40
-rw-r--r--filter/source/config/cache/filterfactory.hxx4
-rw-r--r--filter/source/config/cache/frameloaderfactory.cxx5
-rw-r--r--filter/source/config/cache/querytokenizer.cxx11
-rw-r--r--filter/source/config/cache/querytokenizer.hxx2
-rw-r--r--filter/source/config/cache/typedetection.cxx27
-rw-r--r--filter/source/config/cache/typedetection.hxx9
-rw-r--r--filter/source/config/fragments/filters/WEBP___WebP.xcu30
-rw-r--r--filter/source/config/fragments/filters/calc_webp_Export.xcu20
-rw-r--r--filter/source/config/fragments/filters/draw_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/impress_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/writer_web_webp_Export.xcu21
-rw-r--r--filter/source/config/fragments/filters/writer_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu27
-rw-r--r--filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu2
-rw-r--r--filter/source/config/fragments/types/webp_WebP.xcu29
-rw-r--r--filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu2
-rw-r--r--filter/source/graphic/GraphicExportFilter.cxx2
-rw-r--r--filter/source/graphicfilter/icgm/actimpr.cxx2
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx8
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx46
-rw-r--r--filter/source/msfilter/escherex.cxx39
-rw-r--r--filter/source/msfilter/eschesdo.cxx2
-rw-r--r--filter/source/msfilter/msdffimp.cxx357
-rw-r--r--filter/source/msfilter/mstoolbar.cxx6
-rw-r--r--filter/source/msfilter/msvbahelper.cxx51
-rw-r--r--filter/source/msfilter/svdfppt.cxx47
-rw-r--r--filter/source/msfilter/util.cxx1266
-rw-r--r--filter/source/pdf/impdialog.cxx56
-rw-r--r--filter/source/pdf/impdialog.hxx5
-rw-r--r--filter/source/pdf/pdfdecomposer.cxx8
-rw-r--r--filter/source/pdf/pdfexport.cxx50
-rw-r--r--filter/source/pdf/pdfexport.hxx32
-rw-r--r--filter/source/pdf/pdffilter.cxx13
-rw-r--r--filter/source/svg/presentation_engine.js4
-rw-r--r--filter/source/svg/svgexport.cxx6
-rw-r--r--filter/source/svg/svgfilter.cxx12
-rw-r--r--filter/source/svg/svgfilter.hxx1
-rw-r--r--filter/source/svg/svgfontexport.cxx5
-rw-r--r--filter/source/svg/svgfontexport.hxx2
-rw-r--r--filter/source/svg/svgwriter.cxx50
-rw-r--r--filter/source/svg/svgwriter.hxx2
-rw-r--r--filter/source/textfilterdetect/filterdetect.cxx48
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx16
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx9
-rw-r--r--filter/source/xsltdialog/typedetectionimport.cxx33
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hxx2
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx8
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.hxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx61
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx12
-rw-r--r--filter/uiconfig/ui/pdfgeneralpage.ui2
-rw-r--r--filter/uiconfig/ui/warnpdfdialog.ui58
-rw-r--r--filter/uiconfig/ui/xmlfiltertabpagegeneral.ui2
79 files changed, 2051 insertions, 1459 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index dfeacc6a542c..a58b8396c551 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -442,6 +442,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_web_filters.xc
writer_web_pdf_Export\
writer_web_png_Export\
writer_web_jpg_Export\
+ writer_web_webp_Export\
writerweb8_writer_template\
writerweb8_writer \
))
@@ -715,6 +716,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ
svm_StarView_Metafile \
tga_Truevision_TARGA \
tif_Tag_Image_File \
+ webp_WebP \
wmf_MS_Windows_Metafile \
xbm_X_Consortium \
xpm_XPM \
@@ -742,6 +744,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
SVM___StarView_Metafile \
TGA___Truevision_TARGA \
TIF___Tag_Image_File \
+ WEBP___WebP \
WMF___MS_Windows_Metafile \
XBM___X_Consortium \
XPM \
@@ -757,6 +760,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
draw_png_Export \
draw_svg_Export \
draw_tif_Export \
+ draw_webp_Export \
draw_wmf_Export \
))
@@ -781,6 +785,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impressgraphics_
svm_StarView_Metafile \
tif_Tag_Image_File \
wmf_MS_Windows_Metafile \
+ webp_WebP \
xpm_XPM \
))
@@ -795,6 +800,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic
impress_png_Export \
impress_svg_Export \
impress_tif_Export \
+ impress_webp_Export \
impress_wmf_Export \
))
@@ -809,6 +815,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics
writer_jpg_Export \
writer_png_Export \
writer_svg_Export \
+ writer_webp_Export \
))
# fcfg_calcgraphics
@@ -821,6 +828,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_f
calc_jpg_Export \
calc_png_Export \
calc_svg_Export \
+ calc_webp_Export \
))
# fcfg_internalgraphics
@@ -848,6 +856,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics
svm_StarView_Metafile \
tga_Truevision_TARGA \
tif_Tag_Image_File \
+ webp_WebP \
wmf_MS_Windows_Metafile \
xbm_X_Consortium \
xpm_XPM \
@@ -887,11 +896,13 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter
tga_Import \
tif_Export \
tif_Import \
+ webp_Export \
+ webp_Import \
wmf_Export \
wmf_Import \
xbm_Import \
xpm_Import \
- mov_Import \
+ mov_Import \
))
# fcfg_xslt
diff --git a/filter/CppunitTest_filter_pdf.mk b/filter/CppunitTest_filter_pdf.mk
new file mode 100644
index 000000000000..b85bbf45437c
--- /dev/null
+++ b/filter/CppunitTest_filter_pdf.mk
@@ -0,0 +1,47 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,filter_pdf))
+
+$(eval $(call gb_CppunitTest_use_externals,filter_pdf,\
+ boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,filter_pdf, \
+ filter/qa/pdf \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,filter_pdf, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ test \
+ tl \
+ unotest \
+ utl \
+ vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,filter_pdf))
+
+$(eval $(call gb_CppunitTest_use_ure,filter_pdf))
+$(eval $(call gb_CppunitTest_use_vcl,filter_pdf))
+
+$(eval $(call gb_CppunitTest_use_rdb,filter_pdf,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,filter_pdf,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,filter_pdf))
+
+# vim: set noet sw=4 ts=4:
diff --git a/filter/CppunitTest_filter_textfilterdetect.mk b/filter/CppunitTest_filter_textfilterdetect.mk
index 4066c26591a3..6fb22f8b074e 100644
--- a/filter/CppunitTest_filter_textfilterdetect.mk
+++ b/filter/CppunitTest_filter_textfilterdetect.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,filter_textfilterdetect, \
cppu \
cppuhelper \
sal \
+ sfx \
test \
textfd \
tl \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 42a82bacf5c0..c28c72705cec 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -50,6 +50,7 @@ $(eval $(call gb_Module_add_check_targets,filter,\
CppunitTest_filter_priority \
CppunitTest_filter_msfilter \
CppunitTest_filter_textfilterdetect \
+ CppunitTest_filter_pdf \
))
ifneq ($(DISABLE_CVE_TESTS),TRUE)
diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv
index b882ea1179ca..8e558590b4e7 100644
--- a/filter/qa/complex/filter/detection/typeDetection/files.csv
+++ b/filter/qa/complex/filter/detection/typeDetection/files.csv
@@ -111,6 +111,7 @@ ppm;Graphics/pic.ppm;ppm_Portable_Pixelmap;ppm_Portable_Pixelmap
ras;Graphics/pic.ras;ras_Sun_Rasterfile;ras_Sun_Rasterfile
svm;Graphics/pic.svm;svm_StarView_Metafile;svm_StarView_Metafile:generic_Text
tif;Graphics/pic.tif;tif_Tag_Image_File;tif_Tag_Image_File:generic_Text
+webp;Graphics/pic.webp;webp_WebP;webp_WebP
wmf;Graphics/pic.wmf;wmf_MS_Windows_Metafile;wmf_MS_Windows_Metafile:generic_Text
diff --git a/filter/qa/cppunit/xslt-test.cxx b/filter/qa/cppunit/xslt-test.cxx
index de0e9e71f07a..4e0c621d6786 100644
--- a/filter/qa/cppunit/xslt-test.cxx
+++ b/filter/qa/cppunit/xslt-test.cxx
@@ -98,14 +98,14 @@ void XsltFilterTest::testXsltCopyNew()
m_directories.getURLFromSrc(u"/filter/source/xsltfilter/xsltfilter.component"));
uno::Sequence<uno::Any> args{
uno::Any(beans::NamedValue("StylesheetURL",
- uno::makeAny(m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/xslt/copy.xslt")))),
- uno::Any(beans::NamedValue("SourceURL", uno::makeAny(source))),
- uno::Any(beans::NamedValue("TargetURL", uno::makeAny(tempURL))),
+ uno::Any(m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/xslt/copy.xslt")))),
+ uno::Any(beans::NamedValue("SourceURL", uno::Any(source))),
+ uno::Any(beans::NamedValue("TargetURL", uno::Any(tempURL))),
uno::Any(beans::NamedValue("SourceBaseURL",
- uno::makeAny(m_directories.getURLFromSrc(u"/filter/source/xsltfilter/")))),
- uno::Any(beans::NamedValue("TargetBaseURL", uno::makeAny(tempDirURL))),
- uno::Any(beans::NamedValue("SystemType", uno::makeAny(OUString()))),
- uno::Any(beans::NamedValue("PublicType", uno::makeAny(OUString())))
+ uno::Any(m_directories.getURLFromSrc(u"/filter/source/xsltfilter/")))),
+ uno::Any(beans::NamedValue("TargetBaseURL", uno::Any(tempDirURL))),
+ uno::Any(beans::NamedValue("SystemType", uno::Any(OUString()))),
+ uno::Any(beans::NamedValue("PublicType", uno::Any(OUString())))
};
uno::Reference<ucb::XSimpleFileAccess3> xSFA =
@@ -153,14 +153,14 @@ void XsltFilterTest::testXsltCopyOld()
m_directories.getURLFromSrc(u"/filter/source/xsltfilter/xsltfilter.component"));
uno::Sequence<uno::Any> args{
uno::Any(beans::NamedValue("StylesheetURL",
- uno::makeAny(m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/xslt/copy.xslt")))),
- uno::Any(beans::NamedValue("SourceURL", uno::makeAny(source))),
- uno::Any(beans::NamedValue("TargetURL", uno::makeAny(tempURL))),
+ uno::Any(m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/xslt/copy.xslt")))),
+ uno::Any(beans::NamedValue("SourceURL", uno::Any(source))),
+ uno::Any(beans::NamedValue("TargetURL", uno::Any(tempURL))),
uno::Any(beans::NamedValue("SourceBaseURL",
- uno::makeAny(m_directories.getURLFromSrc(u"/filter/source/xsltfilter/")))),
- uno::Any(beans::NamedValue("TargetBaseURL", uno::makeAny(tempDirURL))),
- uno::Any(beans::NamedValue("SystemType", uno::makeAny(OUString()))),
- uno::Any(beans::NamedValue("PublicType", uno::makeAny(OUString())))
+ uno::Any(m_directories.getURLFromSrc(u"/filter/source/xsltfilter/")))),
+ uno::Any(beans::NamedValue("TargetBaseURL", uno::Any(tempDirURL))),
+ uno::Any(beans::NamedValue("SystemType", uno::Any(OUString()))),
+ uno::Any(beans::NamedValue("PublicType", uno::Any(OUString())))
};
uno::Reference<ucb::XSimpleFileAccess3> xSFA =
diff --git a/filter/qa/data/picture.pdf b/filter/qa/data/picture.pdf
new file mode 100644
index 000000000000..79af2b349dd2
--- /dev/null
+++ b/filter/qa/data/picture.pdf
Binary files differ
diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx
new file mode 100644
index 000000000000..bc8329d0116e
--- /dev/null
+++ b/filter/qa/pdf.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <comphelper/propertyvalue.hxx>
+#include <tools/stream.hxx>
+#include <unotools/streamwrap.hxx>
+#include <vcl/filter/PDFiumLibrary.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Covers filter/source/pdf/ fixes.
+class Test : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ void setUp() override;
+ void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void Test::setUp()
+{
+ test::BootstrapFixture::setUp();
+ MacrosTest::setUpNssGpg(m_directories, "filter_pdf");
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void Test::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/data/";
+
+CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName)
+{
+ uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
+ = xml::crypto::SEInitializer::create(mxComponentContext);
+ uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
+ = xSEInitializer->createSecurityContext(OUString());
+ uno::Reference<xml::crypto::XSecurityEnvironment> xSecurityEnvironment
+ = xSecurityContext->getSecurityEnvironment();
+ if (!GetValidCertificate(xSecurityEnvironment->getPersonalCertificates()))
+ {
+ return;
+ }
+
+ // Given an empty document:
+ getComponent().set(
+ loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // When exporting to PDF, and referring to a certificate using a subject name:
+ uno::Reference<css::lang::XMultiServiceFactory> xFactory = getMultiServiceFactory();
+ uno::Reference<document::XFilter> xFilter(
+ xFactory->createInstance("com.sun.star.document.PDFFilter"), uno::UNO_QUERY);
+ uno::Reference<document::XExporter> xExporter(xFilter, uno::UNO_QUERY);
+ xExporter->setSourceDocument(getComponent());
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+
+ uno::Sequence<beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("SignPDF", true),
+ comphelper::makePropertyValue(
+ "SignCertificateSubjectName",
+ OUString(
+ "CN=Xmlsecurity RSA Test example Alice,O=Xmlsecurity RSA Test,ST=England,C=UK")),
+ };
+ uno::Sequence<beans::PropertyValue> aDescriptor{
+ comphelper::makePropertyValue("FilterName", OUString("writer_pdf_Export")),
+ comphelper::makePropertyValue("FilterData", aFilterData),
+ comphelper::makePropertyValue("OutputStream", xOutputStream),
+ };
+ xFilter->filter(aDescriptor);
+
+ // Then make sure the resulting PDF has a signature:
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize());
+ // Without the accompanying fix in place, this test would have failed, as signing was enabled
+ // without configuring a certificate, so the whole export failed.
+ 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<beans::PropertyValue> 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<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ auto xGraphic = xShape->getPropertyValue("Graphic").get<uno::Reference<graphic::XGraphic>>();
+ 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: 9437
+ // - Actual : 34176
+ // i.e. the width was too large, it used all width of the body frame.
+ // 9437 mm100 is 267.507 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
+ // Unfortunately, this test is DPI-dependent.
+ // Use some allowance (~1/2 pt) to let it pass on non-default DPI.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(9437, aRange.getWidth(), 20.0);
+#endif
+}
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp b/filter/qa/unit/data/attributeRedefinedTest.odp
new file mode 100644
index 000000000000..dfb814bfb9ec
--- /dev/null
+++ b/filter/qa/unit/data/attributeRedefinedTest.odp
Binary files differ
diff --git a/filter/qa/unit/data/calc.ots b/filter/qa/unit/data/calc.ots
new file mode 100644
index 000000000000..d16d2307fee9
--- /dev/null
+++ b/filter/qa/unit/data/calc.ots
Binary files differ
diff --git a/filter/qa/unit/data/empty.ods b/filter/qa/unit/data/empty.ods
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/filter/qa/unit/data/empty.ods
diff --git a/filter/qa/unit/data/impress.otp b/filter/qa/unit/data/impress.otp
new file mode 100644
index 000000000000..199a5f9d470f
--- /dev/null
+++ b/filter/qa/unit/data/impress.otp
Binary files differ
diff --git a/filter/qa/unit/data/writer.ott b/filter/qa/unit/data/writer.ott
new file mode 100644
index 000000000000..1ded03150e01
--- /dev/null
+++ b/filter/qa/unit/data/writer.ott
Binary files differ
diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx
index 3e3508fd52ca..8cb696efa170 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<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY_THROW);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> 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(&aStream);
+
+ // 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 gets redefined like this:
+ // <tspan id="id14" id="id15" id="id17" class="TextParagraph" font-family="Bahnschrift Light" font-size="1129px" font-weight="400">
+
+ 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 does not 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/qa/unit/textfilterdetect.cxx b/filter/qa/unit/textfilterdetect.cxx
index 62d0d60a23a7..3c8daf2f2ef9 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -13,8 +13,13 @@
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/sheet/XCellRangesAccess.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
#include <comphelper/propertyvalue.hxx>
+#include <sfx2/docfac.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/streamwrap.hxx>
#include <tools/stream.hxx>
@@ -31,12 +36,8 @@ namespace
/// Test class for PlainTextFilterDetect.
class TextFilterDetectTest : public test::BootstrapFixture, public unotest::MacrosTest
{
- uno::Reference<lang::XComponent> mxComponent;
-
public:
void setUp() override;
- void tearDown() override;
- uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
};
void TextFilterDetectTest::setUp()
@@ -46,14 +47,6 @@ void TextFilterDetectTest::setUp()
mxDesktop.set(frame::Desktop::create(mxComponentContext));
}
-void TextFilterDetectTest::tearDown()
-{
- if (mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/unit/data/";
CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428)
@@ -78,59 +71,126 @@ CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428)
CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testEmptyFile)
{
- // Given an empty file, with a pptx extension
- OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "empty.pptx";
+ const OUString sDataDirectory = m_directories.getURLFromSrc(DATA_DIRECTORY);
+ auto supportsService = [](const uno::Reference<lang::XComponent>& x, const OUString& s) {
+ return uno::Reference<lang::XServiceInfo>(x, uno::UNO_QUERY_THROW)->supportsService(s);
+ };
+ // Given an empty file, with a pptx extension
// When loading the file
- getComponent() = loadFromDesktop(aURL);
+ auto xComponent = loadFromDesktop(sDataDirectory + "empty.pptx");
// Then make sure it is opened in Impress.
- uno::Reference<lang::XServiceInfo> xServiceInfo(getComponent(), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xServiceInfo.is());
-
// Without the accompanying fix in place, this test would have failed, as it was opened in
// Writer instead.
- CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument"));
-
- getComponent()->dispose();
+ CPPUNIT_ASSERT(supportsService(xComponent, "com.sun.star.presentation.PresentationDocument"));
+ xComponent->dispose();
// Now also test ODT
- aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "empty.odt";
- getComponent() = loadFromDesktop(aURL);
- xServiceInfo.set(getComponent(), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xServiceInfo.is());
+ xComponent = loadFromDesktop(sDataDirectory + "empty.odt");
// Make sure it opens in Writer.
- CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument"));
- getComponent()->dispose();
+ CPPUNIT_ASSERT(supportsService(xComponent, "com.sun.star.text.TextDocument"));
+ xComponent->dispose();
+
+ // ... and ODS
+ xComponent = loadFromDesktop(sDataDirectory + "empty.ods");
+ // Make sure it opens in Calc.
+ CPPUNIT_ASSERT(supportsService(xComponent, "com.sun.star.sheet.SpreadsheetDocument"));
+ xComponent->dispose();
// ... and ODP
- aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "empty.odp";
- getComponent() = loadFromDesktop(aURL);
- xServiceInfo.set(getComponent(), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xServiceInfo.is());
+ xComponent = loadFromDesktop(sDataDirectory + "empty.odp");
// Without the accompanying fix in place, this test would have failed, as it was opened in
// Writer instead.
- CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument"));
- getComponent()->dispose();
+ CPPUNIT_ASSERT(supportsService(xComponent, "com.sun.star.presentation.PresentationDocument"));
+ xComponent->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<frame::XModel> xModel(getComponent(), uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> 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);
+ xComponent = loadFromDesktop(sDataDirectory + "empty.doc");
+ CPPUNIT_ASSERT(supportsService(xComponent, "com.sun.star.text.TextDocument"));
+ {
+ uno::Reference<frame::XModel> xModel(xComponent, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> 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);
+ }
+ xComponent->dispose();
+
+ // Now test with default templates set
+
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.presentation.PresentationDocument",
+ sDataDirectory + "impress.otp");
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.text.TextDocument",
+ sDataDirectory + "writer.ott");
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.sheet.SpreadsheetDocument",
+ sDataDirectory + "calc.ots");
+
+ xComponent = loadFromDesktop(sDataDirectory + "empty.pptx");
+ {
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPages> xPages(xDoc->getDrawPages(), uno::UNO_SET_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(xPages->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xBox(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ // Make sure the template's text was loaded
+ CPPUNIT_ASSERT_EQUAL(OUString("Title of Impress template"), xBox->getString());
+ }
+ xComponent->dispose();
+
+ xComponent = loadFromDesktop(sDataDirectory + "empty.odt");
+ {
+ uno::Reference<text::XTextDocument> xDoc(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<container::XEnumerationAccess> xEA(xDoc->getText(), uno::UNO_QUERY_THROW);
+ uno::Reference<container::XEnumeration> xEnum(xEA->createEnumeration(), uno::UNO_SET_THROW);
+ uno::Reference<text::XTextRange> xParagraph(xEnum->nextElement(), uno::UNO_QUERY_THROW);
+
+ // Make sure the template's text was loaded
+ CPPUNIT_ASSERT_EQUAL(OUString(u"Writer template’s first line"), xParagraph->getString());
+ }
+ xComponent->dispose();
+
+ xComponent = loadFromDesktop(sDataDirectory + "empty.ods");
+ {
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<sheet::XCellRangesAccess> xRA(xDoc->getSheets(), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xC(xRA->getCellByPosition(0, 0, 0), uno::UNO_QUERY_THROW);
+
+ // Make sure the template's text was loaded
+ CPPUNIT_ASSERT_EQUAL(OUString(u"Calc template’s first cell"), xC->getString());
+ }
+ xComponent->dispose();
+
+ xComponent = loadFromDesktop(sDataDirectory + "empty.odp");
+ {
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPages> xPages(xDoc->getDrawPages(), uno::UNO_SET_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(xPages->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xBox(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ // Make sure the template's text was loaded
+ CPPUNIT_ASSERT_EQUAL(OUString("Title of Impress template"), xBox->getString());
+ }
+ xComponent->dispose();
+
+ xComponent = loadFromDesktop(sDataDirectory + "empty.doc");
+ {
+ uno::Reference<text::XTextDocument> xDoc(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<container::XEnumerationAccess> xEA(xDoc->getText(), uno::UNO_QUERY_THROW);
+ uno::Reference<container::XEnumeration> xEnum(xEA->createEnumeration(), uno::UNO_SET_THROW);
+ uno::Reference<text::XTextRange> xParagraph(xEnum->nextElement(), uno::UNO_QUERY_THROW);
+
+ // Make sure the template's text was loaded
+ CPPUNIT_ASSERT_EQUAL(OUString(u"Writer template’s first line"), xParagraph->getString());
+ }
+ xComponent->dispose();
}
}
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
index 97e7b7f22bea..dbbb9bcc23da 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -21,7 +21,6 @@
#include "basecontainer.hxx"
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <com/sun/star/document/FilterConfigRefresh.hpp>
#include <com/sun/star/uno/Type.h>
#include <comphelper/enumhelper.hxx>
#include <comphelper/sequence.hxx>
@@ -45,8 +44,7 @@ BaseContainer::~BaseContainer()
}
-void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
- const OUString& sImplementationName,
+void BaseContainer::init(const OUString& sImplementationName,
const css::uno::Sequence< OUString >& lServiceNames ,
FilterCache::EItemType eType )
{
@@ -56,7 +54,6 @@ void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext
m_sImplementationName = sImplementationName;
m_lServiceNames = lServiceNames ;
m_eType = eType ;
- m_xRefreshBroadcaster = css::document::FilterConfigRefresh::create(rxContext);
// <- SAFE
}
@@ -236,12 +233,10 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem)
// SAFE ->
osl::MutexGuard aLock(m_aMutex);
- CacheItem aItem;
try
{
FilterCache* pCache = impl_getWorkingCache();
- aItem = pCache->getItem(m_eType, sItem);
- pCache->addStatePropsToItem(m_eType, sItem, aItem); // add implicit props "Finalized"/"Mandatory"
+ aValue = pCache->getItemWithStateProps(m_eType, sItem);
}
catch(const css::container::NoSuchElementException&)
{
@@ -250,10 +245,8 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem)
catch(const css::uno::Exception&)
{
// TODO invalid cache!? How should it be handled right?
- aItem.clear();
}
- aValue <<= aItem.getAsPackedPropertyValueList();
// <- SAFE
return aValue;
@@ -366,14 +359,10 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
try
{
- // convert the given properties first to our internal representation
- CacheItem lProps;
- lProps << lProperties;
-
// search the key names of all items, where its properties match
// the given ones in its minimum
FilterCache* pCache = impl_getWorkingCache();
- lKeys = pCache->getMatchingItemsByProps(m_eType, lProps);
+ lKeys = pCache->getMatchingItemsByProps(m_eType, o3tl::span<const css::beans::NamedValue>( lProperties.getConstArray(), lProperties.getLength() ));
}
catch(const css::uno::Exception&)
{
@@ -430,19 +419,14 @@ void SAL_CALL BaseContainer::flush()
throw css::lang::WrappedTargetRuntimeException( "Flush rejected by internal container.",
static_cast< OWeakObject* >(this),
- css::uno::makeAny(ex));
+ css::uno::Any(ex));
}
m_pFlushCache.reset();
- css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = m_xRefreshBroadcaster;
-
aLock.clear();
// <- SAFE
- if (xRefreshBroadcaster.is())
- xRefreshBroadcaster->refresh();
-
// notify listener outside the lock!
// The used listener helper lives if we live
// and is threadsafe by itself.
diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx
index 4ed14d4f603a..6691c1b49380 100644
--- a/filter/source/config/cache/basecontainer.hxx
+++ b/filter/source/config/cache/basecontainer.hxx
@@ -60,9 +60,6 @@ class BaseContainer : public cppu::BaseMutex
protected:
- // TODO
- css::uno::WeakReference< css::util::XRefreshable > m_xRefreshBroadcaster;
-
/** @short the implementation name of our derived class, which we provide
at the interface XServiceInfo of our class... */
OUString m_sImplementationName;
@@ -145,10 +142,9 @@ class BaseContainer : public cppu::BaseMutex
specify, which sub container of the used filter cache
must be wrapped by this container interface.
*/
- void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
- const OUString& sImplementationName,
- const css::uno::Sequence< OUString >& lServiceNames ,
- FilterCache::EItemType eType );
+ void init( const OUString& sImplementationName,
+ const css::uno::Sequence< OUString >& lServiceNames ,
+ FilterCache::EItemType eType );
// helper
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx
index a406b16ff130..595d3891aa7d 100644
--- a/filter/source/config/cache/cacheitem.cxx
+++ b/filter/source/config/cache/cacheitem.cxx
@@ -40,13 +40,7 @@ CacheItem::CacheItem()
void CacheItem::update(const CacheItem& rUpdateItem)
{
for (auto const& elem : rUpdateItem)
- {
- iterator pItThis = find(elem.first);
- if (pItThis == end())
- (*this)[elem.first] = elem.second; // add new prop
- else
- pItThis->second = elem.second; // change value of existing prop
- }
+ (*this)[elem.first] = elem.second;
}
@@ -83,28 +77,35 @@ void CacheItem::validateUINames(const OUString& sActLocale)
}
-css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList()
+css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList(bool bFinalized, bool bMandatory) const
{
sal_Int32 c = static_cast<sal_Int32>(size());
sal_Int32 i = 0;
- css::uno::Sequence< css::beans::PropertyValue > lList(c);
+ css::uno::Sequence< css::beans::PropertyValue > lList(c+2);
css::beans::PropertyValue* pList = lList.getArray();
for (const_iterator pProp = begin();
pProp != end() ;
++pProp )
{
- const OUString& rName = pProp->first;
+ const OUString& rName = pProp->first.maString;
const css::uno::Any& rValue = pProp->second;
if (!rValue.hasValue())
continue;
+ assert (rName != PROPNAME_FINALIZED && rName != PROPNAME_MANDATORY);
pList[i].Name = rName ;
pList[i].Value = rValue;
++i;
}
+ pList[i].Name = PROPNAME_FINALIZED ;
+ pList[i].Value <<= bFinalized;
+ ++i;
+ pList[i].Name = PROPNAME_MANDATORY ;
+ pList[i].Value <<= bMandatory;
+ ++i;
lList.realloc(i);
return lList;
@@ -122,169 +123,159 @@ static bool isSubSet(const css::uno::Any& aSubSet,
return false;
}
- css::uno::TypeClass aTypeClass = aT1.getTypeClass();
- switch(aTypeClass)
+ if (aSubSet.hasValue() && aSet.hasValue())
{
-
- case css::uno::TypeClass_BOOLEAN :
- case css::uno::TypeClass_BYTE :
- case css::uno::TypeClass_SHORT :
- case css::uno::TypeClass_UNSIGNED_SHORT :
- case css::uno::TypeClass_LONG :
- case css::uno::TypeClass_UNSIGNED_LONG :
- case css::uno::TypeClass_HYPER :
- case css::uno::TypeClass_UNSIGNED_HYPER :
- case css::uno::TypeClass_FLOAT :
- case css::uno::TypeClass_DOUBLE :
- {
- bool bIs = (aSubSet == aSet);
- return bIs;
- }
-
-
- case css::uno::TypeClass_STRING :
+ css::uno::TypeClass aTypeClass = aT1.getTypeClass();
+ switch(aTypeClass)
{
- OUString v1;
- OUString v2;
- if (
- (aSubSet >>= v1) &&
- (aSet >>= v2)
- )
+ case css::uno::TypeClass_BOOLEAN :
+ case css::uno::TypeClass_BYTE :
+ case css::uno::TypeClass_SHORT :
+ case css::uno::TypeClass_UNSIGNED_SHORT :
+ case css::uno::TypeClass_LONG :
+ case css::uno::TypeClass_UNSIGNED_LONG :
+ case css::uno::TypeClass_HYPER :
+ case css::uno::TypeClass_UNSIGNED_HYPER :
+ case css::uno::TypeClass_FLOAT :
+ case css::uno::TypeClass_DOUBLE :
{
- bool bIs = v1 == v2;
+ bool bIs = (aSubSet == aSet);
return bIs;
}
- }
- break;
- case css::uno::TypeClass_STRUCT :
- {
- css::beans::PropertyValue p1;
- css::beans::PropertyValue p2;
+ case css::uno::TypeClass_STRING :
+ return aSubSet == aSet;
+ break;
- if (
- (aSubSet >>= p1) &&
- (aSet >>= p2)
- )
- {
- bool bIs = (p1.Name == p2.Name) && isSubSet(p1.Value, p2.Value);
- return bIs;
- }
- css::beans::NamedValue n1;
- css::beans::NamedValue n2;
-
- if (
- (aSubSet >>= n1) &&
- (aSet >>= n2)
- )
+ case css::uno::TypeClass_STRUCT :
{
- bool bIs = (n1.Name == n2.Name) && isSubSet(n1.Value, n2.Value);
- return bIs;
- }
- }
- break;
+ css::beans::PropertyValue p1;
+ css::beans::PropertyValue p2;
+ if (
+ (aSubSet >>= p1) &&
+ (aSet >>= p2)
+ )
+ {
+ bool bIs = (p1.Name == p2.Name) && isSubSet(p1.Value, p2.Value);
+ return bIs;
+ }
- case css::uno::TypeClass_SEQUENCE :
- {
- css::uno::Sequence< OUString > uno_s1;
- css::uno::Sequence< OUString > uno_s2;
-
- if (
- (aSubSet >>= uno_s1) &&
- (aSet >>= uno_s2)
- )
- {
- std::vector<OUString> stl_s1(comphelper::sequenceToContainer< std::vector<OUString> >(uno_s1));
- std::vector<OUString> stl_s2(comphelper::sequenceToContainer< std::vector<OUString> >(uno_s2));
+ css::beans::NamedValue n1;
+ css::beans::NamedValue n2;
- for (auto const& elem : stl_s1)
+ if (
+ (aSubSet >>= n1) &&
+ (aSet >>= n2)
+ )
{
- if (::std::find(stl_s2.begin(), stl_s2.end(), elem) == stl_s2.end())
- {
- return false;
- }
+ bool bIs = (n1.Name == n2.Name) && isSubSet(n1.Value, n2.Value);
+ return bIs;
}
- return true;
}
+ break;
- css::uno::Sequence< css::beans::PropertyValue > uno_p1;
- css::uno::Sequence< css::beans::PropertyValue > uno_p2;
- if (
- (aSubSet >>= uno_p1) &&
- (aSet >>= uno_p2)
- )
+ case css::uno::TypeClass_SEQUENCE :
{
- ::comphelper::SequenceAsHashMap stl_p1(uno_p1);
- ::comphelper::SequenceAsHashMap stl_p2(uno_p2);
+ css::uno::Sequence< OUString > uno_s1;
+ css::uno::Sequence< OUString > uno_s2;
- for (auto const& elem : stl_p1)
+ if (
+ (aSubSet >>= uno_s1) &&
+ (aSet >>= uno_s2)
+ )
{
- ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(elem.first);
- if (it2 == stl_p2.end())
- {
- return false;
- }
- if (!isSubSet(elem.second, it2->second))
+ auto s2Begin = uno_s2.getConstArray();
+ auto s2End = uno_s2.getConstArray() + uno_s2.getLength();
+
+ for (auto const& elem : uno_s1)
{
- return false;
+ if (::std::find(s2Begin, s2End, elem) == s2End)
+ {
+ return false;
+ }
}
+ return true;
}
- return true;
- }
- css::uno::Sequence< css::beans::NamedValue > uno_n1;
- css::uno::Sequence< css::beans::NamedValue > uno_n2;
+ css::uno::Sequence< css::beans::PropertyValue > uno_p1;
+ css::uno::Sequence< css::beans::PropertyValue > uno_p2;
- if (
- (aSubSet >>= uno_n1) &&
- (aSet >>= uno_n2)
- )
- {
- ::comphelper::SequenceAsHashMap stl_n1(uno_n1);
- ::comphelper::SequenceAsHashMap stl_n2(uno_n2);
-
- for (auto const& elem : stl_n1)
+ if (
+ (aSubSet >>= uno_p1) &&
+ (aSet >>= uno_p2)
+ )
{
- ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(elem.first);
- if (it2 == stl_n2.end())
+ ::comphelper::SequenceAsHashMap stl_p1(uno_p1);
+ ::comphelper::SequenceAsHashMap stl_p2(uno_p2);
+
+ for (auto const& elem : stl_p1)
{
- return false;
+ ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(elem.first);
+ if (it2 == stl_p2.end())
+ {
+ return false;
+ }
+ if (!isSubSet(elem.second, it2->second))
+ {
+ return false;
+ }
}
- if (!isSubSet(elem.second, it2->second))
+ return true;
+ }
+
+ css::uno::Sequence< css::beans::NamedValue > uno_n1;
+ css::uno::Sequence< css::beans::NamedValue > uno_n2;
+
+ if (
+ (aSubSet >>= uno_n1) &&
+ (aSet >>= uno_n2)
+ )
+ {
+ ::comphelper::SequenceAsHashMap stl_n1(uno_n1);
+ ::comphelper::SequenceAsHashMap stl_n2(uno_n2);
+
+ for (auto const& elem : stl_n1)
{
- return false;
+ ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(elem.first);
+ if (it2 == stl_n2.end())
+ {
+ return false;
+ }
+ if (!isSubSet(elem.second, it2->second))
+ {
+ return false;
+ }
}
+ return true;
}
- return true;
}
+ break;
+ default: break;
}
- break;
- default: break;
}
-
OSL_FAIL("isSubSet() ... this point should not be reached!");
return false;
}
-bool CacheItem::haveProps(const CacheItem& lProps) const
+bool CacheItem::haveProps(o3tl::span< const css::beans::NamedValue > lProps) const
{
for (auto const& prop : lProps)
{
// i) one required property does not exist at this item => return false
- const_iterator pItThis = find(prop.first);
+ const_iterator pItThis = find(prop.Name);
if (pItThis == end())
{
return false;
}
// ii) one item does not have the right value => return false
- if (!isSubSet(prop.second, pItThis->second))
+ if (!isSubSet(prop.Value, pItThis->second))
{
return false;
}
@@ -297,7 +288,7 @@ bool CacheItem::haveProps(const CacheItem& lProps) const
}
-bool CacheItem::dontHaveProps(const CacheItem& lProps) const
+bool CacheItem::dontHaveProps(o3tl::span< const css::beans::NamedValue > lProps) const
{
for (auto const& prop : lProps)
{
@@ -305,7 +296,7 @@ bool CacheItem::dontHaveProps(const CacheItem& lProps) const
// => continue with next one, because
// "excluding" means... "don't have it".
// And "not exists" matches to "don't have it".
- const_iterator pItThis = find(prop.first);
+ const_iterator pItThis = find(prop.Name);
if (pItThis == end())
{
continue;
@@ -314,7 +305,7 @@ bool CacheItem::dontHaveProps(const CacheItem& lProps) const
// ii) one item have the right value => return false
// because this item has the requested property...
// But we checked for "don't have it" here.
- if (isSubSet(prop.second, pItThis->second))
+ if (isSubSet(prop.Value, pItThis->second))
{
return false;
}
diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx
index 659d6e696201..b20bf72c805c 100644
--- a/filter/source/config/cache/cacheitem.hxx
+++ b/filter/source/config/cache/cacheitem.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vector>
#include <comphelper/sequenceashashmap.hxx>
-
+#include <o3tl/span.hxx>
namespace filter::config {
@@ -74,7 +74,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap
@return sal_True if all given properties exists
at this item; sal_False otherwise.
*/
- bool haveProps(const CacheItem& lProps) const;
+ bool haveProps(o3tl::span< const css::beans::NamedValue > lProps) const;
/** @short check, if the given properties don't exist
@@ -90,7 +90,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap
@return sal_False if at least on property exists at this item(!);
sal_True otherwise.
*/
- bool dontHaveProps(const CacheItem& lProps) const;
+ bool dontHaveProps(o3tl::span< const css::beans::NamedValue > lProps) const;
/** @short because we know two UIName properties
@@ -118,7 +118,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap
as a list of all properties of this cacheitem,
where empty properties was removed.
*/
- css::uno::Sequence< css::beans::PropertyValue > getAsPackedPropertyValueList();
+ css::uno::Sequence< css::beans::PropertyValue > getAsPackedPropertyValueList(bool bFinalized, bool bMandatory) const;
};
diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx
index 14331a190c2d..de9d5704e783 100644
--- a/filter/source/config/cache/cacheupdatelistener.cxx
+++ b/filter/source/config/cache/cacheupdatelistener.cxx
@@ -19,10 +19,10 @@
#include "cacheupdatelistener.hxx"
+#include "configflush.hxx"
#include <com/sun/star/util/XChangesNotifier.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
-#include <com/sun/star/document/FilterConfigRefresh.hpp>
#include <unotools/configpaths.hxx>
#include <rtl/ustring.hxx>
#include <comphelper/processfactory.hxx>
@@ -46,9 +46,9 @@ CacheUpdateListener::~CacheUpdateListener()
void CacheUpdateListener::startListening()
{
// SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
- aLock.clear();
+ aLock.unlock();
// <- SAFE
if (!xNotifier.is())
@@ -62,9 +62,9 @@ void CacheUpdateListener::startListening()
void CacheUpdateListener::stopListening()
{
// SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY);
- aLock.clear();
+ aLock.unlock();
// <- SAFE
if (!xNotifier.is())
@@ -78,7 +78,7 @@ void CacheUpdateListener::stopListening()
void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent)
{
// SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// disposed ?
if ( ! m_xConfig.is())
@@ -86,7 +86,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven
FilterCache::EItemType eType = m_eConfigType;
- aLock.clear();
+ aLock.unlock();
// <- SAFE
std::vector<OUString> lChangedItems;
@@ -161,9 +161,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven
// notify sfx cache about the changed filter cache .-)
if (bNotifyRefresh)
{
- css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster =
- css::document::FilterConfigRefresh::create(xContext);
+ rtl::Reference< ConfigFlush > xRefreshBroadcaster = new ConfigFlush();
xRefreshBroadcaster->refresh();
}
}
@@ -172,7 +170,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven
void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent)
{
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
if (aEvent.Source == m_xConfig)
m_xConfig.clear();
// <- SAFE
diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx
index ff7e02759363..fc0789af8dec 100644
--- a/filter/source/config/cache/cacheupdatelistener.hxx
+++ b/filter/source/config/cache/cacheupdatelistener.hxx
@@ -21,6 +21,7 @@
#include "filtercache.hxx"
#include <com/sun/star/util/XChangesListener.hpp>
#include <cppuhelper/implbase.hxx>
+#include <mutex>
namespace filter::config {
@@ -30,14 +31,15 @@ namespace filter::config {
global filter cache, if the underlying configuration
wa changed by other processes.
*/
-class CacheUpdateListener : public cppu::BaseMutex // must be the first one to guarantee right initialized mutex member!
- , public ::cppu::WeakImplHelper< css::util::XChangesListener >
+class CacheUpdateListener : public ::cppu::WeakImplHelper< css::util::XChangesListener >
{
// member
private:
+ std::mutex m_aMutex;
+
/** @short reference to the singleton(!) filter cache implementation,
which should be updated by this thread. */
FilterCache &m_rCache;
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx
index 864911798dfd..089f8db5ff62 100644
--- a/filter/source/config/cache/contenthandlerfactory.cxx
+++ b/filter/source/config/cache/contenthandlerfactory.cxx
@@ -29,8 +29,7 @@ namespace filter::config{
ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
: m_xContext(rxContext)
{
- BaseContainer::init(rxContext ,
- "com.sun.star.comp.filter.config.ContentHandlerFactory" ,
+ BaseContainer::init("com.sun.star.comp.filter.config.ContentHandlerFactory" ,
{ "com.sun.star.frame.ContentHandlerFactory" },
FilterCache::E_CONTENTHANDLER );
}
@@ -75,7 +74,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea
aHandler >> lConfig;
::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector< css::uno::Any > >(lArguments));
- stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+ stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig));
xInit->initialize(comphelper::containerToSequence(stlArguments));
}
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 4cfda1dc8b10..b32586162146 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -51,6 +51,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <officecfg/Setup.hxx>
+#include <o3tl/string_view.hxx>
namespace filter::config{
@@ -244,8 +245,8 @@ bool FilterCache::isFillState(FilterCache::EFillState eState) const
std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eType ,
- const CacheItem& lIProps,
- const CacheItem& lEProps) const
+ o3tl::span< const css::beans::NamedValue > lIProps,
+ o3tl::span< const css::beans::NamedValue > lEProps) const
{
// SAFE ->
osl::MutexGuard aLock(m_aMutex);
@@ -256,6 +257,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp
const CacheItemList& rList = impl_getItemList(eType);
std::vector<OUString> lKeys;
+ lKeys.reserve(rList.size());
// search items, which provides all needed properties of set "lIProps"
// but not of set "lEProps"!
@@ -348,6 +350,15 @@ CacheItem FilterCache::getItem( EItemType eType,
// SAFE ->
osl::MutexGuard aLock(m_aMutex);
+ CacheItem aItem = impl_getItem(eType, sItem);
+ // <- SAFE
+ return aItem;
+}
+
+
+CacheItem& FilterCache::impl_getItem( EItemType eType,
+ const OUString& sItem)
+{
// search for right list
// An exception is thrown if "eType" is unknown.
// => rList will be valid everytimes next line is reached.
@@ -388,7 +399,6 @@ CacheItem FilterCache::getItem( EItemType eType,
}
return pIt->second;
- // <- SAFE
}
@@ -449,13 +459,14 @@ void FilterCache::refreshItem( EItemType eType,
}
-void FilterCache::addStatePropsToItem( EItemType eType,
- const OUString& sItem,
- CacheItem& rItem)
+css::uno::Any FilterCache::getItemWithStateProps( EItemType eType,
+ const OUString& sItem)
{
// SAFE ->
osl::MutexGuard aLock(m_aMutex);
+ const CacheItem& rItem = impl_getItem(eType, sItem);
+
// Note: Opening of the configuration layer throws some exceptions
// if it failed. So we mustn't check any reference here...
css::uno::Reference< css::container::XNameAccess > xPackage;
@@ -493,9 +504,8 @@ void FilterCache::addStatePropsToItem( EItemType eType,
(sItem == sDefaultFrameLoader )
)
{
- rItem[PROPNAME_FINALIZED] <<= true;
- rItem[PROPNAME_MANDATORY] <<= true;
- return;
+ css::uno::Sequence aProps = rItem.getAsPackedPropertyValueList(true, true);
+ return css::uno::Any(aProps);
}
/* <-- HACK */
@@ -513,17 +523,16 @@ void FilterCache::addStatePropsToItem( EItemType eType,
default: break;
}
+ bool bFinalized, bMandatory;
try
{
css::uno::Reference< css::beans::XProperty > xItem;
xSet->getByName(sItem) >>= xItem;
css::beans::Property aDescription = xItem->getAsProperty();
- bool bFinalized = ((aDescription.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY );
- bool bMandatory = ((aDescription.Attributes & css::beans::PropertyAttribute::REMOVABLE) != css::beans::PropertyAttribute::REMOVABLE);
+ bFinalized = ((aDescription.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY );
+ bMandatory = ((aDescription.Attributes & css::beans::PropertyAttribute::REMOVABLE) != css::beans::PropertyAttribute::REMOVABLE);
- rItem[PROPNAME_FINALIZED] <<= bFinalized;
- rItem[PROPNAME_MANDATORY] <<= bMandatory;
}
catch(const css::container::NoSuchElementException&)
{
@@ -536,10 +545,13 @@ void FilterCache::addStatePropsToItem( EItemType eType,
=> mark item as FINALIZED / MANDATORY, we don't support writing to the old format
*/
- rItem[PROPNAME_FINALIZED] <<= true;
- rItem[PROPNAME_MANDATORY] <<= true;
+ bFinalized = true;
+ bMandatory = true;
}
+ css::uno::Sequence<css::beans::PropertyValue> aProps = rItem.getAsPackedPropertyValueList(bFinalized, bMandatory);
+
+ return css::uno::Any(aProps);
// <- SAFE
}
@@ -622,7 +634,7 @@ void FilterCache::impl_flushByList(const css::uno::Reference< css::container::XN
CacheItemList::const_iterator pItem = rCache.find(item);
impl_saveItem(xItem, eType, pItem->second);
- xAddRemoveSet->insertByName(item, css::uno::makeAny(xItem));
+ xAddRemoveSet->insertByName(item, css::uno::Any(xItem));
}
break;
@@ -889,14 +901,14 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess
// set root path
aParam.Name = "nodepath";
aParam.Value <<= sRoot;
- lParams.push_back(css::uno::makeAny(aParam));
+ lParams.push_back(css::uno::Any(aParam));
// enable "all locales mode" ... if required
if (bLocalesMode)
{
aParam.Name = "locale";
aParam.Value <<= OUString("*");
- lParams.push_back(css::uno::makeAny(aParam));
+ lParams.push_back(css::uno::Any(aParam));
}
// open it
@@ -1176,7 +1188,7 @@ void FilterCache::impl_validateAndOptimize()
CacheItem& rLoader = frameLoader.second;
css::uno::Any& rTypesReg = rLoader[PROPNAME_TYPES];
- std::vector<OUString> lTypesReg (comphelper::sequenceToContainer< std::vector<OUString> >(rTypesReg.get<css::uno::Sequence<OUString> >()));
+ const css::uno::Sequence<OUString> lTypesReg = rTypesReg.get<css::uno::Sequence<OUString> >();
for (auto const& typeReg : lTypesReg)
{
@@ -1272,7 +1284,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
)
{
// Attention! If config couldn't be opened successfully
- // and exception os thrown automatically and must be forwarded
+ // and exception is thrown automatically and must be forwarded
// to our caller...
css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW);
{
@@ -1289,7 +1301,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
)
{
// Attention! If config couldn't be opened successfully
- // and exception os thrown automatically and must be forwarded
+ // and exception is thrown automatically and must be forwarded
// to our call...
css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW);
{
@@ -1306,7 +1318,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
)
{
// Attention! If config couldn't be opened successfully
- // and exception os thrown automatically and must be forwarded
+ // and exception is thrown automatically and must be forwarded
// to our call...
css::uno::Reference< css::container::XNameAccess > xFilters(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW);
{
@@ -1323,7 +1335,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
)
{
// Attention! If config couldn't be opened successfully
- // and exception os thrown automatically and must be forwarded
+ // and exception is thrown automatically and must be forwarded
// to our call...
css::uno::Reference< css::container::XNameAccess > xLoaders(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW);
{
@@ -1340,7 +1352,7 @@ void FilterCache::impl_load(EFillState eRequiredState)
)
{
// Attention! If config couldn't be opened successfully
- // and exception os thrown automatically and must be forwarded
+ // and exception is thrown automatically and must be forwarded
// to our call...
css::uno::Reference< css::container::XNameAccess > xHandlers(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW);
{
@@ -2146,14 +2158,14 @@ CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::containe
}
-std::vector<OUString> FilterCache::impl_tokenizeString(const OUString& sData ,
+std::vector<OUString> FilterCache::impl_tokenizeString(std::u16string_view sData ,
sal_Unicode cSeparator)
{
std::vector<OUString> lData ;
sal_Int32 nToken = 0;
do
{
- OUString sToken = sData.getToken(0, cSeparator, nToken);
+ OUString sToken( o3tl::getToken(sData, 0, cSeparator, nToken) );
lData.push_back(sToken);
}
while(nToken >= 0);
@@ -2169,8 +2181,8 @@ OUString FilterCache::impl_searchFrameLoaderForType(const OUString& sType) const
{
const OUString& sItem = frameLoader.first;
::comphelper::SequenceAsHashMap lProps(frameLoader.second);
- std::vector<OUString> lTypes(
- comphelper::sequenceToContainer< std::vector<OUString> >(lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >()));
+ const css::uno::Sequence<OUString> lTypes =
+ lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >();
if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end())
return sItem;
@@ -2186,8 +2198,8 @@ OUString FilterCache::impl_searchContentHandlerForType(const OUString& sType) co
{
const OUString& sItem = contentHandler.first;
::comphelper::SequenceAsHashMap lProps(contentHandler.second);
- std::vector<OUString> lTypes(
- comphelper::sequenceToContainer< std::vector<OUString> >( lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >() ));
+ const css::uno::Sequence<OUString> lTypes =
+ lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >();
if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end())
return sItem;
}
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
index 42be4314cb38..2f647c33e708 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -361,9 +361,9 @@ class FilterCache : public cppu::BaseMutex
if some input parameter are wrong or the cache itself is not valid
any longer, because any operation before damage it.
*/
- std::vector<OUString> getMatchingItemsByProps( EItemType eType ,
- const CacheItem& lIProps ,
- const CacheItem& lEProps = CacheItem()) const;
+ std::vector<OUString> getMatchingItemsByProps( EItemType eType,
+ o3tl::span< const css::beans::NamedValue > lIProps,
+ o3tl::span< const css::beans::NamedValue > lEProps = {}) const;
/** @short indicates if the requested sub container
@@ -524,10 +524,8 @@ class FilterCache : public cppu::BaseMutex
was not migrated to the new one. So we can't provide write access
to such items...
*/
- void addStatePropsToItem( EItemType eType,
- const OUString& sItem,
- CacheItem& rItem);
-
+ css::uno::Any getItemWithStateProps( EItemType eType,
+ const OUString& sItem);
/** TODO document me
@@ -600,6 +598,7 @@ class FilterCache : public cppu::BaseMutex
CacheItemList& impl_getItemList(EItemType eType);
+ CacheItem& impl_getItem( EItemType eType, const OUString& sItem);
/** @short return a valid configuration update access
to the underlying configuration package, which
@@ -891,7 +890,7 @@ class FilterCache : public cppu::BaseMutex
/** TODO */
- static std::vector<OUString> impl_tokenizeString(const OUString& sData ,
+ static std::vector<OUString> impl_tokenizeString(std::u16string_view sData ,
sal_Unicode cSeparator);
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
index 6bcb0cc4e326..54225db86d7c 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -55,8 +55,7 @@ FilterCache& GetTheFilterCache()
FilterFactory::FilterFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
: m_xContext(rxContext)
{
- BaseContainer::init(rxContext ,
- "com.sun.star.comp.filter.config.FilterFactory" ,
+ BaseContainer::init("com.sun.star.comp.filter.config.FilterFactory" ,
{ "com.sun.star.document.FilterFactory" },
FilterCache::E_FILTER );
}
@@ -103,7 +102,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan
aFilter >> lConfig;
::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector< css::uno::Any > >(lArguments));
- stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+ stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig));
xInit->initialize(comphelper::containerToSequence(stlArguments));
}
@@ -121,14 +120,13 @@ css::uno::Sequence< OUString > SAL_CALL FilterFactory::getAvailableServiceNames(
Of course we can't check for corrupted service names here. We can check
for empty strings only...
*/
- CacheItem lIProps;
- CacheItem lEProps;
- lEProps[PROPNAME_FILTERSERVICE] <<= OUString();
+ css::beans::NamedValue lEProps[] {
+ { PROPNAME_FILTERSERVICE, css::uno::Any(OUString()) } };
std::vector<OUString> lUNOFilters;
try
{
- lUNOFilters = GetTheFilterCache().getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps);
+ lUNOFilters = GetTheFilterCache().getMatchingItemsByProps(FilterCache::E_FILTER, {}, lEProps);
}
catch(const css::uno::RuntimeException&)
{ throw; }
@@ -391,7 +389,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz
{
// more complex search for all filters
// We check first, which office modules are installed...
- std::vector<OUString> lModules = impl_getListOfInstalledModules();
+ const css::uno::Sequence<OUString> lModules = impl_getListOfInstalledModules();
for (auto const& module : lModules)
{
std::vector<OUString> lFilters4Module = impl_getSortedFilterListForModule(module, nIFlags, nEFlags);
@@ -406,17 +404,10 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz
}
-std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const
+css::uno::Sequence<OUString> FilterFactory::impl_getListOfInstalledModules()
{
- // SAFE -> ----------------------
- osl::ClearableMutexGuard aLock(m_aMutex);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aLock.clear();
- // <- SAFE ----------------------
-
- css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(xContext);
- std::vector<OUString> lModules(comphelper::sequenceToContainer< std::vector<OUString> >(xModuleConfig->getElementNames()));
- return lModules;
+ css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get();
+ return xModuleConfig->getElementNames();
}
@@ -427,8 +418,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS
std::vector<OUString> lSortedFilters = impl_readSortedFilterListFromConfig(sModule);
// get all filters for the requested module
- CacheItem lIProps;
- lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule;
+ css::beans::NamedValue lIProps[] { { PROPNAME_DOCUMENTSERVICE, css::uno::Any(sModule) } };
// SAFE -> ----------------------
osl::ClearableMutexGuard aLock(m_aMutex);
@@ -469,17 +459,11 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS
}
-std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const
+std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule)
{
- // SAFE -> ----------------------
- osl::ClearableMutexGuard aLock(m_aMutex);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aLock.clear();
- // <- SAFE ----------------------
-
try
{
- css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(xContext);
+ css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get();
// don't check the module name here. If it does not exists, an exception is thrown and caught below.
// We return an empty list as result then.
css::uno::Reference< css::container::XNameAccess > xModule;
diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx
index 19abea5d6db0..9be370f4dc56 100644
--- a/filter/source/config/cache/filterfactory.hxx
+++ b/filter/source/config/cache/filterfactory.hxx
@@ -95,7 +95,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
/** TODO document me
*/
- std::vector<OUString> impl_getListOfInstalledModules() const;
+ static css::uno::Sequence<OUString> impl_getListOfInstalledModules();
/** @short implement the container string query:
@@ -126,7 +126,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer
@return A string list of internal filter names.
Can be empty.
*/
- std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule) const;
+ static std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule);
};
diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx
index 3627ea93faa1..ebe4823666ad 100644
--- a/filter/source/config/cache/frameloaderfactory.cxx
+++ b/filter/source/config/cache/frameloaderfactory.cxx
@@ -29,8 +29,7 @@ namespace filter::config{
FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
: m_xContext(rxContext)
{
- BaseContainer::init(rxContext ,
- "com.sun.star.comp.filter.config.FrameLoaderFactory" ,
+ BaseContainer::init("com.sun.star.comp.filter.config.FrameLoaderFactory" ,
{ "com.sun.star.frame.FrameLoaderFactory" },
FilterCache::E_FRAMELOADER );
}
@@ -73,7 +72,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI
aLoader >> lConfig;
::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector<css::uno::Any> >(lArguments));
- stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig));
+ stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig));
xInit->initialize(comphelper::containerToSequence(stlArguments));
}
diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx
index 9b64f68fe6d8..f5b021f53b45 100644
--- a/filter/source/config/cache/querytokenizer.cxx
+++ b/filter/source/config/cache/querytokenizer.cxx
@@ -20,23 +20,24 @@
#include "querytokenizer.hxx"
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
namespace filter::config{
-QueryTokenizer::QueryTokenizer(const OUString& sQuery)
+QueryTokenizer::QueryTokenizer(std::u16string_view sQuery)
: m_bValid(true)
{
sal_Int32 token = 0;
while(token != -1)
{
- OUString sToken = sQuery.getToken(0, ':', token);
- if (!sToken.isEmpty())
+ std::u16string_view sToken = o3tl::getToken(sQuery,0, ':', token);
+ if (!sToken.empty())
{
sal_Int32 nIdx{ 0 };
- const OUString sKey{ sToken.getToken(0, '=', nIdx) };
- const OUString sVal{ sToken.getToken(0, ':', nIdx) };
+ const OUString sKey{ o3tl::getToken(sToken, 0, '=', nIdx) };
+ const OUString sVal{ o3tl::getToken(sToken, 0, ':', nIdx) };
if (sKey.isEmpty())
m_bValid = false;
diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx
index e0b8d5218130..0c7e79b3ddc7 100644
--- a/filter/source/config/cache/querytokenizer.hxx
+++ b/filter/source/config/cache/querytokenizer.hxx
@@ -73,7 +73,7 @@ class QueryTokenizer : public std::unordered_map< OUString, OUString >
@param sQuery
the query string.
*/
- explicit QueryTokenizer(const OUString& sQuery);
+ explicit QueryTokenizer(std::u16string_view sQuery);
/** @short destruct an instance of this class.
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index ac4d9aed9f2a..1aae850fd535 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <o3tl/string_view.hxx>
#include <tools/wldcrd.hxx>
#include <sal/log.hxx>
#include <framework/interaction.hxx>
@@ -54,8 +55,7 @@ TypeDetection::TypeDetection(const css::uno::Reference< css::uno::XComponentCont
, m_bCancel(false)
{
css::frame::Desktop::create(m_xContext)->addTerminateListener(m_xTerminateListener);
- BaseContainer::init(rxContext ,
- "com.sun.star.comp.filter.config.TypeDetection" ,
+ BaseContainer::init("com.sun.star.comp.filter.config.TypeDetection" ,
{ "com.sun.star.document.TypeDetection" },
FilterCache::E_TYPE );
}
@@ -125,7 +125,7 @@ namespace {
* In each category, rank them from strictly-structured to
* loosely-structured.
*/
-int getFlatTypeRank(const OUString& rType)
+int getFlatTypeRank(std::u16string_view rType)
{
// List formats from more complex to less complex.
// TODO: Add more.
@@ -232,6 +232,7 @@ int getFlatTypeRank(const OUString& rType)
"pcd_Photo_CD_Base",
"pcd_Photo_CD_Base4",
"pcd_Photo_CD_Base16",
+ "webp_WebP",
"impress_CGM_Computer_Graphics_Metafile", // There is binary and ascii variants ?
"draw_WordPerfect_Graphics",
"draw_Visio_Document",
@@ -286,7 +287,7 @@ int getFlatTypeRank(const OUString& rType)
for (size_t i = 0; i < n; ++i)
{
- if (rType.equalsAscii(ranks[i]))
+ if (o3tl::equalsAscii(rType, ranks[i]))
return n - i - 1;
}
@@ -494,9 +495,9 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
// That can disturb our "load on demand feature". But we have no other chance!
cache.load(FilterCache::E_CONTAINS_FILTERS);
- CacheItem lIProps;
- lIProps[PROPNAME_DOCUMENTSERVICE] <<= sDocumentService;
- lIProps[PROPNAME_TYPE ] <<= sRealType;
+ css::beans::NamedValue lIProps[] {
+ { PROPNAME_DOCUMENTSERVICE, uno::Any(sDocumentService) },
+ { PROPNAME_TYPE, uno::Any(sRealType) } };
std::vector<OUString> lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
aLock.clear();
@@ -575,8 +576,8 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
// That can disturb our "load on demand feature". But we have no other chance!
cache.load(FilterCache::E_CONTAINS_FILTERS);
- CacheItem lIProps;
- lIProps[PROPNAME_TYPE] <<= sType;
+ css::beans::NamedValue lIProps[] {
+ { PROPNAME_TYPE, uno::Any(sType) } };
std::vector<OUString> lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
aLock.clear();
@@ -669,8 +670,8 @@ bool TypeDetection::impl_getPreselectionForType(
// otherwise we must know, if it matches to the given URL really.
// especially if it matches by its extension or pattern registration.
- std::vector<OUString> lExtensions(comphelper::sequenceToContainer< std::vector<OUString> >(aType[PROPNAME_EXTENSIONS].get<css::uno::Sequence<OUString> >() ));
- std::vector<OUString> lURLPattern(comphelper::sequenceToContainer< std::vector<OUString> >(aType[PROPNAME_URLPATTERN].get<css::uno::Sequence<OUString> >() ));
+ const css::uno::Sequence<OUString> lExtensions = aType[PROPNAME_EXTENSIONS].get<css::uno::Sequence<OUString> >();
+ const css::uno::Sequence<OUString> lURLPattern = aType[PROPNAME_URLPATTERN].get<css::uno::Sequence<OUString> >();
for (auto const& extension : lExtensions)
{
@@ -734,8 +735,8 @@ void TypeDetection::impl_getPreselectionForDocumentService(
auto & cache = GetTheFilterCache();
cache.load(FilterCache::E_CONTAINS_FILTERS);
- CacheItem lIProps;
- lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService;
+ css::beans::NamedValue lIProps[] {
+ { PROPNAME_DOCUMENTSERVICE, css::uno::Any(sPreSelDocumentService) } };
lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
// <- SAFE --------------------------
}
diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx
index 79145e836d17..11441039234c 100644
--- a/filter/source/config/cache/typedetection.hxx
+++ b/filter/source/config/cache/typedetection.hxx
@@ -24,6 +24,7 @@
#include <unotools/mediadescriptor.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase.hxx>
+#include <comphelper/compbase.hxx>
namespace filter::config {
@@ -316,15 +317,14 @@ public:
};
-class TerminateDetection : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener>
+class TerminateDetection : public comphelper::WeakComponentImplHelper<css::frame::XTerminateListener>
{
private:
- osl::Mutex m_aLock;
TypeDetection* m_pTypeDetection;
public:
- using cppu::WeakComponentImplHelperBase::disposing;
+ using comphelper::WeakComponentImplHelperBase::disposing;
virtual void SAL_CALL disposing(const css::lang::EventObject&) override
{
}
@@ -340,8 +340,7 @@ public:
}
TerminateDetection(TypeDetection* pTypeDetection)
- : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aLock)
- , m_pTypeDetection(pTypeDetection)
+ : m_pTypeDetection(pTypeDetection)
{
}
};
diff --git a/filter/source/config/fragments/filters/WEBP___WebP.xcu b/filter/source/config/fragments/filters/WEBP___WebP.xcu
new file mode 100644
index 000000000000..9c650e3de42e
--- /dev/null
+++ b/filter/source/config/fragments/filters/WEBP___WebP.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="WEBP - WebP" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/calc_webp_Export.xcu b/filter/source/config/fragments/filters/calc_webp_Export.xcu
new file mode 100644
index 000000000000..a6e5d18a3347
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_webp_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_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_webp_Export.xcu b/filter/source/config/fragments/filters/draw_webp_Export.xcu
new file mode 100644
index 000000000000..e6da69197a61
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_webp_Export.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="draw_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/impress_webp_Export.xcu b/filter/source/config/fragments/filters/impress_webp_Export.xcu
new file mode 100644
index 000000000000..00284a272cba
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_webp_Export.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="impress_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_webp_Export.xcu b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu
new file mode 100644
index 000000000000..5273bb72228b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu
@@ -0,0 +1,21 @@
+<!--
+ * 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="writer_web_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_webp_Export.xcu b/filter/source/config/fragments/filters/writer_webp_Export.xcu
new file mode 100644
index 000000000000..ceb56a8c035f
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_webp_Export.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="writer_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu
new file mode 100644
index 000000000000..70ff15429734
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu
@@ -0,0 +1,27 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="webp_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="FormatName"><value>SVEWEBP</value></prop>
+ <prop oor:name="RealFilterName"/>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu
new file mode 100644
index 000000000000..cdce5c9e4047
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu
@@ -0,0 +1,27 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="webp_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="FormatName"><value>SVIWEBP</value></prop>
+ <prop oor:name="RealFilterName"><value>WEBP - WebP</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu
index 6d1564bebd07..2003217aad30 100644
--- a/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu
+++ b/filter/source/config/fragments/types/emf_MS_Windows_Metafile.xcu
@@ -18,7 +18,7 @@
<node oor:name="emf_MS_Windows_Metafile" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>emf</value></prop>
+ <prop oor:name="Extensions"><value>emf emz</value></prop>
<prop oor:name="MediaType"><value>image/x-emf</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>EMF - MS Windows Metafile</value></prop>
diff --git a/filter/source/config/fragments/types/webp_WebP.xcu b/filter/source/config/fragments/types/webp_WebP.xcu
new file mode 100644
index 000000000000..e58984fbedc7
--- /dev/null
+++ b/filter/source/config/fragments/types/webp_WebP.xcu
@@ -0,0 +1,29 @@
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <node oor:name="webp_WebP" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>webp</value></prop>
+ <prop oor:name="MediaType"><value>image/webp</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WEBP - WebP</value></prop>
+ <prop oor:name="UIName">
+ <value>WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu
index 54c6bf54c33b..7564dd057cf4 100644
--- a/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu
+++ b/filter/source/config/fragments/types/wmf_MS_Windows_Metafile.xcu
@@ -18,7 +18,7 @@
<node oor:name="wmf_MS_Windows_Metafile" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>wmf</value></prop>
+ <prop oor:name="Extensions"><value>wmf wmz</value></prop>
<prop oor:name="MediaType"><value>image/x-wmf</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>WMF - MS Windows Metafile</value></prop>
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index e20c56ddf232..b0b93222dfa3 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -163,7 +163,7 @@ bool GraphicExportFilter::filterRenderDocument() const
SvMemoryStream aMemStream;
const GraphicConversionParameters aParameters(aTargetSizePixel, true, true);
- const ErrCode nResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), OUString(), aMemStream,
+ const ErrCode nResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), u"", aMemStream,
nFilterFormat, &maFilterDataSequence );
if ( nResult == ERRCODE_NONE )
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index bb17a380c3b2..c77b55184c5a 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -791,7 +791,7 @@ void CGMImpressOutAct::DrawText(awt::Point const & rTextPos, awt::Size const & r
maXShape->setSize( awt::Size( nWidth, nHeight ) );
double nX = mpCGM->pElement->nCharacterOrientation[ 2 ];
double nY = mpCGM->pElement->nCharacterOrientation[ 3 ];
- double fSqrt = sqrt(nX * nX + nY * nY);
+ double fSqrt = std::hypot(nX, nY);
double nOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY < 0 )
nOrientation = 360 - nOrientation;
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index cb319cb038e0..67652d9eccd6 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -216,17 +216,17 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
double nX = rDesc.mnR.X - rDesc.mnQ.X;
double nY = rDesc.mnR.Y - rDesc.mnQ.Y;
- rDesc.mndy = sqrt( nX * nX + nY * nY );
+ rDesc.mndy = std::hypot(nX, nY);
nX = rDesc.mnR.X - rDesc.mnP.X;
nY = rDesc.mnR.Y - rDesc.mnP.Y;
- rDesc.mndx = sqrt( nX * nX + nY * nY );
+ rDesc.mndx = std::hypot(nX, nY);
nX = rDesc.mnR.X - rDesc.mnP.X;
nY = rDesc.mnR.Y - rDesc.mnP.Y;
- double fSqrt = sqrt(nX * nX + nY * nY);
+ double fSqrt = std::hypot(nX, nY);
rDesc.mnOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY > 0 )
rDesc.mnOrientation = 360 - rDesc.mnOrientation;
@@ -240,7 +240,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nX = fCos * nX + fSin * nY;
nY = -( fSin * nX - fCos * nY );
- fSqrt = sqrt(nX * nX + nY * nY);
+ fSqrt = std::hypot(nX, nY);
fAngle = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY > 0 )
fAngle = 360 - fAngle;
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index edf34970a27f..af66ff26ae09 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -36,7 +36,7 @@ double CGM::ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & r
double nX = rPoint.X - rCenter.X;
double nY = rPoint.Y - rCenter.Y;
- double fSqrt = sqrt(nX * nX + nY * nY);
+ double fSqrt = std::hypot(nX, nY);
double fOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if (nY > 0)
fOrientation = 360 - fOrientation;
@@ -89,10 +89,10 @@ bool CGM::ImplGetEllipse( FloatPoint& rCenter, FloatPoint& rRadius, double& rAng
rAngle = ImplGetOrientation( rCenter, aPoint1 );
aPoint1.X -= rCenter.X;
aPoint1.Y -= rCenter.Y;
- rRadius.X = sqrt( aPoint1.X * aPoint1.X + aPoint1.Y * aPoint1.Y );
+ rRadius.X = std::hypot(aPoint1.X, aPoint1.Y);
aPoint2.X -= rCenter.X;
aPoint2.Y -= rCenter.Y;
- rRadius.Y = sqrt( aPoint2.X * aPoint2.X + aPoint2.Y * aPoint2.Y );
+ rRadius.Y = std::hypot(aPoint2.X, aPoint2.Y);
if ( fRot1 > fRot2 )
{
@@ -276,29 +276,21 @@ void CGM::ImplDoClass4()
if ( mbFigure )
mpOutAct->CloseRegion();
- sal_uInt16 nPoints = 0;
- std::unique_ptr<Point[]> pPoints(new Point[ 0x4000 ]);
-
+ std::vector<Point> aPoints;
tools::PolyPolygon aPolyPolygon;
FloatPoint aFloatPoint;
- sal_uInt32 nEdgeFlag;
+
while ( mnParaSize < mnElementSize )
{
ImplGetPoint( aFloatPoint, true );
- nEdgeFlag = ImplGetUI16();
- pPoints[ nPoints++ ] = Point( static_cast<tools::Long>(aFloatPoint.X), static_cast<tools::Long>(aFloatPoint.Y) );
+ sal_uInt32 nEdgeFlag = ImplGetUI16();
+ aPoints.push_back(Point(static_cast<tools::Long>(aFloatPoint.X), static_cast<tools::Long>(aFloatPoint.Y)));
if ( ( nEdgeFlag & 2 ) || ( mnParaSize == mnElementSize ) )
{
- tools::Polygon aPolygon( nPoints );
- for ( sal_uInt16 i = 0; i < nPoints; i++ )
- {
- aPolygon.SetPoint( pPoints[ i ], i );
- }
- aPolyPolygon.Insert( aPolygon );
- nPoints = 0;
+ aPolyPolygon.Insert(tools::Polygon(aPoints.size(), aPoints.data()));
+ aPoints.clear();
}
}
- pPoints.reset();
mpOutAct->DrawPolyPolygon( aPolyPolygon );
}
break;
@@ -418,7 +410,7 @@ void CGM::ImplDoClass4()
fStartAngle = fEndAngle;
fEndAngle = fG;
}
- double fRadius = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+ double fRadius = std::hypot(aStartingPoint.X - aCenterPoint.X, aStartingPoint.Y - aCenterPoint.Y);
if ( mbFigure )
{
@@ -508,7 +500,7 @@ void CGM::ImplDoClass4()
fEndAngle = fG;
}
FloatPoint fRadius;
- fRadius.Y = fRadius.X = sqrt( pow( ( aStartingPoint.X - aCenterPoint.X ), 2 ) + pow( ( aStartingPoint.Y - aCenterPoint.Y ), 2 ) ) ;
+ fRadius.Y = fRadius.X = std::hypot(aStartingPoint.X - aCenterPoint.X, aStartingPoint.Y - aCenterPoint.Y);
sal_uInt32 nType = ImplGetUI16();
if ( nType == 0 )
@@ -548,9 +540,9 @@ void CGM::ImplDoClass4()
bool bUseless = useless(vector[0]) || useless(vector[1]) || useless(vector[2]) || useless(vector[3]);
if (!bUseless)
{
- const double fStartSqrt = sqrt(vector[0] * vector[ 0 ] + vector[1] * vector[1]);
+ const double fStartSqrt = std::hypot(vector[0], vector[1]);
fStartAngle = fStartSqrt != 0.0 ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
- const double fEndSqrt = sqrt(vector[2] * vector[ 2 ] + vector[3] * vector[3]);
+ const double fEndSqrt = std::hypot(vector[2], vector[3]);
fEndAngle = fEndSqrt != 0.0 ? basegfx::rad2deg(acos(vector[ 2 ] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
@@ -626,9 +618,9 @@ void CGM::ImplDoClass4()
bool bUseless = useless(vector[0]) || useless(vector[1]) || useless(vector[2]) || useless(vector[3]);
if (!bUseless)
{
- const double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
+ const double fStartSqrt = std::hypot(vector[0], vector[1]);
double fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
- const double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
+ const double fEndSqrt = std::hypot(vector[2], vector[3]);
double fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
@@ -683,9 +675,9 @@ void CGM::ImplDoClass4()
bool bUseless = useless(vector[0]) || useless(vector[1]) || useless(vector[2]) || useless(vector[3]);
if (!bUseless)
{
- double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
+ double fStartSqrt = std::hypot(vector[0], vector[1]);
fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
- double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
+ double fEndSqrt = std::hypot(vector[2], vector[3]);
fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
@@ -719,9 +711,9 @@ void CGM::ImplDoClass4()
bool bUseless = useless(vector[0]) || useless(vector[1]) || useless(vector[2]) || useless(vector[3]);
if (!bUseless)
{
- double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
+ double fStartSqrt = std::hypot(vector[0], vector[1]);
fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
- double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
+ double fEndSqrt = std::hypot(vector[2], vector[3]);
fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index b7ffd449cb22..03f72587e1b2 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -19,6 +19,7 @@
#include "eschesdo.hxx"
#include <o3tl/any.hxx>
+#include <o3tl/string_view.hxx>
#include <svx/svdxcgv.hxx>
#include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx>
@@ -91,6 +92,7 @@
#include <sal/log.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/numeric/ftools.hxx>
#include <osl/diagnose.h>
#include <algorithm>
@@ -928,16 +930,16 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart,
if ( !bIsMapped && comphelper::string::getTokenCount(aArrowStartName, ' ') == 2 )
{
sal_Int32 nIdx{ 0 };
- OUString aArrowName( aArrowStartName.getToken( 0, ' ', nIdx ) );
- if ( aArrowName == "msArrowEnd" )
+ std::u16string_view aArrowName( o3tl::getToken(aArrowStartName, 0, ' ', nIdx ) );
+ if ( aArrowName == u"msArrowEnd" )
reLineEnd = ESCHER_LineArrowEnd;
- else if ( aArrowName == "msArrowOpenEnd" )
+ else if ( aArrowName == u"msArrowOpenEnd" )
reLineEnd = ESCHER_LineArrowOpenEnd;
- else if ( aArrowName == "msArrowStealthEnd" )
+ else if ( aArrowName == u"msArrowStealthEnd" )
reLineEnd = ESCHER_LineArrowStealthEnd;
- else if ( aArrowName == "msArrowDiamondEnd" )
+ else if ( aArrowName == u"msArrowDiamondEnd" )
reLineEnd = ESCHER_LineArrowDiamondEnd;
- else if ( aArrowName == "msArrowOvalEnd" )
+ else if ( aArrowName == u"msArrowOvalEnd" )
reLineEnd = ESCHER_LineArrowOvalEnd;
else
nIdx = -1;
@@ -945,8 +947,8 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart,
// now we have the arrow, and try to determine the arrow size;
if ( nIdx>0 )
{
- OUString aArrowSize( aArrowStartName.getToken( 0, ' ', nIdx ) );
- sal_Int32 nArrowSize = aArrowSize.toInt32();
+ std::u16string_view aArrowSize = o3tl::getToken(aArrowStartName, 0, ' ', nIdx );
+ sal_Int32 nArrowSize = o3tl::toInt32(aArrowSize);
rnArrowWidth = ( nArrowSize - 1 ) / 3;
rnArrowLength = nArrowSize - ( rnArrowWidth * 3 ) - 1;
}
@@ -2450,13 +2452,13 @@ static void ConvertEnhancedCustomShapeEquation(
sal_Int32 i;
for ( i = 0; i < nEquationSourceCount; i++ )
{
- EnhancedCustomShape2d aCustoShape2d(
+ EnhancedCustomShape2d aCustomShape2d(
const_cast< SdrObjCustomShape& >(rSdrObjCustomShape));
try
{
std::shared_ptr< EnhancedCustomShape::ExpressionNode > aExpressNode(
EnhancedCustomShape::FunctionParser::parseFunction(
- sEquationSource[ i ], aCustoShape2d));
+ sEquationSource[ i ], aCustomShape2d));
drawing::EnhancedCustomShapeParameter aPara( aExpressNode->fillNode( rEquations, nullptr, 0 ) );
if ( aPara.Type != drawing::EnhancedCustomShapeParameterType::EQUATION )
{
@@ -2515,7 +2517,7 @@ bool EscherPropertyContainer::IsDefaultObject(
{
switch(eShapeType)
{
- // if the custom shape is not default shape of ppt, return sal_Fasle;
+ // if the custom shape is not default shape of ppt, return false;
case mso_sptTearDrop:
return false;
@@ -2858,7 +2860,11 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
{
double fExtrusionShininess = 0;
if ( rrProp.Value >>= fExtrusionShininess )
- AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>( fExtrusionShininess * 655.36 ) );
+ {
+ // ODF to MS Office conversion invers to msdffimp.cxx
+ fExtrusionShininess = basegfx::fround(fExtrusionShininess / 10.0);
+ AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>(fExtrusionShininess) );
+ }
}
else if ( rrProp.Name == "Skew" )
{
@@ -2875,7 +2881,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
{
double fExtrusionSpecularity = 0;
if ( rrProp.Value >>= fExtrusionSpecularity )
- AddOpt( DFF_Prop_c3DSpecularAmt, static_cast<sal_Int32>( fExtrusionSpecularity * 1333 ) );
+ AddOpt( DFF_Prop_c3DSpecularAmt, static_cast<sal_Int32>( fExtrusionSpecularity * 655.36 ) );
}
else if ( rrProp.Name == "ProjectionMode" )
{
@@ -3712,8 +3718,7 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi
// In case of VML export, try to handle the
// ooxml- prefix in rShapeType. If that fails,
// just do the same as the binary export.
- OString aType = OUStringToOString(rShapeType, RTL_TEXTENCODING_UTF8);
- eShapeType = msfilter::util::GETVMLShapeType(aType);
+ eShapeType = msfilter::util::GETVMLShapeType(rShapeType);
if (eShapeType == mso_sptNil)
eShapeType = EnhancedCustomShapeTypeNames::Get(rShapeType);
}
@@ -4195,7 +4200,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
SvMemoryStream aGIFStream;
const char* const pString = "MSOFFICE9.0";
aGIFStream.WriteBytes(pString, strlen(pString));
- nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aGIFStream,
+ nErrCode = rFilter.ExportGraphic( aGraphic, u"", aGIFStream,
rFilter.GetExportFormatNumberForShortName( u"GIF" ) );
SAL_WARN_IF(
nErrCode != ERRCODE_NONE, "filter.ms",
@@ -4214,7 +4219,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
aFilterProp.Name = "AdditionalChunks";
aFilterProp.Value <<= aAdditionalChunkSequence;
uno::Sequence<beans::PropertyValue> aFilterData{ aFilterProp };
- nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aStream,
+ nErrCode = rFilter.ExportGraphic( aGraphic, u"", aStream,
rFilter.GetExportFormatNumberForShortName( u"PNG" ), &aFilterData );
}
}
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 12e6e62be0a2..d052b5968780 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -669,7 +669,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
if( SDRLAYER_NOTFOUND != mpEscherEx->GetHellLayerId() &&
rObj.ImplGetPropertyValue( "LayerID" ) &&
- *o3tl::doAccess<sal_uInt16>(rObj.GetUsrAny()) == sal_uInt8(mpEscherEx->GetHellLayerId()) )
+ *o3tl::doAccess<sal_Int16>(rObj.GetUsrAny()) == mpEscherEx->GetHellLayerId().get() )
{
aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 8832617a4e58..66c3857711c2 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -149,6 +149,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeMetalType.hpp>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -170,6 +171,18 @@ static sal_uInt32 nMSOleObjCntr = 0;
constexpr OUStringLiteral MSO_OLE_Obj = u"MSO_OLE_Obj";
namespace {
+/* Office File Formats - 2.2.23 */
+enum class OfficeArtBlipRecInstance : sal_uInt32
+{
+ EMF = 0x3D4, // defined in section 2.2.24.
+ WMF = 0x216, // defined in section 2.2.25.
+ PICT = 0x542, // as defined in section 2.2.26.
+ JPEG_RGB = 0x46A, // defined in section 2.2.27.
+ JPEG_CMYK = 0x6E2, // defined in section 2.2.27.
+ PNG = 0x6E0, // defined in section 2.2.28.
+ DIB = 0x7A8, // defined in section 2.2.29.
+ TIFF = 0x6E4 // defined in section 2.2.30.
+};
struct SvxMSDffBLIPInfo
{
@@ -1675,14 +1688,20 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aExtrusionPropVec.push_back( aProp );
// "Brightness"
+ // MS Office default 0x00004E20 16.16 FixedPoint, 20000/65536=0.30517, ODF default 33%.
+ // Thus must set value even if default.
+ double fBrightness = 20000.0;
if ( IsProperty( DFF_Prop_c3DAmbientIntensity ) )
{
- double fBrightness = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DAmbientIntensity, 0 ));
- fBrightness /= 655.36;
- aProp.Name = "Brightness";
- aProp.Value <<= fBrightness;
- aExtrusionPropVec.push_back( aProp );
+ // Value must be in range 0.0 to 1.0 in MS Office binary specification, but larger
+ // values are in fact interpreted.
+ fBrightness = GetPropertyValue( DFF_Prop_c3DAmbientIntensity, 0 );
}
+ fBrightness /= 655.36;
+ aProp.Name = "Brightness";
+ aProp.Value <<= fBrightness;
+ aExtrusionPropVec.push_back( aProp );
+
// "Depth" in 1/100mm
if ( IsProperty( DFF_Prop_c3DExtrudeBackward ) || IsProperty( DFF_Prop_c3DExtrudeForward ) )
{
@@ -1700,14 +1719,17 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aExtrusionPropVec.push_back( aProp );
}
// "Diffusion"
+ // ODF default is 0%, MS Office default is 100%. Thus must set value even if default.
+ double fDiffusion = 100;
if ( IsProperty( DFF_Prop_c3DDiffuseAmt ) )
{
- double fDiffusion = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DDiffuseAmt, 0 ));
+ fDiffusion = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DDiffuseAmt, 0 ));
fDiffusion /= 655.36;
- aProp.Name = "Diffusion";
- aProp.Value <<= fDiffusion;
- aExtrusionPropVec.push_back( aProp );
}
+ aProp.Name = "Diffusion";
+ aProp.Value <<= fDiffusion;
+ aExtrusionPropVec.push_back( aProp );
+
// "NumberOfLineSegments"
if ( IsProperty( DFF_Prop_c3DTolerance ) )
{
@@ -1730,24 +1752,35 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aProp.Name = "SecondLightHarsh";
aProp.Value <<= bExtrusionSecondLightHarsh;
aExtrusionPropVec.push_back( aProp );
+
// "FirstLightLevel"
+ // MS Office default 0x00009470 16.16 FixedPoint, 38000/65536 = 0.5798, ODF default 66%.
+ // Thus must set value even if default.
+ double fFirstLightLevel = 38000.0;
if ( IsProperty( DFF_Prop_c3DKeyIntensity ) )
{
- double fFirstLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyIntensity, 0 ));
- fFirstLightLevel /= 655.36;
- aProp.Name = "FirstLightLevel";
- aProp.Value <<= fFirstLightLevel;
- aExtrusionPropVec.push_back( aProp );
+ // value<0 and value>1 are allowed in MS Office. Clamp such in ODF export, not here.
+ fFirstLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DKeyIntensity, 0 ));
}
+ fFirstLightLevel /= 655.36;
+ aProp.Name = "FirstLightLevel";
+ aProp.Value <<= fFirstLightLevel;
+ aExtrusionPropVec.push_back( aProp );
+
// "SecondLightLevel"
+ // MS Office default 0x00009470 16.16 FixedPoint, 38000/65536 = 0.5798, ODF default 66%.
+ // Thus must set value even if default.
+ double fSecondLightLevel = 38000.0;
if ( IsProperty( DFF_Prop_c3DFillIntensity ) )
{
- double fSecondLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillIntensity, 0 ));
- fSecondLightLevel /= 655.36;
- aProp.Name = "SecondLightLevel";
- aProp.Value <<= fSecondLightLevel;
- aExtrusionPropVec.push_back( aProp );
+ // value<0 and value>1 are allowed in MS Office. Clamp such in ODF export, not here.
+ fSecondLightLevel = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DFillIntensity, 0 ));
}
+ fSecondLightLevel /= 655.36;
+ aProp.Name = "SecondLightLevel";
+ aProp.Value <<= fSecondLightLevel;
+ aExtrusionPropVec.push_back( aProp );
+
// "FirstLightDirection"
if ( IsProperty( DFF_Prop_c3DKeyX ) || IsProperty( DFF_Prop_c3DKeyY ) || IsProperty( DFF_Prop_c3DKeyZ ) )
{
@@ -1776,6 +1809,10 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aProp.Name = "Metal";
aProp.Value <<= bExtrusionMetal;
aExtrusionPropVec.push_back( aProp );
+ aProp.Name = "MetalType";
+ aProp.Value <<= css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible;
+ aExtrusionPropVec.push_back(aProp);
+
// "ShadeMode"
if ( IsProperty( DFF_Prop_c3DRenderMode ) )
{
@@ -1788,7 +1825,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aProp.Value <<= eExtrusionShadeMode;
aExtrusionPropVec.push_back( aProp );
}
- // "RotateAngle" in Grad
+ // "RotateAngle" in Degree
if ( IsProperty( DFF_Prop_c3DXRotationAngle ) || IsProperty( DFF_Prop_c3DYRotationAngle ) )
{
double fAngleX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DXRotationAngle, 0 ))) / 65536.0;
@@ -1821,34 +1858,44 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
}
}
// "Shininess"
+ // MS Office default 5, ODF default 50%.
if ( IsProperty( DFF_Prop_c3DShininess ) )
{
double fShininess = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DShininess, 0 ));
- fShininess /= 655.36;
+ fShininess *= 10.0; // error in [MS ODRAW] (2021), type is not FixedPoint but long.
aProp.Name = "Shininess";
aProp.Value <<= fShininess;
aExtrusionPropVec.push_back( aProp );
}
+
// "Skew"
+ // MS Office angle file value is 16.16 FixedPoint, default 0xFF790000,
+ // -8847360/65536=-135, ODF default 45. Thus must set value even if default.
+ double fSkewAngle = -135.0;
+ // MS Office amount file value is signed integer in range 0xFFFFFF9C to 0x00000064,
+ // default 0x00000032, ODF default 50.0
+ double fSkewAmount = 50.0;
if ( IsProperty( DFF_Prop_c3DSkewAmount ) || IsProperty( DFF_Prop_c3DSkewAngle ) )
{
- double fSkewAmount = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAmount, 50 ));
- double fSkewAngle = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAngle, sal::static_int_cast< sal_uInt32 >(-135 * 65536) ))) / 65536.0;
+ fSkewAmount = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAmount, 50 ));
+ fSkewAngle = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSkewAngle, sal::static_int_cast< sal_uInt32 >(-135 * 65536) ));
+ fSkewAngle /= 65536.0;
+ }
+ EnhancedCustomShapeParameterPair aSkewPair;
+ aSkewPair.First.Value <<= fSkewAmount;
+ aSkewPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aSkewPair.Second.Value <<= fSkewAngle;
+ aSkewPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aProp.Name = "Skew";
+ aProp.Value <<= aSkewPair;
+ aExtrusionPropVec.push_back( aProp );
- EnhancedCustomShapeParameterPair aSkewPair;
- aSkewPair.First.Value <<= fSkewAmount;
- aSkewPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
- aSkewPair.Second.Value <<= fSkewAngle;
- aSkewPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
- aProp.Name = "Skew";
- aProp.Value <<= aSkewPair;
- aExtrusionPropVec.push_back( aProp );
- }
// "Specularity"
+ // Type Fixed point 16.16, percent in API
if ( IsProperty( DFF_Prop_c3DSpecularAmt ) )
{
double fSpecularity = static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DSpecularAmt, 0 ));
- fSpecularity /= 1333;
+ fSpecularity /= 655.36;
aProp.Name = "Specularity";
aProp.Value <<= fSpecularity;
aExtrusionPropVec.push_back( aProp );
@@ -1860,16 +1907,22 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
aExtrusionPropVec.push_back( aProp );
// "ViewPoint" in 1/100mm
+ // MS Office default 1250000 EMU=3472.222 Hmm, ODF default 3.5cm
+ // Thus must set value even if default.
+ double fViewX = 1250000.0 / 360.0;
+ double fViewY = -1250000.0 / 360.0;;
+ double fViewZ = 9000000.0 / 360.0;
if ( IsProperty( DFF_Prop_c3DXViewpoint ) || IsProperty( DFF_Prop_c3DYViewpoint ) || IsProperty( DFF_Prop_c3DZViewpoint ) )
{
- double fViewX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DXViewpoint, 1250000 ))) / 360.0;
- double fViewY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DYViewpoint, sal_uInt32(-1250000) )))/ 360.0;
- double fViewZ = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DZViewpoint, 9000000 ))) / 360.0;
- css::drawing::Position3D aExtrusionViewPoint( fViewX, fViewY, fViewZ );
- aProp.Name = "ViewPoint";
- aProp.Value <<= aExtrusionViewPoint;
- aExtrusionPropVec.push_back( aProp );
+ fViewX = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DXViewpoint, 1250000 ))) / 360.0;
+ fViewY = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DYViewpoint, sal_uInt32(-1250000) )))/ 360.0;
+ fViewZ = static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DZViewpoint, 9000000 ))) / 360.0;
}
+ css::drawing::Position3D aExtrusionViewPoint( fViewX, fViewY, fViewZ );
+ aProp.Name = "ViewPoint";
+ aProp.Value <<= aExtrusionViewPoint;
+ aExtrusionPropVec.push_back( aProp );
+
// "Origin"
if ( IsProperty( DFF_Prop_c3DOriginX ) || IsProperty( DFF_Prop_c3DOriginY ) )
{
@@ -4003,7 +4056,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
pRet->SetName( aFileName );
}
}
- pRet->SetLogicRect( rObjData.aBoundRect );
+ pRet->NbcSetLogicRect( rObjData.aBoundRect );
if (SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pRet))
{
@@ -4173,13 +4226,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect,
int nCalledByGroup, sal_Int32* pShapeId )
{
- SdrObject* pRet = nullptr;
-
if( pShapeId )
*pShapeId = 0;
if (!rHd.SeekToBegOfRecord(rSt))
- return pRet;
+ return nullptr;
DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
@@ -4230,7 +4281,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.bOpt )
{
if (!maShapeRecords.Current()->SeekToBegOfRecord(rSt))
- return pRet;
+ return nullptr;
#ifdef DBG_AUTOSHAPE
ReadPropSet( rSt, &rClientData, (sal_uInt32)aObjData.eShapeType );
#else
@@ -4285,6 +4336,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.nSpFlags & ShapeFlag::Background )
aObjData.aBoundRect = tools::Rectangle( Point(), Size( 1, 1 ) );
+ SdrObjectUniquePtr xRet;
+
tools::Rectangle aTextRect;
if ( !aObjData.aBoundRect.IsEmpty() )
{ // apply rotation to the BoundingBox BEFORE an object has been generated
@@ -4309,7 +4362,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.nSpFlags & ShapeFlag::Group )
{
- pRet = new SdrObjGroup(*pSdrModel);
+ xRet.reset(new SdrObjGroup(*pSdrModel));
/* After CWS aw033 has been integrated, an empty group object
cannot store its resulting bounding rectangle anymore. We have
to return this rectangle via rClientRect now, but only, if
@@ -4329,9 +4382,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( bGraphic )
{
if (!mbSkipImages) {
- pRet = ImportGraphic( rSt, aSet, aObjData ); // SJ: #68396# is no longer true (fixed in ppt2000)
+ xRet.reset(ImportGraphic(rSt, aSet, aObjData)); // SJ: #68396# is no longer true (fixed in ppt2000)
ApplyAttributes( rSt, aSet, aObjData );
- pRet->SetMergedItemSet(aSet);
+ xRet->SetMergedItemSet(aSet);
}
}
else if ( aObjData.eShapeType == mso_sptLine && !( GetPropertyValue( DFF_Prop_fc3DLightFace, 0 ) & 8 ) )
@@ -4339,12 +4392,12 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
basegfx::B2DPolygon aPoly;
aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top()));
aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom()));
- pRet = new SdrPathObj(
+ xRet.reset(new SdrPathObj(
*pSdrModel,
SdrObjKind::Line,
- basegfx::B2DPolyPolygon(aPoly));
+ basegfx::B2DPolyPolygon(aPoly)));
ApplyAttributes( rSt, aSet, aObjData );
- pRet->SetMergedItemSet(aSet);
+ xRet->SetMergedItemSet(aSet);
}
else
{
@@ -4353,7 +4406,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
ApplyAttributes( rSt, aSet, aObjData );
- pRet = new SdrObjCustomShape(*pSdrModel);
+ xRet.reset(new SdrObjCustomShape(*pSdrModel));
sal_uInt32 ngtextFStrikethrough = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 );
bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0;
@@ -4389,12 +4442,12 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// this should be replaced through "CharacterRotation"
// by 90 degrees, therefore a new Item has to be
// supported by svx core, api and xml file format
- static_cast<SdrObjCustomShape*>(pRet)->SetVerticalWriting( ( ngtextFStrikethrough & 0x2000 ) != 0 );
+ static_cast<SdrObjCustomShape*>(xRet.get())->SetVerticalWriting( ( ngtextFStrikethrough & 0x2000 ) != 0 );
if ( SeekToContent( DFF_Prop_gtextUNICODE, rSt ) )
{
aObjectText = MSDFFReadZString( rSt, GetPropertyValue( DFF_Prop_gtextUNICODE, 0 ), true );
- ReadObjText( aObjectText, pRet );
+ ReadObjText(aObjectText, xRet.get());
}
auto eGeoTextAlign = GetPropertyValue(DFF_Prop_gtextAlign, mso_alignTextCenter);
@@ -4461,18 +4514,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
}
}
- pRet->SetMergedItemSet( aSet );
+ xRet->SetMergedItemSet( aSet );
// sj: taking care of rtl, ltr. In case of fontwork mso. seems not to be able to set
// proper text directions, instead the text default is depending to the string.
// so we have to calculate the a text direction from string:
if ( bIsFontwork )
{
- OutlinerParaObject* pParaObj = static_cast<SdrObjCustomShape*>(pRet)->GetOutlinerParaObject();
+ OutlinerParaObject* pParaObj = static_cast<SdrObjCustomShape*>(xRet.get())->GetOutlinerParaObject();
if ( pParaObj )
{
- SdrOutliner& rOutliner = static_cast<SdrObjCustomShape*>(pRet)->ImpGetDrawOutliner();
- rOutliner.SetStyleSheetPool(static_cast< SfxStyleSheetPool* >(pRet->getSdrModelFromSdrObject().GetStyleSheetPool()));
+ SdrOutliner& rOutliner = static_cast<SdrObjCustomShape*>(xRet.get())->ImpGetDrawOutliner();
+ rOutliner.SetStyleSheetPool(static_cast< SfxStyleSheetPool* >(xRet->getSdrModelFromSdrObject().GetStyleSheetPool()));
bool bOldUpdateMode = rOutliner.SetUpdateLayout( false );
rOutliner.SetText( *pParaObj );
ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
@@ -4497,7 +4550,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
{
std::optional<OutlinerParaObject> pNewText = rOutliner.CreateParaObject();
rOutliner.Init( OutlinerMode::TextObject );
- static_cast<SdrObjCustomShape*>(pRet)->NbcSetOutlinerParaObject( std::move(pNewText) );
+ static_cast<SdrObjCustomShape*>(xRet.get())->NbcSetOutlinerParaObject( std::move(pNewText) );
}
}
rOutliner.Clear();
@@ -4514,7 +4567,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
static const OUStringLiteral sAdjustmentValues( u"AdjustmentValues" );
static const OUStringLiteral sViewBox( u"ViewBox" );
static const OUStringLiteral sPath( u"Path" );
- SdrCustomShapeGeometryItem aGeometryItem( static_cast<SdrObjCustomShape*>(pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ SdrCustomShapeGeometryItem aGeometryItem( static_cast<SdrObjCustomShape*>(xRet.get())->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
PropertyValue aPropVal;
// The default arc goes form -90deg to 0deg. Replace general defaults used
@@ -4706,56 +4759,55 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aGeometryItem.ClearPropertyValue( "Equations" );
aGeometryItem.ClearPropertyValue( sPath );
- static_cast<SdrObjCustomShape*>(pRet)->SetMergedItem( aGeometryItem );
- static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes();
+ static_cast<SdrObjCustomShape*>(xRet.get())->SetMergedItem( aGeometryItem );
+ static_cast<SdrObjCustomShape*>(xRet.get())->MergeDefaultAttributes();
// now setting a new name, so the above correction is only done once when importing from ms
- SdrCustomShapeGeometryItem aGeoName( static_cast<SdrObjCustomShape*>(pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ SdrCustomShapeGeometryItem aGeoName( static_cast<SdrObjCustomShape*>(xRet.get())->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
aPropVal.Name = "Type";
aPropVal.Value <<= OUString( "mso-spt100" );
aGeoName.SetPropertyValue( aPropVal );
- static_cast<SdrObjCustomShape*>(pRet)->SetMergedItem( aGeoName );
+ static_cast<SdrObjCustomShape*>(xRet.get())->SetMergedItem( aGeoName );
}
else
- static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes();
+ static_cast<SdrObjCustomShape*>(xRet.get())->MergeDefaultAttributes();
- pRet->SetSnapRect( aObjData.aBoundRect );
- EnhancedCustomShape2d aCustomShape2d(static_cast<SdrObjCustomShape&>(*pRet));
+ xRet->SetSnapRect( aObjData.aBoundRect );
+ EnhancedCustomShape2d aCustomShape2d(static_cast<SdrObjCustomShape&>(*xRet));
aTextRect = aCustomShape2d.GetTextRect();
if( bIsConnector )
{
if( nObjectRotation )
- pRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation );
+ xRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation );
// mirrored horizontally?
if ( nSpFlags & ShapeFlag::FlipH )
{
- tools::Rectangle aBndRect( pRet->GetSnapRect() );
+ tools::Rectangle aBndRect(xRet->GetSnapRect());
Point aTop( ( aBndRect.Left() + aBndRect.Right() ) >> 1, aBndRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
- pRet->NbcMirror( aTop, aBottom );
+ xRet->NbcMirror( aTop, aBottom );
}
// mirrored vertically?
if ( nSpFlags & ShapeFlag::FlipV )
{
- tools::Rectangle aBndRect( pRet->GetSnapRect() );
+ tools::Rectangle aBndRect(xRet->GetSnapRect());
Point aLeft( aBndRect.Left(), ( aBndRect.Top() + aBndRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
- pRet->NbcMirror( aLeft, aRight );
+ xRet->NbcMirror( aLeft, aRight );
}
- basegfx::B2DPolyPolygon aPoly( static_cast<SdrObjCustomShape*>(pRet)->GetLineGeometry( true ) );
- SdrObject::Free( pRet );
+ basegfx::B2DPolyPolygon aPoly( static_cast<SdrObjCustomShape*>(xRet.get())->GetLineGeometry( true ) );
- pRet = new SdrEdgeObj(*pSdrModel);
+ xRet.reset(new SdrEdgeObj(*pSdrModel));
ApplyAttributes( rSt, aSet, aObjData );
- pRet->SetLogicRect( aObjData.aBoundRect );
- pRet->SetMergedItemSet(aSet);
+ xRet->SetLogicRect( aObjData.aBoundRect );
+ xRet->SetMergedItemSet(aSet);
// connectors
auto eConnectorStyle = GetPropertyValue(DFF_Prop_cxstyle, mso_cxstyleStraight);
- static_cast<SdrEdgeObj*>(pRet)->ConnectToNode(true, nullptr);
- static_cast<SdrEdgeObj*>(pRet)->ConnectToNode(false, nullptr);
+ static_cast<SdrEdgeObj*>(xRet.get())->ConnectToNode(true, nullptr);
+ static_cast<SdrEdgeObj*>(xRet.get())->ConnectToNode(false, nullptr);
Point aPoint1( aObjData.aBoundRect.TopLeft() );
Point aPoint2( aObjData.aBoundRect.BottomRight() );
@@ -4795,8 +4847,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
nSpFlags &= ~ShapeFlag::FlipV;
}
- pRet->NbcSetPoint(aPoint1, 0); // start point
- pRet->NbcSetPoint(aPoint2, 1); // endpoint
+ xRet->NbcSetPoint(aPoint1, 0); // start point
+ xRet->NbcSetPoint(aPoint2, 1); // endpoint
sal_Int32 n1HorzDist, n1VertDist, n2HorzDist, n2VertDist;
n1HorzDist = n1VertDist = n2HorzDist = n2VertDist = 0;
@@ -4820,74 +4872,73 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aSet.Put( SdrEdgeNode2HorzDistItem( n2HorzDist ) );
aSet.Put( SdrEdgeNode2VertDistItem( n2VertDist ) );
- static_cast<SdrEdgeObj*>(pRet)->SetEdgeTrackPath( aPoly );
- pRet->SetMergedItemSet( aSet );
+ static_cast<SdrEdgeObj*>(xRet.get())->SetEdgeTrackPath( aPoly );
+ xRet->SetMergedItemSet(aSet);
}
if ( aObjData.eShapeType == mso_sptLine )
{
- pRet->SetMergedItemSet(aSet);
- static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes();
+ xRet->SetMergedItemSet(aSet);
+ static_cast<SdrObjCustomShape*>(xRet.get())->MergeDefaultAttributes();
}
}
}
- if ( pRet )
+ if (xRet)
{
if( nObjectRotation )
- pRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation );
+ xRet->NbcRotate( aObjData.aBoundRect.Center(), nObjectRotation );
// mirrored horizontally?
if ( nSpFlags & ShapeFlag::FlipH )
{
- tools::Rectangle aBndRect( pRet->GetSnapRect() );
+ tools::Rectangle aBndRect(xRet->GetSnapRect());
Point aTop( ( aBndRect.Left() + aBndRect.Right() ) >> 1, aBndRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
- pRet->NbcMirror( aTop, aBottom );
+ xRet->NbcMirror(aTop, aBottom);
}
// mirrored vertically?
if ( nSpFlags & ShapeFlag::FlipV )
{
- tools::Rectangle aBndRect( pRet->GetSnapRect() );
+ tools::Rectangle aBndRect(xRet->GetSnapRect());
Point aLeft( aBndRect.Left(), ( aBndRect.Top() + aBndRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
- pRet->NbcMirror( aLeft, aRight );
+ xRet->NbcMirror(aLeft, aRight);
}
}
}
}
// #i51348# #118052# name of the shape
- if( pRet )
+ if (xRet)
{
OUString aObjName = GetPropertyString( DFF_Prop_wzName, rSt );
if( !aObjName.isEmpty() )
- pRet->SetName( aObjName );
+ xRet->SetName(aObjName);
}
- pRet =
- ProcessObj( rSt, aObjData, rClientData, aTextRect, pRet);
+ xRet.reset(ProcessObj(rSt, aObjData, rClientData, aTextRect, xRet.release()));
- if ( pRet )
+ if (xRet)
{
sal_Int32 nGroupProperties( GetPropertyValue( DFF_Prop_fPrint, 0 ) );
const bool bVisible = ( ( nGroupProperties & 2 ) == 0 );
- pRet->SetVisible( bVisible );
+ xRet->SetVisible( bVisible );
// In Excel hidden means not printed
if ( !bVisible )
{
- pRet->SetPrintable( false );
+ xRet->SetPrintable(false);
}
else
{
// This property isn't used in Excel anymore, leaving it for legacy reasons
- pRet->SetPrintable( ( nGroupProperties & 1 ) != 0 );
+ xRet->SetPrintable( ( nGroupProperties & 1 ) != 0 );
}
}
//Import alt text as description
- if ( pRet && SeekToContent( DFF_Prop_wzDescription, rSt ) )
+ if (xRet && SeekToContent(DFF_Prop_wzDescription, rSt))
{
OUString aAltText = MSDFFReadZString(rSt, GetPropertyValue(DFF_Prop_wzDescription, 0), true);
- pRet->SetDescription( aAltText );
+ xRet->SetDescription(aAltText);
}
// If this shape opens a new group, push back its object data because
@@ -4900,9 +4951,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
else
{
- pRet = FinalizeObj(aObjData, pRet);
+ xRet.reset(FinalizeObj(aObjData, xRet.release()));
}
- return pRet;
+ return xRet.release();
}
tools::Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, tools::Rectangle& aClientRect )
@@ -5158,7 +5209,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
case 0x0392:
pImpRec->nYRelTo = nUDData;
break;
- case 0x03BF: pImpRec->nLayoutInTableCell = nUDData; break;
+ case 0x03BF: pImpRec->nGroupShapeBooleanProperties = nUDData; break;
case 0x0393:
// This seems to correspond to o:hrpct from .docx (even including
// the difference that it's in 0.1% even though the .docx spec
@@ -5477,9 +5528,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
SfxItemSet aSet( pSdrModel->GetItemPool() );
ApplyAttributes( rSt, aSet, rObjData );
- const SfxPoolItem* pPoolItem=nullptr;
- SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR,
- false, &pPoolItem );
+ SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR );
if( SfxItemState::DEFAULT == eState )
aSet.Put( XFillColorItem( OUString(), mnDefaultColor ) );
pObj->SetMergedItemSet(aSet);
@@ -6442,40 +6491,42 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
bool bMtfBLIP = false;
bool bZCodecCompression = false;
// now position it exactly at the beginning of the embedded graphic
- sal_uLong nSkip = ( nInst & 0x0001 ) ? 32 : 16;
-
- switch( nInst & 0xFFFE )
+ sal_uLong nSkip = (nInst & 0x0001) ? 32 : 16;
+ const OfficeArtBlipRecInstance aRecInstanse = OfficeArtBlipRecInstance(nInst & 0xFFFE);
+ switch (aRecInstanse)
{
- case 0x216 : // Metafile header then compressed WMF
- case 0x3D4 : // Metafile header then compressed EMF
- case 0x542 : // Metafile hd. then compressed PICT
+ case OfficeArtBlipRecInstance::EMF:
+ case OfficeArtBlipRecInstance::WMF:
+ case OfficeArtBlipRecInstance::PICT:
{
- rBLIPStream.SeekRel( nSkip + 20 );
+ rBLIPStream.SeekRel(nSkip + 20);
- // read in size of metafile in EMUS
+ // read in size of metafile in English Metric Units (EMUs)
sal_Int32 width(0), height(0);
- rBLIPStream.ReadInt32( width ).ReadInt32( height );
- aMtfSize100.setWidth( width );
- aMtfSize100.setHeight( height );
+ rBLIPStream.ReadInt32(width).ReadInt32(height);
+ aMtfSize100.setWidth(width);
+ aMtfSize100.setHeight(height);
+ // 1 EMU = 1/360,000 of a centimeter
// scale to 1/100mm
- aMtfSize100.setWidth( aMtfSize100.Width() / 360 );
- aMtfSize100.setHeight( aMtfSize100.Height() / 360 );
+ aMtfSize100.setWidth(aMtfSize100.Width() / 360);
+ aMtfSize100.setHeight(aMtfSize100.Height() / 360);
- if ( pVisArea ) // seem that we currently are skipping the visarea position
- *pVisArea = tools::Rectangle( Point(), aMtfSize100 );
+ if (pVisArea) // seem that we currently are skipping the visarea position
+ *pVisArea = tools::Rectangle(Point(), aMtfSize100);
// skip rest of header
nSkip = 6;
bMtfBLIP = bZCodecCompression = true;
}
break;
- case 0x46A : // One byte tag then JPEG (= JFIF) data
- case 0x6E0 : // One byte tag then PNG data
- case 0x6E2 : // One byte tag then JPEG in CMYK color space
- case 0x7A8 :
- nSkip += 1; // One byte tag then DIB data
- break;
+ case OfficeArtBlipRecInstance::JPEG_RGB:
+ case OfficeArtBlipRecInstance::JPEG_CMYK:
+ case OfficeArtBlipRecInstance::PNG:
+ case OfficeArtBlipRecInstance::DIB:
+ case OfficeArtBlipRecInstance::TIFF:
+ nSkip += 1; // Skip one byte tag
+ break;
}
rBLIPStream.SeekRel( nSkip );
@@ -6498,18 +6549,34 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
// extract graphics from ole storage into "dbggfxNNN.*"
static sal_Int32 nGrfCount;
- OUString aFileName = "dbggfx" + OUString::number( nGrfCount++ );
- switch( nInst &~ 1 )
+ OUString aFileName = "dbggfx" + OUString::number(nGrfCount++);
+ switch (aRecInstanse)
{
- case 0x216 : aFileName += ".wmf"; break;
- case 0x3d4 : aFileName += ".emf"; break;
- case 0x542 : aFileName += ".pct"; break;
- case 0x46a : aFileName += ".jpg"; break;
- case 0x6e0 : aFileName += ".png"; break;
- case 0x6e2 : aFileName += ".jpg"; break;
- case 0x7a8 : aFileName += ".bmp"; break;
+ case OfficeArtBlipRecInstance::WMF:
+ aFileName += ".wmf";
+ break;
+ case OfficeArtBlipRecInstance::EMF:
+ aFileName += ".emf";
+ break;
+ case OfficeArtBlipRecInstance::PICT:
+ aFileName += ".pct";
+ break;
+ case OfficeArtBlipRecInstance::JPEG_RGB:
+ case OfficeArtBlipRecInstance::JPEG_CMYK:
+ aFileName += ".jpg";
+ break;
+ case OfficeArtBlipRecInstance::PNG:
+ aFileName += ".png";
+ break;
+ case OfficeArtBlipRecInstance::DIB:
+ aFileName += ".bmp";
+ break;
+ case OfficeArtBlipRecInstance::TIFF:
+ aFileName += ".tif";
+ break;
}
+
OUString aURLStr;
if( osl::FileBase::getFileURLFromSystemPath( Application::GetAppFileName(), aURLStr ) == osl::FileBase::E_None )
{
@@ -6546,8 +6613,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
}
}
#endif
-
- if( ( nInst & 0xFFFE ) == 0x7A8 )
+ if (aRecInstanse == OfficeArtBlipRecInstance::DIB)
{ // getting the DIBs immediately
Bitmap aNew;
if( ReadDIB(aNew, *pGrStream, false) )
@@ -6577,7 +6643,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
nRes = ERRCODE_NONE;
}
else
- nRes = rGF.ImportGraphic( rData, "", *pGrStream );
+ nRes = rGF.ImportGraphic( rData, u"", *pGrStream );
// SJ: I40472, sometimes the aspect ratio (aMtfSize100) does not match and we get scaling problems,
// then it is better to use the prefsize that is stored within the metafile. Bug #72846# for what the
@@ -6585,7 +6651,8 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
//
// For pict graphics we will furthermore scale the metafile, because font scaling leads to error if the
// dxarray is empty (this has been solved in wmf/emf but not for pict)
- if( bMtfBLIP && ( ERRCODE_NONE == nRes ) && ( rData.GetType() == GraphicType::GdiMetafile ) && ( ( nInst & 0xFFFE ) == 0x542 ) )
+ if (bMtfBLIP && (ERRCODE_NONE == nRes) && (rData.GetType() == GraphicType::GdiMetafile)
+ && (aRecInstanse == OfficeArtBlipRecInstance::PICT))
{
if ( ( aMtfSize100.Width() >= 1000 ) && ( aMtfSize100.Height() >= 1000 ) )
{ // #75956#, scaling does not work properly, if the graphic is less than 1cm
@@ -7077,14 +7144,16 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo
}
else
{
- SfxFilterMatcher aMatch( sStarName );
tools::SvRef<SotStorage> xStorage = new SotStorage( false, aMemStream );
rSrcStg.CopyTo( xStorage.get() );
xStorage->Commit();
xStorage.clear();
OUString aType = SfxFilter::GetTypeFromStorage( rSrcStg );
if (aType.getLength() && !utl::ConfigManager::IsFuzzing())
+ {
+ SfxFilterMatcher aMatch( sStarName );
pFilter = aMatch.GetFilter4EA( aType );
+ }
}
#ifdef DEBUG_FILTER_MSFILTER
@@ -7413,7 +7482,7 @@ SvxMSDffImportRec::SvxMSDffImportRec()
nClientDataLen( 0 ),
nXAlign( 0 ), // position n cm from left
nYAlign( 0 ), // position n cm below
- nLayoutInTableCell( 0 ), // element is laid out in table cell
+ nGroupShapeBooleanProperties(0), // 16 settings: LayoutInCell/AllowOverlap/BehindDocument...
nFlags( ShapeFlag::NONE ),
nDxTextLeft( 144 ),
nDyTextTop( 72 ),
@@ -7450,7 +7519,7 @@ SvxMSDffImportRec::SvxMSDffImportRec(const SvxMSDffImportRec& rCopy)
nXRelTo( rCopy.nXRelTo ),
nYAlign( rCopy.nYAlign ),
nYRelTo( rCopy.nYRelTo ),
- nLayoutInTableCell( rCopy.nLayoutInTableCell ),
+ nGroupShapeBooleanProperties(rCopy.nGroupShapeBooleanProperties),
nFlags( rCopy.nFlags ),
nDxTextLeft( rCopy.nDxTextLeft ),
nDyTextTop( rCopy.nDyTextTop ),
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 339b54766101..f746ad0e8a2d 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -102,7 +102,7 @@ CustomToolBarImportHelper::createCommandFromMacro( std::u16string_view sCmd )
// create script url
OUString scriptURL
= OUString::Concat("vnd.sun.star.script:") + sCmd + "?language=Basic&location=document";
- return uno::makeAny( scriptURL );
+ return uno::Any( scriptURL );
}
OUString CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd )
@@ -132,7 +132,7 @@ CustomToolBarImportHelper::createMenu( const OUString& rName, const uno::Referen
uno::Reference< container::XIndexContainer > xPopup( xCfgManager->createSettings(), uno::UNO_SET_THROW );
uno::Reference< beans::XPropertySet > xProps( xPopup, uno::UNO_QUERY_THROW );
// set name for menubar
- xProps->setPropertyValue("UIName", uno::makeAny( rName ) );
+ xProps->setPropertyValue("UIName", uno::Any( rName ) );
if ( xPopup.is() )
{
uno::Sequence< beans::PropertyValue > aPopupMenu{
@@ -142,7 +142,7 @@ CustomToolBarImportHelper::createMenu( const OUString& rName, const uno::Referen
comphelper::makePropertyValue("Type", sal_Int32( 0 ))
};
- xPopup->insertByIndex( xPopup->getCount(), uno::makeAny( aPopupMenu ) );
+ xPopup->insertByIndex( xPopup->getCount(), uno::Any( aPopupMenu ) );
xCfgManager->insertSettings( sMenuBar, xPopup );
uno::Reference< ui::XUIConfigurationPersistence > xPersistence( xCfgManager, uno::UNO_QUERY_THROW );
xPersistence->store();
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index ee40bede6bd4..d55a636fcc14 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -38,7 +38,7 @@
#include <unotools/pathoptions.hxx>
#include <rtl/character.hxx>
#include <sfx2/objsh.hxx>
-
+#include <o3tl/string_view.hxx>
#include <svtools/acceleratorexecute.hxx>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
@@ -66,13 +66,13 @@ OUString extractMacroName( const OUString& rMacroUrl )
return OUString();
}
-static OUString trimMacroName( const OUString& rMacroName )
+static std::u16string_view trimMacroName( std::u16string_view rMacroName )
{
// the name may contain whitespaces and may be enclosed in apostrophs
- OUString aMacroName = rMacroName.trim();
- sal_Int32 nMacroLen = aMacroName.getLength();
+ std::u16string_view aMacroName = o3tl::trim(rMacroName);
+ size_t nMacroLen = aMacroName.size();
if( (nMacroLen >= 2) && (aMacroName[ 0 ] == '\'') && (aMacroName[ nMacroLen - 1 ] == '\'') )
- aMacroName = aMacroName.copy( 1, nMacroLen - 2 ).trim();
+ aMacroName = o3tl::trim(aMacroName.substr( 1, nMacroLen - 2 ));
return aMacroName;
}
@@ -112,7 +112,7 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_SET_THROW );
uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
xProps->getPropertyValue("Title") >>= aName;
- aName = aName.getToken(0, '-').trim();
+ aName = o3tl::trim(o3tl::getToken(aName, 0, '-'));
if( sMacroURLOrPath.lastIndexOf( aName ) >= 0 )
{
pFoundShell = pShell;
@@ -173,8 +173,6 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
// if sMod is empty, only standard modules will be searched (no class, document, form modules)
static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, OUString& sMod, const OUString& sMacro )
{
- bool bFound = false;
-
#if !HAVE_FEATURE_SCRIPTING
(void) pShell;
(void) sLibrary;
@@ -200,18 +198,17 @@ static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, O
SbModule* pModule = pBasic->FindModule( sMod );
if ( pModule && pModule->FindMethod( sMacro, SbxClassType::Method ))
{
- bFound = true;
+ return true;
}
}
- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxClassType::Method ) ) )
+ else
{
- if( SbModule* pModule = pMethod->GetModule() )
+ for (auto const& rModuleRef : pBasic->GetModules())
{
- // when searching for a macro without module name, do not search in class/document/form modules
- if( pModule->GetModuleType() == script::ModuleType::NORMAL )
+ if (rModuleRef && rModuleRef->FindMethod(sMacro, SbxClassType::Method))
{
- sMod = pModule->GetName();
- bFound = true;
+ sMod = rModuleRef->GetName();
+ return true;
}
}
}
@@ -219,7 +216,7 @@ static bool hasMacro( SfxObjectShell const * pShell, const OUString& sLibrary, O
}
}
#endif
- return bFound;
+ return false;
}
#endif
@@ -293,34 +290,34 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
return MacroResolvedInfo();
// the name may be enclosed in apostrophs
- OUString aMacroName = trimMacroName( MacroName );
+ std::u16string_view aMacroName = trimMacroName( MacroName );
// parse the macro name
- sal_Int32 nDocSepIndex = aMacroName.indexOf( '!' );
- if( nDocSepIndex > 0 )
+ size_t nDocSepIndex = aMacroName.find( '!' );
+ if( nDocSepIndex > 0 && nDocSepIndex != std::u16string_view::npos )
{
// macro specified by document name
// find document shell for document name and call ourselves
// recursively
// assume for now that the document name is *this* document
- OUString sDocUrlOrPath = aMacroName.copy( 0, nDocSepIndex );
- aMacroName = aMacroName.copy( nDocSepIndex + 1 );
+ std::u16string_view sDocUrlOrPath = aMacroName.substr( 0, nDocSepIndex );
+ aMacroName = aMacroName.substr( nDocSepIndex + 1 );
SAL_INFO("filter.ms", "doc search, current shell is " << pShell);
SfxObjectShell* pFoundShell = nullptr;
if( bSearchGlobalTemplates )
{
SvtPathOptions aPathOpt;
const OUString& aAddinPath = aPathOpt.GetAddinPath();
- if( sDocUrlOrPath.startsWith( aAddinPath ) )
+ if( o3tl::starts_with(sDocUrlOrPath, aAddinPath) )
pFoundShell = pShell;
}
if( !pFoundShell )
- pFoundShell = findShellForUrl( sDocUrlOrPath );
+ pFoundShell = findShellForUrl( OUString(sDocUrlOrPath) );
SAL_INFO(
"filter.ms",
"doc search, after find, found shell is " << pFoundShell);
- return resolveVBAMacro( pFoundShell, aMacroName );
+ return resolveVBAMacro( pFoundShell, OUString(aMacroName) );
}
// macro is contained in 'this' document ( or code imported from a template
@@ -331,7 +328,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
// macro format = Container.Module.Procedure
OUString sContainer, sModule, sProcedure;
- parseMacro( aMacroName, sContainer, sModule, sProcedure );
+ parseMacro( OUString(aMacroName), sContainer, sModule, sProcedure );
#if 0
// As long as service VBAProjectNameProvider isn't supported in the model, disable the createInstance call
@@ -556,7 +553,7 @@ OUString SAL_CALL VBAMacroResolver::resolveVBAMacroToScriptURL( const OUString&
throw uno::RuntimeException();
// the name may be enclosed in apostrophs
- OUString aMacroName = trimMacroName( rVBAMacroName );
+ OUString aMacroName( trimMacroName( rVBAMacroName ) );
if( aMacroName.isEmpty() )
throw lang::IllegalArgumentException();
@@ -730,7 +727,7 @@ void applyShortCutKeyBinding ( const uno::Reference< frame::XModel >& rxModel, c
{
OUString aMacroName = MacroName.trim();
if( aMacroName.startsWith("!") )
- aMacroName = aMacroName.copy(1).trim();
+ aMacroName = o3tl::trim(aMacroName.subView(1));
SfxObjectShell* pShell = nullptr;
if ( rxModel.is() )
{
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 5dee2e32e509..1c1cf439b999 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4764,11 +4764,6 @@ bool PPTTextParagraphStyleAtomInterpreter::Read( SvStream& rIn, const DffRecordH
return bValid;
}
-PPTTextParagraphStyleAtomInterpreter::~PPTTextParagraphStyleAtomInterpreter()
-{
-
-}
-
PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) :
nCharIdx ( _nCharIdx ),
nDontKnow ( 1 )
@@ -5140,15 +5135,14 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar
sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme )
{
- sal_uInt32 nMask = 0; //TODO: nMask initialized here to suppress warning for now, see corresponding TODO below
- sal_uInt16 nDummy16;
- sal_Int32 nCharsToRead;
- sal_uInt16 nStringLen = aString.getLength();
+ sal_uInt16 nStringLen = aString.getLength();
+ sal_uInt16 nDummy16;
rIn.ReadUInt16( nDummy16 );
nCharCount = (rIn.good()) ? nDummy16 : 0;
rIn.ReadUInt16( nDummy16 );
- nCharsToRead = nStringLen - ( nCharReadCnt + nCharCount );
+
+ sal_Int32 nCharsToRead = nStringLen - ( nCharReadCnt + nCharCount );
if ( nCharsToRead < 0 )
{
nCharCount = nStringLen - nCharReadCnt;
@@ -5161,6 +5155,7 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar
ImplPPTCharPropSet& aSet = *aCharPropSet.mpImplPPTCharPropSet;
// character attributes
+ sal_uInt32 nMask(0);
rIn.ReadUInt32( nMask );
if ( static_cast<sal_uInt16>(nMask) )
{
@@ -5194,7 +5189,7 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar
}
if ( nMask & 0x40000 ) // cfColor
{
- sal_uInt32 nVal;
+ sal_uInt32 nVal(0);
rIn.ReadUInt32( nVal );
if ( !( nVal & 0xff000000 ) )
nVal = PPT_COLSCHEME_HINTERGRUND;
@@ -5748,27 +5743,24 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
const SfxItemSet* pItemSet = pTextObj->GetBackground();
if ( pItemSet )
{
- const SfxPoolItem* pFillStyleItem = nullptr;
- pItemSet->GetItemState( XATTR_FILLSTYLE, false, &pFillStyleItem );
+ const XFillStyleItem* pFillStyleItem = pItemSet->GetItemIfSet( XATTR_FILLSTYLE, false );
if ( pFillStyleItem )
{
- drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem*>(pFillStyleItem)->GetValue();
+ drawing::FillStyle eFillStyle = pFillStyleItem->GetValue();
switch( eFillStyle )
{
case drawing::FillStyle_SOLID :
{
- const SfxPoolItem* pFillColorItem = nullptr;
- pItemSet->GetItemState( XATTR_FILLCOLOR, false, &pFillColorItem );
+ const XColorItem* pFillColorItem = pItemSet->GetItemIfSet( XATTR_FILLCOLOR, false );
if ( pFillColorItem )
- aDefColor = static_cast<const XColorItem*>(pFillColorItem)->GetColorValue();
+ aDefColor = pFillColorItem->GetColorValue();
}
break;
case drawing::FillStyle_GRADIENT :
{
- const SfxPoolItem* pGradientItem = nullptr;
- pItemSet->GetItemState( XATTR_FILLGRADIENT, false, &pGradientItem );
+ const XFillGradientItem* pGradientItem = pItemSet->GetItemIfSet( XATTR_FILLGRADIENT, false );
if ( pGradientItem )
- aDefColor = static_cast<const XFillGradientItem*>(pGradientItem)->GetGradientValue().GetStartColor();
+ aDefColor = pGradientItem->GetGradientValue().GetStartColor();
}
break;
case drawing::FillStyle_HATCH :
@@ -6540,15 +6532,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
else
nTextRulerAtomOfs = 0xffffffff;
- sal_uInt32 nInstance = 0;
switch( rSdrPowerPointImport.m_eCurrentPageKind )
{
case PPT_NOTEPAGE :
- nInstance++;
- [[fallthrough]];
case PPT_MASTERPAGE :
- nInstance++;
- break;
case PPT_SLIDEPAGE :
break;
default :
@@ -7415,7 +7402,7 @@ static void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell > const
{
eFS = css::drawing::FillStyle_SOLID;
Color aFillColor( pObj->GetMergedItem( XATTR_FILLCOLOR ).GetColorValue() );
- xPropSet->setPropertyValue( "FillColor", makeAny( aFillColor ) );
+ xPropSet->setPropertyValue( "FillColor", Any( aFillColor ) );
}
break;
case drawing::FillStyle_GRADIENT :
@@ -7448,16 +7435,16 @@ static void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell > const
const XFillBitmapItem & rXFillBitmapItem(pObj->GetMergedItem( XATTR_FILLBITMAP ));
uno::Reference<graphic::XGraphic> xGraphic = rXFillBitmapItem.GetGraphicObject().GetGraphic().GetXGraphic();
uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
- xPropSet->setPropertyValue("FillBitmap", uno::makeAny(xBitmap));
+ xPropSet->setPropertyValue("FillBitmap", uno::Any(xBitmap));
const XFillBmpStretchItem & rStretchItem(pObj->GetMergedItem( XATTR_FILLBMP_STRETCH ));
const XFillBmpTileItem & rTileItem(pObj->GetMergedItem( XATTR_FILLBMP_TILE ));
if( rTileItem.GetValue() )
- xPropSet->setPropertyValue("FillBitmapMode", uno::makeAny(drawing::BitmapMode_REPEAT));
+ xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_REPEAT));
else if( rStretchItem.GetValue() )
- xPropSet->setPropertyValue("FillBitmapMode", uno::makeAny(drawing::BitmapMode_STRETCH));
+ xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_STRETCH));
else
- xPropSet->setPropertyValue("FillBitmapMode", uno::makeAny(drawing::BitmapMode_NO_REPEAT));
+ xPropSet->setPropertyValue("FillBitmapMode", uno::Any(drawing::BitmapMode_NO_REPEAT));
}
break;
default:
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 23b4de1e87be..a01db3452b10 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -10,11 +10,13 @@
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <rtl/ustring.hxx>
+#include <comphelper/string.hxx>
#include <unotools/fontcvt.hxx>
#include <unotools/fontdefs.hxx>
#include <vcl/BitmapPalette.hxx>
#include <filter/msfilter/escherex.hxx>
#include <filter/msfilter/util.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <unordered_map>
@@ -308,19 +310,19 @@ const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSO
return spPaperSizeTable[ nMSOPaperIndex ];
}
-OUString findQuotedText( const OUString& rCommand,
+std::u16string_view findQuotedText( std::u16string_view rCommand,
const char* cStartQuote, const sal_Unicode uEndQuote )
{
- OUString sRet;
+ std::u16string_view sRet;
OUString sStartQuote( OUString::createFromAscii(cStartQuote) );
- sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote );
- if( nStartIndex >= 0 )
+ size_t nStartIndex = rCommand.find( sStartQuote );
+ if( nStartIndex != std::u16string_view::npos )
{
sal_Int32 nStartLength = sStartQuote.getLength();
- sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength);
- if( nEndIndex > nStartIndex )
+ size_t nEndIndex = rCommand.find( uEndQuote, nStartIndex + nStartLength);
+ if( nEndIndex != std::u16string_view::npos && nEndIndex > nStartIndex )
{
- sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
+ sRet = rCommand.substr( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
}
}
return sRet;
@@ -484,11 +486,11 @@ bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* pFrom, sal_Int32* pTo, sal
const OUString sParams( GetResult() );
sal_Int32 nIndex = 0;
- const OUString sStart( sParams.getToken(0, '-', nIndex) );
+ const std::u16string_view sStart = o3tl::getToken(sParams, 0, '-', nIndex);
if (nIndex>=0)
{
- nStart = sStart.toInt32();
- nEnd = sParams.copy(nIndex).toInt32();
+ nStart = o3tl::toInt32(sStart);
+ nEnd = o3tl::toInt32(sParams.subView(nIndex));
}
}
if( pFrom ) *pFrom = nStart;
@@ -601,650 +603,616 @@ EquationResult ParseCombinedChars(const OUString& rStr)
return aResult;
}
-namespace {
-
-struct CustomShapeTypeTranslationTable
-{
- const char* sOOo;
- const char* sMSO;
-};
-
-}
-
-const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] =
+OString GetOOXMLPresetGeometry( std::u16string_view rShapeType )
{
- // { "non-primitive", mso_sptMin },
- { "frame", "frame" },
- { "rectangle", "rect" },
- { "round-rectangle", "roundRect" },
- { "ellipse", "ellipse" },
- { "diamond", "diamond" },
- { "isosceles-triangle", "triangle" },
- { "right-triangle", "rtTriangle" },
- { "parallelogram", "parallelogram" },
- { "trapezoid", "trapezoid" },
- { "hexagon", "hexagon" },
- { "octagon", "octagon" },
- { "cross", "plus" },
- { "star5", "star5" },
- { "right-arrow", "rightArrow" },
- // { "mso-spt14", mso_sptThickArrow },
- { "pentagon-right", "homePlate" },
- { "cube", "cube" },
- // { "mso-spt17", mso_sptBalloon },
- // { "mso-spt18", mso_sptSeal },
- { "mso-spt19", "arc" },
- { "mso-spt20", "line" },
- { "mso-spt21", "plaque" },
- { "can", "can" },
- { "ring", "donut" },
- { "mso-spt24", "textPlain" },
- { "mso-spt25", "textStop" },
- { "mso-spt26", "textTriangle" },
- { "mso-spt27", "textCanDown" },
- { "mso-spt28", "textWave1" },
- { "mso-spt29", "textArchUpPour" },
- { "mso-spt30", "textCanDown" },
- { "mso-spt31", "textArchUp" },
- { "mso-spt32", "straightConnector1" },
- { "mso-spt33", "bentConnector2" },
- { "mso-spt34", "bentConnector3" },
- { "mso-spt35", "bentConnector4" },
- { "mso-spt36", "bentConnector5" },
- { "mso-spt37", "curvedConnector2" },
- { "mso-spt38", "curvedConnector3" },
- { "mso-spt39", "curvedConnector4" },
- { "mso-spt40", "curvedConnector5" },
- { "mso-spt41", "callout1" },
- { "mso-spt42", "callout2" },
- { "mso-spt43", "callout3" },
- { "mso-spt44", "accentCallout1" },
- { "mso-spt45", "accentCallout2" },
- { "mso-spt46", "accentCallout3" },
- { "line-callout-1", "borderCallout1" },
- { "line-callout-2", "borderCallout2" },
- { "line-callout-3", "borderCallout3" },
- { "mso-spt49", "borderCallout3" },
- { "mso-spt50", "accentBorderCallout1" },
- { "mso-spt51", "accentBorderCallout2" },
- { "mso-spt52", "accentBorderCallout3" },
- { "mso-spt53", "ribbon" },
- { "mso-spt54", "ribbon2" },
- { "chevron", "chevron" },
- { "pentagon", "pentagon" },
- { "forbidden", "noSmoking" },
- { "star8", "star8" },
- { "mso-spt59", "star16" },
- { "mso-spt60", "star32" },
- { "rectangular-callout", "wedgeRectCallout" },
- { "round-rectangular-callout", "wedgeRoundRectCallout" },
- { "round-callout", "wedgeEllipseCallout" },
- { "mso-spt64", "wave" },
- { "paper", "foldedCorner" },
- { "left-arrow", "leftArrow" },
- { "down-arrow", "downArrow" },
- { "up-arrow", "upArrow" },
- { "left-right-arrow", "leftRightArrow" },
- { "up-down-arrow", "upDownArrow" },
- { "mso-spt71", "irregularSeal1" },
- { "bang", "irregularSeal2" },
- { "lightning", "lightningBolt" },
- { "heart", "heart" },
- { "quad-arrow", "quadArrow" },
- { "left-arrow-callout", "leftArrowCallout" },
- { "right-arrow-callout", "rightArrowCallout" },
- { "up-arrow-callout", "upArrowCallout" },
- { "down-arrow-callout", "downArrowCallout" },
- { "left-right-arrow-callout", "leftRightArrowCallout" },
- { "up-down-arrow-callout", "upDownArrowCallout" },
- { "quad-arrow-callout", "quadArrowCallout" },
- { "quad-bevel", "bevel" },
- { "left-bracket", "leftBracket" },
- { "right-bracket", "rightBracket" },
- { "left-brace", "leftBrace" },
- { "right-brace", "rightBrace" },
- { "mso-spt89", "leftUpArrow" },
- { "mso-spt90", "bentUpArrow" },
- { "mso-spt91", "bentArrow" },
- { "star24", "star24" },
- { "striped-right-arrow", "stripedRightArrow" },
- { "notched-right-arrow", "notchedRightArrow" },
- { "block-arc", "blockArc" },
- { "smiley", "smileyFace" },
- { "vertical-scroll", "verticalScroll" },
- { "horizontal-scroll", "horizontalScroll" },
- { "circular-arrow", "circularArrow" },
- { "mso-spt100", "pie" }, // looks like MSO_SPT is wrong here
- { "mso-spt101", "uturnArrow" },
- { "mso-spt102", "curvedRightArrow" },
- { "mso-spt103", "curvedLeftArrow" },
- { "mso-spt104", "curvedUpArrow" },
- { "mso-spt105", "curvedDownArrow" },
- { "cloud-callout", "cloudCallout" },
- { "mso-spt107", "ellipseRibbon" },
- { "mso-spt108", "ellipseRibbon2" },
- { "flowchart-process", "flowChartProcess" },
- { "flowchart-decision", "flowChartDecision" },
- { "flowchart-data", "flowChartInputOutput" },
- { "flowchart-predefined-process", "flowChartPredefinedProcess" },
- { "flowchart-internal-storage", "flowChartInternalStorage" },
- { "flowchart-document", "flowChartDocument" },
- { "flowchart-multidocument", "flowChartMultidocument" },
- { "flowchart-terminator", "flowChartTerminator" },
- { "flowchart-preparation", "flowChartPreparation" },
- { "flowchart-manual-input", "flowChartManualInput" },
- { "flowchart-manual-operation", "flowChartManualOperation" },
- { "flowchart-connector", "flowChartConnector" },
- { "flowchart-card", "flowChartPunchedCard" },
- { "flowchart-punched-tape", "flowChartPunchedTape" },
- { "flowchart-summing-junction", "flowChartSummingJunction" },
- { "flowchart-or", "flowChartOr" },
- { "flowchart-collate", "flowChartCollate" },
- { "flowchart-sort", "flowChartSort" },
- { "flowchart-extract", "flowChartExtract" },
- { "flowchart-merge", "flowChartMerge" },
- { "mso-spt129", "flowChartOfflineStorage" },
- { "flowchart-stored-data", "flowChartOnlineStorage" },
- { "flowchart-sequential-access", "flowChartMagneticTape" },
- { "flowchart-magnetic-disk", "flowChartMagneticDisk" },
- { "flowchart-direct-access-storage", "flowChartMagneticDrum" },
- { "flowchart-display", "flowChartDisplay" },
- { "flowchart-delay", "flowChartDelay" },
- // { "fontwork-plain-text", "textPlainText" },
- // { "fontwork-stop", "textStop" },
- // { "fontwork-triangle-up", "textTriangle" },
- // { "fontwork-triangle-down", "textTriangleInverted" },
- // { "fontwork-chevron-up", "textChevron" },
- // { "fontwork-chevron-down", "textChevronInverted" },
- // { "mso-spt142", "textRingInside" },
- // { "mso-spt143", "textRingOutside" },
- // { "fontwork-arch-up-curve", "textArchUpCurve" },
- // { "fontwork-arch-down-curve", "textArchDownCurve" },
- // { "fontwork-circle-curve", "textCircleCurve" },
- // { "fontwork-open-circle-curve", "textButtonCurve" },
- // { "fontwork-arch-up-pour", "textArchUpPour" },
- // { "fontwork-arch-down-pour", "textArchDownPour" },
- // { "fontwork-circle-pour", "textCirclePour" },
- // { "fontwork-open-circle-pour", "textButtonPour" },
- // { "fontwork-curve-up", "textCurveUp" },
- // { "fontwork-curve-down", "textCurveDown" },
- // { "fontwork-fade-up-and-right", "textCascadeUp" },
- // { "fontwork-fade-up-and-left", "textCascadeDown" },
- // { "fontwork-wave", "textWave1" },
- // { "mso-spt157", "textWave2" },
- // { "mso-spt158", "textWave3" },
- // { "mso-spt159", "textWave4" },
- // { "fontwork-inflate", "textInflate" },
- // { "mso-spt161", "textDeflate" },
- // { "mso-spt162", "textInflateBottom" },
- // { "mso-spt163", "textDeflateBottom" },
- // { "mso-spt164", "textInflateTop" },
- // { "mso-spt165", "textDeflateTop" },
- // { "mso-spt166", "textDeflateInflate" },
- // { "mso-spt167", "textDeflateInflateDeflate" },
- // { "fontwork-fade-right", "textFadeRight" },
- // { "fontwork-fade-left", "textFadeLeft" },
- // { "fontwork-fade-up", "textFadeUp" },
- // { "fontwork-fade-down", "textFadeDown" },
- // { "fontwork-slant-up", "textSlantUp" },
- // { "fontwork-slant-down", "textSlantDown" },
- // { "mso-spt174", "textCanUp" },
- // { "mso-spt175", "textCanDown" },
- { "flowchart-alternate-process", "flowChartAlternateProcess" },
- { "flowchart-off-page-connector", "flowChartOffpageConnector" },
- { "mso-spt178", "callout1" },
- { "mso-spt179", "accentCallout1" },
- { "mso-spt180", "borderCallout1" },
- { "mso-spt182", "leftRightUpArrow" },
- { "sun", "sun" },
- { "moon", "moon" },
- { "bracket-pair", "bracketPair" },
- { "brace-pair", "bracePair" },
- { "star4", "star4" },
- { "mso-spt188", "doubleWave" },
- { "mso-spt189", "actionButtonBlank" },
- { "mso-spt190", "actionButtonHome" },
- { "mso-spt191", "actionButtonHelp" },
- { "mso-spt192", "actionButtonInformation" },
- { "mso-spt193", "actionButtonForwardNext" },
- { "mso-spt194", "actionButtonBackPrevious" },
- { "mso-spt195", "actionButtonEnd" },
- { "mso-spt196", "actionButtonBeginning" },
- { "mso-spt197", "actionButtonReturn" },
- { "mso-spt198", "actionButtonDocument" },
- { "mso-spt199", "actionButtonSound" },
- { "mso-spt200", "actionButtonMovie" },
- // { "mso-spt201", "hostControl" },
- { "mso-spt202", "rect" },
- { "ooxml-actionButtonSound", "actionButtonSound" },
- { "ooxml-borderCallout1", "borderCallout1" },
- { "ooxml-plaqueTabs", "plaqueTabs" },
- { "ooxml-curvedLeftArrow", "curvedLeftArrow" },
- { "ooxml-octagon", "octagon" },
- { "ooxml-leftRightRibbon", "leftRightRibbon" },
- { "ooxml-actionButtonInformation", "actionButtonInformation" },
- { "ooxml-bentConnector5", "bentConnector5" },
- { "ooxml-circularArrow", "circularArrow" },
- { "ooxml-downArrowCallout", "downArrowCallout" },
- { "ooxml-mathMinus", "mathMinus" },
- { "ooxml-gear9", "gear9" },
- { "ooxml-round1Rect", "round1Rect" },
- { "ooxml-sun", "sun" },
- { "ooxml-plaque", "plaque" },
- { "ooxml-chevron", "chevron" },
- { "ooxml-flowChartPreparation", "flowChartPreparation" },
- { "ooxml-diagStripe", "diagStripe" },
- { "ooxml-pentagon", "pentagon" },
- { "ooxml-funnel", "funnel" },
- { "ooxml-chartStar", "chartStar" },
- { "ooxml-accentBorderCallout1", "accentBorderCallout1" },
- { "ooxml-notchedRightArrow", "notchedRightArrow" },
- { "ooxml-rightBracket", "rightBracket" },
- { "ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" },
- { "ooxml-leftRightArrow", "leftRightArrow" },
- { "ooxml-decagon", "decagon" },
- { "ooxml-actionButtonHelp", "actionButtonHelp" },
- { "ooxml-star24", "star24" },
- { "ooxml-mathDivide", "mathDivide" },
- { "ooxml-curvedConnector4", "curvedConnector4" },
- { "ooxml-flowChartOr", "flowChartOr" },
- { "ooxml-borderCallout3", "borderCallout3" },
- { "ooxml-upDownArrowCallout", "upDownArrowCallout" },
- { "ooxml-flowChartDecision", "flowChartDecision" },
- { "ooxml-leftRightArrowCallout", "leftRightArrowCallout" },
- { "ooxml-flowChartManualOperation", "flowChartManualOperation" },
- { "ooxml-snipRoundRect", "snipRoundRect" },
- { "ooxml-mathPlus", "mathPlus" },
- { "ooxml-actionButtonForwardNext", "actionButtonForwardNext" },
- { "ooxml-can", "can" },
- { "ooxml-foldedCorner", "foldedCorner" },
- { "ooxml-star32", "star32" },
- { "ooxml-flowChartInternalStorage", "flowChartInternalStorage" },
- { "ooxml-upDownArrow", "upDownArrow" },
- { "ooxml-irregularSeal2", "irregularSeal2" },
- { "ooxml-mathEqual", "mathEqual" },
- { "ooxml-star12", "star12" },
- { "ooxml-uturnArrow", "uturnArrow" },
- { "ooxml-squareTabs", "squareTabs" },
- { "ooxml-leftRightUpArrow", "leftRightUpArrow" },
- { "ooxml-homePlate", "homePlate" },
- { "ooxml-dodecagon", "dodecagon" },
- { "ooxml-leftArrowCallout", "leftArrowCallout" },
- { "ooxml-chord", "chord" },
- { "ooxml-quadArrowCallout", "quadArrowCallout" },
- { "ooxml-actionButtonBeginning", "actionButtonBeginning" },
- { "ooxml-ellipse", "ellipse" },
- { "ooxml-actionButtonEnd", "actionButtonEnd" },
- { "ooxml-arc", "arc" },
- { "ooxml-star16", "star16" },
- { "ooxml-parallelogram", "parallelogram" },
- { "ooxml-bevel", "bevel" },
- { "ooxml-roundRect", "roundRect" },
- { "ooxml-accentCallout1", "accentCallout1" },
- { "ooxml-flowChartSort", "flowChartSort" },
- { "ooxml-star8", "star8" },
- { "ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" },
- { "ooxml-moon", "moon" },
- { "ooxml-star6", "star6" },
- { "ooxml-round2SameRect", "round2SameRect" },
- { "ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" },
- { "ooxml-diamond", "diamond" },
- { "ooxml-ellipseRibbon", "ellipseRibbon" },
- { "ooxml-callout2", "callout2" },
- { "ooxml-pie", "pie" },
- { "ooxml-star4", "star4" },
- { "ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" },
- { "ooxml-flowChartPunchedTape", "flowChartPunchedTape" },
- { "ooxml-curvedConnector2", "curvedConnector2" },
- { "ooxml-bentConnector3", "bentConnector3" },
- { "ooxml-cornerTabs", "cornerTabs" },
- { "ooxml-hexagon", "hexagon" },
- { "ooxml-flowChartConnector", "flowChartConnector" },
- { "ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" },
- { "ooxml-heart", "heart" },
- { "ooxml-ribbon2", "ribbon2" },
- { "ooxml-bracePair", "bracePair" },
- { "ooxml-flowChartExtract", "flowChartExtract" },
- { "ooxml-actionButtonHome", "actionButtonHome" },
- { "ooxml-accentBorderCallout3", "accentBorderCallout3" },
- { "ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" },
- { "ooxml-irregularSeal1", "irregularSeal1" },
- { "ooxml-quadArrow", "quadArrow" },
- { "ooxml-leftBrace", "leftBrace" },
- { "ooxml-leftBracket", "leftBracket" },
- { "ooxml-blockArc", "blockArc" },
- { "ooxml-curvedConnector3", "curvedConnector3" },
- { "ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" },
- { "ooxml-actionButtonMovie", "actionButtonMovie" },
- { "ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" },
- { "ooxml-gear6", "gear6" },
- { "ooxml-halfFrame", "halfFrame" },
- { "ooxml-snip2SameRect", "snip2SameRect" },
- { "ooxml-triangle", "triangle" },
- { "ooxml-teardrop", "teardrop" },
- { "ooxml-flowChartDocument", "flowChartDocument" },
- { "ooxml-rightArrowCallout", "rightArrowCallout" },
- { "ooxml-rightBrace", "rightBrace" },
- { "ooxml-chartPlus", "chartPlus" },
- { "ooxml-flowChartManualInput", "flowChartManualInput" },
- { "ooxml-flowChartMerge", "flowChartMerge" },
- { "ooxml-line", "line" },
- { "ooxml-downArrow", "downArrow" },
- { "ooxml-upArrow", "upArrow" },
- { "ooxml-curvedDownArrow", "curvedDownArrow" },
- { "ooxml-actionButtonReturn", "actionButtonReturn" },
- { "ooxml-flowChartInputOutput", "flowChartInputOutput" },
- { "ooxml-bracketPair", "bracketPair" },
- { "ooxml-smileyFace", "smileyFace" },
- { "ooxml-actionButtonBlank", "actionButtonBlank" },
- { "ooxml-wave", "wave" },
- { "ooxml-swooshArrow", "swooshArrow" },
- { "ooxml-flowChartSummingJunction", "flowChartSummingJunction" },
- { "ooxml-lightningBolt", "lightningBolt" },
- { "ooxml-flowChartDisplay", "flowChartDisplay" },
- { "ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" },
- { "ooxml-frame", "frame" },
- { "ooxml-rtTriangle", "rtTriangle" },
- { "ooxml-flowChartMagneticTape", "flowChartMagneticTape" },
- { "ooxml-curvedRightArrow", "curvedRightArrow" },
- { "ooxml-leftUpArrow", "leftUpArrow" },
- { "ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" },
- { "ooxml-doubleWave", "doubleWave" },
- { "ooxml-bentArrow", "bentArrow" },
- { "ooxml-star10", "star10" },
- { "ooxml-leftArrow", "leftArrow" },
- { "ooxml-curvedUpArrow", "curvedUpArrow" },
- { "ooxml-snip1Rect", "snip1Rect" },
- { "ooxml-ellipseRibbon2", "ellipseRibbon2" },
- { "ooxml-plus", "plus" },
- { "ooxml-accentCallout3", "accentCallout3" },
- { "ooxml-leftCircularArrow", "leftCircularArrow" },
- { "ooxml-rightArrow", "rightArrow" },
- { "ooxml-flowChartPunchedCard", "flowChartPunchedCard" },
- { "ooxml-snip2DiagRect", "snip2DiagRect" },
- { "ooxml-verticalScroll", "verticalScroll" },
- { "ooxml-star7", "star7" },
- { "ooxml-chartX", "chartX" },
- { "ooxml-cloud", "cloud" },
- { "ooxml-cube", "cube" },
- { "ooxml-round2DiagRect", "round2DiagRect" },
- { "ooxml-flowChartMultidocument", "flowChartMultidocument" },
- { "ooxml-actionButtonDocument", "actionButtonDocument" },
- { "ooxml-flowChartTerminator", "flowChartTerminator" },
- { "ooxml-flowChartDelay", "flowChartDelay" },
- { "ooxml-curvedConnector5", "curvedConnector5" },
- { "ooxml-horizontalScroll", "horizontalScroll" },
- { "ooxml-bentConnector4", "bentConnector4" },
- { "ooxml-leftRightCircularArrow", "leftRightCircularArrow" },
- { "ooxml-wedgeRectCallout", "wedgeRectCallout" },
- { "ooxml-accentCallout2", "accentCallout2" },
- { "ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" },
- { "ooxml-corner", "corner" },
- { "ooxml-borderCallout2", "borderCallout2" },
- { "ooxml-donut", "donut" },
- { "ooxml-flowChartCollate", "flowChartCollate" },
- { "ooxml-mathNotEqual", "mathNotEqual" },
- { "ooxml-bentConnector2", "bentConnector2" },
- { "ooxml-mathMultiply", "mathMultiply" },
- { "ooxml-heptagon", "heptagon" },
- { "ooxml-rect", "rect" },
- { "ooxml-accentBorderCallout2", "accentBorderCallout2" },
- { "ooxml-pieWedge", "pieWedge" },
- { "ooxml-upArrowCallout", "upArrowCallout" },
- { "ooxml-flowChartProcess", "flowChartProcess" },
- { "ooxml-star5", "star5" },
- { "ooxml-lineInv", "lineInv" },
- { "ooxml-straightConnector1", "straightConnector1" },
- { "ooxml-stripedRightArrow", "stripedRightArrow" },
- { "ooxml-callout3", "callout3" },
- { "ooxml-bentUpArrow", "bentUpArrow" },
- { "ooxml-noSmoking", "noSmoking" },
- { "ooxml-trapezoid", "trapezoid" },
- { "ooxml-cloudCallout", "cloudCallout" },
- { "ooxml-callout1", "callout1" },
- { "ooxml-ribbon", "ribbon" },
- { "ooxml-rect", "rect" },
-};
-
-struct {
- const char* sDML;
- MSO_SPT nVML;
-} const pDMLToVMLTable[] = {
- {"notPrimitive", mso_sptNotPrimitive},
- {"rectangle", mso_sptRectangle},
- {"roundRectangle", mso_sptRoundRectangle},
- {"ellipse", mso_sptEllipse},
- {"diamond", mso_sptDiamond},
- {"triangle", mso_sptIsocelesTriangle},
- {"rtTriangle", mso_sptRightTriangle},
- {"parallelogram", mso_sptParallelogram},
- {"trapezoid", mso_sptTrapezoid},
- {"hexagon", mso_sptHexagon},
- {"octagon", mso_sptOctagon},
- {"plus", mso_sptPlus},
- {"star5", mso_sptStar},
- {"rightArrow", mso_sptArrow},
- {"thickArrow", mso_sptThickArrow},
- {"homePlate", mso_sptHomePlate},
- {"cube", mso_sptCube},
- {"wedgeRoundRectCallout", mso_sptBalloon},
- {"star16", mso_sptSeal},
- {"arc", mso_sptArc},
- {"line", mso_sptLine},
- {"plaque", mso_sptPlaque},
- {"can", mso_sptCan},
- {"donut", mso_sptDonut},
- {"textPlain", mso_sptTextSimple},
- {"textStop", mso_sptTextOctagon},
- {"textTriangle", mso_sptTextHexagon},
- {"textCanDown", mso_sptTextCurve},
- {"textWave1", mso_sptTextWave},
- {"textArchUpPour", mso_sptTextRing},
- {"textCanDown", mso_sptTextOnCurve},
- {"textArchUp", mso_sptTextOnRing},
- {"straightConnector1", mso_sptStraightConnector1},
- {"bentConnector2", mso_sptBentConnector2},
- {"bentConnector3", mso_sptBentConnector3},
- {"bentConnector4", mso_sptBentConnector4},
- {"bentConnector5", mso_sptBentConnector5},
- {"curvedConnector2", mso_sptCurvedConnector2},
- {"curvedConnector3", mso_sptCurvedConnector3},
- {"curvedConnector4", mso_sptCurvedConnector4},
- {"curvedConnector5", mso_sptCurvedConnector5},
- {"callout1", mso_sptCallout1},
- {"callout2", mso_sptCallout2},
- {"callout3", mso_sptCallout3},
- {"accentCallout1", mso_sptAccentCallout1},
- {"accentCallout2", mso_sptAccentCallout2},
- {"accentCallout3", mso_sptAccentCallout3},
- {"borderCallout1", mso_sptBorderCallout1},
- {"borderCallout2", mso_sptBorderCallout2},
- {"borderCallout3", mso_sptBorderCallout3},
- {"accentBorderCallout1", mso_sptAccentBorderCallout1},
- {"accentBorderCallout2", mso_sptAccentBorderCallout2},
- {"accentBorderCallout3", mso_sptAccentBorderCallout3},
- {"ribbon", mso_sptRibbon},
- {"ribbon2", mso_sptRibbon2},
- {"chevron", mso_sptChevron},
- {"pentagon", mso_sptPentagon},
- {"noSmoking", mso_sptNoSmoking},
- {"star8", mso_sptSeal8},
- {"star16", mso_sptSeal16},
- {"star32", mso_sptSeal32},
- {"wedgeRectCallout", mso_sptWedgeRectCallout},
- {"wedgeRoundRectCallout", mso_sptWedgeRRectCallout},
- {"wedgeEllipseCallout", mso_sptWedgeEllipseCallout},
- {"wave", mso_sptWave},
- {"foldedCorner", mso_sptFoldedCorner},
- {"leftArrow", mso_sptLeftArrow},
- {"downArrow", mso_sptDownArrow},
- {"upArrow", mso_sptUpArrow},
- {"leftRightArrow", mso_sptLeftRightArrow},
- {"upDownArrow", mso_sptUpDownArrow},
- {"irregularSeal1", mso_sptIrregularSeal1},
- {"irregularSeal2", mso_sptIrregularSeal2},
- {"lightningBolt", mso_sptLightningBolt},
- {"heart", mso_sptHeart},
- {"pictureFrame", mso_sptPictureFrame},
- {"quadArrow", mso_sptQuadArrow},
- {"leftArrowCallout", mso_sptLeftArrowCallout},
- {"rightArrowCallout", mso_sptRightArrowCallout},
- {"upArrowCallout", mso_sptUpArrowCallout},
- {"downArrowCallout", mso_sptDownArrowCallout},
- {"leftRightArrowCallout", mso_sptLeftRightArrowCallout},
- {"upDownArrowCallout", mso_sptUpDownArrowCallout},
- {"quadArrowCallout", mso_sptQuadArrowCallout},
- {"bevel", mso_sptBevel},
- {"leftBracket", mso_sptLeftBracket},
- {"rightBracket", mso_sptRightBracket},
- {"leftBrace", mso_sptLeftBrace},
- {"rightBrace", mso_sptRightBrace},
- {"leftUpArrow", mso_sptLeftUpArrow},
- {"bentUpArrow", mso_sptBentUpArrow},
- {"bentArrow", mso_sptBentArrow},
- {"star24", mso_sptSeal24},
- {"stripedRightArrow", mso_sptStripedRightArrow},
- {"notchedRightArrow", mso_sptNotchedRightArrow},
- {"blockArc", mso_sptBlockArc},
- {"smileyFace", mso_sptSmileyFace},
- {"verticalScroll", mso_sptVerticalScroll},
- {"horizontalScroll", mso_sptHorizontalScroll},
- {"circularArrow", mso_sptCircularArrow},
- {"notchedCircularArrow", mso_sptNotchedCircularArrow},
- {"uturnArrow", mso_sptUturnArrow},
- {"curvedRightArrow", mso_sptCurvedRightArrow},
- {"curvedLeftArrow", mso_sptCurvedLeftArrow},
- {"curvedUpArrow", mso_sptCurvedUpArrow},
- {"curvedDownArrow", mso_sptCurvedDownArrow},
- {"cloudCallout", mso_sptCloudCallout},
- {"ellipseRibbon", mso_sptEllipseRibbon},
- {"ellipseRibbon2", mso_sptEllipseRibbon2},
- {"flowChartProcess", mso_sptFlowChartProcess},
- {"flowChartDecision", mso_sptFlowChartDecision},
- {"flowChartInputOutput", mso_sptFlowChartInputOutput},
- {"flowChartPredefinedProcess", mso_sptFlowChartPredefinedProcess},
- {"flowChartInternalStorage", mso_sptFlowChartInternalStorage},
- {"flowChartDocument", mso_sptFlowChartDocument},
- {"flowChartMultidocument", mso_sptFlowChartMultidocument},
- {"flowChartTerminator", mso_sptFlowChartTerminator},
- {"flowChartPreparation", mso_sptFlowChartPreparation},
- {"flowChartManualInput", mso_sptFlowChartManualInput},
- {"flowChartManualOperation", mso_sptFlowChartManualOperation},
- {"flowChartConnector", mso_sptFlowChartConnector},
- {"flowChartPunchedCard", mso_sptFlowChartPunchedCard},
- {"flowChartPunchedTape", mso_sptFlowChartPunchedTape},
- {"flowChartSummingJunction", mso_sptFlowChartSummingJunction},
- {"flowChartOr", mso_sptFlowChartOr},
- {"flowChartCollate", mso_sptFlowChartCollate},
- {"flowChartSort", mso_sptFlowChartSort},
- {"flowChartExtract", mso_sptFlowChartExtract},
- {"flowChartMerge", mso_sptFlowChartMerge},
- {"flowChartOfflineStorage", mso_sptFlowChartOfflineStorage},
- {"flowChartOnlineStorage", mso_sptFlowChartOnlineStorage},
- {"flowChartMagneticTape", mso_sptFlowChartMagneticTape},
- {"flowChartMagneticDisk", mso_sptFlowChartMagneticDisk},
- {"flowChartMagneticDrum", mso_sptFlowChartMagneticDrum},
- {"flowChartDisplay", mso_sptFlowChartDisplay},
- {"flowChartDelay", mso_sptFlowChartDelay},
- {"textPlain", mso_sptTextPlainText},
- {"textStop", mso_sptTextStop},
- {"textTriangle", mso_sptTextTriangle},
- {"textTriangleInverted", mso_sptTextTriangleInverted},
- {"textChevron", mso_sptTextChevron},
- {"textChevronInverted", mso_sptTextChevronInverted},
- {"textRingInside", mso_sptTextRingInside},
- {"textRingOutside", mso_sptTextRingOutside},
- {"textArchUp", mso_sptTextArchUpCurve},
- {"textArchDown", mso_sptTextArchDownCurve},
- {"textCircle", mso_sptTextCircleCurve},
- {"textButton", mso_sptTextButtonCurve},
- {"textArchUpPour", mso_sptTextArchUpPour},
- {"textArchDownPour", mso_sptTextArchDownPour},
- {"textCirclePour", mso_sptTextCirclePour},
- {"textButtonPour", mso_sptTextButtonPour},
- {"textCurveUp", mso_sptTextCurveUp},
- {"textCurveDown", mso_sptTextCurveDown},
- {"textCascadeUp", mso_sptTextCascadeUp},
- {"textCascadeDown", mso_sptTextCascadeDown},
- {"textWave1", mso_sptTextWave1},
- {"textWave2", mso_sptTextWave2},
- {"textWave3", mso_sptTextWave3},
- {"textWave4", mso_sptTextWave4},
- {"textInflate", mso_sptTextInflate},
- {"textDeflate", mso_sptTextDeflate},
- {"textInflateBottom", mso_sptTextInflateBottom},
- {"textDeflateBottom", mso_sptTextDeflateBottom},
- {"textInflateTop", mso_sptTextInflateTop},
- {"textDeflateTop", mso_sptTextDeflateTop},
- {"textDeflateInflate", mso_sptTextDeflateInflate},
- {"textDeflateInflateDeflate", mso_sptTextDeflateInflateDeflate},
- {"textFadeRight", mso_sptTextFadeRight},
- {"textFadeLeft", mso_sptTextFadeLeft},
- {"textFadeUp", mso_sptTextFadeUp},
- {"textFadeDown", mso_sptTextFadeDown},
- {"textSlantUp", mso_sptTextSlantUp},
- {"textSlantDown", mso_sptTextSlantDown},
- {"textCanUp", mso_sptTextCanUp},
- {"textCanDown", mso_sptTextCanDown},
- {"flowChartAlternateProcess", mso_sptFlowChartAlternateProcess},
- {"flowChartOffpageConnector", mso_sptFlowChartOffpageConnector},
- {"callout1", mso_sptCallout90},
- {"accentCallout1", mso_sptAccentCallout90},
- {"borderCallout1", mso_sptBorderCallout90},
- {"accentBorderCallout1", mso_sptAccentBorderCallout90},
- {"leftRightUpArrow", mso_sptLeftRightUpArrow},
- {"sun", mso_sptSun},
- {"moon", mso_sptMoon},
- {"bracketPair", mso_sptBracketPair},
- {"bracePair", mso_sptBracePair},
- {"star4", mso_sptSeal4},
- {"doubleWave", mso_sptDoubleWave},
- {"actionButtonBlank", mso_sptActionButtonBlank},
- {"actionButtonHome", mso_sptActionButtonHome},
- {"actionButtonHelp", mso_sptActionButtonHelp},
- {"actionButtonInformation", mso_sptActionButtonInformation},
- {"actionButtonForwardNext", mso_sptActionButtonForwardNext},
- {"actionButtonBackPrevious", mso_sptActionButtonBackPrevious},
- {"actionButtonEnd", mso_sptActionButtonEnd},
- {"actionButtonBeginning", mso_sptActionButtonBeginning},
- {"actionButtonReturn", mso_sptActionButtonReturn},
- {"actionButtonDocument", mso_sptActionButtonDocument},
- {"actionButtonSound", mso_sptActionButtonSound},
- {"actionButtonMovie", mso_sptActionButtonMovie},
- {"hostControl", mso_sptHostControl},
- {"textBox", mso_sptTextBox},
-};
-
-const char* GetOOXMLPresetGeometry( const char* sShapeType )
-{
- typedef std::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
- static CustomShapeTypeTranslationHashMap aCustomShapeTypeTranslationHashMap = []()
- {
- CustomShapeTypeTranslationHashMap tmp;
- for(const msfilter::util::CustomShapeTypeTranslationTable& i : pCustomShapeTypeTranslationTable)
- {
- tmp[ i.sOOo ] = i.sMSO;
- }
- return tmp;
- }();
- CustomShapeTypeTranslationHashMap::iterator i(
- aCustomShapeTypeTranslationHashMap.find(sShapeType));
+ typedef std::unordered_map<std::u16string_view, OString> CustomShapeTypeTranslationHashMap;
+ static const CustomShapeTypeTranslationHashMap aCustomShapeTypeTranslationHashMap{
+ // { "non-primitive", mso_sptMin },
+ { u"frame", "frame" },
+ { u"rectangle", "rect" },
+ { u"round-rectangle", "roundRect" },
+ { u"ellipse", "ellipse" },
+ { u"diamond", "diamond" },
+ { u"isosceles-triangle", "triangle" },
+ { u"right-triangle", "rtTriangle" },
+ { u"parallelogram", "parallelogram" },
+ { u"trapezoid", "trapezoid" },
+ { u"hexagon", "hexagon" },
+ { u"octagon", "octagon" },
+ { u"cross", "plus" },
+ { u"star5", "star5" },
+ { u"right-arrow", "rightArrow" },
+ // { u"mso-spt14", mso_sptThickArrow },
+ { u"pentagon-right", "homePlate" },
+ { u"cube", "cube" },
+ // { u"mso-spt17", mso_sptBalloon },
+ // { u"mso-spt18", mso_sptSeal },
+ { u"mso-spt19", "arc" },
+ { u"mso-spt20", "line" },
+ { u"mso-spt21", "plaque" },
+ { u"can", "can" },
+ { u"ring", "donut" },
+ { u"mso-spt24", "textPlain" },
+ { u"mso-spt25", "textStop" },
+ { u"mso-spt26", "textTriangle" },
+ { u"mso-spt27", "textCanDown" },
+ { u"mso-spt28", "textWave1" },
+ { u"mso-spt29", "textArchUpPour" },
+ { u"mso-spt30", "textCanDown" },
+ { u"mso-spt31", "textArchUp" },
+ { u"mso-spt32", "straightConnector1" },
+ { u"mso-spt33", "bentConnector2" },
+ { u"mso-spt34", "bentConnector3" },
+ { u"mso-spt35", "bentConnector4" },
+ { u"mso-spt36", "bentConnector5" },
+ { u"mso-spt37", "curvedConnector2" },
+ { u"mso-spt38", "curvedConnector3" },
+ { u"mso-spt39", "curvedConnector4" },
+ { u"mso-spt40", "curvedConnector5" },
+ { u"mso-spt41", "callout1" },
+ { u"mso-spt42", "callout2" },
+ { u"mso-spt43", "callout3" },
+ { u"mso-spt44", "accentCallout1" },
+ { u"mso-spt45", "accentCallout2" },
+ { u"mso-spt46", "accentCallout3" },
+ { u"line-callout-1", "borderCallout1" },
+ { u"line-callout-2", "borderCallout2" },
+ { u"line-callout-3", "borderCallout3" },
+ { u"mso-spt49", "borderCallout3" },
+ { u"mso-spt50", "accentBorderCallout1" },
+ { u"mso-spt51", "accentBorderCallout2" },
+ { u"mso-spt52", "accentBorderCallout3" },
+ { u"mso-spt53", "ribbon" },
+ { u"mso-spt54", "ribbon2" },
+ { u"chevron", "chevron" },
+ { u"pentagon", "pentagon" },
+ { u"forbidden", "noSmoking" },
+ { u"star8", "star8" },
+ { u"mso-spt59", "star16" },
+ { u"mso-spt60", "star32" },
+ { u"rectangular-callout", "wedgeRectCallout" },
+ { u"round-rectangular-callout", "wedgeRoundRectCallout" },
+ { u"round-callout", "wedgeEllipseCallout" },
+ { u"mso-spt64", "wave" },
+ { u"paper", "foldedCorner" },
+ { u"left-arrow", "leftArrow" },
+ { u"down-arrow", "downArrow" },
+ { u"up-arrow", "upArrow" },
+ { u"left-right-arrow", "leftRightArrow" },
+ { u"up-down-arrow", "upDownArrow" },
+ { u"mso-spt71", "irregularSeal1" },
+ { u"bang", "irregularSeal2" },
+ { u"lightning", "lightningBolt" },
+ { u"heart", "heart" },
+ { u"quad-arrow", "quadArrow" },
+ { u"left-arrow-callout", "leftArrowCallout" },
+ { u"right-arrow-callout", "rightArrowCallout" },
+ { u"up-arrow-callout", "upArrowCallout" },
+ { u"down-arrow-callout", "downArrowCallout" },
+ { u"left-right-arrow-callout", "leftRightArrowCallout" },
+ { u"up-down-arrow-callout", "upDownArrowCallout" },
+ { u"quad-arrow-callout", "quadArrowCallout" },
+ { u"quad-bevel", "bevel" },
+ { u"left-bracket", "leftBracket" },
+ { u"right-bracket", "rightBracket" },
+ { u"left-brace", "leftBrace" },
+ { u"right-brace", "rightBrace" },
+ { u"mso-spt89", "leftUpArrow" },
+ { u"mso-spt90", "bentUpArrow" },
+ { u"mso-spt91", "bentArrow" },
+ { u"star24", "star24" },
+ { u"striped-right-arrow", "stripedRightArrow" },
+ { u"notched-right-arrow", "notchedRightArrow" },
+ { u"block-arc", "blockArc" },
+ { u"smiley", "smileyFace" },
+ { u"vertical-scroll", "verticalScroll" },
+ { u"horizontal-scroll", "horizontalScroll" },
+ { u"circular-arrow", "circularArrow" },
+ { u"mso-spt100", "pie" }, // looks like MSO_SPT is wrong here
+ { u"mso-spt101", "uturnArrow" },
+ { u"mso-spt102", "curvedRightArrow" },
+ { u"mso-spt103", "curvedLeftArrow" },
+ { u"mso-spt104", "curvedUpArrow" },
+ { u"mso-spt105", "curvedDownArrow" },
+ { u"cloud-callout", "cloudCallout" },
+ { u"mso-spt107", "ellipseRibbon" },
+ { u"mso-spt108", "ellipseRibbon2" },
+ { u"flowchart-process", "flowChartProcess" },
+ { u"flowchart-decision", "flowChartDecision" },
+ { u"flowchart-data", "flowChartInputOutput" },
+ { u"flowchart-predefined-process", "flowChartPredefinedProcess" },
+ { u"flowchart-internal-storage", "flowChartInternalStorage" },
+ { u"flowchart-document", "flowChartDocument" },
+ { u"flowchart-multidocument", "flowChartMultidocument" },
+ { u"flowchart-terminator", "flowChartTerminator" },
+ { u"flowchart-preparation", "flowChartPreparation" },
+ { u"flowchart-manual-input", "flowChartManualInput" },
+ { u"flowchart-manual-operation", "flowChartManualOperation" },
+ { u"flowchart-connector", "flowChartConnector" },
+ { u"flowchart-card", "flowChartPunchedCard" },
+ { u"flowchart-punched-tape", "flowChartPunchedTape" },
+ { u"flowchart-summing-junction", "flowChartSummingJunction" },
+ { u"flowchart-or", "flowChartOr" },
+ { u"flowchart-collate", "flowChartCollate" },
+ { u"flowchart-sort", "flowChartSort" },
+ { u"flowchart-extract", "flowChartExtract" },
+ { u"flowchart-merge", "flowChartMerge" },
+ { u"mso-spt129", "flowChartOfflineStorage" },
+ { u"flowchart-stored-data", "flowChartOnlineStorage" },
+ { u"flowchart-sequential-access", "flowChartMagneticTape" },
+ { u"flowchart-magnetic-disk", "flowChartMagneticDisk" },
+ { u"flowchart-direct-access-storage", "flowChartMagneticDrum" },
+ { u"flowchart-display", "flowChartDisplay" },
+ { u"flowchart-delay", "flowChartDelay" },
+ // { u"fontwork-plain-text", "textPlainText" },
+ // { u"fontwork-stop", "textStop" },
+ // { u"fontwork-triangle-up", "textTriangle" },
+ // { u"fontwork-triangle-down", "textTriangleInverted" },
+ // { u"fontwork-chevron-up", "textChevron" },
+ // { u"fontwork-chevron-down", "textChevronInverted" },
+ // { u"mso-spt142", "textRingInside" },
+ // { u"mso-spt143", "textRingOutside" },
+ // { u"fontwork-arch-up-curve", "textArchUpCurve" },
+ // { u"fontwork-arch-down-curve", "textArchDownCurve" },
+ // { u"fontwork-circle-curve", "textCircleCurve" },
+ // { u"fontwork-open-circle-curve", "textButtonCurve" },
+ // { u"fontwork-arch-up-pour", "textArchUpPour" },
+ // { u"fontwork-arch-down-pour", "textArchDownPour" },
+ // { u"fontwork-circle-pour", "textCirclePour" },
+ // { u"fontwork-open-circle-pour", "textButtonPour" },
+ // { u"fontwork-curve-up", "textCurveUp" },
+ // { u"fontwork-curve-down", "textCurveDown" },
+ // { u"fontwork-fade-up-and-right", "textCascadeUp" },
+ // { u"fontwork-fade-up-and-left", "textCascadeDown" },
+ // { u"fontwork-wave", "textWave1" },
+ // { u"mso-spt157", "textWave2" },
+ // { u"mso-spt158", "textWave3" },
+ // { u"mso-spt159", "textWave4" },
+ // { u"fontwork-inflate", "textInflate" },
+ // { u"mso-spt161", "textDeflate" },
+ // { u"mso-spt162", "textInflateBottom" },
+ // { u"mso-spt163", "textDeflateBottom" },
+ // { u"mso-spt164", "textInflateTop" },
+ // { u"mso-spt165", "textDeflateTop" },
+ // { u"mso-spt166", "textDeflateInflate" },
+ // { u"mso-spt167", "textDeflateInflateDeflate" },
+ // { u"fontwork-fade-right", "textFadeRight" },
+ // { u"fontwork-fade-left", "textFadeLeft" },
+ // { u"fontwork-fade-up", "textFadeUp" },
+ // { u"fontwork-fade-down", "textFadeDown" },
+ // { u"fontwork-slant-up", "textSlantUp" },
+ // { u"fontwork-slant-down", "textSlantDown" },
+ // { u"mso-spt174", "textCanUp" },
+ // { u"mso-spt175", "textCanDown" },
+ { u"flowchart-alternate-process", "flowChartAlternateProcess" },
+ { u"flowchart-off-page-connector", "flowChartOffpageConnector" },
+ { u"mso-spt178", "callout1" },
+ { u"mso-spt179", "accentCallout1" },
+ { u"mso-spt180", "borderCallout1" },
+ { u"mso-spt182", "leftRightUpArrow" },
+ { u"sun", "sun" },
+ { u"moon", "moon" },
+ { u"bracket-pair", "bracketPair" },
+ { u"brace-pair", "bracePair" },
+ { u"star4", "star4" },
+ { u"mso-spt188", "doubleWave" },
+ { u"mso-spt189", "actionButtonBlank" },
+ { u"mso-spt190", "actionButtonHome" },
+ { u"mso-spt191", "actionButtonHelp" },
+ { u"mso-spt192", "actionButtonInformation" },
+ { u"mso-spt193", "actionButtonForwardNext" },
+ { u"mso-spt194", "actionButtonBackPrevious" },
+ { u"mso-spt195", "actionButtonEnd" },
+ { u"mso-spt196", "actionButtonBeginning" },
+ { u"mso-spt197", "actionButtonReturn" },
+ { u"mso-spt198", "actionButtonDocument" },
+ { u"mso-spt199", "actionButtonSound" },
+ { u"mso-spt200", "actionButtonMovie" },
+ // { u"mso-spt201", "hostControl" },
+ { u"mso-spt202", "rect" },
+ { u"ooxml-actionButtonSound", "actionButtonSound" },
+ { u"ooxml-borderCallout1", "borderCallout1" },
+ { u"ooxml-plaqueTabs", "plaqueTabs" },
+ { u"ooxml-curvedLeftArrow", "curvedLeftArrow" },
+ { u"ooxml-octagon", "octagon" },
+ { u"ooxml-leftRightRibbon", "leftRightRibbon" },
+ { u"ooxml-actionButtonInformation", "actionButtonInformation" },
+ { u"ooxml-bentConnector5", "bentConnector5" },
+ { u"ooxml-circularArrow", "circularArrow" },
+ { u"ooxml-downArrowCallout", "downArrowCallout" },
+ { u"ooxml-mathMinus", "mathMinus" },
+ { u"ooxml-gear9", "gear9" },
+ { u"ooxml-round1Rect", "round1Rect" },
+ { u"ooxml-sun", "sun" },
+ { u"ooxml-plaque", "plaque" },
+ { u"ooxml-chevron", "chevron" },
+ { u"ooxml-flowChartPreparation", "flowChartPreparation" },
+ { u"ooxml-diagStripe", "diagStripe" },
+ { u"ooxml-pentagon", "pentagon" },
+ { u"ooxml-funnel", "funnel" },
+ { u"ooxml-chartStar", "chartStar" },
+ { u"ooxml-accentBorderCallout1", "accentBorderCallout1" },
+ { u"ooxml-notchedRightArrow", "notchedRightArrow" },
+ { u"ooxml-rightBracket", "rightBracket" },
+ { u"ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" },
+ { u"ooxml-leftRightArrow", "leftRightArrow" },
+ { u"ooxml-decagon", "decagon" },
+ { u"ooxml-actionButtonHelp", "actionButtonHelp" },
+ { u"ooxml-star24", "star24" },
+ { u"ooxml-mathDivide", "mathDivide" },
+ { u"ooxml-curvedConnector4", "curvedConnector4" },
+ { u"ooxml-flowChartOr", "flowChartOr" },
+ { u"ooxml-borderCallout3", "borderCallout3" },
+ { u"ooxml-upDownArrowCallout", "upDownArrowCallout" },
+ { u"ooxml-flowChartDecision", "flowChartDecision" },
+ { u"ooxml-leftRightArrowCallout", "leftRightArrowCallout" },
+ { u"ooxml-flowChartManualOperation", "flowChartManualOperation" },
+ { u"ooxml-snipRoundRect", "snipRoundRect" },
+ { u"ooxml-mathPlus", "mathPlus" },
+ { u"ooxml-actionButtonForwardNext", "actionButtonForwardNext" },
+ { u"ooxml-can", "can" },
+ { u"ooxml-foldedCorner", "foldedCorner" },
+ { u"ooxml-star32", "star32" },
+ { u"ooxml-flowChartInternalStorage", "flowChartInternalStorage" },
+ { u"ooxml-upDownArrow", "upDownArrow" },
+ { u"ooxml-irregularSeal2", "irregularSeal2" },
+ { u"ooxml-mathEqual", "mathEqual" },
+ { u"ooxml-star12", "star12" },
+ { u"ooxml-uturnArrow", "uturnArrow" },
+ { u"ooxml-squareTabs", "squareTabs" },
+ { u"ooxml-leftRightUpArrow", "leftRightUpArrow" },
+ { u"ooxml-homePlate", "homePlate" },
+ { u"ooxml-dodecagon", "dodecagon" },
+ { u"ooxml-leftArrowCallout", "leftArrowCallout" },
+ { u"ooxml-chord", "chord" },
+ { u"ooxml-quadArrowCallout", "quadArrowCallout" },
+ { u"ooxml-actionButtonBeginning", "actionButtonBeginning" },
+ { u"ooxml-ellipse", "ellipse" },
+ { u"ooxml-actionButtonEnd", "actionButtonEnd" },
+ { u"ooxml-arc", "arc" },
+ { u"ooxml-star16", "star16" },
+ { u"ooxml-parallelogram", "parallelogram" },
+ { u"ooxml-bevel", "bevel" },
+ { u"ooxml-roundRect", "roundRect" },
+ { u"ooxml-accentCallout1", "accentCallout1" },
+ { u"ooxml-flowChartSort", "flowChartSort" },
+ { u"ooxml-star8", "star8" },
+ { u"ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" },
+ { u"ooxml-moon", "moon" },
+ { u"ooxml-star6", "star6" },
+ { u"ooxml-round2SameRect", "round2SameRect" },
+ { u"ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" },
+ { u"ooxml-diamond", "diamond" },
+ { u"ooxml-ellipseRibbon", "ellipseRibbon" },
+ { u"ooxml-callout2", "callout2" },
+ { u"ooxml-pie", "pie" },
+ { u"ooxml-star4", "star4" },
+ { u"ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" },
+ { u"ooxml-flowChartPunchedTape", "flowChartPunchedTape" },
+ { u"ooxml-curvedConnector2", "curvedConnector2" },
+ { u"ooxml-bentConnector3", "bentConnector3" },
+ { u"ooxml-cornerTabs", "cornerTabs" },
+ { u"ooxml-hexagon", "hexagon" },
+ { u"ooxml-flowChartConnector", "flowChartConnector" },
+ { u"ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" },
+ { u"ooxml-heart", "heart" },
+ { u"ooxml-ribbon2", "ribbon2" },
+ { u"ooxml-bracePair", "bracePair" },
+ { u"ooxml-flowChartExtract", "flowChartExtract" },
+ { u"ooxml-actionButtonHome", "actionButtonHome" },
+ { u"ooxml-accentBorderCallout3", "accentBorderCallout3" },
+ { u"ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" },
+ { u"ooxml-irregularSeal1", "irregularSeal1" },
+ { u"ooxml-quadArrow", "quadArrow" },
+ { u"ooxml-leftBrace", "leftBrace" },
+ { u"ooxml-leftBracket", "leftBracket" },
+ { u"ooxml-blockArc", "blockArc" },
+ { u"ooxml-curvedConnector3", "curvedConnector3" },
+ { u"ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" },
+ { u"ooxml-actionButtonMovie", "actionButtonMovie" },
+ { u"ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" },
+ { u"ooxml-gear6", "gear6" },
+ { u"ooxml-halfFrame", "halfFrame" },
+ { u"ooxml-snip2SameRect", "snip2SameRect" },
+ { u"ooxml-triangle", "triangle" },
+ { u"ooxml-teardrop", "teardrop" },
+ { u"ooxml-flowChartDocument", "flowChartDocument" },
+ { u"ooxml-rightArrowCallout", "rightArrowCallout" },
+ { u"ooxml-rightBrace", "rightBrace" },
+ { u"ooxml-chartPlus", "chartPlus" },
+ { u"ooxml-flowChartManualInput", "flowChartManualInput" },
+ { u"ooxml-flowChartMerge", "flowChartMerge" },
+ { u"ooxml-line", "line" },
+ { u"ooxml-downArrow", "downArrow" },
+ { u"ooxml-upArrow", "upArrow" },
+ { u"ooxml-curvedDownArrow", "curvedDownArrow" },
+ { u"ooxml-actionButtonReturn", "actionButtonReturn" },
+ { u"ooxml-flowChartInputOutput", "flowChartInputOutput" },
+ { u"ooxml-bracketPair", "bracketPair" },
+ { u"ooxml-smileyFace", "smileyFace" },
+ { u"ooxml-actionButtonBlank", "actionButtonBlank" },
+ { u"ooxml-wave", "wave" },
+ { u"ooxml-swooshArrow", "swooshArrow" },
+ { u"ooxml-flowChartSummingJunction", "flowChartSummingJunction" },
+ { u"ooxml-lightningBolt", "lightningBolt" },
+ { u"ooxml-flowChartDisplay", "flowChartDisplay" },
+ { u"ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" },
+ { u"ooxml-frame", "frame" },
+ { u"ooxml-rtTriangle", "rtTriangle" },
+ { u"ooxml-flowChartMagneticTape", "flowChartMagneticTape" },
+ { u"ooxml-curvedRightArrow", "curvedRightArrow" },
+ { u"ooxml-leftUpArrow", "leftUpArrow" },
+ { u"ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" },
+ { u"ooxml-doubleWave", "doubleWave" },
+ { u"ooxml-bentArrow", "bentArrow" },
+ { u"ooxml-star10", "star10" },
+ { u"ooxml-leftArrow", "leftArrow" },
+ { u"ooxml-curvedUpArrow", "curvedUpArrow" },
+ { u"ooxml-snip1Rect", "snip1Rect" },
+ { u"ooxml-ellipseRibbon2", "ellipseRibbon2" },
+ { u"ooxml-plus", "plus" },
+ { u"ooxml-accentCallout3", "accentCallout3" },
+ { u"ooxml-leftCircularArrow", "leftCircularArrow" },
+ { u"ooxml-rightArrow", "rightArrow" },
+ { u"ooxml-flowChartPunchedCard", "flowChartPunchedCard" },
+ { u"ooxml-snip2DiagRect", "snip2DiagRect" },
+ { u"ooxml-verticalScroll", "verticalScroll" },
+ { u"ooxml-star7", "star7" },
+ { u"ooxml-chartX", "chartX" },
+ { u"ooxml-cloud", "cloud" },
+ { u"ooxml-cube", "cube" },
+ { u"ooxml-round2DiagRect", "round2DiagRect" },
+ { u"ooxml-flowChartMultidocument", "flowChartMultidocument" },
+ { u"ooxml-actionButtonDocument", "actionButtonDocument" },
+ { u"ooxml-flowChartTerminator", "flowChartTerminator" },
+ { u"ooxml-flowChartDelay", "flowChartDelay" },
+ { u"ooxml-curvedConnector5", "curvedConnector5" },
+ { u"ooxml-horizontalScroll", "horizontalScroll" },
+ { u"ooxml-bentConnector4", "bentConnector4" },
+ { u"ooxml-leftRightCircularArrow", "leftRightCircularArrow" },
+ { u"ooxml-wedgeRectCallout", "wedgeRectCallout" },
+ { u"ooxml-accentCallout2", "accentCallout2" },
+ { u"ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" },
+ { u"ooxml-corner", "corner" },
+ { u"ooxml-borderCallout2", "borderCallout2" },
+ { u"ooxml-donut", "donut" },
+ { u"ooxml-flowChartCollate", "flowChartCollate" },
+ { u"ooxml-mathNotEqual", "mathNotEqual" },
+ { u"ooxml-bentConnector2", "bentConnector2" },
+ { u"ooxml-mathMultiply", "mathMultiply" },
+ { u"ooxml-heptagon", "heptagon" },
+ { u"ooxml-rect", "rect" },
+ { u"ooxml-accentBorderCallout2", "accentBorderCallout2" },
+ { u"ooxml-pieWedge", "pieWedge" },
+ { u"ooxml-upArrowCallout", "upArrowCallout" },
+ { u"ooxml-flowChartProcess", "flowChartProcess" },
+ { u"ooxml-star5", "star5" },
+ { u"ooxml-lineInv", "lineInv" },
+ { u"ooxml-straightConnector1", "straightConnector1" },
+ { u"ooxml-stripedRightArrow", "stripedRightArrow" },
+ { u"ooxml-callout3", "callout3" },
+ { u"ooxml-bentUpArrow", "bentUpArrow" },
+ { u"ooxml-noSmoking", "noSmoking" },
+ { u"ooxml-trapezoid", "trapezoid" },
+ { u"ooxml-cloudCallout", "cloudCallout" },
+ { u"ooxml-callout1", "callout1" },
+ { u"ooxml-ribbon", "ribbon" },
+ { u"ooxml-rect", "rect" },
+ };
+ auto i(aCustomShapeTypeTranslationHashMap.find(rShapeType));
return i == aCustomShapeTypeTranslationHashMap.end() ? "rect" : i->second;
}
-MSO_SPT GETVMLShapeType(const OString& aType)
+MSO_SPT GETVMLShapeType(std::u16string_view aType)
{
- typedef std::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> DMLToVMLTranslationHashMap;
- static DMLToVMLTranslationHashMap aDMLToVMLMap = []()
- {
- DMLToVMLTranslationHashMap tmp;
- for (auto& i : pDMLToVMLTable)
- tmp[i.sDML] = i.nVML;
- return tmp;
- }();
-
- const char* pDML = GetOOXMLPresetGeometry(aType.getStr());
- DMLToVMLTranslationHashMap::iterator i(aDMLToVMLMap.find(pDML));
+ typedef std::unordered_map<std::string_view, MSO_SPT> DMLToVMLTranslationHashMap;
+ static const DMLToVMLTranslationHashMap aDMLToVMLMap{
+ {"notPrimitive", mso_sptNotPrimitive},
+ {"rectangle", mso_sptRectangle},
+ {"roundRectangle", mso_sptRoundRectangle},
+ {"ellipse", mso_sptEllipse},
+ {"diamond", mso_sptDiamond},
+ {"triangle", mso_sptIsocelesTriangle},
+ {"rtTriangle", mso_sptRightTriangle},
+ {"parallelogram", mso_sptParallelogram},
+ {"trapezoid", mso_sptTrapezoid},
+ {"hexagon", mso_sptHexagon},
+ {"octagon", mso_sptOctagon},
+ {"plus", mso_sptPlus},
+ {"star5", mso_sptStar},
+ {"rightArrow", mso_sptArrow},
+ {"thickArrow", mso_sptThickArrow},
+ {"homePlate", mso_sptHomePlate},
+ {"cube", mso_sptCube},
+ {"wedgeRoundRectCallout", mso_sptBalloon},
+ {"star16", mso_sptSeal},
+ {"arc", mso_sptArc},
+ {"line", mso_sptLine},
+ {"plaque", mso_sptPlaque},
+ {"can", mso_sptCan},
+ {"donut", mso_sptDonut},
+ {"textPlain", mso_sptTextSimple},
+ {"textStop", mso_sptTextOctagon},
+ {"textTriangle", mso_sptTextHexagon},
+ {"textCanDown", mso_sptTextCurve},
+ {"textWave1", mso_sptTextWave},
+ {"textArchUpPour", mso_sptTextRing},
+ {"textCanDown", mso_sptTextOnCurve},
+ {"textArchUp", mso_sptTextOnRing},
+ {"straightConnector1", mso_sptStraightConnector1},
+ {"bentConnector2", mso_sptBentConnector2},
+ {"bentConnector3", mso_sptBentConnector3},
+ {"bentConnector4", mso_sptBentConnector4},
+ {"bentConnector5", mso_sptBentConnector5},
+ {"curvedConnector2", mso_sptCurvedConnector2},
+ {"curvedConnector3", mso_sptCurvedConnector3},
+ {"curvedConnector4", mso_sptCurvedConnector4},
+ {"curvedConnector5", mso_sptCurvedConnector5},
+ {"callout1", mso_sptCallout1},
+ {"callout2", mso_sptCallout2},
+ {"callout3", mso_sptCallout3},
+ {"accentCallout1", mso_sptAccentCallout1},
+ {"accentCallout2", mso_sptAccentCallout2},
+ {"accentCallout3", mso_sptAccentCallout3},
+ {"borderCallout1", mso_sptBorderCallout1},
+ {"borderCallout2", mso_sptBorderCallout2},
+ {"borderCallout3", mso_sptBorderCallout3},
+ {"accentBorderCallout1", mso_sptAccentBorderCallout1},
+ {"accentBorderCallout2", mso_sptAccentBorderCallout2},
+ {"accentBorderCallout3", mso_sptAccentBorderCallout3},
+ {"ribbon", mso_sptRibbon},
+ {"ribbon2", mso_sptRibbon2},
+ {"chevron", mso_sptChevron},
+ {"pentagon", mso_sptPentagon},
+ {"noSmoking", mso_sptNoSmoking},
+ {"star8", mso_sptSeal8},
+ {"star16", mso_sptSeal16},
+ {"star32", mso_sptSeal32},
+ {"wedgeRectCallout", mso_sptWedgeRectCallout},
+ {"wedgeRoundRectCallout", mso_sptWedgeRRectCallout},
+ {"wedgeEllipseCallout", mso_sptWedgeEllipseCallout},
+ {"wave", mso_sptWave},
+ {"foldedCorner", mso_sptFoldedCorner},
+ {"leftArrow", mso_sptLeftArrow},
+ {"downArrow", mso_sptDownArrow},
+ {"upArrow", mso_sptUpArrow},
+ {"leftRightArrow", mso_sptLeftRightArrow},
+ {"upDownArrow", mso_sptUpDownArrow},
+ {"irregularSeal1", mso_sptIrregularSeal1},
+ {"irregularSeal2", mso_sptIrregularSeal2},
+ {"lightningBolt", mso_sptLightningBolt},
+ {"heart", mso_sptHeart},
+ {"pictureFrame", mso_sptPictureFrame},
+ {"quadArrow", mso_sptQuadArrow},
+ {"leftArrowCallout", mso_sptLeftArrowCallout},
+ {"rightArrowCallout", mso_sptRightArrowCallout},
+ {"upArrowCallout", mso_sptUpArrowCallout},
+ {"downArrowCallout", mso_sptDownArrowCallout},
+ {"leftRightArrowCallout", mso_sptLeftRightArrowCallout},
+ {"upDownArrowCallout", mso_sptUpDownArrowCallout},
+ {"quadArrowCallout", mso_sptQuadArrowCallout},
+ {"bevel", mso_sptBevel},
+ {"leftBracket", mso_sptLeftBracket},
+ {"rightBracket", mso_sptRightBracket},
+ {"leftBrace", mso_sptLeftBrace},
+ {"rightBrace", mso_sptRightBrace},
+ {"leftUpArrow", mso_sptLeftUpArrow},
+ {"bentUpArrow", mso_sptBentUpArrow},
+ {"bentArrow", mso_sptBentArrow},
+ {"star24", mso_sptSeal24},
+ {"stripedRightArrow", mso_sptStripedRightArrow},
+ {"notchedRightArrow", mso_sptNotchedRightArrow},
+ {"blockArc", mso_sptBlockArc},
+ {"smileyFace", mso_sptSmileyFace},
+ {"verticalScroll", mso_sptVerticalScroll},
+ {"horizontalScroll", mso_sptHorizontalScroll},
+ {"circularArrow", mso_sptCircularArrow},
+ {"notchedCircularArrow", mso_sptNotchedCircularArrow},
+ {"uturnArrow", mso_sptUturnArrow},
+ {"curvedRightArrow", mso_sptCurvedRightArrow},
+ {"curvedLeftArrow", mso_sptCurvedLeftArrow},
+ {"curvedUpArrow", mso_sptCurvedUpArrow},
+ {"curvedDownArrow", mso_sptCurvedDownArrow},
+ {"cloudCallout", mso_sptCloudCallout},
+ {"ellipseRibbon", mso_sptEllipseRibbon},
+ {"ellipseRibbon2", mso_sptEllipseRibbon2},
+ {"flowChartProcess", mso_sptFlowChartProcess},
+ {"flowChartDecision", mso_sptFlowChartDecision},
+ {"flowChartInputOutput", mso_sptFlowChartInputOutput},
+ {"flowChartPredefinedProcess", mso_sptFlowChartPredefinedProcess},
+ {"flowChartInternalStorage", mso_sptFlowChartInternalStorage},
+ {"flowChartDocument", mso_sptFlowChartDocument},
+ {"flowChartMultidocument", mso_sptFlowChartMultidocument},
+ {"flowChartTerminator", mso_sptFlowChartTerminator},
+ {"flowChartPreparation", mso_sptFlowChartPreparation},
+ {"flowChartManualInput", mso_sptFlowChartManualInput},
+ {"flowChartManualOperation", mso_sptFlowChartManualOperation},
+ {"flowChartConnector", mso_sptFlowChartConnector},
+ {"flowChartPunchedCard", mso_sptFlowChartPunchedCard},
+ {"flowChartPunchedTape", mso_sptFlowChartPunchedTape},
+ {"flowChartSummingJunction", mso_sptFlowChartSummingJunction},
+ {"flowChartOr", mso_sptFlowChartOr},
+ {"flowChartCollate", mso_sptFlowChartCollate},
+ {"flowChartSort", mso_sptFlowChartSort},
+ {"flowChartExtract", mso_sptFlowChartExtract},
+ {"flowChartMerge", mso_sptFlowChartMerge},
+ {"flowChartOfflineStorage", mso_sptFlowChartOfflineStorage},
+ {"flowChartOnlineStorage", mso_sptFlowChartOnlineStorage},
+ {"flowChartMagneticTape", mso_sptFlowChartMagneticTape},
+ {"flowChartMagneticDisk", mso_sptFlowChartMagneticDisk},
+ {"flowChartMagneticDrum", mso_sptFlowChartMagneticDrum},
+ {"flowChartDisplay", mso_sptFlowChartDisplay},
+ {"flowChartDelay", mso_sptFlowChartDelay},
+ {"textPlain", mso_sptTextPlainText},
+ {"textStop", mso_sptTextStop},
+ {"textTriangle", mso_sptTextTriangle},
+ {"textTriangleInverted", mso_sptTextTriangleInverted},
+ {"textChevron", mso_sptTextChevron},
+ {"textChevronInverted", mso_sptTextChevronInverted},
+ {"textRingInside", mso_sptTextRingInside},
+ {"textRingOutside", mso_sptTextRingOutside},
+ {"textArchUp", mso_sptTextArchUpCurve},
+ {"textArchDown", mso_sptTextArchDownCurve},
+ {"textCircle", mso_sptTextCircleCurve},
+ {"textButton", mso_sptTextButtonCurve},
+ {"textArchUpPour", mso_sptTextArchUpPour},
+ {"textArchDownPour", mso_sptTextArchDownPour},
+ {"textCirclePour", mso_sptTextCirclePour},
+ {"textButtonPour", mso_sptTextButtonPour},
+ {"textCurveUp", mso_sptTextCurveUp},
+ {"textCurveDown", mso_sptTextCurveDown},
+ {"textCascadeUp", mso_sptTextCascadeUp},
+ {"textCascadeDown", mso_sptTextCascadeDown},
+ {"textWave1", mso_sptTextWave1},
+ {"textWave2", mso_sptTextWave2},
+ {"textWave3", mso_sptTextWave3},
+ {"textWave4", mso_sptTextWave4},
+ {"textInflate", mso_sptTextInflate},
+ {"textDeflate", mso_sptTextDeflate},
+ {"textInflateBottom", mso_sptTextInflateBottom},
+ {"textDeflateBottom", mso_sptTextDeflateBottom},
+ {"textInflateTop", mso_sptTextInflateTop},
+ {"textDeflateTop", mso_sptTextDeflateTop},
+ {"textDeflateInflate", mso_sptTextDeflateInflate},
+ {"textDeflateInflateDeflate", mso_sptTextDeflateInflateDeflate},
+ {"textFadeRight", mso_sptTextFadeRight},
+ {"textFadeLeft", mso_sptTextFadeLeft},
+ {"textFadeUp", mso_sptTextFadeUp},
+ {"textFadeDown", mso_sptTextFadeDown},
+ {"textSlantUp", mso_sptTextSlantUp},
+ {"textSlantDown", mso_sptTextSlantDown},
+ {"textCanUp", mso_sptTextCanUp},
+ {"textCanDown", mso_sptTextCanDown},
+ {"flowChartAlternateProcess", mso_sptFlowChartAlternateProcess},
+ {"flowChartOffpageConnector", mso_sptFlowChartOffpageConnector},
+ {"callout1", mso_sptCallout90},
+ {"accentCallout1", mso_sptAccentCallout90},
+ {"borderCallout1", mso_sptBorderCallout90},
+ {"accentBorderCallout1", mso_sptAccentBorderCallout90},
+ {"leftRightUpArrow", mso_sptLeftRightUpArrow},
+ {"sun", mso_sptSun},
+ {"moon", mso_sptMoon},
+ {"bracketPair", mso_sptBracketPair},
+ {"bracePair", mso_sptBracePair},
+ {"star4", mso_sptSeal4},
+ {"doubleWave", mso_sptDoubleWave},
+ {"actionButtonBlank", mso_sptActionButtonBlank},
+ {"actionButtonHome", mso_sptActionButtonHome},
+ {"actionButtonHelp", mso_sptActionButtonHelp},
+ {"actionButtonInformation", mso_sptActionButtonInformation},
+ {"actionButtonForwardNext", mso_sptActionButtonForwardNext},
+ {"actionButtonBackPrevious", mso_sptActionButtonBackPrevious},
+ {"actionButtonEnd", mso_sptActionButtonEnd},
+ {"actionButtonBeginning", mso_sptActionButtonBeginning},
+ {"actionButtonReturn", mso_sptActionButtonReturn},
+ {"actionButtonDocument", mso_sptActionButtonDocument},
+ {"actionButtonSound", mso_sptActionButtonSound},
+ {"actionButtonMovie", mso_sptActionButtonMovie},
+ {"hostControl", mso_sptHostControl},
+ {"textBox", mso_sptTextBox},
+ };
+
+ auto i(aDMLToVMLMap.find(GetOOXMLPresetGeometry(aType)));
return i == aDMLToVMLMap.end() ? mso_sptNil : i->second;
}
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index c1a3c94d5a85..bd8db83692a0 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -271,6 +271,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
GetOKButton().set_label(sOkButtonText);
GetCancelButton().connect_clicked(LINK(this, ImpPDFTabDialog, CancelHdl));
+ GetOKButton().connect_clicked(LINK(this, ImpPDFTabDialog, OkHdl));
// remove the reset button, not needed in this tabbed dialog
RemoveResetButton();
@@ -313,10 +314,45 @@ IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl, weld::Button&, void)
m_xDialog->response(RET_CANCEL);
}
+IMPL_LINK_NOARG(ImpPDFTabDialog, OkHdl, weld::Button&, void)
+{
+ if (getGeneralPage()->IsPdfUaSelected())
+ {
+ SfxObjectShell* pShell = SfxObjectShell::GetShellFromComponent(mrDoc);
+ if (pShell)
+ {
+ sfx::AccessibilityIssueCollection aCollection = pShell->runAccessibilityCheck();
+ if (!aCollection.getIssues().empty())
+ {
+ mpAccessibilityCheckDialog = std::make_shared<svx::AccessibilityCheckDialog>(mpParent, aCollection);
+ weld::DialogController::runAsync(mpAccessibilityCheckDialog, [this](sal_Int32 retValue){
+ m_xDialog->response(retValue);
+ });
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+}
+
ImpPDFTabDialog::~ImpPDFTabDialog()
{
maConfigItem.WriteModifiedConfig();
maConfigI18N.WriteModifiedConfig();
+ if (mpAccessibilityCheckDialog)
+ {
+ mpAccessibilityCheckDialog->response(RET_CANCEL);
+ }
}
void ImpPDFTabDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
@@ -345,26 +381,6 @@ void ImpPDFTabDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
}
}
-short ImpPDFTabDialog::Ok( )
-{
- // here the whole mechanism of the base class is not used
- // when Ok is hit, the user means 'convert to PDF', so simply close with ok
-
- if (getGeneralPage()->IsPdfUaSelected())
- {
- SfxObjectShell* pShell = SfxObjectShell::GetShellFromComponent(mrDoc);
- if (pShell)
- {
- sfx::AccessibilityIssueCollection aCollection = pShell->runAccessibilityCheck();
- if (!aCollection.getIssues().empty())
- {
- svx::AccessibilityCheckDialog aDialog(mpParent, aCollection);
- return aDialog.run();
- }
- }
- }
- return RET_OK;
-}
Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
{
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 9682adbc111d..219d47e6d613 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <sfx2/tabdlg.hxx>
+#include <svx/AccessibilityCheckDialog.hxx>
#include <vcl/pdfwriter.hxx>
#include <vcl/FilterConfigItem.hxx>
@@ -66,6 +67,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
Any maSelection;
DECL_LINK(CancelHdl, weld::Button&, void);
+ DECL_LINK(OkHdl, weld::Button&, void);
// the following data are the configuration used throughout the dialog and pages
bool mbIsPresentation;
@@ -123,6 +125,8 @@ class ImpPDFTabDialog final : public SfxTabDialogController
bool mbCanExtractForAccessibility;
css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords;
+ std::shared_ptr< svx::AccessibilityCheckDialog > mpAccessibilityCheckDialog;
+
bool mbIsRangeChecked;
OUString msPageRange;
bool mbSelectionIsChecked;
@@ -163,7 +167,6 @@ public:
private:
virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
- virtual short Ok() override;
};
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::Reference<util::XBinaryDataContainer
BitmapEx aReplacement(aBitmaps[0]);
// short form for scale and translate transformation
- const Size aDPI(
- Application::GetDefaultDevice()->LogicToPixel(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{
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 604326b4bdbf..e2c072a146b7 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -38,6 +38,7 @@
#include <unotools/configmgr.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <officecfg/Office/Common.hxx>
#include "pdfexport.hxx"
#include <strings.hrc>
@@ -60,6 +61,7 @@
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/beans/XMaterialHolder.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <memory>
@@ -398,6 +400,25 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
return aDocMimetype;
}
+uno::Reference<security::XCertificate>
+PDFExport::GetCertificateFromSubjectName(const std::u16string_view& rSubjectName) const
+{
+ uno::Reference<xml::crypto::XSEInitializer> xSEInitializer
+ = xml::crypto::SEInitializer::create(mxContext);
+ uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext
+ = xSEInitializer->createSecurityContext(OUString());
+ uno::Reference<xml::crypto::XSecurityEnvironment> xSecurityEnvironment
+ = xSecurityContext->getSecurityEnvironment();
+ for (const auto& xCertificate : xSecurityEnvironment->getPersonalCertificates())
+ {
+ if (xCertificate->getSubjectName() == rSubjectName)
+ {
+ return xCertificate;
+ }
+ }
+
+ return {};
+}
bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData )
{
@@ -459,12 +480,18 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
}
}
// getting the string for the producer
- aContext.DocumentInfo.Producer =
- utl::ConfigManager::getProductName() +
- " " +
- utl::ConfigManager::getProductVersion();
+ OUString aProducerOverride = officecfg::Office::Common::Save::Document::GeneratorOverride::get();
+ if( !aProducerOverride.isEmpty())
+ aContext.DocumentInfo.Producer = aProducerOverride;
+ else
+ aContext.DocumentInfo.Producer =
+ utl::ConfigManager::getProductName() +
+ " " +
+ utl::ConfigManager::getProductVersion();
+
aContext.DocumentInfo.Creator = aCreator;
+ OUString aSignCertificateSubjectName;
for ( const beans::PropertyValue& rProp : rFilterData )
{
if ( rProp.Name == "PageRange" )
@@ -584,6 +611,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
rProp.Value >>= msSignPassword;
else if ( rProp.Name == "SignatureCertificate" )
rProp.Value >>= maSignCertificate;
+ else if (rProp.Name == "SignCertificateSubjectName")
+ rProp.Value >>= aSignCertificateSubjectName;
else if ( rProp.Name == "SignatureTSA" )
rProp.Value >>= msSignTSA;
else if ( rProp.Name == "ExportPlaceholders" )
@@ -595,6 +624,11 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
rProp.Value >>= mbIsRedactMode;
}
+ if (!maSignCertificate.is() && !aSignCertificateSubjectName.isEmpty())
+ {
+ maSignCertificate = GetCertificateFromSubjectName(aSignCertificateSubjectName);
+ }
+
aContext.URL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
// set the correct version, depending on user request
@@ -912,14 +946,14 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
xViewProperties->getPropertyValue( sShowOnlineLayout ) >>= bReChangeToNormalView;
if( bReChangeToNormalView )
{
- xViewProperties->setPropertyValue( sShowOnlineLayout, uno::makeAny( false ) );
+ xViewProperties->setPropertyValue( sShowOnlineLayout, uno::Any( false ) );
}
// Also, disable hide-whitespace during export.
xViewProperties->getPropertyValue(sHideWhitespace) >>= bReHideWhitespace;
if (bReHideWhitespace)
{
- xViewProperties->setPropertyValue(sHideWhitespace, uno::makeAny(false));
+ xViewProperties->setPropertyValue(sHideWhitespace, uno::Any(false));
}
}
catch( const uno::Exception& )
@@ -982,7 +1016,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
{
try
{
- xViewProperties->setPropertyValue( sShowOnlineLayout, uno::makeAny( true ) );
+ xViewProperties->setPropertyValue( sShowOnlineLayout, uno::Any( true ) );
}
catch( const uno::Exception& )
{
@@ -992,7 +1026,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
{
try
{
- xViewProperties->setPropertyValue( sHideWhitespace, uno::makeAny( true ) );
+ xViewProperties->setPropertyValue( sHideWhitespace, uno::Any( true ) );
}
catch( const uno::Exception& )
{
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index 967668e7421b..12d43ada945e 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -35,19 +35,14 @@ class Size;
namespace vcl { class PDFWriter; }
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-
class PDFExport
{
private:
- Reference< XComponent > mxSrcDoc;
- Reference< uno::XComponentContext > mxContext;
- Reference< task::XStatusIndicator > mxStatusIndicator;
- Reference< task::XInteractionHandler > mxIH;
+ css::uno::Reference< css::lang::XComponent > mxSrcDoc;
+ css::uno::Reference< css::uno::XComponentContext > mxContext;
+ css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
+ css::uno::Reference< css::task::XInteractionHandler > mxIH;
bool mbUseTaggedPDF;
sal_Int32 mnPDFTypeSelection;
@@ -115,29 +110,30 @@ private:
OUString msSignContact;
OUString msSignReason;
OUString msSignPassword;
- Reference< security::XCertificate > maSignCertificate;
+ css::uno::Reference< css::security::XCertificate > maSignCertificate;
OUString msSignTSA;
void ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize );
void ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize );
+ css::uno::Reference<css::security::XCertificate> GetCertificateFromSubjectName(const std::u16string_view& rSubjectName) const;
public:
- PDFExport( const Reference< XComponent >& rxSrcDoc,
- const Reference< task::XStatusIndicator >& xStatusIndicator,
- const Reference< task::XInteractionHandler >& xIH,
- const Reference< uno::XComponentContext >& xFact );
+ PDFExport( const css::uno::Reference< css::lang::XComponent >& rxSrcDoc,
+ const css::uno::Reference< css::task::XStatusIndicator >& xStatusIndicator,
+ const css::uno::Reference< css::task::XInteractionHandler >& xIH,
+ const css::uno::Reference< css::uno::XComponentContext >& xFact );
~PDFExport();
bool ExportSelection( vcl::PDFWriter& rPDFWriter,
- Reference< css::view::XRenderable > const & rRenderable,
- const Any& rSelection,
+ css::uno::Reference< css::view::XRenderable > const & rRenderable,
+ const css::uno::Any& rSelection,
const StringRangeEnumerator& rRangeEnum,
- Sequence< PropertyValue >& rRenderOptions,
+ css::uno::Sequence< css::beans::PropertyValue >& rRenderOptions,
sal_Int32 nPageCount );
- bool Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData );
+ bool Export( const OUString& rFile, const css::uno::Sequence< css::beans::PropertyValue >& rFilterData );
void showErrors( const std::set<vcl::PDFWriter::ErrorCode>& );
};
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 6d1a793a7158..d7fc558d198e 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -30,6 +30,9 @@
#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/propertysequence.hxx>
+#include <comphelper/sequence.hxx>
+
using namespace ::com::sun::star::io;
PDFFilter::PDFFilter( const Reference< XComponentContext > &rxContext ) :
@@ -47,6 +50,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
{
Reference< XOutputStream > xOStm;
Sequence< PropertyValue > aFilterData;
+ OUString aFilterOptions;
sal_Int32 nLength = rDescriptor.getLength();
const PropertyValue* pValue = rDescriptor.getConstArray();
bool bIsRedactMode = false;
@@ -60,6 +64,8 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
pValue[ i ].Value >>= xOStm;
else if ( pValue[ i ].Name == "FilterData" )
pValue[ i ].Value >>= aFilterData;
+ else if ( pValue[ i ].Name == "FilterOptions" )
+ pValue[ i ].Value >>= aFilterOptions;
else if ( pValue[ i ].Name == "StatusIndicator" )
pValue[ i ].Value >>= xStatusIndicator;
else if ( pValue[i].Name == "InteractionHandler" )
@@ -72,6 +78,13 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
pValue[i].Value >>= bIsRedactMode;
}
+ if (!aFilterData.hasElements() && !aFilterOptions.isEmpty())
+ {
+ // Allow setting filter data keys from the cmdline.
+ std::vector<PropertyValue> aData = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8());
+ aFilterData = comphelper::containerToSequence(aData);
+ }
+
/* we don't get FilterData if we are exporting directly
to pdf, but we have to use the last user settings (especially for the CompressMode) */
if ( !aFilterData.hasElements() )
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 636fc3a50d37..370bacc5cd72 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -18622,8 +18622,8 @@ SlideShow.prototype.exitSlideShowInApp = function()
{
if (window.webkit !== undefined &&
window.webkit.messageHandlers !== undefined &&
- window.webkit.messageHandlers.lool !== undefined)
- window.webkit.messageHandlers.lool.postMessage('EXITSLIDESHOW', '*');
+ window.webkit.messageHandlers.cool !== undefined)
+ window.webkit.messageHandlers.cool.postMessage('EXITSLIDESHOW', '*');
}
SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index ef0c1ea37a80..c21b041b1bbc 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -796,7 +796,9 @@ bool SVGFilter::implExportWriterTextGraphic( const Reference< view::XSelectionSu
const Graphic aOriginalGraphic(xOriginalGraphic);
uno::Reference<graphic::XGraphic> xTransformedGraphic;
- xPropertySet->getPropertyValue("TransformedGraphic") >>= xTransformedGraphic;
+ xPropertySet->getPropertyValue(
+ mbIsPreview ? OUString("GraphicPreview") : OUString("TransformedGraphic"))
+ >>= xTransformedGraphic;
if (!xTransformedGraphic.is())
return false;
@@ -971,6 +973,8 @@ bool SVGFilter::implExportDocument()
mpSVGWriter->SetEmbeddedBitmapRefs( &maBitmapActionMap );
implExportTiledBackground();
}
+ if( mbIsPreview )
+ mpSVGWriter->SetPreviewMode();
// #i124608# export a given object selection, so no MasterPage export at all
if (!mbExportShapeSelection)
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 4c3f033d02eb..4538e50213fc 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -77,6 +77,7 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
mnVisiblePage( -1 ),
mpObjects( nullptr ),
mbExportShapeSelection(false),
+ mbIsPreview(false),
mbWriterFilter(false),
mbCalcFilter(false),
mbImpressFilter(false),
@@ -108,6 +109,15 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
for (const PropertyValue& rProp : rDescriptor)
{
+ if (rProp.Name == "IsPreview")
+ {
+ rProp.Value >>= mbIsPreview;
+ break;
+ }
+ }
+
+ for (const PropertyValue& rProp : rDescriptor)
+ {
if (rProp.Name == "FilterName")
{
OUString sFilterName;
@@ -221,7 +231,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
GraphicFilter aGraphicFilter;
Graphic aGraphic;
const ErrCode nGraphicFilterErrorCode(
- aGraphicFilter.ImportGraphic(aGraphic, OUString(), *aStream));
+ aGraphicFilter.ImportGraphic(aGraphic, u"", *aStream));
if(ERRCODE_NONE != nGraphicFilterErrorCode)
{
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index eb889e81662e..93e14ec41671 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -209,6 +209,7 @@ private:
Sequence< PropertyValue > maFilterData;
Reference< css::drawing::XDrawPage > mxDefaultPage;
std::vector< Reference< css::drawing::XDrawPage > > mSelectedPages;
+ bool mbIsPreview;
bool mbWriterFilter;
bool mbCalcFilter;
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index b0cbed97e4e7..7e75d65e6bc2 100644
--- a/filter/source/svg/svgfontexport.cxx
+++ b/filter/source/svg/svgfontexport.cxx
@@ -29,6 +29,7 @@
#include <vcl/settings.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <xmloff/namespacemap.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/XBreakIterator.hpp>
@@ -307,9 +308,9 @@ void SVGFontExport::EmbedFonts()
}
-OUString SVGFontExport::GetMappedFontName( const OUString& rFontName ) const
+OUString SVGFontExport::GetMappedFontName( std::u16string_view rFontName ) const
{
- OUString aRet( rFontName.getToken( 0, ';' ) );
+ OUString aRet( o3tl::getToken(rFontName, 0, ';' ) );
if( mnCurFontId )
aRet += " embedded";
diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx
index 6492ebd9c04c..259196f9e031 100644
--- a/filter/source/svg/svgfontexport.hxx
+++ b/filter/source/svg/svgfontexport.hxx
@@ -66,7 +66,7 @@ public:
~SVGFontExport();
void EmbedFonts();
- OUString GetMappedFontName( const OUString& rFontName ) const;
+ OUString GetMappedFontName( std::u16string_view rFontName ) const;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index e066806cea9a..9f889924cfb6 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -37,6 +37,7 @@
#include <xmloff/namespacemap.hxx>
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
@@ -301,8 +302,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
{
const double fCenterX = rObjRect.Left() + rObjRect.GetWidth() * rGradient.GetOfsX() * 0.01;
const double fCenterY = rObjRect.Top() + rObjRect.GetHeight() * rGradient.GetOfsY() * 0.01;
- const double fRadius = sqrt( static_cast< double >( rObjRect.GetWidth() ) * rObjRect.GetWidth() +
- rObjRect.GetHeight() * rObjRect.GetHeight() ) * 0.5;
+ const double fRadius = std::hypot(rObjRect.GetWidth(), rObjRect.GetHeight()) * 0.5;
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrGradientUnits, "userSpaceOnUse" );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, OUString::number( ImplRound( fCenterX ) ) );
@@ -1099,7 +1099,19 @@ bool SVGTextWriter::nextParagraph()
const OUString& rParagraphId = implGetValidIDFromInterface( Reference<XInterface>(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;
}
@@ -1775,6 +1787,9 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
}
else
{
+ // Without the following attribute Google Chrome does not render leading spaces
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "style", "white-space: pre" );
+
SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
mrExport.GetDocHandler()->characters( rText );
}
@@ -1796,7 +1811,8 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport
mpVDev(VclPtr<VirtualDevice>::Create()),
mbClipAttrChanged( false ),
mbIsPlaceholderShape( false ),
- mpEmbeddedBitmapsMap( nullptr )
+ mpEmbeddedBitmapsMap( nullptr ),
+ mbIsPreview( false )
{
mpVDev->EnableOutput( false );
maTargetMapMode = MapMode(MapUnit::Map100thMM);
@@ -2930,7 +2946,27 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
}
}
- if( !(bCached || GraphicConverter::Export( aOStm, rBmpEx, ConvertDataFormat::PNG ) == ERRCODE_NONE) )
+ const BitmapEx* pBitmap = &rBmpEx;
+ std::unique_ptr<BitmapEx> pNewBitmap;
+
+ // for preview we generate downscaled images (1280x720 max)
+ if (mbIsPreview)
+ {
+ Size aSize = rBmpEx.GetSizePixel();
+ double fX = static_cast<double>(aSize.getWidth()) / 1280;
+ double fY = static_cast<double>(aSize.getHeight()) / 720;
+ double fFactor = fX > fY ? fX : fY;
+ if (fFactor > 1.0)
+ {
+ aSize.setWidth(aSize.getWidth() / fFactor);
+ aSize.setHeight(aSize.getHeight() / fFactor);
+ pNewBitmap = std::make_unique<BitmapEx>(rBmpEx);
+ pNewBitmap->Scale(aSize);
+ pBitmap = pNewBitmap.get();
+ }
+ }
+
+ if( !(bCached || GraphicConverter::Export( aOStm, *pBitmap, ConvertDataFormat::PNG ) == ERRCODE_NONE) )
return;
Point aPt;
@@ -3490,7 +3526,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
}
- if(mapCurShape && mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || aEndArrow.Count()))
+ if (mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || aEndArrow.Count()))
{
ImplWriteShape( *mapCurShape );
@@ -3666,7 +3702,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
// Both the pattern and the rectangle are embedded in a <defs> element.
// The comment content has the following format: "SLIDE_BACKGROUND <background-id>"
const OString& sComment = pA->GetComment();
- OUString sRefId = "#" + OUString::fromUtf8( sComment.getToken(1, ' ') );
+ OUString sRefId = "#" + OUString::fromUtf8( o3tl::getToken(sComment, 1, ' ') );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, sRefId );
SvXMLElementExport aRefElem( mrExport, XML_NAMESPACE_NONE, "use", true, true );
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index fdfcd24d32b2..d48d68bdec72 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -318,6 +318,7 @@ private:
bool mbClipAttrChanged;
bool mbIsPlaceholderShape;
const MetaBitmapActionMap* mpEmbeddedBitmapsMap;
+ bool mbIsPreview;
tools::Long ImplMap( sal_Int32 nVal ) const;
@@ -377,6 +378,7 @@ public:
void SetEmbeddedBitmapRefs( const MetaBitmapActionMap* pEmbeddedBitmapsMap );
void StartMask(const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient,
sal_uInt32 nWriteFlags, OUString* pTextStyle = nullptr);
+ void SetPreviewMode(bool bState = true) { mbIsPreview = bState; }
};
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index f8fc5cb865eb..9d25e289ec89 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -20,8 +20,6 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <memory>
-#include <sfx2/fcontnr.hxx>
-#include <sfx2/docfilt.hxx>
constexpr OUStringLiteral WRITER_TEXT_FILTER = u"Text";
constexpr OUStringLiteral CALC_TEXT_FILTER = u"Text - txt - csv (StarCalc)";
@@ -129,40 +127,6 @@ bool IsHTMLStream( const uno::Reference<io::XInputStream>& xInStream )
OString aToken = sHeader.copy( nStartOfTagIndex, i - nStartOfTagIndex );
return GetHTMLToken( OStringToOUString( aToken.toAsciiLowerCase(), RTL_TEXTENCODING_ASCII_US ) ) != HtmlTokenId::NONE;
}
-
-/**
- * Given an (empty) file URL in rMediaDesc and rExt, looks up the best filter type for it and
- * writes the type name to rType, the filter name to rMediaDesc.
- */
-bool HandleEmptyFileUrlByExtension(MediaDescriptor& rMediaDesc, const OUString& rExt,
- OUString& rType, OUString& rService)
-{
- OUString aURL = rMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString());
- if (!tools::isEmptyFileUrl(aURL))
- {
- return false;
- }
-
- if (rExt.isEmpty())
- {
- return false;
- }
-
- // 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<const SfxFilter> pFilter(SfxFilterMatcher().GetFilter4Extension(rExt, nMust));
- if (!pFilter)
- {
- return false;
- }
-
- rMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= pFilter->GetFilterName();
- rType = pFilter->GetTypeName();
- rService = pFilter->GetServiceName();
- return true;
-}
}
PlainTextFilterDetect::PlainTextFilterDetect() {}
@@ -221,15 +185,7 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
OUString aName = aParser.getName().toAsciiLowerCase();
// Decide which filter to use based on the document service first,
- // then on extension if that's not available. Make exception for 0-byte files
- // whose extensions are handled by the same service as passed document service.
- OUString aEmptyType, aEmptyService;
- bool bEmpty = HandleEmptyFileUrlByExtension(aMediaDesc, aExt, aEmptyType, aEmptyService);
- if (bEmpty && aDocService == aEmptyService)
- {
- aDocService.clear(); // don't fallback to text filter, use extension-based match
- // TODO: maybe reset aExt when it's "xls"
- }
+ // then on extension if that's not available.
if (aDocService == CALC_DOCSERVICE)
aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(CALC_TEXT_FILTER);
@@ -237,8 +193,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal
aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_TEXT_FILTER);
else if (aExt == "csv" || aExt == "tsv" || aExt == "tab" || aExt == "xls" || aName.endsWith(".csv.gz"))
aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(CALC_TEXT_FILTER);
- else if (bEmpty)
- aType = aEmptyType; // aMediaDesc is already updated in HandleEmptyFileUrlByExtension
else
aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_TEXT_FILTER);
}
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index c4fb3eef20cd..93c6c892f589 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -80,18 +80,17 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
}
// create an XProperty set to configure the exporter for pretty printing
- PropertyMapEntry aImportInfoMap[] =
+ static const PropertyMapEntry aImportInfoMap[] =
{
{ OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0},
{ OUString("BuildId"), 0, ::cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString("DefaultDocumentSettings"), 0,
::cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::MAYBEVOID, 0 },
- { OUString(), 0, css::uno::Type(), 0, 0 }
};
Reference< XPropertySet > xInfoSet(
GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) );
- xInfoSet->setPropertyValue( "BaseURI", makeAny( aBaseURI ));
+ xInfoSet->setPropertyValue( "BaseURI", Any( aBaseURI ));
OUString aFilterName;
auto It = aMediaMap.find(OUString("FilterName"));
@@ -101,7 +100,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
PropertyValue EmptyDbFieldHidesPara("EmptyDbFieldHidesPara", 0, Any(false),
PropertyState::PropertyState_DIRECT_VALUE);
Sequence<PropertyValue> aSettings{ EmptyDbFieldHidesPara };
- xInfoSet->setPropertyValue("DefaultDocumentSettings", makeAny(aSettings));
+ xInfoSet->setPropertyValue("DefaultDocumentSettings", Any(aSettings));
}
Sequence< Any > aAnys{ Any(xInfoSet) };
@@ -280,21 +279,20 @@ bool XmlFilterAdaptor::exportImpl( const Sequence< css::beans::PropertyValue >&
}
// create an XProperty set to configure the exporter for pretty printing
- PropertyMapEntry aImportInfoMap[] =
+ static const PropertyMapEntry aImportInfoMap[] =
{
{ OUString("UsePrettyPrinting"), 0, cppu::UnoType<sal_Bool>::get(), PropertyAttribute::MAYBEVOID, 0},
{ OUString("ExportTextNumberElement"), 0, cppu::UnoType<sal_Bool>::get(), PropertyAttribute::MAYBEVOID, 0},
{ OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0},
- { OUString(), 0, css::uno::Type(), 0, 0 }
};
Reference< XPropertySet > xInfoSet(
GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap ) ) );
- xInfoSet->setPropertyValue("UsePrettyPrinting", makeAny( bPrettyPrint ));
+ xInfoSet->setPropertyValue("UsePrettyPrinting", Any( bPrettyPrint ));
xInfoSet->setPropertyValue(
"ExportTextNumberElement",
- makeAny( bExportTextNumberElementForListItems ));
- xInfoSet->setPropertyValue("BaseURI", makeAny( aBaseURI ));
+ Any( bExportTextNumberElementForListItems ));
+ xInfoSet->setPropertyValue("BaseURI", Any( aBaseURI ));
Sequence < Any > aAnys{ Any(xConverter), Any(xInfoSet) };
Reference< XExporter > xExporter( mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
index 1a3f80cb589a..e7cab3323fca 100644
--- a/filter/source/xmlfilterdetect/filterdetect.cxx
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -28,6 +28,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <svl/inettype.hxx>
#include <memory>
+#include <o3tl/string_view.hxx>
using namespace com::sun::star::container;
using namespace com::sun::star::uno;
@@ -35,13 +36,13 @@ using namespace com::sun::star::beans;
namespace {
-OUString supportedByType( const OUString& clipBoardFormat, const OUString& resultString, const OUString& checkType)
+OUString supportedByType( std::u16string_view clipBoardFormat, std::u16string_view resultString, const OUString& checkType)
{
OUString sTypeName;
- if ( clipBoardFormat.match("doctype:") )
+ if ( o3tl::starts_with(clipBoardFormat, u"doctype:") )
{
- OUString tryStr = clipBoardFormat.copy(8);
- if (resultString.indexOf(tryStr) >= 0)
+ std::u16string_view tryStr = clipBoardFormat.substr(8);
+ if (resultString.find(tryStr) != std::u16string_view::npos)
{
sTypeName = checkType;
}
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
index bba302de703c..be5766927fbc 100644
--- a/filter/source/xsltdialog/typedetectionimport.cxx
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <tools/diagnose_ex.h>
#include <rtl/ref.hxx>
+#include <o3tl/string_view.hxx>
#include "typedetectionimport.hxx"
#include "xmlfiltercommon.hxx"
@@ -80,18 +81,18 @@ void TypeDetectionImporter::fillFilterVector( std::vector< std::unique_ptr<filt
maTypeNodes.clear();
}
-static OUString getSubdata( int index, sal_Unicode delimiter, const OUString& rData )
+static std::u16string_view getSubdata( int index, sal_Unicode delimiter, std::u16string_view rData )
{
sal_Int32 nLastIndex = 0;
- sal_Int32 nNextIndex = rData.indexOf( delimiter );
+ size_t nNextIndex = rData.find( delimiter );
- OUString aSubdata;
+ std::u16string_view aSubdata;
while( index )
{
- nLastIndex = nNextIndex + 1;
- nNextIndex = rData.indexOf( delimiter, nLastIndex );
+ nLastIndex = nNextIndex == std::u16string_view::npos ? 0 : nNextIndex + 1;
+ nNextIndex = rData.find( delimiter, nLastIndex );
index--;
@@ -99,13 +100,13 @@ static OUString getSubdata( int index, sal_Unicode delimiter, const OUString& rD
return aSubdata;
}
- if( nNextIndex == -1 )
+ if( nNextIndex == std::u16string_view::npos )
{
- aSubdata = rData.copy( nLastIndex );
+ aSubdata = rData.substr( nLastIndex );
}
else
{
- aSubdata = rData.copy( nLastIndex, nNextIndex - nLastIndex );
+ aSubdata = rData.substr( nLastIndex, nNextIndex - nLastIndex );
}
return aSubdata;
@@ -135,16 +136,16 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No
pFilter->maType = getSubdata( 1, aComma, aData );
pFilter->maDocumentService = getSubdata( 2, aComma, aData );
- OUString aFilterService( getSubdata( 3, aComma, aData ) );
- pFilter->maFlags = getSubdata( 4, aComma, aData ).toInt32();
+ std::u16string_view aFilterService( getSubdata( 3, aComma, aData ) );
+ pFilter->maFlags = o3tl::toInt32(getSubdata( 4, aComma, aData ));
// parse filter user data
sal_Unicode aDelim(';');
- OUString aFilterUserData( getSubdata( 5, aComma, aData ) );
+ std::u16string_view aFilterUserData( getSubdata( 5, aComma, aData ) );
- OUString aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) );
+ std::u16string_view aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) );
//Import/ExportService
- pFilter->mbNeedsXSLT2 = getSubdata( 1, aDelim, aFilterUserData ).toBoolean();
+ pFilter->mbNeedsXSLT2 = OUString(getSubdata( 1, aDelim, aFilterUserData )).toBoolean();
pFilter->maImportService = getSubdata( 2, aDelim, aFilterUserData );
pFilter->maExportService = getSubdata( 3, aDelim, aFilterUserData );
pFilter->maImportXSLT = getSubdata( 4, aDelim, aFilterUserData );
@@ -161,7 +162,7 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No
pFilter->maDocType = getSubdata( 2, aComma, aTypeUserData );
pFilter->maExtension = getSubdata( 4, aComma, aTypeUserData );
- pFilter->mnDocumentIconID = getSubdata( 5, aComma, aTypeUserData ).toInt32();
+ pFilter->mnDocumentIconID = o3tl::toInt32(getSubdata( 5, aComma, aTypeUserData ));
}
bool bOk = true;
@@ -181,10 +182,10 @@ std::unique_ptr<filter_info_impl> TypeDetectionImporter::createFilterForNode( No
if( pFilter->maFlags == 0 )
bOk = false;
- if( aFilterService != "com.sun.star.comp.Writer.XmlFilterAdaptor" )
+ if( aFilterService != u"com.sun.star.comp.Writer.XmlFilterAdaptor" )
bOk = false;
- if( aAdapterService != "com.sun.star.documentconversion.XSLTFilter" )
+ if( aAdapterService != u"com.sun.star.documentconversion.XSLTFilter" )
bOk = false;
if( pFilter->maExtension.isEmpty() )
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx
index 0d340fa12e0f..4ac225183e60 100644
--- a/filter/source/xsltdialog/xmlfiltercommon.hxx
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -30,7 +30,7 @@ extern OUString string_encode( const OUString & rText );
extern OUString string_decode( const OUString & rText );
bool copyStreams( const css::uno::Reference< css::io::XInputStream >& xIS, const css::uno::Reference< css::io::XOutputStream >& xOS );
-bool createDirectory( OUString const & rURL );
+bool createDirectory( std::u16string_view rURL );
class filter_info_impl
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index e3c8d6239a83..2366aa80e825 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -109,7 +109,7 @@ static void addFile_( Reference< XInterface > const & xRootFolder, Reference< XS
if( xSink.is() && xTunnel.is())
{
Reference< XNameContainer > xNameContainer(xRootFolder, UNO_QUERY );
- xNameContainer->insertByName(encodeZipUri( aName ), makeAny(xTunnel));
+ xNameContainer->insertByName(encodeZipUri( aName ), Any(xTunnel));
xSink->setInputStream( xInput );
}
}
@@ -299,7 +299,7 @@ bool XMLFilterJarHelper::copyFiles( const Reference< XHierarchicalNameAccess >&
return bOk;
}
-bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& xIfc, OUString& rURL, const OUString& rTargetURL )
+bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& xIfc, OUString& rURL, std::u16string_view rTargetURL )
{
if( !rURL.matchIgnoreAsciiCase( sVndSunStarPackage ) )
return true;
@@ -308,8 +308,8 @@ bool XMLFilterJarHelper::copyFile( const Reference< XHierarchicalNameAccess >& x
{
OUString szPackagePath( encodeZipUri( rURL.copy( sVndSunStarPackage.getLength() ) ) );
- if ( ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, ".." )
- || ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, "." ) )
+ if ( ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, u".." )
+ || ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, u"." ) )
throw lang::IllegalArgumentException();
if( xIfc->hasByHierarchicalName( szPackagePath ) )
diff --git a/filter/source/xsltdialog/xmlfilterjar.hxx b/filter/source/xsltdialog/xmlfilterjar.hxx
index 1d8e52fc3e18..d634bb6c4d24 100644
--- a/filter/source/xsltdialog/xmlfilterjar.hxx
+++ b/filter/source/xsltdialog/xmlfilterjar.hxx
@@ -39,7 +39,7 @@ private:
/// @throws css::uno::Exception
void addFile( css::uno::Reference< css::uno::XInterface > const & xRootFolder, css::uno::Reference< css::lang::XSingleServiceFactory > const & xFactory, const OUString& rSourceFile );
- static bool copyFile( const css::uno::Reference< css::container::XHierarchicalNameAccess >& xIfc, OUString& rURL, const OUString& rTargetURL );
+ static bool copyFile( const css::uno::Reference< css::container::XHierarchicalNameAccess >& xIfc, OUString& rURL, std::u16string_view rTargetURL );
bool copyFiles( const css::uno::Reference< css::container::XHierarchicalNameAccess >& xIfc, filter_info_impl* pFilter );
css::uno::Reference< css::uno::XComponentContext > mxContext;
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 8a0d901cb6e6..62a8513d72c3 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <comphelper/propertyvalue.hxx>
+#include <o3tl/string_view.hxx>
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <unotools/pathoptions.hxx>
@@ -183,7 +184,7 @@ void XMLFilterSettingsDialog::updateStates()
bool bIsDefault = false;
if (bHasSelection)
{
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(aRows[0]).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(aRows[0]));
bIsReadonly = pInfo->mbReadonly;
for( auto nFact : o3tl::enumrange<SvtModuleOptions::EFactory>())
@@ -232,7 +233,7 @@ void XMLFilterSettingsDialog::onNew()
void XMLFilterSettingsDialog::onEdit()
{
// get selected filter info
- filter_info_impl* pOldInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64());
+ filter_info_impl* pOldInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_selected_id());
if (!pOldInfo)
return;
@@ -368,7 +369,7 @@ OUString XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rIn
{
// if yes, make sure we generate a unique name with a higher number
// this is dump but fast
- sal_Int32 nNumber = aInterfaceName.copy( rInterfaceName.getLength() ).toInt32();
+ sal_Int32 nNumber = o3tl::toInt32(aInterfaceName.subView( rInterfaceName.getLength() ));
if( nNumber >= nDefaultNumber )
nDefaultNumber = nNumber + 1;
}
@@ -513,7 +514,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
// 4. insert new or replace existing filter
try
{
- Any aAny( makeAny( aFilterData ) );
+ Any aAny( aFilterData );
if( mxFilterContainer->hasByName( pFilterEntry->maFilterName ) )
{
mxFilterContainer->replaceByName( pFilterEntry->maFilterName, aAny );
@@ -566,7 +567,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
{
try
{
- Any aAny( makeAny( aValues ) );
+ Any aAny( aValues );
if( mxTypeDetection->hasByName( pFilterEntry->maType ) )
{
mxTypeDetection->replaceByName( pFilterEntry->maType, aAny );
@@ -676,7 +677,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
aSequenceRange[nIndex].Value <<= aTypes;
- mxExtendedTypeDetection->replaceByName( sFilterDetectService, makeAny( aSequence ) );
+ mxExtendedTypeDetection->replaceByName( sFilterDetectService, Any( aSequence ) );
Reference< XFlushable > xFlushable( mxExtendedTypeDetection, UNO_QUERY );
if( xFlushable.is() )
@@ -713,7 +714,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
void XMLFilterSettingsDialog::onTest()
{
// get the first selected filter
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_selected_id());
if (pInfo)
{
XMLFilterTestDialog aDlg(m_xDialog.get(), mxContext);
@@ -726,7 +727,7 @@ void XMLFilterSettingsDialog::onDelete()
int nIndex = m_xFilterListBox->get_selected_index();
if (nIndex == -1)
return;
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nIndex).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(nIndex));
if (pInfo)
{
OUString aMessage(XsltResId(STR_WARN_DELETE));
@@ -821,7 +822,7 @@ void XMLFilterSettingsDialog::onSave()
int nFilters = 0;
m_xFilterListBox->selected_foreach([&](weld::TreeIter& rEntry){
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(rEntry).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(rEntry));
aFilters.push_back(pInfo);
++nFilters;
return false;
@@ -1209,7 +1210,7 @@ OUString getApplicationUIName( std::u16string_view rServiceName )
void XMLFilterSettingsDialog::addFilterEntry( const filter_info_impl* pInfo )
{
int nRow = m_xFilterListBox->n_children();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo)));
+ OUString sId(weld::toId(pInfo));
m_xFilterListBox->append(sId, pInfo->maFilterName);
m_xFilterListBox->set_text(nRow, getEntryString(pInfo), 1);
}
@@ -1219,7 +1220,7 @@ void XMLFilterSettingsDialog::changeEntry( const filter_info_impl* pInfo )
const int nCount = m_xFilterListBox->n_children();
for(int nPos = 0; nPos < nCount; ++nPos)
{
- filter_info_impl* pEntry = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nPos).toInt64());
+ filter_info_impl* pEntry = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(nPos));
if (pEntry == pInfo)
{
m_xFilterListBox->set_text(nPos, pInfo->maFilterName, 0);
@@ -1306,26 +1307,12 @@ Sequence< OUString > filter_info_impl::getFilterUserData() const
OUString string_encode( const OUString & rText )
{
- static sal_Bool const uricNoSlash[] = {
- false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false,
- false, true, false, false, true, false, true, true, // !"#$%&'
- true, true, true, true, false, true, true, false, // ()*+,-./
- true, true, true, true, true, true, true, true, // 01234567
- true, true, true, false, false, true, false, true, // 89:;<=>?
- true, true, true, true, true, true, true, true, // @ABCDEFG
- true, true, true, true, true, true, true, true, // HIJKLMNO
- true, true, true, true, true, true, true, true, // PQRSTUVW
- true, true, true, false, false, false, false, true, // XYZ[\]^_
- false, true, true, true, true, true, true, true, // `abcdefg
- true, true, true, true, true, true, true, true, // hijklmno
- true, true, true, true, true, true, true, true, // pqrstuvw
- true, true, true, false, false, false, true, false}; // xyz{|}~
-
-
- return Uri::encode( rText, uricNoSlash, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
+ static constexpr auto uricNoSlash = rtl::createUriCharClass(
+ u8"!$&'()*+-.0123456789:=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~");
+
+
+ return
+ Uri::encode( rText, uricNoSlash.data(), rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8 );
}
OUString string_decode( const OUString & rText )
@@ -1370,15 +1357,15 @@ bool copyStreams( const Reference< XInputStream >& xIS, const Reference< XOutput
return false;
}
-bool createDirectory( OUString const & rURL )
+bool createDirectory( std::u16string_view rURL )
{
- sal_Int32 nLastIndex = sizeof( "file:///" ) - 2;
- while( nLastIndex != -1 )
+ size_t nLastIndex = sizeof( "file:///" ) - 2;
+ while( nLastIndex != std::u16string_view::npos )
{
- nLastIndex = rURL.indexOf( '/', nLastIndex + 1);
- if( nLastIndex != -1 )
+ nLastIndex = rURL.find( '/', nLastIndex + 1);
+ if( nLastIndex != std::u16string_view::npos )
{
- OUString aDirURL( rURL.copy( 0, nLastIndex ) );
+ OUString aDirURL( rURL.substr( 0, nLastIndex ) );
Directory aDir( aDirURL );
Directory::RC rc = aDir.open();
if( rc == Directory::E_NOENT )
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 6cbea30926fb..ca38ab547c26 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -199,7 +199,7 @@ void XMLFilterTestDialog::test( const filter_info_impl& rFilterInfo )
m_xDialog->run();
}
-static OUString getFileNameFromURL( OUString const & rURL )
+static OUString getFileNameFromURL( std::u16string_view rURL )
{
INetURLObject aURL( rURL );
OUString aName( aURL.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset) );
@@ -419,14 +419,14 @@ void XMLFilterTestDialog::doExport( const Reference< XComponent >& xComp )
if( xStorable.is() )
{
OUString const ext(".xml");
- utl::TempFile aTempFile(OUString(), true, &ext);
+ utl::TempFile aTempFile(u"", true, &ext);
OUString aTempFileURL( aTempFile.GetURL() );
const application_info_impl* pAppInfo = getApplicationInfo( m_xFilterInfo->maExportService );
if( pAppInfo )
{
File aOutputFile( aTempFileURL );
- /* File::RC rc = */ aOutputFile.open( osl_File_OpenFlag_Write );
+ (void)aOutputFile.open( osl_File_OpenFlag_Write );
// create xslt exporter
Reference< XOutputStream > xIS( new comphelper::OSLOutputStreamWrapper( aOutputFile ) );
@@ -579,14 +579,14 @@ void XMLFilterTestDialog::import( const OUString& rURL )
if( m_xCBXDisplaySource->get_active() )
{
OUString const ext(".xml");
- TempFile aTempFile(OUString(), true, &ext);
+ TempFile aTempFile(u"", true, &ext);
OUString aTempFileURL( aTempFile.GetURL() );
Reference< XImportFilter > xImporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY );
if( xImporter.is() )
{
osl::File aInputFile( rURL );
- aInputFile.open( osl_File_OpenFlag_Read );
+ (void)aInputFile.open( osl_File_OpenFlag_Read );
Reference< XInputStream > xIS( new comphelper::OSLInputStreamWrapper( aInputFile ) );
@@ -599,7 +599,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
Reference< XWriter > xWriter = Writer::create( mxContext );
File aOutputFile( aTempFileURL );
- aOutputFile.open( osl_File_OpenFlag_Write );
+ (void)aOutputFile.open( osl_File_OpenFlag_Write );
Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
xWriter->setOutputStream( xOS );
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 862b4bf56b11..844e3c341a7c 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -868,7 +868,7 @@
<property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="emptypages-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|emptypages">If switched on, automatically inserted blank pages are exported to the PDF file. This is best if you are printing the pdf file double-sided. Example: In a book a chapter paragraph style is set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to export that even numbered page or not.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|emptypages">If switched on, automatically inserted blank pages are exported to the PDF file. This is best if you are printing the pdf file double-sided. Example: In a book a chapter paragraph style is set to always start with an odd numbered page. If the previous chapter ends on an odd page, then an even numbered blank page is normally automatically inserted. This option controls whether to export that even numbered page or not.</property>
</object>
</child>
</object>
diff --git a/filter/uiconfig/ui/warnpdfdialog.ui b/filter/uiconfig/ui/warnpdfdialog.ui
index 6ff3a2bc097b..21b455f00e99 100644
--- a/filter/uiconfig/ui/warnpdfdialog.ui
+++ b/filter/uiconfig/ui/warnpdfdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.2 -->
+<!-- Generated with glade 3.38.2 -->
<interface domain="flt">
<requires lib="gtk+" version="3.20"/>
<object class="GtkTreeStore" id="liststore1">
@@ -13,78 +13,77 @@
</columns>
</object>
<object class="GtkMessageDialog" id="WarnPDFDialog">
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <property name="type">popup</property>
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
<property name="title" translatable="yes" context="warnpdfdialog|WarnPDFDialog">Problems During PDF Export</property>
<property name="resizable">False</property>
<property name="modal">True</property>
- <property name="type_hint">dialog</property>
- <property name="skip_taskbar_hint">True</property>
- <property name="message_type">warning</property>
+ <property name="type-hint">dialog</property>
+ <property name="skip-taskbar-hint">True</property>
+ <property name="message-type">warning</property>
<property name="buttons">ok</property>
<property name="text" translatable="yes" context="warnpdfdialog|WarnPDFDialog">During PDF export the following problems occurred:</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="column_spacing">12</property>
- <property name="column_homogeneous">True</property>
+ <property name="column-spacing">12</property>
+ <property name="column-homogeneous">True</property>
<child>
<object class="GtkLabel" id="message">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="wrap">True</property>
- <property name="width_chars">30</property>
- <property name="max_width_chars">30</property>
+ <property name="width-chars">30</property>
+ <property name="max-width-chars">30</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="shadow_type">in</property>
+ <property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="errors">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- <property name="search_column">1</property>
- <property name="show_expanders">False</property>
+ <property name="headers-visible">False</property>
+ <property name="headers-clickable">False</property>
+ <property name="search-column">1</property>
+ <property name="show-expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
@@ -112,8 +111,8 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
</object>
@@ -125,8 +124,5 @@
</child>
</object>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</interface>
diff --git a/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui b/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui
index 6dda773f7daf..f2e4f381af1e 100644
--- a/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui
+++ b/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui
@@ -116,7 +116,7 @@
<property name="truncate-multiline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="extension-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="xmlfiltertabpagegeneral|extended_tip|extension">Enter the file extension to use when you open a file without specifying a filter. %PRODUCTNAME uses the file extension to determine which filter to use.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="xmlfiltertabpagegeneral|extended_tip|extension">Enter the file extension to use when you open a file without specifying a filter. The file extension to used to determine which filter to use.</property>
</object>
</child>
</object>