This commit is contained in:
Elena.Subbotina
2023-01-23 20:32:21 +03:00
parent 32a851b4e4
commit 43ebeec93c
16 changed files with 792 additions and 4965 deletions

View File

@ -1,308 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "math_limit_elements.h"
#include <xml/xmlchar.h>
#include <xml/attributes.h>
#include <xml/simple_xml_writer.h>
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
//---------------------------------------------------------------
const wchar_t * math_msub::ns = L"math";
const wchar_t * math_msub::name = L"msub";
//----------------------------------------------------------------------------------------------------
void math_msub::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msub::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_msub::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_msup::ns = L"math";
const wchar_t * math_msup::name = L"msup";
//----------------------------------------------------------------------------------------------------
void math_msup::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msup::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_msup::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_msubsup::ns = L"math";
const wchar_t * math_msubsup::name = L"msubsup";
//----------------------------------------------------------------------------------------------------
void math_msubsup::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msubsup::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_msubsup::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_none::ns = L"math";
const wchar_t * math_none::name = L"none";
//----------------------------------------------------------------------------------------------------
void math_none::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_none::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_none::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_mprescripts::ns = L"math";
const wchar_t * math_mprescripts::name = L"mprescripts";
void math_mprescripts::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
//CP_CREATE_ELEMENT(content_); //TODO pich
}
void math_mprescripts::add_child_element(const office_element_ptr & child_element)
{
//content_.push_back(child_element);
}
void math_mprescripts::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
// pich_qa?
/*for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}*/
}
}
}
//---------------------------------------------------------------
const wchar_t * math_mmultiscripts::ns = L"math";
const wchar_t * math_mmultiscripts::name = L"mmultiscripts";
//----------------------------------------------------------------------------------------------------
void math_mmultiscripts::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mmultiscripts::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_mmultiscripts::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < pre_content_.size(); i++)
{
if (!pre_content_[i]) continue;
pre_content_[i]->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_munderover::ns = L"math";
const wchar_t * math_munderover::name = L"munderover";
//----------------------------------------------------------------------------------------------------
void math_munderover::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_munderover::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_munderover::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_mover::ns = L"math";
const wchar_t * math_mover::name = L"mover";
//----------------------------------------------------------------------------------------------------
void math_mover::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mover::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_mover::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
CP_XML_ATTR_OPT(L"accent", accent);
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------
const wchar_t * math_munder::ns = L"math";
const wchar_t * math_munder::name = L"munder";
//----------------------------------------------------------------------------------------------------
void math_munder::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_munder::add_child_element(const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void math_munder::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
CP_XML_ATTR_OPT(L"accentunder", accentunder);
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
} // odf_writer
} // cpdoccore

View File

@ -1,238 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "math_elements.h"
#include "../datatypes/common_attlists.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
class math_msub : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSub;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_msub);
//--------------------------------------------------------------------
class math_msup : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSup;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_msup);
//--------------------------------------------------------------------
class math_msubsup : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSubSup;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_msubsup);
//--------------------------------------------------------------------
class math_none : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMNone;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_none);
//CP_REGISTER_OFFICE_ELEMENT3(math_none);
//--------------------------------------------------------------------
class math_mprescripts : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMPreScripts;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
};
CP_REGISTER_OFFICE_ELEMENT2(math_mprescripts);
//--------------------------------------------------------------------
class math_mmultiscripts : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMMultiScripts;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
office_element_ptr_array pre_content_;
bool bSeparate = false;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mmultiscripts);
//--------------------------------------------------------------------
class math_munderover : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMUnderOver;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_; //3 exact - base, under, over
};
CP_REGISTER_OFFICE_ELEMENT2(math_munderover);
//--------------------------------------------------------------------
class math_mover : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMOver;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_
_CP_OPT(Bool) accent;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mover);
//--------------------------------------------------------------------
class math_munder : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMUnder;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
_CP_OPT(Bool) accentunder;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_munder);
//--------------------------------------------------------------------
}
}

View File

@ -1,220 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "math_elements.h"
#include "../datatypes/common_attlists.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
class math_mi : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMI;
_CP_OPT(std::wstring) text_;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mi);
//CP_REGISTER_OFFICE_ELEMENT3(math_mi);
//--------------------------------------------------------------------
class math_mo : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMO;
_CP_OPT(Bool) accent_;
_CP_OPT(Bool) fence_;
_CP_OPT(std::wstring) form_;
_CP_OPT(Bool) stretchy_;
_CP_OPT(std::wstring) text_;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mo);
//CP_REGISTER_OFFICE_ELEMENT3(math_mo);
//--------------------------------------------------------------------
class math_mn : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
_CP_OPT(std::wstring) text_;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMN;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mn);
//CP_REGISTER_OFFICE_ELEMENT3(math_mn);
//--------------------------------------------------------------------
class math_mtext : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMText;
_CP_OPT(std::wstring) text_;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mtext);
//CP_REGISTER_OFFICE_ELEMENT3(math_mtext);
//--------------------------------------------------------------------
class math_mspace : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSpace;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mspace);
//CP_REGISTER_OFFICE_ELEMENT3(math_mspace);
//--------------------------------------------------------------------
class math_ms : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMS;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_ms);
//CP_REGISTER_OFFICE_ELEMENT3(math_ms);
//--------------------------------------------------------------------
class math_mglyph : public office_math_element
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMGlyph;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mglyph);
//CP_REGISTER_OFFICE_ELEMENT3(math_mglyph);
//--------------------------------------------------------------------
}
}

View File

@ -1,552 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
#include "office_scripts.h"
#include "office_chart.h"
#include "office_elements_create.h"
#include "odf_conversion_context.h"
#include "odf_rels.h"
#include "styles.h"
#include "style_paragraph_properties.h"
#include "../../DesktopEditor/graphics/pro/Fonts.h"
#include "../utils.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
namespace utils
{
void calculate_size_font_symbols(_font_metrix & metrix, NSFonts::IApplicationFonts *appFonts)
{
std::pair<float, float> appr = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name, metrix.font_size, metrix.italic, metrix.bold, appFonts);
if (appr.first < 0.01 || appr.second < 0.01)
{
appr.first = _graphics_utils_::calculate_size_symbol_win(metrix.font_name, metrix.font_size, false/*metrix.italic*/, false/*metrix.bold*/);
appr.first = ((int)(appr.first + 0.5) + 2 * (int)appr.first) / 3.;
}
if (appr.first > 0)
{
//pixels to pt
metrix.approx_symbol_size = appr.first;///1.1;//"1.2" волшебное число оО
metrix.IsCalc = true;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
odf_conversion_context::odf_conversion_context(_office_type_document type_, package::odf_document * outputDocument)
: type (type_), chart_context_ (this), page_layout_context_(this), math_context_(this), font_metrix_()
{
output_document_ = outputDocument;
current_object_ = 0;
applicationFonts_ = NSFonts::NSApplication::Create();
}
odf_conversion_context::~odf_conversion_context()
{
if (applicationFonts_)
delete applicationFonts_;
}
void odf_conversion_context::set_fonts_directory(std::wstring pathFonts)
{
if (applicationFonts_)
applicationFonts_->InitializeFromFolder(pathFonts);
}
void odf_conversion_context::calculate_font_metrix(std::wstring name, double size, bool italic, bool bold)
{
if (font_metrix_.IsCalc) return;
if (size < 1)
size = 12;
font_metrix_.font_size = size;
font_metrix_.italic = italic;
font_metrix_.bold = bold;
font_metrix_.font_name = name;
////////////////////////////////////////////
utils::calculate_size_font_symbols(font_metrix_, applicationFonts_);
}
double odf_conversion_context::convert_symbol_width(double val)
{
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
//width = (int)(((256. * width + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
//
//_dxR = dxR / 1024. * width * 9525.; // to emu
val = ((int)((val * font_metrix_.approx_symbol_size + 5) / font_metrix_.approx_symbol_size * 256)) / 256.;
double pixels = (int)(((256. * val + ((int)(128. / font_metrix_.approx_symbol_size))) / 256.) * font_metrix_.approx_symbol_size); //in pixels
return pixels * 0.75; //* 9525. * 72.0 / (360000.0 * 2.54);
}
odf_style_context* odf_conversion_context::styles_context()
{
if (!objects_.empty())
return objects_[current_object_].style_context.get();
else
return NULL;
}
odf_settings_context* odf_conversion_context::settings_context()
{
if (!objects_.empty())
return objects_[current_object_].settings_context.get();
else
return NULL;
}
odf_page_layout_context* odf_conversion_context::page_layout_context()
{
return &page_layout_context_;
}
odf_chart_context* odf_conversion_context::chart_context()
{
return &chart_context_;
}
odf_math_context* odf_conversion_context::math_context()
{
return &math_context_;
}
odf_number_styles_context* odf_conversion_context::numbers_styles_context()
{
if (objects_.size() > 0 && objects_[current_object_].style_context)
return &(objects_[current_object_].style_context->numbers_styles());
else return NULL;
}
_mediaitems* odf_conversion_context::mediaitems()
{
return &objects_[current_object_].mediaitems;
}
void odf_conversion_context::end_document()
{
rels rels_;
for (size_t i = 0; i < objects_.size(); i++)
{
_object & object = objects_[i];
bool isRoot = (i == 0 ? true : false);
if (object.content == NULL)continue;
process_styles (object, isRoot);
process_settings(object, isRoot);
package::content_content_ptr content_root_ = package::content_content::create();
if (objects_.back().scripts)
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
for (size_t i = 0; i < object.content_styles.size(); i++)
{
object.content_styles[i]->serialize(content_root_->styles());
}
package::content_simple_ptr content_style_ = package::content_simple::create();
for (size_t i = 0; i < object.styles.size(); i++)
{// мастер-пейджы, заданные заливки (градиенты, битмапы), дефолтные стили, колонтитулы, разметки, заметки,...
object.styles[i]->serialize(content_style_->content());
}
package::content_simple_ptr content_settings_ = package::content_simple::create();
object.settings->serialize(content_settings_->content());
////////////////////////////
package::object_files *object_files = new package::object_files();
if (object_files)
{
object_files->set_content (content_root_, object.content_ext);
object_files->set_styles (content_style_);
object_files->set_mediaitems(object.mediaitems);
object_files->set_settings (content_settings_);
if (!isRoot)object_files->local_path = object.name + L"/";
object.mediaitems.dump_rels(rels_, object_files->local_path);
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"styles.xml"));
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"content.xml"));
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"meta.xml"));
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"settings.xml"));
if (isRoot)
{
object_files->local_path = L"/";
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + output_document_->get_type(), object_files->local_path));
}
else
{
switch (object.content->get_type())
{
case typeOfficeText:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.text"), object_files->local_path)); break;
case typeOfficeSpreadsheet:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.spreadsheet"), object_files->local_path)); break;
case typeOfficePresentation:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.presentation"), object_files->local_path)); break;
case typeOfficeChart:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.chart"), object_files->local_path)); break;
case typeMath:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.formula"), object_files->local_path)); break;
default:
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + object.content->get_name(), object_files->local_path));
break;
}
}
output_document_->add_object(package::element_ptr(object_files), isRoot);
}
}
output_document_->set_rels(rels_);
}
void odf_conversion_context::start_chart()
{
create_object();
create_element(L"office", L"chart", objects_.back().content, this, true);
chart_context_.set_styles_context(odf_conversion_context::styles_context());
chart_context_.start_chart(get_current_object_element());
}
void odf_conversion_context::start_spreadsheet()
{
create_object();
create_element(L"office", L"spreadsheet", objects_.back().content, this, true);
}
void odf_conversion_context::start_text()
{
create_object();
create_element(L"office", L"text", objects_.back().content, this, true);
}
void odf_conversion_context::start_presentation()
{
create_object();
create_element(L"office", L"presentation", objects_.back().content, this, true);
create_element(L"office", L"scripts", objects_.back().scripts, this);
}
void odf_conversion_context::create_object(bool bAddContentExt)
{
_object obj;
obj.content_ext = bAddContentExt;
obj.style_context = boost::make_shared<odf_style_context>();
obj.settings_context = boost::make_shared<odf_settings_context>();
obj.name = get_next_name_object();
obj.style_context->set_odf_context(this);
obj.settings_context->set_odf_context(this);
objects_.push_back(obj);
current_object_ = objects_.size() - 1;
}
void odf_conversion_context::end_chart()
{
chart_context_.end_chart();
end_object();
chart_context_.set_styles_context(styles_context());
}
bool odf_conversion_context::start_math()
{
if (false == math_context_.isEmpty()) return false;
if (false == math_context_.in_text_box_)
{
drawing_context()->start_drawing();
drawing_context()->set_anchor(anchor_type::AsChar);
}
drawing_context()->start_object(get_next_name_object(), !math_context_.in_text_box_);
//имитация рисованного объекта - высота-ширина ????
create_object(false);
create_element(L"math", L"math", objects_.back().content, this, true);
math_context_.set_styles_context(odf_conversion_context::styles_context());
math_context_.start_math(get_current_object_element());
return true;
}
void odf_conversion_context::end_math()
{
math_context_.end_math();
end_object();
math_context_.set_styles_context(styles_context());
calculate_font_metrix(math_context_.font, math_context_.size, false, false); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
int count_symbol_height = 30; //сосчитать в math_context_ кол-во этажей
int count_symbol_width = 100; //длина символов
_CP_OPT(double)width = convert_symbol_width(math_context_.symbol_counter * 1.73); // либра рамка формулы(её параметры)
_CP_OPT(double)height = convert_symbol_width(1.73 * (math_context_.lvl_max - math_context_.lvl_min));
if (false == math_context_.in_text_box_)
drawing_context()->set_size(width, height); // раскомиттить по завершению
drawing_context()->end_object(!math_context_.in_text_box_);
if (false == math_context_.in_text_box_)
{
drawing_context()->end_drawing();
}
this->math_context()->symbol_counter = 0;
this->math_context()->lvl_max = 1;
this->math_context()->lvl_min = -1;
this->math_context()->lvl_down_counter = -1;
this->math_context()->lvl_up_counter = 1;
}
void odf_conversion_context::end_text()
{
end_object();
}
void odf_conversion_context::end_spreadsheet()
{
end_object();
}
void odf_conversion_context::end_presentation()
{
end_object();
}
void odf_conversion_context::end_object()
{
current_object_ = 0;//main
}
office_element_ptr & odf_conversion_context::get_current_object_element()
{
if (objects_.empty())
{
create_object();
}
return objects_[current_object_].content;
}
std::wstring odf_conversion_context::get_next_name_object()
{
return std::wstring(L"Object ") + boost::lexical_cast<std::wstring>(objects_.size());
}
void odf_conversion_context::process_settings(_object & object, bool isRoot)
{
create_element(L"office", L"settings", object.settings, this, true);
object.settings_context->process_office_settings(object.settings);
if (isRoot)
{
}
}
void odf_conversion_context::process_styles(_object & object, bool isRoot)
{
create_element(L"office", L"font-face-decls", object.content_styles, this, true);
for (boost::unordered_map<std::wstring, int>::const_iterator it = object.mapFonts.begin(); it != object.mapFonts.end(); ++it)
{
office_element_ptr font_elm;
create_element(L"style", L"font-face", font_elm, this, true);
style_font_face* font = dynamic_cast<style_font_face*>(font_elm.get());
if (font)
{
font->style_name_ = it->first;
font->svg_font_family_ = it->first;
object.content_styles.back()->add_child_element(font_elm);
}
}
object.styles.push_back(object.content_styles.back()); //копия
create_element(L"office", L"styles", object.styles, this, true);//общие стили
object.style_context->process_office_styles(object.styles.back());
page_layout_context()->process_office_styles(object.styles.back());
if (isRoot)
{
create_element(L"office", L"automatic-styles", object.styles, this, true);
object.style_context->process_automatic_for_styles(object.styles.back());
page_layout_context()->process_automatic_for_styles(object.styles.back());
create_element(L"office", L"master-styles", object.styles, this, true);
page_layout_context()->process_master_styles(object.styles.back());
}
create_element(L"office", L"automatic-styles", object.content_styles, this, true);
object.style_context->process_automatic_styles(object.content_styles.back());
}
office_element_ptr odf_conversion_context::start_tabs()
{
create_element(L"style", L"tab-stops", temporary_.elm, this, true);
return temporary_.elm;
}
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
{
if (image_file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage, odf_ref_name);
return odf_ref_name;
}
std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
{
if (file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(file_name,_mediaitems::typeMedia, odf_ref_name);
return odf_ref_name;
}
std::wstring odf_conversion_context::add_imageobject(const std::wstring & file_name)
{
if (file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(file_name,_mediaitems::typeObjectReplacement, odf_ref_name);
return odf_ref_name;
}
std::wstring odf_conversion_context::add_oleobject(const std::wstring & file_name)
{
if (file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(file_name,_mediaitems::typeOleObject, odf_ref_name);
return odf_ref_name;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
{
if (!temporary_.elm) return;
office_element_ptr elm;
create_element(L"style", L"tab-stop", elm, this, true);
style_tab_stop* tab = dynamic_cast<style_tab_stop*>(elm.get());
if (tab)
{
if (_length)
tab->style_position_ = length(_length->get_value_unit(length::cm), length::cm);
if (type)
{
switch(*type)
{
case 0: tab->style_type_ = style_type::Left; break;//tabjcBar = 0,
case 1: tab->style_type_ = style_type::Center; break;//tabjcCenter = 1,
case 2: tab->style_type_ = style_type::Left; break;//tabjcClear = 2,
case 3: tab->style_type_ = style_type::Left; break;//tabjcDecimal = 3,
case 4: tab->style_type_ = style_type::Right; break;//tabjcEnd = 4,
case 5: tab->style_type_ = style_type::Left; break;//tabjcNum = 5,
case 6: tab->style_type_ = style_type::Left; break;//tabjcStart = 6,
case 7: tab->style_type_ = style_type::Right; break;//tabjcRight = 7,
case 8: tab->style_type_ = style_type::Left; break;//tabjcLeft = 8
}
}
if (leader)
{
switch(*leader)
{
case 0: tab->style_leader_type_ = line_type::Single ;
tab->style_leader_style_= line_style::Dotted;
break; // tabtlcDot = 0,
case 1: tab->style_leader_type_ = line_type::Single ;
tab->style_leader_style_= line_style::Wave;
break; // tabtlcHeavy = 1,
case 2: tab->style_leader_type_ = line_type::Single ;
tab->style_leader_style_= line_style::Dash;
break; // tabtlcHyphen = 2,
case 3: tab->style_leader_type_ = line_type::Single ;
tab->style_leader_style_= line_style::LongDash;
break; // tabtlcMiddleDot = 3,
case 4: tab->style_leader_type_ = line_type::None;
break; // tabtlcNone = 4,
case 5: tab->style_leader_type_ = line_type::Single;
tab->style_leader_style_= line_style::Solid;
break; // tabtlcUnderscore = 5
}
}
temporary_.elm->add_child_element(elm);
}
}
void odf_conversion_context::end_tabs()
{
temporary_.elm = office_element_ptr();
temporary_.style_elm = office_element_ptr();
temporary_.style_name = L"";
}
void odf_conversion_context::add_font(const std::wstring& font_name)
{
if (objects_.empty())return;
if (objects_[current_object_].mapFonts.find(font_name) == objects_[current_object_].mapFonts.end())
{
objects_[current_object_].mapFonts.insert(std::make_pair(font_name, 1));
}
else
{
objects_[current_object_].mapFonts[font_name]++;
}
}
}
}

View File

@ -1,236 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "logging.h"
#include <boost/algorithm/string.hpp>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
#include <iostream>
#include "odf_math_context.h"
#include "odf_text_context.h"
#include "odf_style_context.h"
#include "odf_drawing_context.h"
#include "odf_conversion_context.h"
#include "ods_table_state.h"
#include "math_elements.h"
#include "math_layout_elements.h"
#include "math_table_elements.h"
#include "math_limit_elements.h"
#include "math_token_elements.h"
//#include "math_elementaries.h"
namespace cpdoccore
{
using namespace odf_types;
namespace odf_writer
{
struct odf_math_state
{
odf_math_state() { }
void clear()
{
elements_.clear();
}
std::vector<odf_element_state> elements_;
};
struct odf_math_level_state
{
style_text_properties *text_properties_;
style_paragraph_properties *paragraph_properties_;
office_element_ptr elm;
};
class odf_math_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
{
styles_context_ = NULL;
current_paragraph_properties = NULL;
current_text_properties = NULL;
}
odf_math_state current_math_state_;
void clear_current();
style_paragraph_properties *current_paragraph_properties;
style_text_properties *current_text_properties;
std::vector<odf_math_level_state> current_level_; //постоянно меняющийся список уровней наследования
std::vector<odf_math_state> math_list_; //все элементы .. для удобства разделение по "топам"
odf_conversion_context *odf_context_;
office_math *root_element_;
odf_style_context *styles_context_;
};
void odf_math_context::Impl::clear_current()
{
current_math_state_.clear();
}
static formulasconvert::oox2odf_converter formulas_converter_math;
odf_math_context::odf_math_context(odf_conversion_context *odf_context)
: impl_(new odf_math_context::Impl(odf_context)),
lvl_of_me(0), style_flag(true), counter(0), symbol_counter(0), annotation_flag(true), annotation_oper_flag(false), matrix_row_counter(0)
{
mo = { L'+', L'-', L'±', L'', L'', L'×', L'', L'÷', L'/', L'', L'', L'', L'', L'', L'', L'', L'¬', L'', L'', // un/bi operators
L'=', L'', L'<', L'', L'>', L'', L'', L'', L'', L'~', L'', L'', L'', L'', L'', L'|', L'', L'', L'', // relations
L'', L'', L'', L'', L'', L'', L'', L'', L'', L'', L'', L'', L'', // relationships over sets
L'', L'', L'', L'', L'', L'/', L'', L'', L'', L'', L'', L'', L'', L'', //
L'', L'', L'', L'', L'', L'', L'ħ', L'ƛ', L'', L'', L'', L'', L'', L'', L'', L'', L'', // others
L'', L'', L'', L'', L'', L'', L'',
L'', L'', L'', L'', L'', L'',
L'', L'', L'', L'', L'', L'', L'', L'', L'', L'',
L'˙', L'¨', L'', L'̂', L'̌', L'́'//, L'̆', L'', L'', L'', L'', L'',
};
diak_symbols = { {L"̇", L"˙"}, {L"̈", L"¨"}, {L"", L""}, {L"̂", L"&#708;"}, {L"̌", L"ˇ"}, {L"́", L"´"}, {L"̀", L"&#715;"}, {L"̆", L"˘"}, {L"̃", L"~"}, {L"̅", L"¯"},
{L"̿", L""}, {L"", L""}, {L"", L""}, {L"", L""}, {L"", L""}, {L"", L""}, {L"", L""}, {L"̲", L"&#45;"}
//{L'', L''}, { L'', L'' }, { L'', L'' }, { L'', L'' }, { L'', L'' }, { L'', L'' }, { L'', L'' }
};
annotation_diak_symbols = { {L"˙",L"dot"}, {L"¨",L"ddot"}, {L"",L"dddot"}, {L"&#708;", L"hat"}, {L"ˇ",L"check"}, {L"´",L"acute"}, {L"&#715;",L"grave"}, {L"˘",L"breve"},
{L"~",L"tilde"},{L"¯",L"overline"},{L"",L"vec"}, {L"",L"harpoon"}, {L"&#45;",L"underline"}/*, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""},{L"",L""},
{L"",L""}*/
};
annotation_operators = { {L"",L"int"}, {L"", L"iint "}, {L"", L"iiint "}, {L"", L"lint "}, {L"", L"llint "},
{L"", L"lllint "}, {L"", L"sum "}, {L"", L"prod "}, {L"", L"coprod "}
};
annotation_brackets_begin = { {L"(", L"("}, {L"[", L"["}, {L"{", L"lbrace"}, {L"", L"langle"}, {L"", L"langle"}, {L"", L"lfloor"}, {L"", L"lceil"}, {L"|", L"lline"}, {L"", L"ldline"},
{L"]", L"]"}, {L"", L"ldbracket"}
};
annotation_brackets_end = { {L")", L")"}, {L"]", L"]"}, {L"}", L"rbrace"}, {L"", L"rangle"}, {L"", L"rangle"},{L"", L"rfloor"}, {L"", L"rceil"}, {L"|", L"rline"}, {L"", L"rdline"},
{L"[", L"["}, {L"", L"rdbracket"}
};
lvl_counter = 1;
lvl_up_counter = 1;
lvl_down_counter = -1;
lvl_max = 1;
lvl_min = -1;
//debug_stream.open(debug_fileName);
}
odf_math_context::~odf_math_context()
{
//debug_stream.close();
}
void odf_math_context::set_styles_context(odf_style_context * style_context)
{
impl_->styles_context_ = style_context;
impl_->odf_context_->drawing_context()->set_styles_context(style_context);
}
odf_drawing_context * odf_math_context::drawing_context()
{
return impl_->odf_context_->drawing_context();
}
odf_text_context * odf_math_context::text_context()
{
return impl_->odf_context_->text_context();
}
void odf_math_context::start_math(office_element_ptr & root)
{
impl_->root_element_ = dynamic_cast<office_math*>(root.get());
if (!impl_->root_element_) return;
impl_->root_element_->create_child_element(L"math", L"semantics");
size_t level = impl_->current_level_.size();
odf_math_level_state level_state = { NULL, NULL, root };
odf_element_state state(root, L"", office_element_ptr(), level);
impl_->current_level_.push_back(level_state);
impl_->current_math_state_.elements_.push_back(state);
style_flag = true;
}
bool odf_math_context::start_element(office_element_ptr & elm)
{
if (!elm)
return false;
impl_->current_level_.back().elm->add_child_element(elm);
size_t level = impl_->current_level_.size();
odf_element_state state(elm, L"", office_element_ptr(), level);
odf_math_level_state level_state = { NULL, NULL, elm };
impl_->current_level_.push_back(level_state);
impl_->current_math_state_.elements_.push_back(state);
return true;
}
void odf_math_context::end_element()
{
impl_->current_level_.pop_back();
}
bool odf_math_context::isEmpty()
{
return impl_->current_level_.empty();
}
void odf_math_context::end_math()
{
if (impl_->current_math_state_.elements_.empty()) return;
end_element();
///////////////////
impl_->clear_current();
}
}
}

View File

@ -1,151 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 <string>
#include <vector>
#include <set>
#include <CPOptional.h>
#include "office_elements_create.h"
#include <fstream>
//#include "../../../ASCOfficeOdfFile/src/odf/datatypes/mathclass.h"
#define CREATE_MATH_TAG(tag)\
odf_writer::office_element_ptr elm;\
odf_writer::create_element(L"math", tag, elm, odf_context());\
odf_context()->math_context()->current_tag = tag;
//odf_context()->math_context()->debug_stream << tag << "\n";
#define OPEN_MATH_TAG(elm)\
odf_context()->math_context()->tagFlag.push_back(odf_context()->math_context()->start_element(elm));\
if (odf_context()->math_context()->current_tag == L"mn")\
{\
typedef odf_writer::math_mn* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->current_tag == L"mi")\
{\
typedef odf_writer::math_mi* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->current_tag == L"mo")\
{\
typedef odf_writer::math_mo* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->tagFlag.back())\
{\
odf_context()->math_context()->counter++;\
}\
odf_context()->math_context()->current_tag = L"";
//odf_context()->math_context()->debug_stream << L"open, counter is " << odf_context()->math_context()->counter << "\n";
#define CLOSE_MATH_TAG\
if(odf_context()->math_context()->tagFlag.back()) \
{\
odf_context()->math_context()->end_element();\
odf_context()->math_context()->counter--; \
}\
odf_context()->math_context()->tagFlag.pop_back();
//odf_context()->math_context()->debug_stream /*std::wcout*/ << L"close, counter is " << odf_context()->math_context()->counter << "\n";
namespace cpdoccore {
namespace odf_writer
{
class odf_conversion_context;
class odf_style_context;
class odf_text_context;
class odf_drawing_context;
class odf_math_context
{
public:
odf_math_context(odf_conversion_context* odf_context);
~odf_math_context();
void set_styles_context(odf_style_context* style_context);
odf_drawing_context* drawing_context();
odf_text_context* text_context();
void start_math(office_element_ptr& root);
bool start_element(office_element_ptr& elm); // office_math_element TODO
void end_element();
std::vector<std::vector<std::wstring>> brackets;
std::wstring annotation;
int lvl_of_me;
int matrix_row_counter;
std::vector<int> end_counter;
bool style_flag;
int counter;
std::wstring current_tag;
int symbol_counter;
double lvl_counter;
double lvl_up_counter;
double lvl_down_counter;
double lvl_max;
double lvl_min;
std::wstring font;
double size;
std::set<wchar_t> mo;
std::map<std::wstring, std::wstring> diak_symbols;
bool annotation_flag;
bool annotation_oper_flag;
std::map<std::wstring, std::wstring> annotation_operators;
std::map<std::wstring, std::wstring> annotation_brackets_begin;
std::map<std::wstring, std::wstring> annotation_brackets_end;
std::map<std::wstring, std::wstring> annotation_diak_symbols;
//std::pair<std::set<std::string>, bool> annotation_from_to_operators;
void end_math();
std::wofstream debug_stream;
std::string debug_fileName = "debugLog.txt";
bool isEmpty();
std::vector<bool> tagFlag;
bool in_text_box_ = false;
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}
}

View File

@ -1,784 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 <CPOptional.h>
#include "../../../Common/DocxFormat/Source/Base/SmartPtr.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
#include "../progressCallback.h"
#include <vector>
#include <string>
namespace cpdoccore
{
namespace odf_types
{
class color;
class length;
class text_align;
class font_size;
class length_or_percent;
}
namespace odf_writer
{
class odf_conversion_context;
class style_paragraph_properties;
class style_text_properties;
class style_graphic_properties;
class style_section_properties;
class style_table_properties;
class style_table_cell_properties;
class style_table_row_properties;
class style_table_column_properties;
class style_chart_properties;
class style_drawing_page_properties;
class graphic_format_properties;
namespace package
{
class odf_document;
}
}
}
namespace OOX
{
class WritingElement;
class IFileContainer;
class File;
class JsaProject;
namespace Drawing
{
//class CDiagrammParts;
//class CPresetTextShape;
class CInline;
class CAnchor;
class COfficeArtExtensionList;
class COfficeArtExtension;
}
namespace Spreadsheet
{
class IFileContainer;
class CChartSpace;
class CT_extLst;
class CT_ChartSpace;
class CT_Boolean;
class CT_RelId;
class CT_PageSetup;
class CT_PageMargins;
class CT_HeaderFooter;
class CT_PrintSettings;
class CT_ExternalData;
class CT_DispBlanksAs;
class CT_LegendEntry;
class CT_UnsignedInt;
class CT_Extension;
class CT_LegendPos;
class CT_Legend;
class CT_Layout;
class CT_ManualLayout;
class CT_LayoutTarget;
class CT_LayoutMode;
class CT_Double;
class CT_DTable;
class CT_SerAx;
class CT_Scaling;
class CT_LogBase;
class CT_Orientation;
class CT_AxPos;
class CT_ChartLines;
class CT_Title;
class CT_Tx;
class CT_StrRef;
class CT_StrData;
class CT_StrVal;
class CT_NumFmt;
class CT_TickMark;
class CT_TickLblPos;
class CT_Crosses;
class CT_Skip;
class CT_TimeUnit;
class CT_DateAx;
class CT_LblOffset;
class CT_AxisUnit;
class CT_LblAlgn;
class CT_CatAx;
class CT_DispUnitsLbl;
class CT_BuiltInUnit;
class CT_DispUnits;
class CT_CrossBetween;
class CT_ValAx;
class CT_SizeRepresents;
class CT_BubbleScale;
class CT_BubbleSer;
class CT_SerTx;
class CT_DPt;
class CT_Marker;
class CT_MarkerStyle;
class CT_MarkerSize;
class CT_PictureOptions;
class CT_PictureFormat;
class CT_PictureStackUnit;
class CT_DLbls;
class CT_DLbl;
class CT_DLblPos;
class CT_Trendline;
class CT_TrendlineType;
class CT_Order;
class CT_Period;
class CT_TrendlineLbl;
class CT_ErrBars;
class CT_ErrDir;
class CT_ErrBarType;
class CT_ErrValType;
class CT_NumDataSource;
class CT_NumData;
class CT_NumVal;
class CT_NumRef;
class CT_AxDataSource;
class CT_MultiLvlStrRef;
class CT_lvl;
class CT_MultiLvlStrData;
class CT_BubbleChart;
class CT_bandFmts;
class CT_Surface3DChart;
class CT_SurfaceSer;
class CT_BandFmt;
class CT_SurfaceChart;
class CT_SecondPieSize;
class CT_SplitType;
class CT_OfPieType;
class CT_custSplit;
class CT_OfPieChart;
class CT_PieSer;
class CT_GapAmount;
class CT_Bar3DChart;
class CT_BarDir;
class CT_BarGrouping;
class CT_BarSer;
class CT_Shape;
class CT_Overlap;
class CT_BarChart;
class CT_HoleSize;
class CT_DoughnutChart;
class CT_FirstSliceAng;
class CT_Pie3DChart;
class CT_PieChart;
class CT_ScatterSer;
class CT_ScatterStyle;
class CT_ScatterChart;
class CT_RadarSer;
class CT_RadarStyle;
class CT_RadarChart;
class CT_StockChart;
class CT_LineSer;
class CT_UpDownBars;
class CT_UpDownBar;
class CT_Line3DChart;
class CT_Grouping;
class CT_LineChart;
class CT_Area3DChart;
class CT_AreaSer;
class CT_AreaChart;
class CT_PlotArea;
class CT_Thickness;
class CT_Surface;
class CT_Perspective;
class CT_DepthPercent;
class CT_RotY;
class CT_HPercent;
class CT_RotX;
class CT_View3D;
class CT_PivotFmt;
class CT_pivotFmts;
class CT_Chart;
class CT_Protection;
class CT_PivotSource;
class CT_Style1;
class CT_Style;
class CT_TextLanguageID;
class CTextProperties;
namespace ChartEx
{
class CChartSpace;
class CChart;
class CChartData;
class CData;
class CDimension;
class CPlotArea;
class CLegend;
class CAxis;
class CTickMarks;
class CGridlines;
class CValScaling;
class CCatScaling;
class CSeries;
class CDataLabels;
class CTitle;
}
}
class CSizeAnchor;
namespace Vml
{
class CShapeType;
class CShape;
class CImage;
class CImageData;
class CArc;
class CBackground;
class CCurve;
class CFill;
class CLine;
class COval;
class CPath ;
class CPolyLine ;
class CRect;
class CRoundRect;
class CShadow;
class CStroke;
class CTextbox;
class CTextPath;
class CGroup;
class CVmlCommonElements;
class CFormulas;
}
namespace VmlWord
{
class CWrap;
}
namespace Logic
{
class CDeg;
class CDen;
class CElement;
class CFName;
class CLim;
class CNum;
class COMath;
class CSub;
class CSup;
class CCtrlPr;
class CAcc;
class CAccPr;
class CArgPr;
class CBar;
class CBarPr;
class CBorderBox;
class CBorderBoxPr;
class CBox;
class CBoxPr;
class CBrk;
class CDelimiter;
class CDelimiterPr;
class CEqArr;
class CEqArrPr;
class CFPr;
class CFraction;
class CFunc;
class CFuncPr;
class CGroupChr;
class CGroupChrPr;
class CLimLow;
class CLimLowPr;
class CLimUpp;
class CLimUppPr;
class CMathFont;
class CMathPr;
class CMatrix;
class CMc;
class CMcPr;
class CMcs;
class CMDel;
class CMIns;
class CMPr;
class CMr;
class CMRPr;
class CMRun;
class CMText;
class CNary;
class CNaryPr;
class COMathPara;
class COMathParaPr;
class CPhant;
class CPhantPr;
class CRad;
class CRadPr;
class CSPre;
class CSPrePr;
class CSSub;
class CSSubPr;
class CSSubSup;
class CSSubSupPr;
class CSSup;
class CSSupPr;
//class CType;
//class CSupHide;
//class CSubHide;
//class CBegChr;
//class CEndChr;
//class CDiff;
//class CDegHide;
//class CChr;
//class CArgSz;
}
}
namespace SimpleTypes
{
namespace Vml
{
class CCssStyle;
}
}
namespace PPTX
{
class Theme;
namespace Logic
{
class Bullet;
class ClrMap;
class SpTreeElem;
class GraphicFrame;
class SpTree;
class Shape;
class CxnSp;
class Pic;
class SmartArt;
class ChartRec;
class SpPr;
class GrpSpPr;
class Xfrm;
class ShapeStyle;
class PrstTxWarp;
class PrstGeom;
class CustGeom;
class BlipFill;
class GradFill;
class SolidFill;
class PattFill;
class EffectLst;
class EffectDag;
class FontRef;
class StyleRef;
class Ln;
class Path2D;
class PathBase;
class TxBody;
class BodyPr;
class UniFill;
class UniColor;
class NvSpPr;
class CNvPr;
class CNvSpPr;
class CNvCxnSpPr;
class CNvGrpSpPr;
class NvCxnSpPr;
class NvGrpSpPr;
class NvPr;
class Paragraph;
class TxBody;
class TextListStyle;
class TextParagraphPr;
class TextSpacing;
class RunProperties;
class Run;
class Fld;
class Br;
class MathParaWrapper;
class NvGraphicFramePr;
class LineTo;
class MoveTo;
class ArcTo;
class QuadBezTo;
class CubicBezTo;
class Close;
class AhXY;
class AhPolar;
class EffectStyle;
class InnerShdw;
class OuterShdw;
class PrstShdw;
class AlphaModFix;
class Blur;
class FillOverlay;
class Glow;
class Reflection;
class SoftEdge;
class Grayscl;
class Duotone;
}
}
using namespace cpdoccore;
namespace Oox2Odf
{
struct returnValues
{
returnValues() : colorFlag(false), auxFlag(false), naryChr(false), narySubHide(false), narySupHide(false), begEndChrs(L"(", L")"), str(L"")
{}
bool colorFlag;
bool auxFlag;
bool naryChr;
bool narySubHide;
bool narySupHide;
std::pair<std::wstring, std::wstring> begEndChrs;
std::wstring str;
~returnValues() {}
};
class OoxConverter
{
public:
virtual bool convertDocument() = 0;
bool write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID);
OoxConverter() : output_document(NULL), oox_current_child_document(NULL)
{
}
virtual ~OoxConverter()
{
m_mapVmlShapeTypes.clear();
}
void set_fonts_directory (const std::wstring & fontsPath);
bool encrypt_document (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
bool encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size);
//.......................................................................................................................
virtual OOX::IFileContainer *current_document() = 0;
virtual cpdoccore::odf_writer::odf_conversion_context *odf_context() = 0;
virtual PPTX::Theme *oox_theme() = 0;
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
cpdoccore::odf_writer::package::odf_document *output_document;
std::wstring find_link_by (NSCommon::smart_ptr<OOX::File> & oFile, int type);
virtual std::wstring find_link_by_id(const std::wstring & sId, int type) = 0;
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(const std::wstring & sId) = 0;
OOX::IFileContainer *oox_current_child_document;
void convert (OOX::JsaProject *jsaProject);
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
bool convert (std::wstring sSchemeColor, DWORD & argb);
void convert_font(PPTX::Theme *theme, std::wstring & font);
//.......................................................................................................................
void convert(OOX::WritingElement *oox_unknown);
//drawingML & pptx................................................................................................................................
void convert(PPTX::Logic::SpTreeElem *oox_element);
void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame);
void convert(PPTX::Logic::SpTree *oox_shape_tree);
void convert(PPTX::Logic::Shape *oox_shape);
void convert(PPTX::Logic::CxnSp *oox_connect);
void convert(PPTX::Logic::Pic *oox_pic);
void convert(PPTX::Logic::GrpSpPr *oox_grpSpPr);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
void convert(PPTX::Logic::Xfrm *oox_xfrm);
void convert(PPTX::Logic::Xfrm *oox_txbx, PPTX::Logic::Xfrm *oox_xfrm);
int convert(PPTX::Logic::PrstTxWarp *oox_text_preset);
void convert(PPTX::Logic::PrstGeom *oox_geom);
void convert(PPTX::Logic::CustGeom *oox_geom);
void convert(PPTX::Logic::BlipFill *oox_fill);
void convert(PPTX::Logic::GradFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::SolidFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::PattFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::Ln *oox_line, DWORD ARGB = 0, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::FontRef *oox_fontRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
void convert(PPTX::Logic::CNvCxnSpPr *oox_cnvPr);
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::CNvGrpSpPr *oox_cnvGrpSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style);
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
void convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style = NULL);
void convert_chart_text(PPTX::Logic::TxBody *oox_txBody, bool only_properties = false);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::MathParaWrapper *oox_math);
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
void convert(PPTX::Logic::SmartArt *oox_smart_art);
void convert(PPTX::Logic::LineTo *oox_geom_path);
void convert(PPTX::Logic::MoveTo *oox_geom_path);
void convert(PPTX::Logic::ArcTo *oox_geom_path);
void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
void convert(PPTX::Logic::Close *oox_geom_path);
void convert(PPTX::Logic::AhXY *oox_handle);
void convert(PPTX::Logic::AhPolar *oox_handle);
void convert(PPTX::Logic::EffectStyle *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::EffectLst *oox_effect_list, DWORD ARGB = 0);
void convert(PPTX::Logic::EffectDag *oox_effect_dag, DWORD ARGB = 0);
void convert(PPTX::Logic::InnerShdw *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::OuterShdw *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::PrstShdw *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::AlphaModFix *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::Blur *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::FillOverlay *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::Glow *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::Reflection *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::SoftEdge *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::Grayscl *oox_effect, DWORD ARGB = 0);
void convert(PPTX::Logic::Duotone *oox_effect, DWORD ARGB = 0);
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_View3D *oox_view3D);
void convert(OOX::Spreadsheet::CT_Title *ct_title);
void convert(OOX::Spreadsheet::CT_Legend *ct_legend);
void convert(OOX::Spreadsheet::CT_LegendEntry *ct_legend);
void convert(OOX::Spreadsheet::CT_PlotArea *ct_plotArea);
void convert(OOX::Spreadsheet::CT_Surface *ct_surface, int type, bool chart3D);
void convert(OOX::Spreadsheet::CT_CatAx *ct_catAx);
void convert(OOX::Spreadsheet::CT_SerAx *ct_serAx);
void convert(OOX::Spreadsheet::CT_DateAx *ct_dateAx);
void convert(OOX::Spreadsheet::CT_ValAx *ct_valAx);
void convert(OOX::Spreadsheet::CT_Area3DChart *chart);
void convert(OOX::Spreadsheet::CT_AreaChart *chart);
void convert(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert(OOX::Spreadsheet::CT_BarChart *chart);
void convert_before(OOX::Spreadsheet::CT_BarChart *chart);
void convert(OOX::Spreadsheet::CT_Line3DChart *chart);
void convert(OOX::Spreadsheet::CT_LineChart *chart);
void convert(OOX::Spreadsheet::CT_Pie3DChart *chart);
void convert(OOX::Spreadsheet::CT_PieChart *chart);
void convert(OOX::Spreadsheet::CT_Surface3DChart *chart);
void convert(OOX::Spreadsheet::CT_SurfaceChart *chart);
void convert(OOX::Spreadsheet::CT_BubbleChart *chart);
void convert(OOX::Spreadsheet::CT_DoughnutChart *chart);
void convert(OOX::Spreadsheet::CT_ScatterChart *chart);
void convert(OOX::Spreadsheet::CT_RadarChart *chart);
void convert(OOX::Spreadsheet::CT_StockChart *chart);
void convert(OOX::Spreadsheet::CT_OfPieChart *chart);
void convert(OOX::Spreadsheet::CT_AreaSer *ser);
void convert(OOX::Spreadsheet::CT_BubbleSer *ser);
void convert(OOX::Spreadsheet::CT_SurfaceSer *ser);
void convert(OOX::Spreadsheet::CT_PieSer *ser);
void convert(OOX::Spreadsheet::CT_BarSer *ser);
void convert(OOX::Spreadsheet::CT_ScatterSer *ser);
void convert(OOX::Spreadsheet::CT_RadarSer *ser);
void convert(OOX::Spreadsheet::CT_LineSer *ser);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat, int type);
void convert(OOX::Spreadsheet::CT_NumDataSource *val);
//void convert(OOX::Spreadsheet::CRichText *rich);
//void convert(OOX::Spreadsheet::CTextProperties *txPr);
void convert(OOX::Spreadsheet::CT_Tx *ct_tx);
void convert(OOX::Spreadsheet::CT_Layout *ct_layout);
void convert(OOX::Spreadsheet::CT_ManualLayout *ct_layout);
void convert(OOX::Spreadsheet::CT_ChartLines *grid, int type);
void convert(OOX::Spreadsheet::CT_SerTx *ser_tx);
void convert(OOX::Spreadsheet::CT_DLbls *ser_lbls);
void convert(OOX::Spreadsheet::CT_Marker *marker);
void convert(OOX::Spreadsheet::CT_Marker *marker, std::vector<OOX::Spreadsheet::CT_DPt*> & dPt);
void convert(OOX::Spreadsheet::CT_ExternalData *external_data);
void convert(OOX::Spreadsheet::CT_NumData *num_data, bool categories, bool label);
void convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label);
void convert(OOX::CSizeAnchor *sz_anchor, double x0, double y0, double width, double height);
//.chart.ex...........................................................................................................................
void convert(OOX::Spreadsheet::ChartEx::CChartSpace *oox_chart);
void convert(OOX::Spreadsheet::ChartEx::CTitle *ct_title);
void convert(OOX::Spreadsheet::ChartEx::CChart *oox_chart);
void convert(OOX::Spreadsheet::ChartEx::CChartData *oox_chart_data);
void convert(OOX::Spreadsheet::ChartEx::CPlotArea *oox_plot_area);
//.vml............................................................................................................................
void convert(OOX::Vml::CShapeType *vml_shape_type);
void convert(OOX::Vml::CShape *vml_shape);
void convert(OOX::Vml::CImage *vml_image);
void convert(OOX::Vml::CImageData *vml_image_data);
void convert(OOX::Vml::CArc *vml_arc);
void convert(OOX::Vml::CBackground *vml_background);
void convert(OOX::Vml::CCurve *vml_curve);
void convert(OOX::Vml::CFill *vml_fill);
void convert(OOX::Vml::CLine *vml_line);
void convert(OOX::Vml::COval *vml_oval);
void convert(OOX::Vml::CPath *vml_path);
void convert(OOX::Vml::CPolyLine *vml_polyline);
void convert(OOX::Vml::CRect *vml_rect);
void convert(OOX::Vml::CRoundRect *vml_roundrect);
void convert(OOX::Vml::CShadow *vml_shadow);
void convert(OOX::Vml::CStroke *vml_stroke);
void convert(OOX::Vml::CTextbox *vml_textbox);
void convert(OOX::Vml::CTextPath *vml_textpath);
void convert(SimpleTypes::Vml::CCssStyle *vml_style);
void convert(OOX::VmlWord::CWrap *vml_wrap);
void convert(OOX::Vml::CGroup *vml_group);
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
void convert(OOX::Vml::CFormulas *vml_formulas);
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
//math............................................................................................................................
std::vector<std::vector<std::wstring>>& brackets();
int& lvl_of_me();
std::vector<int>& end_counter();
std::wstring& annotation();
bool& annotation_flag();
void lvl_up_counter_increace(double val);
void lvl_up_counter_decreace(double val);
void lvl_down_counter_increace(double val);
void lvl_down_counter_decreace(double val);
void mrow();
void endOfMrow();
void resizeBrackets();
void convert(OOX::Logic::COMath *oox_math);
void convert(OOX::Logic::CMathPr *oox_math_pr);
returnValues convert(OOX::Logic::CCtrlPr *oox_ctrl_pr);
void convert(OOX::Logic::CAcc *oox_acc);
returnValues convert(OOX::Logic::CAccPr *oox_acc_pr);
void convert(OOX::Logic::CArgPr *oox_arg_pr);
void convert(OOX::Logic::CBar *oox_bar);
returnValues convert(OOX::Logic::CBarPr *oox_bar_pr);
void convert(OOX::Logic::CBorderBox *oox_border_box);
returnValues convert(OOX::Logic::CBorderBoxPr *oox_border_box_pr);
void convert(OOX::Logic::CBox *oox_box);
returnValues convert(OOX::Logic::CBoxPr *oox_box_pr);
void convert(OOX::Logic::CBrk *oox_brk);
void convert(OOX::Logic::CDelimiter *oox_del);
returnValues convert(OOX::Logic::CDelimiterPr *oox_del_pr);
void convert(OOX::Logic::CEqArr *oox_eq_arr);
returnValues convert(OOX::Logic::CEqArrPr *oox_eq_arr_pr);
void convert(OOX::Logic::CBaseJc *oox_base_jc);
void convert(OOX::Logic::CMaxDist *oox_max_dist);
void convert(OOX::Logic::CObjDist *oox_obj_dist);
void convert(OOX::Logic::CRSp *oox_r_sp);
void convert(OOX::Logic::CRSpRule *oox_r_sp_rule);
returnValues convert(OOX::Logic::CFPr *oox_f_pr);
void convert(OOX::Logic::CFraction *oox_fraction);
void convert(OOX::Logic::CFunc *oox_func);
returnValues convert(OOX::Logic::CFuncPr *oox_func_pr);
void convert(OOX::Logic::CGroupChr *oox_group_ch, OOX::Logic::CLim *oox_lim = NULL);
returnValues convert(OOX::Logic::CGroupChrPr *oox_group_ch_pr);
void convert(OOX::Logic::CLimLow *oox_lim_low, OOX::Logic::CElement *oox_elm = NULL);
returnValues convert(OOX::Logic::CLimLowPr *oox_lim_low_pr);
void convert(OOX::Logic::CLimUpp *oox_lim_upp);
returnValues convert(OOX::Logic::CLimUppPr *oox_lim_upp_pr);
void convert(OOX::Logic::CMathFont *oox_math_font);
void convert(OOX::Logic::CMatrix *oox_matrix);
void convert(OOX::Logic::CMc *oox_mc);
void convert(OOX::Logic::CMcPr *oox_mc_pr);
void convert(OOX::Logic::CMcs *oox_mcs);
void convert(OOX::Logic::CMDel *oox_m_del);
void convert(OOX::Logic::CMIns *oox_m_ins);
returnValues convert(OOX::Logic::CMPr *oox_m_pr);
void convert(OOX::Logic::CMr *oox_mr);
void convert(OOX::Logic::CMRun *oox_run);
void convert(OOX::Logic::CMText *oox_text);
void convert(OOX::Logic::CNary *oox_nary);
returnValues convert(OOX::Logic::CNaryPr *oox_nary_pr);
void convert(OOX::Logic::CGrow *oox_grow);
void convert(OOX::Logic::COMathPara *oox_math_para);
void convert(OOX::Logic::COMathParaPr *oox_math_para_pr);
void convert(OOX::Logic::CPhant *oox_phant);
void convert(OOX::Logic::CPhantPr *oox_phant_pr);
void convert(OOX::Logic::CRad *oox_rad);
returnValues convert(OOX::Logic::CRadPr *oox_rad_pr);
void convert(OOX::Logic::CSPre *oox_s_pre);
returnValues convert(OOX::Logic::CSPrePr *oox_s_pre_pr);
void convert(OOX::Logic::CSSub *oox_ssub);
returnValues convert(OOX::Logic::CSSubPr *oox_ssub_pr);
void convert(OOX::Logic::CSSubSup *oox_ssub_sup);
returnValues convert(OOX::Logic::CSSubSupPr *oox_ssub_sup_pr);
void convert(OOX::Logic::CAlnScr *oox_aln_scr);
void convert(OOX::Logic::CSSup *oox_ssup);
returnValues convert(OOX::Logic::CSSupPr *oox_ssup_pr);
void convert(OOX::Logic::CNum *oox_num);
void convert(OOX::Logic::CDen *oox_den);
std::wstring convert(OOX::Logic::CBegChr *oox_beg_chr);
std::wstring convert(OOX::Logic::CEndChr *oox_end_chr);
void convert(OOX::Logic::CElement *oox_elm);
bool convert(OOX::Logic::CDegHide *oox_deg_hide);
void convert(OOX::Logic::CDeg *oox_deg, OOX::Logic::CElement *oox_elm);
void convert(OOX::Logic::CSup *oox_sup, OOX::Logic::CElement *oox_elm);
void convert(OOX::Logic::CSub *oox_sub, OOX::Logic::CElement *oox_elm);
bool convert(OOX::Logic::CFName *oox_fname, OOX::Logic::CElement* oox_elm);
void convert(OOX::Logic::CLim *oox_lim);
bool convert(OOX::Logic::CChr *oox_chr);
void convert(OOX::Logic::CSup *oox_csup);
void convert(OOX::Logic::CSub *oox_csub);
bool convert(OOX::Logic::CSubHide *oox_subHide);
bool convert(OOX::Logic::CSupHide *oox_supHide);
std::wstring convert(OOX::Logic::CType *oox_type);
void convert(OOX::Logic::CDiff *oox_diff);
void convert(OOX::Logic::CArgSz *oox_arg_sz);
bool convert(OOX::Logic::COpEmu *oox_op_emu);
bool convert(OOX::Logic::CPos *oox_pos);
void convert(OOX::Logic::CVertJc *oox_vert_jc);
void convert(OOX::Logic::CNoBreak *oox_no_break);
void convert(OOX::Logic::CCount *oox_count);
void convert(OOX::Logic::CMcJc *oox_mc_jc);
void convert(OOX::Logic::CPlcHide *oox_plc_hide);
bool convert(OOX::Logic::CRunProperty *oox_r_pr);
//-----------------------------------
void RGB2HSL(DWORD argb, double& dH, double& dS, double& dL);
DWORD HSL2RGB(double dH, double dS, double dL);
private:
std::map<std::wstring, OOX::Vml::CShapeType*> m_mapVmlShapeTypes;
};
} // namespace Oox2Odf

File diff suppressed because it is too large Load Diff

View File

@ -443,8 +443,23 @@ namespace PPTX
using namespace cpdoccore;
namespace Oox2Odf
{
struct returnValues
{
returnValues() : colorFlag(false), auxFlag(false), naryChr(false), narySubHide(false), narySupHide(false), begEndChrs(L"(", L")"), str(L"")
{}
bool colorFlag;
bool auxFlag;
bool naryChr;
bool narySubHide;
bool narySupHide;
std::pair<std::wstring, std::wstring> begEndChrs;
std::wstring str;
~returnValues() {}
};
class OoxConverter
{
public:
@ -654,49 +669,51 @@ public:
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
std::wstring GetImageIdFromVmlShape(OOX::Vml::CVmlCommonElements* pShape);
//math............................................................................................................................
std::vector<std::vector<std::wstring>>& brackets();
int& lvl_of_me();
std::vector<int>& end_counter();
std::wstring& annotation();
bool& annotation_flag();
void lvl_up_counter_increace(double val);
void lvl_up_counter_decreace(double val);
void lvl_down_counter_increace(double val);
void lvl_down_counter_decreace(double val);
void mrow();
void endOfMrow();
void resizeBrackets();
void convert(OOX::Logic::COMath *oox_math);
void convert(OOX::Logic::CMathPr *oox_math_pr);
bool convert(OOX::Logic::CCtrlPr *oox_ctrl_pr);
returnValues convert(OOX::Logic::CCtrlPr *oox_ctrl_pr);
void convert(OOX::Logic::CAcc *oox_acc);
void convert(OOX::Logic::CAccPr *oox_acc_pr);
returnValues convert(OOX::Logic::CAccPr *oox_acc_pr);
void convert(OOX::Logic::CArgPr *oox_arg_pr);
void convert(OOX::Logic::CBar *oox_bar);
bool convert(OOX::Logic::CBarPr *oox_bar_pr);
returnValues convert(OOX::Logic::CBarPr *oox_bar_pr);
void convert(OOX::Logic::CBorderBox *oox_border_box);
void convert(OOX::Logic::CBorderBoxPr *oox_border_box_pr);
returnValues convert(OOX::Logic::CBorderBoxPr *oox_border_box_pr);
void convert(OOX::Logic::CBox *oox_box);
bool convert(OOX::Logic::CBoxPr *oox_box_pr);
returnValues convert(OOX::Logic::CBoxPr *oox_box_pr);
void convert(OOX::Logic::CBrk *oox_brk);
void convert(OOX::Logic::CDelimiter *oox_del);
std::pair<std::wstring, std::wstring> convert(OOX::Logic::CDelimiterPr *oox_del_pr);
returnValues convert(OOX::Logic::CDelimiterPr *oox_del_pr);
void convert(OOX::Logic::CEqArr *oox_eq_arr);
void convert(OOX::Logic::CEqArrPr *oox_eq_arr_pr);
returnValues convert(OOX::Logic::CEqArrPr *oox_eq_arr_pr);
void convert(OOX::Logic::CBaseJc *oox_base_jc);
void convert(OOX::Logic::CMaxDist *oox_max_dist);
void convert(OOX::Logic::CObjDist *oox_obj_dist);
void convert(OOX::Logic::CRSp *oox_r_sp);
void convert(OOX::Logic::CRSpRule *oox_r_sp_rule);
std::wstring convert(OOX::Logic::CFPr *oox_f_pr);
returnValues convert(OOX::Logic::CFPr *oox_f_pr);
void convert(OOX::Logic::CFraction *oox_fraction);
void convert(OOX::Logic::CFunc *oox_func);
void convert(OOX::Logic::CFuncPr *oox_func_pr);
void convert(OOX::Logic::CGroupChr *oox_group_ch);
bool convert(OOX::Logic::CGroupChrPr *oox_group_ch_pr);
void convert(OOX::Logic::CLimLow *oox_lim_low);
void convert(OOX::Logic::CLimLowPr *oox_lim_low_pr);
returnValues convert(OOX::Logic::CFuncPr *oox_func_pr);
void convert(OOX::Logic::CGroupChr *oox_group_ch, OOX::Logic::CLim *oox_lim = NULL);
returnValues convert(OOX::Logic::CGroupChrPr *oox_group_ch_pr);
void convert(OOX::Logic::CLimLow *oox_lim_low, OOX::Logic::CElement *oox_elm = NULL);
returnValues convert(OOX::Logic::CLimLowPr *oox_lim_low_pr);
void convert(OOX::Logic::CLimUpp *oox_lim_upp);
void convert(OOX::Logic::CLimUppPr *oox_lim_upp_pr);
returnValues convert(OOX::Logic::CLimUppPr *oox_lim_upp_pr);
void convert(OOX::Logic::CMathFont *oox_math_font);
void convert(OOX::Logic::CMatrix *oox_matrix);
void convert(OOX::Logic::CMc *oox_mc);
@ -704,38 +721,38 @@ public:
void convert(OOX::Logic::CMcs *oox_mcs);
void convert(OOX::Logic::CMDel *oox_m_del);
void convert(OOX::Logic::CMIns *oox_m_ins);
void convert(OOX::Logic::CMPr *oox_m_pr);
returnValues convert(OOX::Logic::CMPr *oox_m_pr);
void convert(OOX::Logic::CMr *oox_mr);
void convert(OOX::Logic::CMRun *oox_run);
void convert(OOX::Logic::CMText *oox_text);
void convert(OOX::Logic::CNary *oox_nary);
std::vector<bool> convert(OOX::Logic::CNaryPr *oox_nary_pr);
returnValues convert(OOX::Logic::CNaryPr *oox_nary_pr);
void convert(OOX::Logic::CGrow *oox_grow);
void convert(OOX::Logic::COMathPara *oox_math_para);
void convert(OOX::Logic::COMathParaPr *oox_math_para_pr);
void convert(OOX::Logic::CPhant *oox_phant);
void convert(OOX::Logic::CPhantPr *oox_phant_pr);
void convert(OOX::Logic::CRad *oox_rad);
bool convert(OOX::Logic::CRadPr *oox_rad_pr);
returnValues convert(OOX::Logic::CRadPr *oox_rad_pr);
void convert(OOX::Logic::CSPre *oox_s_pre);
void convert(OOX::Logic::CSPrePr *oox_s_pre_pr);
returnValues convert(OOX::Logic::CSPrePr *oox_s_pre_pr);
void convert(OOX::Logic::CSSub *oox_ssub);
void convert(OOX::Logic::CSSubPr *oox_ssub_pr);
returnValues convert(OOX::Logic::CSSubPr *oox_ssub_pr);
void convert(OOX::Logic::CSSubSup *oox_ssub_sup);
void convert(OOX::Logic::CSSubSupPr *oox_ssub_sup_pr);
returnValues convert(OOX::Logic::CSSubSupPr *oox_ssub_sup_pr);
void convert(OOX::Logic::CAlnScr *oox_aln_scr);
void convert(OOX::Logic::CSSup *oox_ssup);
void convert(OOX::Logic::CSSupPr *oox_ssup_pr);
returnValues convert(OOX::Logic::CSSupPr *oox_ssup_pr);
void convert(OOX::Logic::CNum *oox_num);
void convert(OOX::Logic::CDen *oox_den);
std::wstring convert(OOX::Logic::CBegChr *oox_beg_chr);
std::wstring convert(OOX::Logic::CEndChr *oox_end_chr);
std::wstring convert(OOX::Logic::CBegChr *oox_beg_chr);
std::wstring convert(OOX::Logic::CEndChr *oox_end_chr);
void convert(OOX::Logic::CElement *oox_elm);
bool convert(OOX::Logic::CDegHide *oox_deg_hide);
void convert(OOX::Logic::CDeg *oox_deg, OOX::Logic::CElement *oox_elm);
void convert(OOX::Logic::CSup *oox_sup, OOX::Logic::CElement *oox_elm);
void convert(OOX::Logic::CSub *oox_sub, OOX::Logic::CElement *oox_elm);
void convert(OOX::Logic::CFName *oox_fname);
bool convert(OOX::Logic::CFName *oox_fname, OOX::Logic::CElement* oox_elm);
void convert(OOX::Logic::CLim *oox_lim);
bool convert(OOX::Logic::CChr *oox_chr);
void convert(OOX::Logic::CSup *oox_csup);

File diff suppressed because it is too large Load Diff

View File

@ -295,6 +295,7 @@ void math_munder::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE_NONS()
{
CP_XML_ATTR_OPT(L"accentunder", accentunder);
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;

View File

@ -43,12 +43,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSub;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -65,12 +62,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSup;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -88,12 +82,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSubSup;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -109,12 +100,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMNone;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -132,12 +120,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMPreScripts;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -151,12 +136,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMMultiScripts;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -174,12 +156,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMUnderOver;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -195,12 +174,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMOver;
_CP_OPT(Bool) accent;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
@ -217,12 +193,10 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMUnder;
_CP_OPT(Bool) accentunder;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);

View File

@ -44,8 +44,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMI;
_CP_OPT(std::wstring) text_;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -57,7 +58,6 @@ namespace cpdoccore {
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mi);
@ -68,13 +68,14 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMO;
_CP_OPT(Bool) accent_;
_CP_OPT(Bool) fence_;
_CP_OPT(std::wstring) form_;
_CP_OPT(Bool) stretchy_;
_CP_OPT(std::wstring) text_;
private:
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(const office_element_ptr & child_element);
@ -86,7 +87,6 @@ namespace cpdoccore {
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mo);
@ -97,7 +97,8 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
_CP_OPT(std::wstring) text_;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMN;
@ -112,7 +113,6 @@ namespace cpdoccore {
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mn);
@ -123,8 +123,9 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMText;
_CP_OPT(std::wstring) text_;
private:
@ -138,7 +139,6 @@ namespace cpdoccore {
odf_types::common_math_style_attlist common_attlist_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_mtext);
@ -149,7 +149,7 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSpace;
@ -173,7 +173,7 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMS;
@ -197,7 +197,7 @@ namespace cpdoccore {
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMGlyph;

View File

@ -179,7 +179,7 @@ _mediaitems* odf_conversion_context::mediaitems()
void odf_conversion_context::end_document()
{
rels rels_;
rels rels_;
for (size_t i = 0; i < objects_.size(); i++)
{
_object & object = *objects_[i];
@ -296,9 +296,9 @@ void odf_conversion_context::create_object(bool bAddContentExt)
obj->style_context->set_odf_context(this);
obj->settings_context->set_odf_context(this);
objects_.push_back(obj);
objects_.push_back(obj);
current_object_ = objects_.size() - 1;
current_object_ = objects_.size() - 1;
}
}
void odf_conversion_context::end_chart()
@ -331,20 +331,19 @@ bool odf_conversion_context::start_math()
void odf_conversion_context::end_math()
{
math_context_.end_math();
end_object();
math_context_.set_styles_context(styles_context());
calculate_font_metrix(L"Cambria Math", 12, false, false); // смотреть по формуле - перевычислять только если есть изменения
int count_symbol_height = 3; //сосчитать в math_context_
int count_symbol_width = 10;
_CP_OPT(double)width = convert_symbol_width(count_symbol_width);
_CP_OPT(double)height = convert_symbol_width(count_symbol_height);
calculate_font_metrix(math_context_.font, math_context_.size, false, false); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
int count_symbol_height = 30; //сосчитать в math_context_ кол-во этажей
int count_symbol_width = 100; //длина символов
//if (false == math_context_.in_text_box_)
// drawing_context()->set_size(width, height);
_CP_OPT(double)width = convert_symbol_width(math_context_.symbol_counter * 1.73); // либра рамка формулы(её параметры)
_CP_OPT(double)height = convert_symbol_width(1.73 * (math_context_.lvl_max - math_context_.lvl_min));
if (false == math_context_.in_text_box_)
drawing_context()->set_size(width, height); // раскомиттить по завершению
drawing_context()->end_object(!math_context_.in_text_box_);
@ -352,6 +351,11 @@ void odf_conversion_context::end_math()
{
drawing_context()->end_drawing();
}
this->math_context()->symbol_counter = 0;
this->math_context()->lvl_max = 1;
this->math_context()->lvl_min = -1;
this->math_context()->lvl_down_counter = -1;
this->math_context()->lvl_up_counter = 1;
}
void odf_conversion_context::end_text()
{

View File

@ -110,7 +110,8 @@ namespace odf_writer
static formulasconvert::oox2odf_converter formulas_converter_math;
odf_math_context::odf_math_context(odf_conversion_context *odf_context)
: impl_(new odf_math_context::Impl(odf_context)), lvl_of_me(0), counter(0), annotation_flag(true), matrix_row_counter(0)
: impl_(new odf_math_context::Impl(odf_context)),
lvl_of_me(0), style_flag(true), counter(0), symbol_counter(0), annotation_flag(true), annotation_oper_flag(false), matrix_row_counter(0)
{
mo = { L'+', L'-', L'±', L'', L'', L'×', L'', L'÷', L'/', L'', L'', L'', L'', L'', L'', L'', L'¬', L'', L'', // un/bi operators
L'=', L'', L'<', L'', L'>', L'', L'', L'', L'', L'~', L'', L'', L'', L'', L'', L'|', L'', L'', L'', // relations
@ -129,7 +130,7 @@ namespace odf_writer
};
annotation_diak_symbols = { {L"˙",L"dot"}, {L"¨",L"ddot"}, {L"",L"dddot"}, {L"&#708;", L"hat"}, {L"ˇ",L"check"}, {L"´",L"acute"}, {L"&#715;",L"grave"}, {L"˘",L"breve"},
{L"~",L"tilde"},{L"¯",L"overline"},{L"",L"vec"}, {L"",L"harpoon"}, {L"&#45;",L"unnderline"}/*, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""},{L"",L""},
{L"~",L"tilde"},{L"¯",L"overline"},{L"",L"vec"}, {L"",L"harpoon"}, {L"&#45;",L"underline"}/*, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""}, {L"",L""},{L"",L""},
{L"",L""}*/
};
@ -144,6 +145,11 @@ namespace odf_writer
annotation_brackets_end = { {L")", L")"}, {L"]", L"]"}, {L"}", L"rbrace"}, {L"", L"rangle"}, {L"", L"rangle"},{L"", L"rfloor"}, {L"", L"rceil"}, {L"|", L"rline"}, {L"", L"rdline"},
{L"[", L"["}, {L"", L"rdbracket"}
};
lvl_counter = 1;
lvl_up_counter = 1;
lvl_down_counter = -1;
lvl_max = 1;
lvl_min = -1;
//debug_stream.open(debug_fileName);
}
@ -184,6 +190,7 @@ namespace odf_writer
impl_->current_level_.push_back(level_state);
impl_->current_math_state_.elements_.push_back(state);
style_flag = true;
}
bool odf_math_context::start_element(office_element_ptr & elm)
@ -226,4 +233,4 @@ namespace odf_writer
impl_->clear_current();
}
}
}
}

View File

@ -43,13 +43,36 @@
#define CREATE_MATH_TAG(tag)\
odf_writer::office_element_ptr elm;\
odf_writer::create_element(L"math", tag, elm, odf_context());\
//odf_context()->math_context()->debug_stream << tag << "\n";
odf_context()->math_context()->current_tag = tag;
//odf_context()->math_context()->debug_stream << tag << "\n";
#define OPEN_MATH_TAG(elm)\
odf_context()->math_context()->tagFlag.push_back(odf_context()->math_context()->start_element(elm)); \
if(odf_context()->math_context()->tagFlag.back()) \
odf_context()->math_context()->counter++; \
//odf_context()->math_context()->debug_stream << L"open, counter is " << odf_context()->math_context()->counter << "\n";
odf_context()->math_context()->tagFlag.push_back(odf_context()->math_context()->start_element(elm));\
if (odf_context()->math_context()->current_tag == L"mn")\
{\
typedef odf_writer::math_mn* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->current_tag == L"mi")\
{\
typedef odf_writer::math_mi* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->current_tag == L"mo")\
{\
typedef odf_writer::math_mo* T;\
T tmp = dynamic_cast<T>(elm.get());\
odf_context()->math_context()->symbol_counter += tmp->text_.get().size();\
}\
if (odf_context()->math_context()->tagFlag.back())\
{\
odf_context()->math_context()->counter++;\
}\
odf_context()->math_context()->current_tag = L"";
//odf_context()->math_context()->debug_stream << L"open, counter is " << odf_context()->math_context()->counter << "\n";
#define CLOSE_MATH_TAG\
if(odf_context()->math_context()->tagFlag.back()) \
@ -57,7 +80,7 @@
odf_context()->math_context()->end_element();\
odf_context()->math_context()->counter--; \
}\
odf_context()->math_context()->tagFlag.pop_back(); \
odf_context()->math_context()->tagFlag.pop_back();
//odf_context()->math_context()->debug_stream /*std::wcout*/ << L"close, counter is " << odf_context()->math_context()->counter << "\n";
@ -72,18 +95,18 @@ namespace cpdoccore {
class odf_math_context
{
public:
odf_math_context(odf_conversion_context *odf_context);
odf_math_context(odf_conversion_context* odf_context);
~odf_math_context();
void set_styles_context(odf_style_context * style_context);
void set_styles_context(odf_style_context* style_context);
odf_drawing_context *drawing_context();
odf_text_context *text_context();
odf_drawing_context* drawing_context();
odf_text_context* text_context();
void start_math(office_element_ptr& root);
bool start_element(office_element_ptr& elm); // office_math_element TODO
void start_math(office_element_ptr & root);
bool start_element(office_element_ptr & elm); // office_math_element TODO
void end_element();
std::vector<std::vector<std::wstring>> brackets;
@ -91,10 +114,21 @@ namespace cpdoccore {
int lvl_of_me;
int matrix_row_counter;
std::vector<int> end_counter;
int counter;
bool style_flag;
int counter;
std::wstring current_tag;
int symbol_counter;
double lvl_counter;
double lvl_up_counter;
double lvl_down_counter;
double lvl_max;
double lvl_min;
std::wstring font;
double size;
std::set<wchar_t> mo;
std::map<std::wstring, std::wstring> diak_symbols;
bool annotation_flag;
bool annotation_oper_flag;
std::map<std::wstring, std::wstring> annotation_operators;
std::map<std::wstring, std::wstring> annotation_brackets_begin;
std::map<std::wstring, std::wstring> annotation_brackets_end;