summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorAshod Nakashian <ashodnakashian@yahoo.com>2015-08-30 22:52:03 -0400
committerCaolán McNamara <caolanm@redhat.com>2015-10-01 09:33:35 +0000
commit54a2c8c006e2f216e9d8c6b0ed625180c843c48b (patch)
treef418de3d5ec3dbb10435d8cb7e993ad7c5d232bf /sw/inc
parent55b2b9586662f3fe0f01633d41ddadefe08a84a1 (diff)
tdf#39080 Interactive hide-whitespace mode
Support for enabling and disabling hide-whitespace by clicking between page frames. Disabled header and footer decorators when hide-whitepsace is enabled, and page size is trimmed to the contents of each page. Experimental/suggestive mouse pointers added but only tested on Windows. Change-Id: Ia2faeeda9e3e783ffaf5340aa69303a4218892a7 Reviewed-on: https://gerrit.libreoffice.org/18156 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/swtypes.hxx7
-rw-r--r--sw/inc/viewopt.hxx11
2 files changed, 14 insertions, 4 deletions
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 8e785d1d1024..56d4ac15163f 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -58,6 +58,13 @@ typedef long SwTwips;
#define INVALID_TWIPS LONG_MAX
#define TWIPS_MAX (LONG_MAX - 1)
+// Converts Twips to Millimeters (1 twip == 17.573 um).
+template <typename T = SwTwips>
+static SAL_CONSTEXPR T TwipsToMm(const double twips) { return static_cast<T>(twips * 0.017573); }
+// Converts Millimeters to Twips (1 mm == 56.905479 twips).
+template <typename T = SwTwips>
+static SAL_CONSTEXPR T MmToTwips(const double mm) { return static_cast<T>(mm / 0.017573); }
+
#define MM50 283 // 1/2 cm in TWIPS.
const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32;
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index bb6e034a9475..a2e9d44c38c8 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -375,11 +375,11 @@ public:
static SAL_CONSTEXPR sal_uInt16 GetDefDocumentBorder() { return 284; }
// Default gap between pages: 284 twips == 5.0 mm.
static SAL_CONSTEXPR sal_uInt16 GetDefGapBetweenPages() { return 284; }
- // Minimum edge-to-text distance: 114 twips == 2.0 mm.
- static SAL_CONSTEXPR sal_uInt16 GetMinGapBetweenPages() { return 114; }
+ // Minimum edge-to-text distance: 22 twips == 0.4 mm.
+ static SAL_CONSTEXPR sal_uInt16 GetMinGapBetweenPages() { return 22; }
- inline sal_uInt16 GetDocumentBorder() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
- inline sal_uInt16 GetGapBetweenPages() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
+ inline sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
+ inline sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
@@ -408,6 +408,9 @@ public:
bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode; }
void SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; }
+ /// The rules that allow for hiding whitespace.
+ bool CanHideWhitespace() const { return !IsMultipageView(); }
+ bool IsWhitespaceHidden() const { return IsHideWhitespaceMode() && !IsMultipageView(); }
bool IsMultipageView() const { return IsViewLayoutBookMode() ||
GetViewLayoutColumns() == 0; }