Tag: cws_src680_hsqlcsv
User: fs      
Date: 2008-01-17 02:23:22+0000
Modified:
   dba/dbaccess/source/ui/browser/unodatbr.cxx

Log:
 RESYNC: (1.184-1.192); FILE MERGED

File Changes:

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

File [changed]: unodatbr.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.176.20.3&r2=1.176.20.4
Delta lines:  +30 -73
---------------------
--- unodatbr.cxx        2006-12-18 07:52:57+0000        1.176.20.3
+++ unodatbr.cxx        2008-01-17 02:23:20+0000        1.176.20.4
@@ -115,6 +115,9 @@
 #ifndef _SFXINTITEM_HXX //autogen
 #include <svtools/intitem.hxx>
 #endif
+#ifndef _UNOTOOLS_CONFIGNODE_HXX_
+#include <unotools/confignode.hxx>
+#endif
 #ifndef _SV_WAITOBJ_HXX
 #include <vcl/waitobj.hxx>
 #endif
@@ -239,9 +242,6 @@
 #ifndef _DBU_BRW_HRC_
 #include "dbu_brw.hrc"
 #endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
-#include "moduledbu.hxx"
-#endif
 #ifndef DBACCESS_SBA_GRID_HRC
 #include "sbagrid.hrc"
 #endif
@@ -551,7 +551,7 @@
         m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) );
                m_pSplitter->SetBackground( Wallpaper( 
Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
 
-               m_pTreeView = new 
DBTreeView(getBrowserView(),m_xMultiServiceFacatory, WB_TABSTOP | WB_BORDER);
+               m_pTreeView = new DBTreeView(getBrowserView(),getORB(), 
WB_TABSTOP | WB_BORDER);
                m_pTreeView->SetPreExpandHandler(LINK(this, 
SbaTableQueryBrowser, OnExpandEntry));
 
                m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, 
OnCopyEntry));
@@ -1752,7 +1752,7 @@
                                        if (xDataSource.is())
                                        {
                                                sal_Int32 nType = 
::comphelper::getINT32(xDataSource->getPropertyValue(PROPERTY_COMMANDTYPE));
-                                               aReturn.bEnabled = 
aReturn.bEnabled && 
((::comphelper::getBOOL(xDataSource->getPropertyValue(PROPERTY_USE_ESCAPE_PROCESSING))
 || (nType == ::com::sun::star::sdb::CommandType::QUERY)));
+                                               aReturn.bEnabled = 
aReturn.bEnabled && 
((::comphelper::getBOOL(xDataSource->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))
 || (nType == ::com::sun::star::sdb::CommandType::QUERY)));
                                        }
                                }
                                catch(DisposedException&)
@@ -2028,8 +2028,6 @@
        pDSData->eType = etDatasource;
     pDSData->sAccessor = sDataSourceId;
        pDSData->xConnection = _rxConnection;
-    if ( _rxConnection.is() )
-        pDSData->aController = ModelControllerConnector( 
impl_nf_getDBDocumentForConnection( _rxConnection ), this );
        pDatasourceEntry->SetUserData(pDSData);
 
        // the child for the queries container
@@ -2102,8 +2100,8 @@
 {
     ::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( 
_pParent ) );
 
-    Image aImage( pImageProvider->getImage( _rName, getDatabaseObjectType( 
_eEntryType ), false ) );
-    Image aImageHC( pImageProvider->getImage( _rName, getDatabaseObjectType( 
_eEntryType ), true ) );
+    Image aImage, aImageHC;
+    pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), 
aImage, aImageHC );
 
     SvLBoxEntry* pNewEntry = m_pTreeView->getListBox()->InsertEntry( _rName, 
_pParent, sal_False, LIST_APPEND, _pUserData );
 
@@ -2307,7 +2305,7 @@
                                // set this _before_ setting the connection, 
else the rowset would rebuild it ...
                        xProp->setPropertyValue(PROPERTY_COMMANDTYPE, 
makeAny(_nCommandType));
                        xProp->setPropertyValue(PROPERTY_COMMAND, 
makeAny(_rCommand));
-                       xProp->setPropertyValue(PROPERTY_USE_ESCAPE_PROCESSING, 
::cppu::bool2any(_bEscapeProcessing));
+                       xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, 
::cppu::bool2any(_bEscapeProcessing));
                        if ( m_bPreview )
                        {
                                // this be undone by the grid control in 
DbGridControl::RecalcRows
@@ -2903,13 +2901,7 @@
        {
                DBTreeListModel::DBTreeListUserData* pTreeListData = 
static_cast< DBTreeListModel::DBTreeListUserData* >( _pDSEntry->GetUserData() );
                if ( pTreeListData )
-               {
-            DBG_ASSERT( !pTreeListData->xConnection.is() == 
!!pTreeListData->aController.empty(),
-                "SbaTableQueryBrowser::disposeConnection: inconsistency: there 
should either be a connection and a controller, or none of both!" );
-
             impl_releaseConnection( pTreeListData->xConnection );
-            pTreeListData->aController.clear();
-               }
        }
 }
 
@@ -2917,7 +2909,7 @@
 void SbaTableQueryBrowser::closeConnection(SvLBoxEntry* _pDSEntry,sal_Bool 
_bDisposeConnection)
 {
        DBG_ASSERT(_pDSEntry, "SbaTableQueryBrowser::closeConnection: invalid 
entry (NULL)!");
-       OSL_ENSURE( impl_isDataSourceEntry( _pDSEntry ), 
"SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
+       DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), 
"SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
 
        // if one of the entries of the given DS is displayed currently, unload 
the form
        if (m_pCurrentlyDisplayed && 
(m_pTreeView->getListBox()->GetRootLevelParent(m_pCurrentlyDisplayed) == 
_pDSEntry))
@@ -3033,35 +3025,16 @@
 
     const NamedValueCollection& rArguments( getInitParams() );
 
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_DATASOURCENAME, sInitialDataSourceName ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for DataSourceName.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_COMMANDTYPE, nInitialDisplayCommandType ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for CommandType.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_COMMAND, sInitialCommand ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for Command.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_ACTIVECONNECTION, xForeignConnection ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for ActiveConnection.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, aCatalogName ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for UpdateCatalogName.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, aSchemaName ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for UpdateSchemaName.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_UPDATE_TABLENAME, aTableName ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for UpdateTableName.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_USE_ESCAPE_PROCESSING, bEsacpeProcessing ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for EscapeProcessing.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( "Frame", xFrame ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for Frame.")),*this);
-
-    if ( !rArguments.getIfExists_ensureType( 
(::rtl::OUString)PROPERTY_SHOWMENU, m_bShowMenu ) )
-        throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid 
argument type for ShowMenu.")),*this);
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_DATASOURCENAME, 
sInitialDataSourceName );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_COMMANDTYPE, 
nInitialDisplayCommandType );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_COMMAND, 
sInitialCommand );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_ACTIVECONNECTION, 
xForeignConnection );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, 
aCatalogName );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, 
aSchemaName );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_UPDATE_TABLENAME, 
aTableName );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, 
bEsacpeProcessing );
+    rArguments.get_ensureType( "Frame", xFrame );
+    rArguments.get_ensureType( (::rtl::OUString)PROPERTY_SHOWMENU, m_bShowMenu 
);
 
     sal_Bool bShowTreeView = rArguments.getOrDefault( 
(::rtl::OUString)PROPERTY_SHOWTREEVIEW, sal_True );
     m_bEnableBrowser = rArguments.getOrDefault( 
(::rtl::OUString)PROPERTY_SHOWTREEVIEWBUTTON, sal_True );
@@ -3262,28 +3235,13 @@
     return _rConnection.is();
 }
 
+#ifdef DBG_UTIL
 // 
-----------------------------------------------------------------------------
 bool SbaTableQueryBrowser::impl_isDataSourceEntry( SvLBoxEntry* _pEntry ) const
 {
     return m_pTreeModel->GetRootLevelParent( _pEntry ) == _pEntry;
 }
-
-// -------------------------------------------------------------------------
-Reference< XModel > SbaTableQueryBrowser::impl_nf_getDBDocumentForConnection( 
const Reference< XConnection >& _rxConnection )
-{
-    Reference< XModel > xModel;
-    try
-    {
-           Reference< XChild > xChild( _rxConnection, UNO_QUERY_THROW );
-        Reference< XDocumentDataSource > xDS( xChild->getParent(), 
UNO_QUERY_THROW );
-        xModel = Reference< XModel >( xDS->getDatabaseDocument(), 
UNO_QUERY_THROW );
-    }
-    catch( const Exception& )
-    {
-       OSL_ENSURE( sal_False, 
"SbaTableQueryBrowser::impl_nf_getDBDocumentForConnection: caught an 
exception!" );
-    }
-    return xModel;
-}
+#endif
 
 // 
-----------------------------------------------------------------------------
 sal_Bool SbaTableQueryBrowser::ensureConnection( SvLBoxEntry* _pDSEntry, void* 
pDSData, SharedConnection& _rConnection )
@@ -3310,16 +3268,9 @@
 
                        // connect
             _rConnection.reset(
-                connect( getDataSourceAcessor( _pDSEntry ), 
sConnectingContext, rtl::OUString(), sal_True ),
+                connect( getDataSourceAcessor( _pDSEntry ), 
sConnectingContext, sal_True ),
                 SharedConnection::TakeOwnership
             );
-                       if ( _rConnection.is() )
-            {
-                DBG_ASSERT( impl_isDataSourceEntry( _pDSEntry ), 
"SbaTableQueryBrowser::ensureConnection: this is no data source entry!" );
-                    // if this fails, we can't expect 
pTreeListData->aController to point to a valid
-                    // instance, since those instances are only filled for 
data source entries
-                pTreeListData->aController = ModelControllerConnector( 
impl_nf_getDBDocumentForConnection( _rConnection ), this );
-            }
 
                        // remember the connection
                        pTreeListData->xConnection = _rConnection;
@@ -3531,6 +3482,12 @@
        }
        aContextMenu.EnableItem(SID_COPY,       sal_False);
 
+    ::utl::OConfigurationTreeRoot aConfig( 
::utl::OConfigurationTreeRoot::createWithServiceFactory( getORB(),
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"/org.openoffice.Office.DataAccess/ApplicationIntegration/InstalledFeatures/Common"
 ) ) ) );
+    sal_Bool bHaveEditDatabase( sal_True );
+    OSL_VERIFY( aConfig.getNodeValue( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "EditDatabaseFromDataSourceView" ) ) ) >>= 
bHaveEditDatabase );
+       aContextMenu.EnableItem( ID_TREE_EDIT_DATABASE, bHaveEditDatabase );
+
        if ( pEntry )
        {
 
@@ -3561,7 +3518,7 @@
        // rebuild conn not implemented yet
        aContextMenu.EnableItem(ID_TREE_REBUILD_CONN, sal_False);
 
-       if (!m_xMultiServiceFacatory.is())
+       if (!getORB().is())
                // no ORB -> no administration dialog
                aContextMenu.EnableItem(ID_TREE_EDIT_DATABASE, sal_False);
 
@@ -3661,7 +3618,7 @@
                if ( xQuery.is() )
                {
                        xQuery->getPropertyValue( PROPERTY_COMMAND ) >>= 
_rCommand;
-                       _bEscapeProcessing = ::cppu::any2bool( 
xQuery->getPropertyValue( PROPERTY_USE_ESCAPE_PROCESSING ) );
+                       _bEscapeProcessing = ::cppu::any2bool( 
xQuery->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) );
                        return sal_True;
                }
        }




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

Reply via email to