diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/cite/ooo | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/cite/ooo')
-rw-r--r-- | src/cite/ooo/interface.cpp | 74 | ||||
-rw-r--r-- | src/cite/ooo/ooohandler.cpp | 16 | ||||
-rw-r--r-- | src/cite/ooo/ooohandler.h | 4 |
3 files changed, 47 insertions, 47 deletions
diff --git a/src/cite/ooo/interface.cpp b/src/cite/ooo/interface.cpp index 383ed1e..3e88852 100644 --- a/src/cite/ooo/interface.cpp +++ b/src/cite/ooo/interface.cpp @@ -33,7 +33,7 @@ #include <com/sun/star/sdbc/XResultSetUpdate.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XRowUpdate.hpp> -#include <com/sun/star/sdbc/SQLException.hpp> +#include <com/sun/star/sdbc/STQLException.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> @@ -122,7 +122,7 @@ bool OOOHandler::Interface::connect(const std::string& host_, int port_, const s } // Query for the XUnoUrlResolver interface - Reference<bridge::XUnoUrlResolver> rResolver(rInstance, UNO_QUERY); + Reference<bridge::XUnoUrlResolver> rResolver(rInstance, UNO_TQUERY); if(!rResolver.is()) { DEBUG("Error: Couldn't instantiate com.sun.star.bridge.UnoUrlResolver service"); return false; @@ -145,7 +145,7 @@ bool OOOHandler::Interface::connect(const std::string& host_, int port_, const s return false; } - m_gsmgr = Reference<lang::XMultiServiceFactory>(rInstance, UNO_QUERY); + m_gsmgr = Reference<lang::XMultiServiceFactory>(rInstance, UNO_TQUERY); if(m_gsmgr.is()) { DEBUG("Connected successfully to office"); } else { @@ -180,16 +180,16 @@ bool OOOHandler::Interface::createDocument() { // get the desktop service using createInstance, returns an XInterface type Reference<uno::XInterface> xInstance = m_gsmgr->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")); - Reference<frame::XDesktop> desktop(xInstance, UNO_QUERY); + Reference<frame::XDesktop> desktop(xInstance, UNO_TQUERY); Reference<lang::XComponent> writer = desktop->getCurrentComponent(); - Reference<lang::XServiceInfo> info(writer, UNO_QUERY); + Reference<lang::XServiceInfo> info(writer, UNO_TQUERY); if(info.is() && info->getImplementationName() == OUString::createFromAscii("SwXTextDocument")) { DEBUG("Document already open"); } else { DEBUG("Opening a new document"); //query for the XComponentLoader interface - Reference<frame::XComponentLoader> rComponentLoader(desktop, UNO_QUERY); + Reference<frame::XComponentLoader> rComponentLoader(desktop, UNO_TQUERY); if(!rComponentLoader.is()){ DEBUG("XComponentloader failed to instantiate"); return 0; @@ -203,16 +203,16 @@ bool OOOHandler::Interface::createDocument() { } //Manage many events with EventListener - Reference<document::XEventBroadcaster> eventBroadcast(writer, UNO_QUERY); + Reference<document::XEventBroadcaster> eventBroadcast(writer, UNO_TQUERY); m_listener = new EventListener(this); Reference<document::XEventListener> xEventListener = static_cast<document::XEventListener*>(m_listener); eventBroadcast->addEventListener(xEventListener); - Reference<frame::XController> controller = Reference<frame::XModel>(writer, UNO_QUERY)->getCurrentController(); - m_cursor = Reference<text::XTextViewCursorSupplier>(controller, UNO_QUERY)->getViewCursor(); - m_doc = Reference<text::XTextDocument>(writer, UNO_QUERY); + Reference<frame::XController> controller = Reference<frame::XModel>(writer, UNO_TQUERY)->getCurrentController(); + m_cursor = Reference<text::XTextViewCursorSupplier>(controller, UNO_TQUERY)->getViewCursor(); + m_doc = Reference<text::XTextDocument>(writer, UNO_TQUERY); if(m_doc.is()) { - m_dsmgr = Reference<lang::XMultiServiceFactory>(m_doc, UNO_QUERY); + m_dsmgr = Reference<lang::XMultiServiceFactory>(m_doc, UNO_TQUERY); } return m_doc.is(); } @@ -231,12 +231,12 @@ bool OOOHandler::Interface::updateBibliography() { } void OOOHandler::Interface::createBibliography() { - Reference<container::XIndexAccess> indexes(Reference<text::XDocumentIndexesSupplier>(m_doc, UNO_QUERY)->getDocumentIndexes(), UNO_QUERY); + Reference<container::XIndexAccess> indexes(Reference<text::XDocumentIndexesSupplier>(m_doc, UNO_TQUERY)->getDocumentIndexes(), UNO_TQUERY); for(int i = 0; i < indexes->getCount(); ++i) { - Reference<lang::XServiceInfo> info(indexes->getByIndex(i), UNO_QUERY); + Reference<lang::XServiceInfo> info(indexes->getByIndex(i), UNO_TQUERY); if(info->supportsService(OUSTR("com.sun.star.text.Bibliography"))) { DEBUG("Found existing bibliography..."); - m_bib = Reference<text::XDocumentIndex>(indexes->getByIndex(i), UNO_QUERY); + m_bib = Reference<text::XDocumentIndex>(indexes->getByIndex(i), UNO_TQUERY); break; } } @@ -244,18 +244,18 @@ void OOOHandler::Interface::createBibliography() { if(!m_bib.is()) { DEBUG("Creating new bibliography..."); Reference<text::XText> text = m_doc->getText(); - Reference<text::XTextRange> textRange(text->createTextCursor(), UNO_QUERY); - Reference<text::XTextCursor> cursor(textRange, UNO_QUERY); + Reference<text::XTextRange> textRange(text->createTextCursor(), UNO_TQUERY); + Reference<text::XTextCursor> cursor(textRange, UNO_TQUERY); cursor->gotoEnd(false); text->insertControlCharacter(textRange, text::ControlCharacter::PARAGRAPH_BREAK, false); - m_bib = Reference<text::XDocumentIndex>(m_dsmgr->createInstance(OUSTR("com.sun.star.text.Bibliography")), UNO_QUERY); - Reference<text::XTextContent> textContent(m_bib, UNO_QUERY); + m_bib = Reference<text::XDocumentIndex>(m_dsmgr->createInstance(OUSTR("com.sun.star.text.Bibliography")), UNO_TQUERY); + Reference<text::XTextContent> textContent(m_bib, UNO_TQUERY); text->insertTextContent(textRange, textContent, false); } } bool OOOHandler::Interface::insertCitations(Cite::Map& fields) { - Reference<text::XTextField> entry(m_dsmgr->createInstance(OUString::createFromAscii("com.sun.star.text.TextField.Bibliography")), UNO_QUERY); + Reference<text::XTextField> entry(m_dsmgr->createInstance(OUString::createFromAscii("com.sun.star.text.TextField.Bibliography")), UNO_TQUERY); if(!entry.is()) { DEBUG("Interface::insertCitation - can't create TextField"); return false; @@ -266,12 +266,12 @@ bool OOOHandler::Interface::insertCitations(Cite::Map& fields) { values[i] = propValue(it->first, it->second); std::cout << "Setting " << OU2O(values[i].Name) << " = " << it->second << std::endl; } - Reference<beans::XPropertySet>(entry, UNO_QUERY)->setPropertyValue(OUSTR("Fields"), Any(values)); + Reference<beans::XPropertySet>(entry, UNO_TQUERY)->setPropertyValue(OUSTR("Fields"), Any(values)); Reference<text::XText> text = m_doc->getText(); - Reference<text::XTextCursor> cursor = text->createTextCursorByRange(Reference<text::XTextRange>(m_cursor, UNO_QUERY)); - Reference<text::XTextRange> textRange(cursor, UNO_QUERY); - Reference<text::XTextContent> textContent(entry, UNO_QUERY); + Reference<text::XTextCursor> cursor = text->createTextCursorByRange(Reference<text::XTextRange>(m_cursor, UNO_TQUERY)); + Reference<text::XTextRange> textRange(cursor, UNO_TQUERY); + Reference<text::XTextContent> textContent(entry, UNO_TQUERY); text->insertTextContent(textRange, textContent, false); return true; } @@ -336,13 +336,13 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { return false; } - Reference<sdbc::XRowSet> rowSet(interface, UNO_QUERY); + Reference<sdbc::XRowSet> rowSet(interface, UNO_TQUERY); if(!rowSet.is()) { DEBUG("Could not create rowset interface"); return false; } - Reference<beans::XPropertySet> props(rowSet, UNO_QUERY); + Reference<beans::XPropertySet> props(rowSet, UNO_TQUERY); props->setPropertyValue(OUSTR("DataSourceName"), Any(OUSTR("Bibliography"))); props->setPropertyValue(OUSTR("CommandType"), Any(sdb::CommandType::COMMAND)); OUString s = OUSTR("SELECT COUNT(*) FROM \"biblio\" WHERE identifier='") + O2OU(fields["Identifier"]) + OUSTR("'"); @@ -350,9 +350,9 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { try { rowSet->execute(); - } catch(sdbc::SQLException& e) { + } catch(sdbc::STQLException& e) { DEBUG(OU2O(s)); - DEBUG(OUSTR("SQL error - ") + e.SQLState); + DEBUG(OUSTR("SQL error - ") + e.STQLState); return false; } catch(Exception& e) { DEBUG(OU2O(s)); @@ -360,7 +360,7 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { return false; } - Reference<sdbc::XRow> row(rowSet, UNO_QUERY); + Reference<sdbc::XRow> row(rowSet, UNO_TQUERY); int count = 0; if(rowSet->next()) { count = row->getString(1).toInt32(); @@ -380,9 +380,9 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { try { rowSet->execute(); - } catch(sdbc::SQLException& e) { + } catch(sdbc::STQLException& e) { DEBUG(OU2O(s)); - DEBUG(OUSTR("SQL error(2) - ") + e.SQLState); + DEBUG(OUSTR("SQL error(2) - ") + e.STQLState); return false; } catch(Exception& e) { DEBUG(OU2O(s)); @@ -390,12 +390,12 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { return false; } - Reference<sdbc::XResultSet> resultSet(rowSet, UNO_QUERY); - Reference<sdbc::XResultSetMetaDataSupplier> mdSupplier(resultSet, UNO_QUERY); + Reference<sdbc::XResultSet> resultSet(rowSet, UNO_TQUERY); + Reference<sdbc::XResultSetMetaDataSupplier> mdSupplier(resultSet, UNO_TQUERY); Reference<sdbc::XResultSetMetaData> metaData = mdSupplier->getMetaData(); - Reference<sdbc::XRowUpdate> rowUpdate(rowSet, UNO_QUERY); - Reference<sdbc::XResultSetUpdate> update(rowSet, UNO_QUERY); + Reference<sdbc::XRowUpdate> rowUpdate(rowSet, UNO_TQUERY); + Reference<sdbc::XResultSetUpdate> update(rowSet, UNO_TQUERY); if(count > 0) { resultSet->last(); } else { @@ -412,8 +412,8 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { std::cout << s << " = " << value << std::endl; try { rowUpdate->updateString(i, O2OU(value)); - } catch(sdbc::SQLException& e) { - DEBUG(OUSTR("SQL error(3) - ") + e.SQLState); + } catch(sdbc::STQLException& e) { + DEBUG(OUSTR("SQL error(3) - ") + e.STQLState); } catch(Exception& e) { DEBUG(OUSTR("General error(3) - ") + e.Message); } @@ -425,6 +425,6 @@ bool OOOHandler::Interface::insertRecords(Cite::Map& fields) { update->insertRow(); } - Reference<lang::XComponent>(rowSet, UNO_QUERY)->dispose(); + Reference<lang::XComponent>(rowSet, UNO_TQUERY)->dispose(); return true; } diff --git a/src/cite/ooo/ooohandler.cpp b/src/cite/ooo/ooohandler.cpp index 1741896..d36b3e4 100644 --- a/src/cite/ooo/ooohandler.cpp +++ b/src/cite/ooo/ooohandler.cpp @@ -26,13 +26,13 @@ using Tellico::Cite::OOOHandler; Tellico::Cite::Map OOOHandler::s_fieldsMap; /* -QString OOOHandler::OUString2Q(const rtl::OUString& str) { +TQString OOOHandler::OUString2Q(const rtl::OUString& str) { const uint len = str.getLength(); - QChar* uni = new QChar[len + 1]; + TQChar* uni = new TQChar[len + 1]; const sal_Unicode* ouPtr = str.getStr(); const sal_Unicode* ouEnd = ouPtr + len; - QChar* qPtr = uni; + TQChar* qPtr = uni; while (ouPtr != ouEnd) { *(qPtr++) = *(ouPtr++); @@ -40,22 +40,22 @@ QString OOOHandler::OUString2Q(const rtl::OUString& str) { *qPtr = 0; - QString ret(uni, len); + TQString ret(uni, len); delete[] uni; return ret; } -rtl::OUString OOOHandler::QString2OU(const QString& str) { +rtl::OUString OOOHandler::TQString2OU(const TQString& str) { const uint len = str.length(); sal_Unicode* uni = new sal_Unicode[len + 1]; - const QChar* qPtr = str.unicode(); - const QChar* qEnd = qPtr + len; + const TQChar* qPtr = str.tqunicode(); + const TQChar* qEnd = qPtr + len; sal_Unicode* uPtr = uni; while (qPtr != qEnd) { - *(uPtr++) = (*(qPtr++)).unicode(); + *(uPtr++) = (*(qPtr++)).tqunicode(); } *uPtr = 0; diff --git a/src/cite/ooo/ooohandler.h b/src/cite/ooo/ooohandler.h index fd7f308..695794d 100644 --- a/src/cite/ooo/ooohandler.h +++ b/src/cite/ooo/ooohandler.h @@ -35,8 +35,8 @@ public: virtual bool cite(Cite::Map& fields); private: -// static QString OUString2Q(const rtl::OUString& str); -// static rtl::OUString QString2OU(const QString& str); +// static TQString OUString2Q(const rtl::OUString& str); +// static rtl::OUString TQString2OU(const TQString& str); static Cite::Map s_fieldsMap; static void buildFieldsMap(); |