Tag: cws_src680_dba30a
User: oj      
Date: 2008-02-22 12:47:50+0000
Modified:
   dba/dbaccess/source/ui/browser/brwctrlr.cxx
   dba/dbaccess/source/ui/inc/browserids.hxx
   dba/dbaccess/uiconfig/dbtdata/menubar/menubar.xml

Log:
 #100251# #100250#  two new commands for the dbtdata menu

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.1&r2=1.103.10.2
Delta lines:  +102 -2
---------------------
--- brwctrlr.cxx        2008-02-05 21:38:27+0000        1.103.10.1
+++ brwctrlr.cxx        2008-02-22 12:47:47+0000        1.103.10.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: brwctrlr.cxx,v $
  *
- *  $Revision: 1.103.10.1 $
+ *  $Revision: 1.103.10.2 $
  *
- *  last change: $Author: fs $ $Date: 2008/02/05 21:38:27 $
+ *  last change: $Author: oj $ $Date: 2008/02/22 12:47:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -615,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 );
@@ -1448,6 +1451,26 @@
                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 ?
@@ -1822,6 +1845,83 @@
            pDialog->SetCanceledNotFoundHdl( LINK( this, 
SbaXDataBrowserController, OnCanceledNotFound ) );
            pDialog->Execute();
        delete pDialog;
+        case ID_BROWSER_INSERT_ROW:
+            try
+            {
+                if (SaveModified())
+                {
+                    // 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())
+            {
+                               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
+                            {
+                                if ( bCanInsert )
+                                {
+                                    Reference< XResultSetUpdate >  
xUpdateCursor(getRowSet(), UNO_QUERY_THROW);
+                                    xUpdateCursor->moveToInsertRow();
+                                }
+                                else
+                                    xCursor->first();
+                            }
+                            catch(Exception&)
+                            {
+                                OSL_ENSURE(0,"Exception caught!");
+                            }
+                        }
+                    }
+                }
+            }
+            
+
+            break;
     }
 
        // restore the grid's normal operating state

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

File [changed]: browserids.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/browserids.hxx?r1=1.38&r2=1.38.116.1
Delta lines:  +4 -3
-------------------
--- browserids.hxx      2007-07-06 08:26:37+0000        1.38
+++ browserids.hxx      2008-02-22 12:47:47+0000        1.38.116.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: browserids.hxx,v $
  *
- *  $Revision: 1.38 $
+ *  $Revision: 1.38.116.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/06 08:26:37 $
+ *  last change: $Author: oj $ $Date: 2008/02/22 12:47:47 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -123,6 +123,7 @@
 #define ID_QUERY_ALIASNAME                                     (SID_SBA_START 
+ 43) // Aliasnamen anzeigen
 #define ID_QUERY_DISTINCT                                      (SID_SBA_START 
+ 44) // Distinct anzeigen
 #define ID_QUERY_EDIT_JOINCONNECTION           (SID_SBA_START + 45) // 
show-edit Join
+#define ID_BROWSER_INSERT_ROW                  (SID_SBA_START + 46) // insert 
row
 #define ID_QUERY_ZOOM_IN                                       SID_ZOOM_IN
 #define ID_QUERY_ZOOM_OUT                                      SID_ZOOM_OUT
 

Directory: /dba/dbaccess/uiconfig/dbtdata/menubar/
==================================================

File [changed]: menubar.xml
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/uiconfig/dbtdata/menubar/menubar.xml?r1=1.1.2.2&r2=1.1.2.3
Delta lines:  +6 -0
-------------------
--- menubar.xml 2008-02-11 13:49:27+0000        1.1.2.2
+++ menubar.xml 2008-02-22 12:47:48+0000        1.1.2.3
@@ -24,6 +24,7 @@
                        <menu:menuitem menu:id=".uno:Paste"/>
                        <menu:menuseparator/>
                        <menu:menuitem menu:id=".uno:FormSlots/saveRecord"/>
+                       <menu:menuitem menu:id=".uno:FormSlots/deleteRecord"/>
                        <menu:menuseparator/>
                        <menu:menuitem menu:id=".uno:DSBEditDoc"/>
                </menu:menupopup>
@@ -34,6 +35,11 @@
                        <menu:menuitem menu:id=".uno:StatusBarVisible"/>
                </menu:menupopup>
        </menu:menu>
+       <menu:menu menu:id=".uno:InsertMenu">
+               <menu:menupopup>
+                       <menu:menuitem menu:id=".uno:FormSlots/insertRecord"/>
+               </menu:menupopup>
+       </menu:menu>
        <menu:menu menu:id=".uno:ToolsMenu">
                <menu:menupopup>
                        <menu:menu menu:id=".uno:MacrosMenu">




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

Reply via email to