summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-03-22 17:09:26 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-03-22 19:13:23 +0100
commit743b0a92acc3d1850f4890efaa706098ebf9f558 (patch)
treef0a25a383c73137db0145c80cfb79e46cad04b08
parent8308d6a38ff283a2feebf84a95198159887cd685 (diff)
Unfloat: Move the button to the top of the frame
User can find it easier in this position. Change-Id: I38fd782485a180e0d5223b52cc2c6ee061661600 Reviewed-on: https://gerrit.libreoffice.org/69562 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sw/source/core/layout/fly.cxx4
-rw-r--r--sw/source/uibase/docvw/FrameControlsManager.cxx4
-rw-r--r--sw/source/uibase/docvw/UnfloatTableButton.cxx9
-rw-r--r--sw/source/uibase/inc/FrameControlsManager.hxx2
-rw-r--r--sw/source/uibase/inc/UnfloatTableButton.hxx2
5 files changed, 10 insertions, 11 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 06410cedf750..9e061ebf754d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1869,8 +1869,8 @@ void SwFlyFrame::UpdateUnfloatButton(SwWrtShell* pWrtSh, bool bShow) const
SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
- Point aBottomRightPixel = rEditWin.LogicToPixel( getFrameArea().BottomRight() );
- rMngr.SetUnfloatTableButton(this, bShow, aBottomRightPixel);
+ Point aTopRightPixel = rEditWin.LogicToPixel( getFrameArea().TopRight() );
+ rMngr.SetUnfloatTableButton(this, bShow, aTopRightPixel);
}
SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst )
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index bd135c422cb5..eb816515ea07 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -139,7 +139,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame
pControl->ShowAll( true );
}
-void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aBottomRightPixel )
+void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel )
{
if(pFlyFrame == nullptr)
return;
@@ -168,7 +168,7 @@ void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame,
UnfloatTableButton* pButton = dynamic_cast<UnfloatTableButton*>(pControl->GetWindow());
assert(pButton != nullptr);
- pButton->SetOffset(aBottomRightPixel);
+ pButton->SetOffset(aTopRightPixel);
pControl->ShowAll( bShow );
}
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index 0592378ec768..a4a92be08d33 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -49,7 +49,7 @@ UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFram
UnfloatTableButton::~UnfloatTableButton() { disposeOnce(); }
-void UnfloatTableButton::SetOffset(Point aBottomRightPixel)
+void UnfloatTableButton::SetOffset(Point aTopRightPixel)
{
// Compute the text size and get the box position & size from it
tools::Rectangle aTextRect;
@@ -59,12 +59,11 @@ void UnfloatTableButton::SetOffset(Point aBottomRightPixel)
Size aBoxSize(aTextPxRect.GetWidth() + BUTTON_WIDTH + TEXT_PADDING * 2,
aFontMetric.GetLineHeight() + TEXT_PADDING * 2);
- Point aBoxPos(aBottomRightPixel.X() - aBoxSize.Width() - BOX_DISTANCE,
- aBottomRightPixel.Y() - aBoxSize.Height());
+ Point aBoxPos(aTopRightPixel.X() - aBoxSize.Width() - BOX_DISTANCE, aTopRightPixel.Y());
if (AllSettings::GetLayoutRTL())
{
- aBoxPos.setX(aBottomRightPixel.X() + BOX_DISTANCE);
+ aBoxPos.setX(aTopRightPixel.X() + BOX_DISTANCE);
}
// Set the position & Size of the window
@@ -163,7 +162,7 @@ void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::
::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
// Create button
- SwFrameButtonPainter::PaintButton(aSeq, aRect, false);
+ SwFrameButtonPainter::PaintButton(aSeq, aRect, true);
// Create the text primitive
basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
diff --git a/sw/source/uibase/inc/FrameControlsManager.hxx b/sw/source/uibase/inc/FrameControlsManager.hxx
index 2b94b947fd53..e8b5e33f3806 100644
--- a/sw/source/uibase/inc/FrameControlsManager.hxx
+++ b/sw/source/uibase/inc/FrameControlsManager.hxx
@@ -47,7 +47,7 @@ class SwFrameControlsManager
// Helper methods
void SetHeaderFooterControl( const SwPageFrame* pPageFrame, FrameControlType eType, Point aOffset );
void SetPageBreakControl( const SwPageFrame* pPageFrame );
- void SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopLeftPixel = Point() );
+ void SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel = Point() );
};
#endif
diff --git a/sw/source/uibase/inc/UnfloatTableButton.hxx b/sw/source/uibase/inc/UnfloatTableButton.hxx
index 94b4eb761ca0..cdf6eafb439d 100644
--- a/sw/source/uibase/inc/UnfloatTableButton.hxx
+++ b/sw/source/uibase/inc/UnfloatTableButton.hxx
@@ -30,7 +30,7 @@ public:
UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame);
virtual ~UnfloatTableButton() override;
- void SetOffset(Point aBottomRightPixel);
+ void SetOffset(Point aTopRightPixel);
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;