[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 24 19:07:03 UTC 2019


 sw/source/core/layout/fly.cxx                   |    4 ++--
 sw/source/uibase/docvw/FloatingTableButton.cxx  |   22 +++++++++++-----------
 sw/source/uibase/docvw/FrameControlsManager.cxx |    4 ++--
 sw/source/uibase/inc/FloatingTableButton.hxx    |    4 ++--
 sw/source/uibase/inc/FrameControlsManager.hxx   |    2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 8e005a5677d5cfca18bb68d2a66fc269e5034d25
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Mar 22 21:46:00 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Mar 24 19:40:00 2019 +0100

    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: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 743b0a92acc3d1850f4890efaa706098ebf9f558)
    
    Change-Id: I38fd782485a180e0d5223b52cc2c6ee061661600
    Reviewed-on: https://gerrit.libreoffice.org/69581
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index e19893fb62ce..acd348b096a5 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -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 )
diff --git a/sw/source/uibase/docvw/FloatingTableButton.cxx b/sw/source/uibase/docvw/FloatingTableButton.cxx
index ccbd0a8c17d3..598fc547d9aa 100644
--- a/sw/source/uibase/docvw/FloatingTableButton.cxx
+++ b/sw/source/uibase/docvw/FloatingTableButton.cxx
@@ -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();
diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx
index 26c26cd39826..b7f8f0b3079b 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -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 );
 }
 
diff --git a/sw/source/uibase/inc/FloatingTableButton.hxx b/sw/source/uibase/inc/FloatingTableButton.hxx
index b64ddfe07912..6e8fd4a81ce2 100644
--- a/sw/source/uibase/inc/FloatingTableButton.hxx
+++ b/sw/source/uibase/inc/FloatingTableButton.hxx
@@ -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: */
diff --git a/sw/source/uibase/inc/FrameControlsManager.hxx b/sw/source/uibase/inc/FrameControlsManager.hxx
index 096e61376b8c..875c8cfe878b 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 SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopLeftPixel = Point() );
+        void SetFloatingTableButton( const SwFlyFrame* pFlyFrame, bool bShow, Point aTopRightPixel = Point() );
 };
 
 #endif


More information about the Libreoffice-commits mailing list