summaryrefslogtreecommitdiff
path: root/include/editeng
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-03-15 20:48:53 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-03-16 04:54:47 +0100
commit8805e10f5887df66edfd0a2fa4b70e87f0c74700 (patch)
tree6754af5d8450787a2aab415a864377f704a84af1 /include/editeng
parent2537d6897ae516d3b4d50f0e2885dc24949841bf (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>
Diffstat (limited to 'include/editeng')
-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 e6ebd6d42379..14a30dfc4c70 100644
--- a/include/editeng/boxitem.hxx
+++ b/include/editeng/boxitem.hxx
@@ -231,6 +231,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: */