26#include <com/sun/star/frame/Desktop.hpp>
27#include <com/sun/star/text/XTextDocument.hpp>
44 : OConnection(_pDriver)
51 const uno::Sequence<beans::PropertyValue>& rInfo)
55 sal_Int32 nLen = rURL.indexOf(
':');
56 nLen = rURL.indexOf(
':', nLen + 1);
57 OUString aDSN(rURL.copy(nLen + 1));
61 aURL.SetSmartProtocol(INetProtocol::File);
67 if (
aURL.GetProtocol() == INetProtocol::NotValid)
70 throw sdbc::SQLException();
75 const char pPwd[] =
"password";
77 const beans::PropertyValue* pIter = rInfo.getConstArray();
78 const beans::PropertyValue* pEnd = pIter + rInfo.getLength();
79 for (; pIter != pEnd; ++pIter)
81 if (pIter->Name == pPwd)
99 uno::Sequence<beans::PropertyValue> aArgs(
m_sPassword.isEmpty() ? 2 : 3);
100 auto pArgs = aArgs.getArray();
101 pArgs[0].Name =
"Hidden";
102 pArgs[0].Value <<=
true;
103 pArgs[1].Name =
"ReadOnly";
104 pArgs[1].Value <<=
true;
108 pArgs[2].Name =
"Password";
112 uno::Reference<frame::XDesktop2> xDesktop
114 uno::Reference<lang::XComponent> xComponent;
118 xComponent = xDesktop->loadComponentFromURL(
m_aFileName,
"_blank", 0, aArgs);
120 catch (
const uno::Exception&)
122 aLoaderException = ::cppu::getCaughtException();
125 m_xDoc.set(xComponent, uno::UNO_QUERY);
133 uno::Exception aLoaderError;
134 OSL_VERIFY(aLoaderException >>= aLoaderError);
141 STR_COULD_NOT_LOAD_FILE,
"$filename$",
m_aFileName));
175 OConnection::disposing();
181 "com.sun.star.sdbc.Connection")
188 uno::Reference<sdbc::XDatabaseMetaData> xMetaData = m_xMetaData;
192 m_xMetaData = xMetaData;
201 uno::Reference<css::sdbcx::XTablesSupplier> xTab =
m_xCatalog;
220uno::Reference<sdbc::XPreparedStatement>
228 pStmt->construct(
sql);
233uno::Reference<sdbc::XPreparedStatement>
OUString SubstituteVariable(const OUString &rVar) const
OUString getResourceStringWithSubstitution(TranslateId pResId, const char *_pAsciiPatternToReplace, const OUString &_rStringToSubstitute) const
loads a string from the shared resource file, and replaces a given ASCII pattern with a given string
Prepared statement implementation for Writer tables and Calc sheets.
Statement implementation for Writer tables and Calc sheets.
css::uno::WeakReference< css::sdbcx::XTablesSupplier > m_xCatalog
OFileDriver * getDriver() const
OWriterConnection(ODriver *_pDriver)
css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString &sql) override
~OWriterConnection() override
rtl::Reference< CloseVetoButTerminateListener > m_xCloseVetoButTerminateListener
css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override
oslInterlockedCount m_nDocCount
css::uno::Reference< css::text::XTextDocument > m_xDoc
void SAL_CALL disposing() override
css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override
void construct(const OUString &rURL, const css::uno::Sequence< css::beans::PropertyValue > &rInfo) override
css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString &sql) override
css::uno::Reference< css::text::XTextDocument > const & acquireDoc()
OString exceptionToString(const css::uno::Any &caught)
#define SAL_WARN(area, stream)
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
IMPLEMENT_SERVICE_INFO(OWriterConnection, "com.sun.star.sdbc.drivers.writer.Connection", "com.sun.star.sdbc.Connection") uno
void checkDisposed(bool _bThrow)