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

диаграммы. каркас и шаблоны.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56068 954022d7-b5bf-4e40-9824-e11837661b57
parent e119f7b0
......@@ -942,6 +942,14 @@
RelativePath=".\OdfFormat\office_body.h"
>
</File>
<File
RelativePath=".\OdfFormat\office_chart.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\office_chart.h"
>
</File>
<File
RelativePath=".\OdfFormat\office_spreadsheet.cpp"
>
......
......@@ -279,7 +279,6 @@ void draw_object::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
//draw_object_attlist_.serialize(CP_GET_XML_NODE());
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
}
}
......
......@@ -183,6 +183,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
common_xlink_attlist common_xlink_attlist_;
//draw:notify-on-update-of-ranges
};
CP_REGISTER_OFFICE_ELEMENT2(draw_object);
......
......@@ -78,30 +78,8 @@ namespace odf
CP_XML_NODE(L"manifest:manifest")
{
CP_XML_ATTR(L"xmlns:manifest", L"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:full-path", L"/");
CP_XML_ATTR(L"manifest:media-type", std::wstring(L"application/vnd.oasis.opendocument.") + type_);
}
rels_.serialize(CP_XML_STREAM());//
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:full-path", L"content.xml");
CP_XML_ATTR(L"manifest:media-type", L"text/xml");
}
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:full-path", L"styles.xml");
CP_XML_ATTR(L"manifest:media-type", L"text/xml");
}
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:full-path", L"meta.xml");
CP_XML_ATTR(L"manifest:media-type", L"text/xml");
}
rels_.serialize(CP_XML_STREAM());
}
}
fs::wpath path = fs::wpath(RootPath) / L"META-INF";
......@@ -128,7 +106,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:presentation", L"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0");
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0");
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart");
CP_XML_NODE(L"office:meta")
{
......@@ -237,13 +215,21 @@ namespace odf
void odf_document::add_object(element_ptr _object, bool root)
{
if (root)base_ = _object;
else objects_.push_back(_object);
rels r;
if (root)
{
base_ = _object;
}
else
{
objects_.push_back(_object);
}
dynamic_cast<manifect_file*>(manifest_.get())->add_rels(r);
}
void odf_document::set_rels(rels & r)
{
(dynamic_cast<manifect_file*>(manifest_.get()))->add_rels(r);
dynamic_cast<manifect_file*>(manifest_.get())->add_rels(r);
}
odf_document::odf_document(std::wstring type)
......@@ -258,16 +244,13 @@ namespace odf
long count = 0;
BOOST_FOREACH(const element_ptr & item, objects_)
{
std::wstring name = L"Object " + boost::lexical_cast<std::wstring>(++count);
fs::wpath path = fs::wpath(RootPath) / name;
fs::wpath path = fs::wpath(RootPath) / item->local_path;
fs::create_directory(path);
item->write(path.string());
}
if (manifest_) manifest_->write(RootPath);
if (settings_) settings_->write(RootPath);
}
void content_file::write(const std::wstring & RootPath)
......@@ -277,7 +260,7 @@ namespace odf
{
CP_XML_NODE(L"office:document-content")
{
CP_XML_ATTR(L"xmlns:office",L"urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
CP_XML_ATTR(L"xmlns:office", L"urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
CP_XML_ATTR(L"xmlns:style", L"urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
CP_XML_ATTR(L"xmlns:text", L"urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
CP_XML_ATTR(L"xmlns:table", L"urn:oasis:names:tc:opendocument:xmlns:table:1.0" );
......@@ -286,19 +269,19 @@ namespace odf
CP_XML_ATTR(L"xmlns:xlink", L"http://www.w3.org/1999/xlink" );
CP_XML_ATTR(L"xmlns:dc", L"http://purl.org/dc/elements/1.1/" );
CP_XML_ATTR(L"xmlns:meta", L"urn:oasis:names:tc:opendocument:xmlns:meta:1.0" );
CP_XML_ATTR(L"xmlns:number",L"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" );
CP_XML_ATTR(L"xmlns:number", L"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" );
CP_XML_ATTR(L"xmlns:presentation", L"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" );
CP_XML_ATTR(L"xmlns:svg", L"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
CP_XML_ATTR(L"xmlns:chart", L"urn:oasis:names:tc:opendocument:xmlns:chart:1.0" );
CP_XML_ATTR(L"xmlns:dr3d", L"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" );
CP_XML_ATTR(L"xmlns:math", L"http://www.w3.org/1998/Math/MathML" );
CP_XML_ATTR(L"xmlns:form", L"urn:oasis:names:tc:opendocument:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:script",L"urn:oasis:names:tc:opendocument:xmlns:script:1.0" );
CP_XML_ATTR(L"xmlns:script", L"urn:oasis:names:tc:opendocument:xmlns:script:1.0" );
CP_XML_ATTR(L"xmlns:ooo", L"http://openoffice.org/2004/office" );
CP_XML_ATTR(L"xmlns:ooow", L"http://openoffice.org/2004/writer" );
CP_XML_ATTR(L"xmlns:oooc", L"http://openoffice.org/2004/calc" );
CP_XML_ATTR(L"xmlns:dom", L"http://www.w3.org/2001/xml-events" );
CP_XML_ATTR(L"xmlns:xforms",L"http://www.w3.org/2002/xforms");
CP_XML_ATTR(L"xmlns:xforms", L"http://www.w3.org/2002/xforms");
CP_XML_ATTR(L"xmlns:xsd", L"http://www.w3.org/2001/XMLSchema" );
CP_XML_ATTR(L"xmlns:xsi", L"http://www.w3.org/2001/XMLSchema-instance" );
CP_XML_ATTR(L"xmlns:rpt", L"http://openoffice.org/2005/report" );
......@@ -307,13 +290,14 @@ namespace odf
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_NODE(L"office:scripts");
//CP_XML_NODE(L"office:scripts");
if (content_)
{
CP_XML_STREAM() << content_->styles_str();
......@@ -338,7 +322,7 @@ namespace odf
{
CP_XML_NODE(L"office:document-styles")
{
CP_XML_ATTR(L"xmlns:office",L"urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
CP_XML_ATTR(L"xmlns:office", L"urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
CP_XML_ATTR(L"xmlns:style", L"urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
CP_XML_ATTR(L"xmlns:text", L"urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
CP_XML_ATTR(L"xmlns:table", L"urn:oasis:names:tc:opendocument:xmlns:table:1.0" );
......@@ -347,19 +331,19 @@ namespace odf
CP_XML_ATTR(L"xmlns:xlink", L"http://www.w3.org/1999/xlink" );
CP_XML_ATTR(L"xmlns:dc", L"http://purl.org/dc/elements/1.1/" );
CP_XML_ATTR(L"xmlns:meta", L"urn:oasis:names:tc:opendocument:xmlns:meta:1.0" );
CP_XML_ATTR(L"xmlns:number",L"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" );
CP_XML_ATTR(L"xmlns:number", L"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" );
CP_XML_ATTR(L"xmlns:presentation", L"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" );
CP_XML_ATTR(L"xmlns:svg", L"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0");
CP_XML_ATTR(L"xmlns:chart", L"urn:oasis:names:tc:opendocument:xmlns:chart:1.0" );
CP_XML_ATTR(L"xmlns:dr3d", L"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" );
CP_XML_ATTR(L"xmlns:math", L"http://www.w3.org/1998/Math/MathML" );
CP_XML_ATTR(L"xmlns:form", L"urn:oasis:names:tc:opendocument:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:script",L"urn:oasis:names:tc:opendocument:xmlns:script:1.0" );
CP_XML_ATTR(L"xmlns:script", L"urn:oasis:names:tc:opendocument:xmlns:script:1.0" );
CP_XML_ATTR(L"xmlns:ooo", L"http://openoffice.org/2004/office" );
CP_XML_ATTR(L"xmlns:ooow", L"http://openoffice.org/2004/writer" );
CP_XML_ATTR(L"xmlns:oooc", L"http://openoffice.org/2004/calc" );
CP_XML_ATTR(L"xmlns:dom", L"http://www.w3.org/2001/xml-events" );
CP_XML_ATTR(L"xmlns:xforms",L"http://www.w3.org/2002/xforms");
CP_XML_ATTR(L"xmlns:xforms", L"http://www.w3.org/2002/xforms");
CP_XML_ATTR(L"xmlns:xsd", L"http://www.w3.org/2001/XMLSchema" );
CP_XML_ATTR(L"xmlns:xsi", L"http://www.w3.org/2001/XMLSchema-instance" );
CP_XML_ATTR(L"xmlns:rpt", L"http://openoffice.org/2005/report" );
......@@ -368,6 +352,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
......
......@@ -57,11 +57,9 @@ namespace odf
{
public:
virtual ~element() = 0;
//void set_main_document(element * _element) { element_ = _element; }
//document * get_main_document() { return element_; }
virtual void write(const std::wstring & RootPath) = 0;
std::wstring local_path;
private:
element * element_;
};
......
......@@ -2,6 +2,9 @@
#include <boost/foreach.hpp>
#include "office_spreadsheet.h"
#include "office_chart.h"
#include "office_elements_create.h"
#include "odf_conversion_context.h"
......@@ -42,10 +45,7 @@ odf_conversion_context::~odf_conversion_context()
}
//void odf_conversion_context::start_font_face()
//{
// create_element(L"office", L"font-face-decls", styles_, this,true);
//}
void odf_conversion_context::end_document()
{
......@@ -57,7 +57,7 @@ void odf_conversion_context::end_document()
if (object.content == NULL)continue;
process_styles(object);
process_styles(object,isRoot);
package::content_content_ptr content_root_ = package::content_content::create();
object.content->serialize(content_root_->content());
......@@ -81,7 +81,16 @@ void odf_conversion_context::end_document()
object_files->set_media (object.mediaitems);
object_files->set_pictures (object.mediaitems);
output_document_->add_object(package::element_ptr(object_files ),isRoot);
if (!isRoot)object_files->local_path = object.name + L"/";
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"styles.xml"));
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"content.xml"));
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"meta.xml"));
if (isRoot)object_files->local_path = L"/";
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + object.content->get_name(), object_files->local_path));
output_document_->add_object(package::element_ptr(object_files),isRoot);
}
object.mediaitems.dump_rels(rels_);
......@@ -105,6 +114,8 @@ void odf_conversion_context::create_object()
obj.style_context = boost::make_shared<odf_style_context>();
obj.style_context->set_odf_context(this);
obj.name = get_next_name_object();
objects_.push_back(obj);
current_object_ = objects_.size()-1;
......@@ -113,22 +124,29 @@ void odf_conversion_context::end_object()
{
current_object_ = 0;
}
void odf_conversion_context::process_styles(_object & object)
std::wstring odf_conversion_context::get_next_name_object()
{
create_element(L"office", L"font-face-decls", object.styles, this,true);
return std::wstring(L"Object ") + boost::lexical_cast<std::wstring>(objects_.size());
}
void odf_conversion_context::process_styles(_object & object, bool isRoot)
{
create_element(L"office", L"styles", object.styles, this,true);//îáùèå ñòèëè
object.style_context->process_office(object.styles.back());
if (isRoot)
{
create_element(L"office", L"font-face-decls", object.styles, this,true);
create_element(L"office", L"automatic-styles", object.styles, this,true);
object.style_context->process_automatic_styles(object.styles.back());
create_element(L"office", L"master-styles", object.styles, this,true);
object.style_context->process_master(object.styles.back());
///////////////////////////////
create_element(L"office", L"font-face-decls", object.content_styles, this,true);
}
create_element(L"office", L"automatic-styles", object.content_styles, this,true);
object.style_context->process_automatic(object.content_styles.back());
......
......@@ -17,6 +17,8 @@ class odf_conversion_context : boost::noncopyable
{
struct _object
{
std::wstring name;
office_element_ptr content;
std::vector<office_element_ptr> content_styles;
std::vector<office_element_ptr> styles;
......@@ -48,9 +50,10 @@ public:
void create_object();
void end_object();
std::wstring get_next_name_object();
private:
void process_styles(_object & object);
void process_styles(_object & object, bool isRoot);
int current_object_;
//page_layout_container & pageLayoutContainer() { return page_layout_container_; }
......
......@@ -448,7 +448,6 @@ void odf_drawing_context::end_line_properies()
{
impl_->current_drawing_part_ = Unknown;
}
void odf_drawing_context::start_shadow_properies()
{
impl_->current_drawing_part_ = Shadow;
......@@ -724,13 +723,21 @@ void odf_drawing_context::start_image(std::wstring & path)
set_image_style_repeat(1);//default
}
void odf_drawing_context::start_object()
void odf_drawing_context::start_object(std::wstring name)
{
start_frame();
office_element_ptr object_elm;
create_element(L"draw", L"object", object_elm, impl_->odf_context_);
draw_object* object = dynamic_cast<draw_object*>(object_elm.get());
if (object == NULL)return;
object->common_xlink_attlist_.href_= std::wstring(L"./") + name;
object->common_xlink_attlist_.type_= xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
start_element(object_elm);
}
......
......@@ -43,7 +43,7 @@ public:
void start_text_box();
void end_text_box();
void start_object();
void start_object(std::wstring name);
void end_object();
void start_element(office_element_ptr & elm);
......
......@@ -17,8 +17,8 @@ void relationship::serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"manifest:file-entry")
{
CP_XML_ATTR(L"manifest:media-type", type());
CP_XML_ATTR(L"manifest:full-path", target());
CP_XML_ATTR(L"manifest:media-type", type());
}
}
}
......
......@@ -551,7 +551,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
int curr_col = 1,i;
for (i=0; i< columns_.size(); i++)
{
if (oox_pos.col > columns_[i].repeated - curr_col)
if (oox_pos.col > columns_[i].repeated + curr_col)
{
sz_col += (columns_[i].repeated ) * columns_[i].size;
}
......@@ -569,7 +569,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x,
int curr_row = 1;
for (i=0; i< rows_.size(); i++)
{
if (oox_pos.row > rows_[i].repeated - curr_row)
if (oox_pos.row > rows_[i].repeated + curr_row)
{
sz_row += (rows_[i].repeated ) * rows_[i].size;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -1133,7 +1133,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGraphicFrame* oox_graphic_frame)
{
if (!oox_graphic_frame)return;
////////////////////////////////////////////////////////////////////////////////
ods_context->drawing_context()->start_object();
ods_context->drawing_context()->start_object(ods_context->get_next_name_object());
{
if (oox_graphic_frame->m_oNvGraphicFramePr.IsInit())
{
......@@ -1159,7 +1159,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGraphicFrame* oox_graphic_frame)
}
//
}
}
ods_context->drawing_context()->end_object();
}
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//31
#define INTVER 1,2,0,31
#define STRVER "1,2,0,31\0"
//32
#define INTVER 1,2,0,32
#define STRVER "1,2,0,32\0"
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