summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/Configuration_filter.mk48
-rw-r--r--filter/CppunitTest_filter_pdf.mk49
-rw-r--r--filter/CppunitTest_filter_svg.mk1
-rw-r--r--filter/CppunitTest_filter_textfilterdetect.mk6
-rw-r--r--filter/IwyuFilter_filter.yaml3
-rw-r--r--filter/Library_filterconfig.mk1
-rw-r--r--filter/Library_icg.mk6
-rw-r--r--filter/Library_msfilter.mk5
-rw-r--r--filter/Library_t602filter.mk1
-rw-r--r--filter/Library_xmlfa.mk5
-rw-r--r--filter/Library_xmlfd.mk1
-rw-r--r--filter/Module_filter.mk1
-rw-r--r--filter/inc/strings.hrc23
-rw-r--r--filter/inc/strings.hxx18
-rw-r--r--filter/qa/complex/filter/detection/typeDetection/files.csv1
-rw-r--r--filter/qa/cppunit/msfilter-test.cxx2
-rw-r--r--filter/qa/cppunit/priority-test.cxx13
-rw-r--r--filter/qa/cppunit/xslt-test.cxx28
-rw-r--r--filter/qa/data/commentsInMargin.odtbin0 -> 9938 bytes
-rw-r--r--filter/qa/data/picture.pdfbin0 -> 13829 bytes
-rw-r--r--filter/qa/pdf.cxx373
-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/hybrid_calc.pdfbin0 -> 10420 bytes
-rw-r--r--filter/qa/unit/data/hybrid_impress.pdfbin0 -> 21055 bytes
-rw-r--r--filter/qa/unit/data/hybrid_writer.pdfbin0 -> 10732 bytes
-rw-r--r--filter/qa/unit/data/impress.otpbin0 -> 15382 bytes
-rw-r--r--filter/qa/unit/data/semi-transparent-fill.odgbin0 -> 10597 bytes
-rw-r--r--filter/qa/unit/data/text-in-image.odpbin0 -> 13584 bytes
-rw-r--r--filter/qa/unit/data/writer.ottbin0 -> 10017 bytes
-rw-r--r--filter/qa/unit/svg.cxx277
-rw-r--r--filter/qa/unit/textfilterdetect.cxx227
-rw-r--r--filter/source/config/cache/basecontainer.cxx170
-rw-r--r--filter/source/config/cache/basecontainer.hxx24
-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.cxx25
-rw-r--r--filter/source/config/cache/cacheupdatelistener.hxx8
-rw-r--r--filter/source/config/cache/configflush.cxx38
-rw-r--r--filter/source/config/cache/configflush.hxx11
-rw-r--r--filter/source/config/cache/constant.hxx138
-rw-r--r--filter/source/config/cache/contenthandlerfactory.cxx7
-rw-r--r--filter/source/config/cache/filtercache.cxx263
-rw-r--r--filter/source/config/cache/filtercache.hxx18
-rw-r--r--filter/source/config/cache/filterfactory.cxx73
-rw-r--r--filter/source/config/cache/filterfactory.hxx4
-rw-r--r--filter/source/config/cache/frameloaderfactory.cxx7
-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.cxx256
-rw-r--r--filter/source/config/cache/typedetection.hxx29
-rw-r--r--filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu30
-rw-r--r--filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.xcu30
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97.xcu2
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu2
-rw-r--r--filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu2
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML.xcu3
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu3
-rw-r--r--filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu3
-rw-r--r--filter/source/config/fragments/filters/OOXML_Text.xcu4
-rw-r--r--filter/source/config/fragments/filters/OOXML_Text_Template.xcu4
-rw-r--r--filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu30
-rw-r--r--filter/source/config/fragments/filters/WEBP___WebP.xcu30
-rw-r--r--filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.xcu30
-rw-r--r--filter/source/config/fragments/filters/calc_Parquet.xcu19
-rw-r--r--filter/source/config/fragments/filters/calc_webp_Export.xcu20
-rw-r--r--filter/source/config/fragments/filters/draw_apng_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/draw_emz_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/draw_html_Export.xcu4
-rw-r--r--filter/source/config/fragments/filters/draw_svgz_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/draw_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/draw_wmz_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/impress_html_Export.xcu4
-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/apng_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu27
-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/internalgraphicfilters/wmz_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu27
-rw-r--r--filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu29
-rw-r--r--filter/source/config/fragments/types/calc_Parquet.xcu17
-rw-r--r--filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu29
-rw-r--r--filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu2
-rw-r--r--filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu2
-rw-r--r--filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu29
-rw-r--r--filter/source/config/fragments/types/webp_WebP.xcu29
-rw-r--r--filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.xcu29
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu2
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu2
-rw-r--r--filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu2
-rw-r--r--filter/source/config/fragments/types/writer_OOXML.xcu2
-rw-r--r--filter/source/config/fragments/types/writer_OOXML_Template.xcu2
-rw-r--r--filter/source/config/tools/merge/FCFGMerge.cfg4
-rw-r--r--filter/source/graphic/GraphicExportFilter.cxx9
-rw-r--r--filter/source/graphic/GraphicExportFilter.hxx2
-rw-r--r--filter/source/graphicfilter/icgm/actimpr.cxx11
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx38
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.hxx6
-rw-r--r--filter/source/graphicfilter/icgm/cgm.cxx11
-rw-r--r--filter/source/graphicfilter/icgm/cgm.hxx1
-rw-r--r--filter/source/graphicfilter/icgm/class1.cxx3
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx46
-rw-r--r--filter/source/msfilter/countryid.cxx2
-rw-r--r--filter/source/msfilter/dffpropset.cxx4
-rw-r--r--filter/source/msfilter/escherex.cxx153
-rw-r--r--filter/source/msfilter/eschesdo.cxx52
-rw-r--r--filter/source/msfilter/eschesdo.hxx2
-rw-r--r--filter/source/msfilter/mscodec.cxx5
-rw-r--r--filter/source/msfilter/msdffimp.cxx649
-rw-r--r--filter/source/msfilter/msocximex.cxx5
-rw-r--r--filter/source/msfilter/msoleexp.cxx47
-rw-r--r--filter/source/msfilter/mstoolbar.cxx11
-rw-r--r--filter/source/msfilter/msvbahelper.cxx254
-rw-r--r--filter/source/msfilter/rtfutil.cxx41
-rw-r--r--filter/source/msfilter/svdfppt.cxx530
-rw-r--r--filter/source/msfilter/svxmsbas2.cxx8
-rw-r--r--filter/source/msfilter/util.cxx1301
-rw-r--r--filter/source/msfilter/viscache.hxx2
-rw-r--r--filter/source/odfflatxml/OdfFlatXml.cxx4
-rw-r--r--filter/source/pdf/impdialog.cxx517
-rw-r--r--filter/source/pdf/impdialog.hxx43
-rw-r--r--filter/source/pdf/pdfdecomposer.cxx16
-rw-r--r--filter/source/pdf/pdfdialog.cxx27
-rw-r--r--filter/source/pdf/pdfdialog.hxx13
-rw-r--r--filter/source/pdf/pdfexport.cxx646
-rw-r--r--filter/source/pdf/pdfexport.hxx87
-rw-r--r--filter/source/pdf/pdffilter.cxx54
-rw-r--r--filter/source/storagefilterdetect/filterdetect.cxx62
-rw-r--r--filter/source/storagefilterdetect/filterdetect.hxx2
-rw-r--r--filter/source/svg/gentoken.py2
-rw-r--r--filter/source/svg/presentation_engine.js487
-rw-r--r--filter/source/svg/svgexport.cxx238
-rw-r--r--filter/source/svg/svgfilter.cxx197
-rw-r--r--filter/source/svg/svgfilter.hxx11
-rw-r--r--filter/source/svg/svgfontexport.cxx12
-rw-r--r--filter/source/svg/svgfontexport.hxx2
-rw-r--r--filter/source/svg/svgwriter.cxx533
-rw-r--r--filter/source/svg/svgwriter.hxx21
-rw-r--r--filter/source/t602/t602filter.cxx85
-rw-r--r--filter/source/t602/t602filter.hxx21
-rw-r--r--filter/source/textfilterdetect/filterdetect.cxx64
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx25
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx5
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx11
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.hxx5
-rw-r--r--filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl2
-rw-r--r--filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl4
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/body.xsl2
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl71
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl17
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table.xsl4
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl5
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl27
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl469
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/header.xsl35
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl11
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/table.xsl6
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx65
-rw-r--r--filter/source/xsltdialog/typedetectionimport.cxx35
-rw-r--r--filter/source/xsltdialog/xmlfiltercommon.hxx4
-rw-r--r--filter/source/xsltdialog/xmlfilterdialogcomponent.cxx104
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx28
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.hxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx101
-rw-r--r--filter/source/xsltdialog/xmlfiltertabdialog.cxx7
-rw-r--r--filter/source/xsltdialog/xmlfiltertabpagexslt.cxx3
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx20
-rw-r--r--filter/source/xsltfilter/LibXSLTTransformer.cxx14
-rw-r--r--filter/source/xsltfilter/LibXSLTTransformer.hxx4
-rw-r--r--filter/source/xsltfilter/OleHandler.cxx20
-rw-r--r--filter/source/xsltfilter/OleHandler.hxx5
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx60
-rw-r--r--filter/uiconfig/ui/pdfgeneralpage.ui105
-rw-r--r--filter/uiconfig/ui/pdflinkspage.ui5
-rw-r--r--filter/uiconfig/ui/pdfviewpage.ui270
-rw-r--r--filter/uiconfig/ui/warnpdfdialog.ui58
-rw-r--r--filter/uiconfig/ui/xmlfiltertabpagegeneral.ui118
184 files changed, 7122 insertions, 4238 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index dfeacc6a542c..b2d3b09689f0 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -294,6 +294,7 @@ $(eval $(call filter_Configuration_add_others,fcfg_langpack,fcfg_base_others.xcu
contenthandlers/com_sun_star_comp_framework_oxt_handler \
))
+ifneq ($(ENABLE_WASM_STRIP_DBACCESS),TRUE)
# fcfg_database
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_database_types.xcu,filter/source/config/fragments/types,\
StarBase \
@@ -306,7 +307,9 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_database_filte
$(eval $(call filter_Configuration_add_others,fcfg_langpack,fcfg_database_others.xcu,filter/source/config/fragments,\
frameloaders/org_openoffice_comp_dbflt_DBContentLoader2 \
))
+endif
+ifeq ($(ENABLE_REPORTBUILDER),TRUE)
# fcfg_reportbuilder
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_reportbuilder_types.xcu,filter/source/config/fragments/types,\
StarBaseReport \
@@ -317,6 +320,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_reportbuilder_
StarBaseReport \
StarBaseReportChart \
))
+endif
# fcfg_writer
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu,filter/source/config/fragments/types,\
@@ -442,6 +446,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 \
))
@@ -476,6 +481,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,f
generic_Text \
calc_Gnumeric \
calc_Lotus \
+ calc_Parquet \
calc_QPro \
calc_MS_Excel_40 \
calc_MS_Excel_40_VorlageTemplate \
@@ -534,6 +540,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.x
calc_HTML_WebQuery \
calc_StarOffice_XML_Calc_Template \
calc_pdf_Export \
+ calc_Parquet \
dBase \
calc8 \
calc8_template \
@@ -557,6 +564,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.x
MS_Multiplan \
))
+ifneq ($(ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS),TRUE)
# fcfg_draw
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,filter/source/config/fragments/types,\
draw_ODG_FlatXML \
@@ -655,6 +663,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filter
MWAW_Presentation \
PowerPoint3 \
))
+endif
# fcfg_chart
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_chart_types.xcu,filter/source/config/fragments/types,\
@@ -671,6 +680,7 @@ $(eval $(call filter_Configuration_add_others,fcfg_langpack,fcfg_chart_others.xc
frameloaders/com_sun_star_comp_chart2_ChartFrameLoader \
))
+ifneq ($(ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS),TRUE)
# fcfg_math
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_math_types.xcu,filter/source/config/fragments/types,\
math_MathML_XML_Math \
@@ -687,12 +697,14 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_math_filters.x
math_pdf_Export \
math8 \
))
+endif
# fcfg_drawgraphics
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_types.xcu,filter/source/config/fragments/types,\
bmp_MS_Windows \
dxf_AutoCAD_Interchange \
emf_MS_Windows_Metafile \
+ emz_Compressed_MS_Windows_Metafile \
eps_Encapsulated_PostScript \
gif_Graphics_Interchange \
graphic_HTML \
@@ -712,18 +724,23 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ
ras_Sun_Rasterfile \
svg_Scalable_Vector_Graphics_Draw \
svg_Scalable_Vector_Graphics \
+ svgz_Compressed_Scalable_Vector_Graphics \
svm_StarView_Metafile \
tga_Truevision_TARGA \
tif_Tag_Image_File \
+ webp_WebP \
wmf_MS_Windows_Metafile \
+ wmz_Compressed_MS_Windows_Metafile \
xbm_X_Consortium \
xpm_XPM \
))
$(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_filters.xcu,filter/source/config/fragments/filters,\
+ APNG___Animated_Portable_Network_Graphic \
BMP___MS_Windows \
DXF___AutoCAD_Interchange \
EMF___MS_Windows_Metafile \
+ EMZ___Compressed_MS_Windows_Metafile \
EPS___Encapsulated_PostScript \
GIF___Graphics_Interchange \
JPG___JPEG \
@@ -739,31 +756,40 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
RAS___Sun_Rasterfile \
SVG___Scalable_Vector_Graphics_Draw \
SVG___Scalable_Vector_Graphics \
+ SVGZ___Compressed_Scalable_Vector_Graphics \
SVM___StarView_Metafile \
TGA___Truevision_TARGA \
TIF___Tag_Image_File \
+ WEBP___WebP \
WMF___MS_Windows_Metafile \
+ WMZ___Compressed_MS_Windows_Metafile \
XBM___X_Consortium \
XPM \
draw_PCD_Photo_CD_Base \
draw_PCD_Photo_CD_Base16 \
draw_PCD_Photo_CD_Base4 \
+ draw_apng_Export \
draw_bmp_Export \
draw_emf_Export \
+ draw_emz_Export \
draw_eps_Export \
draw_gif_Export \
draw_html_Export \
draw_jpg_Export \
draw_png_Export \
draw_svg_Export \
+ draw_svgz_Export \
draw_tif_Export \
+ draw_webp_Export \
draw_wmf_Export \
+ draw_wmz_Export \
))
# fcfg_impressgraphics
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impressgraphics_types.xcu,filter/source/config/fragments/types,\
bmp_MS_Windows \
emf_MS_Windows_Metafile \
+ emz_Compressed_MS_Windows_Metafile \
eps_Encapsulated_PostScript \
gif_Graphics_Interchange \
graphic_HTML \
@@ -778,9 +804,12 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impressgraphics_
ras_Sun_Rasterfile \
svg_Scalable_Vector_Graphics_Draw \
svg_Scalable_Vector_Graphics \
+ svgz_Compressed_Scalable_Vector_Graphics \
svm_StarView_Metafile \
tif_Tag_Image_File \
wmf_MS_Windows_Metafile \
+ wmz_Compressed_MS_Windows_Metafile \
+ webp_WebP \
xpm_XPM \
))
@@ -795,6 +824,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 +839,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,13 +852,16 @@ $(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
$(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\
+ apng_Animated_Portable_Network_Graphic \
bmp_MS_Windows \
dxf_AutoCAD_Interchange \
emf_MS_Windows_Metafile \
+ emz_Compressed_MS_Windows_Metafile \
eps_Encapsulated_PostScript \
gif_Graphics_Interchange \
jpg_JPEG \
@@ -845,20 +879,26 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics
psd_Adobe_Photoshop \
ras_Sun_Rasterfile \
svg_Scalable_Vector_Graphics \
+ svgz_Compressed_Scalable_Vector_Graphics \
svm_StarView_Metafile \
tga_Truevision_TARGA \
tif_Tag_Image_File \
+ webp_WebP \
wmf_MS_Windows_Metafile \
+ wmz_Compressed_MS_Windows_Metafile \
xbm_X_Consortium \
xpm_XPM \
))
$(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_internalgraphics_filters.xcu,filter/source/config/fragments/internalgraphicfilters,\
+ apng_Export \
bmp_Export \
bmp_Import \
dxf_Import \
emf_Export \
+ emz_Export \
emf_Import \
+ emz_Import \
eps_Export \
eps_Import \
gif_Export \
@@ -882,16 +922,22 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter
ras_Import \
svg_Export \
svg_Import \
+ svgz_Export \
+ svgz_Import \
svm_Export \
svm_Import \
tga_Import \
tif_Export \
tif_Import \
+ webp_Export \
+ webp_Import \
wmf_Export \
+ wmz_Export \
wmf_Import \
+ wmz_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..912b84e0edb4
--- /dev/null
+++ b/filter/CppunitTest_filter_pdf.mk
@@ -0,0 +1,49 @@
+# -*- 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, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ subsequenttest \
+ 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_svg.mk b/filter/CppunitTest_filter_svg.mk
index ec0841929f3f..96147625e4b3 100644
--- a/filter/CppunitTest_filter_svg.mk
+++ b/filter/CppunitTest_filter_svg.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,filter_svg, \
cppu \
cppuhelper \
sal \
+ subsequenttest \
test \
unotest \
utl \
diff --git a/filter/CppunitTest_filter_textfilterdetect.mk b/filter/CppunitTest_filter_textfilterdetect.mk
index 4066c26591a3..e931a5741a1d 100644
--- a/filter/CppunitTest_filter_textfilterdetect.mk
+++ b/filter/CppunitTest_filter_textfilterdetect.mk
@@ -21,6 +21,8 @@ $(eval $(call gb_CppunitTest_use_libraries,filter_textfilterdetect, \
cppu \
cppuhelper \
sal \
+ sfx \
+ subsequenttest \
test \
textfd \
tl \
@@ -40,4 +42,8 @@ $(eval $(call gb_CppunitTest_use_rdb,filter_textfilterdetect,services))
$(eval $(call gb_CppunitTest_use_configuration,filter_textfilterdetect))
+$(eval $(call gb_CppunitTest_use_custom_headers,filter_textfilterdetect, \
+ officecfg/registry \
+))
+
# vim: set noet sw=4 ts=4:
diff --git a/filter/IwyuFilter_filter.yaml b/filter/IwyuFilter_filter.yaml
index 14ae4e91a041..741729f711f6 100644
--- a/filter/IwyuFilter_filter.yaml
+++ b/filter/IwyuFilter_filter.yaml
@@ -4,9 +4,6 @@ excludelist:
filter/source/graphicfilter/icgm/cgm.cxx:
# OSL_BIGENDIAN is being checked
- osl/endian.h
- filter/source/graphicfilter/ieps/ieps.cxx:
- # Needed on WIN32
- - o3tl/char16_t2wchar_t.hxx
filter/source/msfilter/mscodec.cxx:
# Actually used
- com/sun/star/beans/NamedValue.hpp
diff --git a/filter/Library_filterconfig.mk b/filter/Library_filterconfig.mk
index 38251aa313f0..7d9318781eb3 100644
--- a/filter/Library_filterconfig.mk
+++ b/filter/Library_filterconfig.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_libraries,filterconfig,\
cppu \
sal \
salhelper \
+ sfx \
i18nlangtag \
))
diff --git a/filter/Library_icg.mk b/filter/Library_icg.mk
index 44cb742a6b98..6203c0a6eedd 100644
--- a/filter/Library_icg.mk
+++ b/filter/Library_icg.mk
@@ -19,12 +19,14 @@
$(eval $(call gb_Library_Library,icg))
-$(eval $(call gb_Library_set_plugin_for_nodep,icg,sd))
-
$(eval $(call gb_Library_use_external,icg,boost_headers))
$(eval $(call gb_Library_use_sdk_api,icg))
+$(eval $(call gb_Library_add_defs,icg,\
+ -DFILTER_DLLIMPLEMENTATION \
+))
+
$(eval $(call gb_Library_use_libraries,icg,\
comphelper \
cppuhelper \
diff --git a/filter/Library_msfilter.mk b/filter/Library_msfilter.mk
index 0429a6e31874..fcc343520602 100644
--- a/filter/Library_msfilter.mk
+++ b/filter/Library_msfilter.mk
@@ -21,7 +21,10 @@ $(eval $(call gb_Library_Library,msfilter))
$(eval $(call gb_Library_set_componentfile,msfilter,filter/source/msfilter/msfilter,services))
-$(eval $(call gb_Library_use_external,msfilter,boost_headers))
+$(eval $(call gb_Library_use_externals,msfilter,\
+ boost_headers \
+ frozen \
+))
$(eval $(call gb_Library_use_sdk_api,msfilter))
diff --git a/filter/Library_t602filter.mk b/filter/Library_t602filter.mk
index f8ad92b9680e..027709c4c6e2 100644
--- a/filter/Library_t602filter.mk
+++ b/filter/Library_t602filter.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_Library_use_libraries,t602filter,\
xo \
tl \
utl \
+ comphelper \
cppuhelper \
cppu \
sal \
diff --git a/filter/Library_xmlfa.mk b/filter/Library_xmlfa.mk
index 35a2dd9ff9b6..e1157cca3059 100644
--- a/filter/Library_xmlfa.mk
+++ b/filter/Library_xmlfa.mk
@@ -25,6 +25,11 @@ $(eval $(call gb_Library_use_external,xmlfa,boost_headers))
$(eval $(call gb_Library_use_sdk_api,xmlfa))
+$(eval $(call gb_Library_set_include,xmlfa,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/filter/inc \
+))
+
$(eval $(call gb_Library_use_libraries,xmlfa,\
comphelper \
cppuhelper \
diff --git a/filter/Library_xmlfd.mk b/filter/Library_xmlfd.mk
index a5c1d190c8f7..06aa201f15ec 100644
--- a/filter/Library_xmlfd.mk
+++ b/filter/Library_xmlfd.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_sdk_api,xmlfd))
$(eval $(call gb_Library_use_libraries,xmlfd,\
ucbhelper \
+ comphelper \
cppuhelper \
cppu \
sal \
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/inc/strings.hrc b/filter/inc/strings.hrc
index eecfdb33e2d0..3fd833352194 100644
--- a/filter/inc/strings.hrc
+++ b/filter/inc/strings.hrc
@@ -19,7 +19,11 @@
#pragma once
-#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
+#include <rtl/ustring.hxx>
+#include <unotools/resmgr.hxx>
+
+#define NC_(Context, String) TranslateId(Context, u8##String)
+#define NNC_(Context, StringSingular, StringPlural) TranslateNId(Context, reinterpret_cast<char const *>(u8##StringSingular), reinterpret_cast<char const *>(u8##StringPlural))
#define STR_UNKNOWN_APPLICATION NC_("STR_UNKNOWN_APPLICATION", "Unknown")
#define STR_IMPORT_ONLY NC_("STR_IMPORT_ONLY", "import filter")
@@ -72,5 +76,22 @@
#define STR_WARN_TRANSP_CONVERTED_SHORT NC_("STR_WARN_TRANSP_CONVERTED_SHORT", "Transparencies removed")
#define STR_ERR_SIGNATURE_FAILED NC_("STR_ERR_SIGNATURE_FAILED", "Signature generation failed")
#define STR_ERR_PDF_EXPORT_ABORTED NC_("STR_ERR_PDF_EXPORT_ABORTED", "PDF export aborted")
+#define STR_WARN_PDFUA_ISSUES NNC_("STR_WARN_PDFUA_ISSUES", "One accessibility issue detected. Do you want to continue?", "%1 accessibility issues detected. Do you want to continue?")
+#define STR_PDFUA_IGNORE NC_("STR_PDFUA_IGNORE", "Continue")
+#define STR_PDFUA_INVESTIGATE NNC_("STR_PDFUA_INVESTIGATE", "Investigate issue", "Investigate issues")
+
+// Progress bar status indicator when importing or exporting
+#define STR_FILTER_DOC_LOADING NC_("STR_FILTER_DOC_LOADING", "Loading: ")
+#define STR_FILTER_DOC_SAVING NC_("STR_FILTER_DOC_SAVING", "Saving: ")
+
+static inline OUString FilterResId(TranslateId aId)
+{
+ return Translate::get(aId, Translate::Create("flt"));
+}
+
+static inline OUString FilterResId(TranslateNId aContextSingularPlural, int nCardinality)
+{
+ return Translate::nget(aContextSingularPlural, nCardinality, Translate::Create("flt"));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/inc/strings.hxx b/filter/inc/strings.hxx
index eeeb161b9a92..21e5d90de63a 100644
--- a/filter/inc/strings.hxx
+++ b/filter/inc/strings.hxx
@@ -11,14 +11,14 @@
#include <rtl/ustring.hxx>
-inline constexpr OUStringLiteral STR_APPL_NAME_WRITER = u"%PRODUCTNAME Writer (.sxw)";
-inline constexpr OUStringLiteral STR_APPL_NAME_CALC = u"%PRODUCTNAME Calc (.sxc)";
-inline constexpr OUStringLiteral STR_APPL_NAME_IMPRESS = u"%PRODUCTNAME Impress (.sxi)";
-inline constexpr OUStringLiteral STR_APPL_NAME_DRAW = u"%PRODUCTNAME Draw (.sxd)";
-inline constexpr OUStringLiteral STR_APPL_NAME_OASIS_WRITER = u"%PRODUCTNAME Writer (.odt)";
-inline constexpr OUStringLiteral STR_APPL_NAME_OASIS_CALC = u"%PRODUCTNAME Calc (.ods)";
-inline constexpr OUStringLiteral STR_APPL_NAME_OASIS_IMPRESS = u"%PRODUCTNAME Impress (.odp)";
-inline constexpr OUStringLiteral STR_APPL_NAME_OASIS_DRAW = u"%PRODUCTNAME Draw (.odg)";
-inline constexpr OUStringLiteral STR_DEFAULT_EXTENSION = u"xml";
+inline constexpr OUString STR_APPL_NAME_WRITER = u"%PRODUCTNAME Writer (.sxw)"_ustr;
+inline constexpr OUString STR_APPL_NAME_CALC = u"%PRODUCTNAME Calc (.sxc)"_ustr;
+inline constexpr OUString STR_APPL_NAME_IMPRESS = u"%PRODUCTNAME Impress (.sxi)"_ustr;
+inline constexpr OUString STR_APPL_NAME_DRAW = u"%PRODUCTNAME Draw (.sxd)"_ustr;
+inline constexpr OUString STR_APPL_NAME_OASIS_WRITER = u"%PRODUCTNAME Writer (.odt)"_ustr;
+inline constexpr OUString STR_APPL_NAME_OASIS_CALC = u"%PRODUCTNAME Calc (.ods)"_ustr;
+inline constexpr OUString STR_APPL_NAME_OASIS_IMPRESS = u"%PRODUCTNAME Impress (.odp)"_ustr;
+inline constexpr OUString STR_APPL_NAME_OASIS_DRAW = u"%PRODUCTNAME Draw (.odg)"_ustr;
+inline constexpr OUString STR_DEFAULT_EXTENSION = u"xml"_ustr;
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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/msfilter-test.cxx b/filter/qa/cppunit/msfilter-test.cxx
index 439aad88b674..0969e272803b 100644
--- a/filter/qa/cppunit/msfilter-test.cxx
+++ b/filter/qa/cppunit/msfilter-test.cxx
@@ -52,7 +52,7 @@ void MSFilterTest::testTransColToIco()
15, 14, 13, 13, 12, 12, 9, 9, 9, 10, 10, 11, 11,
1, 14, 13, 13, 1, 12, 1, 9, 1, 10, 1, 11, 1 };
- for( size_t i = 0; i < SAL_N_ELEMENTS(aStdCol); ++i)
+ for( size_t i = 0; i < std::size(aStdCol); ++i)
{
const OString sMessage = "Index of unmatched color: " + OString::number(i);
CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), aExpected[i],
diff --git a/filter/qa/cppunit/priority-test.cxx b/filter/qa/cppunit/priority-test.cxx
index 18e63c3188ee..7b37ce07e6ee 100644
--- a/filter/qa/cppunit/priority-test.cxx
+++ b/filter/qa/cppunit/priority-test.cxx
@@ -50,20 +50,17 @@ void PriorityFilterTest::testPriority()
// TODO: expand this to check more of these priorities
};
- for (size_t i = 0; i < SAL_N_ELEMENTS(aToCheck); i++)
+ for (auto const[pURL, pFormat] : aToCheck)
{
- OUString aURL = OUString::createFromAscii(aToCheck[i].pURL);
+ OUString aURL = OUString::createFromAscii(pURL);
try
{
OUString aTypeName = xDetection->queryTypeByURL(aURL);
- OUString aFormatCorrect = OUString::createFromAscii(aToCheck[i].pFormat);
+ OUString aFormatCorrect = OUString::createFromAscii(pFormat);
OUString aMsg = "Mis-matching formats "
- "'" +
- aTypeName +
- "' should be '" +
- aFormatCorrect +
- "'";
+ "'" +
+ aTypeName + "' should be '" + aFormatCorrect + "'";
CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(aMsg,
RTL_TEXTENCODING_UTF8).getStr(),
aFormatCorrect, aTypeName);
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/commentsInMargin.odt b/filter/qa/data/commentsInMargin.odt
new file mode 100644
index 000000000000..3286f9e01899
--- /dev/null
+++ b/filter/qa/data/commentsInMargin.odt
Binary files differ
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..9ab11cd36d71
--- /dev/null
+++ b/filter/qa/pdf.cxx
@@ -0,0 +1,373 @@
+/* -*- 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/unoapi_test.hxx>
+
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.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>
+#include <tools/helpers.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Covers filter/source/pdf/ fixes.
+class Test : public UnoApiTest
+{
+public:
+ Test()
+ : UnoApiTest("/filter/qa/data/")
+ {
+ }
+
+ void setUp() override;
+ void doTestCommentsInMargin(bool commentsInMarginEnabled);
+};
+
+void Test::setUp()
+{
+ UnoApiTest::setUp();
+
+ MacrosTest::setUpX509(m_directories, "filter_pdf");
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName)
+{
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+
+ 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();
+ 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")),
+ };
+ if (!GetValidCertificate(xSecurityEnvironment->getPersonalCertificates(), xSecurityEnvironment,
+ aFilterData))
+ {
+ return;
+ }
+
+ // Given an empty document:
+ mxComponent.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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+
+ 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::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ // 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)
+{
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+
+ // Given an empty Writer document:
+ mxComponent.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", createFileURL(u"picture.pdf")),
+ };
+ dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs);
+
+ // Then make sure that its size is correct:
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, 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
+}
+
+void Test::doTestCommentsInMargin(bool commentsInMarginEnabled)
+{
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+
+ loadFromFile(u"commentsInMargin.odt");
+ 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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+ uno::Sequence<beans::PropertyValue> aFilterData{ comphelper::makePropertyValue(
+ "ExportNotesInMargin", commentsInMarginEnabled) };
+ uno::Sequence<beans::PropertyValue> aDescriptor{
+ comphelper::makePropertyValue("FilterName", OUString("writer_pdf_Export")),
+ comphelper::makePropertyValue("FilterData", aFilterData),
+ comphelper::makePropertyValue("OutputStream", xOutputStream),
+ };
+ xFilter->filter(aDescriptor);
+
+ // Make sure the number of objects is correct
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ CPPUNIT_ASSERT(pPdfDocument);
+ if (commentsInMarginEnabled)
+ {
+ // Unfortunately, the comment box is DPI dependent, and the lines there may split
+ // at higher DPIs, creating additional objects on import, hence the "_GREATER"
+ CPPUNIT_ASSERT_GREATER(8, pPdfDocument->openPage(0)->getObjectCount());
+ }
+ else
+ CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->openPage(0)->getObjectCount());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testCommentsInMargin)
+{
+ // Test that setting/unsetting the "ExportNotesInMargin" property works correctly
+ doTestCommentsInMargin(true);
+ doTestCommentsInMargin(false);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkColor)
+{
+ // Given an empty Writer document:
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+ mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // When exporting that as PDF with a red watermark:
+ uno::Reference<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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+ uno::Sequence<beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("Watermark", OUString("X")),
+ comphelper::makePropertyValue("WatermarkColor", static_cast<sal_Int32>(0xff0000)),
+ };
+ 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 that the watermark color is correct:
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ CPPUNIT_ASSERT(pPdfDocument);
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = pPage->getObject(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pFormObject = pPageObject->getFormObject(0);
+ Color aFillColor = pFormObject->getFillColor();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: rgba[ff0000ff]
+ // - Actual : rgba[00ff00ff]
+ // i.e. the color was the (default) green, not red.
+ CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xff0000), aFillColor);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontHeight)
+{
+ // Given an empty Writer document:
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+ mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // When exporting that as PDF with a 100pt-sized watermark:
+ 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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+ sal_Int32 nExpectedFontSize = 100;
+ uno::Sequence<beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("Watermark", OUString("X")),
+ comphelper::makePropertyValue("WatermarkFontHeight", nExpectedFontSize),
+ };
+ 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 that the watermark font size is correct:
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ CPPUNIT_ASSERT(pPdfDocument);
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = pPage->getObject(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pFormObject = pPageObject->getFormObject(0);
+ sal_Int32 nFontSize = pFormObject->getFontSize();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 100
+ // - Actual : 594
+ // i.e. the font size was automatic, could not specify an explicit size.
+ CPPUNIT_ASSERT_EQUAL(nExpectedFontSize, nFontSize);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkFontName)
+{
+ // Given an empty Writer document:
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+ mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // When exporting that as PDF with a serif watermark:
+ uno::Reference<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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+ OUString aExpectedFontName("Liberation Serif");
+ uno::Sequence<beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("Watermark", OUString("X")),
+ comphelper::makePropertyValue("WatermarkFontName", aExpectedFontName),
+ };
+ 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 that the watermark font name is correct:
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ CPPUNIT_ASSERT(pPdfDocument);
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = pPage->getObject(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pFormObject = pPageObject->getFormObject(0);
+ OUString aFontName = pFormObject->getFontName();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: Liberation Serif
+ // - Actual : Helvetica
+ // i.e. the font name was sans, could not specify an explicit name.
+ CPPUNIT_ASSERT_EQUAL(aExpectedFontName, aFontName);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testWatermarkRotateAngle)
+{
+ // Given an empty Writer document:
+ std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPDFium)
+ return;
+ mxComponent.set(loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // When exporting that as PDF with a rotated watermark:
+ 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(mxComponent);
+ SvMemoryStream aStream;
+ uno::Reference<io::XOutputStream> xOutputStream(new utl::OStreamWrapper(aStream));
+ // 45.0 degrees, counter-clockwise.
+ sal_Int32 nExpectedRotateAngle = 45;
+ uno::Sequence<beans::PropertyValue> aFilterData{
+ comphelper::makePropertyValue("Watermark", OUString("X")),
+ comphelper::makePropertyValue("WatermarkRotateAngle", nExpectedRotateAngle * 10),
+ };
+ 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 that the watermark rotation angle is correct:
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
+ = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString());
+ CPPUNIT_ASSERT(pPdfDocument);
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPage = pPdfDocument->openPage(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPage->getObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pPageObject = pPage->getObject(0);
+ CPPUNIT_ASSERT_EQUAL(1, pPageObject->getFormObjectCount());
+ std::unique_ptr<vcl::pdf::PDFiumPageObject> pFormObject = pPageObject->getFormObject(0);
+ basegfx::B2DHomMatrix aMatrix = pFormObject->getMatrix();
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate{};
+ double fShearX{};
+ aMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+ sal_Int32 nActualRotateAngle = NormAngle360(basegfx::rad2deg<1>(fRotate));
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 45
+ // - Actual : 270
+ // i.e. the rotation angle was 270 for an A4 page, not the requested 45 degrees.
+ CPPUNIT_ASSERT_EQUAL(nExpectedRotateAngle, nActualRotateAngle);
+}
+}
+
+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/hybrid_calc.pdf b/filter/qa/unit/data/hybrid_calc.pdf
new file mode 100644
index 000000000000..b104113a5238
--- /dev/null
+++ b/filter/qa/unit/data/hybrid_calc.pdf
Binary files differ
diff --git a/filter/qa/unit/data/hybrid_impress.pdf b/filter/qa/unit/data/hybrid_impress.pdf
new file mode 100644
index 000000000000..78e7136211f4
--- /dev/null
+++ b/filter/qa/unit/data/hybrid_impress.pdf
Binary files differ
diff --git a/filter/qa/unit/data/hybrid_writer.pdf b/filter/qa/unit/data/hybrid_writer.pdf
new file mode 100644
index 000000000000..00cf3de44c5c
--- /dev/null
+++ b/filter/qa/unit/data/hybrid_writer.pdf
Binary files differ
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/semi-transparent-fill.odg b/filter/qa/unit/data/semi-transparent-fill.odg
new file mode 100644
index 000000000000..713f48991bcb
--- /dev/null
+++ b/filter/qa/unit/data/semi-transparent-fill.odg
Binary files differ
diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp
new file mode 100644
index 000000000000..660e27062373
--- /dev/null
+++ b/filter/qa/unit/data/text-in-image.odp
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..82dc3832e1b8 100644
--- a/filter/qa/unit/svg.cxx
+++ b/filter/qa/unit/svg.cxx
@@ -9,56 +9,34 @@
#include <sal/config.h>
-#include <string_view>
+#include <test/unoapixml_test.hxx>
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
-#include <test/xmltesttools.hxx>
-
-#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <comphelper/propertyvalue.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/mediadescriptor.hxx>
#include <tools/stream.hxx>
using namespace ::com::sun::star;
-constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/unit/data/";
-
/// SVG filter tests.
-class SvgFilterTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
+class SvgFilterTest : public UnoApiXmlTest
{
-private:
- uno::Reference<lang::XComponent> mxComponent;
-
public:
- void setUp() override;
- void tearDown() override;
+ SvgFilterTest();
void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
- uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
- void load(std::u16string_view rURL);
};
-void SvgFilterTest::setUp()
+SvgFilterTest::SvgFilterTest()
+ : UnoApiXmlTest("/filter/qa/unit/data/")
{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set(frame::Desktop::create(mxComponentContext));
-}
-
-void SvgFilterTest::tearDown()
-{
- if (mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
-void SvgFilterTest::load(std::u16string_view rFileName)
-{
- OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + rFileName;
- mxComponent = loadFromDesktop(aURL);
}
void SvgFilterTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
@@ -68,27 +46,23 @@ void SvgFilterTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg)
{
-#if !defined(MACOSX)
+// On Windows, SVGFilter::filterWriterOrCalc can't get current frame to obtain selection
+#if !defined(MACOSX) && !defined(_WIN32)
// Load a document with a jpeg image in it.
- load(u"preserve-jpg.odt");
+ loadFromFile(u"preserve-jpg.odt");
// Select the image.
- dispatchCommand(getComponent(), ".uno:JumpToNextFrame", {});
+ dispatchCommand(mxComponent, ".uno:JumpToNextFrame", {});
// Export the selection 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("writer_svg_Export");
- aMediaDescriptor["SelectionOnly"] <<= true;
- aMediaDescriptor["OutputStream"] <<= xOut;
- xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
- aStream.Seek(STREAM_SEEK_TO_BEGIN);
+ saveWithParams({
+ comphelper::makePropertyValue("FilterName", u"writer_svg_Export"_ustr),
+ comphelper::makePropertyValue("SelectionOnly", true),
+ });
// Make sure that the original JPG data is reused and we don't perform a PNG re-compress.
- xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
- OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image", "href");
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image"_ostr, "href"_ostr);
// Without the accompanying fix in place, this test would have failed with:
// - Expression: aAttributeValue.startsWith("data:image/jpeg")
@@ -101,22 +75,15 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg)
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
{
// Load a document with a semi-transparent line shape.
- load(u"semi-transparent-line.odg");
+ loadFromFile(u"semi-transparent-line.odg");
// Export it 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("draw_svg_Export");
- aMediaDescriptor["OutputStream"] <<= xOut;
- xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
- aStream.Seek(STREAM_SEEK_TO_BEGIN);
+ save("draw_svg_Export");
// Get the style of the group around the actual <path> element.
- xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
OUString aStyle = getXPath(
- pXmlDoc, "//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g", "style");
+ pXmlDoc, "//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g"_ostr, "style"_ostr);
// Without the accompanying fix in place, this test would have failed, as the style was
// "mask:url(#mask1)", not "opacity: <value>".
CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", &aStyle));
@@ -125,6 +92,33 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
CPPUNIT_ASSERT_EQUAL(30, nPercent);
}
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentFillWithTransparentLine)
+{
+ // Load a document with a shape with semi-transparent fill and line
+ loadFromFile(u"semi-transparent-fill.odg");
+
+ // Export it to SVG.
+ save("draw_svg_Export");
+
+ // Get the style of the group around the actual <path> element.
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ OUString aStyle
+ = getXPath(pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g"_ostr,
+ "style"_ostr);
+ CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", &aStyle));
+ int nPercent = std::round(aStyle.toDouble() * 100);
+ // Make sure that the line is still 50% opaque
+ CPPUNIT_ASSERT_EQUAL(50, nPercent);
+
+ // Get the stroke of the fill of the EllipseShape (it must be "none")
+ OUString aStroke = getXPath(
+ pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path"_ostr,
+ "stroke"_ostr);
+ // Without the accompanying fix in place, this test would have failed, as the stroke was
+ // "rgb(255,255,255)", not "none".
+ CPPUNIT_ASSERT_EQUAL(OUString("none"), aStroke);
+}
+
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
{
// Two shapes, one with transparent text and the other one with
@@ -132,21 +126,12 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
// correct transparency factor applied for the first shape.
// Load draw document with transparent text in one box
- load(u"TransparentText.odg");
+ loadFromFile(u"TransparentText.odg");
// 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("draw_svg_Export");
- aMediaDescriptor["OutputStream"] <<= xOut;
- xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
- aStream.Seek(STREAM_SEEK_TO_BEGIN);
-
- xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+ save("draw_svg_Export");
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
// We expect 2 groups of class "TextShape" that
// have some svg:text node inside.
// Without the accompanying fix in place, this test would have failed with:
@@ -154,22 +139,66 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
// - Actual : 1
// i.e. the 2nd shape lots its text.
- assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text", 2);
+ assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text"_ostr, 2);
// First shape has semi-transparent text.
- assertXPath(pXmlDoc, "//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']");
+ assertXPath(pXmlDoc, "//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']"_ostr);
// Second shape has normal text.
- assertXPath(pXmlDoc, "//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
+ assertXPath(pXmlDoc, "//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]"_ostr, 0);
+}
+
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentMultiParaText)
+{
+ // Given a shape with semi-transparent, multi-paragraph text:
+ mxComponent
+ = loadFromDesktop("private:factory/simpress", "com.sun.star.drawing.DrawingDocument");
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(
+ xFactory->createInstance("com.sun.star.drawing.TextShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+ xDrawPage->add(xShape);
+ xShape->setSize(awt::Size(10000, 10000));
+ uno::Reference<text::XSimpleText> xShapeText(xShape, uno::UNO_QUERY);
+ uno::Reference<text::XTextCursor> xCursor = xShapeText->createTextCursor();
+ xShapeText->insertString(xCursor, "foo", /*bAbsorb=*/false);
+ xShapeText->insertControlCharacter(xCursor, text::ControlCharacter::APPEND_PARAGRAPH,
+ /*bAbsorb=*/false);
+ xShapeText->insertString(xCursor, "bar", /*bAbsorb=*/false);
+ uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+ xShapeProps->setPropertyValue("CharColor", uno::Any(static_cast<sal_Int32>(0xff0000)));
+ xShapeProps->setPropertyValue("CharTransparence", uno::Any(static_cast<sal_Int16>(20)));
+
+ // When exporting to SVG:
+ save("draw_svg_Export");
+
+ // Then make sure that the two semi-transparent paragraphs have the same X position:
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]"_ostr,
+ "x"_ostr, "250");
+ assertXPath(pXmlDoc,
+ "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan"_ostr,
+ "fill-opacity"_ostr, "0.8");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 250
+ // - Actual : 8819
+ // i.e. the X position of the second paragraph was wrong.
+ assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]"_ostr,
+ "x"_ostr, "250");
+ assertXPath(pXmlDoc,
+ "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]/svg:tspan"_ostr,
+ "fill-opacity"_ostr, "0.8");
}
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
{
// Load a document containing a 3D shape.
- load(u"shape-nographic.odp");
+ loadFromFile(u"shape-nographic.odp");
// Export to SVG.
- uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY_THROW);
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY_THROW);
SvMemoryStream aStream;
uno::Reference<io::XOutputStream> xOut = new utl::OOutputStreamWrapper(aStream);
utl::MediaDescriptor aMediaDescriptor;
@@ -185,20 +214,13 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet)
{
// Given a presentation with a custom bullet:
- load(u"custom-bullet.fodp");
+ loadFromFile(u"custom-bullet.fodp");
// When exporting that 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());
+ save("impress_svg_Export");
// Then make sure the bullet glyph is not lost:
- aStream.Seek(STREAM_SEEK_TO_BEGIN);
- xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 1
// - Actual : 0
@@ -206,7 +228,88 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet)
// i.e. the custom bullet used '<use transform="scale(285,285)"
// xlink:href="#bullet-char-template-45"/>', but nobody produced a bullet-char-template-45,
// instead we need the path of the glyph inline.
- CPPUNIT_ASSERT(!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path", "d").isEmpty());
+ CPPUNIT_ASSERT(
+ !getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path"_ostr, "d"_ostr).isEmpty());
+}
+
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest)
+{
+ // Load document containing empty paragraphs with ids.
+ loadFromFile(u"attributeRedefinedTest.odp");
+
+ // Export to SVG.
+ save("impress_svg_Export");
+
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ // 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']"_ostr;
+ 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"_ostr, "id4");
+ assertXPath(pXmlDoc, xPath + "[2]", "id"_ostr, "id5");
+ assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0);
+ assertXPath(pXmlDoc, xPath + "[3]", "id"_ostr, "id6");
+ assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0);
+ assertXPath(pXmlDoc, xPath + "[4]", "id"_ostr, "id7");
+}
+
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab)
+{
+ // Given a shape with "A\tB" text:
+ mxComponent = loadFromDesktop("private:factory/simpress",
+ "com.sun.star.presentation.PresentationDocument");
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(
+ xFactory->createInstance("com.sun.star.drawing.TextShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+ xDrawPage->add(xShape);
+ xShape->setSize(awt::Size(10000, 10000));
+ uno::Reference<text::XTextRange> xShapeText(xShape, uno::UNO_QUERY);
+ xShapeText->setString("A\tB");
+
+ // When exporting that document to SVG:
+ save("impress_svg_Export");
+
+ // Then make sure the tab is not lost:
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 2
+ // - Actual : 1
+ // i.e. the 2nd text portion was not positioned, which looked as if the tab is lost.
+ assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2);
+}
+
+CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage)
+{
+ // Load document containing empty paragraphs with ids.
+ loadFromFile(u"text-in-image.odp");
+
+ // Export to SVG.
+ save("impress_svg_Export");
+
+ xmlDocUniquePtr pXmlDoc = parseExportedFile();
+
+ // We expect the Graphic to have an image and a text
+ assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1);
+ assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1);
+ // Without the accompanying fix, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 0
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/qa/unit/textfilterdetect.cxx b/filter/qa/unit/textfilterdetect.cxx
index 62d0d60a23a7..e578d4b88fee 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -7,14 +7,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include <test/unoapi_test.hxx>
#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/configuration.hxx>
#include <comphelper/propertyvalue.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <osl/file.hxx>
+#include <sfx2/docfac.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/streamwrap.hxx>
#include <tools/stream.hxx>
@@ -28,40 +34,27 @@ using namespace com::sun::star;
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()
+bool supportsService(const uno::Reference<lang::XComponent>& x, const OUString& s)
{
- test::BootstrapFixture::setUp();
-
- mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ return uno::Reference<lang::XServiceInfo>(x, uno::UNO_QUERY_THROW)->supportsService(s);
}
-void TextFilterDetectTest::tearDown()
+/// Test class for PlainTextFilterDetect.
+class TextFilterDetectTest : public UnoApiTest
{
- if (mxComponent.is())
- mxComponent->dispose();
-
- test::BootstrapFixture::tearDown();
-}
-
-constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/unit/data/";
+public:
+ TextFilterDetectTest()
+ : UnoApiTest("/filter/qa/unit/data/")
+ {
+ }
+};
CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428)
{
uno::Reference<document::XExtendedFilterDetection> xDetect(
getMultiServiceFactory()->createInstance("com.sun.star.comp.filters.PlainTextFilterDetect"),
uno::UNO_QUERY);
- OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf114428.xhtml";
+ OUString aURL = createFileURL(u"tdf114428.xhtml");
SvFileStream aStream(aURL, StreamMode::READ);
uno::Reference<io::XInputStream> xStream(new utl::OStreamWrapper(aStream));
uno::Sequence<beans::PropertyValue> aDescriptor
@@ -79,59 +72,167 @@ 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";
-
// When loading the file
- getComponent() = loadFromDesktop(aURL);
+ loadFromFile(u"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(mxComponent, "com.sun.star.presentation.PresentationDocument"));
// 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());
+ loadFromFile(u"empty.odt");
// Make sure it opens in Writer.
- CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument"));
- getComponent()->dispose();
+ CPPUNIT_ASSERT(supportsService(mxComponent, "com.sun.star.text.TextDocument"));
+
+ // ... and ODS
+ loadFromFile(u"empty.ods");
+ // Make sure it opens in Calc.
+ CPPUNIT_ASSERT(supportsService(mxComponent, "com.sun.star.sheet.SpreadsheetDocument"));
// ... and ODP
- aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "empty.odp";
- getComponent() = loadFromDesktop(aURL);
- xServiceInfo.set(getComponent(), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xServiceInfo.is());
+ loadFromFile(u"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(mxComponent, "com.sun.star.presentation.PresentationDocument"));
// ... 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);
+ loadFromFile(u"empty.doc");
+ CPPUNIT_ASSERT(supportsService(mxComponent, "com.sun.star.text.TextDocument"));
+ {
+ uno::Reference<frame::XModel> xModel(mxComponent, 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);
+ }
+
+ // Now test with default templates set
+
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.presentation.PresentationDocument",
+ createFileURL(u"impress.otp"));
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.text.TextDocument",
+ createFileURL(u"writer.ott"));
+ SfxObjectFactory::SetStandardTemplate("com.sun.star.sheet.SpreadsheetDocument",
+ createFileURL(u"calc.ots"));
+
+ loadFromFile(u"empty.pptx");
+ {
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, 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());
+ }
+
+ loadFromFile(u"empty.odt");
+ {
+ uno::Reference<text::XTextDocument> xDoc(mxComponent, 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(u"Writer template’s first line"_ustr, xParagraph->getString());
+ }
+
+ loadFromFile(u"empty.ods");
+ {
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 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(u"Calc template’s first cell"_ustr, xC->getString());
+ }
+
+ loadFromFile(u"empty.odp");
+ {
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, 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());
+ }
+ loadFromFile(u"empty.doc");
+ {
+ uno::Reference<text::XTextDocument> xDoc(mxComponent, 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(u"Writer template’s first line"_ustr, xParagraph->getString());
+ }
+}
+
+// The unit test fails on some Linux systems. Until it is found out why the file URLs are broken
+// there, let it be Windows-only, since the original issue tested here was Windows-specific.
+// See https://lists.freedesktop.org/archives/libreoffice/2023-December/091265.html for details.
+#ifdef _WIN32
+CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testHybridPDFFile)
+{
+ // Make sure that file locking is ON
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::set(true, xChanges);
+ xChanges->commit();
+ }
+
+ // Given a hybrid PDF file
+
+ {
+ // Created in Writer
+ utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+ nonAsciiName.EnableKillingFile();
+ CPPUNIT_ASSERT_EQUAL(
+ osl::FileBase::E_None,
+ osl::File::copy(createFileURL(u"hybrid_writer.pdf"), nonAsciiName.GetURL()));
+ load(nonAsciiName.GetURL());
+ // Make sure it opens in Writer.
+ // Without the accompanying fix in place, this test would have failed on Windows, as it was
+ // opened in Draw instead.
+ CPPUNIT_ASSERT(supportsService(mxComponent, "com.sun.star.text.TextDocument"));
+ }
+
+ {
+ // Created in Calc
+ utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+ nonAsciiName.EnableKillingFile();
+ CPPUNIT_ASSERT_EQUAL(
+ osl::FileBase::E_None,
+ osl::File::copy(createFileURL(u"hybrid_calc.pdf"), nonAsciiName.GetURL()));
+ load(nonAsciiName.GetURL());
+ // Make sure it opens in Calc.
+ CPPUNIT_ASSERT(supportsService(mxComponent, "com.sun.star.sheet.SpreadsheetDocument"));
+ }
+
+ {
+ // Created in Impress
+ utl::TempFileNamed nonAsciiName(u"абв_αβγ_");
+ nonAsciiName.EnableKillingFile();
+ CPPUNIT_ASSERT_EQUAL(
+ osl::FileBase::E_None,
+ osl::File::copy(createFileURL(u"hybrid_impress.pdf"), nonAsciiName.GetURL()));
+ load(nonAsciiName.GetURL());
+ // Make sure it opens in Impress.
+ CPPUNIT_ASSERT(
+ supportsService(mxComponent, "com.sun.star.presentation.PresentationDocument"));
+ }
}
+#endif // _WIN32
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
index 97e7b7f22bea..fe05d7f5ba2b 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -21,20 +21,16 @@
#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>
#include <cppuhelper/supportsservice.hxx>
#include <osl/diagnose.h>
-#define LOAD_IMPLICIT
-
namespace filter::config{
BaseContainer::BaseContainer()
: m_eType()
- , m_lListener (m_aMutex)
{
GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD);
}
@@ -45,28 +41,22 @@ 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 )
{
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
m_sImplementationName = sImplementationName;
m_lServiceNames = lServiceNames ;
m_eType = eType ;
- m_xRefreshBroadcaster = css::document::FilterConfigRefresh::create(rxContext);
// <- SAFE
}
-void BaseContainer::impl_loadOnDemand()
+void BaseContainer::impl_loadOnDemand(std::unique_lock<std::mutex>& /*rGuard*/)
{
-#ifdef LOAD_IMPLICIT
- // SAFE ->
- osl::MutexGuard aLock(m_aMutex);
-
// A generic container needs all items of a set of our cache!
// Of course it can block for a while, till the cache is really filled.
// Note: don't load all sets supported by the cache here!
@@ -92,33 +82,25 @@ void BaseContainer::impl_loadOnDemand()
}
GetTheFilterCache().load(eRequiredState);
- // <- SAFE
-#endif
}
-void BaseContainer::impl_initFlushMode()
+void BaseContainer::impl_initFlushMode(std::unique_lock<std::mutex>& /*rGuard*/)
{
- // SAFE ->
- osl::MutexGuard aLock(m_aMutex);
if (!m_pFlushCache)
m_pFlushCache = GetTheFilterCache().clone();
if (!m_pFlushCache)
throw css::uno::RuntimeException( "Can not create write copy of internal used cache on demand.",
- static_cast< OWeakObject* >(this));
- // <- SAFE
+ getXWeak());
}
-FilterCache* BaseContainer::impl_getWorkingCache() const
+FilterCache* BaseContainer::impl_getWorkingCache(std::unique_lock<std::mutex>& /*rGuard*/) const
{
- // SAFE ->
- osl::MutexGuard aLock(m_aMutex);
if (m_pFlushCache)
return m_pFlushCache.get();
else
return &GetTheFilterCache();
- // <- SAFE
}
@@ -157,15 +139,15 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem ,
throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2);
}
- impl_loadOnDemand();
-
// SAFE -> ----------------------------------
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
// create write copy of used cache on demand ...
- impl_initFlushMode();
+ impl_initFlushMode(aLock);
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
if (pCache->hasItem(m_eType, sItem))
throw css::container::ElementExistException(OUString(), static_cast< css::container::XNameContainer* >(this));
pCache->setItem(m_eType, sItem, aItem);
@@ -175,15 +157,15 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem ,
void SAL_CALL BaseContainer::removeByName(const OUString& sItem)
{
- impl_loadOnDemand();
-
// SAFE -> ----------------------------------
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
// create write copy of used cache on demand ...
- impl_initFlushMode();
+ impl_initFlushMode(aLock);
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
pCache->removeItem(m_eType, sItem); // throw exceptions automatically
// <- SAFE ----------------------------------
}
@@ -207,15 +189,15 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& sItem ,
throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2);
}
- impl_loadOnDemand();
-
// SAFE -> ----------------------------------
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
// create write copy of used cache on demand ...
- impl_initFlushMode();
+ impl_initFlushMode(aLock);
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
if (!pCache->hasItem(m_eType, sItem))
throw css::container::NoSuchElementException(OUString(), static_cast< css::container::XNameContainer* >(this));
pCache->setItem(m_eType, sItem, aItem);
@@ -231,17 +213,15 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem)
css::uno::Any aValue;
- impl_loadOnDemand();
-
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
- CacheItem aItem;
try
{
- FilterCache* pCache = impl_getWorkingCache();
- aItem = pCache->getItem(m_eType, sItem);
- pCache->addStatePropsToItem(m_eType, sItem, aItem); // add implicit props "Finalized"/"Mandatory"
+ FilterCache* pCache = impl_getWorkingCache(aLock);
+ aValue = pCache->getItemWithStateProps(m_eType, sItem);
}
catch(const css::container::NoSuchElementException&)
{
@@ -250,10 +230,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;
@@ -264,14 +242,14 @@ css::uno::Sequence< OUString > SAL_CALL BaseContainer::getElementNames()
{
css::uno::Sequence< OUString > lNames;
- impl_loadOnDemand();
-
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
try
{
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
std::vector<OUString> lKeys = pCache->getItemNames(m_eType);
lNames = comphelper::containerToSequence(lKeys);
}
@@ -291,14 +269,14 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const OUString& sItem)
{
bool bHasOne = false;
- impl_loadOnDemand();
-
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
try
{
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
bHasOne = pCache->hasItem(m_eType, sItem);
}
catch(const css::uno::Exception&)
@@ -325,14 +303,14 @@ sal_Bool SAL_CALL BaseContainer::hasElements()
{
bool bHasSome = false;
- impl_loadOnDemand();
-
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
try
{
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
bHasSome = pCache->hasItems(m_eType);
}
catch(const css::uno::Exception&)
@@ -351,7 +329,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
{
OSL_FAIL("not pure virtual ... but not really implemented .-)");
- return new ::comphelper::OEnumerationByName(this, css::uno::Sequence< OUString >());
+ return new ::comphelper::OEnumerationByName(this, {});
}
@@ -359,21 +337,17 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
{
std::vector<OUString> lKeys;
- impl_loadOnDemand();
-
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
+
+ impl_loadOnDemand(aLock);
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);
+ FilterCache* pCache = impl_getWorkingCache(aLock);
+ lKeys = pCache->getMatchingItemsByProps(m_eType, std::span<const css::beans::NamedValue>( lProperties.getConstArray(), lProperties.getLength() ));
}
catch(const css::uno::Exception&)
{
@@ -394,20 +368,19 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea
Further its easier to work directly with the return value
instead of checking of NULL returns! */
- css::uno::Sequence< OUString > lSubSet = comphelper::containerToSequence(lKeys);
- return new ::comphelper::OEnumerationByName(this, lSubSet);
+ return new ::comphelper::OEnumerationByName(this, std::move(lKeys));
}
void SAL_CALL BaseContainer::flush()
{
// SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
if (!m_pFlushCache)
throw css::lang::WrappedTargetRuntimeException(
"Can not guarantee cache consistency. Special flush container does not exists!",
- static_cast< OWeakObject* >(this),
+ getXWeak(),
css::uno::Any());
try
@@ -429,63 +402,30 @@ void SAL_CALL BaseContainer::flush()
// later again ...
throw css::lang::WrappedTargetRuntimeException( "Flush rejected by internal container.",
- static_cast< OWeakObject* >(this),
- css::uno::makeAny(ex));
+ getXWeak(),
+ 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.
- // Further it's not a good idea to hold the own lock
- // if an outside object is called :-)
css::lang::EventObject aSource (static_cast< css::util::XFlushable* >(this));
- comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XFlushListener>::get());
- if (!pContainer)
- return;
+ m_lListener.notifyEach( aLock, &css::util::XFlushListener::flushed, aSource);
- comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- // ... this pointer can be interesting to find out, where will be called as listener
- // Don't optimize it to a direct iterator cast :-)
- css::util::XFlushListener* pListener = static_cast<css::util::XFlushListener*>(pIterator.next());
- pListener->flushed(aSource);
- }
- catch(const css::uno::Exception&)
- {
- // ignore any "damaged" flush listener!
- // May its remote reference is broken ...
- pIterator.remove();
- }
- }
+ // <- SAFE
}
void SAL_CALL BaseContainer::addFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
{
- // no locks necessary
- // used helper lives if we live and is threadsafe by itself ...
- m_lListener.addInterface(cppu::UnoType<css::util::XFlushListener>::get(), xListener);
+ std::unique_lock g(m_aMutex);
+ m_lListener.addInterface(g, xListener);
}
void SAL_CALL BaseContainer::removeFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener)
{
- // no locks necessary
- // used helper lives if we live and is threadsafe by itself ...
- m_lListener.removeInterface(cppu::UnoType<css::util::XFlushListener>::get(), xListener);
+ std::unique_lock g(m_aMutex);
+ m_lListener.removeInterface(g, xListener);
}
} // namespace filter::config
diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx
index 4ed14d4f603a..f1f63b10bc42 100644
--- a/filter/source/config/cache/basecontainer.hxx
+++ b/filter/source/config/cache/basecontainer.hxx
@@ -27,7 +27,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/util/XFlushable.hpp>
-#include <comphelper/multicontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
#include <rtl/ustring.hxx>
@@ -49,8 +49,7 @@ namespace filter::config {
present by this base class!) was full initialized inside our own
ctor as first!
*/
-class BaseContainer : public cppu::BaseMutex
- , public ::cppu::WeakImplHelper< css::lang::XServiceInfo ,
+class BaseContainer : public ::cppu::WeakImplHelper< css::lang::XServiceInfo ,
css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess
css::container::XContainerQuery ,
css::util::XFlushable >
@@ -59,9 +58,7 @@ class BaseContainer : public cppu::BaseMutex
// member
protected:
-
- // TODO
- css::uno::WeakReference< css::util::XRefreshable > m_xRefreshBroadcaster;
+ mutable std::mutex m_aMutex;
/** @short the implementation name of our derived class, which we provide
at the interface XServiceInfo of our class... */
@@ -93,7 +90,7 @@ class BaseContainer : public cppu::BaseMutex
FilterCache::EItemType m_eType;
/** @short holds all listener, which are registered at this instance. */
- comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener;
+ comphelper::OInterfaceContainerHelper4<css::util::XFlushListener> m_lListener;
// native interface
@@ -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
@@ -159,7 +155,7 @@ class BaseContainer : public cppu::BaseMutex
/** @short check if the underlying configuration data was already loaded
and do it if necessary automatically.
*/
- void impl_loadOnDemand();
+ void impl_loadOnDemand(std::unique_lock<std::mutex>& rGuard);
/** @short it creates the global instance m_pFilterCache, which is a copy
@@ -171,7 +167,7 @@ class BaseContainer : public cppu::BaseMutex
@throws css::uno::RuntimeException
*/
- void impl_initFlushMode();
+ void impl_initFlushMode(std::unique_lock<std::mutex>& rGuard);
/** @short returns a pointer to the current used cache member.
@@ -192,7 +188,7 @@ class BaseContainer : public cppu::BaseMutex
aLock.clear();
// after this point p can't b e guaranteed any longer!
*/
- FilterCache* impl_getWorkingCache() const;
+ FilterCache* impl_getWorkingCache(std::unique_lock<std::mutex>& rGuard) const;
// uno interface
diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx
index a406b16ff130..dddb7d464286 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(std::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(std::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..9ed263442150 100644
--- a/filter/source/config/cache/cacheitem.hxx
+++ b/filter/source/config/cache/cacheitem.hxx
@@ -19,13 +19,13 @@
#pragma once
+#include <span>
#include <unordered_map>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <vector>
#include <comphelper/sequenceashashmap.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(std::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(std::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..c613d0549185 100644
--- a/filter/source/config/cache/cacheupdatelistener.cxx
+++ b/filter/source/config/cache/cacheupdatelistener.cxx
@@ -19,22 +19,23 @@
#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>
+#include <utility>
namespace filter::config{
CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache,
- const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+ css::uno::Reference< css::uno::XInterface > xConfigAccess,
FilterCache::EItemType eConfigType)
: m_rCache(rFilterCache)
- , m_xConfig(xConfigAccess)
+ , m_xConfig(std::move(xConfigAccess))
, m_eConfigType(eConfigType)
{
}
@@ -46,9 +47,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 +63,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 +79,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 +87,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 +162,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 +171,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..3870b9916859 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;
@@ -73,7 +75,7 @@ class CacheUpdateListener : public cppu::BaseMutex // must be the first one to g
specify the type of configuration.
*/
CacheUpdateListener(FilterCache &rFilterCache,
- const css::uno::Reference< css::uno::XInterface >& xConfigAccess,
+ css::uno::Reference< css::uno::XInterface > xConfigAccess,
FilterCache::EItemType eConfigType);
diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx
index 34ac28782b79..ed4da6d71185 100644
--- a/filter/source/config/cache/configflush.cxx
+++ b/filter/source/config/cache/configflush.cxx
@@ -26,7 +26,6 @@
namespace filter::config{
ConfigFlush::ConfigFlush()
- : m_lListener(m_aMutex)
{
}
@@ -57,46 +56,25 @@ void SAL_CALL ConfigFlush::refresh()
// and is threadsafe by itself.
// Further it's not a good idea to hold the own lock
// if an outside object is called :-)
- css::lang::EventObject aSource (static_cast< css::util::XRefreshable* >(this));
- comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XRefreshListener>::get());
- if (!pContainer)
+ std::unique_lock g(m_aMutex);
+ if (!m_aRefreshListeners.getLength(g))
return;
-
- comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- // ... this pointer can be interesting to find out, where will be called as listener
- // Don't optimize it to a direct iterator cast :-)
- css::util::XRefreshListener* pListener = static_cast<css::util::XRefreshListener*>(pIterator.next());
- pListener->refreshed(aSource);
- }
- catch(const css::uno::Exception&)
- {
- // ignore any "damaged" flush listener!
- // May its remote reference is broken ...
- pIterator.remove();
- }
- }
+ css::lang::EventObject aSource(static_cast< css::util::XRefreshable* >(this));
+ m_aRefreshListeners.notifyEach(g, &css::util::XRefreshListener::refreshed, aSource);
}
void SAL_CALL ConfigFlush::addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
{
- // no locks necessary
- // used helper lives if we live and is threadsafe by itself ...
- m_lListener.addInterface(cppu::UnoType<css::util::XRefreshListener>::get(),
- xListener);
+ std::unique_lock g(m_aMutex);
+ m_aRefreshListeners.addInterface(g, xListener);
}
void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
{
- // no locks necessary
- // used helper lives if we live and is threadsafe by itself ...
- m_lListener.removeInterface(cppu::UnoType<css::util::XRefreshListener>::get(),
- xListener);
+ std::unique_lock g(m_aMutex);
+ m_aRefreshListeners.removeInterface(g, xListener);
}
diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx
index d033516733ac..ba20c9e9d505 100644
--- a/filter/source/config/cache/configflush.hxx
+++ b/filter/source/config/cache/configflush.hxx
@@ -20,9 +20,8 @@
#include <com/sun/star/util/XRefreshable.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <comphelper/multicontainer2.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/basemutex.hxx>
namespace filter::config {
@@ -34,14 +33,14 @@ namespace filter::config {
@descr Such refresh listener will be called in case the
type/filter configuration will be changed at runtime.
*/
-class ConfigFlush final : public cppu::BaseMutex
- , public ::cppu::WeakImplHelper<
+class ConfigFlush final : public ::cppu::WeakImplHelper<
css::util::XRefreshable,
css::lang::XServiceInfo
>
{
- /** @short holds all listener, which are registered at this instance. */
- comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener;
+ std::mutex m_aMutex;
+ /** @short holds all listener, which are registered at this instance. */
+ comphelper::OInterfaceContainerHelper4<css::util::XRefreshListener> m_aRefreshListeners;
// native interface
diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx
index 86e6e6de985c..a371fccf406e 100644
--- a/filter/source/config/cache/constant.hxx
+++ b/filter/source/config/cache/constant.hxx
@@ -20,68 +20,62 @@
#include <rtl/ustring.hxx>
-/* disable impl_loadOnDemand function of BaseContainer for certain
- functions, where it the feature "impl_loadItemOnDemand() of class FilterCache
- can be used instead of loadAll()!*/
-// #define LOAD_IMPLICIT
-
-
/** @short used to identify a some generic item properties against the
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
-inline constexpr OUStringLiteral PROPNAME_NAME = u"Name";
+inline constexpr OUString PROPNAME_NAME = u"Name"_ustr;
/** @short used to identify a type item property against the
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
-inline constexpr OUStringLiteral PROPNAME_UINAME = u"UIName";
-inline constexpr OUStringLiteral PROPNAME_UINAMES = u"UINames";
-inline constexpr OUStringLiteral PROPNAME_PREFERRED = u"Preferred";
-inline constexpr OUStringLiteral PROPNAME_PREFERREDFILTER = u"PreferredFilter";
-inline constexpr OUStringLiteral PROPNAME_DETECTSERVICE = u"DetectService";
-inline constexpr OUStringLiteral PROPNAME_MEDIATYPE = u"MediaType";
-inline constexpr OUStringLiteral PROPNAME_CLIPBOARDFORMAT = u"ClipboardFormat";
-inline constexpr OUStringLiteral PROPNAME_URLPATTERN = u"URLPattern";
-inline constexpr OUStringLiteral PROPNAME_EXTENSIONS = u"Extensions";
+inline constexpr OUString PROPNAME_UINAME = u"UIName"_ustr;
+inline constexpr OUString PROPNAME_UINAMES = u"UINames"_ustr;
+inline constexpr OUString PROPNAME_PREFERRED = u"Preferred"_ustr;
+inline constexpr OUString PROPNAME_PREFERREDFILTER = u"PreferredFilter"_ustr;
+inline constexpr OUString PROPNAME_DETECTSERVICE = u"DetectService"_ustr;
+inline constexpr OUString PROPNAME_MEDIATYPE = u"MediaType"_ustr;
+inline constexpr OUString PROPNAME_CLIPBOARDFORMAT = u"ClipboardFormat"_ustr;
+inline constexpr OUString PROPNAME_URLPATTERN = u"URLPattern"_ustr;
+inline constexpr OUString PROPNAME_EXTENSIONS = u"Extensions"_ustr;
/** @short used to identify a filter item property against the
configuration API and can be used at all name containers
(based on this filtercache) too.
*/
-inline constexpr OUStringLiteral PROPNAME_TYPE = u"Type";
-inline constexpr OUStringLiteral PROPNAME_DOCUMENTSERVICE = u"DocumentService";
-inline constexpr OUStringLiteral PROPNAME_FILTERSERVICE = u"FilterService";
-inline constexpr OUStringLiteral PROPNAME_UICOMPONENT = u"UIComponent";
-inline constexpr OUStringLiteral PROPNAME_FLAGS = u"Flags";
-inline constexpr OUStringLiteral PROPNAME_USERDATA = u"UserData";
-inline constexpr OUStringLiteral PROPNAME_TEMPLATENAME = u"TemplateName";
-inline constexpr OUStringLiteral PROPNAME_FILEFORMATVERSION = u"FileFormatVersion";
-inline constexpr OUStringLiteral PROPNAME_EXPORTEXTENSION = u"ExportExtension";
-inline constexpr OUStringLiteral PROPNAME_ENABLED = u"Enabled";
+inline constexpr OUString PROPNAME_TYPE = u"Type"_ustr;
+inline constexpr OUString PROPNAME_DOCUMENTSERVICE = u"DocumentService"_ustr;
+inline constexpr OUString PROPNAME_FILTERSERVICE = u"FilterService"_ustr;
+inline constexpr OUString PROPNAME_UICOMPONENT = u"UIComponent"_ustr;
+inline constexpr OUString PROPNAME_FLAGS = u"Flags"_ustr;
+inline constexpr OUString PROPNAME_USERDATA = u"UserData"_ustr;
+inline constexpr OUString PROPNAME_TEMPLATENAME = u"TemplateName"_ustr;
+inline constexpr OUString PROPNAME_FILEFORMATVERSION = u"FileFormatVersion"_ustr;
+inline constexpr OUString PROPNAME_EXPORTEXTENSION = u"ExportExtension"_ustr;
+inline constexpr OUString PROPNAME_ENABLED = u"Enabled"_ustr;
/** @short used to identify a frame loader or detect service item
property against the configuration API and can be used
at all name containers (based on this filtercache) too.
*/
-inline constexpr OUStringLiteral PROPNAME_TYPES = u"Types";
+inline constexpr OUString PROPNAME_TYPES = u"Types"_ustr;
/** @short used to identify the list of sorted filters for a specific
office module
*/
-inline constexpr OUStringLiteral PROPNAME_SORTEDFILTERLIST = u"SortedFilterList";
+inline constexpr OUString PROPNAME_SORTEDFILTERLIST = u"SortedFilterList"_ustr;
/** @short implicit properties. which are used at the container interface only.
*/
-inline constexpr OUStringLiteral PROPNAME_FINALIZED = u"Finalized";
-inline constexpr OUStringLiteral PROPNAME_MANDATORY = u"Mandatory";
+inline constexpr OUString PROPNAME_FINALIZED = u"Finalized"_ustr;
+inline constexpr OUString PROPNAME_MANDATORY = u"Mandatory"_ustr;
/** @short used to identify a set of items against the configuration API. */
-inline constexpr OUStringLiteral CFGSET_TYPES = u"Types";
-inline constexpr OUStringLiteral CFGSET_FILTERS = u"Filters";
-inline constexpr OUStringLiteral CFGSET_FRAMELOADERS = u"FrameLoaders";
-inline constexpr OUStringLiteral CFGSET_CONTENTHANDLERS = u"ContentHandlers";
+inline constexpr OUString CFGSET_TYPES = u"Types"_ustr;
+inline constexpr OUString CFGSET_FILTERS = u"Filters"_ustr;
+inline constexpr OUString CFGSET_FRAMELOADERS = u"FrameLoaders"_ustr;
+inline constexpr OUString CFGSET_CONTENTHANDLERS = u"ContentHandlers"_ustr;
/** @short used to address some configuration keys directly.
@@ -90,8 +84,8 @@ inline constexpr OUStringLiteral CFGSET_CONTENTHANDLERS = u"ContentHandlers";
@TODO define these direct keys ...
*/
-inline constexpr OUStringLiteral CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale";
-inline constexpr OUStringLiteral CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader";
+inline constexpr OUString CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale"_ustr;
+inline constexpr OUString CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader"_ustr;
#define CFGDIRECTKEY_PRODUCTNAME "/org.openoffice.Setup/Product/ooName"
// Note that these flag bits have parallel names in
@@ -99,55 +93,55 @@ inline constexpr OUStringLiteral CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openof
// documentation on their meaning.
/** @short names of filter flags, sorted in alphabetical order */
-inline constexpr OUStringLiteral FLAGNAME_3RDPARTYFILTER = u"3RDPARTYFILTER";
-inline constexpr OUStringLiteral FLAGNAME_ALIEN = u"ALIEN";
-inline constexpr OUStringLiteral FLAGNAME_CONSULTSERVICE = u"CONSULTSERVICE";
-inline constexpr OUStringLiteral FLAGNAME_DEFAULT = u"DEFAULT";
-inline constexpr OUStringLiteral FLAGNAME_ENCRYPTION = u"ENCRYPTION";
-inline constexpr OUStringLiteral FLAGNAME_EXPORT = u"EXPORT";
-inline constexpr OUStringLiteral FLAGNAME_GPGENCRYPTION = u"GPGENCRYPTION";
-inline constexpr OUStringLiteral FLAGNAME_IMPORT = u"IMPORT";
-inline constexpr OUStringLiteral FLAGNAME_INTERNAL = u"INTERNAL";
-inline constexpr OUStringLiteral FLAGNAME_NOTINFILEDIALOG = u"NOTINFILEDIALOG";
-inline constexpr OUStringLiteral FLAGNAME_NOTINSTALLED = u"NOTINSTALLED";
-inline constexpr OUStringLiteral FLAGNAME_OWN = u"OWN";
-inline constexpr OUStringLiteral FLAGNAME_PACKED = u"PACKED";
-inline constexpr OUStringLiteral FLAGNAME_PASSWORDTOMODIFY = u"PASSWORDTOMODIFY";
-inline constexpr OUStringLiteral FLAGNAME_PREFERRED = u"PREFERRED";
-inline constexpr OUStringLiteral FLAGNAME_STARTPRESENTATION = u"STARTPRESENTATION";
-inline constexpr OUStringLiteral FLAGNAME_READONLY = u"READONLY";
-inline constexpr OUStringLiteral FLAGNAME_SUPPORTSSELECTION = u"SUPPORTSSELECTION";
-inline constexpr OUStringLiteral FLAGNAME_TEMPLATE = u"TEMPLATE";
-inline constexpr OUStringLiteral FLAGNAME_TEMPLATEPATH = u"TEMPLATEPATH";
-inline constexpr OUStringLiteral FLAGNAME_COMBINED = u"COMBINED";
-inline constexpr OUStringLiteral FLAGNAME_SUPPORTSSIGNING = u"SUPPORTSSIGNING";
-inline constexpr OUStringLiteral FLAGNAME_EXOTIC = u"EXOTIC";
+inline constexpr OUString FLAGNAME_3RDPARTYFILTER = u"3RDPARTYFILTER"_ustr;
+inline constexpr OUString FLAGNAME_ALIEN = u"ALIEN"_ustr;
+inline constexpr OUString FLAGNAME_CONSULTSERVICE = u"CONSULTSERVICE"_ustr;
+inline constexpr OUString FLAGNAME_DEFAULT = u"DEFAULT"_ustr;
+inline constexpr OUString FLAGNAME_ENCRYPTION = u"ENCRYPTION"_ustr;
+inline constexpr OUString FLAGNAME_EXPORT = u"EXPORT"_ustr;
+inline constexpr OUString FLAGNAME_GPGENCRYPTION = u"GPGENCRYPTION"_ustr;
+inline constexpr OUString FLAGNAME_IMPORT = u"IMPORT"_ustr;
+inline constexpr OUString FLAGNAME_INTERNAL = u"INTERNAL"_ustr;
+inline constexpr OUString FLAGNAME_NOTINFILEDIALOG = u"NOTINFILEDIALOG"_ustr;
+inline constexpr OUString FLAGNAME_NOTINSTALLED = u"NOTINSTALLED"_ustr;
+inline constexpr OUString FLAGNAME_OWN = u"OWN"_ustr;
+inline constexpr OUString FLAGNAME_PACKED = u"PACKED"_ustr;
+inline constexpr OUString FLAGNAME_PASSWORDTOMODIFY = u"PASSWORDTOMODIFY"_ustr;
+inline constexpr OUString FLAGNAME_PREFERRED = u"PREFERRED"_ustr;
+inline constexpr OUString FLAGNAME_STARTPRESENTATION = u"STARTPRESENTATION"_ustr;
+inline constexpr OUString FLAGNAME_READONLY = u"READONLY"_ustr;
+inline constexpr OUString FLAGNAME_SUPPORTSSELECTION = u"SUPPORTSSELECTION"_ustr;
+inline constexpr OUString FLAGNAME_TEMPLATE = u"TEMPLATE"_ustr;
+inline constexpr OUString FLAGNAME_TEMPLATEPATH = u"TEMPLATEPATH"_ustr;
+inline constexpr OUString FLAGNAME_COMBINED = u"COMBINED"_ustr;
+inline constexpr OUString FLAGNAME_SUPPORTSSIGNING = u"SUPPORTSSIGNING"_ustr;
+inline constexpr OUString FLAGNAME_EXOTIC = u"EXOTIC"_ustr;
/** @short some uno service names.
*/
-inline constexpr OUStringLiteral SERVICE_CONFIGURATIONUPDATEACCESS = u"com.sun.star.configuration.ConfigurationUpdateAccess";
-inline constexpr OUStringLiteral SERVICE_CONFIGURATIONACCESS = u"com.sun.star.configuration.ConfigurationAccess";
+inline constexpr OUString SERVICE_CONFIGURATIONUPDATEACCESS = u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr;
+inline constexpr OUString SERVICE_CONFIGURATIONACCESS = u"com.sun.star.configuration.ConfigurationAccess"_ustr;
/** @short some configuration paths.
*/
-inline constexpr OUStringLiteral CFGPACKAGE_TD_TYPES = u"/org.openoffice.TypeDetection.Types";
-inline constexpr OUStringLiteral CFGPACKAGE_TD_FILTERS = u"/org.openoffice.TypeDetection.Filter";
-inline constexpr OUStringLiteral CFGPACKAGE_TD_OTHERS = u"/org.openoffice.TypeDetection.Misc";
-inline constexpr OUStringLiteral CFGPACKAGE_TD_OLD = u"/org.openoffice.Office.TypeDetection";
+inline constexpr OUString CFGPACKAGE_TD_TYPES = u"/org.openoffice.TypeDetection.Types"_ustr;
+inline constexpr OUString CFGPACKAGE_TD_FILTERS = u"/org.openoffice.TypeDetection.Filter"_ustr;
+inline constexpr OUString CFGPACKAGE_TD_OTHERS = u"/org.openoffice.TypeDetection.Misc"_ustr;
+inline constexpr OUString CFGPACKAGE_TD_OLD = u"/org.openoffice.Office.TypeDetection"_ustr;
/** @short some default values.
*/
-inline constexpr OUStringLiteral DEFAULT_OFFICELOCALE = u"en-US";
+inline constexpr OUString DEFAULT_OFFICELOCALE = u"en-US"_ustr;
/** @short used for the queries of the FilterFactory service.
*/
-inline constexpr OUStringLiteral QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE = u"matchByDocumentService";
-inline constexpr OUStringLiteral QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE = u"getDefaultFilterForType";
-inline constexpr OUStringLiteral QUERY_IDENTIFIER_GET_SORTED_FILTERLIST = u"getSortedFilterList()";
+inline constexpr OUString QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE = u"matchByDocumentService"_ustr;
+inline constexpr OUString QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE = u"getDefaultFilterForType"_ustr;
+inline constexpr OUString QUERY_IDENTIFIER_GET_SORTED_FILTERLIST = u"getSortedFilterList()"_ustr;
-inline constexpr OUStringLiteral QUERY_PARAM_IFLAGS = u"iflags";
-inline constexpr OUStringLiteral QUERY_PARAM_EFLAGS = u"eflags";
-inline constexpr OUStringLiteral QUERY_PARAM_MODULE = u"module";
+inline constexpr OUString QUERY_PARAM_IFLAGS = u"iflags"_ustr;
+inline constexpr OUString QUERY_PARAM_EFLAGS = u"eflags"_ustr;
+inline constexpr OUString QUERY_PARAM_MODULE = u"module"_ustr;
#define QUERY_CONSTVALUE_ALL "all"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx
index 864911798dfd..f844362b6907 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 );
}
@@ -53,7 +52,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea
css::uno::Reference< css::uno::XInterface > xHandler;
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
auto & cache = GetTheFilterCache();
@@ -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..2abf11a5ada9 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -19,7 +19,7 @@
#include <memory>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "filtercache.hxx"
#include "constant.hxx"
#include "cacheupdatelistener.hxx"
@@ -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
+ std::span< const css::beans::NamedValue > lIProps,
+ std::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;
@@ -761,7 +773,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
return m_xConfigTypes;
sPath = CFGPACKAGE_TD_TYPES;
pConfig = &m_xConfigTypes;
- sRtlLog = "impl_openconfig(E_PROVIDER_TYPES)";
+ sRtlLog = "impl_openconfig(E_PROVIDER_TYPES)"_ostr;
}
break;
@@ -771,7 +783,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
return m_xConfigFilters;
sPath = CFGPACKAGE_TD_FILTERS;
pConfig = &m_xConfigFilters;
- sRtlLog = "impl_openconfig(E_PROVIDER_FILTERS)";
+ sRtlLog = "impl_openconfig(E_PROVIDER_FILTERS)"_ostr;
}
break;
@@ -781,7 +793,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
return m_xConfigOthers;
sPath = CFGPACKAGE_TD_OTHERS;
pConfig = &m_xConfigOthers;
- sRtlLog = "impl_openconfig(E_PROVIDER_OTHERS)";
+ sRtlLog = "impl_openconfig(E_PROVIDER_OTHERS)"_ostr;
}
break;
@@ -791,7 +803,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
// the old configuration format only. It's not cached!
sPath = CFGPACKAGE_TD_OLD;
pConfig = &xOld;
- sRtlLog = "impl_openconfig(E_PROVIDER_OLD)";
+ sRtlLog = "impl_openconfig(E_PROVIDER_OLD)"_ostr;
}
break;
@@ -828,7 +840,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
return *pConfig;
}
-css::uno::Any FilterCache::impl_getDirectCFGValue(const OUString& sDirectKey)
+css::uno::Any FilterCache::impl_getDirectCFGValue(std::u16string_view sDirectKey)
{
OUString sRoot;
OUString sKey ;
@@ -876,7 +888,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess
css::uno::Reference< css::uno::XInterface > xCfg;
- if (!utl::ConfigManager::IsFuzzing())
+ if (!comphelper::IsFuzzing())
{
try
{
@@ -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);
{
@@ -1815,6 +1827,37 @@ void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XName
}
}
+namespace {
+ constexpr struct {
+ SfxFilterFlags eFlag;
+ OUString aName;
+ } flagFilterSwitcher[] = {
+ { SfxFilterFlags::STARONEFILTER, FLAGNAME_3RDPARTYFILTER },
+ { SfxFilterFlags::ALIEN, FLAGNAME_ALIEN },
+ { SfxFilterFlags::CONSULTSERVICE, FLAGNAME_CONSULTSERVICE },
+ { SfxFilterFlags::DEFAULT, FLAGNAME_DEFAULT },
+ { SfxFilterFlags::ENCRYPTION, FLAGNAME_ENCRYPTION },
+ { SfxFilterFlags::EXPORT, FLAGNAME_EXPORT },
+ { SfxFilterFlags::IMPORT, FLAGNAME_IMPORT },
+ { SfxFilterFlags::INTERNAL, FLAGNAME_INTERNAL },
+ { SfxFilterFlags::NOTINFILEDLG, FLAGNAME_NOTINFILEDIALOG },
+ { SfxFilterFlags::MUSTINSTALL, FLAGNAME_NOTINSTALLED },
+ { SfxFilterFlags::OWN, FLAGNAME_OWN },
+ { SfxFilterFlags::PACKED, FLAGNAME_PACKED },
+ { SfxFilterFlags::PASSWORDTOMODIFY, FLAGNAME_PASSWORDTOMODIFY },
+ { SfxFilterFlags::PREFERED, FLAGNAME_PREFERRED },
+ { SfxFilterFlags::STARTPRESENTATION, FLAGNAME_STARTPRESENTATION },
+ { SfxFilterFlags::OPENREADONLY, FLAGNAME_READONLY },
+ { SfxFilterFlags::SUPPORTSSELECTION, FLAGNAME_SUPPORTSSELECTION },
+ { SfxFilterFlags::TEMPLATE, FLAGNAME_TEMPLATE },
+ { SfxFilterFlags::TEMPLATEPATH, FLAGNAME_TEMPLATEPATH },
+ { SfxFilterFlags::COMBINED, FLAGNAME_COMBINED },
+ { SfxFilterFlags::SUPPORTSSIGNING, FLAGNAME_SUPPORTSSIGNING },
+ { SfxFilterFlags::GPGENCRYPTION, FLAGNAME_GPGENCRYPTION },
+ { SfxFilterFlags::EXOTIC, FLAGNAME_EXOTIC },
+ };
+}
+
/*-----------------------------------------------
static! => no locks necessary
-----------------------------------------------*/
@@ -1822,29 +1865,11 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(SfxF
{
std::vector<OUString> lFlagNames;
- if (nFlags & SfxFilterFlags::STARONEFILTER ) lFlagNames.emplace_back(FLAGNAME_3RDPARTYFILTER );
- if (nFlags & SfxFilterFlags::ALIEN ) lFlagNames.emplace_back(FLAGNAME_ALIEN );
- if (nFlags & SfxFilterFlags::CONSULTSERVICE ) lFlagNames.emplace_back(FLAGNAME_CONSULTSERVICE );
- if (nFlags & SfxFilterFlags::DEFAULT ) lFlagNames.emplace_back(FLAGNAME_DEFAULT );
- if (nFlags & SfxFilterFlags::ENCRYPTION ) lFlagNames.emplace_back(FLAGNAME_ENCRYPTION );
- if (nFlags & SfxFilterFlags::EXPORT ) lFlagNames.emplace_back(FLAGNAME_EXPORT );
- if (nFlags & SfxFilterFlags::IMPORT ) lFlagNames.emplace_back(FLAGNAME_IMPORT );
- if (nFlags & SfxFilterFlags::INTERNAL ) lFlagNames.emplace_back(FLAGNAME_INTERNAL );
- if (nFlags & SfxFilterFlags::NOTINFILEDLG ) lFlagNames.emplace_back(FLAGNAME_NOTINFILEDIALOG );
- if (nFlags & SfxFilterFlags::MUSTINSTALL ) lFlagNames.emplace_back(FLAGNAME_NOTINSTALLED );
- if (nFlags & SfxFilterFlags::OWN ) lFlagNames.emplace_back(FLAGNAME_OWN );
- if (nFlags & SfxFilterFlags::PACKED ) lFlagNames.emplace_back(FLAGNAME_PACKED );
- if (nFlags & SfxFilterFlags::PASSWORDTOMODIFY ) lFlagNames.emplace_back(FLAGNAME_PASSWORDTOMODIFY );
- if (nFlags & SfxFilterFlags::PREFERED ) lFlagNames.emplace_back(FLAGNAME_PREFERRED );
- if (nFlags & SfxFilterFlags::STARTPRESENTATION) lFlagNames.emplace_back(FLAGNAME_STARTPRESENTATION);
- if (nFlags & SfxFilterFlags::OPENREADONLY ) lFlagNames.emplace_back(FLAGNAME_READONLY );
- if (nFlags & SfxFilterFlags::SUPPORTSSELECTION) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSELECTION);
- if (nFlags & SfxFilterFlags::TEMPLATE ) lFlagNames.emplace_back(FLAGNAME_TEMPLATE );
- if (nFlags & SfxFilterFlags::TEMPLATEPATH ) lFlagNames.emplace_back(FLAGNAME_TEMPLATEPATH );
- if (nFlags & SfxFilterFlags::COMBINED ) lFlagNames.emplace_back(FLAGNAME_COMBINED );
- if (nFlags & SfxFilterFlags::SUPPORTSSIGNING) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSIGNING);
- if (nFlags & SfxFilterFlags::GPGENCRYPTION) lFlagNames.emplace_back(FLAGNAME_GPGENCRYPTION);
- if (nFlags & SfxFilterFlags::EXOTIC) lFlagNames.emplace_back(FLAGNAME_EXOTIC);
+ for (const auto& [eFlag, aName] : flagFilterSwitcher)
+ {
+ if (nFlags & eFlag)
+ lFlagNames.emplace_back(aName);
+ }
return comphelper::containerToSequence(lFlagNames);
}
@@ -1860,120 +1885,12 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ
sal_Int32 c = lNames.getLength();
for (sal_Int32 i=0; i<c; ++i)
{
- if (pNames[i] == FLAGNAME_3RDPARTYFILTER)
- {
- nField |= SfxFilterFlags::STARONEFILTER;
- continue;
- }
- if (pNames[i] == FLAGNAME_ALIEN)
- {
- nField |= SfxFilterFlags::ALIEN;
- continue;
- }
- if (pNames[i] == FLAGNAME_CONSULTSERVICE)
- {
- nField |= SfxFilterFlags::CONSULTSERVICE;
- continue;
- }
- if (pNames[i] == FLAGNAME_DEFAULT)
- {
- nField |= SfxFilterFlags::DEFAULT;
- continue;
- }
- if (pNames[i] == FLAGNAME_ENCRYPTION)
- {
- nField |= SfxFilterFlags::ENCRYPTION;
- continue;
- }
- if (pNames[i] == FLAGNAME_EXOTIC)
- {
- nField |= SfxFilterFlags::EXOTIC;
- continue;
- }
- if (pNames[i] == FLAGNAME_EXPORT)
+ for (const auto& [eFlag, aName] : flagFilterSwitcher)
{
- nField |= SfxFilterFlags::EXPORT;
- continue;
- }
- if (pNames[i] == FLAGNAME_GPGENCRYPTION)
- {
- nField |= SfxFilterFlags::GPGENCRYPTION;
- continue;
- }
- if (pNames[i] == FLAGNAME_IMPORT)
- {
- nField |= SfxFilterFlags::IMPORT;
- continue;
- }
- if (pNames[i] == FLAGNAME_INTERNAL)
- {
- nField |= SfxFilterFlags::INTERNAL;
- continue;
- }
- if (pNames[i] == FLAGNAME_NOTINFILEDIALOG)
- {
- nField |= SfxFilterFlags::NOTINFILEDLG;
- continue;
- }
- if (pNames[i] == FLAGNAME_NOTINSTALLED)
- {
- nField |= SfxFilterFlags::MUSTINSTALL;
- continue;
- }
- if (pNames[i] == FLAGNAME_OWN)
- {
- nField |= SfxFilterFlags::OWN;
- continue;
- }
- if (pNames[i] == FLAGNAME_PACKED)
- {
- nField |= SfxFilterFlags::PACKED;
- continue;
- }
- if (pNames[i] == FLAGNAME_PASSWORDTOMODIFY)
- {
- nField |= SfxFilterFlags::PASSWORDTOMODIFY;
- continue;
- }
- if (pNames[i] == FLAGNAME_PREFERRED)
- {
- nField |= SfxFilterFlags::PREFERED;
- continue;
- }
- if (pNames[i] == FLAGNAME_STARTPRESENTATION)
- {
- nField |= SfxFilterFlags::STARTPRESENTATION;
- continue;
- }
- if (pNames[i] == FLAGNAME_SUPPORTSSIGNING)
- {
- nField |= SfxFilterFlags::SUPPORTSSIGNING;
- continue;
- }
- if (pNames[i] == FLAGNAME_READONLY)
- {
- nField |= SfxFilterFlags::OPENREADONLY;
- continue;
- }
- if (pNames[i] == FLAGNAME_SUPPORTSSELECTION)
- {
- nField |= SfxFilterFlags::SUPPORTSSELECTION;
- continue;
- }
- if (pNames[i] == FLAGNAME_TEMPLATE)
- {
- nField |= SfxFilterFlags::TEMPLATE;
- continue;
- }
- if (pNames[i] == FLAGNAME_TEMPLATEPATH)
- {
- nField |= SfxFilterFlags::TEMPLATEPATH;
- continue;
- }
- if (pNames[i] == FLAGNAME_COMBINED)
- {
- nField |= SfxFilterFlags::COMBINED;
- continue;
+ if (pNames[i] == aName) {
+ nField |= eFlag;
+ break;
+ }
}
}
@@ -2146,14 +2063,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 +2086,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 +2103,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..8445efea8227 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include "cacheitem.hxx"
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -361,9 +362,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,
+ std::span< const css::beans::NamedValue > lIProps,
+ std::span< const css::beans::NamedValue > lEProps = {}) const;
/** @short indicates if the requested sub container
@@ -524,10 +525,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 +599,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
@@ -665,7 +665,7 @@ class FilterCache : public cppu::BaseMutex
Can be empty if an internal error occurred or if the requested
key does not exists!
*/
- css::uno::Any impl_getDirectCFGValue(const OUString& sDirectKey);
+ css::uno::Any impl_getDirectCFGValue(std::u16string_view sDirectKey);
/** @short load the underlying configuration into this cache.
@@ -891,7 +891,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..9b0793b94e1e 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -55,9 +55,9 @@ 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" ,
- { "com.sun.star.document.FilterFactory" },
+ static const css::uno::Sequence<OUString> sServiceNames { "com.sun.star.document.FilterFactory" };
+ BaseContainer::init("com.sun.star.comp.filter.config.FilterFactory" ,
+ sServiceNames,
FilterCache::E_FILTER );
}
@@ -77,7 +77,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan
const css::uno::Sequence< css::uno::Any >& lArguments)
{
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
auto & cache = GetTheFilterCache();
@@ -103,7 +103,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 +121,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; }
@@ -153,8 +152,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
if (pos != -1)
{
OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'");
- OUString sPatchedQuery(OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7));
- sNewQuery = sPatchedQuery;
+ sNewQuery = OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7);
}
// analyze query and split it into its tokens
@@ -167,10 +165,10 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
{
// SAFE -> ----------------------
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// May be not all filters was loaded ...
// But we need it now!
- impl_loadOnDemand();
+ impl_loadOnDemand(aLock);
}
// <- SAFE ----------------------
@@ -187,8 +185,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea
// pack list of item names as an enum list
// Attention: Do not return empty reference for empty list!
// The outside check "hasMoreElements()" should be enough, to detect this state :-)
- css::uno::Sequence< OUString > lSet = comphelper::containerToSequence(lEnumSet);
- return new ::comphelper::OEnumerationByName(this, lSet);
+ return new ::comphelper::OEnumerationByName(this, std::move(lEnumSet));
}
@@ -253,10 +250,10 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer
nEFlags = pIt->second.toInt32();
// SAFE -> ----------------------
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// search suitable filters
- FilterCache* pCache = impl_getWorkingCache();
+ FilterCache* pCache = impl_getWorkingCache(aLock);
std::vector<OUString> lFilterNames = pCache->getItemNames(FilterCache::E_FILTER);
std::vector<OUString> lResult ;
@@ -314,7 +311,7 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer
{ continue; }
}
- aLock.clear();
+ aLock.unlock();
// <- SAFE ----------------------
return lResult;
@@ -391,7 +388,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 +403,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,14 +417,13 @@ 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);
- FilterCache* pCache = impl_getWorkingCache();
+ std::unique_lock aLock(m_aMutex);
+ FilterCache* pCache = impl_getWorkingCache(aLock);
std::vector<OUString> lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps);
- aLock.clear();
+ aLock.unlock();
// <- SAFE ----------------------
// bring "other" filters in an alphabetical order
@@ -453,13 +442,11 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS
// remove all filters from this merged list, which does not fit the flag specification
if (nIFlags != -1)
{
- auto pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nIFlags, true));
- lMergedFilters.erase(pItToErase, lMergedFilters.end());
+ std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, nIFlags, true));
}
if (nEFlags != -1)
{
- auto pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nEFlags, false));
- lMergedFilters.erase(pItToErase, lMergedFilters.end());
+ std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, nEFlags, false));
}
// sort the default filter to the front of this list
@@ -469,17 +456,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..ee78ebd98979 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 );
}
@@ -51,7 +50,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI
const css::uno::Sequence< css::uno::Any >& lArguments)
{
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
auto & cache = GetTheFilterCache();
@@ -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..065fe483a3dd 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -25,16 +25,25 @@
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include <sfx2/brokenpackageint.hxx>
+#include <o3tl/string_view.hxx>
#include <tools/wldcrd.hxx>
#include <sal/log.hxx>
#include <framework/interaction.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/fileurl.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/scopeguard.hxx>
+#include <utility>
#define DEBUG_TYPE_DETECTION 0
@@ -54,8 +63,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 );
}
@@ -72,7 +80,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const OUString& sURL)
OUString sType;
// SAFE ->
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
css::util::URL aURL;
aURL.Complete = sURL;
@@ -125,7 +133,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.
@@ -210,6 +218,7 @@ int getFlatTypeRank(const OUString& rType)
"calc_SYLK",
"calc_DIF",
"calc_dBase",
+ "Apache Parquet",
// Binary (raster and vector image files)
"emf_MS_Windows_Metafile",
@@ -232,6 +241,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",
@@ -282,11 +292,11 @@ int getFlatTypeRank(const OUString& rType)
"math_MathType_3x", // MathType equation embedded in Word doc.
};
- size_t n = SAL_N_ELEMENTS(ranks);
+ size_t n = std::size(ranks);
for (size_t i = 0; i < n; ++i)
{
- if (rType.equalsAscii(ranks[i]))
+ if (o3tl::equalsAscii(rType, ranks[i]))
return n - i - 1;
}
@@ -344,7 +354,7 @@ class FindByType
{
OUString maType;
public:
- explicit FindByType(const OUString& rType) : maType(rType) {}
+ explicit FindByType(OUString aType) : maType(std::move(aType)) {}
bool operator() (const FlatDetectionInfo& rInfo) const
{
return rInfo.sType == maType;
@@ -377,7 +387,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
try
{
// SAFE -> ----------------------------------
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// parse given URL to split it into e.g. main and jump marks ...
sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString());
@@ -403,9 +413,9 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css::
}
FlatDetection lFlatTypes;
- impl_getAllFormatTypes(aURL, stlDescriptor, lFlatTypes);
+ impl_getAllFormatTypes(aLock, aURL, stlDescriptor, lFlatTypes);
- aLock.clear();
+ aLock.unlock();
// <- SAFE ----------------------------------
// Properly prioritize all candidate types.
@@ -487,25 +497,25 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
OUString sRealType = sType;
// SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
// Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-(
// 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();
+ aLock.unlock();
// <- SAFE
for (auto const& filter : lFilters)
{
// SAFE ->
- aLock.reset();
+ aLock.lock();
try
{
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, filter);
@@ -518,7 +528,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
break;
}
catch(const css::uno::Exception&) {}
- aLock.clear();
+ aLock.unlock();
// <- SAFE
}
@@ -544,16 +554,10 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
sFilter.clear();
try
{
- // SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
-
CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType);
aType[PROPNAME_PREFERREDFILTER] >>= sFilter;
cache.getItem(FilterCache::E_FILTER, sFilter);
- aLock.clear();
- // <- SAFE
-
// no exception => found valid type and filter => set it on the given descriptor
rDescriptor[utl::MediaDescriptor::PROP_TYPENAME ] <<= sType ;
rDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= sFilter;
@@ -567,27 +571,19 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
sFilter.clear();
try
{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aMutex);
-
// Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-(
// 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();
- // <- SAFE
-
for (auto const& filter : lFilters)
{
sFilter = filter;
- // SAFE ->
- aLock.reset();
try
{
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);
@@ -599,8 +595,6 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
}
catch(const css::uno::Exception&)
{ continue; }
- aLock.clear();
- // <- SAFE
sFilter.clear();
}
@@ -618,6 +612,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
bool TypeDetection::impl_getPreselectionForType(
+ std::unique_lock<std::mutex>& /*rGuard*/,
const OUString& sPreSelType, const util::URL& aParsedURL, FlatDetection& rFlatTypes, bool bDocService)
{
// Can be used to suppress execution of some parts of this method
@@ -639,10 +634,7 @@ bool TypeDetection::impl_getPreselectionForType(
CacheItem aType;
try
{
- // SAFE -> --------------------------
- osl::MutexGuard aLock(m_aMutex);
aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType);
- // <- SAFE --------------------------
}
catch(const css::container::NoSuchElementException&)
{
@@ -669,8 +661,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)
{
@@ -719,25 +711,22 @@ bool TypeDetection::impl_getPreselectionForType(
}
void TypeDetection::impl_getPreselectionForDocumentService(
+ std::unique_lock<std::mutex>& rGuard,
const OUString& sPreSelDocumentService, const util::URL& aParsedURL, FlatDetection& rFlatTypes)
{
// get all filters, which match to this doc service
std::vector<OUString> lFilters;
try
{
- // SAFE -> --------------------------
- osl::MutexGuard aLock(m_aMutex);
-
// Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-(
// That can disturb our "load on demand feature". But we have no other chance!
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 --------------------------
}
catch (const css::container::NoSuchElementException&)
{
@@ -751,20 +740,19 @@ void TypeDetection::impl_getPreselectionForDocumentService(
// is an easier job than removing them .-)
for (auto const& filter : lFilters)
{
- OUString aType = impl_getTypeFromFilter(filter);
+ OUString aType = impl_getTypeFromFilter(rGuard, filter);
if (aType.isEmpty())
continue;
- impl_getPreselectionForType(aType, aParsedURL, rFlatTypes, true);
+ impl_getPreselectionForType(rGuard, aType, aParsedURL, rFlatTypes, true);
}
}
-OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName)
+OUString TypeDetection::impl_getTypeFromFilter(std::unique_lock<std::mutex>& /*rGuard*/, const OUString& rFilterName)
{
CacheItem aFilter;
try
{
- osl::MutexGuard aLock(m_aMutex);
aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName);
}
catch (const container::NoSuchElementException&)
@@ -778,6 +766,7 @@ OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName)
}
void TypeDetection::impl_getAllFormatTypes(
+ std::unique_lock<std::mutex>& rGuard,
const util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor, FlatDetection& rFlatTypes)
{
rFlatTypes.clear();
@@ -786,7 +775,6 @@ void TypeDetection::impl_getAllFormatTypes(
std::vector<OUString> aFilterNames;
try
{
- osl::MutexGuard aLock(m_aMutex);
auto & cache = GetTheFilterCache();
cache.load(FilterCache::E_CONTAINS_FILTERS);
aFilterNames = cache.getItemNames(FilterCache::E_FILTER);
@@ -799,7 +787,7 @@ void TypeDetection::impl_getAllFormatTypes(
// Retrieve the default type for each of these filters, and store them.
for (auto const& filterName : aFilterNames)
{
- OUString aType = impl_getTypeFromFilter(filterName);
+ OUString aType = impl_getTypeFromFilter(rGuard, filterName);
if (aType.isEmpty())
continue;
@@ -842,12 +830,81 @@ void TypeDetection::impl_getAllFormatTypes(
// Mark pre-selected type (if any) to have it prioritized.
OUString sSelectedType = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_TYPENAME, OUString());
if (!sSelectedType.isEmpty())
- impl_getPreselectionForType(sSelectedType, aParsedURL, rFlatTypes, false);
+ impl_getPreselectionForType(rGuard, sSelectedType, aParsedURL, rFlatTypes, false);
// Mark all types preferred by the current document service, to have it prioritized.
OUString sSelectedDoc = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString());
if (!sSelectedDoc.isEmpty())
- impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes);
+ impl_getPreselectionForDocumentService(rGuard, sSelectedDoc, aParsedURL, rFlatTypes);
+}
+
+
+static bool isBrokenZIP(const css::uno::Reference<css::io::XInputStream>& xStream,
+ const css::uno::Reference<css::uno::XComponentContext>& xContext)
+{
+ try
+ {
+ // Only consider seekable streams starting with "PK", to avoid false detections
+ css::uno::Reference<css::io::XSeekable> xSeek(xStream, css::uno::UNO_QUERY_THROW);
+ comphelper::ScopeGuard restorePos(
+ [xSeek, nPos = xSeek->getPosition()]
+ {
+ try
+ {
+ xSeek->seek(nPos);
+ }
+ catch (const css::uno::Exception&)
+ {
+ }
+ });
+ css::uno::Sequence<sal_Int8> magic(2);
+ xStream->readBytes(magic, 2);
+ if (magic.getLength() < 2 || magic[0] != 'P' || magic[1] != 'K')
+ return false;
+ }
+ catch (const css::uno::Exception&)
+ {
+ return false;
+ }
+
+ std::vector<css::uno::Any> aArguments{
+ css::uno::Any(xStream),
+ css::uno::Any(css::beans::NamedValue("AllowRemoveOnInsert", css::uno::Any(false))),
+ css::uno::Any(css::beans::NamedValue("StorageFormat",
+ css::uno::Any(css::embed::StorageFormats::ZIP))),
+ };
+ try
+ {
+ // If this is a broken ZIP package, or not a ZIP, this would throw ZipIOException
+ xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.packages.comp.ZipPackage", comphelper::containerToSequence(aArguments),
+ xContext);
+ }
+ catch (const css::packages::zip::ZipIOException&)
+ {
+ // Now test if repair will succeed
+ aArguments.emplace_back(css::beans::NamedValue("RepairPackage", css::uno::Any(true)));
+ try
+ {
+ // If this is a broken ZIP package that can be repaired, this would succeed,
+ // and the result will be not empty
+ if (css::uno::Reference<css::beans::XPropertySet> xPackage{
+ xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.packages.comp.ZipPackage",
+ comphelper::containerToSequence(aArguments), xContext),
+ css::uno::UNO_QUERY })
+ if (bool bHasElements; xPackage->getPropertyValue("HasElements") >>= bHasElements)
+ return bHasElements;
+ }
+ catch (const css::uno::Exception&)
+ {
+ }
+ }
+ catch (const css::uno::Exception&)
+ {
+ }
+ // The package is either not broken, or is not a repairable ZIP
+ return false;
}
@@ -860,6 +917,65 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r
// a set and a not set value.
rLastChance.clear();
+ // tdf#96401: First of all, check if this is a broken ZIP package. Not doing this here would
+ // make some filters silently not recognize their content in broken packages, and some filters
+ // show a warning and mistakenly claim own content based on user choice.
+ if (bAllowDeep && !rDescriptor.getUnpackedValueOrDefault("RepairPackage", false)
+ && rDescriptor.getUnpackedValueOrDefault("RepairAllowed", true)
+ && rDescriptor.contains(utl::MediaDescriptor::PROP_INTERACTIONHANDLER))
+ {
+ try
+ {
+ impl_openStream(rDescriptor);
+ if (auto xStream = rDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_INPUTSTREAM,
+ css::uno::Reference<css::io::XInputStream>()))
+ {
+ css::uno::Reference<css::uno::XComponentContext> xContext;
+
+ // SAFE ->
+ {
+ std::unique_lock aLock(m_aMutex);
+ xContext = m_xContext;
+ }
+ // <- SAFE
+
+ if (isBrokenZIP(xStream, xContext))
+ {
+ if (css::uno::Reference<css::task::XInteractionHandler> xInteraction{
+ rDescriptor.getValue(utl::MediaDescriptor::PROP_INTERACTIONHANDLER),
+ css::uno::UNO_QUERY })
+ {
+ INetURLObject aURL(rDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_URL, OUString()));
+ OUString aDocumentTitle
+ = aURL.getName(INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::DecodeMechanism::WithCharset);
+
+ // Ask the user whether they wants to try to repair
+ RequestPackageReparation aRequest(aDocumentTitle);
+ xInteraction->handle(aRequest.GetRequest());
+
+ if (aRequest.isApproved())
+ {
+ // lok: we want to overwrite file in jail, so don't use template flag
+ const bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+ rDescriptor[utl::MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle;
+ rDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE] <<= !bIsLOK;
+ rDescriptor["RepairPackage"] <<= true;
+ }
+ else
+ rDescriptor["RepairAllowed"] <<= false; // Do not ask again
+ }
+ }
+ }
+ }
+ catch (const css::uno::Exception&)
+ {
+ // No problem
+ }
+ }
+
// step over all possible types for this URL.
// solutions:
// a) no types => no detection
@@ -896,9 +1012,9 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r
try
{
// SAFE -> ----------------------------------
- osl::ClearableMutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType);
- aLock.clear();
+ aLock.unlock();
OUString sDetectService;
aType[PROPNAME_DETECTSERVICE] >>= sDetectService;
@@ -974,7 +1090,7 @@ OUString TypeDetection::impl_askDetectService(const OUString& sDet
// SAFE ->
{
- osl::MutexGuard aLock(m_aMutex);
+ std::unique_lock aLock(m_aMutex);
xContext = m_xContext;
}
// <- SAFE
@@ -1090,7 +1206,6 @@ OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescript
OUString sFilter = aRequest.getFilter();
if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter))
return OUString();
-
OUString sType;
rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] >>= sType;
return sType;
@@ -1118,7 +1233,7 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor)
if ( !bSuccess )
throw css::uno::Exception(
"Could not open stream for <" + sURL + ">",
- static_cast<OWeakObject *>(this));
+ getXWeak());
if ( !bRequestedReadOnly )
{
@@ -1145,16 +1260,11 @@ void TypeDetection::impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor& rD
bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor,
const OUString& sType )
{
- // SAFE ->
+ if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType))
{
- osl::MutexGuard aLock(m_aMutex);
- if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType))
- {
- rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType;
- return true;
- }
+ rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType;
+ return true;
}
- // <- SAFE
// remove all related information from the descriptor
impl_removeTypeFilterFromDescriptor(rDescriptor);
@@ -1162,22 +1272,16 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript
}
-bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor,
- const OUString& sFilter )
+bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor,
+ const OUString& sFilter )
{
try
{
- // SAFE ->
- osl::ClearableMutexGuard aLock(m_aMutex);
-
auto & cache = GetTheFilterCache();
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);
OUString sType;
aFilter[PROPNAME_TYPE] >>= sType;
- aLock.clear();
- // <- SAFE
-
// found valid type and filter => set it on the given descriptor
rDescriptor[utl::MediaDescriptor::PROP_TYPENAME ] <<= sType ;
rDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= sFilter;
diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx
index 79145e836d17..6ff70e64eba4 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 {
@@ -69,18 +70,21 @@ public:
private:
- bool impl_getPreselectionForType(
+ static bool impl_getPreselectionForType(
+ std::unique_lock<std::mutex>& rGuard,
const OUString& sPreSelType, const css::util::URL& aParsedURL, FlatDetection& rFlatTypes, bool bDocService);
- void impl_getPreselectionForDocumentService(
+ static void impl_getPreselectionForDocumentService(
+ std::unique_lock<std::mutex>& rGuard,
const OUString& sPreSelDocumentService, const css::util::URL& aParsedURL, FlatDetection& rFlatTypes);
- OUString impl_getTypeFromFilter(const OUString& rFilterName);
+ static OUString impl_getTypeFromFilter(std::unique_lock<std::mutex>& rGuard, const OUString& rFilterName);
/**
* Get all format types that we handle.
*/
- void impl_getAllFormatTypes(
+ static void impl_getAllFormatTypes(
+ std::unique_lock<std::mutex>& rGuard,
const css::util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor,
FlatDetection& rFlatTypes);
@@ -172,7 +176,7 @@ private:
@return [string]
a valid type name or an empty string if user canceled interaction.
*/
- OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor);
+ static OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor);
/** @short check if an input stream is already part of the
@@ -229,8 +233,8 @@ private:
@return TRUE the specified type and its registrations was valid(!) and
could be set on the descriptor.
*/
- bool impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor,
- const OUString& sType );
+ static bool impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor,
+ const OUString& sType );
/** @short validate the specified filter and its relationships
@@ -250,7 +254,8 @@ private:
@return TRUE the specified type and its registrations was valid(!) and
could be set on the descriptor.
*/
- bool impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor,
+ static bool impl_validateAndSetFilterOnDescriptor(
+ utl::MediaDescriptor& rDescriptor,
const OUString& sFilter );
@@ -316,15 +321,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 +344,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/APNG___Animated_Portable_Network_Graphic.xcu b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..79c118c46d10
--- /dev/null
+++ b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.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="APNG - Animated Portable Network Graphic" 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">APNG - Animated Portable Network Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</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/EMZ___Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..4d76ea375bad
--- /dev/null
+++ b/filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.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="EMZ - Compressed MS Windows Metafile" 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">EMZ - Compressed Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</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/MS_PowerPoint_97.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu
index eab7c73e316d..73ea306af0b1 100644
--- a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu
@@ -19,7 +19,7 @@
<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"/>
- <prop oor:name="UserData"><value>sdfilt</value></prop>
+ <prop oor:name="UserData"><value>sd</value></prop>
<prop oor:name="UIName">
<value xml:lang="en-US">PowerPoint 97–2003</value>
</prop>
diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu
index 24683ea1b8b7..62358fa79ec0 100644
--- a/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu
@@ -19,7 +19,7 @@
<prop oor:name="Flags"><value>IMPORT EXPORT ALIEN STARTPRESENTATION</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"/>
- <prop oor:name="UserData"><value>sdfilt</value></prop>
+ <prop oor:name="UserData"><value>sd</value></prop>
<prop oor:name="UIName">
<value xml:lang="en-US">PowerPoint 97–2003 AutoPlay</value>
</prop>
diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu
index 4de589b1d908..098b2947afee 100644
--- a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu
+++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu
@@ -19,7 +19,7 @@
<prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"/>
- <prop oor:name="UserData"><value>sdfilt</value></prop>
+ <prop oor:name="UserData"><value>sd</value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>impress_MS_PowerPoint_97_Vorlage</value></prop>
<prop oor:name="TemplateName"/>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu
index c4e6f828cc77..91c7e02d226f 100644
--- a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu
@@ -21,8 +21,9 @@
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value>OXML</value></prop>
<prop oor:name="UIName">
- <value xml:lang="en-US">Word 2007–365</value>
+ <value xml:lang="en-US">Word 2007</value>
</prop>
+ <!-- ECMA 376 1st edition -->
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>writer_MS_Word_2007</value></prop>
<prop oor:name="TemplateName"/>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu
index cd81c9943032..ab1823a70316 100644
--- a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu
@@ -20,7 +20,8 @@
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value>OXML</value></prop>
- <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 Template</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 Template</value></prop>
+ <!-- ECMA 376 1st edition -->
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>writer_MS_Word_2007_Template</value></prop>
<prop oor:name="TemplateName"/>
diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu
index 0f1bdb7239e4..87b561b025f7 100644
--- a/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu
+++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu
@@ -10,7 +10,8 @@
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value>OXML</value></prop>
- <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 VBA</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 VBA</value></prop>
+ <!-- ECMA 376 1st edition -->
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>writer_MS_Word_2007_VBA</value></prop>
<prop oor:name="TemplateName"/>
diff --git a/filter/source/config/fragments/filters/OOXML_Text.xcu b/filter/source/config/fragments/filters/OOXML_Text.xcu
index ebaab6406fd6..bbcceb1713d8 100644
--- a/filter/source/config/fragments/filters/OOXML_Text.xcu
+++ b/filter/source/config/fragments/filters/OOXML_Text.xcu
@@ -16,12 +16,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<node oor:name="Office Open XML Text" oor:op="replace">
- <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY</value></prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="UIName">
- <value xml:lang="en-US">Office Open XML Text (Transitional)</value>
+ <value xml:lang="en-US">Word 2010–365 Document</value>
</prop>
<!-- ISO/IEC 29500:2008 -->
<prop oor:name="FileFormatVersion"><value>1</value></prop>
diff --git a/filter/source/config/fragments/filters/OOXML_Text_Template.xcu b/filter/source/config/fragments/filters/OOXML_Text_Template.xcu
index 88fbf7047140..55d326563bf6 100644
--- a/filter/source/config/fragments/filters/OOXML_Text_Template.xcu
+++ b/filter/source/config/fragments/filters/OOXML_Text_Template.xcu
@@ -16,12 +16,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<node oor:name="Office Open XML Text Template" oor:op="replace">
- <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop>
+ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="UIName">
- <value xml:lang="en-US">Office Open XML Text Template (Transitional)</value>
+ <value xml:lang="en-US">Word 2010–365 Template</value>
</prop>
<!-- ISO/IEC 29500:2008 -->
<prop oor:name="FileFormatVersion"><value>1</value></prop>
diff --git a/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu
new file mode 100644
index 000000000000..35753a1f1a8b
--- /dev/null
+++ b/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.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="SVGZ - Compressed Scalable Vector Graphics" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</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/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/WMZ___Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..875dfb8ac295
--- /dev/null
+++ b/filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.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="WMZ - Compressed MS Windows Metafile" 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">WMZ - Compressed Windows Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</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_Parquet.xcu b/filter/source/config/fragments/filters/calc_Parquet.xcu
new file mode 100644
index 000000000000..5b0fea8257bb
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_Parquet.xcu
@@ -0,0 +1,19 @@
+<!--
+ * 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="Apache Parquet Spreadsheet" oor:op="replace">
+ <prop oor:name="Flags"><value>IMPORT ALIEN PREFERRED</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"/>
+ <prop oor:name="UserData"/>
+ <prop oor:name="Type"><value>Apache Parquet</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">Apache Parquet Spreadsheet</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_apng_Export.xcu b/filter/source/config/fragments/filters/draw_apng_Export.xcu
new file mode 100644
index 000000000000..f413ca74711a
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_apng_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_apng_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">APNG - Animated Portable Network Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</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/draw_emz_Export.xcu b/filter/source/config/fragments/filters/draw_emz_Export.xcu
new file mode 100644
index 000000000000..5c1aae3a761c
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_emz_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_emz_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">EMZ - Compressed Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</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/draw_html_Export.xcu b/filter/source/config/fragments/filters/draw_html_Export.xcu
index 179c7bb7edc0..ebb14b75b19f 100644
--- a/filter/source/config/fragments/filters/draw_html_Export.xcu
+++ b/filter/source/config/fragments/filters/draw_html_Export.xcu
@@ -17,8 +17,8 @@
-->
<node oor:name="draw_html_Export" oor:op="replace">
<prop oor:name="Flags"><value>EXPORT ALIEN</value></prop>
- <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop>
- <prop oor:name="FilterService"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>graphic_HTML</value></prop>
diff --git a/filter/source/config/fragments/filters/draw_svgz_Export.xcu b/filter/source/config/fragments/filters/draw_svgz_Export.xcu
new file mode 100644
index 000000000000..59af9fa1d5d4
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_svgz_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_svgz_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</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/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/draw_wmz_Export.xcu b/filter/source/config/fragments/filters/draw_wmz_Export.xcu
new file mode 100644
index 000000000000..272880aa4b0a
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_wmz_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_wmz_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">WMZ - Compressed Windows Metafile</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</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_html_Export.xcu b/filter/source/config/fragments/filters/impress_html_Export.xcu
index 65a5c5dadf78..1e0fb435e01e 100644
--- a/filter/source/config/fragments/filters/impress_html_Export.xcu
+++ b/filter/source/config/fragments/filters/impress_html_Export.xcu
@@ -17,8 +17,8 @@
-->
<node oor:name="impress_html_Export" oor:op="replace">
<prop oor:name="Flags"><value>EXPORT ALIEN</value></prop>
- <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop>
- <prop oor:name="FilterService"/>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="FilterService"></prop>
<prop oor:name="UserData"><value></value></prop>
<prop oor:name="FileFormatVersion"><value>0</value></prop>
<prop oor:name="Type"><value>graphic_HTML</value></prop>
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/apng_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu
new file mode 100644
index 000000000000..2bf240fa801a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/apng_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="apng_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop>
+ <prop oor:name="FormatName"><value>SVEAPNG</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">APNG - Animated Portable Network Graphics</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu
new file mode 100644
index 000000000000..40ccb11105b3
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/emz_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="emz_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVEMZ</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">EMZ - Compressed Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu
new file mode 100644
index 000000000000..590ef29d567b
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/emz_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="emz_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVEMZ</value></prop>
+ <prop oor:name="RealFilterName"><value>EMZ - Compressed MS Windows Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">EMZ - Compressed Enhanced Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu
new file mode 100644
index 000000000000..8231ca965ff1
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/svgz_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="svgz_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="FormatName"><value>SVESVGZ</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">SVGZ - Compressed Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu
new file mode 100644
index 000000000000..fe0d2deaac2a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/svgz_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="svgz_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop>
+ <prop oor:name="FormatName"><value>SVISVGZ</value></prop>
+ <prop oor:name="RealFilterName"><value>SVGZ - Compressed Scalable Vector Graphics</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</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/internalgraphicfilters/wmz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/wmz_Export.xcu
new file mode 100644
index 000000000000..69b9aec9e0e2
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/wmz_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="wmz_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVWMZ</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">WMZ - Compressed Windows Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu
new file mode 100644
index 000000000000..9f124f1a1817
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/wmz_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="wmz_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVWMZ</value></prop>
+ <prop oor:name="RealFilterName"><value>WMZ - Compressed MS Windows Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WMZ - Compressed Windows Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..b094e81e912d
--- /dev/null
+++ b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.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="apng_Animated_Portable_Network_Graphic" 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>apng</value></prop>
+ <prop oor:name="MediaType"><value>image/apng</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>APNG - Animated Portable Network Graphic</value></prop>
+ <prop oor:name="UIName">
+ <value>APNG - Animated Portable Network Graphic</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/calc_Parquet.xcu b/filter/source/config/fragments/types/calc_Parquet.xcu
new file mode 100644
index 000000000000..6c29d886c92f
--- /dev/null
+++ b/filter/source/config/fragments/types/calc_Parquet.xcu
@@ -0,0 +1,17 @@
+<!--
+ * 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="Apache Parquet" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.sc.OrcusFilterDetect</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>parquet</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Apache Parquet Spreadsheet</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Apache Parquet</value></prop>
+ <prop oor:name="ClipboardFormat"/>
+</node>
diff --git a/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..b2dfeb3f9532
--- /dev/null
+++ b/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.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="emz_Compressed_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>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>EMZ - Compressed MS Windows Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>EMZ - Compressed Enhanced Meta File</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
index 7fe5e2adbfda..0b5be4b19923 100644
--- a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
+++ b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu
@@ -18,7 +18,7 @@
<node oor:name="png_Portable_Network_Graphic" 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>png</value></prop>
+ <prop oor:name="Extensions"><value>png apng</value></prop>
<prop oor:name="MediaType"><value>image/png</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>PNG - Portable Network Graphic</value></prop>
diff --git a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
index a2015a536873..04b08c08b664 100644
--- a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
+++ b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu
@@ -18,7 +18,7 @@
<node oor:name="svg_Scalable_Vector_Graphics" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>svg svgz</value></prop>
+ <prop oor:name="Extensions"><value>svg</value></prop>
<prop oor:name="MediaType"><value>image/svg+xml</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>SVG - Scalable Vector Graphics</value></prop>
diff --git a/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu
new file mode 100644
index 000000000000..7ba66f15f092
--- /dev/null
+++ b/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.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="svgz_Compressed_Scalable_Vector_Graphics" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>svgz</value></prop>
+ <prop oor:name="MediaType"><value>image/svg+xml</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>SVGZ - Compressed Scalable Vector Graphics</value></prop>
+ <prop oor:name="UIName">
+ <value>SVGZ - Compressed Scalable Vector Graphics</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
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/wmz_Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.xcu
new file mode 100644
index 000000000000..859c9d6d27bd
--- /dev/null
+++ b/filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.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="wmz_Compressed_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>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>WMZ - Compressed MS Windows Metafile</value></prop>
+ <prop oor:name="UIName">
+ <value>WMZ - Compressed Windows Metafile</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu
index 75cb091cd0aa..11396057a026 100644
--- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu
@@ -22,6 +22,6 @@
<prop oor:name="MediaType"><value>application/msword</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>MS Word 2007 XML</value></prop>
- <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Word 2007</value></prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu
index 391cc20cec3b..059e7078a40e 100644
--- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu
@@ -22,6 +22,6 @@
<prop oor:name="MediaType"><value>application/msword</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>MS Word 2007 XML Template</value></prop>
- <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 Template</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 Template</value></prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
index 8a44c1e5f3a2..0519bcd7dac7 100644
--- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
+++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu
@@ -12,6 +12,6 @@
<prop oor:name="MediaType"><value>application/msword</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>MS Word 2007 XML VBA</value></prop>
- <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 VBA</value></prop>
+ <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 VBA</value></prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/filter/source/config/fragments/types/writer_OOXML.xcu b/filter/source/config/fragments/types/writer_OOXML.xcu
index 8d6a025fdac2..079a6421f072 100644
--- a/filter/source/config/fragments/types/writer_OOXML.xcu
+++ b/filter/source/config/fragments/types/writer_OOXML.xcu
@@ -23,7 +23,7 @@
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>Office Open XML Text</value></prop>
<prop oor:name="UIName">
- <value>Office Open XML Text Document (Transitional)</value>
+ <value>Word 2010–365 Document</value>
</prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/filter/source/config/fragments/types/writer_OOXML_Template.xcu b/filter/source/config/fragments/types/writer_OOXML_Template.xcu
index 39f499eb6b68..a9d424b967b4 100644
--- a/filter/source/config/fragments/types/writer_OOXML_Template.xcu
+++ b/filter/source/config/fragments/types/writer_OOXML_Template.xcu
@@ -23,7 +23,7 @@
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>Office Open XML Text Template</value></prop>
<prop oor:name="UIName">
- <value>Office Open XML Text Template (Transitional)</value>
+ <value>Word 2010–365 Template</value>
</prop>
<prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop>
</node>
diff --git a/filter/source/config/tools/merge/FCFGMerge.cfg b/filter/source/config/tools/merge/FCFGMerge.cfg
index 8a0b4b78fec8..041a16a9f17b 100644
--- a/filter/source/config/tools/merge/FCFGMerge.cfg
+++ b/filter/source/config/tools/merge/FCFGMerge.cfg
@@ -32,7 +32,7 @@ loglevel = 2
# This extension is used for all XML files. It doesn't
# matter if it's used for reading fragments or writing
# XML packages.
-# Must be given without any additional signes like "."
+# Must be given without any additional signs like "."
# or "*."!
#
# [REQUIRED]
@@ -44,7 +44,7 @@ extension_xcu=xcu
# This extension is used for all Package files. It doesn't
# matter if it's used for reading such files or writing
# it.
-# Must be given without any additional signes like "."
+# Must be given without any additional signs like "."
# or "*."!
#
# [REQUIRED]
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index e20c56ddf232..224c4b2b0794 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -25,14 +25,15 @@
#include <com/sun/star/frame/XModel.hpp>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
#include <vcl/graphicfilter.hxx>
#include <svl/outstrm.hxx>
#include <svtools/DocumentToGraphicRenderer.hxx>
using namespace css;
-GraphicExportFilter::GraphicExportFilter( const uno::Reference< uno::XComponentContext > & rxContext )
- : mxContext(rxContext)
+GraphicExportFilter::GraphicExportFilter( uno::Reference< uno::XComponentContext > xContext )
+ : mxContext(std::move(xContext))
, mnTargetWidth(0)
, mnTargetHeight(0)
, mbSelectionOnly(false)
@@ -89,7 +90,7 @@ void GraphicExportFilter::gatherProperties( const uno::Sequence< beans::Property
}
}
- for ( const beans::PropertyValue& rProp : std::as_const(maFilterDataSequence) )
+ for (const beans::PropertyValue& rProp : maFilterDataSequence)
{
if ( rProp.Name == "PixelWidth" )
{
@@ -163,7 +164,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/graphic/GraphicExportFilter.hxx b/filter/source/graphic/GraphicExportFilter.hxx
index 6e2a30448817..c78b25d70a89 100644
--- a/filter/source/graphic/GraphicExportFilter.hxx
+++ b/filter/source/graphic/GraphicExportFilter.hxx
@@ -57,7 +57,7 @@ class GraphicExportFilter :
const css::uno::Reference< css::drawing::XShape > & rxShape ) const;
public:
- explicit GraphicExportFilter( const css::uno::Reference< css::uno::XComponentContext > & rxContext );
+ explicit GraphicExportFilter( css::uno::Reference< css::uno::XComponentContext > xContext );
virtual ~GraphicExportFilter() override;
// XServiceInfo
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index bb17a380c3b2..e726db7a137c 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -47,7 +47,7 @@
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/helpers.hxx>
-#include <unotools/configmgr.hxx>
+#include <comphelper/configuration.hxx>
#include "bitmap.hxx"
#include "elements.hxx"
@@ -110,7 +110,7 @@ bool CGMImpressOutAct::ImplInitPage()
bool CGMImpressOutAct::ImplCreateShape( const OUString& rType )
{
- if (utl::ConfigManager::IsFuzzing())
+ if (comphelper::IsFuzzing())
return false;
uno::Reference< uno::XInterface > xNewShape( maXMultiServiceFactory->createInstance( rType ) );
maXShape.set( xNewShape, uno::UNO_QUERY );
@@ -387,11 +387,10 @@ void CGMImpressOutAct::InsertPage()
{
if ( mnCurrentPage ) // one side is always existing, therefore the first side will be left out
{
- uno::Reference< drawing::XDrawPage > xPage = maXDrawPages->insertNewByIndex( 0xffff );
- maXDrawPage = xPage;
+ maXDrawPage = maXDrawPages->insertNewByIndex(0xffff);
if ( !ImplInitPage() )
mpCGM->mbStatus = false;
- if (mnCurrentPage > MAX_PAGES_FOR_FUZZING && utl::ConfigManager::IsFuzzing())
+ if (mnCurrentPage > MAX_PAGES_FOR_FUZZING && comphelper::IsFuzzing())
{
// ofz#21753 that's enough pages for fuzzing, we're not doing anything productive now
mpCGM->mbStatus = false;
@@ -791,7 +790,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..ed163206641a 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -19,7 +19,7 @@
#include <sal/log.hxx>
-#include <unotools/configmgr.hxx>
+#include <comphelper/configuration.hxx>
#include <vcl/BitmapTools.hxx>
#include <memory>
@@ -34,14 +34,13 @@ Color BMCOL(sal_uInt32 _col) {
}
-CGMBitmap::CGMBitmap( CGM& rCGM ) :
- mpCGM ( &rCGM ),
- pCGMBitmapDescriptor ( new CGMBitmapDescriptor )
+CGMBitmap::CGMBitmap(CGM& rCGM)
+ : mpCGM(&rCGM)
+ , pCGMBitmapDescriptor(new CGMBitmapDescriptor)
{
ImplGetBitmap( *pCGMBitmapDescriptor );
};
-
CGMBitmap::~CGMBitmap()
{
}
@@ -216,17 +215,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 +239,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;
@@ -375,15 +374,26 @@ bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& rDesc )
void CGMBitmap::ImplInsert( CGMBitmapDescriptor const & rSource, CGMBitmapDescriptor& rDest )
{
- if (utl::ConfigManager::IsFuzzing() && rDest.mxBitmap.GetSizePixel().Height() + rSource.mnY > SAL_MAX_UINT16)
+ ++mpCGM->mnBitmapInserts;
+ static const bool bFuzzing = comphelper::IsFuzzing();
+ if (bFuzzing)
{
- SAL_WARN("filter.icgm", "bitmap would expand too much");
- rDest.mbStatus = false;
- return;
+ if (rDest.mxBitmap.GetSizePixel().Height() + rSource.mnY > SAL_MAX_UINT16)
+ {
+ SAL_WARN("filter.icgm", "bitmap would expand too much");
+ rDest.mbStatus = false;
+ return;
+ }
+ if (mpCGM->mnBitmapInserts > 1024)
+ {
+ SAL_WARN("filter.icgm", "too many inserts");
+ rDest.mbStatus = false;
+ return;
+ }
}
rDest.mxBitmap.Expand( 0, rSource.mnY );
rDest.mxBitmap.CopyPixel( tools::Rectangle( Point( 0, rDest.mnY ), Size( rSource.mnX, rSource.mnY ) ),
- tools::Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), &rSource.mxBitmap );
+ tools::Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), rSource.mxBitmap );
if ( ( rSource.mnR.Y == rDest.mnQ.Y ) && ( rSource.mnR.X == rDest.mnQ.X ) )
{ // Insert on Bottom
diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx b/filter/source/graphicfilter/icgm/bitmap.hxx
index 3e7b80f5177f..564284b22135 100644
--- a/filter/source/graphicfilter/icgm/bitmap.hxx
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -31,8 +31,8 @@ class CGMBitmapDescriptor
sal_uInt8* mpBuf;
sal_uInt8* mpEndBuf;
BitmapEx mxBitmap;
- bool mbStatus;
- bool mbVMirror;
+ bool mbStatus;
+ bool mbVMirror;
sal_uInt32 mnDstBitsPerPixel;
sal_uInt32 mnScanSize; // bytes per line
FloatPoint mnP, mnQ, mnR;
@@ -42,7 +42,7 @@ class CGMBitmapDescriptor
double mnOrientation;
sal_uInt32 mnX, mnY;
- tools::Long mnLocalColorPrecision;
+ tools::Long mnLocalColorPrecision;
sal_uInt32 mnCompressionMode;
CGMBitmapDescriptor()
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 1cf7c7ca0b36..e8488328356d 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -17,9 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/task/XStatusIndicator.hpp>
#include <o3tl/safeint.hxx>
#include <osl/endian.h>
+#include <filter/importcgm.hxx>
#include <tools/stream.hxx>
#include "bitmap.hxx"
#include "chart.hxx"
@@ -27,7 +27,7 @@
#include "outact.hxx"
#include <memory>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
@@ -53,6 +53,7 @@ CGM::CGM(uno::Reference< frame::XModel > const & rModel)
, mbFirstOutPut(false)
, mbInDefaultReplacement(false)
, mnAct4PostReset(0)
+ , mnBitmapInserts(0)
, mpOutAct(new CGMImpressOutAct(*this, rModel))
, mpSource(nullptr)
, mpEndValidSource(nullptr)
@@ -682,7 +683,7 @@ bool CGM::Write( SvStream& rIStm )
};
// GraphicImport - the exported function
-extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32
+FILTER_DLLPUBLIC sal_uInt32
ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, css::uno::Reference<css::task::XStatusIndicator> const & aXStatInd)
{
@@ -700,7 +701,7 @@ ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, css::u
sal_uInt64 const nInSize = rIn.remainingSize();
rIn.Seek(0);
- sal_uInt32 nNext = 0;
+ sal_uInt64 nNext = 0;
sal_uInt32 nAdd = nInSize / 20;
bool bProgressBar = aXStatInd.is();
if ( bProgressBar )
@@ -710,7 +711,7 @@ ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, css::u
{
if ( bProgressBar )
{
- sal_uInt32 nCurrentPos = rIn.Tell();
+ sal_uInt64 nCurrentPos = rIn.Tell();
if ( nCurrentPos >= nNext )
{
aXStatInd->setValue( nCurrentPos );
diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx
index b344cb22e707..e2281311e438 100644
--- a/filter/source/graphicfilter/icgm/cgm.hxx
+++ b/filter/source/graphicfilter/icgm/cgm.hxx
@@ -61,6 +61,7 @@ class CGM
bool mbFirstOutPut;
bool mbInDefaultReplacement;
sal_uInt32 mnAct4PostReset;
+ int mnBitmapInserts;
std::unique_ptr<CGMBitmap> mpBitmapInUse;
std::unique_ptr<CGMChart> mpChart; // if sal_True->"SHWSLIDEREC"
// otherwise "BEGINPIC" commands
diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx
index 07a6fe253e4e..4304d142b5e5 100644
--- a/filter/source/graphicfilter/icgm/class1.cxx
+++ b/filter/source/graphicfilter/icgm/class1.cxx
@@ -151,9 +151,6 @@ void CGM::ImplDoClass1()
}
break;
case 0x0a : /*Color Value Extent*/
- {
- nI1 = 6;
- }
break;
case 0x0b : /*MetaFile Element List */break;
case 0x0c : /*MetaFile Default Replacement*/
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/countryid.cxx b/filter/source/msfilter/countryid.cxx
index 9ad504ab3272..a6f72001db17 100644
--- a/filter/source/msfilter/countryid.cxx
+++ b/filter/source/msfilter/countryid.cxx
@@ -243,7 +243,7 @@ const CountryEntry pTable[] =
{ COUNTRY_UZBEKISTAN, LANGUAGE_UZBEK_LATIN, false }
};
-const CountryEntry * const pEnd = pTable + SAL_N_ELEMENTS( pTable );
+const CountryEntry * const pEnd = pTable + std::size( pTable );
/** Predicate comparing a country ID with the member of a CountryEntry. */
struct CountryEntryPred_Country
diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx
index e6ef672b0328..15e203961f15 100644
--- a/filter/source/msfilter/dffpropset.cxx
+++ b/filter/source/msfilter/dffpropset.cxx
@@ -1108,7 +1108,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly )
sal_uInt32 nPropCount = aHd.nRecInstance;
- sal_uInt32 nComplexDataFilePos = rIn.Tell() + ( nPropCount * 6 );
+ sal_uInt64 nComplexDataFilePos = rIn.Tell() + ( nPropCount * 6 );
const size_t nMaxPossibleRecords = rIn.remainingSize() / (sizeof(sal_uInt16) + sizeof(sal_uInt32));
if (nPropCount > nMaxPossibleRecords)
@@ -1176,7 +1176,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly )
|| ( nRecType == DFF_Prop_textRectangles ) )
{
// now check if the current content size is possible, or 6 bytes too small
- sal_uInt32 nOldPos = rIn.Tell();
+ sal_uInt64 nOldPos = rIn.Tell();
sal_Int16 nNumElem(0), nNumElemReserved(0), nSize(0);
if (checkSeek(rIn, nComplexDataFilePos))
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index b7ffd449cb22..b5be935d9b95 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>
@@ -30,6 +31,7 @@
#include <svx/svdoole2.hxx>
#include <svx/sdtfsitm.hxx>
#include <editeng/outlobj.hxx>
+#include <utility>
#include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/svapp.hxx>
@@ -91,6 +93,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>
@@ -106,8 +109,8 @@ EscherExContainer::EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType,
}
EscherExContainer::~EscherExContainer()
{
- sal_uInt32 nPos = rStrm.Tell();
- sal_uInt32 nSize= nPos - nContPos;
+ sal_uInt64 nPos = rStrm.Tell();
+ sal_uInt32 nSize = nPos - nContPos;
if ( nSize )
{
rStrm.Seek( nContPos - 4 );
@@ -124,8 +127,8 @@ EscherExAtom::EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_
}
EscherExAtom::~EscherExAtom()
{
- sal_uInt32 nPos = rStrm.Tell();
- sal_uInt32 nSize= nPos - nContPos;
+ sal_uInt64 nPos = rStrm.Tell();
+ sal_uInt32 nSize = nPos - nContPos;
if ( nSize )
{
rStrm.Seek( nContPos - 4 );
@@ -206,14 +209,13 @@ void EscherPropertyContainer::AddOpt(
void EscherPropertyContainer::AddOpt(
sal_uInt16 nPropID,
- const OUString& rString)
+ std::u16string_view rString)
{
std::vector<sal_uInt8> aBuf;
- aBuf.reserve(rString.getLength() * 2 + 2);
+ aBuf.reserve(rString.size() * 2 + 2);
- for(sal_Int32 i(0); i < rString.getLength(); i++)
+ for(const sal_Unicode nUnicode: rString)
{
- const sal_Unicode nUnicode(rString[i]);
aBuf.push_back(static_cast<sal_uInt8>(nUnicode));
aBuf.push_back(static_cast<sal_uInt8>(nUnicode >> 8));
}
@@ -405,7 +407,7 @@ void EscherPropertyContainer::CreateGradientProperties(
nFillType = ESCHER_FillShadeScale;
nAngle = (rGradient.Angle * 0x10000) / 10;
nFillFocus = (sal::static_int_cast<int>(rGradient.Style) ==
- sal::static_int_cast<int>(GradientStyle::Linear)) ? 0 : 50;
+ sal::static_int_cast<int>(css::awt::GradientStyle_LINEAR)) ? 0 : 50;
}
break;
case awt::GradientStyle_RADIAL :
@@ -596,7 +598,7 @@ void EscherPropertyContainer::CreateFillProperties(
uno::Any aAny;
AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
- static const OUStringLiteral aPropName( u"FillStyle" );
+ static constexpr OUString aPropName( u"FillStyle"_ustr );
if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, aPropName ) )
@@ -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;
}
@@ -1339,8 +1341,7 @@ bool EscherPropertyContainer::CreateOLEGraphicProperties(const uno::Reference<dr
const Graphic* pGraphic = pOle2Obj->GetGraphic();
if (pGraphic)
{
- Graphic aGraphic(*pGraphic);
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(*pGraphic);
bRetValue = CreateGraphicProperties(rXShape, aGraphicObject);
}
}
@@ -1415,10 +1416,10 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties(
uno::Reference<graphic::XGraphic> xGraphic(rxBitmap, uno::UNO_QUERY);
if (!xGraphic.is())
return;
- const Graphic aGraphic(xGraphic);
+ Graphic aGraphic(xGraphic);
if (aGraphic.IsNone())
return;
- const GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (aGraphicObject.GetType() == GraphicType::NONE)
return;
if (ImplCreateEmbeddedBmp(aGraphicObject))
@@ -1464,7 +1465,7 @@ void EscherPropertyContainer::CreateEmbeddedHatchProperties(const drawing::Hatch
{
const tools::Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : tools::Rectangle(Point(0,0), Size(28000, 21000)));
Graphic aGraphic(lclDrawHatch(rHatch, rBackColor, bFillBackground, aRect));
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (ImplCreateEmbeddedBmp(aGraphicObject))
AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
@@ -1631,7 +1632,9 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
nFormat != GraphicFileFormat::TIF &&
nFormat != GraphicFileFormat::PCT &&
nFormat != GraphicFileFormat::WMF &&
- nFormat != GraphicFileFormat::EMF) )
+ nFormat != GraphicFileFormat::WMZ &&
+ nFormat != GraphicFileFormat::EMF &&
+ nFormat != GraphicFileFormat::EMZ) )
{
std::unique_ptr<SvStream> pIn(::utl::UcbStreamHelper::CreateStream(
aTmp.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
@@ -1773,7 +1776,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
{
EscherGraphicProvider aProvider;
SvMemoryStream aMemStrm;
- GraphicObject aGraphicObject(aGraphic);
+ GraphicObject aGraphicObject(std::move(aGraphic));
if (aProvider.GetBlibID(aMemStrm, aGraphicObject, nullptr, pGraphicAttr.get(), bOOxmlExport))
{
@@ -2450,13 +2453,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 +2518,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;
@@ -2536,13 +2539,13 @@ bool EscherPropertyContainer::IsDefaultObject(
void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted )
{
const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eShapeType );
- if ( !(pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles) )
+ if ( !pDefCustomShape || pDefCustomShape->pHandles.empty() )
return;
- sal_Int32 k, nkCount = pDefCustomShape->nHandles;
- const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
- for ( k = 0; k < nkCount; k++, pData++ )
+ sal_Int32 k, nkCount = pDefCustomShape->pHandles.size();
+ for (k = 0; k < nkCount; k++)
{
+ const SvxMSDffHandle* pData = &pDefCustomShape->pHandles[k];
if ( pData->nFlags & SvxMSDffHandleFlags::POLAR )
{
if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
@@ -2593,14 +2596,14 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
if ( !(aGeoPropSet >>= aGeoPropSeq) )
return;
- static const OUStringLiteral sViewBox ( u"ViewBox" );
- static const OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" );
- static const OUStringLiteral sExtrusion ( u"Extrusion" );
- static const OUStringLiteral sEquations ( u"Equations" );
- static const OUStringLiteral sPath ( u"Path" );
- static const OUStringLiteral sTextPath ( u"TextPath" );
- static const OUStringLiteral sHandles ( u"Handles" );
- static const OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" );
+ static constexpr OUStringLiteral sViewBox ( u"ViewBox" );
+ static constexpr OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" );
+ static constexpr OUString sExtrusion ( u"Extrusion"_ustr );
+ static constexpr OUStringLiteral sEquations ( u"Equations" );
+ static constexpr OUStringLiteral sPath ( u"Path" );
+ static constexpr OUString sTextPath ( u"TextPath"_ustr );
+ static constexpr OUStringLiteral sHandles ( u"Handles" );
+ static constexpr OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" );
bool bAdjustmentValuesProp = false;
uno::Any aAdjustmentValuesProp;
@@ -2858,7 +2861,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 = std::round(fExtrusionShininess / 10.0);
+ AddOpt( DFF_Prop_c3DShininess, static_cast<sal_Int32>(fExtrusionShininess) );
+ }
}
else if ( rrProp.Name == "Skew" )
{
@@ -2875,7 +2882,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" )
{
@@ -3445,7 +3452,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
AddOpt(DFF_Prop_gtextAlign,gTextAlign);
}
}
- if((nTextPathFlags & 0x4000) != 0) // Is Font work
+ if((nTextPathFlags & 0x4000) != 0) // Is Fontwork
{
OutlinerParaObject* pOutlinerParaObject(rSdrObjCustomShape.GetOutlinerParaObject());
if ( pOutlinerParaObject && pOutlinerParaObject->IsEffectivelyVertical() )
@@ -3712,8 +3719,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);
}
@@ -3752,8 +3758,8 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer
if ( !pShape )
return false;
- const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
- const GraphicObject aGraphicObject(aGraphic);
+ Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
+ const GraphicObject aGraphicObject(std::move(aGraphic));
if (!aGraphicObject.GetUniqueID().isEmpty())
{
@@ -3782,12 +3788,8 @@ EscherPersistTable::~EscherPersistTable()
bool EscherPersistTable::PtIsID( sal_uInt32 nID )
{
- for(auto const & pPtr : maPersistTable) {
- if ( pPtr->mnID == nID ) {
- return true;
- }
- }
- return false;
+ return std::any_of(maPersistTable.begin(), maPersistTable.end(),
+ [&nID](const auto& rxEntry) { return rxEntry->mnID == nID; });
}
void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs )
@@ -4051,7 +4053,8 @@ void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pM
if ( pMergePicStreamBSE )
{
- sal_uInt32 nBlipSize, nOldPos = pMergePicStreamBSE->Tell();
+ sal_uInt32 nBlipSize;
+ sal_uInt64 nOldPos = pMergePicStreamBSE->Tell();
const sal_uInt32 nBuf = 0x40000; // 256KB buffer
std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nBuf ]);
@@ -4195,7 +4198,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 +4217,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 );
}
}
@@ -4338,7 +4341,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec
}
if ( nAtomSize )
{
- sal_uInt32 nPos = rPicOutStrm.Tell();
+ sal_uInt64 nPos = rPicOutStrm.Tell();
rPicOutStrm.Seek( nAtomSize - 4 );
rPicOutStrm.WriteUInt32( nPos - nAtomSize );
rPicOutStrm.Seek( nPos );
@@ -4368,8 +4371,8 @@ struct EscherShapeListEntry
uno::Reference<drawing::XShape>aXShape;
sal_uInt32 n_EscherId;
- EscherShapeListEntry(const uno::Reference<drawing::XShape> & rShape, sal_uInt32 nId)
- : aXShape(rShape)
+ EscherShapeListEntry(uno::Reference<drawing::XShape> xShape, sal_uInt32 nId)
+ : aXShape(std::move(xShape))
, n_EscherId(nId)
{}
};
@@ -4558,7 +4561,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
else if ( nGluePointType == drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
{
tools::PolyPolygon aPolyPoly;
- SdrObjectUniquePtr pTemporaryConvertResultObject(pSdrObjCustomShape->DoConvertToPolyObj(true, true));
+ rtl::Reference<SdrObject> pTemporaryConvertResultObject(pSdrObjCustomShape->DoConvertToPolyObj(true, true));
SdrPathObj* pSdrPathObj(dynamic_cast< SdrPathObj* >(pTemporaryConvertResultObject.get()));
if(pSdrPathObj)
@@ -4569,7 +4572,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
}
// do *not* forget to delete the temporary used SdrObject - possible memory leak (!)
- pTemporaryConvertResultObject.reset();
+ pTemporaryConvertResultObject.clear();
pSdrPathObj = nullptr;
if(0 != aPolyPoly.Count())
@@ -4857,10 +4860,9 @@ public:
}
-EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pOutStrm, bool bOOXML)
- : mxGlobal(rxGlobal)
+EscherEx::EscherEx(std::shared_ptr<EscherExGlobal> xGlobal, SvStream* pOutStrm, bool bOOXML)
+ : mxGlobal(std::move(xGlobal))
, mpOutStrm(pOutStrm)
- , mbOwnsStrm(false)
, mnCurrentDg(0)
, mnCountOfs(0)
, mnGroupLevel(0)
@@ -4871,8 +4873,8 @@ EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pO
{
if (!mpOutStrm)
{
- mpOutStrm = new SvNullStream();
- mbOwnsStrm = true;
+ mxOwnStrm = std::make_unique<SvNullStream>();
+ mpOutStrm = mxOwnStrm.get();
}
mnStrmStartOfs = mpOutStrm->Tell();
mpImplEESdrWriter.reset( new ImplEESdrWriter( *this ) );
@@ -4880,8 +4882,6 @@ EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pO
EscherEx::~EscherEx()
{
- if (mbOwnsStrm)
- delete mpOutStrm;
}
void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
@@ -4921,7 +4921,8 @@ void EscherEx::Flush( SvStream* pPicStreamMergeBSE /* = NULL */ )
void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes )
{
- sal_uInt32 nSize, nType, nSource, nBufSize, nToCopy, nCurPos = mpOutStrm->Tell();
+ sal_uInt32 nSize, nType, nSource, nBufSize, nToCopy;
+ sal_uInt64 nCurPos = mpOutStrm->Tell();
// adjust persist table
for(auto const & pPtr : maPersistTable) {
@@ -4936,7 +4937,7 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes )
while ( mpOutStrm->Tell() < nCurPos )
{
mpOutStrm->ReadUInt32( nType ).ReadUInt32( nSize );
- sal_uInt32 nEndOfRecord = mpOutStrm->Tell() + nSize;
+ sal_uInt64 nEndOfRecord = mpOutStrm->Tell() + nSize;
bool bContainer = (nType & 0x0F) == 0x0F;
/* Expand the record, if the insertion position is inside, or if the
position is at the end of a container (expands always), or at the
@@ -5013,7 +5014,7 @@ bool EscherEx::SeekToPersistOffset( sal_uInt32 nKey )
void EscherEx::InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue )
{
- sal_uInt32 nOldPos = mpOutStrm->Tell();
+ sal_uInt64 nOldPos = mpOutStrm->Tell();
bool bRetValue = SeekToPersistOffset( nKey );
if ( bRetValue )
{
@@ -5080,8 +5081,8 @@ void EscherEx::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
void EscherEx::CloseContainer()
{
- sal_uInt32 nSize, nPos = mpOutStrm->Tell();
- nSize = ( nPos - mOffsets.back() ) - 4;
+ sal_uInt64 nPos = mpOutStrm->Tell();
+ sal_uInt32 nSize = ( nPos - mOffsets.back() ) - 4;
mpOutStrm->Seek( mOffsets.back() );
mpOutStrm->WriteUInt32( nSize );
@@ -5124,7 +5125,7 @@ void EscherEx::BeginAtom()
void EscherEx::EndAtom( sal_uInt16 nRecType, int nRecVersion, int nRecInstance )
{
- sal_uInt32 nOldPos = mpOutStrm->Tell();
+ sal_uInt64 nOldPos = mpOutStrm->Tell();
mpOutStrm->Seek( mnCountOfs );
sal_uInt32 nSize = nOldPos - mnCountOfs;
mpOutStrm->WriteUInt16( ( nRecInstance << 4 ) | ( nRecVersion & 0xf ) ).WriteUInt16( nRecType ).WriteUInt32( nSize - 8 );
@@ -5216,7 +5217,7 @@ void EscherEx::SetGroupSnapRect( sal_uInt32 nGroupLevel, const tools::Rectangle&
{
if ( nGroupLevel )
{
- sal_uInt32 nCurrentPos = mpOutStrm->Tell();
+ sal_uInt64 nCurrentPos = mpOutStrm->Tell();
if ( DoSeek( ESCHER_Persist_Grouping_Snap | ( nGroupLevel - 1 ) ) )
{
mpOutStrm ->WriteInt32( rRect.Left() ) // Bounding box for the grouped shapes to which they will be attached
@@ -5232,7 +5233,7 @@ void EscherEx::SetGroupLogicRect( sal_uInt32 nGroupLevel, const tools::Rectangle
{
if ( nGroupLevel )
{
- sal_uInt32 nCurrentPos = mpOutStrm->Tell();
+ sal_uInt64 nCurrentPos = mpOutStrm->Tell();
if ( DoSeek( ESCHER_Persist_Grouping_Logic | ( nGroupLevel - 1 ) ) )
{
mpOutStrm->WriteInt16( rRect.Top() ).WriteInt16( rRect.Left() ).WriteInt16( rRect.Right() ).WriteInt16( rRect.Bottom() );
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 12e6e62be0a2..b21534676e4c 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -23,8 +23,8 @@
#include <svx/svdobj.hxx>
#include <tools/poly.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <svx/fmdpage.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <svx/unopage.hxx>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -164,7 +164,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
if ( xPropInfo.is() && xPropInfo->hasPropertyByName( "InteropGrabBag" ) )
{
xPropertySet->getPropertyValue( "InteropGrabBag" ) >>= aGrabBag;
- for (const beans::PropertyValue& rProp : std::as_const(aGrabBag))
+ for (const beans::PropertyValue& rProp : aGrabBag)
{
if (rProp.Name == "mso-edit-as")
{
@@ -430,13 +430,17 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
}
mpEscherEx->OpenContainer( ESCHER_SpContainer );
- if(bInline)
+ nShapeType = bInline ? ESCHER_ShpInst_PictureFrame : ESCHER_ShpInst_HostControl;
+ const ShapeFlag nFlags = ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor;
+ nShapeID = rObj.GetShapeId();
+ if (nShapeID)
{
- addShape( ESCHER_ShpInst_PictureFrame, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
+ mpEscherEx->AddShape(nShapeType, nFlags, nShapeID );
+ rSolverContainer.AddShape(rObj.GetShapeRef(), nShapeID);
}
else
{
- addShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
+ addShape(nShapeType, nFlags);
}
}
else
@@ -669,14 +673,14 @@ 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 );
}
{
tools::Rectangle aRect( rObj.GetRect() );
- aRect.Justify();
+ aRect.Normalize();
rObj.SetRect( aRect );
}
@@ -868,7 +872,7 @@ bool ImplEESdrWriter::ImplInitPage( const SdrPage& rPage )
Reference<css::lang::XComponent> xOldDrawPage(mXDrawPage, UNO_QUERY);
if (xOldDrawPage.is())
xOldDrawPage->dispose();
- mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( const_cast<SdrPage*>(&rPage) );
+ mXDrawPage = pSvxDrawPage = new SvxDrawPage( const_cast<SdrPage*>(&rPage) );
mXShapes = mXDrawPage;
if ( !mXShapes.is() )
return false;
@@ -946,9 +950,9 @@ void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes, bool ooxmlExp
mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport);
}
-sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj, bool ooxmlExport )
+sal_uInt32 EscherEx::AddSdrObject(const SdrObject& rObj, bool ooxmlExport, sal_uInt32 nId)
{
- ImplEESdrObject aObj( *mpImplEESdrWriter, rObj, mbOOXML );
+ ImplEESdrObject aObj(*mpImplEESdrWriter, rObj, mbOOXML , nId);
if( aObj.IsValid() )
return mpImplEESdrWriter->ImplWriteTheShape( aObj, ooxmlExport );
return 0;
@@ -995,8 +999,8 @@ const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
- const SdrObject& rObj, bool bOOXML ) :
- mnShapeId( 0 ),
+ const SdrObject& rObj, bool bOOXML, sal_uInt32 nId) :
+ mnShapeId(nId),
mnTextSize( 0 ),
mnAngle( 0 ),
mbValid( false ),
@@ -1086,9 +1090,10 @@ static basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape >&
aHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
aHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
aHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
- aHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
- aHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
- aHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
+ // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
+ assert( aMatrix.Line3.Column1 == 0 );
+ assert( aMatrix.Line3.Column2 == 0 );
+ assert( aMatrix.Line3.Column3 == 1 );
basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX;
@@ -1151,10 +1156,19 @@ void ImplEESdrObject::Init()
{
// if it's a group, the unrotated range is needed for that group
const basegfx::B2DRange aUnrotatedRange(getUnrotatedGroupBoundRange(mXShape));
- const Point aNewP(basegfx::fround(aUnrotatedRange.getMinX()), basegfx::fround(aUnrotatedRange.getMinY()));
- const Size aNewS(basegfx::fround(aUnrotatedRange.getWidth()), basegfx::fround(aUnrotatedRange.getHeight()));
+ if (aUnrotatedRange.isEmpty())
+ {
+ SetRect(tools::Rectangle());
+ }
+ else
+ {
+ const Point aNewP(basegfx::fround<tools::Long>(aUnrotatedRange.getMinX()),
+ basegfx::fround<tools::Long>(aUnrotatedRange.getMinY()));
+ const Size aNewS(basegfx::fround<tools::Long>(aUnrotatedRange.getWidth()),
+ basegfx::fround<tools::Long>(aUnrotatedRange.getHeight()));
- SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS));
+ SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS));
+ }
}
else
{
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
index cf46f49b6bee..ae3fe91ec1cd 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -45,7 +45,7 @@ class ImplEESdrObject
public:
css::uno::Reference< css::beans::XPropertySet > mXPropSet;
- ImplEESdrObject( ImplEESdrWriter& rEx, const SdrObject& rObj, bool bOOXML );
+ ImplEESdrObject(ImplEESdrWriter& rEx, const SdrObject& rObj, bool bOOXML, sal_uInt32 nId = 0);
ImplEESdrObject( const css::uno::Reference< css::drawing::XShape >& rShape );
~ImplEESdrObject();
diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx
index 7aad72ba2dc7..376a453206fc 100644
--- a/filter/source/msfilter/mscodec.cxx
+++ b/filter/source/msfilter/mscodec.cxx
@@ -28,6 +28,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <utility>
#define DEBUG_MSO_ENCRYPTION_STD97 0
@@ -246,8 +247,8 @@ void MSCodec_Xor95::Skip( std::size_t nBytes )
mnOffset = (mnOffset + nBytes) & 0x0F;
}
-MSCodec97::MSCodec97(size_t nHashLen, const OUString& rEncKeyName)
- : m_sEncKeyName(rEncKeyName)
+MSCodec97::MSCodec97(size_t nHashLen, OUString aEncKeyName)
+ : m_sEncKeyName(std::move(aEncKeyName))
, m_nHashLen(nHashLen)
, m_hCipher(rtl_cipher_create(rtl_Cipher_AlgorithmARCFOUR, rtl_Cipher_ModeStream))
, m_aDocId(16, 0)
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 8832617a4e58..702e14d64d89 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -23,6 +23,7 @@
#include <math.h>
#include <limits>
#include <limits.h>
+#include <utility>
#include <vector>
#include <o3tl/any.hxx>
@@ -34,7 +35,7 @@
#include <comphelper/classids.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <unotools/configmgr.hxx>
+#include <comphelper/configuration.hxx>
#include <unotools/streamwrap.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
@@ -53,8 +54,9 @@
// SvxItem-Mapping. Is needed to successfully include the SvxItem-Header
#include <editeng/eeitem.hxx>
#include <editeng/editdata.hxx>
-#include <tools/stream.hxx>
+#include <tools/bigint.hxx>
#include <tools/debug.hxx>
+#include <tools/stream.hxx>
#include <tools/zcodec.hxx>
#include <filter/msfilter/escherex.hxx>
#include <basegfx/numeric/ftools.hxx>
@@ -72,6 +74,7 @@
#include <sfx2/fcontnr.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xsflclit.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xflftrit.hxx>
#include <svx/sdgcpitm.hxx>
@@ -149,6 +152,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>
@@ -167,14 +171,26 @@ using namespace container ;
// static counter for OLE-Objects
static sal_uInt32 nMSOleObjCntr = 0;
-constexpr OUStringLiteral MSO_OLE_Obj = u"MSO_OLE_Obj";
+constexpr OUString MSO_OLE_Obj = u"MSO_OLE_Obj"_ustr;
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
{
- sal_uLong nFilePos; ///< offset of the BLIP in data stream
- explicit SvxMSDffBLIPInfo(sal_uLong nFPos)
+ sal_uInt32 nFilePos; ///< offset of the BLIP in data stream
+ explicit SvxMSDffBLIPInfo(sal_uInt32 nFPos)
: nFilePos(nFPos)
{
}
@@ -528,8 +544,6 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
case SdrObjKind::PathFill :
case SdrObjKind::FreehandLine :
case SdrObjKind::FreehandFill :
- case SdrObjKind::SplineLine :
- case SdrObjKind::SplineFill :
case SdrObjKind::PathPoly :
case SdrObjKind::PathPolyLine :
{
@@ -601,7 +615,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
{
const SfxPoolItem& aCustomShape = static_cast<SdrObjCustomShape*>(pO)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(aCustomShape) );
- static const OUStringLiteral sPath( u"Path" );
+ static constexpr OUString sPath( u"Path"_ustr );
sal_Int16 nGluePointType = EnhancedCustomShapeGluePointType::SEGMENTS;
css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sPath, "GluePointType" );
if ( pAny )
@@ -723,7 +737,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
sal_Int32 nX = 0, nY = 0;
if ( ( rPara.First.Value >>= nX ) && ( rPara.Second.Value >>= nY ) )
{
- static const OUStringLiteral sGluePoints( u"GluePoints" );
+ static constexpr OUString sGluePoints( u"GluePoints"_ustr );
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aGluePoints;
pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints );
if ( pAny )
@@ -1078,7 +1092,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
basegfx::B2DPolyPolygon aPolyPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLength, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
rSet.Put( XLineStartWidthItem( nArrowWidth ) );
- rSet.Put( XLineStartItem( aArrowName, aPolyPoly) );
+ rSet.Put( XLineStartItem( std::move(aArrowName), std::move(aPolyPoly) ) );
rSet.Put( XLineStartCenterItem( bArrowCenter ) );
}
@@ -1096,7 +1110,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
basegfx::B2DPolyPolygon aPolyPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLength, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
rSet.Put( XLineEndWidthItem( nArrowWidth ) );
- rSet.Put( XLineEndItem( aArrowName, aPolyPoly ) );
+ rSet.Put( XLineEndItem( std::move(aArrowName), std::move(aPolyPoly) ) );
rSet.Put( XLineEndCenterItem( bArrowCenter ) );
}
}
@@ -1325,6 +1339,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
if ( nFillFlags & 0x10 )
{
auto eMSO_FillType = GetPropertyValue(DFF_Prop_fillType, mso_fillSolid);
+ bool bUseSlideBackground = false;
drawing::FillStyle eXFill = drawing::FillStyle_NONE;
switch( eMSO_FillType )
{
@@ -1353,7 +1368,10 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
case mso_fillShadeTitle : // special type - shade to title --- for PP
eXFill = drawing::FillStyle_GRADIENT;
break;
-// case mso_fillBackground : // Use the background fill color/pattern
+ case mso_fillBackground : // Use the background fill color/pattern
+ eXFill = drawing::FillStyle_NONE;
+ bUseSlideBackground = true;
+ break;
default: break;
}
rSet.Put( XFillStyleItem( eXFill ) );
@@ -1399,7 +1417,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
Bitmap aBmp( aGraf.GetBitmapEx().GetBitmap() );
if (aBmp.GetSizePixel().Width() == 8 &&
aBmp.GetSizePixel().Height() == 8 &&
- aBmp.getPixelFormat() == vcl::PixelFormat::N1_BPP)
+ aBmp.getPixelFormat() == vcl::PixelFormat::N8_BPP)
{
Color aCol1( COL_WHITE ), aCol2( COL_WHITE );
@@ -1412,7 +1430,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
// Create a bitmap for the pattern with expected colors
vcl::bitmap::RawBitmap aResult(Size(8, 8), 24);
{
- Bitmap::ScopedReadAccess pRead(aBmp);
+ BitmapScopedReadAccess pRead(aBmp);
for (tools::Long y = 0; y < aResult.Height(); ++y)
{
@@ -1447,12 +1465,18 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
}
else
{
- rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBitmapItem(OUString(), std::move(aGraf)));
rSet.Put(XFillBmpTileItem(false));
}
}
}
}
+ else if (eXFill == drawing::FillStyle_NONE && bUseSlideBackground)
+ {
+ rSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
+ XFillUseSlideBackgroundItem aFillBgItem(true);
+ rSet.Put(aFillBgItem);
+ }
}
else
rSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
@@ -1675,14 +1699,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 +1730,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 +1763,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 +1820,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 +1836,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 +1869,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 +1918,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 ) )
{
@@ -2111,12 +2175,13 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
else
{
const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( rObjData.eShapeType );
- if ( pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
+ if (pDefCustomShape && !pDefCustomShape->pHandles.empty())
{
- sal_uInt32 i, nCnt = pDefCustomShape->nHandles;
- const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
- for ( i = 0; i < nCnt; i++, pData++ )
+ // TODO: This is very similar to EscherPropertyContainer::LookForPolarHandles
+ sal_uInt32 i, nCnt = pDefCustomShape->pHandles.size();
+ for (i = 0; i < nCnt; i++)
{
+ const SvxMSDffHandle* pData = &pDefCustomShape->pHandles[i];
if ( pData->nFlags & SvxMSDffHandleFlags::POLAR )
{
if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
@@ -2769,7 +2834,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem
const css::uno::Any* pAny;
SdrCustomShapeGeometryItem aGeometryItem(rSet.Get( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
- static const OUStringLiteral sTextRotateAngle( u"TextRotateAngle" );
+ static constexpr OUString sTextRotateAngle( u"TextRotateAngle"_ustr );
pAny = aGeometryItem.GetPropertyValueByName( sTextRotateAngle );
double fExtraTextRotateAngle = 0.0;
if ( pAny )
@@ -2867,13 +2932,13 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F
aCol1 = aCol2;
aCol2 = aZwi;
//Swap two colors' transparency
- double dTemp = dTrans;
- dTrans = dBackTrans;
- dBackTrans = dTemp;
+ std::swap( dTrans, dBackTrans );
}
//Construct gradient item
- XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
+ basegfx::BGradient aGrad(
+ basegfx::BColorStops(aCol2.getBColor(), aCol1.getBColor()),
+ eGrad, nAngle, nFocusX, nFocusY );
//Intensity has been merged into color. So here just set is as 100
aGrad.SetStartIntens( 100 );
aGrad.SetEndIntens( 100 );
@@ -2886,7 +2951,9 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F
aCol1 = Color(nStartCol, nStartCol, nStartCol);
aCol2 = Color(nEndCol, nEndCol, nEndCol);
- XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY );
+ basegfx::BGradient aGrad2(
+ basegfx::BColorStops(aCol2.getBColor(), aCol1.getBColor()),
+ eGrad, nAngle, nFocusX, nFocusY );
aSet.Put( XFillFloatTransparenceItem( OUString(), aGrad2 ) );
}
}
@@ -3102,7 +3169,22 @@ bool CompareSvxMSDffShapeInfoByTxBxComp::operator() (
void SvxMSDffManager::Scale( sal_Int32& rVal ) const
{
if ( bNeedMap )
+ {
+ if (rVal > nMaxAllowedVal)
+ {
+ SAL_WARN("filter.ms", "Cannot scale value: " << rVal);
+ rVal = SAL_MAX_INT32;
+ return;
+ }
+ else if (rVal < nMinAllowedVal)
+ {
+ SAL_WARN("filter.ms", "Cannot scale value: " << rVal);
+ rVal = SAL_MAX_INT32;
+ return;
+ }
+
rVal = BigMulDiv( rVal, nMapMul, nMapDiv );
+ }
}
void SvxMSDffManager::Scale( Point& rPos ) const
@@ -3185,6 +3267,26 @@ void SvxMSDffManager::SetModel(SdrModel* pModel, tools::Long nApplicationScale)
nMapMul = nMapDiv = nMapXOfs = nMapYOfs = nEmuMul = nEmuDiv = nPntMul = nPntDiv = 0;
bNeedMap = false;
}
+
+ if (bNeedMap)
+ {
+ assert(nMapMul > nMapDiv);
+
+ BigInt aMinVal(SAL_MIN_INT32);
+ aMinVal /= nMapMul;
+ aMinVal *= nMapDiv;
+ nMinAllowedVal = aMinVal;
+
+ BigInt aMaxVal(SAL_MAX_INT32);
+ aMaxVal /= nMapMul;
+ aMaxVal *= nMapDiv;
+ nMaxAllowedVal = aMaxVal;
+ }
+ else
+ {
+ nMinAllowedVal = SAL_MIN_INT32;
+ nMaxAllowedVal = SAL_MAX_INT32;
+ }
}
bool SvxMSDffManager::SeekToShape( SvStream& rSt, SvxMSDffClientData* /* pClientData */, sal_uInt32 nId ) const
@@ -3614,7 +3716,7 @@ void SvxMSDffManager::ReadObjText( SvStream& rStream, SdrObject* pObj )
// our outliner is too complicate to be used properly,
void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj )
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pObj );
+ SdrTextObj* pText = DynCastSdrTextObj( pObj );
if ( !pText )
return;
@@ -3767,9 +3869,9 @@ static void lcl_ApplyCropping( const DffPropSet& rPropSet, SfxItemSet* pSet, Gra
}
}
-SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const DffObjData& rObjData )
+rtl::Reference<SdrObject> SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, const DffObjData& rObjData )
{
- SdrObject* pRet = nullptr;
+ rtl::Reference<SdrObject> pRet;
OUString aLinkFileName;
tools::Rectangle aVisArea;
@@ -3803,9 +3905,9 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
}
if (bOk && DFF_msofbtBSE == aHd.nRecType)
{
- const sal_uLong nSkipBLIPLen = 20;
- const sal_uLong nSkipShapePos = 4;
- const sal_uLong nSkipBLIP = 4;
+ const sal_uInt8 nSkipBLIPLen = 20;
+ const sal_uInt8 nSkipShapePos = 4;
+ const sal_uInt8 nSkipBLIP = 4;
const sal_uLong nSkip =
nSkipBLIPLen + 4 + nSkipShapePos + 4 + nSkipBLIP;
@@ -3966,7 +4068,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
{
pRet = new SdrGrafObj(*pSdrModel);
if( bGrfRead )
- static_cast<SdrGrafObj*>(pRet)->SetGraphic( aGraf );
+ static_cast<SdrGrafObj*>(pRet.get())->SetGraphic( aGraf );
if( bLinkGrf && !bGrfRead ) // sj: #i55484# if the graphic was embedded ( bGrfRead == true ) then
{ // we do not need to set a link. TODO: not to lose the information where the graphic is linked from
@@ -4003,9 +4105,9 @@ 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))
+ if (SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pRet.get()))
{
if( aLinkFileName.getLength() )
{
@@ -4025,10 +4127,10 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
}
// PptSlidePersistEntry& rPersistEntry, SdPage* pPage
-SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, SvxMSDffClientData& rClientData,
+rtl::Reference<SdrObject> SvxMSDffManager::ImportObj( SvStream& rSt, SvxMSDffClientData& rClientData,
tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect, int nCalledByGroup, sal_Int32* pShapeId )
{
- SdrObject* pRet = nullptr;
+ rtl::Reference<SdrObject> pRet;
DffRecordHeader aObjHd;
bool bOk = ReadDffRecordHeader(rSt, aObjHd);
if (bOk && aObjHd.nRecType == DFF_msofbtSpgrContainer)
@@ -4043,17 +4145,17 @@ SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, SvxMSDffClientData& rClien
return pRet;
}
-SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData,
+rtl::Reference<SdrObject> SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData,
tools::Rectangle& rClientRect, const tools::Rectangle& rGlobalChildRect,
int nCalledByGroup, sal_Int32* pShapeId )
{
- SdrObject* pRet = nullptr;
-
if( pShapeId )
*pShapeId = 0;
if (!rHd.SeekToContent(rSt))
- return pRet;
+ return nullptr;
+
+ rtl::Reference<SdrObject> xRet;
DffRecordHeader aRecHd; // the first atom has to be the SpContainer for the GroupObject
bool bOk = ReadDffRecordHeader(rSt, aRecHd);
@@ -4061,9 +4163,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
{
mnFix16Angle = 0_deg100;
if (!aRecHd.SeekToBegOfRecord(rSt))
- return pRet;
- pRet = ImportObj( rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId );
- if ( pRet )
+ return xRet;
+ xRet = ImportObj(rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId);
+ if (xRet)
{
Degree100 nGroupRotateAngle(0);
ShapeFlag nSpFlags = nGroupShapeFlags;
@@ -4093,7 +4195,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
// now importing the inner objects of the group
if (!aRecHd.SeekToEndOfRecord(rSt))
- return pRet;
+ return xRet;
while (rSt.good() && ( rSt.Tell() < rHd.GetRecEndFilePos()))
{
@@ -4105,81 +4207,79 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
tools::Rectangle aGroupClientAnchor, aGroupChildAnchor;
GetGroupAnchors( aRecHd2, rSt, aGroupClientAnchor, aGroupChildAnchor, aClientRect, aGlobalChildRect );
if (!aRecHd2.SeekToBegOfRecord(rSt))
- return pRet;
+ return xRet;
sal_Int32 nShapeId;
- SdrObject* pTmp = ImportGroup( aRecHd2, rSt, rClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
+ rtl::Reference<SdrObject> pTmp = ImportGroup( aRecHd2, rSt, rClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
if (pTmp)
{
- SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet);
+ SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(xRet.get());
if (pGroup && pGroup->GetSubList())
{
- pGroup->GetSubList()->NbcInsertObject(pTmp);
+ pGroup->GetSubList()->NbcInsertObject(pTmp.get());
if (nShapeId)
- insertShapeId(nShapeId, pTmp);
+ insertShapeId(nShapeId, pTmp.get());
}
else
- FreeObj(rClientData, pTmp);
+ FreeObj(rClientData, pTmp.get());
}
}
else if ( aRecHd2.nRecType == DFF_msofbtSpContainer )
{
if (!aRecHd2.SeekToBegOfRecord(rSt))
- return pRet;
+ return xRet;
sal_Int32 nShapeId;
- SdrObject* pTmp = ImportShape( aRecHd2, rSt, rClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
+ rtl::Reference<SdrObject> pTmp = ImportShape( aRecHd2, rSt, rClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
if (pTmp)
{
- SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pRet);
+ SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(xRet.get());
if (pGroup && pGroup->GetSubList())
{
- pGroup->GetSubList()->NbcInsertObject(pTmp);
+ pGroup->GetSubList()->NbcInsertObject(pTmp.get());
if (nShapeId)
- insertShapeId(nShapeId, pTmp);
+ insertShapeId(nShapeId, pTmp.get());
}
else
- FreeObj(rClientData, pTmp);
+ FreeObj(rClientData, pTmp.get());
}
}
if (!aRecHd2.SeekToEndOfRecord(rSt))
- return pRet;
+ return xRet;
}
if ( nGroupRotateAngle )
- pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle );
+ xRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle );
if ( nSpFlags & ShapeFlag::FlipV )
{ // BoundRect in aBoundRect
Point aLeft( aClientRect.Left(), ( aClientRect.Top() + aClientRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
- pRet->NbcMirror( aLeft, aRight );
+ xRet->NbcMirror( aLeft, aRight );
}
if ( nSpFlags & ShapeFlag::FlipH )
{ // BoundRect in aBoundRect
Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, aClientRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
- pRet->NbcMirror( aTop, aBottom );
+ xRet->NbcMirror( aTop, aBottom );
}
}
}
if (o3tl::make_unsigned(nCalledByGroup) < maPendingGroupData.size())
{
// finalization for this group is pending, do it now
- pRet = FinalizeObj(maPendingGroupData.back().first, pRet);
+ xRet = FinalizeObj(maPendingGroupData.back().first, xRet.get());
maPendingGroupData.pop_back();
}
- return pRet;
+ return xRet;
}
-SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData,
+rtl::Reference<SdrObject> SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, SvxMSDffClientData& rClientData,
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 +4330,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 +4385,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.nSpFlags & ShapeFlag::Background )
aObjData.aBoundRect = tools::Rectangle( Point(), Size( 1, 1 ) );
+ rtl::Reference<SdrObject> xRet;
+
tools::Rectangle aTextRect;
if ( !aObjData.aBoundRect.IsEmpty() )
{ // apply rotation to the BoundingBox BEFORE an object has been generated
@@ -4309,7 +4411,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.nSpFlags & ShapeFlag::Group )
{
- pRet = new SdrObjGroup(*pSdrModel);
+ xRet = 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 +4431,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 = 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 +4441,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 = new SdrPathObj(
*pSdrModel,
SdrObjKind::Line,
basegfx::B2DPolyPolygon(aPoly));
ApplyAttributes( rSt, aSet, aObjData );
- pRet->SetMergedItemSet(aSet);
+ xRet->SetMergedItemSet(aSet);
}
else
{
@@ -4353,7 +4455,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
ApplyAttributes( rSt, aSet, aObjData );
- pRet = new SdrObjCustomShape(*pSdrModel);
+ xRet = new SdrObjCustomShape(*pSdrModel);
sal_uInt32 ngtextFStrikethrough = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 );
bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0;
@@ -4389,12 +4491,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);
@@ -4453,29 +4555,29 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
&& aObjName.match( "PowerPlusWaterMarkObject" ) )
{
double fRatio = static_cast<double>(pDevice->GetTextHeight()) / nTextWidth;
- sal_Int32 nNewHeight = fRatio * aObjData.aBoundRect.getWidth();
- sal_Int32 nPaddingY = aObjData.aBoundRect.getHeight() - nNewHeight;
+ sal_Int32 nNewHeight = fRatio * aObjData.aBoundRect.getOpenWidth();
+ sal_Int32 nPaddingY = aObjData.aBoundRect.getOpenHeight() - nNewHeight;
if ( nPaddingY > 0 )
aObjData.aBoundRect.setHeight( nNewHeight );
}
}
}
- 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);
+ ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::WITHOUT_ALPHA);
pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
sal_Int32 i, nParagraphs = rOutliner.GetParagraphCount();
if ( nParagraphs )
@@ -4497,7 +4599,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();
@@ -4511,10 +4613,10 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// applies only if importing arcs from MS Office.
if ( aObjData.eShapeType == mso_sptArc )
{
- 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 ) );
+ static constexpr OUString sAdjustmentValues( u"AdjustmentValues"_ustr );
+ static constexpr OUString sViewBox( u"ViewBox"_ustr );
+ static constexpr OUString sPath( u"Path"_ustr );
+ 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
@@ -4626,8 +4728,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
{
double fLogicXOfs(0.0); // LogicLeft_LO = LogicLeft_MS + fXLogicOfs
double fLogicYOfs(0.0);
- double fLogicPieWidth(aObjData.aBoundRect.getWidth());
- double fLogicPieHeight(aObjData.aBoundRect.getHeight());
+ double fLogicPieWidth(aObjData.aBoundRect.getOpenWidth());
+ double fLogicPieHeight(aObjData.aBoundRect.getOpenHeight());
double fLogicEllipseWidth(0.0); // to be LogicWidth_LO
double fLogicEllipseHeight(0.0);
if (aPieRect_MS.getWidth())
@@ -4706,56 +4808,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 = 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 +4896,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 +4921,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 = ProcessObj(rSt, aObjData, rClientData, aTextRect, xRet.get());
- 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 +5000,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
}
else
{
- pRet = FinalizeObj(aObjData, pRet);
+ xRet = FinalizeObj(aObjData, xRet.get());
}
- return pRet;
+ return xRet;
}
tools::Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, tools::Rectangle& aClientRect )
@@ -5064,7 +5164,7 @@ void SvxMSDffImportData::insert(std::unique_ptr<SvxMSDffImportRec> pImpRec)
if (bSuccess)
{
SvxMSDffImportRec* pRec = aRet.first->get();
- m_ObjToRecMap[pRec->pObj] = pRec;
+ m_ObjToRecMap[pRec->pObj.get()] = pRec;
}
}
@@ -5082,9 +5182,8 @@ void SvxMSDffManager::NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj)
if (SdrObjGroup* pGroup = dynamic_cast<SdrObjGroup*>(pObj))
{
SdrObjList* pSubList = pGroup->GetSubList();
- size_t nObjCount = pSubList->GetObjCount();
- for (size_t i = 0; i < nObjCount; ++i)
- NotifyFreeObj(rData, pSubList->GetObj(i));
+ for (const rtl::Reference<SdrObject>& pChildObj : *pSubList)
+ NotifyFreeObj(rData, pChildObj.get());
}
rData.NotifyFreeObj(pObj);
@@ -5093,16 +5192,16 @@ void SvxMSDffManager::NotifyFreeObj(SvxMSDffClientData& rData, SdrObject* pObj)
void SvxMSDffManager::FreeObj(SvxMSDffClientData& rData, SdrObject* pObj)
{
NotifyFreeObj(rData, pObj);
- SdrObject::Free(pObj);
}
-SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
+rtl::Reference<SdrObject> SvxMSDffManager::ProcessObj(SvStream& rSt,
DffObjData& rObjData,
SvxMSDffClientData& rData,
tools::Rectangle& rTextRect,
- SdrObject* pObj
+ SdrObject* pObj1
)
{
+ rtl::Reference<SdrObject> pObj = pObj1;
if( !rTextRect.IsEmpty() )
{
SvxMSDffImportData& rImportData = static_cast<SvxMSDffImportData&>(rData);
@@ -5158,7 +5257,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
@@ -5179,8 +5278,8 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
}
// text frame, also Title or Outline
- SdrObject* pOrgObj = pObj;
- SdrRectObj* pTextObj = nullptr;
+ rtl::Reference<SdrObject> pOrgObj = pObj;
+ rtl::Reference<SdrRectObj> pTextObj;
sal_uInt32 nTextId = GetPropertyValue( DFF_Prop_lTxid, 0 );
if( nTextId )
{
@@ -5209,8 +5308,8 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
if (bTextFrame)
{
- SdrObject::Free( pObj );
- pObj = pOrgObj = nullptr;
+ pObj = nullptr;
+ pOrgObj = nullptr;
}
// Distance of Textbox to its surrounding Customshape
@@ -5447,20 +5546,20 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
if( !pObj )
{
- pObj = pTextObj;
+ pObj = pTextObj.get();
}
else
{
- if( pTextObj != pObj )
+ if( pTextObj.get() != pObj.get() )
{
- SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
- pGroup->GetSubList()->NbcInsertObject( pObj );
- pGroup->GetSubList()->NbcInsertObject( pTextObj );
+ rtl::Reference<SdrObject> pGroup = new SdrObjGroup(*pSdrModel);
+ pGroup->GetSubList()->NbcInsertObject( pObj.get() );
+ pGroup->GetSubList()->NbcInsertObject( pTextObj.get() );
if (pOrgObj == pObj)
pOrgObj = pGroup;
else
pOrgObj = pObj;
- pObj = pGroup;
+ pObj = pGroup.get();
}
}
}
@@ -5477,9 +5576,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);
@@ -5575,7 +5672,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
// amend the import record list
if( pOrgObj )
{
- pImpRec->pObj = pOrgObj;
+ pImpRec->pObj = pOrgObj.get();
rImportData.insert(std::unique_ptr<SvxMSDffImportRec>(pImpRec));
bDeleteImpRec = false;
if (pImpRec == pTextImpRec)
@@ -5586,7 +5683,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
{
// Modify ShapeId (must be unique)
pImpRec->nShapeId |= 0x8000000;
- pTextImpRec->pObj = pTextObj;
+ pTextImpRec->pObj = pTextObj.get();
rImportData.insert(std::unique_ptr<SvxMSDffImportRec>(pTextImpRec));
bDeleteTextImpRec = false;
if (pTextImpRec == pImpRec)
@@ -5602,7 +5699,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
)
StoreShapeOrder( pImpRec->nShapeId,
( static_cast<sal_uLong>(pImpRec->aTextId.nTxBxS) << 16 )
- + pImpRec->aTextId.nSequence, pObj );
+ + pImpRec->aTextId.nSequence, pObj.get() );
}
if (bDeleteImpRec)
@@ -5671,7 +5768,7 @@ void SvxMSDffManager::RemoveFromShapeOrder( SdrObject const * pObject ) const
// exported class: Public Methods
SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
- const OUString& rBaseURL,
+ OUString aBaseURL,
sal_uInt32 nOffsDgg_,
SvStream* pStData_,
SdrModel* pSdrModel_,// see SetModel() below
@@ -5686,7 +5783,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
nBLIPCount( USHRT_MAX ), // initialize with error, since we first check if the
nGroupShapeFlags(ShapeFlag::NONE), // ensure initialization here, as some corrupted
// files may yield to this being uninitialized
- maBaseURL( rBaseURL ),
+ maBaseURL(std::move( aBaseURL )),
mnIdClusters(0),
rStCtrl( rStCtrl_ ),
pStData( pStData_ ),
@@ -5721,14 +5818,14 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
pStData->Seek( nOldPosData );
}
-SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const OUString& rBaseURL )
+SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, OUString aBaseURL )
:DffPropertyReader( *this ),
m_pBLIPInfos( new SvxMSDffBLIPInfos ),
m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
nOffsDgg( 0 ),
nBLIPCount( USHRT_MAX ), // initialize with error, since we first have to check
nGroupShapeFlags(ShapeFlag::NONE),
- maBaseURL( rBaseURL ),
+ maBaseURL(std::move( aBaseURL )),
mnIdClusters(0),
rStCtrl( rStCtrl_ ),
pStData( nullptr ),
@@ -5900,10 +5997,10 @@ void SvxMSDffManager::GetCtrlData(sal_uInt32 nOffsDggL)
if (!checkSeek(rStCtrl, nOffsDggL))
return;
- sal_uInt8 nVer;
- sal_uInt16 nInst;
- sal_uInt16 nFbt;
- sal_uInt32 nLength;
+ sal_uInt8 nVer(0);
+ sal_uInt16 nInst(0);
+ sal_uInt16 nFbt(0);
+ sal_uInt32 nLength(0);
if( !ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) ) return;
sal_uInt64 nPos = nOffsDggL + DFF_COMMON_RECORD_HEADER_SIZE;
@@ -6038,7 +6135,7 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uInt32 nL
void SvxMSDffManager::GetDrawingContainerData( SvStream& rSt, sal_uInt32 nLenDg,
sal_uInt16 nDrawingContainerId )
{
- sal_uInt8 nVer;sal_uInt16 nInst;sal_uInt16 nFbt;sal_uInt32 nLength;
+ sal_uInt8 nVer;sal_uInt16 nInst;sal_uInt16 nFbt(0);sal_uInt32 nLength(0);
sal_uLong nReadDg = 0;
@@ -6239,7 +6336,6 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
// complex Prop found:
// Length is always 6. The length of the appended extra data
// after the actual prop table is of different size.
- nPropVal = 6;
}
}
break;
@@ -6306,7 +6402,7 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
Access to a shape at runtime (via the Shape-Id)
----------------------------
******************************************************************************/
-bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
+bool SvxMSDffManager::GetShape(sal_uLong nId, rtl::Reference<SdrObject>& rpShape,
SvxMSDffImportData& rData)
{
auto const pTmpRec = std::make_shared<SvxMSDffShapeInfo>(0, nId);
@@ -6336,7 +6432,7 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
rStCtrl.Seek( nOldPosCtrl );
if( &rStCtrl != pStData && pStData )
pStData->Seek( nOldPosData );
- return ( nullptr != rpShape );
+ return bool( rpShape );
}
@@ -6442,40 +6538,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 +6596,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 +6660,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 +6690,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 +6698,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
@@ -6656,7 +6770,7 @@ void SvxMSDffManager::ProcessClientAnchor2( SvStream& /* rSt */, DffRecordHeader
// will be overridden by SJ in Draw
}
-bool SvxMSDffManager::GetOLEStorageName( sal_uInt32, OUString&, tools::SvRef<SotStorage>&, uno::Reference < embed::XStorage >& ) const
+bool SvxMSDffManager::GetOLEStorageName( sal_uInt32, OUString&, rtl::Reference<SotStorage>&, uno::Reference < embed::XStorage >& ) const
{
return false;
}
@@ -6667,15 +6781,15 @@ bool SvxMSDffManager::ShapeHasText( sal_uLong /* nShapeId */, sal_uLong /* nFile
}
// #i32596# - add new parameter <_nCalledByGroup>
-SdrObject* SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId,
+rtl::Reference<SdrObject> SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId,
const Graphic& rGrf,
const tools::Rectangle& rBoundRect,
const tools::Rectangle& rVisArea,
const int /* _nCalledByGroup */ ) const
{
- SdrObject* pRet = nullptr;
+ rtl::Reference<SdrObject> pRet;
OUString sStorageName;
- tools::SvRef<SotStorage> xSrcStg;
+ rtl::Reference<SotStorage> xSrcStg;
ErrCode nError = ERRCODE_NONE;
uno::Reference < embed::XStorage > xDstStg;
if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg ))
@@ -6697,7 +6811,7 @@ SdrObject* SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId,
bool SvxMSDffManager::MakeContentStream( SotStorage * pStor, const GDIMetaFile & rMtf )
{
- tools::SvRef<SotStorageStream> xStm = pStor->OpenSotStream(SVEXT_PERSIST_STREAM);
+ rtl::Reference<SotStorageStream> xStm = pStor->OpenSotStream(SVEXT_PERSIST_STREAM);
xStm->SetVersion( pStor->GetVersion() );
xStm->SetBufferSize( 8192 );
@@ -6837,10 +6951,10 @@ const ClsIDs aClsIDs[] = {
bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen,
- const GDIMetaFile * pMtf, const tools::SvRef<SotStorage>& rDest )
+ const GDIMetaFile * pMtf, const rtl::Reference<SotStorage>& rDest )
{
bool bMtfRead = false;
- tools::SvRef<SotStorageStream> xOle10Stm = rDest->OpenSotStream( "\1Ole10Native",
+ rtl::Reference<SotStorageStream> xOle10Stm = rDest->OpenSotStream( "\1Ole10Native",
StreamMode::WRITE| StreamMode::SHARE_DENYALL );
if( xOle10Stm->GetError() )
return false;
@@ -6886,7 +7000,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen,
// write to ole10 stream
xOle10Stm->WriteUInt32( nDataLen );
xOle10Stm->WriteBytes(pData.get(), nDataLen);
- xOle10Stm = tools::SvRef<SotStorageStream>();
+ xOle10Stm.clear();
// set the compobj stream
const ClsIDs* pIds;
@@ -7004,7 +7118,7 @@ OUString SvxMSDffManager::GetFilterNameFromClassID( const SvGlobalName& aGlobNam
void SvxMSDffManager::ExtractOwnStream(SotStorage& rSrcStg, SvMemoryStream& rMemStream)
{
- tools::SvRef<SotStorageStream> xStr
+ rtl::Reference<SotStorageStream> xStr
= rSrcStg.OpenSotStream("package_stream", StreamMode::STD_READ);
xStr->ReadStream(rMemStream);
}
@@ -7077,14 +7191,16 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo
}
else
{
- SfxFilterMatcher aMatch( sStarName );
- tools::SvRef<SotStorage> xStorage = new SotStorage( false, aMemStream );
+ rtl::Reference<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())
+ if (aType.getLength() && !comphelper::IsFuzzing())
+ {
+ SfxFilterMatcher aMatch( sStarName );
pFilter = aMatch.GetFilter4EA( aType );
+ }
}
#ifdef DEBUG_FILTER_MSFILTER
@@ -7186,10 +7302,10 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo
}
// TODO/MBA: code review and testing!
-SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
+rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage(
SdrModel& rSdrModel,
const OUString& rStorageName,
- tools::SvRef<SotStorage> const & rSrcStorage,
+ rtl::Reference<SotStorage> const & rSrcStorage,
const uno::Reference < embed::XStorage >& xDestStorage,
const Graphic& rGrf,
const tools::Rectangle& rBoundRect,
@@ -7201,7 +7317,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
OUString const& rBaseURL)
{
sal_Int64 nAspect = nRecommendedAspect;
- SdrOle2Obj* pRet = nullptr;
+ rtl::Reference<SdrOle2Obj> pRet;
if( rSrcStorage.is() && xDestStorage.is() && rStorageName.getLength() )
{
comphelper::EmbeddedObjectContainer aCnt( xDestStorage );
@@ -7212,12 +7328,12 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
OUString aDstStgName = MSO_OLE_Obj + OUString::number( ++nMSOleObjCntr );
{
- tools::SvRef<SotStorage> xObjStg = rSrcStorage->OpenSotStorage( rStorageName );
+ rtl::Reference<SotStorage> xObjStg = rSrcStorage->OpenSotStorage(rStorageName);
if( xObjStg.is() )
{
{
sal_uInt8 aTestA[10]; // exist the \1CompObj-Stream ?
- tools::SvRef<SotStorageStream> xSrcTst = xObjStg->OpenSotStream( "\1CompObj" );
+ rtl::Reference<SotStorageStream> xSrcTst = xObjStg->OpenSotStream("\1CompObj");
bValidStorage = xSrcTst.is() && sizeof( aTestA ) ==
xSrcTst->ReadBytes(aTestA, sizeof(aTestA));
if( !bValidStorage )
@@ -7238,7 +7354,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
// is a kind of embedded objects in Word documents
// TODO/LATER: should the caller be notified if the aspect changes in future?
- tools::SvRef<SotStorageStream> xObjInfoSrc = xObjStg->OpenSotStream(
+ rtl::Reference<SotStorageStream> xObjInfoSrc = xObjStg->OpenSotStream(
"\3ObjInfo", StreamMode::STD_READ );
if ( xObjInfoSrc.is() && !xObjInfoSrc->GetError() )
{
@@ -7280,11 +7396,11 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
if( bValidStorage )
{
// object is not an own object
- tools::SvRef<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName, StreamMode::READWRITE );
+ rtl::Reference<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName, StreamMode::READWRITE );
if ( xObjStor.is() )
{
- tools::SvRef<SotStorage> xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, StreamMode::READ );
+ rtl::Reference<SotStorage> xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, StreamMode::READ );
xSrcStor->CopyTo( xObjStor.get() );
if( !xObjStor->GetError() )
@@ -7311,7 +7427,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
else
{
// or is it an OLE-1 Stream in the DataStream?
- tools::SvRef<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName );
+ rtl::Reference<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName );
//TODO/MBA: remove metafile conversion from ConvertToOle2
//when is this code used?!
GDIMetaFile aMtf;
@@ -7408,12 +7524,11 @@ bool SvxMSDffManager::SetPropValue( const uno::Any& rAny, const uno::Reference<
}
SvxMSDffImportRec::SvxMSDffImportRec()
- : pObj( nullptr ),
- nClientAnchorLen( 0 ),
+ : nClientAnchorLen( 0 ),
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 +7565,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/msocximex.cxx b/filter/source/msfilter/msocximex.cxx
index d2236f62c30c..f57f3d25bd08 100644
--- a/filter/source/msfilter/msocximex.cxx
+++ b/filter/source/msfilter/msocximex.cxx
@@ -28,12 +28,13 @@
#include <com/sun/star/form/XForm.hpp>
#include <osl/diagnose.h>
#include <filter/msfilter/msocximex.hxx>
+#include <utility>
using namespace ::com::sun::star;
-constexpr OUStringLiteral sWW8_form( u"WW-Standard" );
+constexpr OUString sWW8_form( u"WW-Standard"_ustr );
-SvxMSConvertOCXControls::SvxMSConvertOCXControls( const uno::Reference< frame::XModel >& rxModel) : mxModel(rxModel)
+SvxMSConvertOCXControls::SvxMSConvertOCXControls( uno::Reference< frame::XModel > xModel) : mxModel(std::move(xModel))
{
}
diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx
index 9e68e5cb0ab7..5e0729be55bd 100644
--- a/filter/source/msfilter/msoleexp.cxx
+++ b/filter/source/msfilter/msoleexp.cxx
@@ -19,10 +19,6 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/configuration/theDefaultProvider.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
@@ -35,9 +31,8 @@
#include <sfx2/fcontnr.hxx>
#include <sot/formats.hxx>
#include <sot/storage.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/fileformat.h>
-#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <unotools/streamwrap.hxx>
#include <comphelper/storagehelper.hxx>
@@ -83,36 +78,6 @@ static OUString GetStorageType( const SvGlobalName& aEmbName )
return OUString();
}
-static bool UseOldMSExport()
-{
- uno::Reference< lang::XMultiServiceFactory > xProvider(
- configuration::theDefaultProvider::get(
- comphelper::getProcessComponentContext()));
- try {
- uno::Sequence< uno::Any > aArg{ uno::Any(
- OUString( "/org.openoffice.Office.Common/InternalMSExport" )) };
- uno::Reference< container::XNameAccess > xNameAccess(
- xProvider->createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationUpdateAccess",
- aArg ),
- uno::UNO_QUERY );
- if ( xNameAccess.is() )
- {
- uno::Any aResult = xNameAccess->getByName( "UseOldExport" );
-
- bool bResult;
- if ( aResult >>= bResult )
- return bResult;
- }
- }
- catch( const uno::Exception& )
- {
- }
-
- OSL_FAIL( "Could not get access to configuration entry!" );
- return false;
-}
-
void SvxMSExportOLEObjects::ExportOLEObject( const css::uno::Reference < css::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg )
{
svt::EmbeddedObjectRef aObj( rObj, embed::Aspects::MSOLE_CONTENT );
@@ -203,7 +168,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj
}
catch( const uno::Exception& ) {} // #TODO really handle exceptions - interactionalhandler etc. ?
- tools::SvRef<SotStorage> xOLEStor = new SotStorage( pStream, true );
+ rtl::Reference<SotStorage> xOLEStor = new SotStorage( pStream, true );
xOLEStor->CopyTo( &rDestStg );
rDestStg.Commit();
}
@@ -217,14 +182,14 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj
{
// own format, maybe SO6 format or lower
SvGlobalName aEmbName = GetEmbeddedVersion( aOwnGlobalName );
- if ( aEmbName != SvGlobalName() && !UseOldMSExport() )
+ if ( aEmbName != SvGlobalName() )
{
// this is a SO6 embedded object, save in old binary format
rDestStg.SetVersion( SOFFICE_FILEFORMAT_31 );
rDestStg.SetClass( aEmbName,
SotClipboardFormatId::EMBEDDED_OBJ_OLE,
GetStorageType( aEmbName ) );
- tools::SvRef<SotStorageStream> xExtStm = rDestStg.OpenSotStream(
+ rtl::Reference<SotStorageStream> xExtStm = rDestStg.OpenSotStream(
"properties_stream");
bool bExtentSuccess = false;
@@ -279,7 +244,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj
if ( bExtentSuccess )
{
- tools::SvRef<SotStorageStream> xEmbStm = rDestStg.OpenSotStream(
+ rtl::Reference<SotStorageStream> xEmbStm = rDestStg.OpenSotStream(
"package_stream");
if( !xEmbStm->GetError() )
{
@@ -326,7 +291,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj
catch ( const uno::Exception& )
{}
- tools::SvRef<SotStorage> xOLEStor = SotStorage::OpenOLEStorage( xStor, aTempName, StreamMode::STD_READ );
+ rtl::Reference<SotStorage> xOLEStor = SotStorage::OpenOLEStorage( xStor, aTempName, StreamMode::STD_READ );
xOLEStor->CopyTo( &rDestStg );
rDestStg.Commit();
}
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 339b54766101..fa78dce52443 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
+#include <utility>
#include <vcl/dibtools.hxx>
#include <vcl/graph.hxx>
#include <vcl/bitmapex.hxx>
@@ -102,7 +103,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 +133,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 +143,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();
@@ -219,7 +220,7 @@ void TBCHeader::Print( FILE* fp )
}
#endif
-TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
+TBCData::TBCData( TBCHeader Header ) : rHeader(std::move( Header ))
{
}
@@ -302,7 +303,7 @@ void TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect
// according to the spec:
// "the iconMask is white in all the areas in which the icon is
// displayed as transparent and is black in all other areas."
- aBitEx = BitmapEx(aBitEx.GetBitmap(), rMaskBase.CreateMask(COL_WHITE));
+ aBitEx = BitmapEx(aBitEx.GetBitmap(), rMaskBase.CreateAlphaMask(COL_WHITE));
}
}
diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx
index ee40bede6bd4..17282aebf61a 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -38,41 +38,43 @@
#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>
-#include <map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
using namespace ::com::sun::star;
namespace ooo::vba {
-constexpr OUStringLiteral sUrlPart0( u"vnd.sun.star.script:" );
-constexpr OUStringLiteral sUrlPart1( u"?language=Basic&location=document" );
+constexpr OUString sUrlPart0( u"vnd.sun.star.script:"_ustr );
+constexpr OUString sUrlPart1( u"?language=Basic&location=document"_ustr );
OUString makeMacroURL( std::u16string_view sMacroName )
{
return sUrlPart0 + sMacroName + sUrlPart1;
}
-OUString extractMacroName( const OUString& rMacroUrl )
+OUString extractMacroName( std::u16string_view rMacroUrl )
{
- if( rMacroUrl.startsWith( sUrlPart0 ) && rMacroUrl.endsWith( sUrlPart1 ) )
+ if( o3tl::starts_with(rMacroUrl, sUrlPart0 ) && o3tl::ends_with(rMacroUrl, sUrlPart1 ) )
{
- return rMacroUrl.copy( sUrlPart0.getLength(),
- rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() );
+ return OUString(rMacroUrl.substr( sUrlPart0.getLength(),
+ rMacroUrl.size() - sUrlPart0.getLength() - sUrlPart1.getLength() ));
}
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 +114,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;
@@ -171,55 +173,70 @@ static SfxObjectShell* findShellForUrl( const OUString& sMacroURLOrPath )
// sMod can be empty ( but we really need the library to search in )
// if sMod is empty and a macro is found then sMod is updated
// 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 )
+static bool hasMacro(SfxObjectShell const* pShell, const OUString& sLibrary, OUString& sMod,
+ const OUString& sMacro, bool bOnlyPublic, const OUString& sSkipModule)
{
- bool bFound = false;
-
#if !HAVE_FEATURE_SCRIPTING
(void) pShell;
(void) sLibrary;
(void) sMod;
(void) sMacro;
+ (void) bOnlyPublic;
+ (void) sSkipModule;
#else
- if ( !sLibrary.isEmpty() && !sMacro.isEmpty() )
+ if (sLibrary.isEmpty() || sMacro.isEmpty())
+ return false;
+
+ BasicManager* pBasicMgr = pShell->GetBasicManager();
+ if (!pBasicMgr)
+ return false;
+
+ StarBASIC* pBasic = pBasicMgr->GetLib(sLibrary);
+ if (!pBasic)
{
- BasicManager* pBasicMgr = pShell-> GetBasicManager();
- if ( pBasicMgr )
+ sal_uInt16 nId = pBasicMgr->GetLibId(sLibrary);
+ pBasicMgr->LoadLib(nId);
+ pBasic = pBasicMgr->GetLib(sLibrary);
+ }
+ if (!pBasic)
+ return false;
+
+ if (!sMod.isEmpty()) // we wish to find the macro is a specific module
+ {
+ SbModule* pModule = pBasic->FindModule(sMod);
+ if (!pModule)
+ return false;
+ SbMethod* pMeth = pModule->FindMethod(sMacro, SbxClassType::Method);
+
+ // Must be compiled before we can trust SbxFlagBits::Private
+ if (pMeth && bOnlyPublic && !pModule->IsCompiled())
+ pModule->Compile();
+
+ return pMeth && (!bOnlyPublic || !pMeth->IsSet(SbxFlagBits::Private));
+ }
+
+ for (auto const& rModuleRef : pBasic->GetModules())
+ {
+ SbMethod* pMeth = rModuleRef->FindMethod(sMacro, SbxClassType::Method);
+ if (pMeth)
{
- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
- if ( !pBasic )
- {
- sal_uInt16 nId = pBasicMgr->GetLibId( sLibrary );
- pBasicMgr->LoadLib( nId );
- pBasic = pBasicMgr->GetLib( sLibrary );
- }
- if ( pBasic )
+ if (rModuleRef->GetName() == sSkipModule)
+ continue;
+
+ if (bOnlyPublic)
{
- if ( !sMod.isEmpty() ) // we wish to find the macro is a specific module
- {
- SbModule* pModule = pBasic->FindModule( sMod );
- if ( pModule && pModule->FindMethod( sMacro, SbxClassType::Method ))
- {
- bFound = true;
- }
- }
- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxClassType::Method ) ) )
- {
- if( SbModule* pModule = pMethod->GetModule() )
- {
- // when searching for a macro without module name, do not search in class/document/form modules
- if( pModule->GetModuleType() == script::ModuleType::NORMAL )
- {
- sMod = pModule->GetName();
- bFound = true;
- }
- }
- }
+ if (!rModuleRef->IsCompiled())
+ rModuleRef->Compile();
+
+ if (pMeth->IsSet(SbxFlagBits::Private))
+ continue;
}
+ sMod = rModuleRef->GetName();
+ return true;
}
}
#endif
- return bFound;
+ return false;
}
#endif
@@ -246,7 +263,7 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString&
{
sProcedure = sMacro.copy( nMacroDot + 1 );
- sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
+ const sal_Int32 nContainerDot = sMacro.lastIndexOf('.', nMacroDot);
if ( nContainerDot != -1 )
{
sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
@@ -261,19 +278,23 @@ static void parseMacro( const OUString& sMacro, OUString& sContainer, OUString&
#endif
-OUString resolveVBAMacro( SfxObjectShell const * pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName )
+OUString resolveVBAMacro(SfxObjectShell const* pShell, const OUString& rLibName,
+ const OUString& rModuleName, const OUString& rMacroName,
+ bool bOnlyPublic, const OUString& sSkipModule)
{
#if !HAVE_FEATURE_SCRIPTING
(void) pShell;
(void) rLibName;
(void) rModuleName;
(void) rMacroName;
+ (void) bOnlyPublic;
+ (void) sSkipModule;
#else
if( pShell )
{
OUString aLibName = rLibName.isEmpty() ? getDefaultProjectName( pShell ) : rLibName ;
OUString aModuleName = rModuleName;
- if( hasMacro( pShell, aLibName, aModuleName, rMacroName ) )
+ if (hasMacro(pShell, aLibName, aModuleName, rMacroName, bOnlyPublic, sSkipModule))
return aLibName + "." + aModuleName + "." + rMacroName;
}
#endif
@@ -293,34 +314,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 +352,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
@@ -444,7 +465,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& Macro
for (auto const& search : sSearchList)
{
- aRes.mbFound = hasMacro( pShell, search, sModule, sProcedure );
+ aRes.mbFound = hasMacro(pShell, search, sModule, sProcedure, /*bOnlyPublic=*/false, "");
if ( aRes.mbFound )
{
sContainer = search;
@@ -556,7 +577,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();
@@ -624,95 +645,82 @@ static sal_uInt16 parseChar( sal_Unicode c )
return nVclKey;
}
-namespace {
+namespace
+{
-struct KeyCodeEntry
+constexpr frozen::unordered_map<std::u16string_view, sal_uInt16, 34> s_KeyCodes
{
- const char* sName;
- sal_uInt16 nCode;
+ { u"BACKSPACE", KEY_BACKSPACE },
+ { u"BS", KEY_BACKSPACE },
+ { u"DELETE", KEY_DELETE },
+ { u"DEL", KEY_DELETE },
+ { u"DOWN", KEY_DOWN },
+ { u"UP", KEY_UP },
+ { u"LEFT", KEY_LEFT },
+ { u"RIGHT", KEY_RIGHT },
+ { u"END", KEY_END },
+ { u"ESCAPE", KEY_ESCAPE },
+ { u"ESC", KEY_ESCAPE },
+ { u"HELP", KEY_HELP },
+ { u"HOME", KEY_HOME },
+ { u"PGDN", KEY_PAGEDOWN },
+ { u"PGUP", KEY_PAGEUP },
+ { u"INSERT", KEY_INSERT },
+ { u"SCROLLLOCK", KEY_SCROLLLOCK },
+ { u"NUMLOCK", KEY_NUMLOCK },
+ { u"TAB", KEY_TAB },
+ { u"F1", KEY_F1 },
+ { u"F2", KEY_F2 },
+ { u"F3", KEY_F3 },
+ { u"F4", KEY_F4 },
+ { u"F5", KEY_F5 },
+ { u"F6", KEY_F6 },
+ { u"F7", KEY_F7 },
+ { u"F8", KEY_F8 },
+ { u"F9", KEY_F9 },
+ { u"F10", KEY_F10 },
+ { u"F11", KEY_F11 },
+ { u"F12", KEY_F12 },
+ { u"F13", KEY_F13 },
+ { u"F14", KEY_F14 },
+ { u"F15", KEY_F15 }
};
-}
-
-KeyCodeEntry const aMSKeyCodesData[] = {
- { "BACKSPACE", KEY_BACKSPACE },
- { "BS", KEY_BACKSPACE },
- { "DELETE", KEY_DELETE },
- { "DEL", KEY_DELETE },
- { "DOWN", KEY_DOWN },
- { "UP", KEY_UP },
- { "LEFT", KEY_LEFT },
- { "RIGHT", KEY_RIGHT },
- { "END", KEY_END },
- { "ESCAPE", KEY_ESCAPE },
- { "ESC", KEY_ESCAPE },
- { "HELP", KEY_HELP },
- { "HOME", KEY_HOME },
- { "PGDN", KEY_PAGEDOWN },
- { "PGUP", KEY_PAGEUP },
- { "INSERT", KEY_INSERT },
- { "SCROLLLOCK", KEY_SCROLLLOCK },
- { "NUMLOCK", KEY_NUMLOCK },
- { "TAB", KEY_TAB },
- { "F1", KEY_F1 },
- { "F2", KEY_F2 },
- { "F3", KEY_F3 },
- { "F4", KEY_F4 },
- { "F5", KEY_F5 },
- { "F6", KEY_F6 },
- { "F7", KEY_F7 },
- { "F8", KEY_F8 },
- { "F9", KEY_F9 },
- { "F10", KEY_F10 },
- { "F11", KEY_F11 },
- { "F12", KEY_F12 },
- { "F13", KEY_F13 },
- { "F14", KEY_F14 },
- { "F15", KEY_F15 },
-};
+} // end anonymous namespace
-awt::KeyEvent parseKeyEvent( const OUString& Key )
+awt::KeyEvent parseKeyEvent( std::u16string_view Key )
{
- static std::map< OUString, sal_uInt16 > s_KeyCodes = []()
- {
- std::map< OUString, sal_uInt16 > tmp;
- for (KeyCodeEntry const & i : aMSKeyCodesData)
- {
- tmp[ OUString::createFromAscii( i.sName ) ] = i.nCode;
- }
- return tmp;
- }();
- OUString sKeyCode;
+ std::u16string_view sKeyCode;
sal_uInt16 nVclKey = 0;
// parse the modifier if any
- for ( int i=0; i<Key.getLength(); ++i )
+ for ( size_t i=0; i<Key.size(); ++i )
{
if ( ! getModifier( Key[ i ], nVclKey ) )
{
- sKeyCode = Key.copy( i );
+ sKeyCode = Key.substr( i );
break;
}
}
// check if keycode is surrounded by '{}', if so scoop out the contents
// else it should be just one char of ( 'a-z,A-Z,0-9' )
- if ( sKeyCode.getLength() == 1 ) // ( a single char )
+ if ( sKeyCode.size() == 1 ) // ( a single char )
{
nVclKey |= parseChar( sKeyCode[ 0 ] );
}
else // key should be enclosed in '{}'
{
- if ( sKeyCode.getLength() < 3 || sKeyCode[0] != '{' || sKeyCode[sKeyCode.getLength() - 1 ] != '}' )
+ if ( sKeyCode.size() < 3 || sKeyCode[0] != '{' || sKeyCode[sKeyCode.size() - 1 ] != '}' )
throw uno::RuntimeException();
- sKeyCode = sKeyCode.copy(1, sKeyCode.getLength() - 2 );
+ sKeyCode = sKeyCode.substr(1, sKeyCode.size() - 2 );
- if ( sKeyCode.getLength() == 1 )
+ if ( sKeyCode.size() == 1 )
nVclKey |= parseChar( sKeyCode[ 0 ] );
else
{
- auto it = s_KeyCodes.find( sKeyCode );
+ auto it = s_KeyCodes.find(sKeyCode);
if ( it == s_KeyCodes.end() ) // unknown or unsupported
throw uno::RuntimeException();
nVclKey |= it->second;
@@ -730,7 +738,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/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx
index e20a146c42d6..b5a06c929e7d 100644
--- a/filter/source/msfilter/rtfutil.cxx
+++ b/filter/source/msfilter/rtfutil.cxx
@@ -26,12 +26,12 @@ namespace
void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2,
const OString& rClassName)
{
- tools::SvRef<SotStorage> pStorage = new SotStorage(rOle2);
+ rtl::Reference<SotStorage> pStorage = new SotStorage(rOle2);
OString aAnsiUserType;
SvGlobalName aName;
if (rClassName == "PBrush")
{
- aAnsiUserType = "Bitmap Image";
+ aAnsiUserType = "Bitmap Image"_ostr;
aName = SvGlobalName(0x0003000A, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46);
}
else
@@ -40,13 +40,13 @@ void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2,
{
SAL_WARN("filter.ms", "WrapOle1InOle2: unexpected class name: '" << rClassName << "'");
}
- aAnsiUserType = "OLE Package";
+ aAnsiUserType = "OLE Package"_ostr;
aName = SvGlobalName(0x0003000C, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46);
}
pStorage->SetClass(aName, SotClipboardFormatId::NONE, "");
// [MS-OLEDS] 2.3.7 CompObjHeader
- tools::SvRef<SotStorageStream> pCompObj = pStorage->OpenSotStream("\1CompObj");
+ rtl::Reference<SotStorageStream> pCompObj = pStorage->OpenSotStream("\1CompObj");
// Reserved1
pCompObj->WriteUInt32(0xfffe0001);
// Version
@@ -80,7 +80,7 @@ void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2,
pCompObj.clear();
// [MS-OLEDS] 2.3.6 OLENativeStream
- tools::SvRef<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native");
+ rtl::Reference<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native");
// NativeDataSize
pOleNative->WriteUInt32(nOle1Size);
pOleNative->WriteStream(rOle1, nOle1Size);
@@ -180,20 +180,17 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS
{
if (*pUCMode != nLen)
{
- aBuf.append("\\uc");
- aBuf.append(nLen);
+ aBuf.append("\\uc" + OString::number(nLen));
// #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.
aBuf.append(' ');
*pUCMode = nLen;
}
- aBuf.append("\\u");
- aBuf.append(static_cast<sal_Int32>(c));
+ aBuf.append("\\u" + OString::number(static_cast<sal_Int32>(c)));
}
for (sal_Int32 nI = 0; nI < nLen; ++nI)
{
- aBuf.append("\\'");
- aBuf.append(OutHex(sConverted[nI], 2));
+ aBuf.append("\\'" + OutHex(sConverted[nI], 2));
}
}
}
@@ -213,28 +210,26 @@ OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc, bool* pS
return aBuf.makeStringAndClear();
}
-OString OutString(const OUString& rStr, rtl_TextEncoding eDestEnc, bool bUnicode)
+OString OutString(std::u16string_view rStr, rtl_TextEncoding eDestEnc, bool bUnicode)
{
- SAL_INFO("filter.ms", __func__ << ", rStr = '" << rStr << "'");
OStringBuffer aBuf;
int nUCMode = 1;
- for (sal_Int32 n = 0; n < rStr.getLength(); ++n)
+ for (size_t n = 0; n < rStr.size(); ++n)
aBuf.append(OutChar(rStr[n], &nUCMode, eDestEnc, nullptr, bUnicode));
if (nUCMode != 1)
{
- aBuf.append(OOO_STRING_SVTOOLS_RTF_UC);
- aBuf.append(sal_Int32(1));
aBuf.append(
- " "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.;
+ OOO_STRING_SVTOOLS_RTF_UC + OString::number(sal_Int32(1))
+ + " "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.;
}
return aBuf.makeStringAndClear();
}
/// Checks if lossless conversion of the string to eDestEnc is possible or not.
-static bool TryOutString(const OUString& rStr, rtl_TextEncoding eDestEnc)
+static bool TryOutString(std::u16string_view rStr, rtl_TextEncoding eDestEnc)
{
int nUCMode = 1;
- for (sal_Int32 n = 0; n < rStr.getLength(); ++n)
+ for (size_t n = 0; n < rStr.size(); ++n)
{
bool bRet;
OutChar(rStr[n], &nUCMode, eDestEnc, &bRet);
@@ -244,7 +239,7 @@ static bool TryOutString(const OUString& rStr, rtl_TextEncoding eDestEnc)
return true;
}
-OString OutStringUpr(const char* pToken, const OUString& rStr, rtl_TextEncoding eDestEnc)
+OString OutStringUpr(std::string_view pToken, std::u16string_view rStr, rtl_TextEncoding eDestEnc)
{
if (TryOutString(rStr, eDestEnc))
return OString::Concat("{") + pToken + " " + OutString(rStr, eDestEnc) + "}";
@@ -295,7 +290,7 @@ OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream, sa
if (++nBreak == nLimit)
{
if (pStream)
- pStream->WriteCharPtr(SAL_NEWLINE_STRING);
+ pStream->WriteOString(SAL_NEWLINE_STRING);
else
aRet.append(SAL_NEWLINE_STRING);
nBreak = 0;
@@ -360,12 +355,12 @@ bool ExtractOLE2FromObjdata(const OString& rObjdata, SvStream& rOle2)
sal_uInt64 nPos = aStream.Tell();
sal_uInt8 aSignature[8];
- aStream.ReadBytes(aSignature, SAL_N_ELEMENTS(aSignature));
+ aStream.ReadBytes(aSignature, std::size(aSignature));
aStream.Seek(nPos);
const sal_uInt8 aOle2Signature[8] = { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
// Don't use Storage::IsStorageFile() here, that would seek to the start of the stream,
// where the magic will always mismatch.
- if (std::memcmp(aSignature, aOle2Signature, SAL_N_ELEMENTS(aSignature)) == 0)
+ if (std::memcmp(aSignature, aOle2Signature, sizeof(aSignature)) == 0)
{
// NativeData
rOle2.WriteStream(aStream, nData);
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 5dee2e32e509..42b31c99af02 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -20,9 +20,10 @@
#include <sal/config.h>
#include <osl/endian.h>
+#include <utility>
#include <vcl/svapp.hxx>
#include <unotools/tempfile.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/UnitConversion.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/editdata.hxx>
@@ -52,6 +53,7 @@
#include <svx/svdopath.hxx>
#include <svx/svdotable.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xfilluseslidebackgrounditem.hxx>
#include <svx/xflbstit.hxx>
#include <svx/xflbmtit.hxx>
#include <svx/xflclit.hxx>
@@ -124,7 +126,6 @@
#include <algorithm>
#include <cassert>
-#include <utility>
#include <rtl/strbuf.hxx>
#include <tools/time.hxx>
#include <memory>
@@ -216,7 +217,7 @@ sal_uInt16 PptSlidePersistList::FindPage(sal_uInt32 nId) const
return PPTSLIDEPERSIST_ENTRY_NOTFOUND;
}
-SvStream& ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAtom )
+bool ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAtom )
{
rIn.ReadUInt32( rAtom.nSoundRef )
.ReadUInt32( rAtom.nExHyperlinkId )
@@ -228,7 +229,7 @@ SvStream& ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAt
.ReadUChar( rAtom.nUnknown1 )
.ReadUChar( rAtom.nUnknown2 )
.ReadUChar( rAtom.nUnknown3 );
- return rIn;
+ return rIn.good();
}
SvStream& ReadPptExOleObjAtom( SvStream& rIn, PptExOleObjAtom& rAtom )
@@ -482,7 +483,7 @@ void PptOEPlaceholderAtom::Clear()
SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom )
{
rIn.ReadUInt32( rAtom.nPlacementId );
- sal_uInt8 nTmp;
+ sal_uInt8 nTmp(0);
rIn.ReadUChar(nTmp);
rAtom.nPlaceholderId = static_cast<PptPlaceholder>(nTmp);
rIn.ReadUChar( rAtom.nPlaceholderSize );
@@ -494,7 +495,6 @@ PptSlidePersistEntry::PptSlidePersistEntry() :
nSlidePersistEndOffset ( 0 ),
nBackgroundOffset ( 0 ),
nDrawingDgId ( 0xffffffff ),
- pBObj ( nullptr ),
ePageKind ( PPT_MASTERPAGE ),
bNotesMaster ( false ),
bHandoutMaster ( false ),
@@ -729,13 +729,13 @@ void ProcessData::NotifyFreeObj(SdrObject* pObj)
The parameter pOriginalObj is the object as it was imported by our general escher import, it must either
be deleted or it can be returned to be inserted into the sdr page.
*/
-SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pOriginalObj )
+rtl::Reference<SdrObject> SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, SvxMSDffClientData& rClientData, tools::Rectangle& rTextRect, SdrObject* pOriginalObj )
{
if ( dynamic_cast<const SdrObjCustomShape* >(pOriginalObj) != nullptr )
pOriginalObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
// we are initializing our return value with the object that was imported by our escher import
- SdrObject* pRet = pOriginalObj;
+ rtl::Reference<SdrObject> pRet = pOriginalObj;
ProcessData& rData = static_cast<ProcessData&>(rClientData);
PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
@@ -780,7 +780,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
case PPT_PST_RecolorInfoAtom :
{
- if ( auto pSdrGrafObj = dynamic_cast<SdrGrafObj* >(pRet) )
+ if ( auto pSdrGrafObj = dynamic_cast<SdrGrafObj* >(pRet.get()) )
if ( pSdrGrafObj->HasGDIMetaFile() )
{
Graphic aGraphic( pSdrGrafObj->GetGraphic() );
@@ -801,7 +801,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
nPageNum--;
// replacing the object which we will return with a SdrPageObj
- SdrObject::Free( pRet );
pRet = new SdrPageObj(
*pSdrModel,
rObjData.aBoundRect,
@@ -848,11 +847,13 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
aTextObj.SetVertical( bVerticalText );
if ( pRet )
{
- bool bDeleteSource = aTextObj.GetOEPlaceHolderAtom() != nullptr;
- if ( bDeleteSource && dynamic_cast<const SdrGrafObj* >(pRet) == nullptr // we are not allowed to get
- && dynamic_cast<const SdrObjGroup* >(pRet) == nullptr // grouped placeholder objects
- && dynamic_cast<const SdrOle2Obj* >(pRet) == nullptr )
- SdrObject::Free( pRet );
+ bool bDeleteSource = aTextObj.GetOEPlaceHolderAtom().has_value();
+ if ( bDeleteSource && dynamic_cast<const SdrGrafObj* >(pRet.get()) == nullptr // we are not allowed to get
+ && dynamic_cast<const SdrObjGroup* >(pRet.get()) == nullptr // grouped placeholder objects
+ && dynamic_cast<const SdrOle2Obj* >(pRet.get()) == nullptr )
+ {
+ pRet = nullptr;
+ }
}
sal_uInt32 nTextFlags = aTextObj.GetTextFlags();
sal_Int32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 25 * 3600 ); // 0.25 cm (emu)
@@ -1049,11 +1050,11 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
eTextKind = SdrObjKind::Rectangle;
}
}
- SdrObject* pTObj = nullptr;
+ rtl::Reference<SdrObject> pTObj;
bool bWordWrap = GetPropertyValue(DFF_Prop_WrapText, mso_wrapSquare) != mso_wrapNone;
bool bFitShapeToText = ( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 2 ) != 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr && ( eTextKind == SdrObjKind::Rectangle ) )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pRet.get()) != nullptr && ( eTextKind == SdrObjKind::Rectangle ) )
{
bAutoGrowHeight = bFitShapeToText;
bAutoGrowWidth = !bWordWrap;
@@ -1062,9 +1063,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
}
else
{
- if ( dynamic_cast<const SdrObjCustomShape* >(pRet) != nullptr )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pRet.get()) != nullptr )
{
- SdrObject::Free( pRet );
pRet = nullptr;
}
pTObj = new SdrRectObj(
@@ -1103,7 +1103,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) );
}
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
{
pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
@@ -1119,12 +1119,12 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
if ( nMinFrameHeight < 0 )
nMinFrameHeight = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
if ( nMinFrameWidth < 0 )
nMinFrameWidth = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
// set margins at the borders of the textbox
@@ -1134,9 +1134,9 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr )
pTObj->SetSnapRect( rTextRect );
- pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
+ pTObj = ReadObjText( &aTextObj, pTObj.get(), rData.pPage );
if ( pTObj )
{
@@ -1146,9 +1146,9 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
snaprect of the object. Then we will use
ADJUST_CENTER instead of ADJUST_BLOCK.
*/
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr && !bFitShapeToText && !bWordWrap )
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj.get()) == nullptr && !bFitShapeToText && !bWordWrap )
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pTObj );
+ SdrTextObj* pText = DynCastSdrTextObj( pTObj.get() );
if ( pText )
{
if ( bVerticalText )
@@ -1179,7 +1179,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
Degree100 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way
nAngle += nTextRotationAngle;
- if ( dynamic_cast< const SdrObjCustomShape* >(pTObj) == nullptr )
+ if ( dynamic_cast< const SdrObjCustomShape* >(pTObj.get()) == nullptr )
{
if ( rObjData.nSpFlags & ShapeFlag::FlipV )
{
@@ -1192,13 +1192,13 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
}
if ( pRet )
{
- SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
- pGroup->GetSubList()->NbcInsertObject( pRet );
- pGroup->GetSubList()->NbcInsertObject( pTObj );
+ rtl::Reference<SdrObject> pGroup = new SdrObjGroup(*pSdrModel);
+ pGroup->GetSubList()->NbcInsertObject( pRet.get() );
+ pGroup->GetSubList()->NbcInsertObject( pTObj.get() );
pRet = pGroup;
}
else
- pRet = pTObj;
+ pRet = pTObj.get();
}
}
}
@@ -1254,11 +1254,11 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
for (auto & pPtr : rPersistEntry.xSolverContainer->aCList)
{
if ( rObjData.nShapeId == pPtr->nShapeC )
- pPtr->pCObj = pRet;
+ pPtr->pCObj = pRet.get();
else
{
- SdrObject* pConnectObj = pRet;
- if ( pOriginalObj && dynamic_cast< const SdrObjGroup* >(pRet) != nullptr )
+ SdrObject* pConnectObj = pRet.get();
+ if ( pOriginalObj && dynamic_cast< const SdrObjGroup* >(pRet.get()) != nullptr )
{ /* check if the original object from the escherimport is part of the group object,
if this is the case, we will use the original object to connect to */
SdrObjListIter aIter( *pRet, SdrIterMode::DeepWithGroups );
@@ -1295,13 +1295,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
maFidcls[ nSec ].dgid = rPersistEntry.nDrawingDgId; // insert the correct drawing id;
}
}
- if ( GetPropertyValue( DFF_Prop_fNoFillHitTest, 0 ) & 0x10 )
- {
- if (GetPropertyValue(DFF_Prop_fillType, mso_fillSolid) == mso_fillBackground)
- {
- rData.aBackgroundColoredObjects.push_back( pRet );
- }
- }
}
return pRet;
}
@@ -1678,7 +1671,7 @@ SdrPowerPointImport::~SdrPowerPointImport()
m_pNotePages.reset();
}
-bool PPTConvertOCXControls::ReadOCXStream( tools::SvRef<SotStorage>& rSrc,
+bool PPTConvertOCXControls::ReadOCXStream( rtl::Reference<SotStorage>& rSrc,
css::uno::Reference< css::drawing::XShape > *pShapeRef )
{
bool bRes = false;
@@ -1783,7 +1776,7 @@ void PPTConvertOCXControls::GetDrawPage()
static bool SdrPowerPointOLEDecompress( SvStream& rOutput, SvStream& rInput, sal_uInt32 nInputSize )
{
- sal_uInt32 nOldPos = rInput.Tell();
+ sal_uInt64 nOldPos = rInput.Tell();
std::unique_ptr<char[]> pBuf(new char[ nInputSize ]);
rInput.ReadBytes(pBuf.get(), nInputSize);
ZCodec aZCodec( 0x8000, 0x8000 );
@@ -1796,15 +1789,15 @@ static bool SdrPowerPointOLEDecompress( SvStream& rOutput, SvStream& rInput, sal
}
// #i32596# - add new parameter <_nCalledByGroup>
-SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
+rtl::Reference<SdrObject> SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
const Graphic& rGraf,
const tools::Rectangle& rBoundRect,
const tools::Rectangle& rVisArea,
const int /*_nCalledByGroup*/ ) const
{
- SdrObject* pRet = nullptr;
+ rtl::Reference<SdrObject> pRet;
- sal_uInt32 nOldPos = rStCtrl.Tell();
+ sal_uInt64 nOldPos = rStCtrl.Tell();
Graphic aGraphic( rGraf );
@@ -1847,138 +1840,129 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
rStCtrl.SeekRel( 4 );
- ::utl::TempFile aTmpFile;
- aTmpFile.EnableKillingFile();
-
- if ( aTmpFile.IsValid() )
+ ::utl::TempFileFast aTmpFile;
+ SvStream* pDest = aTmpFile.GetStream(StreamMode::READWRITE);
+ if (pDest)
{
- SvStream* pDest = aTmpFile.GetStream(StreamMode::TRUNC | StreamMode::WRITE);
- if (pDest)
- {
- bSuccess = SdrPowerPointOLEDecompress( *pDest, rStCtrl, nLen );
- }
- aTmpFile.CloseStream();
+ bSuccess = SdrPowerPointOLEDecompress( *pDest, rStCtrl, nLen );
}
if ( bSuccess )
{
- SvStream* pDest = aTmpFile.GetStream(StreamMode::READ);
- Storage* pObjStor = pDest ? new Storage( *pDest, true ) : nullptr;
- if (pObjStor)
+ pDest->Seek(0);
+ Storage* pObjStor = new Storage(*pDest, false);
+ rtl::Reference<SotStorage> xObjStor(new SotStorage(pObjStor));
+ if ( xObjStor.is() && !xObjStor->GetError() )
{
- tools::SvRef<SotStorage> xObjStor( new SotStorage( pObjStor ) );
- if ( xObjStor.is() && !xObjStor->GetError() )
+ if ( xObjStor->GetClassName() == SvGlobalName() )
{
- if ( xObjStor->GetClassName() == SvGlobalName() )
- {
- xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() );
+ xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() );
+ }
+ rtl::Reference<SotStorageStream> xSrcTst = xObjStor->OpenSotStream("\1Ole");
+ if ( xSrcTst.is() )
+ {
+ sal_uInt8 aTestA[ 10 ];
+ bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
+ if ( !bGetItAsOle )
+ { // maybe there is a contents stream in here
+ xSrcTst = xObjStor->OpenSotStream( "Contents", StreamMode::READWRITE | StreamMode::NOCREATE );
+ bGetItAsOle = (xSrcTst.is() &&
+ sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
}
- tools::SvRef<SotStorageStream> xSrcTst = xObjStor->OpenSotStream( "\1Ole" );
- if ( xSrcTst.is() )
+ if ( bGetItAsOle )
{
- sal_uInt8 aTestA[ 10 ];
- bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
- if ( !bGetItAsOle )
- { // maybe there is a contents stream in here
- xSrcTst = xObjStor->OpenSotStream( "Contents", StreamMode::READWRITE | StreamMode::NOCREATE );
- bGetItAsOle = (xSrcTst.is() &&
- sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)));
- }
- if ( bGetItAsOle )
+ OUString aNm;
+ // if ( nSvxMSDffOLEConvFlags )
{
- OUString aNm;
- // if ( nSvxMSDffOLEConvFlags )
+ uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
+ if( xObj.is() )
{
- uno::Reference < embed::XStorage > xDestStorage( rOe.pShell->GetStorage() );
- uno::Reference < embed::XEmbeddedObject > xObj =
- CheckForConvertToSOObj(nSvxMSDffOLEConvFlags, *xObjStor, xDestStorage, rGraf, rVisArea, maBaseURL);
- if( xObj.is() )
- {
- rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
+ rOe.pShell->getEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aNm );
- svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
- // TODO/LATER: need MediaType for Graphic
- aObj.SetGraphic( rGraf, OUString() );
- pRet = new SdrOle2Obj(
- *pSdrModel,
- aObj,
- aNm,
- rBoundRect);
- }
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( rGraf, OUString() );
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
- if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
- {
- uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
- PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, m_eCurrentPageKind );
- css::uno::Reference< css::drawing::XShape > xShape;
- if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
- pRet = SdrObject::getSdrObjectFromXShape(xShape);
+ }
+ if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
+ {
+ uno::Reference< frame::XModel > xModel( rOe.pShell->GetModel() );
+ PPTConvertOCXControls aPPTConvertOCXControls( this, xModel, m_eCurrentPageKind );
+ css::uno::Reference< css::drawing::XShape > xShape;
+ if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape ) )
+ pRet = SdrObject::getSdrObjectFromXShape(xShape);
- }
- if ( !pRet )
- {
- aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
+ }
+ if ( !pRet )
+ {
+ aNm = rOe.pShell->getEmbeddedObjectContainer().CreateUniqueObjectName();
- // object is not an own object
- const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
- if (rStorage.is())
+ // object is not an own object
+ const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage();
+ if (rStorage.is())
+ {
+ rtl::Reference<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
+ if (xObjStor.is() && xTarget.is())
{
- tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE);
- if (xObjStor.is() && xTarget.is())
- {
- xObjStor->CopyTo(xTarget.get());
- if (!xTarget->GetError())
- xTarget->Commit();
- }
- xTarget.clear();
+ xObjStor->CopyTo(xTarget.get());
+ if (!xTarget->GetError())
+ xTarget->Commit();
}
+ xTarget.clear();
+ }
- uno::Reference < embed::XEmbeddedObject > xObj =
- rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
- if ( xObj.is() )
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ rOe.pShell->getEmbeddedObjectContainer().GetEmbeddedObject( aNm );
+ if ( xObj.is() )
+ {
+ if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
{
- if ( rOe.nAspect != embed::Aspects::MSOLE_ICON )
+ //TODO/LATER: keep on hacking?!
+ // we don't want to be modified
+ //xInplaceObj->EnableSetModified( sal_False );
+ if ( rVisArea.IsEmpty() )
{
- //TODO/LATER: keep on hacking?!
- // we don't want to be modified
- //xInplaceObj->EnableSetModified( sal_False );
- if ( rVisArea.IsEmpty() )
- {
- MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
- Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
- aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
-
- awt::Size aSz;
- aSz.Width = aSize.Width();
- aSz.Height = aSize.Height();
- xObj->setVisualAreaSize( rOe.nAspect, aSz );
- }
- else
- {
- awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
- xObj->setVisualAreaSize( rOe.nAspect, aSize );
- }
- //xInplaceObj->EnableSetModified( sal_True );
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( rOe.nAspect ) );
+ Size aSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MapMode( aMapUnit ) ) );
+
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( rOe.nAspect, aSz );
+ }
+ else
+ {
+ awt::Size aSize( rVisArea.GetSize().Width(), rVisArea.GetSize().Height() );
+ xObj->setVisualAreaSize( rOe.nAspect, aSize );
}
+ //xInplaceObj->EnableSetModified( sal_True );
+ }
- svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
+ svt::EmbeddedObjectRef aObj( xObj, rOe.nAspect );
- // TODO/LATER: need MediaType for Graphic
- aObj.SetGraphic( aGraphic, OUString() );
+ // TODO/LATER: need MediaType for Graphic
+ aObj.SetGraphic( aGraphic, OUString() );
- pRet = new SdrOle2Obj(
- *pSdrModel,
- aObj,
- aNm,
- rBoundRect);
- }
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
}
}
}
}
- aTmpFile.CloseStream();
}
+ aTmpFile.CloseStream();
}
}
rStCtrl.Seek( nOldPos );
@@ -2024,7 +2008,7 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
DffRecordHeader* pHd;
- sal_uInt32 nOldPos = rStCtrl.Tell();
+ sal_uInt64 nOldPos = rStCtrl.Tell();
if ( nFilterOptions & 1 )
{
pHd = aDocRecManager.GetRecordHeader( PPT_PST_List );
@@ -2045,16 +2029,16 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
std::unique_ptr<SvMemoryStream> pBas = ImportExOleObjStg( nPersistPtr, nOleId );
if ( pBas )
{
- tools::SvRef<SotStorage> xSource( new SotStorage( pBas.release(), true ) );
- tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
+ rtl::Reference<SotStorage> xSource(new SotStorage(pBas.release(), true));
+ rtl::Reference<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
if ( xSource.is() && xDest.is() )
{
// is this a visual basic storage ?
- tools::SvRef<SotStorage> xSubStorage = xSource->OpenSotStorage( "VBA",
+ rtl::Reference<SotStorage> xSubStorage = xSource->OpenSotStorage( "VBA",
StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL );
if( xSubStorage.is() && ( ERRCODE_NONE == xSubStorage->GetError() ) )
{
- tools::SvRef<SotStorage> xMacros = xDest->OpenSotStorage( "MACROS" );
+ rtl::Reference<SotStorage> xMacros = xDest->OpenSotStorage( "MACROS" );
if ( xMacros.is() )
{
SvStorageInfoList aList;
@@ -2073,13 +2057,13 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt
uno::Reference < embed::XStorage > xDoc( pShell->GetStorage() );
if ( xDoc.is() )
{
- tools::SvRef<SotStorage> xVBA = SotStorage::OpenOLEStorage( xDoc, SvxImportMSVBasic::GetMSBasicStorageName() );
+ rtl::Reference<SotStorage> xVBA = SotStorage::OpenOLEStorage( xDoc, SvxImportMSVBasic::GetMSBasicStorageName() );
if ( xVBA.is() && ( xVBA->GetError() == ERRCODE_NONE ) )
{
- tools::SvRef<SotStorage> xSubVBA = xVBA->OpenSotStorage( "_MS_VBA_Overhead" );
+ rtl::Reference<SotStorage> xSubVBA = xVBA->OpenSotStorage( "_MS_VBA_Overhead" );
if ( xSubVBA.is() && ( xSubVBA->GetError() == ERRCODE_NONE ) )
{
- tools::SvRef<SotStorageStream> xOriginal = xSubVBA->OpenSotStream( "_MS_VBA_Overhead2" );
+ rtl::Reference<SotStorageStream> xOriginal = xSubVBA->OpenSotStream( "_MS_VBA_Overhead2" );
if ( xOriginal.is() && ( xOriginal->GetError() == ERRCODE_NONE ) )
{
if ( nPersistPtr && ( nPersistPtr < m_nPersistPtrCnt ) )
@@ -2236,7 +2220,7 @@ SdrOutliner* SdrPowerPointImport::GetDrawOutliner( SdrTextObj const * pSdrText )
SdrObject* SdrPowerPointImport::ReadObjText( PPTTextObj* pTextObj, SdrObject* pSdrObj, SdPageCapsule pPage ) const
{
- SdrTextObj* pText = dynamic_cast<SdrTextObj*>( pSdrObj );
+ SdrTextObj* pText = DynCastSdrTextObj( pSdrObj );
if ( pText )
{
if ( !ApplyTextObj( pTextObj, pText, pPage, nullptr, nullptr ) )
@@ -2358,6 +2342,8 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj*
pPara->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance );
if ( !nIsBullet2 )
aParagraphAttribs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, false ) );
+ else
+ aParagraphAttribs.Put( SfxInt16Item(EE_PARA_OUTLLEVEL, pPara->mxParaSet->mnDepth));
if ( !aSelection.nStartPos ) // in PPT empty paragraphs never gets a bullet
{
@@ -2400,7 +2386,7 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream&
const DffRecordHeader& rSourceHd, DffRecordHeader& rContentHd )
{
bool bRetValue = false;
- sal_uInt32 nOldPos = rSt.Tell();
+ sal_uInt64 nOldPos = rSt.Tell();
DffRecordHeader aProgTagsHd, aProgTagBinaryDataHd;
rSourceHd.SeekToContent( rSt );
@@ -2636,7 +2622,7 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, SvxMSDffClientData* pClien
nCurrent = pCList->nCurrent;
if ( const_cast<SdrPowerPointImport*>(this)->maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
{
- sal_uInt32 nStreamPos = rSt.Tell();
+ sal_uInt64 nStreamPos = rSt.Tell();
PPTTextObj aTextObj( rSt, const_cast<SdrPowerPointImport&>(*this), rPersistEntry, nullptr );
if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
{
@@ -2763,7 +2749,7 @@ static void ImportComment10( SvxMSDffManager const & rMan, SvStream& rStCtrl, Sd
// be sure not to import masterpages with this method
void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* pMasterPersist )
{
- sal_uInt32 nOldPos = rStCtrl.Tell();
+ sal_uInt64 nOldPos = rStCtrl.Tell();
PptSlidePersistList* pList = GetPageList( m_eCurrentPageKind );
if ( ( !pList ) || ( pList->size() <= m_nCurrentPageNum ) )
return;
@@ -2810,7 +2796,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
DffRecordHeader aPPDrawHd;
if ( SeekToRec( rStCtrl, DFF_msofbtDgContainer, aHd.GetRecEndFilePos(), &aPPDrawHd ) )
{
- sal_uInt32 nPPDrawOfs = rStCtrl.Tell();
+ sal_uInt64 nPPDrawOfs = rStCtrl.Tell();
// importing the background object before importing the page
auto nPPEndRecPos = SanitizeEndPos(rStCtrl, aPPDrawHd.GetRecEndFilePos());
@@ -2847,7 +2833,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
if ( pE->nBackgroundOffset )
{
// do not follow master colorscheme?
- sal_uInt32 nPos = rStCtrl.Tell();
+ sal_uInt64 nPos = rStCtrl.Tell();
rStCtrl.Seek( pE->nBackgroundOffset );
rSlidePersist.pBObj = ImportObj( rStCtrl, aProcessData, aPageSize, aPageSize, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
rStCtrl.Seek( nPos );
@@ -2906,16 +2892,16 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
aShapeHd.SeekToBegOfRecord( rStCtrl );
sal_Int32 nShapeId;
aProcessData.pTableRowProperties.reset();
- SdrObject* pObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, 0, &nShapeId );
+ rtl::Reference<SdrObject> pObj = ImportObj( rStCtrl, aProcessData, aEmpty, aEmpty, 0, &nShapeId );
if ( pObj )
{
if ( aProcessData.pTableRowProperties )
- pObj = CreateTable(pObj, aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.xSolverContainer.get(), aProcessData.aBackgroundColoredObjects);
+ pObj = CreateTable(pObj.get(), aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.xSolverContainer.get());
- pRet->NbcInsertObject( pObj );
+ pRet->NbcInsertObject( pObj.get() );
if( nShapeId )
- insertShapeId( nShapeId, pObj );
+ insertShapeId( nShapeId, pObj.get() );
}
}
bool bSuccess = aShapeHd.SeekToEndOfRecord(rStCtrl);
@@ -2932,27 +2918,6 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
break;
}
- // Handle shapes where the fill matches the background
- // fill (mso_fillBackground).
- if (rSlidePersist.ePageKind == PPT_SLIDEPAGE)
- {
- if (!aProcessData.aBackgroundColoredObjects.empty())
- {
- if (!rSlidePersist.pBObj)
- {
- for (auto pObject : aProcessData.aBackgroundColoredObjects)
- {
- // The shape wants a background, but the slide doesn't have
- // one: default to white.
- SfxItemSet aNewSet(*pObject->GetMergedItemSet().GetPool());
- aNewSet.Put(XFillStyleItem(css::drawing::FillStyle_SOLID));
- aNewSet.Put(XFillColorItem(OUString(), COL_WHITE));
- pObject->SetMergedItemSet(aNewSet);
- }
- }
- }
- }
-
if ( rSlidePersist.pBObj )
{
// #i99386# transfer the attributes from the temporary BackgroundObject
@@ -2964,15 +2929,15 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
for (auto & pPtr : rSlidePersist.xSolverContainer->aCList)
{
// check connections to the group object
- if (pPtr->pAObj == rSlidePersist.pBObj)
+ if (pPtr->pAObj == rSlidePersist.pBObj.get())
pPtr->pAObj = nullptr;
- if (pPtr->pBObj == rSlidePersist.pBObj)
+ if (pPtr->pBObj == rSlidePersist.pBObj.get())
pPtr->pBObj = nullptr;
- if (pPtr->pCObj == rSlidePersist.pBObj)
+ if (pPtr->pCObj == rSlidePersist.pBObj.get())
pPtr->pCObj = nullptr;
}
}
- SdrObject::Free(rSlidePersist.pBObj);
+ rSlidePersist.pBObj.clear();
}
}
}
@@ -3046,9 +3011,9 @@ sal_uInt16 SdrPowerPointImport::GetMasterPageIndex( sal_uInt16 nPageNum, PptPage
return nIdx;
}
-SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage, sal_uInt32& nBgFileOffset )
+rtl::Reference<SdrObject> SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage, sal_uInt32& nBgFileOffset )
{
- SdrObject* pRet = nullptr;
+ rtl::Reference<SdrObject> pRet;
std::optional<SfxItemSet> pSet;
sal_uInt64 nOldFPos = rStCtrl.Tell(); // remember FilePos for restoring it later
DffRecordHeader aPageHd;
@@ -3188,9 +3153,9 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader const & rHd,
}
}
-PPTBuGraEntry::PPTBuGraEntry( Graphic const & rGraphic, sal_uInt32 nInst ) :
+PPTBuGraEntry::PPTBuGraEntry( Graphic aGraphic, sal_uInt32 nInst ) :
nInstance ( nInst ),
- aBuGra ( rGraphic ) {}
+ aBuGra (std::move( aGraphic )) {}
PPTExtParaLevel::PPTExtParaLevel()
: mnExtParagraphMask( 0 )
@@ -3251,7 +3216,7 @@ bool PPTExtParaProv::GetGraphic( sal_uInt32 nInstance, Graphic& rGraph ) const
PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const DffRecordHeader* pHd ) :
bStyles ( false )
{
- sal_uInt32 nOldPos = rSt.Tell();
+ sal_uInt64 nOldPos = rSt.Tell();
// here we have to get the graphical bullets...
@@ -3284,7 +3249,7 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
if ( SvxMSDffManager::GetBLIPDirect( rSt, aGraphic ) )
{
sal_uInt32 nInstance = aBuGraAtomHd.nRecInstance;
- PPTBuGraEntry* pBuGra = new PPTBuGraEntry( aGraphic, nInstance );
+ PPTBuGraEntry* pBuGra = new PPTBuGraEntry( std::move(aGraphic), nInstance );
size_t n = 0;
size_t nBuGraCount = aBuGraList.size();
if ( nBuGraCount )
@@ -3492,83 +3457,79 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 0 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 1 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 2 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
- rNumberFormat.SetSuffix( ")" );
+ rNumberFormat.SetListFormat("", ")", nLevel);
}
break;
case 3 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 4 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
- rNumberFormat.SetSuffix( ")" );
- rNumberFormat.SetPrefix( "(" );
+ rNumberFormat.SetListFormat("(", ")", nLevel);
}
break;
case 5 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
- rNumberFormat.SetSuffix( ")" );
+ rNumberFormat.SetListFormat("", ")", nLevel);
}
break;
case 6 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_LOWER );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 7 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 8 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
- rNumberFormat.SetSuffix( ")" );
- rNumberFormat.SetPrefix( "(" );
+ rNumberFormat.SetListFormat("(", ")", nLevel);
}
break;
case 9 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_LOWER_LETTER );
- rNumberFormat.SetSuffix( ")" );
+ rNumberFormat.SetListFormat("", ")", nLevel);
}
break;
case 10 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
- rNumberFormat.SetSuffix( ")" );
- rNumberFormat.SetPrefix( "(" );
+ rNumberFormat.SetListFormat("(", ")", nLevel);
}
break;
case 11 :
{
rNumberFormat.SetNumberingType( SVX_NUM_CHARS_UPPER_LETTER );
- rNumberFormat.SetSuffix( ")" );
+ rNumberFormat.SetListFormat("", ")", nLevel);
}
break;
case 12 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ARABIC );
- rNumberFormat.SetSuffix( ")" );
- rNumberFormat.SetPrefix( "(" );
+ rNumberFormat.SetListFormat("(", ")", nLevel);
}
break;
case 13 :
@@ -3579,14 +3540,13 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 14 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
- rNumberFormat.SetSuffix( ")" );
- rNumberFormat.SetPrefix( "(" );
+ rNumberFormat.SetListFormat("(", ")", nLevel);
}
break;
case 15 :
{
rNumberFormat.SetNumberingType( SVX_NUM_ROMAN_UPPER );
- rNumberFormat.SetSuffix( ")" );
+ rNumberFormat.SetListFormat("", ")", nLevel);
}
break;
case 16: // Simplified Chinese.
@@ -3597,7 +3557,7 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 17: // Simplified Chinese with single-byte period.
{
rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 18: // Double byte circle numbers.
@@ -3615,13 +3575,13 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 22: // Traditional Chinese with single-byte period.
{
rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH_TW );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 25: // Bidi Hebrew 2 with ANSI minus symbol.
{
rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_HEBREW );
- rNumberFormat.SetSuffix( "-" );
+ rNumberFormat.SetListFormat("", "-", nLevel);
}
break;
case 26: // Japanese/Korean.
@@ -3632,7 +3592,7 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 27: // Japanese/Korean with single-byte period.
{
rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH );
- rNumberFormat.SetSuffix( "." );
+ rNumberFormat.SetListFormat("", ".", nLevel);
}
break;
case 28: // Double-byte Arabic numbers.
@@ -3643,13 +3603,13 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport const &
case 29: // Double-byte Arabic numbers with double-byte period.
{
rNumberFormat.SetNumberingType( SVX_NUM_FULL_WIDTH_ARABIC );
- rNumberFormat.SetSuffix( OUString( u'\xff0e' ) );
+ rNumberFormat.SetListFormat("", OUString(u'\xff0e'), nLevel);
}
break;
case 38: // Japanese with double-byte period.
{
rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH ); // No such type. Instead with Lower Chinese Number
- rNumberFormat.SetSuffix( OUString( u'\xff0e' ) );
+ rNumberFormat.SetListFormat("", OUString(u'\xff0e'), nLevel);
}
break;
}
@@ -4112,7 +4072,7 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
PPTNumberFormatCreator ( std::make_unique<PPTExtParaProv>( rManager, rIn, &rSlideHd ) ),
maTxSI ( rTextSpecInfo )
{
- sal_uInt32 nOldFilePos = rIn.Tell();
+ sal_uInt64 nOldFilePos = rIn.Tell();
// default stylesheets
mpCharSheet[ TSS_Type::PageTitle ] = std::make_unique<PPTCharSheet>( TSS_Type::PageTitle );
@@ -4583,7 +4543,7 @@ PPTTextRulerInterpreter::PPTTextRulerInterpreter( sal_uInt32 nFileOfs, DffRecord
if ( nFileOfs == 0xffffffff )
return;
- sal_uInt32 nOldPos = rIn.Tell();
+ sal_uInt64 nOldPos = rIn.Tell();
DffRecordHeader rHd;
if ( nFileOfs )
{
@@ -4764,11 +4724,6 @@ bool PPTTextParagraphStyleAtomInterpreter::Read( SvStream& rIn, const DffRecordH
return bValid;
}
-PPTTextParagraphStyleAtomInterpreter::~PPTTextParagraphStyleAtomInterpreter()
-{
-
-}
-
PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) :
nCharIdx ( _nCharIdx ),
nDontKnow ( 1 )
@@ -5133,22 +5088,21 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, const DffRecordHeader
}
}
-void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const OUString& aString,
+void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, std::u16string_view aString,
sal_uInt32& nCharCount, sal_uInt32 nCharReadCnt,
bool& bTextPropAtom, sal_uInt32 nExtParaPos,
const std::vector< StyleTextProp9 >& aStyleTextProp9,
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.size();
+ 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 +5115,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 +5149,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;
@@ -5224,7 +5179,7 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar
void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHeader,
PPTTextRulerInterpreter const & rRuler, const DffRecordHeader& rExtParaHd, TSS_Type nInstance )
{
- sal_uInt32 nOldPos = rIn.Tell();
+ sal_uInt64 nOldPos = rIn.Tell();
sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0;
std::vector< StyleTextProp9 > aStyleTextProp9;
@@ -5699,7 +5654,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
if ( aSize.Height() > 64 )
aSize.setHeight( 64 );
- Bitmap::ScopedReadAccess pAcc(aBmp);
+ BitmapScopedReadAccess pAcc(aBmp);
if( pAcc )
{
sal_uLong nRt = 0, nGn = 0, nBl = 0;
@@ -5748,27 +5703,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 = Color(pGradientItem->GetGradientValue().GetColorStops().front().getStopColor());
}
break;
case drawing::FillStyle_HATCH :
@@ -6232,22 +6184,16 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, std::optional< sal_Int16 >& rS
GetAttrib(PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance);
GetAttrib(PPT_ParaAttr_TextOfs, _nTextOfs, nDestinationInstance);
GetAttrib(PPT_ParaAttr_BulletOfs, _nBulletOfs, nDestinationInstance);
+ SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
if ( !nIsBullet2 )
{
- SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
auto const nAbsLSpace = convertMasterUnitToMm100(_nTextOfs);
auto const nFirstLineOffset = nAbsLSpace - convertMasterUnitToMm100(_nBulletOfs);
- aLRSpaceItem.SetLeft( nAbsLSpace );
aLRSpaceItem.SetTextFirstLineOffsetValue( -nFirstLineOffset );
- rSet.Put( aLRSpaceItem );
- }
- else
- {
- SvxLRSpaceItem aLRSpaceItem( EE_PARA_LRSPACE );
- aLRSpaceItem.SetLeft( 0 );
- aLRSpaceItem.SetTextFirstLineOffsetValue( 0 );
- rSet.Put( aLRSpaceItem );
+ aLRSpaceItem.SetTextLeft( nAbsLSpace );
}
+ rSet.Put( aLRSpaceItem );
+
if ( GetAttrib( PPT_ParaAttr_Adjust, nVal, nDestinationInstance ) )
{
if ( nVal <= 3 )
@@ -6497,13 +6443,13 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
// ClientData
if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
{
- sal_uInt32 nOldPos = rIn.Tell();
+ sal_uInt64 nOldPos = rIn.Tell();
DffRecordHeader& aClientDataContainerHd = *rSdrPowerPointImport.maShapeRecords.Current();
DffRecordHeader aPlaceHolderAtomHd;
if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_OEPlaceholderAtom, aClientDataContainerHd.GetRecEndFilePos(), &aPlaceHolderAtomHd ) )
{
- mxImplTextObj->mpPlaceHolderAtom.reset( new PptOEPlaceholderAtom );
- ReadPptOEPlaceholderAtom( rIn, *( mxImplTextObj->mpPlaceHolderAtom ) );
+ mxImplTextObj->moPlaceHolderAtom.emplace();
+ ReadPptOEPlaceholderAtom( rIn, *( mxImplTextObj->moPlaceHolderAtom ) );
}
rIn.Seek( nOldPos );
DffRecordHeader aProgTagHd;
@@ -6540,15 +6486,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 :
@@ -6563,7 +6504,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
if ( !aExtParaHd.nRecType )
{
- sal_uInt32 nOldPos = rIn.Tell();
+ sal_uInt64 nOldPos = rIn.Tell();
// try to locate the referenced ExtendedParaHd
DffRecordHeader* pHd = pExtParaProv->
aExtendedPresRules.GetRecordHeader( PPT_PST_ExtendedParagraphHeaderAtom,
@@ -6668,7 +6609,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
aTextHd.SeekToEndOfRecord( rIn );
mxImplTextObj->mnInstance = nInstance;
- sal_uInt32 nFilePos = rIn.Tell();
+ sal_uInt64 nFilePos = rIn.Tell();
if ( !(rSdrPowerPointImport.SeekToRec2( PPT_PST_TextBytesAtom,
PPT_PST_TextCharsAtom,
aClientTextBoxHd.GetRecEndFilePos() )
@@ -6685,7 +6626,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if ( !nParagraphs )
return;
- // the language settings will be merged into the list of PPTCharPropSet
+ // the languages and locales will be merged into the list of PPTCharPropSet
DffRecordHeader aTextSpecInfoHd;
PPTTextSpecInfoAtomInterpreter aTextSpecInfoAtomInterpreter;
if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_TextSpecInfoAtom,
@@ -7415,25 +7356,25 @@ 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 :
{
eFS = css::drawing::FillStyle_GRADIENT;
- XGradient aXGradient(pObj->GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue());
+ basegfx::BGradient aBGradient(pObj->GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue());
css::awt::Gradient aGradient;
- aGradient.Style = aXGradient.GetGradientStyle();
- aGradient.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor());
- aGradient.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor());
- aGradient.Angle = static_cast<short>(aXGradient.GetAngle());
- aGradient.Border = aXGradient.GetBorder();
- aGradient.XOffset = aXGradient.GetXOffset();
- aGradient.YOffset = aXGradient.GetYOffset();
- aGradient.StartIntensity = aXGradient.GetStartIntens();
- aGradient.EndIntensity = aXGradient.GetEndIntens();
- aGradient.StepCount = aXGradient.GetSteps();
+ aGradient.Style = aBGradient.GetGradientStyle();
+ aGradient.StartColor = static_cast<sal_Int32>(Color(aBGradient.GetColorStops().front().getStopColor()));
+ aGradient.EndColor = static_cast<sal_Int32>(Color(aBGradient.GetColorStops().back().getStopColor()));
+ aGradient.Angle = static_cast<short>(aBGradient.GetAngle());
+ aGradient.Border = aBGradient.GetBorder();
+ aGradient.XOffset = aBGradient.GetXOffset();
+ aGradient.YOffset = aBGradient.GetYOffset();
+ aGradient.StartIntensity = aBGradient.GetStartIntens();
+ aGradient.EndIntensity = aBGradient.GetEndIntens();
+ aGradient.StepCount = aBGradient.GetSteps();
xPropSet->setPropertyValue( "FillGradient", Any( aGradient ) );
}
@@ -7448,16 +7389,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:
@@ -7533,9 +7474,11 @@ static void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >
}
}
-SdrObject* SdrPowerPointImport::CreateTable(SdrObject* pGroup, const sal_uInt32* pTableArry, SvxMSDffSolverContainer* pSolverContainer, std::vector<SdrObject*>& rBackgroundColoredObjects)
+rtl::Reference<SdrObject> SdrPowerPointImport::CreateTable(
+ SdrObject* pGroup, const sal_uInt32* pTableArry,
+ SvxMSDffSolverContainer* pSolverContainer)
{
- SdrObject* pRet = pGroup;
+ rtl::Reference<SdrObject> pRet = pGroup;
sal_uInt32 nRows = pTableArry[ 1 ];
if (!nRows)
@@ -7567,7 +7510,7 @@ SdrObject* SdrPowerPointImport::CreateTable(SdrObject* pGroup, const sal_uInt32*
if (aRows.empty())
return pRet;
- sdr::table::SdrTableObj* pTable = new sdr::table::SdrTableObj(*pSdrModel);
+ rtl::Reference<sdr::table::SdrTableObj> pTable = new sdr::table::SdrTableObj(*pSdrModel);
pTable->uno_lock();
Reference< XTable > xTable( pTable->getTable() );
@@ -7672,9 +7615,9 @@ SdrObject* SdrPowerPointImport::CreateTable(SdrObject* pGroup, const sal_uInt32*
//table when export by us. We should process this
//situation when importing.
if ( pPtr->pAObj == pGroup )
- pPtr->pAObj = pTable;
+ pPtr->pAObj = pTable.get();
if ( pPtr->pBObj == pGroup )
- pPtr->pBObj = pTable;
+ pPtr->pBObj = pTable.get();
}
}
pTable->uno_unlock();
@@ -7687,17 +7630,12 @@ SdrObject* SdrPowerPointImport::CreateTable(SdrObject* pGroup, const sal_uInt32*
{
SdrObject* pPartObj = aIter.Next();
removeShapeId(pPartObj);
- // ofz#41510 make sure rBackgroundColoredObjects doesn't contain deleted objects
- std::replace(rBackgroundColoredObjects.begin(), rBackgroundColoredObjects.end(), pPartObj, pRet);
}
-
- SdrObject::Free( pGroup );
}
catch( const Exception& )
{
pTable->uno_unlock();
- SdrObject* pObj = pTable;
- SdrObject::Free( pObj );
+ pTable = nullptr;
}
return pRet;
diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx
index 8a4ce43f1914..71ac50fd3928 100644
--- a/filter/source/msfilter/svxmsbas2.cxx
+++ b/filter/source/msfilter/svxmsbas2.cxx
@@ -33,7 +33,7 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
ErrCode nRet = ERRCODE_NONE;
uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
OUString aDstStgName( GetMSBasicStorageName() );
- tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName,
+ rtl::Reference<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName,
StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL ) );
if( xVBAStg.is() && !xVBAStg->GetError() )
{
@@ -45,8 +45,8 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
if( pBasicMan && pBasicMan->IsBasicModified() )
nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE;
#endif
- tools::SvRef<SotStorage> xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::STD_READ );
- tools::SvRef<SotStorage> xDst = xRoot->OpenSotStorage( rStorageName, StreamMode::READWRITE | StreamMode::TRUNC );
+ rtl::Reference<SotStorage> xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::STD_READ );
+ rtl::Reference<SotStorage> xDst = xRoot->OpenSotStorage( rStorageName, StreamMode::READWRITE | StreamMode::TRUNC );
xSrc->CopyTo( xDst.get() );
xDst->Commit();
ErrCode nError = xDst->GetError();
@@ -65,7 +65,7 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto,
ErrCode SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocSh)
{
uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() );
- tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(),
+ rtl::Reference<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(),
StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL ));
return ( xVBAStg.is() && !xVBAStg->GetError() )
? ERRCODE_SVX_VBASIC_STORAGE_EXIST
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 23b4de1e87be..2ac3536af9b1 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -10,11 +10,15 @@
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <rtl/ustring.hxx>
+#include <rtl/character.hxx>
+#include <comphelper/string.hxx>
#include <unotools/fontcvt.hxx>
#include <unotools/fontdefs.hxx>
+#include <utility>
#include <vcl/BitmapPalette.hxx>
#include <filter/msfilter/escherex.hxx>
#include <filter/msfilter/util.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <unordered_map>
@@ -275,7 +279,7 @@ sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const css::awt::Size& rSize )
sal_Int32 nPaperSizeIndex = 0; // Undefined
const ApiPaperSize* pItem = spPaperSizeTable;
- const ApiPaperSize* pEnd = spPaperSizeTable + SAL_N_ELEMENTS( spPaperSizeTable );
+ const ApiPaperSize* pEnd = spPaperSizeTable + std::size( spPaperSizeTable );
for ( ; pItem != pEnd; ++pItem )
{
sal_Int32 nCurDeltaHeight = std::abs( pItem->mnHeight - rSize.Height );
@@ -303,32 +307,49 @@ sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const css::awt::Size& rSize )
const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex )
{
- if ( nMSOPaperIndex < 0 || nMSOPaperIndex > sal_Int32(SAL_N_ELEMENTS( spPaperSizeTable )) - 1 )
+ if ( nMSOPaperIndex < 0 || nMSOPaperIndex > std::ssize( spPaperSizeTable ) - 1 )
return spPaperSizeTable[ 0 ];
return spPaperSizeTable[ nMSOPaperIndex ];
}
-OUString findQuotedText( const OUString& rCommand,
- const char* cStartQuote, const sal_Unicode uEndQuote )
+OUString CreateDOCXStyleId(std::u16string_view const aName)
{
- OUString sRet;
- OUString sStartQuote( OUString::createFromAscii(cStartQuote) );
- sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote );
- if( nStartIndex >= 0 )
+ OUStringBuffer aStyleIdBuf(aName.size());
+ for (size_t i = 0; i < aName.size(); ++i)
{
- sal_Int32 nStartLength = sStartQuote.getLength();
- sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength);
- if( nEndIndex > nStartIndex )
+ sal_Unicode nChar = aName[i];
+ if (rtl::isAsciiAlphanumeric(nChar) || nChar == '-')
{
- sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
+ // first letter should be uppercase
+ if (aStyleIdBuf.isEmpty())
+ aStyleIdBuf.append(char(rtl::toAsciiUpperCase(nChar)));
+ else
+ aStyleIdBuf.append(char(nChar));
+ }
+ }
+ return aStyleIdBuf.makeStringAndClear();
+}
+
+std::u16string_view findQuotedText( std::u16string_view rCommand,
+ std::u16string_view sStartQuote, const sal_Unicode uEndQuote )
+{
+ std::u16string_view sRet;
+ size_t nStartIndex = rCommand.find( sStartQuote );
+ if( nStartIndex != std::u16string_view::npos )
+ {
+ sal_Int32 nStartLength = sStartQuote.size();
+ size_t nEndIndex = rCommand.find( uEndQuote, nStartIndex + nStartLength);
+ if( nEndIndex != std::u16string_view::npos && nEndIndex > nStartIndex )
+ {
+ sRet = rCommand.substr( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
}
}
return sRet;
}
-WW8ReadFieldParams::WW8ReadFieldParams( const OUString& _rData )
- : aData( _rData )
+WW8ReadFieldParams::WW8ReadFieldParams( OUString _aData )
+ : aData(std::move( _aData ))
, nFnd( 0 )
, nNext( 0 )
, nSavPtr( 0 )
@@ -484,11 +505,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 +622,616 @@ EquationResult ParseCombinedChars(const OUString& rStr)
return aResult;
}
-namespace {
-
-struct CustomShapeTypeTranslationTable
+OString GetOOXMLPresetGeometry( std::u16string_view rShapeType )
{
- const char* sOOo;
- const char* sMSO;
-};
-
+ 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"_ostr : i->second;
}
-const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] =
+MSO_SPT GETVMLShapeType(std::u16string_view aType)
{
- // { "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));
- return i == aCustomShapeTypeTranslationHashMap.end() ? "rect" : i->second;
-}
-
-MSO_SPT GETVMLShapeType(const OString& 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/msfilter/viscache.hxx b/filter/source/msfilter/viscache.hxx
index 5111969b3f9e..524510583190 100644
--- a/filter/source/msfilter/viscache.hxx
+++ b/filter/source/msfilter/viscache.hxx
@@ -44,7 +44,7 @@ public:
pMtf.reset( new GDIMetaFile( rMtf ) );
}
void SetAspect( sal_uInt16 nAsp ) { nAspect = nAsp; }
- void SetAdviseFlags( sal_uLong nAdv ) { nAdvFlags = nAdv; }
+ void SetAdviseFlags( sal_uInt32 nAdv ) { nAdvFlags = nAdv; }
void SetSize( const Size & rSize ) { aSize = rSize; }
void Write( SvStream & rStm );
};
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index 4d60054317c0..755f14ec6be2 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -35,16 +35,14 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::cppu;
-using namespace ::osl;
using namespace ::sax;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::xml;
using namespace ::com::sun::star::xml::sax;
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index c1a3c94d5a85..c4e133297e95 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -24,11 +24,13 @@
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <sfx2/passwd.hxx>
-#include <unotools/resmgr.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sfx2/objsh.hxx>
-#include <svx/AccessibilityCheckDialog.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <comphelper/lok.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/storagehelper.hxx>
@@ -42,11 +44,6 @@
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-static OUString PDFFilterResId(TranslateId aId)
-{
- return Translate::get(aId, Translate::Create("flt"));
-}
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -58,7 +55,6 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
const Reference< XComponent >& rxDoc)
: SfxTabDialogController(pParent, "filter/ui/pdfoptionsdialog.ui", "PdfOptionsDialog"),
mrDoc(rxDoc),
- mpParent(pParent),
maConfigItem( u"Office.Common/Filter/PDF/Export/", &rFilterData ),
maConfigI18N( u"Office.Common/I18N/CTL/" ),
mbIsPresentation( false ),
@@ -74,6 +70,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbUseTaggedPDF( false ),
mbUseTaggedPDFUserSelection( false ),
mbExportNotes( true ),
+ mbExportNotesInMargin( false ),
mbViewPDF( false ),
mbUseReferenceXObject( false ),
mbExportNotesPages( false ),
@@ -98,7 +95,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbOpenInFullScreenMode( false ),
mbDisplayPDFDocumentTitle( false ),
mnMagnification( 0 ),
- mnInitialView( 0 ),
+ mnInitialView( 1 ),
mnZoom( 0 ),
mnInitialPage( 1 ),
mnPageLayout( 0 ),
@@ -111,8 +108,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbCanCopyOrExtract( false ),
mbCanExtractForAccessibility( true ),
- mbIsRangeChecked( false ),
+ mbIsPageRangeChecked( false ),
msPageRange( ' ' ),
+ mbIsSheetRangeChecked( false ),
+ msSheetRange( ' ' ),
mbSelectionIsChecked( false ),
mbExportRelativeFsysLinks( false ),
@@ -198,9 +197,12 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbExportOnlyNotesPages = maConfigItem.ReadBool( "ExportOnlyNotesPages", false );
}
mbExportNotes = maConfigItem.ReadBool( "ExportNotes", false );
+ if (mbIsWriter)
+ mbExportNotesInMargin = maConfigItem.ReadBool( "ExportNotesInMargin", false );
mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false );
mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", true );
+ mbExportBookmarksUserSelection = mbExportBookmarks;
if ( mbIsPresentation )
mbExportHiddenSlides = maConfigItem.ReadBool( "ExportHiddenSlides", false );
if ( mbIsSpreadsheet )
@@ -227,6 +229,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbDisplayPDFDocumentTitle = maConfigItem.ReadBool( "DisplayPDFDocumentTitle", true );
mnInitialView = maConfigItem.ReadInt32( "InitialView", 0 );
+ mnInitialViewUserSelection = mnInitialView;
mnMagnification = maConfigItem.ReadInt32( "Magnification", 0 );
mnZoom = maConfigItem.ReadInt32( "Zoom", 100 );
mnPageLayout = maConfigItem.ReadInt32( "PageLayout", 0 );
@@ -254,7 +257,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
// queue the tab pages for later creation (created when first shown)
AddTabPage("general", ImpPDFTabGeneralPage::Create, nullptr );
- AddTabPage("digitalsignatures", ImpPDFTabSigningPage::Create, nullptr);
+ if (comphelper::LibreOfficeKit::isActive())
+ m_xTabCtrl->remove_page("digitalsignatures");
+ else
+ AddTabPage("digitalsignatures", ImpPDFTabSigningPage::Create, nullptr);
AddTabPage("security", ImpPDFTabSecurityPage::Create, nullptr);
AddTabPage("links", ImpPDFTabLinksPage::Create, nullptr);
AddTabPage("userinterface", ImpPDFTabViewerPage::Create, nullptr);
@@ -271,6 +277,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();
@@ -278,7 +285,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
ImpPDFTabSecurityPage* ImpPDFTabDialog::getSecurityPage() const
{
- SfxTabPage* pSecurityPage = GetTabPage("security");
+ SfxTabPage* pSecurityPage = GetTabPage(u"security");
if (pSecurityPage)
{
return static_cast<ImpPDFTabSecurityPage*>(pSecurityPage);
@@ -286,10 +293,19 @@ ImpPDFTabSecurityPage* ImpPDFTabDialog::getSecurityPage() const
return nullptr;
}
+ImpPDFTabOpnFtrPage * ImpPDFTabDialog::getOpenPage() const
+{
+ SfxTabPage* pOpenPage = GetTabPage(u"initialview");
+ if (pOpenPage)
+ {
+ return static_cast<ImpPDFTabOpnFtrPage*>(pOpenPage);
+ }
+ return nullptr;
+}
ImpPDFTabLinksPage* ImpPDFTabDialog::getLinksPage() const
{
- SfxTabPage* pLinksPage = GetTabPage("links");
+ SfxTabPage* pLinksPage = GetTabPage(u"links");
if (pLinksPage)
{
return static_cast<ImpPDFTabLinksPage*>(pLinksPage);
@@ -300,7 +316,7 @@ ImpPDFTabLinksPage* ImpPDFTabDialog::getLinksPage() const
ImpPDFTabGeneralPage* ImpPDFTabDialog::getGeneralPage() const
{
- SfxTabPage* pGeneralPage = GetTabPage("general");
+ SfxTabPage* pGeneralPage = GetTabPage(u"general");
if (pGeneralPage)
{
return static_cast<ImpPDFTabGeneralPage*>(pGeneralPage);
@@ -313,13 +329,67 @@ 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();
+ auto aIssues = aCollection.getIssues();
+ int nIssueCount(aIssues.size());
+ if (!aIssues.empty())
+ {
+ OUString aMessage(FilterResId(STR_WARN_PDFUA_ISSUES, nIssueCount));
+ aMessage = aMessage.replaceFirst("%1", OUString::number(nIssueCount));
+
+ std::unique_ptr<weld::MessageDialog> xPDFUADialog(Application::CreateMessageDialog(
+ getGeneralPage()->GetFrameWeld(), VclMessageType::Warning,
+ VclButtonsType::Cancel, aMessage));
+ xPDFUADialog->add_button(FilterResId(STR_PDFUA_INVESTIGATE, nIssueCount), RET_NO);
+ xPDFUADialog->add_button(FilterResId(STR_PDFUA_IGNORE), RET_YES);
+ xPDFUADialog->set_default_response(RET_YES);
+
+ int ret = xPDFUADialog->run();
+ if (ret == RET_YES)
+ m_xDialog->response(RET_OK);
+ else if (ret == RET_NO)
+ {
+ m_xDialog->response(RET_CANCEL);
+ // Show accessibility check Sidebar deck
+ SfxDispatcher* pDispatcher = pShell->GetDispatcher();
+ if (pDispatcher)
+ {
+ const SfxStringItem sDeckName(SID_SIDEBAR_DECK, "A11yCheckDeck");
+ pDispatcher->ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::RECORD,
+ { &sDeckName });
+ }
+ }
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+ }
+ else
+ {
+ m_xDialog->response(RET_OK);
+ }
+}
+
ImpPDFTabDialog::~ImpPDFTabDialog()
{
maConfigItem.WriteModifiedConfig();
maConfigI18N.WriteModifiedConfig();
}
-void ImpPDFTabDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
+void ImpPDFTabDialog::PageCreated(const OUString& rId, SfxTabPage& rPage)
{
if (rId == "general")
static_cast<ImpPDFTabGeneralPage&>(rPage).SetFilterConfigItem(this);
@@ -345,41 +415,20 @@ 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()
{
// updating the FilterData sequence and storing FilterData to configuration
- if (ImpPDFTabGeneralPage* pPage = static_cast<ImpPDFTabGeneralPage*>(GetTabPage("general")))
+ if (ImpPDFTabGeneralPage* pPage = static_cast<ImpPDFTabGeneralPage*>(GetTabPage(u"general")))
pPage->GetFilterConfigItem(this);
- if (ImpPDFTabViewerPage* pPage = static_cast<ImpPDFTabViewerPage*>(GetTabPage("userinterface")))
+ if (ImpPDFTabViewerPage* pPage = static_cast<ImpPDFTabViewerPage*>(GetTabPage(u"userinterface")))
pPage->GetFilterConfigItem(this);
- if (ImpPDFTabOpnFtrPage* pPage = static_cast<ImpPDFTabOpnFtrPage*>(GetTabPage("initialview")))
+ if (ImpPDFTabOpnFtrPage* pPage = static_cast<ImpPDFTabOpnFtrPage*>(GetTabPage(u"initialview")))
pPage->GetFilterConfigItem(this);
- if (ImpPDFTabLinksPage* pPage = static_cast<ImpPDFTabLinksPage*>(GetTabPage("links")))
+ if (ImpPDFTabLinksPage* pPage = static_cast<ImpPDFTabLinksPage*>(GetTabPage(u"links")))
pPage->GetFilterConfigItem(this);
- if (ImpPDFTabSecurityPage* pPage = static_cast<ImpPDFTabSecurityPage*>( GetTabPage("security")))
+ if (ImpPDFTabSecurityPage* pPage = static_cast<ImpPDFTabSecurityPage*>( GetTabPage(u"security")))
pPage->GetFilterConfigItem(this);
- if (ImpPDFTabSigningPage* pPage = static_cast<ImpPDFTabSigningPage*>(GetTabPage("digitalsignatures")))
+ if (ImpPDFTabSigningPage* pPage = static_cast<ImpPDFTabSigningPage*>(GetTabPage(u"digitalsignatures")))
pPage->GetFilterConfigItem(this);
// prepare the items to be returned
@@ -402,6 +451,8 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
maConfigItem.WriteBool( "ExportOnlyNotesPages", mbExportOnlyNotesPages );
}
maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
+ if (mbIsWriter)
+ maConfigItem.WriteBool( "ExportNotesInMargin", mbExportNotesInMargin );
maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
@@ -457,8 +508,10 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
comphelper::makePropertyValue("RestrictPermissions", mbRestrictPermissions),
comphelper::makePropertyValue("PreparedPermissionPassword", maPreparedOwnerPassword)
};
- if( mbIsRangeChecked )
+ if( mbIsPageRangeChecked )
aRet.push_back(comphelper::makePropertyValue("PageRange", msPageRange));
+ if( mbIsSheetRangeChecked )
+ aRet.push_back(comphelper::makePropertyValue("SheetRange", msSheetRange));
else if( mbSelectionIsChecked )
aRet.push_back(comphelper::makePropertyValue("Selection", maSelection));
@@ -482,10 +535,11 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogC
, mbIsWriter(false)
, mpParent(nullptr)
, mxRbAll(m_xBuilder->weld_radio_button("all"))
- , mxRbRange(m_xBuilder->weld_radio_button("range"))
+ , mxRbPageRange(m_xBuilder->weld_radio_button("pagerange"))
+ , mxRbSheetRange(m_xBuilder->weld_radio_button("sheetrange"))
, mxRbSelection(m_xBuilder->weld_radio_button("selection"))
, mxEdPages(m_xBuilder->weld_entry("pages"))
- , mxSelectedSheets(m_xBuilder->weld_label("selectedsheets"))
+ , mxEdSheets(m_xBuilder->weld_entry("sheets"))
, mxRbLosslessCompression(m_xBuilder->weld_radio_button("losslesscompress"))
, mxRbJPEGCompression(m_xBuilder->weld_radio_button("jpegcompress"))
, mxQualityFrame(m_xBuilder->weld_widget("qualityframe"))
@@ -504,6 +558,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogC
, mxCbExportHiddenSlides(m_xBuilder->weld_check_button("hiddenpages"))
, mxCbSinglePageSheets(m_xBuilder->weld_check_button("singlepagesheets"))
, mxCbExportNotes(m_xBuilder->weld_check_button("comments"))
+ , mxCbExportNotesInMargin(m_xBuilder->weld_check_button("commentsinmargin"))
, mxCbViewPDF(m_xBuilder->weld_check_button("viewpdf"))
, mxCbUseReferenceXObject(m_xBuilder->weld_check_button("usereferencexobject"))
, mxCbExportNotesPages(m_xBuilder->weld_check_button("notes"))
@@ -515,12 +570,14 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogC
, mxFtWatermark(m_xBuilder->weld_label("watermarklabel"))
, mxEdWatermark(m_xBuilder->weld_entry("watermarkentry"))
, mxSlidesFt(m_xBuilder->weld_label("slides"))
- , mxSheetsFt(m_xBuilder->weld_label("selectedsheets"))
+ , mxSheetsSelectionFt(m_xBuilder->weld_label("selectedsheets"))
{
}
ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage()
{
+ if (mxPasswordUnusedWarnDialog)
+ mxPasswordUnusedWarnDialog->response(RET_CANCEL);
}
void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
@@ -528,39 +585,45 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
mpParent = pParent;
// init this class data
- mxRbRange->connect_toggled( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) );
+ mxRbPageRange->connect_toggled( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) );
+ mxRbSheetRange->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleSheetsHdl ) );
mxRbAll->set_active(true);
mxRbAll->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleAllHdl ) );
TogglePagesHdl();
+ ToggleSheetsHdl();
- const bool bSelectionPresent = pParent->mbSelectionPresent;
- mxRbSelection->set_sensitive( bSelectionPresent );
- if ( bSelectionPresent )
+ mxRbSelection->set_sensitive( pParent->mbSelectionPresent );
+ if ( pParent->mbSelectionPresent )
mxRbSelection->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleSelectionHdl ) );
mbIsPresentation = pParent->mbIsPresentation;
mbIsWriter = pParent->mbIsWriter;
mbIsSpreadsheet = pParent->mbIsSpreadsheet;
- mxCbExportEmptyPages->set_sensitive( mbIsWriter );
- mxCbExportPlaceholders->set_sensitive( mbIsWriter );
-
mxRbLosslessCompression->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) );
const bool bUseLosslessCompression = pParent->mbUseLosslessCompression;
if ( bUseLosslessCompression )
mxRbLosslessCompression->set_active(true);
else
mxRbJPEGCompression->set_active(true);
+ const bool bReadOnlyCompression = !pParent->maConfigItem.IsReadOnly("UseLosslessCompression");
+ mxRbLosslessCompression->set_sensitive(bReadOnlyCompression);
+ mxRbJPEGCompression->set_sensitive(bReadOnlyCompression);
mxNfQuality->set_value( pParent->mnQuality, FieldUnit::PERCENT );
- mxQualityFrame->set_sensitive(!bUseLosslessCompression);
+ mxQualityFrame->set_sensitive(
+ !bUseLosslessCompression && !pParent->maConfigItem.IsReadOnly("Quality"));
mxCbReduceImageResolution->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl));
const bool bReduceImageResolution = pParent->mbReduceImageResolution;
mxCbReduceImageResolution->set_active( bReduceImageResolution );
+ mxCbReduceImageResolution->set_sensitive(
+ !pParent->maConfigItem.IsReadOnly("ReduceImageResolution"));
OUString aStrRes = OUString::number( pParent->mnMaxImageResolution ) + " DPI";
mxCoReduceImageResolution->set_entry_text(aStrRes);
- mxCoReduceImageResolution->set_sensitive( bReduceImageResolution );
+ mxCoReduceImageResolution->set_sensitive(
+ bReduceImageResolution && !pParent->maConfigItem.IsReadOnly("MaxImageResolution"));
+
mxCbWatermark->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleWatermarkHdl ) );
mxFtWatermark->set_sensitive(false );
mxEdWatermark->set_sensitive( false );
@@ -585,6 +648,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
const bool bIsPDFUA = pParent->mbPDFUACompliance;
mxCbPDFUA->set_active(bIsPDFUA);
mxCbPDFUA->connect_toggled(LINK(this, ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHandle));
+ mxCbPDFUA->set_sensitive(!pParent->maConfigItem.IsReadOnly("PDFUACompliance"));
// the TogglePDFVersionOrUniversalAccessibilityHandle handler will read or write the *UserSelection based
// on the mxCbPDFA (= bIsPDFA) state, so we have to prepare the correct input state.
@@ -592,32 +656,59 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
mxCbTaggedPDF->set_active(pParent->mbUseTaggedPDFUserSelection);
else
mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDFUserSelection;
+
+ mxCbExportBookmarks->set_active(pParent->mbExportBookmarksUserSelection);
TogglePDFVersionOrUniversalAccessibilityHandle(*mxCbPDFA);
mxCbExportFormFields->set_active(pParent->mbExportFormFields);
mxCbExportFormFields->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) );
+ mxCbExportFormFields->set_sensitive(!pParent->maConfigItem.IsReadOnly("ExportFormFields"));
mxLbFormsFormat->set_active(static_cast<sal_uInt16>(pParent->mnFormsType));
mxCbAllowDuplicateFieldNames->set_active( pParent->mbAllowDuplicateFieldNames );
+ // FormsFrame contains (and thus sets_sensitive) FormsFormat and AllowDuplicateFieldNames
mxFormsFrame->set_sensitive(pParent->mbExportFormFields);
+ if (pParent->mbExportFormFields)
+ {
+ if (pParent->maConfigItem.IsReadOnly("FormsType"))
+ mxLbFormsFormat->set_sensitive(false);
+ if (pParent->maConfigItem.IsReadOnly("AllowDuplicateFieldNames"))
+ mxCbAllowDuplicateFieldNames->set_sensitive(false);
+ }
- mxCbExportBookmarks->set_active( pParent->mbExportBookmarks );
mxCbExportNotes->set_active( pParent->mbExportNotes );
- mxCbViewPDF->set_active( pParent->mbViewPDF);
+ mxCbExportNotesInMargin->set_active(mbIsWriter && pParent->mbExportNotesInMargin);
+ mxCbExportNotesInMargin->set_sensitive(
+ mbIsWriter && !pParent->maConfigItem.IsReadOnly("ExportNotesInMargin"));
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ mxCbViewPDF->hide();
+ mxCbViewPDF->set_active(false);
+ }
+ else
+ {
+ mxCbViewPDF->set_active(pParent->mbViewPDF);
+ mxCbViewPDF->set_sensitive(!pParent->maConfigItem.IsReadOnly("ViewPDFAfterExport"));
+ }
if ( mbIsPresentation )
{
- mxRbRange->set_label(mxSlidesFt->get_label());
+ mxRbPageRange->set_label(mxSlidesFt->get_label());
mxCbExportNotesPages->show();
mxCbExportNotesPages->set_active(pParent->mbExportNotesPages);
mxCbExportNotesPages->connect_toggled( LINK(this, ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl ) );
+ mxCbExportNotesPages->set_sensitive(!pParent->maConfigItem.IsReadOnly("ExportNotesPages"));
mxCbExportOnlyNotesPages->show();
mxCbExportOnlyNotesPages->set_active(pParent->mbExportOnlyNotesPages);
// tdf#116473 Initially enable Export only note pages option depending on the checked state of Export notes pages option
- mxCbExportOnlyNotesPages->set_sensitive(mxCbExportNotesPages->get_active());
+ mxCbExportOnlyNotesPages->set_sensitive(
+ mxCbExportNotesPages->get_active() && !pParent->maConfigItem.IsReadOnly("ExportOnlyNotesPages"));
mxCbExportHiddenSlides->show();
mxCbExportHiddenSlides->set_active(pParent->mbExportHiddenSlides);
+ mxCbExportHiddenSlides->set_sensitive(
+ !pParent->maConfigItem.IsReadOnly("ExportHiddenSlides"));
}
else
{
@@ -631,34 +722,38 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
if( mbIsSpreadsheet )
{
- mxRbSelection->set_label(mxSheetsFt->get_label());
+ mxRbSelection->set_label(mxSheetsSelectionFt->get_label());
// tdf#105965 Make Selection/Selected sheets the default PDF export range setting for spreadsheets
mxRbSelection->set_active(true);
+ mxRbSheetRange->show();
+ mxEdSheets->show();
+
mxCbSinglePageSheets->show();
mxCbSinglePageSheets->set_active(pParent->mbSinglePageSheets);
+ mxCbSinglePageSheets->set_sensitive(!pParent->maConfigItem.IsReadOnly("SinglePageSheets"));
}
else
{
mxCbSinglePageSheets->hide();
mxCbSinglePageSheets->set_active(false);
+ mxRbSheetRange->hide();
+ mxRbSheetRange->set_active(false);
+ mxEdSheets->hide();
}
- mxCbExportPlaceholders->set_visible(mbIsWriter);
- if( mbIsWriter )
- {
- // tdf#54908 Make selection active if there is a selection in Writer's version
- mxRbSelection->set_active( bSelectionPresent );
- }
- else
- {
- mxCbExportPlaceholders->set_active(false);
- }
mxCbExportEmptyPages->set_active(!pParent->mbIsSkipEmptyPages);
+ mxCbExportEmptyPages->set_sensitive(
+ mbIsWriter && !pParent->maConfigItem.IsReadOnly("IsSkipEmptyPages"));
+
+ mxCbExportPlaceholders->set_visible(mbIsWriter);
mxCbExportPlaceholders->set_active(pParent->mbIsExportPlaceholders);
+ mxCbExportPlaceholders->set_sensitive(
+ mbIsWriter && !pParent->maConfigItem.IsReadOnly("ExportPlaceholders"));
mxCbAddStream->show();
mxCbAddStream->set_active(pParent->mbAddStream);
+ mxCbAddStream->set_sensitive(!pParent->maConfigItem.IsReadOnly("IsAddStream"));
mxCbAddStream->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleAddStreamHdl));
ToggleAddStreamHdl(*mxCbAddStream); // init addstream dependencies
@@ -672,6 +767,8 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mbReduceImageResolution = mxCbReduceImageResolution->get_active();
pParent->mnMaxImageResolution = mxCoReduceImageResolution->get_active_text().toInt32();
pParent->mbExportNotes = mxCbExportNotes->get_active();
+ if (mbIsWriter)
+ pParent->mbExportNotesInMargin = mxCbExportNotesInMargin->get_active();
pParent->mbViewPDF = mxCbViewPDF->get_active();
pParent->mbUseReferenceXObject = mxCbUseReferenceXObject->get_active();
if ( mbIsPresentation )
@@ -690,12 +787,17 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mbIsExportPlaceholders = mxCbExportPlaceholders->get_active();
pParent->mbAddStream = mxCbAddStream->get_visible() && mxCbAddStream->get_active();
- pParent->mbIsRangeChecked = false;
- if( mxRbRange->get_active() )
+ pParent->mbIsPageRangeChecked = false;
+ if( mxRbPageRange->get_active() )
{
- pParent->mbIsRangeChecked = true;
+ pParent->mbIsPageRangeChecked = true;
pParent->msPageRange = mxEdPages->get_text(); //FIXME all right on other languages ?
}
+ else if ( mxRbSheetRange->get_active() )
+ {
+ pParent->mbIsSheetRangeChecked = true;
+ pParent->msSheetRange = mxEdSheets->get_text();
+ }
else if( mxRbSelection->get_active() )
{
pParent->mbSelectionIsChecked = mxRbSelection->get_active();
@@ -721,6 +823,11 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
if (!bIsPDFA && !bIsPDFUA)
mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDF;
+ if (!bIsPDFUA)
+ {
+ pParent->mbExportBookmarksUserSelection = pParent->mbExportBookmarks;
+ pParent->mbUseReferenceXObjectUserSelection = pParent->mbUseReferenceXObject;
+ }
pParent->mbUseTaggedPDFUserSelection = mbUseTaggedPDFUserSelection;
pParent->mbExportFormFields = mxCbExportFormFields->get_active();
@@ -753,6 +860,12 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePagesHdl, weld::Toggleable&, void)
EnableExportNotesPages();
}
+IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleSheetsHdl, weld::Toggleable&, void)
+{
+ ToggleSheetsHdl();
+ EnableExportNotesPages();
+}
+
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleSelectionHdl, weld::Toggleable&, void)
{
EnableExportNotesPages();
@@ -760,38 +873,62 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleSelectionHdl, weld::Toggleable&, voi
void ImpPDFTabGeneralPage::TogglePagesHdl()
{
- mxEdPages->set_sensitive( mxRbRange->get_active() );
- if (mxRbRange->get_active())
+ mxEdPages->set_sensitive( mxRbPageRange->get_active() );
+ if (mxRbPageRange->get_active())
mxEdPages->grab_focus();
}
+void ImpPDFTabGeneralPage::ToggleSheetsHdl()
+{
+ mxEdSheets->set_sensitive( mxRbSheetRange->get_active() );
+ if (mxRbSheetRange->get_active())
+ mxEdSheets->grab_focus();
+}
+
void ImpPDFTabGeneralPage::EnableExportNotesPages()
{
if ( mbIsPresentation )
{
- mxCbExportNotesPages->set_sensitive( !mxRbSelection->get_active() );
- mxCbExportOnlyNotesPages->set_sensitive( !mxRbSelection->get_active() && mxCbExportNotesPages->get_active() );
+ mxCbExportNotesPages->set_sensitive(
+ !mxRbSelection->get_active() && !IsReadOnlyProperty("ExportNotesPages"));
+ mxCbExportOnlyNotesPages->set_sensitive(
+ !mxRbSelection->get_active() && mxCbExportNotesPages->get_active()
+ && !IsReadOnlyProperty("ExportOnlyNotesPages"));
}
}
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl, weld::Toggleable&, void)
{
- mxFormsFrame->set_sensitive(mxCbExportFormFields->get_active());
+ const bool bExportFormFields = mxCbExportFormFields->get_active();
+ // FormsFrame contains (and thus sets_sensitive) FormsFormat and AllowDuplicateFieldNames
+ mxFormsFrame->set_sensitive(bExportFormFields);
+ if (bExportFormFields)
+ {
+ if (IsReadOnlyProperty("FormsType"))
+ mxLbFormsFormat->set_sensitive(false);
+ if (IsReadOnlyProperty("AllowDuplicateFieldNames"))
+ mxCbAllowDuplicateFieldNames->set_sensitive(false);
+ }
}
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl, weld::Toggleable&, void)
{
- mxCbExportOnlyNotesPages->set_sensitive(mxCbExportNotesPages->get_active());
+ mxCbExportOnlyNotesPages->set_sensitive(
+ mxCbExportNotesPages->get_active()
+ && !IsReadOnlyProperty("ExportOnlyNotesPages"));
}
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleCompressionHdl, weld::Toggleable&, void)
{
- mxQualityFrame->set_sensitive(mxRbJPEGCompression->get_active());
+ mxQualityFrame->set_sensitive(
+ mxRbJPEGCompression->get_active() && !IsReadOnlyProperty("Quality"));
}
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl, weld::Toggleable&, void)
{
- mxCoReduceImageResolution->set_sensitive(mxCbReduceImageResolution->get_active());
+ mxCoReduceImageResolution->set_sensitive(
+ mxCbReduceImageResolution->get_active()
+ && !IsReadOnlyProperty("MaxImageResolution"));
}
IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleWatermarkHdl, weld::Toggleable&, void)
@@ -810,7 +947,8 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleAddStreamHdl, weld::Toggleable&, voi
if( mxCbAddStream->get_active() )
{
mxRbAll->set_active(true);
- mxRbRange->set_sensitive( false );
+ mxRbPageRange->set_sensitive( false );
+ mxRbSheetRange->set_sensitive( false );
mxRbSelection->set_sensitive( false );
mxEdPages->set_sensitive( false );
mxRbAll->set_sensitive( false );
@@ -818,7 +956,8 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleAddStreamHdl, weld::Toggleable&, voi
else
{
mxRbAll->set_sensitive(true);
- mxRbRange->set_sensitive(true);
+ mxRbPageRange->set_sensitive(true);
+ mxRbSheetRange->set_sensitive(true);
mxRbSelection->set_sensitive(true);
}
}
@@ -831,10 +970,12 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
// set the security page status (and its controls as well)
ImpPDFTabSecurityPage* pSecPage = mpParent ? mpParent->getSecurityPage() : nullptr;
if (pSecPage)
- pSecPage->ImplPDFASecurityControl(!bIsPDFA);
+ pSecPage->ImplPDFASecurityControl();
- mxCbTaggedPDF->set_sensitive(!bIsPDFA && !bIsPDFUA);
- mxRbPDFAVersion->set_sensitive(bIsPDFA);
+ mxCbTaggedPDF->set_sensitive(
+ !bIsPDFA && !bIsPDFUA && !IsReadOnlyProperty("UseTaggedPDF"));
+ mxRbPDFAVersion->set_sensitive(
+ bIsPDFA && !IsReadOnlyProperty("SelectPdfVersion"));
if (bIsPDFA || bIsPDFUA)
{
@@ -843,12 +984,13 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
mxCbTaggedPDF->set_active(true);
// if a password was set, inform the user that this will not be used
- if (pSecPage && pSecPage->hasPassword())
+ if (bIsPDFA && pSecPage && pSecPage->hasPassword())
{
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(),
+ mxPasswordUnusedWarnDialog =
+ std::shared_ptr<weld::MessageDialog>(Application::CreateMessageDialog(m_xContainer.get(),
VclMessageType::Warning, VclButtonsType::Ok,
- PDFFilterResId(STR_WARN_PASSWORD_PDFA)));
- xBox->run();
+ FilterResId(STR_WARN_PASSWORD_PDFA)));
+ mxPasswordUnusedWarnDialog->runAsync(mxPasswordUnusedWarnDialog, [] (sal_uInt32){ });
}
}
else
@@ -857,6 +999,40 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
mxCbTaggedPDF->set_active(mbUseTaggedPDFUserSelection);
}
+ if (bIsPDFUA)
+ {
+ if (mxCbExportBookmarks->get_sensitive())
+ {
+ if (mpParent)
+ {
+ mpParent->mbExportBookmarksUserSelection = mxCbExportBookmarks->get_active();
+ }
+ mxCbExportBookmarks->set_active(true);
+ }
+ if (mxCbUseReferenceXObject->get_sensitive())
+ {
+ if (mpParent)
+ {
+ mpParent->mbUseReferenceXObjectUserSelection = mxCbUseReferenceXObject->get_active();
+ }
+ mxCbUseReferenceXObject->set_active(false);
+ }
+ }
+ else if (mpParent)
+ {
+ mxCbExportBookmarks->set_active(mpParent->mbExportBookmarksUserSelection);
+ mxCbUseReferenceXObject->set_active(mpParent->mbUseReferenceXObjectUserSelection);
+ }
+ mxCbExportBookmarks->set_sensitive(
+ !bIsPDFUA && !IsReadOnlyProperty("ExportBookmarks"));
+ mxCbUseReferenceXObject->set_sensitive(!bIsPDFUA);
+
+ ImpPDFTabOpnFtrPage *const pOpenPage(mpParent ? mpParent->getOpenPage() : nullptr);
+ if (pOpenPage)
+ {
+ pOpenPage->ToggleInitialView(*mpParent);
+ }
+
// PDF/A doesn't allow launch action, so enable/disable the selection on the Link page
ImpPDFTabLinksPage* pLinksPage = mpParent ? mpParent->getLinksPage() : nullptr;
if (pLinksPage)
@@ -906,6 +1082,10 @@ void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mnInitialView = 1;
else if( mxRbOpnThumbs->get_active() )
pParent->mnInitialView = 2;
+ if (!pParent->mbPDFUACompliance)
+ {
+ pParent->mnInitialViewUserSelection = pParent->mnInitialView;
+ }
pParent->mnMagnification = 0;
if( mxRbMagnFitWin->get_active() )
@@ -933,7 +1113,7 @@ void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mbFirstPageLeft = mbUseCTLFont && mxCbPgLyFirstOnLeft->get_active();
}
-void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent )
+void ImpPDFTabOpnFtrPage::SetFilterConfigItem(ImpPDFTabDialog *const pParent)
{
mbUseCTLFont = pParent->mbUseCTLFont;
switch( pParent->mnPageLayout )
@@ -1003,6 +1183,52 @@ void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent )
mxCbPgLyFirstOnLeft->set_active(pParent->mbFirstPageLeft);
ToggleRbPgLyContinueFacingHdl();
}
+
+ // The call from ImpPDFTabGeneralPage::SetFilterConfigItem() did not init
+ // the radio buttons correctly because ImpPDFTabOpnFtrPage did not yet exist.
+ ToggleInitialView(*pParent);
+}
+
+void ImpPDFTabOpnFtrPage::ToggleInitialView(ImpPDFTabDialog & rParent)
+{
+ bool const bIsPDFUA(rParent.getGeneralPage()->IsPdfUaSelected());
+ if (bIsPDFUA)
+ { // only allow Outline for PDF/UA
+ if (mxRbOpnOutline->get_sensitive())
+ {
+ if (mxRbOpnPageOnly->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 0;
+ }
+ else if (mxRbOpnOutline->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 1;
+ }
+ else if (mxRbOpnThumbs->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 2;
+ }
+ mxRbOpnOutline->set_active(true);
+ }
+ }
+ else
+ {
+ switch (rParent.mnInitialViewUserSelection)
+ {
+ case 0:
+ mxRbOpnPageOnly->set_active(true);
+ break;
+ case 1:
+ mxRbOpnOutline->set_active(true);
+ break;
+ case 2:
+ mxRbOpnThumbs->set_active(true);
+ break;
+ }
+ }
+ mxRbOpnPageOnly->set_sensitive(!bIsPDFUA);
+ mxRbOpnThumbs->set_sensitive(!bIsPDFUA);
+ mxRbOpnOutline->set_sensitive(!bIsPDFUA);
}
IMPL_LINK_NOARG(ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl, weld::Toggleable&, void)
@@ -1098,10 +1324,10 @@ void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent )
/// The Security preferences tab page
ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& i_rCoreSet)
: SfxTabPage(pPage, pController, "filter/ui/pdfsecuritypage.ui", "PdfSecurityPage", &i_rCoreSet)
- , msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) )
+ , msUserPwdTitle( FilterResId( STR_PDF_EXPORT_UDPWD ) )
, mbHaveOwnerPassword( false )
, mbHaveUserPassword( false )
- , msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) )
+ , msOwnerPwdTitle( FilterResId( STR_PDF_EXPORT_ODPWD ) )
, mxPbSetPwd(m_xBuilder->weld_button("setpassword"))
, mxUserPwdSet(m_xBuilder->weld_widget("userpwdset"))
, mxUserPwdUnset(m_xBuilder->weld_widget("userpwdunset"))
@@ -1123,6 +1349,7 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(weld::Container* pPage, weld::Dialo
, mxCbEnableCopy(m_xBuilder->weld_check_button("enablecopy"))
, mxCbEnableAccessibility(m_xBuilder->weld_check_button("enablea11y"))
, mxPasswordTitle(m_xBuilder->weld_label("setpasswordstitle"))
+ , mxPermissionTitle(m_xBuilder->weld_label("label2"))
{
msStrSetPwd = mxPasswordTitle->get_label();
mxPbSetPwd->connect_clicked(LINK(this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl));
@@ -1130,6 +1357,10 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(weld::Container* pPage, weld::Dialo
ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage()
{
+ if (mpPasswordDialog)
+ mpPasswordDialog->response(RET_CANCEL);
+ if (mpUnsupportedMsgDialog)
+ mpUnsupportedMsgDialog->response(RET_CANCEL);
}
std::unique_ptr<SfxTabPage> ImpPDFTabSecurityPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
@@ -1215,56 +1446,77 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent
ImpPDFTabGeneralPage* pGeneralPage = pParent->getGeneralPage();
if (pGeneralPage)
- ImplPDFASecurityControl(!pGeneralPage->IsPdfaSelected());
+ ImplPDFASecurityControl();
}
IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, weld::Button&, void)
{
- SfxPasswordDialog aPwdDialog(m_xContainer.get(), &msUserPwdTitle);
- aPwdDialog.SetMinLen(0);
- aPwdDialog.ShowMinLengthText(false);
- aPwdDialog.ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 );
- aPwdDialog.set_title(msStrSetPwd);
- aPwdDialog.SetGroup2Text(msOwnerPwdTitle);
- aPwdDialog.AllowAsciiOnly();
- if (aPwdDialog.run() == RET_OK) // OK issued get password and set it
- {
- OUString aUserPW(aPwdDialog.GetPassword());
- OUString aOwnerPW(aPwdDialog.GetPassword2());
-
- mbHaveUserPassword = !aUserPW.isEmpty();
- mbHaveOwnerPassword = !aOwnerPW.isEmpty();
-
- mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW );
- if (!mxPreparedPasswords.is()) {
- OUString msg;
- ErrorHandler::GetErrorString(ERRCODE_IO_NOTSUPPORTED, msg); //TODO: handle failure
- std::unique_ptr<weld::MessageDialog>(
- Application::CreateMessageDialog(
- GetFrameWeld(), VclMessageType::Error, VclButtonsType::Ok, msg))
- ->run();
- return;
- }
+ if(mpPasswordDialog)
+ mpPasswordDialog->response(RET_CANCEL);
+
+ mpPasswordDialog = std::make_shared<SfxPasswordDialog>(m_xContainer.get(), &msUserPwdTitle);
+
+ mpPasswordDialog->SetMinLen(0);
+ mpPasswordDialog->ShowMinLengthText(false);
+ mpPasswordDialog->ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 );
+ mpPasswordDialog->set_title(msStrSetPwd);
+ mpPasswordDialog->SetGroup2Text(msOwnerPwdTitle);
+ mpPasswordDialog->AllowAsciiOnly();
+
+ mpPasswordDialog->PreRun();
- if( mbHaveOwnerPassword )
+ weld::DialogController::runAsync(mpPasswordDialog, [this](sal_Int32 response){
+ if (response == RET_OK)
{
- maPreparedOwnerPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW );
+ OUString aUserPW(mpPasswordDialog->GetPassword());
+ OUString aOwnerPW(mpPasswordDialog->GetPassword2());
+
+ mbHaveUserPassword = !aUserPW.isEmpty();
+ mbHaveOwnerPassword = !aOwnerPW.isEmpty();
+
+ mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW );
+ if (!mxPreparedPasswords.is())
+ {
+ OUString msg;
+ ErrorHandler::GetErrorString(ERRCODE_IO_NOTSUPPORTED, msg); //TODO: handle failure
+ mpUnsupportedMsgDialog = std::shared_ptr<weld::MessageDialog>(
+ Application::CreateMessageDialog(
+ GetFrameWeld(), VclMessageType::Error, VclButtonsType::Ok, msg));
+
+ mpUnsupportedMsgDialog->runAsync(mpUnsupportedMsgDialog, [](sal_Int32){ });
+ return;
+ }
+
+ if( mbHaveOwnerPassword )
+ maPreparedOwnerPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW );
+ else
+ maPreparedOwnerPassword = Sequence< NamedValue >();
}
- else
- maPreparedOwnerPassword = Sequence< NamedValue >();
- }
- enablePermissionControls();
+ if (response != RET_CANCEL)
+ enablePermissionControls();
+ mpPasswordDialog.reset();
+ });
}
void ImpPDFTabSecurityPage::enablePermissionControls()
{
bool bIsPDFASel = false;
+ bool bIsPDFUASel = false;
ImpPDFTabDialog* pParent = static_cast<ImpPDFTabDialog*>(GetDialogController());
ImpPDFTabGeneralPage* pGeneralPage = pParent ? pParent->getGeneralPage() : nullptr;
if (pGeneralPage)
{
bIsPDFASel = pGeneralPage->IsPdfaSelected();
+ bIsPDFUASel = pGeneralPage->IsPdfUaSelected();
+ }
+ // ISO 14289-1:2014, Clause: 7.16
+ if (bIsPDFUASel)
+ {
+ mxCbEnableAccessibility->set_active(true);
}
+ mxPermissionTitle->set_sensitive(!bIsPDFASel);
+ mxPbSetPwd->set_sensitive(!bIsPDFASel);
+ mxCbEnableAccessibility->set_sensitive(!bIsPDFUASel);
if (bIsPDFASel)
{
mxUserPwdPdfa->show();
@@ -1317,9 +1569,8 @@ void ImpPDFTabSecurityPage::enablePermissionControls()
// This tab page is under control of the PDF/A-1a checkbox:
// TODO: implement a method to do it.
-void ImpPDFTabSecurityPage::ImplPDFASecurityControl( bool bEnableSecurity )
+void ImpPDFTabSecurityPage::ImplPDFASecurityControl()
{
- m_xContainer->set_sensitive(bEnableSecurity);
// after enable, check the status of control as if the dialog was initialized
enablePermissionControls();
}
@@ -1469,19 +1720,19 @@ ImplErrorDialog::ImplErrorDialog(weld::Window* pParent, const std::set<vcl::PDFW
switch(error)
{
case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA:
- m_xErrors->append(PDFFilterResId(STR_WARN_TRANSP_PDFA), PDFFilterResId(STR_WARN_TRANSP_PDFA_SHORT), "dialog-warning");
+ m_xErrors->append(FilterResId(STR_WARN_TRANSP_PDFA), FilterResId(STR_WARN_TRANSP_PDFA_SHORT), "dialog-warning");
break;
case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13:
- m_xErrors->append(PDFFilterResId(STR_WARN_TRANSP_VERSION), PDFFilterResId(STR_WARN_TRANSP_VERSION_SHORT), "dialog-warning");
+ m_xErrors->append(FilterResId(STR_WARN_TRANSP_VERSION), FilterResId(STR_WARN_TRANSP_VERSION_SHORT), "dialog-warning");
break;
case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA:
- m_xErrors->append(PDFFilterResId(STR_WARN_FORMACTION_PDFA), PDFFilterResId(STR_WARN_FORMACTION_PDFA_SHORT), "dialog-warning");
+ m_xErrors->append(FilterResId(STR_WARN_FORMACTION_PDFA), FilterResId(STR_WARN_FORMACTION_PDFA_SHORT), "dialog-warning");
break;
case vcl::PDFWriter::Warning_Transparency_Converted:
- m_xErrors->append(PDFFilterResId(STR_WARN_TRANSP_CONVERTED), PDFFilterResId(STR_WARN_TRANSP_CONVERTED_SHORT), "dialog-warning");
+ m_xErrors->append(FilterResId(STR_WARN_TRANSP_CONVERTED), FilterResId(STR_WARN_TRANSP_CONVERTED_SHORT), "dialog-warning");
break;
case vcl::PDFWriter::Error_Signature_Failed:
- m_xErrors->append(PDFFilterResId(STR_ERR_PDF_EXPORT_ABORTED), PDFFilterResId(STR_ERR_SIGNATURE_FAILED), "dialog-error");
+ m_xErrors->append(FilterResId(STR_ERR_PDF_EXPORT_ABORTED), FilterResId(STR_ERR_SIGNATURE_FAILED), "dialog-error");
break;
default:
break;
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 9682adbc111d..95d25f99d705 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <sfx2/tabdlg.hxx>
+#include <sfx2/passwd.hxx>
#include <vcl/pdfwriter.hxx>
#include <vcl/FilterConfigItem.hxx>
@@ -58,7 +59,6 @@ class ImpPDFTabLinksPage;
class ImpPDFTabDialog final : public SfxTabDialogController
{
css::uno::Reference<css::lang::XComponent> mrDoc;
- weld::Window* mpParent;
FilterConfigItem maConfigItem;
FilterConfigItem maConfigI18N;
@@ -66,6 +66,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;
@@ -82,8 +83,10 @@ class ImpPDFTabDialog final : public SfxTabDialogController
sal_Int32 mnPDFTypeSelection;
bool mbPDFUACompliance;
bool mbExportNotes;
+ bool mbExportNotesInMargin;
bool mbViewPDF;
bool mbUseReferenceXObject;
+ bool mbUseReferenceXObjectUserSelection = false;
bool mbExportNotesPages;
bool mbExportOnlyNotesPages;
bool mbUseTransitionEffects;
@@ -94,6 +97,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
bool mbExportFormFields;
bool mbAllowDuplicateFieldNames;
bool mbExportBookmarks;
+ bool mbExportBookmarksUserSelection = true;
bool mbExportHiddenSlides;
bool mbSinglePageSheets;
sal_Int32 mnOpenBookmarkLevels;
@@ -107,6 +111,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
bool mbDisplayPDFDocumentTitle;
sal_Int32 mnMagnification;
sal_Int32 mnInitialView;
+ sal_Int32 mnInitialViewUserSelection;
sal_Int32 mnZoom;
sal_Int32 mnInitialPage;
@@ -123,8 +128,10 @@ class ImpPDFTabDialog final : public SfxTabDialogController
bool mbCanExtractForAccessibility;
css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords;
- bool mbIsRangeChecked;
+ bool mbIsPageRangeChecked;
OUString msPageRange;
+ bool mbIsSheetRangeChecked;
+ OUString msSheetRange;
bool mbSelectionIsChecked;
bool mbExportRelativeFsysLinks;
@@ -157,13 +164,13 @@ public:
Sequence< PropertyValue > GetFilterData();
+ ImpPDFTabOpnFtrPage* getOpenPage() const;
ImpPDFTabSecurityPage* getSecurityPage() const;
ImpPDFTabLinksPage* getLinksPage() const;
ImpPDFTabGeneralPage* getGeneralPage() const;
private:
- virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override;
- virtual short Ok() override;
+ virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
};
@@ -179,10 +186,11 @@ class ImpPDFTabGeneralPage : public SfxTabPage
ImpPDFTabDialog* mpParent;
std::unique_ptr<weld::RadioButton> mxRbAll;
- std::unique_ptr<weld::RadioButton> mxRbRange;
+ std::unique_ptr<weld::RadioButton> mxRbPageRange;
+ std::unique_ptr<weld::RadioButton> mxRbSheetRange;
std::unique_ptr<weld::RadioButton> mxRbSelection;
std::unique_ptr<weld::Entry> mxEdPages;
- std::unique_ptr<weld::Label> mxSelectedSheets;
+ std::unique_ptr<weld::Entry> mxEdSheets;
std::unique_ptr<weld::RadioButton> mxRbLosslessCompression;
std::unique_ptr<weld::RadioButton> mxRbJPEGCompression;
std::unique_ptr<weld::Widget> mxQualityFrame;
@@ -201,6 +209,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
std::unique_ptr<weld::CheckButton> mxCbExportHiddenSlides;
std::unique_ptr<weld::CheckButton> mxCbSinglePageSheets;
std::unique_ptr<weld::CheckButton> mxCbExportNotes;
+ std::unique_ptr<weld::CheckButton> mxCbExportNotesInMargin;
std::unique_ptr<weld::CheckButton> mxCbViewPDF;
std::unique_ptr<weld::CheckButton> mxCbUseReferenceXObject;
std::unique_ptr<weld::CheckButton> mxCbExportNotesPages;
@@ -212,10 +221,11 @@ class ImpPDFTabGeneralPage : public SfxTabPage
std::unique_ptr<weld::Label> mxFtWatermark;
std::unique_ptr<weld::Entry> mxEdWatermark;
std::unique_ptr<weld::Label> mxSlidesFt;
- std::unique_ptr<weld::Label> mxSheetsFt;
+ std::unique_ptr<weld::Label> mxSheetsSelectionFt;
DECL_LINK(ToggleAllHdl, weld::Toggleable&, void);
DECL_LINK(TogglePagesHdl, weld::Toggleable&, void);
+ DECL_LINK(ToggleSheetsHdl, weld::Toggleable&, void);
DECL_LINK(ToggleSelectionHdl, weld::Toggleable&, void);
DECL_LINK(ToggleCompressionHdl, weld::Toggleable&, void);
DECL_LINK(ToggleReduceImageResolutionHdl, weld::Toggleable&, void);
@@ -225,10 +235,18 @@ class ImpPDFTabGeneralPage : public SfxTabPage
DECL_LINK(ToggleExportNotesPagesHdl, weld::Toggleable&, void);
void TogglePagesHdl();
+ void ToggleSheetsHdl();
void EnableExportNotesPages();
DECL_LINK(TogglePDFVersionOrUniversalAccessibilityHandle, weld::Toggleable&, void);
+ std::shared_ptr<weld::MessageDialog> mxPasswordUnusedWarnDialog;
+
+ bool IsReadOnlyProperty(const OUString& rPropertyName) const
+ {
+ return mpParent && mpParent->maConfigItem.IsReadOnly(rPropertyName);
+ }
+
public:
ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -245,6 +263,8 @@ public:
/// Class tab page viewer
class ImpPDFTabOpnFtrPage : public SfxTabPage
{
+ friend class ImpPDFTabGeneralPage;
+
bool mbUseCTLFont;
std::unique_ptr<weld::RadioButton> mxRbOpnPageOnly;
@@ -267,6 +287,7 @@ class ImpPDFTabOpnFtrPage : public SfxTabPage
DECL_LINK(ToggleRbMagnHdl, weld::Toggleable&, void);
void ToggleRbPgLyContinueFacingHdl();
+ void ToggleInitialView(ImpPDFTabDialog & rParent);
public:
ImpPDFTabOpnFtrPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -275,7 +296,7 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
- void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+ void SetFilterConfigItem(ImpPDFTabDialog* pParent);
};
/// Class tab page viewer
@@ -340,6 +361,10 @@ class ImpPDFTabSecurityPage : public SfxTabPage
std::unique_ptr<weld::CheckButton> mxCbEnableCopy;
std::unique_ptr<weld::CheckButton> mxCbEnableAccessibility;
std::unique_ptr<weld::Label> mxPasswordTitle;
+ std::unique_ptr<weld::Label> mxPermissionTitle;
+
+ std::shared_ptr< SfxPasswordDialog > mpPasswordDialog;
+ std::shared_ptr< weld::MessageDialog > mpUnsupportedMsgDialog;
DECL_LINK(ClickmaPbSetPwdHdl, weld::Button&, void);
@@ -353,7 +378,7 @@ public:
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
- void ImplPDFASecurityControl( bool bEnableSecurity );
+ void ImplPDFASecurityControl();
bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
};
diff --git a/filter/source/pdf/pdfdecomposer.cxx b/filter/source/pdf/pdfdecomposer.cxx
index f861b4eaf86e..998f73dc1160 100644
--- a/filter/source/pdf/pdfdecomposer.cxx
+++ b/filter/source/pdf/pdfdecomposer.cxx
@@ -10,7 +10,7 @@
#include <vector>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
@@ -32,8 +32,7 @@ using namespace css;
namespace
{
/// Class to convert the PDF data into a XPrimitive2D (containing only a bitmap).
-class XPdfDecomposer
- : public ::cppu::WeakAggImplHelper2<graphic::XPdfDecomposer, lang::XServiceInfo>
+class XPdfDecomposer : public ::cppu::WeakImplHelper<graphic::XPdfDecomposer, lang::XServiceInfo>
{
public:
explicit XPdfDecomposer(uno::Reference<uno::XComponentContext> const& context);
@@ -82,17 +81,16 @@ 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{
- new drawinglayer::primitive2d::BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(aReplacement), aBitmapTransform)
+ new drawinglayer::primitive2d::BitmapPrimitive2D(aReplacement, aBitmapTransform)
}
.toSequence();
}
diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx
index 7c3e5dda1956..a5c9e8aaa007 100644
--- a/filter/source/pdf/pdfdialog.cxx
+++ b/filter/source/pdf/pdfdialog.cxx
@@ -62,6 +62,13 @@ std::unique_ptr<weld::DialogController> PDFDialog::createDialog(const css::uno::
return nullptr;
}
+std::shared_ptr<SfxTabDialogController> PDFDialog::createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
+{
+ if( mxSrcDoc.is() )
+ return std::make_shared<ImpPDFTabDialog>(Application::GetFrameWeld(rParent), maFilterData, mxSrcDoc);
+ return nullptr;
+}
+
void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
{
if (nExecutionResult && m_xDialog)
@@ -69,6 +76,24 @@ void PDFDialog::executedDialog( sal_Int16 nExecutionResult )
destroyDialog();
}
+void PDFDialog::runAsync(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener)
+{
+ SfxTabDialogController::runAsync(m_xAsyncDialog, [this, xListener](sal_Int32 nResponse) {
+ rtl::Reference<PDFDialog> xThis(this); // keep alive for scope, dialogClosed can cause owner to drop this
+ executedAsyncDialog( m_xAsyncDialog, nResponse );
+ css::ui::dialogs::DialogClosedEvent aEvent;
+ aEvent.DialogResult = nResponse;
+ xListener->dialogClosed( aEvent );
+ destroyAsyncDialog();
+ });
+}
+
+void PDFDialog::executedAsyncDialog( std::shared_ptr<SfxTabDialogController> xAsyncDialog, sal_Int32 nExecutionResult )
+{
+ if (nExecutionResult && xAsyncDialog)
+ maFilterData = static_cast<ImpPDFTabDialog*>(xAsyncDialog.get())->GetFilterData();
+}
+
Reference< XPropertySetInfo > SAL_CALL PDFDialog::getPropertySetInfo()
{
Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
@@ -113,7 +138,7 @@ void SAL_CALL PDFDialog::setPropertyValues( const Sequence< PropertyValue >& rPr
{
maMediaDescriptor = rProps;
- for( const PropertyValue& rProp : std::as_const(maMediaDescriptor) )
+ for (const PropertyValue& rProp : maMediaDescriptor)
{
if ( rProp.Name == "FilterData" )
{
diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx
index fcfd1d0976bd..2410192a2617 100644
--- a/filter/source/pdf/pdfdialog.hxx
+++ b/filter/source/pdf/pdfdialog.hxx
@@ -19,8 +19,6 @@
#pragma once
-#include <svtools/genericunodialog.hxx>
-
#include <comphelper/proparrhlp.hxx>
#include <cppuhelper/implbase.hxx>
@@ -28,12 +26,16 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <sfx2/tabdlg.hxx>
+#include <svtools/genericasyncunodialog.hxx>
+
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoDialog, XPropertyAccess, XExporter > PDFDialog_Base;
+typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoAsyncDialog<SfxTabDialogController>,
+ XPropertyAccess, XExporter > PDFDialog_Base;
class PDFDialog final:
public PDFDialog_Base,
@@ -54,6 +56,11 @@ private:
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ // OGenericUnoAsyncDialog
+ virtual std::shared_ptr<SfxTabDialogController> createAsyncDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override;
+ virtual void runAsync(const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener) override;
+ virtual void executedAsyncDialog(std::shared_ptr<SfxTabDialogController> xAsyncDialog, sal_Int32 nExecutionResult) override;
+
// XPropertyAccess
using OPropertySetHelper::getPropertyValues;
virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) override;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 604326b4bdbf..03ecbf576c56 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -22,11 +22,12 @@
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <tools/poly.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/resmgr.hxx>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/canvastools.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/gdimtf.hxx>
+#include <rtl/ustring.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/string.hxx>
@@ -36,8 +37,8 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <unotools/configmgr.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
+#include <comphelper/compbase.hxx>
+#include <officecfg/Office/Common.hxx>
#include "pdfexport.hxx"
#include <strings.hrc>
@@ -48,7 +49,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentProperties2.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
@@ -58,18 +59,22 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/sheet/XSheetRange.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>
+#include <rtl/bootstrap.hxx>
+#include <config_features.h>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::view;
-using namespace ::com::sun::star::graphic;
PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
@@ -80,59 +85,17 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
mxContext ( xContext ),
mxStatusIndicator ( rxStatusIndicator ),
mxIH ( rxIH ),
- mbUseTaggedPDF ( false ),
- mnPDFTypeSelection ( 0 ),
- mbPDFUACompliance ( false),
- mbExportNotes ( true ),
- mbExportPlaceholders ( false ),
- mbUseReferenceXObject ( false ),
- mbExportNotesPages ( false ),
- mbExportOnlyNotesPages ( false ),
- mbUseTransitionEffects ( true ),
- mbExportBookmarks ( true ),
- mbExportHiddenSlides ( false ),
- mbSinglePageSheets ( false ),
- mnOpenBookmarkLevels ( -1 ),
mbUseLosslessCompression ( false ),
mbReduceImageResolution ( true ),
mbSkipEmptyPages ( true ),
- mbAddStream ( false ),
mnMaxImageResolution ( 300 ),
mnQuality ( 80 ),
- mnFormsFormat ( 0 ),
- mbExportFormFields ( true ),
- mbAllowDuplicateFieldNames ( false ),
mnProgressValue ( 0 ),
mbRemoveTransparencies ( false ),
mbIsRedactMode ( false ),
-
- mbHideViewerToolbar ( false ),
- mbHideViewerMenubar ( false ),
- mbHideViewerWindowControls ( false ),
- mbFitWindow ( false ),
- mbCenterWindow ( false ),
- mbOpenInFullScreenMode ( false ),
- mbDisplayPDFDocumentTitle ( true ),
- mnPDFDocumentMode ( 0 ),
- mnPDFDocumentAction ( 0 ),
- mnZoom ( 100 ),
- mnInitialPage ( 1 ),
- mnPDFPageLayout ( 0 ),
-
- mbEncrypt ( false ),
- mbRestrictPermissions ( false ),
- mnPrintAllowed ( 2 ),
- mnChangesAllowed ( 4 ),
- mbCanCopyOrExtract ( true ),
- mbCanExtractForAccessibility( true ),
-
- // #i56629
- mbExportRelativeFsysLinks ( false ),
- mnDefaultLinkAction ( 0 ),
- mbConvertOOoTargetToPDFTarget( false ),
- mbExportBmkToDest ( false ),
- mbSignPDF ( false )
+ maWatermarkColor ( COL_LIGHTGREEN ),
+ maWatermarkFontName ( "Helvetica" )
{
}
@@ -307,19 +270,16 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream )
if( !xStore.is() )
return;
- Sequence< beans::PropertyValue > aArgs( 2 + (m_aPreparedPassword.hasElements() ? 1 : 0) );
- aArgs.getArray()[0].Name = "FilterName";
- aArgs.getArray()[1].Name = "OutputStream";
- aArgs.getArray()[1].Value <<= xStream;
- if( m_aPreparedPassword.hasElements() )
- {
- aArgs.getArray()[2].Name = "EncryptionData";
- aArgs.getArray()[2].Value <<= m_aPreparedPassword;
- }
+ std::vector<beans::PropertyValue> aArgs {
+ comphelper::makePropertyValue("FilterName", OUString()),
+ comphelper::makePropertyValue("OutputStream", xStream),
+ };
+ if (m_aPreparedPassword.hasElements())
+ aArgs.push_back(comphelper::makePropertyValue("EncryptionData", m_aPreparedPassword));
try
{
- xStore->storeToURL( "private:stream", aArgs );
+ xStore->storeToURL("private:stream", comphelper::containerToSequence(aArgs));
}
catch( const IOException& )
{
@@ -370,7 +330,7 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
Sequence< beans::PropertyValue > aFilterData;
xFilterFactory->getByName( aFilterName ) >>= aFilterData;
- for ( const beans::PropertyValue& rProp : std::as_const(aFilterData) )
+ for (const beans::PropertyValue& rProp : aFilterData)
if ( rProp.Name == "Type" )
rProp.Value >>= aTypeName;
@@ -383,7 +343,7 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC
Sequence< beans::PropertyValue > aTypeData;
xTypeDetection->getByName( aTypeName ) >>= aTypeData;
- for ( const beans::PropertyValue& rProp : std::as_const(aTypeData) )
+ for (const beans::PropertyValue& rProp : aTypeData)
if ( rProp.Name == "MediaType" )
rProp.Value >>= aDocMimetype;
}
@@ -398,6 +358,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 )
{
@@ -420,6 +399,53 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
if( xRenderable.is() )
{
+ // The defaults
+ bool bUseTaggedPDF = false;
+ sal_Int32 nPDFTypeSelection = 0;
+ bool bPDFUACompliance = false;
+ bool bExportNotes = true;
+ bool bExportNotesInMargin = false;
+ bool bExportNotesPages = false;
+ bool bExportOnlyNotesPages = false;
+ bool bUseTransitionEffects = true;
+ bool bExportFormFields = true;
+ sal_Int32 nFormsFormat = 0;
+ bool bAllowDuplicateFieldNames = false;
+ bool bHideViewerToolbar = false;
+ bool bHideViewerMenubar = false;
+ bool bHideViewerWindowControls = false;
+ bool bFitWindow = false;
+ bool bCenterWindow = false;
+ bool bOpenInFullScreenMode = false;
+ bool bDisplayPDFDocumentTitle = true;
+ sal_Int32 nPDFDocumentMode = 0;
+ sal_Int32 nPDFDocumentAction = 0;
+ sal_Int32 nZoom = 100;
+ sal_Int32 nInitialPage = 1;
+ sal_Int32 nPDFPageLayout = 0;
+ bool bAddStream = false;
+ bool bEncrypt = false;
+ bool bRestrictPermissions = false;
+ sal_Int32 nPrintAllowed = 2;
+ sal_Int32 nChangesAllowed = 4;
+ bool bCanCopyOrExtract = true;
+ bool bCanExtractForAccessibility = true;
+ // #i56629
+ bool bExportRelativeFsysLinks = false;
+ sal_Int32 nDefaultLinkAction = 0;
+ bool bConvertOOoTargetToPDFTarget = false;
+ bool bExportBmkToDest = false;
+ bool bExportBookmarks = true;
+ bool bExportHiddenSlides = false;
+ bool bSinglePageSheets = false;
+ sal_Int32 nOpenBookmarkLevels = -1;
+ bool bSignPDF = false;
+ OUString sSignLocation, sSignReason, sSignContact, sSignPassword;
+ css::uno::Reference<css::security::XCertificate> aSignCertificate;
+ OUString sSignTSA;
+ bool bExportPlaceholders = false;
+ bool bUseReferenceXObject = false;
+
rtl::Reference<VCLXDevice> xDevice(new VCLXDevice);
OUString aPageRange;
Any aSelection;
@@ -427,7 +453,11 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
OUString aOpenPassword, aPermissionPassword;
Reference< beans::XMaterialHolder > xEnc;
Sequence< beans::NamedValue > aPreparedPermissionPassword;
-
+ std::optional<PropertyValue> oMathTitleRow;
+ std::optional<PropertyValue> oMathFormulaText;
+ std::optional<PropertyValue> oMathBorder;
+ std::optional<PropertyValue> oMathPrintFormat;
+ std::optional<PropertyValue> oMathPrintScale;
// getting the string for the creator
OUString aCreator;
@@ -435,40 +465,74 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
if ( xInfo.is() )
{
if ( xInfo->supportsService( "com.sun.star.presentation.PresentationDocument" ) )
- aCreator += "Impress";
+ aCreator = u"Impress"_ustr;
else if ( xInfo->supportsService( "com.sun.star.drawing.DrawingDocument" ) )
- aCreator += "Draw";
+ aCreator = u"Draw"_ustr;
else if ( xInfo->supportsService( "com.sun.star.text.TextDocument" ) )
- aCreator += "Writer";
+ aCreator = u"Writer"_ustr;
else if ( xInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
- aCreator += "Calc";
+ aCreator = u"Calc"_ustr;
else if ( xInfo->supportsService( "com.sun.star.formula.FormulaProperties" ) )
- aCreator += "Math";
+ aCreator = u"Math"_ustr;
}
Reference< document::XDocumentPropertiesSupplier > xDocumentPropsSupplier( mxSrcDoc, UNO_QUERY );
if ( xDocumentPropsSupplier.is() )
{
- Reference< document::XDocumentProperties > xDocumentProps( xDocumentPropsSupplier->getDocumentProperties() );
+ Reference< document::XDocumentProperties2 > xDocumentProps( xDocumentPropsSupplier->getDocumentProperties(), UNO_QUERY );
if ( xDocumentProps.is() )
{
aContext.DocumentInfo.Title = xDocumentProps->getTitle();
aContext.DocumentInfo.Author = xDocumentProps->getAuthor();
aContext.DocumentInfo.Subject = xDocumentProps->getSubject();
aContext.DocumentInfo.Keywords = ::comphelper::string::convertCommaSeparated(xDocumentProps->getKeywords());
+ aContext.DocumentInfo.ModificationDate
+ = xDocumentProps->getEditingCycles() < 1
+ ? xDocumentProps->getCreationDate()
+ : xDocumentProps->getModificationDate();
+ aContext.DocumentInfo.Contributor = xDocumentProps->getContributor();
+ aContext.DocumentInfo.Coverage = xDocumentProps->getCoverage();
+ aContext.DocumentInfo.Identifier = xDocumentProps->getIdentifier();
+ aContext.DocumentInfo.Publisher = xDocumentProps->getPublisher();
+ aContext.DocumentInfo.Relation = xDocumentProps->getRelation();
+ aContext.DocumentInfo.Rights = xDocumentProps->getRights();
+ aContext.DocumentInfo.Source = xDocumentProps->getSource();
+ aContext.DocumentInfo.Type = xDocumentProps->getType();
}
}
- // getting the string for the producer
- aContext.DocumentInfo.Producer =
- utl::ConfigManager::getProductName() +
- " " +
- utl::ConfigManager::getProductVersion();
+
+ if (!comphelper::IsFuzzing())
+ {
+ OUString arch;
+ auto const ok = rtl::Bootstrap::get("_ARCH", arch);
+ assert(ok); (void) ok;
+ // getting the string for the producer
+ 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::getAboutBoxProductVersion() +
+ " (" + arch + ") / LibreOffice Community";
+ }
+
aContext.DocumentInfo.Creator = aCreator;
+ OUString aSignCertificateSubjectName;
for ( const beans::PropertyValue& rProp : rFilterData )
{
if ( rProp.Name == "PageRange" )
rProp.Value >>= aPageRange;
+ else if ( rProp.Name == "SheetRange" )
+ {
+ Reference< frame::XController > xController( Reference< frame::XModel >( mxSrcDoc, UNO_QUERY_THROW )->getCurrentController() );
+ Reference< sheet::XSheetRange > xView( xController, UNO_QUERY);
+ OUString aSheetRange;
+ rProp.Value >>= aSheetRange;
+ aSelection = xView->getSelectionFromString(aSheetRange);
+ }
else if ( rProp.Name == "Selection" )
aSelection = rProp.Value;
else if ( rProp.Name == "UseLosslessCompression" )
@@ -482,65 +546,99 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
else if ( rProp.Name == "MaxImageResolution" )
rProp.Value >>= mnMaxImageResolution;
else if ( rProp.Name == "UseTaggedPDF" )
- rProp.Value >>= mbUseTaggedPDF;
+ rProp.Value >>= bUseTaggedPDF;
else if ( rProp.Name == "SelectPdfVersion" )
- rProp.Value >>= mnPDFTypeSelection;
+ rProp.Value >>= nPDFTypeSelection;
else if ( rProp.Name == "PDFUACompliance" )
- rProp.Value >>= mbPDFUACompliance;
+ rProp.Value >>= bPDFUACompliance;
else if ( rProp.Name == "ExportNotes" )
- rProp.Value >>= mbExportNotes;
+ rProp.Value >>= bExportNotes;
+ else if ( rProp.Name == "ExportNotesInMargin" )
+ rProp.Value >>= bExportNotesInMargin;
else if ( rProp.Name == "ExportNotesPages" )
- rProp.Value >>= mbExportNotesPages;
+ rProp.Value >>= bExportNotesPages;
else if ( rProp.Name == "ExportOnlyNotesPages" )
- rProp.Value >>= mbExportOnlyNotesPages;
+ rProp.Value >>= bExportOnlyNotesPages;
else if ( rProp.Name == "UseTransitionEffects" )
- rProp.Value >>= mbUseTransitionEffects;
+ rProp.Value >>= bUseTransitionEffects;
else if ( rProp.Name == "ExportFormFields" )
- rProp.Value >>= mbExportFormFields;
+ rProp.Value >>= bExportFormFields;
else if ( rProp.Name == "FormsType" )
- rProp.Value >>= mnFormsFormat;
+ rProp.Value >>= nFormsFormat;
else if ( rProp.Name == "AllowDuplicateFieldNames" )
- rProp.Value >>= mbAllowDuplicateFieldNames;
+ rProp.Value >>= bAllowDuplicateFieldNames;
// viewer properties
else if ( rProp.Name == "HideViewerToolbar" )
- rProp.Value >>= mbHideViewerToolbar;
+ rProp.Value >>= bHideViewerToolbar;
else if ( rProp.Name == "HideViewerMenubar" )
- rProp.Value >>= mbHideViewerMenubar;
+ rProp.Value >>= bHideViewerMenubar;
else if ( rProp.Name == "HideViewerWindowControls" )
- rProp.Value >>= mbHideViewerWindowControls;
+ rProp.Value >>= bHideViewerWindowControls;
else if ( rProp.Name == "ResizeWindowToInitialPage" )
- rProp.Value >>= mbFitWindow;
+ rProp.Value >>= bFitWindow;
else if ( rProp.Name == "CenterWindow" )
- rProp.Value >>= mbCenterWindow;
+ rProp.Value >>= bCenterWindow;
else if ( rProp.Name == "OpenInFullScreenMode" )
- rProp.Value >>= mbOpenInFullScreenMode;
+ rProp.Value >>= bOpenInFullScreenMode;
else if ( rProp.Name == "DisplayPDFDocumentTitle" )
- rProp.Value >>= mbDisplayPDFDocumentTitle;
+ rProp.Value >>= bDisplayPDFDocumentTitle;
else if ( rProp.Name == "InitialView" )
- rProp.Value >>= mnPDFDocumentMode;
+ rProp.Value >>= nPDFDocumentMode;
else if ( rProp.Name == "Magnification" )
- rProp.Value >>= mnPDFDocumentAction;
+ rProp.Value >>= nPDFDocumentAction;
else if ( rProp.Name == "Zoom" )
- rProp.Value >>= mnZoom;
+ rProp.Value >>= nZoom;
else if ( rProp.Name == "InitialPage" )
- rProp.Value >>= mnInitialPage;
+ rProp.Value >>= nInitialPage;
else if ( rProp.Name == "PageLayout" )
- rProp.Value >>= mnPDFPageLayout;
+ rProp.Value >>= nPDFPageLayout;
else if ( rProp.Name == "FirstPageOnLeft" )
rProp.Value >>= aContext.FirstPageLeft;
else if ( rProp.Name == "IsAddStream" )
- rProp.Value >>= mbAddStream;
+ rProp.Value >>= bAddStream;
else if ( rProp.Name == "Watermark" )
rProp.Value >>= msWatermark;
+ else if ( rProp.Name == "WatermarkColor" )
+ {
+ sal_Int32 nColor{};
+ if (rProp.Value >>= nColor)
+ {
+ maWatermarkColor = Color(ColorTransparency, nColor);
+ }
+ }
+ else if (rProp.Name == "WatermarkFontHeight")
+ {
+ sal_Int32 nFontHeight{};
+ if (rProp.Value >>= nFontHeight)
+ {
+ moWatermarkFontHeight = nFontHeight;
+ }
+ }
+ else if (rProp.Name == "WatermarkRotateAngle")
+ {
+ sal_Int32 nRotateAngle{};
+ if (rProp.Value >>= nRotateAngle)
+ {
+ moWatermarkRotateAngle = Degree10(nRotateAngle);
+ }
+ }
+ else if (rProp.Name == "WatermarkFontName")
+ {
+ OUString aFontName{};
+ if (rProp.Value >>= aFontName)
+ {
+ maWatermarkFontName = aFontName;
+ }
+ }
else if ( rProp.Name == "TiledWatermark" )
rProp.Value >>= msTiledWatermark;
// now all the security related properties...
else if ( rProp.Name == "EncryptFile" )
- rProp.Value >>= mbEncrypt;
+ rProp.Value >>= bEncrypt;
else if ( rProp.Name == "DocumentOpenPassword" )
rProp.Value >>= aOpenPassword;
else if ( rProp.Name == "RestrictPermissions" )
- rProp.Value >>= mbRestrictPermissions;
+ rProp.Value >>= bRestrictPermissions;
else if ( rProp.Name == "PermissionPassword" )
rProp.Value >>= aPermissionPassword;
else if ( rProp.Name == "PreparedPasswords" )
@@ -548,81 +646,99 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
else if ( rProp.Name == "PreparedPermissionPassword" )
rProp.Value >>= aPreparedPermissionPassword;
else if ( rProp.Name == "Printing" )
- rProp.Value >>= mnPrintAllowed;
+ rProp.Value >>= nPrintAllowed;
else if ( rProp.Name == "Changes" )
- rProp.Value >>= mnChangesAllowed;
+ rProp.Value >>= nChangesAllowed;
else if ( rProp.Name == "EnableCopyingOfContent" )
- rProp.Value >>= mbCanCopyOrExtract;
+ rProp.Value >>= bCanCopyOrExtract;
else if ( rProp.Name == "EnableTextAccessForAccessibilityTools" )
- rProp.Value >>= mbCanExtractForAccessibility;
+ rProp.Value >>= bCanExtractForAccessibility;
// i56629 links extra (relative links and other related stuff)
else if ( rProp.Name == "ExportLinksRelativeFsys" )
- rProp.Value >>= mbExportRelativeFsysLinks;
+ rProp.Value >>= bExportRelativeFsysLinks;
else if ( rProp.Name == "PDFViewSelection" )
- rProp.Value >>= mnDefaultLinkAction;
+ rProp.Value >>= nDefaultLinkAction;
else if ( rProp.Name == "ConvertOOoTargetToPDFTarget" )
- rProp.Value >>= mbConvertOOoTargetToPDFTarget;
+ rProp.Value >>= bConvertOOoTargetToPDFTarget;
else if ( rProp.Name == "ExportBookmarksToPDFDestination" )
- rProp.Value >>= mbExportBmkToDest;
+ rProp.Value >>= bExportBmkToDest;
else if ( rProp.Name == "ExportBookmarks" )
- rProp.Value >>= mbExportBookmarks;
+ rProp.Value >>= bExportBookmarks;
else if ( rProp.Name == "ExportHiddenSlides" )
- rProp.Value >>= mbExportHiddenSlides;
+ rProp.Value >>= bExportHiddenSlides;
else if ( rProp.Name == "SinglePageSheets" )
- rProp.Value >>= mbSinglePageSheets;
+ rProp.Value >>= bSinglePageSheets;
else if ( rProp.Name == "OpenBookmarkLevels" )
- rProp.Value >>= mnOpenBookmarkLevels;
+ rProp.Value >>= nOpenBookmarkLevels;
else if ( rProp.Name == "SignPDF" )
- rProp.Value >>= mbSignPDF;
+ rProp.Value >>= bSignPDF;
else if ( rProp.Name == "SignatureLocation" )
- rProp.Value >>= msSignLocation;
+ rProp.Value >>= sSignLocation;
else if ( rProp.Name == "SignatureReason" )
- rProp.Value >>= msSignReason;
+ rProp.Value >>= sSignReason;
else if ( rProp.Name == "SignatureContactInfo" )
- rProp.Value >>= msSignContact;
+ rProp.Value >>= sSignContact;
else if ( rProp.Name == "SignaturePassword" )
- rProp.Value >>= msSignPassword;
+ rProp.Value >>= sSignPassword;
else if ( rProp.Name == "SignatureCertificate" )
- rProp.Value >>= maSignCertificate;
+ rProp.Value >>= aSignCertificate;
+ else if (rProp.Name == "SignCertificateSubjectName")
+ rProp.Value >>= aSignCertificateSubjectName;
else if ( rProp.Name == "SignatureTSA" )
- rProp.Value >>= msSignTSA;
+ rProp.Value >>= sSignTSA;
else if ( rProp.Name == "ExportPlaceholders" )
- rProp.Value >>= mbExportPlaceholders;
+ rProp.Value >>= bExportPlaceholders;
else if ( rProp.Name == "UseReferenceXObject" )
- rProp.Value >>= mbUseReferenceXObject;
+ rProp.Value >>= bUseReferenceXObject;
// Redaction & bitmap related stuff
else if ( rProp.Name == "IsRedactMode" )
rProp.Value >>= mbIsRedactMode;
+ // Math-specific render options
+ else if (rProp.Name == "TitleRow")
+ oMathTitleRow = rProp;
+ else if (rProp.Name == "FormulaText")
+ oMathFormulaText = rProp;
+ else if (rProp.Name == "Border")
+ oMathBorder = rProp;
+ else if (rProp.Name == "PrintFormat")
+ oMathPrintFormat = rProp;
+ else if (rProp.Name == "PrintScale")
+ oMathPrintScale = rProp;
+ }
+
+ if (!aSignCertificate.is() && !aSignCertificateSubjectName.isEmpty())
+ {
+ aSignCertificate = GetCertificateFromSubjectName(aSignCertificateSubjectName);
}
aContext.URL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
// set the correct version, depending on user request
- switch( mnPDFTypeSelection )
+ switch( nPDFTypeSelection )
{
default:
case 0:
- aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_6;
+ aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_7;
break;
case 1:
aContext.Version = vcl::PDFWriter::PDFVersion::PDF_A_1;
- mbUseTaggedPDF = true; // force the tagged PDF as well
+ bUseTaggedPDF = true; // force the tagged PDF as well
mbRemoveTransparencies = true; // does not allow transparencies
- mbEncrypt = false; // no encryption
+ bEncrypt = false; // no encryption
xEnc.clear();
break;
case 2:
aContext.Version = vcl::PDFWriter::PDFVersion::PDF_A_2;
- mbUseTaggedPDF = true; // force the tagged PDF as well
+ bUseTaggedPDF = true; // force the tagged PDF as well
mbRemoveTransparencies = false; // does allow transparencies
- mbEncrypt = false; // no encryption
+ bEncrypt = false; // no encryption
xEnc.clear();
break;
case 3:
aContext.Version = vcl::PDFWriter::PDFVersion::PDF_A_3;
- mbUseTaggedPDF = true; // force the tagged PDF as well
+ bUseTaggedPDF = true; // force the tagged PDF as well
mbRemoveTransparencies = false; // does allow transparencies
- mbEncrypt = false; // no encryption
+ bEncrypt = false; // no encryption
xEnc.clear();
break;
case 15:
@@ -631,30 +747,38 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
case 16:
aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_6;
break;
+ case 17:
+ aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_7;
+ break;
}
// PDF/UA support
- aContext.UniversalAccessibilityCompliance = mbPDFUACompliance;
- if (mbPDFUACompliance)
+ aContext.UniversalAccessibilityCompliance = bPDFUACompliance;
+ if (bPDFUACompliance)
{
- mbUseTaggedPDF = true;
+ // ISO 14289-1:2014, Clause: 7.1
+ bUseTaggedPDF = true;
+ // ISO 14289-1:2014, Clause: 7.16
+ bCanExtractForAccessibility = true;
+ // ISO 14289-1:2014, Clause: 7.20
+ bUseReferenceXObject = false;
}
// copy in context the values default in the constructor or set by the FilterData sequence of properties
- aContext.Tagged = mbUseTaggedPDF;
+ aContext.Tagged = bUseTaggedPDF;
// values used in viewer
- aContext.HideViewerToolbar = mbHideViewerToolbar;
- aContext.HideViewerMenubar = mbHideViewerMenubar;
- aContext.HideViewerWindowControls = mbHideViewerWindowControls;
- aContext.FitWindow = mbFitWindow;
- aContext.CenterWindow = mbCenterWindow;
- aContext.OpenInFullScreenMode = mbOpenInFullScreenMode;
- aContext.DisplayPDFDocumentTitle = mbDisplayPDFDocumentTitle;
- aContext.InitialPage = mnInitialPage-1;
- aContext.OpenBookmarkLevels = mnOpenBookmarkLevels;
-
- switch( mnPDFDocumentMode )
+ aContext.HideViewerToolbar = bHideViewerToolbar;
+ aContext.HideViewerMenubar = bHideViewerMenubar;
+ aContext.HideViewerWindowControls = bHideViewerWindowControls;
+ aContext.FitWindow = bFitWindow;
+ aContext.CenterWindow = bCenterWindow;
+ aContext.OpenInFullScreenMode = bOpenInFullScreenMode;
+ aContext.DisplayPDFDocumentTitle = bDisplayPDFDocumentTitle;
+ aContext.InitialPage = nInitialPage-1;
+ aContext.OpenBookmarkLevels = nOpenBookmarkLevels;
+
+ switch( nPDFDocumentMode )
{
default:
case 0:
@@ -667,7 +791,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aContext.PDFDocumentMode = vcl::PDFWriter::UseThumbs;
break;
}
- switch( mnPDFDocumentAction )
+ switch( nPDFDocumentAction )
{
default:
case 0:
@@ -684,11 +808,11 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
break;
case 4:
aContext.PDFDocumentAction = vcl::PDFWriter::ActionZoom;
- aContext.Zoom = mnZoom;
+ aContext.Zoom = nZoom;
break;
}
- switch( mnPDFPageLayout )
+ switch( nPDFPageLayout )
{
default:
case 0:
@@ -712,20 +836,20 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
{
// set check for permission change password
// if not enabled and no permission password, force permissions to default as if PDF where without encryption
- if( mbRestrictPermissions && (xEnc.is() || !aPermissionPassword.isEmpty()) )
+ if( bRestrictPermissions && (xEnc.is() || !aPermissionPassword.isEmpty()) )
{
- mbEncrypt = true; // permission set as desired, done after
+ bEncrypt = true; // permission set as desired, done after
}
else
{
// force permission to default
- mnPrintAllowed = 2 ;
- mnChangesAllowed = 4 ;
- mbCanCopyOrExtract = true;
- mbCanExtractForAccessibility = true ;
+ nPrintAllowed = 2 ;
+ nChangesAllowed = 4 ;
+ bCanCopyOrExtract = true;
+ bCanExtractForAccessibility = true ;
}
- switch( mnPrintAllowed )
+ switch( nPrintAllowed )
{
case 0: // initialized when aContext is build, means no printing
break;
@@ -738,7 +862,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
break;
}
- switch( mnChangesAllowed )
+ switch( nChangesAllowed )
{
case 0: // already in struct PDFSecPermissions CTOR
break;
@@ -760,11 +884,11 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
break;
}
- aContext.Encryption.CanCopyOrExtract = mbCanCopyOrExtract;
- aContext.Encryption.CanExtractForAccessibility = mbCanExtractForAccessibility;
- if( mbEncrypt && ! xEnc.is() )
+ aContext.Encryption.CanCopyOrExtract = bCanCopyOrExtract;
+ aContext.Encryption.CanExtractForAccessibility = bCanExtractForAccessibility;
+ if( bEncrypt && ! xEnc.is() )
xEnc = vcl::PDFWriter::InitEncryption( aPermissionPassword, aOpenPassword );
- if( mbEncrypt && !aPermissionPassword.isEmpty() && ! aPreparedPermissionPassword.hasElements() )
+ if( bEncrypt && !aPermissionPassword.isEmpty() && ! aPreparedPermissionPassword.hasElements() )
aPreparedPermissionPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aPermissionPassword );
}
// after this point we don't need the legacy clear passwords anymore
@@ -777,7 +901,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
* FIXME: the entries are only implicitly defined by the resource file. Should there
* ever be an additional form submit format this could get invalid.
*/
- switch( mnFormsFormat )
+ switch( nFormsFormat )
{
case 1:
aContext.SubmitFormat = vcl::PDFWriter::PDF;
@@ -793,7 +917,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aContext.SubmitFormat = vcl::PDFWriter::FDF;
break;
}
- aContext.AllowDuplicateFieldNames = mbAllowDuplicateFieldNames;
+ aContext.AllowDuplicateFieldNames = bAllowDuplicateFieldNames;
// get model
Reference< frame::XModel > xModel( mxSrcDoc, UNO_QUERY );
@@ -802,9 +926,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
// set the base URL of the file: then base URL
aContext.BaseURL = xModel->getURL();
// relative link option is private to PDF Export filter and limited to local filesystem only
- aContext.RelFsys = mbExportRelativeFsysLinks;
- // determine the default acton for PDF links
- switch( mnDefaultLinkAction )
+ aContext.RelFsys = bExportRelativeFsysLinks;
+ // determine the default action for PDF links
+ switch( nDefaultLinkAction )
{
default:
// default: URI, without fragment conversion (the bookmark in PDF may not work)
@@ -821,7 +945,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aContext.DefaultLinkAction = vcl::PDFWriter::URIActionDestination;
break;
}
- aContext.ConvertOOoTargetToPDFTarget = mbConvertOOoTargetToPDFTarget;
+ aContext.ConvertOOoTargetToPDFTarget = bConvertOOoTargetToPDFTarget;
// check for Link Launch action, not allowed on PDF/A-1
// this code chunk checks when the filter is called from scripting
@@ -835,14 +959,14 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
}
}
- aContext.SignPDF = mbSignPDF;
- aContext.SignLocation = msSignLocation;
- aContext.SignContact = msSignContact;
- aContext.SignReason = msSignReason;
- aContext.SignPassword = msSignPassword;
- aContext.SignCertificate = maSignCertificate;
- aContext.SignTSA = msSignTSA;
- aContext.UseReferenceXObject = mbUseReferenceXObject;
+ aContext.SignPDF = bSignPDF;
+ aContext.SignLocation = sSignLocation;
+ aContext.SignContact = sSignContact;
+ aContext.SignReason = sSignReason;
+ aContext.SignPassword = sSignPassword;
+ aContext.SignCertificate = aSignCertificate;
+ aContext.SignTSA = sSignTSA;
+ aContext.UseReferenceXObject = bUseReferenceXObject;
// all context data set, time to create the printing device
vcl::PDFWriter aPDFWriter( aContext, xEnc );
@@ -851,14 +975,22 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
DBG_ASSERT( pOut, "PDFExport::Export: no reference device" );
xDevice->SetOutputDevice(pOut);
- if( mbAddStream )
+ if( bAddStream )
{
// export stream
// get mimetype
OUString aSrcMimetype = getMimetypeForDocument( mxContext, mxSrcDoc );
- aPDFWriter.AddStream( aSrcMimetype,
- new PDFExportStreamDoc( mxSrcDoc, aPreparedPermissionPassword )
- );
+ OUString aExt;
+ if (aSrcMimetype == "application/vnd.oasis.opendocument.text")
+ aExt = ".odt";
+ else if (aSrcMimetype == "application/vnd.oasis.opendocument.presentation")
+ aExt = ".odp";
+ else if (aSrcMimetype == "application/vnd.oasis.opendocument.spreadsheet")
+ aExt = ".ods";
+ else if (aSrcMimetype == "application/vnd.oasis.opendocument.graphics")
+ aExt = ".odg";
+ std::unique_ptr<vcl::PDFOutputStream> pStream(new PDFExportStreamDoc(mxSrcDoc, aPreparedPermissionPassword));
+ aPDFWriter.AddAttachedFile("Original" + aExt, aSrcMimetype, u"Embedded original document of this PDF file"_ustr, std::move(pStream));
}
if ( pOut )
@@ -866,28 +998,41 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
DBG_ASSERT( pOut->GetExtOutDevData() == nullptr, "PDFExport: ExtOutDevData already set!!!" );
vcl::PDFExtOutDevData aPDFExtOutDevData( *pOut );
pOut->SetExtOutDevData( &aPDFExtOutDevData );
- aPDFExtOutDevData.SetIsExportNotes( mbExportNotes );
- aPDFExtOutDevData.SetIsExportTaggedPDF( mbUseTaggedPDF );
- aPDFExtOutDevData.SetIsExportTransitionEffects( mbUseTransitionEffects );
- aPDFExtOutDevData.SetIsExportFormFields( mbExportFormFields );
- aPDFExtOutDevData.SetIsExportBookmarks( mbExportBookmarks );
- aPDFExtOutDevData.SetIsExportHiddenSlides( mbExportHiddenSlides );
- aPDFExtOutDevData.SetIsSinglePageSheets( mbSinglePageSheets );
+ aPDFExtOutDevData.SetIsExportNotes( bExportNotes );
+ aPDFExtOutDevData.SetIsExportNotesInMargin( bExportNotesInMargin );
+ aPDFExtOutDevData.SetIsExportTaggedPDF( bUseTaggedPDF );
+ aPDFExtOutDevData.SetIsExportTransitionEffects( bUseTransitionEffects );
+ aPDFExtOutDevData.SetIsExportFormFields( bExportFormFields );
+ aPDFExtOutDevData.SetIsExportBookmarks( bExportBookmarks );
+ aPDFExtOutDevData.SetIsExportHiddenSlides( bExportHiddenSlides );
+ aPDFExtOutDevData.SetIsSinglePageSheets( bSinglePageSheets );
aPDFExtOutDevData.SetIsLosslessCompression( mbUseLosslessCompression );
aPDFExtOutDevData.SetCompressionQuality( mnQuality );
aPDFExtOutDevData.SetIsReduceImageResolution( mbReduceImageResolution );
- aPDFExtOutDevData.SetIsExportNamedDestinations( mbExportBmkToDest );
+ aPDFExtOutDevData.SetIsExportNamedDestinations( bExportBmkToDest );
- Sequence< PropertyValue > aRenderOptions{
+ std::vector<PropertyValue> aRenderOptionsVector{
comphelper::makePropertyValue("RenderDevice", uno::Reference<awt::XDevice>(xDevice)),
comphelper::makePropertyValue("ExportNotesPages", false),
comphelper::makePropertyValue("IsFirstPage", true),
comphelper::makePropertyValue("IsLastPage", false),
comphelper::makePropertyValue("IsSkipEmptyPages", mbSkipEmptyPages),
comphelper::makePropertyValue("PageRange", aPageRange),
- comphelper::makePropertyValue("ExportPlaceholders", mbExportPlaceholders),
- comphelper::makePropertyValue("SinglePageSheets", mbSinglePageSheets)
+ comphelper::makePropertyValue("ExportPlaceholders", bExportPlaceholders),
+ comphelper::makePropertyValue("SinglePageSheets", bSinglePageSheets),
+ comphelper::makePropertyValue("ExportNotesInMargin", bExportNotesInMargin)
};
+ if (oMathTitleRow)
+ aRenderOptionsVector.push_back(*oMathTitleRow);
+ if (oMathFormulaText)
+ aRenderOptionsVector.push_back(*oMathFormulaText);
+ if (oMathBorder)
+ aRenderOptionsVector.push_back(*oMathBorder);
+ if (oMathPrintFormat)
+ aRenderOptionsVector.push_back(*oMathPrintFormat);
+ if (oMathPrintScale)
+ aRenderOptionsVector.push_back(*oMathPrintScale);
+ Sequence aRenderOptions = comphelper::containerToSequence(aRenderOptionsVector);
Any& rExportNotesValue = aRenderOptions.getArray()[ 1 ].Value;
if( !aPageRange.isEmpty() || !aSelection.hasValue() )
@@ -895,11 +1040,10 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aSelection = Any();
aSelection <<= mxSrcDoc;
}
- bool bExportNotesPages = false;
bool bReChangeToNormalView = false;
- static const OUStringLiteral sShowOnlineLayout( u"ShowOnlineLayout" );
+ static constexpr OUString sShowOnlineLayout( u"ShowOnlineLayout"_ustr );
bool bReHideWhitespace = false;
- static const OUStringLiteral sHideWhitespace(u"HideWhitespace");
+ static constexpr OUString sHideWhitespace(u"HideWhitespace"_ustr);
uno::Reference< beans::XPropertySet > xViewProperties;
if ( aCreator == "Writer" )
@@ -912,14 +1056,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& )
@@ -930,15 +1074,17 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
const sal_Int32 nPageCount = xRenderable->getRendererCount( aSelection, aRenderOptions );
- if ( mbExportNotesPages && aCreator == "Impress" )
+ if ( bExportNotesPages && aCreator == "Impress" )
{
uno::Reference< drawing::XShapes > xShapes; // do not allow to export notes when exporting a selection
- if ( ! ( aSelection >>= xShapes ) )
- bExportNotesPages = true;
+ if ( aSelection >>= xShapes )
+ bExportNotesPages = false;
}
- const bool bExportPages = !bExportNotesPages || !mbExportOnlyNotesPages;
+ else
+ bExportNotesPages = false;
+ const bool bExportPages = !bExportNotesPages || !bExportOnlyNotesPages;
- if( aPageRange.isEmpty() || mbSinglePageSheets)
+ if( aPageRange.isEmpty() || bSinglePageSheets)
{
aPageRange = OUString::number( 1 ) + "-" + OUString::number(nPageCount );
}
@@ -946,11 +1092,10 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
if ( mxStatusIndicator.is() )
{
- std::locale loc(Translate::Create("flt"));
sal_Int32 nTotalPageCount = aRangeEnum.size();
if ( bExportPages && bExportNotesPages )
nTotalPageCount *= 2;
- mxStatusIndicator->start(Translate::get(PDF_PROGRESS_BAR, loc), nTotalPageCount);
+ mxStatusIndicator->start(FilterResId(PDF_PROGRESS_BAR), nTotalPageCount);
}
bRet = nPageCount > 0;
@@ -982,7 +1127,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 +1137,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& )
{
@@ -1012,14 +1157,13 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
namespace
{
-typedef cppu::WeakComponentImplHelper< task::XInteractionRequest > PDFErrorRequestBase;
+typedef comphelper::WeakComponentImplHelper< task::XInteractionRequest > PDFErrorRequestBase;
-class PDFErrorRequest : private cppu::BaseMutex,
- public PDFErrorRequestBase
+class PDFErrorRequest : public PDFErrorRequestBase
{
task::PDFExportException maExc;
public:
- explicit PDFErrorRequest( const task::PDFExportException& i_rExc );
+ explicit PDFErrorRequest( task::PDFExportException aExc );
// XInteractionRequest
virtual uno::Any SAL_CALL getRequest() override;
@@ -1027,16 +1171,15 @@ public:
};
-PDFErrorRequest::PDFErrorRequest( const task::PDFExportException& i_rExc ) :
- PDFErrorRequestBase( m_aMutex ),
- maExc( i_rExc )
+PDFErrorRequest::PDFErrorRequest( task::PDFExportException aExc ) :
+ maExc(std::move( aExc ))
{
}
uno::Any SAL_CALL PDFErrorRequest::getRequest()
{
- osl::MutexGuard const guard( m_aMutex );
+ std::unique_lock guard( m_aMutex );
uno::Any aRet;
aRet <<= maExc;
@@ -1058,7 +1201,7 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors
{
task::PDFExportException aExc;
aExc.ErrorCodes = comphelper::containerToSequence<sal_Int32>( rErrors );
- Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( aExc ) );
+ Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( std::move(aExc) ) );
mxIH->handle( xReq );
}
}
@@ -1087,7 +1230,7 @@ void PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
// Throw them all away in the absence of a way to reposition them to new positions of
// their replacements.
if (aCtx.m_bTransparenciesWereRemoved)
- rPDFExtOutDevData.ResetSyncData();
+ rPDFExtOutDevData.ResetSyncData(&rWriter);
}
else
{
@@ -1103,7 +1246,7 @@ void PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
rWriter.PlayMetafile( aMtf, aCtx, &rPDFExtOutDevData );
- rPDFExtOutDevData.ResetSyncData();
+ rPDFExtOutDevData.ResetSyncData(nullptr);
if (!msWatermark.isEmpty())
{
@@ -1118,7 +1261,7 @@ void PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData&
void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize )
{
- vcl::Font aFont( "Helvetica", Size( 0, 3*rPageSize.Height()/4 ) );
+ vcl::Font aFont( maWatermarkFontName, Size( 0, moWatermarkFontHeight ? *moWatermarkFontHeight : 3*rPageSize.Height()/4 ) );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_NORMAL );
aFont.SetWeight( WEIGHT_NORMAL );
@@ -1130,25 +1273,43 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
aFont.SetOrientation( 2700_deg10 );
}
+ if (moWatermarkRotateAngle)
+ {
+ aFont.SetOrientation(*moWatermarkRotateAngle);
+ if (rPageSize.Width() < rPageSize.Height())
+ {
+ // Set text width based on the shorter side, so rotation can't push text outside the
+ // page boundaries.
+ nTextWidth = rPageSize.Width();
+ }
+ }
+
// adjust font height for text to fit
OutputDevice* pDev = rWriter.GetReferenceDevice();
pDev->Push();
pDev->SetFont( aFont );
pDev->SetMapMode( MapMode( MapUnit::MapPoint ) );
int w = 0;
- while( ( w = pDev->GetTextWidth( msWatermark ) ) > nTextWidth )
+ if (moWatermarkFontHeight)
{
- if (w == 0)
- break;
- tools::Long nNewHeight = aFont.GetFontHeight() * nTextWidth / w;
- if( nNewHeight == aFont.GetFontHeight() )
+ w = pDev->GetTextWidth(msWatermark);
+ }
+ else
+ {
+ while( ( w = pDev->GetTextWidth( msWatermark ) ) > nTextWidth )
{
- nNewHeight--;
- if( nNewHeight <= 0 )
+ if (w == 0)
break;
+ tools::Long nNewHeight = aFont.GetFontHeight() * nTextWidth / w;
+ if( nNewHeight == aFont.GetFontHeight() )
+ {
+ nNewHeight--;
+ if( nNewHeight <= 0 )
+ break;
+ }
+ aFont.SetFontHeight( nNewHeight );
+ pDev->SetFont( aFont );
}
- aFont.SetFontHeight( nNewHeight );
- pDev->SetFont( aFont );
}
tools::Long nTextHeight = pDev->GetTextHeight();
// leave some maneuvering room for rounding issues, also
@@ -1157,9 +1318,18 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
pDev->Pop();
rWriter.Push();
+ // tdf#152235 tag around the reference to the XObject on the page
+ sal_Int32 const id = rWriter.EnsureStructureElement();
+ rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ rWriter.BeginStructureElement(id);
+ rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination);
+ rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark);
+ // HACK: this should produce *nothing* itself but is necessary to output
+ // the Artifact tag here, not inside the XObject
+ rWriter.DrawPolyLine({});
rWriter.SetMapMode( MapMode( MapUnit::MapPoint ) );
rWriter.SetFont( aFont );
- rWriter.SetTextColor( COL_LIGHTGREEN );
+ rWriter.SetTextColor(maWatermarkColor);
Point aTextPoint;
tools::Rectangle aTextRect;
if( rPageSize.Width() > rPageSize.Height() )
@@ -1176,10 +1346,30 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
(rPageSize.Height()-w)/2 );
aTextRect = tools::Rectangle( aTextPoint, Size( nTextHeight, w ) );
}
+
+ if (moWatermarkRotateAngle)
+ {
+ // First set the text's starting point to the center of the page.
+ tools::Rectangle aPageRectangle(Point(0, 0), rPageSize);
+ aTextPoint = aPageRectangle.Center();
+ // Then adjust it so that the text remains centered, based on the rotation angle.
+ basegfx::B2DPolygon aTextPolygon
+ = basegfx::utils::createPolygonFromRect(basegfx::B2DRectangle(0, -nTextHeight, w, 0));
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.rotate(-1 * toRadians(*moWatermarkRotateAngle));
+ aTextPolygon.transform(aMatrix);
+ basegfx::B2DPoint aPolygonCenter = aTextPolygon.getB2DRange().getCenter();
+ aTextPoint.AdjustX(-aPolygonCenter.getX());
+ aTextPoint.AdjustY(-aPolygonCenter.getY());
+
+ aTextRect = aPageRectangle;
+ }
+
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.DrawText( aTextPoint, msWatermark );
rWriter.EndTransparencyGroup( aTextRect, 50 );
+ rWriter.EndStructureElement();
rWriter.Pop();
}
@@ -1226,6 +1416,15 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
pDev->Pop();
rWriter.Push();
+ // tdf#152235 tag around the reference to the XObject on the page
+ sal_Int32 const id = rWriter.EnsureStructureElement();
+ rWriter.InitStructureElement(id, vcl::PDFWriter::NonStructElement, ::std::u16string_view());
+ rWriter.BeginStructureElement(id);
+ rWriter.SetStructureAttribute(vcl::PDFWriter::Type, vcl::PDFWriter::Pagination);
+ rWriter.SetStructureAttribute(vcl::PDFWriter::Subtype, vcl::PDFWriter::Watermark);
+ // HACK: this should produce *nothing* itself but is necessary to output
+ // the Artifact tag here, not inside the XObject
+ rWriter.DrawPolyLine({});
rWriter.SetMapMode( MapMode( MapUnit::MapPoint ) );
rWriter.SetFont(aFont);
rWriter.SetTextColor( Color(19,20,22) );
@@ -1261,6 +1460,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
aTextPoint.Move( nTextWidth*1.5, 0 );
}
+ rWriter.EndStructureElement();
rWriter.Pop();
}
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index 967668e7421b..8bfd1c363038 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -35,109 +35,56 @@ 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;
-
- bool mbUseTaggedPDF;
- sal_Int32 mnPDFTypeSelection;
- bool mbPDFUACompliance;
- bool mbExportNotes;
- bool mbExportPlaceholders;
- bool mbUseReferenceXObject;
- bool mbExportNotesPages;
- bool mbExportOnlyNotesPages;
- bool mbUseTransitionEffects;
- bool mbExportBookmarks;
- bool mbExportHiddenSlides;
- bool mbSinglePageSheets;
- sal_Int32 mnOpenBookmarkLevels;
+ 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 mbUseLosslessCompression;
bool mbReduceImageResolution;
bool mbSkipEmptyPages;
- bool mbAddStream;
sal_Int32 mnMaxImageResolution;
sal_Int32 mnQuality;
- sal_Int32 mnFormsFormat;
- bool mbExportFormFields;
- bool mbAllowDuplicateFieldNames;
sal_Int32 mnProgressValue;
bool mbRemoveTransparencies;
bool mbIsRedactMode;
OUString msWatermark;
+ Color maWatermarkColor;
+ std::optional<sal_Int32> moWatermarkFontHeight;
+ OUString maWatermarkFontName;
+ std::optional<Degree10> moWatermarkRotateAngle;
OUString msTiledWatermark;
- // these variable are here only to have a location in filter/pdf to set the default
- // to be used by the macro (when the FilterData are set by the macro itself)
- bool mbHideViewerToolbar;
- bool mbHideViewerMenubar;
- bool mbHideViewerWindowControls;
- bool mbFitWindow;
- bool mbCenterWindow;
- bool mbOpenInFullScreenMode;
- bool mbDisplayPDFDocumentTitle;
- sal_Int32 mnPDFDocumentMode;
- sal_Int32 mnPDFDocumentAction;
- sal_Int32 mnZoom;
- sal_Int32 mnInitialPage;
- sal_Int32 mnPDFPageLayout;
-
- bool mbEncrypt;
- bool mbRestrictPermissions;
- sal_Int32 mnPrintAllowed;
- sal_Int32 mnChangesAllowed;
- bool mbCanCopyOrExtract;
- bool mbCanExtractForAccessibility;
-
- // #i56629
- bool mbExportRelativeFsysLinks;
- sal_Int32 mnDefaultLinkAction;
- bool mbConvertOOoTargetToPDFTarget;
- bool mbExportBmkToDest;
void ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& rPDFExtOutDevData,
const GDIMetaFile& rMtf );
- bool mbSignPDF;
- OUString msSignLocation;
- OUString msSignContact;
- OUString msSignReason;
- OUString msSignPassword;
- Reference< 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..dcfc918bbdd0 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -26,10 +26,16 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/tempfile.hxx>
#include <vcl/FilterConfigItem.hxx>
+#include <vcl/glyphitemcache.hxx>
#include <memory>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/propertysequence.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <boost/property_tree/json_parser/error.hpp>
+
using namespace ::com::sun::star::io;
PDFFilter::PDFFilter( const Reference< XComponentContext > &rxContext ) :
@@ -47,29 +53,42 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
{
Reference< XOutputStream > xOStm;
Sequence< PropertyValue > aFilterData;
- sal_Int32 nLength = rDescriptor.getLength();
- const PropertyValue* pValue = rDescriptor.getConstArray();
+ OUString aFilterOptions;
bool bIsRedactMode = false;
bool bRet = false;
Reference< task::XStatusIndicator > xStatusIndicator;
Reference< task::XInteractionHandler > xIH;
- for (sal_Int32 i = 0; i < nLength; ++i)
+ for (const auto& rValue : rDescriptor)
{
- if ( pValue[ i ].Name == "OutputStream" )
- pValue[ i ].Value >>= xOStm;
- else if ( pValue[ i ].Name == "FilterData" )
- pValue[ i ].Value >>= aFilterData;
- else if ( pValue[ i ].Name == "StatusIndicator" )
- pValue[ i ].Value >>= xStatusIndicator;
- else if ( pValue[i].Name == "InteractionHandler" )
- pValue[i].Value >>= xIH;
+ if (rValue.Name == "OutputStream")
+ rValue.Value >>= xOStm;
+ else if (rValue.Name == "FilterData")
+ rValue.Value >>= aFilterData;
+ else if (rValue.Name == "FilterOptions")
+ rValue.Value >>= aFilterOptions;
+ else if (rValue.Name == "StatusIndicator")
+ rValue.Value >>= xStatusIndicator;
+ else if (rValue.Name == "InteractionHandler")
+ rValue.Value >>= xIH;
+ else if (rValue.Name == "IsRedactMode")
+ rValue.Value >>= bIsRedactMode;
}
- for (sal_Int32 i = 0 ; i < nLength; ++i)
+ if (!aFilterData.hasElements() && aFilterOptions.startsWith("{"))
{
- if ( pValue[i].Name == "IsRedactMode")
- pValue[i].Value >>= bIsRedactMode;
+ try
+ {
+ // Allow setting filter data keys from the cmdline.
+ std::vector<PropertyValue> aData
+ = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8());
+ aFilterData = comphelper::containerToSequence(aData);
+ }
+ catch (const boost::property_tree::json_parser::json_parser_error& e)
+ {
+ // This wasn't a valid json; maybe came from import filter (tdf#150846)
+ SAL_WARN("filter.pdf", "error parsing FilterOptions: " << e.message());
+ }
}
/* we don't get FilterData if we are exporting directly
@@ -85,6 +104,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
aCfgItem.ReadInt32( "SelectPdfVersion", 0 );
aCfgItem.ReadBool("PDFUACompliance", false);
aCfgItem.ReadBool( "ExportNotes", false );
+ aCfgItem.ReadBool( "ExportNotesInMargin", false );
aCfgItem.ReadBool( "ExportPlaceholders", false );
aCfgItem.ReadBool( "ExportNotesPages", false );
aCfgItem.ReadBool( "ExportOnlyNotesPages", false );
@@ -155,7 +175,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
if( mxSrcDoc.is() && xOStm.is() )
{
PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxContext );
- ::utl::TempFile aTempFile;
+ ::utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
bRet = aExport.Export( aTempFile.GetURL(), aFilterData );
@@ -221,8 +241,12 @@ sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescripto
{
FocusWindowWaitCursor aCur;
+ SalLayoutGlyphsCache::self()->SetCacheGlyphsWhenDoingFallbackFonts(true);
+
const bool bRet = implExport( rDescriptor );
+ SalLayoutGlyphsCache::self()->SetCacheGlyphsWhenDoingFallbackFonts(false);
+
return bRet;
}
diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx
index f45edd6cb5b6..1d0d7557d273 100644
--- a/filter/source/storagefilterdetect/filterdetect.cxx
+++ b/filter/source/storagefilterdetect/filterdetect.cxx
@@ -31,6 +31,9 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <utility>
+
+#include <comphelper/lok.hxx>
using namespace ::com::sun::star;
using utl::MediaDescriptor;
@@ -75,8 +78,8 @@ OUString getInternalFromMediaType(std::u16string_view aMediaType)
}
-StorageFilterDetect::StorageFilterDetect(const uno::Reference<uno::XComponentContext>& xCxt) :
- mxCxt(xCxt) {}
+StorageFilterDetect::StorageFilterDetect(uno::Reference<uno::XComponentContext> xCxt) :
+ mxCxt(std::move(xCxt)) {}
StorageFilterDetect::~StorageFilterDetect() {}
@@ -102,6 +105,11 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue
OUString aMediaType;
xStorageProperties->getPropertyValue( "MediaType" ) >>= aMediaType;
aTypeName = getInternalFromMediaType( aMediaType );
+ if (comphelper::LibreOfficeKit::isActive() && aTypeName == "draw8_template")
+ {
+ // save it as draw8 instead of template format
+ aTypeName = "draw8";
+ }
}
catch( const lang::WrappedTargetException& aWrap )
@@ -113,42 +121,44 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue
if ( ( aWrap.TargetException >>= aZipException ) && !aRequestedTypeName.isEmpty() )
{
// The package is a broken one.
- uno::Reference< task::XInteractionHandler > xInteraction =
- aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() );
-
- if ( xInteraction.is() )
+ INetURLObject aParser(
+ aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString()));
+ OUString aDocumentTitle = aParser.getName(INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::DecodeMechanism::WithCharset);
+ bool bRepairPackage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
+ // fdo#46310 Don't ask to repair if the user rejected it once.
+ if (!bRepairPackage && aMediaDesc.getUnpackedValueOrDefault("RepairAllowed", true))
{
- INetURLObject aParser( aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL, OUString() ) );
- OUString aDocumentTitle = aParser.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
- bool bRepairPackage = aMediaDesc.getUnpackedValueOrDefault( "RepairPackage", false );
- // fdo#46310 Don't try to repair if the user rejected it once.
- bool bRepairAllowed = aMediaDesc.getUnpackedValueOrDefault( "RepairAllowed", true );
+ uno::Reference< task::XInteractionHandler > xInteraction =
+ aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() );
- if ( !bRepairPackage && bRepairAllowed )
+ if ( xInteraction.is() )
{
// Ask the user whether he wants to try to repair.
- RequestPackageReparation aRequest( aDocumentTitle );
- xInteraction->handle( aRequest.GetRequest() );
-
- if ( aRequest.isApproved() )
- {
- aTypeName = aRequestedTypeName;
- aMediaDesc[MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle;
- aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= true;
- aMediaDesc["RepairPackage"] <<= true;
- }
- else
+ RequestPackageReparation aRequest(aDocumentTitle);
+ xInteraction->handle(aRequest.GetRequest());
+ bRepairPackage = aRequest.isApproved();
+ if (!bRepairPackage)
{
// Repair either not allowed or not successful.
NotifyBrokenPackage aNotifyRequest( aDocumentTitle );
xInteraction->handle( aNotifyRequest.GetRequest() );
aMediaDesc["RepairAllowed"] <<= false;
}
-
- // Write the changes back.
- aMediaDesc >> rDescriptor;
}
}
+ if (bRepairPackage)
+ {
+ aTypeName = aRequestedTypeName;
+ // lok: we want to overwrite file in jail, so don't use template flag
+ const bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+ aMediaDesc[MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle;
+ aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= !bIsLOK;
+ aMediaDesc["RepairPackage"] <<= true;
+ }
+
+ // Write the changes back.
+ aMediaDesc >> rDescriptor;
}
}
catch( uno::RuntimeException& )
diff --git a/filter/source/storagefilterdetect/filterdetect.hxx b/filter/source/storagefilterdetect/filterdetect.hxx
index 0b7849f2d979..052e2c2ffd80 100644
--- a/filter/source/storagefilterdetect/filterdetect.hxx
+++ b/filter/source/storagefilterdetect/filterdetect.hxx
@@ -35,7 +35,7 @@ class StorageFilterDetect : public cppu::WeakImplHelper<
public:
- explicit StorageFilterDetect (const css::uno::Reference<css::uno::XComponentContext>& xCxt);
+ explicit StorageFilterDetect (css::uno::Reference<css::uno::XComponentContext> xCxt);
virtual ~StorageFilterDetect() override;
// XExtendedFilterDetection
diff --git a/filter/source/svg/gentoken.py b/filter/source/svg/gentoken.py
index c78d066d7c97..2ef75fe5dd80 100644
--- a/filter/source/svg/gentoken.py
+++ b/filter/source/svg/gentoken.py
@@ -37,7 +37,7 @@ with open(tokenfile_name) as tokenfile:
tokens[arr[0]] = arr[1].upper()
hxx = open(hxx_name, 'w')
-gperf = open(gperf_name, 'w')
+gperf = open(gperf_name, 'w', newline='\n')
gperf.write(gperf_header)
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 636fc3a50d37..fa42b89b2f8e 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -763,7 +763,7 @@ function getDistance(p1, p2, props) {
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
- return Math.sqrt((x * x) + (y * y));
+ return Math.hypot(x, y);
}
/**
@@ -2756,6 +2756,56 @@ function getElementsByProperty( node, name )
return elements;
}
+// User can hide / show the presentation content.
+// For that purpose, we change the background color of root node to either black or white.
+// To set it back to its original color (for showing the content back), we should have the initial background color saved somewhere to read back.
+// There may be no initial color at all, so the initial value of the saved initial is undefined.
+var rootNodeInitialBackgroundColor = undefined;
+
+function changeRootNodeBackgroundTo(color) {
+ if (rootNodeInitialBackgroundColor === undefined)
+ rootNodeInitialBackgroundColor = ROOT_NODE.style.backgroundColor;
+
+ if (color === 'initial')
+ ROOT_NODE.style.backgroundColor = rootNodeInitialBackgroundColor;
+ else
+ ROOT_NODE.style.backgroundColor = color;
+}
+
+var isContentHidden = false;
+var contentInitialVisibilityValues = null;
+
+function getInitialVisibilityValues() {
+ var list = ROOT_NODE.querySelectorAll('g');
+ contentInitialVisibilityValues = [];
+ for (var i = 0; i < list.length; i++) {
+ var temp = {};
+ temp.object = list[i];
+ temp.visibility = list[i].style.visibility;
+ contentInitialVisibilityValues.push(temp);
+ }
+}
+
+function hideShowContent(color) {
+ if (contentInitialVisibilityValues === null)
+ getInitialVisibilityValues();
+
+ if (isContentHidden) {
+ for (var i = 0; i < contentInitialVisibilityValues.length; i++)
+ contentInitialVisibilityValues[i].object.style.visibility = contentInitialVisibilityValues[i].visibility;
+
+ changeRootNodeBackgroundTo('initial');
+ isContentHidden = false;
+ }
+ else {
+ for (var i = 0; i < contentInitialVisibilityValues.length; i++)
+ contentInitialVisibilityValues[i].object.style.visibility = 'hidden';
+
+ changeRootNodeBackgroundTo(color);
+ isContentHidden = true;
+ }
+}
+
/** Event handler for key press.
*
* @param aEvt the event
@@ -2765,7 +2815,7 @@ function onKeyDown( aEvt )
if ( !aEvt )
aEvt = window.event;
- var code = aEvt.keyCode || aEvt.charCode;
+ var code = aEvt.keyCode || aEvt.charCode || aEvt.code;
// console.log('===> onKeyDown: ' + code);
@@ -2788,6 +2838,20 @@ function onKeyDown( aEvt )
// console.log(' now: ' + code);
}
+ else if (code === P_KEY) {
+ aEvt.preventDefault();
+ if (ROOT_NODE.style.cursor === 'pointer')
+ ROOT_NODE.style.cursor = 'default';
+ else
+ ROOT_NODE.style.cursor = 'pointer';
+ }
+ else if (code === W_KEY) {
+ hideShowContent('white');
+ }
+ else if (code === B_KEY) {
+ hideShowContent('black');
+ }
+
if( !processingEffect && keyCodeDictionary[currentMode] && keyCodeDictionary[currentMode][code] )
{
@@ -4464,13 +4528,13 @@ var aOOOAttrTextAdjust = 'text-adjust';
// element class names
var aClipPathGroupClassName = 'ClipPathGroup';
var aPageClassName = 'Page';
-var aSlideNumberClassName = 'Slide_Number';
-var aDateTimeClassName = 'Date/Time';
+var aSlideNumberClassName = 'PageNumber';
+var aDateTimeClassName = 'DateTime';
var aFooterClassName = 'Footer';
var aHeaderClassName = 'Header';
var aDateClassName = 'Date';
var aTimeClassName = 'Time';
-var aSlideNameClassName='SlideName';
+var aSlideNameClassName='PageName';
// Creating a namespace dictionary.
var NSS = {};
@@ -4505,7 +4569,10 @@ var END_KEY = 35; // end keycode
var ENTER_KEY = 13;
var SPACE_KEY = 32;
var ESCAPE_KEY = 27;
+var B_KEY = 66;
+var P_KEY = 80;
var Q_KEY = 81;
+var W_KEY = 87;
// Visibility Values
var HIDDEN = 0;
@@ -4785,15 +4852,6 @@ function getRandomInt( nMax )
return Math.floor( Math.random() * nMax );
}
-function isTextFieldElement( aElement ) // eslint-disable-line no-unused-vars
-{
- var sClassName = aElement.getAttribute( 'class' );
- return ( sClassName === aSlideNumberClassName ) ||
- ( sClassName === aFooterClassName ) ||
- ( sClassName === aHeaderClassName ) ||
- ( sClassName === aDateTimeClassName );
-}
-
/*********************
** Debug Utilities **
@@ -5192,10 +5250,11 @@ initPlaceholderElements : function()
for( ; i < aPlaceholderList.length; ++i )
{
var aPlaceholderElem = aPlaceholderList[i];
- var sContent = aPlaceholderElem.textContent;
- if( sContent === '<date>' )
+ var sClass = aPlaceholderElem.getAttribute('class');
+ var sFieldType = sClass.split(' ')[1];
+ if( sFieldType === aDateClassName)
aPlaceholderElem.textContent = new Date().toLocaleDateString();
- else if( sContent === '<time>' )
+ else if( sFieldType === aTimeClassName )
aPlaceholderElem.textContent = new Date().toLocaleTimeString();
}
},
@@ -5376,24 +5435,43 @@ getSlideAnimationsRoot : function()
}; // end MetaSlide prototype
-function getTextFieldType ( elem )
+function removeRedundantParagraphFromTextFieldShape( aObject )
{
+ var aTextElem = getElementByClassName( aObject, 'SVGTextShape' );
+ if( aTextElem )
+ {
+ var aPlaceholderElement = getElementsByClassName(aTextElem, 'PlaceholderText');
+ if( aPlaceholderElement )
+ {
+ var aTextParagraphSet = getElementsByClassName(aTextElem, 'TextParagraph');
+ // When the text field width is too small, the placeholder text spans several lines.
+ // We remove all text lines but the first one which is used as a placeholder.
+ // This is a workaround but it should work in the majority of cases.
+ // A complete solution needs to support svg text wrapping.
+ if( aTextParagraphSet.length > 1 )
+ {
+ var i = aTextParagraphSet.length;
+ while( i > 1 )
+ {
+ aTextElem.removeChild(aTextParagraphSet[i - 1]);
+ --i;
+ }
+ }
+ }
+ }
+}
+
+function getTextFieldType ( elem ) {
var sFieldType = null;
var sClass = elem.getAttribute('class');
- if( sClass == 'TextShape' )
+ if( sClass === 'TextShape' )
{
- var aPlaceholderElement = getElementByClassName( elem, 'PlaceholderText' );
- if (aPlaceholderElement)
+ var aPlaceholderElement = getElementByClassName(elem, 'PlaceholderText');
+ if( aPlaceholderElement )
{
- var sContent = aPlaceholderElement.textContent
- if (sContent === '<number>')
- sFieldType = aSlideNumberClassName;
- else if (sContent === '<date>')
- sFieldType = aDateClassName;
- else if (sContent === '<time>')
- sFieldType = aTimeClassName;
- else if (sContent === '<slide-name>')
- sFieldType = aSlideNameClassName;
+ var sClassAttr = aPlaceholderElement.getAttribute('class');
+ var classes = sClassAttr.split(' ');
+ sFieldType = classes[1];
}
}
return sFieldType;
@@ -5401,8 +5479,8 @@ function getTextFieldType ( elem )
function isTextFieldByClassName ( sClassName )
{
- return sClassName === aDateTimeClassName || sClassName === aFooterClassName
- || sClassName === aHeaderClassName || sClassName.indexOf( aSlideNumberClassName ) == 0
+ return sClassName.indexOf( aDateTimeClassName ) == 0 || sClassName.indexOf( aFooterClassName ) == 0
+ || sClassName.indexOf( aHeaderClassName ) == 0 || sClassName.indexOf( aSlideNumberClassName ) == 0
|| sClassName.indexOf( aDateClassName ) == 0 || sClassName.indexOf( aTimeClassName ) == 0
|| sClassName.indexOf( aSlideNameClassName ) == 0;
}
@@ -5421,7 +5499,7 @@ function isTextFieldByClassName ( sClassName )
* background image
* </g>
* <g class='BackgroundObjects'>
- * <g class='Date/Time'>
+ * <g class='DateTime'>
* date/time placeholder
* </g>
* <g class='Header'>
@@ -5430,7 +5508,7 @@ function isTextFieldByClassName ( sClassName )
* <g class='Footer'>
* footer placeholder
* </g>
- * <g class='Slide_Number'>
+ * <g class='PageNumber'>
* slide number placeholder
* </g>
* shapes
@@ -5487,6 +5565,7 @@ function MasterPage( sMasterPageId, aMetaSlide )
for( ; i < aBackgroundObjectList.length; ++i )
{
var aObject = aBackgroundObjectList[i];
+ removeRedundantParagraphFromTextFieldShape( aObject );
sClass = null;
var sFieldType = getTextFieldType( aObject );
if( sFieldType && aObject.firstElementChild )
@@ -5501,6 +5580,12 @@ function MasterPage( sMasterPageId, aMetaSlide )
if( !sClass )
{
sClass = aBackgroundObjectList[i].getAttribute('class');
+ if( sClass === aDateTimeClassName || sClass === aFooterClassName
+ || sClass === aHeaderClassName || sClass === aSlideNumberClassName)
+ {
+ sClass += '.Default';
+ aObject.setAttribute('class', sClass);
+ }
}
if( !sClass || !isTextFieldByClassName( sClass ) )
{
@@ -5707,10 +5792,10 @@ PlaceholderShape.prototype.init = function()
* <use class='Background'> // reference to master page background element
* <g class='BackgroundObjects'>
* <use class='BackgroundObjectSubGroup'> // reference to the group of shapes on the master page that are below text fields
- * <g class='Slide_Number'> // a cloned element
+ * <g class='PageNumber'> // a cloned element
* ...
* </g>
- * <use class='Date/Time'> // reference to a clone
+ * <use class='DateTime'> // reference to a clone
* <use class='Footer'>
* <use class='Header'>
* <use class='BackgroundObjectSubGroup'> // reference to the group of shapes on the master page that are above text fields
@@ -5834,7 +5919,7 @@ MasterPageView.prototype.createElement = function()
// The cloned element is appended directly to the field group element
// since there is no slide number field content shared between two slide
// (because the slide number of two slide is always different).
- var nIsPageNumberVisible = sId === aSlideNumberClassName ? this.aMetaSlide.nIsPageNumberVisible : true;
+ var nIsPageNumberVisible = sId === (aSlideNumberClassName + '.Default') ? this.aMetaSlide.nIsPageNumberVisible : true;
if( aPlaceholderShapeSet[sId] &&
aPlaceholderShapeSet[sId].isValid() &&
nIsPageNumberVisible &&
@@ -5845,44 +5930,47 @@ MasterPageView.prototype.createElement = function()
aTextFieldContentProviderSet[aSlideNumberClassName] );
aSlideNumberFieldHandler.update( this.aMetaSlide.nSlideNumber );
aSlideNumberFieldHandler.appendTo( this.aBackgroundObjectsElement );
- if ( sId === aSlideNumberClassName )
+ if ( sId === aSlideNumberClassName + '.Default' )
this.aSlideNumberFieldHandler = aSlideNumberFieldHandler;
}
}
- else if( sId === aDateTimeClassName )
+ else if( sId === aDateTimeClassName + '.Default' )
{
- // Date/Time field
+ // DateTime field
if( this.aMetaSlide.nIsDateTimeVisible )
{
this.aDateTimeFieldHandler =
- this.initTextFieldHandler( aDateTimeClassName, aPlaceholderShapeSet,
+ this.initTextFieldHandler( sId, aPlaceholderShapeSet,
aTextFieldContentProviderSet, aDefsElement,
aTextFieldHandlerSet, sMasterSlideId );
}
}
- else if( sId === aFooterClassName )
+ else if( sId === aFooterClassName + '.Default' )
{
// Footer Field
if( this.aMetaSlide.nIsFooterVisible )
{
this.aFooterFieldHandler =
- this.initTextFieldHandler( aFooterClassName, aPlaceholderShapeSet,
+ this.initTextFieldHandler( sId, aPlaceholderShapeSet,
aTextFieldContentProviderSet, aDefsElement,
aTextFieldHandlerSet, sMasterSlideId );
}
}
- else if( sId === aHeaderClassName )
+ else if( sId === aHeaderClassName + '.Default' )
{
// Header Field
if( this.aMetaSlide.nIsHeaderVisible )
{
this.aHeaderFieldHandler =
- this.initTextFieldHandler( aHeaderClassName, aPlaceholderShapeSet,
+ this.initTextFieldHandler( sId, aPlaceholderShapeSet,
aTextFieldContentProviderSet, aDefsElement,
aTextFieldHandlerSet, sMasterSlideId );
}
}
- else if( sId.indexOf( aDateClassName ) == 0
+ else if( sId.indexOf( aDateTimeClassName ) == 0
+ || sId.indexOf( aFooterClassName ) == 0
+ || sId.indexOf( aHeaderClassName ) == 0
+ || sId.indexOf( aDateClassName ) == 0
|| sId.indexOf( aTimeClassName ) == 0
|| sId.indexOf( aSlideNameClassName ) == 0 )
{
@@ -5922,21 +6010,21 @@ MasterPageView.prototype.initTextFieldHandler =
if( aPlaceholderShape && aPlaceholderShape.isValid()
&& aTextFieldContentProvider )
{
- var sTextFieldContentProviderId = aTextFieldContentProvider.sId;
+ var sTextFiedHandlerKey = aTextFieldContentProvider.sId + '.' + sId;
// We create only one single TextFieldHandler object (and so one only
// text field clone) per master slide and text content.
- if ( !aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ] )
+ if ( !aTextFieldHandlerSet[ sMasterSlideId ][ sTextFiedHandlerKey ] )
{
- aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ] =
+ aTextFieldHandlerSet[ sMasterSlideId ][ sTextFiedHandlerKey ] =
new TextFieldHandler( aPlaceholderShape,
aTextFieldContentProvider );
- aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ];
+ aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFiedHandlerKey ];
aTextFieldHandler.update();
aTextFieldHandler.appendTo( aDefsElement );
}
else
{
- aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ];
+ aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFiedHandlerKey ];
}
sRefId = aTextFieldHandler.sId;
}
@@ -7033,6 +7121,8 @@ function matrixToString( aSVGMatrix )
// eslint-disable-next-line no-unused-vars
function numberParser( sValue )
{
+ if( typeof sValue !== 'string' )
+ return undefined;
if( sValue === '.' )
return undefined;
var reFloatNumber = /^[+-]?[0-9]*[.]?[0-9]*$/;
@@ -7045,6 +7135,9 @@ function numberParser( sValue )
function booleanParser( sValue )
{
+ if( typeof sValue !== 'string' )
+ return undefined;
+
sValue = sValue.toLowerCase();
if( sValue === 'true' )
return true;
@@ -7056,6 +7149,9 @@ function booleanParser( sValue )
function colorParser( sValue )
{
+ if( typeof sValue !== 'string' )
+ return undefined;
+
// The following 3 color functions are used in evaluating sValue string
// so don't remove them.
@@ -7989,6 +8085,7 @@ var ENUM_PROPERTY = 2;
var COLOR_PROPERTY = 3;
var STRING_PROPERTY = 4;
var BOOL_PROPERTY = 5;
+var TUPLE_NUMBER_PROPERTY = 6;
var aValueTypeOutMap = [ 'unknown', 'number', 'enum', 'color', 'string', 'boolean' ];
@@ -8006,6 +8103,14 @@ var aAttributeMap =
'get': 'getOpacity',
'set': 'setOpacity' },
+ 'scale': { 'type': TUPLE_NUMBER_PROPERTY,
+ 'get': 'getSize',
+ 'set': 'setSize' },
+
+ 'translate': { 'type': TUPLE_NUMBER_PROPERTY,
+ 'get': 'getPos',
+ 'set': 'setPos' },
+
'rotate': { 'type': NUMBER_PROPERTY,
'get': 'getRotationAngle',
'set': 'setRotationAngle' },
@@ -11574,6 +11679,70 @@ PropertyAnimationNode.prototype.createActivity = function()
+function isValidTransformation( sType )
+{
+ return ( sType === 'translate' || sType === 'scale' || sType === 'rotate'
+ || sType === 'skewX' || sType === 'skewY' );
+}
+
+function AnimationTransformNode( aAnimElem, aParentNode, aNodeContext )
+{
+ AnimationTransformNode.superclass.constructor.call( this, aAnimElem, aParentNode, aNodeContext );
+
+ this.sClassName = 'AnimationTransformNode';
+}
+extend( AnimationTransformNode, AnimationBaseNode3 );
+
+
+AnimationTransformNode.prototype.parseElement = function()
+{
+ var bRet = AnimationTransformNode.superclass.parseElement.call(this);
+
+ var aAnimElem = this.aElement;
+
+ // transformation type
+ var sTransformType = aAnimElem.getAttribute( 'svg:type' );
+ if( !isValidTransformation( sTransformType ) )
+ {
+ this.eCurrentState = INVALID_NODE;
+ log( 'AnimationTransformNode.parseElement: transformation type not found: ' + sTransformType );
+ }
+ else
+ {
+ this.sAttributeName = sTransformType;
+ }
+
+ return bRet;
+}
+
+AnimationTransformNode.prototype.createActivity = function()
+{
+ var aActivityParamSet = this.fillActivityParams();
+ var aAnimation;
+
+ if( this.getAttributeName() === 'scale' || this.getAttributeName() === 'translate' )
+ {
+ aAnimation = createPairPropertyAnimation( this.getAttributeName(),
+ this.getAnimatedElement(),
+ this.aNodeContext.aSlideWidth,
+ this.aNodeContext.aSlideHeight );
+
+ }
+ else
+ {
+ aAnimation = createPropertyAnimation( this.getAttributeName(),
+ this.getAnimatedElement(),
+ this.aNodeContext.aSlideWidth,
+ this.aNodeContext.aSlideHeight );
+ }
+
+ var aInterpolator = null; // createActivity will compute it;
+ return createActivity( aActivityParamSet, this, aAnimation, aInterpolator );
+};
+
+
+
+
function AnimationSetNode( aAnimElem, aParentNode, aNodeContext )
{
AnimationSetNode.superclass.constructor.call( this, aAnimElem, aParentNode, aNodeContext );
@@ -11872,10 +12041,8 @@ function createAnimationNode( aElement, aParentNode, aNodeContext )
aCreatedNode = new AnimationColorNode( aElement, aParentNode, aNodeContext );
break;
case ANIMATION_NODE_ANIMATETRANSFORM:
- //aCreatedNode = new AnimationTransformNode( aElement, aParentNode, aNodeContext );
- //break;
- log( 'createAnimationNode: ANIMATETRANSFORM not implemented' );
- return null;
+ aCreatedNode = new AnimationTransformNode( aElement, aParentNode, aNodeContext );
+ break;
case ANIMATION_NODE_TRANSITIONFILTER:
aCreatedNode = new AnimationTransitionFilterNode( aElement, aParentNode, aNodeContext );
break;
@@ -11998,6 +12165,41 @@ function createPropertyAnimation( sAttrName, aAnimatedElement, nWidth, nHeight )
+function createPairPropertyAnimation( sTransformType, aAnimatedElement, nWidth, nHeight )
+{
+ var aFunctorSet = aAttributeMap[ sTransformType ];
+ var sGetValueMethod = aFunctorSet.get;
+ var sSetValueMethod = aFunctorSet.set;
+
+ var aDefaultValue = [];
+ var aSizeReference = [];
+ if( sTransformType === 'scale' )
+ {
+ aDefaultValue[0] = aSizeReference[0] = aAnimatedElement.getBaseBBox().width;
+ aDefaultValue[1] = aSizeReference[1] = aAnimatedElement.getBaseBBox().height;
+ }
+ else if( sTransformType === 'translate' )
+ {
+ aDefaultValue[0] = aAnimatedElement.getBaseCenterX();
+ aDefaultValue[1] = aAnimatedElement.getBaseCenterY();
+ aSizeReference[0] = nWidth;
+ aSizeReference[1] = nHeight;
+ }
+ else
+ {
+ log( 'createPairPropertyAnimation: transform type is not handled' );
+ return null;
+ }
+
+ return new TupleAnimation( bind( aAnimatedElement, aAnimatedElement[ sGetValueMethod ] ),
+ bind( aAnimatedElement, aAnimatedElement[ sSetValueMethod ] ),
+ aDefaultValue,
+ aSizeReference );
+}
+
+
+
+
/** createShapeTransition
*
* @param aActivityParamSet
@@ -12197,6 +12399,45 @@ GenericAnimation.prototype.getUnderlyingValue = function()
+function TupleAnimation( aGetValueFunc, aSetValueFunc, aDefaultValue, aReferenceSize )
+{
+ TupleAnimation.superclass.constructor.call( this, aGetValueFunc, aSetValueFunc );
+ assert( aDefaultValue && aReferenceSize,
+ 'TupleAnimation constructor: default value functor and/or reference size are not valid' );
+
+ this.aDefaultValue = aDefaultValue;
+ this.aReferenceSize = aReferenceSize;
+}
+extend( TupleAnimation, GenericAnimation );
+
+TupleAnimation.prototype.perform = function( aNormValue )
+{
+ assert(aNormValue.length === this.aReferenceSize.length);
+
+ var aValue = [];
+ for( var i = 0; i < aNormValue.length; ++i )
+ {
+ aValue.push( aNormValue[i] * this.aReferenceSize[i] );
+ }
+
+ this.aSetValueFunc( aValue );
+};
+
+TupleAnimation.prototype.getUnderlyingValue = function()
+{
+ var aValue = this.aGetValueFunc();
+ assert(aValue.length === this.aReferenceSize.length);
+
+ var aNormValue = [];
+ for( var i = 0; i < aValue.length; ++i )
+ {
+ aNormValue.push( aValue[i] / this.aReferenceSize[i] );
+ }
+
+ return aNormValue;
+};
+
+
function HSLAnimationWrapper( aColorAnimation )
{
@@ -14514,6 +14755,11 @@ AnimatedElement.prototype.getY = function()
return this.nCenterY;
};
+AnimatedElement.prototype.getPos = function()
+{
+ return [this.getX(), this.getY()];
+};
+
AnimatedElement.prototype.getWidth = function()
{
return this.nScaleFactorX * this.getBaseBBox().width;
@@ -14524,6 +14770,11 @@ AnimatedElement.prototype.getHeight = function()
return this.nScaleFactorY * this.getBaseBBox().height;
};
+AnimatedElement.prototype.getSize = function()
+{
+ return [this.getWidth(), this.getHeight()];
+};
+
AnimatedElement.prototype.updateTransformAttribute = function()
{
this.aTransformAttrList = this.aActiveElement.transform.baseVal;
@@ -14553,12 +14804,27 @@ AnimatedElement.prototype.setY = function( nNewCenterY )
this.nCenterY = nNewCenterY;
};
+AnimatedElement.prototype.setPos = function( aNewPos )
+{
+ var nNewCenterX = aNewPos[0];
+ var nNewCenterY = aNewPos[1];
+
+ if( nNewCenterX === this.nCenterX && nNewCenterY === this.nCenterY ) return;
+
+ this.aTransformAttrList = this.aActiveElement.transform.baseVal;
+ this.aTransformAttr = this.aTransformAttrList.getItem( 0 );
+ this.aTMatrix = this.aTransformAttr.matrix.translate( nNewCenterX - this.nCenterX, nNewCenterY - this.nCenterY );
+ this.aTransformAttr.setMatrix( this.aTMatrix );
+ this.nCenterX = nNewCenterX;
+ this.nCenterY = nNewCenterY;
+};
+
AnimatedElement.prototype.setWidth = function( nNewWidth )
{
ANIMDBG.print( 'AnimatedElement.setWidth: nNewWidth = ' + nNewWidth );
if( nNewWidth < 0 )
{
- log('AnimatedElement(' + this.getId() + ').setWidth: negative height!');
+ log('AnimatedElement(' + this.getId() + ').setWidth: negative width!');
nNewWidth = 0;
}
@@ -14603,6 +14869,43 @@ AnimatedElement.prototype.setHeight = function( nNewHeight )
this.nScaleFactorY = nScaleFactorY;
};
+AnimatedElement.prototype.setSize= function( aNewSize )
+{
+ var nNewWidth = aNewSize[0];
+ var nNewHeight = aNewSize[1];
+ ANIMDBG.print( 'AnimatedElement.setSize: = [' + nNewWidth + ',' + nNewHeight + ']');
+ if( nNewWidth < 0 )
+ {
+ log('AnimatedElement(' + this.getId() + ').setSize: negative width!');
+ nNewWidth = 0;
+ }
+ if( nNewHeight < 0 )
+ {
+ log('AnimatedElement(' + this.getId() + ').setSize: negative height!');
+ nNewHeight = 0;
+ }
+
+ var nBaseWidth = this.getBaseBBox().width;
+ var nScaleFactorX = nNewWidth / nBaseWidth;
+ if( nScaleFactorX < 1e-5 ) nScaleFactorX = 1e-5;
+
+ var nBaseHeight = this.getBaseBBox().height;
+ var nScaleFactorY = nNewHeight / nBaseHeight;
+ if( nScaleFactorY < 1e-5 ) nScaleFactorY = 1e-5;
+
+ if( nScaleFactorX == this.nScaleFactorX && nScaleFactorY == this.nScaleFactorY ) return;
+
+ this.aTMatrix = document.documentElement.createSVGMatrix()
+ .translate( this.nCenterX, this.nCenterY )
+ .rotate(this.nRotationAngle)
+ .scaleNonUniform( nScaleFactorX, nScaleFactorY )
+ .translate( -this.nBaseCenterX, -this.nBaseCenterY );
+ this.updateTransformAttribute();
+
+ this.nScaleFactorX = nScaleFactorX;
+ this.nScaleFactorY = nScaleFactorY;
+};
+
AnimatedElement.prototype.getOpacity = function()
{
return this.aActiveElement.getAttribute( 'opacity' );
@@ -14807,7 +15110,7 @@ function AnimatedTextElement( aElement, aEventMultiplexer )
if( aBulletPlaceholderElem )
{
var sId = aBulletPlaceholderElem.getAttribute( 'id' );
- sId = 'bullet-char(' + sId + ')';
+ sId = 'bullet-char-' + sId;
aBulletCharElem = theDocument.getElementById( sId );
if( aBulletCharElem )
{
@@ -16336,6 +16639,17 @@ aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ COLOR_PROPERTY ][ COLO
};
};
+aInterpolatorHandler.aLerpFunctorMap[ CALC_MODE_LINEAR ][ TUPLE_NUMBER_PROPERTY ] =
+ function ( aFrom, aTo, nT )
+ {
+ var aRes = [];
+ for( var i = 0; i < aFrom.length; ++i )
+ {
+ aRes.push( ( 1.0 - nT )* aFrom[i] + nT * aTo[i] );
+ }
+ return aRes;
+ };
+
@@ -16503,6 +16817,36 @@ aOperatorSetMap[ STRING_PROPERTY ] = aOperatorSetMap[ ENUM_PROPERTY ];
// bool operators
aOperatorSetMap[ BOOL_PROPERTY ] = aOperatorSetMap[ ENUM_PROPERTY ];
+// tuple number operators
+aOperatorSetMap[ TUPLE_NUMBER_PROPERTY ] = {};
+
+aOperatorSetMap[ TUPLE_NUMBER_PROPERTY ].equal = function( a, b )
+{
+ assert( a.length === b.length, 'Tuples length mismatch.' );
+ return ( a.toString() === b.toString() );
+};
+
+aOperatorSetMap[ TUPLE_NUMBER_PROPERTY ].add = function( a, b )
+{
+ assert( a.length === b.length, 'Tuples length mismatch.' );
+ var r = [];
+ for( var i = 0; i < a.length; ++i )
+ {
+ r.push(a[i] + b[i]);
+ }
+ return r;
+};
+
+aOperatorSetMap[ TUPLE_NUMBER_PROPERTY ].scale = function( k, v )
+{
+ var r = [];
+ for( var i = 0; i < v.length; ++i )
+ {
+ r.push(k * v[i]);
+ }
+ return r;
+};
+
@@ -17912,6 +18256,22 @@ function extractAttributeValues( eValueType, aValueList, aValueSet, aBBox, nSlid
aValueList.push( aValue );
}
break;
+ case TUPLE_NUMBER_PROPERTY :
+ for( i = 0; i < aValueSet.length; ++i )
+ {
+ if( typeof aValueSet[i] === 'string' )
+ {
+ var aTuple = aValueSet[i].split(',');
+ aValue = [];
+ evalValuesAttribute(aValue, aTuple, aBBox, nSlideWidth, nSlideHeight);
+ aValueList.push(aValue);
+ }
+ else
+ {
+ aValueList.push( undefined );
+ }
+ }
+ break;
default:
log( 'createValueListActivity: unexpected value type: ' + eValueType );
}
@@ -17934,9 +18294,12 @@ function evalValuesAttribute( aValueList, aValueSet, aBBox, nSlideWidth, nSlideH
for( var i = 0; i < aValueSet.length; ++i )
{
var sValue = aValueSet[i];
- sValue = sValue.replace(reMath, 'Math.$&');
- sValue = sValue.replace(/pi(?!\w)/g, 'Math.PI');
- sValue = sValue.replace(/e(?!\w)/g, 'Math.E');
+ if(sValue)
+ {
+ sValue = sValue.replace(reMath, 'Math.$&');
+ sValue = sValue.replace(/pi(?!\w)/g, 'Math.PI');
+ sValue = sValue.replace(/e(?!\w)/g, 'Math.E');
+ }
var aValue = eval( sValue );
aValueList.push( aValue );
}
@@ -18622,8 +18985,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.lok !== undefined)
+ window.webkit.messageHandlers.lok.postMessage('EXITSLIDESHOW', '*');
}
SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index ef0c1ea37a80..c6325f282a2e 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <strings.hrc>
#include "svgwriter.hxx"
#include "svgfontexport.hxx"
#include "svgfilter.hxx"
@@ -44,6 +45,7 @@
#include <editeng/flditem.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
+#include <comphelper/scopeguard.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <i18nlangtag/lang.h>
#include <svl/numformat.hxx>
@@ -62,7 +64,9 @@
#include <svx/svdmodel.hxx>
#include <svx/svdxcgv.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <tools/zcodec.hxx>
+#include <rtl/crc.h>
#include <memory>
#include <string_view>
@@ -70,7 +74,7 @@
using namespace css::animations;
using namespace css::presentation;
using namespace ::com::sun::star::graphic;
-using namespace ::com::sun::star::geometry;
+using namespace ::com::sun::star::style;
using namespace ::com::sun::star;
using namespace ::xmloff::token;
@@ -86,25 +90,25 @@ constexpr OUStringLiteral SVG_PROP_OPACITY = u"Opacity";
constexpr OUStringLiteral SVG_PROP_POSITIONED_CHARACTERS = u"UsePositionedCharacters";
// ooo xml elements
-constexpr OUStringLiteral aOOOElemTextField = NSPREFIX "text_field";
+constexpr OUString aOOOElemTextField = NSPREFIX "text_field"_ustr;
// ooo xml attributes for meta_slide
-constexpr OUStringLiteral aOOOAttrSlide = NSPREFIX "slide";
-constexpr OUStringLiteral aOOOAttrMaster = NSPREFIX "master";
+constexpr OUString aOOOAttrSlide = NSPREFIX "slide"_ustr;
+constexpr OUString aOOOAttrMaster = NSPREFIX "master"_ustr;
constexpr OUStringLiteral aOOOAttrHasCustomBackground = NSPREFIX "has-custom-background";
constexpr OUStringLiteral aOOOAttrDisplayName = NSPREFIX "display-name";
-constexpr OUStringLiteral aOOOAttrBackgroundVisibility = NSPREFIX "background-visibility";
-constexpr OUStringLiteral aOOOAttrMasterObjectsVisibility = NSPREFIX "master-objects-visibility";
+constexpr OUString aOOOAttrBackgroundVisibility = NSPREFIX "background-visibility"_ustr;
+constexpr OUString aOOOAttrMasterObjectsVisibility = NSPREFIX "master-objects-visibility"_ustr;
constexpr OUStringLiteral aOOOAttrSlideDuration = NSPREFIX "slide-duration";
-constexpr OUStringLiteral aOOOAttrDateTimeField = NSPREFIX "date-time-field";
-constexpr OUStringLiteral aOOOAttrFooterField = NSPREFIX "footer-field";
-constexpr OUStringLiteral aOOOAttrHasTransition = NSPREFIX "has-transition";
+constexpr OUString aOOOAttrDateTimeField = NSPREFIX "date-time-field"_ustr;
+constexpr OUString aOOOAttrFooterField = NSPREFIX "footer-field"_ustr;
+constexpr OUString aOOOAttrHasTransition = NSPREFIX "has-transition"_ustr;
// ooo xml attributes for pages and shapes
-constexpr OUStringLiteral aOOOAttrName = NSPREFIX "name";
+constexpr OUString aOOOAttrName = NSPREFIX "name"_ustr;
-constexpr OUStringLiteral constSvgNamespace = u"http://www.w3.org/2000/svg";
+constexpr OUString constSvgNamespace = u"http://www.w3.org/2000/svg"_ustr;
/** Text Field Class Hierarchy
@@ -207,7 +211,7 @@ public:
}
virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const override
{
- static constexpr OUStringLiteral sFieldId = aOOOAttrFooterField;
+ static constexpr OUString sFieldId = aOOOAttrFooterField;
implGrowCharSet( aTextFieldCharSets, text, sFieldId );
}
};
@@ -304,7 +308,7 @@ public:
OUString sDateTimeFormat = sDateFormat + " " + sTimeFormat;
- pSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-format", sDateTimeFormat );
+ pSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-format"_ustr, sDateTimeFormat );
SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", true, true );
}
virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const override
@@ -372,6 +376,11 @@ SVGExport::SVGExport(
// add namespaces
GetNamespaceMap_().Add(
+ GetXMLToken(XML_NP_SVG),
+ GetXMLToken(XML_N_SVG_COMPAT),
+ XML_NAMESPACE_SVG);
+
+ GetNamespaceMap_().Add(
GetXMLToken(XML_NP_PRESENTATION),
GetXMLToken(XML_N_PRESENTATION),
XML_NAMESPACE_PRESENTATION);
@@ -645,6 +654,8 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
{
pValue[ i ].Value >>= maFilterData;
}
+ else if (pValue[i].Name == "StatusIndicator")
+ pValue[i].Value >>= mxStatusIndicator;
}
if(mbWriterFilter || mbCalcFilter)
@@ -657,12 +668,16 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOSt
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ;
bool bRet = false;
+ // Instead of writing to rxOStm directly, we write here in case we need
+ // to compress the output later
+ SvMemoryStream aTempStm;
if( rxOStm.is() )
{
- if( !mSelectedPages.empty() && !mMasterPageTargets.empty() )
+ if (!mSelectedPages.empty())
{
- Reference< XDocumentHandler > xDocHandler = implCreateExportDocumentHandler( rxOStm );
+ ::rtl::Reference< ::utl::OStreamWrapper > aTempStmWrapper = new ::utl::OStreamWrapper( aTempStm );
+ Reference< XDocumentHandler > xDocHandler = implCreateExportDocumentHandler( aTempStmWrapper );
if( xDocHandler.is() )
{
@@ -737,6 +752,38 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOSt
}
}
}
+ if ( bRet )
+ {
+ const sal_Int8* aDataPtr = static_cast< const sal_Int8* >( aTempStm.GetData() );
+ sal_uInt32 aDataSize = aTempStm.GetSize();
+ SvMemoryStream aCompressedStm;
+ if ( mbShouldCompress )
+ {
+ sal_uInt32 nUncompressedCRC32
+ = rtl_crc32( 0, aTempStm.GetData(), aTempStm.GetSize() );
+ ZCodec aCodec;
+ aTempStm.Seek( 0 );
+ aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true );
+ // the inner modify time/filename doesn't really matter in this context because
+ // compressed graphic formats are meant to be opened as is - not to be extracted
+ aCodec.SetCompressionMetadata( "inner"_ostr, 0, nUncompressedCRC32 );
+ aCodec.Compress( aTempStm, aCompressedStm );
+ sal_uInt32 nTotalIn = static_cast< sal_uInt32 >( aCodec.EndCompression() );
+ if ( aCompressedStm.GetError() || nTotalIn != aDataSize )
+ {
+ bRet = false;
+ return bRet;
+ }
+ else
+ {
+ aDataPtr = static_cast< const sal_Int8* >( aCompressedStm.GetData() );
+ aDataSize = aCompressedStm.GetSize();
+ }
+ }
+
+ Sequence< sal_Int8 > aTempSeq( aDataPtr, aDataSize );
+ rxOStm->writeBytes( aTempSeq );
+ }
return bRet;
}
@@ -796,7 +843,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;
@@ -815,8 +864,18 @@ bool SVGFilter::implExportWriterTextGraphic( const Reference< view::XSelectionSu
if(pSvxDrawPage == nullptr || pSvxDrawPage->GetSdrPage() == nullptr)
return false;
- SdrGrafObj* pGraphicObj = new SdrGrafObj(pSvxDrawPage->GetSdrPage()->getSdrModelFromSdrPage(), aGraphic, tools::Rectangle( aPos, aSize ));
- uno::Reference< drawing::XShape > xShape = GetXShapeForSdrObject(pGraphicObj);
+ SdrModel& rModel = pSvxDrawPage->GetSdrPage()->getSdrModelFromSdrPage();
+ const bool bUndoEnable = rModel.IsUndoEnabled();
+ if (bUndoEnable)
+ rModel.EnableUndo(false);
+ comphelper::ScopeGuard guard([bUndoEnable, &rModel]() {
+ // restore when leaving
+ if (bUndoEnable)
+ rModel.EnableUndo(false);
+ });
+
+ rtl::Reference<SdrGrafObj> pGraphicObj = new SdrGrafObj(rModel, aGraphic, tools::Rectangle( aPos, aSize ));
+ uno::Reference< drawing::XShape > xShape = GetXShapeForSdrObject(pGraphicObj.get());
uno::Reference< XPropertySet > xShapePropSet(xShape, uno::UNO_QUERY);
xShapePropSet->setPropertyValue("Graphic", uno::Any(xGraphic));
@@ -890,10 +949,14 @@ bool SVGFilter::implExportDocument()
// #i124608#
mbExportShapeSelection = mbSinglePage && maShapeSelection.is() && maShapeSelection->getCount();
- if(xDefaultPagePropertySet.is())
+ if (xDefaultPagePropertySet.is())
{
- xDefaultPagePropertySet->getPropertyValue( "Width" ) >>= nDocWidth;
- xDefaultPagePropertySet->getPropertyValue( "Height" ) >>= nDocHeight;
+ sal_Int32 nWidth = 0;
+ sal_Int32 nHeight = 0;
+ if (xDefaultPagePropertySet->getPropertyValue("Width") >>= nWidth)
+ nDocWidth = nWidth;
+ if (xDefaultPagePropertySet->getPropertyValue("Height") >>= nHeight)
+ nDocHeight = nHeight;
}
if(mbExportShapeSelection)
@@ -971,9 +1034,11 @@ 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)
+ if (!mbExportShapeSelection && !mMasterPageTargets.empty())
implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.size() - 1 );
implExportDrawPages( mSelectedPages, 0, nLastPage );
@@ -1043,6 +1108,7 @@ void SVGFilter::implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:presentation", "http://sun.com/xmlns/staroffice/presentation" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:smil", "http://www.w3.org/2001/SMIL20/" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:anim", "urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xml:space", "preserve" );
mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", true, true );
@@ -1154,13 +1220,13 @@ void SVGFilter::implGenerateMetaData()
// we wrap all meta presentation info into a svg:defs element
SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", NSPREFIX "meta_slides" );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "number-of-slides", OUString::number( nCount ) );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "start-slide-number", OUString::number( mnVisiblePage ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", NSPREFIX "meta_slides"_ustr );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "number-of-slides"_ustr, OUString::number( nCount ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "start-slide-number"_ustr, OUString::number( mnVisiblePage ) );
if( mpSVGExport->IsUsePositionedCharacters() )
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "use-positioned-chars", "true" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "use-positioned-chars"_ustr, "true" );
}
// Add a (global) Page Numbering Type attribute for the document
@@ -1201,20 +1267,20 @@ void SVGFilter::implGenerateMetaData()
break;
}
if( !sNumberingType.isEmpty() )
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-numbering-type", sNumberingType );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-numbering-type"_ustr, sNumberingType );
}
{
SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
- const OUString aId( NSPREFIX "meta_slide" );
+ const OUString aId( NSPREFIX "meta_slide"_ustr );
const OUString aElemTextFieldId( aOOOElemTextField );
std::vector< std::unique_ptr<TextField> > aFieldSet;
// dummy slide - used as leaving slide for transition on the first slide
if( mbPresentation )
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", NSPREFIX "meta_dummy_slide" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", NSPREFIX "meta_dummy_slide"_ustr );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, "dummy-slide" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, "dummy-master-page" );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, "hidden" );
@@ -1273,7 +1339,7 @@ void SVGFilter::implGenerateMetaData()
if( !bBackgroundVisibility ) // visibility default value: 'visible'
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, "hidden" );
- // Page Number, Date/Time, Footer and Header Fields are regarded as background objects.
+ // Page Number, DateTime, Footer and Header Fields are regarded as background objects.
// So bBackgroundObjectsVisibility overrides visibility of master page text fields.
xPropSet->getPropertyValue( "IsBackgroundObjectsVisible" ) >>= bBackgroundObjectsVisibility;
if( bBackgroundObjectsVisibility ) // visibility default value: 'visible'
@@ -1287,50 +1353,44 @@ void SVGFilter::implGenerateMetaData()
bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != css::style::NumberingType::NUMBER_NONE );
if( bPageNumberVisibility ) // visibility default value: 'hidden'
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-number-visibility", "visible" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "page-number-visibility"_ustr, "visible" );
}
- // Date/Time Field
- xPropSet->getPropertyValue( "IsDateTimeVisible" ) >>= bDateTimeVisibility;
- if( bDateTimeVisibility ) // visibility default value: 'visible'
+ // DateTime Field
+ bool bDateTimeFixed = true; // default: fixed
+ xPropSet->getPropertyValue( "IsDateTimeFixed" ) >>= bDateTimeFixed;
+ if( bDateTimeFixed ) // we are interested only in the field text not in the date/time format
{
- bool bDateTimeFixed = true; // default: fixed
- xPropSet->getPropertyValue( "IsDateTimeFixed" ) >>= bDateTimeFixed;
- if( bDateTimeFixed ) // we are interested only in the field text not in the date/time format
- {
- xPropSet->getPropertyValue( "DateTimeText" ) >>= aFixedDateTimeField.text;
- if( !aFixedDateTimeField.text.isEmpty() )
- {
- OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
- }
- }
- else // the inverse applies: we are interested only in the date/time format not in the field text
+ xPropSet->getPropertyValue( "DateTimeText" ) >>= aFixedDateTimeField.text;
+ if( !aFixedDateTimeField.text.isEmpty() )
{
- xPropSet->getPropertyValue( "DateTimeFormat" ) >>= aVariableDateTimeField.format;
- OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage );
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
}
}
- else
+ else // the inverse applies: we are interested only in the date/time format not in the field text
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-visibility", "hidden" );
+ xPropSet->getPropertyValue( "DateTimeFormat" ) >>= aVariableDateTimeField.format;
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
+ }
+ xPropSet->getPropertyValue( "IsDateTimeVisible" ) >>= bDateTimeVisibility;
+ if( !bDateTimeVisibility ) // visibility default value: 'visible'
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "date-time-visibility"_ustr, "hidden" );
}
// Footer Field
- xPropSet->getPropertyValue( "IsFooterVisible" ) >>= bFooterVisibility;
- if( bFooterVisibility ) // visibility default value: 'visible'
+ xPropSet->getPropertyValue( "FooterText" ) >>= aFooterField.text;
+ if( !aFooterField.text.isEmpty() )
{
- xPropSet->getPropertyValue( "FooterText" ) >>= aFooterField.text;
- if( !aFooterField.text.isEmpty() )
- {
- OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId );
- }
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId );
}
- else
+ xPropSet->getPropertyValue( "IsFooterVisible" ) >>= bFooterVisibility;
+ if( !bFooterVisibility ) // visibility default value: 'visible'
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "footer-visibility", "hidden" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "footer-visibility"_ustr, "hidden" );
}
}
else
@@ -1466,7 +1526,7 @@ void SVGFilter::implExportTextShapeIndex()
for( sal_Int32 i = 0; i < nCount; ++i )
{
const Reference< css::drawing::XDrawPage > & xDrawPage = mSelectedPages[i];
- if( mTextShapeIdListMap.find( xDrawPage ) != mTextShapeIdListMap.end() )
+ if( mTextShapeIdListMap.contains(xDrawPage) )
{
OUString sTextShapeIdList = mTextShapeIdListMap[xDrawPage].trim();
@@ -1474,7 +1534,7 @@ void SVGFilter::implExportTextShapeIndex()
if( !rPageId.isEmpty() && !sTextShapeIdList.isEmpty() )
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, rPageId );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "id-list", sTextShapeIdList );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "id-list"_ustr, sTextShapeIdList );
SvXMLElementExport aGElem( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
}
}
@@ -1849,25 +1909,21 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing:
}
}
- if(!mbExportShapeSelection)
+ if (!mbExportShapeSelection)
{
// We wrap all slide in a group element with class name "SlideGroup".
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "SlideGroup" );
SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true );
+ if (mxStatusIndicator)
+ mxStatusIndicator->start(FilterResId(STR_FILTER_DOC_SAVING), nLastPage - nFirstPage + 1);
+
for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
{
- Reference< css::drawing::XShapes > xShapes;
+ if (mxStatusIndicator.is())
+ mxStatusIndicator->setValue(i - nFirstPage);
- if (mbExportShapeSelection)
- {
- // #i124608# export a given object selection
- xShapes = maShapeSelection;
- }
- else
- {
- xShapes = rxPages[i];
- }
+ Reference<css::drawing::XShapes> xShapes = rxPages[i];
if( xShapes.is() )
{
@@ -1910,6 +1966,9 @@ void SVGFilter::implExportDrawPages( const std::vector< Reference< css::drawing:
} // append the </g> closing tag related to inserted elements
} // append the </g> closing tag related to the svg element handling the slide visibility
}
+
+ if (mxStatusIndicator)
+ mxStatusIndicator->end();
}
else
{
@@ -2111,9 +2170,9 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
if( mbPresentation )
{
- bool bIsPageNumber = ( aShapeClass == "Slide_Number" );
+ bool bIsPageNumber = ( aShapeClass == "PageNumber" );
bool bIsFooter = ( aShapeClass == "Footer" );
- bool bIsDateTime = ( aShapeClass == "Date/Time" );
+ bool bIsDateTime = ( aShapeClass == "DateTime" );
bool bTextField = bIsPageNumber || bIsFooter || bIsDateTime;
if( bTextField )
{
@@ -2144,7 +2203,7 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
default:
break;
}
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "text-adjust", sTextAdjust );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, NSPREFIX "text-adjust"_ustr, sTextAdjust );
}
}
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aShapeClass );
@@ -2283,7 +2342,8 @@ bool SVGFilter::implCreateObjects()
if( xPropSet.is() )
{
Reference< XPropertySet > xBackground;
- xPropSet->getPropertyValue( "Background" ) >>= xBackground;
+ if (xPropSet->getPropertySetInfo()->hasPropertyByName("Background"))
+ xPropSet->getPropertyValue( "Background" ) >>= xBackground;
if( xBackground.is() )
{
drawing::FillStyle aFillStyle;
@@ -2334,7 +2394,8 @@ bool SVGFilter::implCreateObjectsFromShape( const Reference< css::drawing::XDraw
if( pObj )
{
- Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pObj));
+ // tdf#155479 need to signal SVG export
+ Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pObj, true));
// Writer graphic shapes are handled differently
if( mbWriterFilter && aGraphic.GetType() == GraphicType::NONE )
@@ -2455,18 +2516,19 @@ void SVGFilter::implCreateObjectsFromBackground( const Reference< css::drawing::
GDIMetaFile aMtf;
- utl::TempFile aFile;
- aFile.EnableKillingFile();
+ utl::TempFileFast aFile;
+ SvStream* pStream = aFile.GetStream(StreamMode::READWRITE);
Sequence< PropertyValue > aDescriptor{
comphelper::makePropertyValue("FilterName", OUString( "SVM" )),
- comphelper::makePropertyValue("URL", aFile.GetURL()),
+ comphelper::makePropertyValue("OutputStream", uno::Reference<XOutputStream>(new utl::OOutputStreamWrapper(*pStream))),
comphelper::makePropertyValue("ExportOnlyBackground", true)
};
xExporter->setSourceDocument( Reference< XComponent >( rxDrawPage, UNO_QUERY ) );
xExporter->filter( aDescriptor );
- SvmReader aReader( *aFile.GetStream( StreamMode::READ ) );
+ pStream->Seek(0);
+ SvmReader aReader( *pStream );
aReader.Read( aMtf );
bool bIsBitmap = false;
@@ -2589,9 +2651,9 @@ OUString SVGFilter::implGetClassFromShape( const Reference< css::drawing::XShape
else if( aShapeType.lastIndexOf( "presentation.FooterShape" ) != -1 )
aRet = "Footer";
else if( aShapeType.lastIndexOf( "presentation.DateTimeShape" ) != -1 )
- aRet = "Date/Time";
+ aRet = "DateTime";
else if( aShapeType.lastIndexOf( "presentation.SlideNumberShape" ) != -1 )
- aRet = "Slide_Number";
+ aRet = "PageNumber";
else if( aShapeType.lastIndexOf( "presentation.TitleTextShape" ) != -1 )
aRet = "TitleText";
else if( aShapeType.lastIndexOf( "presentation.OutlinerShape" ) != -1 )
@@ -2647,9 +2709,9 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void )
}
bool bHasCharSetMap = mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) != mTextFieldCharSets.end();
- static constexpr OUStringLiteral aHeaderId( NSPREFIX "header-field" );
- static constexpr OUStringLiteral aFooterId( aOOOAttrFooterField );
- static constexpr OUStringLiteral aDateTimeId( aOOOAttrDateTimeField );
+ static constexpr OUString aHeaderId( NSPREFIX "header-field"_ustr );
+ static constexpr OUString aFooterId( aOOOAttrFooterField );
+ static constexpr OUString aDateTimeId( aOOOAttrDateTimeField );
static const OUString aVariableDateTimeId( aOOOAttrDateTimeField + "-variable" );
const UCharSet * pCharSet = nullptr;
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 4c3f033d02eb..0d622b4e0fce 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -41,7 +41,7 @@
#include <unotools/mediadescriptor.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/zcodec.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
@@ -77,6 +77,8 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
mnVisiblePage( -1 ),
mpObjects( nullptr ),
mbExportShapeSelection(false),
+ mbIsPreview(false),
+ mbShouldCompress(false),
mbWriterFilter(false),
mbCalcFilter(false),
mbImpressFilter(false),
@@ -99,6 +101,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
mbWriterFilter = false;
mbCalcFilter = false;
mbImpressFilter = false;
+ mbShouldCompress = false;
if(mxDstDoc.is()) // Import works for Impress / draw only
return filterImpressOrDraw(rDescriptor);
@@ -108,6 +111,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;
@@ -127,12 +139,84 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
mbCalcFilter = true;
return filterWriterOrCalc(rDescriptor);
}
+ else if(sFilterName == "draw_svgz_Export")
+ {
+ mbShouldCompress = true;
+ }
break;
}
}
return filterImpressOrDraw(rDescriptor);
}
+css::uno::Reference<css::frame::XController> SVGFilter::fillDrawImpressSelectedPages()
+{
+ uno::Reference<frame::XDesktop2> xDesktop(frame::Desktop::create(mxContext));
+ uno::Reference<frame::XFrame> xFrame = xDesktop->getCurrentFrame(); // Manage headless case
+ if (!xFrame)
+ return {};
+ uno::Reference<frame::XController> xController(xFrame->getController(), uno::UNO_SET_THROW);
+ uno::Reference<drawing::framework::XControllerManager> xManager(xController,
+ uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::framework::XConfigurationController> xConfigController(
+ xManager->getConfigurationController());
+
+ // which view configuration are we in?
+ //
+ // * traverse Impress resources to find slide preview pane, grab selection from there
+ // * otherwise, fallback to current slide
+ //
+ const uno::Sequence<uno::Reference<drawing::framework::XResourceId>> aResIds(
+ xConfigController->getCurrentConfiguration()->getResources(
+ {}, "", drawing::framework::AnchorBindingMode_INDIRECT));
+
+ for (const uno::Reference<drawing::framework::XResourceId>& rResId : aResIds)
+ {
+ // can we somehow obtain the slidesorter from the Impress framework?
+ if (rResId->getResourceURL() == "private:resource/view/SlideSorter")
+ {
+ // got it, grab current selection from there
+ uno::Reference<view::XSelectionSupplier> xSelectionSupplier(
+ xConfigController->getResource(rResId), uno::UNO_QUERY);
+ if (!xSelectionSupplier)
+ continue;
+
+ Sequence<Reference<XInterface>> aSelectedPageSequence;
+ if (xSelectionSupplier->getSelection() >>= aSelectedPageSequence)
+ {
+ for (auto& xInterface : aSelectedPageSequence)
+ {
+ uno::Reference<drawing::XDrawPage> xDrawPage(xInterface, uno::UNO_QUERY);
+
+ if (Reference<XPropertySet> xPropSet{ xDrawPage, UNO_QUERY })
+ {
+ Reference<XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
+ if (xPropSetInfo && xPropSetInfo->hasPropertyByName("Visible"))
+ {
+ bool bIsSlideVisible = true; // default: true
+ xPropSet->getPropertyValue("Visible") >>= bIsSlideVisible;
+ if (!bIsSlideVisible)
+ continue;
+ }
+ }
+ mSelectedPages.push_back(xDrawPage);
+ }
+
+ // and stop looping. It is likely not getting better
+ break;
+ }
+ }
+ }
+
+ if (mSelectedPages.empty())
+ {
+ // apparently failed to clean selection - fallback to current page
+ uno::Reference<drawing::XDrawView> xDrawView(xController, uno::UNO_QUERY_THROW);
+ mSelectedPages.push_back(xDrawView->getCurrentPage());
+ }
+ return xController;
+}
+
bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescriptor )
{
SolarMutexGuard aGuard;
@@ -221,7 +305,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)
{
@@ -275,15 +359,15 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
// create a SdrModel-GraphicObject to insert to page
SdrPage* pTargetSdrPage(pSvxDrawPage->GetSdrPage());
- std::unique_ptr< SdrGrafObj, SdrObjectFreeOp > aNewSdrGrafObj;
+ rtl::Reference< SdrGrafObj > aNewSdrGrafObj;
// tdf#118232 only add an SdrGrafObj when we have Geometry
if(!bContainsNoGeometry)
{
- aNewSdrGrafObj.reset(
+ aNewSdrGrafObj =
new SdrGrafObj(
pTargetSdrPage->getSdrModelFromSdrPage(),
- aGraphic));
+ aGraphic);
}
// Evtl. adapt the GraphicPrefSize to target-MapMode of target-Model
@@ -311,7 +395,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
static_cast< double >(pTargetSdrPage->GetRightBorder()) / aPageSize.Width() +
static_cast< double >(pTargetSdrPage->GetUpperBorder()) / aPageSize.Height() +
static_cast< double >(pTargetSdrPage->GetLowerBorder()) / aPageSize.Height()) / 4.0);
- const tools::Long nAllBorder(basegfx::fround((aGraphicSize.Width() + aGraphicSize.Height()) * fBorderRelation * 0.5));
+ const tools::Long nAllBorder(basegfx::fround<tools::Long>((aGraphicSize.Width() + aGraphicSize.Height()) * fBorderRelation * 0.5));
// Adapt PageSize and Border stuff. To get all MasterPages and PresObjs
// correctly adapted, do not just use
@@ -339,7 +423,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
aGraphicSize));
// insert to page (owner change of SdrGrafObj)
- pTargetSdrPage->InsertObject(aNewSdrGrafObj.release());
+ pTargetSdrPage->InsertObject(aNewSdrGrafObj.get());
}
// done - set positive result now
@@ -374,68 +458,9 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
}
}
- uno::Reference<frame::XDesktop2> xDesktop(frame::Desktop::create(mxContext));
uno::Reference<frame::XController > xController;
- if (xDesktop->getCurrentFrame().is() && !bPageProvided) // Manage headless case
- {
- uno::Reference<frame::XFrame> xFrame(xDesktop->getCurrentFrame(), uno::UNO_SET_THROW);
- xController.set(xFrame->getController(), uno::UNO_SET_THROW);
- uno::Reference<drawing::XDrawView> xDrawView(xController, uno::UNO_QUERY_THROW);
- uno::Reference<drawing::framework::XControllerManager> xManager(xController, uno::UNO_QUERY_THROW);
- uno::Reference<drawing::framework::XConfigurationController> xConfigController(xManager->getConfigurationController());
-
- // which view configuration are we in?
- //
- // * traverse Impress resources to find slide preview pane, grab selection from there
- // * otherwise, fallback to current slide
- //
- const uno::Sequence<uno::Reference<drawing::framework::XResourceId> > aResIds(
- xConfigController->getCurrentConfiguration()->getResources(
- uno::Reference<drawing::framework::XResourceId>(),
- "",
- drawing::framework::AnchorBindingMode_INDIRECT));
-
- for( const uno::Reference<drawing::framework::XResourceId>& rResId : aResIds )
- {
- // can we somehow obtain the slidesorter from the Impress framework?
- if( rResId->getResourceURL() == "private:resource/view/SlideSorter" )
- {
- // got it, grab current selection from there
- uno::Reference<drawing::framework::XResource> xRes(
- xConfigController->getResource(rResId));
-
- uno::Reference< view::XSelectionSupplier > xSelectionSupplier(
- xRes,
- uno::UNO_QUERY );
- if( xSelectionSupplier.is() )
- {
- uno::Any aSelection = xSelectionSupplier->getSelection();
- if( aSelection.hasValue() )
- {
- Sequence< Reference< XInterface > > aSelectedPageSequence;
- aSelection >>= aSelectedPageSequence;
- mSelectedPages.resize( aSelectedPageSequence.getLength() );
- for( size_t j=0; j<mSelectedPages.size(); ++j )
- {
- uno::Reference< drawing::XDrawPage > xDrawPage( aSelectedPageSequence[j],
- uno::UNO_QUERY );
- mSelectedPages[j] = xDrawPage;
- }
-
- // and stop looping. It is likely not getting better
- break;
- }
- }
- }
- }
-
- if( mSelectedPages.empty() )
- {
- // apparently failed to clean selection - fallback to current page
- mSelectedPages.resize( 1 );
- mSelectedPages[0] = xDrawView->getCurrentPage();
- }
- }
+ if (!bPageProvided)
+ xController = fillDrawImpressSelectedPages();
/*
* Export all slides, or requested "PagePos"
@@ -454,19 +479,30 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
{
sal_Int32 nDPCount = xDrawPages->getCount();
- mSelectedPages.resize( nPageToExport != -1 ? 1 : nDPCount );
sal_Int32 i;
for( i = 0; i < nDPCount; ++i )
{
if( nPageToExport != -1 && nPageToExport == i )
{
uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY );
- mSelectedPages[0] = xDrawPage;
+ mSelectedPages.push_back(xDrawPage);
}
else
{
uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY );
- mSelectedPages[i] = xDrawPage;
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ bool bIsSlideVisible = true; // default: true
+ if (xPropSet.is())
+ {
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("Visible"))
+ {
+ xPropSet->getPropertyValue( "Visible" ) >>= bIsSlideVisible;
+ if (!bIsSlideVisible)
+ continue;
+ }
+ }
+ mSelectedPages.push_back(xDrawPage);
}
}
}
@@ -513,8 +549,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
sal_Int32 i = 0;
for (auto const& masterPageTarget : aMasterPageTargetSet)
{
- uno::Reference< drawing::XDrawPage > xMasterPage( masterPageTarget, uno::UNO_QUERY );
- mMasterPageTargets[i++] = xMasterPage;
+ mMasterPageTargets[i++].set(masterPageTarget, uno::UNO_QUERY);
}
bRet = implExport( rDescriptor );
@@ -547,11 +582,8 @@ bool SVGFilter::filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor
uno::Reference<frame::XDesktop2> xDesktop(frame::Desktop::create(mxContext));
uno::Reference<frame::XController > xController;
- if (xDesktop->getCurrentFrame().is())
- {
- uno::Reference<frame::XFrame> xFrame(xDesktop->getCurrentFrame(), uno::UNO_SET_THROW);
+ if (uno::Reference<frame::XFrame> xFrame = xDesktop->getCurrentFrame())
xController.set(xFrame->getController(), uno::UNO_SET_THROW);
- }
Reference< view::XSelectionSupplier > xSelection (xController, UNO_QUERY);
if (!xSelection.is())
@@ -560,9 +592,8 @@ bool SVGFilter::filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor
// Select only one draw page
uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY );
uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSupplier->getDrawPages();
- uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex(0), uno::UNO_QUERY );
mSelectedPages.resize( 1 );
- mSelectedPages[0] = xDrawPage;
+ mSelectedPages[0].set(xDrawPages->getByIndex(0), uno::UNO_QUERY);
bool bGotSelection = xSelection->getSelection() >>= maShapeSelection;
@@ -690,7 +721,7 @@ private:
if(!mbIsSVG)
{
const sal_Int8 aMagic[] = {'<', 's', 'v', 'g'};
- const sal_Int32 nMagicSize(SAL_N_ELEMENTS(aMagic));
+ const sal_Int32 nMagicSize(std::size(aMagic));
mbIsSVG = impCheckForMagic(aMagic, nMagicSize);
}
@@ -698,7 +729,7 @@ private:
if(!mbIsSVG)
{
const sal_Int8 aMagic[] = {'D', 'O', 'C', 'T', 'Y', 'P', 'E', ' ', 's', 'v', 'g'};
- const sal_Int32 nMagicSize(SAL_N_ELEMENTS(aMagic));
+ const sal_Int32 nMagicSize(std::size(aMagic));
mbIsSVG = impCheckForMagic(aMagic, nMagicSize);
}
@@ -742,7 +773,7 @@ public:
{
// xmlns:ooo
const sal_Int8 aMagic[] = {'x', 'm', 'l', 'n', 's', ':', 'o', 'o', 'o'};
- const sal_Int32 nMagicSize(SAL_N_ELEMENTS(aMagic));
+ const sal_Int32 nMagicSize(std::size(aMagic));
return impCheckForMagic(aMagic, nMagicSize);
}
@@ -758,7 +789,7 @@ public:
{
// ooo:meta_slides
const sal_Int8 aMagic[] = {'o', 'o', 'o', ':', 'm', 'e', 't', 'a', '_', 's', 'l', 'i', 'd', 'e', 's'};
- const sal_Int32 nMagicSize(SAL_N_ELEMENTS(aMagic));
+ const sal_Int32 nMagicSize(std::size(aMagic));
return impCheckForMagic(aMagic, nMagicSize);
}
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index eb889e81662e..916bd9d263ad 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/xml/sax/XWriter.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
@@ -52,11 +53,12 @@ using namespace ::com::sun::star::xml::sax;
#define SVG_EXPORT_ALLPAGES ((sal_Int32)-1)
+namespace com::sun::star::frame { class XController; }
// Placeholder tag used into the ImplWriteActions method to filter text placeholder fields
-inline constexpr OUStringLiteral sPlaceholderTag = u"<[:isPlaceholder:]>";
+inline constexpr OUString sPlaceholderTag = u"<[:isPlaceholder:]>"_ustr;
// This tag is used for exporting a slide background made of tiled bitmaps
-inline constexpr OStringLiteral sTiledBackgroundTag = "SLIDE_BACKGROUND";
+inline constexpr OString sTiledBackgroundTag = "SLIDE_BACKGROUND"_ostr;
class SVGExport : public SvXMLExport
{
@@ -208,7 +210,10 @@ private:
bool mbExportShapeSelection;
Sequence< PropertyValue > maFilterData;
Reference< css::drawing::XDrawPage > mxDefaultPage;
+ Reference<css::task::XStatusIndicator> mxStatusIndicator;
std::vector< Reference< css::drawing::XDrawPage > > mSelectedPages;
+ bool mbIsPreview;
+ bool mbShouldCompress;
bool mbWriterFilter;
bool mbCalcFilter;
@@ -291,6 +296,8 @@ private:
bool filterImpressOrDraw( const Sequence< PropertyValue >& rDescriptor );
bool filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor );
+ css::uno::Reference<css::frame::XController> fillDrawImpressSelectedPages();
+
protected:
// XFilter
diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx
index b0cbed97e4e7..014975b8d229 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>
@@ -251,7 +252,6 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
void SVGFontExport::implEmbedGlyph( OutputDevice const & rOut, const OUString& rCellStr )
{
tools::PolyPolygon aPolyPoly;
- const sal_Unicode nSpace = ' ';
if( !rOut.GetTextOutline( aPolyPoly, rCellStr ) )
return;
@@ -260,14 +260,10 @@ void SVGFontExport::implEmbedGlyph( OutputDevice const & rOut, const OUString& r
aPolyPoly.Scale( 1.0, -1.0 );
- if( !rOut.GetTextBoundRect( aBoundRect, rCellStr ) )
+ if (rCellStr == " " || !rOut.GetTextBoundRect(aBoundRect, rCellStr))
aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( rCellStr ), 0 ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", rCellStr );
-
- if( rCellStr[ 0 ] == nSpace && rCellStr.getLength() == 1 )
- aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( OUString(' ') ), 0 ) );
-
mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", OUString::number( aBoundRect.GetWidth() ) );
const OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, false ) );
@@ -307,9 +303,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..b7b9d741ebef 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -37,6 +37,10 @@
#include <xmloff/namespacemap.hxx>
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <o3tl/string_view.hxx>
+#include <svx/svdomedia.hxx>
+#include <basegfx/utils/bgradient.hxx>
+#include <tools/vcompat.hxx>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
@@ -48,44 +52,45 @@
#include <memory>
-
-constexpr OUStringLiteral aPrefixClipPathId = u"clip_path_";
-
-constexpr OUStringLiteral aXMLElemG = u"g";
-constexpr OUStringLiteral aXMLElemDefs = u"defs";
-constexpr OUStringLiteral aXMLElemText = u"text";
-constexpr OUStringLiteral aXMLElemTspan = u"tspan";
-constexpr OUStringLiteral aXMLElemLinearGradient = u"linearGradient";
-constexpr OUStringLiteral aXMLElemStop = u"stop";
-
-constexpr OUStringLiteral aXMLAttrTransform = u"transform";
-constexpr OUStringLiteral aXMLAttrStyle = u"style";
-constexpr OUStringLiteral aXMLAttrId = u"id";
-constexpr OUStringLiteral aXMLAttrX = u"x";
-constexpr OUStringLiteral aXMLAttrY = u"y";
-constexpr OUStringLiteral aXMLAttrX1 = u"x1";
-constexpr OUStringLiteral aXMLAttrY1 = u"y1";
-constexpr OUStringLiteral aXMLAttrX2 = u"x2";
-constexpr OUStringLiteral aXMLAttrY2 = u"y2";
-constexpr OUStringLiteral aXMLAttrCX = u"cx";
-constexpr OUStringLiteral aXMLAttrCY = u"cy";
-constexpr OUStringLiteral aXMLAttrRX = u"rx";
-constexpr OUStringLiteral aXMLAttrRY = u"ry";
-constexpr OUStringLiteral aXMLAttrWidth = u"width";
-constexpr OUStringLiteral aXMLAttrHeight = u"height";
-constexpr OUStringLiteral aXMLAttrStrokeWidth = u"stroke-width";
-constexpr OUStringLiteral aXMLAttrFill = u"fill";
-constexpr OUStringLiteral aXMLAttrFontFamily = u"font-family";
-constexpr OUStringLiteral aXMLAttrFontSize = u"font-size";
-constexpr OUStringLiteral aXMLAttrFontStyle = u"font-style";
-constexpr OUStringLiteral aXMLAttrFontWeight = u"font-weight";
-constexpr OUStringLiteral aXMLAttrTextDecoration = u"text-decoration";
-constexpr OUStringLiteral aXMLAttrXLinkHRef = u"xlink:href";
-constexpr OUStringLiteral aXMLAttrGradientUnits = u"gradientUnits";
-constexpr OUStringLiteral aXMLAttrOffset = u"offset";
-constexpr OUStringLiteral aXMLAttrStopColor = u"stop-color";
-constexpr OUStringLiteral aXMLAttrStrokeLinejoin = u"stroke-linejoin";
-constexpr OUStringLiteral aXMLAttrStrokeLinecap = u"stroke-linecap";
+using namespace ::com::sun::star::style;
+
+constexpr OUString aPrefixClipPathId = u"clip_path_"_ustr;
+
+constexpr OUString aXMLElemG = u"g"_ustr;
+constexpr OUString aXMLElemDefs = u"defs"_ustr;
+constexpr OUString aXMLElemText = u"text"_ustr;
+constexpr OUString aXMLElemTspan = u"tspan"_ustr;
+constexpr OUString aXMLElemLinearGradient = u"linearGradient"_ustr;
+constexpr OUString aXMLElemStop = u"stop"_ustr;
+
+constexpr OUString aXMLAttrTransform = u"transform"_ustr;
+constexpr OUString aXMLAttrStyle = u"style"_ustr;
+constexpr OUString aXMLAttrId = u"id"_ustr;
+constexpr OUString aXMLAttrX = u"x"_ustr;
+constexpr OUString aXMLAttrY = u"y"_ustr;
+constexpr OUString aXMLAttrX1 = u"x1"_ustr;
+constexpr OUString aXMLAttrY1 = u"y1"_ustr;
+constexpr OUString aXMLAttrX2 = u"x2"_ustr;
+constexpr OUString aXMLAttrY2 = u"y2"_ustr;
+constexpr OUString aXMLAttrCX = u"cx"_ustr;
+constexpr OUString aXMLAttrCY = u"cy"_ustr;
+constexpr OUString aXMLAttrRX = u"rx"_ustr;
+constexpr OUString aXMLAttrRY = u"ry"_ustr;
+constexpr OUString aXMLAttrWidth = u"width"_ustr;
+constexpr OUString aXMLAttrHeight = u"height"_ustr;
+constexpr OUString aXMLAttrStrokeWidth = u"stroke-width"_ustr;
+constexpr OUString aXMLAttrFill = u"fill"_ustr;
+constexpr OUString aXMLAttrFontFamily = u"font-family"_ustr;
+constexpr OUString aXMLAttrFontSize = u"font-size"_ustr;
+constexpr OUString aXMLAttrFontStyle = u"font-style"_ustr;
+constexpr OUString aXMLAttrFontWeight = u"font-weight"_ustr;
+constexpr OUString aXMLAttrTextDecoration = u"text-decoration"_ustr;
+constexpr OUString aXMLAttrXLinkHRef = u"xlink:href"_ustr;
+constexpr OUString aXMLAttrGradientUnits = u"gradientUnits"_ustr;
+constexpr OUString aXMLAttrOffset = u"offset"_ustr;
+constexpr OUString aXMLAttrStopColor = u"stop-color"_ustr;
+constexpr OUString aXMLAttrStrokeLinejoin = u"stroke-linejoin"_ustr;
+constexpr OUString aXMLAttrStrokeLinecap = u"stroke-linecap"_ustr;
vcl::PushFlags SVGContextHandler::getPushFlags() const
@@ -217,8 +222,8 @@ void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFi
void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const Gradient& rGradient, OUString& rGradientId )
{
if( rObjRect.GetWidth() && rObjRect.GetHeight() &&
- ( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial ||
- rGradient.GetStyle() == GradientStyle::Radial || rGradient.GetStyle() == GradientStyle::Elliptical ) )
+ ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ||
+ rGradient.GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) )
{
SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, true, true );
Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() );
@@ -246,7 +251,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
std::unique_ptr< SvXMLElementExport > apGradient;
OUString aColorStr;
- if( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial )
+ if( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
tools::Polygon aLinePoly( 2 );
@@ -265,9 +270,9 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
// write stop values
double fBorder = static_cast< double >( rGradient.GetBorder() ) *
- ( ( rGradient.GetStyle() == GradientStyle::Axial ) ? 0.005 : 0.01 );
+ ( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? 0.005 : 0.01 );
- ImplGetColorStr( ( rGradient.GetStyle() == GradientStyle::Axial ) ? aEndColor : aStartColor, aColorStr );
+ ImplGetColorStr( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? aEndColor : aStartColor, aColorStr );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( fBorder ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
@@ -275,7 +280,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
SvXMLElementExport aDesc2( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true );
}
- if( rGradient.GetStyle() == GradientStyle::Axial )
+ if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
ImplGetColorStr( aStartColor, aColorStr );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( 0.5 ) );
@@ -286,7 +291,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
}
}
- if( rGradient.GetStyle() != GradientStyle::Axial )
+ if( rGradient.GetStyle() != css::awt::GradientStyle_AXIAL )
fBorder = 0.0;
ImplGetColorStr( aEndColor, aColorStr );
@@ -301,8 +306,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 ) ) );
@@ -633,8 +637,13 @@ sal_Int32 SVGTextWriter::setTextPosition(const GDIMetaFile& rMtf, size_t& nCurAc
{
// Text is found in the inner metafile.
bConfigured = true;
+
+ // nTextFound == 1 is only possible if the inner setTextPosition() had bEmpty ==
+ // false, adjust our bEmpty accordingly.
+ bEmpty = false;
+
mrActionWriter.StartMask(pA->GetPoint(), pA->GetSize(), pA->GetGradient(),
- nWriteFlags, &maTextOpacity);
+ nWriteFlags, pA->getSVGTransparencyColorStops(), &maTextOpacity);
}
}
break;
@@ -1099,7 +1108,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;
}
@@ -1144,8 +1165,8 @@ bool SVGTextWriter::nextTextPortion()
Reference < XTextField > xTextField( xRangePropSet->getPropertyValue( "TextField" ), UNO_QUERY );
if( xTextField.is() )
{
- static const OUStringLiteral sServicePrefix(u"com.sun.star.text.textfield.");
- static const OUStringLiteral sPresentationServicePrefix(u"com.sun.star.presentation.TextField.");
+ static constexpr OUString sServicePrefix(u"com.sun.star.text.textfield."_ustr);
+ static constexpr OUString sPresentationServicePrefix(u"com.sun.star.presentation.TextField."_ustr);
Reference< XServiceInfo > xService( xTextField, UNO_QUERY );
const Sequence< OUString > aServices = xService->getSupportedServiceNames();
@@ -1178,8 +1199,8 @@ bool SVGTextWriter::nextTextPortion()
#if OSL_DEBUG_LEVEL > 0
sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
#endif
- // This case handle Date or Time text field inserted by the user
- // on both page/master page. It doesn't handle the standard Date/Time field.
+ // This case handles Date or Time text field inserted by the user
+ // on both page/master page. It doesn't handle the standard DateTime field.
if( sFieldName == "DateTime" )
{
Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
@@ -1188,7 +1209,7 @@ bool SVGTextWriter::nextTextPortion()
Reference<XPropertySetInfo> xPropSetInfo = xTextFieldPropSet->getPropertySetInfo();
if( xPropSetInfo.is() )
{
- // The standard Date/Time field has no property.
+ // The standard DateTime field has no property.
// Trying to get a property value on such field would cause a runtime exception.
// So the hasPropertyByName check is needed.
bool bIsFixed = true;
@@ -1197,7 +1218,7 @@ bool SVGTextWriter::nextTextPortion()
bool bIsDate = true;
if( xPropSetInfo->hasPropertyByName("IsDate") && ( ( xTextFieldPropSet->getPropertyValue( "IsDate" ) ) >>= bIsDate ) )
{
- msDateTimeType = OUString::createFromAscii( bIsDate ? "<date>" : "<time>" );
+ msDateTimeType = OUString::createFromAscii( bIsDate ? "Date" : "Time" );
}
}
}
@@ -1329,7 +1350,6 @@ void SVGTextWriter::startTextParagraph()
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextParagraph" );
}
maParentFont = vcl::Font();
- addFontAttributes( /* isTexTContainer: */ true );
mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ));
if( !mbIsListLevelStyleImage )
@@ -1612,6 +1632,12 @@ void SVGTextWriter::writeTextPortion( const Point& rPos,
continue;
if( sContent == "\n" )
mbLineBreak = true;
+ else if (sContent == "\t")
+ {
+ // Need to emit position for the next text portion after a tab, otherwise the tab
+ // would appear as if it has 0 width.
+ mbPositioningNeeded = true;
+ }
if( sContent.match( rText, nStartPos ) )
bNotSync = false;
}
@@ -1722,7 +1748,18 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
if( mbIsPlaceholderShape )
{
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "PlaceholderText" );
+ OUString sClass = "PlaceholderText";
+ // This case handles Date or Time text field inserted by the user
+ // on both page/master page. It doesn't handle the standard DateTime field.
+ if( !msDateTimeType.isEmpty() )
+ {
+ sClass += " " + msDateTimeType;
+ }
+ else if( !msTextFieldType.isEmpty() )
+ {
+ sClass += " " + msTextFieldType;
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", sClass );
}
addFontAttributes( /* isTexTContainer: */ false );
@@ -1753,28 +1790,11 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
mrExport.GetDocHandler()->characters( msPageCount );
}
- // This case handle Date or Time text field inserted by the user
- // on both page/master page. It doesn't handle the standard Date/Time field.
- else if ( !msDateTimeType.isEmpty() )
- {
- SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
- mrExport.GetDocHandler()->characters( msDateTimeType );
- }
- else if( mbIsPlaceholderShape && rText.startsWith("<") && rText.endsWith(">") )
- {
- OUString sContent;
- if( msTextFieldType == "PageNumber" )
- sContent = "<number>";
- else if( msTextFieldType == "PageName" )
- sContent = "<slide-name>";
- else
- sContent = rText;
-
- SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
- mrExport.GetDocHandler()->characters( sContent );
- }
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 +1816,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);
@@ -1873,8 +1894,8 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol
OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bool bLine )
{
OUStringBuffer aPathData;
- static const OUStringLiteral aBlank( u" " );
- static const OUStringLiteral aComma( u"," );
+ static constexpr OUString aBlank( u" "_ustr );
+ static constexpr OUString aComma( u","_ustr );
Point aPolyPoint;
for( tools::Long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
@@ -2100,10 +2121,11 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
ImplMap( rShape.maShapePolyPoly, aPolyPoly );
const bool bLineOnly
- = (rShape.maShapeFillColor == COL_TRANSPARENT) && (!rShape.mapShapeGradient);
+ = (rShape.maShapeFillColor == COL_TRANSPARENT) && (!rShape.moShapeGradient);
tools::Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
- maAttributeWriter.AddPaintAttr( rShape.maShapeLineColor, rShape.maShapeFillColor, &aBoundRect, rShape.mapShapeGradient.get() );
+ maAttributeWriter.AddPaintAttr( rShape.maShapeLineColor, rShape.maShapeFillColor, &aBoundRect,
+ rShape.moShapeGradient ? &*rShape.moShapeGradient : nullptr );
if( !rShape.maId.isEmpty() )
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, rShape.maId );
@@ -2165,7 +2187,7 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
for( size_t k = 0; k < rShape.maDashArray.size(); ++k )
{
- const sal_Int32 nDash = ImplMap( FRound( rShape.maDashArray[ k ] ) );
+ const sal_Int32 nDash = ImplMap(basegfx::fround(rShape.maDashArray[k]));
if( k )
aDashArrayStr.append(",");
@@ -2293,12 +2315,12 @@ void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly,
void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient,
- sal_uInt32 nWriteFlags)
+ sal_uInt32 nWriteFlags, const basegfx::BColorStops* pColorStops)
{
- if ( rGradient.GetStyle() == GradientStyle::Linear ||
- rGradient.GetStyle() == GradientStyle::Axial )
+ if ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR ||
+ rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
- ImplWriteGradientLinear( rPolyPoly, rGradient );
+ ImplWriteGradientLinear( rPolyPoly, rGradient, pColorStops );
}
else
{
@@ -2308,7 +2330,7 @@ void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly,
void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPoly,
- const Gradient& rGradient )
+ const Gradient& rGradient, const basegfx::BColorStops* pColorStops )
{
if( !rPolyPoly.Count() )
return;
@@ -2351,60 +2373,53 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo
{
SvXMLElementExport aElemLinearGradient( mrExport, XML_NAMESPACE_NONE, aXMLElemLinearGradient, true, true );
+ basegfx::BColorStops aColorStops;
- const Color aStartColor = ImplGetColorWithIntensity( rGradient.GetStartColor(), rGradient.GetStartIntensity() );
- const Color aEndColor = ImplGetColorWithIntensity( rGradient.GetEndColor(), rGradient.GetEndIntensity() );
- double fBorderOffset = rGradient.GetBorder() / 100.0;
- const sal_uInt16 nSteps = rGradient.GetSteps();
- if( rGradient.GetStyle() == GradientStyle::Linear )
+ if (nullptr != pColorStops && pColorStops->size() > 1)
{
- // Emulate non-smooth gradient
- if( 0 < nSteps && nSteps < 100 )
- {
- double fOffsetStep = ( 1.0 - fBorderOffset ) / static_cast<double>(nSteps);
- for( sal_uInt16 i = 0; i < nSteps; i++ ) {
- Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep );
- aColor = ImplGetGradientColor( aStartColor, aEndColor, ( i + 1 ) / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, fBorderOffset + ( i + 1 ) * fOffsetStep );
- }
- }
- else
- {
- ImplWriteGradientStop( aStartColor, fBorderOffset );
- ImplWriteGradientStop( aEndColor, 1.0 );
- }
+ // if we got the real colr stops, use them. That way we are
+ // now capable in the SVG export to export real multi color gradients
+ aColorStops = *pColorStops;
}
else
{
- fBorderOffset /= 2;
- // Emulate non-smooth gradient
- if( 0 < nSteps && nSteps < 100 )
- {
- double fOffsetStep = ( 0.5 - fBorderOffset ) / static_cast<double>(nSteps);
- // Upper half
- for( sal_uInt16 i = 0; i < nSteps; i++ )
- {
- Color aColor = ImplGetGradientColor( aEndColor, aStartColor, i / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep );
- aColor = ImplGetGradientColor( aEndColor, aStartColor, (i + 1 ) / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, fBorderOffset + i * fOffsetStep );
- }
- // Lower half
- for( sal_uInt16 i = 0; i < nSteps; i++ )
- {
- Color aColor = ImplGetGradientColor( aStartColor, aEndColor, i / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep );
- aColor = ImplGetGradientColor( aStartColor, aEndColor, (i + 1 ) / static_cast<double>(nSteps) );
- ImplWriteGradientStop( aColor, 0.5 + (i + 1) * fOffsetStep );
- }
- }
- else
- {
- ImplWriteGradientStop( aEndColor, fBorderOffset );
- ImplWriteGradientStop( aStartColor, 0.5 );
- ImplWriteGradientStop( aEndColor, 1.0 - fBorderOffset );
- }
+ // else create color stops with 'old' start/endColor
+ aColorStops.emplace_back(0.0, rGradient.GetStartColor().getBColor());
+ aColorStops.emplace_back(1.0, rGradient.GetEndColor().getBColor());
+ }
+
+ // create a basegfx::BGradient with the info to be able to directly
+ // use the tooling it offers
+ basegfx::BGradient aGradient(
+ aColorStops,
+ rGradient.GetStyle(),
+ rGradient.GetAngle(),
+ rGradient.GetOfsX(),
+ rGradient.GetOfsY(),
+ rGradient.GetBorder(),
+ rGradient.GetStartIntensity(),
+ rGradient.GetEndIntensity(),
+ rGradient.GetSteps());
+
+ // apply Start/EndIntensity to the whole color stops - if used
+ aGradient.tryToApplyStartEndIntensity();
+
+ // apply border to color stops - if used
+ aGradient.tryToApplyBorder();
+
+ // convert from 'axial' to linear - if needed and used
+ aGradient.tryToApplyAxial();
+
+ // apply 'Steps' as hard gradient stops - if used
+ aGradient.tryToApplySteps();
+
+ // write prepared gradient stops
+ for (const auto& rCand : aGradient.GetColorStops())
+ {
+ ImplWriteGradientStop(
+ Color(rCand.getStopColor()),
+ rCand.getStopOffset());
+ // aStartColor, fBorderOffset );
}
}
}
@@ -2442,28 +2457,9 @@ Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor,
}
-Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor,
- const Color& rEndColor,
- double fOffset )
-{
- tools::Long nRedStep = rEndColor.GetRed() - rStartColor.GetRed();
- tools::Long nNewRed = rStartColor.GetRed() + static_cast<tools::Long>( nRedStep * fOffset );
- nNewRed = ( nNewRed < 0 ) ? 0 : ( nNewRed > 0xFF) ? 0xFF : nNewRed;
-
- tools::Long nGreenStep = rEndColor.GetGreen() - rStartColor.GetGreen();
- tools::Long nNewGreen = rStartColor.GetGreen() + static_cast<tools::Long>( nGreenStep * fOffset );
- nNewGreen = ( nNewGreen < 0 ) ? 0 : ( nNewGreen > 0xFF) ? 0xFF : nNewGreen;
-
- tools::Long nBlueStep = rEndColor.GetBlue() - rStartColor.GetBlue();
- tools::Long nNewBlue = rStartColor.GetBlue() + static_cast<tools::Long>( nBlueStep * fOffset );
- nNewBlue = ( nNewBlue < 0 ) ? 0 : ( nNewBlue > 0xFF) ? 0xFF : nNewBlue;
-
- return Color( static_cast<sal_uInt8>(nNewRed), static_cast<sal_uInt8>(nNewGreen), static_cast<sal_uInt8>(nNewBlue) );
-}
-
void SVGActionWriter::StartMask(const Point& rDestPt, const Size& rDestSize,
const Gradient& rGradient, sal_uInt32 nWriteFlags,
- OUString* pTextFillOpacity)
+ const basegfx::BColorStops* pColorStops, OUString* pTextFillOpacity)
{
OUString aStyle;
if (rGradient.GetStartColor() == rGradient.GetEndColor())
@@ -2504,7 +2500,19 @@ void SVGActionWriter::StartMask(const Point& rDestPt, const Size& rDestSize,
aGradient.SetEndColor(aTmpColor);
aGradient.SetEndIntensity(nTmpIntensity);
- ImplWriteGradientEx(aPolyPolygon, aGradient, nWriteFlags);
+ // tdf#155479 prep local ColorStops. The code above
+ // implies that the ColorStops need to be reversed,
+ // so do so & use change of local ptr to represent this
+ basegfx::BColorStops aLocalColorStops;
+
+ if (nullptr != pColorStops)
+ {
+ aLocalColorStops = *pColorStops;
+ aLocalColorStops.reverseColorStops();
+ pColorStops = &aLocalColorStops;
+ }
+
+ ImplWriteGradientEx(aPolyPolygon, aGradient, nWriteFlags, pColorStops);
}
}
@@ -2514,7 +2522,7 @@ void SVGActionWriter::StartMask(const Point& rDestPt, const Size& rDestSize,
}
void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize,
- const Gradient& rGradient, sal_uInt32 nWriteFlags)
+ const Gradient& rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops* pColorStops)
{
Point aSrcPt(rMtf.GetPrefMapMode().GetOrigin());
const Size aSrcSize(rMtf.GetPrefSize());
@@ -2527,8 +2535,8 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con
if (fScaleX != 1.0 || fScaleY != 1.0)
{
rMtf.Scale(fScaleX, fScaleY);
- aSrcPt.setX(FRound(aSrcPt.X() * fScaleX));
- aSrcPt.setY(FRound(aSrcPt.Y() * fScaleY));
+ aSrcPt.setX(basegfx::fround<tools::Long>(aSrcPt.X() * fScaleX));
+ aSrcPt.setY(basegfx::fround<tools::Long>(aSrcPt.Y() * fScaleY));
}
nMoveX = rDestPt.X() - aSrcPt.X();
@@ -2541,7 +2549,7 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con
std::unique_ptr<SvXMLElementExport> pElemG;
if (!maTextWriter.hasTextOpacity())
{
- StartMask(rDestPt, rDestSize, rGradient, nWriteFlags);
+ StartMask(rDestPt, rDestSize, rGradient, nWriteFlags, pColorStops);
pElemG.reset(
new SvXMLElementExport(mrExport, XML_NAMESPACE_NONE, aXMLElemG, true, true));
}
@@ -2554,7 +2562,7 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con
void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
- o3tl::span<const sal_Int32> pDXArray, tools::Long nWidth )
+ KernArraySpan pDXArray, tools::Long nWidth )
{
const FontMetric aMetric( mpVDev->GetFontMetric() );
@@ -2645,7 +2653,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
- o3tl::span<const sal_Int32> pDXArray, tools::Long nWidth,
+ KernArraySpan pDXArray, tools::Long nWidth,
Color aTextColor )
{
sal_Int32 nLen = rText.getLength();
@@ -2662,18 +2670,17 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
ImplMap( rPos, aPos );
- std::vector<sal_Int32> aTmpArray(nLen);
+ KernArray aTmpArray;
// get text sizes
if( !pDXArray.empty() )
{
aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
- memcpy(aTmpArray.data(), pDXArray.data(), nLen * sizeof(sal_Int32));
+ aTmpArray.assign(pDXArray);
}
else
{
- aNormSize = Size( mpVDev->GetTextArray( rText, &aTmpArray ), 0 );
+ aNormSize = Size(basegfx::fround<tools::Long>(mpVDev->GetTextArray(rText, &aTmpArray)), 0);
}
- sal_Int32* pDX = aTmpArray.data();
// if text is rotated, set transform matrix at new g element
if( rFont.GetOrientation() )
@@ -2721,7 +2728,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
{
if( nLen > 1 )
{
- aNormSize.setWidth( pDX[ nLen - 2 ] + mpVDev->GetTextWidth( OUString(rText[nLen - 1]) ) );
+ aNormSize.setWidth( aTmpArray[ nLen - 2 ] + mpVDev->GetTextWidth( OUString(rText[nLen - 1]) ) );
if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
{
@@ -2729,7 +2736,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
const double fFactor = static_cast<double>(nWidth) / aNormSize.Width();
for( i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
+ aTmpArray.set(i, basegfx::fround(aTmpArray[i] * fFactor));
}
else
{
@@ -2765,7 +2772,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
if( bCont )
{
// #118796# do NOT access pDXArray, it may be zero (!)
- sal_Int32 nDXWidth = pDX[ nCurPos - 1 ];
+ sal_Int32 nDXWidth = aTmpArray[ nCurPos - 1 ];
nDXWidth = ImplMap( nDXWidth );
nX = aPos.X() + nDXWidth;
}
@@ -2793,18 +2800,18 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
return;
tools::Polygon aPoly( 4 );
- const tools::Long nLineHeight = std::max<tools::Long>( FRound( aMetric.GetLineHeight() * 0.05 ), 1 );
+ const tools::Long nLineHeight = std::max<tools::Long>( basegfx::fround<tools::Long>( aMetric.GetLineHeight() * 0.05 ), 1 );
if( rFont.GetStrikeout() )
{
- const tools::Long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
+ const tools::Long nYLinePos = aBaseLinePos.Y() - basegfx::fround<tools::Long>( aMetric.GetAscent() * 0.26 );
aPoly[ 0 ].setX( aBaseLinePos.X() ); aPoly[ 0 ].setY( nYLinePos - ( nLineHeight >> 1 ) );
aPoly[ 1 ].setX( aBaseLinePos.X() + aNormSize.Width() - 1 ); aPoly[ 1 ].setY( aPoly[ 0 ].Y() );
aPoly[ 2 ].setX( aPoly[ 1 ].X() ); aPoly[ 2 ].setY( aPoly[ 0 ].Y() + nLineHeight - 1 );
aPoly[ 3 ].setX( aPoly[ 0 ].X() ); aPoly[ 3 ].setY( aPoly[ 2 ].Y() );
- ImplWritePolyPolygon( aPoly, false );
+ ImplWritePolyPolygon( tools::PolyPolygon(aPoly), false );
}
if( rFont.GetUnderline() )
@@ -2816,7 +2823,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
aPoly[ 2 ].setX( aPoly[ 1 ].X() ); aPoly[ 2 ].setY( aPoly[ 0 ].Y() + nLineHeight - 1 );
aPoly[ 3 ].setX( aPoly[ 0 ].X() ); aPoly[ 3 ].setY( aPoly[ 2 ].Y() );
- ImplWritePolyPolygon( aPoly, false );
+ ImplWritePolyPolygon( tools::PolyPolygon(aPoly), false );
}
}
@@ -2909,7 +2916,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
if (aGraphic.GetType() == GraphicType::Bitmap)
{
const BitmapEx& rGraphicBitmap = aGraphic.GetBitmapExRef();
- if (rGraphicBitmap.GetChecksum() == rBmpEx.GetChecksum())
+ if (rGraphicBitmap == rBmpEx)
{
bool bPNG = false;
GfxLink aGfxLink = aGraphic.GetGfxLink();
@@ -2930,7 +2937,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;
@@ -2955,12 +2982,49 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, OUString::number( aSz.Width() ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, OUString::number( aSz.Height() ) );
- // the image must be scaled to aSz in a non-uniform way
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", "none" );
+ // If we have a media object (a video), export the video.
+ // Also, use the image generated above as the video poster (thumbnail).
+ SdrMediaObj* pMediaObj
+ = pShape ? dynamic_cast<SdrMediaObj*>(SdrObject::getSdrObjectFromXShape(*pShape)) : nullptr;
+ const bool embedVideo = (pMediaObj && !pMediaObj->getTempURL().isEmpty());
+
+ if (!embedVideo)
+ {
+ // the image must be scaled to aSz in a non-uniform way
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "preserveAspectRatio", "none");
+
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, aBuffer.makeStringAndClear());
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, aBuffer.makeStringAndClear() );
+ SvXMLElementExport aElem(mrExport, XML_NAMESPACE_NONE, "image", true, true);
+ }
+ else
{
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, "image", true, true );
+ // <foreignObject xmlns="http://www.w3.org/2000/svg" overflow="visible" width="499.6" height="374.33333333333337" x="705" y="333">
+ // <body xmlns="http://www.w3.org/1999/xhtml">
+ // <video controls="controls" width="499.6" height="374.33333333333337">
+ // <source src="file:///tmp/abcdef.mp4" type="video/mp4">
+ // </video>
+ // </body>
+ // </foreignObject>
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "xmlns", "http://www.w3.org/2000/svg");
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "overflow", "visible");
+ SvXMLElementExport aForeignObject(mrExport, XML_NAMESPACE_NONE, "foreignObject", true,
+ true);
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "xmlns", "http://www.w3.org/1999/xhtml");
+ SvXMLElementExport aBody(mrExport, XML_NAMESPACE_NONE, "body", true, true);
+
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrWidth, OUString::number(aSz.Width()));
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrHeight, OUString::number(aSz.Height()));
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "autoplay", "autoplay");
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "controls", "controls");
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "loop", "loop");
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "preload", "auto");
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "poster", aBuffer.makeStringAndClear());
+ SvXMLElementExport aVideo(mrExport, XML_NAMESPACE_NONE, "video", true, true);
+
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "src", pMediaObj->getTempURL());
+ mrExport.AddAttribute(XML_NAMESPACE_NONE, "type", "video/mp4"); //FIXME: set mime type.
+ SvXMLElementExport aSource(mrExport, XML_NAMESPACE_NONE, "source", true, true);
}
}
@@ -3025,10 +3089,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
sal_uInt16 sz = static_cast<sal_uInt16>((pA->GetDataSize()) / 2);
if (sz)
{
- sType.append("; ");
- sType.append(
- reinterpret_cast<sal_Unicode const*>(pData),
- sz);
+ sType.append(OUString::Concat("; ")
+ + std::u16string_view(
+ reinterpret_cast<sal_Unicode const*>(pData),
+ sz));
}
}
}
@@ -3161,7 +3225,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( aPoly.GetSize() )
{
maAttributeWriter.AddPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( aPoly, false );
+ ImplWritePolyPolygon( tools::PolyPolygon(aPoly), false );
}
}
}
@@ -3178,7 +3242,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
maAttributeWriter.AddPaintAttr( mpVDev->GetLineColor(), COL_TRANSPARENT );
ImplAddLineAttr( pA->GetLineInfo() );
- ImplWritePolyPolygon( rPoly, true );
+ ImplWritePolyPolygon( tools::PolyPolygon(rPoly), true );
}
}
}
@@ -3208,7 +3272,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const tools::Polygon aRectPoly( pA->GetRect() );
const tools::PolyPolygon aRectPolyPoly( aRectPoly );
- ImplWriteGradientEx( aRectPolyPoly, pA->GetGradient(), nWriteFlags );
+ ImplWriteGradientEx( aRectPolyPoly, pA->GetGradient(), nWriteFlags, nullptr );
}
}
break;
@@ -3218,7 +3282,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( nWriteFlags & SVGWRITER_WRITE_FILL )
{
const MetaGradientExAction* pA = static_cast<const MetaGradientExAction*>(pAction);
- ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), nWriteFlags );
+ ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), nWriteFlags, nullptr );
}
}
break;
@@ -3244,8 +3308,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
Color aNewLineColor( mpVDev->GetLineColor() ), aNewFillColor( mpVDev->GetFillColor() );
- aNewLineColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
- aNewFillColor.SetAlpha( 255 - sal::static_int_cast<sal_uInt8>( FRound( pA->GetTransparence() * 2.55 ) ) );
+ // tdf#149800 do not change transparency of fully transparent
+ // i.e. invisible line, because it makes it visible,
+ // resulting an extra line behind the normal shape line
+ if ( aNewLineColor.GetAlpha() > 0 )
+ aNewLineColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( pA->GetTransparence() * 2.55 ) );
+ aNewFillColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( pA->GetTransparence() * 2.55 ) );
maAttributeWriter.AddPaintAttr( aNewLineColor, aNewFillColor );
ImplWritePolyPolygon( rPolyPoly, false );
@@ -3261,7 +3329,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
const MetaFloatTransparentAction* pA = static_cast<const MetaFloatTransparentAction*>(pAction);
GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
ImplWriteMask( aTmpMtf, pA->GetPoint(), pA->GetSize(),
- pA->GetGradient(), nWriteFlags );
+ pA->GetGradient(), nWriteFlags, pA->getSVGTransparencyColorStops() );
}
}
break;
@@ -3295,7 +3363,62 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
{
const MetaCommentAction* pA = static_cast<const MetaCommentAction*>(pAction);
- if( ( pA->GetComment().equalsIgnoreAsciiCase("XGRAD_SEQ_BEGIN") ) &&
+ if (pA->GetComment().equalsIgnoreAsciiCase("BGRAD_SEQ_BEGIN"))
+ {
+ // detect and use the new BGRAD_SEQ_* metafile comment actions
+ const MetaGradientExAction* pGradAction(nullptr);
+ bool bDone(false);
+
+ while (!bDone && (++nCurAction < nCount))
+ {
+ pAction = rMtf.GetAction(nCurAction);
+
+ if (MetaActionType::GRADIENTEX == pAction->GetType())
+ {
+ // remember the 'paint' data action
+ pGradAction = static_cast<const MetaGradientExAction*>(pAction);
+ }
+ else if (MetaActionType::COMMENT == pAction->GetType()
+ && static_cast<const MetaCommentAction*>(pAction)->GetComment().equalsIgnoreAsciiCase("BGRAD_SEQ_END"))
+ {
+ // end action found
+ bDone = true;
+ }
+ }
+
+ if (nullptr != pGradAction)
+ {
+ // we have a complete actions sequence of BGRAD_SEQ_*, so we can now
+ // read the correct color stops here
+ basegfx::BColorStops aColorStops;
+ SvMemoryStream aMemStm(const_cast<sal_uInt8 *>(pA->GetData()), pA->GetDataSize(), StreamMode::READ);
+ VersionCompatRead aCompat(aMemStm);
+ sal_uInt16 nTmp(0);
+ double fOff, fR, fG, fB;
+ aMemStm.ReadUInt16( nTmp );
+
+ const size_t nMaxPossibleEntries = aMemStm.remainingSize() / 4 * sizeof(double);
+ if (nTmp > nMaxPossibleEntries)
+ {
+ SAL_WARN("filter.svg", "gradient record claims to have: " << nTmp << " entries, but only " << nMaxPossibleEntries << " possible, clamping");
+ nTmp = nMaxPossibleEntries;
+ }
+
+ for (sal_uInt16 a(0); a < nTmp; a++)
+ {
+ aMemStm.ReadDouble(fOff);
+ aMemStm.ReadDouble(fR);
+ aMemStm.ReadDouble(fG);
+ aMemStm.ReadDouble(fB);
+
+ aColorStops.emplace_back(fOff, basegfx::BColor(fR, fG, fB));
+ }
+
+ // export with real Color Stops
+ ImplWriteGradientEx(pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), nWriteFlags, &aColorStops);
+ }
+ }
+ else if( ( pA->GetComment().equalsIgnoreAsciiCase("XGRAD_SEQ_BEGIN") ) &&
( nWriteFlags & SVGWRITER_WRITE_FILL ) )
{
const MetaGradientExAction* pGradAction = nullptr;
@@ -3316,7 +3439,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
if( pGradAction )
- ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), nWriteFlags );
+ ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), nWriteFlags, nullptr );
}
else if( ( pA->GetComment().equalsIgnoreAsciiCase("XPATHFILL_SEQ_BEGIN") ) &&
( nWriteFlags & SVGWRITER_WRITE_FILL ) && !( nWriteFlags & SVGWRITER_NO_SHAPE_COMMENTS ) &&
@@ -3356,12 +3479,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape->maShapePolyPoly = aShapePolyPoly;
mapCurShape->maShapeFillColor = aFill.getFillColor();
- mapCurShape->maShapeFillColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( 255.0 * aFill.getTransparency() )) );
+ mapCurShape->maShapeFillColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( 255.0 * aFill.getTransparency() ) );
if( bGradient )
{
// step through following actions until the first Gradient/GradientEx action is found
- while (!mapCurShape->mapShapeGradient && bSkip
+ while (!mapCurShape->moShapeGradient && bSkip
&& (++nCurAction < nCount))
{
pAction = rMtf.GetAction( nCurAction );
@@ -3374,13 +3497,13 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
else if( pAction->GetType() == MetaActionType::GRADIENTEX )
{
- mapCurShape->mapShapeGradient.reset( new Gradient(
- static_cast< const MetaGradientExAction* >( pAction )->GetGradient() ) );
+ mapCurShape->moShapeGradient.emplace(
+ static_cast< const MetaGradientExAction* >( pAction )->GetGradient() );
}
else if( pAction->GetType() == MetaActionType::GRADIENT )
{
- mapCurShape->mapShapeGradient.reset( new Gradient(
- static_cast< const MetaGradientAction* >( pAction )->GetGradient() ) );
+ mapCurShape->moShapeGradient.emplace(
+ static_cast< const MetaGradientAction* >( pAction )->GetGradient() );
}
}
}
@@ -3442,12 +3565,12 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
mapCurShape->maId = aElementId + "_" + OUString::number(nEntryCount++);
}
- mapCurShape->maShapePolyPoly = aPoly;
+ mapCurShape->maShapePolyPoly = tools::PolyPolygon(aPoly);
}
mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
- mapCurShape->maShapeLineColor.SetAlpha( 255 - static_cast<sal_uInt8>(FRound( aStroke.getTransparency() * 255.0 )) );
- mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() );
+ mapCurShape->maShapeLineColor.SetAlpha( 255 - basegfx::fround<sal_uInt8>( aStroke.getTransparency() * 255.0 ) );
+ mapCurShape->mnStrokeWidth = basegfx::fround(aStroke.getStrokeWidth());
aStroke.getDashArray( mapCurShape->maDashArray );
// added support for LineJoin
@@ -3490,7 +3613,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 +3789,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..1bcf8a87b4c9 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -41,16 +41,16 @@
#include <stack>
#include <unordered_map>
+namespace basegfx { class BColorStops; }
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::style;
using namespace ::com::sun::star::svg;
using namespace ::com::sun::star::xml::sax;
-inline constexpr OUStringLiteral SVG_DTD_STRING = u"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">";
+inline constexpr OUString SVG_DTD_STRING = u"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">"_ustr;
#define SVGWRITER_WRITE_FILL 0x00000001
#define SVGWRITER_WRITE_TEXT 0x00000002
@@ -164,7 +164,7 @@ struct SVGShapeDescriptor
Color maShapeLineColor;
sal_Int32 mnStrokeWidth;
SvtGraphicStroke::DashArray maDashArray;
- ::std::unique_ptr< Gradient > mapShapeGradient;
+ ::std::optional< Gradient > moShapeGradient;
OUString maId;
basegfx::B2DLineJoin maLineJoin;
css::drawing::LineCap maLineCap;
@@ -318,6 +318,7 @@ private:
bool mbClipAttrChanged;
bool mbIsPlaceholderShape;
const MetaBitmapActionMap* mpEmbeddedBitmapsMap;
+ bool mbIsPreview;
tools::Long ImplMap( sal_Int32 nVal ) const;
@@ -339,14 +340,13 @@ private:
void ImplStartClipRegion(sal_Int32 nClipPathId);
void ImplEndClipRegion();
void ImplWriteClipPath( const tools::PolyPolygon& rPolyPoly );
- void ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, sal_uInt32 nWriteFlags);
- void ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
+ void ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops* pColorStops);
+ void ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, const basegfx::BColorStops* pColorStops );
void ImplWriteGradientStop( const Color& rColor, double fOffset );
static Color ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity );
- static Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset );
- void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags );
- void ImplWriteText( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, tools::Long nWidth );
- void ImplWriteText( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, tools::Long nWidth, Color aTextColor );
+ void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags, const basegfx::BColorStops* pColorStops);
+ void ImplWriteText( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, tools::Long nWidth );
+ void ImplWriteText( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, tools::Long nWidth, Color aTextColor );
void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const css::uno::Reference<css::drawing::XShape>* pShape);
void ImplWriteActions( const GDIMetaFile& rMtf,
@@ -376,7 +376,8 @@ public:
void SetEmbeddedBitmapRefs( const MetaBitmapActionMap* pEmbeddedBitmapsMap );
void StartMask(const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient,
- sal_uInt32 nWriteFlags, OUString* pTextStyle = nullptr);
+ sal_uInt32 nWriteFlags, const basegfx::BColorStops* pColorStops, OUString* pTextStyle = nullptr);
+ void SetPreviewMode(bool bState = true) { mbIsPreview = bState; }
};
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index d2f44023b590..e215b465b925 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -20,8 +20,6 @@
#include "t602filter.hxx"
#include <strings.hrc>
-#include <stdio.h>
-
#include <cppuhelper/factory.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -35,15 +33,13 @@
#include <osl/diagnose.h>
#include <rtl/ref.hxx>
#include <rtl/character.hxx>
-#include <unotools/resmgr.hxx>
#include <unotools/streamwrap.hxx>
+#include <utility>
using namespace ::cppu;
-using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::awt;
@@ -131,14 +127,14 @@ namespace T602ImportFilter {
static inistruct ini;
-T602ImportFilter::T602ImportFilter(const css::uno::Reference<css::uno::XComponentContext > &r )
- : mxContext(r)
+T602ImportFilter::T602ImportFilter(css::uno::Reference<css::uno::XComponentContext > x )
+ : mxContext(std::move(x))
, node(tnode::START)
{
}
-T602ImportFilter::T602ImportFilter(css::uno::Reference<css::io::XInputStream> const & xInputStream)
- : mxInputStream(xInputStream)
+T602ImportFilter::T602ImportFilter(css::uno::Reference<css::io::XInputStream> xInputStream)
+ : mxInputStream(std::move(xInputStream))
, node(tnode::START)
{
}
@@ -210,10 +206,8 @@ void T602ImportFilter::inschr(unsigned char ch)
inschrdef(' ');
pst.wasfdash = false;
} else {
- char s[20];
- sprintf(s,"%i",pst.wasspace);
if (mpAttrList)
- mpAttrList->AddAttribute("text:c",OUString::createFromAscii(s));
+ mpAttrList->AddAttribute("text:c",OUString::number(pst.wasspace));
Start_("text:s");
End_("text:s");
}
@@ -249,11 +243,10 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >&
Reference < XImporter > xImporter(mxHandler, UNO_QUERY);
xImporter->setTargetDocument(mxDoc);
- char fs[32], fs2[32];
- sprintf(fs, "%ipt", inistruct::fontsize);
- sprintf(fs2,"%ipt", 2*inistruct::fontsize);
+ auto const fs = OUString(OUString::number(inistruct::fontsize) + "pt");
+ auto const fs2 = OUString(OUString::number(2*inistruct::fontsize) + "pt");
- mpAttrList = new SvXMLAttributeList;
+ mpAttrList = new comphelper::AttributeList;
Reference < XAttributeList > xAttrList ( mpAttrList );
@@ -293,7 +286,7 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >&
mpAttrList->AddAttribute("style:parent-style-name","Standard");
Start_("style:style");
mpAttrList->AddAttribute("style:font-name","Courier New");
- mpAttrList->AddAttribute("fo:font-size",OUString::createFromAscii(fs));
+ mpAttrList->AddAttribute("fo:font-size",fs);
Start_("style:properties");
End_("style:properties");
End_("style:style");
@@ -304,7 +297,7 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >&
mpAttrList->AddAttribute("style:parent-style-name","Standard");
Start_("style:style");
mpAttrList->AddAttribute("style:font-name","Courier New");
- mpAttrList->AddAttribute("fo:font-size",OUString::createFromAscii(fs));
+ mpAttrList->AddAttribute("fo:font-size",fs);
mpAttrList->AddAttribute("fo:break-before","page");
Start_("style:properties");
End_("style:properties");
@@ -350,7 +343,7 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >&
mpAttrList->AddAttribute("style:name","T5");
mpAttrList->AddAttribute("style:family","text");
Start_("style:style");
- mpAttrList->AddAttribute("fo:font-size",OUString::createFromAscii(fs2));
+ mpAttrList->AddAttribute("fo:font-size",fs2);
mpAttrList->AddAttribute("fo:font-weight","bold");
mpAttrList->AddAttribute("style:text-scale","50%");
Start_("style:properties");
@@ -361,7 +354,7 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >&
mpAttrList->AddAttribute("style:name","T6");
mpAttrList->AddAttribute("style:family","text");
Start_("style:style");
- mpAttrList->AddAttribute("fo:font-size",OUString::createFromAscii(fs2));
+ mpAttrList->AddAttribute("fo:font-size",fs2);
mpAttrList->AddAttribute("fo:font-weight","bold");
Start_("style:properties");
End_("style:properties");
@@ -497,7 +490,7 @@ void T602ImportFilter::inschrdef(unsigned char ch)
void T602ImportFilter::wrtfnt()
{
Reference < XAttributeList > xAttrList ( mpAttrList );
- const char *style = "P1";
+ const char *style;
switch(fst.nowfnt) {
case standard : style = fst.uline ? "T7" : "T1"; break;
@@ -857,8 +850,6 @@ Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames( )
}
T602ImportFilterDialog::T602ImportFilterDialog()
- : maLocale(SvtSysLocale().GetUILanguageTag())
- , maResLocale(Translate::Create("flt"))
{
}
@@ -866,23 +857,6 @@ T602ImportFilterDialog::~T602ImportFilterDialog()
{
}
-// XLocalizable
-
-void SAL_CALL T602ImportFilterDialog::setLocale(const Locale& rLocale)
-{
- LanguageTag aLocale(rLocale);
- if (maLocale != aLocale)
- {
- maLocale = aLocale;
- maResLocale = Translate::Create("flt", maLocale);
- }
-}
-
-Locale SAL_CALL T602ImportFilterDialog::getLocale()
-{
- return maLocale.getLocale(false);
-}
-
bool T602ImportFilterDialog::OptionsDlg()
{
Any any;
@@ -896,10 +870,10 @@ bool T602ImportFilterDialog::OptionsDlg()
any <<= _val;\
_prop->setPropertyValue(_nam, any);
#define propString_(_prop,_nam,_val) \
- any <<= OUString(_val);\
+ any <<= _val;\
_prop->setPropertyValue(_nam, any);
#define propStringFromResId_(_prop,_nam,_val) \
- any <<= getResStr(_val);\
+ any <<= FilterResId(_val);\
_prop->setPropertyValue(_nam, any);
#define propGet_(_prop,_nam) \
_prop->getPropertyValue(_nam);
@@ -922,13 +896,13 @@ bool T602ImportFilterDialog::OptionsDlg()
propInt_(xPSetDialog,"Height",90);
propStringFromResId_(xPSetDialog,"Title", T602FILTER_STR_IMPORT_DIALOG_TITLE);
- static constexpr OUStringLiteral T602DLG_OK_BUTTON = u"ok_button";
- static constexpr OUStringLiteral T602DLG_CANCEL_BUTTON = u"cancel_button";
- static constexpr OUStringLiteral T602DLG_CODE_LB = u"code_lb";
- static constexpr OUStringLiteral T602DLG_AZBUKA_CB = u"azbuka_cb";
- static constexpr OUStringLiteral T602DLG_COMMENT_CB = u"comment_cb";
- static constexpr OUStringLiteral T602DLG_REFORMAT_CB = u"reformat_cb";
- static constexpr OUStringLiteral T602DLG_CODE_TXT = u"code_txt";
+ static constexpr OUString T602DLG_OK_BUTTON = u"ok_button"_ustr;
+ static constexpr OUString T602DLG_CANCEL_BUTTON = u"cancel_button"_ustr;
+ static constexpr OUString T602DLG_CODE_LB = u"code_lb"_ustr;
+ static constexpr OUString T602DLG_AZBUKA_CB = u"azbuka_cb"_ustr;
+ static constexpr OUString T602DLG_COMMENT_CB = u"comment_cb"_ustr;
+ static constexpr OUString T602DLG_REFORMAT_CB = u"reformat_cb"_ustr;
+ static constexpr OUString T602DLG_CODE_TXT = u"code_txt"_ustr;
Reference < XInterface > TextModel = Inst_("com.sun.star.awt.UnoControlFixedTextModel");
Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY );
@@ -952,10 +926,10 @@ bool T602ImportFilterDialog::OptionsDlg()
Sequence< OUString > ous
{
- getResStr(T602FILTER_STR_ENCODING_AUTO),
- getResStr(T602FILTER_STR_ENCODING_CP852),
- getResStr(T602FILTER_STR_ENCODING_CP895),
- getResStr(T602FILTER_STR_ENCODING_KOI8CS2)
+ FilterResId(T602FILTER_STR_ENCODING_AUTO),
+ FilterResId(T602FILTER_STR_ENCODING_CP852),
+ FilterResId(T602FILTER_STR_ENCODING_CP895),
+ FilterResId(T602FILTER_STR_ENCODING_KOI8CS2)
};
any <<= ous;
xPSetCodeLB->setPropertyValue("StringItemList", any);
@@ -1077,11 +1051,6 @@ sal_Int16 SAL_CALL T602ImportFilterDialog::execute()
return css::ui::dialogs::ExecutableDialogResults::CANCEL;
}
-OUString T602ImportFilterDialog::getResStr(TranslateId resid)
-{
- return Translate::get(resid, maResLocale);
-}
-
uno::Sequence<beans::PropertyValue> SAL_CALL T602ImportFilterDialog::getPropertyValues()
{
return uno::Sequence<beans::PropertyValue>();
diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx
index 04376a1f3c26..93efc45c28ed 100644
--- a/filter/source/t602/t602filter.hxx
+++ b/filter/source/t602/t602filter.hxx
@@ -25,16 +25,13 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XLocalizable.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/attributelist.hxx>
#include <cppuhelper/implbase.hxx>
-#include <xmloff/attrlist.hxx>
-#include <i18nlangtag/languagetag.hxx>
#include <rtl/ref.hxx>
-#include <unotools/resmgr.hxx>
namespace T602ImportFilter {
@@ -78,15 +75,11 @@ struct inistruct
class T602ImportFilterDialog : public cppu::WeakImplHelper <
css::ui::dialogs::XExecutableDialog,
- css::lang::XLocalizable,
css::lang::XServiceInfo,
css::beans::XPropertyAccess
>
{
- LanguageTag maLocale;
- std::locale maResLocale;
- bool OptionsDlg();
- OUString getResStr(TranslateId resid);
+ static bool OptionsDlg();
virtual ~T602ImportFilterDialog() override;
@@ -94,10 +87,6 @@ class T602ImportFilterDialog : public cppu::WeakImplHelper <
virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
virtual sal_Int16 SAL_CALL execute() override;
- // XLocalizable
- virtual void SAL_CALL setLocale( const css::lang::Locale& eLocale ) override;
- virtual css::lang::Locale SAL_CALL getLocale() override;
-
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
@@ -129,7 +118,7 @@ private:
css::uno::Reference< css::lang::XComponent > mxDoc;
css::uno::Reference < css::io::XInputStream > mxInputStream;
- rtl::Reference<SvXMLAttributeList> mpAttrList;
+ rtl::Reference<comphelper::AttributeList> mpAttrList;
tnode node; // START
@@ -224,8 +213,8 @@ private:
bool importImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor );
public:
- explicit T602ImportFilter(const css::uno::Reference<css::uno::XComponentContext > &r );
- explicit T602ImportFilter(css::uno::Reference<css::io::XInputStream> const & xInputStream);
+ explicit T602ImportFilter(css::uno::Reference<css::uno::XComponentContext > x );
+ explicit T602ImportFilter(css::uno::Reference<css::io::XInputStream> xInputStream);
virtual ~T602ImportFilter() override;
// XFilter
diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx
index f8fc5cb865eb..898728af434f 100644
--- a/filter/source/textfilterdetect/filterdetect.cxx
+++ b/filter/source/textfilterdetect/filterdetect.cxx
@@ -20,18 +20,16 @@
#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)";
+constexpr OUString WRITER_TEXT_FILTER = u"Text"_ustr;
+constexpr OUString CALC_TEXT_FILTER = u"Text - txt - csv (StarCalc)"_ustr;
constexpr OUStringLiteral WEB_HTML_FILTER = u"HTML";
constexpr OUStringLiteral WRITER_HTML_FILTER = u"HTML (StarWriter)";
constexpr OUStringLiteral CALC_HTML_FILTER = u"calc_HTML_WebQuery";
-constexpr OUStringLiteral WRITER_DOCSERVICE = u"com.sun.star.text.TextDocument";
-constexpr OUStringLiteral CALC_DOCSERVICE = u"com.sun.star.sheet.SpreadsheetDocument";
+constexpr OUString WRITER_DOCSERVICE = u"com.sun.star.text.TextDocument"_ustr;
+constexpr OUString CALC_DOCSERVICE = u"com.sun.star.sheet.SpreadsheetDocument"_ustr;
using namespace ::com::sun::star;
using utl::MediaDescriptor;
@@ -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,26 +185,16 @@ 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);
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= CALC_TEXT_FILTER;
else if (aDocService == WRITER_DOCSERVICE)
- aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_TEXT_FILTER);
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= 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
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= CALC_TEXT_FILTER;
else
- aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= OUString(WRITER_TEXT_FILTER);
+ aMediaDesc[MediaDescriptor::PROP_FILTERNAME] <<= WRITER_TEXT_FILTER;
}
else
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index c4fb3eef20cd..1f246433a4ae 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -20,7 +20,7 @@
#include <iostream>
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include "XmlFilterAdaptor.hxx"
#include <com/sun/star/io/XActiveDataSource.hpp>
@@ -43,10 +43,11 @@
#include <unotools/pathoptions.hxx>
#include <xmloff/xmlimp.hxx>
+#include <strings.hrc>
+
using namespace comphelper;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-using namespace com::sun::star::io;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace com::sun::star::document;
@@ -67,7 +68,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >()));
if (xStatusIndicator.is()){
- xStatusIndicator->start( "Loading :", 4);
+ xStatusIndicator->start(FilterResId(STR_FILTER_DOC_LOADING), 4);
}
OUString aBaseURI;
@@ -80,18 +81,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 +101,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) };
@@ -234,7 +234,7 @@ bool XmlFilterAdaptor::exportImpl( const Sequence< css::beans::PropertyValue >&
utl::MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >()));
if (xStatusIndicator.is())
- xStatusIndicator->start( "Saving :", 3);
+ xStatusIndicator->start(FilterResId(STR_FILTER_DOC_SAVING), 3);
// Set up converter bridge.
Reference< css::xml::XExportFilter > xConverter(mxContext->getServiceManager()->createInstanceWithContext( udConvertClass, mxContext ), UNO_QUERY);
@@ -280,21 +280,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/xmlfilteradaptor/XmlFilterAdaptor.hxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
index 43db4e939ba7..a276d396eda2 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase.hxx>
+#include <utility>
enum FilterType
@@ -64,8 +65,8 @@ class XmlFilterAdaptor final : public cppu::WeakImplHelper
public:
- explicit XmlFilterAdaptor( const css::uno::Reference< css::uno::XComponentContext > & rxContext)
- : mxContext(rxContext)
+ explicit XmlFilterAdaptor( css::uno::Reference< css::uno::XComponentContext > xContext)
+ : mxContext(std::move(xContext))
, meType(FILTER_IMPORT)
{
}
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
index 1a3f80cb589a..c873db648819 100644
--- a/filter/source/xmlfilterdetect/filterdetect.cxx
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -23,11 +23,12 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <ucbhelper/content.hxx>
#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/xmlfilterdetect/filterdetect.hxx b/filter/source/xmlfilterdetect/filterdetect.hxx
index 61b6dfaf53ee..c84b9f06612e 100644
--- a/filter/source/xmlfilterdetect/filterdetect.hxx
+++ b/filter/source/xmlfilterdetect/filterdetect.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
+#include <utility>
namespace com::sun::star::uno {
class XComponentContext;
@@ -38,8 +39,8 @@ class FilterDetect final : public cppu::WeakImplHelper <
css::uno::Reference< css::uno::XComponentContext > mxCtx;
public:
- explicit FilterDetect( const css::uno::Reference< css::uno::XComponentContext > &rxCtx)
- : mxCtx( rxCtx ) {}
+ explicit FilterDetect( css::uno::Reference< css::uno::XComponentContext > xCtx)
+ : mxCtx(std::move( xCtx )) {}
//XExtendedFilterDetection
virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) override;
diff --git a/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
index e8bb6fa7999a..32e8ea44b979 100644
--- a/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
+++ b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
@@ -3700,7 +3700,7 @@
<xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
<xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
<xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
- <xsl:attribute name="字:类型">custum</xsl:attribute>
+ <xsl:attribute name="字:类型">custom</xsl:attribute>
<xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
<xsl:call-template name="字:字体"/>
</xsl:element>
diff --git a/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
index 95d0d6b9d271..dbd1f5460c57 100644
--- a/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
+++ b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
@@ -522,7 +522,7 @@
<draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
<draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
<draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
- <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="Sparse_20_Dash" draw:display-name="Sparse Dash" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
<draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
<draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
<draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
@@ -6779,7 +6779,7 @@
<draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
<draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
<draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
- <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="Sparse_20_Dash" draw:display-name="Sparse Dash" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
<draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
<draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
<draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
diff --git a/filter/source/xslt/odf2xhtml/export/common/body.xsl b/filter/source/xslt/odf2xhtml/export/common/body.xsl
index bcad3abd9ab3..8dfb78222186 100644
--- a/filter/source/xslt/odf2xhtml/export/common/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/body.xsl
@@ -81,7 +81,7 @@
<!-- *************** -->
<!-- ID / NAME of text-box -->
- <xsl:template match="@draw:name">
+ <xsl:template match="@draw:name | @text:id | @xml:id">
<xsl:attribute name="id">
<xsl:choose>
<xsl:when test="number(substring(.,1,1))">
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index bac0c5963ccd..bdad6da4bf45 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -504,6 +504,8 @@
</xsl:template>
+ <!-- Context is <style:style> with all style properties elements containing attributes, accessed by */@prop
+ overwriting the ODF style properties that are being inherited from the 'inheritedStyleProperties' parameter! -->
<xsl:template name="create-inherited-style-properties">
<xsl:param name="inheritedStyleProperties" />
@@ -511,9 +513,59 @@
<!-- Writing all inherited style properties -->
<xsl:for-each select="$inheritedStyleProperties/@*">
<xsl:sort select="name()" />
- <xsl:copy-of select="." />
+
+ <!-- Normalization three ODF attributes to one ODF attribute fo:background color (only temporary not ODF conform but eases mapping to ODF)
+ There are two different background color:
+ 1) fo:background-color
+ 2) draw:fill-color
+ mapped to one in CSS.
+ In addition if there is the attribute @draw:fill="none" the background is 'transparent' -->
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:fill-color' or name() = 'fo:background-color' or name() = 'draw:fill'">
+ <xsl:choose>
+ <xsl:when test="$inheritedStyleProperties/@draw:fill='none'">
+ <xsl:attribute name="fo:background-color">transparent</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="name()!='draw:fill'">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color">transparent</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>
+ <xsl:if test="*/@draw:fill-color or */@fo:background-color or */@draw:fill">
+ <xsl:choose>
+ <xsl:when test="*/@draw:fill='none'">
+ <xsl:attribute name="fo:background-color">transparent</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="*/@draw:fill-color">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="*/@draw:fill-color"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="*/@fo:background-color">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="*/@fo:background-color"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color">transparent</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+
+
<!-- split border into border parts for better activation-check on style:joint-border feature -->
<xsl:if test="*/@fo:border">
<xsl:attribute name="fo:border-top"><xsl:value-of select="*/@fo:border"/></xsl:attribute>
@@ -524,7 +576,7 @@
<!--All current attributes will override already inserted attributes of the same name
XSLT Spec: "Adding an attribute to an element replaces any existing attribute of that element with the same expanded-name." -->
- <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() != 'fo:border']">
+ <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() != 'fo:border'][name() != 'draw:fill-color']">
<xsl:copy-of select="." />
</xsl:for-each>
@@ -568,21 +620,20 @@
<xsl:template name="write-collected-styles">
<xsl:param name="globalData" />
- <xsl:message>&lt;all-doc-styles&gt;</xsl:message>
+ <xsl:message>all-doc-styles:start</xsl:message>
<xsl:for-each select="$globalData/all-doc-styles/style">
- <xsl:message>&lt;style</xsl:message>
- <xsl:message>style:family="<xsl:value-of select="current()/@style:family" />"&gt;</xsl:message>
- <xsl:message>style:name="<xsl:value-of select="current()/@style:name" />" </xsl:message>
- <xsl:message> &lt;*</xsl:message>
+ <xsl:message>***style:start</xsl:message>
+ <xsl:message>style:family="<xsl:value-of select="current()/@style:family" />"</xsl:message>
+ <xsl:message>style:name="<xsl:value-of select="current()/@style:name" />"</xsl:message>
+ <xsl:message> with properties:</xsl:message>
<xsl:for-each select="*/@*">
<xsl:message>
<xsl:text></xsl:text>
<xsl:value-of select="name()" />="<xsl:value-of select="." />"</xsl:message>
</xsl:for-each>
- <xsl:message>/&gt;</xsl:message>
- <xsl:message>&lt;/style&gt;</xsl:message>
+ <xsl:message>***style:end</xsl:message>
</xsl:for-each>
- <xsl:message>&lt;/all-doc-styles&gt;</xsl:message>
+ <xsl:message>all-doc-styles:end</xsl:message>
</xsl:template>
<xsl:template name="map-odf-style-properties">
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
index c81cc9a1e0be..56b17331a0b9 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -22,11 +22,18 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
- <!-- *** Properties with a 'fo:' prefix *** -->
- <xsl:template match="@fo:background-color">
- <xsl:text>background-color:</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>; </xsl:text>
+ <!-- *** Background color handling *** -->
+ <xsl:template match="@fo:background-color | @draw:fill-color | @draw:fill">
+ <xsl:choose>
+ <xsl:when test="@draw:fill='none'">
+ <xsl:text>background-color:transparent; </xsl:text>
+ </xsl:when>
+ <xsl:when test="name()!='draw:fill'">
+ <xsl:text>background-color:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+ </xsl:choose>
</xsl:template>
<xsl:template match="@fo:border | @fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right">
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
index cfc1ebbc525b..1e9baa5703f2 100644
--- a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
@@ -65,12 +65,14 @@
<xsl:template match="table:table" name="table:table">
<xsl:param name="globalData" />
+ <xsl:text>&#xa;</xsl:text>
<!-- The table will only be created if the table:scenario is active -->
<xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
<xsl:call-template name="create-table">
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
</xsl:if>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
@@ -110,10 +112,12 @@
</xsl:element>
</xsl:when>
<xsl:otherwise>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name="create-table-element">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
index 2d6cd7285037..60b47be753ca 100644
--- a/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
@@ -196,7 +196,10 @@
<xsl:param name="node-position" />
<xsl:attribute name="class">
- <xsl:value-of select="translate(@table:style-name, '. %()/\+', '')" />
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@table:style-name"/>
+ <xsl:with-param name="styleFamily" select="'table-row'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:template>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
index f26e2cc0a6c9..0f36b36486de 100644
--- a/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
@@ -93,7 +93,10 @@
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
- <xsl:value-of select="translate(parent::*/@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'table'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
@@ -291,7 +294,7 @@ Scenarios tabstops
-> put the preceding tab stops into a TD (left aligned is default)
4) first style:type would have no right preceding tabStop
- -> works well with first sceanrios 1 and 3
+ -> works well with first scenarios 1 and 3
5) last style:type would be a special case, if it would be left aligned, but this won't happen in our case... :D
@@ -317,7 +320,10 @@ Scenarios unmatched:
<xsl:element namespace="{$namespace}" name="p">
<xsl:if test="$position = 1">
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'paragraph'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="content-table">
@@ -341,7 +347,10 @@ Scenarios unmatched:
<xsl:element namespace="{$namespace}" name="p">
<xsl:if test="$position = 1">
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'paragraph'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="grab-cell-content-before-tab-stop">
@@ -358,7 +367,10 @@ Scenarios unmatched:
<xsl:element namespace="{$namespace}" name="p">
<xsl:if test="$position = 1">
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'paragraph'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="grab-cell-content-before-tab-stop">
@@ -382,7 +394,10 @@ Scenarios unmatched:
<xsl:element namespace="{$namespace}" name="p">
<xsl:if test="$position = 1">
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'paragraph'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:if>
<xsl:element namespace="{$namespace}" name="td">
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 430b834b3cca..a8a4aa0b0347 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -19,7 +19,7 @@
<!--
For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
-->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.jclark.com/xt" xmlns:common="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" exclude-result-prefixes="chart config dc dom dr3d draw fo form loext math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan" xmlns="http://www.w3.org/1999/xhtml">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.jclark.com/xt" xmlns:common="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" exclude-result-prefixes="chart config dc dom dr3d draw fo form loext math meta number office ooo oooc ooow presentation script style svg table text xforms xlink xsd xsi xt common xalan" xmlns="http://www.w3.org/1999/xhtml">
<!--+++++ INCLUDED XSL MODULES +++++-->
@@ -50,9 +50,11 @@
<xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/>
<xsl:template name="create-body">
<xsl:param name="globalData"/>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name="create-body.collect-page-properties">
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
<xsl:template name="create-body.collect-page-properties">
@@ -139,15 +141,21 @@
</xsl:choose>
<!-- adapt page size -->
<xsl:variable name="pageWidth" select="$pageProperties/style:page-layout-properties/@fo:page-width"/>
+ <xsl:variable name="pageHeight" select="$pageProperties/style:page-layout-properties/@fo:height"/>
<!-- multiple backgroundimages for different page styles (never used in html) -->
<xsl:variable name="backgroundImage" select="$pageProperties/style:page-layout-properties/style:background-image"/>
<!-- page margins & background image -->
- <xsl:if test="$pageWidth or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:if test="$pageWidth or $pageHeight or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
<xsl:attribute name="style">
<xsl:if test="$pageWidth">
<xsl:text>max-width:</xsl:text>
- <xsl:value-of select="$pageWidth"/>
+ <xsl:value-of select="$pageWidth" />
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$pageHeight">
+ <xsl:text>max-height:</xsl:text>
+ <xsl:value-of select="$pageHeight" />
<xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="$pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
@@ -178,6 +186,7 @@
</xsl:if>
</xsl:attribute>
</xsl:if>
+ <xsl:text>&#xa;</xsl:text>
<!-- processing the content of the OpenDocument content file -->
<xsl:apply-templates select="/*/office:body/*">
<xsl:with-param name="globalData" select="$globalData"/>
@@ -233,6 +242,7 @@
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:apply-templates>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
@@ -244,23 +254,25 @@
<xsl:template match="draw:text-box">
<xsl:param name="globalData"/>
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:variable name="dimension">
- <xsl:apply-templates select="@fo:min-width"/>
- <xsl:apply-templates select="@fo:max-width"/>
- <xsl:apply-templates select="@fo:min-height"/>
- <xsl:apply-templates select="@fo:max-height"/>
+ <xsl:apply-templates select="@fo:min-width" />
+ <xsl:apply-templates select="@fo:max-width" />
+ <xsl:apply-templates select="@fo:min-height" />
+ <xsl:apply-templates select="@fo:max-height" />
</xsl:variable>
- <xsl:if test="$dimension">
+ <xsl:if test="normalize-space($dimension)!=''">
<xsl:attribute name="style">
- <xsl:value-of select="$dimension"/>
+ <xsl:value-of select="$dimension" />
</xsl:attribute>
</xsl:if>
- <xsl:apply-templates select="@draw:name">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
+ <xsl:apply-templates select="@xml:id">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
<xsl:apply-templates select="node()">
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:apply-templates>
@@ -359,7 +371,7 @@
</xsl:if>
</xsl:when>
- <xsl:when test="draw:frame and ((normalize-space($childText) != '') or (((count(*) - count(text:soft-page-break)) &gt; 1)))">
+ <xsl:when test="name() = 'draw:frame' and ((normalize-space($childText) != '') or (((count(*) - count(text:soft-page-break)) &gt; 1)))">
<!-- If there is a 'draw:frame' child with text (not being whitespace alone) and more than the draw:frame alone and
not the draw:frame and a soft-page-break alone (which is quite often) -->
@@ -368,10 +380,14 @@
<!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
<xsl:choose>
<xsl:when test="name() = 'text:p'">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:otherwise>
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="div">
@@ -411,7 +427,7 @@
&#160; is an unbreakable whitespace to give content to the element and force a browser not to ignore the element -->
<div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
</xsl:when>
- <xsl:when test="text:tab and not(ancestor::text:index-body)">
+ <xsl:when test="text:tab and not(ancestor::text:index-body)">
<!-- If there is a tabulator (ie. text:tab) within a paragraph, a heuristic for ODF tabulators creates a
span for every text:tab embracing the following text nodes aligning them according to the tabulator.
A line break or another text:tab starts a new text:span, line break even the tab counter for the line.
@@ -430,7 +446,7 @@
<xsl:variable name="paragraphName" select="@text:style-name" />
<xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
<!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
-<!-- TODO: left-margin in order with bidirectional -->
+ <!-- TODO: left-margin in order with bidirectional -->
<xsl:choose>
<xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
<xsl:call-template name="convert2cm">
@@ -472,10 +488,12 @@
</xsl:if>
</xsl:when>
<xsl:otherwise>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name="create-paragraph">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
@@ -547,6 +565,7 @@
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:apply-templates>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
<xsl:with-param name="globalData" select="$globalData"/>
<xsl:with-param name="tabStops" select="$tabStops"/>
@@ -558,6 +577,7 @@
<xsl:when test="name() = 'text:line-break'">
<!-- A line-break resets the tabCount to '0' -->
<br/>
+ <xsl:text>&#xa;</xsl:text>
<xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
<xsl:with-param name="globalData" select="$globalData"/>
<xsl:with-param name="tabStops" select="$tabStops"/>
@@ -565,6 +585,7 @@
<xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
<xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
</xsl:apply-templates>
+ <xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- only before the first tab all content is written out -->
@@ -580,6 +601,7 @@
<xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
<xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
</xsl:apply-templates>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -688,7 +710,10 @@
<xsl:otherwise>p</xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
+ <xsl:if test="name() = 'text:p' and $elementName = 'div'">
+ <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
+ </xsl:if>
<xsl:element name="{$elementName}">
<xsl:choose>
<!-- in ODF borders of paragraphs will be merged by default. Merging means the adjacent paragraphs are building a unit,
@@ -788,7 +813,7 @@
<xsl:text>;</xsl:text>
</xsl:template>
- <!-- As soon a frame is within a paragraph (text:p) or page:frame, every child element is floating (CSS) and worked out in sequence.
+ <!-- As soon a frame is within a paragraph (text:p) or page:frame, every child element is floating (CSS) and worked out in sequence.
Accumulating prior frame width and adding parent's left margin -->
<!-- Matching all elements and text beyond a paragraph/text:page which are sibling of a draw:frame -->
<xsl:template match="* | text()" mode="frameFloating">
@@ -798,11 +823,9 @@
<xsl:param name="leftPosition" select="0" />
<xsl:param name="parentMarginLeft" />
<xsl:param name="stopAtFirstFrame" select="false()" />
- <xsl:param name="tdf146264hack" select="false()" />
<xsl:choose>
<xsl:when test="name() = 'draw:frame' and not($stopAtFirstFrame)">
-
<!-- if the first node is a draw:frame create a div -->
<xsl:call-template name="createDrawFrame">
<xsl:with-param name="globalData" select="$globalData"/>
@@ -819,21 +842,18 @@
<!-- every following frame sibling till the next draw:frame
have to be encapsulated within a div with left indent.
To be moved altogether according the indent (usually right) -->
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:attribute name="style">
<xsl:text>display:inline; position:relative; left:</xsl:text>
<xsl:value-of select="$leftPosition"/>
<xsl:text>cm;</xsl:text>
</xsl:attribute>
- <!-- This xsl:if is the meat of the extremely ugly "fix" to tdf#146264. It probably has unintended
- bad side-effects.
- -->
- <xsl:if test="not($tdf146264hack)">
- <xsl:apply-templates select=".">
- <xsl:with-param name="globalData" select="$globalData"/>
- </xsl:apply-templates>
- </xsl:if>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
<!-- if it is a frame sibling it will be NOT encapsulated within the div (as already within one) -->
<xsl:if test="not($nextSiblingIsFrame)">
<xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
@@ -904,13 +924,11 @@
<xsl:param name="globalData"/>
<xsl:param name="previousFrameWidths" select="0"/>
<xsl:param name="previousFrameHeights" select="0" />
- <xsl:param name="tdf146264hack" select="false()" />
<xsl:call-template name="createDrawFrame">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
<xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
- <xsl:with-param name="tdf146264hack" select="$tdf146264hack"/>
</xsl:call-template>
<!-- after the last draw:frame sibling the CSS float is disabled -->
<xsl:if test="@text:anchor-type!='as-char'">
@@ -954,7 +972,6 @@
<xsl:param name="previousFrameHeights" select="0" />
<xsl:param name="parentMarginLeft"/>
<xsl:param name="stopAtFirstFrame" select="false()" />
- <xsl:param name="tdf146264hack" select="false()" />
<xsl:variable name="parentMarginLeftNew">
<xsl:choose>
@@ -1010,7 +1027,9 @@
</xsl:variable>
<!-- if the frame is anchored on a paragraph -->
<xsl:if test="@text:anchor-type='paragraph'">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' is emulating the top height of a draw:frame.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<!-- When the svg:y is set relative to the paragraph content, the best way to emulate a positive height,
is to add an invisible division inbetween with a height.
Often text will flow into this 'gap', which is handled separately!
@@ -1033,14 +1052,6 @@
<xsl:with-param name="leftPosition" select="$leftPosition"/>
<xsl:with-param name="svgY" select="$svgY"/>
</xsl:call-template>
- <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
- <xsl:with-param name="globalData" select="$globalData"/>
- <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
- <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
- <xsl:with-param name="leftPosition" select="$leftPosition"/>
- <xsl:with-param name="stopAtFirstFrame" select="$stopAtFirstFrame" />
- <xsl:with-param name="tdf146264hack" select="$tdf146264hack" />
- </xsl:apply-templates>
</xsl:template>
<xsl:template name="createDrawFrame2">
@@ -1056,9 +1067,9 @@
<xsl:otherwise>div</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:comment>Next '
- <xsl:value-of select="$elem-name"/>' is a draw:frame.
- </xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
+ <xsl:comment>Next '<xsl:value-of select="$elem-name"/>' is a draw:frame. </xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="{$elem-name}">
<xsl:choose>
<xsl:when test="draw:object/math:math">
@@ -1074,18 +1085,33 @@
<xsl:attribute name="style">
<xsl:call-template name="widthAndHeight"/>
<xsl:text> padding:0; </xsl:text>
- <xsl:if test="@text:anchor-type!='as-char'">
- <!-- all images float (CSS float relative) with a left position calculated by svg:x - parentMarginLeft - previousFrameWidths -->
- <xsl:text> float:left; position:relative; left:</xsl:text>
- <xsl:value-of select="$leftPosition"/>
- <xsl:text>cm; </xsl:text>
- <!-- if the frame is anchored on a char -->
- <xsl:if test="@text:anchor-type='char'">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">
+ <!-- images being used as character are not floating and are not positioned (CSS position:static being the default)-->
+ <!--<xsl:text> position:static;</xsl:text>-->
+ </xsl:when>
+ <xsl:when test="@text:anchor-type!='as-char'">
+ <!-- all images float (CSS float relative) with a left position calculated by svg:x - parentMarginLeft - previousFrameWidths -->
+ <xsl:text> float:left; position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition" />
+ <xsl:text>cm; </xsl:text>
+ <!-- if the frame is anchored on a char -->
+ <xsl:if test="@text:anchor-type='char'">
+ <xsl:text>top:</xsl:text>
+ <xsl:value-of select="$svgY" />
+ <xsl:text>cm; </xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <!-- if there is no attribute @text:anchor-type -->
+ <xsl:otherwise>
+ <xsl:text> position:absolute; left:</xsl:text>
+ <xsl:value-of select="$leftPosition" />
+ <xsl:text>cm; </xsl:text>
<xsl:text>top:</xsl:text>
- <xsl:value-of select="$svgY"/>
+ <xsl:value-of select="$svgY" />
<xsl:text>cm; </xsl:text>
- </xsl:if>
- </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="@*">
<xsl:with-param name="globalData" select="$globalData"/>
@@ -1181,7 +1207,10 @@
NOTE: Should be handled as CSS style in style header -->
<xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
<xsl:attribute name="class">
- <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ <xsl:with-param name="styleFamily" select="'paragraph'"/>
+ </xsl:call-template>
</xsl:attribute>
<xsl:call-template name="create-heading-anchor">
@@ -1193,6 +1222,7 @@
</xsl:apply-templates>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
<xsl:template name="create-heading-anchor">
@@ -1998,7 +2028,7 @@
<xsl:otherwise>
<xsl:variable name="listLabelWidth">
<xsl:choose>
- <xsl:when test="$minLabelWidth">
+ <xsl:when test="$minLabelWidth &gt; 0">
<xsl:value-of select="$minLabelWidth"/>
</xsl:when>
<xsl:otherwise>
@@ -2053,9 +2083,11 @@
<xsl:apply-templates select="text:number" mode="listnumber"/>
</xsl:when>
<xsl:when test="name($listLevelStyle) = 'text:list-level-style-bullet'">
- <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <!-- not viewed in LO similar to tdf146264
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>-->
<xsl:value-of select="$listLevelStyle/@text:bullet-char"/>
- <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ <!-- not viewed in LO see tdf146264
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>-->
</xsl:when>
<xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
<xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
@@ -2561,7 +2593,6 @@
<xsl:apply-templates>
<xsl:with-param name="globalData" select="$globalData"/>
<xsl:with-param name="listIndent" select="$minLabelWidth"/>
- <xsl:with-param name="tdf146264hack" select="true()"/>
</xsl:apply-templates>
<!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
<span class="odfLiEnd"></span>
@@ -2782,12 +2813,15 @@
<xsl:param name="globalData"/>
<xsl:if test="not(contains(@text:display, 'none'))">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:call-template name="apply-styles-and-content">
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:call-template>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
</xsl:if>
</xsl:template>
@@ -2816,14 +2850,329 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
+ <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name | @presentation:style-name">
<xsl:param name="globalData"/>
- <xsl:attribute name="class">
- <xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
- </xsl:attribute>
+ <!-- the problem there can be more than one style-name attribute! We need to write class once with all style-name attribute values -->
+ <xsl:variable name="classAttributeValue">
+ <xsl:if test="parent::*/@text:style-name != ''">
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@text:style-name"/>
+ <xsl:with-param name="styleFamily">
+ <xsl:call-template name="get-style-family-name">
+ <xsl:with-param name="parentName" select="name(..)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:if test="parent::*/@draw:style-name != ''">
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@draw:style-name"/>
+ <xsl:with-param name="styleFamily">
+ <xsl:call-template name="get-style-family-name">
+ <xsl:with-param name="parentName" select="name(..)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:if test="parent::*/@draw:text-style-name != ''">
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@draw:text-style-name"/>
+ <xsl:with-param name="styleFamily">
+ <xsl:call-template name="get-style-family-name">
+ <xsl:with-param name="parentName" select="name(..)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:if test="parent::*/@table:style-name != ''">
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@table:style-name"/>
+ <xsl:with-param name="styleFamily">
+ <xsl:call-template name="get-style-family-name">
+ <xsl:with-param name="parentName" select="name(..)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:if test="parent::*/@presentation:style-name != ''">
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="parent::*/@presentation:style-name"/>
+ <xsl:with-param name="styleFamily">
+ <xsl:call-template name="get-style-family-name">
+ <xsl:with-param name="parentName" select="name(..)"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template><xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:attribute name="class"><xsl:value-of select="normalize-space($classAttributeValue)"/></xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template name="create-unique-style-id">
+ <xsl:param name="styleName" />
+ <xsl:param name="styleFamily" />
+
+ <xsl:call-template name="abbreviate-style-family-name">
+ <xsl:with-param name="styleFamily" select="$styleFamily"/>
+ </xsl:call-template>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:template>
+
+
+ <xsl:template name="abbreviate-style-family-name">
+ <xsl:param name="styleFamily" />
+ <!--<xsl:message>abbreviate-style-family-name: The style family is '<xsl:value-of select="$styleFamily"/>'</xsl:message>-->
+
+ <!--
+ The complete set of family types (aka @style:family) is defined in the ODF specification:
+ https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#attribute-style_family
+ (realized style family 'section' is missing, see https://docs.oasis-open.org/office/OpenDocument/v1.3/os/schemas/OpenDocument-v1.3-schema-rng.html#12668
+ and wrote an issue to ODF TC: https://github.com/oasis-tcs/odf-tc/issues/49
+ -->
+ <xsl:choose>
+ <!-- chart: family name of styles for charts. -->
+ <xsl:when test="$styleFamily='chart'">
+ <xsl:text>chart</xsl:text>
+ </xsl:when>
+ <!-- drawing-page: family name of styles for drawing pages. -->
+ <xsl:when test="$styleFamily='drawing-page'">
+ <xsl:text>page</xsl:text>
+ </xsl:when>
+ <!-- graphic: family name of styles for graphic elements. -->
+ <xsl:when test="$styleFamily='graphic'">
+ <xsl:text>graphic</xsl:text>
+ </xsl:when>
+ <!-- paragraph: family name of styles for paragraphs. -->
+ <xsl:when test="$styleFamily='paragraph'">
+ <xsl:text>paragraph</xsl:text>
+ </xsl:when>
+ <!-- presentation: family name of styles for presentations. -->
+ <xsl:when test="$styleFamily='presentation'">
+ <xsl:text>presentation</xsl:text>
+ </xsl:when>
+ <!-- ruby: family name of styles for ruby text. -->
+ <xsl:when test="$styleFamily='ruby'">
+ <xsl:text>ruby</xsl:text>
+ </xsl:when>
+ <!-- section: family name of styles for sections. -->
+ <xsl:when test="$styleFamily='section'">
+ <xsl:text>section</xsl:text>
+ </xsl:when>
+ <!-- table: family name of styles for tables. -->
+ <xsl:when test="$styleFamily='table'">
+ <xsl:text>table</xsl:text>
+ </xsl:when>
+ <!-- table-cell: family name of styles for table cells. -->
+ <xsl:when test="$styleFamily='table-cell'">
+ <xsl:text>cell</xsl:text>
+ </xsl:when>
+ <!-- table-column: family name of styles for table columns. -->
+ <xsl:when test="$styleFamily='table-column'">
+ <xsl:text>col</xsl:text>
+ </xsl:when>
+ <!-- table-row: family name of styles for table rows. -->
+ <xsl:when test="$styleFamily='table-row'">
+ <xsl:text>row</xsl:text>
+ </xsl:when>
+ <!-- text: family name of styles for text. -->
+ <xsl:when test="$styleFamily='text'">
+ <xsl:text>text</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>WARNING: No style family found for <xsl:value-of select="$styleFamily"/></xsl:message>
+ <xsl:text>unknown-family</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
+ <xsl:template name="get-style-family-name">
+ <xsl:param name="parentName" />
+
+
+ <!--<xsl:message>get-style-family-name: The style parent is '<xsl:value-of select="name(..)"/>'</xsl:message>-->
+ <!--
+ The complete set of family types (aka @style:family) is defined in the ODF specification:
+ https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#attribute-style_family
+ (realized style family 'section' is missing, see https://docs.oasis-open.org/office/OpenDocument/v1.3/os/schemas/OpenDocument-v1.3-schema-rng.html#12668
+ and wrote an issue to ODF TC: https://github.com/oasis-tcs/odf-tc/issues/49
+
+ in addition the mapping of styleable ODF elements to their @style:family attribute is available in structured form (XML) in the ODF Toolkit generator project:
+ https://github.com/tdf/odftoolkit/blob/master/generator/schema2template/src/test/resources/test-input/odf/generation/odfdom-java/dom/grammar-additions.xml#LL43C52-L43C52r-additions.xml#LL43C52-L43C52
+ -->
+ <xsl:choose>
+ <!-- chart: family name of styles for charts. -->
+ <xsl:when test="
+ $parentName='chart:axis' or
+ $parentName='chart:chart' or
+ $parentName='chart:data-point' or
+ $parentName='chart:error-indicator' or
+ $parentName='chart:floor' or
+ $parentName='chart:footer' or
+ $parentName='chart:grid' or
+ $parentName='chart:legend' or
+ $parentName='chart:mean-value' or
+ $parentName='chart:plot-area' or
+ $parentName='chart:regression-curve' or
+ $parentName='chart:series' or
+ $parentName='chart:stock-gain-marker' or
+ $parentName='chart:stock-loss-marker' or
+ $parentName='chart:stock-range-line' or
+ $parentName='chart:subtitle' or
+ $parentName='chart:title' or
+ $parentName='chart:wall'">
+ <xsl:text>chart</xsl:text>
+ </xsl:when>
+ <!-- drawing-page: family name of styles for drawing pages. -->
+ <xsl:when test="
+ $parentName='draw:page' or
+ $parentName='style:handout-master' or
+ $parentName='style:master-page' or
+ $parentName='presentation:notes'">
+ <xsl:text>drawing-page</xsl:text>
+ </xsl:when>
+ <!-- graphic: family name of styles for graphic elements. -->
+ <xsl:when test="
+ $parentName='dr3d:cube' or
+ $parentName='dr3d:extrude' or
+ $parentName='dr3d:rotate' or
+ $parentName='dr3d:scene' or
+ $parentName='dr3d:sphere' or
+ $parentName='draw:caption' or
+ $parentName='draw:circle' or
+ $parentName='draw:connector' or
+ $parentName='draw:control' or
+ $parentName='draw:custom-shape' or
+ $parentName='draw:ellipse' or
+ $parentName='draw:frame' or
+ $parentName='draw:g' or
+ $parentName='draw:line' or
+ $parentName='draw:measure' or
+ $parentName='draw:page-thumbnail' or
+ $parentName='draw:path' or
+ $parentName='draw:polygon' or
+ $parentName='draw:polyline' or
+ $parentName='draw:rect' or
+ $parentName='draw:regular-polygon' or
+ $parentName='office:annotation'">
+ <xsl:text>graphic</xsl:text>
+ </xsl:when>
+ <!-- paragraph: family name of styles for paragraphs. -->
+ <xsl:when test="
+ $parentName='text:alphabetical-index-entry-template' or
+ $parentName='text:bibliography-entry-template' or
+ $parentName='text:h' or
+ $parentName='text:illustration-index-entry-template' or
+ $parentName='text:index-source-style' or
+ $parentName='text:index-title-template' or
+ $parentName='text:object-index-entry-template' or
+ $parentName='text:p' or
+ $parentName='text:table-index-entry-template' or
+ $parentName='text:table-of-content-entry-template' or
+ $parentName='text:user-index-entry-template'">
+ <xsl:text>paragraph</xsl:text>
+ </xsl:when>
+ <!-- presentation: family name of styles for presentations. -->
+ <xsl:when test="
+ $parentName='dr3d:cube' or
+ $parentName='dr3d:extrude' or
+ $parentName='dr3d:rotate' or
+ $parentName='dr3d:scene' or
+ $parentName='dr3d:sphere' or
+ $parentName='draw:caption' or
+ $parentName='draw:circle' or
+ $parentName='draw:connector' or
+ $parentName='draw:control' or
+ $parentName='draw:custom-shape' or
+ $parentName='draw:ellipse' or
+ $parentName='draw:frame' or
+ $parentName='draw:g' or
+ $parentName='draw:line' or
+ $parentName='draw:measure' or
+ $parentName='draw:page-thumbnail' or
+ $parentName='draw:path' or
+ $parentName='draw:polygon' or
+ $parentName='draw:polyline' or
+ $parentName='draw:rect' or
+ $parentName='draw:regular-polygon' or
+ $parentName='office:annotation'">
+ <xsl:text>presentation</xsl:text>
+ </xsl:when>
+ <!-- ruby: family name of styles for ruby text. -->
+ <xsl:when test="$parentName='text:ruby' or
+ $parentName='text:ruby-text'">
+ <xsl:text>ruby</xsl:text>
+ </xsl:when>
+ <!-- section: family name of styles for sections. -->
+ <xsl:when test="
+ $parentName='text:alphabetical-index' or
+ $parentName='text:bibliography' or
+ $parentName='text:illustration-index' or
+ $parentName='text:index-title' or
+ $parentName='text:object-index' or
+ $parentName='text:page' or
+ $parentName='text:section' or
+ $parentName='text:s' or
+ $parentName='text:table-index' or
+ $parentName='text:table-of-content' or
+ $parentName='text:user-index'">
+ <xsl:text>section</xsl:text>
+ </xsl:when>
+ <!-- table: family name of styles for tables. -->
+ <xsl:when test="$parentName='table:table'">
+ <xsl:text>table</xsl:text>
+ </xsl:when>
+ <!-- table-cell: family name of styles for table cells. -->
+ <xsl:when test="
+ $parentName='table:table-cell' or
+ $parentName='table:body' or
+ $parentName='table:even-columns' or
+ $parentName='table:even-rows' or
+ $parentName='table:first-column' or
+ $parentName='table:first-row' or
+ $parentName='table:last-column' or
+ $parentName='table:last-row' or
+ $parentName='table:odd-columns' or
+ $parentName='table:odd-rows' or
+ $parentName='table:covered-table-cell'">
+ <xsl:text>table-cell</xsl:text>
+ </xsl:when>
+ <!-- table-column: family name of styles for table columns. -->
+ <xsl:when test="$parentName='table:table-column'">
+ <xsl:text>table-column</xsl:text>
+ </xsl:when>
+ <!-- table-row: family name of styles for table rows. -->
+ <xsl:when test="$parentName='table:table-row'">
+ <xsl:text>table-row</xsl:text>
+ </xsl:when>
+ <!-- text: family name of styles for text. -->
+ <xsl:when test="
+ $parentName='text:index-entry-bibliography' or
+ $parentName='text:index-entry-chapter' or
+ $parentName='text:index-entry-link-end' or
+ $parentName='text:index-entry-link-start' or
+ $parentName='text:index-entry-page-number' or
+ $parentName='text:index-entry-span' or
+ $parentName='text:index-entry-tab-stop' or
+ $parentName='text:index-entry-text' or
+ $parentName='text:a' or
+ $parentName='text:span' or
+ $parentName='style:drop-cap' or
+ $parentName='text:line-break' or
+ $parentName='text:tab' or
+ $parentName='text:linenumbering-configuration'">
+ <xsl:text>text</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>WARNING: No style family found for parent element <xsl:value-of select="$parentName"/></xsl:message>
+ <xsl:text>unknown-family-parent</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<!-- ***************** -->
<!-- *** Footnotes *** -->
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
index 2bd07d8d29e4..bdd2d05b0925 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
@@ -55,12 +55,14 @@
<xsl:template name="create-header">
<xsl:param name="globalData" />
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="head">
<xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
<xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created...</xsl:message></xsl:if>
<xsl:call-template name='xhtml-header-properties'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created...</xsl:message></xsl:if>
<!-- constructing the css header simulating inheritance of style-families by style order -->
@@ -68,6 +70,7 @@
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
<xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
+ <xsl:text>&#xa;</xsl:text>
</xsl:element>
</xsl:template>
@@ -126,7 +129,12 @@
<xsl:for-each select="$globalData/all-styles/style">
<xsl:if test="final-properties != ''">
<!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambiguous -->
- <xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
+ <xsl:text>.</xsl:text>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="@style:name"/>
+ <xsl:with-param name="styleFamily" select="@style:family"/>
+ </xsl:call-template>
+ <xsl:text>{ </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
</xsl:text>
</xsl:if>
@@ -246,11 +254,13 @@
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
<xsl:if test="./@meta:name='ODF.base'">
<xsl:value-of select="." />
+ <xsl:text>&#xa;</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
<xsl:if test="./@meta:name='ODF.filename'">
<xsl:value-of select="." />
+ <xsl:text>&#xa;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
@@ -282,11 +292,13 @@
</xsl:for-each>
</xsl:variable>
+ <xsl:text>&#xa;</xsl:text>
<!-- explicit output content-type for low-tech browser (e.g. IE6) -->
<xsl:element name="meta">
<xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
<xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
<!-- title of document for browser frame title -->
<xsl:element name="title">
@@ -304,6 +316,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
<!-- title, in DC syntax -->
<xsl:element name="meta">
@@ -315,6 +328,7 @@
<xsl:value-of select="$lang" />
</xsl:attribute>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
<!-- the identifier for source (identifier) -->
<xsl:call-template name="add-meta-tag">
@@ -322,6 +336,7 @@
<xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
<xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- the language for source (language) -->
<xsl:call-template name="add-meta-tag">
@@ -329,18 +344,21 @@
<xsl:with-param name="meta-data" select="$lang" />
<xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- a bit commercial (generator) -->
<xsl:element name="meta">
<xsl:attribute name="name">DCTERMS.source</xsl:attribute>
<xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
<!-- the author of the input source (author) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- creation-date of the input source (issued) -->
<xsl:call-template name="add-meta-tag">
@@ -348,12 +366,14 @@
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- name of last changing person of the input source (changedby) -->
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- last changing date of the input source (changed) -->
<xsl:call-template name="add-meta-tag">
@@ -361,6 +381,7 @@
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
<xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- Last print, as provenance -->
<xsl:if test="$prov">
@@ -369,6 +390,7 @@
<xsl:with-param name="meta-data" select="$prov" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:if>
<!-- keywords about the input source (keywords) -->
@@ -380,6 +402,7 @@
<xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,', ',$keywords))" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:when test="($globalData/meta-file/*/office:meta/dc:subject != '')">
<xsl:call-template name="add-meta-tag">
@@ -387,6 +410,7 @@
<xsl:with-param name="meta-data" select="normalize-space($globalData/meta-file/*/office:meta/dc:subject)" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="add-meta-tag">
@@ -394,6 +418,7 @@
<xsl:with-param name="meta-data" select="normalize-space($keywords)" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
@@ -404,6 +429,7 @@
<xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
<xsl:with-param name="meta-lang" select="$lang" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<!-- user defined use of DCTERM tags -->
@@ -413,6 +439,7 @@
<xsl:with-param name="meta-data" select="." />
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:for-each>
<!-- user defined use of DC tags (legacy) -->
<xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
@@ -421,16 +448,22 @@
<xsl:with-param name="meta-data" select="." />
<!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:for-each>
<xsl:call-template name="add-meta-tag">
<xsl:with-param name="meta-name" select="'xsl:vendor'" />
<xsl:with-param name="meta-data" select="system-property('xsl:vendor')" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
+ <xsl:text>&#xa;</xsl:text>
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
+ <xsl:text>&#xa;</xsl:text>
<link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
+ <xsl:text>&#xa;</xsl:text>
<link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
+ <xsl:text>&#xa;</xsl:text>
<!-- W3C GRDDL Profile -->
<!--
<link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
index 196b85eae859..b320f9c22979 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
@@ -145,6 +145,11 @@
<xsl:template name="start-main">
<xsl:param name="globalData" />
+ <!-- disable style collection debug
+ <xsl:call-template name="write-collected-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template> -->
+
<xsl:variable name="lang">
<xsl:choose>
<xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
@@ -154,18 +159,24 @@
</xsl:choose>
</xsl:variable>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="html">
<xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>This file was converted to xhtml by LibreOffice - see https://cgit.freedesktop.org/libreoffice/core/tree/filter/source/xslt for the code.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name='create-header'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name='create-body'>
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
index 8448665d20b3..0788b2bf52a9 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
@@ -206,8 +206,10 @@
<!-- cell style header -->
<xsl:attribute name="class">
- <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ <xsl:call-template name="create-unique-style-id">
+ <xsl:with-param name="styleName" select="$styleName"/>
+ <xsl:with-param name="styleFamily" select="'table-cell'"/>
+ </xsl:call-template>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
-
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
index 30c4f894bf9c..6912bb407c0b 100644
--- a/filter/source/xsltdialog/typedetectionexport.cxx
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "typedetectionexport.hxx"
#include "xmlfiltercommon.hxx"
@@ -79,18 +79,17 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
{
try
{
- static const OUStringLiteral sComponentData ( u"oor:component-data" );
- static const OUStringLiteral sNode ( u"node" );
- static const OUStringLiteral sName ( u"oor:name" );
- static const OUStringLiteral sWhiteSpace ( u" " );
- static const OUStringLiteral sUIName ( u"UIName" );
- static const OUStringLiteral sComma ( u"," );
- static const OUStringLiteral sDelim ( u";" );
- static const OUStringLiteral sData ( u"Data" );
- static const OUStringLiteral sDocTypePrefix ( u"doctype:" );
- static const OUStringLiteral sFilterAdaptorService( u"com.sun.star.comp.Writer.XmlFilterAdaptor" );
- static const OUStringLiteral sXSLTFilterService ( u"com.sun.star.documentconversion.XSLTFilter" );
- static const OUStringLiteral sCdataAttribute ( u"CDATA" );
+ static constexpr OUString sComponentData ( u"oor:component-data"_ustr );
+ static constexpr OUString sNode ( u"node"_ustr );
+ static constexpr OUString sName ( u"oor:name"_ustr );
+ static constexpr OUString sWhiteSpace ( u" "_ustr );
+ static constexpr OUString sUIName ( u"UIName"_ustr );
+ static constexpr OUString sComma ( u","_ustr );
+ static constexpr OUString sDelim ( u";"_ustr );
+ static constexpr OUString sData ( u"Data"_ustr );
+ static constexpr OUStringLiteral sDocTypePrefix ( u"doctype:" );
+ static constexpr OUStringLiteral sFilterAdaptorService( u"com.sun.star.comp.Writer.XmlFilterAdaptor" );
+ static constexpr OUStringLiteral sXSLTFilterService ( u"com.sun.star.documentconversion.XSLTFilter" );
// set up sax writer and connect to given output stream
@@ -98,10 +97,10 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
xHandler->setOutputStream( xOS );
rtl::Reference<::comphelper::AttributeList> pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( "xmlns:oor", sCdataAttribute, "http://openoffice.org/2001/registry" );
- pAttrList->AddAttribute ( "xmlns:xs", sCdataAttribute, "http://www.w3.org/2001/XMLSchema" );
- pAttrList->AddAttribute ( sName, sCdataAttribute, "TypeDetection" );
- pAttrList->AddAttribute ( "oor:package", sCdataAttribute, "org.openoffice.Office" );
+ pAttrList->AddAttribute ( "xmlns:oor", "http://openoffice.org/2001/registry" );
+ pAttrList->AddAttribute ( "xmlns:xs", "http://www.w3.org/2001/XMLSchema" );
+ pAttrList->AddAttribute ( sName, "TypeDetection" );
+ pAttrList->AddAttribute ( "oor:package", "org.openoffice.Office" );
xHandler->startDocument();
xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -110,14 +109,14 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
// export types
{
pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( sName, sCdataAttribute, "Types" );
+ pAttrList->AddAttribute ( sName, "Types" );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, pAttrList );
for (auto const& filter : rFilters)
{
pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute( sName, sCdataAttribute, filter->maType );
+ pAttrList->AddAttribute( sName, filter->maType );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, pAttrList );
OUString sValue = "0" + sComma + sComma;
@@ -141,14 +140,14 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co
// export filters
{
pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( sName, sCdataAttribute, "Filters" );
+ pAttrList->AddAttribute ( sName, "Filters" );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, pAttrList );
for (auto const& filter : rFilters)
{
pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute( sName, sCdataAttribute, filter->maFilterName );
+ pAttrList->AddAttribute( sName, filter->maFilterName );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sNode, pAttrList );
addLocaleProperty( xHandler, sUIName, filter->maInterfaceName );
@@ -207,14 +206,13 @@ void TypeDetectionExporter::addProperty( const Reference< XWriter >& xHandler, c
{
try
{
- static const OUStringLiteral sCdataAttribute( u"CDATA" );
- static const OUStringLiteral sProp( u"prop" );
- static const OUStringLiteral sValue( u"value" );
- static const OUStringLiteral sWhiteSpace ( u" " );
+ static constexpr OUString sProp( u"prop"_ustr );
+ static constexpr OUString sValue( u"value"_ustr );
+ static constexpr OUString sWhiteSpace ( u" "_ustr );
rtl::Reference<::comphelper::AttributeList>pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( "oor:name", sCdataAttribute, rName );
- pAttrList->AddAttribute ( "oor:type", sCdataAttribute, "xs:string" );
+ pAttrList->AddAttribute ( "oor:name", rName );
+ pAttrList->AddAttribute ( "oor:type", "xs:string" );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sProp, pAttrList );
@@ -235,19 +233,18 @@ void TypeDetectionExporter::addLocaleProperty( const Reference< XWriter >& xHand
{
try
{
- static const OUStringLiteral sCdataAttribute( u"CDATA" );
- static const OUStringLiteral sProp( u"prop" );
- static const OUStringLiteral sValue( u"value" );
- static const OUStringLiteral sWhiteSpace ( u" " );
+ static constexpr OUString sProp( u"prop"_ustr );
+ static constexpr OUString sValue( u"value"_ustr );
+ static constexpr OUString sWhiteSpace ( u" "_ustr );
rtl::Reference<::comphelper::AttributeList> pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( "oor:name", sCdataAttribute, rName );
- pAttrList->AddAttribute ( "oor:type", sCdataAttribute, "xs:string" );
+ pAttrList->AddAttribute ( "oor:name", rName );
+ pAttrList->AddAttribute ( "oor:type", "xs:string" );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sProp, pAttrList );
pAttrList = new ::comphelper::AttributeList;
- pAttrList->AddAttribute ( "xml:lang", sCdataAttribute, "en-US" );
+ pAttrList->AddAttribute ( "xml:lang", "en-US" );
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sValue, pAttrList );
xHandler->characters( rValue );
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
index bba302de703c..d891a4908c62 100644
--- a/filter/source/xsltdialog/typedetectionimport.cxx
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -20,8 +20,9 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#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..9482fb0b2b63 100644
--- a/filter/source/xsltdialog/xmlfiltercommon.hxx
+++ b/filter/source/xsltdialog/xmlfiltercommon.hxx
@@ -20,7 +20,6 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
-#include <unotools/resmgr.hxx>
#include <string_view>
#include <vector>
@@ -30,7 +29,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
@@ -78,6 +77,5 @@ struct application_info_impl
extern std::vector< application_info_impl > const & getApplicationInfos();
extern OUString getApplicationUIName( std::u16string_view rServiceName );
extern const application_info_impl* getApplicationInfo( std::u16string_view rServiceName );
-OUString XsltResId(TranslateId pId);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
index 6f4b1db3453b..64b02feb2d78 100644
--- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <osl/mutex.hxx>
-
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/factory.hxx>
-#include <cppuhelper/component.hxx>
+#include <comphelper/compbase.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <cppuhelper/supportsservice.hxx>
@@ -35,42 +33,26 @@
#include "xmlfiltersettingsdialog.hxx"
using namespace ::cppu;
-using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::frame;
namespace {
-class XMLFilterDialogComponentBase
-{
-protected:
- ::osl::Mutex maMutex;
-};
-
-class XMLFilterDialogComponent : public XMLFilterDialogComponentBase,
- public OComponentHelper,
- public css::ui::dialogs::XExecutableDialog,
- public XServiceInfo,
- public XInitialization,
- public XTerminateListener
+class XMLFilterDialogComponent : public comphelper::WeakComponentImplHelper<
+ css::ui::dialogs::XExecutableDialog,
+ XServiceInfo,
+ XInitialization,
+ XTerminateListener>
{
public:
explicit XMLFilterDialogComponent( const Reference< XComponentContext >& rxContext );
- // XInterface
- virtual Any SAL_CALL queryInterface( const Type& aType ) override;
- virtual Any SAL_CALL queryAggregation( Type const & rType ) override;
- virtual void SAL_CALL acquire() noexcept override;
- virtual void SAL_CALL release() noexcept override;
-
protected:
// XTypeProvider
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
- virtual Sequence< Type > SAL_CALL getTypes() override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
@@ -91,7 +73,7 @@ protected:
/** Called in dispose method after the listeners were notified.
*/
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
private:
css::uno::Reference<css::awt::XWindow> mxParent; /// parent window
@@ -103,59 +85,13 @@ private:
}
XMLFilterDialogComponent::XMLFilterDialogComponent(const css::uno::Reference< XComponentContext >& rxContext)
- : OComponentHelper(maMutex)
- , mxContext(rxContext)
+ : mxContext(rxContext)
{
Reference< XDesktop2 > xDesktop = Desktop::create( rxContext );
Reference< XTerminateListener > xListener( this );
xDesktop->addTerminateListener( xListener );
}
-// XInterface
-Any SAL_CALL XMLFilterDialogComponent::queryInterface( const Type& aType )
-{
- return OComponentHelper::queryInterface( aType );
-}
-
-
-Any SAL_CALL XMLFilterDialogComponent::queryAggregation( Type const & rType )
-{
- if (rType == cppu::UnoType<css::ui::dialogs::XExecutableDialog>::get())
- {
- void * p = static_cast< css::ui::dialogs::XExecutableDialog * >( this );
- return Any( &p, rType );
- }
- else if (rType == cppu::UnoType<XServiceInfo>::get())
- {
- void * p = static_cast< XServiceInfo * >( this );
- return Any( &p, rType );
- }
- else if (rType == cppu::UnoType<XInitialization>::get())
- {
- void * p = static_cast< XInitialization * >( this );
- return Any( &p, rType );
- }
- else if (rType == cppu::UnoType<XTerminateListener>::get())
- {
- void * p = static_cast< XTerminateListener * >( this );
- return Any( &p, rType );
- }
- return OComponentHelper::queryAggregation( rType );
-}
-
-
-void SAL_CALL XMLFilterDialogComponent::acquire() noexcept
-{
- OComponentHelper::acquire();
-}
-
-
-void SAL_CALL XMLFilterDialogComponent::release() noexcept
-{
- OComponentHelper::release();
-}
-
-
OUString SAL_CALL XMLFilterDialogComponent::getImplementationName()
{
return "com.sun.star.comp.ui.XSLTFilterDialog";
@@ -168,18 +104,6 @@ Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId()
}
-Sequence< Type > XMLFilterDialogComponent::getTypes()
-{
- return { cppu::UnoType<XComponent>::get(),
- cppu::UnoType<XTypeProvider>::get(),
- cppu::UnoType<XAggregation>::get(),
- cppu::UnoType<XWeak>::get(),
- cppu::UnoType<XServiceInfo>::get(),
- cppu::UnoType<XInitialization>::get(),
- cppu::UnoType<XTerminateListener>::get(),
- cppu::UnoType<css::ui::dialogs::XExecutableDialog>::get() };
-}
-
Sequence< OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames()
{
return { "com.sun.star.ui.dialogs.XSLTFilterDialog" };
@@ -192,12 +116,16 @@ sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const OUString& Serv
/** Called in dispose method after the listeners were notified.
*/
-void SAL_CALL XMLFilterDialogComponent::disposing()
+void XMLFilterDialogComponent::disposing(std::unique_lock<std::mutex>& rGuard)
{
- ::SolarMutexGuard aGuard;
+ rGuard.unlock();
+ {
+ ::SolarMutexGuard aGuard;
- if (mxDialog)
- mxDialog->response(RET_CLOSE);
+ if (mxDialog)
+ mxDialog->response(RET_CLOSE);
+ }
+ rGuard.lock();
}
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index e3c8d6239a83..01ec7af8ccd8 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -37,7 +37,7 @@
#include <unotools/streamwrap.hxx>
#include <unotools/tempfile.hxx>
#include <svl/urihelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
@@ -60,7 +60,7 @@ using namespace com::sun::star::io;
using ::rtl::Uri;
-constexpr OUStringLiteral sVndSunStarPackage(u"vnd.sun.star.Package:");
+constexpr OUString sVndSunStarPackage(u"vnd.sun.star.Package:"_ustr);
XMLFilterJarHelper::XMLFilterJarHelper( const Reference< XComponentContext >& rxContext )
: mxContext( rxContext ),
@@ -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 );
}
}
@@ -149,7 +149,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const std::ve
Sequence< Any > aArguments{ Any(rPackageURL),
// let ZipPackage be used ( no manifest.xml is required )
Any(beans::NamedValue(
- "StorageFormat", Any(OUString(ZIP_STORAGE_FORMAT_STRING)))) };
+ "StorageFormat", Any(ZIP_STORAGE_FORMAT_STRING))) };
Reference< XHierarchicalNameAccess > xIfc(
mxContext->getServiceManager()->createInstanceWithArgumentsAndContext(
@@ -191,20 +191,18 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const std::ve
}
// create TypeDetection.xcu
- utl::TempFile aTempFile;
- aTempFile.EnableKillingFile();
- OUString aTempFileURL( aTempFile.GetURL() );
+ utl::TempFileFast aTempFile;
+ SvStream* pStream = aTempFile.GetStream(StreamMode::READWRITE);
{
- osl::File aOutputFile( aTempFileURL );
- (void)aOutputFile.open(osl_File_OpenFlag_Write);
- Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
+ Reference< XOutputStream > xOS( new ::utl::OOutputStreamWrapper( *pStream ) );
TypeDetectionExporter aExporter( mxContext );
aExporter.doExport(xOS,rFilters);
}
- Reference< XInputStream > XIS( new utl::OSeekableInputStreamWrapper( new SvFileStream(aTempFileURL, StreamMode::READ ), true ) );
+ pStream->Seek(0);
+ Reference< XInputStream > XIS( new utl::OSeekableInputStreamWrapper( *pStream ) );
addFile_( xRootFolder, xFactory, XIS, "TypeDetection.xcu" );
Reference< XChangesBatch > xBatch( xIfc, UNO_QUERY );
@@ -235,7 +233,7 @@ void XMLFilterJarHelper::openPackage( const OUString& rPackageURL,
// let ZipPackage be used ( no manifest.xml is required )
beans::NamedValue aArg;
aArg.Name = "StorageFormat";
- aArg.Value <<= OUString(ZIP_STORAGE_FORMAT_STRING);
+ aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
Sequence< Any > aArguments{ Any(rPackageURL), Any(aArg) };
Reference< XHierarchicalNameAccess > xIfc(
@@ -299,7 +297,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 +306,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..ce06b716e20b 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -26,10 +26,10 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <comphelper/propertyvalue.hxx>
-#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <unotools/pathoptions.hxx>
-#include <unotools/resmgr.hxx>
#include <unotools/streamwrap.hxx>
#include <osl/file.hxx>
#include <o3tl/enumrange.hxx>
@@ -60,11 +60,6 @@ using namespace com::sun::star::util;
using ::rtl::Uri;
-OUString XsltResId(TranslateId aId)
-{
- return Translate::get(aId, Translate::Create("flt"));
-}
-
XMLFilterSettingsDialog::XMLFilterSettingsDialog(weld::Window* pParent,
const css::uno::Reference<css::uno::XComponentContext>& rxContext)
: GenericDialogController(pParent, "filter/ui/xmlfiltersettings.ui", "XMLFilterSettingsDialog")
@@ -87,7 +82,7 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(weld::Window* pParent,
m_xFilterListBox->connect_changed( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) );
m_xFilterListBox->connect_row_activated( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) );
- m_xFilterListBox->set_accessible_name(XsltResId(STR_XML_FILTER_LISTBOX));
+ m_xFilterListBox->set_accessible_name(FilterResId(STR_XML_FILTER_LISTBOX));
m_xPBNew->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
m_xPBEdit->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) );
@@ -183,7 +178,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>())
@@ -208,13 +203,13 @@ void XMLFilterSettingsDialog::onNew()
filter_info_impl aTempInfo;
// create a unique filter name
- aTempInfo.maFilterName = createUniqueFilterName(XsltResId(STR_DEFAULT_FILTER_NAME));
+ aTempInfo.maFilterName = createUniqueFilterName(FilterResId(STR_DEFAULT_FILTER_NAME));
// init default extension
aTempInfo.maExtension = STR_DEFAULT_EXTENSION;
// set default ui name
- aTempInfo.maInterfaceName = createUniqueInterfaceName(XsltResId(STR_DEFAULT_UI_NAME));
+ aTempInfo.maInterfaceName = createUniqueInterfaceName(FilterResId(STR_DEFAULT_UI_NAME));
// set default application
aTempInfo.maDocumentService = "com.sun.star.text.TextDocument";
@@ -232,7 +227,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 +363,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 +508,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 +561,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 +671,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 +708,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,10 +721,10 @@ 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));
+ OUString aMessage(FilterResId(STR_WARN_DELETE));
aMessage = aMessage.replaceFirst( "%s", pInfo->maFilterName );
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xDialog.get(),
@@ -821,7 +816,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;
@@ -834,7 +829,7 @@ void XMLFilterSettingsDialog::onSave()
aDlg.SetContext(sfx2::FileDialogHelper::XMLFilterSettings);
OUString aExtensions( "*.jar" );
- OUString aFilterName = XsltResId(STR_FILTER_PACKAGE) +
+ OUString aFilterName = FilterResId(STR_FILTER_PACKAGE) +
" (" + aExtensions + ")";
aDlg.AddFilter( aFilterName, aExtensions );
@@ -852,13 +847,13 @@ void XMLFilterSettingsDialog::onSave()
OUString aMsg;
if( nFilters > 0 )
{
- aMsg = XsltResId(STR_FILTERS_HAVE_BEEN_SAVED);
+ aMsg = FilterResId(STR_FILTERS_HAVE_BEEN_SAVED);
aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) );
aMsg = aMsg.replaceFirst(sPlaceholder, aURL.GetLastName());
}
else
{
- aMsg = XsltResId(STR_FILTER_HAS_BEEN_SAVED);
+ aMsg = FilterResId(STR_FILTER_HAS_BEEN_SAVED);
aMsg = aMsg.replaceFirst( sPlaceholder, (*aFilters.begin())->maFilterName );
aMsg = aMsg.replaceFirst(sPlaceholder, aURL.GetLastName());
}
@@ -880,7 +875,7 @@ void XMLFilterSettingsDialog::onOpen()
aDlg.SetContext(sfx2::FileDialogHelper::XMLFilterSettings);
OUString aExtensions( "*.jar" );
- OUString aFilterName = XsltResId(STR_FILTER_PACKAGE) +
+ OUString aFilterName = FilterResId(STR_FILTER_PACKAGE) +
" (" + aExtensions + ")";
aDlg.AddFilter( aFilterName, aExtensions );
@@ -913,18 +908,18 @@ void XMLFilterSettingsDialog::onOpen()
if( nFilters == 0 )
{
INetURLObject aURLObj( aURL );
- aMsg = XsltResId(STR_NO_FILTERS_FOUND);
+ aMsg = FilterResId(STR_NO_FILTERS_FOUND);
aMsg = aMsg.replaceFirst(sPlaceholder, aURLObj.GetLastName());
}
else if( nFilters == 1 )
{
- aMsg = XsltResId(STR_FILTER_INSTALLED);
+ aMsg = FilterResId(STR_FILTER_INSTALLED);
aMsg = aMsg.replaceFirst( sPlaceholder, aFilterName );
}
else
{
- aMsg = XsltResId(STR_FILTERS_INSTALLED);
+ aMsg = FilterResId(STR_FILTERS_INSTALLED);
aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) );
}
@@ -1196,7 +1191,7 @@ OUString getApplicationUIName( std::u16string_view rServiceName )
}
else
{
- OUString aRet = XsltResId(STR_UNKNOWN_APPLICATION);
+ OUString aRet = FilterResId(STR_UNKNOWN_APPLICATION);
if( !rServiceName.empty() )
{
aRet += OUString::Concat(" (") + rServiceName + ")";
@@ -1209,7 +1204,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 +1214,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);
@@ -1242,20 +1237,20 @@ OUString XMLFilterSettingsDialog::getEntryString( const filter_info_impl* pInfo
{
if( pInfo->maFlags & 2 )
{
- aEntryStr += XsltResId(STR_IMPORT_EXPORT);
+ aEntryStr += FilterResId(STR_IMPORT_EXPORT);
}
else
{
- aEntryStr += XsltResId(STR_IMPORT_ONLY);
+ aEntryStr += FilterResId(STR_IMPORT_ONLY);
}
}
else if( pInfo->maFlags & 2 )
{
- aEntryStr += XsltResId(STR_EXPORT_ONLY);
+ aEntryStr += FilterResId(STR_EXPORT_ONLY);
}
else
{
- aEntryStr += XsltResId(STR_UNDEFINED_FILTER);
+ aEntryStr += FilterResId(STR_UNDEFINED_FILTER);
}
return aEntryStr;
@@ -1306,26 +1301,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 +1351,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/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
index ea73c486ae1f..0c105fd84126 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
@@ -21,11 +21,10 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <comphelper/fileurl.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/file.hxx>
-#include <unotools/resmgr.hxx>
#include <strings.hrc>
#include "xmlfiltertabdialog.hxx"
@@ -69,7 +68,7 @@ bool XMLFilterTabDialog::onOk()
mpXSLTPage->FillInfo( mpNewInfo.get() );
mpBasicPage->FillInfo( mpNewInfo.get() );
- OString sErrorPage;
+ OUString sErrorPage;
TranslateId pErrorId;
weld::Widget* pFocusWindow = nullptr;
OUString aReplace1;
@@ -225,7 +224,7 @@ bool XMLFilterTabDialog::onOk()
{
m_xTabCtrl->set_current_page(sErrorPage);
- OUString aMessage(XsltResId(pErrorId));
+ OUString aMessage(FilterResId(pErrorId));
if( aReplace2.getLength() )
{
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
index 4d758da28f49..4e5618329ce9 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -27,9 +27,6 @@
#include "xmlfiltercommon.hxx"
#include "xmlfiltertabpagexslt.hxx"
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
XMLFilterTabPageXSLT::XMLFilterTabPageXSLT(weld::Widget* pPage, weld::Dialog* pDialog)
: sInstPath( "$(prog)/" )
, m_pDialog(pDialog)
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 6cbea30926fb..e89ecc2d13d3 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -43,7 +43,7 @@
#include <sfx2/filedlghelper.hxx>
#include <osl/file.hxx>
#include <unotools/tempfile.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
@@ -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) );
@@ -310,7 +310,7 @@ void XMLFilterTestDialog::onExportBrowse()
int nFound = 0;
- for( const PropertyValue& rValue : std::as_const(aValues) )
+ for (const PropertyValue& rValue : aValues)
{
if ( rValue.Name == "Type" )
{
@@ -348,7 +348,7 @@ void XMLFilterTestDialog::onExportBrowse()
if( aAny >>= aValues2 )
{
OUString aExtension;
- for( const PropertyValue& rProp : std::as_const(aValues2) )
+ for (const PropertyValue& rProp : aValues2)
{
if ( rProp.Name == "Extensions" )
{
@@ -418,15 +418,14 @@ void XMLFilterTestDialog::doExport( const Reference< XComponent >& xComp )
Reference< XStorable > xStorable( xComp, UNO_QUERY );
if( xStorable.is() )
{
- OUString const ext(".xml");
- utl::TempFile aTempFile(OUString(), true, &ext);
+ utl::TempFileNamed aTempFile(u"", true, u".xml");
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 ) );
@@ -578,15 +577,14 @@ void XMLFilterTestDialog::import( const OUString& rURL )
if( m_xCBXDisplaySource->get_active() )
{
- OUString const ext(".xml");
- TempFile aTempFile(OUString(), true, &ext);
+ TempFileNamed aTempFile(u"", true, u".xml");
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 +597,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/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 6cfe82c30a2a..82f74a695e84 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -333,7 +333,7 @@ namespace XSLT
}
else
{
- xmlErrorPtr lastErr = xmlGetLastError();
+ const xmlError* lastErr = xmlGetLastError();
OUString msg;
if (lastErr)
msg = OStringToOUString(lastErr->message, RTL_TEXTENCODING_UTF8);
@@ -386,8 +386,8 @@ namespace XSLT
}
LibXSLTTransformer::LibXSLTTransformer(
- const css::uno::Reference<XComponentContext> & rxContext) :
- m_xContext(rxContext)
+ css::uno::Reference<XComponentContext> xContext) :
+ m_xContext(std::move(xContext))
{
}
@@ -441,7 +441,7 @@ namespace XSLT
LibXSLTTransformer::removeListener(
const css::uno::Reference<XStreamListener>& listener)
{
- m_listeners.erase( std::remove(m_listeners.begin(), m_listeners.end(), listener ), m_listeners.end() );
+ std::erase(m_listeners,listener);
}
void
@@ -503,9 +503,13 @@ namespace XSLT
{ // backward compatibility for old clients using createInstance
params = args;
}
+
+SAL_WNODEPRECATED_DECLARATIONS_PUSH
xmlSubstituteEntitiesDefault(0);
+SAL_WNODEPRECATED_DECLARATIONS_POP
+
m_parameters.clear();
- for (const Any& p : std::as_const(params))
+ for (const Any& p : params)
{
NamedValue nv;
p >>= nv;
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx b/filter/source/xsltfilter/LibXSLTTransformer.hxx
index 266fa2c559e1..8696bda6a34a 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.hxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx
@@ -67,7 +67,7 @@ namespace XSLT
static const sal_Int32 OUTPUT_BUFFER_SIZE;
static const sal_Int32 INPUT_BUFFER_SIZE;
- LibXSLTTransformer* m_transformer;
+ rtl::Reference<LibXSLTTransformer> m_transformer;
Sequence<sal_Int8> m_readBuf;
Sequence<sal_Int8> m_writeBuf;
@@ -131,7 +131,7 @@ namespace XSLT
public:
// ctor...
- LibXSLTTransformer(const css::uno::Reference<css::uno::XComponentContext> &r);
+ LibXSLTTransformer(css::uno::Reference<css::uno::XComponentContext> x);
// XServiceInfo
virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx
index bb2089935b32..14a21c38d75a 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -49,10 +49,9 @@ namespace XSLT
m_rootStream = createTempFile();
Sequence<Any> args{ Any(m_rootStream->getInputStream()) };
- Reference<XNameContainer> cont(
+ m_storage.set(
Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW)
->createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", args), UNO_QUERY);
- m_storage = cont;
}
}
@@ -71,10 +70,9 @@ namespace XSLT
//create a com.sun.star.embed.OLESimpleStorage from the temp stream
Sequence<Any> args{ Any(xSeek) };
- Reference<XNameContainer> cont(
+ m_storage.set(
Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW)
->createInstanceWithArguments("com.sun.star.embed.OLESimpleStorage", args), UNO_QUERY);
- m_storage = cont;
}
OString
@@ -82,13 +80,13 @@ namespace XSLT
{
if (!m_storage || !m_storage->hasByName(streamName))
{
- return "Not Found:";// + streamName;
+ return "Not Found:"_ostr;// + streamName;
}
Reference<XInputStream> subStream(m_storage->getByName(streamName), UNO_QUERY);
if (!subStream.is())
{
- return "Not Found:";// + streamName;
+ return "Not Found:"_ostr;// + streamName;
}
//The first four byte are the length of the uncompressed data
Sequence<sal_Int8> aLength(4);
@@ -98,7 +96,7 @@ namespace XSLT
int readbytes = subStream->readBytes(aLength, 4);
if (4 != readbytes)
{
- return "Can not read the length.";
+ return "Can not read the length."_ostr;
}
sal_Int32 const oleLength = (static_cast<sal_uInt8>(aLength[0]) << 0U)
| (static_cast<sal_uInt8>(aLength[1]) << 8U)
@@ -106,14 +104,14 @@ namespace XSLT
| (static_cast<sal_uInt8>(aLength[3]) << 24U);
if (oleLength < 0)
{
- return "invalid oleLength";
+ return "invalid oleLength"_ostr;
}
Sequence<sal_Int8> content(oleLength);
//Read all bytes. The compressed length should be less than the uncompressed length
readbytes = subStream->readBytes(content, oleLength);
if (oleLength < readbytes)
{
- return "oleLength";// +oleLength + readBytes;
+ return "oleLength"_ostr;// +oleLength + readBytes;
}
// Decompress the bytes
@@ -126,7 +124,7 @@ namespace XSLT
//return the base64 string of the uncompressed data
OUStringBuffer buf(oleLength);
::comphelper::Base64::encode(buf, result);
- return OUStringToOString(buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+ return OUStringToOString(buf, RTL_TEXTENCODING_ASCII_US);
}
void
@@ -159,7 +157,7 @@ namespace XSLT
//return the base64 encoded string
OUStringBuffer buf(oleLength);
::comphelper::Base64::encode(buf, oledata);
- return OUStringToOString(buf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+ return OUStringToOString(buf, RTL_TEXTENCODING_ASCII_US);
}
return encodeSubStorage(streamName);
}
diff --git a/filter/source/xsltfilter/OleHandler.hxx b/filter/source/xsltfilter/OleHandler.hxx
index 485541ee1f3b..d59429aacf4d 100644
--- a/filter/source/xsltfilter/OleHandler.hxx
+++ b/filter/source/xsltfilter/OleHandler.hxx
@@ -13,6 +13,7 @@
#include <cstring>
#include <map>
#include <string_view>
+#include <utility>
#include <vector>
#include <iostream>
#include <libxml/parser.h>
@@ -56,8 +57,8 @@ namespace XSLT
class OleHandler
{
public:
- OleHandler(const css::uno::Reference<XComponentContext>& rxContext)
- : m_xContext(rxContext)
+ OleHandler(css::uno::Reference<XComponentContext> xContext)
+ : m_xContext(std::move(xContext))
, m_tcontext(nullptr)
{
}
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index d22c372a72f5..f5fa3132580d 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -28,9 +28,10 @@
#include <osl/time.h>
#include <osl/conditn.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <rtl/ref.hxx>
+#include <rtl/uri.hxx>
#include <comphelper/interaction.hxx>
@@ -64,8 +65,8 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
-#include <com/sun/star/xml/xslt/XSLT2Transformer.hpp>
#include <com/sun/star/xml/xslt/XSLTTransformer.hpp>
+#include <utility>
#define TRANSFORMATION_TIMEOUT_SEC 60
@@ -76,7 +77,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::xml;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::util;
@@ -147,7 +147,7 @@ namespace XSLT
public:
// ctor...
- explicit XSLTFilter(const css::uno::Reference<XComponentContext> &r);
+ explicit XSLTFilter(css::uno::Reference<XComponentContext> x);
// XServiceInfo
virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
@@ -180,8 +180,8 @@ namespace XSLT
}
- XSLTFilter::XSLTFilter(const css::uno::Reference<XComponentContext> &r):
- m_xContext(r), m_bTerminated(false), m_bError(false)
+ XSLTFilter::XSLTFilter(css::uno::Reference<XComponentContext> x):
+ m_xContext(std::move(x)), m_bTerminated(false), m_bError(false)
{}
void
@@ -206,20 +206,16 @@ namespace XSLT
OUString
XSLTFilter::expandUrl(const OUString& sUrl)
{
- OUString sExpandedUrl;
- try
- {
- css::uno::Reference<XMacroExpander>
- xMacroExpander = theMacroExpander::get(m_xContext);
- sExpandedUrl = xMacroExpander->expandMacros(sUrl);
- sal_Int32 nPos = sExpandedUrl.indexOf( "vnd.sun.star.expand:" );
- if (nPos != -1)
- sExpandedUrl = sExpandedUrl.copy(nPos + 20);
- }
- catch (const Exception&)
- {
- }
- return sExpandedUrl;
+ OUString sPreparedURL(sUrl);
+ if (sPreparedURL.startsWithIgnoreAsciiCase("vnd.sun.star.expand:", &sPreparedURL))
+ {
+ sPreparedURL = rtl::Uri::decode(sPreparedURL, rtl_UriDecodeWithCharset,
+ RTL_TEXTENCODING_UTF8);
+ css::uno::Reference<XMacroExpander>
+ xMacroExpander = theMacroExpander::get(m_xContext);
+ sPreparedURL = xMacroExpander->expandMacros(sPreparedURL);
+ }
+ return sPreparedURL;
}
css::uno::Reference<xslt::XXSLTTransformer>
@@ -236,7 +232,10 @@ namespace XSLT
{
try
{
- xTransformer = xslt::XSLT2Transformer::create(m_xContext, rArgs);
+ xTransformer.set(
+ m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.xml.xslt.XSLT2Transformer", rArgs, m_xContext),
+ css::uno::UNO_QUERY_THROW);
}
catch (const Exception&)
{
@@ -246,10 +245,7 @@ namespace XSLT
throw;
}
}
-
- // instantiation of XSLT 2.0 transformer service failed, or the
- // filter does not need it
- if (!xTransformer.is())
+ else
{
xTransformer = xslt::XSLTTransformer::create(m_xContext, rArgs);
}
@@ -354,7 +350,6 @@ namespace XSLT
// create pipe
css::uno::Reference<XOutputStream> pipeout =
Pipe::create(m_xContext);
- css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
//connect transformer to pipe
m_tcontrol->setOutputStream(pipeout);
@@ -363,10 +358,10 @@ namespace XSLT
InputSource aInput;
aInput.sSystemId = aURL;
aInput.sPublicId = aURL;
- aInput.aInputStream = pipein;
+ aInput.aInputStream.set(pipeout, UNO_QUERY);
- css::uno::Reference< css::xml::sax::XFastParser > xFastParser = dynamic_cast<
- css::xml::sax::XFastParser* >( xHandler.get() );
+ css::uno::Reference< css::xml::sax::XFastParser > xFastParser(
+ xHandler, css::uno::UNO_QUERY );
// transform
m_tcontrol->start();
@@ -377,7 +372,7 @@ namespace XSLT
Sequence<Any> excArgs(0);
css::ucb::InteractiveAugmentedIOException exc(
"Timeout!",
- static_cast< OWeakObject * >( this ),
+ getXWeak(),
InteractionClassification_ERROR,
css::ucb::IOErrorCode_GENERAL,
excArgs);
@@ -484,7 +479,6 @@ namespace XSLT
// create pipe
css::uno::Reference<XOutputStream> pipeout =
Pipe::create(m_xContext);
- css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
//connect transformer to pipe
m_tcontrol->setOutputStream(pipeout);
@@ -493,7 +487,7 @@ namespace XSLT
InputSource aInput;
aInput.sSystemId = aURL;
aInput.sPublicId = aURL;
- aInput.aInputStream = pipein;
+ aInput.aInputStream.set(pipeout, UNO_QUERY);
// transform
m_tcontrol->start();
@@ -504,7 +498,7 @@ namespace XSLT
Sequence<Any> excArgs(0);
css::ucb::InteractiveAugmentedIOException exc(
"Timeout!",
- static_cast< OWeakObject * >( this ),
+ getXWeak(),
InteractionClassification_ERROR,
css::ucb::IOErrorCode_GENERAL,
excArgs);
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 862b4bf56b11..f09113793d07 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
<interface domain="flt">
<requires lib="gtk+" version="3.20"/>
<object class="GtkSizeGroup"/>
@@ -60,8 +60,8 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="range">
- <property name="label" translatable="yes" context="pdfgeneralpage|range">_Pages:</property>
+ <object class="GtkRadioButton" id="pagerange">
+ <property name="label" translatable="yes" context="pdfgeneralpage|pagerange">_Pages:</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
@@ -74,8 +74,8 @@
<relation type="label-for" target="pages"/>
</accessibility>
<child internal-child="accessible">
- <object class="AtkObject" id="range-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|range">Exports the pages you type in the box.</property>
+ <object class="AtkObject" id="pagerange-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|pagerange">Exports the pages you type in the box.</property>
</object>
</child>
</object>
@@ -85,6 +85,31 @@
</packing>
</child>
<child>
+ <object class="GtkRadioButton" id="sheetrange">
+ <property name="label" translatable="yes" context="pdfgeneralpage|sheetrange">_Sheets:</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ <property name="group">all</property>
+ <accessibility>
+ <relation type="label-for" target="sheets"/>
+ </accessibility>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="sheetrange-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|sheetrange">Exports the sheets you type in the box.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkRadioButton" id="selection">
<property name="label" translatable="yes" context="pdfgeneralpage|selection">_Selection</property>
<property name="visible">True</property>
@@ -114,7 +139,7 @@
<property name="width-chars">5</property>
<property name="truncate-multiline">True</property>
<accessibility>
- <relation type="labelled-by" target="range"/>
+ <relation type="labelled-by" target="pagerange"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="pages-atkobject">
@@ -128,11 +153,32 @@
</packing>
</child>
<child>
+ <object class="GtkEntry" id="sheets">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="activates-default">True</property>
+ <property name="width-chars">5</property>
+ <property name="truncate-multiline">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="sheetrange"/>
+ </accessibility>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="sheets-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|sheets">Exports the sheets you type in the box.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="slides">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">start</property>
- <property name="label" translatable="yes" context="pdfgeneralpage|slides">Slides:</property>
+ <property name="label" translatable="yes" context="pdfgeneralpage|slides">_Slides:</property>
</object>
<packing>
<property name="left-attach">0</property>
@@ -654,7 +700,7 @@
<property name="row-spacing">6</property>
<child>
<object class="GtkCheckButton" id="pdfa">
- <property name="label" translatable="yes" context="pdfgeneralpage|pdfa">Archive (P_DF/A, ISO 19005)</property>
+ <property name="label" translatable="yes" context="pdfgeneralpage|pdfa">Archival (P_DF/A, ISO 19005)</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
@@ -790,7 +836,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
- <!-- n-columns=1 n-rows=9 -->
+ <!-- n-columns=1 n-rows=10 -->
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -806,9 +852,10 @@
<property name="halign">start</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
+ <property name="tooltip-text" translatable="yes" context="pdfgeneralpage|bookmarks|tooltip_text">Export headings along with hyperlinked entries in Table of Contents as PDF bookmarks.</property>
<child internal-child="accessible">
<object class="AtkObject" id="bookmarks-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|bookmarks">Select to export bookmarks of Writer documents as PDF bookmarks. Bookmarks are created for all outline paragraphs (Tools - Chapter Numbering) and for all table of contents entries for which you did assign hyperlinks in the source document.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|bookmarks">PDF bookmarks are created for all paragraphs with outline level 1 or greater and for all “Table of Contents” entries with hyperlinks.</property>
</object>
</child>
</object>
@@ -868,13 +915,13 @@
<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>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">7</property>
+ <property name="top-attach">8</property>
</packing>
</child>
<child>
@@ -894,7 +941,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">8</property>
+ <property name="top-attach">9</property>
</packing>
</child>
<child>
@@ -914,7 +961,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">5</property>
+ <property name="top-attach">6</property>
</packing>
</child>
<child>
@@ -934,7 +981,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">3</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
@@ -955,7 +1002,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">4</property>
+ <property name="top-attach">5</property>
</packing>
</child>
<child>
@@ -975,7 +1022,27 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">6</property>
+ <property name="top-attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="commentsinmargin">
+ <property name="label" translatable="yes" context="pdfgeneralpage|commentsinmargin">_Comments in margin</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="commentsinmargin-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfgeneralpage|extended_tip|commentsinmargin">Select to export comments of Writer documents in the page margin.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
</object>
@@ -1019,7 +1086,8 @@
<object class="GtkSizeGroup" id="sizegroupLabel">
<widgets>
<widget name="all"/>
- <widget name="range"/>
+ <widget name="pagerange"/>
+ <widget name="sheetrange"/>
<widget name="selection"/>
<widget name="losslesscompress"/>
<widget name="box3"/>
@@ -1030,6 +1098,7 @@
<object class="GtkSizeGroup" id="sizegroupWidget">
<widgets>
<widget name="pages"/>
+ <widget name="sheets"/>
<widget name="qualityframe"/>
<widget name="resolution"/>
<widget name="watermarkentry"/>
diff --git a/filter/uiconfig/ui/pdflinkspage.ui b/filter/uiconfig/ui/pdflinkspage.ui
index 892f72864665..7e9ce16b77bf 100644
--- a/filter/uiconfig/ui/pdflinkspage.ui
+++ b/filter/uiconfig/ui/pdflinkspage.ui
@@ -26,15 +26,16 @@
<property name="row-spacing">6</property>
<child>
<object class="GtkCheckButton" id="export">
- <property name="label" translatable="yes" context="pdflinkspage|export">Export outlines as named destinations</property>
+ <property name="label" translatable="yes" context="pdflinkspage|export">Export bookmarks as named destinations</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
+ <property name="tooltip_text" translatable="yes" context="pdflinkspage|export|tooltip_text">Enable the checkbox to export bookmarks in your document as named destinations in the PDF document.</property>
<child internal-child="accessible">
<object class="AtkObject" id="export-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdflinkspage|extended_tip|export">Enable the checkbox to export the names of objects in your document as valid bookmark targets. This allows you to link to those objects by name from other documents.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdflinkspage|extended_tip|export">Enable the checkbox to export bookmarks in your document as named destinations in the PDF document. The destinations correspond to the location of your bookmarks. Use these destinations to create URL links that point to these locations in the PDF document.</property>
</object>
</child>
</object>
diff --git a/filter/uiconfig/ui/pdfviewpage.ui b/filter/uiconfig/ui/pdfviewpage.ui
index 33ee039b5441..2e70dbd2ceca 100644
--- a/filter/uiconfig/ui/pdfviewpage.ui
+++ b/filter/uiconfig/ui/pdfviewpage.ui
@@ -1,57 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
<interface domain="flt">
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">2147483647</property>
<property name="value">1</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
+ <property name="step-increment">1</property>
+ <property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="lower">50</property>
<property name="upper">1600</property>
<property name="value">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
+ <property name="step-increment">1</property>
+ <property name="page-increment">10</property>
</object>
<object class="GtkBox" id="PdfViewPage">
<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="border_width">6</property>
+ <property name="border-width">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="can-focus">False</property>
+ <property name="label-xalign">0</property>
+ <property name="shadow-type">none</property>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=1 n-rows=4 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
+ <property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
+ <property name="row-spacing">6</property>
<child>
<object class="GtkRadioButton" id="pageonly">
<property name="label" translatable="yes" context="pdfviewpage|pageonly">_Page only</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
<property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="pageonly-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|pageonly">Select to generate a PDF file that shows only the page contents.</property>
@@ -59,18 +59,18 @@
</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>
<child>
<object class="GtkRadioButton" id="outline">
<property name="label" translatable="yes" context="pdfviewpage|outline">Outl_ine and page</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">pageonly</property>
<child internal-child="accessible">
<object class="AtkObject" id="outline-atkobject">
@@ -79,18 +79,18 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="thumbs">
<property name="label" translatable="yes" context="pdfviewpage|thumbs">_Thumbnails and page</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">pageonly</property>
<child internal-child="accessible">
<object class="AtkObject" id="thumbs-atkobject">
@@ -99,37 +99,37 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="column_spacing">12</property>
+ <property name="can-focus">False</property>
+ <property name="column-spacing">12</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="pdfviewpage|label4">Open on pa_ge:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">page</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">page</property>
<property name="xalign">0</property>
</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>
<child>
<object class="GtkSpinButton" id="page">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="can-focus">True</property>
+ <property name="activates-default">True</property>
<property name="truncate-multiline">True</property>
+ <property name="adjustment">adjustment1</property>
<child internal-child="accessible">
<object class="AtkObject" id="page-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|page">Select to show the given page when the reader opens the PDF file.</property>
@@ -137,14 +137,14 @@
</child>
</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>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
</object>
@@ -152,7 +152,7 @@
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="pdfviewpage|label2">Panes</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -169,26 +169,26 @@
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="can-focus">False</property>
+ <property name="label-xalign">0</property>
+ <property name="shadow-type">none</property>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=1 n-rows=5 -->
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
+ <property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
+ <property name="row-spacing">6</property>
<child>
<object class="GtkRadioButton" id="fitdefault">
<property name="label" translatable="yes" context="pdfviewpage|fitdefault">_Default</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
<property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="fitdefault-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|fitdefault">Select to generate a PDF file that shows the page contents without zooming. If the reader software is configured to use a zoom factor by default, the page shows with that zoom factor.</property>
@@ -196,18 +196,18 @@
</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>
<child>
<object class="GtkRadioButton" id="fitwin">
<property name="label" translatable="yes" context="pdfviewpage|fitwin">_Fit in window</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">fitdefault</property>
<child internal-child="accessible">
<object class="AtkObject" id="fitwin-atkobject">
@@ -216,18 +216,18 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="fitwidth">
<property name="label" translatable="yes" context="pdfviewpage|fitwidth">Fit _width</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">fitdefault</property>
<child internal-child="accessible">
<object class="AtkObject" id="fitwidth-atkobject">
@@ -236,44 +236,44 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="fitvis">
<property name="label" translatable="yes" context="pdfviewpage|fitvis">Fit _visible</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">fitdefault</property>
<child internal-child="accessible">
<object class="AtkObject" id="fitvis-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|fitvis">Select to generate a PDF file that shows the text and graphics on the page zoomed to fit the width of the reader's window.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|fitvis">Select to generate a PDF file that shows the text and graphics on the page zoomed to fit the reader's window.</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=2 n-rows=1 -->
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="column_spacing">12</property>
+ <property name="can-focus">False</property>
+ <property name="column-spacing">12</property>
<child>
<object class="GtkRadioButton" id="fitzoom">
<property name="label" translatable="yes" context="pdfviewpage|fitzoom">_Zoom factor:</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">fitdefault</property>
<accessibility>
<relation type="label-for" target="zoom"/>
@@ -285,20 +285,20 @@
</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>
<child>
<object class="GtkSpinButton" id="zoom">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="activates-default">True</property>
+ <property name="truncate-multiline">True</property>
<property name="adjustment">adjustment2</property>
<accessibility>
<relation type="labelled-by" target="fitzoom"/>
</accessibility>
- <property name="truncate-multiline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="zoom-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|zoom">Select a given zoom factor when the reader opens the PDF file.</property>
@@ -306,14 +306,14 @@
</child>
</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>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
</packing>
</child>
</object>
@@ -321,7 +321,7 @@
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="pdfviewpage|label3">Magnification</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -345,26 +345,26 @@
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="can-focus">False</property>
+ <property name="label-xalign">0</property>
+ <property name="shadow-type">none</property>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=1 n-rows=5 -->
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
+ <property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
+ <property name="row-spacing">6</property>
<child>
<object class="GtkRadioButton" id="defaultlayout">
<property name="label" translatable="yes" context="pdfviewpage|defaultlayout">D_efault</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
<property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="defaultlayout-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|defaultlayout">Select to generate a PDF file that shows the pages according to the layout setting of the reader software.</property>
@@ -372,18 +372,18 @@
</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>
<child>
<object class="GtkRadioButton" id="singlelayout">
<property name="label" translatable="yes" context="pdfviewpage|singlelayout">_Single page</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">defaultlayout</property>
<child internal-child="accessible">
<object class="AtkObject" id="singlelayout-atkobject">
@@ -392,18 +392,18 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="contlayout">
<property name="label" translatable="yes" context="pdfviewpage|contlayout">C_ontinuous</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">defaultlayout</property>
<child internal-child="accessible">
<object class="AtkObject" id="contlayout-atkobject">
@@ -412,18 +412,18 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="contfacinglayout">
<property name="label" translatable="yes" context="pdfviewpage|contfacinglayout">Co_ntinuous facing</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<property name="group">defaultlayout</property>
<child internal-child="accessible">
<object class="AtkObject" id="contfacinglayout-atkobject">
@@ -432,28 +432,28 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="firstonleft">
<property name="label" translatable="yes" context="pdfviewpage|firstonleft">First page is _left</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="margin_top">6</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="margin-top">6</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="firstonleft-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|firstonleft">Select to generate a PDF file that shows pages side by side in a continuous column. For more than two pages, the first page is displayed on the left. You must enable support for complex text layout on Language settings - Languages in the Options dialog box.</property>
+ <property name="AtkObject::accessible-description" translatable="yes" context="pdfviewpage|extended_tip|firstonleft">Select to generate a PDF file that shows pages side by side in a continuous column. For more than two pages, the first page is displayed on the left. You must enable support for complex text layout on Languages and Locales - General in the Options dialog box.</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
</packing>
</child>
</object>
@@ -461,7 +461,7 @@
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="pdfviewpage|label1">Page Layout</property>
<attributes>
<attribute name="weight" value="bold"/>
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..9a3e9ff5deb8 100644
--- a/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui
+++ b/filter/uiconfig/ui/xmlfiltertabpagegeneral.ui
@@ -1,99 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.36.0 -->
+<!-- Generated with glade 3.38.2 -->
<interface domain="flt">
<requires lib="gtk+" version="3.20"/>
<object class="GtkBox" id="XmlFilterTabPageGeneral">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
<property name="spacing">12</property>
<child>
- <!-- n-columns=1 n-rows=1 -->
+ <!-- n-columns=2 n-rows=5 -->
<object class="GtkGrid" id="grid1">
<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="row_spacing">6</property>
- <property name="column_spacing">12</property>
+ <property name="row-spacing">6</property>
+ <property name="column-spacing">12</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label2">_Filter name:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">filtername</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">filtername</property>
<property name="xalign">1</property>
</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>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label3">_Application:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">application</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">application</property>
<property name="xalign">1</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label4">_Name of file type:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">interfacename</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">interfacename</property>
<property name="xalign">1</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label5">File _extension:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">extension</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">extension</property>
<property name="xalign">1</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" context="xmlfiltertabpagegeneral|label6">Comment_s:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">description</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">description</property>
<property name="xalign">1</property>
<property name="yalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="filtername">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="halign">start</property>
- <property name="activates_default">True</property>
- <property name="width_chars">38</property>
+ <property name="activates-default">True</property>
+ <property name="width-chars">38</property>
<property name="truncate-multiline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="filtername-atkobject">
@@ -102,36 +102,36 @@
</child>
</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="GtkEntry" id="extension">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="halign">start</property>
- <property name="activates_default">True</property>
- <property name="width_chars">6</property>
+ <property name="activates-default">True</property>
+ <property name="width-chars">6</property>
<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 is used to determine which filter to use.</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="interfacename">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="halign">start</property>
- <property name="activates_default">True</property>
- <property name="width_chars">38</property>
+ <property name="activates-default">True</property>
+ <property name="width-chars">38</property>
<property name="truncate-multiline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="interfacename-atkobject">
@@ -140,21 +140,21 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="application">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="halign">start</property>
- <property name="has_entry">True</property>
+ <property name="has-entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
+ <property name="activates-default">True</property>
<property name="truncate-multiline">True</property>
- <property name="activates_default">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -164,21 +164,21 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<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="GtkTextView" id="description">
<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>
<child internal-child="accessible">
@@ -190,8 +190,8 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
</packing>
</child>
</object>