Tag: cws_src680_reportdesign02
User: oj      
Date: 2007-12-20 07:52:08+0000
Removed:
   dba/dbaccess/source/ui/dlg/AdvancedPageDlg.cxx
   dba/dbaccess/source/ui/dlg/AdvancedPageDlg.hrc
   dba/dbaccess/source/ui/dlg/AdvancedPageDlg.src
   dba/dbaccess/source/ui/inc/AdvancedPageDlg.hxx
   dba/dbaccess/source/ui/inc/dialogcontrolling.hxx
   dba/dbaccess/source/ui/misc/dialogcontrolling.cxx
   dba/dbaccess/source/ui/querydesign/TableWindowData.hxx
   dba/dbaccess/source/ui/uno/AdvancedSettingsDlg.hxx

Modified:
   dba/dbaccess/source/core/dataaccess/documentdefinition.cxx
   dba/dbaccess/source/core/dataaccess/documentdefinition.hxx
   dba/dbaccess/source/ui/app/AppController.cxx

Log:
 RESYNC: (1.47-1.50); FILE MERGED

File Changes:

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.47.22.2&r2=1.47.22.3
Delta lines:  +242 -168
-----------------------
--- documentdefinition.cxx      2007-11-07 12:14:20+0000        1.47.22.2
+++ documentdefinition.cxx      2007-12-20 07:51:04+0000        1.47.22.3
@@ -60,8 +60,11 @@
 #ifndef _COMPHELPER_MEDIADESCRIPTOR_HXX_
 #include <comphelper/mediadescriptor.hxx>
 #endif
-#ifndef _SO_CLSIDS_HXX
-#include <so3/clsids.hxx>
+#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX
+#include <comphelper/namedvaluecollection.hxx>
+#endif
+#ifndef _COMPHELPER_CLASSIDS_HXX
+#include <comphelper/classids.hxx>
 #endif
 #ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
 #include <com/sun/star/awt/XTopWindow.hpp>
@@ -164,6 +167,9 @@
 #ifndef DBA_INTERCEPT_HXX
 #include "intercept.hxx"
 #endif
+#ifndef _COM_SUN_STAR_SDB_ERRORCONDITION_HPP_
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#endif
 #ifndef _COM_SUN_STAR_SDB_XINTERACTIONDOCUMENTSAVE_HPP_
 #include <com/sun/star/sdb/XInteractionDocumentSave.hpp>
 #endif
@@ -463,7 +469,7 @@
 
             ::rtl::OUString aMediaType;
                        try {
-                               Any aAny = xPropSet->getPropertyValue( 
::rtl::OUString::createFromAscii( "MediaType" ) );
+                               Any aAny = xPropSet->getPropertyValue( 
INFO_MEDIATYPE );
                                aAny >>= aMediaType;
                        }
                        catch ( Exception& )
@@ -534,7 +540,7 @@
        DBG_CTOR(ODocumentDefinition, NULL);
        registerProperties();
        if ( _aClassID.getLength() )
-               
loadEmbeddedObject(MacroExecMode::USE_CONFIG,_aClassID,_xConnection);
+               loadEmbeddedObject( _xConnection, _aClassID, Sequence< 
PropertyValue >(), false, false );
 }
 
 //--------------------------------------------------------------------------
@@ -634,16 +640,16 @@
 // 
-----------------------------------------------------------------------------
 namespace
 {
-    bool lcl_extractOpenMode( const Any& _rValue, sal_Int32& /* [out] */ 
_rMode )
+    bool lcl_extractOpenMode( const Any& _rValue, sal_Int32& _out_rMode )
     {
         OpenCommandArgument aOpenCommand;
         if ( _rValue >>= aOpenCommand )
-            _rMode = aOpenCommand.Mode;
+            _out_rMode = aOpenCommand.Mode;
         else
         {
                    OpenCommandArgument2 aOpenCommand2;
             if ( _rValue >>= aOpenCommand2 )
-                _rMode = aOpenCommand2.Mode;
+                _out_rMode = aOpenCommand2.Mode;
             else
                 return false;
         }
@@ -655,14 +661,14 @@
 void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const Reference< 
XFrame >& _rxFrame )
 {
     if ( !m_xDesktop.is() )
-               m_xDesktop.set( m_xORB->createInstance( SERVICE_FRAME_DESKTOP 
), UNO_QUERY_THROW );
+        m_xDesktop.set( m_aContext.createComponent( 
(::rtl::OUString)SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW );
 
        Reference< XFrames > xFrames( m_xDesktop->getFrames(), UNO_QUERY_THROW 
);
     xFrames->remove( _rxFrame );
 }
 
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::impl_onActivateEmbeddedObject( bool 
_bOpenedInDesignMode )
+void ODocumentDefinition::impl_onActivateEmbeddedObject()
 {
     try
     {
@@ -692,7 +698,7 @@
         LifetimeCoupler::couple( *this, Reference< XComponent >( xFrame, 
UNO_QUERY_THROW ) );
 
         // init the edit view
-        if ( _bOpenedInDesignMode )
+        if ( m_bOpenInDesign )
             impl_initObjectEditView( xController );
     }
     catch( const RuntimeException& )
@@ -834,39 +840,73 @@
 }
 
 // 
-----------------------------------------------------------------------------
-Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 
CommandId, const Reference< XCommandEnvironment >& Environment ) throw 
(Exception, CommandAbortedException, RuntimeException)
+void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, 
const bool _bActivate,
+    const Reference< XCommandEnvironment >& _rxEnvironment, Any& 
_out_rComponent )
 {
-       Any aRet;
-       ::osl::MutexGuard aGuard(m_aMutex);
-    if ( !m_bInExecute )
-    {
         OExecuteImpl aExecuteGuard(m_bInExecute);
-           sal_Bool bOpenInDesign = aCommand.Name.equalsAscii("openDesign");
-           sal_Bool bOpenForMail = aCommand.Name.equalsAscii("openForMail");
-           if ( aCommand.Name.compareToAscii( "open" ) == 0 || bOpenInDesign 
|| bOpenForMail )
-           {
-                   
//////////////////////////////////////////////////////////////////
-                   // open command for a folder content
-                   
//////////////////////////////////////////////////////////////////
-                   Reference< XConnection> xConnection;
+
+    Reference< XConnection > xConnection;
             sal_Int32 nOpenMode = OpenMode::DOCUMENT;
 
-            lcl_extractOpenMode( aCommand.Argument, nOpenMode );
+    // our own macro execution mode
+    // 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.
+    bool bExecuteOwnMacros = 
m_pImpl->m_pDataSource->adjustMacroMode_AutoReject();
+    sal_Int16 nDocumentMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
+
+    ::comphelper::NamedValueCollection aDocumentArgs;
+
+    // for the document, default to the interaction handler as used for 
loading the DB doc
+    // This might be overwritten below, when examining _rOpenArgument.
+    ::comphelper::NamedValueCollection aDBDocArgs( 
m_pImpl->m_pDataSource->m_aArgs );
+    aDocumentArgs.put( "InteractionHandler", aDBDocArgs.getOrDefault( 
"InteractionHandler", Reference< XInteractionHandler >() ) );
 
+    if ( !lcl_extractOpenMode( _rOpenArgument, nOpenMode ) )
+    {
                        Sequence< PropertyValue > aArguments;
-                       if ( aCommand.Argument >>= aArguments )
+               if ( _rOpenArgument >>= aArguments )
             {
                                const PropertyValue* pIter = 
aArguments.getConstArray();
                                const PropertyValue* pEnd  = pIter + 
aArguments.getLength();
-                               for(;pIter != pEnd;++pIter)
+                       for ( ;pIter != pEnd; ++pIter )
                                {
                                        if ( pIter->Name == 
PROPERTY_ACTIVECONNECTION )
-                                               
xConnection.set(pIter->Value,UNO_QUERY);
-                                       else
-                                               lcl_extractOpenMode( 
pIter->Value, nOpenMode );
+                {
+                                       xConnection.set( pIter->Value, 
UNO_QUERY );
+                    continue;
                                }
+
+                if ( lcl_extractOpenMode( pIter->Value, nOpenMode ) )
+                    continue;
+
+                if ( pIter->Name.equalsAscii( "MacroExecutionMode" ) )
+                {
+                    OSL_VERIFY( pIter->Value >>= nDocumentMacroMode );
+                    continue;
             }
 
+                // unknown argument -> pass to the loaded document
+                aDocumentArgs.put( pIter->Name, pIter->Value );
+                       }
+        }
+    }
+
+    // allow the command arguments to downgrade the macro execution mode, but 
not to upgrade
+    // it
+    if ( !bExecuteOwnMacros )
+    {
+        // no macros per DB doc -> no macros in the embedded doc
+        nDocumentMacroMode = MacroExecMode::NEVER_EXECUTE;
+    }
+    else
+    {
+        // DB doc allows macros -> allow macros in the embedded doc, unless 
explicitly prohibited
+        if ( nDocumentMacroMode != MacroExecMode::NEVER_EXECUTE )
+            nDocumentMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
+    }
+    aDocumentArgs.put( "MacroExecutionMode", nDocumentMacroMode );
+
+
             if ( xConnection.is() )
                 m_xLastKnownConnection = xConnection;
 
@@ -877,13 +917,13 @@
                 ||  ( nOpenMode == OpenMode::DOCUMENT_SHARE_DENY_WRITE )
                 )
                    {
-                // opening as folder is not supported
+        // not supported
                 ucbhelper::cancelCommandExecution(
                         makeAny( UnsupportedOpenModeException(
                                         rtl::OUString(),
                                         static_cast< cppu::OWeakObject * >( 
this ),
                                         sal_Int16( nOpenMode ) ) ),
-                        Environment );
+                _rxEnvironment );
                     // Unreachable
                 DBG_ERROR( "unreachable" );
                    }
@@ -891,15 +931,14 @@
                        Reference<XModel> xModel;
                        if ( m_pImpl->m_aProps.sPersistentName.getLength() )
                        {
-                               m_bOpenInDesign = bOpenInDesign;
-                               
loadEmbeddedObject(MacroExecMode::USE_CONFIG,Sequence< sal_Int8 
>(),xConnection,!bOpenInDesign);
+        Sequence< PropertyValue > aLoadArgs;
+        aDocumentArgs >>= aLoadArgs;
+               loadEmbeddedObject( xConnection, Sequence< sal_Int8 >(), 
aLoadArgs, false, !m_bOpenInDesign );
                                if ( m_xEmbeddedObject.is() )
                                {
                                        xModel.set(getComponent(),UNO_QUERY);
-                    Reference< report::XReportDefinition> 
xReportDefinition(xModel,UNO_QUERY);
+            Reference< report::XReportDefinition > 
xReportDefinition(xModel,UNO_QUERY);
 
-                    if ( !bOpenForMail && !(!bOpenInDesign && 
xReportDefinition.is()) )
-                                       {
                         Reference< XModule> xModule(xModel,UNO_QUERY);
                         if ( xModule.is() )
                         {
@@ -908,26 +947,47 @@
                                                        else if ( 
!xReportDefinition.is() )
                                 
xModule->setIdentifier(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.TextReportDesign")));
                         }
-                                               
m_xEmbeddedObject->changeState(EmbedStates::ACTIVE);
-                        impl_onActivateEmbeddedObject( bOpenInDesign );
-                                       }
-                    else if ( !bOpenInDesign && xReportDefinition.is() )
+
+            bool bIsAliveNewStyleReport = ( !m_bOpenInDesign && 
xReportDefinition.is() );
+            if ( bIsAliveNewStyleReport )
                     {
                         // we are in ReadOnly mode
                         // we would like to open the Writer or Calc with the 
report direct, without design it.
-                        Reference< report::XReportEngine> xReportEngine( 
m_xORB->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportEngineJFree")))
 ,UNO_QUERY);
+                Reference< report::XReportEngine > xReportEngine( 
m_aContext.createComponent( "com.sun.star.comp.report.OReportEngineJFree" ), 
UNO_QUERY_THROW );
                     
                         xReportEngine->setReportDefinition(xReportDefinition);
                         
xReportEngine->setActiveConnection(m_xLastKnownConnection);
-                        aRet <<= xReportEngine->createDocumentAlive(NULL);
-                        return aRet;            
+                _out_rComponent <<= xReportEngine->createDocumentAlive(NULL);
+                return;            
                     }
 
-                                       fillReportData(!bOpenInDesign);
-                                       aRet <<= xModel;
+            if ( _bActivate )
+                       {
+                               m_xEmbeddedObject->changeState( 
EmbedStates::ACTIVE );
+                impl_onActivateEmbeddedObject();
                            }
+
+                       fillReportData();
+                       _out_rComponent <<= xModel;
                    }
            }
+}
+
+// 
-----------------------------------------------------------------------------
+Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 
CommandId, const Reference< XCommandEnvironment >& Environment ) throw 
(Exception, CommandAbortedException, RuntimeException)
+{
+       Any aRet;
+       ::osl::MutexGuard aGuard(m_aMutex);
+    if ( !m_bInExecute )
+    {
+        sal_Bool bOpen = aCommand.Name.equalsAscii( "open" );
+           sal_Bool bOpenInDesign = aCommand.Name.equalsAscii( "openDesign" );
+           sal_Bool bOpenForMail = aCommand.Name.equalsAscii( "openForMail" );
+           if ( bOpen || bOpenInDesign || bOpenForMail )
+           {
+            m_bOpenInDesign = bOpenInDesign;
+            onCommandOpenSomething( aCommand.Argument, !bOpenForMail, 
Environment, aRet );
+        }
            else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( 
"copyTo" ) ) )
            {
                    Sequence<Any> aIni;
@@ -946,7 +1006,7 @@
                    Reference< XStorage> xStorage(aIni[0],UNO_QUERY);
                    ::rtl::OUString sPersistentName;
                    aIni[1] >>= sPersistentName;
-            loadEmbeddedObject(MacroExecMode::USE_CONFIG, Sequence< sal_Int8 
>(), Reference< XConnection >(), sal_False );
+            loadEmbeddedObject();
                    Reference<XEmbedPersist> 
xPersist(m_xEmbeddedObject,UNO_QUERY);
                    if ( xPersist.is() )
                    {
@@ -959,7 +1019,7 @@
            }
            else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( 
"preview" ) ) )
            {
-                   generateNewImage(aRet);
+                   onCommandPreview(aRet);
            }
            else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( 
"insert" ) ) )
            {
@@ -978,11 +1038,11 @@
                    }
                    ::rtl::OUString sURL;
                    aIni[0] >>= sURL;
-                   insert(sURL,Environment);
+                   onCommandInsert( sURL, Environment );
            }
            else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( 
"getdocumentinfo" ) ) )
            {
-                   fillDocumentInfo(aRet);
+                   onCommandGetDocumentInfo( aRet );
            }
         else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( 
"delete" ) ) )
         {
@@ -1054,7 +1114,7 @@
     }
 }
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::insert(const ::rtl::OUString& _sURL, const 
Reference< XCommandEnvironment >& Environment)
+void ODocumentDefinition::onCommandInsert( const ::rtl::OUString& _sURL, const 
Reference< XCommandEnvironment >& Environment )
     throw( Exception )
 {
        osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
@@ -1062,7 +1122,7 @@
        // Check, if all required properties were set.
        if ( !_sURL.getLength() || m_xEmbeddedObject.is() )
        {
-        OSL_ENSURE( sal_False, "Content::insert - property value missing!" );
+        OSL_ENSURE( sal_False, "Content::onCommandInsert - property value 
missing!" );
 
         Sequence< rtl::OUString > aProps( 1 );
         aProps[ 0 ] = PROPERTY_URL;
@@ -1081,7 +1141,7 @@
                Reference< XStorage> xStorage = getStorage();
                if ( xStorage.is() )
                {
-                       Reference< XEmbedObjectCreator> xEmbedFactory( 
m_xORB->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")))
 ,UNO_QUERY);
+                       Reference< XEmbedObjectCreator> xEmbedFactory( 
m_aContext.createComponent( "com.sun.star.embed.EmbeddedObjectCreator" ), 
UNO_QUERY );
                        if ( xEmbedFactory.is() )
                        {
                                Sequence<PropertyValue> aEmpty,aMediaDesc(1);
@@ -1171,7 +1231,7 @@
                        pRequest->addContinuation(pAbort);
 
                        // create the handler, let it handle the request
-                       Reference< XInteractionHandler > 
xHandler(m_xORB->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
+            Reference< XInteractionHandler > xHandler( 
m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_INTERACTION_HANDLER ), 
UNO_QUERY );
                        if ( xHandler.is() )
                                xHandler->handle(xRequest);
 
@@ -1314,10 +1374,41 @@
        }
        return sal_True;
 }
+
+namespace
+{
+    // 
.........................................................................
+    void    lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, 
const bool _bSuppressMacros, const bool _bReadOnly,
+        const ::rtl::OUString& _rDocTitle )
+    {
+        if ( _bSuppressMacros )
+        {
+            // if we're to suppress macros, do exactly this
+            _io_rArgs.put( "MacroExecutionMode", MacroExecMode::NEVER_EXECUTE 
);
+        }
+        else
+        {
+            // otherwise, put the setting only if not already present
+            if ( !_io_rArgs.has( "MacroExecutionMode" ) )
+            {
+                _io_rArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG 
);
+            }
+        }
+
+        _io_rArgs.put( "ReadOnly", _bReadOnly );
+
+        if ( _rDocTitle.getLength() )
+           {
+            _io_rArgs.put( "DocumentTitle", _rDocTitle );
+           }
+    }
+}
+
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::fillLoadArgs(Sequence<PropertyValue>& 
_rArgs,Sequence<PropertyValue>& _rEmbeddedObjectDescriptor,const 
Reference<XConnection>& _xConnection,sal_Bool _bReadOnly,sal_Int16 
_nMarcoExcecMode)
+Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< 
XConnection>& _xConnection, const bool _bSuppressMacros, const bool _bReadOnly,
+        const Sequence< PropertyValue >& _rAdditionalArgs, Sequence< 
PropertyValue >& _out_rEmbeddedObjectDescriptor )
 {
-       sal_Int32 nLen = _rArgs.getLength();
+    ::comphelper::NamedValueCollection aMediaDesc( _rAdditionalArgs );
        {
                Sequence<PropertyValue> aDocumentContext(2);
                aDocumentContext[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection"));
@@ -1326,24 +1417,10 @@
                aDocumentContext[1].Name = PROPERTY_APPLYFORMDESIGNMODE;
                aDocumentContext[1].Value <<= !_bReadOnly;
 
-               _rArgs.realloc(nLen+1);
-               _rArgs[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComponentData"));
-               _rArgs[nLen++].Value <<= aDocumentContext;
+        aMediaDesc.put( "ComponentData", aDocumentContext );
        }
 
-       _rArgs.realloc(nLen+2);
-       _rArgs[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
-       _rArgs[nLen++].Value <<= _bReadOnly;
-
-       _rArgs[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode"));
-       _rArgs[nLen++].Value <<= _nMarcoExcecMode;
-
-       if ( m_pImpl->m_aProps.aTitle.getLength() )
-       {
-               _rArgs.realloc(nLen+1);
-               _rArgs[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle"));
-               _rArgs[nLen++].Value <<= m_pImpl->m_aProps.aTitle;
-       }
+    lcl_putLoadArgs( aMediaDesc, _bSuppressMacros, _bReadOnly, 
m_pImpl->m_aProps.aTitle );
 
        if ( m_pInterceptor )
        {
@@ -1356,10 +1433,10 @@
        m_pInterceptor->acquire();
        Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor;
 
-       _rEmbeddedObjectDescriptor.realloc(2);
-       nLen = 0;
-       _rEmbeddedObjectDescriptor[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutplaceDispatchInterceptor"));
-       _rEmbeddedObjectDescriptor[nLen++].Value <<= xInterceptor;
+       _out_rEmbeddedObjectDescriptor.realloc(2);
+       sal_Int32 nLen = 0;
+       _out_rEmbeddedObjectDescriptor[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutplaceDispatchInterceptor"));
+       _out_rEmbeddedObjectDescriptor[nLen++].Value <<= xInterceptor;
 
     uno::Sequence< uno::Any > aOutFrameProps(2);
     PropertyValue aProp;
@@ -1382,18 +1459,23 @@
         aOutFrameProps[1] <<= aProp;
     }
 
-    _rEmbeddedObjectDescriptor[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutplaceFrameProperties"));
-       _rEmbeddedObjectDescriptor[nLen++].Value <<= aOutFrameProps;
+    _out_rEmbeddedObjectDescriptor[nLen].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutplaceFrameProperties"));
+       _out_rEmbeddedObjectDescriptor[nLen++].Value <<= aOutFrameProps;
+
+    Sequence< PropertyValue > aLoadArgs;
+    aMediaDesc >>= aLoadArgs;
+    return aLoadArgs;
 }
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::loadEmbeddedObject(sal_Int16 _nMarcoExcecMode,const 
Sequence< sal_Int8 >& _aClassID,const Reference<XConnection>& 
_xConnection,sal_Bool _bReadOnly)
+void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& 
_xConnection, const Sequence< sal_Int8 >& _aClassID,
+        const Sequence< PropertyValue >& _rAdditionalArgs, const bool 
_bSuppressMacros, const bool _bReadOnly )
 {
        if ( !m_xEmbeddedObject.is() )
        {
                Reference< XStorage> xStorage = getStorage();
                if ( xStorage.is() )
                {
-                       Reference< XEmbedObjectFactory> xEmbedFactory( 
m_xORB->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OOoEmbeddedObjectFactory")))
 ,UNO_QUERY);
+                       Reference< XEmbedObjectFactory> xEmbedFactory( 
m_aContext.createComponent( "com.sun.star.embed.OOoEmbeddedObjectFactory" ), 
UNO_QUERY );
                        if ( xEmbedFactory.is() )
                        {
                                ::rtl::OUString sDocumentService;
@@ -1407,12 +1489,12 @@
                                }
                                else
                                {
-                                       sDocumentService = 
GetDocumentServiceFromMediaType(xStorage,m_pImpl->m_aProps.sPersistentName,m_xORB,aClassID);
+                                       sDocumentService = 
GetDocumentServiceFromMediaType( xStorage, m_pImpl->m_aProps.sPersistentName, 
m_aContext.getLegacyServiceFactory(), aClassID );
                     // check if we are not a form and
                                        if (m_bForm == 0 /* MAGIC! */ && 
!sDocumentService.equalsAscii("com.sun.star.text.TextDocument"))
                                        {
                                                // we seems to be a new report, 
check if report extension is present.
-                               Reference< XContentEnumerationAccess > 
xEnumAccess(m_xORB, UNO_QUERY);
+                               Reference< XContentEnumerationAccess > 
xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY );
                         const ::rtl::OUString sReportEngineServiceName = 
::dbtools::getDefaultReportEngineServiceName(m_xORB);
                                Reference< XEnumeration > xEnumDrivers = 
xEnumAccess->createContentEnumeration(sReportEngineServiceName);
                                if ( !xEnumDrivers.is() || 
!xEnumDrivers->hasMoreElements() )
@@ -1435,15 +1517,16 @@
 
                                OSL_ENSURE( aClassID.getLength(),"No Class ID" 
);
 
-                               Sequence<PropertyValue> 
aArgs,aEmbeddedObjectDescriptor;
-                               
fillLoadArgs(aArgs,aEmbeddedObjectDescriptor,_xConnection,_bReadOnly,_nMarcoExcecMode);
+                               Sequence< PropertyValue > 
aEmbeddedObjectDescriptor;
+                Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
+                    _xConnection, _bSuppressMacros, _bReadOnly, 
_rAdditionalArgs, aEmbeddedObjectDescriptor ) );
 
                                
m_xEmbeddedObject.set(xEmbedFactory->createInstanceUserInit(aClassID
                                                                                
                                                                        
,sDocumentService
                                                                                
                                                                        
,xStorage
                                                                                
                                                                        
,m_pImpl->m_aProps.sPersistentName
                                                                                
                                                                        
,nEntryConnectionMode
-                                                                               
                                                                        ,aArgs
+                                                                               
                                                                        
,aLoadArgs
                                                                                
                                                                        
,aEmbeddedObjectDescriptor
                                                                                
                                                                        
),UNO_QUERY);
                                if ( m_xEmbeddedObject.is() )
@@ -1478,12 +1561,14 @@
                Reference<XEmbeddedClient> xClient = m_pClientHelper;
                m_xEmbeddedObject->setClientSite(xClient);
 
-               Sequence<PropertyValue> aArgs,aEmbeddedObjectDescriptor;
-               
fillLoadArgs(aArgs,aEmbeddedObjectDescriptor,_xConnection,_bReadOnly,_nMarcoExcecMode);
+               Sequence< PropertyValue > aEmbeddedObjectDescriptor;
+        Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
+            _xConnection, _bSuppressMacros, _bReadOnly, _rAdditionalArgs, 
aEmbeddedObjectDescriptor ) );
+
                Reference<XCommonEmbedPersist> 
xCommon(m_xEmbeddedObject,UNO_QUERY);
                OSL_ENSURE(xCommon.is(),"unsupported interface!");
                if ( xCommon.is() )
-                       xCommon->reload(aArgs,aEmbeddedObjectDescriptor);
+                       xCommon->reload( aLoadArgs, aEmbeddedObjectDescriptor );
                m_xEmbeddedObject->changeState(EmbedStates::RUNNING);
        }
 
@@ -1502,32 +1587,25 @@
         }
         catch( const Exception& )
         {
-            OSL_ENSURE( sal_False, "ODocumentDefinition::loadEmbeddedObject: 
caught an exception while setting the parent of the embedded object!" );
+            DBG_UNHANDLED_EXCEPTION();
         }
     }
 
     if ( xModel.is() )
        {
                Sequence<PropertyValue> aArgs = xModel->getArgs();
-               ::comphelper::MediaDescriptor aHelper(aArgs);
-        aHelper[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ) )] 
<<= _bReadOnly;
-
-               if ( m_pImpl->m_aProps.aTitle.getLength() )
-                       aHelper[ 
-                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentTitle" 
) )] <<= m_pImpl->m_aProps.aTitle;
-
-               aHelper[ 
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroExecutionMode" 
))] <<= _nMarcoExcecMode;
 
-               aHelper >> aArgs;
+        ::comphelper::NamedValueCollection aMediaDesc( aArgs );
+        lcl_putLoadArgs( aMediaDesc, _bSuppressMacros, _bReadOnly, 
m_pImpl->m_aProps.aTitle );
 
-               xModel->attachResource(xModel->getURL(),aArgs);
+               aMediaDesc >>= aArgs;
+               xModel->attachResource( xModel->getURL(), aArgs );
        }
 }
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::generateNewImage(Any& _rImage)
+void ODocumentDefinition::onCommandPreview(Any& _rImage)
 {
-    loadEmbeddedObject( MacroExecMode::NEVER_EXECUTE,Sequence< sal_Int8 >(), 
Reference< XConnection >(), sal_True );
+    loadEmbeddedObjectForPreview();
        if ( m_xEmbeddedObject.is() )
        {
                try
@@ -1554,19 +1632,20 @@
        _rDefault.clear();
 }
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::fillDocumentInfo(Any& _rInfo)
+void ODocumentDefinition::onCommandGetDocumentInfo( Any& _rInfo )
 {
-       loadEmbeddedObject( MacroExecMode::NEVER_EXECUTE,Sequence< sal_Int8 
>(), Reference< XConnection >(), sal_True );
+       loadEmbeddedObjectForPreview();
        if ( m_xEmbeddedObject.is() )
        {
                try
                {
-                       Reference<XDocumentInfoSupplier> 
xDocSup(getComponent(),UNO_QUERY);
+                       Reference<XDocumentInfoSupplier> xDocSup( 
getComponent(), UNO_QUERY );
                        if ( xDocSup.is() )
                                _rInfo <<= xDocSup->getDocumentInfo();
                }
-               catch( Exception e )
+               catch( const Exception& )
                {
+            DBG_UNHANDLED_EXCEPTION();
                }
        }
 }
@@ -1606,13 +1685,10 @@
         if ( _rNewName.equals( m_pImpl->m_aProps.aTitle ) )
             return;
 
-        // document definitions are organized in a hierarchicalway, so reject 
names
+        // document definitions are organized in a hierarchical way, so reject 
names
         // which contain a /, as this is reserved for hierarchy level 
separation
         if ( _rNewName.indexOf( '/' ) != -1 )
-        {
-            ::dbtools::throwGenericSQLException(
-                DBA_RES( RID_STR_NO_SLASH_IN_OBJECT_NAME ), *this );
-        }
+            m_aErrorHelper.raiseException( 
ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES, *this );
 
         sal_Int32 nHandle = PROPERTY_ID_NAME;
         Any aOld = makeAny( m_pImpl->m_aProps.aTitle );
@@ -1635,10 +1711,8 @@
 // 
-----------------------------------------------------------------------------
 Reference< XStorage> ODocumentDefinition::getStorage() const
 {
-       static const ::rtl::OUString s_sForms = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("forms"));
-       static const ::rtl::OUString s_sReports = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reports"));
        return  m_pImpl->m_pDataSource
-        ?   m_pImpl->m_pDataSource->getStorage( m_bForm ? s_sForms : 
s_sReports )
+        ?   m_pImpl->m_pDataSource->getStorage( 
ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? 
ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) )
         :   Reference< XStorage>();
 }
 // 
-----------------------------------------------------------------------------
@@ -1696,9 +1770,9 @@
     return true;
 }
 // 
-----------------------------------------------------------------------------
-void ODocumentDefinition::fillReportData(sal_Bool _bFill)
+void ODocumentDefinition::fillReportData()
 {
-       if ( !m_bForm && _bFill && m_pImpl->m_aProps.bAsTemplate && 
!m_bOpenInDesign ) // open a report in alive mode, so we need to fill it
+       if ( !m_bForm && m_pImpl->m_aProps.bAsTemplate && !m_bOpenInDesign ) // 
open a report in alive mode, so we need to fill it
        {
                Sequence<Any> aArgs(2);
                PropertyValue aValue;
@@ -1709,7 +1783,7 @@
                aValue.Value <<= m_xLastKnownConnection;
                aArgs[1] <<= aValue;
 
-               Reference< XJobExecutor > 
xExecuteable(m_xORB->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.wizards.report.CallReportWizard")),aArgs),UNO_QUERY);
+               Reference< XJobExecutor > xExecuteable( 
m_aContext.createComponentWithArguments( 
"com.sun.star.wizards.report.CallReportWizard", aArgs ), UNO_QUERY );
                if ( xExecuteable.is() )
                        
xExecuteable->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fill")));
        }

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

File [changed]: documentdefinition.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.hxx?r1=1.23.24.1&r2=1.23.24.2
Delta lines:  +70 -40
---------------------
--- documentdefinition.hxx      2007-11-07 12:14:20+0000        1.23.24.1
+++ documentdefinition.hxx      2007-12-20 07:51:07+0000        1.23.24.2
@@ -105,42 +105,6 @@
        sal_Bool                                                                
                                                                                
        m_bInExecute;
        OEmbeddedClientHelper*                                                  
                                                                        
m_pClientHelper;
 
-private:
-       // Command "insert"
-       void insert( const ::rtl::OUString& _sURL, const 
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& 
Environment ) throw( ::com::sun::star::uno::Exception );
-
-       /** fills the load arguments
-       *
-       * \param _rArgs
-       * \param _rEmbeddedObjectDescriptor
-    * \param _xConnection
-    * \param _bReadOnly
-    * \param _nMarcoExcecMode
-       */
-       void fillLoadArgs(::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue>& _rArgs
-                                       , ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue>& _rEmbeddedObjectDescriptor
-                                       ,const 
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& 
_xConnection
-                                       ,sal_Bool _bReadOnly
-                    ,sal_Int16 _nMarcoExcecMode);
-       /** loads the EmbeddedObject if not already loaded
-               @param  _aClassID
-                       If set, it will be used to create the embedded object.
-       */
-       void loadEmbeddedObject(sal_Int16 _nMarcoExcecMode
-                            ,const ::com::sun::star::uno::Sequence< sal_Int8 
>& _aClassID = ::com::sun::star::uno::Sequence< sal_Int8 >()
-                                                       ,const 
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& 
_xConnection = ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection>()
-                                                       ,sal_Bool _bReadOnly = 
sal_False
-                            );
-
-
-       void generateNewImage(::com::sun::star::uno::Any& _rImage);
-       void fillDocumentInfo(::com::sun::star::uno::Any& _rInfo);
-       /** searches for read-only flag in the args of the model and sets it to 
the given value,
-               if the value was not found, it will be appended.
-               @param  _bReadOnly
-                       If <TRUE/> the document will be switched to readonly 
mode
-       */
-       void updateDocumentTitle();
 protected:
        virtual ~ODocumentDefinition();
 
@@ -204,7 +168,7 @@
         @param _bOpenedInDesignMode
             determines whether the embedded object has been opened for 
designing it or for data display
     */
-    void impl_onActivateEmbeddedObject( bool _bOpenedInDesignMode );
+    void impl_onActivateEmbeddedObject();
 
     /** initializes a newly created view/controller which is displaying our 
embedded object
 
@@ -236,8 +200,74 @@
        virtual void SAL_CALL disposing();
 
 private:
+       /** fills the load arguments
+       */
+    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+        fillLoadArgs(
+            const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection>& _xConnection,
+            const bool _bSuppressMacros,
+                       const bool _bReadOnly,
+            const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
+                       ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& _out_rEmbeddedObjectDescriptor
+        );
+
+       /** loads the EmbeddedObject if not already loaded
+               @param  _aClassID
+                       If set, it will be used to create the embedded object.
+       */
+       void loadEmbeddedObject(
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection>& _xConnection,
+                const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID,
+                const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& _rAdditionalArgs,
+                const bool _bSuppressMacros,
+                               const bool _bReadOnly
+            );
+
+    /** loads the embedded object, if not already loaded. No new object can be 
created with this method.
+    */
+    void    loadEmbeddedObject()
+    {
+        loadEmbeddedObject(
+            NULL,
+            ::com::sun::star::uno::Sequence< sal_Int8 >(),
+            ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >(),
+            false,
+            false
+        );
+    }
+
+    /** loads the embedded object for preview. Macros will be suppressed, and 
the document will
+        be read-only.
+    */
+    void    loadEmbeddedObjectForPreview()
+    {
+        loadEmbeddedObject(
+            NULL,
+            ::com::sun::star::uno::Sequence< sal_Int8 >(),
+            ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >(),
+            true,
+            true
+        );
+    }
+
+       /** searches for read-only flag in the args of the model and sets it to 
the given value,
+               if the value was not found, it will be appended.
+               @param  _bReadOnly
+                       If <TRUE/> the document will be switched to readonly 
mode
+       */
+       void updateDocumentTitle();
+
        void registerProperties();
 
+    //-------------------------------------------------------------------------
+    //- commands
+    //-------------------------------------------------------------------------
+
+    void onCommandGetDocumentInfo( ::com::sun::star::uno::Any& _rInfo );
+       void onCommandInsert( const ::rtl::OUString& _sURL, const 
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& 
Environment ) throw( ::com::sun::star::uno::Exception );
+       void onCommandPreview( ::com::sun::star::uno::Any& _rImage );
+    void onCommandOpenSomething( const ::com::sun::star::uno::Any& _rArgument, 
const bool _bActivate,
+            const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XCommandEnvironment >& _rxEnvironment, 
::com::sun::star::uno::Any& _out_rComponent );
 };
 
 //........................................................................

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.47.16.1&r2=1.47.16.2
Delta lines:  +207 -148
-----------------------
--- AppController.cxx   2007-10-26 11:05:06+0000        1.47.16.1
+++ AppController.cxx   2007-12-20 07:51:10+0000        1.47.16.2
@@ -36,12 +36,10 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_dbaccess.hxx"
 
-#ifndef DBAUI_APPCONTROLLER_HXX
 #include "AppController.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
 #include "dbustrings.hrc"
-#endif
+#include "advancedsettingsdlg.hxx"
+
 /** === begin UNO includes === **/
 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
 #include <com/sun/star/container/XNameContainer.hpp>
@@ -70,6 +68,9 @@
 #ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
 #include <com/sun/star/sdbcx/XAppend.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDBCX_XALTERVIEW_HPP_
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+#endif
 #ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
 #endif
@@ -737,6 +738,7 @@
                                break;
                        case SID_FORM_CREATE_REPWIZ_PRE_SEL:
                        case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
+            case SID_APP_NEW_REPORT_PRE_SEL:
                                aReturn.bEnabled = !isDataSourceReadOnly()
                                                                        && 
SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER)
                                                                        && 
getContainer()->isALeafSelected();
@@ -744,6 +746,17 @@
                                {
                                        ElementType eType = 
getContainer()->getElementType();
                                        aReturn.bEnabled = eType == E_QUERY || 
eType == E_TABLE;
+                    if ( aReturn.bEnabled && SID_APP_NEW_REPORT_PRE_SEL == 
_nId )
+                    {
+                        Reference< XContentEnumerationAccess > 
xEnumAccess(m_xServiceFactory, UNO_QUERY);
+                                           aReturn.bEnabled = xEnumAccess.is();
+                           if ( aReturn.bEnabled )
+                        {
+                            static ::rtl::OUString 
s_sReportDesign(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOReportJobFactory"));
+                           Reference< XEnumeration > xEnumDrivers = 
xEnumAccess->createContentEnumeration(s_sReportDesign);
+                            aReturn.bEnabled = xEnumDrivers.is() && 
xEnumDrivers->hasMoreElements();
+                        }
+                    }
                                }
                                break;
                        case SID_DB_APP_DELETE:
@@ -779,12 +792,36 @@
                                                                        && 
getContainer()->isALeafSelected();
                                break;
                        case SID_DB_APP_EDIT_SQL_VIEW:
-                               aReturn.bEnabled =
-                    (   ( !isDataSourceReadOnly() )
-                    &&  ( getContainer()->getElementType() == E_QUERY )
-                    &&  ( getContainer()->getSelectionCount() > 0 )
+                if ( isDataSourceReadOnly() )
+                                   aReturn.bEnabled = sal_False;
+                else
+                {
+                    switch ( getContainer()->getElementType() )
+                    {
+                    case E_QUERY:
+                        aReturn.bEnabled =  ( 
getContainer()->getSelectionCount() > 0 )
+                                        &&  ( 
getContainer()->isALeafSelected() );
+                        break;
+                    case E_TABLE:
+                        aReturn.bEnabled = sal_False;
+                        // there's one exception: views which support altering 
their underlying
+                        // command can be edited in SQL view, too
+                        if  (   ( getContainer()->getSelectionCount() > 0 )
                     &&  ( getContainer()->isALeafSelected() )
-                    );
+                            )
+                        {
+                                                   ::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;
+                        }
+                        break;
+                    default:
+                        break;
+                    }
+                }
                 break;
                        case SID_DB_APP_OPEN:
                        case SID_DB_APP_TABLE_OPEN:
@@ -795,9 +832,8 @@
                                break;
                        case SID_DB_APP_DSUSERADMIN:
                        {
-                               ODsnTypeCollection aTypeCollection;
-                               DATASOURCE_TYPE eType = 
aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
-                               aReturn.bEnabled = DST_EMBEDDED != eType;
+                               DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
+                               aReturn.bEnabled = DST_EMBEDDED_HSQLDB != eType;
                        }
                        break;
                        case SID_DB_APP_DSRELDESIGN:
@@ -814,7 +850,7 @@
                                if ( aReturn.bEnabled )
                                {
                                        DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
-                                       aReturn.bEnabled = DST_EMBEDDED != 
eType && DST_MOZILLA != eType && DST_EVOLUTION != eType && DST_KAB != eType && 
DST_MACAB != eType && DST_OUTLOOK != eType && DST_OUTLOOKEXP != eType;
+                                       aReturn.bEnabled = DST_EMBEDDED_HSQLDB 
!= eType && DST_MOZILLA != eType && DST_EVOLUTION != eType && DST_KAB != eType 
&& DST_MACAB != eType && DST_OUTLOOK != eType && DST_OUTLOOKEXP != eType;
                                }
                                break;
                        case SID_DB_APP_DSCONNECTION_TYPE:
@@ -822,15 +858,15 @@
                                if ( aReturn.bEnabled )
                                {
                                        DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
-                                       aReturn.bEnabled = DST_EMBEDDED != 
eType;
+                                       aReturn.bEnabled = DST_EMBEDDED_HSQLDB 
!= eType;
                                }
                                break;
                        case SID_DB_APP_DSADVANCED_SETTINGS:
                 aReturn.bEnabled = m_xDataSource.is();
                                if ( aReturn.bEnabled )
                                {
-                                       DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
-                                       aReturn.bEnabled = DST_EMBEDDED != 
eType && DST_LDAP != eType && DST_CALC != eType && DST_MOZILLA != eType && 
DST_THUNDERBIRD != eType && DST_EVOLUTION != eType && DST_KAB != eType && 
DST_MACAB != eType && DST_OUTLOOK != eType && DST_OUTLOOKEXP != eType;
+                                       DATASOURCE_TYPE eType = 
m_aTypeCollection.getType( ::comphelper::getString( 
m_xDataSource->getPropertyValue( PROPERTY_URL ) ) );
+                    aReturn.bEnabled = 
AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( eType );
                                }
                                break;
                        case SID_DB_APP_CONVERTTOVIEW:
@@ -890,23 +926,18 @@
                                aReturn.bEnabled = m_xDataSource.is();
                                if ( aReturn.bEnabled )
                                {
-                                       ::rtl::OUString sTemp;
-                                       
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sTemp;
-                                       DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(sTemp);
+                                       ::rtl::OUString sURL;
+                                       
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
+                                       DATASOURCE_TYPE eType = 
m_aTypeCollection.getType( sURL );
+
                                        String sDatabaseName;
-                                       if ( eType != DST_EMBEDDED )
-                                       {
-                                               String sUser,sHostName,ssTemp;
-                                               ssTemp = sTemp;
-                                               sal_Int32 nPortNumber = -1;
+                                       String sHostName;
+                                       sal_Int32 nPortNumber( -1 );
 
-                                               
m_aTypeCollection.extractHostNamePort(ssTemp
-                                                            ,sDatabaseName
-                                                                               
                                        ,sHostName
-                                                                               
                                        ,nPortNumber);
-                                               if ( !sDatabaseName.Len() )
-                                                       sDatabaseName = 
m_aTypeCollection.cutPrefix(sTemp);
+                                       m_aTypeCollection.extractHostNamePort( 
sURL, sDatabaseName, sHostName, nPortNumber );
 
+                    if ( !sDatabaseName.Len() )
+                                               sDatabaseName = 
m_aTypeCollection.cutPrefix( sURL );
                                                if ( 
m_aTypeCollection.isFileSystemBased(eType) )
                                                {
                                                        sDatabaseName = 
SvtPathOptions().SubstituteVariable( sDatabaseName );
@@ -917,9 +948,10 @@
                                                                sDatabaseName = 
aFileNotation.get(::svt::OFileNotation::N_SYSTEM);
                                                        }
                                                }
-                                       }
-                                       else
-                                               sDatabaseName = 
m_aTypeCollection.getEmbeddedDatabaseUIName(getORB());
+
+                    if ( sDatabaseName.Len() == 0 )
+                        sDatabaseName = m_aTypeCollection.getTypeDisplayName( 
eType );
+
                                        aReturn.sTitle = sDatabaseName;
                                }
                                break;
@@ -932,21 +964,14 @@
                                aReturn.bEnabled = m_xDataSource.is();
                                if ( aReturn.bEnabled )
                                {
-                                       ::rtl::OUString sTemp;
-                                       
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sTemp;
-                                       DATASOURCE_TYPE eType = 
m_aTypeCollection.getType(sTemp);
-                                       if ( eType != DST_EMBEDDED )
-                                       {
-                                               String 
sUser,sHostName,sDatabaseName,ssTemp;
-                                               ssTemp = sTemp;
+                                       ::rtl::OUString sURL;
+                                       m_xDataSource->getPropertyValue( 
PROPERTY_URL ) >>= sURL;
+
+                                       String sHostName, sDatabaseName;
                                                sal_Int32 nPortNumber = -1;
-                                               
m_aTypeCollection.extractHostNamePort(ssTemp
-                                                                               
                                        ,sDatabaseName
-                                                                               
                                        ,sHostName
-                                                                               
                                        ,nPortNumber);
+                                       m_aTypeCollection.extractHostNamePort( 
sURL, sDatabaseName, sHostName, nPortNumber );
                                                aReturn.sTitle = sHostName;
                                        }
-                               }
                                break;
                        default:
                                aReturn = 
OApplicationController_CBASE::GetState(_nId);
@@ -1161,6 +1186,7 @@
                        case ID_APP_NEW_QUERY_AUTO_PILOT:
                        case SID_DB_FORM_NEW_PILOT:
                        case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
+            case SID_APP_NEW_REPORT_PRE_SEL:
                        case SID_FORM_CREATE_REPWIZ_PRE_SEL:
                        case ID_DOCUMENT_CREATE_REPWIZ:
                        case SID_APP_NEW_FORM:
@@ -1187,6 +1213,7 @@
                                                        bAutoPilot = sal_True;
                                                        // run through
                                                case SID_APP_NEW_REPORT:
+                        case SID_APP_NEW_REPORT_PRE_SEL:
                                                        eType = E_REPORT;
                                                        break;
                                                case 
ID_APP_NEW_QUERY_AUTO_PILOT:
@@ -1226,7 +1253,7 @@
                     SharedConnection xConnection( ensureConnection() );
                                        if ( xConnection.is() )
                                        {
-                                               QueryDesigner aDesigner( 
getORB(), this, m_xCurrentFrame, sal_True, SID_DB_NEW_VIEW_SQL == _nId );
+                                               QueryDesigner aDesigner( 
getORB(), this, m_xCurrentFrame, true, SID_DB_NEW_VIEW_SQL == _nId );
 
                         Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                                Reference< XComponent > 
xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
@@ -1377,6 +1404,8 @@
                                                                                
         CommandGroup::APPLICATION );
 
        implDescribeSupportedFeature( ".uno:DBNewReport",                
SID_APP_NEW_REPORT,            CommandGroup::INSERT );
+    implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection",          
 
+                                                             
SID_APP_NEW_REPORT_PRE_SEL,CommandGroup::APPLICATION );
     implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot",
                                                              
ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT );
     implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection",
@@ -1698,6 +1727,32 @@
     return false;   // not handled
 }
 // 
-----------------------------------------------------------------------------
+bool OApplicationController::impl_isAlterableView_nothrow( const 
::rtl::OUString& _rTableOrViewName ) const
+{
+    OSL_PRECOND( m_xDataSourceConnection.is(), 
"OApplicationController::impl_isAlterableView_nothrow: no connection!" );
+
+    bool bIsAlterableView( false );
+    try
+    {
+        Reference< XViewsSupplier > xViewsSupp( m_xDataSourceConnection, 
UNO_QUERY );
+        Reference< XNameAccess > xViews;
+        if ( xViewsSupp.is() )
+            xViews = xViewsSupp->getViews();
+
+        Reference< XAlterView > xAsAlterableView;
+        if ( xViews.is() && xViews->hasByName( _rTableOrViewName ) )
+            xAsAlterableView.set( xViews->getByName( _rTableOrViewName ), 
UNO_QUERY );
+
+        bIsAlterableView = xAsAlterableView.is();
+    }
+    catch( const Exception& )
+    {
+        DBG_UNHANDLED_EXCEPTION();
+    }
+    return bIsAlterableView;
+}
+
+// 
-----------------------------------------------------------------------------
 Reference< XComponent > OApplicationController::openElement(const 
::rtl::OUString& _sName, ElementType _eType,
     OLinkedDocumentsAccess::EOpenMode _eOpenMode, sal_uInt16 
_nInstigatorCommand )
 {
@@ -1708,6 +1763,7 @@
                // OJ: http://www.openoffice.org/issues/show_bug.cgi?id=30382
                getContainer()->showPreview(NULL);
        }
+
        switch ( _eType )
        {
                case E_REPORT:
@@ -1729,28 +1785,30 @@
                case E_TABLE:
                        {
                                SharedConnection xConnection( 
ensureConnection() );
-                               if ( xConnection.is() )
-                               {
+               if ( !xConnection.is() )
+            break;
+
                                    ::std::auto_ptr< DatabaseObjectView > 
pDesigner;
                                        Sequence < PropertyValue > aArgs;
                                        Any aDataSource;
                                        if ( _eOpenMode == 
OLinkedDocumentsAccess::OPEN_DESIGN )
                                        {
+            sal_Bool bQuerySQLMode =( _nInstigatorCommand == 
SID_DB_APP_EDIT_SQL_VIEW );
+
                                                if ( _eType == E_TABLE )
                                                {
+                if ( impl_isAlterableView_nothrow( _sName ) )
+                    pDesigner.reset( new QueryDesigner( getORB(), this, 
m_xCurrentFrame, true, bQuerySQLMode ) );
+                else
                                                        pDesigner.reset( new 
TableDesigner( getORB(), this, m_xCurrentFrame ) );
                                                }
                                                else if ( _eType == E_QUERY )
                                                {
-                            sal_Bool bQuerySQLMode =
-                                (   ( _nInstigatorCommand == 
SID_DB_APP_EDIT_SQL_VIEW )
-                                &&  ( _eType == E_QUERY )
-                                );
-                            pDesigner.reset( new QueryDesigner( getORB(), 
this, m_xCurrentFrame, sal_False, bQuerySQLMode ) );
+                pDesigner.reset( new QueryDesigner( getORB(), this, 
m_xCurrentFrame, false, bQuerySQLMode ) );
                                                }
                                                else if ( _eType == E_REPORT )
                                                {
-                                                       pDesigner.reset(new 
OReportDesigner(getORB(),this, m_xCurrentFrame ));
+                               pDesigner.reset( new ReportDesigner( 
getORB(),this, m_xCurrentFrame ) );
                                                }
                                                aDataSource <<= m_xDataSource;
                                        }
@@ -1768,8 +1826,8 @@
                                        Reference< XComponent > xComponent( 
pDesigner->openExisting( aDataSource, _sName, aArgs ), UNO_QUERY );
                                        addDocumentListener( xComponent, NULL );
                                }
-                       }
                        break;
+
         default:
             break;
        }
@@ -1796,24 +1854,8 @@
                        ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = 
getDocumentsAccess(_eType);
             if ( aHelper->isConnected() )
                        {
-                           sal_Int32 nCommandType = ( 
(getContainer()->getElementType() == E_QUERY)
-                                                                               
    ? CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? 
CommandType::TABLE : -1 ));
-                           Reference<XConnection> xConnection;
-
-                           ::rtl::OUString sName;
-                           if ( nCommandType != -1 )
-                           {
-                                   try
-                                   {
-                                           sName = 
getContainer()->getQualifiedName( NULL );
-                        OSL_ENSURE( sName.getLength(), 
"OApplicationController::newElementWithPilot: no name given!" );
-                                   }
-                                   catch(Exception)
-                                   {
-                        OSL_ENSURE( 0, 
"OApplicationController::newElementWithPilot: Exception catched!" );
-                                   }
-                           }
-
+                sal_Int32 nCommandType = -1;
+                const ::rtl::OUString 
sName(getCurrentlySelectedName(nCommandType));
                 Reference< XComponent > xComponent,xDefinition;
                                if ( E_REPORT == _eType )
                                        xComponent = 
aHelper->newReportWithPilot(xDefinition,nCommandType,sName);
@@ -1850,18 +1892,13 @@
        switch ( _eType )
        {
         case E_FORM:
-                       {
-                               ::std::auto_ptr<OLinkedDocumentsAccess> aHelper 
= getDocumentsAccess(_eType);
-                               Reference< XComponent > xComponent,xDefinition;
-                               xComponent = 
aHelper->newForm(ID_FORM_NEW_TEXT,xDefinition);
-                               addDocumentListener(xComponent,xDefinition);
-                       }
-                       break;
                case E_REPORT:
                        {
                                ::std::auto_ptr<OLinkedDocumentsAccess> aHelper 
= getDocumentsAccess(_eType);
                                Reference< XComponent > xComponent,xDefinition;
-                               xComponent = 
aHelper->newForm(ID_REPORT_NEW_TEXT,xDefinition);
+                sal_Int32 nCommandType = -1;
+                const ::rtl::OUString 
sName(getCurrentlySelectedName(nCommandType));
+                xComponent = aHelper->newDocument(_eType == E_FORM ? 
ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT,xDefinition,nCommandType,sName);
                                addDocumentListener(xComponent,xDefinition);
                        }
                        break;
@@ -1879,10 +1916,10 @@
                                        }
                                        else if ( _eType == E_QUERY )
                                        {
-                                               pDesigner.reset( new 
QueryDesigner( getORB(), this, m_xCurrentFrame, sal_False, _bSQLView ) );
+                                               pDesigner.reset( new 
QueryDesigner( getORB(), this, m_xCurrentFrame, false, _bSQLView ) );
                                        }
                                        else 
-                                               pDesigner.reset(new 
OReportDesigner(getORB(),this, m_xCurrentFrame ));
+                                               pDesigner.reset( new 
ReportDesigner( getORB(), this, m_xCurrentFrame ) );
 
                     Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                        Reference< XComponent > xComponent( 
pDesigner->createNew( xDataSource ), UNO_QUERY );
@@ -2494,6 +2531,28 @@
        }
 }
 // 
-----------------------------------------------------------------------------
+::rtl::OUString OApplicationController::getCurrentlySelectedName(sal_Int32& 
_rnCommandType) const
+{
+    _rnCommandType = ( (getContainer()->getElementType() == E_QUERY)
+                                                               ? 
CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? 
CommandType::TABLE : -1 ));
+       
+
+       ::rtl::OUString sName;
+       if ( _rnCommandType != -1 )
+       {
+               try
+               {
+                       sName = getContainer()->getQualifiedName( NULL );
+            OSL_ENSURE( sName.getLength(), 
"OApplicationController::newElementWithPilot: no name given!" );
+               }
+               catch(Exception)
+               {
+            OSL_ENSURE( 0, "OApplicationController::newElementWithPilot: 
Exception catched!" );
+               }
+       }
+    return sName;
+}
+// 
-----------------------------------------------------------------------------
 ::sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) 
throw (IllegalArgumentException, RuntimeException)
 {
     ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );

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

File [removed]: AdvancedPageDlg.cxx

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

File [removed]: AdvancedPageDlg.hrc

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

File [removed]: AdvancedPageDlg.src

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

File [removed]: AdvancedPageDlg.hxx

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

File [removed]: dialogcontrolling.hxx

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

File [removed]: dialogcontrolling.cxx

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

File [removed]: TableWindowData.hxx

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

File [removed]: AdvancedSettingsDlg.hxx




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

Reply via email to