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 | |
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>
32 files changed, 301 insertions, 59 deletions
diff --git a/include/vcl/ptrstyle.hxx b/include/vcl/ptrstyle.hxx index d63d44b55a5a..996caf5f6078 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 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 ); diff --git a/vcl/inc/unx/x11_cursors/salcursors.h b/vcl/inc/unx/x11_cursors/salcursors.h index 5eb74e661c42..627352f9ef4c 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 000000000000..e8fd2723024c --- /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 000000000000..8547baa25183 --- /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 000000000000..56b705e69796 --- /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 000000000000..2da7aea99094 --- /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 acc0f4381f38..e5a0e1835a56 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 Binary files differnew file mode 100644 index 000000000000..0195b91cdb39 --- /dev/null +++ b/vcl/osx/res/cursors/wshide.png diff --git a/vcl/osx/res/cursors/wsshow.png b/vcl/osx/res/cursors/wsshow.png Binary files differnew file mode 100644 index 000000000000..fe374643eb20 --- /dev/null +++ b/vcl/osx/res/cursors/wsshow.png diff --git a/vcl/osx/saldata.cxx b/vcl/osx/saldata.cxx index 1dff45e2aee5..ea89aa5502ba 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 4b47eda86841..ee6a1b892f6b 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 d6f71589de51..694d057fdc4a 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 2084bc13609f..c45935c59594 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 Binary files differnew file mode 100644 index 000000000000..bfa8fdfdbac0 --- /dev/null +++ b/vcl/win/source/src/wshide.cur diff --git a/vcl/win/source/src/wsshow.cur b/vcl/win/source/src/wsshow.cur Binary files differnew file mode 100644 index 000000000000..e0c21060344d --- /dev/null +++ b/vcl/win/source/src/wsshow.cur diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 3a61bc2e1338..3ac3f8f3c6ec 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 ? |