[Libreoffice-commits] core.git: 3 commits - include/o3tl sw/source

Michael Stahl mstahl at redhat.com
Tue Sep 20 12:35:26 UTC 2016


 include/o3tl/cow_wrapper.hxx   |    3 ++-
 sw/source/ui/dbui/dbinsdlg.cxx |   39 +++++++++++++++++++++++++++++++++------
 2 files changed, 35 insertions(+), 7 deletions(-)

New commits:
commit bb0e9dd57e7ca0f346ac1102139edaec4e6b3790
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Sep 20 11:25:01 2016 +0200

    tdf#101164 sw: Insert Database Columns dialog: expect selection
    
    ... as bookmarks, not raw row indexes.  Bookmarks is what
    FmXGridPeer::getSelection() / FmGridControl::getSelectionBookmarks()
    always produce, and it's unclear to me if there even is a case where
    something other than a bookmark ends up pasted into Writer.
    
    The only case where dbaccess creates a selection that doesn't contain
    bookmarks is in SbaGridControl::implTransferSelectedRows() if no rows
    are selected but i haven't figured out how to reach that state.
    
    (regression in OOo 3.3)
    
    Change-Id: Ib45787bc002447338df775102790843f2cb1dd3b

diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index c0214de..b9bbe1c 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/sdbc/XRow.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdb/XColumn.hpp>
@@ -994,6 +995,14 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
     Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY );
     Reference <XNameAccess> xCols = xColsSupp->getColumns();
 
+    static bool isSelectionBookmarks = true; // TODO is this always true here?
+    uno::Reference<sdbcx::XRowLocate> xRowLocate;
+    if (isSelectionBookmarks)
+    {
+        xRowLocate.set(xResultSet, uno::UNO_QUERY);
+        assert(xRowLocate.is());
+    }
+
     do{                                 // middle checked loop!!
     if( bAsTable )          // Daten als Tabelle einfuegen
     {
@@ -1071,9 +1080,16 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
             {
                 if(pSelection)
                 {
-                    sal_Int32 nPos = 0;
-                    pSelection[i] >>= nPos;
-                    bBreak = !xResultSet->absolute(nPos);
+                    if (isSelectionBookmarks)
+                    {
+                        bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
+                    }
+                    else
+                    {
+                        sal_Int32 nPos = 0;
+                        pSelection[i] >>= nPos;
+                        bBreak = !xResultSet->absolute(nPos);
+                    }
                 }
                 else if(!i)
                     bBreak = !xResultSet->first();
@@ -1264,9 +1280,16 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
                 {
                     if(pSelection)
                     {
-                        sal_Int32 nPos = 0;
-                        pSelection[i] >>= nPos;
-                        bBreak = !xResultSet->absolute(nPos);
+                        if (isSelectionBookmarks)
+                        {
+                            bBreak = !xRowLocate->moveToBookmark(pSelection[i]);
+                        }
+                        else
+                        {
+                            sal_Int32 nPos = 0;
+                            pSelection[i] >>= nPos;
+                            bBreak = !xResultSet->absolute(nPos);
+                        }
                     }
                     else if(!i)
                         bBreak = !xResultSet->first();
commit 984790f15d935f986fd0f5ed92f6a63c17eace35
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Sep 16 22:45:33 2016 +0200

    tdf#101164 sw: Insert Database Columns dialog: ensure one of ...
    
    ... the radio buttons is active by default, in case there's no
    configuration to read the state from yet.
    
    Change-Id: If1c0462eb5cb9ea5177f1d5a8953b34fabd0829c

diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 6145cde..c0214de 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -363,6 +363,10 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
         m_pIbDbcolAllFrom->Enable( false );
     }
 
+    // by default, select header button
+    m_pRbHeadlColnms->Check(true);
+    m_pRbHeadlEmpty->Check(false);
+
     m_pRbAsTable->SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
     m_pRbAsField->SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
     m_pRbAsText->SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
commit 14bcb68cbbd23db8705d40dd116d3970a00b08e7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Sep 19 17:49:11 2016 +0200

    o3tl: replace yet another sal_Size with std::size_t
    
    Change-Id: I3f6a401d6d5ed7b44a71dc8bda559dcc4d57ee32

diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx
index 425a166..a80241e 100644
--- a/include/o3tl/cow_wrapper.hxx
+++ b/include/o3tl/cow_wrapper.hxx
@@ -23,6 +23,7 @@
 #include <osl/interlck.h>
 
 #include <utility>
+#include <cstddef>
 
 namespace o3tl
 {
@@ -34,7 +35,7 @@ namespace o3tl
      */
     struct UnsafeRefCountingPolicy
     {
-        typedef sal_Size ref_count_t;
+        typedef std::size_t ref_count_t;
         static void incrementCount( ref_count_t& rCount ) { ++rCount; }
         static bool decrementCount( ref_count_t& rCount ) { return --rCount != 0; }
     };


More information about the Libreoffice-commits mailing list