summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAshod Nakashian <ashodnakashian@yahoo.com>2015-08-29 21:02:39 -0400
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-18 10:21:48 +0100
commitd8bc8f1d6bd9d84d624d1a21955ed5fbf96f80e3 (patch)
tree3ca08266a4daf1c276732f720193a6eb67937a3e /sw
parent6559276d85fcc54d52e291b8ae09436418e7709d (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> (cherry picked from commit 2b8e62f7b6e0a45a9ff1ec530b2e941f3fbcf1a0)
Diffstat (limited to 'sw')
-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
-rw-r--r--sw/source/core/layout/layact.cxx5
-rw-r--r--sw/source/core/layout/pagechg.cxx11
-rw-r--r--sw/source/core/layout/wsfrm.cxx16
-rw-r--r--sw/source/core/view/viewsh.cxx43
-rw-r--r--sw/source/core/view/vprint.cxx2
-rw-r--r--sw/source/uibase/app/docsh2.cxx60
-rw-r--r--sw/source/uibase/uiview/pview.cxx1
-rw-r--r--sw/source/uibase/uiview/view0.cxx26
-rw-r--r--sw/source/uibase/uiview/view2.cxx4
-rw-r--r--sw/source/uibase/uiview/viewport.cxx4
-rw-r--r--sw/source/uibase/uno/unomod.cxx31
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
16 files changed, 152 insertions, 95 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index af0aed66a454..66b3a90992f2 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -285,7 +285,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 b724fbdc3313..498fb0b00860 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 87558cc185c6..e7b2b00bd842 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
@@ -370,6 +370,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; }
@@ -397,6 +407,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 eaa0bf9b3e69..c6b440170dcf 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -499,11 +499,10 @@ public:
void SetFrameView( const Size& rBrowseBorder )
{ mbFrameView = true; maBrowseBorder = rBrowseBorder; }
- // 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;
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index ba9edb0398db..1e743a86d63f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1310,12 +1310,13 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrm *pLay,
// between pages (not only for in online mode).
if ( pLay->IsPageFrm() )
{
- const SwTwips nHalfDocBorder = GAPBETWEENPAGES;
+ const SwViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
+ const SwTwips nHalfDocBorder = pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
+ : SwViewOption::GetDefGapBetweenPages();
const bool bLeftToRightViewLayout = pRoot->IsLeftToRightViewLayout();
const bool bPrev = bLeftToRightViewLayout ? pLay->GetPrev() : pLay->GetNext();
const bool bNext = bLeftToRightViewLayout ? pLay->GetNext() : pLay->GetPrev();
SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
- const SwViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
SwRect aPageRect( pLay->Frm() );
if(pSh)
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 6e426b44f08f..c535bd284591 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1884,8 +1884,8 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
{
assert(pViewOpt && "CheckViewLayout required ViewOptions");
- const sal_uInt16 nColumns = pViewOpt->GetViewLayoutColumns();
- const bool bBookMode = pViewOpt->IsViewLayoutBookMode();
+ const sal_uInt16 nColumns = pViewOpt->GetViewLayoutColumns();
+ const bool bBookMode = pViewOpt->IsViewLayoutBookMode();
if ( nColumns == mnColumns && bBookMode == mbBookMode && pVisArea->Width() == mnViewWidth && !mbSidebarChanged )
return;
@@ -1911,7 +1911,10 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
const long nBorder = Frm().Pos().getX();
const long nVisWidth = mnViewWidth - 2 * nBorder;
- const long nGapBetweenPages = GAPBETWEENPAGES;
+ SwViewShell* pSh = GetCurrShell();
+ const long nGapBetweenPages = pViewOpt ? pViewOpt->GetGapBetweenPages()
+ : (pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
+ : SwViewOption::GetDefGapBetweenPages());
// check how many pages fit into the first page layout row:
SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(Lower());
@@ -2171,8 +2174,6 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
::AdjustSizeChgNotify( this );
Calc(pRenderContext);
- SwViewShell* pSh = GetCurrShell();
-
if ( pSh && pSh->GetDoc()->GetDocShell() )
{
pSh->SetFirstVisPageInvalid();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 2304e4a52ef4..0ecf0e6a99d3 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2927,18 +2927,20 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
*/
void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs *pAttrs )
{
- OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs ist 0." );
+ OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs is 0." );
if ( mbValidPrtArea && mbValidSize )
return;
SwViewShell *pSh = getRootFrm()->GetCurrShell();
- const bool hideWhitespace = (pSh && pSh->GetViewOptions()->IsHideWhitespaceMode());
- const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this );
- const sal_uInt16 nUpper = hideWhitespace ? 0 : pAttrs->CalcTop();
-
- const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight( this );
- const sal_uInt16 nLower = hideWhitespace ? 0 : pAttrs->CalcBottom();
+ const bool hideWS = (pSh && pSh->GetViewOptions()->IsHideWhitespaceMode());
+ const long hideWSBorderSize = (pSh ? pSh->GetViewOptions()->GetDocumentBorder() : 0);
+ const bool hideSideWS = (pSh && pSh->GetViewOptions()->IsMultipageView());
+ const sal_uInt16 nLeft = hideSideWS ? hideWSBorderSize * 2 : (sal_uInt16)pAttrs->CalcLeft(this);
+ const sal_uInt16 nUpper = hideWS ? hideWSBorderSize : pAttrs->CalcTop();
+
+ const sal_uInt16 nRight = hideSideWS ? hideWSBorderSize * 2 : (sal_uInt16)pAttrs->CalcRight(this);
+ const sal_uInt16 nLower = hideWS ? hideWSBorderSize : pAttrs->CalcBottom();
bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index e7f65b5a5819..db92f8d84fda 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -930,7 +930,6 @@ void SwViewShell::Reformat()
if( GetLayout()->IsCallbackActionEnabled() )
{
-
StartAction();
GetLayout()->InvalidateAllContent( INV_SIZE | INV_POS | INV_PRTAREA );
EndAction();
@@ -1918,7 +1917,7 @@ void SwViewShell::SetBrowseBorder( const Size& rNew )
{
maBrowseBorder = rNew;
if ( maVisArea.HasArea() )
- CheckBrowseView( false );
+ InvalidateLayout( false );
}
}
@@ -1941,9 +1940,10 @@ sal_Int32 SwViewShell::GetBrowseWidth() const
return maVisArea.Width() - 2 * GetOut()->PixelToLogic(maBrowseBorder).Width();
}
-void SwViewShell::CheckBrowseView( bool bBrowseChgd )
+void SwViewShell::InvalidateLayout( bool bSizeChanged )
{
- if ( !bBrowseChgd && !GetViewOptions()->getBrowseMode() )
+ if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() &&
+ !GetViewOptions()->IsHideWhitespaceMode() )
return;
SET_CURR_SHELL( this );
@@ -1973,7 +1973,7 @@ void SwViewShell::CheckBrowseView( bool bBrowseChgd )
{ pPg->InvalidateSize();
pPg->_InvalidatePrt();
pPg->InvaPercentLowers();
- if ( bBrowseChgd )
+ if ( bSizeChanged )
{
pPg->PrepareHeader();
pPg->PrepareFooter();
@@ -1984,9 +1984,9 @@ void SwViewShell::CheckBrowseView( bool bBrowseChgd )
// When the size ratios in browse mode change,
// the Position and PrtArea of the Content and Tab frames must be Invalidated.
sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_POS;
- // In case of browse mode change the ContentFrms need a size-Invalidate
- // because of printer/screen formatting
- if( bBrowseChgd )
+ // In case of layout or mode change, the ContentFrms need a size-Invalidate
+ // because of printer/screen formatting.
+ if ( bSizeChanged )
nInv |= INV_SIZE | INV_DIRECTION;
GetLayout()->InvalidateAllContent( nInv );
@@ -2043,7 +2043,6 @@ SfxItemPool& SwViewShell::GetAttrPool()
void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
{
-
for(SwViewShell& rSh : GetRingContainer())
rSh.StartAction();
@@ -2059,11 +2058,12 @@ void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
continue;
SwViewOption aOpt( *rSh.GetViewOptions() );
aOpt.SetFieldName( rOpt.IsFieldName() );
- aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
+ aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
- aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
- aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
- aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
+ aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
+ aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
+ aOpt.SetHideWhitespaceMode(rOpt.IsHideWhitespaceMode());
+ aOpt.SetViewLayoutColumns(rOpt.GetViewLayoutColumns());
aOpt.SetPostIts(rOpt.IsPostIts());
if ( !(aOpt == *rSh.GetViewOptions()) )
rSh.ImplApplyViewOptions( aOpt );
@@ -2128,7 +2128,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
pMyWin->SetMapMode( aMode );
// if not a reference device (printer) is used for formatting,
// but the screen, new formatting is needed for zoomfactor changes.
- if( mpOpt->getBrowseMode() )
+ if (mpOpt->getBrowseMode() || mpOpt->IsHideWhitespaceMode())
bReformat = true;
}
@@ -2141,6 +2141,17 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
else if( mpOpt->getBrowseMode() && mpOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
bReformat = true;
+ bool bHideWhitespaceModeChanged = false;
+ if (mpOpt->IsHideWhitespaceMode() != rOpt.IsHideWhitespaceMode() ||
+ (rOpt.IsHideWhitespaceMode() &&
+ (mpOpt->IsViewLayoutBookMode() != rOpt.IsViewLayoutBookMode() ||
+ mpOpt->GetViewLayoutColumns() != rOpt.GetViewLayoutColumns())))
+ {
+ // When whitespace is hidden, view change needs reformatting.
+ bHideWhitespaceModeChanged = true;
+ bReformat = true;
+ }
+
if ( HasDrawView() || rOpt.IsGridVisible() )
{
if ( !HasDrawView() )
@@ -2178,12 +2189,12 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
mpDoc->GetDocumentSettingManager().set(DocumentSettingId::HTML_MODE, 0 != ::GetHtmlMode(mpDoc->GetDocShell()));
- if( bBrowseModeChanged )
+ if( bBrowseModeChanged || bHideWhitespaceModeChanged )
{
// #i44963# Good occasion to check if page sizes in
// page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
mpDoc->CheckDefaultPageFormat();
- CheckBrowseView( true );
+ InvalidateLayout( true );
}
pMyWin->Invalidate();
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 0176505779b9..6d4a875b697e 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -604,7 +604,7 @@ void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintD
if ( pSh->GetViewOptions()->getBrowseMode() &&
pSh->GetRingContainer().size() == 1 )
{
- pSh->CheckBrowseView( false );
+ pSh->InvalidateLayout( false );
pSh->GetLayout()->Lower()->InvalidateSize();
}
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 166cbeb0d72d..d8a7ea769cf0 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -155,44 +155,38 @@ VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(
return pDlg;
}
-// Disable "multiple layout"
-
-void SwDocShell::ToggleBrowserMode(bool bSet, SwView* _pView )
+void SwDocShell::ToggleLayoutMode(SwView* pView)
{
- GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bSet );
- UpdateFontList();
- SwView* pTempView = _pView ? _pView : GetView();
- if( pTempView )
+ OSL_ENSURE( pView, "SwDocShell::ToggleLayoutMode, pView is null." );
+
+ const SwViewOption& rViewOptions = *pView->GetWrtShell().GetViewOptions();
+
+ //TODO: Should HideWhitespace flag be saved in the document settings?
+ GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, rViewOptions.getBrowseMode());
+ UpdateFontList(); // Why is this necessary here?
+
+ pView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
+ if( !GetDoc()->getIDocumentDeviceAccess().getPrinter( false ) )
+ pView->SetPrinter( GetDoc()->getIDocumentDeviceAccess().getPrinter( false ), SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
+ GetDoc()->CheckDefaultPageFormat();
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, false);
+ while (pTmpFrm)
{
- pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
- if( !GetDoc()->getIDocumentDeviceAccess().getPrinter( false ) )
- pTempView->SetPrinter( GetDoc()->getIDocumentDeviceAccess().getPrinter( false ), SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
- GetDoc()->CheckDefaultPageFormat();
- SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, false);
- while (pTmpFrm)
- {
- if( pTmpFrm != pTempView->GetViewFrame() )
- {
- pTmpFrm->DoClose();
- pTmpFrm = SfxViewFrame::GetFirst(this, false);
- }
- else
- pTmpFrm = SfxViewFrame::GetNext(*pTmpFrm, this, false);
- }
- const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions();
- pTempView->GetWrtShell().CheckBrowseView( true );
- pTempView->CheckVisArea();
- if( bSet )
+ if( pTmpFrm != pView->GetViewFrame() )
{
- const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
- if ( SvxZoomType::PERCENT != eType)
- static_cast<SwView*>(GetView())->SetZoom( eType );
+ pTmpFrm->DoClose();
+ pTmpFrm = SfxViewFrame::GetFirst(this, false);
}
- pTempView->InvalidateBorder();
- pTempView->SetNewWindowAllowed(!bSet);
+ else
+ pTmpFrm = SfxViewFrame::GetNext(*pTmpFrm, this, false);
}
+
+ pView->GetWrtShell().InvalidateLayout(true);
+
+ pView->RecheckBrowseMode();
+
+ pView->SetNewWindowAllowed(!rViewOptions.getBrowseMode());
}
-// End of disabled "multiple layout"
// update text fields on document properties changes
void SwDocShell::DoFlushDocInfo()
@@ -1363,7 +1357,7 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
{
SwWrtShell& rWrtSh = pCurrView->GetWrtShell();
if( rWrtSh.GetLayout())
- rWrtSh.CheckBrowseView( true );
+ rWrtSh.InvalidateLayout( true );
}
// Take HTTP-Header-Attibutes over into the DokInfo again.
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 83fe02820d3e..2974766b9bfe 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1144,6 +1144,7 @@ void SwPagePreview::Init(const SwViewOption * pPrefs)
aOpt.SetTable( true );
aOpt.SetSnap( false );
aOpt.SetGridVisible( false );
+ aOpt.SetHideWhitespaceMode( false );
GetViewShell()->ApplyViewOptions( aOpt );
GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index a77ae11b771c..81825c20cc58 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -303,6 +303,17 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
}
case FN_VIEW_HIDDEN_PARA:
aBool.SetValue( pOpt->IsShowHiddenPara()); break;
+ case FN_VIEW_HIDE_WHITESPACE:
+ {
+ if (pOpt->getBrowseMode())
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue(pOpt->IsHideWhitespaceMode());
+ }
+ break;
case SID_GRID_VISIBLE:
aBool.SetValue( pOpt->IsGridVisible() ); break;
case SID_GRID_USE:
@@ -357,6 +368,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
int eState = STATE_TOGGLE;
bool bSet = false;
bool bBrowseModeChanged = false;
+ bool bHideWhitespaceModeChanged = false;
const SfxItemSet *pArgs = rReq.GetArgs();
sal_uInt16 nSlot = rReq.GetSlot();
@@ -419,8 +431,6 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
else if( nSlot == FN_PRINT_LAYOUT )
bFlag = !bFlag;
bBrowseModeChanged = bFlag != pOpt->getBrowseMode();
- // Disable "multiple layout"
- GetDocShell()->ToggleBrowserMode( bFlag, this );
pOpt->setBrowseMode( bFlag );
break;
@@ -441,6 +451,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
pOpt->SetShowHiddenPara( bFlag );
break;
+ case FN_VIEW_HIDE_WHITESPACE:
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsHideWhitespaceMode();
+ bHideWhitespaceModeChanged = (bFlag != pOpt->IsHideWhitespaceMode());
+ pOpt->SetHideWhitespaceMode(bFlag);
+ break;
+
case FN_VIEW_SMOOTH_SCROLL:
if ( STATE_TOGGLE == eState )
@@ -561,10 +578,9 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
if( !(*rSh.GetViewOptions() == *pOpt ))
{
rSh.ApplyViewOptions( *pOpt );
- if( bBrowseModeChanged )
+ if( bBrowseModeChanged || bHideWhitespaceModeChanged )
{
- RecheckBrowseMode();
- CheckVisArea();
+ GetDocShell()->ToggleLayoutMode(this);
}
// The UsrPref must be marked as modified.
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 498a2627b1e4..edebaf77aa07 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1461,7 +1461,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
const Size& rEditSize = GetEditWin().GetOutputSizePixel();
const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
- const long nOf = DOCUMENTBORDER * 2L;
+ const long nOf = pVOpt->GetDocumentBorder() * 2L;
long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
nTmpWidth += nOf;
aPageSize.Height() += nOf;
@@ -1474,7 +1474,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
if ( bAutomaticViewLayout )
{
- nTmpWidth += aPageSize.Width() + GAPBETWEENPAGES;
+ nTmpWidth += aPageSize.Width() + pVOpt->GetGapBetweenPages();
nFac = aWindowSize.Width() * 100 / nTmpWidth;
nFac = std::min( nFac, nVisPercent );
aZoomSliderItem.AddSnappingPoint( nFac );
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index e7dad98ac39b..db2548a80b0b 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -265,7 +265,7 @@ void SwView::SetVisArea( const Rectangle &rRect, bool bUpdateScrollbar )
if ( aOldSz != m_pWrtShell->VisArea().SSize() &&
( std::abs(aOldSz.Width() - m_pWrtShell->VisArea().Width()) > 2 ||
std::abs(aOldSz.Height() - m_pWrtShell->VisArea().Height()) > 2 ) )
- m_pWrtShell->CheckBrowseView( false );
+ m_pWrtShell->InvalidateLayout( false );
}
if ( !bProtectDocShellVisArea )
@@ -329,7 +329,7 @@ void SwView::SetVisArea( const Point &rPt, bool bUpdateScrollbar )
void SwView::CheckVisArea()
{
m_pHScrollbar->SetAuto( m_pWrtShell->GetViewOptions()->getBrowseMode() &&
- !GetViewFrame()->GetFrame().IsInPlace() );
+ !GetViewFrame()->GetFrame().IsInPlace() );
if ( IsDocumentBorder() )
{
if ( m_aVisArea.Left() != DOCUMENTBORDER ||
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 726166c3f018..9029ea48068b 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -90,7 +90,8 @@ enum SwViewSettingsPropertyHandles
HANDLE_VIEWSET_RASTER_SUBDIVISION_Y,
HANDLE_VIEWSET_HORI_RULER_METRIC,
HANDLE_VIEWSET_VERT_RULER_METRIC,
- HANDLE_VIEWSET_SCROLLBAR_TIPS
+ HANDLE_VIEWSET_SCROLLBAR_TIPS,
+ HANDLE_VIEWSET_HIDE_WHITESPACE
};
enum SwPrintSettingsPropertyHandles
@@ -136,6 +137,7 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
{ OUString( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
+ { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 },
@@ -707,23 +709,37 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
break;
case HANDLE_VIEWSET_ONLINE_LAYOUT :
{
- if( pView && !bVal != !pView->GetWrtShell().GetViewOptions()->getBrowseMode() )
+ SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
+ if (pView && !bVal != !aOpt.getBrowseMode())
{
- SwViewOption aOpt( *pView->GetWrtShell().GetViewOptions() );
aOpt.setBrowseMode( bVal );
pView->GetWrtShell().ApplyViewOptions( aOpt );
- pView->RecheckBrowseMode();
// must be set in mpViewOption as this will overwrite settings in _post!
if(mpViewOption)
mpViewOption->setBrowseMode(bVal);
- // disable multiple layout
- pView->GetDocShell()->ToggleBrowserMode(bVal, pView );
+ pView->GetDocShell()->ToggleLayoutMode(pView);
}
}
break;
- case HANDLE_VIEWSET_HELP_URL :
+ case HANDLE_VIEWSET_HIDE_WHITESPACE:
+ {
+ SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
+ if (pView && !bVal != !aOpt.IsHideWhitespaceMode())
+ {
+ aOpt.SetHideWhitespaceMode( bVal );
+ pView->GetWrtShell().ApplyViewOptions( aOpt );
+
+ // must be set in mpViewOption as this will overwrite settings in _post!
+ if(mpViewOption)
+ mpViewOption->SetHideWhitespaceMode(bVal);
+
+ pView->GetDocShell()->ToggleLayoutMode(pView);
+ }
+ }
+ break;
+ case HANDLE_VIEWSET_HELP_URL:
{
if ( pView )
{
@@ -852,6 +868,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
case HANDLE_VIEWSET_HIDE_WHITESPACE: bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break;
+ case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break;
case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index e6c1040cb9da..12d157a4deaa 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2559,10 +2559,12 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
if (bFormat)
{
// #i38289
- if( pViewShell->GetViewOptions()->getBrowseMode() )
+ if( pViewShell->GetViewOptions()->getBrowseMode() ||
+ pViewShell->GetViewOptions()->IsHideWhitespaceMode() )
{
SwViewOption aOpt( *pViewShell->GetViewOptions() );
aOpt.setBrowseMode( false );
+ aOpt.SetHideWhitespaceMode( false );
pViewShell->ApplyViewOptions( aOpt );
if (pSwView)
{