From d3fbf3bebfaf75d94f08a6560d5f916932440280 Mon Sep 17 00:00:00 2001 From: Akash Shetye Date: Tue, 30 Jul 2013 08:08:13 +0530 Subject: Part 1 of Adding DB Data export Adding this skeleton for all the constructs for DB Data export Change-Id: I7510358af5f2ac92bd7f2ec7d1af4170ec8f763c --- sc/source/filter/excel/xedbdata.cxx | 86 +++++++++++++++++++++++++++++++++++++ sc/source/filter/inc/xedbdata.hxx | 81 ++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 sc/source/filter/excel/xedbdata.cxx create mode 100644 sc/source/filter/inc/xedbdata.hxx diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx new file mode 100644 index 000000000000..ebce789f3f35 --- /dev/null +++ b/sc/source/filter/excel/xedbdata.cxx @@ -0,0 +1,86 @@ +/* -*- 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 "xedbdata.hxx" +#include "document.hxx" + +XclExpXmlDBDataStyleInfo::XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, ScDBDataFormatting& rDBDataFormatting ) + : XclExpRoot( rRoot ) +{ +} + +void XclExpXmlDBDataStyleInfo::SaveXml( XclExpXmlStream& rStrm ) +{ +} + +// ============================================================================ +XclExpXmlDBDataColumn::XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int iID, OUString& rName ) + : XclExpRoot( rRoot ) +{ +} + +void XclExpXmlDBDataColumn::SaveXml( XclExpXmlStream& rStrm ) +{ +} + +// ============================================================================ +XclExpXmlDBDataColumns::XclExpXmlDBDataColumns( const XclExpRoot& rRoot, ScDBData& rDBData ) + : XclExpRoot( rRoot ) +{ +} + +void XclExpXmlDBDataColumns::SaveXml( XclExpXmlStream& rStrm ) +{ +} + +// ============================================================================ +XclExpXmlDBDataTable::XclExpXmlDBDataTable(const XclExpRoot& rRoot, ScDBData& rDBData ) + : XclExpRoot( rRoot ) +{ + maTableColumns.reset( new XclExpXmlDBDataColumns( rRoot, rDBData ) ); + ScDBDataFormatting aDBFormatting; + rDBData.GetTableFormatting( aDBFormatting ); + maStyleInfo.reset( new XclExpXmlDBDataStyleInfo( rRoot, aDBFormatting) ); +} +void XclExpXmlDBDataTable::SaveXml( XclExpXmlStream& rStrm ) +{ +} + +// ============================================================================= +XclExpXmlDBDataTables::XclExpXmlDBDataTables( const XclExpRoot& rRoot ) + : XclExpRoot( rRoot ) +{ + ScDBCollection* pDBCollection = rRoot.GetDoc().GetDBCollection(); + if( pDBCollection ) + { + ScDBCollection::NamedDBs& aNamedDBs = pDBCollection->getNamedDBs(); + ScDBCollection::NamedDBs::iterator itr = aNamedDBs.begin(); + ScDBCollection::NamedDBs::iterator itrEnd = aNamedDBs.end(); + for(; itr!= itrEnd; ++itr) + { + maDBDataTableContainer.push_back( new XclExpXmlDBDataTable( rRoot, *itr ) ); + ++miCount; + } + } +} + +void XclExpXmlDBDataTables::SaveXml( XclExpXmlStream& rStrm ) +{ +} +// ============================================================================= diff --git a/sc/source/filter/inc/xedbdata.hxx b/sc/source/filter/inc/xedbdata.hxx new file mode 100644 index 000000000000..d05b6836bd6a --- /dev/null +++ b/sc/source/filter/inc/xedbdata.hxx @@ -0,0 +1,81 @@ +/* -*- 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 SC_XEDBDATA_HXX +#define SC_ZEDBDATA_HXX + +#include "dbdata.hxx" +#include "xeroot.hxx" +#include "xerecord.hxx" +#include +#include +#include + +class XclExpXmlDBDataStyleInfo : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpXmlDBDataStyleInfo( const XclExpRoot& rRoot, ScDBDataFormatting& rDBDataFormatting ); + virtual void SaveXml( XclExpXmlStream& rStrm ); +}; +// =========================================================================== +class XclExpXmlDBDataColumn : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpXmlDBDataColumn( const XclExpRoot& rRoot, int iID, OUString& rName ); + virtual void SaveXml( XclExpXmlStream& rStrm ); +}; + +// =========================================================================== +class XclExpXmlDBDataColumns : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpXmlDBDataColumns( const XclExpRoot& rRoot, ScDBData& rDBData ); + virtual void SaveXml( XclExpXmlStream& rStrm ); +private: + typedef boost::ptr_vector< XclExpXmlDBDataColumn > DBDataColumnContainer; + DBDataColumnContainer maDBDataColumnContainer; + int miCount; +}; + +// ============================================================================ +class XclExpXmlDBDataTable : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpXmlDBDataTable( const XclExpRoot& rRoot, ScDBData& rDBData ); + virtual void SaveXml( XclExpXmlStream& rStrm ); +private: + typedef boost::scoped_ptr < XclExpXmlDBDataColumns > DBDataTableColumns; + typedef boost::scoped_ptr < XclExpXmlDBDataStyleInfo > DBDataStyleInfo; + DBDataTableColumns maTableColumns; + DBDataStyleInfo maStyleInfo; +}; + +// ============================================================================ +class XclExpXmlDBDataTables : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpXmlDBDataTables( const XclExpRoot& rRoot ); + virtual void SaveXml( XclExpXmlStream& rStrm ); +private: + typedef boost::ptr_vector< XclExpXmlDBDataTable > DBDataTableContainer; + DBDataTableContainer maDBDataTableContainer; + int miCount; +}; + +#endif -- cgit