sw/qa/extras/fodfexport/data/SvgImageTest.fodt |  321 +++++++++++++++++++++++++
 sw/qa/extras/fodfexport/fodfexport.cxx         |   25 +
 xmloff/inc/xmlmultiimagehelper.hxx             |    1 
 xmloff/source/core/xmlmultiimagehelper.cxx     |   28 +-
 xmloff/source/draw/ximpshap.cxx                |   24 +
 xmloff/source/draw/ximpshap.hxx                |    3 
 xmloff/source/text/XMLTextFrameContext.cxx     |   12 
 xmloff/source/text/XMLTextFrameContext.hxx     |    1 
 8 files changed, 400 insertions(+), 15 deletions(-)

New commits:
commit f5cf0c10eb7050feff19190b06b4597aab2d400a
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Dec 2 16:57:30 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sat Dec 2 11:10:34 2023 +0100

    tdf#123396 actually use the mimetype set in the from document
    
    In the document we set the mime type for the images stored, but
    at import we never actually used the mime types. We always did
    mime type detection from the filename extension. The problem with
    this is that files stored as base64 streams don't have a filename
    so it is also not possible to determine the mime type from the
    file name.
    
    The consequence of this is that we can't know which image to take
    if we have multiple images (fallback images) so we always take the
    last one, which could be the wrong one. This happend in the test
    document.
    
    This changes the behavior so that we always first use the document
    set mime type as there is no reason to not trust that. Only if the
    mime type isn't provided by the document we use other mime type
    detection methods.
    
    Change-Id: I175c509ce5f11eab2c0454d4d9901ca1fe975272
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160237
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sw/qa/extras/fodfexport/data/SvgImageTest.fodt 
b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt
new file mode 100644
index 000000000000..4246a7cb5e5e
--- /dev/null
+++ b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2023-12-01T21:40:25.010896609</meta:creation-date><dc:date>2023-12-02T14:20:24.763250978</dc:date><meta:editing-duration>PT2M41S</meta:editing-duration><meta:editing-cycles>2</meta:editing-cycles><meta:generator>LibreOffice/7.6.3.1$Linux_X86_64
 LibreOffice_project/60$Build-1</meta:generator><meta:document-statistic 
meta:table-count="0" meta:image-count="1" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" 
meta:character-count="0" meta:non-whitespace-character-count="0"/></office:meta>
+ <office:settings>
+  <config:config-item-set config:name="ooo:view-settings">
+   <config:config-item config:name="ViewAreaTop" 
config:type="long">0</config:config-item>
+   <config:config-item config:name="ViewAreaLeft" 
config:type="long">0</config:config-item>
+   <config:config-item config:name="ViewAreaWidth" 
config:type="long">58104</config:config-item>
+   <config:config-item config:name="ViewAreaHeight" 
config:type="long">33657</config:config-item>
+   <config:config-item config:name="ShowRedlineChanges" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="InBrowseMode" 
config:type="boolean">false</config:config-item>
+   <config:config-item-map-indexed config:name="Views">
+    <config:config-item-map-entry>
+     <config:config-item config:name="ViewId" 
config:type="string">view2</config:config-item>
+     <config:config-item config:name="ViewLeft" 
config:type="long">20551</config:config-item>
+     <config:config-item config:name="ViewTop" 
config:type="long">17866</config:config-item>
+     <config:config-item config:name="VisibleLeft" 
config:type="long">0</config:config-item>
+     <config:config-item config:name="VisibleTop" 
config:type="long">0</config:config-item>
+     <config:config-item config:name="VisibleRight" 
config:type="long">58103</config:config-item>
+     <config:config-item config:name="VisibleBottom" 
config:type="long">33655</config:config-item>
+     <config:config-item config:name="ZoomType" 
config:type="short">0</config:config-item>
+     <config:config-item config:name="ViewLayoutColumns" 
config:type="short">1</config:config-item>
+     <config:config-item config:name="ViewLayoutBookMode" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="ZoomFactor" 
config:type="short">100</config:config-item>
+     <config:config-item config:name="IsSelectedFrame" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="KeepRatio" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="AnchoredTextOverflowLegacy" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="LegacySingleLineFontwork" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="ConnectorUseSnapRect" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IgnoreBreakAfterMultilineField" 
config:type="boolean">false</config:config-item>
+    </config:config-item-map-entry>
+   </config:config-item-map-indexed>
+  </config:config-item-set>
+  <config:config-item-set config:name="ooo:configuration-settings">
+   <config:config-item config:name="PrintRightPages" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrintProspectRTL" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintLeftPages" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrintPaperFromSetup" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintControls" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrintProspect" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintBlackFonts" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintAnnotationMode" 
config:type="short">0</config:config-item>
+   <config:config-item config:name="PrintEmptyPages" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrintSingleJobs" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="AutoFirstLineIndentDisregardLineSpace" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="HeaderSpacingBelowLastPara" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ProtectBookmarks" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ContinuousEndnotes" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="DisableOffPagePositioning" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintTables" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="SubtractFlysAnchoredAtFlys" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ApplyParagraphMarkFormatToNumbering" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintFaxName" config:type="string"/>
+   <config:config-item config:name="SurroundTextWrapSmall" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="TreatSingleColumnBreakAsPageBreak" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PropLineSpacingShrinksFirstLine" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="TabOverSpacing" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="TabOverMargin" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="EmbedComplexScriptFonts" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="EmbedLatinScriptFonts" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="EmbedOnlyUsedFonts" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="EmbedFonts" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ClippedPictures" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="FrameAutowidthWithMorePara" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="FloattableNomargins" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="UnbreakableNumberings" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="AllowPrintJobCancel" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="UseFormerObjectPositioning" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="UseOldNumbering" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="RsidRoot" 
config:type="int">925541</config:config-item>
+   <config:config-item config:name="PrinterPaperFromSetup" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="CurrentDatabaseDataSource" 
config:type="string"/>
+   <config:config-item config:name="UpdateFromTemplate" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="AddFrameOffsets" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="LoadReadonly" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="Rsid" 
config:type="int">982611</config:config-item>
+   <config:config-item config:name="FootnoteInColumnToPageEnd" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="ProtectFields" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="SaveGlobalDocumentLinks" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="LinkUpdateMode" 
config:type="short">1</config:config-item>
+   <config:config-item config:name="AddExternalLeading" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrintGraphics" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="EmbedSystemFonts" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsLabelDocument" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="AddParaLineSpacingToTableCells" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="UseFormerTextWrapping" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="HyphenateURLs" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="AddParaTableSpacingAtStart" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="TabsRelativeToIndent" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="FieldAutoUpdate" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="SaveVersionOnClose" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ChartAutoUpdate" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="ImagePreferredDPI" 
config:type="int">0</config:config-item>
+   <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+   <config:config-item config:name="SmallCapsPercentage66" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="AlignTabStopPosition" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="DropCapPunctuation" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="MathBaselineAlignment" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="PrinterName" config:type="string"/>
+   <config:config-item config:name="CharacterCompressionType" 
config:type="short">0</config:config-item>
+   <config:config-item config:name="AddParaTableSpacing" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="DoNotJustifyLinesWithManualBreak" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintHiddenText" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IsKernAsianPunctuation" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrinterIndependentLayout" 
config:type="string">high-resolution</config:config-item>
+   <config:config-item config:name="TabOverflow" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="AddParaSpacingToTableCells" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="AddVerticalFrameOffsets" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="TabAtLeftIndentForParagraphsInList" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="ApplyUserData" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="MsWordCompMinLineHeightByFly" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintTextPlaceholder" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IgnoreFirstLineIndentInNumbering" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="UseFormerLineSpacing" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintPageBackground" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="RedlineProtectionKey" 
config:type="base64Binary"/>
+   <config:config-item config:name="EmbedAsianScriptFonts" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="BackgroundParaOverDrawings" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="SaveThumbnail" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="ConsiderTextWrapOnObjPos" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="EmbeddedDatabaseName" 
config:type="string"/>
+   <config:config-item config:name="ProtectForm" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="DoNotResetParaAttrsForNumFont" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="MsWordCompTrailingBlanks" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="EmptyDbFieldHidesPara" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="TableRowKeep" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="NoNumberingShowFollowBy" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="InvertBorderSpacing" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="DoNotCaptureDrawObjsOnPage" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="GutterAtTop" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="StylesNoDefault" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="UnxForceZeroExtLeading" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="PrintReversed" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="UseOldPrinterMetrics" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="CurrentDatabaseCommandType" 
config:type="int">0</config:config-item>
+   <config:config-item config:name="PrintDrawings" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="OutlineLevelYieldsNumbering" 
config:type="boolean">false</config:config-item>
+   <config:config-item config:name="CurrentDatabaseCommand" 
config:type="string"/>
+   <config:config-item config:name="CollapseEmptyCellPara" 
config:type="boolean">true</config:config-item>
+  </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+  <office:script script:language="ooo:Basic">
+   <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+  <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu 
Sans&apos;" style:font-family-generic="swiss"/>
+  <style:font-face style:name="DejaVu Serif" svg:font-family="&apos;DejaVu 
Serif&apos;" style:font-family-generic="roman"/>
+  <style:font-face style:name="Noto Sans CJK SC" svg:font-family="&apos;Noto 
Sans CJK SC&apos;" style:font-family-generic="system" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans Devanagari" 
svg:font-family="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic="swiss"/>
+  <style:font-face style:name="Noto Sans Devanagari1" 
svg:font-family="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="&apos;Noto 
Serif CJK SC&apos;" style:font-family-generic="system" 
style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" 
style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0cm" 
style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="DejaVu Serif" fo:font-size="12pt" 
fo:language="sl" fo:country="SI" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans Devanagari1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="DejaVu Serif" fo:font-size="12pt" 
fo:language="sl" fo:country="SI" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans Devanagari1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Heading" style:family="paragraph" 
style:parent-style-name="Standard" style:next-style-name="Text_20_body" 
style:class="text">
+   <style:paragraph-properties fo:margin-top="0.423cm" 
fo:margin-bottom="0.212cm" style:contextual-spacing="false" 
fo:keep-with-next="always"/>
+   <style:text-properties style:font-name="DejaVu Sans" 
fo:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="swiss" 
fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" 
style:font-family-asian="&apos;Noto Sans CJK SC&apos;" 
style:font-family-generic-asian="system" style:font-pitch-asian="variable" 
style:font-size-asian="14pt" style:font-name-complex="Noto Sans Devanagari1" 
style:font-family-complex="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic-complex="system" style:font-pitch-complex="variable" 
style:font-size-complex="14pt"/>
+  </style:style>
+  <style:style style:name="Text_20_body" style:display-name="Text body" 
style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" 
style:contextual-spacing="false" fo:line-height="115%"/>
+  </style:style>
+  <style:style style:name="List" style:family="paragraph" 
style:parent-style-name="Text_20_body" style:class="list">
+   <style:text-properties style:font-name="DejaVu Serif" 
fo:font-family="&apos;DejaVu Serif&apos;" style:font-family-generic="roman" 
style:font-size-asian="12pt" style:font-name-complex="Noto Sans Devanagari" 
style:font-family-complex="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic-complex="swiss"/>
+  </style:style>
+  <style:style style:name="Caption" style:family="paragraph" 
style:parent-style-name="Standard" style:class="extra">
+   <style:paragraph-properties fo:margin-top="0.212cm" 
fo:margin-bottom="0.212cm" style:contextual-spacing="false" 
text:number-lines="false" text:line-number="0"/>
+   <style:text-properties style:font-name="DejaVu Serif" 
fo:font-family="&apos;DejaVu Serif&apos;" style:font-family-generic="roman" 
fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" 
style:font-style-asian="italic" style:font-name-complex="Noto Sans Devanagari" 
style:font-family-complex="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic-complex="swiss" style:font-size-complex="12pt" 
style:font-style-complex="italic"/>
+  </style:style>
+  <style:style style:name="Index" style:family="paragraph" 
style:parent-style-name="Standard" style:class="index">
+   <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+   <style:text-properties style:font-name="DejaVu Serif" 
fo:font-family="&apos;DejaVu Serif&apos;" style:font-family-generic="roman" 
style:font-size-asian="12pt" style:font-name-complex="Noto Sans Devanagari" 
style:font-family-complex="&apos;Noto Sans Devanagari&apos;" 
style:font-family-generic-complex="swiss"/>
+  </style:style>
+  <style:style style:name="Graphics" style:family="graphic">
+   <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" 
svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" 
style:wrap-contour="false" style:vertical-pos="top" 
style:vertical-rel="paragraph" style:horizontal-pos="center" 
style:horizontal-rel="paragraph" fo:background-color="transparent" 
draw:fill="none"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" loext:num-list-format="%1%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" loext:num-list-format="%2%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" loext:num-list-format="%3%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" loext:num-list-format="%4%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" loext:num-list-format="%5%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" loext:num-list-format="%6%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" loext:num-list-format="%7%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" loext:num-list-format="%8%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" loext:num-list-format="%9%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" loext:num-list-format="%10%" 
style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  <loext:theme loext:name="Office Theme">
+   <loext:theme-colors loext:name="LibreOffice">
+    <loext:color loext:name="dark1" loext:color="#000000"/>
+    <loext:color loext:name="light1" loext:color="#ffffff"/>
+    <loext:color loext:name="dark2" loext:color="#000000"/>
+    <loext:color loext:name="light2" loext:color="#ffffff"/>
+    <loext:color loext:name="accent1" loext:color="#18a303"/>
+    <loext:color loext:name="accent2" loext:color="#0369a3"/>
+    <loext:color loext:name="accent3" loext:color="#a33e03"/>
+    <loext:color loext:name="accent4" loext:color="#8e03a3"/>
+    <loext:color loext:name="accent5" loext:color="#c99c00"/>
+    <loext:color loext:name="accent6" loext:color="#c9211e"/>
+    <loext:color loext:name="hyperlink" loext:color="#0000ee"/>
+    <loext:color loext:name="followed-hyperlink" loext:color="#551a8b"/>
+   </loext:theme-colors>
+  </loext:theme>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="fr1" style:family="graphic" 
style:parent-style-name="Graphics">
+   <style:graphic-properties style:vertical-pos="top" 
style:vertical-rel="paragraph" style:horizontal-pos="center" 
style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm, 0cm, 
0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" 
draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" 
draw:image-opacity="100%" draw:color-mode="standard"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:style style:name="dp1" style:family="drawing-page">
+   <style:drawing-page-properties draw:background-size="full"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1" 
draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="Standard"><draw:frame draw:style-name="fr1" 
draw:name="Image1" text:anchor-type="char" svg:width="15.365cm" 
svg:height="15.365cm" draw:z-index="0"><draw:image 
draw:mime-type="image/svg+xml">
+      
<office:binary-data>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLSBDcmVhdGVkIHdp
+       dGggSW5rc2NhcGUgKGh0dHA6Ly93d3cuaW5rc2NhcGUub3JnLykgLS0+Cjxzdmcgd2lkdGg9
+       IjEwbW0iIGhlaWdodD0iMTBtbSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTAgMTAi
+       IHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8cmVjdCB4PSIxIiB5PSIx
+       IiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiByeD0iMiIgcnk9IjIiIGZpbGw9IiMwZmM5NTQiIHN0
+       cm9rZS13aWR0aD0iMi4xMTY3Ii8+Cjwvc3ZnPgo=
+      </office:binary-data>
+     </draw:image>
+     <draw:image draw:mime-type="image/png">
+      
<office:binary-data>iVBORw0KGgoAAAANSUhEUgAAACcAAAAnCAYAAACMo1E1AAABqklEQVRYhe2Yu0oDQRiFzxkV
+       xCLpUihaii9gtIyXeKmDzyBIfBltxEcIWtoYCWurWKutly5CVlALszkWEsGZzaqru4mwX3lm
+       lv9j57Y7lIRBxfRbIIpMLi7DX3XgxeZILmguQiyTHP/OMxG0BdxDqj++NBsqee3I2lELIn9W
+       WaW4A3L6F0LhSNeS2fbna/Ufy+XPN7Yo7QAc+nOxDxQIqPrFg71vy+XPKqsEj5IV66IA1Fpr
+       9vDEbnEWBL3SMMWE39inikPomF16JWcuO3K5scJyInMsCmImN1pYsOOQrURLafg4mE7ZieyA
+       0mQ6NnZdTNmZIydwLB2dr+sO9AmRycUlk4tLJheXTC4umVxcMrm4/C85Qs/9ECH1ZGfu9xx5
+       m46OVRe4sTN3WKWe/5FJQuDYzhy5x5dmA9J1OkpddOk/N0/t1B3WkteWzDagICWxADLVsKuJ
+       0NXqz9fqAqrJCyqAzFZrrtYIa+25lfjFgz11zDqEq4TELiGz0pqr7ffqEXmRA7zfAORGCwsw
+       nTKFCZAj8X30KuKOVN1/evB+dcvUb/7XCTFIDLTcG/DxnDT71BIPAAAAAElFTkSuQmCC
+      </office:binary-data>
+     </draw:image>
+    </draw:frame></text:p>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx 
b/sw/qa/extras/fodfexport/fodfexport.cxx
index 30bcc1fcf54a..2cf5bf42a7c9 100644
--- a/sw/qa/extras/fodfexport/fodfexport.cxx
+++ b/sw/qa/extras/fodfexport/fodfexport.cxx
@@ -9,6 +9,7 @@
 
 #include <swmodeltestbase.hxx>
 #include <o3tl/string_view.hxx>
+#include <vcl/graph.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -49,6 +50,30 @@ DECLARE_FODFEXPORT_TEST(testTdf113696WriterImage, 
"tdf113696-writerimage.odt")
     }
 }
 
+DECLARE_FODFEXPORT_TEST(testSvgImageRoundtrip, "SvgImageTest.fodt")
+{
+    // Related to tdf#123396
+
+    // We should have one image (shape)
+    CPPUNIT_ASSERT_EQUAL(1, getShapes());
+
+    // Get the shape and extract the Graphic
+    uno::Reference<drawing::XShape> xShape = getShape(1);
+    uno::Reference<beans::XPropertySet> XPropertySet(xShape, 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(XPropertySet.is());
+    uno::Reference<graphic::XGraphic> xGraphic;
+    XPropertySet->getPropertyValue("Graphic") >>= xGraphic;
+    CPPUNIT_ASSERT(xGraphic.is());
+    Graphic aGraphic(xGraphic);
+
+    // The graphic should be SVG - so should contain a VectorGraphicData
+    auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+    CPPUNIT_ASSERT(pVectorGraphicData);
+
+    // The VectorGraphicData type should be SVG
+    CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Svg, 
pVectorGraphicData->getType());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmlmultiimagehelper.hxx 
b/xmloff/inc/xmlmultiimagehelper.hxx
index adfdce2e9285..b55e59324ed4 100644
--- a/xmloff/inc/xmlmultiimagehelper.hxx
+++ b/xmloff/inc/xmlmultiimagehelper.hxx
@@ -32,6 +32,7 @@ protected:
     /// helper to get the created xShape instance, override this
     virtual void removeGraphicFromImportContext(const SvXMLImportContext& 
rContext) = 0;
     virtual OUString getGraphicPackageURLFromImportContext(const 
SvXMLImportContext& rContext) const = 0;
+    virtual OUString getMimeTypeFromImportContext(const SvXMLImportContext& 
rContext) const = 0;
     virtual css::uno::Reference<css::graphic::XGraphic> 
getGraphicFromImportContext(const SvXMLImportContext& rContext) const = 0;
 
 public:
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx 
b/xmloff/source/core/xmlmultiimagehelper.cxx
index 000c6151ee81..99e4b1f6080d 100644
--- a/xmloff/source/core/xmlmultiimagehelper.cxx
+++ b/xmloff/source/core/xmlmultiimagehelper.cxx
@@ -114,19 +114,23 @@ SvXMLImportContextRef 
MultiImageImportHelper::solveMultipleImages()
         {
             const SvXMLImportContext& rContext = *maImplContextVector[a];
 
-
-            OUString sMimeType;
-
-            const OUString 
aStreamURL(getGraphicPackageURLFromImportContext(rContext));
-            if (!aStreamURL.isEmpty())
-            {
-                sMimeType = getMimeTypeForURL(aStreamURL);
-            }
-            else
+            // First try the mime type provided by the document
+            OUString sMimeType = getMimeTypeFromImportContext(rContext);
+            if (sMimeType.isEmpty())
             {
-                uno::Reference<graphic::XGraphic> 
xGraphic(getGraphicFromImportContext(rContext));
-                if (xGraphic.is())
-                    sMimeType = 
comphelper::GraphicMimeTypeHelper::GetMimeTypeForXGraphic(xGraphic);
+                // Try to determine the mime type from the extension
+                const OUString 
aStreamURL(getGraphicPackageURLFromImportContext(rContext));
+                if (!aStreamURL.isEmpty())
+                {
+                    sMimeType = getMimeTypeForURL(aStreamURL);
+                }
+                else
+                {
+                    // Try to determine the mime type from the graphic itself
+                    uno::Reference<graphic::XGraphic> 
xGraphic(getGraphicFromImportContext(rContext));
+                    if (xGraphic.is())
+                        sMimeType = 
comphelper::GraphicMimeTypeHelper::GetMimeTypeForXGraphic(xGraphic);
+                }
             }
 
             sal_uInt32 nNewQuality = getQualityIndex(sMimeType);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 3961c8d546f8..aaee9668fa37 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2368,10 +2368,18 @@ 
SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext(
 // this is called from the parent group for each unparsed attribute in the 
attribute list
 bool SdXMLGraphicObjectShapeContext::processAttribute( const 
sax_fastparser::FastAttributeList::FastAttributeIter & aIter )
 {
-    if( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
+    switch (aIter.getToken())
+    {
+    case XML_ELEMENT(XLINK, XML_HREF):
         maURL = aIter.toString();
-    else
-        return SdXMLShapeContext::processAttribute( aIter );
+        break;
+    case XML_ELEMENT(DRAW, XML_MIME_TYPE):
+    case XML_ELEMENT(LO_EXT, XML_MIME_TYPE):
+        msMimeType = aIter.toString();
+        break;
+    default:
+        return SdXMLShapeContext::processAttribute(aIter);
+    }
     return true;
 }
 
@@ -3370,6 +3378,16 @@ uno::Reference<graphic::XGraphic> 
SdXMLFrameShapeContext::getGraphicFromImportCo
     return xGraphic;
 }
 
+OUString SdXMLFrameShapeContext::getMimeTypeFromImportContext(const 
SvXMLImportContext& rContext) const
+{
+    OUString aMimeType;
+    const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = 
dynamic_cast<const SdXMLGraphicObjectShapeContext*>(&rContext);
+
+    if (pSdXMLGraphicObjectShapeContext)
+        aMimeType = pSdXMLGraphicObjectShapeContext->getMimeType();
+    return aMimeType;
+}
+
 OUString SdXMLFrameShapeContext::getGraphicPackageURLFromImportContext(const 
SvXMLImportContext& rContext) const
 {
     OUString aRetval;
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index 3450a16e5780..9a61f4b594de 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -390,9 +390,11 @@ class SdXMLGraphicObjectShapeContext : public 
SdXMLShapeContext
 {
 private:
     OUString maURL;
+    OUString msMimeType;
     css::uno::Reference < css::io::XOutputStream > mxBase64Stream;
 
 public:
+    OUString const& getMimeType() const { return msMimeType; }
 
     SdXMLGraphicObjectShapeContext( SvXMLImport& rImport,
         const css::uno::Reference< css::xml::sax::XFastAttributeList>& 
xAttrList,
@@ -564,6 +566,7 @@ protected:
     /// helper to get the created xShape instance, needs to be overridden
     void removeGraphicFromImportContext(const SvXMLImportContext& rContext) 
override;
     OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext& 
rContext) const override;
+    OUString getMimeTypeFromImportContext(const SvXMLImportContext& rContext) 
const override;
     css::uno::Reference<css::graphic::XGraphic> 
getGraphicFromImportContext(const SvXMLImportContext& rContext) const override;
 
 public:
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index eb49a0d77678..723a168a52b9 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -411,6 +411,7 @@ public:
     const OUString& GetOrigName() const { return m_sOrigName; }
 
     css::text::TextContentAnchorType GetAnchorType() const { return 
eAnchorType; }
+    OUString GetMimeType() const { return sMimeType; }
 
     const css::uno::Reference < css::beans::XPropertySet >& GetPropSet() const 
{ return xPropSet; }
 };
@@ -768,6 +769,16 @@ void 
XMLTextFrameContext::removeGraphicFromImportContext(const SvXMLImportContex
     }
 }
 
+OUString XMLTextFrameContext::getMimeTypeFromImportContext(const 
SvXMLImportContext& rContext) const
+{
+    const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = 
dynamic_cast<const XMLTextFrameContext_Impl*>(&rContext);
+
+    if (pXMLTextFrameContext_Impl)
+        return pXMLTextFrameContext_Impl->GetMimeType();
+
+    return OUString();
+}
+
 OUString XMLTextFrameContext::getGraphicPackageURLFromImportContext(const 
SvXMLImportContext& rContext) const
 {
     const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< 
const XMLTextFrameContext_Impl* >(&rContext);
@@ -1071,6 +1082,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
         case XML_ELEMENT(DRAW, XML_MIME_TYPE):
         case XML_ELEMENT(LO_EXT, XML_MIME_TYPE):
             sMimeType = aIter.toString();
+            printf ("MIME %s\n", sMimeType.toUtf8().getStr());
             break;
         case XML_ELEMENT(DRAW, XML_NOTIFY_ON_UPDATE_OF_RANGES):
         case XML_ELEMENT(DRAW, XML_NOTIFY_ON_UPDATE_OF_TABLE):
diff --git a/xmloff/source/text/XMLTextFrameContext.hxx 
b/xmloff/source/text/XMLTextFrameContext.hxx
index 27c9b4c2b81f..4f7e01118b2c 100644
--- a/xmloff/source/text/XMLTextFrameContext.hxx
+++ b/xmloff/source/text/XMLTextFrameContext.hxx
@@ -60,6 +60,7 @@ protected:
     /// helper to get the created xShape instance, needs to be overridden
     void removeGraphicFromImportContext(const SvXMLImportContext& rContext) 
override;
     OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext& 
rContext) const override;
+    OUString getMimeTypeFromImportContext(const SvXMLImportContext& rContext) 
const override;
     css::uno::Reference<css::graphic::XGraphic> 
getGraphicFromImportContext(const SvXMLImportContext& rContext) const override;
 
 public:

Reply via email to