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

(1.0.0.163): ASCOfficeOdfFile

подправлены примечания (odp)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53489 954022d7-b5bf-4e40-9824-e11837661b57
parent a6a366d5
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//0 //0
//162 //163
#define INTVER 1,0,0,162 #define INTVER 1,0,0,163
#define STRVER "1,0,0,162\0" #define STRVER "1,0,0,163\0"
...@@ -8,46 +8,10 @@ ...@@ -8,46 +8,10 @@
namespace cpdoccore { namespace cpdoccore {
namespace oox { namespace oox {
//unsigned int hex_string_to_int(std::wstring str)
//{
// unsigned int x;
// std::wstringstream ss;
// ss << std::hex << str;
// ss >> x;
// return x;
//}
//
class pptx_comments::Impl class pptx_comments::Impl
{ {
public: public:
void serialize_authors(std::wostream & strm) const
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"p:cmAuthorLst")
{
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
////<p:cmAuthor id="0" name="" initials="" lastIdx="4" clrIdx="0"/>
////<p:cmAuthor id="1" name="Elen Subbotina" initials="ES" lastIdx="2" clrIdx="1"/>
// int i=0;
// int size = author_list_.size();
// while(true)
// {
// if (i>=size)break;
// CP_XML_NODE(L"p:cmAuthor")
// {
// CP_XML_ATTR(L"id", i);
// CP_XML_STREAM() << author_list_[i];//
// }
// i++;
// }
}
}
}
void serialize(std::wostream & strm) const void serialize(std::wostream & strm) const
{ {
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
...@@ -62,12 +26,15 @@ public: ...@@ -62,12 +26,15 @@ public:
{ {
CP_XML_NODE(L"p:cm") CP_XML_NODE(L"p:cm")
{ {
CP_XML_ATTR(L"authorId", c.author_); CP_XML_ATTR(L"idx",c.idx_);
CP_XML_ATTR(L"authorId", c.author_id_);
CP_XML_ATTR(L"dt", c.date_);
CP_XML_NODE(L"p:pos") CP_XML_NODE(L"p:pos")
{ {
CP_XML_ATTR(L"y", c.top_); CP_XML_ATTR(L"x", c.x_);
CP_XML_ATTR(L"x", c.left_); CP_XML_ATTR(L"y", c.y_);
} }
CP_XML_NODE(L"p:text") CP_XML_NODE(L"p:text")
{ {
...@@ -84,25 +51,9 @@ public: ...@@ -84,25 +51,9 @@ public:
} }
void add(_pptx_comment & c) void add(_pptx_comment & c)
{ {
bool find = false;
for (long i=0;i<author_list_.size();i++)
{
if (c.author_ == author_list_[i])
{
find=true;
c.author_ = boost::lexical_cast<std::wstring>(i);
break;
}
}
if (!find)
{
author_list_.push_back(c.author_);
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
}
pptx_comment_.push_back(c); pptx_comment_.push_back(c);
} }
private: private:
std::vector<std::wstring> author_list_;
std::vector<_pptx_comment> pptx_comment_; std::vector<_pptx_comment> pptx_comment_;
}; };
...@@ -126,10 +77,6 @@ void pptx_serialize(std::wostream & _Wostream, pptx_comments const & val) ...@@ -126,10 +77,6 @@ void pptx_serialize(std::wostream & _Wostream, pptx_comments const & val)
{ {
val.impl_->serialize(_Wostream); val.impl_->serialize(_Wostream);
} }
void pptx_serialize_authors(std::wostream & _Wostream, pptx_comments const & val)
{
val.impl_->serialize_authors(_Wostream);
}
pptx_comments_ptr pptx_comments::create() pptx_comments_ptr pptx_comments::create()
{ {
......
...@@ -11,15 +11,16 @@ namespace oox { ...@@ -11,15 +11,16 @@ namespace oox {
struct _pptx_comment struct _pptx_comment
{ {
size_t left_, top_; size_t x_, y_;
size_t width_, height_;
bool visibly_; int author_id_;
int idx_;
std::wstring date_;
std::vector<odf::_property> graphicProperties_;
std::wstring author_;
std::wstring content_; std::wstring content_;
std::vector<odf::_property> graphicProperties_;
}; };
//class rels; //class rels;
...@@ -49,7 +50,6 @@ public: ...@@ -49,7 +50,6 @@ public:
bool empty() const; bool empty() const;
friend void pptx_serialize(std::wostream & _Wostream, pptx_comments const & val); friend void pptx_serialize(std::wostream & _Wostream, pptx_comments const & val);
friend void pptx_serialize_authors(std::wostream & _Wostream, pptx_comments const & val);
private: private:
class Impl; class Impl;
......
...@@ -25,7 +25,7 @@ public: ...@@ -25,7 +25,7 @@ public:
{ {
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++); const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml"; const std::wstring fileName = std::wstring(L"comment") + file_id + L".xml";
comments_.push_back(pptx_comment_elm(fileName, content, comments)); comments_.push_back(pptx_comment_elm(fileName, content, comments));
...@@ -94,6 +94,11 @@ public: ...@@ -94,6 +94,11 @@ public:
{ {
return pptx_comments_; return pptx_comments_;
} }
void clear()
{
pptx_comments_ = pptx_comments::create();
}
private: private:
pptx_comments_ptr pptx_comments_; pptx_comments_ptr pptx_comments_;
}; };
...@@ -108,26 +113,22 @@ pptx_comments_context::~pptx_comments_context() ...@@ -108,26 +113,22 @@ pptx_comments_context::~pptx_comments_context()
{ {
} }
void pptx_comments_context::start_comment (double width_pt, double height_pt, double x_pt, double y_pt) void pptx_comments_context::start_comment (double x_emu, double y_emu,int id_author, int idx_comment)
{ {
impl_->current_.width_ = width_pt; impl_->current_.x_ = (int)(x_emu + 0.5);
impl_->current_.height_ = height_pt; impl_->current_.y_ = (int)(y_emu + 0.5);
impl_->current_.left_ = x_pt;
impl_->current_.top_ = y_pt; impl_->current_.author_id_ = id_author;
impl_->current_.idx_ = idx_comment;
impl_->current_.visibly_ = false;
} }
void pptx_comments_context::add_content(std::wstring content) void pptx_comments_context::add_content(std::wstring content)
{ {
impl_->current_.content_ = content; impl_->current_.content_ = content;
} }
void pptx_comments_context::add_author(std::wstring author)
{ void pptx_comments_context::add_date(std::wstring Val)
impl_->current_.author_ = author;
}
void pptx_comments_context::set_visibly(bool Val)
{ {
impl_->current_.visibly_ = Val; impl_->current_.date_ = Val;
} }
std::vector<odf::_property> & pptx_comments_context::get_draw_properties() std::vector<odf::_property> & pptx_comments_context::get_draw_properties()
...@@ -148,6 +149,7 @@ bool pptx_comments_context::empty() const ...@@ -148,6 +149,7 @@ bool pptx_comments_context::empty() const
void pptx_comments_context::write_comments(std::wostream & strm) void pptx_comments_context::write_comments(std::wostream & strm)
{ {
impl_->write_comments(strm); impl_->write_comments(strm);
impl_->clear();
} }
pptx_comments_ptr pptx_comments_context::get_comments() pptx_comments_ptr pptx_comments_context::get_comments()
{ {
......
...@@ -41,14 +41,12 @@ public: ...@@ -41,14 +41,12 @@ public:
pptx_comments_context(pptx_comments_context_handle & h); pptx_comments_context(pptx_comments_context_handle & h);
~pptx_comments_context(); ~pptx_comments_context();
void start_comment(double width_pt, double height_pt, double x_pt, double y_pt); void start_comment(double x_emu, double y_emu,int id_author, int idx_comment);
void add_content(std::wstring content); void add_content (std::wstring content);
void add_author(std::wstring author); void add_date (std::wstring date);
std::vector<odf::_property> & get_draw_properties(); std::vector<odf::_property> & get_draw_properties();
void set_visibly(bool Val);
void end_comment(); void end_comment();
......
...@@ -240,6 +240,8 @@ void pptx_conversion_context::end_document() ...@@ -240,6 +240,8 @@ void pptx_conversion_context::end_document()
output_document_->get_ppt_files().set_themes(theme_); output_document_->get_ppt_files().set_themes(theme_);
output_document_->get_ppt_files().set_media(get_mediaitems()); output_document_->get_ppt_files().set_media(get_mediaitems());
output_document_->get_ppt_files().set_authors_comments(authors_comments_);
} }
void pptx_conversion_context::start_body() void pptx_conversion_context::start_body()
...@@ -459,6 +461,17 @@ void pptx_conversion_context::end_layout() ...@@ -459,6 +461,17 @@ void pptx_conversion_context::end_layout()
get_slide_context().end_slide(); get_slide_context().end_slide();
} }
std::pair<int,int> pptx_conversion_context::add_author_comments(std::wstring author)
{
if (!authors_comments_)
{
authors_comments_ = pptx_xml_authors_comments::create();
if (!authors_comments_)return std::pair<int,int>(-1,-1);
}
return authors_comments_->add_or_find(author);
}
void pptx_conversion_context::end_master() void pptx_conversion_context::end_master()
{ {
get_slide_context().serialize_background(current_master().Background(),true); get_slide_context().serialize_background(current_master().Background(),true);
......
...@@ -68,6 +68,8 @@ public: ...@@ -68,6 +68,8 @@ public:
void start_theme(std::wstring & name); void start_theme(std::wstring & name);
void end_theme(); void end_theme();
std::pair<int,int> add_author_comments(std::wstring author);
pptx_slide_context & get_slide_context() { return pptx_slide_context_; } pptx_slide_context & get_slide_context() { return pptx_slide_context_; }
pptx_comments_context & get_comments_context() { return pptx_comments_context_; } pptx_comments_context & get_comments_context() { return pptx_comments_context_; }
...@@ -118,18 +120,19 @@ private: ...@@ -118,18 +120,19 @@ private:
package::pptx_document * output_document_; package::pptx_document * output_document_;
odf::odf_document * odf_document_; odf::odf_document * odf_document_;
pptx_slide_context pptx_slide_context_; pptx_slide_context pptx_slide_context_;
pptx_text_context pptx_text_context_; pptx_text_context pptx_text_context_;
pptx_table_context pptx_table_context_; pptx_table_context pptx_table_context_;
pptx_comments_context pptx_comments_context_; pptx_comments_context pptx_comments_context_;
std::vector<oox_chart_context_ptr> charts_; std::vector<oox_chart_context_ptr> charts_;
std::vector<pptx_xml_slide_ptr> slides_; std::vector<pptx_xml_slide_ptr> slides_;
std::vector<pptx_xml_slideMaster_ptr> slideMasters_; std::vector<pptx_xml_slideMaster_ptr> slideMasters_;
std::vector<pptx_xml_slideLayout_ptr> slideLayouts_; std::vector<pptx_xml_slideLayout_ptr> slideLayouts_;
pptx_xml_authors_comments_ptr authors_comments_;
pptx_xml_theme_ptr theme_; pptx_xml_theme_ptr theme_;
pptx_xml_presentation presentation_; pptx_xml_presentation presentation_;
......
...@@ -125,8 +125,7 @@ public: ...@@ -125,8 +125,7 @@ public:
Rels.add(relationship( Rels.add(relationship(
r.rid_, r.rid_,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
r.ref_, r.ref_)
L"External")
); );
} }
} }
......
...@@ -68,10 +68,10 @@ void pptx_xml_slide::write_to(std::wostream & strm) ...@@ -68,10 +68,10 @@ void pptx_xml_slide::write_to(std::wostream & strm)
CP_XML_STREAM() << slideData_.str(); CP_XML_STREAM() << slideData_.str();
} }
} }
CP_XML_NODE(L"p:clrMapOvr") //CP_XML_NODE(L"p:clrMapOvr")
{ //{
CP_XML_NODE(L"a:masterClrMapping"); // CP_XML_NODE(L"a:masterClrMapping");
} //}
} }
} }
} }
...@@ -290,6 +290,68 @@ void pptx_xml_theme::write_to(std::wostream & strm) ...@@ -290,6 +290,68 @@ void pptx_xml_theme::write_to(std::wostream & strm)
} }
} }
} }
pptx_xml_authors_comments_ptr pptx_xml_authors_comments::create()
{
return boost::make_shared<pptx_xml_authors_comments>();
}
std::pair<int,int> pptx_xml_authors_comments::add_or_find(std::wstring author)
{
int id_author=0;
int last_id=0;
bool find = false;
for (long i=0;i<list_.size();i++)
{
if (author == list_[i].name)
{
id_author = i;
last_id = list_[i].last_idx+1;
list_[i].last_idx++;
find=true;
break;
}
}
if (!find)
{
_author_elm elm = {author,0};
list_.push_back(elm);
id_author = list_.size()-1;
}
return std::pair<int,int>(id_author,last_id);
}
void pptx_xml_authors_comments::write_to(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"p:cmAuthorLst")
{
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
int i=0;
int size = list_.size();
while(true)
{
if (i>=size)break;
CP_XML_NODE(L"p:cmAuthor")
{
CP_XML_ATTR(L"id", i);
CP_XML_ATTR(L"name", list_[i].name);
CP_XML_ATTR(L"initials", L"");
CP_XML_ATTR(L"lastIdx", list_[i].last_idx+1);
CP_XML_ATTR(L"clrIdx", i);
}
i++;
}
}
}
}
void pptx_xml_presentation::write_to(std::wostream & strm) void pptx_xml_presentation::write_to(std::wostream & strm)
{ {
......
...@@ -159,5 +159,30 @@ private: ...@@ -159,5 +159,30 @@ private:
std::wstring name_; std::wstring name_;
int id_; int id_;
}; };
////////////////////////////////////////////////////////////////////////////////////////////////////////
class pptx_xml_authors_comments;
typedef _CP_PTR(pptx_xml_authors_comments) pptx_xml_authors_comments_ptr;
class pptx_xml_authors_comments: noncopyable
{
public:
pptx_xml_authors_comments(){}
~pptx_xml_authors_comments(){}
public:
struct _author_elm
{
std::wstring name;
int last_idx;
};
void write_to(std::wostream & strm);
std::pair<int,int> add_or_find(std::wstring name);// 2 - - idx
// , , ....
static pptx_xml_authors_comments_ptr create();
std::vector<_author_elm> list_;
};
} }
} }
...@@ -211,7 +211,7 @@ void slideLayouts_files::write(const std::wstring & RootPath) ...@@ -211,7 +211,7 @@ void slideLayouts_files::write(const std::wstring & RootPath)
} }
} }
} }
///////////////////////////////////////////////////////////////////////////////////////
theme_elements::theme_elements(pptx_xml_theme_ptr & theme) : theme_(theme) theme_elements::theme_elements(pptx_xml_theme_ptr & theme) : theme_(theme)
{ {
} }
...@@ -229,6 +229,28 @@ void theme_elements::write(const std::wstring & RootPath) ...@@ -229,6 +229,28 @@ void theme_elements::write(const std::wstring & RootPath)
if (get_main_document()) if (get_main_document())
get_main_document()->content_type().get_content_type().add_override(std::wstring(L"/ppt/theme/") + file_name, L"application/vnd.openxmlformats-officedocument.theme+xml"); get_main_document()->content_type().get_content_type().add_override(std::wstring(L"/ppt/theme/") + file_name, L"application/vnd.openxmlformats-officedocument.theme+xml");
}
///////////////////////////////////////////////////////////////////////////////////////
authors_comments_element::authors_comments_element(pptx_xml_authors_comments_ptr & authors_comments) : authors_comments_(authors_comments)
{
}
void authors_comments_element::write(const std::wstring & RootPath)
{
if (authors_comments_ == NULL) return;
fs::wpath path = fs::wpath(RootPath);
const std::wstring file_name = std::wstring(L"commentAuthors.xml");
std::wstringstream content_authors_comments;
authors_comments_->write_to(content_authors_comments);
simple_element(file_name, content_authors_comments.str()).write(BOOST_STRING_PATH(path));
if (get_main_document())
{
get_main_document()->content_type().get_content_type().add_override(std::wstring(L"/ppt/commentAuthors.xml"),
L"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml");
}
} }
//////////////////////////// ////////////////////////////
...@@ -336,7 +358,12 @@ void ppt_files::write(const std::wstring & RootPath) ...@@ -336,7 +358,12 @@ void ppt_files::write(const std::wstring & RootPath)
comments_->set_main_document(get_main_document()); comments_->set_main_document(get_main_document());
comments_->write(BOOST_STRING_PATH(path)); comments_->write(BOOST_STRING_PATH(path));
} }
rels_files_.write(BOOST_STRING_PATH(path)); if (authors_comments_)
{
rels_files_.add( relationship( L"auId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", L"commentAuthors.xml" ) );
authors_comments_->write(BOOST_STRING_PATH(path));
}
rels_files_.write(BOOST_STRING_PATH(path));
} }
void ppt_files::set_presentation(pptx_xml_presentation & presentation) void ppt_files::set_presentation(pptx_xml_presentation & presentation)
...@@ -380,6 +407,15 @@ void ppt_files::set_media(mediaitems & _Mediaitems) ...@@ -380,6 +407,15 @@ void ppt_files::set_media(mediaitems & _Mediaitems)
{ {
media_ = element_ptr( new media(_Mediaitems) ); media_ = element_ptr( new media(_Mediaitems) );
} }
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)
{
if (authors_comments)
{
authors_comments_element * elm = new authors_comments_element(authors_comments);
elm->set_main_document( this->get_main_document() );
authors_comments_ = element_ptr( elm );
}
}
void ppt_files::add_charts(chart_content_ptr chart) void ppt_files::add_charts(chart_content_ptr chart)
{ {
charts_files_.add_chart(chart); charts_files_.add_chart(chart);
......
...@@ -10,6 +10,8 @@ namespace oox { ...@@ -10,6 +10,8 @@ namespace oox {
class pptx_xml_presentation; class pptx_xml_presentation;
class pptx_xml_theme; class pptx_xml_theme;
typedef _CP_PTR(pptx_xml_theme) pptx_xml_theme_ptr; typedef _CP_PTR(pptx_xml_theme) pptx_xml_theme_ptr;
class pptx_xml_authors_comments;
typedef _CP_PTR(pptx_xml_authors_comments) pptx_xml_authors_comments_ptr;
namespace package { namespace package {
...@@ -76,7 +78,6 @@ public: ...@@ -76,7 +78,6 @@ public:
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class theme_elements : public element class theme_elements : public element
{ {
public: public:
...@@ -86,6 +87,18 @@ public: ...@@ -86,6 +87,18 @@ public:
private: private:
pptx_xml_theme_ptr & theme_; pptx_xml_theme_ptr & theme_;
};
///////////////////////////////////////////////////////////////////////////////
class authors_comments_element : public element
{
public:
authors_comments_element(pptx_xml_authors_comments_ptr & theme);
virtual void write(const std::wstring & RootPath);
private:
pptx_xml_authors_comments_ptr & authors_comments_;
}; };
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
...@@ -129,6 +142,8 @@ private: ...@@ -129,6 +142,8 @@ private:
const std::vector<pptx_comment_elm> & comments_; const std::vector<pptx_comment_elm> & comments_;
}; };
//////////////////////////////////////////////////////////////////////////////
/// \class ppt_charts_files /// \class ppt_charts_files
class ppt_charts_files : public element class ppt_charts_files : public element
{ {
...@@ -163,6 +178,7 @@ public: ...@@ -163,6 +178,7 @@ public:
void set_media(mediaitems & _Mediaitems); void set_media(mediaitems & _Mediaitems);
void add_charts(chart_content_ptr chart); void add_charts(chart_content_ptr chart);
void set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments);
private: private:
rels_files rels_files_; rels_files rels_files_;
...@@ -175,7 +191,9 @@ private: ...@@ -175,7 +191,9 @@ private:
//slides_files notesSlides_files_; //slides_files notesSlides_files_;
//slides_files notesMasters_files_; //slides_files notesMasters_files_;
//slides_files handoutMasters_files_; //slides_files handoutMasters_files_;
element_ptr authors_comments_;
element_ptr theme_; element_ptr theme_;
element_ptr presentation_; element_ptr presentation_;
......
...@@ -58,6 +58,9 @@ public: ...@@ -58,6 +58,9 @@ public:
void start_field(field_type type, const std::wstring & styleName); void start_field(field_type type, const std::wstring & styleName);
void end_field(); void end_field();
void start_comment();
std::wstring end_comment();
bool in_list_; bool in_list_;
private: private:
...@@ -141,7 +144,7 @@ void pptx_text_context::Impl::start_paragraph(const std::wstring & styleName) ...@@ -141,7 +144,7 @@ void pptx_text_context::Impl::start_paragraph(const std::wstring & styleName)
{ {
dump_paragraph(); dump_paragraph();
} }
else if (in_list_ == false) else if (in_list_ == false || in_comment == true)
{ {
// //
//text_ << L"&#10;"; //text_ << L"&#10;";
...@@ -378,6 +381,8 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm) ...@@ -378,6 +381,8 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
} }
std::wstring pptx_text_context::Impl::dump_paragraph(/*bool last*/) std::wstring pptx_text_context::Impl::dump_paragraph(/*bool last*/)
{ {
if (in_comment) return L"";
dump_run();//last dump_run();//last
std::wstring & str_run = run_.str(); std::wstring & str_run = run_.str();
...@@ -457,6 +462,8 @@ void pptx_text_context::Impl::dump_field() ...@@ -457,6 +462,8 @@ void pptx_text_context::Impl::dump_field()
} }
void pptx_text_context::Impl::dump_run() void pptx_text_context::Impl::dump_run()
{ {
if (in_comment) return;
dump_field(); dump_field();
const std::wstring content = xml::utils::replace_text_to_xml(text_.str()); const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
...@@ -511,12 +518,12 @@ std::wstring pptx_text_context::Impl::end_object() ...@@ -511,12 +518,12 @@ std::wstring pptx_text_context::Impl::end_object()
std::wstring & str_paragraph = paragraph_.str(); std::wstring & str_paragraph = paragraph_.str();
std::wstringstream str_styles; std::wstringstream str_output;
if (str_paragraph.length() > 0) if (str_paragraph.length() > 0)
{ {
write_list_styles(str_styles); write_list_styles(str_output);
str_styles << str_paragraph; str_output << str_paragraph;
} }
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
...@@ -529,7 +536,7 @@ std::wstring pptx_text_context::Impl::end_object() ...@@ -529,7 +536,7 @@ std::wstring pptx_text_context::Impl::end_object()
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
span_style_name_=L""; span_style_name_=L"";
return str_styles.str(); return str_output.str();
} }
void pptx_text_context::Impl::start_list_item(bool restart) void pptx_text_context::Impl::start_list_item(bool restart)
{ {
...@@ -612,7 +619,23 @@ void pptx_text_context::Impl::start_field(field_type type, const std::wstring & ...@@ -612,7 +619,23 @@ void pptx_text_context::Impl::start_field(field_type type, const std::wstring &
{ {
field_type_ = type; field_type_ = type;
} }
void pptx_text_context::Impl::start_comment()
{
in_comment = true;// -
}
std::wstring pptx_text_context::Impl::end_comment()
{
std::wstring str_comment = text_.str();
text_.str(std::wstring());
in_comment = false;
paragraphs_cout_ = 0;
paragraph_style_name_ = L"";
span_style_name_=L"";
return str_comment;
}
void pptx_text_context::Impl::end_field() void pptx_text_context::Impl::end_field()
{ {
dump_run(); dump_run();
...@@ -758,11 +781,11 @@ void pptx_text_context::end_field() ...@@ -758,11 +781,11 @@ void pptx_text_context::end_field()
} }
void pptx_text_context::start_comment_content() void pptx_text_context::start_comment_content()
{ {
impl_->start_object(); impl_->start_comment();
} }
std::wstring pptx_text_context::end_comment_content() std::wstring pptx_text_context::end_comment_content()
{ {
return impl_->end_object(); return impl_->end_comment();
} }
} }
......
...@@ -210,21 +210,13 @@ void officeooo_annotation::add_attributes( const xml::attributes_wc_ptr & Attrib ...@@ -210,21 +210,13 @@ void officeooo_annotation::add_attributes( const xml::attributes_wc_ptr & Attrib
void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context) void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
{ {
const _CP_OPT(length) svg_widthVal = office_annotation_attr_.svg_width_; const double x = 8 * office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double y = 8 * office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
const double width_cm = svg_widthVal.get_value_or(length(0)).get_value_unit(length::cm);
const double width_pt = svg_widthVal.get_value_or(length(0)).get_value_unit(length::pt);
const _CP_OPT(length) svg_heightVal =office_annotation_attr_.svg_height_;
const double height_cm = svg_heightVal.get_value_or(length(0)).get_value_unit(length::cm);
const double height_pt = svg_heightVal.get_value_or(length(0)).get_value_unit(length::pt);
const double x_pt = office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double y_pt = office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
///////////////////////////////// /////////////////////////////////
std::wstring date; std::wstring date;
std::wstring author; std::wstring author;
std::pair<int,int> id_idx;
if (dc_date_) if (dc_date_)
{ {
date = xml::utils::replace_text_to_xml(dynamic_cast<dc_date * >(dc_date_.get())->content_); date = xml::utils::replace_text_to_xml(dynamic_cast<dc_date * >(dc_date_.get())->content_);
...@@ -233,22 +225,19 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -233,22 +225,19 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
{ {
author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_); author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_);
} }
//////////////////////////////////////// id_idx = Context.add_author_comments(author);
Context.get_comments_context().start_comment(width_pt, height_pt, x_pt, y_pt);
if (office_annotation_attr_.display_)
{
Context.get_comments_context().set_visibly(office_annotation_attr_.display_.get());
}
Context.get_comments_context().start_comment(x, y,id_idx.first,id_idx.second);//author & idx (uniq number for author
Context.get_text_context().start_comment_content(); Context.get_text_context().start_comment_content();
BOOST_FOREACH(office_element_ptr const & elm, content_)//òåêñò + òåêñòîâûé ñòèëü BOOST_FOREACH(office_element_ptr const & elm, content_)//òåêñò + òåêñòîâûé ñòèëü
{ {
elm->pptx_convert(Context); elm->pptx_convert(Context);
} }
Context.get_comments_context().add_author(author);
Context.get_comments_context().add_date(date);
Context.get_comments_context().add_content(Context.get_text_context().end_comment_content()); Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
/// Îáðàáàòûâàåì ñòèëü draw /// Îáðàáàòûâàåì ñòèëü draw
std::vector<const odf::style_instance *> instances; std::vector<const odf::style_instance *> instances;
......
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