Commit ad91c909 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

(1.0.0.152): ASCOfficeOdfFile

презентации - таблицы и диагарммы

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53201 954022d7-b5bf-4e40-9824-e11837661b57
parent b1f976ba
......@@ -70,9 +70,7 @@ HRESULT ConvertOO2OOX(const std::wstring &ext, const std::wstring & srcPath, con
case 3:
hr = ConvertOdp2Pptx(inputDoc,dstPath);
break;
}
}
catch(...)
{
......
......@@ -2,6 +2,6 @@
//1
//0
//0
//149
#define INTVER 1,0,0,149
#define STRVER "1,0,0,149\0"
//153
#define INTVER 1,0,0,153
#define STRVER "1,0,0,153\0"
......@@ -5,8 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpxml", "cpxml.vcproj", "{4
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpodf", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}"
......@@ -16,18 +16,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "ASCOfficeOdfFile\ASCOfficeOdfFile.vcproj", "{64B09C98-22DC-494E-A882-9E2D7D18557C}"
ProjectSection(ProjectDependencies) = postProject
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "examples\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{64B09C98-22DC-494E-A882-9E2D7D18557C} = {64B09C98-22DC-494E-A882-9E2D7D18557C}
EndProjectSection
EndProject
......
......@@ -1626,6 +1626,14 @@
RelativePath=".\src\docx\pptx_slide_context.h"
>
</File>
<File
RelativePath=".\src\docx\pptx_table_context.cpp"
>
</File>
<File
RelativePath=".\src\docx\pptx_table_context.h"
>
</File>
<File
RelativePath=".\src\docx\pptx_text_context.cpp"
>
......@@ -1964,6 +1972,10 @@
RelativePath=".\src\odf\table_named_expressions.h"
>
</File>
<File
RelativePath=".\src\odf\table_pptx.cpp"
>
</File>
<File
RelativePath=".\src\odf\table_xlsx.cpp"
>
......
......@@ -7,6 +7,7 @@
#include <string>
#import "../../../Redist/ASCOfficeOdfFile.dll" rename_namespace("ASCOfficeOdfFile"), raw_interfaces_only
#import "../../../Redist/ASCPresentationEditor.dll" rename_namespace("Editor"), raw_interfaces_only
#define HR_RET(HR) if FAILED(hr = (HR)) { _ASSERTE(false); return -1; }
......@@ -22,21 +23,15 @@ int ConvertSingle(int argc, _TCHAR* argv[])
return 0;
}
int ConvertMulti(int argc, _TCHAR* argv[])
int PresentationEditor(int argc, _TCHAR* argv[])
{
ATL::CComPtr<ASCOfficeOdfFile::IASCOfficeFileTemplate> officeOdfFile;
ATL::CComPtr<Editor::IAVSPresentationEditor> officeEditor;
HRESULT hr;
HR_RET(officeOdfFile.CoCreateInstance(__uuidof(ASCOfficeOdfFile::COfficeOdfFile)));
HR_RET(officeEditor.CoCreateInstance(__uuidof(Editor::CAVSPresentationEditor)));
boost::timer t1;
for (int i = 0; i < argc - 2; ++i)
{
const std::wstring input = argv[i + 2];
const std::wstring output = input + std::wstring(L".docx");
officeOdfFile->LoadFromFile(ATL::CComBSTR(input.c_str()), ATL::CComBSTR(output.c_str()), NULL);
}
hr = officeEditor->ConvertToPPTY(ATL::CComBSTR(argv[1]),ATL::CComBSTR(argv[2]));
//hr = officeEditor->OpenFile(ATL::CComBSTR(argv[1]));
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
......@@ -44,17 +39,10 @@ int ConvertMulti(int argc, _TCHAR* argv[])
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
if (argc < 3)
return -1;
if (std::wstring(argv[1]) == L"-m")
{
return ConvertMulti(argc, argv);
}
else
{
//return PresentationEditor(argc, argv);
return ConvertSingle(argc, argv);
}
return 0;
}
......@@ -260,9 +260,9 @@ void docx_serialize_chart(std::wostream & strm, _docx_drawing const & val)
CP_XML_ATTR(L"uri", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_NODE(L"c:chart")
{
CP_XML_ATTR(L"r:id", val.chartId);
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id", val.chartId);
}
}
}
......
#ifndef _CPDOCCORE_DOCX_TABLE_CONVERSIONCONTEXT_H_
#define _CPDOCCORE_DOCX_TABLE_CONVERSIONCONTEXT_H_
#pragma once
#include <string>
#include <list>
......@@ -161,5 +160,3 @@ private:
}
}
#endif
......@@ -11,13 +11,14 @@ class rels;
class mediaitems
{
public:
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeHyperlink};
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink};
mediaitems(const std::wstring & odfPacket) : odf_packet_(odfPacket)
{
count_charts =0;
count_shape =0;
count_image =0;
count_tables =0;
}
struct item
......@@ -42,9 +43,11 @@ public:
size_t count_charts;
size_t count_image;
size_t count_shape;
size_t count_tables;
std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal);//
std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal, std::wstring & ref);
void dump_rels(rels & Rels);
items_array & items() { return items_; }
......
......@@ -80,7 +80,19 @@ void styles_context::docx_serialize_text_style(std::wostream & strm)
}
}
}
void styles_context::pptx_serialize_table_style(std::wostream & strm)
{
if (!table_style_.str().empty())
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:tblPr")
{
CP_XML_STREAM() << table_style_.str();
}
}
}
}
void styles_context::docx_serialize_table_style(std::wostream & strm)
{
......
......@@ -24,6 +24,8 @@ public:
void docx_serialize_text_style(std::wostream & strm);
void docx_serialize_table_style(std::wostream & strm);
void pptx_serialize_table_style(std::wostream & strm);
std::wstring & extern_node(){return extern_node_;}
std::wstring & hlinkClick(){return hlinkClick_;}
......
......@@ -269,12 +269,11 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
}
}
void oox_serialize_xfrm(std::wostream & strm, _oox_drawing const & val)
void oox_serialize_xfrm(std::wostream & strm, _oox_drawing const & val, std::wstring name_space)
{
CP_XML_WRITER(strm)
{
std::wstring xfrm = L"a:xfrm";
if (val.type == mediaitems::typeChart)xfrm = L"xdr:xfrm";
std::wstring xfrm = name_space + L":xfrm";
_CP_OPT(double) dRotate;
odf::GetProperty(val.additional,L"svg:rotate",dRotate);
......
......@@ -42,6 +42,7 @@ struct _oox_drawing
mediaitems::Type type;
size_t id;
std::wstring name;
size_t x, y;
......@@ -56,7 +57,7 @@ struct _oox_drawing
std::vector<odf::_property> additional;
friend void oox_serialize_xfrm( std::wostream & _Wostream, _oox_drawing const & val);
friend void oox_serialize_xfrm( std::wostream & _Wostream, _oox_drawing const & val,std::wstring name_space = L"a");
friend void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val);
friend void oox_serialize_ln (std::wostream & _Wostream, const std::vector<odf::_property> & val);
friend void oox_serialize_hlink (std::wostream & _Wostream, const std::vector<_hlink_desc> & val);
......
......@@ -201,6 +201,10 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
CP_XML_NODE(L"a:pattFill")
{
CP_XML_ATTR(L"prst",val.hatch->preset);
CP_XML_NODE(L"a:fgClr")// ms back
{
oox_serialize_srgb(CP_XML_STREAM(),val.hatch->color_ref,val.opacity);
}
if (val.hatch->color_back_ref)
{
CP_XML_NODE(L"a:bgClr")
......@@ -208,10 +212,7 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
oox_serialize_srgb(CP_XML_STREAM(),*val.hatch->color_back_ref,val.opacity);
}
}
CP_XML_NODE(L"a:fgClr")
{
oox_serialize_srgb(CP_XML_STREAM(),val.hatch->color_ref,val.opacity);
}
}
}
}
......
......@@ -35,6 +35,7 @@ pptx_conversion_context(::cpdoccore::oox::package::pptx_document * outputDocumen
output_document_(outputDocument)
,odf_document_(odfDocument)
,pptx_text_context_(odf_document_->odf_context(),*this)
,pptx_table_context_(*this)
,pptx_slide_context_(*this/*, pptx_text_context_*/)
{
}
......@@ -194,7 +195,8 @@ void pptx_conversion_context::end_document()
output_document_->get_ppt_files().add_slideLayout(content);//slideMaster.xml
}
/////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
//ðàçìåðû ñòðàíèö â ïðåçåíòàöèè
odf::odf_read_context & context = root()->odf_context();
odf::page_layout_container & pageLayouts = context.pageLayoutContainer();
if ((pageLayouts.master_pages().size()>0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
......@@ -206,10 +208,23 @@ void pptx_conversion_context::end_document()
if (pages_layouts)pages_layouts->pptx_convert(*this);
}
/////////////////////////////////////////////////////////////////////////////////////////////
pptx_serialize_size(current_presentation().notesSlidesSize(),6858000,9144000,L"p:notesSz");
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//äîáàâëÿåì äèàãðàììû
count = 0;
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
{
count++;
package::chart_content_ptr content = package::chart_content::create();
chart->write_to(content->content());
output_document_->get_ppt_files().add_charts(content);
}
output_document_->get_ppt_files().set_presentation(presentation_);
output_document_->get_ppt_files().set_themes(theme_);
......
......@@ -15,6 +15,7 @@
//#include "xlsx_defined_names.h"
//#include "xlsx_table_metrics.h"
#include "oox_chart_context.h"
#include "pptx_table_context.h"
#include "mediaitems.h"
......@@ -89,6 +90,8 @@ public:
oox_chart_context & current_chart();
pptx_text_context & get_text_context() { return pptx_text_context_; }
pptx_table_context & get_table_context(){return pptx_table_context_;}
// num_format_context & get_num_format_context() { return num_format_context_; }
// xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; }
......@@ -123,13 +126,14 @@ private:
pptx_slide_context pptx_slide_context_;
pptx_text_context pptx_text_context_;
pptx_table_context pptx_table_context_;
std::vector<oox_chart_context_ptr> charts_;
std::vector<pptx_xml_slide_ptr> slides_;
std::vector<pptx_xml_slideMaster_ptr> slideMasters_;
std::vector<pptx_xml_slideLayout_ptr> slideLayouts_;
std::vector<oox_chart_context_ptr> charts_;
pptx_xml_theme_ptr theme_;
pptx_xml_presentation presentation_;
......
......@@ -145,8 +145,9 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing const & val)
}
CP_XML_NODE(L"p:cNvGraphicFramePr");
CP_XML_NODE(L"p:nvPr");
}
oox_serialize_xfrm(CP_XML_STREAM(),val);
oox_serialize_xfrm(CP_XML_STREAM(),val,L"p");
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
......@@ -157,9 +158,49 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing const & val)
CP_XML_ATTR(L"uri", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_NODE(L"c:chart")
{
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id", val.chartId);
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
}
}
}
} // p:graphicFrame
} // CP_XML_WRITER
}
void pptx_serialize_table(std::wostream & strm, _pptx_drawing const & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"p:graphicFrame")
{
CP_XML_NODE(L"p:nvGraphicFramePr")
{
CP_XML_NODE(L"p:cNvPr")
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
}
CP_XML_NODE(L"p:cNvGraphicFramePr");
CP_XML_NODE(L"p:nvPr");
}
oox_serialize_xfrm(CP_XML_STREAM(),val,L"p");
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
CP_XML_NODE(L"a:graphic")
{
CP_XML_NODE(L"a:graphicData")
{
CP_XML_ATTR(L"uri", L"http://schemas.openxmlformats.org/drawingml/2006/table");
_CP_OPT(std::wstring) strTableContent;
odf::GetProperty(val.additional,L"table-content",strTableContent);
if (strTableContent)
{
CP_XML_STREAM() << strTableContent.get();
}
}
}
......@@ -181,6 +222,10 @@ void pptx_serialize(std::wostream & strm, _pptx_drawing const & val)
{
pptx_serialize_chart(strm,val);
}
else if (val.type == mediaitems::typeTable)
{
pptx_serialize_table(strm,val);
}
}
......
......@@ -230,6 +230,33 @@ void theme_elements::write(const std::wstring & RootPath)
get_main_document()->content_type().get_content_type().add_override(std::wstring(L"/ppt/theme/") + file_name, L"application/vnd.openxmlformats-officedocument.theme+xml");
}
////////////////////////////
void ppt_charts_files::add_chart(chart_content_ptr chart)
{
charts_.push_back(chart);
}
void ppt_charts_files::write(const std::wstring & RootPath)
{
fs::wpath path = fs::wpath(RootPath) / L"charts";
fs::create_directory(path);
size_t count = 0;
BOOST_FOREACH(const chart_content_ptr & item, charts_)
{
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes.add_override(std::wstring(L"/ppt/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(BOOST_STRING_PATH(path));
}
}
}
////////////////////////////////////////////
ppt_files::ppt_files()
......@@ -278,7 +305,10 @@ void ppt_files::write(const std::wstring & RootPath)
media_->set_main_document(get_main_document());
media_->write(BOOST_STRING_PATH(path));
}
{
charts_files_.set_main_document(get_main_document());
charts_files_.write(BOOST_STRING_PATH(path));
}
rels_files_.write(BOOST_STRING_PATH(path));
}
......@@ -321,7 +351,10 @@ void ppt_files::set_media(mediaitems & _Mediaitems)
{
media_ = element_ptr( new media(_Mediaitems) );
}
void ppt_files::add_charts(chart_content_ptr chart)
{
charts_files_.add_chart(chart);
}
}
}
......
......@@ -107,6 +107,19 @@ public:
std::vector<slide_content_ptr> slides_;
rels_files * rels_;
};
/// \class xl_charts_files
class ppt_charts_files : public element
{
public:
ppt_charts_files(){}
void add_chart(chart_content_ptr chart);
virtual void write(const std::wstring & RootPath);
std::vector<chart_content_ptr> charts_;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////
class ppt_files : public element
{
public:
......@@ -125,6 +138,7 @@ public:
void add_slideMaster(slide_content_ptr sheet);
void set_media(mediaitems & _Mediaitems);
void add_charts(chart_content_ptr chart);
private:
......@@ -134,6 +148,7 @@ private:
slideLayouts_files slideLayouts_files_;
slideMasters_files slideMasters_files_;
ppt_charts_files charts_files_;
//slides_files notesSlides_files_;
//slides_files notesMasters_files_;
//slides_files handoutMasters_files_;
......
......@@ -32,6 +32,7 @@ public:
std::vector<drawing_object_description> images_;
std::vector<drawing_object_description> charts_;
std::vector<drawing_object_description> shapes_;
std::vector<drawing_object_description> tables_;
void add_drawing(_pptx_drawing const & d,
bool isInternal,
......@@ -61,6 +62,7 @@ public:
images_.clear();
charts_.clear();
shapes_.clear();
tables_.clear();
rId_ = 1;
pptx_drawings_ = pptx_drawings::create();
......@@ -207,6 +209,10 @@ void pptx_slide_context::start_image(std::wstring const & path)
impl_->object_description_.xlink_href_ = path;
impl_->object_description_.type_ = 0; //frame
}
void pptx_slide_context::start_table()
{
impl_->object_description_.type_ = 0; //frame
}
void pptx_slide_context::start_chart(std::wstring const & path)
{
impl_->object_description_.xlink_href_ = path;
......@@ -227,6 +233,11 @@ void pptx_slide_context::end_chart()
impl_->charts_.push_back(impl_->object_description_);
default_set();
}
void pptx_slide_context::end_table()
{
impl_->tables_.push_back(impl_->object_description_);
default_set();
}
bool pptx_slide_context::empty() const
{
return impl_->empty();
......@@ -235,17 +246,20 @@ void pptx_slide_context::process_drawings()
{
process_shapes();
process_images();
process_tables();
process_charts();
}
void pptx_slide_context::process_images()
{
using boost::filesystem::wpath;
int pos_replaicement=0;
int pos_replaicement=0, pos_preview=0;
BOOST_FOREACH(drawing_object_description & pic, impl_->images_)
{
pos_replaicement= pic.xlink_href_.find(L"ObjectReplacements");
if (pos_replaicement <0)//,
pos_replaicement = pic.xlink_href_.find(L"ObjectReplacements");
pos_preview = pic.xlink_href_.find(L"TablePreview");
if (pos_replaicement <0 && pos_preview <0)//,
{
_pptx_drawing drawing=_pptx_drawing();
......@@ -302,6 +316,27 @@ void pptx_slide_context::process_charts()
impl_->add_drawing(drawing, isMediaInternal, drawing.chartId, ref, mediaitems::typeChart);
}
}
void pptx_slide_context::process_tables()
{
using boost::filesystem::wpath;
BOOST_FOREACH(drawing_object_description & pic, impl_->tables_)
{
_pptx_drawing drawing=_pptx_drawing();
process_common_properties(pic,drawing);
drawing.type = mediaitems::typeTable;
drawing.name = pic.draw_name_;
drawing.id = impl_->next_rId();
////////////////////////////////////////////////////////////////
std::wstring ref;
bool isMediaInternal = true;
drawing.chartId = impl_->get_mediaitems().add_or_find(pic.xlink_href_, mediaitems::typeTable, isMediaInternal, ref);
impl_->add_drawing(drawing, isMediaInternal, drawing.chartId, ref, mediaitems::typeTable);
}
}
void pptx_slide_context::process_common_properties(drawing_object_description & pic,_pptx_drawing & drawing)
{
......
......@@ -44,6 +44,10 @@ public:
void start_chart(std::wstring const & path);
void end_chart();
void start_table();
//void set_table_content(std::wstring & str);
void end_table();
void start_shape(int type);
void end_shape();
......@@ -62,9 +66,11 @@ public:
private:
void process_common_properties(drawing_object_description& pic,_pptx_drawing & drawing);
void default_set();
void process_shapes();
void process_images();
void process_charts();
void process_tables();
int hlinks_size_;
......
#include "precompiled_cpodf.h"
#include "pptx_conversion_context.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include <cpdoccore/odf/odf_document.h>
#include "../odf/odfcontext.h"
namespace cpdoccore {
namespace oox {
/**/
pptx_table_state::pptx_table_state(pptx_conversion_context & Context,
const std::wstring & StyleName) : context_(Context),
table_style_(StyleName),
current_table_column_(-1),
columns_spanned_num_(0),
close_table_covered_cell_(false)
{
}
void pptx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
{
columns_.push_back(repeated);
for (unsigned int i = 0; i < repeated; ++i)
columnsDefaultCellStyleName_.push_back(defaultCellStyleName);
}
std::wstring pptx_table_state::get_default_cell_style_col(unsigned int column)
{
return columnsDefaultCellStyleName_.at(column);
}
std::wstring pptx_table_state::get_default_cell_style_row()
{
return default_row_cell_style_name_;
}
void pptx_table_state::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
{
current_table_column_ = -1;
columns_spanned_style_ = L"";
close_table_covered_cell_ = false;
table_row_style_stack_.push_back(StyleName);
default_row_cell_style_name_ = defaultCellStyleName;
}
void pptx_table_state::end_row()
{
table_row_style_stack_.pop_back();
default_row_cell_style_name_ = L"";
}
std::wstring pptx_table_state::current_row_style() const
{
if (table_row_style_stack_.size())
return table_row_style_stack_.back();
else
return L"";
}
void pptx_table_state::start_cell()
{
current_table_column_++;
if (current_table_column_ >= (int)(rows_spanned_.size()))
rows_spanned_.push_back(table_row_spanned());
}
void pptx_table_state::end_cell()
{}
bool pptx_table_state::start_covered_cell(pptx_conversion_context & Context)
{
std::wostream & _Wostream = context_.get_table_context().tableData();
current_table_column_++;
// ,
//
if (current_table_column_ >= (int)(rows_spanned_.size()))
rows_spanned_.push_back(table_row_spanned());
bool closeTag = false;
if (columns_spanned_num_ == 0 && rows_spanned_[current_table_column_].num() > 0)
{
closeTag = true;
_Wostream << L"<w:tc>";
_Wostream << L"<w:tcPr>";
_Wostream << L"<w:vMerge w:val=\"continue\" />";
//_Wostream << L"<w:tcW w:w=\"0\" w:type=\"auto\" />";
if (rows_spanned_[current_table_column_].column_spanned() > 0)
_Wostream << L"<w:gridSpan w:val=\"" << rows_spanned_[current_table_column_].column_spanned() + 1 << "\" />";
odf::style_instance * inst =
context_.root()->odf_context().styleContainer().style_by_name(
rows_spanned_[current_table_column_].style() , odf::style_family::TableCell,false);
if (inst && inst->content())
inst->content()->pptx_convert(context_);
_Wostream << L"</w:tcPr>";
}
// ,
//
if (columns_spanned_num_ > 0)
columns_spanned_num_--;
if (rows_spanned_[current_table_column_].num() > 0)
rows_spanned_[current_table_column_].decrease();
// , <w:tc>
close_table_covered_cell_ = closeTag;
return closeTag;
}
void pptx_table_state::end_covered_cell()
{
std::wostream & _Wostream = context_.get_table_context().tableData();
if (close_table_covered_cell_)
{
//
_Wostream << L"</w:tc>";
close_table_covered_cell_ = false;
}
}
int pptx_table_state::current_column() const
{
return current_table_column_;
}
void pptx_table_state::set_columns_spanned(unsigned int Val)
{
if ( current_columns_spaned() > 0 )
{
#ifdef _DEBUG
_CP_LOG(info) << L"[warning] set_columns_spanned warning\n";
#endif
}
columns_spanned_num_ = Val;
}
unsigned int pptx_table_state::current_columns_spaned() const
{
return columns_spanned_num_;
}
void pptx_table_state::set_rows_spanned(unsigned int Column, unsigned int Val, unsigned int ColumnsSpanned, const std::wstring & Style)
{
if (rows_spanned_.size() <= Column)
{
_CP_LOG(info) << L"[warning] set_rows_spanned error\n";
}
else
{
if (rows_spanned_[Column].num() > 0)
{
_CP_LOG(info) << L"[warning] set_rows_spanned warning\n";
}
rows_spanned_[Column].num(Val);
rows_spanned_[Column].set_style(Style);
rows_spanned_[Column].column_spanned(ColumnsSpanned);
}
}
unsigned int pptx_table_state::current_rows_spanned(unsigned int Column) const
{
if (rows_spanned_.size() <= Column)
{
_CP_LOG(info) << L"[warning] current_rows_spanned error\n";
return 0;
}
else
{
return rows_spanned_[Column].num();
}
}
/**/
}
}
#pragma once
#include <string>
#include <list>
#include <vector>
#include "ooxtablerowspanned.h"
namespace cpdoccore {
namespace oox {
class pptx_conversion_context;
class pptx_table_state
{
public:
pptx_table_state(pptx_conversion_context & Context, const std::wstring & StyleName);
std::wstring current_style() const { return table_style_; }
void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
std::wstring get_default_cell_style_col(unsigned int column);
std::wstring get_default_cell_style_row();
void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
void end_row();
std::wstring current_row_style() const;
void start_cell();
void end_cell();
bool start_covered_cell(pptx_conversion_context & Context);
void end_covered_cell();
int current_column() const;
void set_columns_spanned(unsigned int Val);
unsigned int current_columns_spaned() const;
void set_rows_spanned(unsigned int Column, unsigned int Val, unsigned int ColumnsSpanned, const std::wstring & Style);
unsigned int current_rows_spanned(unsigned int Column) const;
private:
pptx_conversion_context & context_;
std::wstring table_style_;
std::list<std::wstring> table_row_style_stack_;
std::wstring default_row_cell_style_name_;
int current_table_column_;
unsigned int columns_spanned_num_;
std::wstring columns_spanned_style_;
std::vector<table_row_spanned> rows_spanned_;
bool close_table_covered_cell_;
std::vector<unsigned int> columns_;
std::vector<std::wstring> columnsDefaultCellStyleName_;
};
class pptx_table_context : boost::noncopyable
{
public:
pptx_table_context(pptx_conversion_context & Context) : context_(Context)
{}
std::wstringstream & tableData(){return output_stream_;}
void start_table(const std::wstring & StyleName)
{
output_stream_.str(std::wstring(L""));
table_state_stack_.push_back(pptx_table_state(context_, StyleName));
}
void end_table()
{
table_state_stack_.pop_back();
}
std::wstring current_style() const
{
return table_state_stack_.back().current_style();
}
size_t in_table() const
{
return table_state_stack_.size();
}
void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
{
return table_state_stack_.back().start_column(repeated, defaultCellStyleName);
}
void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
{
return table_state_stack_.back().start_row(StyleName, defaultCellStyleName);
}
void end_row()
{
return table_state_stack_.back().end_row();
}
std::wstring current_row_style() const
{
return table_state_stack_.back().current_row_style();
}
void start_cell()
{
return table_state_stack_.back().start_cell();
}
void end_cell()
{
return table_state_stack_.back().end_cell();
}
bool start_covered_cell(pptx_conversion_context & Context)
{
return table_state_stack_.back().start_covered_cell(Context);
}
void end_covered_cell()
{
return table_state_stack_.back().end_covered_cell();
}
int current_column() const
{
return table_state_stack_.back().current_column();
}
void set_columns_spanned(unsigned int Val)
{
return table_state_stack_.back().set_columns_spanned(Val);
}
unsigned int current_columns_spaned() const
{
return table_state_stack_.back().current_columns_spaned();
}
void set_rows_spanned(unsigned int Column, unsigned int Val, unsigned int ColumnsSpanned, const std::wstring & Style)
{
return table_state_stack_.back().set_rows_spanned(Column, Val, ColumnsSpanned, Style);
}
unsigned int current_rows_spanned(unsigned int Column) const
{
return table_state_stack_.back().current_rows_spanned(Column);
}
std::wstring get_default_cell_style_col(unsigned int column)
{
return table_state_stack_.back().get_default_cell_style_col(column);
}
std::wstring get_default_cell_style_row()
{
return table_state_stack_.back().get_default_cell_style_row();
}
private:
std::wstringstream output_stream_;
pptx_conversion_context & context_;
std::list<pptx_table_state> table_state_stack_;
};
}
}
......@@ -328,7 +328,7 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
CP_XML_STREAM() << run_.str();
CP_XML_NODE(L"a:endParaRPr");
//CP_XML_NODE(L"a:endParaRPr");
//- /
//{
// CP_XML_ATTR(L"dirty", 0);
......@@ -356,7 +356,7 @@ void pptx_text_context::Impl::dump_run()
CP_XML_NODE(L"a:t")
{
CP_XML_ATTR(L"xml:space", L"preserve");
// CP_XML_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM() << content;
}
}
......@@ -624,10 +624,19 @@ std::wstring pptx_text_context::end_object()
{
return impl_->end_object();
}
styles_context & pptx_text_context::get_styles_context()
{
return impl_->get_styles_context() ;
}
void pptx_text_context::start_field(int type, const std::wstring & styleName)
{
//todooo
//1 - datetime, 2 -pagecount, 3 - pagenumber - <a:fld><a:t></a:fld>
}
void pptx_text_context::end_field()
{
}
}
}
......@@ -50,6 +50,9 @@ public:
void start_hyperlink();
void end_hyperlink(std::wstring hId);
void start_field(int type, const std::wstring & styleName);//1 - datetime, 2 -pagecount, 3 - pagenumber - <a:fld><a:t></a:fld>
void end_field();
bool in_list();
void start_list(const std::wstring & StyleName, bool Continue = false);
......
......@@ -186,7 +186,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing const & val)
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
}
oox_serialize_xfrm(CP_XML_STREAM(),val);
oox_serialize_xfrm(CP_XML_STREAM(),val,L"xdr");
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
......@@ -197,9 +197,9 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing const & val)
CP_XML_ATTR(L"uri", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_NODE(L"c:chart")
{
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id", val.chartId);
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
}
}
}
......
......@@ -158,7 +158,8 @@ void draw_frame::add_child_element( xml::sax * Reader, const ::std::wstring & Ns
CP_CHECK_NAME(L"draw", L"object-ole") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
CP_CHECK_NAME(L"draw", L"plugin")
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"table", L"table")
)
{
CP_CREATE_ELEMENT(content_);
......
......@@ -111,7 +111,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
instances.push_back(baseStyleInst);
}
else if (grStyleInst)//
if (grStyleInst)//
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
......@@ -157,7 +157,6 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
}
Context.get_text_context().end_base_style();
//Context.get_slide_context().end_drawing();
}
void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
......@@ -190,10 +189,6 @@ void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
Context.get_slide_context().start_chart(href);
//BOOST_FOREACH(office_element_ptr const & elm, content_)
//{
// elm->pptx_convert(Context);
//}
int i=0;
int size = content_.size();
while(true)
......
......@@ -18,9 +18,12 @@ void draw_page_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
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_);
}
......
......@@ -21,8 +21,12 @@ public:
public:
_CP_OPT(std::wstring) draw_name_;
_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
/// \brief draw:page
......
......@@ -94,7 +94,18 @@ void number_style_base::add_attributes( const xml::attributes_wc_ptr & Attribute
{
common_data_style_attlist_.add_attributes(Attributes);
}
void number_date_style::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"number:automatic-order", number_automatic_order_);
number_style_base::add_attributes(Attributes);
}
void number_time_style::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"number:automatic-order", number_automatic_order_);
number_style_base::add_attributes(Attributes);
}
void number_style_base::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
if CP_CHECK_NAME(L"style", L"text-properties")
......
#ifndef _CPDOCCORE_ODF_NUMBER_STYLE_H_
#define _CPDOCCORE_ODF_NUMBER_STYLE_H_
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -17,11 +16,13 @@ class number_style_base : public office_element
public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
void xlsx_convert_impl(oox::xlsx_conversion_context & Context);
CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
virtual void add_text(const std::wstring &) {}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
......@@ -29,6 +30,7 @@ public:
private:
common_data_style_attlist common_data_style_attlist_;
office_element_ptr style_text_properties_;
office_element_ptr_array content_;
office_element_ptr_array style_map_;
......@@ -97,6 +99,9 @@ public:
static const ElementType type = typeNumberDataStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(bool) number_automatic_order_;
};
CP_REGISTER_OFFICE_ELEMENT2(number_date_style);
......@@ -130,6 +135,10 @@ public:
static const ElementType type = typeNumberTimeStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(bool) number_automatic_order_;
};
CP_REGISTER_OFFICE_ELEMENT2(number_time_style);
......@@ -591,5 +600,3 @@ CP_REGISTER_OFFICE_ELEMENT2(number_fraction);
}
}
#endif
......@@ -20,7 +20,13 @@ const wchar_t * office_presentation::name = L"presentation";
void office_presentation::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
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_decl_);
else if CP_CHECK_NAME(L"presentation", L"date-time-decl")
CP_CREATE_ELEMENT(date_time_decl_);
}
void office_presentation::add_text(const std::wstring & Text)
......@@ -35,8 +41,8 @@ void office_presentation::add_attributes( const xml::attributes_wc_ptr & Attribu
void office_presentation::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
_CP_LOG(info) << L"[info][docx] process spreadsheet (" << content_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, content_)
_CP_LOG(info) << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->docx_convert(Context);
}
......@@ -46,18 +52,20 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG(info) << L"[info][xlsx] process spreadsheet (" << content_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, content_)
_CP_LOG(info) << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}
void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.start_office_presentation();
_CP_LOG(info) << L"[info][pptx] process presentationt (" << content_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, content_)
_CP_LOG(info) << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->pptx_convert(Context);
}
......
......@@ -31,16 +31,11 @@ private:
virtual void add_text(const std::wstring & Text);
public:
// TODO: office-text-content-prelude:
// TODO: office-forms
// TODO: text-tracked-changes
// TODO: text-decls
// TODO: table-decls
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions
office_element_ptr_array date_time_decl_;
office_element_ptr_array footer_decl_;
office_element_ptr_array pages_;
};
......
......@@ -718,6 +718,14 @@ void text_placeholder::docx_convert(oox::docx_conversion_context & Context)
}
}
void text_placeholder::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->pptx_convert(Context);
}
}
// text:page-number
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_page_number::ns = L"text";
......@@ -759,6 +767,15 @@ void text_page_number::docx_convert(oox::docx_conversion_context & Context)
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
void text_page_number::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(3, L"");
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
// text:page-count
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -801,6 +818,16 @@ void text_page_count::docx_convert(oox::docx_conversion_context & Context)
Context.finish_run();
strm << L"<w:r><w:fldChar w:fldCharType=\"end\" /></w:r>";
}
void text_page_count::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(2, L"");
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
// text:date
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -815,7 +842,9 @@ const wchar_t * text_date::name = L"date";
void text_date::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
// TODO
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:fixed", text_fixed_);
CP_APPLY_ATTR(L"text:date-value", text_date_value_);
}
void text_date::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
......@@ -838,7 +867,15 @@ void text_date::docx_convert(oox::docx_conversion_context & Context)
}
Context.finish_run();
}
void text_date::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(1,style_data_style_name_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_time::ns = L"text";
......@@ -852,7 +889,10 @@ const wchar_t * text_time::name = L"time";
void text_time::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
// TODO
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:fixed", text_fixed_);
CP_APPLY_ATTR(L"text:time-value", text_time_value_);
}
void text_time::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
......@@ -875,6 +915,15 @@ void text_time::docx_convert(oox::docx_conversion_context & Context)
}
Context.finish_run();
}
void text_time::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_field(1, style_data_style_name_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->pptx_convert(Context);
}
Context.get_text_context().end_field();
}
// text:time
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -545,6 +545,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -571,6 +572,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -600,6 +602,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -629,6 +632,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -639,7 +643,11 @@ private:
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_;
};
......@@ -658,6 +666,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -667,7 +676,10 @@ private:
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_time_value_;//with format
office_element_ptr_array text_;
};
......
......@@ -30,7 +30,9 @@ class table_format_properties
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
bool add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
private:
// 15.8.1 style:width
......@@ -108,6 +110,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -146,8 +149,10 @@ public:
static const ElementType type = typeStyleTableColumnProperties;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -165,7 +170,9 @@ class style_table_row_properties_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
_CP_OPT(length) style_row_height_;
......@@ -191,6 +198,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -209,7 +217,9 @@ class style_table_cell_properties_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void apply_from(const style_table_cell_properties_attlist & Other);
......@@ -306,6 +316,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......
......@@ -129,6 +129,30 @@ void style_content::docx_convert(oox::docx_conversion_context & Context)
Context.end_process_style_content();
}
void style_content::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().get_styles_context().start();
if (style_text_properties_)
style_text_properties_->pptx_convert(Context);
if (style_paragraph_properties_)
style_paragraph_properties_->pptx_convert(Context);
if (style_table_properties_)
style_table_properties_->pptx_convert(Context);
if (style_table_column_properties_)
style_table_column_properties_->pptx_convert(Context);
if (style_table_row_properties_)
style_table_row_properties_->pptx_convert(Context);
if (style_table_cell_properties_)
style_table_cell_properties_->pptx_convert(Context);
//Context.get_text_context().get_styles_context().end();
}
void style_content::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context)
{
......
......@@ -53,8 +53,10 @@ class style_content : noncopyable
{
public:
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
style_text_properties * get_style_text_properties() const;
style_paragraph_properties * get_style_paragraph_properties() const;
......
......@@ -591,10 +591,6 @@ const wchar_t * table_shapes::name = L"shapes";
void table_shapes::docx_convert(oox::docx_conversion_context & Context)
{
//BOOST_FOREACH(office_element_ptr const & elm, content_)
//{
// elm->docx_convert(Context);
//}
int i=0;
int size = content_.size();
while(true)
......@@ -604,6 +600,17 @@ void table_shapes::docx_convert(oox::docx_conversion_context & Context)
i++;
}
}
void table_shapes::pptx_convert(oox::pptx_conversion_context & Context)
{
int i=0;
int size = content_.size();
while(true)
{
if (i>=size)break;
content_[i]->pptx_convert(Context);
i++;
}
}
void table_shapes::xlsx_convert(oox::xlsx_conversion_context & Context)
{
......
......@@ -135,8 +135,10 @@ class table_columns
{
public:
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
office_element_ptr table_table_columns_;
......@@ -166,6 +168,7 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
static _CP_PTR(table_columns_no_group) create();
......@@ -188,6 +191,7 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
......@@ -223,8 +227,10 @@ public:
static const ElementType type = typeTableTableColumn;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -251,6 +257,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -278,6 +285,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -316,6 +324,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
table_table_column_group()
{
......@@ -348,6 +357,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -373,9 +383,8 @@ public:
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
bool docx_convert(oox::docx_conversion_context & Context) ;
/// \return shared string id
int xlsx_convert(oox::xlsx_conversion_context & Context) ;
bool pptx_convert(oox::pptx_conversion_context & Context) ;
private:
// TODO table-cell-range-source
......@@ -401,6 +410,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -435,6 +445,7 @@ public:
table_covered_table_cell() {empty_ = true; }
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
public:
......@@ -466,8 +477,10 @@ public:
static const ElementType type = typeTableTableRows;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
table_table_rows()
{
......@@ -498,8 +511,10 @@ public:
static const ElementType type = typeTableTableHeaderRows;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
......@@ -523,8 +538,10 @@ class table_rows
public:
::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
office_element_ptr table_table_rows_;
......@@ -557,6 +574,7 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
table_rows table_rows_1_;
......@@ -575,8 +593,10 @@ public:
table_rows_and_groups();
::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context);
void docx_convert(oox::docx_conversion_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
office_element_ptr_array content_;
......@@ -645,6 +665,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -679,6 +700,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......
This diff is collapsed.
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