summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Repository.mk1
-rw-r--r--connectivity/Configuration_writer.mk20
-rw-r--r--connectivity/Library_calc.mk4
-rw-r--r--connectivity/Library_file.mk4
-rw-r--r--connectivity/Library_writer.mk49
-rw-r--r--connectivity/Module_connectivity.mk2
-rw-r--r--connectivity/registry/writer/org/openoffice/Office/DataAccess/Drivers.xcu44
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx8
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx4
-rw-r--r--connectivity/source/drivers/component/CColumns.cxx (renamed from connectivity/source/drivers/calc/CColumns.cxx)11
-rw-r--r--connectivity/source/drivers/component/CPreparedStatement.cxx (renamed from connectivity/source/drivers/calc/CPreparedStatement.cxx)12
-rw-r--r--connectivity/source/drivers/component/CResultSet.cxx (renamed from connectivity/source/drivers/calc/CResultSet.cxx)56
-rw-r--r--connectivity/source/drivers/component/CStatement.cxx (renamed from connectivity/source/drivers/calc/CStatement.cxx)12
-rw-r--r--connectivity/source/drivers/writer/WCatalog.cxx63
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx257
-rw-r--r--connectivity/source/drivers/writer/WDatabaseMetaData.cxx325
-rw-r--r--connectivity/source/drivers/writer/WDriver.cxx90
-rw-r--r--connectivity/source/drivers/writer/WTable.cxx420
-rw-r--r--connectivity/source/drivers/writer/WTables.cxx50
-rw-r--r--connectivity/source/drivers/writer/Wservices.cxx102
-rw-r--r--connectivity/source/drivers/writer/writer.component17
-rw-r--r--connectivity/source/inc/component/CColumns.hxx (renamed from connectivity/source/inc/calc/CColumns.hxx)13
-rw-r--r--connectivity/source/inc/component/CPreparedStatement.hxx (renamed from connectivity/source/inc/calc/CPreparedStatement.hxx)13
-rw-r--r--connectivity/source/inc/component/CResultSet.hxx (renamed from connectivity/source/inc/calc/CResultSet.hxx)25
-rw-r--r--connectivity/source/inc/component/CStatement.hxx (renamed from connectivity/source/inc/calc/CStatement.hxx)13
-rw-r--r--connectivity/source/inc/writer/WCatalog.hxx45
-rw-r--r--connectivity/source/inc/writer/WConnection.hxx170
-rw-r--r--connectivity/source/inc/writer/WDatabaseMetaData.hxx52
-rw-r--r--connectivity/source/inc/writer/WDriver.hxx58
-rw-r--r--connectivity/source/inc/writer/WTable.hxx116
-rw-r--r--connectivity/source/inc/writer/WTables.hxx45
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc1
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx4
-rw-r--r--dbaccess/source/inc/dsntypes.hxx3
-rw-r--r--dbaccess/source/ui/dlg/AutoControls.src5
-rw-r--r--dbaccess/source/ui/dlg/ConnectionHelper.cxx13
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx4
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx2
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx2
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx1
-rw-r--r--dbaccess/source/ui/dlg/dbadminsetup.src4
-rw-r--r--dbaccess/source/ui/dlg/dbwiz.cxx1
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx10
-rw-r--r--dbaccess/source/ui/inc/dbu_dlg.hrc4
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx2
-rw-r--r--include/sal/log-areas.dox1
-rw-r--r--postprocess/CustomTarget_registry.mk6
-rw-r--r--postprocess/Rdb_services.mk1
-rw-r--r--sw/CppunitTest_sw_mailmerge.mk1
-rw-r--r--sw/inc/dbmgr.hxx3
-rw-r--r--sw/inc/dbui.hrc2
-rw-r--r--sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odtbin0 -> 12849 bytes
-rw-r--r--sw/qa/extras/mailmerge/data/writer-mail-merge.odtbin0 -> 8410 bytes
-rw-r--r--sw/qa/extras/mailmerge/mailmerge.cxx14
-rw-r--r--sw/source/ui/dbui/dbui.src10
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx19
56 files changed, 2108 insertions, 106 deletions
diff --git a/Repository.mk b/Repository.mk
index 6eade9020edd..3635ccfadada 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -480,6 +480,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,writer, \
$(call gb_Helper_optional,SCRIPTING,vbaswobj) \
wpftwriter \
writerfilter \
+ $(call gb_Helper_optional,DBCONNECTIVITY,writer) \
))
# cli_cppuhelper is NONE even though it is actually in URE because it is CliNativeLibrary
diff --git a/connectivity/Configuration_writer.mk b/connectivity/Configuration_writer.mk
new file mode 100644
index 000000000000..c14030b11cc5
--- /dev/null
+++ b/connectivity/Configuration_writer.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Configuration_Configuration,driver_writer))
+
+$(eval $(call gb_Configuration_add_spool_modules,driver_writer,connectivity/registry/writer,\
+ org/openoffice/Office/DataAccess/Drivers-writer.xcu \
+))
+
+$(eval $(call gb_Configuration_add_localized_datas,driver_writer,connectivity/registry/writer,\
+ org/openoffice/Office/DataAccess/Drivers.xcu \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk
index a2b355813412..0c0d2ad4bc0c 100644
--- a/connectivity/Library_calc.mk
+++ b/connectivity/Library_calc.mk
@@ -40,12 +40,8 @@ $(eval $(call gb_Library_use_libraries,calc,\
))
$(eval $(call gb_Library_add_exception_objects,calc,\
- connectivity/source/drivers/calc/CResultSet \
- connectivity/source/drivers/calc/CStatement \
- connectivity/source/drivers/calc/CPreparedStatement \
connectivity/source/drivers/calc/CDatabaseMetaData \
connectivity/source/drivers/calc/CCatalog \
- connectivity/source/drivers/calc/CColumns \
connectivity/source/drivers/calc/CTable \
connectivity/source/drivers/calc/CTables \
connectivity/source/drivers/calc/CConnection \
diff --git a/connectivity/Library_file.mk b/connectivity/Library_file.mk
index 765b13bf9998..ba07f5031909 100644
--- a/connectivity/Library_file.mk
+++ b/connectivity/Library_file.mk
@@ -42,6 +42,10 @@ $(eval $(call gb_Library_use_libraries,file,\
))
$(eval $(call gb_Library_add_exception_objects,file,\
+ connectivity/source/drivers/component/CColumns \
+ connectivity/source/drivers/component/CPreparedStatement \
+ connectivity/source/drivers/component/CResultSet \
+ connectivity/source/drivers/component/CStatement \
connectivity/source/drivers/file/FCatalog \
connectivity/source/drivers/file/FColumns \
connectivity/source/drivers/file/FConnection \
diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk
new file mode 100644
index 000000000000..d07f572a3227
--- /dev/null
+++ b/connectivity/Library_writer.mk
@@ -0,0 +1,49 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,writer))
+
+$(eval $(call gb_Library_set_componentfile,writer,connectivity/source/drivers/writer/writer))
+
+$(eval $(call gb_Library_use_external,writer,boost_headers))
+
+$(eval $(call gb_Library_use_sdk_api,writer))
+
+$(eval $(call gb_Library_set_include,writer,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/connectivity/inc \
+ -I$(SRCDIR)/connectivity/source/inc \
+ -I$(WORKDIR)/YaccTarget/connectivity/source/parse \
+))
+
+$(eval $(call gb_Library_use_libraries,writer,\
+ cppu \
+ cppuhelper \
+ svl \
+ tl \
+ utl \
+ sal \
+ salhelper \
+ dbtools \
+ file \
+ comphelper \
+))
+
+$(eval $(call gb_Library_add_exception_objects,writer,\
+ connectivity/source/drivers/writer/WCatalog \
+ connectivity/source/drivers/writer/WConnection \
+ connectivity/source/drivers/writer/WDatabaseMetaData \
+ connectivity/source/drivers/writer/WDriver \
+ connectivity/source/drivers/writer/WTable \
+ connectivity/source/drivers/writer/WTables \
+ connectivity/source/drivers/writer/Wservices \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk
index aee317867501..c9275b0f6883 100644
--- a/connectivity/Module_connectivity.mk
+++ b/connectivity/Module_connectivity.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Configuration_flat \
Configuration_mysql \
Configuration_odbc \
+ Configuration_writer \
Library_calc \
Library_dbase \
Library_dbpool2 \
@@ -25,6 +26,7 @@ $(eval $(call gb_Module_add_targets,connectivity,\
Library_mysql \
$(if $(filter ANDROID IOS,$(OS)),,Library_odbc) \
Library_sdbc2 \
+ Library_writer \
))
$(eval $(call gb_Module_add_l10n_targets,connectivity,\
diff --git a/connectivity/registry/writer/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/writer/org/openoffice/Office/DataAccess/Drivers.xcu
new file mode 100644
index 000000000000..69ed08e1c63d
--- /dev/null
+++ b/connectivity/registry/writer/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed" install:module="writer">
+ <node oor:name="sdbc:writer:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.writer.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Writer Document</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/vnd.oasis.opendocument.text</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index a315bc6b7c45..75746504ef97 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -28,8 +28,8 @@
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <tools/urlobj.hxx>
-#include "calc/CPreparedStatement.hxx"
-#include "calc/CStatement.hxx"
+#include "component/CPreparedStatement.hxx"
+#include "component/CStatement.hxx"
#include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -239,7 +239,7 @@ Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) throw(SQLE
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- Reference< XStatement > xReturn = new OCalcStatement(this);
+ Reference< XStatement > xReturn = new connectivity::component::OComponentStatement(this);
m_aStatements.push_back(WeakReferenceHelper(xReturn));
return xReturn;
}
@@ -252,7 +252,7 @@ Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( cons
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OCalcPreparedStatement* pStmt = new OCalcPreparedStatement(this);
+ auto pStmt = new connectivity::component::OComponentPreparedStatement(this);
Reference< XPreparedStatement > xHoldAlive = pStmt;
pStmt->construct(sql);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index cae94275f944..5b73750b9af0 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -36,7 +36,7 @@
#include <com/sun/star/text/XText.hpp>
#include <svl/converter.hxx>
#include "calc/CConnection.hxx"
-#include "calc/CColumns.hxx"
+#include "component/CColumns.hxx"
#include <connectivity/sdbcx/VColumn.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/thread.h>
@@ -622,7 +622,7 @@ void OCalcTable::refreshColumns()
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns = new OCalcColumns(this,m_aMutex,aVector);
+ m_pColumns = new component::OComponentColumns(this,m_aMutex,aVector);
}
void OCalcTable::refreshIndexes()
diff --git a/connectivity/source/drivers/calc/CColumns.cxx b/connectivity/source/drivers/component/CColumns.cxx
index 3cd002cd3681..68dcba53d9f4 100644
--- a/connectivity/source/drivers/calc/CColumns.cxx
+++ b/connectivity/source/drivers/component/CColumns.cxx
@@ -17,11 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "calc/CColumns.hxx"
-#include "calc/CTable.hxx"
+#include "component/CColumns.hxx"
+#include "file/FTable.hxx"
#include <connectivity/sdbcx/VColumn.hxx>
-using namespace connectivity::calc;
+using namespace connectivity::component;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -30,10 +30,9 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-sdbcx::ObjectType OCalcColumns::createObject(const OUString& _rName)
+sdbcx::ObjectType OComponentColumns::createObject(const OUString& _rName)
{
- OCalcTable* pTable = static_cast<OCalcTable*>(m_pTable);
- ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns();
+ ::rtl::Reference<OSQLColumns> aCols = m_pTable->getTableColumns();
OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive()));
sdbcx::ObjectType xRet;
diff --git a/connectivity/source/drivers/calc/CPreparedStatement.cxx b/connectivity/source/drivers/component/CPreparedStatement.cxx
index 96eb9a2672a8..a2b1161fb7cb 100644
--- a/connectivity/source/drivers/calc/CPreparedStatement.cxx
+++ b/connectivity/source/drivers/component/CPreparedStatement.cxx
@@ -17,18 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "calc/CPreparedStatement.hxx"
-#include "calc/CResultSet.hxx"
+#include "component/CPreparedStatement.hxx"
+#include "component/CResultSet.hxx"
-using namespace connectivity::calc;
+using namespace connectivity::component;
using namespace connectivity::file;
using namespace com::sun::star::uno;
-OResultSet* OCalcPreparedStatement::createResultSet()
+OResultSet* OComponentPreparedStatement::createResultSet()
{
- return new OCalcResultSet(this,m_aSQLIterator);
+ return new connectivity::component::OComponentResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OCalcPreparedStatement,"com.sun.star.sdbc.driver.calc.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OComponentPreparedStatement,"com.sun.star.sdbc.driver.component.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/component/CResultSet.cxx
index dc175865151e..989839d61437 100644
--- a/connectivity/source/drivers/calc/CResultSet.cxx
+++ b/connectivity/source/drivers/component/CResultSet.cxx
@@ -18,7 +18,7 @@
*/
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#include "calc/CResultSet.hxx"
+#include "component/CResultSet.hxx"
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
@@ -26,7 +26,7 @@
#include <connectivity/dbexception.hxx>
using namespace ::comphelper;
-using namespace connectivity::calc;
+using namespace connectivity::component;
using namespace connectivity::file;
using namespace ::cppu;
using namespace com::sun::star::uno;
@@ -36,19 +36,19 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
-OCalcResultSet::OCalcResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
+OComponentResultSet::OComponentResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
: file::OResultSet(pStmt,_aSQLIterator)
,m_bBookmarkable(true)
{
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, cppu::UnoType<bool>::get());
}
-OUString SAL_CALL OCalcResultSet::getImplementationName( ) throw ( RuntimeException, std::exception)
+OUString SAL_CALL OComponentResultSet::getImplementationName( ) throw ( RuntimeException, std::exception)
{
- return OUString("com.sun.star.sdbcx.calc.ResultSet");
+ return OUString("com.sun.star.sdbcx.component.ResultSet");
}
-Sequence< OUString > SAL_CALL OCalcResultSet::getSupportedServiceNames( ) throw( RuntimeException, std::exception)
+Sequence< OUString > SAL_CALL OComponentResultSet::getSupportedServiceNames( ) throw( RuntimeException, std::exception)
{
Sequence< OUString > aSupported(2);
aSupported[0] = "com.sun.star.sdbc.ResultSet";
@@ -56,25 +56,25 @@ Sequence< OUString > SAL_CALL OCalcResultSet::getSupportedServiceNames( ) throw
return aSupported;
}
-sal_Bool SAL_CALL OCalcResultSet::supportsService( const OUString& _rServiceName ) throw( RuntimeException, std::exception)
+sal_Bool SAL_CALL OComponentResultSet::supportsService( const OUString& _rServiceName ) throw( RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
-Any SAL_CALL OCalcResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
+Any SAL_CALL OComponentResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
{
Any aRet = OResultSet::queryInterface(rType);
- return aRet.hasValue() ? aRet : OCalcResultSet_BASE::queryInterface(rType);
+ return aRet.hasValue() ? aRet : OComponentResultSet_BASE::queryInterface(rType);
}
- Sequence< Type > SAL_CALL OCalcResultSet::getTypes( ) throw( RuntimeException, std::exception)
+ Sequence< Type > SAL_CALL OComponentResultSet::getTypes( ) throw( RuntimeException, std::exception)
{
- return ::comphelper::concatSequences(OResultSet::getTypes(),OCalcResultSet_BASE::getTypes());
+ return ::comphelper::concatSequences(OResultSet::getTypes(),OComponentResultSet_BASE::getTypes());
}
// XRowLocate
-Any SAL_CALL OCalcResultSet::getBookmark( ) throw( SQLException, RuntimeException, std::exception)
+Any SAL_CALL OComponentResultSet::getBookmark( ) throw( SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
@@ -83,7 +83,7 @@ Any SAL_CALL OCalcResultSet::getBookmark( ) throw( SQLException, RuntimeExcept
return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
}
-sal_Bool SAL_CALL OCalcResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException, std::exception)
+sal_Bool SAL_CALL OComponentResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
@@ -94,7 +94,7 @@ sal_Bool SAL_CALL OCalcResultSet::moveToBookmark( const Any& bookmark ) throw(
return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),true);
}
-sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException, std::exception)
+sal_Bool SAL_CALL OComponentResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
@@ -108,17 +108,17 @@ sal_Bool SAL_CALL OCalcResultSet::moveRelativeToBookmark( const Any& bookmark,
}
-sal_Int32 SAL_CALL OCalcResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception)
+sal_Int32 SAL_CALL OComponentResultSet::compareBookmarks( const Any& lhs, const Any& rhs ) throw( SQLException, RuntimeException, std::exception)
{
return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
}
-sal_Bool SAL_CALL OCalcResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception)
+sal_Bool SAL_CALL OComponentResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException, std::exception)
{
return true;
}
-sal_Int32 SAL_CALL OCalcResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException, std::exception)
+sal_Int32 SAL_CALL OComponentResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
@@ -128,7 +128,7 @@ sal_Int32 SAL_CALL OCalcResultSet::hashBookmark( const Any& bookmark ) throw( S
}
// XDeleteRows
-Sequence< sal_Int32 > SAL_CALL OCalcResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw( SQLException, RuntimeException, std::exception)
+Sequence< sal_Int32 > SAL_CALL OComponentResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw( SQLException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
@@ -137,18 +137,18 @@ Sequence< sal_Int32 > SAL_CALL OCalcResultSet::deleteRows( const Sequence< Any
return Sequence< sal_Int32 >();
}
-bool OCalcResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
+bool OComponentResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
{
- // Calc table has no index
+ // Writer or Calc table has no index
return false;
}
-::cppu::IPropertyArrayHelper & OCalcResultSet::getInfoHelper()
+::cppu::IPropertyArrayHelper & OComponentResultSet::getInfoHelper()
{
- return *OCalcResultSet_BASE3::getArrayHelper();
+ return *OComponentResultSet_BASE3::getArrayHelper();
}
-::cppu::IPropertyArrayHelper* OCalcResultSet::createArrayHelper() const
+::cppu::IPropertyArrayHelper* OComponentResultSet::createArrayHelper() const
{
Sequence< Property > aProps;
describeProperties(aProps);
@@ -156,17 +156,17 @@ bool OCalcResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xInd
}
-void SAL_CALL OCalcResultSet::acquire() throw()
+void SAL_CALL OComponentResultSet::acquire() throw()
{
- OCalcResultSet_BASE2::acquire();
+ OComponentResultSet_BASE2::acquire();
}
-void SAL_CALL OCalcResultSet::release() throw()
+void SAL_CALL OComponentResultSet::release() throw()
{
- OCalcResultSet_BASE2::release();
+ OComponentResultSet_BASE2::release();
}
-css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OCalcResultSet::getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception)
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OComponentResultSet::getPropertySetInfo( ) throw(css::uno::RuntimeException, std::exception)
{
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
diff --git a/connectivity/source/drivers/calc/CStatement.cxx b/connectivity/source/drivers/component/CStatement.cxx
index 15d4e45a04b8..a83ff8587e20 100644
--- a/connectivity/source/drivers/calc/CStatement.cxx
+++ b/connectivity/source/drivers/component/CStatement.cxx
@@ -17,18 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "calc/CStatement.hxx"
-#include "calc/CResultSet.hxx"
+#include "component/CStatement.hxx"
+#include "component/CResultSet.hxx"
-using namespace connectivity::calc;
+using namespace connectivity::component;
using namespace connectivity::file;
using namespace com::sun::star::uno;
-OResultSet* OCalcStatement::createResultSet()
+OResultSet* OComponentStatement::createResultSet()
{
- return new OCalcResultSet(this,m_aSQLIterator);
+ return new connectivity::component::OComponentResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OCalcStatement,"com.sun.star.sdbc.driver.calc.Statement","com.sun.star.sdbc.Statement");
+IMPLEMENT_SERVICE_INFO(OComponentStatement,"com.sun.star.sdbc.driver.component.Statement","com.sun.star.sdbc.Statement");
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WCatalog.cxx b/connectivity/source/drivers/writer/WCatalog.cxx
new file mode 100644
index 000000000000..0cf4a1626e40
--- /dev/null
+++ b/connectivity/source/drivers/writer/WCatalog.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WCatalog.hxx"
+#include "writer/WTables.hxx"
+
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+
+#include <connectivity/sdbcx/VCollection.hxx>
+
+#include "writer/WConnection.hxx"
+
+using namespace ::com::sun::star;
+
+namespace connectivity
+{
+namespace writer
+{
+
+OWriterCatalog::OWriterCatalog(OWriterConnection* pConnection) : file::OFileCatalog(pConnection)
+{
+}
+
+void OWriterCatalog::refreshTables()
+{
+ TStringVector aVector;
+ uno::Sequence<OUString> aTypes;
+ OWriterConnection::ODocHolder aDocHolder(static_cast<OWriterConnection*>(m_pConnection));
+ uno::Reference< sdbc::XResultSet > xResult = m_xMetaData->getTables(uno::Any(), "%", "%", aTypes);
+
+ if (xResult.is())
+ {
+ uno::Reference< sdbc::XRow > xRow(xResult, uno::UNO_QUERY);
+ while (xResult->next())
+ aVector.push_back(xRow->getString(3));
+ }
+ if (m_pTables)
+ m_pTables->reFill(aVector);
+ else
+ m_pTables = new OWriterTables(m_xMetaData, *this, m_aMutex, aVector);
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
new file mode 100644
index 000000000000..8b46b949965c
--- /dev/null
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WConnection.hxx"
+#include "writer/WDatabaseMetaData.hxx"
+#include "writer/WCatalog.hxx"
+#include "writer/WDriver.hxx"
+#include "resource/sharedresources.hxx"
+#include "resource/common_res.hrc"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <tools/urlobj.hxx>
+#include "component/CPreparedStatement.hxx"
+#include "component/CStatement.hxx"
+#include <unotools/pathoptions.hxx>
+#include <connectivity/dbexception.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/processfactory.hxx>
+
+typedef connectivity::file::OConnection OConnection_BASE;
+
+using namespace ::com::sun::star;
+
+namespace connectivity
+{
+namespace writer
+{
+
+OWriterConnection::OWriterConnection(ODriver* _pDriver) : OConnection(_pDriver),m_nDocCount(0)
+{
+ // m_aFilenameExtension is not used
+}
+
+OWriterConnection::~OWriterConnection()
+{
+}
+
+void OWriterConnection::construct(const OUString& url,const uno::Sequence< beans::PropertyValue >& info) throw(sdbc::SQLException, uno::RuntimeException, uno::DeploymentException, std::exception)
+{
+ // open file
+
+ sal_Int32 nLen = url.indexOf(':');
+ nLen = url.indexOf(':',nLen+1);
+ OUString aDSN(url.copy(nLen+1));
+
+ m_aFileName = aDSN;
+ INetURLObject aURL;
+ aURL.SetSmartProtocol(INetProtocol::File);
+ {
+ SvtPathOptions aPathOptions;
+ m_aFileName = aPathOptions.SubstituteVariable(m_aFileName);
+ }
+ aURL.SetSmartURL(m_aFileName);
+ if (aURL.GetProtocol() == INetProtocol::NotValid)
+ {
+ // don't pass invalid URL to loadComponentFromURL
+ throw sdbc::SQLException();
+ }
+ m_aFileName = aURL.GetMainURL(INetURLObject::NO_DECODE);
+
+ m_sPassword.clear();
+ const char pPwd[] = "password";
+
+ const beans::PropertyValue* pIter = info.getConstArray();
+ const beans::PropertyValue* pEnd = pIter + info.getLength();
+ for (; pIter != pEnd; ++pIter)
+ {
+ if (pIter->Name == pPwd)
+ {
+ pIter->Value >>= m_sPassword;
+ break;
+ }
+ } // for(;pIter != pEnd;++pIter)
+ ODocHolder aDocHolder(this); // just to test that the doc can be loaded
+ acquireDoc();
+}
+
+uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc()
+{
+ if (m_xDoc.is())
+ {
+ osl_atomic_increment(&m_nDocCount);
+ return m_xDoc;
+ }
+ // open read-only as long as updating isn't implemented
+ uno::Sequence<beans::PropertyValue> aArgs(2);
+ aArgs[0].Name = "Hidden";
+ aArgs[0].Value <<= true;
+ aArgs[1].Name = "ReadOnly";
+ aArgs[1].Value <<= true;
+
+ if (!m_sPassword.isEmpty())
+ {
+ const sal_Int32 nPos = aArgs.getLength();
+ aArgs.realloc(nPos+1);
+ aArgs[nPos].Name = "Password";
+ aArgs[nPos].Value <<= m_sPassword;
+ }
+
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(getDriver()->getComponentContext());
+ uno::Reference< lang::XComponent > xComponent;
+ uno::Any aLoaderException;
+ try
+ {
+ xComponent = xDesktop->loadComponentFromURL(
+ m_aFileName, "_blank", 0, aArgs);
+ }
+ catch (const uno::Exception&)
+ {
+ aLoaderException = ::cppu::getCaughtException();
+ }
+
+ m_xDoc.set(xComponent, uno::UNO_QUERY);
+
+ // if the URL is not a text document, throw the exception here
+ // instead of at the first access to it
+ if (!m_xDoc.is())
+ {
+ if (aLoaderException.hasValue())
+ {
+ uno::Exception aLoaderError;
+ OSL_VERIFY(aLoaderException >>= aLoaderError);
+
+ SAL_WARN("connectivity.writer", "empty m_xDoc, exception type: " << aLoaderException.getValueTypeName() << ", error message: " << aLoaderError.Message);
+ }
+
+ const OUString sError(m_aResources.getResourceStringWithSubstitution(
+ STR_COULD_NOT_LOAD_FILE,
+ "$filename$", m_aFileName
+ ));
+ ::dbtools::throwGenericSQLException(sError, *this);
+ }
+ osl_atomic_increment(&m_nDocCount);
+ m_xCloseVetoButTerminateListener.set(new CloseVetoButTerminateListener);
+ m_xCloseVetoButTerminateListener->start(m_xDoc, xDesktop);
+ return m_xDoc;
+}
+
+void OWriterConnection::releaseDoc()
+{
+ if (osl_atomic_decrement(&m_nDocCount) == 0)
+ {
+ if (m_xCloseVetoButTerminateListener.is())
+ {
+ m_xCloseVetoButTerminateListener->stop(); // dispose m_xDoc
+ m_xCloseVetoButTerminateListener.clear();
+ }
+ m_xDoc.clear();
+ }
+}
+
+void OWriterConnection::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_nDocCount = 0;
+ if (m_xCloseVetoButTerminateListener.is())
+ {
+ m_xCloseVetoButTerminateListener->stop(); // dispose m_xDoc
+ m_xCloseVetoButTerminateListener.clear();
+ }
+ m_xDoc.clear();
+
+ OConnection::disposing();
+}
+
+// XServiceInfo
+
+
+IMPLEMENT_SERVICE_INFO(OWriterConnection, "com.sun.star.sdbc.drivers.writer.Connection", "com.sun.star.sdbc.Connection")
+
+
+uno::Reference< sdbc::XDatabaseMetaData > SAL_CALL OWriterConnection::getMetaData() throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+
+ uno::Reference< sdbc::XDatabaseMetaData > xMetaData = m_xMetaData;
+ if (!xMetaData.is())
+ {
+ xMetaData = new OWriterDatabaseMetaData(this);
+ m_xMetaData = xMetaData;
+ }
+
+ return xMetaData;
+}
+
+
+css::uno::Reference< css::sdbcx::XTablesSupplier > OWriterConnection::createCatalog()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< css::sdbcx::XTablesSupplier > xTab = m_xCatalog;
+ if (!xTab.is())
+ {
+ OWriterCatalog* pCat = new OWriterCatalog(this);
+ xTab = pCat;
+ m_xCatalog = xTab;
+ }
+ return xTab;
+}
+
+
+uno::Reference< sdbc::XStatement > SAL_CALL OWriterConnection::createStatement() throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this);
+ m_aStatements.push_back(uno::WeakReferenceHelper(xReturn));
+ return xReturn;
+}
+
+
+uno::Reference< sdbc::XPreparedStatement > SAL_CALL OWriterConnection::prepareStatement(const OUString& sql) throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ auto pStmt = new component::OComponentPreparedStatement(this);
+ uno::Reference<sdbc::XPreparedStatement> xHoldAlive = pStmt;
+ pStmt->construct(sql);
+ m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt));
+ return pStmt;
+}
+
+
+uno::Reference< sdbc::XPreparedStatement > SAL_CALL OWriterConnection::prepareCall(const OUString& /*sql*/) throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwFeatureNotImplementedSQLException("XConnection::prepareCall", *this);
+ return nullptr;
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WDatabaseMetaData.cxx b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
new file mode 100644
index 000000000000..730b085cb110
--- /dev/null
+++ b/connectivity/source/drivers/writer/WDatabaseMetaData.cxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WDatabaseMetaData.hxx"
+#include "writer/WConnection.hxx"
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include "FDatabaseMetaDataResultSet.hxx"
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/types.hxx>
+
+using namespace connectivity::file;
+using namespace ::com::sun::star;
+
+namespace connectivity
+{
+namespace writer
+{
+
+OWriterDatabaseMetaData::OWriterDatabaseMetaData(OConnection* pConnection) :ODatabaseMetaData(pConnection)
+{
+}
+
+OWriterDatabaseMetaData::~OWriterDatabaseMetaData()
+{
+}
+
+uno::Reference<sdbc::XResultSet> OWriterDatabaseMetaData::impl_getTypeInfo_throw()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
+ uno::Reference<sdbc::XResultSet> xRef = pResult;
+
+ static ODatabaseMetaDataResultSet::ORows aRows;
+ if (aRows.empty())
+ {
+ ODatabaseMetaDataResultSet::ORow aRow;
+
+ aRows.reserve(6);
+ aRow.reserve(18);
+
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR")));
+ aRow.push_back(new ORowSetValueDecorator(sdbc::DataType::VARCHAR));
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)65535));
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); // ORowSetValue((sal_Int32)ColumnValue::NULLABLE)
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)sdbc::ColumnSearch::CHAR));
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
+ aRow[2] = new ORowSetValueDecorator(sdbc::DataType::DECIMAL);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(OUString("BOOL"));
+ aRow[2] = new ORowSetValueDecorator(sdbc::DataType::BIT);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = new ORowSetValueDecorator((sal_Int32)15);
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
+ aRow[2] = new ORowSetValueDecorator(sdbc::DataType::DATE);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
+ aRow[2] = new ORowSetValueDecorator(sdbc::DataType::TIME);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
+ aRow[2] = new ORowSetValueDecorator(sdbc::DataType::TIMESTAMP);
+ aRow[3] = ODatabaseMetaDataResultSet::get0Value();
+ aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[15] = ODatabaseMetaDataResultSet::get0Value();
+ aRows.push_back(aRow);
+ }
+
+ pResult->setRows(aRows);
+ return xRef;
+}
+
+
+uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getColumns(
+ const uno::Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& tableNamePattern,
+ const OUString& columnNamePattern) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ uno::Reference<sdbcx::XTablesSupplier> xTables = m_pConnection->createCatalog();
+ if (!xTables.is())
+ throw sdbc::SQLException();
+
+ uno::Reference<container::XNameAccess> xNames = xTables->getTables();
+ if (!xNames.is())
+ throw sdbc::SQLException();
+
+ ODatabaseMetaDataResultSet::ORows aRows;
+ ODatabaseMetaDataResultSet::ORow aRow(19);
+
+ aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
+
+ uno::Sequence<OUString> aTabNames(xNames->getElementNames());
+ const OUString* pTabIter = aTabNames.getConstArray();
+ const OUString* pTabEnd = pTabIter + aTabNames.getLength();
+ for (; pTabIter != pTabEnd; ++pTabIter)
+ {
+ if (match(tableNamePattern,*pTabIter,'\0'))
+ {
+ uno::Reference<sdbcx::XColumnsSupplier> xTable(xNames->getByName(*pTabIter), uno::UNO_QUERY_THROW);
+ aRow[3] = new ORowSetValueDecorator(*pTabIter);
+
+ uno::Reference<container::XNameAccess> xColumns = xTable->getColumns();
+ if (!xColumns.is())
+ throw sdbc::SQLException();
+
+ uno::Sequence<OUString> aColNames(xColumns->getElementNames());
+
+ const OUString* pColumnIter = aColNames.getConstArray();
+ const OUString* pEnd = pColumnIter + aColNames.getLength();
+ uno::Reference<beans::XPropertySet> xColumn;
+ for (sal_Int32 i=1; pColumnIter != pEnd; ++pColumnIter,++i)
+ {
+ if (match(columnNamePattern,*pColumnIter,'\0'))
+ {
+ aRow[4] = new ORowSetValueDecorator(*pColumnIter);
+
+ xColumns->getByName(*pColumnIter) >>= xColumn;
+ OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
+ aRow[5] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
+ aRow[6] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
+ aRow[7] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
+ // aRow[8] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
+ aRow[9] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
+ aRow[11] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
+ // aRow[12] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
+ aRow[13] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
+ // aRow[14] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
+ // aRow[15] = xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
+ switch (sal_Int32(aRow[5]->getValue()))
+ {
+ case sdbc::DataType::CHAR:
+ case sdbc::DataType::VARCHAR:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
+ break;
+ case sdbc::DataType::LONGVARCHAR:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
+ break;
+ default:
+ aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
+ }
+ aRow[17] = new ORowSetValueDecorator(i);
+ switch (sal_Int32(aRow[11]->getValue()))
+ {
+ case sdbc::ColumnValue::NO_NULLS:
+ aRow[18] = new ORowSetValueDecorator(OUString("NO"));
+ break;
+ case sdbc::ColumnValue::NULLABLE:
+ aRow[18] = new ORowSetValueDecorator(OUString("YES"));
+ break;
+ default:
+ aRow[18] = new ORowSetValueDecorator(OUString());
+ }
+ aRows.push_back(aRow);
+ }
+ }
+ }
+ }
+
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
+ uno::Reference<sdbc::XResultSet> xRef = pResult;
+ pResult->setRows(aRows);
+
+ return xRef;
+}
+
+
+OUString SAL_CALL OWriterDatabaseMetaData::getURL() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ return "sdbc:writer:" + m_pConnection->getURL();
+}
+
+
+sal_Int32 SAL_CALL OWriterDatabaseMetaData::getMaxBinaryLiteralLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ return SAL_MAX_INT32;
+}
+
+
+sal_Int32 SAL_CALL OWriterDatabaseMetaData::getMaxCharLiteralLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ return SAL_MAX_INT32;
+}
+
+sal_Int32 SAL_CALL OWriterDatabaseMetaData::getMaxColumnNameLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ return SAL_MAX_INT32;
+}
+
+sal_Int32 SAL_CALL OWriterDatabaseMetaData::getMaxColumnsInIndex() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ return 1;
+}
+
+sal_Int32 SAL_CALL OWriterDatabaseMetaData::getMaxColumnsInTable() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ return 256;
+}
+
+uno::Reference<sdbc::XResultSet> SAL_CALL OWriterDatabaseMetaData::getTables(
+ const uno::Any& /*catalog*/, const OUString& /*schemaPattern*/,
+ const OUString& tableNamePattern, const uno::Sequence< OUString >& types) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
+ uno::Reference<sdbc::XResultSet> xRef = pResult;
+
+ // check if ORowSetValue type is given
+ // when no types are given then we have to return all tables e.g. TABLE
+
+ OUString aTable("TABLE");
+
+ bool bTableFound = true;
+ sal_Int32 nLength = types.getLength();
+ if (nLength)
+ {
+ bTableFound = false;
+
+ const OUString* pIter = types.getConstArray();
+ const OUString* pEnd = pIter + nLength;
+ for (; pIter != pEnd; ++pIter)
+ {
+ if (*pIter == aTable)
+ {
+ bTableFound = true;
+ break;
+ }
+ }
+ }
+ if (!bTableFound)
+ return xRef;
+
+ // get the table names from the document
+
+ OWriterConnection::ODocHolder aDocHolder(static_cast<OWriterConnection*>(m_pConnection));
+ uno::Reference<text::XTextTablesSupplier> xDoc(aDocHolder.getDoc(), uno::UNO_QUERY);
+ if (!xDoc.is())
+ throw sdbc::SQLException();
+ uno::Reference<container::XNameAccess> xTables = xDoc->getTextTables();
+ if (!xTables.is())
+ throw sdbc::SQLException();
+ uno::Sequence<OUString> aTableNames = xTables->getElementNames();
+
+ ODatabaseMetaDataResultSet::ORows aRows;
+ sal_Int32 nTableCount = aTableNames.getLength();
+ for (sal_Int32 nTable=0; nTable<nTableCount; nTable++)
+ {
+ OUString aName = aTableNames[nTable];
+ if (match(tableNamePattern,aName,'\0'))
+ {
+ ODatabaseMetaDataResultSet::ORow aRow { nullptr, nullptr, nullptr };
+ aRow.reserve(6);
+ aRow.push_back(new ORowSetValueDecorator(aName));
+ aRow.push_back(new ORowSetValueDecorator(aTable));
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRows.push_back(aRow);
+ }
+ }
+
+ pResult->setRows(aRows);
+
+ return xRef;
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx
new file mode 100644
index 000000000000..2e3d81be5a5b
--- /dev/null
+++ b/connectivity/source/drivers/writer/WDriver.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WDriver.hxx"
+#include "writer/WConnection.hxx"
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <connectivity/dbexception.hxx>
+#include "resource/sharedresources.hxx"
+#include "resource/common_res.hrc"
+#include <comphelper/processfactory.hxx>
+
+using namespace connectivity::file;
+using namespace ::com::sun::star;
+
+namespace connectivity
+{
+namespace writer
+{
+
+OUString ODriver::getImplementationName_Static() throw(uno::RuntimeException)
+{
+ return OUString("com.sun.star.comp.sdbc.writer.ODriver");
+}
+
+OUString SAL_CALL ODriver::getImplementationName() throw(uno::RuntimeException, std::exception)
+{
+ return getImplementationName_Static();
+}
+
+uno::Reference< css::uno::XInterface > SAL_CALL
+ODriver_CreateInstance(const uno::Reference<
+ lang::XMultiServiceFactory >& _rxFactory) throw( css::uno::Exception )
+{
+ return *(new ODriver(comphelper::getComponentContext(_rxFactory)));
+}
+
+uno::Reference< sdbc::XConnection > SAL_CALL ODriver::connect(const OUString& url,
+ const uno::Sequence< beans::PropertyValue >& info) throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (ODriver_BASE::rBHelper.bDisposed)
+ throw lang::DisposedException();
+
+ if (! acceptsURL(url))
+ return nullptr;
+
+ OWriterConnection* pCon = new OWriterConnection(this);
+ pCon->construct(url, info);
+ uno::Reference< sdbc::XConnection > xCon = pCon;
+ m_xConnections.push_back(uno::WeakReferenceHelper(*pCon));
+
+ return xCon;
+}
+
+sal_Bool SAL_CALL ODriver::acceptsURL(const OUString& url) throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ return url.startsWith("sdbc:writer:");
+}
+
+uno::Sequence< sdbc::DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo(const OUString& url, const uno::Sequence< beans::PropertyValue >& /*info*/) throw(sdbc::SQLException, uno::RuntimeException, std::exception)
+{
+ if (!acceptsURL(url))
+ {
+ SharedResources aResources;
+ const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
+ ::dbtools::throwGenericSQLException(sMessage,*this);
+ }
+ return uno::Sequence< sdbc::DriverPropertyInfo >();
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx
new file mode 100644
index 000000000000..b8facb1d14cf
--- /dev/null
+++ b/connectivity/source/drivers/writer/WTable.cxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WTable.hxx"
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <svl/converter.hxx>
+#include "writer/WConnection.hxx"
+#include "component/CColumns.hxx"
+#include <connectivity/sdbcx/VColumn.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/queryinterface.hxx>
+#include <comphelper/sequence.hxx>
+#include <svl/zforlist.hxx>
+#include <rtl/math.hxx>
+#include <comphelper/extract.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbconversion.hxx>
+#include <comphelper/types.hxx>
+#include <connectivity/StdTypeDefs.hxx>
+#include <connectivity/sdbcx/VCollection.hxx>
+
+using namespace ::com::sun::star;
+
+static void lcl_GetDataArea(const uno::Reference<text::XTextTable>& xTable, sal_Int32& rColumnCount, sal_Int32& rRowCount)
+{
+ uno::Reference<container::XIndexAccess> xColumns(xTable->getColumns(), uno::UNO_QUERY);
+ if (xColumns.is())
+ rColumnCount = xColumns->getCount();
+
+ uno::Reference<container::XIndexAccess> xRows(xTable->getRows(), uno::UNO_QUERY);
+ if (xRows.is())
+ rRowCount = xRows->getCount() - 1; // first row (headers) is not counted
+
+}
+
+static void lcl_GetColumnInfo(const uno::Reference<text::XTextTable>& xTable,
+ sal_Int32 nDocColumn, sal_Int32 nStartRow, bool bHasHeaders,
+ OUString& rName, sal_Int32& rDataType, bool& rCurrency)
+{
+ uno::Reference<table::XCellRange> xCellRange(xTable, uno::UNO_QUERY);
+ // get column name from first row, if range contains headers
+ if (bHasHeaders)
+ {
+ uno::Reference<text::XText> xHeaderText(xCellRange->getCellByPosition(nDocColumn, nStartRow), uno::UNO_QUERY);
+ if (xHeaderText.is())
+ rName = xHeaderText->getString();
+ }
+
+ rCurrency = false;
+ rDataType = sdbc::DataType::VARCHAR;
+}
+
+
+static void lcl_SetValue(connectivity::ORowSetValue& rValue, const uno::Reference<text::XTextTable>& xTable,
+ sal_Int32 nStartCol, sal_Int32 nStartRow, bool bHasHeaders,
+ sal_Int32 nDBRow, sal_Int32 nDBColumn)
+{
+ sal_Int32 nDocColumn = nStartCol + nDBColumn - 1; // database counts from 1
+ sal_Int32 nDocRow = nStartRow + nDBRow - 1;
+ if (bHasHeaders)
+ ++nDocRow;
+
+ uno::Reference<table::XCellRange> xCellRange(xTable, uno::UNO_QUERY);
+ const uno::Reference<table::XCell> xCell = xCellRange->getCellByPosition(nDocColumn, nDocRow);
+ if (xCell.is())
+ {
+ const uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY);
+ if (xText.is())
+ rValue = xText->getString();
+ }
+}
+
+namespace connectivity
+{
+namespace writer
+{
+
+void OWriterTable::fillColumns()
+{
+ if (!m_xTable.is())
+ throw sdbc::SQLException();
+
+ OUString aTypeName;
+ ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers());
+ const bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
+
+ for (sal_Int32 i = 0; i < m_nDataCols; i++)
+ {
+ OUString aColumnName;
+ sal_Int32 eType = sdbc::DataType::OTHER;
+ bool bCurrency = false;
+
+ lcl_GetColumnInfo(m_xTable, m_nStartCol + i, m_nStartRow, m_bHasHeaders,
+ aColumnName, eType, bCurrency);
+
+ sal_Int32 nPrecision = 0; //! ...
+ sal_Int32 nDecimals = 0; //! ...
+
+ switch (eType)
+ {
+ case sdbc::DataType::VARCHAR:
+ aTypeName = "VARCHAR";
+ break;
+ case sdbc::DataType::DECIMAL:
+ aTypeName = "DECIMAL";
+ break;
+ case sdbc::DataType::BIT:
+ aTypeName = "BOOL";
+ break;
+ case sdbc::DataType::DATE:
+ aTypeName = "DATE";
+ break;
+ case sdbc::DataType::TIME:
+ aTypeName = "TIME";
+ break;
+ case sdbc::DataType::TIMESTAMP:
+ aTypeName = "TIMESTAMP";
+ break;
+ default:
+ SAL_WARN("connectivity.writer", "missing type name");
+ aTypeName.clear();
+ }
+
+ // check if the column name already exists
+ OUString aAlias = aColumnName;
+ OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ sal_Int32 nExprCnt = 0;
+ while (aFind != m_aColumns->get().end())
+ {
+ (aAlias = aColumnName) += OUString::number(++nExprCnt);
+ aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase);
+ }
+
+ sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias, aTypeName, OUString(),OUString(),
+ sdbc::ColumnValue::NULLABLE, nPrecision, nDecimals,
+ eType, false, false, bCurrency,
+ bStoresMixedCaseQuotedIdentifiers,
+ m_CatalogName, getSchema(), getName());
+ uno::Reference< XPropertySet> xCol = pColumn;
+ m_aColumns->get().push_back(xCol);
+ m_aTypes.push_back(eType);
+ m_aPrecisions.push_back(nPrecision);
+ m_aScales.push_back(nDecimals);
+ }
+}
+
+
+OWriterTable::OWriterTable(sdbcx::OCollection* _pTables, OWriterConnection* _pConnection,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description,
+ const OUString& SchemaName,
+ const OUString& CatalogName
+ ) : OWriterTable_BASE(_pTables,_pConnection,Name,
+ Type,
+ Description,
+ SchemaName,
+ CatalogName)
+ ,m_pWriterConnection(_pConnection)
+ ,m_nStartCol(0)
+ ,m_nStartRow(0)
+ ,m_nDataCols(0)
+ ,m_nDataRows(0)
+ ,m_bHasHeaders(false)
+ ,m_aNullDate(::Date::EMPTY)
+{
+}
+
+void OWriterTable::construct()
+{
+ uno::Reference<text::XTextDocument> xDoc = m_pWriterConnection->acquireDoc();
+ if (xDoc.is())
+ {
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(xDoc, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xTables = xTextTablesSupplier->getTextTables();
+ if (xTables.is() && xTables->hasByName(m_Name))
+ {
+ m_xTable.set(xTables->getByName(m_Name), uno::UNO_QUERY);
+ if (m_xTable.is())
+ {
+ lcl_GetDataArea(m_xTable, m_nDataCols, m_nDataRows);
+ m_bHasHeaders = true;
+ }
+ }
+
+ uno::Reference<util::XNumberFormatsSupplier> xSupp(xDoc, uno::UNO_QUERY);
+ if (xSupp.is())
+ m_xFormats = xSupp->getNumberFormats();
+ }
+
+ fillColumns();
+
+ refreshColumns();
+}
+
+void OWriterTable::refreshColumns()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ TStringVector aVector;
+
+ OSQLColumns::Vector::const_iterator aEnd = m_aColumns->get().end();
+ for (OSQLColumns::Vector::const_iterator aIter = m_aColumns->get().begin(); aIter != aEnd; ++aIter)
+ aVector.push_back(uno::Reference<XNamed>(*aIter, uno::UNO_QUERY)->getName());
+
+ if (m_pColumns)
+ m_pColumns->reFill(aVector);
+ else
+ m_pColumns = new component::OComponentColumns(this, m_aMutex, aVector);
+}
+
+void OWriterTable::refreshIndexes()
+{
+ // Writer table has no index
+}
+
+
+void SAL_CALL OWriterTable::disposing()
+{
+ OFileTable::disposing();
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aColumns = nullptr;
+ if (m_pWriterConnection)
+ m_pWriterConnection->releaseDoc();
+ m_pWriterConnection = nullptr;
+
+}
+
+uno::Sequence< uno::Type > SAL_CALL OWriterTable::getTypes() throw(css::uno::RuntimeException, std::exception)
+{
+ uno::Sequence< uno::Type > aTypes = file::OTable_TYPEDEF::getTypes();
+ std::vector<uno::Type> aOwnTypes;
+ aOwnTypes.reserve(aTypes.getLength());
+
+ const uno::Type* pBegin = aTypes.getConstArray();
+ const uno::Type* pEnd = pBegin + aTypes.getLength();
+ for (; pBegin != pEnd; ++pBegin)
+ {
+ if (!(*pBegin == cppu::UnoType<XKeysSupplier>::get()||
+ *pBegin == cppu::UnoType<XIndexesSupplier>::get()||
+ *pBegin == cppu::UnoType<XRename>::get()||
+ *pBegin == cppu::UnoType<XAlterTable>::get()||
+ *pBegin == cppu::UnoType<XDataDescriptorFactory>::get()))
+ aOwnTypes.push_back(*pBegin);
+ }
+ aOwnTypes.push_back(cppu::UnoType<css::lang::XUnoTunnel>::get());
+
+ return uno::Sequence< uno::Type >(aOwnTypes.data(), aOwnTypes.size());
+}
+
+
+uno::Any SAL_CALL OWriterTable::queryInterface(const uno::Type& rType) throw(css::uno::RuntimeException, std::exception)
+{
+ if (rType == cppu::UnoType<XKeysSupplier>::get()||
+ rType == cppu::UnoType<XIndexesSupplier>::get()||
+ rType == cppu::UnoType<XRename>::get()||
+ rType == cppu::UnoType<XAlterTable>::get()||
+ rType == cppu::UnoType<XDataDescriptorFactory>::get())
+ return uno::Any();
+
+ const uno::Any aRet = ::cppu::queryInterface(rType,static_cast< css::lang::XUnoTunnel*>(this));
+ return aRet.hasValue() ? aRet : file::OTable_TYPEDEF::queryInterface(rType);
+}
+
+
+uno::Sequence< sal_Int8 > OWriterTable::getUnoTunnelImplementationId()
+{
+ static ::cppu::OImplementationId implId;
+
+ return implId.getImplementationId();
+}
+
+sal_Int64 OWriterTable::getSomething(const uno::Sequence< sal_Int8 >& rId) throw(css::uno::RuntimeException, std::exception)
+{
+ return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16))
+ ? reinterpret_cast< sal_Int64 >(this)
+ : OWriterTable_BASE::getSomething(rId);
+}
+
+sal_Int32 OWriterTable::getCurrentLastPos() const
+{
+ return m_nDataRows;
+}
+
+bool OWriterTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
+{
+ // prepare positioning:
+
+ sal_uInt32 nNumberOfRecords = m_nDataRows;
+ sal_uInt32 nTempPos = m_nFilePos;
+ m_nFilePos = nCurPos;
+
+ switch (eCursorPosition)
+ {
+ case IResultSetHelper::NEXT:
+ m_nFilePos++;
+ break;
+ case IResultSetHelper::PRIOR:
+ if (m_nFilePos > 0)
+ m_nFilePos--;
+ break;
+ case IResultSetHelper::FIRST:
+ m_nFilePos = 1;
+ break;
+ case IResultSetHelper::LAST:
+ m_nFilePos = nNumberOfRecords;
+ break;
+ case IResultSetHelper::RELATIVE1:
+ m_nFilePos = (m_nFilePos + nOffset < 0) ? 0L
+ : (sal_uInt32)(m_nFilePos + nOffset);
+ break;
+ case IResultSetHelper::ABSOLUTE1:
+ case IResultSetHelper::BOOKMARK:
+ m_nFilePos = (sal_uInt32)nOffset;
+ break;
+ }
+
+ if (m_nFilePos > (sal_Int32)nNumberOfRecords)
+ m_nFilePos = (sal_Int32)nNumberOfRecords + 1;
+
+ if (m_nFilePos == 0 || m_nFilePos == (sal_Int32)nNumberOfRecords + 1)
+ goto Error;
+ else
+ {
+ //! read buffer / setup row object etc?
+ }
+ goto End;
+
+Error:
+ switch (eCursorPosition)
+ {
+ case IResultSetHelper::PRIOR:
+ case IResultSetHelper::FIRST:
+ m_nFilePos = 0;
+ break;
+ case IResultSetHelper::LAST:
+ case IResultSetHelper::NEXT:
+ case IResultSetHelper::ABSOLUTE1:
+ case IResultSetHelper::RELATIVE1:
+ if (nOffset > 0)
+ m_nFilePos = nNumberOfRecords + 1;
+ else if (nOffset < 0)
+ m_nFilePos = 0;
+ break;
+ case IResultSetHelper::BOOKMARK:
+ m_nFilePos = nTempPos; // previous position
+ }
+ // aStatus.Set(SDB_STAT_NO_DATA_FOUND);
+ return false;
+
+End:
+ nCurPos = m_nFilePos;
+ return true;
+}
+
+bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols,
+ bool bRetrieveData)
+{
+ // read the bookmark
+
+ _rRow->setDeleted(false);
+ *(_rRow->get())[0] = m_nFilePos;
+
+ if (!bRetrieveData)
+ return true;
+
+ // fields
+
+ OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin();
+ OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end();
+ const OValueRefVector::Vector::size_type nCount = _rRow->get().size();
+ for (OValueRefVector::Vector::size_type i = 1; aIter != aEnd && i < nCount;
+ ++aIter, i++)
+ {
+ if ((_rRow->get())[i]->isBound())
+ {
+ lcl_SetValue((_rRow->get())[i]->get(), m_xTable, m_nStartCol, m_nStartRow, m_bHasHeaders,
+ m_nFilePos, i);
+ }
+ }
+ return true;
+}
+
+void OWriterTable::FileClose()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ OWriterTable_BASE::FileClose();
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WTables.cxx b/connectivity/source/drivers/writer/WTables.cxx
new file mode 100644
index 000000000000..685a5b778c54
--- /dev/null
+++ b/connectivity/source/drivers/writer/WTables.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WTables.hxx"
+
+#include <sal/config.h>
+
+#include <comphelper/types.hxx>
+
+#include <writer/WConnection.hxx>
+#include "file/FCatalog.hxx"
+#include "file/FConnection.hxx"
+#include "writer/WCatalog.hxx"
+#include "writer/WTable.hxx"
+
+using namespace ::com::sun::star;
+
+namespace connectivity
+{
+namespace writer
+{
+
+sdbcx::ObjectType OWriterTables::createObject(const OUString& rName)
+{
+ OWriterTable* pTable = new OWriterTable(this, static_cast<OWriterConnection*>(static_cast<file::OFileCatalog&>(m_rParent).getConnection()), rName, "TABLE");
+ sdbcx::ObjectType xRet = pTable;
+ pTable->construct();
+ return xRet;
+}
+
+} // namespace writer
+} // namespace connectivity
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/Wservices.cxx b/connectivity/source/drivers/writer/Wservices.cxx
new file mode 100644
index 000000000000..4e439bece7e0
--- /dev/null
+++ b/connectivity/source/drivers/writer/Wservices.cxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "writer/WDriver.hxx"
+#include <cppuhelper/factory.hxx>
+
+using namespace com::sun::star;
+
+typedef uno::Reference< lang::XSingleServiceFactory > (SAL_CALL* createFactoryFunc)
+(
+ const uno::Reference< lang::XMultiServiceFactory >& rServiceManager,
+ const OUString& rComponentName,
+ ::cppu::ComponentInstantiation pCreateFunction,
+ const uno::Sequence< OUString >& rServiceNames,
+ rtl_ModuleCount*
+);
+
+
+struct ProviderRequest
+{
+ uno::Reference< lang::XSingleServiceFactory > xRet;
+ uno::Reference< lang::XMultiServiceFactory > const xServiceManager;
+ OUString const sImplementationName;
+
+ ProviderRequest(
+ void* pServiceManager,
+ sal_Char const* pImplementationName
+ )
+ : xServiceManager(static_cast<lang::XMultiServiceFactory*>(pServiceManager))
+ , sImplementationName(OUString::createFromAscii(pImplementationName))
+ {
+ }
+
+ bool CREATE_PROVIDER(
+ const OUString& Implname,
+ const uno::Sequence< OUString >& Services,
+ ::cppu::ComponentInstantiation Factory,
+ createFactoryFunc creator
+ )
+ {
+ if (!xRet.is() && (Implname == sImplementationName))
+ {
+ try
+ {
+ xRet = creator(xServiceManager, sImplementationName,Factory, Services,nullptr);
+ }
+ catch (...)
+ {
+ }
+ }
+ return xRet.is();
+ }
+
+ void* getProvider() const
+ {
+ return xRet.get();
+ }
+};
+
+
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL connectivity_writer_component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* /*pRegistryKey*/)
+{
+ void* pRet = nullptr;
+ if (pServiceManager)
+ {
+ ProviderRequest aReq(pServiceManager,pImplementationName);
+
+ aReq.CREATE_PROVIDER(
+ connectivity::writer::ODriver::getImplementationName_Static(),
+ connectivity::writer::ODriver::getSupportedServiceNames_Static(),
+ connectivity::writer::ODriver_CreateInstance, ::cppu::createSingleFactory)
+ ;
+
+ if (aReq.xRet.is())
+ aReq.xRet->acquire();
+
+ pRet = aReq.getProvider();
+ }
+
+ return pRet;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/writer.component b/connectivity/source/drivers/writer/writer.component
new file mode 100644
index 000000000000..3bf9d6e79292
--- /dev/null
+++ b/connectivity/source/drivers/writer/writer.component
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ -->
+
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+ prefix="connectivity_writer"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.sdbc.writer.ODriver">
+ <service name="com.sun.star.sdbc.Driver"/>
+ <service name="com.sun.star.sdbcx.Driver"/>
+ </implementation>
+</component>
diff --git a/connectivity/source/inc/calc/CColumns.hxx b/connectivity/source/inc/component/CColumns.hxx
index f178e80a396c..3ecec1d0b637 100644
--- a/connectivity/source/inc/calc/CColumns.hxx
+++ b/connectivity/source/inc/component/CColumns.hxx
@@ -17,21 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCOLUMNS_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCOLUMNS_HXX
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
#include "file/FColumns.hxx"
namespace connectivity
{
- namespace calc
+ namespace component
{
- class OCalcColumns : public file::OColumns
+ /// Columns implementation for Writer tables and Calc sheets.
+ class OOO_DLLPUBLIC_FILE OComponentColumns : public file::OColumns
{
protected:
virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
public:
- OCalcColumns(file::OFileTable* _pTable,
+ OComponentColumns(file::OFileTable* _pTable,
::osl::Mutex& _rMutex,
const TStringVector &_rVector
) : file::OColumns(_pTable,_rMutex,_rVector)
@@ -41,6 +42,6 @@ namespace connectivity
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCOLUMNS_HXX
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CCOLUMNS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/calc/CPreparedStatement.hxx b/connectivity/source/inc/component/CPreparedStatement.hxx
index 91507792dc10..55f8bf9f84c0 100644
--- a/connectivity/source/inc/calc/CPreparedStatement.hxx
+++ b/connectivity/source/inc/component/CPreparedStatement.hxx
@@ -17,27 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
#include "file/FPreparedStatement.hxx"
namespace connectivity
{
- namespace calc
+ namespace component
{
class OConnection;
- class OCalcPreparedStatement : public file::OPreparedStatement
+ /// Prepared statement implementation for Writer tables and Calc sheets.
+ class OOO_DLLPUBLIC_FILE OComponentPreparedStatement : public file::OPreparedStatement
{
protected:
virtual file::OResultSet* createResultSet() override;
public:
- OCalcPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}
+ OComponentPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}
DECLARE_SERVICE_INFO();
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/calc/CResultSet.hxx b/connectivity/source/inc/component/CResultSet.hxx
index aa8278a41417..b9fc94d03437 100644
--- a/connectivity/source/inc/calc/CResultSet.hxx
+++ b/connectivity/source/inc/component/CResultSet.hxx
@@ -16,8 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CRESULTSET_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CRESULTSET_HXX
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
#include "file/FResultSet.hxx"
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -26,19 +26,20 @@
namespace connectivity
{
- namespace calc
+ namespace component
{
- class OCalcResultSet;
+ class OComponentResultSet;
// these typedef's are only necessary for the compiler
typedef ::cppu::ImplHelper2< css::sdbcx::XRowLocate,
- css::sdbcx::XDeleteRows> OCalcResultSet_BASE;
- typedef file::OResultSet OCalcResultSet_BASE2;
- typedef ::comphelper::OPropertyArrayUsageHelper<OCalcResultSet> OCalcResultSet_BASE3;
+ css::sdbcx::XDeleteRows> OComponentResultSet_BASE;
+ typedef file::OResultSet OComponentResultSet_BASE2;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OComponentResultSet> OComponentResultSet_BASE3;
- class OCalcResultSet : public OCalcResultSet_BASE2,
- public OCalcResultSet_BASE,
- public OCalcResultSet_BASE3
+ /// ResultSet implementation for Writer tables and Calc sheets.
+ class OOO_DLLPUBLIC_FILE OComponentResultSet : public OComponentResultSet_BASE2,
+ public OComponentResultSet_BASE,
+ public OComponentResultSet_BASE3
{
bool m_bBookmarkable;
protected:
@@ -50,7 +51,7 @@ namespace connectivity
public:
DECLARE_SERVICE_INFO();
- OCalcResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
+ OComponentResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
private:
// XInterface
@@ -78,6 +79,6 @@ namespace connectivity
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CRESULTSET_HXX
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/calc/CStatement.hxx b/connectivity/source/inc/component/CStatement.hxx
index e9a3d552eab0..695d92a4e225 100644
--- a/connectivity/source/inc/calc/CStatement.hxx
+++ b/connectivity/source/inc/component/CStatement.hxx
@@ -17,27 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
#include "file/FStatement.hxx"
namespace connectivity
{
- namespace calc
+ namespace component
{
class OConnection;
- class OCalcStatement : public file::OStatement
+ /// Statement implementation for Writer tables and Calc sheets.
+ class OOO_DLLPUBLIC_FILE OComponentStatement : public file::OStatement
{
protected:
virtual file::OResultSet* createResultSet() override;
public:
- OCalcStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){}
+ OComponentStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){}
DECLARE_SERVICE_INFO();
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WCatalog.hxx b/connectivity/source/inc/writer/WCatalog.hxx
new file mode 100644
index 000000000000..b1ba9a582714
--- /dev/null
+++ b/connectivity/source/inc/writer/WCatalog.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
+
+#include "file/FCatalog.hxx"
+
+namespace connectivity
+{
+namespace writer
+{
+
+class OWriterConnection;
+class OWriterCatalog : public file::OFileCatalog
+{
+public:
+ void refreshTables() override;
+
+public:
+ OWriterCatalog(OWriterConnection* _pCon);
+};
+
+} // namespace writer
+} // namespace connectivity
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WConnection.hxx b/connectivity/source/inc/writer/WConnection.hxx
new file mode 100644
index 000000000000..d0aaaa911ba4
--- /dev/null
+++ b/connectivity/source/inc/writer/WConnection.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
+
+#include <memory>
+#include "file/FConnection.hxx"
+#include <com/sun/star/frame/XDesktop2.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/uno/DeploymentException.hpp>
+#include <unotools/closeveto.hxx>
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace text
+{
+class XTextDocument;
+}
+}
+}
+}
+
+namespace utl
+{
+class CloseVeto;
+}
+
+
+namespace connectivity
+{
+namespace writer
+{
+class ODriver;
+class OWriterConnection : public file::OConnection
+{
+ // the spreadsheet document:
+ css::uno::Reference< css::text::XTextDocument > m_xDoc;
+ OUString m_sPassword;
+ OUString m_aFileName;
+ oslInterlockedCount m_nDocCount;
+
+ class CloseVetoButTerminateListener : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener>
+ {
+ private:
+ /// close listener that vetoes so nobody else disposes m_xDoc
+ std::unique_ptr<utl::CloseVeto> m_pCloseListener;
+ /// but also listen to XDesktop and if app is terminating anyway, dispose m_xDoc while
+ /// its still possible to do so properly
+ css::uno::Reference<css::frame::XDesktop2> m_xDesktop;
+ osl::Mutex m_aMutex;
+ public:
+ CloseVetoButTerminateListener()
+ : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aMutex)
+ {
+ }
+
+ void start(const css::uno::Reference<css::uno::XInterface>& rCloseable,
+ const css::uno::Reference<css::frame::XDesktop2>& rDesktop)
+ {
+ m_xDesktop = rDesktop;
+ m_xDesktop->addTerminateListener(this);
+ m_pCloseListener.reset(new utl::CloseVeto(rCloseable, true));
+ }
+
+ void stop()
+ {
+ m_pCloseListener.reset();
+ if (!m_xDesktop.is())
+ return;
+ m_xDesktop->removeTerminateListener(this);
+ m_xDesktop.clear();
+ }
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination(const css::lang::EventObject& /*rEvent*/) throw(css::frame::TerminationVetoException, css::uno::RuntimeException, std::exception) override
+ {
+ }
+
+ virtual void SAL_CALL notifyTermination(const css::lang::EventObject& /*rEvent*/) throw(css::uno::RuntimeException, std::exception) override
+ {
+ stop();
+ }
+
+ virtual void SAL_CALL disposing() throw(css::uno::RuntimeException, std::exception) override
+ {
+ stop();
+ cppu::WeakComponentImplHelperBase::disposing();
+ }
+
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override
+ {
+ const bool bShutDown = (rEvent.Source == m_xDesktop);
+ if (bShutDown)
+ stop();
+ }
+ };
+
+ rtl::Reference<CloseVetoButTerminateListener> m_xCloseVetoButTerminateListener;
+
+public:
+ OWriterConnection(ODriver* _pDriver);
+ virtual ~OWriterConnection() override;
+
+ virtual void construct(const OUString& _rUrl,
+ const css::uno::Sequence< css::beans::PropertyValue >& _rInfo) throw( css::sdbc::SQLException, css::uno::RuntimeException, css::uno::DeploymentException, std::exception) override;
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ // XConnection
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override;
+ virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString& sql) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString& sql) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+
+ // no interface methods
+ css::uno::Reference< css::text::XTextDocument> const& acquireDoc();
+ void releaseDoc();
+
+ class ODocHolder
+ {
+ OWriterConnection* m_pConnection;
+ css::uno::Reference< css::text::XTextDocument> m_xDoc;
+ public:
+ ODocHolder(OWriterConnection* _pConnection) : m_pConnection(_pConnection)
+ {
+ m_xDoc = m_pConnection->acquireDoc();
+ }
+ ~ODocHolder()
+ {
+ m_xDoc.clear();
+ m_pConnection->releaseDoc();
+ }
+ const css::uno::Reference< css::text::XTextDocument>& getDoc() const
+ {
+ return m_xDoc;
+ }
+ };
+};
+}
+}
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCONNECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WDatabaseMetaData.hxx b/connectivity/source/inc/writer/WDatabaseMetaData.hxx
new file mode 100644
index 000000000000..ef499f1c9880
--- /dev/null
+++ b/connectivity/source/inc/writer/WDatabaseMetaData.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
+
+#include "file/FDatabaseMetaData.hxx"
+
+namespace connectivity
+{
+namespace writer
+{
+
+class OWriterDatabaseMetaData : public file::ODatabaseMetaData
+{
+ virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override;
+ virtual OUString SAL_CALL getURL() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns(const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int32 SAL_CALL getMaxCharLiteralLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnNameLength() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInIndex() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Int32 SAL_CALL getMaxColumnsInTable() throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables(const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+protected:
+ virtual ~OWriterDatabaseMetaData() override;
+public:
+ OWriterDatabaseMetaData(file::OConnection* pConnection);
+};
+
+} // namespace writer
+} // namespace connectivity
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDATABASEMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WDriver.hxx b/connectivity/source/inc/writer/WDriver.hxx
new file mode 100644
index 000000000000..0e6075b0d1ff
--- /dev/null
+++ b/connectivity/source/inc/writer/WDriver.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
+
+#include "file/FDriver.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace connectivity
+{
+namespace writer
+{
+/// @throws css::uno::Exception
+css::uno::Reference< css::uno::XInterface > SAL_CALL
+ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory) throw( css::uno::Exception );
+
+class ODriver : public file::OFileDriver
+{
+public:
+ ODriver(const css::uno::Reference<
+ css::uno::XComponentContext >& _rxContext) :
+ file::OFileDriver(_rxContext) {}
+
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static() throw(css::uno::RuntimeException);
+ OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
+
+ // XDriver
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL
+ connect(const OUString& url, const css::uno::Sequence<
+ css::beans::PropertyValue >& info) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual sal_Bool SAL_CALL acceptsURL(const OUString& url) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+ virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
+};
+}
+}
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WDRIVER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WTable.hxx b/connectivity/source/inc/writer/WTable.hxx
new file mode 100644
index 000000000000..e0c5d2045402
--- /dev/null
+++ b/connectivity/source/inc/writer/WTable.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
+
+#include "file/FTable.hxx"
+#include <tools/date.hxx>
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace text
+{
+class XTextTable;
+}
+}
+}
+}
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace util
+{
+class XNumberFormats;
+}
+}
+}
+}
+
+
+namespace connectivity
+{
+namespace writer
+{
+typedef file::OFileTable OWriterTable_BASE;
+class OWriterConnection;
+
+class OWriterTable : public OWriterTable_BASE
+{
+private:
+ std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset
+ std::vector<sal_Int32> m_aPrecisions; // same as aboth
+ std::vector<sal_Int32> m_aScales;
+ css::uno::Reference< css::text::XTextTable > m_xTable;
+ OWriterConnection* m_pWriterConnection;
+ sal_Int32 m_nStartCol;
+ sal_Int32 m_nStartRow;
+ sal_Int32 m_nDataCols;
+ sal_Int32 m_nDataRows;
+ bool m_bHasHeaders;
+ css::uno::Reference< css::util::XNumberFormats > m_xFormats;
+ ::Date m_aNullDate;
+
+ void fillColumns();
+
+protected:
+ virtual void FileClose() override;
+public:
+ virtual void refreshColumns() override;
+ virtual void refreshIndexes() override;
+
+public:
+ OWriterTable(sdbcx::OCollection* _pTables, OWriterConnection* _pConnection,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description = OUString(),
+ const OUString& SchemaName = OUString(),
+ const OUString& CatalogName = OUString()
+ );
+
+ virtual sal_Int32 getCurrentLastPos() const override;
+ virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override;
+ virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
+
+ virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& rType) throw(css::uno::RuntimeException, std::exception) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw(css::uno::RuntimeException, std::exception) override;
+ virtual void SAL_CALL disposing() override;
+
+ // css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& aIdentifier) throw(css::uno::RuntimeException, std::exception) override;
+ static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ void construct() override;
+};
+
+} // namespace writer
+} // namespace connectivity
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WTables.hxx b/connectivity/source/inc/writer/WTables.hxx
new file mode 100644
index 000000000000..0f9b61e0de3e
--- /dev/null
+++ b/connectivity/source/inc/writer/WTables.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
+
+#include "file/FTables.hxx"
+
+namespace connectivity
+{
+namespace writer
+{
+typedef file::OTables OWriterTables_BASE;
+
+class OWriterTables : public OWriterTables_BASE
+{
+protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+public:
+ OWriterTables(const css::uno::Reference<css::sdbc::XDatabaseMetaData>& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const TStringVector& _rVector) : OWriterTables_BASE(_rMetaData,_rParent,_rMutex,_rVector)
+ {}
+};
+}
+}
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WTABLES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 086bf7f4d40a..36fe8399efed 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -100,6 +100,7 @@
#define HID_DSADMIN_MSACCESS_MDB_FILE "DBACCESS_HID_DSADMIN_MSACCESS_MDB_FILE"
#define HID_DSADMIN_FLAT_PATH "DBACCESS_HID_DSADMIN_FLAT_PATH"
#define HID_DSADMIN_CALC_PATH "DBACCESS_HID_DSADMIN_CALC_PATH"
+#define HID_DSADMIN_WRITER_PATH "DBACCESS_HID_DSADMIN_WRITER_PATH"
#define HID_DSADMIN_ORACLE_DATABASE "DBACCESS_HID_DSADMIN_ORACLE_DATABASE"
#define HID_APP_TABLE_TREE "DBACCESS_HID_APP_TABLE_TREE"
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 0414b77e2219..a478f6c6fb63 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -388,6 +388,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
const KnownPrefix aKnowPrefixes[] =
{
KnownPrefix( "sdbc:calc:", DST_CALC, false ),
+ KnownPrefix( "sdbc:writer:", DST_WRITER, false ),
KnownPrefix( "sdbc:flat:", DST_FLAT, false ),
KnownPrefix( "sdbc:odbc:", DST_ODBC, false ),
KnownPrefix( "sdbc:dbase:", DST_DBASE, false ),
@@ -436,7 +437,8 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,::std::vector<sal_Int
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_TEXT);
break;
case DST_CALC:
- _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_SPREADSHEET);
+ case DST_WRITER:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET);
break;
case DST_ODBC:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ODBC);
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 75c6739a2fe1..9d78daf9693f 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -62,6 +62,7 @@ enum DATASOURCE_TYPE
DST_FIREBIRD = 26,
DST_EMBEDDED_FIREBIRD = 27,
DST_POSTGRES = 28,
+ DST_WRITER = 29,
DST_USERDEFINE1, /// first user defined driver
DST_USERDEFINE2,
@@ -90,7 +91,7 @@ enum DATASOURCE_TYPE
#define PAGE_DBSETUPWIZARD_JDBC 10
#define PAGE_DBSETUPWIZARD_ADO 11
#define PAGE_DBSETUPWIZARD_ODBC 12
-#define PAGE_DBSETUPWIZARD_SPREADSHEET 13
+#define PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET 13
#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
#define PAGE_DBSETUPWIZARD_FINAL 16
#define PAGE_DBSETUPWIZARD_USERDEFINED 17
diff --git a/dbaccess/source/ui/dlg/AutoControls.src b/dbaccess/source/ui/dlg/AutoControls.src
index 5b0b9687796c..c6539edc6f66 100644
--- a/dbaccess/source/ui/dlg/AutoControls.src
+++ b/dbaccess/source/ui/dlg/AutoControls.src
@@ -34,6 +34,11 @@ String STR_CALC_PATH_OR_FILE
Text[ en-US ] = "Path to the spreadsheet document";
};
+String STR_WRITER_PATH_OR_FILE
+{
+ Text[ en-US ] = "Path to the Writer document";
+};
+
String STR_NAME_OF_ODBC_DATASOURCE
{
Text[ en-US ] = "Name of the ODBC data source on your system";
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index 5911c6e0eb88..65828aad2c3a 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -224,6 +224,17 @@ namespace dbaui
askForFileName(aFileDlg);
}
break;
+ case ::dbaccess::DST_WRITER:
+ {
+ SvtModuleOptions aModule;
+ ::sfx2::FileDialogHelper aFileDlg(
+ ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
+ FileDialogFlags::NONE,
+ aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::WRITER)
+ ,SfxFilterFlags::IMPORT);
+ askForFileName(aFileDlg);
+ }
+ break;
case ::dbaccess::DST_MSACCESS:
{
const OUString sExt("*.mdb;*.mde");
@@ -664,7 +675,7 @@ namespace dbaui
const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
- if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
+ if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
{
if( pathExists(sURL, true) == PATH_NOT_EXIST )
{
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index fa8d31fbfcd3..ac673a4b5638 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -149,6 +149,10 @@ namespace dbaui
m_pFT_Connection->SetText(OUString(ModuleRes(STR_CALC_PATH_OR_FILE)));
m_pConnectionURL->SetHelpId(HID_DSADMIN_CALC_PATH);
break;
+ case ::dbaccess::DST_WRITER:
+ m_pFT_Connection->SetText(OUString(ModuleRes(STR_WRITER_PATH_OR_FILE)));
+ m_pConnectionURL->SetHelpId(HID_DSADMIN_WRITER_PATH);
+ break;
case ::dbaccess::DST_ADO:
m_pFT_Connection->SetText(OUString(ModuleRes(STR_COMMONURL)));
break;
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index edad0abe55ea..8daeaed35163 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -687,7 +687,7 @@ using namespace ::com::sun::star;
callModifiedHdl();
}
- VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+ VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
{
return VclPtr<OSpreadSheetConnectionPageSetup>::Create( pParent, _rAttrSet );
}
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index cbdb3e273e4e..9aff6bb8d5bf 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -40,7 +40,7 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
- static VclPtr<OGenericAdministrationPage> CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+ static VclPtr<OGenericAdministrationPage> CreateDocumentOrSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
OSpreadSheetConnectionPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
virtual ~OSpreadSheetConnectionPageSetup() override;
virtual void dispose() override;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 2490f0eaf31c..04d204379331 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -479,6 +479,7 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
case ::dbaccess::DST_DBASE:
case ::dbaccess::DST_FLAT:
case ::dbaccess::DST_CALC:
+ case ::dbaccess::DST_WRITER:
break;
case ::dbaccess::DST_MSACCESS:
case ::dbaccess::DST_MSACCESS_2007:
diff --git a/dbaccess/source/ui/dlg/dbadminsetup.src b/dbaccess/source/ui/dlg/dbadminsetup.src
index d798978cb21b..a4903c5dc4d1 100644
--- a/dbaccess/source/ui/dlg/dbadminsetup.src
+++ b/dbaccess/source/ui/dlg/dbadminsetup.src
@@ -74,9 +74,9 @@ String STR_PAGETITLE_ODBC
Text[ en-US ] = "Set up ODBC connection" ;
};
-String STR_PAGETITLE_SPREADSHEET
+String STR_PAGETITLE_DOCUMENT_OR_SPREADSHEET
{
- Text[ en-US ] = "Set up Spreadsheet connection" ;
+ Text[ en-US ] = "Set up Writer Document or Spreadsheet connection" ;
};
String STR_PAGETITLE_AUTHENTIFICATION
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 669a607c669a..3ff5645621f2 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -156,6 +156,7 @@ WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCur
case ::dbaccess::DST_MSACCESS_2007:
case ::dbaccess::DST_JDBC:
case ::dbaccess::DST_CALC:
+ case ::dbaccess::DST_WRITER:
nNextState = WZS_INVALID_STATE;
break;
case ::dbaccess::DST_DBASE:
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 9e33bc439e79..4e09735c5c5f 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -120,7 +120,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(vcl::Window* _pParent
, m_sRM_OracleText( ModuleRes( STR_PAGETITLE_ORACLE ) )
, m_sRM_MySQLText( ModuleRes( STR_PAGETITLE_MYSQL ) )
, m_sRM_ODBCText( ModuleRes( STR_PAGETITLE_ODBC ) )
- , m_sRM_SpreadSheetText( ModuleRes( STR_PAGETITLE_SPREADSHEET ) )
+ , m_sRM_DocumentOrSpreadSheetText( ModuleRes( STR_PAGETITLE_DOCUMENT_OR_SPREADSHEET ) )
, m_sRM_AuthentificationText( ModuleRes( STR_PAGETITLE_AUTHENTIFICATION ) )
, m_sRM_FinalText( ModuleRes( STR_PAGETITLE_FINAL ) )
, m_sWorkPath( SvtPathOptions().GetWorkPath() )
@@ -240,8 +240,8 @@ OUString ODbTypeWizDialogSetup::getStateDisplayName( WizardState _nState ) const
case PAGE_DBSETUPWIZARD_ODBC:
sRoadmapItem = m_sRM_ODBCText;
break;
- case PAGE_DBSETUPWIZARD_SPREADSHEET:
- sRoadmapItem = m_sRM_SpreadSheetText;
+ case PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET:
+ sRoadmapItem = m_sRM_DocumentOrSpreadSheetText;
break;
case PAGE_DBSETUPWIZARD_AUTHENTIFICATION:
sRoadmapItem = m_sRM_AuthentificationText;
@@ -520,8 +520,8 @@ VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState)
pPage = OLDAPConnectionPageSetup::CreateLDAPTabPage(this,*m_pOutSet);
break;
- case PAGE_DBSETUPWIZARD_SPREADSHEET: /// first user defined driver
- pPage = OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage(this,*m_pOutSet);
+ case PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET:
+ pPage = OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(this,*m_pOutSet);
break;
case PAGE_DBSETUPWIZARD_MSACCESS:
diff --git a/dbaccess/source/ui/inc/dbu_dlg.hrc b/dbaccess/source/ui/inc/dbu_dlg.hrc
index 3fb205315fa8..960c175a3ff6 100644
--- a/dbaccess/source/ui/inc/dbu_dlg.hrc
+++ b/dbaccess/source/ui/inc/dbu_dlg.hrc
@@ -79,7 +79,7 @@
#define STR_NAME_OF_ODBC_DATASOURCE RID_STR_DLG_START + 48
#define STR_MYSQL_DATABASE_NAME RID_STR_DLG_START + 49
#define STR_ORACLE_DATABASE_NAME RID_STR_DLG_START + 50
- // FREE
+#define STR_WRITER_PATH_OR_FILE RID_STR_DLG_START + 51
#define STR_MSACCESS_MDB_FILE RID_STR_DLG_START + 52
#define STR_COMMONURL RID_STR_DLG_START + 53
#define STR_DATABASEDEFAULTNAME RID_STR_DLG_START + 54
@@ -108,7 +108,7 @@
#define STR_PAGETITLE_ORACLE RID_STR_DLG_START + 76
#define STR_PAGETITLE_MYSQL RID_STR_DLG_START + 77
#define STR_PAGETITLE_ODBC RID_STR_DLG_START + 78
-#define STR_PAGETITLE_SPREADSHEET RID_STR_DLG_START + 79
+#define STR_PAGETITLE_DOCUMENT_OR_SPREADSHEET RID_STR_DLG_START + 79
#define STR_PAGETITLE_AUTHENTIFICATION RID_STR_DLG_START + 80
#define STR_PAGETITLE_MYSQL_NATIVE RID_STR_DLG_START + 81
#define STR_PAGETITLE_FINAL RID_STR_DLG_START + 82
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 31b08dfa0bd5..99df1376475e 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -77,7 +77,7 @@ private:
OUString m_sRM_OracleText;
OUString m_sRM_MySQLText;
OUString m_sRM_ODBCText;
- OUString m_sRM_SpreadSheetText;
+ OUString m_sRM_DocumentOrSpreadSheetText;
OUString m_sRM_AuthentificationText;
OUString m_sRM_FinalText;
INetURLObject m_aDocURL;
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index bd4ab2f1240e..6dcd82b3dea6 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -85,6 +85,7 @@ certain functionality.
@li @c connectivity.odbc
@li @c connectivity.parse
@li @c connectivity.postgresql
+@li @c connectivity.writer
@section comphelper
diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk
index 6ee4597fb69f..231cbb63cc22 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -417,6 +417,12 @@ postprocess_FILES_writer := \
$(postprocess_MOD)/org/openoffice/Office/Embedding-writer.xcu \
$(postprocess_MOD)/org/openoffice/Setup-writer.xcu
+ifeq (DBCONNECTIVITY,$(filter DBCONNECTIVITY,$(BUILD_TYPE)))
+postprocess_FILES_writer += \
+ $(call gb_XcuModuleTarget_get_target,connectivity/registry/writer)/org/openoffice/Office/DataAccess/Drivers-writer.xcu
+postprocess_DRIVERS += writer
+endif
+
postprocess_DEPS_xsltfilter := main
postprocess_OPTDEPS_xsltfilter := calc writer
postprocess_FILES_xsltfilter := \
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index cd952135cc96..9fce3c6c37f5 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -268,6 +268,7 @@ $(eval $(call gb_Rdb_add_components,services,\
connectivity/source/drivers/jdbc/jdbc \
) \
connectivity/source/manager/sdbc2 \
+ connectivity/source/drivers/writer/writer \
dbaccess/source/ext/macromigration/dbmm \
dbaccess/source/filter/xml/dbaxml \
dbaccess/util/dba \
diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index 8d2a3f8ac75e..7826c312ddb2 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_mailmerge, \
configmgr/source/configmgr \
connectivity/source/cpool/dbpool2 \
connectivity/source/drivers/calc/calc \
+ connectivity/source/drivers/writer/writer \
connectivity/source/manager/sdbc2 \
dbaccess/source/filter/xml/dbaxml \
dbaccess/util/dba \
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 7a3d6d124ba6..09a077200454 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -293,7 +293,8 @@ public:
DBCONN_DBASE,
DBCONN_FLAT,
DBCONN_MSJET,
- DBCONN_MSACE
+ DBCONN_MSACE,
+ DBCONN_WRITER
};
/// MailMergeEvent source
diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc
index 5557fa379612..61fb0b6b432d 100644
--- a/sw/inc/dbui.hrc
+++ b/sw/inc/dbui.hrc
@@ -40,6 +40,7 @@
#define ST_PUNCTUATION (RC_DBUI_BEGIN + 14)
#define ST_TEXT (RC_DBUI_BEGIN + 15)
#define RA_SALUTATION (RC_DBUI_BEGIN + 16)
+#define STR_FILTER_SXW (RC_DBUI_BEGIN + 17)
#define RA_PUNCTUATION (RC_DBUI_BEGIN + 18)
#define ST_TITLE_MALE (RC_DBUI_BEGIN + 19)
#define ST_TITLE_FEMALE (RC_DBUI_BEGIN + 20)
@@ -82,6 +83,7 @@
#define ST_FINISH (RC_DBUI_BEGIN + 57)
#define ST_ADDRESSLIST (RC_DBUI_BEGIN + 58)
#define ST_EXCLUDE (RC_DBUI_BEGIN + 59)
+#define STR_FILTER_DOC (RC_DBUI_BEGIN + 60)
// ImageList
#define ILIST (RC_DBUI_BEGIN + 62)
diff --git a/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt b/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt
new file mode 100644
index 000000000000..40b61eda3bbb
--- /dev/null
+++ b/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt
Binary files differ
diff --git a/sw/qa/extras/mailmerge/data/writer-mail-merge.odt b/sw/qa/extras/mailmerge/data/writer-mail-merge.odt
new file mode 100644
index 000000000000..f3d42f6b4781
--- /dev/null
+++ b/sw/qa/extras/mailmerge/data/writer-mail-merge.odt
Binary files differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 0c356526de26..a239f2c1ca17 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -420,6 +420,20 @@ DECLARE_FILE_MAILMERGE_TEST(testSimpleMailMerge, "simple-mail-merge.odt", "10-te
}
}
+DECLARE_FILE_MAILMERGE_TEST(testWriterDataSource, "writer-mail-merge.odt", "10-testing-addresses-writer.odt", "testing-addresses-writer")
+{
+ // This failed as the .odt data source was mapped to the jdbc: protocol.
+ executeMailMerge();
+ for (int doc = 0; doc < 10; ++doc)
+ {
+ loadMailMergeDocument(doc);
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ CPPUNIT_ASSERT_EQUAL(OUString("Fixed text."), getRun(getParagraph(1), 1)->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("lastname" + OUString::number(doc + 1)), getRun(getParagraph(2), 1)->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Another fixed text."), getRun(getParagraph(3), 1)->getString());
+ }
+}
+
DECLARE_FILE_MAILMERGE_TEST(test2Pages, "simple-mail-merge-2pages.odt", "10-testing-addresses.ods", "testing-addresses")
{
executeMailMerge();
diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src
index 3962a253e0c7..fa50541d277f 100644
--- a/sw/source/ui/dbui/dbui.src
+++ b/sw/source/ui/dbui/dbui.src
@@ -60,13 +60,21 @@ String STR_FILTER_SXC
{
Text [ en-US ] = "%PRODUCTNAME Calc (*.ods;*.sxc)" ;
};
+String STR_FILTER_SXW
+{
+ Text [ en-US ] = "%PRODUCTNAME Writer (*.odt;*.sxw)" ;
+};
String STR_FILTER_DBF
{
Text [ en-US ] = "dBase (*.dbf)" ;
};
String STR_FILTER_XLS
{
- Text [ en-US ] = "Microsoft Excel (*.xls)" ;
+ Text [ en-US ] = "Microsoft Excel (*.xls;*.xlsx)" ;
+};
+String STR_FILTER_DOC
+{
+ Text [ en-US ] = "Microsoft Word (*.doc;*.docx)" ;
};
String STR_FILTER_TXT
{
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 991b6127c251..876f4c22166a 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2581,8 +2581,10 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
OUString sFilterAllData(SW_RES(STR_FILTER_ALL_DATA));
OUString sFilterSXB(SW_RES(STR_FILTER_SXB));
OUString sFilterSXC(SW_RES(STR_FILTER_SXC));
+ OUString sFilterSXW(SW_RES(STR_FILTER_SXW));
OUString sFilterDBF(SW_RES(STR_FILTER_DBF));
OUString sFilterXLS(SW_RES(STR_FILTER_XLS));
+ OUString sFilterDOC(SW_RES(STR_FILTER_DOC));
OUString sFilterTXT(SW_RES(STR_FILTER_TXT));
OUString sFilterCSV(SW_RES(STR_FILTER_CSV));
#ifdef _WIN32
@@ -2590,12 +2592,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
OUString sFilterACCDB(SW_RES(STR_FILTER_ACCDB));
#endif
xFltMgr->appendFilter( sFilterAll, "*" );
- xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.dbf;*.xls;*.txt;*.csv");
+ xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.odt;*.sxw;*.dbf;*.xls;*.xlsx;*.doc;*.docx;*.txt;*.csv");
xFltMgr->appendFilter( sFilterSXB, "*.odb" );
xFltMgr->appendFilter( sFilterSXC, "*.ods;*.sxc" );
+ xFltMgr->appendFilter( sFilterSXW, "*.odt;*.sxw" );
xFltMgr->appendFilter( sFilterDBF, "*.dbf" );
- xFltMgr->appendFilter( sFilterXLS, "*.xls" );
+ xFltMgr->appendFilter( sFilterXLS, "*.xls;*.xlsx" );
+ xFltMgr->appendFilter( sFilterDOC, "*.doc;*.docx" );
xFltMgr->appendFilter( sFilterTXT, "*.txt" );
xFltMgr->appendFilter( sFilterCSV, "*.csv" );
#ifdef _WIN32
@@ -2636,13 +2640,21 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
}
else if(sExt.equalsIgnoreAsciiCase("sxc")
|| sExt.equalsIgnoreAsciiCase("ods")
- || sExt.equalsIgnoreAsciiCase("xls"))
+ || sExt.equalsIgnoreAsciiCase("xls")
+ || sExt.equalsIgnoreAsciiCase("xlsx"))
{
OUString sDBURL("sdbc:calc:");
sDBURL += aURL.GetMainURL(INetURLObject::NO_DECODE);
aURLAny <<= sDBURL;
type = DBCONN_CALC;
}
+ else if (sExt.equalsIgnoreAsciiCase("sxw") || sExt.equalsIgnoreAsciiCase("odt") || sExt.equalsIgnoreAsciiCase("doc") || sExt.equalsIgnoreAsciiCase("docx"))
+ {
+ OUString sDBURL("sdbc:writer:");
+ sDBURL += aURL.GetMainURL(INetURLObject::NO_DECODE);
+ aURLAny <<= sDBURL;
+ type = DBCONN_WRITER;
+ }
else if(sExt.equalsIgnoreAsciiCase("dbf"))
{
aURL.removeSegment();
@@ -2709,6 +2721,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
switch (type) {
case DBCONN_UNKNOWN:
case DBCONN_CALC:
+ case DBCONN_WRITER:
break;
case DBCONN_ODB:
bStore = false;