mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54724 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
3c061ff50c
commit
e5c9394c0b
@ -828,6 +828,10 @@
|
||||
RelativePath=".\src\odf\datatypes\smil_transitiontype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\odf\datatypes\style_ref.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\odf\datatypes\style_ref.h"
|
||||
>
|
||||
|
||||
20
ASCOfficeOdfFile/src/odf/datatypes/style_ref.cpp
Normal file
20
ASCOfficeOdfFile/src/odf/datatypes/style_ref.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -11,11 +11,11 @@ class style_ref
|
||||
public:
|
||||
style_ref()
|
||||
{
|
||||
} ;
|
||||
}
|
||||
|
||||
style_ref(const ::std::wstring & StyleName) : style_name_(StyleName)
|
||||
{
|
||||
} ;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
@ -37,15 +37,10 @@ private:
|
||||
::std::wstring style_name_;
|
||||
|
||||
};
|
||||
std::wostream & operator << (std::wostream & _Wostream, const style_ref & _styleReft);
|
||||
|
||||
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)
|
||||
{
|
||||
_Istream >> _styleRef.style_name();
|
||||
|
||||
@ -582,6 +582,10 @@
|
||||
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\smil_transitiontype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\style_ref.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\style_ref.h"
|
||||
>
|
||||
@ -971,6 +975,10 @@
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OdfFormat\serialize_common_attlists.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@ -26,7 +26,7 @@ void ods_conversion_context::start_sheet(std::wstring & name)
|
||||
{
|
||||
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
|
||||
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) );
|
||||
state().set_name(name);
|
||||
}
|
||||
|
||||
void ods_table_context::end_table()
|
||||
{
|
||||
state().convert();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ public:
|
||||
ods_table_context(ods_conversion_context & Context/*, ods_text_context & textCotnext*/);
|
||||
|
||||
public:
|
||||
void start_table(office_element_ptr & elm);
|
||||
void start_table(office_element_ptr & elm,std::wstring & name);
|
||||
void end_table();
|
||||
|
||||
//std::wstring get_current_table_name() const;
|
||||
|
||||
@ -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;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>??? <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,9 @@ class table_table;
|
||||
class ods_table_state
|
||||
{
|
||||
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_; }
|
||||
// void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
// void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
@ -67,7 +68,7 @@ public:
|
||||
// void serialize_hyperlinks(std::wostream & _Wostream);
|
||||
// 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
|
||||
//{
|
||||
@ -76,13 +77,14 @@ public:
|
||||
// int level;
|
||||
// bool collapsed;
|
||||
//}group_row_;
|
||||
void convert();
|
||||
private:
|
||||
ods_conversion_context & context_;
|
||||
|
||||
table_table* office_element_;
|
||||
|
||||
//std::wstring table_style_;
|
||||
// std::wstring tableName_;
|
||||
std::wstring tableName_;
|
||||
// std::wstring table_row_style_;
|
||||
// std::vector<std::wstring> column_default_cell_style_name_;
|
||||
// std::wstring row_default_cell_style_name_;
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
#include <cpdoccore/xml/serialize.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf {
|
||||
|
||||
@ -39,7 +41,13 @@ void office_body::add_child_element( office_element_ptr & child_element)
|
||||
|
||||
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 @@
|
||||
#include "office_elements.h"
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf {
|
||||
|
||||
@ -34,7 +36,16 @@ void office_spreadsheet::add_child_element(office_element_ptr & child_element)
|
||||
}
|
||||
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 @@
|
||||
#include <cpdoccore/xml/serialize.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
//#include "serialize_elements.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 odf {
|
||||
@ -117,17 +118,6 @@ void table_table::add_attributes( const xml::attributes_wc_ptr & 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)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
{
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
#include "office_elements.h"
|
||||
#include "office_elements_create.h"
|
||||
|
||||
#include "style_ref.h"
|
||||
#include "tablevisibility.h"
|
||||
|
||||
#include "common_attlists.h"
|
||||
@ -652,7 +651,7 @@ public:
|
||||
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 serialize(std::wostream & _Wostream){}
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
@ -91,14 +91,14 @@ namespace Oox2Odf
|
||||
|
||||
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);
|
||||
if (NULL != pPair)
|
||||
{
|
||||
OOX::Spreadsheet::CWorksheet *pWorksheet = pPair->m_value;
|
||||
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);
|
||||
//CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pair = aWorksheets.Lookup(pSheet->m_oRid->GetValue());
|
||||
//if(NULL != pair)
|
||||
|
||||
@ -2,6 +2,11 @@
|
||||
|
||||
#include <boost_filesystem_version.h>
|
||||
|
||||
static std::wstring string2std_string(CString val)
|
||||
{
|
||||
return std::wstring(val.GetBuffer());
|
||||
}
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
class Impl;
|
||||
|
||||
Reference in New Issue
Block a user