summaryrefslogtreecommitdiff
path: root/oox/inc
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-02-14 01:36:50 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-02-22 07:12:19 +0000
commitb94336ac3d29180504e4bd7ada4d29ed5b6d3fda (patch)
treeccd07586b0d6cb4c6697fdced79efc063518ef42 /oox/inc
parent63784053ccd321c8f3fc7fe60f4e50fda597f553 (diff)
tdf#51195 Improve DML export of Fontwork shapes for docx
Fontwork in Writer has fill and outline as shape properties. The 'abc transform' in Word uses character properties. Output of character properties happens in DocxAttributeOutput methods in LO. The patch modifies the character properties of the Fontwork shape, in particular the contents of the CharInteropGrabBag, so that DocxAttributeOutput produces a reasonably suitable markup. Change-Id: Ic9285d9a4d6dc21cd256e448ace058f1026a2780 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146964 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/inc')
-rw-r--r--oox/inc/drawingml/fontworkhelpers.hxx52
1 files changed, 52 insertions, 0 deletions
diff --git a/oox/inc/drawingml/fontworkhelpers.hxx b/oox/inc/drawingml/fontworkhelpers.hxx
index f1861f266bde..7d8d0a9692dd 100644
--- a/oox/inc/drawingml/fontworkhelpers.hxx
+++ b/oox/inc/drawingml/fontworkhelpers.hxx
@@ -19,6 +19,7 @@
#pragma once
+#include <docmodel/theme/ThemeColor.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <svx/msdffdef.hxx>
@@ -26,7 +27,11 @@
#include "customshapeproperties.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/text/XText.hpp>
namespace FontworkHelpers
{
@@ -46,5 +51,52 @@ void putCustomShapeIntoTextPathMode(
If eShapeType is not a Fontwork shape type or the special type is not yet implemented,
it returns an empty string.*/
OString GetVMLFontworkShapetypeMarkup(const MSO_SPT eShapeType);
+
+/** Collects the properties "CharColor", "CharLumMod", "CharLumOff", "CharColorTheme",
+ "CharColorThemeReference" and "CharTransparence" from the first non-empty run in rXText and puts
+ them into rCharPropVec.*/
+void collectCharColorProps(const css::uno::Reference<css::text::XText>& rXText,
+ std::vector<css::beans::PropertyValue>& rCharPropVec);
+
+/** Applies all properties in rTextPropVec excluding "CharInteropGrabBag" to all non-empty runs in
+ rXText.*/
+void applyPropsToRuns(const std::vector<css::beans::PropertyValue>& rTextPropVec,
+ css::uno::Reference<css::text::XText>& rXText);
+
+/** Generates the properties "CharColor", "CharLumMod", "CharLumOff", "CharColorTheme",
+ "CharColorThemeReference" and "CharTransparence" from the shape properties "FillColor",
+ "FillColorLumMod, "FillColorLumOff", "FillColorTheme", "FillColorThemeReference" and
+ "FillTransparence" and puts them into rCharPropVec.*/
+void createCharFillPropsFromShape(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
+ std::vector<css::beans::PropertyValue>& rCharPropVec);
+
+/** Creates the properties "CharTextFillTextEffect", "CharTextOutlineTextEffect", "CharThemeColor",
+ "CharThemeColorShade" or "CharThemeColorTint", and "CharThemeOriginalColor" from the FillFoo and
+ LineBar properties of the shape and puts them into rUpdatePropVec.*/
+void createCharInteropGrabBagUpdatesFromShapeProps(
+ const css::uno::Reference<css::beans::XPropertySet>& rXPropSet,
+ std::vector<css::beans::PropertyValue>& rUpdatePropVec);
+
+/** Puts all properties in rUpdatePropVec into the "CharInteropGrabBag" of all non-empty runs in rXText.
+ Existing properties are overwritten.*/
+void applyUpdatesToCharInteropGrabBag(const std::vector<css::beans::PropertyValue>& rUpdatePropVec,
+ css::uno::Reference<css::text::XText>& rXText);
+
+// ToDo: This is essentially the same as contained in methode DrawingML::WriteOutline. Change it
+// there to use this method too, perhaps move this method to a common location.
+/** Uses LineDash and LineCap to detect, whether the dashing comes from a prstDash in MS Office.
+ If prstDash is detected, the method puts the corresponding string for markup into rsPrstDash
+ and returns true.
+ If no prstDash is detected, the method leaves rsPrstDash unchanged and returns false. */
+bool createPrstDashFromLineDash(const css::drawing::LineDash& rLineDash,
+ const css::drawing::LineCap& rLineCap, OUString& rsPrstDash);
+
+/** Returns true if a theme color with other type than model::ThemeColorType::Unknown was found.
+ The theme color is then in aThemeColor.
+ Returns false otherwise. aThemeColor is then unchanged or its type is
+ model::ThemeColorType::Unknown */
+bool getThemeColorFromShape(const OUString& rPropertyName,
+ const css::uno::Reference<css::beans::XPropertySet>& xPropertySet,
+ model::ThemeColor& aThemeColor);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file