summaryrefslogtreecommitdiff
path: root/dbaccess/source/filter/xml/dbloader2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/filter/xml/dbloader2.cxx')
-rw-r--r--dbaccess/source/filter/xml/dbloader2.cxx30
1 files changed, 14 insertions, 16 deletions
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 9587647a38ff..3942dab26801 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -31,7 +31,6 @@
#include <com/sun/star/frame/XLoadEventListener.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
@@ -47,15 +46,15 @@
#include <comphelper/documentconstants.hxx>
#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/propertysequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <sfx2/docfile.hxx>
+#include <unotools/fcm.hxx>
#include <unotools/moduleoptions.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
using namespace ::ucbhelper;
@@ -66,7 +65,6 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::sdb;
@@ -140,8 +138,8 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
{
// After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further
// for now the file should be reopened to have read/write access
- aMedia.remove( OUString( "InputStream" ) );
- aMedia.remove( OUString( "Stream" ) );
+ aMedia.remove( "InputStream" );
+ aMedia.remove( "Stream" );
aMedia >>= Descriptor;
try
{
@@ -265,7 +263,7 @@ namespace
}
catch( const Exception& )
{
- OSL_FAIL( "lcl_urlAllowsInteraction: caught an exception while analyzing the URL!" );
+ TOOLS_WARN_EXCEPTION( "dbaccess", "lcl_urlAllowsInteraction: caught an exception while analyzing the URL!" );
}
return bDoesAllow;
}
@@ -355,10 +353,13 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
OUString sViewName = aMediaDesc.getOrDefault( "ViewName", OUString( "Default" ) );
aMediaDesc.remove( "ViewName" );
+ // this needs to stay alive for duration of this method
+ Reference< XDatabaseContext > xDatabaseContext;
+
sal_Int32 nInitialSelection = -1;
if ( !xModel.is() )
{
- Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(m_aContext) );
+ xDatabaseContext = DatabaseContext::create(m_aContext);
OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::DATABASE);
bCreateNew = sFactoryName.match(_rURL);
@@ -373,7 +374,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
else
{
::comphelper::NamedValueCollection aCreationArgs;
- aCreationArgs.put( OUString(INFO_POOLURL), sSalvagedURL );
+ aCreationArgs.put( INFO_POOLURL, sSalvagedURL );
xDocumentDataSource.set( xDatabaseContext->createInstanceWithArguments( aCreationArgs.getWrappedNamedValues() ), UNO_QUERY_THROW );
}
@@ -446,11 +447,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
Reference< XModel2 > xModel2( xModel, UNO_QUERY_THROW );
Reference< XController2 > xController( xModel2->createViewController( sViewName, Sequence< PropertyValue >(), rFrame ), UNO_SET_THROW );
- xController->attachModel( xModel );
- xModel->connectController( xController.get() );
- rFrame->setComponent( xController->getComponentWindow(), xController.get() );
- xController->attachFrame( rFrame );
- xModel->setCurrentController( xController.get() );
+ // introduce model/view/controller to each other
+ utl::ConnectFrameControllerModel(rFrame, xController, xModel);
bSuccess = true;
}
@@ -473,7 +471,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
{
NamedDatabaseObject aSelection;
aSelection.Type = nInitialSelection;
- xDocView->select( makeAny( aSelection ) );
+ xDocView->select( Any( aSelection ) );
}
}
@@ -517,7 +515,7 @@ IMPL_LINK_NOARG( DBContentLoader, OnStartTableWizard, void*, void )
}
catch(const Exception&)
{
- OSL_FAIL("caught an exception while starting the table wizard!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "caught an exception while starting the table wizard!");
}
m_xMySelf = nullptr;
}