diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-08-29 21:02:39 -0400 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-03 08:45:07 +0000 |
commit | 2b8e62f7b6e0a45a9ff1ec530b2e941f3fbcf1a0 (patch) | |
tree | 2536a965821cd4ce454b8b93b59fa9582b4fa94e | |
parent | a1fd97308d7fc7a35a5def1e15a05099dba90f91 (diff) |
tdf#39080 Hide white space between pages in 'print layout'
Merged Hide Whitespace with Browser Mode and hooked
the former with the UI. In Hide Whitespace mode
the headers and footers are removed and
page margins as well as between-page gaps are
reduced to minimum.
In single-page view the side margins are left
as-is. In multi-page and book-view the sides
are removed, however, they have twice the
width of the top and bottom.
Printing and PDF export disable this mode.
The usable screen real-estate is greatly
improved in this mode, which is controlled
from the View menu.
Change-Id: I2d0075ae9a76162c26c78e9eb23a71920cdfc522
Reviewed-on: https://gerrit.libreoffice.org/17281
Reviewed-by: Jean-Baptiste Faure <jbfaure@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 27 | ||||
-rw-r--r-- | sw/inc/docsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/swtypes.hxx | 4 | ||||
-rw-r--r-- | sw/inc/viewopt.hxx | 25 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/layout/layact.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 43 | ||||
-rw-r--r-- | sw/source/core/view/vprint.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 60 | ||||
-rw-r--r-- | sw/source/uibase/uiview/pview.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 31 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
17 files changed, 175 insertions, 99 deletions
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 455e2bccaef5..d2b511bd3e5d 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 f65f99e908a5..cf35adc33234 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -277,7 +277,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 33b7876d4c6b..8e785d1d1024 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 4b9076bcf534..bb6e034a9475 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 @@ -371,6 +371,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; } @@ -398,6 +408,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 6e99bc160429..ff8c36c3dc6e 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -489,11 +489,10 @@ public: bool IsFrameView() const { return mbFrameView; } - // 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 f5d265ab8f7f..e8a03f3343bb 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1293,12 +1293,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 2bf79201f05f..b806c2a6e3a8 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1895,8 +1895,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; @@ -1922,7 +1922,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()); @@ -2182,8 +2185,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 bc75b1bec98a..ae2fbc0667b8 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 cd4bd172749f..aaf026cdc31b 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -915,7 +915,6 @@ void SwViewShell::Reformat() if( GetLayout()->IsCallbackActionEnabled() ) { - StartAction(); GetLayout()->InvalidateAllContent( INV_SIZE | INV_POS | INV_PRTAREA ); EndAction(); @@ -1900,7 +1899,7 @@ void SwViewShell::SetBrowseBorder( const Size& rNew ) { maBrowseBorder = rNew; if ( maVisArea.HasArea() ) - CheckBrowseView( false ); + InvalidateLayout( false ); } } @@ -1923,9 +1922,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 ); @@ -1955,7 +1955,7 @@ void SwViewShell::CheckBrowseView( bool bBrowseChgd ) { pPg->InvalidateSize(); pPg->_InvalidatePrt(); pPg->InvaPercentLowers(); - if ( bBrowseChgd ) + if ( bSizeChanged ) { pPg->PrepareHeader(); pPg->PrepareFooter(); @@ -1966,9 +1966,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 ); @@ -2025,7 +2025,6 @@ SfxItemPool& SwViewShell::GetAttrPool() void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt ) { - for(SwViewShell& rSh : GetRingContainer()) rSh.StartAction(); @@ -2041,11 +2040,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 ); @@ -2110,7 +2110,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; } @@ -2123,6 +2123,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() ) @@ -2160,12 +2171,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 2407dda521ae..3567ff0c663c 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 1f28a9fe6cbf..6a7b55d6d1a9 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -156,44 +156,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() @@ -1365,7 +1359,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 0daf3076b953..6f16f8bcdbcd 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 edd0b4211c93..6173af8596af 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -302,6 +302,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: @@ -356,6 +367,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(); @@ -418,8 +430,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; @@ -440,6 +450,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 ) @@ -560,10 +577,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 a050e583a94d..1006837cb787 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1437,7 +1437,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) const Size& rEditSize = GetEditWin().GetOutputSizePixel(); const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) ); - const long nOf = DOCUMENTBORDER * 2L; + const long nOf = pVOpt->GetDocumentBorder() * 2L; long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width(); nTmpWidth += nOf; aPageSize.Height() += nOf; @@ -1450,7 +1450,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) if ( bAutomaticViewLayout ) { - nTmpWidth += aPageSize.Width() + GAPBETWEENPAGES; + nTmpWidth += aPageSize.Width() + pVOpt->GetGapBetweenPages(); nFac = aWindowSize.Width() * 100 / nTmpWidth; nFac = std::min( nFac, nVisPercent ); aZoomSliderItem.AddSnappingPoint( nFac ); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 0560f11398b5..231ef09ae9ba 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -265,7 +265,7 @@ void SwView::SetVisArea( const Rectangle &rRect, bool bUpdateScrollbar ) if ( aOldSz != m_pWrtShell->VisArea().SSize() && ( std::abs(aOldSz.Width() - m_pWrtShell->VisArea().Width()) > 2 || std::abs(aOldSz.Height() - m_pWrtShell->VisArea().Height()) > 2 ) ) - m_pWrtShell->CheckBrowseView( false ); + m_pWrtShell->InvalidateLayout( false ); } if ( !bProtectDocShellVisArea ) @@ -329,7 +329,7 @@ void SwView::SetVisArea( const Point &rPt, bool bUpdateScrollbar ) void SwView::CheckVisArea() { m_pHScrollbar->SetAuto( m_pWrtShell->GetViewOptions()->getBrowseMode() && - !GetViewFrame()->GetFrame().IsInPlace() ); + !GetViewFrame()->GetFrame().IsInPlace() ); if ( IsDocumentBorder() ) { if ( m_aVisArea.Left() != DOCUMENTBORDER || diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 1215a943ae85..2cb78d2fa7ee 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -90,7 +90,8 @@ enum SwViewSettingsPropertyHandles HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, HANDLE_VIEWSET_HORI_RULER_METRIC, HANDLE_VIEWSET_VERT_RULER_METRIC, - HANDLE_VIEWSET_SCROLLBAR_TIPS + HANDLE_VIEWSET_SCROLLBAR_TIPS, + HANDLE_VIEWSET_HIDE_WHITESPACE }; enum SwPrintSettingsPropertyHandles @@ -136,6 +137,7 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo() { OUString( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { OUString( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { OUString( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, + { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { OUString( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { OUString( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { OUString( "HideWhitespace"), HANDLE_VIEWSET_HIDE_WHITESPACE, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, @@ -708,23 +710,37 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c break; case HANDLE_VIEWSET_ONLINE_LAYOUT : { - if( pView && !bVal != !pView->GetWrtShell().GetViewOptions()->getBrowseMode() ) + SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions()); + if (pView && !bVal != !aOpt.getBrowseMode()) { - SwViewOption aOpt( *pView->GetWrtShell().GetViewOptions() ); aOpt.setBrowseMode( bVal ); pView->GetWrtShell().ApplyViewOptions( aOpt ); - pView->RecheckBrowseMode(); // must be set in mpViewOption as this will overwrite settings in _post! if(mpViewOption) mpViewOption->setBrowseMode(bVal); - // disable multiple layout - pView->GetDocShell()->ToggleBrowserMode(bVal, pView ); + pView->GetDocShell()->ToggleLayoutMode(pView); } } break; - case HANDLE_VIEWSET_HELP_URL : + case HANDLE_VIEWSET_HIDE_WHITESPACE: + { + SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions()); + if (pView && !bVal != !aOpt.IsHideWhitespaceMode()) + { + aOpt.SetHideWhitespaceMode( bVal ); + pView->GetWrtShell().ApplyViewOptions( aOpt ); + + // must be set in mpViewOption as this will overwrite settings in _post! + if(mpViewOption) + mpViewOption->SetHideWhitespaceMode(bVal); + + pView->GetDocShell()->ToggleLayoutMode(pView); + } + } + break; + case HANDLE_VIEWSET_HELP_URL: { if ( pView ) { @@ -853,6 +869,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break; case HANDLE_VIEWSET_HIDE_WHITESPACE: bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break; case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break; + case HANDLE_VIEWSET_HIDE_WHITESPACE : bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break; case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break; case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break; case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 0cdf83fb1d69..fe75178f1329 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2554,10 +2554,12 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if (bFormat) { // #i38289 - if( pViewShell->GetViewOptions()->getBrowseMode() ) + if( pViewShell->GetViewOptions()->getBrowseMode() || + pViewShell->GetViewOptions()->IsHideWhitespaceMode() ) { SwViewOption aOpt( *pViewShell->GetViewOptions() ); aOpt.setBrowseMode( false ); + aOpt.SetHideWhitespaceMode( false ); pViewShell->ApplyViewOptions( aOpt ); if (pSwView) { |