Kaydet (Commit) d3d9292a authored tarafından Miklos Vajna's avatar Miklos Vajna

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/40183Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 196ee66d
......@@ -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 \
......
......@@ -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 \
......
......@@ -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 \
......
......@@ -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()
......
......@@ -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;
......
/* -*- 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: */
......@@ -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()
......
......@@ -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: */
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment