diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-08-30 22:52:03 -0400 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-01 09:33:35 +0000 |
commit | 54a2c8c006e2f216e9d8c6b0ed625180c843c48b (patch) | |
tree | f418de3d5ec3dbb10435d8cb7e993ad7c5d232bf /sw | |
parent | 55b2b9586662f3fe0f01633d41ddadefe08a84a1 (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')
-rw-r--r-- | sw/inc/swtypes.hxx | 7 | ||||
-rw-r--r-- | sw/inc/viewopt.hxx | 11 | ||||
-rw-r--r-- | sw/source/core/inc/pagefrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/inc/rootfrm.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 41 | ||||
-rw-r--r-- | sw/source/core/layout/hffrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/ssfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 31 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 53 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 2 |
16 files changed, 148 insertions, 46 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; } diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 38dc3c18eef0..1318e1444cbd 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -324,6 +324,7 @@ public: const SwPageFrm& GetFormatPage() const; /// If in header or footer area, it also indicates the exact area in rControl. + /// Header or footer must be active, otherwise returns false. bool IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rControl ) const; // return font used to paint the "empty page" string diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 25da09538f24..61cac40a16cb 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -291,6 +291,15 @@ public: */ const SwPageFrm* GetPageAtPos( const Point& rPt, const Size* pSize = 0, bool bExtend = false ) const; + /** + * Point rPt: The point to test + * @returns true: if rPt is between top/bottom margins of two pages + * in hide-whitespace, rPt can be near the gap, but + * not strictly between pages (in a page) as gap is small. + * @returns false: if rPt is in a page or not strictly between two pages + */ + bool IsBetweenPages(const Point& rPt) const; + void CalcFrmRects( SwShellCrsr& ); /** diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 2b4f3939d6b5..2e925327998e 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -764,6 +764,7 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext) else { // Set FixSize. For pages, this is not done from Upper, but from // the attribute. + //FIXME: This resets the size when (mbValidSize && !mbValidPrtArea). Frm().SSize( pAttrs->GetSize() ); Format( pRenderContext, pAttrs ); } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 53d86fbdd3cf..ced90ecc8cf1 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -31,6 +31,7 @@ #include "fmtftn.hxx" #include <txtfrm.hxx> #include <calbck.hxx> +#include <viewopt.hxx> /// Searches the first ContentFrm in BodyText below the page. SwLayoutFrm *SwFootnoteBossFrm::FindBodyCont() @@ -580,6 +581,46 @@ const SwPageFrm* SwRootFrm::GetPageAtPos( const Point& rPt, const Size* pSize, b return pRet; } +bool SwRootFrm::IsBetweenPages(const Point& rPt) const +{ + if (!Frm().IsInside(rPt)) + return false; + + // top visible page + const SwFrm* pPage = Lower(); + if (pPage == nullptr) + return false; + + // skip pages above point: + while (pPage && rPt.Y() > pPage->Frm().Bottom()) + pPage = pPage->GetNext(); + + if (pPage && + rPt.X() >= pPage->Frm().Left() && + rPt.X() <= pPage->Frm().Right()) + { + // Trivial case when we're right in between. + if (!pPage->Frm().IsInside(rPt)) + return true; + + // In normal mode the gap is large enough and + // header/footer mouse interaction competes with + // handling hide-whitespace within them. + // In hide-whitespace, however, the gap is too small + // for convenience and there are no headers/footers. + const SwViewShell *pSh = GetCurrShell(); + if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden()) + { + // If we are really close to the bottom or top of a page. + const auto toEdge = std::min(std::abs(pPage->Frm().Top() - rPt.Y()), + std::abs(pPage->Frm().Bottom() - rPt.Y())); + return toEdge <= MmToTwips(2.0); + } + } + + return false; +} + const SwAttrSet* SwFrm::GetAttrSet() const { if ( IsContentFrm() ) diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 631a7072ac94..0929c1eef09a 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -674,7 +674,7 @@ void SwPageFrm::PrepareHeader() const SwViewShell *pSh = getRootFrm()->GetCurrShell(); const bool bOn = !(pSh && (pSh->GetViewOptions()->getBrowseMode() || - pSh->GetViewOptions()->IsHideWhitespaceMode())); + pSh->GetViewOptions()->IsWhitespaceHidden())); if ( bOn && rH.IsActive() ) { //Implant header, but remove first, if already present @@ -717,7 +717,7 @@ void SwPageFrm::PrepareFooter() const SwViewShell *pSh = getRootFrm()->GetCurrShell(); const bool bOn = !(pSh && (pSh->GetViewOptions()->getBrowseMode() || - pSh->GetViewOptions()->IsHideWhitespaceMode())); + pSh->GetViewOptions()->IsWhitespaceHidden())); if ( bOn && rF.IsActive() ) { //Implant footer, but remove first, if already present diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 68854e4c42a0..993f2a6f2ea5 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -68,9 +68,9 @@ SwBodyFrm::SwBodyFrm( SwFrameFormat *pFormat, SwFrm* pSib ): void SwBodyFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs * ) { - // Formatting of the body is too simple, thus, it gets an own format method. + // Formatting of the body is too simple, thus, it gets its own format method. // Borders etc. are not taken into account here. - // With is taken from the PrtArea of the Upper, height is the height of the + // Width is taken from the PrtArea of the Upper. Height is the height of the // PrtArea of the Upper minus any neighbors (for robustness). // The PrtArea has always the size of the frame. @@ -597,7 +597,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew, mbValidSize = false; // OD 28.10.2002 #97265# - Don't call <SwPageFrm::MakeAll()> // Calculation of the page is not necessary, because its size is - // is invalidated here and further invalidation is done in the + // invalidated here and further invalidation is done in the // calling method <SwPageFrm::Modify(..)> and probably by calling // <SwLayoutFrm::Modify(..)> at the end. // It can also causes inconsistences, because the lowers are @@ -2267,15 +2267,19 @@ bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rCon if ( aHeaderArea.IsInside( rPt ) ) { - rControl = Header; - return true; + if (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetHeader().IsActive()) + { + rControl = Header; + return true; + } } else { SwRect aFooterArea( Point( Frm().Left(), nLowerLimit ), Size( Frm().Width(), Frm().Bottom() - nLowerLimit ) ); - if ( aFooterArea.IsInside( rPt ) ) + if ( aFooterArea.IsInside( rPt ) && + static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetFooter().IsActive() ) { rControl = Footer; return true; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 1a1c111001e6..a85918a1a384 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -115,7 +115,7 @@ struct SwPaintProperties; #define IS_SUBS (!gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && \ !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() && \ !gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&\ - !gProp.pSGlobalShell->GetViewOptions()->IsHideWhitespaceMode() &&\ + !gProp.pSGlobalShell->GetViewOptions()->IsWhitespaceHidden() &&\ SwViewOption::IsDocBoundaries()) //subsidiary lines for sections #define IS_SUBS_SECTION (!gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() && \ diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 4d21ba2edf04..f7379a7b6fce 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -188,7 +188,7 @@ void SwFrm::SetRightLeftMargins( long nRight, long nLeft) Prt().Width( Frm().Width() - nLeft - nRight ); } -/// checks the layout direction and invalidates the lower frames rekursivly, if necessary. +/// checks the layout direction and invalidates the lower frames recursively, if necessary. void SwFrm::CheckDirChange() { bool bOldVert = GetVerticalFlag(); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 6c47b1ac8b3f..2955846193a3 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1100,15 +1100,15 @@ void SwLayoutFrm::Cut() SWRECTFN( this ) SwTwips nShrink = (Frm().*fnRect->fnGetHeight)(); - //Remove first, then shrink upper. + // Remove first, then shrink upper. SwLayoutFrm *pUp = GetUpper(); // AdjustNeighbourhood is now also called in columns which are not - // placed inside a frame + // placed inside a frame. - // Remove must not be called before a AdjustNeighbourhood, but it has to + // Remove must not be called before an AdjustNeighbourhood, but it has to // be called before the upper-shrink-call, if the upper-shrink takes care - // of his content + // of its content. if ( pUp && nShrink ) { if( pUp->IsFootnoteBossFrm() ) @@ -2357,7 +2357,7 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo ) { const SwViewShell *pSh = getRootFrm()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body + const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse by Body. if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2933,13 +2933,12 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder return; SwViewShell *pSh = getRootFrm()->GetCurrShell(); - const bool hideWS = (pSh && pSh->GetViewOptions()->IsHideWhitespaceMode()); + const bool hideWS = (pSh && pSh->GetViewOptions()->IsWhitespaceHidden()); 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 nLeft = (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 nRight = (sal_uInt16)pAttrs->CalcRight(this); const sal_uInt16 nLower = hideWS ? hideWSBorderSize : pAttrs->CalcBottom(); bool bVert = IsVertical() && !IsPageFrm(); @@ -3009,8 +3008,22 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder MakePos(); } while ( !mbValidSize ); } + else if (hideWS) + { + const auto newHeight = InnerHeight() + nUpper + nLower; + ChgSize(Size(Frm().Width(), newHeight)); + mbValidSize = true; + } else mbValidSize = true; + + // While updating the size, PrtArea might be invalidated. + if (!mbValidPrtArea) + { + mbValidPrtArea = true; + (this->*fnRect->fnSetXMargins)(nLeft, nRight); + (this->*fnRect->fnSetYMargins)(nUpper, nLower); + } } } diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 7d3c623badfd..aac690a304f0 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1089,7 +1089,7 @@ void SwTextFrm::FormatAdjust( SwTextFormatter &rLine, const SwTwips nDocPrtTop = Frm().Top() + Prt().Top(); const SwTwips nOldHeight = Prt().SSize().Height(); - SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight; + const SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight; // Vertical Formatting: // The (rotated) repaint rectangle's x coordinate referes to the frame. diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 92dff8012e83..704e20d5d0fd 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1938,7 +1938,7 @@ sal_Int32 SwViewShell::GetBrowseWidth() const void SwViewShell::InvalidateLayout( bool bSizeChanged ) { if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() && - !GetViewOptions()->IsHideWhitespaceMode() ) + !GetViewOptions()->IsWhitespaceHidden() ) return; SET_CURR_SHELL( this ); @@ -2123,7 +2123,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() || mpOpt->IsHideWhitespaceMode()) + if (mpOpt->getBrowseMode() || mpOpt->IsWhitespaceHidden()) bReformat = true; } @@ -2137,10 +2137,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) bReformat = true; bool bHideWhitespaceModeChanged = false; - if (mpOpt->IsHideWhitespaceMode() != rOpt.IsHideWhitespaceMode() || - (rOpt.IsHideWhitespaceMode() && - (mpOpt->IsViewLayoutBookMode() != rOpt.IsViewLayoutBookMode() || - mpOpt->GetViewLayoutColumns() != rOpt.GetViewLayoutColumns()))) + if (mpOpt->IsWhitespaceHidden() != rOpt.IsWhitespaceHidden()) { // When whitespace is hidden, view change needs reformatting. bHideWhitespaceModeChanged = true; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 6ecbc320d859..9dc11dbd2a54 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -587,6 +587,15 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) // which kind of text pointer have we to show - horz / vert - ? if( PointerStyle::Text == eStyle && rSh.IsInVerticalText( &rLPt )) eStyle = PointerStyle::TextVertical; + else + if (rSh.GetViewOptions()->CanHideWhitespace() && + rSh.GetLayout()->IsBetweenPages(rLPt)) + { + if (rSh.GetViewOptions()->IsHideWhitespaceMode()) + eStyle = PointerStyle::ShowWhitespace; + else + eStyle = PointerStyle::HideWhitespace; + } SetPointer( eStyle ); } @@ -2818,23 +2827,28 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if ( !bActive ) { - SwPaM aPam( *rSh.GetCurrentShellCursor().GetPoint() ); - bool bWasInHeader = aPam.GetPoint( )->nNode.GetNode( ).FindHeaderStartNode( ) != NULL; - bool bWasInFooter = aPam.GetPoint( )->nNode.GetNode( ).FindFooterStartNode( ) != NULL; + // When in Hide-Whitespace mode, we don't want header + // and footer controls. + if (!rSh.GetViewOptions()->IsHideWhitespaceMode()) + { + SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint()); + const bool bWasInHeader = aPam.GetPoint()->nNode.GetNode().FindHeaderStartNode() != NULL; + const bool bWasInFooter = aPam.GetPoint()->nNode.GetNode().FindFooterStartNode() != NULL; - // Is the cursor in a part like similar to the one we clicked on? For example, - // if the cursor is in a header and we click on an empty header... don't change anything to - // keep consistent behaviour due to header edit mode (and the same for the footer as well). + // Is the cursor in a part like similar to the one we clicked on? For example, + // if the cursor is in a header and we click on an empty header... don't change anything to + // keep consistent behaviour due to header edit mode (and the same for the footer as well). - // Otherwise, we hide the header/footer control if a separator is shown, and vice versa. - if ( !( bWasInHeader && eControl == Header ) && - !( bWasInFooter && eControl == Footer ) ) - { - rSh.SetShowHeaderFooterSeparator( eControl, !rSh.IsShowHeaderFooterSeparator( eControl ) ); - } + // Otherwise, we hide the header/footer control if a separator is shown, and vice versa. + if (!(bWasInHeader && eControl == Header) && + !(bWasInFooter && eControl == Footer)) + { + rSh.SetShowHeaderFooterSeparator(eControl, !rSh.IsShowHeaderFooterSeparator(eControl)); + } - // Repaint everything - Invalidate(); + // Repaint everything + Invalidate(); + } } else { @@ -2865,6 +2879,17 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // problems when resizing table columns, so disable it // rSh.GetWin()->Invalidate(); } + + // Toggle Hide-Whitespace if between pages. + if (_rMEvt.GetClicks() >= 2 && + rSh.GetViewOptions()->CanHideWhitespace() && + rSh.GetLayout()->IsBetweenPages(aDocPos)) + { + SwViewOption aOpt(*rSh.GetViewOptions()); + aOpt.SetHideWhitespaceMode(!aOpt.IsHideWhitespaceMode()); + rSh.ApplyViewOptions(aOpt); + m_rView.GetDocShell()->ToggleLayoutMode(&m_rView); + } } if ( IsChainMode() ) diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 01b1759926a8..b10b3f291f6d 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -304,7 +304,8 @@ void SwView::StateViewOptions(SfxItemSet &rSet) aBool.SetValue( pOpt->IsShowHiddenPara()); break; case FN_VIEW_HIDE_WHITESPACE: { - if (pOpt->getBrowseMode()) + if (pOpt->getBrowseMode() || + !pOpt->CanHideWhitespace()) { rSet.DisableItem(nWhich); nWhich = 0; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 8a0471fa06da..b7f3d76b12dc 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2555,7 +2555,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( { // #i38289 if( pViewShell->GetViewOptions()->getBrowseMode() || - pViewShell->GetViewOptions()->IsHideWhitespaceMode() ) + pViewShell->GetViewOptions()->IsWhitespaceHidden() ) { SwViewOption aOpt( *pViewShell->GetViewOptions() ); aOpt.setBrowseMode( false ); |