summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-04 16:04:06 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-04 16:04:06 +0100
commit538e41ebb44726aa666c92b79d0000aca8c41ae4 (patch)
treeac8d879d8b03bd4a206d1a4eef12034e224e0042 /dbaccess
parent4831a67ec526909f6efd74545405e93891e11a45 (diff)
autorecovery: form and report wizzard now also using XDatabaseDocumentUI, instead of manipulating document definitions
All database object wizards by now employ XDatabaseDocumentUI. This way, it is ensured that the controller has the full control over the opened sub components. Still, other third-party code could use direct access to the document definitions, and open sub documents this way. This would go unnoticed by the application controller at the moment. I would be possible to fix this, by introducing broadcasts from the document definitions, listened to by the controller. But as this sounds like a rare case, and XDatabaseDocumentUI is the preferred way for third-party components, too, such an implementation is deferred to Later ...
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx13
-rw-r--r--dbaccess/source/ui/app/AppController.cxx33
-rw-r--r--dbaccess/source/ui/inc/linkeddocuments.hxx21
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx55
5 files changed, 39 insertions, 85 deletions
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 03cb9326809e..9646c36499d3 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -232,7 +232,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
::rtl::OUString sName, sPersistentName, sURL;
Reference< XCommandProcessor > xCopyFrom;
Reference< XConnection > xConnection;
- sal_Bool bAsTemplate;
+ sal_Bool bAsTemplate( sal_False );
Sequence< sal_Int8 > aClassID;
::comphelper::NamedValueCollection aArgs( _aArguments );
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 4a6813bee2af..ee0fb347f6d6 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1083,10 +1083,6 @@ void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, con
}
aDocumentArgs.put( "MacroExecutionMode", *aDocumentMacroMode );
-
- if ( xConnection.is() )
- m_xLastKnownConnection = xConnection;
-
if ( ( nOpenMode == OpenMode::ALL )
|| ( nOpenMode == OpenMode::FOLDERS )
|| ( nOpenMode == OpenMode::DOCUMENTS )
@@ -1793,7 +1789,7 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
return aMediaDesc.getPropertyValues();
}
// -----------------------------------------------------------------------------
-void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _xConnection, const Sequence< sal_Int8 >& _aClassID,
+void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_rConnection, const Sequence< sal_Int8 >& _aClassID,
const Sequence< PropertyValue >& i_rOpenCommandArguments, const bool _bSuppressMacros, const bool _bReadOnly )
{
if ( !m_xEmbeddedObject.is() )
@@ -1847,7 +1843,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x
Sequence< PropertyValue > aEmbeddedObjectDescriptor;
Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
- _xConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) );
+ i_rConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) );
m_xEmbeddedObject.set(xEmbedFactory->createInstanceUserInit(aClassID
,sDocumentService
@@ -1893,7 +1889,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x
Sequence< PropertyValue > aEmbeddedObjectDescriptor;
Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
- _xConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) );
+ i_rConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) );
Reference<XCommonEmbedPersist> xCommon(m_xEmbeddedObject,UNO_QUERY);
OSL_ENSURE(xCommon.is(),"unsupported interface!");
@@ -1954,6 +1950,9 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x
DBG_UNHANDLED_EXCEPTION();
}
}
+
+ if ( i_rConnection.is() )
+ m_xLastKnownConnection = i_rConnection;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index cc040cabe11c..b15832a7ee7d 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2048,26 +2048,10 @@ void OApplicationController::newElementWithPilot( ElementType _eType )
{
sal_Int32 nCommandType = -1;
const ::rtl::OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) );
- Reference< XComponent > xComponent,xDefinition;
if ( E_REPORT == _eType )
- xComponent = aHelper->newReportWithPilot( xDefinition, nCommandType, sCurrentSelected );
+ aHelper->newReportWithPilot( nCommandType, sCurrentSelected );
else
- xComponent = aHelper->newFormWithPilot( xDefinition, nCommandType, sCurrentSelected );
- OSL_POSTCOND( xComponent.is() && xDefinition.is(), "OApplicationController::newElementWithPilot:"
- "invalid component/docdef!" );
-
- ::rtl::OUString sName;
- try
- {
- Reference< XHierarchicalName > xName( xDefinition, UNO_QUERY_THROW );
- sName = xName->getHierarchicalName();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( xComponent.is() && xDefinition.is() )
- onDocumentOpened( sName, _eType, E_OPEN_DESIGN, xComponent, xDefinition );
+ aHelper->newFormWithPilot( nCommandType, sCurrentSelected );
}
}
break;
@@ -2077,20 +2061,19 @@ void OApplicationController::newElementWithPilot( ElementType _eType )
::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
if ( aHelper->isConnected() )
{
- Reference< XComponent > xComponent;
if ( E_QUERY == _eType )
- xComponent = aHelper->newQueryWithPilot();
+ aHelper->newQueryWithPilot();
else
- xComponent = aHelper->newTableWithPilot();
-
- // no need for onDocumentOpened, the table wizard opens the created table by using
- // XDatabaseDocumentUI::loadComponent method.
+ aHelper->newTableWithPilot();
}
}
break;
case E_NONE:
break;
}
+
+ // no need for onDocumentOpened, the table wizard opens the created table by using
+ // XDatabaseDocumentUI::loadComponent method.
}
// -----------------------------------------------------------------------------
@@ -2908,7 +2891,7 @@ void OApplicationController::containerFound( const Reference< XContainer >& _xCo
try
{
sName = getContainer()->getQualifiedName( NULL );
- OSL_ENSURE( sName.getLength(), "OApplicationController::newElementWithPilot: no name given!" );
+ OSL_ENSURE( sName.getLength(), "OApplicationController::getCurrentlySelectedName: no name given!" );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx
index b91aca78fff2..cc4824058000 100644
--- a/dbaccess/source/ui/inc/linkeddocuments.hxx
+++ b/dbaccess/source/ui/inc/linkeddocuments.hxx
@@ -119,24 +119,16 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDefinition
);
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- newFormWithPilot(
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition,
+ void newFormWithPilot(
const sal_Int32 _nCommandType = -1,
const ::rtl::OUString& _rObjectName = ::rtl::OUString()
);
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- newReportWithPilot(
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition,
+ void newReportWithPilot(
const sal_Int32 _nCommandType = -1,
const ::rtl::OUString& _rObjectName = ::rtl::OUString()
);
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- newQueryWithPilot();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- newTableWithPilot();
+ void newQueryWithPilot();
+ void newTableWithPilot();
enum RESULT
{
@@ -148,15 +140,14 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
impl_open(
const ::rtl::OUString& _rLinkName,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition,
ElementOpenMode _eOpenMode,
const ::comphelper::NamedValueCollection& _rAdditionalArgs
);
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ void
impl_newWithPilot(
const char* _pWizardService,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition,
const sal_Int32 _nCommandType,
const ::rtl::OUString& _rObjectName
);
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 9dc35a684041..85f8eb635947 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -268,81 +268,62 @@ namespace dbaui
return xRet;
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,
- Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
+ void OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,
+ const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
{
- Reference< XComponent> xRet;
try
{
::comphelper::NamedValueCollection aArgs;
aArgs.put( "DataSourceName", m_sDataSourceName );
+ if ( m_xConnection.is() )
+ aArgs.put( "ActiveConnection", m_xConnection );
+
if ( _rObjectName.getLength() && ( _nCommandType != -1 ) )
{
aArgs.put( "CommandType", _nCommandType );
aArgs.put( "Command", _rObjectName );
}
- if ( m_xConnection.is() )
- aArgs.put( "ActiveConnection", m_xConnection );
aArgs.put( "DocumentUI", m_xDocumentUI );
- Reference< XController > xController( m_xDocumentUI, UNO_QUERY_THROW );
- aArgs.put( "ParentFrame", xController->getFrame() );
- // (legacy, 'til not all wizards migrated to the DocumentUI parameter)
-
Reference< XJobExecutor > xWizard;
{
WaitObject aWaitCursor( m_pDialogParent );
xWizard.set( m_xORB->createInstanceWithArguments(
- ::rtl::OUString::createFromAscii(_pWizardService),
+ ::rtl::OUString::createFromAscii( _pWizardService ),
aArgs.getWrappedPropertyValues()
- ), UNO_QUERY );
+ ), UNO_QUERY_THROW );
}
- if ( xWizard.is() )
- {
- xWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start")));
- Reference<XPropertySet> xProp( xWizard, UNO_QUERY_THROW );
- Reference<XPropertySetInfo> xInfo( xProp->getPropertySetInfo(), UNO_SET_THROW );
- if ( xInfo->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))) )
- {
- _xDefinition.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentDefinition"))),UNO_QUERY);
- xRet.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))),UNO_QUERY);
- }
- xWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("end")));
- ::comphelper::disposeComponent(xWizard);
- }
+ xWizard->trigger( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "start" ) ) );
+ ::comphelper::disposeComponent( xWizard );
}
catch(const Exception& e)
{
- (void) e;
- OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newWithPilot: caught an exception while loading the object!");
+ DBG_UNHANDLED_EXCEPTION();
}
- return xRet;
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newFormWithPilot(Reference< XComponent >& _xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName)
+ void OLinkedDocumentsAccess::newFormWithPilot( const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName )
{
- return impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _xDefinition, _nCommandType, _rObjectName );
+ impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _nCommandType, _rObjectName );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newReportWithPilot( Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
+ void OLinkedDocumentsAccess::newReportWithPilot( const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName )
{
- return impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _xDefinition, _nCommandType, _rObjectName );
+ impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _nCommandType, _rObjectName );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newTableWithPilot()
+ void OLinkedDocumentsAccess::newTableWithPilot()
{
- Reference< XComponent > xDefinition;
- return impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", xDefinition, -1, ::rtl::OUString() );
+ impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", -1, ::rtl::OUString() );
}
//------------------------------------------------------------------
- Reference< XComponent> OLinkedDocumentsAccess::newQueryWithPilot()
+ void OLinkedDocumentsAccess::newQueryWithPilot()
{
- Reference< XComponent > xDefinition;
- return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() );
+ impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", -1, ::rtl::OUString() );
}
//------------------------------------------------------------------
Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID,