diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-02-01 23:44:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-02-02 08:33:46 +0100 |
commit | d938920433ed28897f41a2dde89ba296ce89bfd5 (patch) | |
tree | c423de1d57e4e64a2ed43c82683c6194e6da9db4 | |
parent | 59886618cf8db7842ad4724a56f0f92436d0b3bd (diff) |
oox: OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY() can be a template
Change-Id: I9d3d371e3942e3f7ba3f2fabfb31e5d339c41ee0
Reviewed-on: https://gerrit.libreoffice.org/67264
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | include/oox/export/drawingml.hxx | 13 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 24adf475be16..fbcc25fb3db1 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -42,12 +42,6 @@ #include <tools/gen.hxx> #include <vcl/mapmod.hxx> -#ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY -// Our rotation is counter-clockwise and is in 100ths of a degree. -// drawingML rotation is clockwise and is in 60000ths of a degree. -#define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000) -#endif - class Graphic; class SdrObjCustomShape; @@ -102,6 +96,13 @@ namespace core { namespace drawingml { +// Our rotation is counter-clockwise and is in 100ths of a degree. +// drawingML rotation is clockwise and is in 60000ths of a degree. +template <typename T> T ExportRotateClockwisify(T input) +{ + return ((21600000 - input * 600) % 21600000); +} + /// Interface to be implemented by the parent exporter that knows how to handle shape text. class OOX_DLLPUBLIC DMLTextExport { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index cbc39f946a00..91961155294a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1493,7 +1493,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa nRotation = nRotation * -1 + 36000; WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace, - bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape )); + bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation), IsGroupShape( rXShape )); } void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect, diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 05e5807995a2..46dc2ebfb07c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4775,7 +4775,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size if (sal_uInt32 nRot = rSet.Get(RES_GRFATR_ROTATION).GetValue()) { // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths for macro - sal_uInt32 mOOXMLRot = OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRot*10); + sal_uInt32 mOOXMLRot = oox::drawingml::ExportRotateClockwisify(nRot*10); xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot)); aSize = pGrfNode->GetTwipSize(); } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 55b159bbae70..6484fbef9883 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1588,7 +1588,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho } aRotation >>= m_pImpl->getDMLandVMLTextFrameRotation(); OString sRotation(OString::number( - (OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(m_pImpl->getDMLandVMLTextFrameRotation())))); + oox::drawingml::ExportRotateClockwisify(m_pImpl->getDMLandVMLTextFrameRotation()))); // Shape properties pFS->startElementNS(XML_wps, XML_spPr, FSEND); if (m_pImpl->getDMLandVMLTextFrameRotation()) |