summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorDaniel Arato (NISZ) <arato.daniel@nisz.hu>2020-08-31 12:48:07 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-03 18:34:55 +0200
commit07dcb0dab759d4ab535d99c0e6d326959906b87e (patch)
tree3149eb49ab6cfbd2bd30dbf2ae446ba32ebdcaf2 /sw/source/filter/ww8/docxattributeoutput.cxx
parent3e2a3c8e3f3930a4f84274d36023bdb506a714c3 (diff)
tdf#131537 DOCX export: fix OLE "Display as icon"
for example to avoid converting OLE icons of an ODF document to an icon-size embedded spreadsheet. When creating a new OLE object in Writer the user has an option called "Display as icon" which causes the actual contents of the OLE to be hidden when rendered in the document. This setting, referred to internally as the DrawAspect of the object, was imported fine, but when exported to a .docx it always had the value "Content" (corresponding to "Display as icon" being unchecked). Now OLE objects with "Display as icon" checked are saved with DrawAspect="Icon". A grab bag entry was previously used to let the DrawAspect setting flow through Writer from OOXML import to export. Now this workaround is no longer needed and is removed by the present commit. Change-Id: I46ea4fc95a26bcd1f85e19a506c0965f73d4257a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101711 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1dabca1b51f9..947a7f355050 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -142,6 +142,7 @@
#include <com/sun/star/drawing/ShadingPattern.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
#include <algorithm>
#include <stdarg.h>
@@ -5541,7 +5542,16 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S
OUString sObjectName = aContainer->GetEmbeddedObjectName( xObj );
// set some attributes according to the type of the embedded object
- OUString sProgID, sDrawAspect = "Content";
+ OUString sProgID, sDrawAspect;
+ switch (rNode.GetAspect())
+ {
+ case embed::Aspects::MSOLE_CONTENT: sDrawAspect = "Content"; break;
+ case embed::Aspects::MSOLE_DOCPRINT: sDrawAspect = "DocPrint"; break;
+ case embed::Aspects::MSOLE_ICON: sDrawAspect = "Icon"; break;
+ case embed::Aspects::MSOLE_THUMBNAIL: sDrawAspect = "Thumbnail"; break;
+ default:
+ SAL_WARN("sw.ww8", "DocxAttributeOutput::WriteOLE: invalid aspect value");
+ }
auto pObjectsInterop = std::find_if(aObjectsInteropList.begin(), aObjectsInteropList.end(),
[&sObjectName](const beans::PropertyValue& rProp) { return rProp.Name == sObjectName; });
if (pObjectsInterop != aObjectsInteropList.end())
@@ -5553,10 +5563,6 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S
{
rObjectInteropAttribute.Value >>= sProgID;
}
- else if ( rObjectInteropAttribute.Name == "DrawAspect" )
- {
- rObjectInteropAttribute.Value >>= sDrawAspect;
- }
}
// write embedded file