Commit e26cf3bf authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - convert pptx->odp

parent 8525a1e9
......@@ -36,7 +36,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/timer.hpp>
#include <iostream>
#include <string>
......@@ -109,6 +108,7 @@ std::wstring DetectTypeDocument(const std::wstring & pathOOX)
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
{
sRes = L"presentation";
}
delete []pBuffer;
......@@ -124,7 +124,6 @@ int _tmain(int argc, _TCHAR* argv[])
if (argc < 3) return 0;
HRESULT hr = S_OK;
boost::timer t1;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argv[2];
......@@ -154,7 +153,5 @@ int _tmain(int argc, _TCHAR* argv[])
NSDirectory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
......@@ -195,7 +195,7 @@
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;DONT_WRITE_EMBEDDED_FONTS"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
......@@ -449,6 +449,14 @@
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
......
......@@ -44,7 +44,7 @@
// shapetypeHeptagon,
// shapetypeNonIsoscelesTrapezoid,
// shapetypePie,
// shapetypePieWedge,
//+ shapetypePieWedge,
//+ shapetypePlaque,
// shapetypePlaqueTabs,
// shapetypeSquareTabs,
......@@ -324,7 +324,7 @@ public:
}
};
class oox_shape_Gear6 : public oox_shape
class oox_shape_Gear6 : public oox_shape
{
public:
oox_shape_Gear6()
......@@ -411,7 +411,7 @@ public:
/////////////////////////////////////////////////////////
}
};
class oox_shape_Gear9 : public oox_shape
class oox_shape_Gear9 : public oox_shape
{
public:
oox_shape_Gear9()
......@@ -758,4 +758,31 @@ public:
/////////////////////////////////////////////////////////
}
};
class oox_shape_PieWedge : public oox_shape
{
public:
oox_shape_PieWedge()
{
odf_type_name =L"ooxml-PieWedge";
enhanced_path = L"M 0 ?f7 G ?f8 ?f9 ?f10 ?f11 L ?f4 ?f7 Z N";
text_areas = L"?f2 ?f3 ?f4 ?f7";
view_box = L"0 0 0 0";
add(L"f0", L"logwidth*cos(pi*(13500000)/10800000)");
add(L"f1", L"logheight*sin(pi*(13500000)/10800000)");
add(L"f2", L"logwidth+?f0 -0");
add(L"f3", L"logheight+?f1 -0");
add(L"f4", L"logwidth");
add(L"f5", L"logheight/2");
add(L"f6", L"logwidth/2");
add(L"f7", L"logheight");
add(L"f8", L"logwidth");
add(L"f9", L"logheight");
add(L"f10", L"(10800000)/60000.0");
add(L"f11", L"(5400000)/60000.0");
/////////////////////////////////////////////////////////
}
};
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "draw_page.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
void draw_page_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:id", draw_id_);
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"presentation:presentation-page-layout-name", page_layout_name_);
CP_APPLY_ATTR(L"draw:master-page-name", master_page_name_);
CP_APPLY_ATTR(L"presentation:use-date-time-name", use_date_time_name_);
CP_APPLY_ATTR(L"presentation:use-footer-name", use_footer_name_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_page::ns = L"draw";
const wchar_t * draw_page::name = L"page";
void draw_page::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"anim", L"par")
CP_CREATE_ELEMENT(animation_);
else
CP_CREATE_ELEMENT(content_);
}
void draw_page::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if(type == typeAnimPar)
animation_ = child_element;
else
content_.push_back(child_element);
}
void draw_page::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_page_attr_.add_attributes(Attributes);
}
void draw_page::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_footer_decl::ns = L"presentation";
const wchar_t * presentation_footer_decl::name = L"footer-decl";
void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"presentation:name", presentation_name_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_date_time_decl::ns = L"presentation";
const wchar_t * presentation_date_time_decl::name = L"date-time-decl";
void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"presentation:name", presentation_name_);
CP_APPLY_ATTR(L"presentation:source", presentation_source_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "presentationclass.h"
namespace cpdoccore {
namespace odf_writer {
class draw_page_attr
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_id_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) page_layout_name_;
_CP_OPT(std::wstring) master_page_name_;
_CP_OPT(std::wstring) use_footer_name_;
_CP_OPT(std::wstring) use_date_time_name_;
};
class draw_page : public office_element_impl<draw_page>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPage;
CPDOCCORE_DEFINE_VISITABLE();
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);
void add_attributes( const xml::attributes_wc_ptr & Attributes );
office_element_ptr_array content_;
office_element_ptr animation_;
draw_page_attr draw_page_attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_page);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//presentation:footer-decl
class presentation_footer_decl : public office_element_impl<presentation_footer_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationFooterDecl;
CPDOCCORE_DEFINE_VISITABLE();
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){}
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) presentation_name_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_footer_decl);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//presentation:date-time-decl
class presentation_date_time_decl : public office_element_impl<presentation_date_time_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationDateTimeDecl;
CPDOCCORE_DEFINE_VISITABLE();
_CP_OPT(std::wstring) presentation_name_;
_CP_OPT(std::wstring) presentation_source_;
_CP_OPT(std::wstring) style_data_style_name_;
std::wstring text_;
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){}
void add_attributes( const xml::attributes_wc_ptr & Attributes );
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl);
}
}
......@@ -228,8 +228,6 @@ namespace odf_writer
}
}
void object_files::set_content(content_content_ptr & _content)
{
content_.set_content(_content);
......
......@@ -189,6 +189,11 @@ 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);
}
void odf_conversion_context::create_object()
{
_object obj;
......@@ -220,6 +225,10 @@ 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
......@@ -227,6 +236,11 @@ void odf_conversion_context::end_object()
office_element_ptr & odf_conversion_context::get_current_object_element()
{
if (objects_.empty())
{
create_object();
}
return objects_[current_object_].content;
}
......
......@@ -115,6 +115,9 @@ public:
void start_text();
void end_text();
void start_presentation();
void end_presentation();
void create_object();
void end_object();
......
......@@ -1797,9 +1797,8 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->content().fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
}
void odf_drawing_context::set_textarea_font(_CP_OPT(std::wstring) & latin, _CP_OPT(std::wstring) & cs, _CP_OPT(std::wstring) & ea)
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
if (!latin && !cs && !ea)return;
if (impl_->current_drawing_state_.elements_.empty())return;
if (!impl_->current_text_properties)
......@@ -1813,9 +1812,9 @@ void odf_drawing_context::set_textarea_font(_CP_OPT(std::wstring) & latin, _CP_O
if (!impl_->current_text_properties) return;
if (ea) impl_->current_text_properties->content().fo_font_family_ = *ea;
if (cs) impl_->current_text_properties->content().style_font_family_complex_= *cs;
if (latin) impl_->current_text_properties->content().style_font_family_asian_ = *latin;
if (!ea.empty()) impl_->current_text_properties->content().fo_font_family_ = ea;
if (!cs.empty()) impl_->current_text_properties->content().style_font_family_complex_= cs;
if (!latin.empty()) impl_->current_text_properties->content().style_font_family_asian_ = latin;
}
void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)
......
......@@ -203,7 +203,7 @@ public:
void set_textarea_writing_mode (int mode);
void set_textarea_wrap (bool val);
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (_CP_OPT(std::wstring) & latin, _CP_OPT(std::wstring) & cs, _CP_OPT(std::wstring) & ea);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style ();
void set_gradient_type (odf_types::gradient_style::type style);
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include <boost/algorithm/string.hpp>
#include "../utils.h"
#include "odp_conversion_context.h"
#include "office_presentation.h"
#include "styles.h"
#include "style_table_properties.h"
#include "odf_text_context.h"
#include "paragraph_elements.h"
#include "odf_settings_context.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
odp_conversion_context::odp_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this)
//, current_text_context_(NULL)
{
}
void odp_conversion_context::start_document()
{
start_presentation();
root_presentation_ = dynamic_cast<office_presentation*>(get_current_object_element().get());
}
void odp_conversion_context::end_document()
{
odf_conversion_context::end_document();
}
void odp_conversion_context::start_slide()
{
create_element(L"draw", L"page", root_presentation_->pages_, this);
slide_context_.start_page(root_presentation_->pages_.back());
drawing_context()->set_styles_context(styles_context());
page_layout_context()->set_styles_context(styles_context());
//page_layout_context()->add_master_page(L"");
//current_table().set_table_master_page(page_layout_context()->last_master() ?
// page_layout_context()->last_master()->get_name() : L"");
}
void odp_conversion_context::end_slide()
{
slide_context_.end_page();
//
//styles_context()->reset_defaults();
}
void odp_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
}
void odp_conversion_context::end_text_context()
{
if (current_text_context_)
delete current_text_context_;
current_text_context_ = NULL;
}
void odp_conversion_context::start_drawings()
{
}
void odp_conversion_context::end_drawings()
{
current_slide().drawing_context()->clear();
}
void odp_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
current_slide().drawing_context()->start_image(odf_ref_name);
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "odf_conversion_context.h"
#include "odp_slide_context.h"
namespace cpdoccore {
namespace odf_writer {
class office_presentation;
class odf_text_context;
class odp_conversion_context : public odf_conversion_context
{
public:
odp_conversion_context(package::odf_document * outputDocument);
virtual void start_document();
virtual void end_document();
void start_slide();
void end_slide();
///////////////////////////////////////////////////////
odp_page_state & current_slide() { return slide_context_.state();}
/////////////////////////////////////////////////////
virtual void start_text_context();
virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
virtual odf_text_context * text_context() {return current_text_context_;}
void start_drawings();
void end_drawings();
virtual void start_image(const std::wstring & image_file_name);
private:
odp_slide_context slide_context_;
odf_text_context* current_text_context_;
office_presentation* root_presentation_;
};
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "logging.h"
#include <boost/algorithm/string.hpp>
#include <boost/date_time.hpp>
#include "odp_page_state.h"
#include "odf_text_context.h"
#include "odp_conversion_context.h"
#include "draw_page.h"
#include "office_annotation.h"
#include "styles.h"
#include "style_table_properties.h"
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
///////////////////////////////////////////////////////////////
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
: context_(Context), drawing_context_(Context)
{
draw_page_ = elm;
}
void odp_page_state::set_page_name(std::wstring name)
{
office_page_name_ = name;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return;
page->draw_page_attr_.draw_name_ = name;
}
void odp_page_state::set_page_master_page(std::wstring name)
{
if (!office_page_style_)return;
office_page_style_->style_master_page_name_ = name;
}
void odp_page_state::set_page_style(office_element_ptr & elm)
{
office_page_style_ = dynamic_cast<style*>(elm.get());
if (!office_page_style_)return;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return;
page->draw_page_attr_.draw_style_name_ = office_page_style_->style_name_;
//потом в принципе и по имени можно будет связать(найти)
}
void odp_page_state::add_child_element( const office_element_ptr & child_element)
{
draw_page_->add_child_element(child_element);
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include <vector>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
#include "odf_drawing_context.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf_types
{
class color;
}
namespace odf_writer {
class odp_conversion_context;
class odf_text_context;
//class table_table;
class style;
struct odp_element_state
{
office_element_ptr elm;
short repeated;
std::wstring style_name;
office_element_ptr style_elm;
};
class odp_page_state
{
public:
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_page_name(std::wstring name);
void set_page_style(office_element_ptr & _style);
void set_page_master_page(std::wstring name);
void add_child_element( const office_element_ptr & child_element);
///////////////////////////////
odf_drawing_context * drawing_context(){return &drawing_context_;}
std::wstring office_page_name_;
office_element_ptr draw_page_;
private:
odf_conversion_context * context_;
style* office_page_style_;
odf_drawing_context drawing_context_;
friend class odp_slide_context;
};
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "odp_slide_context.h"
//#include "table.h"
#include "odp_conversion_context.h"
#include "logging.h"
#include <iostream>
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context)
{
}
odp_page_state & odp_slide_context::state()
{
return page_state_list_.back();
}
void odp_slide_context::start_page(office_element_ptr & elm)
{
page_state_list_.push_back( odp_page_state(&context_, elm) );
std::wstring style_name_new = L"ta" + boost::lexical_cast<std::wstring>(page_state_list_.size());
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::DrawingPage, true);
style->create_child_element(L"style", L"drawing-page-properties");
state().set_page_style(style);
//для свойств страницы, а не таблицы - нужно создать master-page c page layout и связать по имени со стилем таблицы
//причем здесь, т.к. с другой стороны это ВСЕ еще свойства листа. то есть совйства листа разделить на свйства страницы и таблицы ..
//todooo
//????
}
void odp_slide_context::end_page()
{
state().drawing_context()->finalize(state().draw_page_);
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <string>
#include "odp_page_state.h"
namespace cpdoccore {
namespace odf_writer {
class odp_conversion_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
class odp_slide_context
{
public:
odp_slide_context(odp_conversion_context & Context);
void start_page(office_element_ptr & elm);
void end_page();
odp_page_state & state();
private:
odp_conversion_context & context_;
std::list<odp_page_state> page_state_list_;
friend class odp_conversion_context;
};
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "office_presentation.h"
#include "draw_page.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf_writer {
// office:presentation
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_presentation::ns = L"office";
const wchar_t * office_presentation::name = L"presentation";
void office_presentation::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"page")
CP_CREATE_ELEMENT(pages_);
else if CP_CHECK_NAME(L"presentation", L"footer-decl")
CP_CREATE_ELEMENT(footer_decls_);
else if CP_CHECK_NAME(L"presentation", L"date-time-decl")
CP_CREATE_ELEMENT(date_time_decls_);
}
void office_presentation::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typePresentationDateTimeDecl)
{
date_time_decls_.push_back(child_element);
}
else if ( type == typePresentationFooterDecl)
{
footer_decls_.push_back(child_element);
}
else if ( type == typeDrawPage)
{
pages_.push_back(child_element);
}
}
void office_presentation::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < pages_.size(); i++)
{
pages_[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf_writer {
// office:presentation
class office_presentation : public office_element_impl<office_presentation>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficePresentation;
CPDOCCORE_DEFINE_VISITABLE();
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);
public:
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
office_element_ptr_array pages_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_presentation);
}
}
......@@ -79,6 +79,8 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypePlaque: return boost::make_shared<oox_shape_Plaque>();
case SimpleTypes::shapetypeDoubleWave: return boost::make_shared<oox_shape_DoubleWave>();
case SimpleTypes::shapetypePieWedge: return boost::make_shared<oox_shape_PieWedge>();
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
......
......@@ -68,8 +68,9 @@ namespace OOX
class CText;
class CAlternateContent;
class CDrawing;
class CGroupShape;
class CShape;
// class CGroupShape;
// class CShape;
class CControl;
class CPicture;
class CObject;
class CPBdr;
......@@ -146,7 +147,7 @@ namespace Oox2Odf
virtual void write(const std::wstring & path);
virtual odf_writer::odf_conversion_context *odf_context();
virtual OOX::CTheme *oox_theme();
virtual PPTX::Theme *oox_theme();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId);
......@@ -214,17 +215,11 @@ namespace Oox2Odf
void convert(OOX::Logic::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing);
void convert(OOX::Logic::CGroupShape *oox_group_shape);
void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Logic::CPicture *oox_picture);
void convert(OOX::Logic::CLockedCanvas *oox_canvas);
void convert(OOX::Logic::CPicture *oox_pict);
void convert(OOX::Logic::CObject *oox_obj);
void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline);
void convert(OOX::Drawing::CGraphic *oox_graphic);
void convert(OOX::Drawing::CChart *oox_chart);
void convert(OOX::Drawing::CPicture *oox_picture);
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color);
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "PptxConverter.h"
#include "../utils.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h"
#include <boost/lexical_cast.hpp>
#include "../OdfFormat/odp_conversion_context.h"
#include "../OdfFormat/odf_text_context.h"
#include "../OdfFormat/odf_drawing_context.h"
#include "../OdfFormat/styles.h"
#include "../OdfFormat/style_table_properties.h"
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#include "../OdfFormat/style_graphic_properties.h"
#include "../OdfFormat/styles_list.h"
using namespace cpdoccore;
namespace Oox2Odf
{
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
const OOX::CPath oox_path(std::wstring(path.c_str()));
pptx_document = new PPTX::Folder();
if (!pptx_document->isValid(oox_path.GetPath())) // true ???
{
delete pptx_document;
return;
}
pptx_document->read(oox_path.GetPath() + FILE_SEPARATOR_STR, NULL);
smart_ptr<PPTX::Presentation> presentation_ptr = pptx_document->Get(OOX::Presentation::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation_ptr.is_init())
{
delete pptx_document;
return;
}
presentation = presentation_ptr.operator->();
output_document = new odf_writer::package::odf_document(L"presentation");
odp_context = new odf_writer::odp_conversion_context(output_document);
current_slide = NULL;
current_theme = NULL;
pCallBack = CallBack;
if (UpdateProgress(290000))return;
}
PptxConverter::~PptxConverter()
{
current_slide = NULL;
current_theme = NULL;
presentation = NULL;
if (odp_context) delete odp_context; odp_context = NULL;
if (pptx_document) delete pptx_document; pptx_document = NULL;
if (output_document) delete output_document; output_document = NULL;
}
void PptxConverter::write(const std::wstring & path)
{
if (!output_document)return;
output_document->write(path);
if (UpdateProgress(1000000))return;
}
odf_writer::odf_conversion_context* PptxConverter::odf_context()
{
return odp_context;
}
PPTX::Theme* PptxConverter::oox_theme()
{
return current_theme;
}
NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId)
{
smart_ptr<OOX::File> oFile;
if (pptx_document)
{
if (oox_current_child_document)
oFile = oox_current_child_document->Find(sId);
else if (current_slide)
oFile = current_slide->Find(sId);
else
oFile = pptx_document->Find(sId);
}
return oFile;
}
std::wstring PptxConverter::find_link_by_id (std::wstring sId, int type)
{
std::wstring ref;
if (ref.empty() && oox_current_child_document)
{
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
if (oFile.IsInit())
{
if (type==1 && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
if (type==2 && oFile.IsInit() && OOX::FileTypes::HyperLink == oFile->type())
{
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
ref = pHyperlink->Uri().GetPath();
}
}
}
smart_ptr<OOX::File> oFile = current_slide ? current_slide->Find(sId) : pptx_document->Find(sId);
if (ref.empty() && oFile.IsInit())
{
if (type==1 && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
{
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
ref = pHyperlink->Uri().GetPath();
}
}
return ref;
}
void PptxConverter::convertDocument()
{
if (!pptx_document) return;
if (!odp_context) return;
odp_context->start_document();
if (UpdateProgress(300000))return;
//convert_settings();
convert_slides();
if (UpdateProgress(800000))return;
//удалим уже ненужный документ pptx
delete pptx_document; pptx_document = NULL;
odp_context->end_document();
if (UpdateProgress(850000))return;
}
void PptxConverter::convert_slides()
{
for (size_t i = 0; i < presentation->sldIdLst.size(); ++i)
{
std::wstring rId = presentation->sldIdLst[i].rid.get();
smart_ptr<PPTX::Slide> slide = ((*presentation)[rId]).smart_dynamic_cast<PPTX::Slide>();
if (slide.IsInit() == false)
{
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
}
current_slide = slide.operator->();
current_theme = slide->theme.operator->();
//smart_ptr<SlideLayout> Layout;
//smart_ptr<SlideMaster> Master;
odp_context->start_slide();
convert(slide->cSld.GetPointer());
//nullable_bool show;
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
//nullable<Logic::ClrMapOvr> clrMapOvr;
//nullable<Logic::CSld> cSld;
//nullable<Logic::Transition> transition;
//nullable<Logic::Timing> timing;
//smart_ptr<NotesSlide> Note;
//smart_ptr<Theme> theme;
//smart_ptr<OOX::CVmlDrawing> Vml;
//smart_ptr<TableStyles> tableStyles_;
//smart_ptr<PPTX::Comments> comments;
odp_context->end_slide();
}
}
void PptxConverter::convert(OOX::WritingElement *oox_unknown)
{
if (oox_unknown == NULL)return;
switch(oox_unknown->getType())
{
default:
{
OoxConverter::convert(oox_unknown);
}break;
}
}
void PptxConverter::convert(PPTX::Logic::CSld *slide)
{
if (slide == NULL) return;
if (slide->attrName.IsInit())
odp_context->current_slide().set_page_name(slide->attrName.get());
for (size_t i = 0 ; i < slide->spTree.SpTreeElems.size(); i++)
{
convert(slide->spTree.SpTreeElems[i].GetElem().operator->());
}
//nullable<Bg> bg;
//nullable<Controls> controls;
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
namespace OOX
{
class CTheme;
}
namespace PPTX
{
class Presentation;
class Folder;
namespace Logic
{
class CSld;
class Transition;
class Timing;
}
}
namespace cpdoccore
{
namespace odf_writer
{
namespace package
{
class odf_document;
}
class ods_conversion_context;
class odf_conversion_context;
class odt_conversion_context;
class odp_conversion_context;
}
}
using namespace cpdoccore;
namespace Oox2Odf
{
class PptxConverter : public OoxConverter
{
public:
PptxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
~PptxConverter();
virtual void convertDocument();
virtual void write(const std::wstring & path);
virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id (std::wstring sId);
void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *slide);
private:
PPTX::Folder *pptx_document;
PPTX::Presentation *presentation;
cpdoccore::odf_writer::package::odf_document *output_document;
PPTX::Theme *current_theme;
OOX::IFileContainer *current_slide;
odf_writer::odp_conversion_context *odp_context;
void convert_slides ();
//--------------------------------------------------------------------------------
};
}
......@@ -72,13 +72,7 @@ namespace OOX
class CCellAnchor;
class CDrawing;
class CFromTo;
class CPic;
class CShape;
class CConnShape;
class CGroupShape;
class CCommentItem;
class CGraphicFrame;
class CGraphicChart;
class CDefinedName;
class CConditionalFormatting;
class CConditionalFormattingRule;
......@@ -137,14 +131,14 @@ namespace Oox2Odf
virtual void write(const std::wstring & path);
virtual odf_writer::odf_conversion_context *odf_context();
virtual OOX::CTheme *oox_theme();
virtual PPTX::Theme *oox_theme();
virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId);
void convert(OOX::Spreadsheet::WritingElement *oox_unknown);
private:
OOX::Spreadsheet::CXlsx *xlsx_document;
OOX::Spreadsheet::IFileContainer *xlsx_current_container;
OOX::IFileContainer *xlsx_current_container;
odf_writer::ods_conversion_context *ods_context;
......@@ -196,11 +190,6 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position * pos);
void convert(OOX::Spreadsheet::CPic *oox_picture);
void convert(OOX::Spreadsheet::CShape *oox_shape);
void convert(OOX::Spreadsheet::CConnShape *oox_conn_shape);
void convert(OOX::Spreadsheet::CGroupShape *oox_group_shape);
void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt);
void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule);
void convert(OOX::Spreadsheet::CAutofilter *oox_filter);
......
......@@ -345,6 +345,14 @@
RelativePath="..\OdfFormat\draw_frame.h"
>
</File>
<File
RelativePath="..\OdfFormat\draw_page.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\draw_page.h"
>
</File>
<File
RelativePath="..\OdfFormat\draw_shapes.cpp"
>
......@@ -385,6 +393,14 @@
RelativePath="..\OdfFormat\office_chart.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_presentation.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\office_presentation.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_settings.cpp"
>
......@@ -697,6 +713,30 @@
<Filter
Name="odf presentation"
>
<File
RelativePath="..\OdfFormat\odp_conversion_context.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\odp_conversion_context.h"
>
</File>
<File
RelativePath="..\OdfFormat\odp_page_state.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\odp_page_state.h"
>
</File>
<File
RelativePath="..\OdfFormat\odp_slide_context.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\odp_slide_context.h"
>
</File>
</Filter>
<Filter
Name="odf common"
......
......@@ -171,7 +171,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../ASCOfficeOdfFile/include;../../../ASCOfficeOdfFile/src/odf/datatypes"
PreprocessorDefinitions="NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;BUILD_CONFIG_FULL_VERSION"
PreprocessorDefinitions="NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;BUILD_CONFIG_FULL_VERSION;DONT_WRITE_EMBEDDED_FONTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
......@@ -278,7 +278,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\Oox2OdfConverter\ConvertDiagram.cpp"
RelativePath="..\Oox2OdfConverter\ConvertDrawing.cpp"
>
</File>
<File
......@@ -297,6 +297,10 @@
RelativePath="..\Oox2OdfConverter\DocxConverter.cpp"
>
</File>
<File
RelativePath="..\Oox2OdfConverter\PptxConverter.cpp"
>
</File>
<File
RelativePath="..\Oox2OdfConverter\XlsxConverter.cpp"
>
......@@ -315,6 +319,10 @@
RelativePath="..\Oox2OdfConverter\DocxConverter.h"
>
</File>
<File
RelativePath="..\Oox2OdfConverter\PptxConverter.h"
>
</File>
<File
RelativePath="..\Oox2OdfConverter\VmlShapeTypes2Oox.h"
>
......
This diff is collapsed.
......@@ -121,6 +121,8 @@ namespace NExtractTools
int docx_dir2odt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int xlsx2ods (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int xlsx_dir2ods (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int pptx2odp (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int pptx_dir2odp (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int fromMscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
int mscrypt2oox (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
......@@ -150,6 +152,7 @@ namespace NExtractTools
int fromCanvasPdf(const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params);
int fromInputParams(InputParams& oInputParams);
X2T_DECL_EXPORT int FromFile(const std::wstring& file);
X2T_DECL_EXPORT int FromXml(const std::wstring& xml);
}
......
......@@ -128,6 +128,7 @@ namespace NExtractTools
if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPTX2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPTX2PPTT;
else if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPSX2PPTX;
else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
{
......
......@@ -131,7 +131,12 @@ namespace NExtractTools
TCD_XLST2ODS,
TCD_XLST_BIN2ODS,
TCD_XML2DOCX,
//2 odp
TCD_PPTX2ODP,
TCD_PPTT2ODP,
TCD_PPTX_BIN2ODP,
TCD_XML2DOCX,
TCD_DOCX2XML,
//
TCD_MSCRYPT2,
......
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="X2tTest"
ProjectGUID="{355A22F4-1394-4B82-B2F1-FF0ECFB9E3EF}"
RootNamespace="X2tTest"
......@@ -595,6 +595,10 @@
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ReaderClasses.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\Readers.h"
>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment