User: kz      
Date: 2008-03-05 16:52:32+0000
Modified:
   dba/dbaccess/source/ui/browser/brwctrlr.cxx

Log:
 INTEGRATION: CWS dba30a (1.103.10); FILE MERGED
 2008/03/05 10:56:21 oj 1.103.10.5: #100250# move to last row before move to 
insert row
 2008/02/26 09:10:48 oj 1.103.10.4: #100251# delete selected rows or the 
current one
 2008/02/25 13:50:56 fs 1.103.10.3: #i10000#
 2008/02/22 12:47:47 oj 1.103.10.2: #100251# #100250#  two new commands for the 
dbtdata menu
 2008/02/05 21:38:27 fs 1.103.10.1: #i85879# cleanup the toolbar mess in the 
data source browser

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&r2=1.104
Delta lines:  +72 -19
---------------------
--- brwctrlr.cxx        2008-01-30 08:42:45+0000        1.103
+++ brwctrlr.cxx        2008-03-05 16:52:29+0000        1.104
@@ -523,6 +523,7 @@
        ,m_aAsyncGetCellFocus(LINK(this, SbaXDataBrowserController, 
OnAsyncGetCellFocus))
        ,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD))
        ,m_sStateUndoRecord(ModuleRes(RID_STR_UNDO_MODIFY_RECORD))
+    ,m_sModuleIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.sdb.DataSourceBrowser" ) ) )
     ,m_pLoadThread(NULL)
        ,m_pFormControllerImpl(NULL)
        ,m_nPendingLoadFinished(0)
@@ -614,6 +615,9 @@
 // 
-----------------------------------------------------------------------------
 void SbaXDataBrowserController::describeSupportedFeatures()
 {
+    
+    implDescribeSupportedFeature( ".uno:FormSlots/deleteRecord",    
SID_FM_DELETEROWS,      CommandGroup::EDIT );
+    implDescribeSupportedFeature( ".uno:FormSlots/insertRecord",    
ID_BROWSER_INSERT_ROW,  CommandGroup::INSERT );
        OGenericUnoController::describeSupportedFeatures();
     implDescribeSupportedFeature( ".uno:FormSlots/undoRecord",      
ID_BROWSER_UNDORECORD,  CommandGroup::CONTROLS );
        implDescribeSupportedFeature( ".uno:FormController/undoRecord", 
ID_BROWSER_UNDORECORD,  CommandGroup::CONTROLS );
@@ -994,6 +998,20 @@
 }
 
 // -----------------------------------------------------------------------
+void SAL_CALL SbaXDataBrowserController::setIdentifier( const ::rtl::OUString& 
_Identifier ) throw (RuntimeException)
+{
+    ::osl::MutexGuard aGuard( m_aMutex );
+    m_sModuleIdentifier = _Identifier;
+}
+
+// -----------------------------------------------------------------------
+::rtl::OUString SAL_CALL SbaXDataBrowserController::getIdentifier(  ) throw 
(RuntimeException)
+{
+    ::osl::MutexGuard aGuard( m_aMutex );
+    return m_sModuleIdentifier;
+}
+
+// -----------------------------------------------------------------------
 void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) 
throw ( RuntimeException )
 {
        Reference< XPropertySet >  xSource(evt.Source, UNO_QUERY);
@@ -1455,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:
@@ -1822,6 +1860,39 @@
 
        switch (nId)
        {
+        case ID_BROWSER_INSERT_ROW:
+            try
+            {
+                if (SaveModified())
+                {
+                                       getRowSet()->afterLast();
+                    // check if it is available
+                                   Reference< XResultSetUpdate >  
xUpdateCursor(getRowSet(), UNO_QUERY_THROW);
+                    xUpdateCursor->moveToInsertRow();
+                }
+            }
+            catch(Exception&)
+            {
+                OSL_ENSURE(0,"Exception caught!");
+            }
+            break;
+        case SID_FM_DELETEROWS:
+            
+            if (SaveModified())
+            {
+                               SbaGridControl* pVclGrid = 
getBrowserView()->getVclControl();
+                               if ( pVclGrid )
+                               {
+                                       if( !pVclGrid->GetSelectRowCount() )
+                                       {
+                                               pVclGrid->DeactivateCell();
+                                               
pVclGrid->SelectRow(pVclGrid->GetCurRow());
+                                       }
+                                       pVclGrid->DeleteSelectedRows();
+                               }
+            }
+            break;
+
                case ID_BROWSER_FILTERED:
                        if (SaveModified())
                        {
@@ -2956,24 +3027,6 @@
                
xFormError->addSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this);
 }
 // 
-----------------------------------------------------------------------------
-void SbaXDataBrowserController::onLoadedMenu(const Reference< 
::com::sun::star::frame::XLayoutManager >& _xLayoutManager)
-{
-       OGenericUnoController::onLoadedMenu( _xLayoutManager );
-
-    // for task frames, we have our own cut/copy/paste functionality
-       // 22.05.2002 - 99030 - [EMAIL PROTECTED]
-       if ( m_xCurrentFrame.is() && _xLayoutManager.is() )
-       {
-        if ( m_xCurrentFrame->isTop() )
-               {
-                       _xLayoutManager->lock();
-                       _xLayoutManager->createElement( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/copyobjectbar"))
 );
-                       _xLayoutManager->unlock();
-                       _xLayoutManager->doLayout();
-               }
-       }
-}
-// 
-----------------------------------------------------------------------------
 void SbaXDataBrowserController::addColumnListeners(const Reference< 
::com::sun::star::awt::XControlModel > & _xGridControlModel)
 {
 // ... all the grid columns




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

Reply via email to