From 4073bc15d1aa1b46b2e0953d6316f2ab6a23dc87 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 19 Jul 2017 14:31:13 +0200 Subject: connectivity: merge OCalcStatement and OWriterStatement Into a single OComponentStatement, as both of them just provide statement functionality based on a file loaded into an LO component, so they can share code. Change-Id: Iad2852f93783ec3c4a672f4b86424b4aa0ae8eaf Reviewed-on: https://gerrit.libreoffice.org/40181 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- connectivity/Library_calc.mk | 1 - connectivity/Library_file.mk | 1 + connectivity/Library_writer.mk | 1 - connectivity/source/drivers/calc/CConnection.cxx | 4 +- connectivity/source/drivers/calc/CStatement.cxx | 34 ---------------- .../source/drivers/component/CStatement.cxx | 34 ++++++++++++++++ connectivity/source/drivers/writer/WConnection.cxx | 6 +-- connectivity/source/drivers/writer/WStatement.cxx | 40 ------------------- connectivity/source/inc/calc/CStatement.hxx | 43 --------------------- connectivity/source/inc/component/CStatement.hxx | 44 +++++++++++++++++++++ connectivity/source/inc/writer/WStatement.hxx | 45 ---------------------- 11 files changed, 83 insertions(+), 170 deletions(-) delete mode 100644 connectivity/source/drivers/calc/CStatement.cxx create mode 100644 connectivity/source/drivers/component/CStatement.cxx delete mode 100644 connectivity/source/drivers/writer/WStatement.cxx delete mode 100644 connectivity/source/inc/calc/CStatement.hxx create mode 100644 connectivity/source/inc/component/CStatement.hxx delete mode 100644 connectivity/source/inc/writer/WStatement.hxx (limited to 'connectivity') diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk index 441f0305de9e..5a3a206b12b7 100644 --- a/connectivity/Library_calc.mk +++ b/connectivity/Library_calc.mk @@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,calc,\ )) $(eval $(call gb_Library_add_exception_objects,calc,\ - connectivity/source/drivers/calc/CStatement \ connectivity/source/drivers/calc/CPreparedStatement \ connectivity/source/drivers/calc/CDatabaseMetaData \ connectivity/source/drivers/calc/CCatalog \ diff --git a/connectivity/Library_file.mk b/connectivity/Library_file.mk index 57f9ff733166..fec48e2e966c 100644 --- a/connectivity/Library_file.mk +++ b/connectivity/Library_file.mk @@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_libraries,file,\ $(eval $(call gb_Library_add_exception_objects,file,\ 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 index dd74110c824a..c5cd2ddf3979 100644 --- a/connectivity/Library_writer.mk +++ b/connectivity/Library_writer.mk @@ -43,7 +43,6 @@ $(eval $(call gb_Library_add_exception_objects,writer,\ connectivity/source/drivers/writer/WDatabaseMetaData \ connectivity/source/drivers/writer/WDriver \ connectivity/source/drivers/writer/WPreparedStatement \ - connectivity/source/drivers/writer/WStatement \ connectivity/source/drivers/writer/WTable \ connectivity/source/drivers/writer/WTables \ connectivity/source/drivers/writer/Wservices \ diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index 17c50c4c0c95..8ae8ca2be690 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -28,7 +28,7 @@ #include #include #include "calc/CPreparedStatement.hxx" -#include "calc/CStatement.hxx" +#include "component/CStatement.hxx" #include #include #include @@ -237,7 +237,7 @@ Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) 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; } diff --git a/connectivity/source/drivers/calc/CStatement.cxx b/connectivity/source/drivers/calc/CStatement.cxx deleted file mode 100644 index f826642f566d..000000000000 --- a/connectivity/source/drivers/calc/CStatement.cxx +++ /dev/null @@ -1,34 +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 "calc/CStatement.hxx" -#include "component/CResultSet.hxx" - -using namespace connectivity::calc; -using namespace connectivity::file; -using namespace com::sun::star::uno; - -OResultSet* OCalcStatement::createResultSet() -{ - return new connectivity::component::OComponentResultSet(this,m_aSQLIterator); -} - -IMPLEMENT_SERVICE_INFO(OCalcStatement,"com.sun.star.sdbc.driver.calc.Statement","com.sun.star.sdbc.Statement"); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/component/CStatement.cxx b/connectivity/source/drivers/component/CStatement.cxx new file mode 100644 index 000000000000..a83ff8587e20 --- /dev/null +++ b/connectivity/source/drivers/component/CStatement.cxx @@ -0,0 +1,34 @@ +/* -*- 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 "component/CStatement.hxx" +#include "component/CResultSet.hxx" + +using namespace connectivity::component; +using namespace connectivity::file; +using namespace com::sun::star::uno; + +OResultSet* OComponentStatement::createResultSet() +{ + return new connectivity::component::OComponentResultSet(this,m_aSQLIterator); +} + +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/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx index ff2710cedb59..cede5fe96b93 100644 --- a/connectivity/source/drivers/writer/WConnection.cxx +++ b/connectivity/source/drivers/writer/WConnection.cxx @@ -28,14 +28,12 @@ #include #include #include "writer/WPreparedStatement.hxx" -#include "writer/WStatement.hxx" +#include "component/CStatement.hxx" #include #include #include #include -using namespace connectivity::file; - typedef connectivity::file::OConnection OConnection_BASE; using namespace ::com::sun::star; @@ -225,7 +223,7 @@ uno::Reference< sdbc::XStatement > SAL_CALL OWriterConnection::createStatement() ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - uno::Reference xReturn = new OWriterStatement(this); + uno::Reference xReturn = new component::OComponentStatement(this); m_aStatements.push_back(uno::WeakReferenceHelper(xReturn)); return xReturn; } diff --git a/connectivity/source/drivers/writer/WStatement.cxx b/connectivity/source/drivers/writer/WStatement.cxx deleted file mode 100644 index fcb9c8a4f28a..000000000000 --- a/connectivity/source/drivers/writer/WStatement.cxx +++ /dev/null @@ -1,40 +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/WStatement.hxx" -#include "component/CResultSet.hxx" - -using namespace com::sun::star; - -namespace connectivity -{ -namespace writer -{ - -file::OResultSet* OWriterStatement::createResultSet() -{ - return new component::OComponentResultSet(this, m_aSQLIterator); -} - -IMPLEMENT_SERVICE_INFO(OWriterStatement, "com.sun.star.sdbc.driver.writer.Statement", "com.sun.star.sdbc.Statement"); - -} // namespace writer -} // namespace connectivity - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/calc/CStatement.hxx b/connectivity/source/inc/calc/CStatement.hxx deleted file mode 100644 index e9a3d552eab0..000000000000 --- a/connectivity/source/inc/calc/CStatement.hxx +++ /dev/null @@ -1,43 +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_CALC_CSTATEMENT_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX - -#include "file/FStatement.hxx" - -namespace connectivity -{ - namespace calc - { - class OConnection; - class OCalcStatement : public file::OStatement - { - protected: - virtual file::OResultSet* createResultSet() override; - public: - OCalcStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; - } -} - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/component/CStatement.hxx b/connectivity/source/inc/component/CStatement.hxx new file mode 100644 index 000000000000..695d92a4e225 --- /dev/null +++ b/connectivity/source/inc/component/CStatement.hxx @@ -0,0 +1,44 @@ +/* -*- 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_COMPONENT_CSTATEMENT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX + +#include "file/FStatement.hxx" + +namespace connectivity +{ + namespace component + { + class OConnection; + /// Statement implementation for Writer tables and Calc sheets. + class OOO_DLLPUBLIC_FILE OComponentStatement : public file::OStatement + { + protected: + virtual file::OResultSet* createResultSet() override; + public: + OComponentStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/writer/WStatement.hxx b/connectivity/source/inc/writer/WStatement.hxx deleted file mode 100644 index 3781cb5eb8c3..000000000000 --- a/connectivity/source/inc/writer/WStatement.hxx +++ /dev/null @@ -1,45 +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_WSTATEMENT_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WSTATEMENT_HXX - -#include "file/FStatement.hxx" - -namespace connectivity -{ -namespace writer -{ - -class OConnection; -class OWriterStatement : public file::OStatement -{ -protected: - virtual file::OResultSet* createResultSet() override; -public: - OWriterStatement(file::OConnection* _pConnection) : file::OStatement(_pConnection) {} - DECLARE_SERVICE_INFO(); -}; - -} // namespace writer -} // namespace connectivity - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WSTATEMENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit