[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source tools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Feb 2 07:34:00 UTC 2019
include/oox/export/drawingml.hxx | 13 +++++++------
oox/source/export/drawingml.cxx | 2 +-
sw/source/filter/ww8/docxattributeoutput.cxx | 2 +-
sw/source/filter/ww8/docxsdrexport.cxx | 2 +-
tools/source/generic/gen.cxx | 11 +++--------
5 files changed, 13 insertions(+), 17 deletions(-)
New commits:
commit d938920433ed28897f41a2dde89ba296ce89bfd5
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 1 23:44:38 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Sat Feb 2 08:33:46 2019 +0100
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 at collabora.com>
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())
commit 59886618cf8db7842ad4724a56f0f92436d0b3bd
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 1 23:31:18 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Sat Feb 2 08:33:37 2019 +0100
tools: use std::swap() in Rectangle::Justify()
Change-Id: If613c9e54f8b6178937f085c594d16a9b883ac10
Reviewed-on: https://gerrit.libreoffice.org/67263
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 16b81b6ee56f..3593801579ac 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <algorithm>
#include <sstream>
#include <o3tl/safeint.hxx>
#include <tools/gen.hxx>
@@ -145,20 +146,14 @@ tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect
void tools::Rectangle::Justify()
{
- long nHelp;
-
if ( (nRight < nLeft) && (nRight != RECT_EMPTY) )
{
- nHelp = nLeft;
- nLeft = nRight;
- nRight = nHelp;
+ std::swap(nLeft, nRight);
}
if ( (nBottom < nTop) && (nBottom != RECT_EMPTY) )
{
- nHelp = nBottom;
- nBottom = nTop;
- nTop = nHelp;
+ std::swap(nBottom, nTop);
}
}
More information about the Libreoffice-commits
mailing list