User: rt      
Date: 2008-01-30 08:51:16+0000
Modified:
   dba/dbaccess/source/ui/misc/UITools.cxx

Log:
 INTEGRATION: CWS dba24d (1.74.2); FILE MERGED
 2007/11/15 10:02:31 fs 1.74.2.2: #i81658# added createView taking a command 
(instead of the object)
 2007/11/08 14:24:15 fs 1.74.2.1: during #i81658#: string cleanup

File Changes:

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

File [changed]: UITools.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/UITools.cxx?r1=1.75&r2=1.76
Delta lines:  +33 -25
---------------------
--- UITools.cxx 2007-11-21 16:07:06+0000        1.75
+++ UITools.cxx 2008-01-30 08:51:13+0000        1.76
@@ -1697,11 +1697,10 @@
 }
 
 // 
-----------------------------------------------------------------------------
-Reference<XPropertySet> createView( const ::rtl::OUString& _sName
-                                                                  ,const 
Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
-                                                                  ,const 
Reference<XPropertySet>& _xSourceObject)
+Reference< XPropertySet > createView( const ::rtl::OUString& _rName, const 
Reference< XConnection >& _rxConnection,
+                                    const ::rtl::OUString& _rCommand )
 {
-       Reference<XViewsSupplier> xSup(_xConnection,UNO_QUERY);
+       Reference<XViewsSupplier> xSup(_rxConnection,UNO_QUERY);
        Reference< XNameAccess > xViews;
        if(xSup.is())
                xViews = xSup->getViews();
@@ -1715,8 +1714,8 @@
                return NULL;
 
        ::rtl::OUString sCatalog,sSchema,sTable;
-       ::dbtools::qualifiedNameComponents(_xConnection->getMetaData(),
-                                                                               
_sName,
+       ::dbtools::qualifiedNameComponents(_rxConnection->getMetaData(),
+                                                                               
_rName,
                                                                                
sCatalog,
                                                                                
sSchema,
                                                                                
sTable,
@@ -1726,22 +1725,7 @@
        xView->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
        xView->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
 
-       ::rtl::OUString sCommand;
-       
if(_xSourceObject->getPropertySetInfo()->hasPropertyByName(PROPERTY_COMMAND))
-       {
-               _xSourceObject->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
-
-        sal_Bool bEscapeProcessing( sal_False );
-        OSL_VERIFY( _xSourceObject->getPropertyValue( 
PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
-        if ( bEscapeProcessing )
-            sCommand = lcl_createSDBCLevelStatement( sCommand, _xConnection );
-       }
-       else
-       {
-               sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT 
* FROM "));
-               sCommand += composeTableNameForSelect( _xConnection, 
_xSourceObject );
-       }
-       xView->setPropertyValue(PROPERTY_COMMAND,makeAny(sCommand));
+       xView->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) );
 
        Reference<XAppend> xAppend(xViews,UNO_QUERY);
        if(xAppend.is())
@@ -1750,17 +1734,41 @@
        xView = NULL;
        // we need to reget the view because after appending it it is no longer 
valid
        // but this time it isn't a view object it is a table object with type 
"VIEW"
-       Reference<XTablesSupplier> xTabSup(_xConnection,UNO_QUERY);
+       Reference<XTablesSupplier> xTabSup(_rxConnection,UNO_QUERY);
        Reference< XNameAccess > xTables;
        if ( xTabSup.is() )
        {
                xTables = xTabSup->getTables();
-               if ( xTables.is() && xTables->hasByName(_sName) )
-                       xTables->getByName(_sName) >>= xView;
+               if ( xTables.is() && xTables->hasByName( _rName ) )
+                       xTables->getByName( _rName ) >>= xView;
        }
 
        return xView;
 }
+
+// 
-----------------------------------------------------------------------------
+Reference<XPropertySet> createView( const ::rtl::OUString& _rName, const 
Reference< XConnection >& _rxConnection
+                                                                  ,const 
Reference<XPropertySet>& _rxSourceObject)
+{
+       ::rtl::OUString sCommand;
+    Reference< XPropertySetInfo > xPSI( _rxSourceObject->getPropertySetInfo(), 
UNO_SET_THROW );
+       if ( xPSI->hasPropertyByName( PROPERTY_COMMAND ) )
+       {
+               _rxSourceObject->getPropertyValue( PROPERTY_COMMAND ) >>= 
sCommand;
+
+        sal_Bool bEscapeProcessing( sal_False );
+        OSL_VERIFY( _rxSourceObject->getPropertyValue( 
PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
+        if ( bEscapeProcessing )
+            sCommand = lcl_createSDBCLevelStatement( sCommand, _rxConnection );
+       }
+       else
+       {
+               sCommand = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"SELECT * FROM " ) );
+               sCommand += composeTableNameForSelect( _rxConnection, 
_rxSourceObject );
+       }
+    return createView( _rName, _rxConnection, sCommand );
+}
+
 // 
-----------------------------------------------------------------------------
 void fillTreeListNames( const Reference< XNameAccess >& _xContainer, 
DBTreeListBox& _rList,
         USHORT _nImageId, USHORT _nHighContrastImageId, SvLBoxEntry* _pParent, 
IContainerFoundListener* _pContainerFoundListener )




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

Reply via email to