sc/source/ui/view/viewfun2.cxx |   63 ++++++++++++++++++++++++-----------------
 sw/source/ui/misc/bookmark.cxx |    2 -
 2 files changed, 38 insertions(+), 27 deletions(-)

New commits:
commit 8724448a2434a08ab2f5ac20b2285d94379189fe
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Jun 20 15:55:41 2019 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Thu Jun 20 23:50:19 2019 +0200

    fix putting ; between entries
    
    broken since...
    
    commit 8bddb3c77048814b370351e0eb72c31f289fb34f
    Author: Caolán McNamara <[email protected]>
    Date:   Thu Mar 14 12:51:31 2019 +0000
    
        weld SwInsertBookmarkDlg
    
    Change-Id: I2a07820dd5ea13976a1044323a5b52835fd711f1
    Reviewed-on: https://gerrit.libreoffice.org/74469
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 260bb6e6bc49..11144f55b703 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -152,7 +152,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, 
weld::TreeView&, void)
         sw::mark::IMark* pBookmark = 
reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(nRow).toInt64());
         const OUString& sEntryName = pBookmark->GetName();
         sEditBoxText.append(sEntryName);
-        if (nRow > 1)
+        if (i > 1)
             sEditBoxText.append(";");
     }
     if (!aSelectedRows.empty())
commit 7778ace84cbeb5ee8481b9de8b7bc63778470075
Author:     Eike Rathke <[email protected]>
AuthorDate: Thu Jun 20 18:02:38 2019 +0200
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Thu Jun 20 23:50:05 2019 +0200

    Resolves: tdf#108209 let auto fill handle double click stop at existing data
    
    Also consolidate the code to take both, left and right, data areas
    into account, still preferring left if it exists.
    
    Change-Id: I3d46b32f3790fd367fe92712fbcab0c392294599
    Reviewed-on: https://gerrit.libreoffice.org/74462
    Reviewed-by: Eike Rathke <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 7dd57a914be5f8fc2b53b7725c16625887cf7439)
    Reviewed-on: https://gerrit.libreoffice.org/74468

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index f34ce438dae7..b97b40b95068 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1658,40 +1658,51 @@ void ScViewFunc::FillCrossDblClick()
 
     if ( nEndY < MAXROW )
     {
-        if ( nStartX > 0 )
+        const bool bDataLeft = (nStartX > 0);
+        if (bDataLeft || nEndX < MAXCOL)
         {
-            SCCOL nMovX = nStartX - 1;
-            SCROW nMovY = nStartY;
+            // Check that there is
+            // 1) data immediately left (preferred) or right of start (row) of 
selection
+            // 2) data there below
+            // 3) no data immediately below selection
 
-            if ( pDoc->HasData( nMovX, nStartY, nTab ) &&
-                 pDoc->HasData( nMovX, nStartY + 1, nTab ) )
+            SCCOL nMovX = (bDataLeft ? nStartX - 1 : nEndX + 1);
+            SCROW nMovY = nStartY;
+            bool bDataFound = (pDoc->HasData( nMovX, nStartY, nTab) && 
pDoc->HasData( nMovX, nStartY + 1, nTab));
+            if (!bDataFound && bDataLeft && nEndX < MAXCOL)
             {
-                pDoc->FindAreaPos( nMovX, nMovY, nTab, SC_MOVE_DOWN );
-
-                if ( nMovY > nEndY )
-                {
-                    FillAuto( FILL_TO_BOTTOM, nStartX, nStartY, nEndX, nEndY,
-                              nMovY - nEndY );
-                    return;
-                }
+                nMovX = nEndX + 1;  // check right
+                bDataFound = (pDoc->HasData( nMovX, nStartY, nTab) && 
pDoc->HasData( nMovX, nStartY + 1, nTab));
             }
-        }
 
-        if ( nEndX < MAXCOL )
-        {
-            SCCOL nMovX = nEndX + 1;
-            SCROW nMovY = nStartY;
-
-            if ( pDoc->HasData( nMovX, nStartY, nTab ) &&
-                 pDoc->HasData( nMovX, nStartY + 1, nTab ) )
+            if (bDataFound && pDoc->IsBlockEmpty( nTab, nStartX, nEndY + 1, 
nEndX, nEndY + 1, true))
             {
-                pDoc->FindAreaPos( nMovX, nMovY, nTab, SC_MOVE_DOWN );
+                // Get end of data left or right.
+                pDoc->FindAreaPos( nMovX, nMovY, nTab, SC_MOVE_DOWN);
+                // Find minimum end row of below empty area and data right.
+                for (SCCOL nX = nStartX; nX <= nEndX; ++nX)
+                {
+                    SCROW nY = nEndY + 1;
+                    // Get next row with data in this column.
+                    pDoc->FindAreaPos( nX, nY, nTab, SC_MOVE_DOWN);
+                    if (nMovY == MAXROW && nY == MAXROW)
+                    {
+                        // FindAreaPos() returns MAXROW also if there is no
+                        // data at all from the start, so check if that
+                        // contains data if the nearby (left or right) data
+                        // ends there and increment if no data here, pretending
+                        // the next data would be thereafter so nMovY will not
+                        // be decremented.
+                        if (!pDoc->HasData( nX, nY, nTab))
+                            ++nY;
+                    }
+                    if (nMovY > nY - 1)
+                        nMovY = nY - 1;
+                }
 
-                if ( nMovY > nEndY )
+                if (nMovY > nEndY)
                 {
-                    FillAuto( FILL_TO_BOTTOM, nStartX, nStartY, nEndX, nEndY,
-                              nMovY - nEndY );
-                    return;
+                    FillAuto( FILL_TO_BOTTOM, nStartX, nStartY, nEndX, nEndY, 
nMovY - nEndY);
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to