sw/inc/AnnotationWin.hxx | 1 sw/inc/SidebarWin.hxx | 10 -- sw/inc/postithelper.hxx | 2 sw/source/core/fields/postithelper.cxx | 2 sw/source/uibase/docvw/AnnotationMenuButton.cxx | 41 ++------- sw/source/uibase/docvw/AnnotationWin.cxx | 3 sw/source/uibase/docvw/SidebarWin.cxx | 108 +++++++----------------- 7 files changed, 50 insertions(+), 117 deletions(-)
New commits: commit 5fb961ad0b5938434777751c9d5c599f7400ab36 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Apr 10 13:36:50 2017 +0200 PB_Preview constant in SwSidebarWin is unused which leads to removing various preview stuff in the SwSidebarWin code Last usage seems to have gone with commit c230e962ca2c876187a028fa14426210b5746a0f Author: Oliver-Rainer Wittmann <o...@openoffice.org> Date: Tue Jan 12 10:43:45 2010 +0100 sw33a11y01: #i88070# refactoring of sidebar window code used for visualization of comments/annotations Change-Id: Idc9382e01a21b679f157f6d1da84d871cb6f1059 Reviewed-on: https://gerrit.libreoffice.org/36377 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 5b2c186dae67..04122ce9f70b 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -34,7 +34,6 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin SwAnnotationWin( SwEditWin& rEditWin, WinBits nBits, SwPostItMgr& aMgr, - SwPostItBits aBits, SwSidebarItem& rSidebarItem, SwFormatField* aField ); virtual ~SwAnnotationWin() override; diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index 630fea42c0d5..d4692890b153 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -54,17 +54,12 @@ class SidebarTextControl; class AnchorOverlayObject; class ShadowOverlayObject; -typedef sal_Int64 SwPostItBits; - -#define PB_Preview ((SwPostItBits)0x00000001) - class SwSidebarWin : public vcl::Window { public: SwSidebarWin( SwEditWin& rEditWin, WinBits nBits, SwPostItMgr& aMgr, - SwPostItBits aBits, SwSidebarItem& rSidebarItem ); virtual ~SwSidebarWin() override; virtual void dispose() override; @@ -135,10 +130,6 @@ class SwSidebarWin : public vcl::Window { return mbReadonly; } - bool IsPreview() - { - return nFlags & PB_Preview; - } void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor); const Color& ColorAnchor() { return mColorAnchor; } @@ -218,7 +209,6 @@ class SwSidebarWin : public vcl::Window SwPostItMgr& mrMgr; SwView& mrView; - const SwPostItBits nFlags; ImplSVEvent * mnEventId; diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 5e323aa4cf5d..90cfaf3a5d7e 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -38,8 +38,6 @@ namespace sw { namespace sidebarwindows { struct SwPosition; -typedef sal_Int64 SwPostItBits; - struct SwLayoutInfo { const SwFrame* mpAnchorFrame; diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index effde49a1218..cd607e8b5f3d 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -148,7 +148,7 @@ VclPtr<sw::sidebarwindows::SwSidebarWin> SwAnnotationItem::GetSidebarWindow( SwPostItMgr& aMgr) { return VclPtr<sw::annotation::SwAnnotationWin>::Create( rEditWin, WB_DIALOGCONTROL, - aMgr, 0, + aMgr, *this, &mrFormatField ); } diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index 38fe8def1a86..0eff9dc8aa93 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -156,34 +156,19 @@ void AnnotationMenuButton::Paint(vcl::RenderContext& rRenderContext, const tools } rRenderContext.DrawRect(aRect); - if (mrSidebarWin.IsPreview()) - { - vcl::Font aOldFont(mrSidebarWin.GetFont()); - vcl::Font aFont(aOldFont); - Color aCol(COL_BLACK); - aFont.SetColor(aCol); - aFont.SetFontHeight(200); - aFont.SetWeight(WEIGHT_MEDIUM); - rRenderContext.SetFont(aFont); - rRenderContext.DrawText(aRect, OUString("Edit Note"), DrawTextFlags::Center); - rRenderContext.SetFont(aOldFont); - } - else - { - tools::Rectangle aSymbolRect(aRect); - // 25% distance to the left and right button border - const long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000; - aSymbolRect.Left() += nBorderDistanceLeftAndRight; - aSymbolRect.Right() -= nBorderDistanceLeftAndRight; - // 40% distance to the top button border - const long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000; - aSymbolRect.Top()+=nBorderDistanceTop; - // 15% distance to the bottom button border - const long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000; - aSymbolRect.Bottom() -= nBorderDistanceBottom; - DecorationView aDecoView(&rRenderContext); - aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, (bHighContrast ? Color(COL_WHITE) : Color(COL_BLACK))); - } + tools::Rectangle aSymbolRect(aRect); + // 25% distance to the left and right button border + const long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000; + aSymbolRect.Left() += nBorderDistanceLeftAndRight; + aSymbolRect.Right() -= nBorderDistanceLeftAndRight; + // 40% distance to the top button border + const long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000; + aSymbolRect.Top()+=nBorderDistanceTop; + // 15% distance to the bottom button border + const long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000; + aSymbolRect.Bottom() -= nBorderDistanceBottom; + DecorationView aDecoView(&rRenderContext); + aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, (bHighContrast ? Color(COL_WHITE) : Color(COL_BLACK))); } void AnnotationMenuButton::KeyInput(const KeyEvent& rKeyEvt) diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index eae69733f332..7809c3bc18b3 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -59,10 +59,9 @@ namespace sw { namespace annotation { SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, WinBits nBits, SwPostItMgr& aMgr, - SwPostItBits aBits, SwSidebarItem& rSidebarItem, SwFormatField* aField ) - : SwSidebarWin( rEditWin, nBits, aMgr, aBits, rSidebarItem ) + : SwSidebarWin( rEditWin, nBits, aMgr, rSidebarItem ) , mpFormatField(aField) , mpField( static_cast<SwPostItField*>(aField->GetField())) , mpButtonPopup(nullptr) diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 594a66d41c1d..7c3d69c7d69e 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -159,12 +159,10 @@ namespace sw { namespace sidebarwindows { SwSidebarWin::SwSidebarWin(SwEditWin& rEditWin, WinBits nBits, SwPostItMgr& aMgr, - SwPostItBits aBits, SwSidebarItem& rSidebarItem) : Window(&rEditWin, nBits) , mrMgr(aMgr) , mrView(rEditWin.GetView()) - , nFlags(aBits) , mnEventId(nullptr) , mpOutlinerView(nullptr) , mpOutliner(nullptr) @@ -794,36 +792,33 @@ void SwSidebarWin::SetPosAndSize() EditWin().EnableMapMode(false); } - if (!IsPreview()) + if (mpAnchor) { - if (mpAnchor) + mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15), + basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15), + basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15), + basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15), + basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15), + basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()), + basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y())); + mpAnchor->SetHeight(mAnchorRect.Height()); + } + else + { + mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView, + mAnchorRect, + mPageBorder, + aLineStart, + aLineEnd, + mColorAnchor ); + if ( mpAnchor ) { - mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15), - basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15), - basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15), - basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15), - basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15), - basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()), - basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y())); mpAnchor->SetHeight(mAnchorRect.Height()); - } - else - { - mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView, - mAnchorRect, - mPageBorder, - aLineStart, - aLineEnd, - mColorAnchor ); - if ( mpAnchor ) + mpAnchor->setVisible(true); + mpAnchor->SetAnchorState(AnchorState::Tri); + if (HasChildPathFocus()) { - mpAnchor->SetHeight(mAnchorRect.Height()); - mpAnchor->setVisible(true); - mpAnchor->SetAnchorState(AnchorState::Tri); - if (HasChildPathFocus()) - { - mpAnchor->setLineSolid(true); - } + mpAnchor->setLineSolid(true); } } } @@ -978,7 +973,7 @@ void SwSidebarWin::DoResize() mpMetadataDate->Show(); mpSidebarTextControl->SetQuickHelpText(OUString()); - if ((aTextHeight > aHeight) && !IsPreview()) + if (aTextHeight > aHeight) { // we need vertical scrollbars and have to reduce the width aWidth -= GetScrollbarWidth(); mpVScrollbar->Show(); @@ -1015,8 +1010,7 @@ void SwSidebarWin::DoResize() } else { - mpSidebarTextControl->setPosSizePixel( ( (aTextHeight > aHeight) && !IsPreview() - ? GetScrollbarWidth() : 0 ) , 0, + mpSidebarTextControl->setPosSizePixel( ( aTextHeight > aHeight ? GetScrollbarWidth() : 0 ), 0, aWidth, aHeight); mpVScrollbar->setPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight); } @@ -1032,31 +1026,10 @@ void SwSidebarWin::DoResize() const Fraction& fy( GetMapMode().GetScaleY() ); const Point aPos( mpMetadataAuthor->GetPosPixel()); - tools::Rectangle aRectMetaButton; - if (IsPreview()) - { - aRectMetaButton = PixelToLogic( - tools::Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(), - aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ), - Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(), - METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) ); - } - else - { - aRectMetaButton = PixelToLogic( - tools::Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(), - aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ), - Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(), - METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) ); - } - - { - const tools::Rectangle aRectMetaButtonPixel( LogicToPixel( aRectMetaButton ) ); - mpMenuButton->setPosSizePixel( aRectMetaButtonPixel.Left(), - aRectMetaButtonPixel.Top(), - aRectMetaButtonPixel.GetWidth(), - aRectMetaButtonPixel.GetHeight() ); - } + mpMenuButton->setPosSizePixel( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(), + aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator(), + METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(), + METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ); } void SwSidebarWin::SetSizePixel( const Size& rNewSize ) @@ -1389,14 +1362,11 @@ IMPL_LINK( SwSidebarWin, WindowEventListener, VclWindowEvent&, rEvent, void ) } else if ( pMouseEvt->IsLeaveWindow()) { - if (!IsPreview()) + mbMouseOver = false; + if ( !HasFocus() ) { - mbMouseOver = false; - if ( !HasFocus() ) - { - SetViewState(ViewState::NORMAL); - Invalidate(); - } + SetViewState(ViewState::NORMAL); + Invalidate(); } } } @@ -1405,12 +1375,7 @@ IMPL_LINK( SwSidebarWin, WindowEventListener, VclWindowEvent&, rEvent, void ) { const bool bLockView = mrView.GetWrtShell().IsViewLocked(); mrView.GetWrtShell().LockView( true ); - - if ( !IsPreview() ) - { - mrMgr.SetActiveSidebarWin( this ); - } - + mrMgr.SetActiveSidebarWin( this ); mrView.GetWrtShell().LockView( bLockView ); mrMgr.MakeVisible( this ); } @@ -1462,10 +1427,7 @@ sal_Int32 SwSidebarWin::GetScrollbarWidth() sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth() { const Fraction& f( GetMapMode().GetScaleX() ); - if (IsPreview()) - return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator(); - else - return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator(); + return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator(); } sal_Int32 SwSidebarWin::GetMetaHeight() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits