summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-05-15 12:20:18 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-05-15 12:20:37 +0200
commitf5c6a14de565c34b581e99508f5ce0454134f7f1 (patch)
tree34f8307b0f8c1132c444f87f6b99fcba5213edeb /sw/source/uibase
parentdd466513a9b5412f59c38bfa1786782852033c2c (diff)
SwDBManager::LoadAndRegisterDataSource: fix indentation
Change-Id: I62645c02c556cb52d53e76c93ae17b41dfd43820
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx178
1 files changed, 89 insertions, 89 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 3f81f2edeadc..abb06f5bbe4c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2515,104 +2515,104 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, Any &
OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir)
{
- INetURLObject aURL( rURI );
- OUString sExt( aURL.GetExtension() );
- Any aTableFilterAny;
- Any aSuppressVersionsAny;
- Any aInfoAny;
- bool bStore = true;
- OUString sFind;
- Sequence<OUString> aFilters(1);
-
- switch (type) {
- case DBCONN_UNKNOWN:
- case DBCONN_CALC:
- break;
- case DBCONN_ODB:
- bStore = false;
- break;
- case DBCONN_FLAT:
- case DBCONN_DBASE:
- //set the filter to the file name without extension
- aFilters[0] = aURL.getBase();
- aTableFilterAny <<= aFilters;
- break;
- case DBCONN_MSJET:
- case DBCONN_MSACE:
- aSuppressVersionsAny <<= makeAny(true);
- break;
- }
-
- try
- {
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+ INetURLObject aURL( rURI );
+ OUString sExt( aURL.GetExtension() );
+ Any aTableFilterAny;
+ Any aSuppressVersionsAny;
+ Any aInfoAny;
+ bool bStore = true;
+ OUString sFind;
+ Sequence<OUString> aFilters(1);
- OUString sNewName = INetURLObject::decode( aURL.getName(),
- INetURLObject::DECODE_UNAMBIGUOUS,
- RTL_TEXTENCODING_UTF8 );
- sal_Int32 nExtLen = aURL.GetExtension().getLength();
- sNewName = sNewName.replaceAt( sNewName.getLength() - nExtLen - 1, nExtLen + 1, "" );
- if (pPrefix)
- sNewName = *pPrefix + sNewName;
+ switch (type) {
+ case DBCONN_UNKNOWN:
+ case DBCONN_CALC:
+ break;
+ case DBCONN_ODB:
+ bStore = false;
+ break;
+ case DBCONN_FLAT:
+ case DBCONN_DBASE:
+ //set the filter to the file name without extension
+ aFilters[0] = aURL.getBase();
+ aTableFilterAny <<= aFilters;
+ break;
+ case DBCONN_MSJET:
+ case DBCONN_MSACE:
+ aSuppressVersionsAny <<= makeAny(true);
+ break;
+ }
- //find a unique name if sNewName already exists
+ try
+ {
+ Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+
+ OUString sNewName = INetURLObject::decode( aURL.getName(),
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ sal_Int32 nExtLen = aURL.GetExtension().getLength();
+ sNewName = sNewName.replaceAt( sNewName.getLength() - nExtLen - 1, nExtLen + 1, "" );
+ if (pPrefix)
+ sNewName = *pPrefix + sNewName;
+
+ //find a unique name if sNewName already exists
+ sFind = sNewName;
+ sal_Int32 nIndex = 0;
+ while(xDBContext->hasByName(sFind))
+ {
sFind = sNewName;
- sal_Int32 nIndex = 0;
- while(xDBContext->hasByName(sFind))
- {
- sFind = sNewName;
- sFind += OUString::number(++nIndex);
- }
+ sFind += OUString::number(++nIndex);
+ }
- Reference<XInterface> xNewInstance;
- if(!bStore)
+ Reference<XInterface> xNewInstance;
+ if(!bStore)
+ {
+ //odb-file
+ Any aDataSource = xDBContext->getByName(aURL.GetMainURL(INetURLObject::NO_DECODE));
+ aDataSource >>= xNewInstance;
+ }
+ else
+ {
+ xNewInstance = xDBContext->createInstance();
+ Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
+
+ if(aURLAny.hasValue())
+ xDataProperties->setPropertyValue("URL", aURLAny);
+ if(aTableFilterAny.hasValue())
+ xDataProperties->setPropertyValue("TableFilter", aTableFilterAny);
+ if(aSuppressVersionsAny.hasValue())
+ xDataProperties->setPropertyValue("SuppressVersionColumns", aSuppressVersionsAny);
+ if(aInfoAny.hasValue())
+ xDataProperties->setPropertyValue("Info", aInfoAny);
+
+ if( DBCONN_FLAT == type && pSettings )
{
- //odb-file
- Any aDataSource = xDBContext->getByName(aURL.GetMainURL(INetURLObject::NO_DECODE));
- aDataSource >>= xNewInstance;
+ uno::Any aSettings = xDataProperties->getPropertyValue( "Settings" );
+ uno::Reference < beans::XPropertySet > xDSSettings;
+ aSettings >>= xDSSettings;
+ ::comphelper::copyProperties( *pSettings, xDSSettings );
+ xDSSettings->setPropertyValue( "Extension", uno::makeAny( sExt ));
}
- else
- {
- xNewInstance = xDBContext->createInstance();
- Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
-
- if(aURLAny.hasValue())
- xDataProperties->setPropertyValue("URL", aURLAny);
- if(aTableFilterAny.hasValue())
- xDataProperties->setPropertyValue("TableFilter", aTableFilterAny);
- if(aSuppressVersionsAny.hasValue())
- xDataProperties->setPropertyValue("SuppressVersionColumns", aSuppressVersionsAny);
- if(aInfoAny.hasValue())
- xDataProperties->setPropertyValue("Info", aInfoAny);
-
- if( DBCONN_FLAT == type && pSettings )
- {
- uno::Any aSettings = xDataProperties->getPropertyValue( "Settings" );
- uno::Reference < beans::XPropertySet > xDSSettings;
- aSettings >>= xDSSettings;
- ::comphelper::copyProperties( *pSettings, xDSSettings );
- xDSSettings->setPropertyValue( "Extension", uno::makeAny( sExt ));
- }
- Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
- Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
- OUString sOutputExt = ".odb";
- OUString sTmpName;
- {
- OUString sHomePath(SvtPathOptions().GetWorkPath());
- utl::TempFile aTempFile(sNewName, true, &sOutputExt, pDestDir ? pDestDir : &sHomePath);
- aTempFile.EnableKillingFile(true);
- sTmpName = aTempFile.GetURL();
- }
- xStore->storeAsURL(sTmpName, Sequence< PropertyValue >());
+ Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
+ Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
+ OUString sOutputExt = ".odb";
+ OUString sTmpName;
+ {
+ OUString sHomePath(SvtPathOptions().GetWorkPath());
+ utl::TempFile aTempFile(sNewName, true, &sOutputExt, pDestDir ? pDestDir : &sHomePath);
+ aTempFile.EnableKillingFile(true);
+ sTmpName = aTempFile.GetURL();
}
- xDBContext->registerObject( sFind, xNewInstance );
- }
- catch(const Exception&)
- {
- sFind.clear();
+ xStore->storeAsURL(sTmpName, Sequence< PropertyValue >());
}
+ xDBContext->registerObject( sFind, xNewInstance );
+ }
+ catch(const Exception&)
+ {
+ sFind.clear();
+ }
return sFind;
}