summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-03-15 20:48:53 +0300
committerJan Holesovsky <kendy@collabora.com>2018-07-20 12:13:51 +0200
commited6bcf7185cd2a650f304a065aa60114ac2d3fb7 (patch)
tree2b24b64c06c109382709935573eac3137f5cf4e8 /include
parent0f3ba021f7a9072306beec3d279179f4bae35afc (diff)
tdf#112118: DOC: properly import/export border distance
DOCX part was done in fb959e581c900b392efd0bb329b7cf30c8ed56a5. This commit fixes DOC part. Line width wasn't taken into account on import; and export was done only with "from text" distance, which gave poor interoperability with Word, where the borders were close to page edge. The common code is moved to editeng/source/items/frmitems.cxx and include/editeng/boxitem.hxx. Change-Id: I3d1d1312cb9dc9a9e00d9847ec11234cd787df60 Reviewed-on: https://gerrit.libreoffice.org/51366 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/57704 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/boxitem.hxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
index d0d2143c576f..de337e757db0 100644
--- a/include/editeng/boxitem.hxx
+++ b/include/editeng/boxitem.hxx
@@ -229,6 +229,36 @@ public:
: ( nValidFlags &= ~nValid ); }
void ResetFlags();
};
+
+namespace editeng
+{
+
+void EDITENG_DLLPUBLIC BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin,
+ sal_Int32& nBorderDistance, sal_Int32 nBorderWidth);
+
+struct EDITENG_DLLPUBLIC WordPageMargins final
+{
+ sal_uInt16 nLeft = 0;
+ sal_uInt16 nRight = 0;
+ sal_uInt16 nTop = 0;
+ sal_uInt16 nBottom = 0;
+};
+
+struct EDITENG_DLLPUBLIC WordBorderDistances final
+{
+ bool bFromEdge = false;
+ sal_uInt16 nLeft = 0;
+ sal_uInt16 nRight = 0;
+ sal_uInt16 nTop = 0;
+ sal_uInt16 nBottom = 0;
+};
+
+// Heuristics to decide if we need to use "from edge" offset of borders. All sizes in twips
+void EDITENG_DLLPUBLIC BorderDistancesToWord(const SvxBoxItem& rBox, const WordPageMargins& rMargins,
+ WordBorderDistances& rDistances);
+
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */