[Libreoffice-commits] core.git: include/vcl sw/inc sw/source vcl/inc vcl/osx vcl/unx vcl/win

Ashod Nakashian ashodnakashian at yahoo.com
Thu Oct 1 02:33:58 PDT 2015


 include/vcl/ptrstyle.hxx              |    4 +-
 sw/inc/swtypes.hxx                    |    7 ++++
 sw/inc/viewopt.hxx                    |   11 ++++---
 sw/source/core/inc/pagefrm.hxx        |    1 
 sw/source/core/inc/rootfrm.hxx        |    9 +++++
 sw/source/core/layout/calcmove.cxx    |    1 
 sw/source/core/layout/findfrm.cxx     |   41 ++++++++++++++++++++++++++
 sw/source/core/layout/hffrm.cxx       |    4 +-
 sw/source/core/layout/pagechg.cxx     |   16 ++++++----
 sw/source/core/layout/paintfrm.cxx    |    2 -
 sw/source/core/layout/ssfrm.cxx       |    2 -
 sw/source/core/layout/wsfrm.cxx       |   31 ++++++++++++++-----
 sw/source/core/text/frmform.cxx       |    2 -
 sw/source/core/view/viewsh.cxx        |    9 +----
 sw/source/uibase/docvw/edtwin.cxx     |   53 +++++++++++++++++++++++++---------
 sw/source/uibase/uiview/view0.cxx     |    3 +
 sw/source/uibase/uno/unotxdoc.cxx     |    2 -
 vcl/inc/unx/x11_cursors/salcursors.h  |    4 ++
 vcl/inc/unx/x11_cursors/wshide_curs.h |   29 ++++++++++++++++++
 vcl/inc/unx/x11_cursors/wshide_mask.h |   29 ++++++++++++++++++
 vcl/inc/unx/x11_cursors/wsshow_curs.h |   29 ++++++++++++++++++
 vcl/inc/unx/x11_cursors/wsshow_mask.h |   29 ++++++++++++++++++
 vcl/inc/win/salids.hrc                |   20 +++++++-----
 vcl/osx/res/cursors/wshide.png        |binary
 vcl/osx/res/cursors/wsshow.png        |binary
 vcl/osx/saldata.cxx                   |    4 +-
 vcl/unx/generic/app/saldisp.cxx       |    9 +++++
 vcl/unx/gtk/app/gtkdata.cxx           |    3 +
 vcl/win/source/src/salsrc.rc          |    2 +
 vcl/win/source/src/wshide.cur         |binary
 vcl/win/source/src/wsshow.cur         |binary
 vcl/win/source/window/salframe.cxx    |    4 +-
 32 files changed, 301 insertions(+), 59 deletions(-)

New commits:
commit 54a2c8c006e2f216e9d8c6b0ed625180c843c48b
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date:   Sun Aug 30 22:52:03 2015 -0400

    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 at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/ptrstyle.hxx b/include/vcl/ptrstyle.hxx
index d63d44b..996caf5 100644
--- a/include/vcl/ptrstyle.hxx
+++ b/include/vcl/ptrstyle.hxx
@@ -116,7 +116,9 @@ enum class PointerStyle
     TabSelectW         = 91,
     TabSelectSW        = 92,
     Paintbrush         = 93,
-    LAST               = Paintbrush,
+    HideWhitespace     = 94,
+    ShowWhitespace     = 95,
+    LAST               = ShowWhitespace,
 };
 
 #endif // INCLUDED_VCL_PTRSTYLE_HXX
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 8e785d1..56d4ac1 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 bb6e034..a2e9d44 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 38dc3c1..1318e14 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 25da095..61cac40 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 2b4f393..2e92532 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 53d86fb..ced90ec 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 631a707..0929c1e 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 68854e4..993f2a6 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 1a1c111..a85918a 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 4d21ba2..f7379a7 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 6c47b1a..2955846 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 7d3c623..aac690a 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 92dff80..704e20d 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 6ecbc32..9dc11db 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 01b1759..b10b3f2 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 8a0471f..b7f3d76 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 );
diff --git a/vcl/inc/unx/x11_cursors/salcursors.h b/vcl/inc/unx/x11_cursors/salcursors.h
index 5eb74e6..627352f 100644
--- a/vcl/inc/unx/x11_cursors/salcursors.h
+++ b/vcl/inc/unx/x11_cursors/salcursors.h
@@ -152,5 +152,9 @@
 #include "unx/x11_cursors/tblselsw_mask.h"
 #include "unx/x11_cursors/paintbrush_curs.h"
 #include "unx/x11_cursors/paintbrush_mask.h"
+#include "unx/x11_cursors/wshide_curs.h"
+#include "unx/x11_cursors/wshide_mask.h"
+#include "unx/x11_cursors/wsshow_curs.h"
+#include "unx/x11_cursors/wsshow_mask.h"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11_cursors/wshide_curs.h b/vcl/inc/unx/x11_cursors/wshide_curs.h
new file mode 100644
index 0000000..e8fd272
--- /dev/null
+++ b/vcl/inc/unx/x11_cursors/wshide_curs.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define hidewhitespace_curs_width 16
+#define hidewhitespace_curs_height 16
+#define hidewhitespace_curs_x_hot 0
+#define hidewhitespace_curs_y_hot 10
+static unsigned char hidewhitespace_curs_bits[] = {
+  0x00, 0x01, 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, 0xFF, 0xFF,
+  0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0x00, 0x01,
+  0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0x00, 0x01, };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11_cursors/wshide_mask.h b/vcl/inc/unx/x11_cursors/wshide_mask.h
new file mode 100644
index 0000000..8547baa
--- /dev/null
+++ b/vcl/inc/unx/x11_cursors/wshide_mask.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define hidewhitespace_mask_width 16
+#define hidewhitespace_mask_height 16
+#define hidewhitespace_mask_x_hot 0
+#define hidewhitespace_mask_y_hot 10
+static unsigned char hidewhitespace_mask_bits[] = {
+  0x00, 0x01, 0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, 0xFF, 0xFF,
+  0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0xFF, 0xFF, 0x00, 0x01,
+  0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0x00, 0x01, };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11_cursors/wsshow_curs.h b/vcl/inc/unx/x11_cursors/wsshow_curs.h
new file mode 100644
index 0000000..56b705e
--- /dev/null
+++ b/vcl/inc/unx/x11_cursors/wsshow_curs.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define showwhitespace_curs_width 16
+#define showwhitespace_curs_height 16
+#define showwhitespace_curs_x_hot 0
+#define showwhitespace_curs_y_hot 10
+static unsigned char showwhitespace_curs_bits[] = {
+  0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x81,
+  0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0xFF, 0xFF,
+  0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11_cursors/wsshow_mask.h b/vcl/inc/unx/x11_cursors/wsshow_mask.h
new file mode 100644
index 0000000..2da7aea
--- /dev/null
+++ b/vcl/inc/unx/x11_cursors/wsshow_mask.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define showwhitespace_mask_width 16
+#define showwhitespace_mask_height 16
+#define showwhitespace_mask_x_hot 0
+#define showwhitespace_mask_y_hot 10
+static unsigned char showwhitespace_mask_bits[] = {
+  0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x81,
+  0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0x01, 0x81, 0xFF, 0xFF,
+  0x00, 0x01, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salids.hrc b/vcl/inc/win/salids.hrc
index acc0f43..e5a0e18 100644
--- a/vcl/inc/win/salids.hrc
+++ b/vcl/inc/win/salids.hrc
@@ -60,12 +60,12 @@
 #define SAL_RESID_POINTER_DRAW_CONNECT              10047
 #define SAL_RESID_POINTER_DRAW_TEXT                 10048
 #define SAL_RESID_POINTER_DRAW_CAPTION              10049
-#define SAL_RESID_POINTER_CHART                                 10050
+#define SAL_RESID_POINTER_CHART                     10050
 #define SAL_RESID_POINTER_DETECTIVE                 10051
 #define SAL_RESID_POINTER_PIVOT_COL                 10052
 #define SAL_RESID_POINTER_PIVOT_ROW                 10053
 #define SAL_RESID_POINTER_PIVOT_FIELD               10054
-#define SAL_RESID_POINTER_CHAIN                                 10055
+#define SAL_RESID_POINTER_CHAIN                     10055
 #define SAL_RESID_POINTER_CHAIN_NOTALLOWED          10056
 #define SAL_RESID_POINTER_TIMEEVENT_MOVE            10057
 #define SAL_RESID_POINTER_TIMEEVENT_SIZE            10058
@@ -80,15 +80,17 @@
 #define SAL_RESID_POINTER_AUTOSCROLL_NS             10067
 #define SAL_RESID_POINTER_AUTOSCROLL_WE             10068
 #define SAL_RESID_POINTER_AUTOSCROLL_NSWE           10069
-#define SAL_RESID_POINTER_AIRBRUSH                              10070
+#define SAL_RESID_POINTER_AIRBRUSH                  10070
 #define SAL_RESID_POINTER_TEXT_VERTICAL             10071
 #define SAL_RESID_POINTER_PIVOT_DELETE              10072
-#define SAL_RESID_POINTER_TAB_SELECT_S                          10073
-#define SAL_RESID_POINTER_TAB_SELECT_E                          10074
-#define SAL_RESID_POINTER_TAB_SELECT_SE                         10075
-#define SAL_RESID_POINTER_TAB_SELECT_W                          10076
-#define SAL_RESID_POINTER_TAB_SELECT_SW                         10077
-#define SAL_RESID_POINTER_PAINTBRUSH                            10078
+#define SAL_RESID_POINTER_TAB_SELECT_S              10073
+#define SAL_RESID_POINTER_TAB_SELECT_E              10074
+#define SAL_RESID_POINTER_TAB_SELECT_SE             10075
+#define SAL_RESID_POINTER_TAB_SELECT_W              10076
+#define SAL_RESID_POINTER_TAB_SELECT_SW             10077
+#define SAL_RESID_POINTER_PAINTBRUSH                10078
+#define SAL_RESID_POINTER_HIDEWHITESPACE            10079
+#define SAL_RESID_POINTER_SHOWWHITESPACE            10080
 
 #define SAL_RESID_BITMAP_50                                             11000
 
diff --git a/vcl/osx/res/cursors/wshide.png b/vcl/osx/res/cursors/wshide.png
new file mode 100644
index 0000000..0195b91
Binary files /dev/null and b/vcl/osx/res/cursors/wshide.png differ
diff --git a/vcl/osx/res/cursors/wsshow.png b/vcl/osx/res/cursors/wsshow.png
new file mode 100644
index 0000000..fe37464
Binary files /dev/null and b/vcl/osx/res/cursors/wsshow.png differ
diff --git a/vcl/osx/saldata.cxx b/vcl/osx/saldata.cxx
index 1dff45e..ea89aa5 100644
--- a/vcl/osx/saldata.cxx
+++ b/vcl/osx/saldata.cxx
@@ -206,7 +206,9 @@ curs_ent{ NULL, { 0, 0 } }, //PointerStyle::Arrow
 { "tblselse", { 30, 30 } }, //PointerStyle::TabSelectSE
 { "tblselw", { 1, 16 } }, //PointerStyle::TabSelectW
 { "tblselsw", { 1, 30 } }, //PointerStyle::TabSelectSW
-{ "pntbrsh", { 9, 16 } }  //PointerStyle::Paintbrush
+{ "pntbrsh", { 9, 16 } }, //PointerStyle::Paintbrush
+{ "wshide", { 16, 16 } }, //PointerStyle::HideWhitespace
+{ "wsshow", { 16, 16 } } //PointerStyle::ShowWhitespace
 };
 
 NSCursor* SalData::getCursor( PointerStyle i_eStyle )
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 4b47eda..ee6a1b8 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -1797,10 +1797,17 @@ Cursor SalDisplay::GetPointer( PointerStyle ePointerStyle )
             break;
 
         // #i20119# Paintbrush tool
-        case PointerStyle::Paintbrush :
+        case PointerStyle::Paintbrush:
             MAKE_CURSOR( paintbrush_ );
             break;
 
+        case PointerStyle::HideWhitespace:
+            MAKE_CURSOR( hidewhitespace_ );
+            break;
+        case PointerStyle::ShowWhitespace:
+            MAKE_CURSOR( showwhitespace_ );
+            break;
+
         default:
             OSL_FAIL("pointer not implemented");
             aCur = XCreateFontCursor( pDisp_, XC_arrow );
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index d6f7158..694d057 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -474,6 +474,9 @@ GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle )
             // #i20119#
             MAKE_CURSOR( PointerStyle::Paintbrush, paintbrush_ );
 
+            MAKE_CURSOR( PointerStyle::HideWhitespace, hidewhitespace_ );
+            MAKE_CURSOR( PointerStyle::ShowWhitespace, showwhitespace_ );
+
         default:
             SAL_WARN( "vcl.gtk", "pointer " << static_cast<int>(ePointerStyle) << "not implemented" );
             break;
diff --git a/vcl/win/source/src/salsrc.rc b/vcl/win/source/src/salsrc.rc
index 2084bc1..c45935c 100644
--- a/vcl/win/source/src/salsrc.rc
+++ b/vcl/win/source/src/salsrc.rc
@@ -83,6 +83,8 @@ SAL_RESID_POINTER_TAB_SELECT_SE         CURSOR          tblselse.cur
 SAL_RESID_POINTER_TAB_SELECT_W          CURSOR          tblselw.cur
 SAL_RESID_POINTER_TAB_SELECT_SW         CURSOR          tblselsw.cur
 SAL_RESID_POINTER_PAINTBRUSH            CURSOR          pntbrsh.cur
+SAL_RESID_POINTER_HIDEWHITESPACE        CURSOR          wshide.cur
+SAL_RESID_POINTER_SHOWWHITESPACE        CURSOR          wsshow.cur
 
 SAL_RESID_BITMAP_50                     BITMAP          "50.bmp"
 
diff --git a/vcl/win/source/src/wshide.cur b/vcl/win/source/src/wshide.cur
new file mode 100644
index 0000000..bfa8fdf
Binary files /dev/null and b/vcl/win/source/src/wshide.cur differ
diff --git a/vcl/win/source/src/wsshow.cur b/vcl/win/source/src/wsshow.cur
new file mode 100644
index 0000000..e0c2106
Binary files /dev/null and b/vcl/win/source/src/wsshow.cur differ
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 3a61bc2..3ac3f8f 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2156,8 +2156,10 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle )
     { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW },      // POINTER_TAB_SELECT_SW
 
      // #i20119#
-    { 0, 0, SAL_RESID_POINTER_PAINTBRUSH }          // POINTER_PAINTBRUSH
+    { 0, 0, SAL_RESID_POINTER_PAINTBRUSH },         // POINTER_PAINTBRUSH
 
+    { 0, 0, SAL_RESID_POINTER_HIDEWHITESPACE },     // POINTER_HIDEWHITESPACE
+    { 0, 0, SAL_RESID_POINTER_SHOWWHITESPACE }      // POINTER_UNHIDEWHITESPACE
     };
 
     // Mousepointer loaded ?


More information about the Libreoffice-commits mailing list