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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54724 954022d7-b5bf-4e40-9824-e11837661b57
parent 3c061ff5
...@@ -828,6 +828,10 @@ ...@@ -828,6 +828,10 @@
RelativePath=".\src\odf\datatypes\smil_transitiontype.h" RelativePath=".\src\odf\datatypes\smil_transitiontype.h"
> >
</File> </File>
<File
RelativePath=".\src\odf\datatypes\style_ref.cpp"
>
</File>
<File <File
RelativePath=".\src\odf\datatypes\style_ref.h" RelativePath=".\src\odf\datatypes\style_ref.h"
> >
......
#include "precompiled_cpodf.h"
#include "style_ref.h"
#include <iostream>
#include <sstream>
#include <lexical_cast.h>
#include <cpdoccore/CPAssert.h>
namespace cpdoccore {
namespace odf {
std::wostream & operator << (std::wostream & _Wostream, const style_ref & _styleRef)
{
_Wostream << _styleRef.style_name();
return _Wostream;
}
}
}
\ No newline at end of file
...@@ -11,11 +11,11 @@ class style_ref ...@@ -11,11 +11,11 @@ class style_ref
public: public:
style_ref() style_ref()
{ {
} ; }
style_ref(const ::std::wstring & StyleName) : style_name_(StyleName) style_ref(const ::std::wstring & StyleName) : style_name_(StyleName)
{ {
} ; }
bool empty() const bool empty() const
{ {
...@@ -37,15 +37,10 @@ private: ...@@ -37,15 +37,10 @@ private:
::std::wstring style_name_; ::std::wstring style_name_;
}; };
std::wostream & operator << (std::wostream & _Wostream, const style_ref & _styleReft);
typedef ::std::vector<style_ref> style_ref_array; typedef ::std::vector<style_ref> style_ref_array;
template <class Ostream> Ostream & operator << (Ostream & _Ostream, const style_ref & _styleRef)
{
_Ostream << _styleRef.style_name();
return _Ostream;
}
inline std::wistream & operator >> (std::wistream & _Istream, style_ref & _styleRef) inline std::wistream & operator >> (std::wistream & _Istream, style_ref & _styleRef)
{ {
_Istream >> _styleRef.style_name(); _Istream >> _styleRef.style_name();
......
...@@ -582,6 +582,10 @@ ...@@ -582,6 +582,10 @@
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\smil_transitiontype.h" RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\smil_transitiontype.h"
> >
</File> </File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\style_ref.cpp"
>
</File>
<File <File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\style_ref.h" RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\style_ref.h"
> >
...@@ -971,6 +975,10 @@ ...@@ -971,6 +975,10 @@
RelativePath=".\ReadMe.txt" RelativePath=".\ReadMe.txt"
> >
</File> </File>
<File
RelativePath=".\OdfFormat\serialize_common_attlists.h"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
......
...@@ -26,7 +26,7 @@ void ods_conversion_context::start_sheet(std::wstring & name) ...@@ -26,7 +26,7 @@ void ods_conversion_context::start_sheet(std::wstring & name)
{ {
create_element(L"table", L"table",current_spreadsheet_->getContent(),this); create_element(L"table", L"table",current_spreadsheet_->getContent(),this);
ods_table_context_.start_table(current_spreadsheet_->getContent().back()); ods_table_context_.start_table(current_spreadsheet_->getContent().back(),name);
} }
......
...@@ -25,13 +25,15 @@ const ods_table_state & ods_table_context::state() const ...@@ -25,13 +25,15 @@ const ods_table_state & ods_table_context::state() const
return table_state_list_.back(); return table_state_list_.back();
} }
void ods_table_context::start_table(office_element_ptr & elm) void ods_table_context::start_table(office_element_ptr & elm, std::wstring & name)
{ {
table_state_list_.push_back( ods_table_state(context_, elm) ); table_state_list_.push_back( ods_table_state(context_, elm) );
state().set_name(name);
} }
void ods_table_context::end_table() void ods_table_context::end_table()
{ {
state().convert();
} }
} }
} }
\ No newline at end of file
...@@ -20,7 +20,7 @@ public: ...@@ -20,7 +20,7 @@ public:
ods_table_context(ods_conversion_context & Context/*, ods_text_context & textCotnext*/); ods_table_context(ods_conversion_context & Context/*, ods_text_context & textCotnext*/);
public: public:
void start_table(office_element_ptr & elm); void start_table(office_element_ptr & elm,std::wstring & name);
void end_table(); void end_table();
//std::wstring get_current_table_name() const; //std::wstring get_current_table_name() const;
......
...@@ -15,6 +15,19 @@ ods_table_state::ods_table_state(ods_conversion_context & Context, office_elemen ...@@ -15,6 +15,19 @@ ods_table_state::ods_table_state(ods_conversion_context & Context, office_elemen
} }
void ods_table_state::set_name(std::wstring name)
{
tableName_ = name;
office_element_->table_table_attlist_.table_name_ = name;
}
void ods_table_state::convert()
{
if (office_element_ == NULL)return;
// ??? ..
}
} }
} }
...@@ -24,6 +24,7 @@ class ods_table_state ...@@ -24,6 +24,7 @@ class ods_table_state
public: public:
ods_table_state(ods_conversion_context & Context, office_element_ptr & elm); ods_table_state(ods_conversion_context & Context, office_element_ptr & elm);
void set_name(std::wstring);
// std::wstring current_style() const { return table_style_; } // std::wstring current_style() const { return table_style_; }
// void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName); // void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
// void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName); // void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
...@@ -67,7 +68,7 @@ public: ...@@ -67,7 +68,7 @@ public:
// void serialize_hyperlinks(std::wostream & _Wostream); // void serialize_hyperlinks(std::wostream & _Wostream);
// void dump_rels_hyperlinks(rels & Rels); // void dump_rels_hyperlinks(rels & Rels);
//std::wstring get_current_table_name() const { return tableName_; } std::wstring get_current_table_name() const { return tableName_; }
//struct _group_row //struct _group_row
//{ //{
...@@ -76,13 +77,14 @@ public: ...@@ -76,13 +77,14 @@ public:
// int level; // int level;
// bool collapsed; // bool collapsed;
//}group_row_; //}group_row_;
void convert();
private: private:
ods_conversion_context & context_; ods_conversion_context & context_;
table_table* office_element_; table_table* office_element_;
//std::wstring table_style_; //std::wstring table_style_;
// std::wstring tableName_; std::wstring tableName_;
// std::wstring table_row_style_; // std::wstring table_row_style_;
// std::vector<std::wstring> column_default_cell_style_name_; // std::vector<std::wstring> column_default_cell_style_name_;
// std::wstring row_default_cell_style_name_; // std::wstring row_default_cell_style_name_;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <cpdoccore/xml/serialize.h> #include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h> #include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -39,7 +41,13 @@ void office_body::add_child_element( office_element_ptr & child_element) ...@@ -39,7 +41,13 @@ void office_body::add_child_element( office_element_ptr & child_element)
void office_body::serialize(std::wostream & _Wostream) void office_body::serialize(std::wostream & _Wostream)
{ {
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"office::body")
{
content_->serialize(CP_XML_STREAM());
}
}
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -34,7 +36,16 @@ void office_spreadsheet::add_child_element(office_element_ptr & child_element) ...@@ -34,7 +36,16 @@ void office_spreadsheet::add_child_element(office_element_ptr & child_element)
} }
void office_spreadsheet::serialize(std::wostream & _Wostream) void office_spreadsheet::serialize(std::wostream & _Wostream)
{ {
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"office:spreadsheet")
{
BOOST_FOREACH(office_element_ptr & elm, content_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
} }
} }
......
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
#include <cpdoccore/xml/serialize.h> #include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h> #include <cpdoccore/xml/attributes.h>
//#include "serialize_elements.h"
#include <cpdoccore/odf/odf_document.h> #include <cpdoccore/odf/odf_document.h>
//#include "odf_conversion_context.h" #include <cpdoccore/xml/simple_xml_writer.h>
#include "serialize_common_attlists.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -117,17 +118,6 @@ void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes ) ...@@ -117,17 +118,6 @@ void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
table_table_attlist_.add_attributes(Attributes); table_table_attlist_.add_attributes(Attributes);
} }
//void table_table::add_child_element(office_element_ptr & child_element)
//{
// //get_type ->
// content_.push_back(child_element);
//}
//
//void table_table::serialize(std::wostream & _Wostream)
//{
//
//}
void table_table::add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name) void table_table::add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
if (L"table" == Ns && L"table-source" == Name) if (L"table" == Ns && L"table-source" == Name)
...@@ -158,6 +148,33 @@ void table_table::add_child_element(const ::std::wstring & Ns, const ::std::wstr ...@@ -158,6 +148,33 @@ void table_table::add_child_element(const ::std::wstring & Ns, const ::std::wstr
} }
void table_table::serialize(std::wostream & _Wostream)
{
std::wstring ns_name_ =std::wstring(ns) + std::wstring(L":") + std::wstring(name);
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(ns_name_)
{
CP_XML_ATTR_OPT( L"table:name", table_table_attlist_.table_name_);
CP_XML_ATTR_OPT( L"table:style-name", table_table_attlist_.table_style_name_);
CP_XML_ATTR_OPT( L"table:template-name", table_table_attlist_.table_template_name_);
if (table_table_attlist_.table_protected_)
CP_XML_ATTR_OPT( L"table:protection-key", table_table_attlist_.table_protection_key_);
if (table_table_attlist_.table_print_)
CP_XML_ATTR_OPT( L"table:print-ranges", table_table_attlist_.table_print_ranges_);
if (table_shapes_)table_shapes_->serialize(CP_XML_STREAM());
if (table_shapes_)table_shapes_->serialize(CP_XML_STREAM());
table_columns_and_groups_.serialize(CP_XML_STREAM());
table_rows_and_groups_.serialize(CP_XML_STREAM());
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
void table_table_column_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_column_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "style_ref.h"
#include "tablevisibility.h" #include "tablevisibility.h"
#include "common_attlists.h" #include "common_attlists.h"
...@@ -652,7 +651,7 @@ public: ...@@ -652,7 +651,7 @@ public:
virtual void add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){} virtual void add_child_element( office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream){} virtual void serialize(std::wostream & _Wostream);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......
...@@ -91,14 +91,14 @@ namespace Oox2Odf ...@@ -91,14 +91,14 @@ namespace Oox2Odf
if(pSheet->m_oRid.IsInit()) if(pSheet->m_oRid.IsInit())
{ {
CString sSheetRId = pSheet->m_oName.get2(); CString sSheetRId = pSheet->m_oRid.get2().ToString();
CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pPair = arrWorksheets.Lookup(sSheetRId); CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pPair = arrWorksheets.Lookup(sSheetRId);
if (NULL != pPair) if (NULL != pPair)
{ {
OOX::Spreadsheet::CWorksheet *pWorksheet = pPair->m_value; OOX::Spreadsheet::CWorksheet *pWorksheet = pPair->m_value;
if (NULL != pWorksheet && pWorksheet->m_oSheetData.IsInit()) if (NULL != pWorksheet && pWorksheet->m_oSheetData.IsInit())
{ {
std::wstring name = L"";/*pSheet->m_oName.get2()*/ std::wstring name = string2std_string(pSheet->m_oName.get2());
ods_conversion_context_.start_sheet(name); ods_conversion_context_.start_sheet(name);
//CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pair = aWorksheets.Lookup(pSheet->m_oRid->GetValue()); //CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pair = aWorksheets.Lookup(pSheet->m_oRid->GetValue());
//if(NULL != pair) //if(NULL != pair)
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
#include <boost_filesystem_version.h> #include <boost_filesystem_version.h>
static std::wstring string2std_string(CString val)
{
return std::wstring(val.GetBuffer());
}
namespace Oox2Odf namespace Oox2Odf
{ {
class Impl; class Impl;
......
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