Tag: cws_dev300_odbmacros3
User: fs      
Date: 2008-05-09 09:27:53+0000
Modified:
   dba/dbaccess/source/core/dataaccess/ModelImpl.cxx
   dba/dbaccess/source/core/dataaccess/databasedocument.cxx
   dba/dbaccess/source/core/dataaccess/documentdefinition.cxx
   dba/dbaccess/source/ui/app/AppController.cxx
   dba/dbaccess/source/ui/app/AppController.hxx
   dba/dbaccess/source/ui/app/AppControllerDnD.cxx
   dba/dbaccess/source/ui/app/AppControllerGen.cxx
   dba/dbaccess/source/ui/browser/unodatbr.cxx
   dba/dbaccess/source/ui/misc/databaseobjectview.cxx
   dba/dbaccess/source/ui/misc/linkeddocuments.cxx

Log:
 RESYNC: (1.26-1.28); FILE MERGED

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: ModelImpl.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.25.6.3&r2=1.25.6.4
Delta lines:  +15 -12
---------------------
--- ModelImpl.cxx       2008-05-07 08:27:27+0000        1.25.6.3
+++ ModelImpl.cxx       2008-05-09 09:26:40+0000        1.25.6.4
@@ -307,6 +307,7 @@
             ,m_aContainer(4)
             ,m_aStorages()
             ,m_aMacroMode( *this )
+                       ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
             ,m_bHasAnyObjectWithMacros( false )
             ,m_bModificationLock( false )
                        ,m_aContext( _rxFactory )
@@ -343,6 +344,7 @@
             ,m_aContainer(4)
             ,m_aStorages()
             ,m_aMacroMode( *this )
+                       ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
             ,m_bHasAnyObjectWithMacros( false )
             ,m_bModificationLock( false )
                        ,m_aContext( _rxFactory )
@@ -1136,7 +1138,7 @@
 // 
-----------------------------------------------------------------------------
 namespace
 {
-    void lcl_modifyListening( ::osl::Mutex& _rMutex, 
::sfx2::IModifiableDocument& _rDocument,
+    void lcl_modifyListening( ::sfx2::IModifiableDocument& _rDocument,
         const Reference< XStorage >& _rxStorage, ::rtl::Reference< 
::sfx2::DocumentStorageModifyListener >& _inout_rListener,
         bool _bListen )
     {
@@ -1156,7 +1158,8 @@
 
         if ( xModify.is() && _bListen )
         {
-            _inout_rListener = new ::sfx2::DocumentStorageModifyListener( 
_rMutex, _rDocument );
+            // the listener from sfx2 uses SolarMutex internally
+            _inout_rListener = new ::sfx2::DocumentStorageModifyListener( 
_rDocument );
             xModify->addModifyListener( _inout_rListener.get() );
         }
     }
@@ -1182,13 +1185,13 @@
 Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const 
Reference< XStorage >& _rxNewRootStorage )
 {
     // stop listening for modifications at the old storage
-    lcl_modifyListening( m_xMutex->getMutex(), *this, 
m_xDocumentStorage.getTyped(), m_pStorageModifyListener, false );
+    lcl_modifyListening( *this, m_xDocumentStorage.getTyped(), 
m_pStorageModifyListener, false );
 
     // set new storage
     m_xDocumentStorage.reset( _rxNewRootStorage, SharedStorage::TakeOwnership 
);
 
     // start listening for modifications
-    lcl_modifyListening( m_xMutex->getMutex(), *this, 
m_xDocumentStorage.getTyped(), m_pStorageModifyListener, true );
+    lcl_modifyListening( *this, m_xDocumentStorage.getTyped(), 
m_pStorageModifyListener, true );
 
     // forward new storage to Basic and Dialog library containers
     lcl_rebaseScriptStorage_throw( m_xBasicLibraries, 
m_xDocumentStorage.getTyped() );
@@ -1244,23 +1247,23 @@
 }
 
 // 
-----------------------------------------------------------------------------
-sal_Int16 ODatabaseModelImpl::getImposedMacroExecMode() const
+sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const
 {
-    sal_Int16 nMacroExecMode( MacroExecMode::USE_CONFIG );
+    sal_Int16 nCurrentMode = MacroExecMode::NEVER_EXECUTE;
     try
     {
         ::comphelper::NamedValueCollection aArgs( m_aArgs );
-        nMacroExecMode = aArgs.getOrDefault( "MacroExecutionMode", 
nMacroExecMode );
+        nCurrentMode = aArgs.getOrDefault( "MacroExecutionMode", nCurrentMode 
);
     }
     catch( const Exception& )
     {
        DBG_UNHANDLED_EXCEPTION();
     }
-    return nMacroExecMode;
+    return nCurrentMode;
 }
 
 // 
-----------------------------------------------------------------------------
-sal_Bool ODatabaseModelImpl::setImposedMacroExecMode( sal_uInt16 nMacroMode )
+sal_Bool ODatabaseModelImpl::setCurrentMacroExecMode( sal_uInt16 nMacroMode )
 {
     try
     {

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.40.6.4&r2=1.40.6.5
Delta lines:  +9 -4
-------------------
--- databasedocument.cxx        2008-05-08 13:14:51+0000        1.40.6.4
+++ databasedocument.cxx        2008-05-09 09:26:45+0000        1.40.6.5
@@ -404,6 +404,11 @@
     ::comphelper::NamedValueCollection aResource( _aArguments );
     lcl_stripLoadArguments( aResource, m_pImpl->m_aArgs );
 
+    // now that somebody (perhaps) told us an macro execution mode, remember 
it as
+    // ImposedMacroExecMode
+    m_pImpl->setImposedMacroExecMode(
+        aResource.getOrDefault( "MacroExecutionMode", 
m_pImpl->getImposedMacroExecMode() ) );
+
     ::rtl::OUString sDocumentLocation( aResource.getOrDefault( "SalvagedFile", 
_rURL ) );
     if ( !sDocumentLocation.getLength() )
         // this indicates "the document is being recovered, but _rURL already 
is the real document URL,

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: documentdefinition.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.56.6.4&r2=1.56.6.5
Delta lines:  +73 -49
---------------------
--- documentdefinition.cxx      2008-05-07 08:31:33+0000        1.56.6.4
+++ documentdefinition.cxx      2008-05-09 09:26:51+0000        1.56.6.5
@@ -280,6 +280,10 @@
 //........................................................................
 namespace dbaccess
 {
+//........................................................................
+
+    typedef ::boost::optional< bool > optional_bool;
+
        //==================================================================
        // OEmbedObjectHolder
        //==================================================================
@@ -894,20 +898,17 @@
         }
     }
 
-    // our database document's macro execution mode
-    sal_Int16 nImposedMacroExecMode( 
m_pImpl->m_pDataSource->getImposedMacroExecMode() );
-        // (caching it, since adjustMacroMode will overwrite it)
     bool bExecuteDBDocMacros = 
m_pImpl->m_pDataSource->adjustMacroMode_AutoReject();
         // Note that we don't pass an interaction handler here. If the user 
has not been asked/notified
         // by now (i.e. during loading the whole DB document), then this won't 
happen anymore.
 
     // allow the command arguments to downgrade the macro execution mode, but 
not to upgrade
     // it
-    if  (   ( nImposedMacroExecMode == MacroExecMode::USE_CONFIG )
+    if  (   ( m_pImpl->m_pDataSource->getImposedMacroExecMode() == 
MacroExecMode::USE_CONFIG )
         &&  bExecuteDBDocMacros
         )
     {
-        // while loading the whole database document, USE_CONFIG, or *no* 
macro exec mode was passed.
+        // while loading the whole database document, USE_CONFIG, was passed.
         // Additionally, *by now* executing macros from the DB doc is allowed 
(this is what bExecuteDBDocMacros
         // indicates). This means either one of:
         // 1. The DB doc or one of the sub docs contained macros and
@@ -1452,9 +1453,11 @@
 namespace
 {
     // 
.........................................................................
-    void    lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, 
const bool _bSuppressMacros, const bool _bReadOnly)
+    void    lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, 
const optional_bool _bSuppressMacros, const optional_bool _bReadOnly )
     {
-        if ( _bSuppressMacros )
+        if ( !!_bSuppressMacros )
+        {
+            if ( *_bSuppressMacros )
         {
             // if we're to suppress macros, do exactly this
             _io_rArgs.put( "MacroExecutionMode", MacroExecMode::NEVER_EXECUTE 
);
@@ -1467,8 +1470,10 @@
                 _io_rArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG 
);
             }
         }
+        }
 
-        _io_rArgs.put( "ReadOnly", _bReadOnly );
+        if ( !!_bReadOnly )
+            _io_rArgs.put( "ReadOnly", *_bReadOnly );
     }
 }
 
@@ -1558,7 +1563,7 @@
 
     // 
.........................................................................
     // put the common load arguments into the document's media descriptor
-    lcl_putLoadArgs( aMediaDesc, _bSuppressMacros, _bReadOnly );
+    lcl_putLoadArgs( aMediaDesc, optional_bool( _bSuppressMacros ), 
optional_bool( _bReadOnly ) );
 
     return aMediaDesc.getPropertyValues();
 }
@@ -1646,7 +1651,10 @@
                }
                }
        }
-       else if ( m_xEmbeddedObject->getCurrentState() == EmbedStates::LOADED )
+       else
+    {
+        sal_Int32 nCurrentState = m_xEmbeddedObject->getCurrentState();
+        if ( nCurrentState == EmbedStates::LOADED )
        {
                if ( !m_pClientHelper )
         {
@@ -1666,11 +1674,37 @@
                        xCommon->reload( aLoadArgs, aEmbeddedObjectDescriptor );
                m_xEmbeddedObject->changeState(EmbedStates::RUNNING);
        }
+        else
+        {
+            OSL_ENSURE( ( nCurrentState == EmbedStates::RUNNING ) || ( 
nCurrentState == EmbedStates::ACTIVE ),
+                "ODocumentDefinition::loadEmbeddedObject: unexpected state!" );
+
+            // if the document was already loaded (which means the embedded 
object is in state RUNNING or ACTIVE),
+            // then just re-set some model parameters
+            try
+            {
+                Reference< XModel > xModel( getComponent(), UNO_QUERY_THROW );
+                   Sequence< PropertyValue > aArgs = xModel->getArgs();
+
+                ::comphelper::NamedValueCollection aMediaDesc( aArgs );
+                lcl_putLoadArgs( aMediaDesc, optional_bool(), optional_bool() 
);
+                    // don't put _bSuppressMacros and _bReadOnly here - if the 
document was already
+                    // loaded, we should not tamper with its settings.
+                    // #i86872# / 2008-03-13 / [EMAIL PROTECTED]
+
+                   aMediaDesc >>= aArgs;
+                   xModel->attachResource( xModel->getURL(), aArgs );
+            }
+            catch( const Exception& )
+            {
+               DBG_UNHANDLED_EXCEPTION();
+            }
+        }
+    }
 
-    Reference<XModel> xModel(getComponent(),UNO_QUERY);
        // set the OfficeDatabaseDocument instance as parent of the embedded 
document
     // #i40358# / 2005-01-19 / [EMAIL PROTECTED]
-    Reference< XChild > xDepdendDocAsChild( xModel, UNO_QUERY );
+    Reference< XChild > xDepdendDocAsChild( getComponent(), UNO_QUERY );
     if ( xDepdendDocAsChild.is() )
     {
         try
@@ -1685,18 +1719,8 @@
             DBG_UNHANDLED_EXCEPTION();
         }
     }
-
-    if ( xModel.is() )
-       {
-               Sequence<PropertyValue> aArgs = xModel->getArgs();
-
-        ::comphelper::NamedValueCollection aMediaDesc( aArgs );
-        lcl_putLoadArgs( aMediaDesc, _bSuppressMacros, _bReadOnly);
-
-               aMediaDesc >>= aArgs;
-               xModel->attachResource( xModel->getURL(), aArgs );
-       }
 }
+
 // 
-----------------------------------------------------------------------------
 void ODocumentDefinition::onCommandPreview(Any& _rImage)
 {

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

File [changed]: AppController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.56.6.5&r2=1.56.6.6
Delta lines:  +80 -67
---------------------
--- AppController.cxx   2008-05-08 13:09:07+0000        1.56.6.5
+++ AppController.cxx   2008-05-09 09:26:57+0000        1.56.6.6
@@ -814,10 +814,15 @@
                         {
                                                    ::std::vector< 
::rtl::OUString > aSelected;
                                                    getSelectionElementNames( 
aSelected );
-                            OSL_ENSURE( aSelected.size() == 1, 
"OApplicationController::GetState: inconsistency!" );
-                            if ( aSelected.size() == 1 )
-                                if ( impl_isAlterableView_nothrow( 
aSelected[0] ) )
-                                    aReturn.bEnabled = sal_True;
+                            bool bAlterableViews = true;
+                            for (   ::std::vector< ::rtl::OUString 
>::const_iterator selectedName = aSelected.begin();
+                                    bAlterableViews && ( selectedName != 
aSelected.end() ) ;
+                                    ++selectedName
+                                )
+                            {
+                                bAlterableViews &= 
impl_isAlterableView_nothrow( *selectedName );
+                            }
+                            aReturn.bEnabled = bAlterableViews;
                         }
                         break;
                     default:
@@ -1081,7 +1086,8 @@
                                                                                
)
                                                                                
sFolderNameToInsertInto = *aList.begin();
                                                                }
-                                                               paste( eType, 
OComponentTransferable::extractComponentDescriptor( rTransferData ), 
sFolderNameToInsertInto );
+                                                               paste( eType, 
OComponentTransferable::extractComponentDescriptor( rTransferData ),
+                                    sFolderNameToInsertInto );
                                                        }
                                                        break;
                                        }
@@ -1312,24 +1318,24 @@
                        case SID_DB_APP_QUERY_EDIT:
                        case SID_DB_APP_FORM_EDIT:
                        case SID_DB_APP_REPORT_EDIT:
-                               
doAction(_nId,OLinkedDocumentsAccess::OPEN_DESIGN);
+                               doAction( _nId, E_OPEN_DESIGN );
                 break;
                        case SID_DB_APP_OPEN:
                        case SID_DB_APP_TABLE_OPEN:
                        case SID_DB_APP_QUERY_OPEN:
                        case SID_DB_APP_FORM_OPEN:
                        case SID_DB_APP_REPORT_OPEN:
-                               
doAction(_nId,OLinkedDocumentsAccess::OPEN_NORMAL);
+                               doAction( _nId, E_OPEN_NORMAL );
                                break;
                        case SID_DB_APP_CONVERTTOVIEW:
-                               
doAction(_nId,OLinkedDocumentsAccess::OPEN_NORMAL);
+                               doAction( _nId, E_OPEN_NORMAL );
                                break;
                        case SID_SELECTALL:
                                getContainer()->selectAll();
                                InvalidateAll();
                                break;
                        case SID_DB_APP_DSRELDESIGN:
-                if ( 
!impl_activateSubFrame_throw(::rtl::OUString(),SID_DB_APP_DSRELDESIGN,OLinkedDocumentsAccess::OPEN_DESIGN)
 )
+                if ( 
!impl_activateSubFrame_throw(::rtl::OUString(),SID_DB_APP_DSRELDESIGN,E_OPEN_DESIGN)
 )
                 {
                                    SharedConnection xConnection( 
ensureConnection() );
                                    if ( xConnection.is() )
@@ -1339,7 +1345,7 @@
                                            Reference< XComponent > xComponent( 
aDesigner.createNew( xDataSource ), UNO_QUERY );
                                            addDocumentListener( xComponent, 
NULL );
                         
m_aSpecialSubFrames.insert(TFrames::value_type(::rtl::OUString(),
-                            
TTypeFrame(TTypeOpenMode(SID_DB_APP_DSRELDESIGN,OLinkedDocumentsAccess::OPEN_DESIGN),xComponent)));
+                            
TTypeFrame(TTypeOpenMode(SID_DB_APP_DSRELDESIGN,E_OPEN_DESIGN),xComponent)));
                                    } // if ( xConnection.is() )
                 }
                                break;
@@ -1411,7 +1417,7 @@
                                }
                                break;
                        case SID_DB_APP_SENDREPORTASMAIL:
-                               
doAction(_nId,OLinkedDocumentsAccess::OPEN_FORMAIL);
+                               doAction( _nId, E_OPEN_FOR_MAIL );
                                break;
                }
        }
@@ -1760,7 +1766,7 @@
                        openElement(
                 getContainer()->getQualifiedName( _pTree->GetHdlEntry() ),
                 getContainer()->getElementType(),
-                OLinkedDocumentsAccess::OPEN_NORMAL
+                E_OPEN_NORMAL
             );
             return true;    // handled
                }
@@ -1799,11 +1805,21 @@
 
 // 
-----------------------------------------------------------------------------
 Reference< XComponent > OApplicationController::openElement(const 
::rtl::OUString& _sName, ElementType _eType,
-    OLinkedDocumentsAccess::EOpenMode _eOpenMode, sal_uInt16 
_nInstigatorCommand )
+    ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand )
 {
-       OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
+    return openElementWithArguments( _sName, _eType, _eOpenMode, 
_nInstigatorCommand, ::comphelper::NamedValueCollection() );
+}
+
+// 
-----------------------------------------------------------------------------
+Reference< XComponent > OApplicationController::openElementWithArguments( 
const ::rtl::OUString& _sName, ElementType _eType,
+    ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand, const 
::comphelper::NamedValueCollection& _rAdditionalArguments )
+{
+    OSL_PRECOND( getContainer(), 
"OApplicationController::openElementWithArguments: no view!" );
+    if ( !getContainer() )
+        return NULL;
+
        Reference< XComponent > xRet;
-       if ( _eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN )
+       if ( _eOpenMode == E_OPEN_DESIGN )
        {
                // OJ: http://www.openoffice.org/issues/show_bug.cgi?id=30382
                getContainer()->showPreview(NULL);
@@ -1814,12 +1830,15 @@
        case E_REPORT:
        case E_FORM:
        {
-               ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = 
getDocumentsAccess(_eType);
+               ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = 
getDocumentsAccess( _eType );
+        if ( !aHelper->isConnected() )
+            break;
+
                Reference< XComponent > xDefinition;
-               xRet.set(aHelper->open(_sName, 
xDefinition,_eOpenMode),UNO_QUERY);
-               if (_eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN || _eType 
== E_FORM )
+               xRet = aHelper->open( _sName, xDefinition, _eOpenMode, 
_rAdditionalArguments );
+
+        if (_eOpenMode == E_OPEN_DESIGN || _eType == E_FORM )
                {
-               //      // LLA: close only if in EDIT mode
                        addDocumentListener(xRet,xDefinition);
                }
        }
@@ -1836,9 +1855,10 @@
                 break;
 
             ::std::auto_ptr< DatabaseObjectView > pDesigner;
-                   Sequence < PropertyValue > aArgs;
+        ::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
+
                    Any aDataSource;
-                   if ( _eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN )
+               if ( _eOpenMode == E_OPEN_DESIGN )
                    {
                 sal_Bool bQuerySQLMode =( _nInstigatorCommand == 
SID_DB_APP_EDIT_SQL_VIEW );
 
@@ -1853,24 +1873,19 @@
                            {
                     pDesigner.reset( new QueryDesigner( getORB(), this, 
m_aCurrentFrame.getFrame(), false, bQuerySQLMode ) );
                            }
-                           else if ( _eType == E_REPORT )
-                           {
-                                   pDesigner.reset( new ReportDesigner( 
getORB(),this, m_aCurrentFrame.getFrame() ) );
-                           }
                            aDataSource <<= m_xDataSource;
                    }
                    else
                    {
                            pDesigner.reset( new ResultSetBrowser( getORB(), 
this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
 
-                           aArgs.realloc(1);
-                           aArgs[0].Name = PROPERTY_SHOWMENU;
-                           aArgs[0].Value <<= sal_True;
+            if ( !aArguments.has( (::rtl::OUString)PROPERTY_SHOWMENU ) )
+                aArguments.put( (::rtl::OUString)PROPERTY_SHOWMENU, makeAny( 
(sal_Bool)sal_True ) );
 
                            aDataSource <<= getDatabaseName();
                    }
 
-                   Reference< XComponent > xComponent( 
pDesigner->openExisting( aDataSource, _sName, aArgs ), UNO_QUERY );
+               Reference< XComponent > xComponent( pDesigner->openExisting( 
aDataSource, _sName, aArguments.getPropertyValues() ), UNO_QUERY );
                    addDocumentListener( xComponent, NULL );
             m_aSpecialSubFrames.insert(TFrames::value_type(_sName,
                             
TTypeFrame(TTypeOpenMode(_eType,_eOpenMode),xComponent)));
@@ -1879,6 +1894,7 @@
        break;
 
     default:
+        OSL_ENSURE( false, "OApplicationController::openElement: illegal 
object type!" );
         break;
        }
        return xRet;
@@ -1924,9 +1940,9 @@
             {
                 Reference< XComponent > xComponent,xDefinition;
                            if ( E_QUERY == _eType )
-                                   xComponent = aHelper->newQueryWithPilot( );
+                               xComponent = aHelper->newQueryWithPilot();
                            else
-                                   xComponent = aHelper->newTableWithPilot( );
+                               xComponent = aHelper->newTableWithPilot();
                 addDocumentListener(xComponent,xDefinition);
                        }
                }
@@ -1956,7 +1972,6 @@
                        break;
                case E_QUERY:
                case E_TABLE:
-
                        {
                                ::std::auto_ptr< DatabaseObjectView > pDesigner;
                                SharedConnection xConnection( 
ensureConnection() );
@@ -1970,8 +1985,6 @@
                                        {
                                                pDesigner.reset( new 
QueryDesigner( getORB(), this, getFrame(), false, _bSQLView ) );
                                        }
-                                       else
-                                               pDesigner.reset( new 
ReportDesigner( getORB(), this, getFrame() ) );
 
                     Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                        Reference< XComponent > xComponent( 
pDesigner->createNew( xDataSource ), UNO_QUERY );
@@ -2759,7 +2772,7 @@
 }
 
 // 
-----------------------------------------------------------------------------
-bool OApplicationController::impl_activateSubFrame_throw(const 
::rtl::OUString& _sName,const sal_Int32 _nKind,const 
OLinkedDocumentsAccess::EOpenMode _eOpenMode) const
+bool OApplicationController::impl_activateSubFrame_throw(const 
::rtl::OUString& _sName,const sal_Int32 _nKind,const ElementOpenMode 
_eOpenMode) const
 {
     bool bFound = false;
     TFrames::const_iterator aFind = m_aSpecialSubFrames.find(_sName);

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

File [changed]: AppController.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.hxx?r1=1.27.2.1&r2=1.27.2.2
Delta lines:  +25 -9
--------------------
--- AppController.hxx   2008-05-07 08:34:17+0000        1.27.2.1
+++ AppController.hxx   2008-05-09 09:27:01+0000        1.27.2.2
@@ -50,6 +50,7 @@
 /** === end UNO includes === **/
 
 #include <comphelper/stl_types.hxx>
+#include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/uno3.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <sot/storage.hxx>
@@ -101,7 +102,7 @@
         typedef ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponent >      TComponent;
                typedef ::std::map< TComponent, TComponent >                    
                    TDocuments;
 
-        typedef ::std::pair<sal_Int32,OLinkedDocumentsAccess::EOpenMode>       
             TTypeOpenMode;
+        typedef ::std::pair< sal_Int32, ElementOpenMode >                      
             TTypeOpenMode;
         typedef ::std::pair< TTypeOpenMode , TComponent >                      
             TTypeFrame;
         typedef ::std::multimap< ::rtl::OUString, TTypeFrame >                 
             TFrames;
 
@@ -146,7 +147,7 @@
             @param  _sName  the name of the component
             @param  _nKind  the kind of the component
         */
-        bool impl_activateSubFrame_throw(const ::rtl::OUString& _sName,const 
sal_Int32 _nKind,const OLinkedDocumentsAccess::EOpenMode _eOpenMode) const;
+        bool impl_activateSubFrame_throw(const ::rtl::OUString& _sName,const 
sal_Int32 _nKind,const ElementOpenMode _eOpenMode) const;
                /** returns the database name
                        @return
                                the database name
@@ -179,10 +180,20 @@
                ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponent > openElement(
             const ::rtl::OUString& _sName,
             ElementType _eType,
-            OLinkedDocumentsAccess::EOpenMode _eOpenMode,
+            ElementOpenMode _eOpenMode,
             sal_uInt16 _nInstigatorCommand = 0
         );
 
+        /** opens a new sub frame with a table/query/form/report/view, passing 
additional arguments
+        */
+               ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponent > openElementWithArguments(
+            const ::rtl::OUString& _sName,
+            ElementType _eType,
+            ElementOpenMode _eOpenMode,
+            sal_uInt16 _nInstigatorCommand,
+            const ::comphelper::NamedValueCollection& _rAdditionalArguments
+        );
+
                /** opens a new frame for creation or auto pilot
                        @param  _eType
                                Defines the type to open
@@ -266,8 +277,6 @@
                /// returns the nameaccess
                ::com::sun::star::uno::Reference< 
::com::sun::star::container::XNameAccess > getElements(ElementType _eType);
 
-               ///
-
                /** returns the document access for the specific type
                        @param  _eType
                                the type
@@ -390,9 +399,9 @@
                        @param  _nId
                                The slot which should be executed.
                        @param  _eOpenMode
-                               Defines the mode of opening. @see 
OLinkedDocumentsAccess::EOpenMode
+                               Defines the mode of opening. @see 
ElementOpenMode
                */
-               void doAction(sal_uInt16 _nId 
,OLinkedDocumentsAccess::EOpenMode _eOpenMode);
+               void doAction(sal_uInt16 _nId ,ElementOpenMode _eOpenMode);
 
         /** returns the currently selected table or query name.
         *
@@ -419,6 +428,11 @@
         */
         void    impl_migrateScripts_nothrow();
 
+        /** verifies the object type denotes a valid DatabaseObject, and the 
object name denotes an existing
+            object of this type. Throws if not.
+        */
+        void    impl_validateObjectTypeAndName_throw( const sal_Int32 
_nObjectType, const ::rtl::OUString& _rObjectName );
+
        protected:
                // 
----------------------------------------------------------------
                // initalizing members
@@ -485,6 +499,8 @@
         virtual ::sal_Bool SAL_CALL isConnected(  ) throw 
(::com::sun::star::uno::RuntimeException);
         virtual ::sal_Bool SAL_CALL connect(  ) throw 
(::com::sun::star::uno::RuntimeException);
         virtual ::sal_Bool SAL_CALL closeSubComponents(  ) throw 
(::com::sun::star::uno::RuntimeException);
+        virtual ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 
ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw 
(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::container::NoSuchElementException, 
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+        virtual ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( 
::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool 
ForEditing, const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& Arguments ) throw 
(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::container::NoSuchElementException, 
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
 
         // XSelectionSupplier
         virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& 
xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException);

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

File [changed]: AppControllerDnD.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerDnD.cxx?r1=1.26.6.2&r2=1.26.6.3
Delta lines:  +49 -83
---------------------
--- AppControllerDnD.cxx        2008-04-15 13:11:41+0000        1.26.6.2
+++ AppControllerDnD.cxx        2008-05-09 09:27:05+0000        1.26.6.3
@@ -511,57 +511,52 @@
        return bIsConnectionReadOnly;
 }
 // 
-----------------------------------------------------------------------------
-Reference< XNameAccess > OApplicationController::getElements(ElementType 
_eType)
+Reference< XNameAccess > OApplicationController::getElements( ElementType 
_eType )
 {
-       OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
-       // TODO get a list for all object
-       ::rtl::OUString sDataSource = getDatabaseName();
-
        Reference< XNameAccess > xElements;
        try
        {
                switch ( _eType )
                {
-                       case E_REPORT: // TODO: seperate handling of forms and 
reports
+               case E_REPORT:
                                {
-                                       Reference< XReportDocumentsSupplier > 
xSupp(m_xModel,UNO_QUERY);
-                                       OSL_ENSURE(xSupp.is(),"Data source 
doesn't return a XReportDocumentsSupplier -> GPF");
-                                       if ( xSupp.is() )
-                                               xElements = 
xSupp->getReportDocuments();
+                       Reference< XReportDocumentsSupplier > xSupp( m_xModel, 
UNO_QUERY_THROW );
+            xElements.set( xSupp->getReportDocuments(), UNO_SET_THROW );
                                }
                                break;
+
                        case E_FORM:
                                {
-                                       Reference< XFormDocumentsSupplier > 
xSupp(m_xModel,UNO_QUERY);
-                                       OSL_ENSURE(xSupp.is(),"Data source 
doesn't return a XFormDocumentsSupplier -> GPF");
-                                       if ( xSupp.is() )
-                                               xElements = 
xSupp->getFormDocuments();
+                       Reference< XFormDocumentsSupplier > xSupp( m_xModel, 
UNO_QUERY_THROW );
+            xElements.set( xSupp->getFormDocuments(), UNO_SET_THROW );
                                }
                                break;
+
                        case E_QUERY:
                                {
-                                       
xElements.set(getQueryDefintions(),UNO_QUERY);
+                       xElements.set( getQueryDefintions(), UNO_QUERY_THROW );
                                }
                                break;
+
                        case E_TABLE:
                                {
                     if ( m_xDataSourceConnection.is() )
                                        {
-                                               Reference< XTablesSupplier > 
xSup( getConnection(), UNO_QUERY );
-                                               
OSL_ENSURE(xSup.is(),"OApplicationController::getElements: no XTablesSuppier!");
-                                               if ( xSup.is() )
-                                                       xElements = 
xSup->getTables();
+                               Reference< XTablesSupplier > xSup( 
getConnection(), UNO_QUERY_THROW );
+                               xElements.set( xSup->getTables(), UNO_SET_THROW 
);
                                        }
                                }
                                break;
+
             default:
                 break;
                }
        }
        catch(const Exception&)
        {
-               OSL_ENSURE(0,"Could not get element container!");
+        DBG_UNHANDLED_EXCEPTION();
        }
+
        return xElements;
 }
 // 
-----------------------------------------------------------------------------
@@ -574,55 +569,26 @@
 
        getContainer()->getSelectionElementNames( _rNames );
 }
+
 // 
-----------------------------------------------------------------------------
-::std::auto_ptr<OLinkedDocumentsAccess> 
OApplicationController::getDocumentsAccess(ElementType _eType)
+::std::auto_ptr< OLinkedDocumentsAccess > 
OApplicationController::getDocumentsAccess( ElementType _eType )
 {
-       OSL_ENSURE(_eType == E_FORM || _eType == E_REPORT || _eType == E_QUERY 
|| _eType == E_TABLE,"Illegal type for call!");
-       Reference< XNameAccess > xNameAccess;
-       switch( _eType )
-       {
-               case E_FORM:
-               {
-                       Reference< XFormDocumentsSupplier > 
xSupp(m_xModel,UNO_QUERY);
-                       if ( xSupp.is() )
-                               xNameAccess = xSupp->getFormDocuments();
-                       break;
-               }
-               case E_REPORT:
-               {
-                       Reference< XReportDocumentsSupplier > 
xSupp(m_xModel,UNO_QUERY);
-                       if ( xSupp.is() )
-                               xNameAccess = xSupp->getReportDocuments();
-                       break;
-               }
-               case E_QUERY:
-               {
-                       Reference< XQueryDefinitionsSupplier > 
xSupp(m_xDataSource,UNO_QUERY);
-                       if ( xSupp.is() )
-                               xNameAccess = xSupp->getQueryDefinitions();
-                       break;
-               }
-               case E_TABLE:
-               {
-                       Reference< XTablesSupplier > 
xSupp(m_xDataSource,UNO_QUERY);
-                       if ( xSupp.is() )
-                               xNameAccess = xSupp->getTables();
-                       break;
-               }
-        case E_NONE:
-            break;
-       }
+    OSL_ENSURE( ( _eType == E_TABLE ) || ( _eType == E_QUERY ) || ( _eType == 
E_FORM ) || ( _eType == E_REPORT ),
+        "OApplicationController::getDocumentsAccess: only forms and reports 
are supported here!" );
 
-    SharedConnection xConnection;
-    try
+    SharedConnection xConnection( ensureConnection() );
+    Reference< XNameAccess > xDocContainer;
+
+    if ( ( _eType == E_FORM ) | ( _eType == E_REPORT ) )
     {
-           xConnection = ensureConnection();
+        xDocContainer.set( getElements( _eType ) );
+        OSL_ENSURE( xDocContainer.is(), 
"OApplicationController::getDocumentsAccess: invalid container!" );
     }
-    catch(const SQLException&) { showError( SQLExceptionInfo( 
::cppu::getCaughtException() ) ); }
 
-    OSL_ENSURE(xNameAccess.is(),"Data source doesn't return a name access -> 
GPF");
-       return ::std::auto_ptr<OLinkedDocumentsAccess>(
-        new OLinkedDocumentsAccess( getView(), m_aCurrentFrame.getFrame(), 
getORB(), xNameAccess, xConnection, getDatabaseName() ) );
+    ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new 
OLinkedDocumentsAccess(
+        getView(), m_aCurrentFrame.getFrame(), getORB(), xDocContainer, 
xConnection, getDatabaseName()
+    ) );
+    return pDocuments;
 }
 // 
-----------------------------------------------------------------------------
 TransferableHelper* OApplicationController::copyObject()

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

File [changed]: AppControllerGen.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.32.6.3&r2=1.32.6.4
Delta lines:  +110 -8
---------------------
--- AppControllerGen.cxx        2008-04-15 20:49:48+0000        1.32.6.3
+++ AppControllerGen.cxx        2008-05-09 09:27:09+0000        1.32.6.4
@@ -52,6 +52,9 @@
 #include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#include <com/sun/star/sdb/application/DatabaseObject.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
 #include <com/sun/star/ucb/Command.hpp>
@@ -61,11 +64,14 @@
 #include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/util/XCloseable.hpp>
 #include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
 /** === end UNO includes === **/
 
 #include <cppuhelper/exc_hlp.hxx>
 #include <connectivity/dbexception.hxx>
 #include <connectivity/dbtools.hxx>
+#include <connectivity/sqlerror.hxx>
+#include <connectivity/dbexception.hxx>
 #include <sfx2/mailmodelapi.hxx>
 #include <svx/dbaexchange.hxx>
 #include <toolkit/unohlp.hxx>
@@ -81,6 +87,7 @@
 namespace dbaui
 {
 using namespace ::dbtools;
+using namespace ::connectivity;
 using namespace ::svx;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::awt;
@@ -95,6 +102,10 @@
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::ucb;
 using ::com::sun::star::util::XCloseable;
+
+namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
+namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition;
+
 //........................................................................
 // 
-----------------------------------------------------------------------------
 
@@ -479,6 +490,98 @@
 }
 
 // 
-----------------------------------------------------------------------------
+namespace
+{
+    ElementType lcl_objectType2ElementType( const sal_Int32 _nObjectType )
+    {
+        ElementType eType( E_NONE );
+        switch ( _nObjectType )
+        {
+        case DatabaseObject::TABLE:  eType = E_TABLE;   break;
+        case DatabaseObject::QUERY:  eType = E_QUERY;   break;
+        case DatabaseObject::FORM:   eType = E_FORM;    break;
+        case DatabaseObject::REPORT: eType = E_REPORT;  break;
+        default:
+            OSL_ENSURE( false, "lcl_objectType2ElementType: unsupported object 
type!" );
+                // this should have been caught earlier
+        }
+        return eType;
+    }
+}
+
+// 
-----------------------------------------------------------------------------
+void OApplicationController::impl_validateObjectTypeAndName_throw( const 
sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName )
+{
+    // ensure we're connected
+    if ( !isConnected() )
+    {
+        SQLError aError( getORB() );
+        aError.raiseException( ErrorCondition::DB_NOT_CONNECTED, *this );
+    }
+
+    // ensure a proper object type
+    if  (   ( _nObjectType != DatabaseObject::TABLE )
+        &&  ( _nObjectType != DatabaseObject::QUERY )
+        &&  ( _nObjectType != DatabaseObject::FORM )
+        &&  ( _nObjectType != DatabaseObject::REPORT )
+        )
+        throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+    // ensure an existing object
+    Reference< XNameAccess > xContainer( getElements( 
lcl_objectType2ElementType( _nObjectType ) ) );
+    if ( !xContainer.is() )
+        // all possible reasons for this (e.g. not being connected currently) 
should
+        // have been handled before
+        throw RuntimeException( ::rtl::OUString(), *this );
+
+    bool bExistentObject = false;
+    switch ( _nObjectType )
+    {
+    case DatabaseObject::TABLE:
+    case DatabaseObject::QUERY:
+        bExistentObject = xContainer->hasByName( _rObjectName );
+        break;
+    case DatabaseObject::FORM:
+    case DatabaseObject::REPORT:
+    {
+        Reference< XHierarchicalNameAccess > xHierarchy( xContainer, 
UNO_QUERY_THROW );
+        bExistentObject = xHierarchy->hasByHierarchicalName( _rObjectName );
+    }
+    break;
+    }
+
+    if ( !bExistentObject )
+        throw NoSuchElementException( _rObjectName, *this );
+}
+
+// 
-----------------------------------------------------------------------------
+Reference< XComponent > SAL_CALL OApplicationController::loadComponent( 
::sal_Int32 _ObjectType,
+    const ::rtl::OUString& _ObjectName, ::sal_Bool _ForEditing ) throw 
(IllegalArgumentException, NoSuchElementException, SQLException, 
RuntimeException)
+{
+    return loadComponentWithArguments( _ObjectType, _ObjectName, _ForEditing, 
Sequence< PropertyValue >() );
+}
+
+// 
-----------------------------------------------------------------------------
+Reference< XComponent > SAL_CALL 
OApplicationController::loadComponentWithArguments( ::sal_Int32 _ObjectType,
+    const ::rtl::OUString& _ObjectName, ::sal_Bool _ForEditing, const 
Sequence< PropertyValue >& _Arguments ) throw (IllegalArgumentException, 
NoSuchElementException, SQLException, RuntimeException)
+{
+       ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+       ::osl::MutexGuard aGuard( m_aMutex );
+
+    impl_validateObjectTypeAndName_throw( _ObjectType, _ObjectName );
+
+    Reference< XComponent > xComponent( openElementWithArguments(
+        _ObjectName,
+        lcl_objectType2ElementType( _ObjectType ),
+        _ForEditing ? E_OPEN_DESIGN : E_OPEN_NORMAL,
+        _ForEditing ? SID_DB_APP_EDIT : SID_DB_APP_OPEN,
+        ::comphelper::NamedValueCollection( _Arguments )
+    ) );
+
+    return xComponent;
+}
+
+// 
-----------------------------------------------------------------------------
 void OApplicationController::previewChanged( sal_Int32 _nMode )
 {
        ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -661,7 +764,7 @@
        }
 }
 // 
-----------------------------------------------------------------------------
-void OApplicationController::doAction(sal_uInt16 _nId 
,OLinkedDocumentsAccess::EOpenMode _eOpenMode)
+void OApplicationController::doAction(sal_uInt16 _nId ,ElementOpenMode 
_eOpenMode)
 {
        ::std::vector< ::rtl::OUString> aList;
        getSelectionElementNames(aList);
@@ -681,7 +784,7 @@
        }
 
        // special handling for mail, if more than one document is selected 
attach them all
-       if ( _eOpenMode == OLinkedDocumentsAccess::OPEN_FORMAIL )
+       if ( _eOpenMode == E_OPEN_FOR_MAIL )
        {
                ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel 
> > >::iterator componentIter = aCompoments.begin();
                ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel 
> > >::iterator componentEnd = aCompoments.end();
@@ -717,8 +820,7 @@
        }
        return eRet;
 }
+
 //........................................................................
 }      // namespace dbaui
 //........................................................................
-
-

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.196.6.2&r2=1.196.6.3
Delta lines:  +7 -4
-------------------
--- unodatbr.cxx        2008-04-15 13:12:10+0000        1.196.6.2
+++ unodatbr.cxx        2008-05-09 09:27:17+0000        1.196.6.3
@@ -43,7 +43,6 @@
 #include "dlgsave.hxx"
 #include "HtmlReader.hxx"
 #include "imageprovider.hxx"
-#include "linkeddocuments.hxx"
 #include "listviewitems.hxx"
 #include "QEnumTypes.hxx"
 #include "RtfReader.hxx"
@@ -98,6 +97,7 @@
 #include <com/sun/star/util/XFlushable.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
 /** === end UNO includes === **/
 
 #include <comphelper/extract.hxx>
@@ -352,8 +352,9 @@
                Reference< XContainer > 
xDatasourceContainer(m_xDatabaseContext, UNO_QUERY);
                if (xDatasourceContainer.is())
                        xDatasourceContainer->addContainerListener(this);
-               else
+               else {
                        DBG_ERROR("SbaTableQueryBrowser::Construct: the 
DatabaseContext should allow us to be a listener!");
+        }
 
                // the collator for the string compares
                m_xCollator = Reference< XCollator 
>(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.i18n.Collator")),
 UNO_QUERY);
@@ -2089,9 +2090,10 @@
                                        pEntryData->xContainer = xQueryDefs;
                     bSuccess = pEntryData->xContainer.is();
                                }
-                               else
+                               else {
                                        
DBG_ERROR("SbaTableQueryBrowser::ensureEntryObject: no 
XQueryDefinitionsSupplier interface!");
                        }
+                       }
             catch( const Exception& )
             {
                 DBG_UNHANDLED_EXCEPTION();
@@ -2614,8 +2616,9 @@
                        delete pData;
                        m_pTreeModel->Remove(pDSLoop);
                }
-               else
+               else {
                        DBG_ERROR("SbaTableQueryBrowser::elementRemoved: 
unknown datasource name!");
+        }
 
                // maybe the object which is part of the document data source 
has been removed
                checkDocumentDataSource();

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

File [changed]: databaseobjectview.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/databaseobjectview.cxx?r1=1.8.6.2&r2=1.8.6.3
Delta lines:  +8 -1
-------------------
--- databaseobjectview.cxx      2008-04-15 13:13:10+0000        1.8.6.2
+++ databaseobjectview.cxx      2008-05-09 09:27:21+0000        1.8.6.3
@@ -77,6 +77,9 @@
 #ifndef _COMPHELPER_SEQUENCE_HXX_
 #include <comphelper/sequence.hxx>
 #endif
+#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX
+#include <comphelper/namedvaluecollection.hxx>
+#endif
 
 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
 #include <connectivity/dbtools.hxx>
@@ -148,7 +151,11 @@
     {
                Sequence< PropertyValue > aDispatchArgs;
         fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName );
-        return doDispatch( ::comphelper::concatSequences( aDispatchArgs, 
_rCreationArgs ) );
+
+        ::comphelper::NamedValueCollection aDispArgs( aDispatchArgs );
+        aDispArgs.merge( _rCreationArgs, true );
+
+        return doDispatch( aDispArgs.getPropertyValues() );
     }
 
        //----------------------------------------------------------------------

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

File [changed]: linkeddocuments.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/linkeddocuments.cxx?r1=1.27.32.2&r2=1.27.32.3
Delta lines:  +20 -18
---------------------
--- linkeddocuments.cxx 2008-04-15 13:13:18+0000        1.27.32.2
+++ linkeddocuments.cxx 2008-05-09 09:27:24+0000        1.27.32.3
@@ -221,7 +221,8 @@
                DBG_DTOR(OLinkedDocumentsAccess,NULL);          
        }
        //------------------------------------------------------------------
-       Reference< XComponent> OLinkedDocumentsAccess::implOpen(const 
::rtl::OUString& _rLinkName,Reference< XComponent >& _xDefinition, EOpenMode 
_eOpenMode)
+       Reference< XComponent> OLinkedDocumentsAccess::impl_open( const 
::rtl::OUString& _rLinkName, Reference< XComponent >& _xDefinition,
+        ElementOpenMode _eOpenMode, const ::comphelper::NamedValueCollection& 
_rAdditionalArgs )
        {
                Reference< XComponent> xRet;
         OSL_ENSURE(m_xDocumentContainer.is(), 
"OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!");
@@ -235,15 +236,15 @@
         ::rtl::OUString sOpenMode;
                switch ( _eOpenMode )
                {
-            case OPEN_NORMAL:
+            case E_OPEN_NORMAL:
                 sOpenMode = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"open" ) );
                 break;
 
-            case OPEN_FORMAIL:
+            case E_OPEN_FOR_MAIL:
                 aArguments.put( "Hidden", true );
                 // fall through
 
-            case OPEN_DESIGN:
+            case E_OPEN_DESIGN:
                 sOpenMode = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"openDesign" ) );
                 break;
 
@@ -261,6 +262,9 @@
                        {
                                
_xDefinition.set(xHier->getByHierarchicalName(_rLinkName),UNO_QUERY);
                        }
+
+            aArguments.merge( _rAdditionalArgs, true );
+
                        xRet = xComponentLoader->loadComponentFromURL( 
_rLinkName, ::rtl::OUString(), 0, aArguments.getPropertyValues() );
                }
                catch(Exception& e) 
@@ -272,11 +276,8 @@
                return xRet;
        }
     //------------------------------------------------------------------
-    Reference< XComponent> OLinkedDocumentsAccess::newWithPilot(const char* 
_pWizardService
-                                                , Reference< XComponent >& 
_xDefinition
-                                                , const sal_Int32 _nCommandType
-                                                       , const 
::rtl::OUString& _rObjectName                                                
-                                                )
+    Reference< XComponent> OLinkedDocumentsAccess::impl_newWithPilot( const 
char* _pWizardService,
+        Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, 
const ::rtl::OUString& _rObjectName )
        {
         Reference< XComponent> xRet;
                try
@@ -329,28 +330,28 @@
        //------------------------------------------------------------------
        Reference< XComponent> 
OLinkedDocumentsAccess::newFormWithPilot(Reference< XComponent >& 
_xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName)
        {
-        return 
newWithPilot("com.sun.star.wizards.form.CallFormWizard",_xDefinition,_nCommandType,_rObjectName);
+        return impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", 
_xDefinition, _nCommandType, _rObjectName );
        }
 
     //------------------------------------------------------------------
-       Reference< XComponent> 
OLinkedDocumentsAccess::newReportWithPilot(Reference< XComponent >& 
_xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName)
+       Reference< XComponent> OLinkedDocumentsAccess::newReportWithPilot( 
Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const 
::rtl::OUString& _rObjectName )
        {
-        return 
newWithPilot("com.sun.star.wizards.report.CallReportWizard",_xDefinition,_nCommandType,_rObjectName);
+        return impl_newWithPilot( 
"com.sun.star.wizards.report.CallReportWizard", _xDefinition, _nCommandType, 
_rObjectName );
        }
     //------------------------------------------------------------------
        Reference< XComponent> OLinkedDocumentsAccess::newTableWithPilot()
        {
         Reference< XComponent > xDefinition;
-        return 
newWithPilot("com.sun.star.wizards.table.CallTableWizard",xDefinition);
+        return impl_newWithPilot( 
"com.sun.star.wizards.table.CallTableWizard", xDefinition, -1, 
::rtl::OUString() );
        }    
     //------------------------------------------------------------------
-       Reference< XComponent> OLinkedDocumentsAccess::newQueryWithPilot(const 
sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName)
+       Reference< XComponent> OLinkedDocumentsAccess::newQueryWithPilot()
        {
         Reference< XComponent > xDefinition;
-        return 
newWithPilot("com.sun.star.wizards.query.CallQueryWizard",xDefinition,_nCommandType,_rObjectName);
+        return impl_newWithPilot( 
"com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, 
::rtl::OUString() );
        }
        //------------------------------------------------------------------
-       Reference< XComponent > OLinkedDocumentsAccess::newDocument(sal_Int32 
_nNewFormId,Reference< XComponent >& _xDefinition,const sal_Int32 
_nCommandType,const ::rtl::OUString& _sObjectName)
+       Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 
_nNewFormId, Reference< XComponent >& _xDefinition, const sal_Int32 
_nCommandType, const ::rtl::OUString& _sObjectName )
        {
         OSL_ENSURE(m_xDocumentContainer.is(), 
"OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!");
                // determine the URL to use for the new document
@@ -428,13 +429,14 @@
        }
 
        //------------------------------------------------------------------
-       Reference< XComponent > OLinkedDocumentsAccess::open(const 
::rtl::OUString& _rLinkName,Reference< XComponent >& _xDefinition, EOpenMode 
_eOpenMode)
+       Reference< XComponent > OLinkedDocumentsAccess::open( const 
::rtl::OUString& _rLinkName, Reference< XComponent >& _xDefinition,
+        ElementOpenMode _eOpenMode, const ::comphelper::NamedValueCollection& 
_rAdditionalArgs )
        {       
                dbtools::SQLExceptionInfo aInfo;
         Reference< XComponent > xRet;
                try 
                {
-                       xRet = implOpen(_rLinkName,_xDefinition, _eOpenMode);
+                       xRet = impl_open( _rLinkName, _xDefinition, _eOpenMode, 
_rAdditionalArgs );
                        if ( !xRet.is() )
                        {
                 String sMessage = 
String(ModuleRes(STR_COULDNOTOPEN_LINKEDDOC));




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

Reply via email to