summaryrefslogtreecommitdiffstats
path: root/oox/source/export/drawingml.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/export/drawingml.cxx')
-rw-r--r--oox/source/export/drawingml.cxx37
1 files changed, 34 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 01f926c0c90c..4a9ac9f69014 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2954,20 +2954,31 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
pWrap = "square";
}
- bool isUpright = false;
std::optional<OUString> sHorzOverflow;
std::optional<OUString> sVertOverflow;
+ sal_Int32 nShapeRotateAngle = 0;
+ if (GetProperty(rXPropSet, "RotateAngle"))
+ nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get<sal_Int32>() / 300;
+ Reference< XPropertySet > xTextSet(xXText, UNO_QUERY);
+ sal_Int32 nShapeTextRotateAngle = 0;
+ if (GetProperty(xTextSet, "RotateAngle"))
+ nShapeTextRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get<sal_Int32>() / 300;
+ std::optional<OString> isUpright;
if (GetProperty(rXPropSet, "InteropGrabBag"))
{
if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
{
+ bool bUpright = false;
+ sal_Int32 nOldShapeRotation = 0;
+ sal_Int32 nOldTextRotation = 0;
uno::Sequence<beans::PropertyValue> aGrabBag;
rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
for (const auto& aProp : std::as_const(aGrabBag))
{
if (aProp.Name == "Upright")
{
- aProp.Value >>= isUpright;
+ aProp.Value >>= bUpright;
+ isUpright = OString(bUpright ? "1" : "0");
}
else if (aProp.Name == "horzOverflow")
{
@@ -2982,6 +2993,26 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
sVertOverflow = sValue;
}
}
+ if (bUpright)
+ {
+ for (auto& aProp : aGrabBag)
+ {
+ if (aProp.Name == "nShapeRotationAtImport")
+ aProp.Value >>= nOldShapeRotation;
+ else if (aProp.Name == "nTextRotationAtImport")
+ aProp.Value >>= nOldTextRotation;
+ }
+ // So our shape with the textbox in it was not rotated.
+ // Keep upright and make the preRotateAngle 0, it is an attribute
+ // of textBodyPr and must be 0 when upright is true, otherwise
+ // bad rotation happens in MSO.
+ if (nShapeRotateAngle == nOldShapeRotation && nShapeTextRotateAngle == nOldTextRotation)
+ nTextPreRotateAngle = 0;
+ // So we rotated the shape, in this case lose upright and do
+ // as LO normally does.
+ else
+ isUpright.reset();
+ }
}
}
@@ -2997,7 +3028,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
XML_anchor, sVerticalAlignment,
XML_anchorCtr, sax_fastparser::UseIf("1", bHorizontalCenter),
XML_vert, sWritingMode,
- XML_upright, isUpright ? "1" : "0",
+ XML_upright, isUpright,
XML_rot, sax_fastparser::UseIf(oox::drawingml::calcRotationValue((nTextPreRotateAngle + nTextRotateAngle) * 100), (nTextPreRotateAngle + nTextRotateAngle) != 0));
if (bIsFontworkShape)
{