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

гиперлинки и примечания

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57050 954022d7-b5bf-4e40-9824-e11837661b57
parent 8961132b
......@@ -1239,6 +1239,14 @@
RelativePath=".\OdfFormat\odf_chart_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_comment_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_comment_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_conversion_context.cpp"
>
......
......@@ -65,6 +65,7 @@ void office_annotation_attr::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:height", svg_height_);
CP_XML_ATTR_OPT(L"office:display",display_);
CP_XML_ATTR_OPT(L"office:name",name_);
}
// office:annotation
......@@ -98,6 +99,19 @@ void office_annotation::add_child_element( office_element_ptr & child_element)
else
content_.push_back(child_element);
}
const wchar_t * office_annotation_end::ns = L"office";
const wchar_t * office_annotation_end::name = L"annotation-end";
void office_annotation_end::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
office_annotation_attr_.serialize(CP_GET_XML_NODE());
}
}
}
void office_annotation::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
......
......@@ -35,6 +35,8 @@ public:
_CP_OPT(style_ref) draw_text_style_name_;
_CP_OPT(style_ref) draw_style_name_;
_CP_OPT(std::wstring) name_;
};
/// \brief dc:date
......@@ -107,6 +109,33 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(office_annotation);
/// \brief office:annotation-end
class office_annotation_end : public office_element_impl<office_annotation_end>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeAnnotationEnd;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name){}
virtual void add_child_element( office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
office_annotation_attr office_annotation_attr_;
//
//private:
// office_element_ptr_array content_;
//
// office_element_ptr dc_date_;
// office_element_ptr dc_creator_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_annotation_end);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//officeooo:annotation
class officeooo_annotation : public office_element_impl<officeooo_annotation>
......
......@@ -223,6 +223,7 @@ enum ElementType
typeOfficeSpreadsheet,
typeOfficeAnnotation,
typeOfficeAnnotationEnd,
typeStyleRegionLeft,
typeOfficeScripts,
typeOfficeScript,
......
......@@ -183,16 +183,18 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_w_commentRangeEnd:
{
OOX::Logic::CShape* pShape = static_cast<OOX::Logic::CShape*>(oox_unknown);
convert(pShape);
OOX::Logic::CCommentRangeEnd* pCommEnd = static_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown);
convert(pCommEnd);
}break;
case OOX::et_w_commentRangeStart:
{
OOX::Logic::CShape* pShape = static_cast<OOX::Logic::CShape*>(oox_unknown);
convert(pShape);
OOX::Logic::CCommentRangeStart* pCommStart = static_cast<OOX::Logic::CCommentRangeStart*>(oox_unknown);
convert(pCommStart);
}break;
case OOX::et_w_commentReference:
{
OOX::Logic::CCommentReference* pCommRef = static_cast<OOX::Logic::CCommentReference*>(oox_unknown);
convert(pCommRef); // Start - Run
}break;
default:
{
......@@ -1241,7 +1243,74 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
}
void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start)
{
if(oox_comm_start == NULL)return;
if (oox_comm_start->m_oId.IsInit() == false) return;
int oox_comm_id = oox_comm_start->m_oId->GetValue();
bool added = odt_context->start_comment(oox_comm_id);
if (added==false)
{
convert_comment(oox_comm_id);
}
}
void DocxConverter::convert(OOX::Logic::CCommentRangeEnd* oox_comm_end)
{
if(oox_comm_end == NULL)return;
if (oox_comm_end->m_oId.IsInit() == false) return;
int oox_comm_id = oox_comm_end->m_oId->GetValue();
odt_context->end_comment(oox_comm_id);
}
void DocxConverter::convert(OOX::Logic::CCommentReference* oox_comm_ref)
{
if(oox_comm_ref == NULL)return;
if (oox_comm_ref->m_oId.IsInit() == false) return;
int oox_comm_id = oox_comm_ref->m_oId->GetValue();
bool added = odt_context->start_comment(oox_comm_id);
if (added == false)
{
// RangeStart
convert_comment(oox_comm_id);
}
}
void DocxConverter::convert_comment(int oox_comm_id)
{
OOX::CComments * docx_comments = docx_document->GetComments();
if (!docx_comments)return;
for (int comm =0 ; comm < docx_comments->m_arrComments.GetSize(); comm++)
{
OOX::CComment* oox_comment = docx_comments->m_arrComments[comm];
if (oox_comment == NULL) continue;
if (oox_comment->m_oId.IsInit() == false) continue;
if (oox_comment->m_oId->GetValue() == oox_comm_id)
{
odt_context->start_comment_content();
{
if (oox_comment->m_oAuthor.IsInit())odt_context->comment_context()->set_author (string2std_string(*oox_comment->m_oAuthor));
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (string2std_string(oox_comment->m_oDate->GetValue()));
if (oox_comment->m_oInitials.IsInit()){}
for (long i=0; i <oox_comment->m_arrItems.GetSize(); i++)
{
convert(oox_comment->m_arrItems[i]);
}
}
odt_context->end_comment_content();
}
}
}
}
}
\ No newline at end of file
......@@ -30,6 +30,9 @@ namespace OOX
class CHyperlink;
class CFldChar;
class CInstrText;
class CCommentRangeStart;
class CCommentRangeEnd;
class CCommentReference;
}
}
......@@ -82,6 +85,7 @@ namespace Oox2Odf
void convert_document();
void convert_styles();
void convert_comment(int oox_comm_id);
void convert(OOX::WritingElement *oox_unknown);
......@@ -116,5 +120,9 @@ namespace Oox2Odf
SimpleTypes::CUcharHexNumber<>* theme_shade, _CP_OPT(odf::color) & odf_color);
void convert(OOX::CDocDefaults *def_style);
void convert(OOX::CStyle *style);
void convert(OOX::Logic::CCommentRangeStart *oox_comm_start);
void convert(OOX::Logic::CCommentRangeEnd *oox_comm_end);
void convert(OOX::Logic::CCommentReference *oox_comm_ref);
};
}
\ No newline at end of file
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