Tag: cws_src680_dba30a
User: oj      
Date: 2008-02-26 09:10:51+0000
Modified:
   dba/dbaccess/source/ui/browser/brwctrlr.cxx
   dba/dbaccess/source/ui/browser/sbagrid.cxx

Log:
 #100251# delete selected rows or the current one

File Changes:

Directory: /dba/dbaccess/source/ui/browser/
===========================================

File [changed]: brwctrlr.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/brwctrlr.cxx?r1=1.103.10.3&r2=1.103.10.4
Delta lines:  +32 -76
---------------------
--- brwctrlr.cxx        2008-02-25 13:50:56+0000        1.103.10.3
+++ brwctrlr.cxx        2008-02-26 09:10:48+0000        1.103.10.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: brwctrlr.cxx,v $
  *
- *  $Revision: 1.103.10.3 $
+ *  $Revision: 1.103.10.4 $
  *
- *  last change: $Author: fs $ $Date: 2008/02/25 13:50:56 $
+ *  last change: $Author: oj $ $Date: 2008/02/26 09:10:48 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1451,26 +1451,6 @@
                switch (nId)
                {
                        case ID_BROWSER_REMOVEFILTER:
-            case ID_BROWSER_INSERT_ROW:
-                {
-                    // check if it is available
-                                   Reference< XPropertySet >  
xDataSourceSet(getRowSet(), UNO_QUERY);
-                                   if (!xDataSourceSet.is())
-                                           break;      // no datasource -> no 
edit mode
-
-                                   sal_Int32 nDataSourcePrivileges = 
::comphelper::getINT32(xDataSourceSet->getPropertyValue(PROPERTY_PRIVILEGES));
-                                   aReturn.bEnabled = ((nDataSourcePrivileges 
& ::com::sun::star::sdbcx::Privilege::INSERT) != 0) && 
::comphelper::getBOOL(xDataSourceSet->getPropertyValue(::rtl::OUString::createFromAscii("AllowInserts")));
-                }
-                break;
-            case SID_FM_DELETEROWS:
-                {
-                                   Reference< XPropertySet >  
xFormSet(getRowSet(), UNO_QUERY);
-                                   sal_Int32 nCount = 
::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_ROWCOUNT));
-                    sal_Bool bNew = sal_False;
-                    xFormSet->getPropertyValue(PROPERTY_ISNEW) >>= bNew;
-                                   aReturn.bEnabled = nCount != 0 && !bNew;
-                           }
-                break;
                                if (!m_xParser.is())
                                        break;
                                // any filter or sort order set ?
@@ -1493,6 +1473,26 @@
                                aReturn.bEnabled = nCount != 0;
                        }
                        break;
+            case ID_BROWSER_INSERT_ROW:
+                {
+                    // check if it is available
+                                   Reference< XPropertySet >  
xDataSourceSet(getRowSet(), UNO_QUERY);
+                                   if (!xDataSourceSet.is())
+                                           break;      // no datasource -> no 
edit mode
+
+                                   sal_Int32 nDataSourcePrivileges = 
::comphelper::getINT32(xDataSourceSet->getPropertyValue(PROPERTY_PRIVILEGES));
+                                   aReturn.bEnabled = ((nDataSourcePrivileges 
& ::com::sun::star::sdbcx::Privilege::INSERT) != 0) && 
::comphelper::getBOOL(xDataSourceSet->getPropertyValue(::rtl::OUString::createFromAscii("AllowInserts")));
+                }
+                break;
+            case SID_FM_DELETEROWS:
+                {
+                                   Reference< XPropertySet >  
xFormSet(getRowSet(), UNO_QUERY);
+                                   sal_Int32 nCount = 
::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_ROWCOUNT));
+                    sal_Bool bNew = sal_False;
+                    xFormSet->getPropertyValue(PROPERTY_ISNEW) >>= bNew;
+                                   aReturn.bEnabled = nCount != 0 && !bNew;
+                           }
+                break;
 
                        case ID_BROWSER_PASTE:
                        case ID_BROWSER_COPY:
@@ -1879,59 +1879,15 @@
             
             if (SaveModified())
             {
-                               Reference< XPropertySet >  
xFormSet(getRowSet(), UNO_QUERY);
-                Reference< XResultSet >  xCursor(xFormSet, UNO_QUERY);
-                sal_Bool bNew = sal_False;
-                xFormSet->getPropertyValue(PROPERTY_ISNEW) >>= bNew;
-                sal_Bool bSuccess = sal_False;
-                sal_Bool bLeft = sal_False;
-                sal_Bool bRight = sal_False;
-                
-                if ( !bNew )
-                {
-                    sal_uInt32 nCount = 0;
-                    xFormSet->getPropertyValue(PROPERTY_ROWCOUNT) >>= nCount;
-                    try
-                    {
-                        bLeft = xCursor->isLast() && nCount > 1;
-                        bRight= !xCursor->isLast();
-                        ::com::sun::star::sdb::RowChangeEvent aEvent;
-                        bSuccess = confirmDelete(aEvent);
-                        if ( bSuccess )
-                        {
-                            Reference< XResultSetUpdate >  
xUpdateCursor(getRowSet(), UNO_QUERY_THROW);
-                            xUpdateCursor->deleteRow();
-                        }
-                    }
-                    catch(Exception&)
-                    {
-                        OSL_ENSURE(0,"Exception caught!");
-                        bSuccess = sal_False;
-                    }
-                    if (bSuccess)
-                    {
-                        sal_Int32 nDataSourcePrivileges = 
::comphelper::getINT32(xFormSet->getPropertyValue(PROPERTY_PRIVILEGES));
-                                   bool bCanInsert = ((nDataSourcePrivileges & 
::com::sun::star::sdbcx::Privilege::INSERT) != 0) && 
::comphelper::getBOOL(xFormSet->getPropertyValue(::rtl::OUString::createFromAscii("AllowInserts")));
-                        if (bLeft || bRight)
-                            xCursor->relative(bRight ? 1 : -1);
-                        else
-                        {
-                            try
+                               SbaGridControl* pVclGrid = 
getBrowserView()->getVclControl();
+                               if ( pVclGrid )
                             {
-                                if ( bCanInsert )
+                                       if( !pVclGrid->GetSelectRowCount() )
                                 {
-                                    Reference< XResultSetUpdate >  
xUpdateCursor(getRowSet(), UNO_QUERY_THROW);
-                                    xUpdateCursor->moveToInsertRow();
-                                }
-                                else
-                                    xCursor->first();
-                            }
-                            catch(Exception&)
-                            {
-                                OSL_ENSURE(0,"Exception caught!");
-                            }
-                        }
+                                               pVclGrid->DeactivateCell();
+                                               
pVclGrid->SelectRow(pVclGrid->GetCurRow());
                     }
+                                       pVclGrid->DeleteSelectedRows();
                 }
             }
             break;

File [changed]: sbagrid.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/sbagrid.cxx?r1=1.82&r2=1.82.6.1
Delta lines:  +7 -4
-------------------
--- sbagrid.cxx 2008-01-07 08:40:22+0000        1.82
+++ sbagrid.cxx 2008-02-26 09:10:48+0000        1.82.6.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: sbagrid.cxx,v $
  *
- *  $Revision: 1.82 $
+ *  $Revision: 1.82.6.1 $
  *
- *  last change: $Author: obo $ $Date: 2008/01/07 08:40:22 $
+ *  last change: $Author: oj $ $Date: 2008/02/26 09:10:48 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1778,6 +1778,9 @@
        return sRet; 
 }
 // 
-----------------------------------------------------------------------------
-
+void SbaGridControl::DeleteSelectedRows()
+{
+       FmGridControl::DeleteSelectedRows();
+}
 
 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to