Commit d8f34224 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - pilot tables

parent dfe4541f
......@@ -212,6 +212,11 @@ SOURCES += \
../src/odf/datatypes/xlink.cpp \
../src/odf/datatypes/chartlabelposition.cpp \
../src/odf/datatypes/grandtotal.cpp \
../src/odf/datatypes/membertype.cpp \
../src/odf/datatypes/tabletype.cpp \
../src/odf/datatypes/tableorientation.cpp \
../src/odf/datatypes/tablefunction.cpp \
../src/odf/datatypes/tableorder.cpp \
../src/docx/xlsx_conditionalFormatting.cpp \
../src/docx/xlsx_dxfs.cpp \
../src/docx/docx_content_type.cpp \
......
......@@ -121,3 +121,8 @@
#include "../src/odf/datatypes/xlink.cpp"
#include "../src/odf/datatypes/chartlabelposition.cpp"
#include "../src/odf/datatypes/grandtotal.cpp"
#include "../src/odf/datatypes/membertype.cpp"
#include "../src/odf/datatypes/tabletype.cpp"
#include "../src/odf/datatypes/tableorientation.cpp"
#include "../src/odf/datatypes/tablefunction.cpp"
#include "../src/odf/datatypes/tableorder.cpp"
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "membertype.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const member_type & _Val)
{
switch(_Val.get_type())
{
case member_type::named:
_Wostream << L"named";
break;
case member_type::next:
_Wostream << L"next";
break;
case member_type::previous:
_Wostream << L"previous";
break;
}
return _Wostream;
}
member_type member_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"named")
return member_type( named );
else if (tmp == L"next")
return member_type( next );
else if (tmp == L"previous")
return member_type( previous );
else
{
return member_type( named );
}
}
} }
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class member_type
{
public:
enum type
{
named,
next,
previous
};
member_type() {}
member_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static member_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const member_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::member_type);
}
......@@ -74,7 +74,6 @@ table_align table_align::parse(const std::wstring & Str)
return table_align( Margins );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return table_align( Left );
}
}
......
......@@ -29,12 +29,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _CPDOCCORE_ODF_TABLEALIGN_H_
#define _CPDOCCORE_ODF_TABLEALIGN_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -78,5 +74,3 @@ std::wostream & operator << (std::wostream & _Wostream, const table_align & _Val
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_align);
}
#endif
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "tablefunction.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_function & _Val)
{
switch(_Val.get_type())
{
case table_function::Auto:
_Wostream << L"auto";
break;
case table_function::average:
_Wostream << L"average";
break;
case table_function::count:
_Wostream << L"count";
break;
case table_function::countnums:
_Wostream << L"countnums";
break;
case table_function::max:
_Wostream << L"max";
break;
case table_function::min:
_Wostream << L"min";
break;
case table_function::product:
_Wostream << L"product";
break;
case table_function::stdev:
_Wostream << L"stdev";
break;
case table_function::stdevp:
_Wostream << L"stdevp";
break;
case table_function::sum:
_Wostream << L"sum";
break;
case table_function::var:
_Wostream << L"var";
break;
case table_function::varp:
_Wostream << L"varp";
break;
default:
_Wostream << _Val.get_string();
break;
}
return _Wostream;
}
table_function table_function::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"auto")
return table_function( Auto );
else if (tmp == L"average")
return table_function( average );
else if (tmp == L"count")
return table_function( count );
else if (tmp == L"countnums")
return table_function( countnums );
else if (tmp == L"max")
return table_function( max );
else if (tmp == L"min")
return table_function( min );
else if (tmp == L"product")
return table_function( product );
else if (tmp == L"stdev")
return table_function( stdev );
else if (tmp == L"stdevp")
return table_function( stdevp );
else if (tmp == L"sum")
return table_function( sum );
else if (tmp == L"var")
return table_function( var );
else if (tmp == L"varp")
return table_function( varp );
else
{
return table_function( String, Str );
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_function
{
public:
enum type
{
Auto,
average,
count,
countnums,
max,
min,
product,
stdev,
stdevp,
sum,
var,
varp,
String
};
table_function() {}
table_function(type _Type, std::wstring _string = L"") : type_(_Type), string_(_string)
{}
type get_type() const
{
return type_;
};
std::wstring get_string() const
{
return string_;
};
static table_function parse(const std::wstring & Str);
private:
type type_;
std::wstring string_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_function & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_function);
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "tableorder.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_order & _Val)
{
switch(_Val.get_type())
{
case table_order::ascending:
_Wostream << L"ascending";
break;
case table_order::descending:
_Wostream << L"descending";
break;
default:
_Wostream << L"ascending";
break;
}
return _Wostream;
}
table_order table_order::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"ascending")
return table_order( ascending);
else if (tmp == L"descending")
return table_order( descending );
else
{
return table_order( ascending );
}
}
} }
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_order
{
public:
enum type
{
ascending,
descending
};
table_order() {}
table_order(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_order parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_order & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_order);
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "tableorientation.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_orientation & _Val)
{
switch(_Val.get_type())
{
case table_orientation::column:
_Wostream << L"column";
break;
case table_orientation::data:
_Wostream << L"data";
break;
case table_orientation::hidden:
_Wostream << L"hidden";
break;
case table_orientation::page:
_Wostream << L"page";
break;
default:
_Wostream << L"row";
break;
}
return _Wostream;
}
table_orientation table_orientation::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"column")
return table_orientation( column );
else if (tmp == L"data")
return table_orientation( data );
else if (tmp == L"hidden")
return table_orientation( hidden );
else if (tmp == L"page")
return table_orientation( page );
else
{
return table_orientation( row );
}
}
} }
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_orientation
{
public:
enum type
{
column,
data,
hidden,
page,
row
};
table_orientation() {}
table_orientation(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_orientation parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_orientation & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_orientation);
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "tabletype.h"
#include <boost/algorithm/string.hpp>
#include <ostream>
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const table_type & _Val)
{
switch(_Val.get_type())
{
case table_type::none:
_Wostream << L"none";
break;
case table_type::member_difference:
_Wostream << L"member-difference";
break;
case table_type::member_percentage:
_Wostream << L"member-percentage";
break;
case table_type::member_percentage_difference:
_Wostream << L"member-percentage-difference";
break;
case table_type::running_total:
_Wostream << L"running-total";
break;
case table_type::row_percentage:
_Wostream << L"row-percentage";
break;
case table_type::column_percentage:
_Wostream << L"column-percentage";
break;
case table_type::total_percentage:
_Wostream << L"total-percentage";
break;
default:
_Wostream << L"index";
break;
}
return _Wostream;
}
table_type table_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"none")
return table_type( none );
else if (tmp == L"member-difference")
return table_type( member_difference );
else if (tmp == L"member-percentage")
return table_type( member_percentage );
else if (tmp == L"member-percentage-difference")
return table_type( member_percentage_difference );
else if (tmp == L"running-total")
return table_type( running_total );
else if (tmp == L"row-percentage")
return table_type( row_percentage );
else if (tmp == L"column-percentage")
return table_type( column_percentage );
else if (tmp == L"total-percentage")
return table_type( total_percentage );
else
{
return table_type( index );
}
}
} }
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf_types {
class table_type
{
public:
enum type
{
none,
member_difference,
member_percentage,
member_percentage_difference,
running_total,
row_percentage,
column_percentage,
total_percentage,
index
};
table_type() {}
table_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static table_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const table_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::table_type);
}
......@@ -206,6 +206,12 @@ enum ElementType
typeTableSort,
typeTableSortBy,
typeTableFilter,
typeTableFilterAnd,
typeTableFilterOr,
typeTableFilterCondition,
typeTableFilterSetItem,
typeTableTable,
typeTableTableColumn,
typeTableTableColumns,
......@@ -223,11 +229,23 @@ enum ElementType
typeTableDataPilotTables,
typeTableDataPilotTable,
typeTableDataPilotField,
typeTableDataPilotFieldReference,
typeTableDatabaseSourceTable,
typeTableDatabaseSourceQuery,
typeTableDatabaseSourceSql,
typeTableSourceCellRange,
typeTableSourceService,
typeTableDataPilotSubtotals,
typeTableDataPilotSubtotal,
typeTableDataPilotGroupMember,
typeTableDataPilotMember,
typeTableDataPilotMembers,
typeTableDataPilotGroup,
typeTableDataPilotGroups,
typeTableDataPilotLevel,
typeTableDataSortInfo,
typeTableDataDisplayInfo,
typeTableDataLayoutInfo,
typeOfficeBody,
typeOfficeText,
......
......@@ -41,11 +41,11 @@
#include <cpdoccore/odf/odf_document.h>
namespace cpdoccore {
namespace odf_reader {
using namespace odf_types;
namespace odf_reader {
// table:table-source
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_database_ranges::ns = L"table";
const wchar_t * table_database_ranges::name = L"database-ranges";
......@@ -66,8 +66,7 @@ void table_database_ranges::xlsx_convert(oox::xlsx_conversion_context & Context)
}
}
// table:named-range
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_database_range::ns = L"table";
const wchar_t * table_database_range::name = L"database-range";
......@@ -96,7 +95,7 @@ void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
if (table_orientation_)
Context.get_table_context().set_database_orientation(*table_orientation_ == L"row" ? true : false);
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
if (table_contains_header_)
Context.get_table_context().set_database_header(table_contains_header_->get());
......@@ -109,8 +108,7 @@ void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_table_context().end_database_range();
}
// table:sort
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_sort::ns = L"table";
const wchar_t * table_sort::name = L"sort";
......@@ -118,25 +116,24 @@ void table_sort::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
if (L"table" == Ns && L"sort-by" == Name)
{
CP_CREATE_ELEMENT(table_sort_by_);
CP_CREATE_ELEMENT(content_);
}
}
void table_sort::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < table_sort_by_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
table_sort_by * sort_by = dynamic_cast<table_sort_by*>(table_sort_by_[i].get());
table_sort_by * sort_by = dynamic_cast<table_sort_by*>(content_[i].get());
int descending = 1;
if ((sort_by->table_order_) && (sort_by->table_order_.get() == L"descending"))
if ((sort_by->table_order_) && (sort_by->table_order_->get_type() == table_order::descending))
descending = 2;
Context.get_table_context().add_database_sort(sort_by->table_field_number_, descending);
}
}
// table:sort-by
//////////////////////////////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------------------------------
const wchar_t * table_sort_by::ns = L"table";
const wchar_t * table_sort_by::name = L"sort-by";
......@@ -147,6 +144,98 @@ void table_sort_by::add_attributes(xml::attributes_wc_ptr const & Attributes)
CP_APPLY_ATTR(L"table:order" , table_order_);
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter::ns = L"table";
const wchar_t * table_filter::name = L"filter";
void table_filter::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:condition-source", table_condition_source_);
CP_APPLY_ATTR(L"table:condition-source-range-address", table_condition_source_range_address_);
CP_APPLY_ATTR(L"table:display-duplicates", table_display_duplicates_);
CP_APPLY_ATTR(L"table:target-range-address", table_target_range_address_);
}
void table_filter::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_or::ns = L"table";
const wchar_t * table_filter_or::name = L"filter-or";
void table_filter_or::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_or::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_and::ns = L"table";
const wchar_t * table_filter_and::name = L"filter-and";
void table_filter_and::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_and::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_condition::ns = L"table";
const wchar_t * table_filter_condition::name = L"filter-condition";
void table_filter_condition::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:case-sensitive", table_case_sensitive_);
CP_APPLY_ATTR(L"table:data-type", table_data_type_);
CP_APPLY_ATTR(L"table:field-number", table_field_number_);
CP_APPLY_ATTR(L"table:operator", table_operator_);
CP_APPLY_ATTR(L"table:value", table_value_);
}
void table_filter_condition::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void table_filter_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
}
//--------------------------------------------------------------------------------------------------
const wchar_t * table_filter_set_item::ns = L"table";
const wchar_t * table_filter_set_item::name = L"filter-set-item";
void table_filter_set_item::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:value", table_value_);
}
void table_filter_set_item::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
}
}
......@@ -40,14 +40,14 @@
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/tableorientation.h"
#include "datatypes/tableorder.h"
#include "../docx/xlsxconversioncontext.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_reader {
// table:named-expressions
class table_database_ranges : public office_element_impl<table_database_ranges>
{
public:
......@@ -68,8 +68,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_ranges);
//-------------------------------------------------------------------------------------------------------------
// table:named-range
class table_database_range: public office_element_impl<table_database_range>
{
public:
......@@ -85,11 +85,11 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_target_range_address_;
_CP_OPT(Bool) table_display_filter_buttons_;
_CP_OPT(Bool) table_contains_header_;
_CP_OPT(std::wstring) table_orientation_;
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_target_range_address_;
_CP_OPT(odf_types::Bool) table_display_filter_buttons_;
_CP_OPT(odf_types::Bool) table_contains_header_;
_CP_OPT(odf_types::table_orientation) table_orientation_;
//table:refresh-delay
office_element_ptr_array content_;
......@@ -99,8 +99,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_database_range);
//-------------------------------------------------------------------------------------------------------------
// table:sort
class table_sort: public office_element_impl<table_sort>
{
public:
......@@ -116,7 +116,7 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array table_sort_by_;
office_element_ptr_array content_;
//attr
//table:algorithm
//table:country
......@@ -125,8 +125,8 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_sort);
//-------------------------------------------------------------------------------------------------------------
// table:sort-by
class table_sort_by: public office_element_impl<table_sort_by>
{
public:
......@@ -140,11 +140,124 @@ public:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
int table_field_number_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(std::wstring) table_order_;
int table_field_number_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(odf_types::table_order) table_order_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_sort_by);
//-------------------------------------------------------------------------------------------------------------
class table_filter: public office_element_impl<table_filter>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilter;
CPDOCCORE_DEFINE_VISITABLE()
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_condition_source_; //self or cell-range.
_CP_OPT(std::wstring) table_condition_source_range_address_; //cellRangeAddress
_CP_OPT(odf_types::Bool) table_display_duplicates_;
_CP_OPT(std::wstring) table_target_range_address_;//cellRangeAddress
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter);
//------------------------------------------------------------------------------
class table_filter_and: public office_element_impl<table_filter_and>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterAnd;
CPDOCCORE_DEFINE_VISITABLE()
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_and);
//-------------------------------------------------------------------------------------------------------------
class table_filter_or: public office_element_impl<table_filter_or>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterOr;
CPDOCCORE_DEFINE_VISITABLE()
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_or);
//-------------------------------------------------------------------------------------------------------------
class table_filter_condition: public office_element_impl<table_filter_condition>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterCondition;
CPDOCCORE_DEFINE_VISITABLE()
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_case_sensitive_;
_CP_OPT(std::wstring) table_data_type_;
_CP_OPT(unsigned int) table_field_number_;
_CP_OPT(std::wstring) table_operator_;
_CP_OPT(std::wstring) table_value_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_condition);
//-------------------------------------------------------------------------------------------------------------
class table_filter_set_item: public office_element_impl<table_filter_set_item>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableFilterSetItem;
CPDOCCORE_DEFINE_VISITABLE()
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
_CP_OPT(std::wstring) table_value_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_filter_set_item);
//-------------------------------------------------------------------------------------------------------------
}
}
......@@ -697,6 +697,14 @@
RelativePath="..\src\odf\datatypes\mathvariant.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\membertype.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\membertype.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\noteclass.cpp"
>
......@@ -909,6 +917,14 @@
RelativePath="..\src\odf\datatypes\tablecentering.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablemode.cpp"
>
......@@ -917,6 +933,30 @@
RelativePath="..\src\odf\datatypes\tablemode.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorder.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorder.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorientation.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tableorientation.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tabletype.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tabletype.h"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablevisibility.cpp"
>
......
......@@ -1695,6 +1695,14 @@
RelativePath="..\src\odf\table_xlsx.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.cpp"
>
</File>
<File
RelativePath="..\src\odf\datatypes\tablefunction.h"
>
</File>
<File
RelativePath="..\src\odf\text_content.cpp"
>
......
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