summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorAshod Nakashian <ashodnakashian@yahoo.com>2015-08-29 21:02:39 -0400
committerCaolán McNamara <caolanm@redhat.com>2015-09-03 08:45:07 +0000
commit2b8e62f7b6e0a45a9ff1ec530b2e941f3fbcf1a0 (patch)
tree2536a965821cd4ce454b8b93b59fa9582b4fa94e /sw/inc
parenta1fd97308d7fc7a35a5def1e15a05099dba90f91 (diff)
tdf#39080 Hide white space between pages in 'print layout'
Merged Hide Whitespace with Browser Mode and hooked the former with the UI. In Hide Whitespace mode the headers and footers are removed and page margins as well as between-page gaps are reduced to minimum. In single-page view the side margins are left as-is. In multi-page and book-view the sides are removed, however, they have twice the width of the top and bottom. Printing and PDF export disable this mode. The usable screen real-estate is greatly improved in this mode, which is controlled from the View menu. Change-Id: I2d0075ae9a76162c26c78e9eb23a71920cdfc522 Reviewed-on: https://gerrit.libreoffice.org/17281 Reviewed-by: Jean-Baptiste Faure <jbfaure@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/docsh.hxx2
-rw-r--r--sw/inc/swtypes.hxx4
-rw-r--r--sw/inc/viewopt.hxx25
-rw-r--r--sw/inc/viewsh.hxx9
4 files changed, 26 insertions, 14 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index f65f99e908a5..cf35adc33234 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -277,7 +277,7 @@ public:
sal_Int16 GetUpdateDocMode() const { return m_nUpdateDocMode; }
- void ToggleBrowserMode(bool bOn, SwView* pView);
+ void ToggleLayoutMode(SwView* pView);
sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt,
bool bUnoCall );
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 33b7876d4c6b..8e785d1d1024 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -75,13 +75,13 @@ const SwTwips cMinHdFtHeight = 56;
// 28 Twips == 0,4mm
#define MIN_BORDER_DIST 28
-// Minimal document border.
+// Minimal document border: 20mm.
const SwTwips lMinBorder = 1134;
// Margin left and above document.
// Half of it is gap between the pages.
+//TODO: Replace with SwViewOption::GetDefDocumentBorder()
#define DOCUMENTBORDER 284L
-#define GAPBETWEENPAGES 284L
// Constant strings.
SW_DLLPUBLIC extern OUString aEmptyOUStr; // remove once aEmptyOUStr can be changed to OUString
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 4b9076bcf534..bb6e034a9475 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -130,18 +130,18 @@ class SW_DLLPUBLIC SwViewOption
protected:
static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
- OUString sSymbolFont; // Symbolfont.
+ OUString sSymbolFont; // Symbolfont.
sal_uInt32 nCoreOptions; // Bits for SwViewShell.
sal_uInt32 nCore2Options; // Bits for SwViewShell.
sal_uInt32 nUIOptions; // UI-Bits
Color aRetoucheColor; // DefaultBackground for BrowseView
Size aSnapSize; // Describes horizontal and vertical snap.
- sal_uInt16 mnViewLayoutColumns;// # columns for edit view
+ sal_uInt16 mnViewLayoutColumns;// # columns for edit view
short nDivisionX; // Grid division.
short nDivisionY;
- sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
- sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
- sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
+ sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
+ sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
+ sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
bool bReadonly : 1; // Readonly-Doc.
bool bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
bool bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
@@ -151,7 +151,7 @@ protected:
bool mbBookView : 1; // View mode for page preview.
bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
bool mbHideWhitespaceMode : 1; // Hide header, footer, and pagebreak.
- bool bShowPlaceHolderFields : 1; // Only used in printing!
+ bool bShowPlaceHolderFields : 1; // Only used in printing!
mutable bool bIdle;
// Scale
@@ -371,6 +371,16 @@ public:
inline short GetDivisionY() const { return nDivisionY; }
inline void SetDivisionY( short n ){ nDivisionY = n; }
+ // Default margin left and above document: 284 twips == 5.0 mm.
+ 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; }
+
+ inline sal_uInt16 GetDocumentBorder() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
+ inline sal_uInt16 GetGapBetweenPages() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
+
inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
@@ -398,6 +408,9 @@ public:
bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode; }
void SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; }
+ bool IsMultipageView() const { return IsViewLayoutBookMode() ||
+ GetViewLayoutColumns() == 0; }
+
#ifdef DBG_UTIL
// Correspond to statements in ui/config/cfgvw.src.
inline bool IsTest1() const { return m_bTest1; }
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 6e99bc160429..ff8c36c3dc6e 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -489,11 +489,10 @@ public:
bool IsFrameView() const { return mbFrameView; }
- // Makes the necessary invalidations:
- // If BrowseMode has changed bBrowseChgd == true
- // or bBrowseChgd == false in BrowseMode
- // if proportions have changed.
- void CheckBrowseView( bool bBrowseChgd );
+ // Invalidates pages and contents.
+ // When bSizeChanged==true, adds/removes
+ // headers and footers as necessary.
+ void InvalidateLayout(bool bSizeChanged);
const Size& GetBrowseBorder() const;
sal_Int32 GetBrowseWidth() const;