diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-19 15:57:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-07-19 19:53:20 +0200 |
commit | d3d9292a0fb414e6721b2f3b12b7e283caed946d (patch) | |
tree | 99c7fef8485f878f39a1ec55dbd607d4189187a6 /connectivity | |
parent | 196ee66d4aab62678a8cfb762379909bdda16051 (diff) |
connectivity: merge OCalcColumns and OWriterColumns
Turns out createObject() only needs the base class OFileTable, and then
these can be shared.
Change-Id: I6e8a83155dbbbc3d85794e190c2e710d01902017
Reviewed-on: https://gerrit.libreoffice.org/40183
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/Library_calc.mk | 1 | ||||
-rw-r--r-- | connectivity/Library_file.mk | 1 | ||||
-rw-r--r-- | connectivity/Library_writer.mk | 1 | ||||
-rw-r--r-- | connectivity/source/drivers/calc/CTable.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/component/CColumns.cxx (renamed from connectivity/source/drivers/calc/CColumns.cxx) | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WColumns.cxx | 48 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WTable.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/component/CColumns.hxx (renamed from connectivity/source/inc/calc/CColumns.hxx) | 13 | ||||
-rw-r--r-- | connectivity/source/inc/writer/WColumns.hxx | 46 |
9 files changed, 17 insertions, 112 deletions
diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk index 30e16d29a3d2..5f734f8c2401 100644 --- a/connectivity/Library_calc.mk +++ b/connectivity/Library_calc.mk @@ -41,7 +41,6 @@ $(eval $(call gb_Library_use_libraries,calc,\ $(eval $(call gb_Library_add_exception_objects,calc,\ 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 30cd6ae6a97a..9a36e1a21e2e 100644 --- a/connectivity/Library_file.mk +++ b/connectivity/Library_file.mk @@ -41,6 +41,7 @@ $(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 \ diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk index 4fab8bf043d9..d07f572a3227 100644 --- a/connectivity/Library_writer.mk +++ b/connectivity/Library_writer.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Library_use_libraries,writer,\ $(eval $(call gb_Library_add_exception_objects,writer,\ connectivity/source/drivers/writer/WCatalog \ - connectivity/source/drivers/writer/WColumns \ connectivity/source/drivers/writer/WConnection \ connectivity/source/drivers/writer/WDatabaseMetaData \ connectivity/source/drivers/writer/WDriver \ diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index f1d7d7f17b7c..73c73c1327bd 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/writer/WColumns.cxx b/connectivity/source/drivers/writer/WColumns.cxx deleted file mode 100644 index 73945b9e2ca8..000000000000 --- a/connectivity/source/drivers/writer/WColumns.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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/WColumns.hxx" - -#include <connectivity/sdbcx/VColumn.hxx> - -#include "writer/WTable.hxx" - -using namespace ::com::sun::star; - -namespace connectivity -{ -namespace writer -{ - -sdbcx::ObjectType OWriterColumns::createObject(const OUString& _rName) -{ - OWriterTable* pTable = static_cast<OWriterTable*>(m_pTable); - ::rtl::Reference<OSQLColumns> aCols = pTable->getTableColumns(); - - OSQLColumns::Vector::const_iterator aIter = find(aCols->get().begin(),aCols->get().end(),_rName,::comphelper::UStringMixEqual(isCaseSensitive())); - sdbcx::ObjectType xRet; - if (aIter != aCols->get().end()) - xRet = sdbcx::ObjectType(*aIter, uno::UNO_QUERY); - return xRet; -} - -} // 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 index 9c558701a1e1..1562059379bc 100644 --- a/connectivity/source/drivers/writer/WTable.cxx +++ b/connectivity/source/drivers/writer/WTable.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/text/XText.hpp> #include <svl/converter.hxx> #include "writer/WConnection.hxx" -#include "writer/WColumns.hxx" +#include "component/CColumns.hxx" #include <connectivity/sdbcx/VColumn.hxx> #include <rtl/ustrbuf.hxx> #include <osl/thread.h> @@ -231,7 +231,7 @@ void OWriterTable::refreshColumns() if (m_pColumns) m_pColumns->reFill(aVector); else - m_pColumns = new OWriterColumns(this, m_aMutex, aVector); + m_pColumns = new component::OComponentColumns(this, m_aMutex, aVector); } void OWriterTable::refreshIndexes() 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/writer/WColumns.hxx b/connectivity/source/inc/writer/WColumns.hxx deleted file mode 100644 index 8b59851999eb..000000000000 --- a/connectivity/source/inc/writer/WColumns.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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_WCOLUMNS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCOLUMNS_HXX - -#include "file/FColumns.hxx" - -namespace connectivity -{ -namespace writer -{ -class OWriterColumns : public file::OColumns -{ -protected: - virtual sdbcx::ObjectType createObject(const OUString& _rName) override; -public: - OWriterColumns(file::OFileTable* _pTable, - ::osl::Mutex& _rMutex, - const TStringVector& _rVector - ) : file::OColumns(_pTable,_rMutex,_rVector) - {} - -}; -} -} - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCOLUMNS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |