[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 10 commits - filter/source include/vcl offapi/com offapi/type_reference officecfg/registry sw/inc sw/sdi sw/source sw/uiconfig vcl/inc vcl/osx vcl/unx vcl/win
Miklos Vajna
vmiklos at collabora.co.uk
Wed Nov 18 03:43:41 PST 2015
filter/source/pdf/pdfexport.cxx | 27 +
include/vcl/ptrstyle.hxx | 4
offapi/com/sun/star/text/ViewSettings.idl | 4
offapi/type_reference/offapi.idl | 1
officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 5
sw/inc/cmdid.h | 1
sw/inc/docsh.hxx | 2
sw/inc/swtypes.hxx | 11
sw/inc/unoprnms.hxx | 1
sw/inc/viewopt.hxx | 28 +
sw/inc/viewsh.hxx | 9
sw/sdi/_viewsh.sdi | 7
sw/sdi/swriter.sdi | 26 +
sw/source/core/inc/pagefrm.hxx | 4
sw/source/core/inc/rootfrm.hxx | 9
sw/source/core/inc/sectfrm.hxx | 11
sw/source/core/layout/calcmove.cxx | 179 ++++++----
sw/source/core/layout/findfrm.cxx | 41 ++
sw/source/core/layout/hffrm.cxx | 4
sw/source/core/layout/layact.cxx | 5
sw/source/core/layout/pagechg.cxx | 29 +
sw/source/core/layout/paintfrm.cxx | 7
sw/source/core/layout/sectfrm.cxx | 25 -
sw/source/core/layout/ssfrm.cxx | 2
sw/source/core/layout/wsfrm.cxx | 27 +
sw/source/core/text/frmform.cxx | 2
sw/source/core/view/viewsh.cxx | 40 +-
sw/source/core/view/vprint.cxx | 2
sw/source/uibase/app/docsh2.cxx | 60 +--
sw/source/uibase/docvw/edtwin.cxx | 56 ++-
sw/source/uibase/uiview/pview.cxx | 1
sw/source/uibase/uiview/view0.cxx | 24 +
sw/source/uibase/uiview/view2.cxx | 4
sw/source/uibase/uiview/viewport.cxx | 4
sw/source/uibase/uno/unomod.cxx | 49 +-
sw/source/uibase/uno/unotxdoc.cxx | 4
sw/source/uibase/utlui/unotools.cxx | 1
sw/uiconfig/swriter/menubar/menubar.xml | 1
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
53 files changed, 650 insertions(+), 229 deletions(-)
New commits:
commit a60c0d7990a8361f467c9f635a1c2461dde7d639
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 18 09:33:55 2015 +0100
tdf#95888 sw: make click to header area show header controls again
Regression from commit 54a2c8c006e2f216e9d8c6b0ed625180c843c48b
(tdf#39080 Interactive hide-whitespace mode, 2015-08-30), the problem
was that SwPageFrm::IsOverHeaderFooterArea() checked if the header is
active before accepting that the user clicked in that area.
Don't require an active header at least in non-hide-whitespace mode, as
the member function is used in the "could there be a header here" sense
in SwEditWin::MouseButtonDown() to show the controls that allows
actually adding a header.
Change-Id: I6f905920113aed1512e333e718a8f26d88a3245d
(cherry picked from commit a23f85f171634732359fc7e4d932a6ff11905c9a)
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index cf4e7d1..250a9f6 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2254,9 +2254,11 @@ bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rCon
SwRect aHeaderArea( Frm().TopLeft(),
Size( Frm().Width(), nUpperLimit - Frm().Top() ) );
+ SwViewShell* pViewShell = getRootFrm()->GetCurrShell();
+ bool bHideWhitespaceMode = pViewShell->GetViewOptions()->IsHideWhitespaceMode();
if ( aHeaderArea.IsInside( rPt ) )
{
- if (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetHeader().IsActive())
+ if (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetHeader().IsActive() || !bHideWhitespaceMode)
{
rControl = Header;
return true;
@@ -2268,7 +2270,7 @@ bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rCon
Size( Frm().Width(), Frm().Bottom() - nLowerLimit ) );
if ( aFooterArea.IsInside( rPt ) &&
- static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetFooter().IsActive() )
+ (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetFooter().IsActive() || !bHideWhitespaceMode) )
{
rControl = Footer;
return true;
commit 7ffb53497fc05f8e0ea367780be076193263292a
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date: Sun Nov 1 16:33:36 2015 -0500
SwPageFrm::MakeAll Refactored
Browser and Hide Whitespace page height now use
SwPageFrm::GetContentHeight, which is const.
A few improvements are done for both paths as well.
Reviewed-on: https://gerrit.libreoffice.org/19730
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>
(cherry picked from commit f05da45c9c69e66cd5f26fc02c950ccf0c0b946d)
Conflicts:
sw/source/core/layout/calcmove.cxx
Change-Id: I73a8e920ccfa96d76cbbb002bed6a85f2e636ede
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index e19012d..8afa92b 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -111,7 +111,7 @@ protected:
virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
/// Calculate the content height of a page (without columns).
- size_t GetContentHeight();
+ size_t GetContentHeight(const long nTop, const long nBottom) const;
public:
DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 668578a..5e1aeae 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -118,15 +118,20 @@ public:
bool CalcMinDiff( SwTwips& rMinDiff ) const;
/**
- * If we don't pass a @param bOverSize or false, the return value is > 0 for
- * undersized Frames, or 0
+ * Returns the size delta that the section would like to be
+ * greater if it has undersized TextFrms in it.
*
+ * If we don't pass a @param bOverSize or false, the return value
+ * is > 0 for undersized Frames, or 0 otherwise.
* If @param bOverSize == true, we can also get a negative return value,
* if the SectionFrm is not completely filled, which happens often for
* e.g. SectionFrms with Follows.
+ *
+ * If necessary the undersized-flag is corrected.
* We need this in the FormatWidthCols to "deflate" columns there.
*/
- long Undersize( bool bOverSize = false );
+ SwTwips Undersize(bool bOverSize = false);
+ SwTwips Undersize() const;
/// Adapt size to surroundings
void _CheckClipping( bool bGrow, bool bMaximize );
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 34cd281..0820e38 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -636,27 +636,37 @@ static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, const SwFrm* pFrm, long
rBot = std::max( rBot, nMax );
}
-//TODO: This should really be const, but Undersize modifies the flag.
-size_t SwPageFrm::GetContentHeight()
+size_t SwPageFrm::GetContentHeight(const long nTop, const long nBottom) const
{
+ OSL_ENSURE(!(FindBodyCont() && FindBodyCont()->Lower() && FindBodyCont()->Lower()->IsColumnFrm()),
+ "SwPageFrm::GetContentHeight(): No support for columns.");
+
// In pages without columns, the content defines the size.
- long nBot = Frm().Top();
- SwFrm *pFrm = Lower();
+ long nBot = Frm().Top() + nTop;
+ const SwFrm *pFrm = Lower();
while (pFrm)
{
long nTmp = 0;
- SwFrm *pCnt = static_cast<SwLayoutFrm*>(pFrm)->ContainsAny();
+ const SwFrm *pCnt = static_cast<const SwLayoutFrm*>(pFrm)->ContainsAny();
while (pCnt && (pCnt->GetUpper() == pFrm ||
- static_cast<SwLayoutFrm*>(pFrm)->IsAnLower(pCnt)))
+ static_cast<const SwLayoutFrm*>(pFrm)->IsAnLower(pCnt)))
{
nTmp += pCnt->Frm().Height();
if (pCnt->IsTextFrm() &&
- static_cast<SwTextFrm*>(pCnt)->IsUndersized())
- nTmp += static_cast<SwTextFrm*>(pCnt)->GetParHeight()
- - pCnt->Prt().Height();
- else if (pCnt->IsSctFrm() &&
- static_cast<SwSectionFrm*>(pCnt)->IsUndersized())
- nTmp += static_cast<SwSectionFrm*>(pCnt)->Undersize();
+ static_cast<const SwTextFrm*>(pCnt)->IsUndersized())
+ {
+ // This TextFrm would like to be a bit bigger.
+ nTmp += static_cast<const SwTextFrm*>(pCnt)->GetParHeight()
+ - pCnt->Prt().Height();
+ }
+ else if (pCnt->IsSctFrm())
+ {
+ // Grow if undersized, but don't shrink if oversized.
+ const auto delta = static_cast<const SwSectionFrm*>(pCnt)->Undersize();
+ if (delta > 0)
+ nTmp += delta;
+ }
+
pCnt = pCnt->FindNext();
}
// OD 29.10.2002 #97265# - consider invalid body frame properties
@@ -685,7 +695,7 @@ size_t SwPageFrm::GetContentHeight()
lcl_CheckObjects(pSortedObjs, pFrm, nBot);
pFrm = pFrm->GetNext();
}
-
+ nBot += nBottom;
// And the page anchored ones
if (pSortedObjs)
lcl_CheckObjects(pSortedObjs, this, nBot);
@@ -721,23 +731,25 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
}
else
{
- if ( !pAccess )
+ if (!pAccess)
{
pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
pAttrs = pAccess->Get();
}
assert(pAttrs);
- // In BrowseView, we use fixed settings
+
SwViewShell *pSh = getRootFrm()->GetCurrShell();
- if ( pSh && pSh->GetViewOptions()->getBrowseMode() )
+ if (pSh && pSh->GetViewOptions()->getBrowseMode())
{
+ // In BrowseView, we use fixed settings
const Size aBorder = pRenderContext->PixelToLogic( pSh->GetBrowseBorder() );
const long nTop = pAttrs->CalcTopLine() + aBorder.Height();
const long nBottom = pAttrs->CalcBottomLine()+ aBorder.Height();
long nWidth = GetUpper() ? static_cast<SwRootFrm*>(GetUpper())->GetBrowseWidth() : 0;
- if ( nWidth < pSh->GetBrowseWidth() )
- nWidth = pSh->GetBrowseWidth();
+ const auto nDefWidth = pSh->GetBrowseWidth();
+ if (nWidth < nDefWidth)
+ nWidth = nDefWidth;
nWidth += + 2 * aBorder.Width();
nWidth = std::max( nWidth, 2L * aBorder.Width() + 4L*MM50 );
@@ -752,56 +764,8 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
else
{
// In pages without columns, the content defines the size.
- long nBot = Frm().Top() + nTop;
- SwFrm *pFrm = Lower();
- while ( pFrm )
- {
- long nTmp = 0;
- SwFrm *pCnt = static_cast<SwLayoutFrm*>(pFrm)->ContainsAny();
- while ( pCnt && (pCnt->GetUpper() == pFrm ||
- static_cast<SwLayoutFrm*>(pFrm)->IsAnLower( pCnt )))
- {
- nTmp += pCnt->Frm().Height();
- if( pCnt->IsTextFrm() &&
- static_cast<SwTextFrm*>(pCnt)->IsUndersized() )
- nTmp += static_cast<SwTextFrm*>(pCnt)->GetParHeight()
- - pCnt->Prt().Height();
- else if( pCnt->IsSctFrm() &&
- static_cast<SwSectionFrm*>(pCnt)->IsUndersized() )
- nTmp += static_cast<SwSectionFrm*>(pCnt)->Undersize();
- pCnt = pCnt->FindNext();
- }
- // OD 29.10.2002 #97265# - consider invalid body frame properties
- if ( pFrm->IsBodyFrm() &&
- ( !pFrm->GetValidSizeFlag() ||
- !pFrm->GetValidPrtAreaFlag() ) &&
- ( pFrm->Frm().Height() < pFrm->Prt().Height() )
- )
- {
- nTmp = std::min( nTmp, pFrm->Frm().Height() );
- }
- else
- {
- // OD 30.10.2002 #97265# - assert invalid lower property
- OSL_ENSURE( !(pFrm->Frm().Height() < pFrm->Prt().Height()),
- "SwPageFrm::MakeAll(): Lower with frame height < printing height" );
- nTmp += pFrm->Frm().Height() - pFrm->Prt().Height();
- }
- if ( !pFrm->IsBodyFrm() )
- nTmp = std::min( nTmp, pFrm->Frm().Height() );
- nBot += nTmp;
- // Here we check whether paragraph anchored objects
- // protrude outside the Body/FootnoteCont.
- if( pSortedObjs && !pFrm->IsHeaderFrm() &&
- !pFrm->IsFooterFrm() )
- lcl_CheckObjects( pSortedObjs, pFrm, nBot );
- pFrm = pFrm->GetNext();
- }
- nBot += nBottom;
- // And the page anchored ones
- if ( pSortedObjs )
- lcl_CheckObjects( pSortedObjs, this, nBot );
- nBot -= Frm().Top();
+ long nBot = GetContentHeight(nTop, nBottom);
+
// #i35143# - If second page frame
// exists, the first page doesn't have to fulfill the
// visible area.
@@ -819,10 +783,11 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
+ pAttrs->CalcRightLine() + aBorder.Width() ) );
Prt().Height( Frm().Height() - (nTop + nBottom) );
mbValidSize = mbValidPrtArea = true;
+ continue;
}
else if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
{
- auto height = Frm().Height();
+ long height = 0;
SwLayoutFrm *pBody = FindBodyCont();
if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
{
@@ -831,7 +796,8 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
}
else
{
- height = GetContentHeight();
+ // No need for borders.
+ height = GetContentHeight(0, 0);
}
if (height > 0)
@@ -841,24 +807,19 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
Prt().Height(height);
mbValidSize = mbValidPrtArea = true;
+ continue;
}
- else
- {
- // Fallback to default formatting.
- // This is especially relevant when
- // loading a doc with Hide Whitespace
- // is enabled--frame heights are zero.
- Frm().SSize(pAttrs->GetSize());
- Format(pRenderContext, pAttrs);
- }
- }
- 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 );
+
+ // Fallback to default formatting. Especially relevant
+ // when loading a doc when Hide Whitespace is enabled.
+ // Heights are zero initially.
}
+
+ // 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 );
}
}
} //while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
@@ -1171,8 +1132,8 @@ void SwContentFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/)
bool bMovedBwd = false;
// as long as bMovedFwd is false, the Frm may flow backwards (until
// it has been moved forward once)
- bool bMovedFwd = false;
- sal_Bool bFormatted = sal_False; // For the widow/orphan rules, we encourage the
+ bool bMovedFwd = false;
+ sal_Bool bFormatted = sal_False; // For the widow/orphan rules, we encourage the
// last ContentFrm of a chain to format. This only
// needs to happen once. Every time the Frm is
// moved, the flag will have to be reset.
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index bef77ba..250d6e1 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2491,21 +2491,18 @@ void SwSectionFrm::InvalidateFootnotePos()
}
}
-/** Returns the value that the section would like to be
- * greater if it has undersized TextFrms in it,
- * otherwise Null.
- * If necessary the undersized-flag is corrected.
- */
-long SwSectionFrm::Undersize( bool bOverSize )
+SwTwips SwSectionFrm::Undersize() const
{
- m_bUndersized = false;
- SWRECTFN( this )
- long nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)();
- if( nRet > 0 )
- m_bUndersized = true;
- else if( !bOverSize )
- nRet = 0;
- return nRet;
+ SWRECTFN(this);
+ return InnerHeight() - (Prt().*fnRect->fnGetHeight)();
+}
+
+SwTwips SwSectionFrm::Undersize(bool bOverSize)
+{
+ SWRECTFN(this);
+ const auto nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)();
+ m_bUndersized = (nRet > 0);
+ return (nRet <= 0 && !bOverSize) ? 0 : nRet;
}
void SwSectionFrm::CalcFootnoteContent()
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 616fa26..9eed78e 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2938,7 +2938,7 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight(this);
const sal_uInt16 nLower = pAttrs->CalcBottom();
- bool bVert = IsVertical() && !IsPageFrm();
+ const bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
if ( !mbValidPrtArea )
{
commit 98195b6dbdf55d4b32191eef692d6cdb50aae726
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Nov 6 09:18:32 2015 +0000
coverity#1338232 Explicit null dereferenced
Change-Id: I4be589325b89eac129328f98f9db7ce8c741892d
(cherry picked from commit 705c0edcf4de6159b0744dc98b61d7c03df82ddd)
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 2d95050..34cd281 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -726,6 +726,7 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
pAttrs = pAccess->Get();
}
+ assert(pAttrs);
// In BrowseView, we use fixed settings
SwViewShell *pSh = getRootFrm()->GetCurrShell();
if ( pSh && pSh->GetViewOptions()->getBrowseMode() )
commit 7069ef9bda60ff3889bce9fd20f62e9abea68b60
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date: Fri Oct 30 13:58:47 2015 -0400
tdf#39080 Hide Whitespace improvements
Moved the page resizing from SwLayoutFrm::Format to
SwPageFrm::MakeAll and calculated the new page height
more accurately based on the content (stolen from
the browser-mode height calculation, to be refactored).
This fixes issues with repagination with certain contents.
Removed unnecessary ToggleLayoutMode calls and
prevented clicking between pages in single-view
mode to jump the cursor.
Reviewed-on: https://gerrit.libreoffice.org/19699
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>
(cherry picked from commit 40f3a942448facb900b422d30f64b75d7cac7f0f)
[ Miklos Vajna: adapted to build with non-prefixed SwPageFrm. ]
Change-Id: I5662dd26efff66d6e95b8fd4dcf8564588adbbb7
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index a0662a1..e19012d 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -110,6 +110,9 @@ protected:
virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
virtual void SwClientNotify(const SwModify&, const SfxHint&) SAL_OVERRIDE;
+ /// Calculate the content height of a page (without columns).
+ size_t GetContentHeight();
+
public:
DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index b539a74..2d95050 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -606,7 +606,7 @@ void SwFrm::MakePos()
}
// #i28701# - new type <SwSortedObjs>
-static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, SwFrm* pFrm, long& rBot )
+static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, const SwFrm* pFrm, long& rBot )
{
// And then there can be paragraph anchored frames that sit below their paragraph.
long nMax = 0;
@@ -636,6 +636,64 @@ static void lcl_CheckObjects( SwSortedObjs* pSortedObjs, SwFrm* pFrm, long& rBot
rBot = std::max( rBot, nMax );
}
+//TODO: This should really be const, but Undersize modifies the flag.
+size_t SwPageFrm::GetContentHeight()
+{
+ // In pages without columns, the content defines the size.
+ long nBot = Frm().Top();
+ SwFrm *pFrm = Lower();
+ while (pFrm)
+ {
+ long nTmp = 0;
+ SwFrm *pCnt = static_cast<SwLayoutFrm*>(pFrm)->ContainsAny();
+ while (pCnt && (pCnt->GetUpper() == pFrm ||
+ static_cast<SwLayoutFrm*>(pFrm)->IsAnLower(pCnt)))
+ {
+ nTmp += pCnt->Frm().Height();
+ if (pCnt->IsTextFrm() &&
+ static_cast<SwTextFrm*>(pCnt)->IsUndersized())
+ nTmp += static_cast<SwTextFrm*>(pCnt)->GetParHeight()
+ - pCnt->Prt().Height();
+ else if (pCnt->IsSctFrm() &&
+ static_cast<SwSectionFrm*>(pCnt)->IsUndersized())
+ nTmp += static_cast<SwSectionFrm*>(pCnt)->Undersize();
+ pCnt = pCnt->FindNext();
+ }
+ // OD 29.10.2002 #97265# - consider invalid body frame properties
+ if (pFrm->IsBodyFrm() &&
+ (!pFrm->GetValidSizeFlag() ||
+ !pFrm->GetValidPrtAreaFlag()) &&
+ (pFrm->Frm().Height() < pFrm->Prt().Height())
+ )
+ {
+ nTmp = std::min(nTmp, pFrm->Frm().Height());
+ }
+ else
+ {
+ // OD 30.10.2002 #97265# - assert invalid lower property
+ OSL_ENSURE(!(pFrm->Frm().Height() < pFrm->Prt().Height()),
+ "SwPageFrm::GetContentHeight(): Lower with frame height < printing height");
+ nTmp += pFrm->Frm().Height() - pFrm->Prt().Height();
+ }
+ if (!pFrm->IsBodyFrm())
+ nTmp = std::min(nTmp, pFrm->Frm().Height());
+ nBot += nTmp;
+ // Here we check whether paragraph anchored objects
+ // protrude outside the Body/FootnoteCont.
+ if (pSortedObjs && !pFrm->IsHeaderFrm() &&
+ !pFrm->IsFooterFrm())
+ lcl_CheckObjects(pSortedObjs, pFrm, nBot);
+ pFrm = pFrm->GetNext();
+ }
+
+ // And the page anchored ones
+ if (pSortedObjs)
+ lcl_CheckObjects(pSortedObjs, this, nBot);
+ nBot -= Frm().Top();
+
+ return nBot;
+}
+
void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
{
PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
@@ -761,6 +819,38 @@ void SwPageFrm::MakeAll(vcl::RenderContext* pRenderContext)
Prt().Height( Frm().Height() - (nTop + nBottom) );
mbValidSize = mbValidPrtArea = true;
}
+ else if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
+ {
+ auto height = Frm().Height();
+ SwLayoutFrm *pBody = FindBodyCont();
+ if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
+ {
+ // Columns have a fixed height
+ height = pAttrs->GetSize().Height();
+ }
+ else
+ {
+ height = GetContentHeight();
+ }
+
+ if (height > 0)
+ {
+ ChgSize(Size(Frm().Width(), height));
+ Prt().Top(0);
+ Prt().Height(height);
+
+ mbValidSize = mbValidPrtArea = true;
+ }
+ else
+ {
+ // Fallback to default formatting.
+ // This is especially relevant when
+ // loading a doc with Hide Whitespace
+ // is enabled--frame heights are zero.
+ Frm().SSize(pAttrs->GetSize());
+ Format(pRenderContext, pAttrs);
+ }
+ }
else
{ // Set FixSize. For pages, this is not done from Upper, but from
// the attribute.
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index a50a957..616fa26 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2932,14 +2932,11 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
if ( mbValidPrtArea && mbValidSize )
return;
- SwViewShell *pSh = getRootFrm()->GetCurrShell();
- const bool hideWS = (pSh && pSh->GetViewOptions()->IsWhitespaceHidden());
- const long hideWSBorderSize = (pSh ? pSh->GetViewOptions()->GetDocumentBorder() : 0);
const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft(this);
- const sal_uInt16 nUpper = hideWS ? hideWSBorderSize : pAttrs->CalcTop();
+ const sal_uInt16 nUpper = pAttrs->CalcTop();
const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight(this);
- const sal_uInt16 nLower = hideWS ? hideWSBorderSize : pAttrs->CalcBottom();
+ const sal_uInt16 nLower = pAttrs->CalcBottom();
bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
@@ -3008,12 +3005,6 @@ 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;
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index f05cf37..49d6245 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2899,14 +2899,17 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
}
// Toggle Hide-Whitespace if between pages.
- if (_rMEvt.GetClicks() >= 2 &&
- rSh.GetViewOptions()->CanHideWhitespace() &&
+ if (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 (_rMEvt.GetClicks() >= 2)
+ {
+ SwViewOption aOpt(*rSh.GetViewOptions());
+ aOpt.SetHideWhitespaceMode(!aOpt.IsHideWhitespaceMode());
+ rSh.ApplyViewOptions(aOpt);
+ }
+
+ return;
}
}
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index 2f2d835..b3240cd 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -369,7 +369,6 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
int eState = STATE_TOGGLE;
bool bSet = false;
bool bBrowseModeChanged = false;
- bool bHideWhitespaceModeChanged = false;
const SfxItemSet *pArgs = rReq.GetArgs();
sal_uInt16 nSlot = rReq.GetSlot();
@@ -455,7 +454,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
case FN_VIEW_HIDE_WHITESPACE:
if ( STATE_TOGGLE == eState )
bFlag = !pOpt->IsHideWhitespaceMode();
- bHideWhitespaceModeChanged = (bFlag != pOpt->IsHideWhitespaceMode());
+
pOpt->SetHideWhitespaceMode(bFlag);
break;
@@ -579,7 +578,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
if( !(*rSh.GetViewOptions() == *pOpt ))
{
rSh.ApplyViewOptions( *pOpt );
- if( bBrowseModeChanged || bHideWhitespaceModeChanged )
+ if( bBrowseModeChanged )
{
GetDocShell()->ToggleLayoutMode(this);
}
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index fa68df4..3c98a32 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -736,8 +736,6 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
// must be set in mpViewOption as this will overwrite settings in _post!
if(mpViewOption)
mpViewOption->SetHideWhitespaceMode(bVal);
-
- pView->GetDocShell()->ToggleLayoutMode(pView);
}
}
}
commit 3dfdf8c1fe3d0cc1e2164803cf8dedaf4f9ec420
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 10 21:05:34 2015 +0100
coverity#1323757 Dereference before null check
Change-Id: I5353b78b6961d28fb3f42e5f2073e9a83ac1037c
(cherry picked from commit 13fdf04f6594c74f20c78f814c428f893fab9f64)
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 8c75ef9..fa68df4 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -706,33 +706,39 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
break;
case HANDLE_VIEWSET_ONLINE_LAYOUT :
{
- SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
- if (pView && !bVal != !aOpt.getBrowseMode())
+ if ( pView )
{
- aOpt.setBrowseMode( bVal );
- pView->GetWrtShell().ApplyViewOptions( aOpt );
+ SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
+ if (!bVal != !aOpt.getBrowseMode())
+ {
+ aOpt.setBrowseMode( bVal );
+ pView->GetWrtShell().ApplyViewOptions( aOpt );
- // must be set in mpViewOption as this will overwrite settings in _post!
- if(mpViewOption)
- mpViewOption->setBrowseMode(bVal);
+ // must be set in mpViewOption as this will overwrite settings in _post!
+ if(mpViewOption)
+ mpViewOption->setBrowseMode(bVal);
- pView->GetDocShell()->ToggleLayoutMode(pView);
+ pView->GetDocShell()->ToggleLayoutMode(pView);
+ }
}
}
break;
case HANDLE_VIEWSET_HIDE_WHITESPACE:
{
- SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
- if (pView && !bVal != !aOpt.IsHideWhitespaceMode())
+ if ( pView )
{
- aOpt.SetHideWhitespaceMode( bVal );
- pView->GetWrtShell().ApplyViewOptions( aOpt );
+ SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
+ if (!bVal != !aOpt.IsHideWhitespaceMode())
+ {
+ aOpt.SetHideWhitespaceMode( bVal );
+ pView->GetWrtShell().ApplyViewOptions( aOpt );
- // must be set in mpViewOption as this will overwrite settings in _post!
- if(mpViewOption)
- mpViewOption->SetHideWhitespaceMode(bVal);
+ // must be set in mpViewOption as this will overwrite settings in _post!
+ if(mpViewOption)
+ mpViewOption->SetHideWhitespaceMode(bVal);
- pView->GetDocShell()->ToggleLayoutMode(pView);
+ pView->GetDocShell()->ToggleLayoutMode(pView);
+ }
}
}
break;
commit f3f095576cee05785cd0fa44c7b2dc9b753d0226
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>
(cherry picked from commit 54a2c8c006e2f216e9d8c6b0ed625180c843c48b)
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 498fb0b..6672d28 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 e7b2b00..3d42a3b 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -374,11 +374,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; }
@@ -407,6 +407,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 45c3989..a0662a1 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -329,6 +329,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 e5ca715..6b2ea41 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 6b4d8cb..b539a74 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 18189ba..cfcf6e1 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()
@@ -582,6 +583,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 a5789fe..cacc468 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -680,7 +680,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
@@ -723,7 +723,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 c535bd2..cf4e7d1 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -67,9 +67,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.
@@ -596,7 +596,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
@@ -2256,15 +2256,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 77f7c49..9e05777 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -114,7 +114,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 a29b09e..e14ecd7 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 0ecf0e6..a50a957 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 09de3d8..6006cd4 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1102,7 +1102,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 db92f8d..23a7b59 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1943,7 +1943,7 @@ sal_Int32 SwViewShell::GetBrowseWidth() const
void SwViewShell::InvalidateLayout( bool bSizeChanged )
{
if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() &&
- !GetViewOptions()->IsHideWhitespaceMode() )
+ !GetViewOptions()->IsWhitespaceHidden() )
return;
SET_CURR_SHELL( this );
@@ -2128,7 +2128,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
pMyWin->SetMapMode( aMode );
// if not a reference device (printer) is used for formatting,
// but the screen, new formatting is needed for zoomfactor changes.
- if (mpOpt->getBrowseMode() || mpOpt->IsHideWhitespaceMode())
+ if (mpOpt->getBrowseMode() || mpOpt->IsWhitespaceHidden())
bReformat = true;
}
@@ -2142,10 +2142,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 07d707b..f05cf37 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -588,6 +588,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 );
}
@@ -2836,23 +2845,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
{
@@ -2883,6 +2897,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 81825c2..2f2d835 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -305,7 +305,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 12d157a..750fd20 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2560,7 +2560,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 7008011..9c35714 100644
--- a/vcl/osx/saldata.cxx
+++ b/vcl/osx/saldata.cxx
@@ -207,7 +207,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 ff71bc6..1ad2c81 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 2d8e26c..57a8ece 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -471,6 +471,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 07505d4..62a0cf6 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2161,8 +2161,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 ?
commit 45b8db1b1e74b93864d712e1f8576142abdaf3e4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 3 10:13:53 2015 +0100
duplicate HANDLE_VIEWSET_HIDE_WHITESPACE handling
Change-Id: Id34ae93ccbb020f09c608f34e5f41a8622cf1607
(cherry picked from commit f7bc163ca4f643b6f046892de6d99ec8049b6955)
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 9029ea4..8c75ef9 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -58,7 +58,6 @@ enum SwViewSettingsPropertyHandles
HANDLE_VIEWSET_HIDDEN_CHARACTERS,
HANDLE_VIEWSET_HIDDEN_PARAGRAPHS,
HANDLE_VIEWSET_HIDDEN_TEXT,
- HANDLE_VIEWSET_HIDE_WHITESPACE,
HANDLE_VIEWSET_HRULER,
HANDLE_VIEWSET_HSCROLL,
HANDLE_VIEWSET_INDEX_MARK_BACKGROUND,
@@ -140,7 +139,6 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
{ OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
- { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 },
{ OUString( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
{ OUString( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, cppu::UnoType<bool>::get(),PROPERTY_NONE, 0},
@@ -621,7 +619,6 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(bVal); break;
case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(bVal); break;
case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(bVal); break;
- case HANDLE_VIEWSET_HIDE_WHITESPACE: mpViewOption->SetHideWhitespaceMode(bVal); break;
case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(bVal); break;
case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(bVal); break;
case HANDLE_VIEWSET_TABLE_BOUNDARIES : SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bVal, true); break;
@@ -866,7 +863,6 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(true); break;
case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(true); break;
case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
- case HANDLE_VIEWSET_HIDE_WHITESPACE: bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break;
case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
commit d8bc8f1d6bd9d84d624d1a21955ed5fbf96f80e3
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date: Sat Aug 29 21:02:39 2015 -0400
tdf#39080 Hide white space between pages in 'print layout'
Merged Hide Whitespace with Browser Mode and hooked
the former with the UI. In Hide Whitespace mode
the headers and footers are removed and
page margins as well as between-page gaps are
reduced to minimum.
In single-page view the side margins are left
as-is. In multi-page and book-view the sides
are removed, however, they have twice the
width of the top and bottom.
Printing and PDF export disable this mode.
The usable screen real-estate is greatly
improved in this mode, which is controlled
from the View menu.
Change-Id: I2d0075ae9a76162c26c78e9eb23a71920cdfc522
Reviewed-on: https://gerrit.libreoffice.org/17281
Reviewed-by: Jean-Baptiste Faure <jbfaure at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 2b8e62f7b6e0a45a9ff1ec530b2e941f3fbcf1a0)
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 7c065a4..045b0bd 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -844,10 +844,12 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aSelection = Any();
aSelection <<= mxSrcDoc;
}
- bool bSecondPassForImpressNotes = false;
+ bool bSecondPassForImpressNotes = false;
bool bReChangeToNormalView = false;
- OUString sShowOnlineLayout( "ShowOnlineLayout" );
- uno::Reference< beans::XPropertySet > xViewProperties;
+ const OUString sShowOnlineLayout( "ShowOnlineLayout" );
+ bool bReHideWhitespace = false;
+ const OUString sHideWhitespace("HideWhitespace");
+ uno::Reference< beans::XPropertySet > xViewProperties;
if ( aCreator == "Writer" )
{
@@ -855,12 +857,19 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
try
{
Reference< view::XViewSettingsSupplier > xVSettingsSupplier( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xViewProperties = xVSettingsSupplier->getViewSettings();
+ xViewProperties = xVSettingsSupplier->getViewSettings();
xViewProperties->getPropertyValue( sShowOnlineLayout ) >>= bReChangeToNormalView;
if( bReChangeToNormalView )
{
xViewProperties->setPropertyValue( sShowOnlineLayout, uno::makeAny( false ) );
}
+
+ // Also, disable hide-whitespace during export.
+ xViewProperties->getPropertyValue(sHideWhitespace) >>= bReHideWhitespace;
+ if (bReHideWhitespace)
+ {
+ xViewProperties->setPropertyValue(sHideWhitespace, uno::makeAny(false));
+ }
}
catch( const uno::Exception& )
{
@@ -930,6 +939,16 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
{
}
}
+ if( bReHideWhitespace )
+ {
+ try
+ {
+ xViewProperties->setPropertyValue( sHideWhitespace, uno::makeAny( true ) );
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
}
}
}
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index af0aed6..66b3a90 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -285,7 +285,7 @@ public:
sal_Int16 GetUpdateDocMode() const { return m_nUpdateDocMode; }
- void ToggleBrowserMode(bool bOn, SwView* pView);
+ void ToggleLayoutMode(SwView* pView);
sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt,
bool bUnoCall );
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index b724fbd..498fb0b 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -75,13 +75,13 @@ const SwTwips cMinHdFtHeight = 56;
// 28 Twips == 0,4mm
#define MIN_BORDER_DIST 28
-// Minimal document border.
+// Minimal document border: 20mm.
const SwTwips lMinBorder = 1134;
// Margin left and above document.
// Half of it is gap between the pages.
+//TODO: Replace with SwViewOption::GetDefDocumentBorder()
#define DOCUMENTBORDER 284L
-#define GAPBETWEENPAGES 284L
// Constant strings.
SW_DLLPUBLIC extern OUString aEmptyOUStr; // remove once aEmptyOUStr can be changed to OUString
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 87558cc..e7b2b00 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -130,18 +130,18 @@ class SW_DLLPUBLIC SwViewOption
protected:
static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
- OUString sSymbolFont; // Symbolfont.
+ OUString sSymbolFont; // Symbolfont.
sal_uInt32 nCoreOptions; // Bits for SwViewShell.
sal_uInt32 nCore2Options; // Bits for SwViewShell.
sal_uInt32 nUIOptions; // UI-Bits
Color aRetoucheColor; // DefaultBackground for BrowseView
Size aSnapSize; // Describes horizontal and vertical snap.
- sal_uInt16 mnViewLayoutColumns;// # columns for edit view
+ sal_uInt16 mnViewLayoutColumns;// # columns for edit view
short nDivisionX; // Grid division.
short nDivisionY;
- sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
- sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
- sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
+ sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
+ sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
+ sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
bool bReadonly : 1; // Readonly-Doc.
bool bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
bool bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
@@ -151,7 +151,7 @@ protected:
bool mbBookView : 1; // View mode for page preview.
bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
bool mbHideWhitespaceMode : 1; // Hide header, footer, and pagebreak.
- bool bShowPlaceHolderFields : 1; // Only used in printing!
+ bool bShowPlaceHolderFields : 1; // Only used in printing!
mutable bool bIdle;
// Scale
@@ -370,6 +370,16 @@ public:
inline short GetDivisionY() const { return nDivisionY; }
inline void SetDivisionY( short n ){ nDivisionY = n; }
+ // Default margin left and above document: 284 twips == 5.0 mm.
+ static SAL_CONSTEXPR sal_uInt16 GetDefDocumentBorder() { return 284; }
+ // Default gap between pages: 284 twips == 5.0 mm.
+ static SAL_CONSTEXPR sal_uInt16 GetDefGapBetweenPages() { return 284; }
+ // Minimum edge-to-text distance: 114 twips == 2.0 mm.
+ static SAL_CONSTEXPR sal_uInt16 GetMinGapBetweenPages() { return 114; }
+
+ inline sal_uInt16 GetDocumentBorder() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefDocumentBorder(); }
+ inline sal_uInt16 GetGapBetweenPages() const { return IsHideWhitespaceMode() ? GetMinGapBetweenPages() : GetDefGapBetweenPages(); }
+
inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
@@ -397,6 +407,9 @@ public:
bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode; }
void SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; }
+ bool IsMultipageView() const { return IsViewLayoutBookMode() ||
+ GetViewLayoutColumns() == 0; }
+
#ifdef DBG_UTIL
// Correspond to statements in ui/config/cfgvw.src.
inline bool IsTest1() const { return m_bTest1; }
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index eaa0bf9..c6b4401 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -499,11 +499,10 @@ public:
void SetFrameView( const Size& rBrowseBorder )
{ mbFrameView = true; maBrowseBorder = rBrowseBorder; }
- // Makes the necessary invalidations:
- // If BrowseMode has changed bBrowseChgd == true
- // or bBrowseChgd == false in BrowseMode
- // if proportions have changed.
- void CheckBrowseView( bool bBrowseChgd );
+ // Invalidates pages and contents.
+ // When bSizeChanged==true, adds/removes
+ // headers and footers as necessary.
+ void InvalidateLayout(bool bSizeChanged);
const Size& GetBrowseBorder() const;
sal_Int32 GetBrowseWidth() const;
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index ba9edb0..1e743a8 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1310,12 +1310,13 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrm *pLay,
// between pages (not only for in online mode).
if ( pLay->IsPageFrm() )
{
- const SwTwips nHalfDocBorder = GAPBETWEENPAGES;
+ const SwViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
+ const SwTwips nHalfDocBorder = pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
+ : SwViewOption::GetDefGapBetweenPages();
const bool bLeftToRightViewLayout = pRoot->IsLeftToRightViewLayout();
const bool bPrev = bLeftToRightViewLayout ? pLay->GetPrev() : pLay->GetNext();
const bool bNext = bLeftToRightViewLayout ? pLay->GetNext() : pLay->GetPrev();
SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
- const SwViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
SwRect aPageRect( pLay->Frm() );
if(pSh)
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 6e426b4..c535bd2 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1884,8 +1884,8 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
{
assert(pViewOpt && "CheckViewLayout required ViewOptions");
- const sal_uInt16 nColumns = pViewOpt->GetViewLayoutColumns();
- const bool bBookMode = pViewOpt->IsViewLayoutBookMode();
+ const sal_uInt16 nColumns = pViewOpt->GetViewLayoutColumns();
+ const bool bBookMode = pViewOpt->IsViewLayoutBookMode();
if ( nColumns == mnColumns && bBookMode == mbBookMode && pVisArea->Width() == mnViewWidth && !mbSidebarChanged )
return;
@@ -1911,7 +1911,10 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
const long nBorder = Frm().Pos().getX();
const long nVisWidth = mnViewWidth - 2 * nBorder;
- const long nGapBetweenPages = GAPBETWEENPAGES;
+ SwViewShell* pSh = GetCurrShell();
+ const long nGapBetweenPages = pViewOpt ? pViewOpt->GetGapBetweenPages()
+ : (pSh ? pSh->GetViewOptions()->GetGapBetweenPages()
+ : SwViewOption::GetDefGapBetweenPages());
// check how many pages fit into the first page layout row:
SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(Lower());
@@ -2171,8 +2174,6 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
::AdjustSizeChgNotify( this );
Calc(pRenderContext);
- SwViewShell* pSh = GetCurrShell();
-
if ( pSh && pSh->GetDoc()->GetDocShell() )
{
pSh->SetFirstVisPageInvalid();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 2304e4a..0ecf0e6 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2927,18 +2927,20 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
*/
void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs *pAttrs )
{
- OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs ist 0." );
+ OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs is 0." );
if ( mbValidPrtArea && mbValidSize )
return;
SwViewShell *pSh = getRootFrm()->GetCurrShell();
- const bool hideWhitespace = (pSh && pSh->GetViewOptions()->IsHideWhitespaceMode());
- const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this );
- const sal_uInt16 nUpper = hideWhitespace ? 0 : pAttrs->CalcTop();
-
- const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight( this );
- const sal_uInt16 nLower = hideWhitespace ? 0 : pAttrs->CalcBottom();
+ const bool hideWS = (pSh && pSh->GetViewOptions()->IsHideWhitespaceMode());
+ const long hideWSBorderSize = (pSh ? pSh->GetViewOptions()->GetDocumentBorder() : 0);
+ const bool hideSideWS = (pSh && pSh->GetViewOptions()->IsMultipageView());
+ const sal_uInt16 nLeft = hideSideWS ? hideWSBorderSize * 2 : (sal_uInt16)pAttrs->CalcLeft(this);
+ const sal_uInt16 nUpper = hideWS ? hideWSBorderSize : pAttrs->CalcTop();
+
+ const sal_uInt16 nRight = hideSideWS ? hideWSBorderSize * 2 : (sal_uInt16)pAttrs->CalcRight(this);
+ const sal_uInt16 nLower = hideWS ? hideWSBorderSize : pAttrs->CalcBottom();
bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index e7f65b5..db92f8d 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -930,7 +930,6 @@ void SwViewShell::Reformat()
if( GetLayout()->IsCallbackActionEnabled() )
{
-
StartAction();
GetLayout()->InvalidateAllContent( INV_SIZE | INV_POS | INV_PRTAREA );
EndAction();
@@ -1918,7 +1917,7 @@ void SwViewShell::SetBrowseBorder( const Size& rNew )
{
maBrowseBorder = rNew;
if ( maVisArea.HasArea() )
- CheckBrowseView( false );
+ InvalidateLayout( false );
}
}
@@ -1941,9 +1940,10 @@ sal_Int32 SwViewShell::GetBrowseWidth() const
return maVisArea.Width() - 2 * GetOut()->PixelToLogic(maBrowseBorder).Width();
}
-void SwViewShell::CheckBrowseView( bool bBrowseChgd )
+void SwViewShell::InvalidateLayout( bool bSizeChanged )
{
- if ( !bBrowseChgd && !GetViewOptions()->getBrowseMode() )
+ if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() &&
+ !GetViewOptions()->IsHideWhitespaceMode() )
return;
SET_CURR_SHELL( this );
@@ -1973,7 +1973,7 @@ void SwViewShell::CheckBrowseView( bool bBrowseChgd )
{ pPg->InvalidateSize();
pPg->_InvalidatePrt();
pPg->InvaPercentLowers();
- if ( bBrowseChgd )
+ if ( bSizeChanged )
{
pPg->PrepareHeader();
pPg->PrepareFooter();
@@ -1984,9 +1984,9 @@ void SwViewShell::CheckBrowseView( bool bBrowseChgd )
// When the size ratios in browse mode change,
// the Position and PrtArea of the Content and Tab frames must be Invalidated.
sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_POS;
- // In case of browse mode change the ContentFrms need a size-Invalidate
- // because of printer/screen formatting
- if( bBrowseChgd )
+ // In case of layout or mode change, the ContentFrms need a size-Invalidate
+ // because of printer/screen formatting.
+ if ( bSizeChanged )
nInv |= INV_SIZE | INV_DIRECTION;
GetLayout()->InvalidateAllContent( nInv );
@@ -2043,7 +2043,6 @@ SfxItemPool& SwViewShell::GetAttrPool()
void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
{
-
for(SwViewShell& rSh : GetRingContainer())
rSh.StartAction();
@@ -2059,11 +2058,12 @@ void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
continue;
SwViewOption aOpt( *rSh.GetViewOptions() );
aOpt.SetFieldName( rOpt.IsFieldName() );
- aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
+ aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
- aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
- aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
- aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
+ aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
+ aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
+ aOpt.SetHideWhitespaceMode(rOpt.IsHideWhitespaceMode());
+ aOpt.SetViewLayoutColumns(rOpt.GetViewLayoutColumns());
aOpt.SetPostIts(rOpt.IsPostIts());
if ( !(aOpt == *rSh.GetViewOptions()) )
rSh.ImplApplyViewOptions( aOpt );
@@ -2128,7 +2128,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
pMyWin->SetMapMode( aMode );
// if not a reference device (printer) is used for formatting,
// but the screen, new formatting is needed for zoomfactor changes.
- if( mpOpt->getBrowseMode() )
+ if (mpOpt->getBrowseMode() || mpOpt->IsHideWhitespaceMode())
bReformat = true;
}
@@ -2141,6 +2141,17 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
else if( mpOpt->getBrowseMode() && mpOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
bReformat = true;
+ bool bHideWhitespaceModeChanged = false;
+ if (mpOpt->IsHideWhitespaceMode() != rOpt.IsHideWhitespaceMode() ||
+ (rOpt.IsHideWhitespaceMode() &&
+ (mpOpt->IsViewLayoutBookMode() != rOpt.IsViewLayoutBookMode() ||
+ mpOpt->GetViewLayoutColumns() != rOpt.GetViewLayoutColumns())))
+ {
+ // When whitespace is hidden, view change needs reformatting.
+ bHideWhitespaceModeChanged = true;
+ bReformat = true;
+ }
+
if ( HasDrawView() || rOpt.IsGridVisible() )
{
if ( !HasDrawView() )
@@ -2178,12 +2189,12 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
mpDoc->GetDocumentSettingManager().set(DocumentSettingId::HTML_MODE, 0 != ::GetHtmlMode(mpDoc->GetDocShell()));
- if( bBrowseModeChanged )
+ if( bBrowseModeChanged || bHideWhitespaceModeChanged )
{
// #i44963# Good occasion to check if page sizes in
// page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
mpDoc->CheckDefaultPageFormat();
- CheckBrowseView( true );
+ InvalidateLayout( true );
}
pMyWin->Invalidate();
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 0176505..6d4a875 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -604,7 +604,7 @@ void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintD
if ( pSh->GetViewOptions()->getBrowseMode() &&
pSh->GetRingContainer().size() == 1 )
{
- pSh->CheckBrowseView( false );
+ pSh->InvalidateLayout( false );
pSh->GetLayout()->Lower()->InvalidateSize();
}
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 166cbeb..d8a7ea7 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -155,44 +155,38 @@ VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(
return pDlg;
}
-// Disable "multiple layout"
-
-void SwDocShell::ToggleBrowserMode(bool bSet, SwView* _pView )
+void SwDocShell::ToggleLayoutMode(SwView* pView)
{
- GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bSet );
- UpdateFontList();
- SwView* pTempView = _pView ? _pView : GetView();
- if( pTempView )
+ OSL_ENSURE( pView, "SwDocShell::ToggleLayoutMode, pView is null." );
+
+ const SwViewOption& rViewOptions = *pView->GetWrtShell().GetViewOptions();
+
+ //TODO: Should HideWhitespace flag be saved in the document settings?
+ GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, rViewOptions.getBrowseMode());
+ UpdateFontList(); // Why is this necessary here?
+
+ pView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
+ if( !GetDoc()->getIDocumentDeviceAccess().getPrinter( false ) )
+ pView->SetPrinter( GetDoc()->getIDocumentDeviceAccess().getPrinter( false ), SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
+ GetDoc()->CheckDefaultPageFormat();
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, false);
+ while (pTmpFrm)
{
- pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
- if( !GetDoc()->getIDocumentDeviceAccess().getPrinter( false ) )
- pTempView->SetPrinter( GetDoc()->getIDocumentDeviceAccess().getPrinter( false ), SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
- GetDoc()->CheckDefaultPageFormat();
- SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, false);
- while (pTmpFrm)
- {
- if( pTmpFrm != pTempView->GetViewFrame() )
- {
- pTmpFrm->DoClose();
- pTmpFrm = SfxViewFrame::GetFirst(this, false);
- }
- else
- pTmpFrm = SfxViewFrame::GetNext(*pTmpFrm, this, false);
- }
- const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions();
- pTempView->GetWrtShell().CheckBrowseView( true );
- pTempView->CheckVisArea();
- if( bSet )
+ if( pTmpFrm != pView->GetViewFrame() )
{
- const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
- if ( SvxZoomType::PERCENT != eType)
- static_cast<SwView*>(GetView())->SetZoom( eType );
+ pTmpFrm->DoClose();
+ pTmpFrm = SfxViewFrame::GetFirst(this, false);
}
- pTempView->InvalidateBorder();
- pTempView->SetNewWindowAllowed(!bSet);
+ else
+ pTmpFrm = SfxViewFrame::GetNext(*pTmpFrm, this, false);
}
+
+ pView->GetWrtShell().InvalidateLayout(true);
+
+ pView->RecheckBrowseMode();
+
+ pView->SetNewWindowAllowed(!rViewOptions.getBrowseMode());
}
-// End of disabled "multiple layout"
// update text fields on document properties changes
void SwDocShell::DoFlushDocInfo()
@@ -1363,7 +1357,7 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
{
SwWrtShell& rWrtSh = pCurrView->GetWrtShell();
if( rWrtSh.GetLayout())
- rWrtSh.CheckBrowseView( true );
+ rWrtSh.InvalidateLayout( true );
}
// Take HTTP-Header-Attibutes over into the DokInfo again.
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 83fe028..2974766 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1144,6 +1144,7 @@ void SwPagePreview::Init(const SwViewOption * pPrefs)
aOpt.SetTable( true );
aOpt.SetSnap( false );
aOpt.SetGridVisible( false );
+ aOpt.SetHideWhitespaceMode( false );
GetViewShell()->ApplyViewOptions( aOpt );
GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index a77ae11..81825c2 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -303,6 +303,17 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
}
case FN_VIEW_HIDDEN_PARA:
aBool.SetValue( pOpt->IsShowHiddenPara()); break;
+ case FN_VIEW_HIDE_WHITESPACE:
+ {
+ if (pOpt->getBrowseMode())
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue(pOpt->IsHideWhitespaceMode());
+ }
+ break;
case SID_GRID_VISIBLE:
aBool.SetValue( pOpt->IsGridVisible() ); break;
case SID_GRID_USE:
@@ -357,6 +368,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
int eState = STATE_TOGGLE;
bool bSet = false;
bool bBrowseModeChanged = false;
+ bool bHideWhitespaceModeChanged = false;
const SfxItemSet *pArgs = rReq.GetArgs();
sal_uInt16 nSlot = rReq.GetSlot();
@@ -419,8 +431,6 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
else if( nSlot == FN_PRINT_LAYOUT )
bFlag = !bFlag;
bBrowseModeChanged = bFlag != pOpt->getBrowseMode();
- // Disable "multiple layout"
- GetDocShell()->ToggleBrowserMode( bFlag, this );
pOpt->setBrowseMode( bFlag );
break;
@@ -441,6 +451,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
pOpt->SetShowHiddenPara( bFlag );
break;
+ case FN_VIEW_HIDE_WHITESPACE:
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsHideWhitespaceMode();
+ bHideWhitespaceModeChanged = (bFlag != pOpt->IsHideWhitespaceMode());
+ pOpt->SetHideWhitespaceMode(bFlag);
+ break;
+
case FN_VIEW_SMOOTH_SCROLL:
if ( STATE_TOGGLE == eState )
@@ -561,10 +578,9 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
if( !(*rSh.GetViewOptions() == *pOpt ))
{
rSh.ApplyViewOptions( *pOpt );
- if( bBrowseModeChanged )
+ if( bBrowseModeChanged || bHideWhitespaceModeChanged )
{
- RecheckBrowseMode();
- CheckVisArea();
+ GetDocShell()->ToggleLayoutMode(this);
}
// The UsrPref must be marked as modified.
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 498a262..edebaf7 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1461,7 +1461,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
const Size& rEditSize = GetEditWin().GetOutputSizePixel();
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list