Kaydet (Commit) 743b0a92 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

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: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 8308d6a3
...@@ -1869,8 +1869,8 @@ void SwFlyFrame::UpdateUnfloatButton(SwWrtShell* pWrtSh, bool bShow) const ...@@ -1869,8 +1869,8 @@ void SwFlyFrame::UpdateUnfloatButton(SwWrtShell* pWrtSh, bool bShow) const
SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager(); SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
Point aBottomRightPixel = rEditWin.LogicToPixel( getFrameArea().BottomRight() ); Point aTopRightPixel = rEditWin.LogicToPixel( getFrameArea().TopRight() );
rMngr.SetUnfloatTableButton(this, bShow, aBottomRightPixel); rMngr.SetUnfloatTableButton(this, bShow, aTopRightPixel);
} }
SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst )
......
...@@ -139,7 +139,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame ...@@ -139,7 +139,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame
pControl->ShowAll( true ); 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) if(pFlyFrame == nullptr)
return; return;
...@@ -168,7 +168,7 @@ void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame, ...@@ -168,7 +168,7 @@ void SwFrameControlsManager::SetUnfloatTableButton( const SwFlyFrame* pFlyFrame,
UnfloatTableButton* pButton = dynamic_cast<UnfloatTableButton*>(pControl->GetWindow()); UnfloatTableButton* pButton = dynamic_cast<UnfloatTableButton*>(pControl->GetWindow());
assert(pButton != nullptr); assert(pButton != nullptr);
pButton->SetOffset(aBottomRightPixel); pButton->SetOffset(aTopRightPixel);
pControl->ShowAll( bShow ); pControl->ShowAll( bShow );
} }
......
...@@ -49,7 +49,7 @@ UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFram ...@@ -49,7 +49,7 @@ UnfloatTableButton::UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFram
UnfloatTableButton::~UnfloatTableButton() { disposeOnce(); } 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 // Compute the text size and get the box position & size from it
tools::Rectangle aTextRect; tools::Rectangle aTextRect;
...@@ -59,12 +59,11 @@ void UnfloatTableButton::SetOffset(Point aBottomRightPixel) ...@@ -59,12 +59,11 @@ void UnfloatTableButton::SetOffset(Point aBottomRightPixel)
Size aBoxSize(aTextPxRect.GetWidth() + BUTTON_WIDTH + TEXT_PADDING * 2, Size aBoxSize(aTextPxRect.GetWidth() + BUTTON_WIDTH + TEXT_PADDING * 2,
aFontMetric.GetLineHeight() + TEXT_PADDING * 2); aFontMetric.GetLineHeight() + TEXT_PADDING * 2);
Point aBoxPos(aBottomRightPixel.X() - aBoxSize.Width() - BOX_DISTANCE, Point aBoxPos(aTopRightPixel.X() - aBoxSize.Width() - BOX_DISTANCE, aTopRightPixel.Y());
aBottomRightPixel.Y() - aBoxSize.Height());
if (AllSettings::GetLayoutRTL()) if (AllSettings::GetLayoutRTL())
{ {
aBoxPos.setX(aBottomRightPixel.X() + BOX_DISTANCE); aBoxPos.setX(aTopRightPixel.X() + BOX_DISTANCE);
} }
// Set the position & Size of the window // Set the position & Size of the window
...@@ -163,7 +162,7 @@ void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools:: ...@@ -163,7 +162,7 @@ void UnfloatTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::
::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel()))); ::tools::Rectangle(Point(0, 0), rRenderContext.PixelToLogic(GetSizePixel())));
// Create button // Create button
SwFrameButtonPainter::PaintButton(aSeq, aRect, false); SwFrameButtonPainter::PaintButton(aSeq, aRect, true);
// Create the text primitive // Create the text primitive
basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor(); basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
......
...@@ -47,7 +47,7 @@ class SwFrameControlsManager ...@@ -47,7 +47,7 @@ class SwFrameControlsManager
// Helper methods // Helper methods
void SetHeaderFooterControl( const SwPageFrame* pPageFrame, FrameControlType eType, Point aOffset ); void SetHeaderFooterControl( const SwPageFrame* pPageFrame, FrameControlType eType, Point aOffset );
void SetPageBreakControl( const SwPageFrame* pPageFrame ); 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 #endif
......
...@@ -30,7 +30,7 @@ public: ...@@ -30,7 +30,7 @@ public:
UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame); UnfloatTableButton(SwEditWin* pEditWin, const SwFrame* pFrame);
virtual ~UnfloatTableButton() override; virtual ~UnfloatTableButton() override;
void SetOffset(Point aBottomRightPixel); void SetOffset(Point aTopRightPixel);
virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment