Kaydet (Commit) 8e005a56 authored tarafından Tamás Zolnai's avatar Tamás Zolnai Kaydeden (comit) Andras Timar

Unfloat: Move the button to the top of the frame

User can find it easier in this position.

Reviewed-on: https://gerrit.libreoffice.org/69562
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 743b0a92)

Change-Id: I38fd782485a180e0d5223b52cc2c6ee061661600
Reviewed-on: https://gerrit.libreoffice.org/69581Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 0100258f
......@@ -1858,8 +1858,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.SetFloatingTableButton(this, bShow, aBottomRightPixel);
Point aTopRightPixel = rEditWin.LogicToPixel( getFrameArea().TopRight() );
rMngr.SetFloatingTableButton(this, bShow, aTopRightPixel);
}
SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst )
......
......@@ -48,7 +48,7 @@ FloatingTableButton::FloatingTableButton(SwEditWin* pEditWin, const SwFrame* pFr
FloatingTableButton::~FloatingTableButton() { disposeOnce(); }
void FloatingTableButton::SetOffset(Point aBottomRightPixel)
void FloatingTableButton::SetOffset(Point aTopRightPixel)
{
// Compute the text size and get the box position & size from it
tools::Rectangle aTextRect;
......@@ -58,12 +58,11 @@ void FloatingTableButton::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
......@@ -113,8 +112,9 @@ void FloatingTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
// of the text node otherwise LO will create a page break after the table
if (pTextFrame->GetTextNode())
{
const SwPageDesc* pPageDesc
= pTextFrame->GetAttrSet()->GetPageDesc().GetPageDesc(); // First text node of the page has this
const SwPageDesc* pPageDesc = pTextFrame->GetAttrSet()
->GetPageDesc()
.GetPageDesc(); // First text node of the page has this
if (pPageDesc)
{
// First set the existing page desc for the table node
......@@ -122,14 +122,14 @@ void FloatingTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
svl::Items<RES_PAGEDESC, RES_PAGEDESC>{});
aSet.Put(SwFormatPageDesc(pPageDesc));
SwPaM aPaMTable(*pTableNode);
rDoc.getIDocumentContentOperations().InsertItemSet(
aPaMTable, aSet, SetAttrMode::DEFAULT);
rDoc.getIDocumentContentOperations().InsertItemSet(aPaMTable, aSet,
SetAttrMode::DEFAULT);
// Then remove pagedesc from the attributes of the text node
aSet.Put(SwFormatPageDesc(nullptr));
SwPaM aPaMTextNode(*pTextFrame->GetTextNode());
rDoc.getIDocumentContentOperations().InsertItemSet(
aPaMTextNode, aSet, SetAttrMode::DEFAULT);
rDoc.getIDocumentContentOperations().InsertItemSet(aPaMTextNode, aSet,
SetAttrMode::DEFAULT);
}
}
......@@ -162,7 +162,7 @@ void FloatingTableButton::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();
......
......@@ -155,7 +155,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame
pControl->ShowAll( true );
}
void SwFrameControlsManager::SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aBottomRightPixel )
void SwFrameControlsManager::SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel )
{
if(pFlyFrame == nullptr)
return;
......@@ -184,7 +184,7 @@ void SwFrameControlsManager::SetFloatingTableButton( const SwFlyFrame* pFlyFrame
FloatingTableButton* pButton = dynamic_cast<FloatingTableButton*>(pControl->GetWindow());
assert(pButton != nullptr);
pButton->SetOffset(aBottomRightPixel);
pButton->SetOffset(aTopRightPixel);
pControl->ShowAll( bShow );
}
......
......@@ -21,7 +21,7 @@ public:
FloatingTableButton(SwEditWin* pEditWin, const SwFrame* pFrame);
virtual ~FloatingTableButton() 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;
......@@ -34,4 +34,4 @@ public:
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
\ No newline at end of file
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -47,7 +47,7 @@ class SwFrameControlsManager
// Helper methods
void SetHeaderFooterControl( const SwPageFrame* pPageFrame, FrameControlType eType, Point aOffset );
void SetPageBreakControl( const SwPageFrame* pPageFrame );
void SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopLeftPixel = Point() );
void SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel = Point() );
};
#endif
......
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