Commit d32dc99e 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@54693 954022d7-b5bf-4e40-9824-e11837661b57
parent e70b94ae
......@@ -69,6 +69,8 @@ public:
HRESULT FinalConstruct()
{
office_utils_.CoCreateInstance(__uuidof(ASCOfficeUtils::COfficeUtils));
return S_OK;
}
......
......@@ -859,6 +859,50 @@
>
</File>
</Filter>
<Filter
Name="elements"
>
<File
RelativePath=".\OdfFormat\office_body.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\office_body.h"
>
</File>
<File
RelativePath=".\OdfFormat\office_spreadsheet.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\office_spreadsheet.h"
>
</File>
</Filter>
<Filter
Name="_spreadsheep"
>
<File
RelativePath=".\OdfFormat\ods_conversion_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\ods_conversion_context.h"
>
</File>
</Filter>
<File
RelativePath=".\OdfFormat\abstract_xml.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\abstract_xml.h"
>
</File>
<File
RelativePath=".\OdfFormat\logging.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_conversion_context.cpp"
>
......
#include "precompiled_cpodf.h"
#include "abstract_xml.h"
//#include "paragraph_elements.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace odf {
// abstract-xml
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * abstract_xml::ns = L"";
const wchar_t * abstract_xml::name = L"abstract-xml";
void abstract_xml::add_attributes( const xml::attributes_wc_ptr & )
{
}
void abstract_xml::serialize(std::wostream & strm)
{
}
//void abstract_xml::add_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
//{
// CP_CREATE_ELEMENT(xml_content_);
//}
//
//void abstract_xml::add_child_element( office_element_ptr & child_element)
//{
// xml_content_.push_back(child_element);
//}
}
}
#pragma once
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
class abstract_xml : public office_element_impl<abstract_xml>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = type_AbstractXml;
CPDOCCORE_DEFINE_VISITABLE();
public:
abstract_xml() {};
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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 abstract_xml::serialize(std::wostream & strm);
private:
//office_element_ptr_array xml_content_;
};
CP_REGISTER_OFFICE_ELEMENT2(abstract_xml);
}
}
#include "precompiled_cpodf.h"
#include "logging.h"
#include <iostream>
namespace cpdoccore {
logging< std::wostream > logging_err(std::wcerr);
logging< std::wostream > logging_cout(std::wcout);
}
......@@ -281,7 +281,7 @@ namespace odf
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" );
......@@ -304,7 +304,7 @@ namespace odf
CP_XML_NODE(L"office:scripts");
CP_XML_NODE(L"office:font-face-decls");
CP_XML_NODE(L"office:automatic-styles");
CP_XML_NODE(L"office:boby")
CP_XML_NODE(L"office:body")
{
if (content_)
{
......
#include "precompiled_cpodf.h"
#include <boost/foreach.hpp>
#include "office_elements_create.h"
#include "odf_conversion_context.h"
#include "odf_rels.h"
namespace cpdoccore {
namespace odf {
//////////////////////////////////////////////////////////////////////////////////////////////////
odf_conversion_context::odf_conversion_context(package::odf_document * outputDocument)
......@@ -19,8 +23,17 @@ odf_conversion_context::~odf_conversion_context()
}
void odf_conversion_context::start_document()
office_element_ptr & odf_conversion_context::getCurrentElement()
{
if (content_.size()>0)
{
return content_.back();
}
else
{
CP_ASSERT(false);
throw std::runtime_error("internal error");
}
}
void odf_conversion_context::end_document()
......@@ -28,6 +41,11 @@ void odf_conversion_context::end_document()
package::content_content_ptr content_root_ = package::content_content::create();
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(content_root_->content());
}
std::wstringstream styles_root_strm;
//odf_styles_.serialize(styles_root_strm);// ìàñòåð-ïåéäæû, çàäàííûå çàëèâêè (ãðàäèåíòû, áèòìàïû), äåôîëòíûå ñòèëè, êîëîíòèòóëû, ðàçìåòêè, çàìåòêè,...
......@@ -45,6 +63,7 @@ void odf_conversion_context::end_document()
{
//...
}
output_document_->set_rels(rels_);
}
......
......@@ -5,9 +5,8 @@
namespace cpdoccore {
namespace odf {
//class office_element;
//class relationship;
//class rels;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
class odf_style_manager;
......@@ -17,9 +16,12 @@ public:
odf_conversion_context(package::odf_document * outputDocument);
virtual ~odf_conversion_context();
void start_document();
virtual void start_document() = 0 ;
void end_document();
office_element_ptr & getCurrentElement();
std::vector<office_element_ptr> content_;
void add_rel(relationship const & r);
......@@ -29,6 +31,8 @@ public:
private:
//odf_style_manager odf_styles_;
rels rels_;
//office_spreadsheet* current_spreadsheet_;
};
}
......
#include "precompiled_cpodf.h"
#include "ods_conversion_context.h"
#include "office_spreadsheet.h"
namespace cpdoccore {
namespace odf {
//////////////////////////////////////////////////////////////////////////////////////////////////
void ods_conversion_context::start_document()
{
create_element(L"office", L"spreadsheet",content_, this);
//current_spreadsheet_ = (office_spreadsheet*)dynamic_cast<office_spreadsheet*>(content_.back().get());
}
void ods_conversion_context::start_sheet(std::wstring & name)
{
create_element(L"table", L"table",content_,this/*current_spreadsheet_.getContent()*/);
//current_sheet_ = (table_table*)dynamic_cast<table_table*>(content_.back().get());
}
void ods_conversion_context::end_sheet()
{
}
}
}
#pragma once
#include "odf_conversion_context.h"
namespace cpdoccore {
namespace odf {
class ods_conversion_context : public odf_conversion_context
{
public:
ods_conversion_context(package::odf_document * outputDocument) : odf_conversion_context(outputDocument){}
virtual void start_document();
void start_sheet(std::wstring & name);
void end_sheet();
};
}
}
\ No newline at end of file
#include "precompiled_cpodf.h"
#include "office_body.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
namespace odf {
using xml::xml_char_wc;
// office:body
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_body::ns = L"office";
const wchar_t * office_body::name = L"body";
office_body::office_body()
{}
void office_body::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void office_body::add_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
create_element(Ns,Name,content_,getContext());
}
void office_body::add_child_element( office_element_ptr & child_element)
{
content_ = child_element;
}
void office_body::serialize(std::wostream & _Wostream)
{
}
}
}
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
class office_body;
typedef shared_ptr<office_body>::Type office_body_ptr;
/// \brief office:body
class office_body : public office_element_impl<office_body>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeBody;
CPDOCCORE_DEFINE_VISITABLE();
office_element * content() { return content_.get(); }
public:
office_body();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
private:
office_element_ptr content_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_body);
}
}
......@@ -6,63 +6,65 @@
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPWeakPtr.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/attributes.h>
//#include <cpdoccore/common/readdocelement.h>
#include <cpdoccore/common/writedocelement.h>
//#include <cpdoccore/common/writedocelement.h>
#include <cpdoccore/CPAssert.h>
#include "office_elements_type.h"
//#include "visitor.h"
#include "visitor.h"
//#include "..\conversionelement.h"
namespace cpdoccore {
namespace odf {
class document_context;
class odf_conversion_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
typedef ::std::vector<office_element_ptr> office_element_ptr_array;
typedef std::vector<office_element_ptr> office_element_ptr_array;
class office_element : public xml::element<wchar_t>, public base_visitable
class office_element : public xml::element<wchar_t>,
public common::write_doc_element
{
public:
office_element() : is_root_(false), context_(NULL) {}
office_element() : context_(NULL) {}
virtual ElementType get_type() const = 0;
virtual ~office_element() = 0;
void set_root(bool isRoot) { is_root_ = isRoot; }
bool is_root() const { return is_root_; }
virtual void afterCreate() {};
virtual void afterReadContent() {};
office_element_ptr & get_parent(){ return parent_;}
void set_parent(office_element_ptr & parent){ parent_ = parent;}
void setContext(document_context * Context) { context_ = Context; }
void setContext(odf_conversion_context * Context) { context_ = Context; }
public:
virtual void serialize(std::wostream & _Wostream) = 0 ;
odf_conversion_context * getContext() { return context_; }
const odf_conversion_context * getContext() const { return context_; }
void set_root(bool root){is_root_ = root;}
////////////////////////
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const
{
//_CP_LOG(info) << L"[warning] use base text_to_stream\n";
_CP_LOG(info) << L"[warning] use base text_to_stream\n";
return _Wostream;
}
virtual ::std::wostream & xml_to_stream(::std::wostream & _Wostream) const
{
//_CP_LOG(info) << L"[warning] use base xml_to_stream\n";
_CP_LOG(info) << L"[warning] use base xml_to_stream\n";
return _Wostream;
}
document_context * getContext() { return context_; }
//
//protected:
const document_context * getContext() const { return context_; }
private:
bool is_root_;
document_context * context_;
office_element_ptr parent_;
odf_conversion_context * context_;
};
#define CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_ public:\
......@@ -99,15 +101,6 @@ public:
}
private:
virtual void add_text(const std::wstring & Text)
{
std::wstring text = Text;
boost::algorithm::erase_all(text, L" ");
boost::algorithm::erase_all(text, L"\t");
boost::algorithm::erase_all(text, L"\n");
boost::algorithm::erase_all(text, L"\r");
//CP_ASSERT(false);
}
// office_element impl
public:
......
......@@ -20,7 +20,7 @@ office_element_creator::office_element_creator() : rw_lock_( new boost::shared_m
{
}
office_element_ptr office_element_creator::create(const ::std::wstring & ns, const ::std::wstring & name, document_context * Context, bool isRoot) const
office_element_ptr office_element_creator::create(const ::std::wstring & ns, const ::std::wstring & name, odf_conversion_context * Context, bool isRoot) const
{
const std::wstring fullName = ns + (ns.size() > 0 ? L":" : L"") + name;
......@@ -39,9 +39,6 @@ office_element_ptr office_element_creator::create(const ::std::wstring & ns, con
if (element && isRoot)
element->set_root(true);
if (element)
element->afterCreate();
return element;
}
else
......@@ -111,7 +108,7 @@ void not_applicable_element(const office_element * CurrentElm, const std::wstrin
bool create_element(const ::std::wstring & Ns,
const ::std::wstring & Name,
office_element_ptr & _Element,
document_context * Context,
odf_conversion_context * Context,
bool isRoot)
{
if (office_element_ptr elm = office_element_creator::get()->create(Ns, Name, Context, isRoot))
......@@ -133,7 +130,7 @@ bool create_element(const ::std::wstring & Ns,
ss << L"[warning] : create element failed (" << Ns << L":" << Name << L")\n";
_CP_LOG(error) << ss.str();
#endif
not_applicable_element(L"[!!!]", 0, Ns, Name);
not_applicable_element(L"[!!!]", Ns, Name);
}
return false;
}
......@@ -141,7 +138,7 @@ bool create_element(const ::std::wstring & Ns,
bool create_element(const ::std::wstring & Ns,
const ::std::wstring & Name,
office_element_ptr_array & _Elements,
document_context * Context,
odf_conversion_context * Context,
bool isRoot)
{
office_element_ptr elm;
......
#ifndef _CPDOCCORE_ODF_OFFCIE_ELEMENTS_CREATE_H_
#define _CPDOCCORE_ODF_OFFCIE_ELEMENTS_CREATE_H_
#pragma once
#include <string>
#include <map>
......@@ -16,7 +15,7 @@ namespace boost {
namespace cpdoccore {
namespace odf {
class document_context;
class odf_conversion_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
......@@ -36,7 +35,7 @@ public:
bool register_element(const std::wstring &ns, const std::wstring & name, CreateFuncImpl f);
//
office_element_ptr create(const ::std::wstring & ns, const ::std::wstring & name, document_context * Context = NULL, bool isRoot = false) const;
office_element_ptr create(const ::std::wstring & ns, const ::std::wstring & name, odf_conversion_context * Context = NULL, bool isRoot = false) const;
private:
typedef std::map<::std::wstring, CreateFuncImpl> MapType;
......@@ -88,34 +87,27 @@ private:
template<class T> int RegisterElement<T>::class_registered_ = 0;
/// \brief
bool create_element(const ::std::wstring & Ns,
const ::std::wstring & Name,
bool create_element(const std::wstring & Ns,
const std::wstring & Name,
office_element_ptr & _Element,
document_context * Context,
odf_conversion_context * Context,
bool isRoot = false);
bool create_element(const ::std::wstring & Ns,
const ::std::wstring & Name,
office_element_ptr_array & _Elements,
document_context * Context,
bool isRoot);
odf_conversion_context * Context,
bool isRoot = false);
#define CP_CHECK_NAME(NS, NAME) ((NS) == Ns && (NAME) == Name)
#define CP_CREATE_ELEMENT_SIMPLE(ELEMENT) create_element(Ns, Name, (ELEMENT), Context)
#define CP_CREATE_ELEMENT (ELEMENT) create_element(Ns, Name, (ELEMENT), getContext())
#define _CPDOCCORE_CREATE_ELEMENT_ROOT(ELEMENT) create_element(Ns, Name, (ELEMENT), getContext(), true)
void not_applicable_element(const office_element * CurrentElm, xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
void not_applicable_element(const std::wstring & Current, xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
#define CP_CHECK_NAME(NS, NAME) ((NS) == Ns && (NAME) == Name)
void not_applicable_element(const office_element * CurrentElm, const std::wstring & Ns, const std::wstring & Name);
void not_applicable_element(const std::wstring & Current, const std::wstring & Ns, const std::wstring & Name);
#define CP_NOT_APPLICABLE_ELM() \
not_applicable_element(this, Reader, Ns, Name)
#define CP_NOT_APPLICABLE_ELM_SIMPLE(A) \
not_applicable_element(A, Reader, Ns, Name)
}
}
#endif // #ifndef _CPDOCCORE_ODF_OFFCIE_ELEMENTS_CREATE_H_
#include "precompiled_cpodf.h"
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
// office:spreadsheet
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_spreadsheet::ns = L"office";
const wchar_t * office_spreadsheet::name = L"spreadsheet";
void office_spreadsheet::add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
create_element(Ns,Name,content_,getContext());
}
void office_spreadsheet::add_child_element(office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void office_spreadsheet::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void office_spreadsheet::serialize(std::wostream & _Wostream)
{
}
}
}
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
/// \brief office:spreadsheet
class office_spreadsheet : public office_element_impl<office_spreadsheet>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSpreadsheet;
CPDOCCORE_DEFINE_VISITABLE();
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array & getContent(){return content_;}
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element);
public:
// TODO: office-text-content-prelude:
// TODO: office-forms
// TODO: text-tracked-changes
// TODO: text-decls
// TODO: table-decls
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions
};
CP_REGISTER_OFFICE_ELEMENT2(office_spreadsheet);
}
}
#ifndef _CPDOCCORE_VISITOR_H_INCLUDED_
#define _CPDOCCORE_VISITOR_H_INCLUDED_
/*
visitor:
, visitor-:
1. base_visitable
2. CPDOCCORE_DEFINE_VISITABLE()
class example_visitable_element: public base_visitable
{
// ...
public:
CPDOCCORE_DEFINE_VISITABLE();
// ...
};
:
1. base_visitor
2. () const_visitor<visitable_element1>/visitor<visitable_element1>,
const_visitor<visitable_element2>/visitor<visitable_element2>, ..
,
3.
virtual void visit(const visitable_element1& val);
virtual void visit(const visitable_element2& val);
..
( - const)
class table_round : public base_visitor,
public const_visitor<office_body>,
public const_visitor<office_spreadsheet>,
public const_visitor<table_table>
{
virtual void visit(const office_body& val)
{
// ...
}
virtual void visit(const office_spreadsheet& val)
{
// ...
}
virtual void visit(const table_table& val)
{
// ...
}
};
:
1.
2. accept
office_element * root;
/// ...
table_round tableRoundVisitor;
root->accept(tableRoundVisitor);
! , ..
virtual void visit(const office_body& val)
{
val.content_->accept(*this);
}
*/
namespace cpdoccore {
class base_visitor
{
public:
virtual ~base_visitor() {}
virtual void on_not_impl(std::string const & message) = 0;
};
template <class T>
class visitor
{
public:
virtual void visit(T&) = 0;
// virtual void visit(T const& t) = 0;
};
template <class T>
class const_visitor
{
public:
virtual void visit(T const& t) = 0;
};
class base_visitable
{
public:
virtual ~base_visitable() {};
virtual void accept(base_visitor &) = 0;
virtual void accept(base_visitor &) const = 0;
protected:
template <class T>
static void accept_impl(T& visited, base_visitor & guest)
{
if (visitor<T> * p = dynamic_cast< visitor<T> * >(&guest))
{
return p->visit(visited);
}
else
{
guest.on_not_impl(typeid(visited).name());
}
}
template <class T>
static void accept_impl(T const& visited, base_visitor & guest)
{
if (const_visitor<T> * p = dynamic_cast< const_visitor<T> * >(&guest))
{
return p->visit(visited);
}
else
{
guest.on_not_impl(typeid(visited).name());
}
}
};
#define CPDOCCORE_DEFINE_VISITABLE() \
virtual void accept(base_visitor& guest)\
{\
return accept_impl(*this, guest);\
}\
virtual void accept(base_visitor& guest) const\
{\
return accept_impl(*this, guest);\
}
}
#endif
......@@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\OdfFormat;.\Oox2OdfConverter;..\..\Common\DocxFormat\Source;..\..\Common\DocxFormat\Source\XML;..\..\ASCOfficeOdfFile\include;..\..\ASCOfficeOdfFile\3dparty\utf8cpp\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_XMLLITE_READER_"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -104,7 +104,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\OdfFormat;.\Oox2OdfConverter;..\..\Common\DocxFormat\Source;..\..\Common\DocxFormat\Source\XML;..\..\ASCOfficeOdfFile\include;..\..\ASCOfficeOdfFile\3dparty\utf8cpp\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_XMLLITE_READER_"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
......
......@@ -8,7 +8,8 @@
#include <boost/foreach.hpp>
#include "odf_conversion_context.h"
#include "ods_conversion_context.h"
//#include "odt_conversion_context.h"
using namespace cpdoccore;
......@@ -55,7 +56,7 @@ namespace Oox2Odf
void Impl::convert()
{
odf::odf_conversion_context odf_conversion_context_(&output_document);
odf::ods_conversion_context ods_conversion_context_(&output_document);
if (docx_document)
{
......@@ -71,17 +72,49 @@ namespace Oox2Odf
}
else if (xlsx_document)
{
const OOX::Spreadsheet::CWorkbook *document = xlsx_document->GetWorkbook();
const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->GetWorkbook();
CAtlMap<CString, OOX::Spreadsheet::CWorksheet*> &arrWorksheets = xlsx_document->GetWorksheets();
if (document)
//convert(xlsx_document->GetWorkbook(),odf_conversion_context_);
if (Workbook)
{
odf_conversion_context_.start_document();
document->m_oSheets;
//odf_context.convert(document); - odf
ods_conversion_context_.start_document();
if(Workbook->m_oSheets.IsInit())
{
CSimpleArray<OOX::Spreadsheet::CSheet*>& aWs = Workbook->m_oSheets->m_arrItems;
for(int i = 0, length = aWs.GetSize(); i < length; ++i)
{
OOX::Spreadsheet::CSheet* pSheet = aWs[i];
if(pSheet->m_oRid.IsInit())
{
CString sSheetRId = pSheet->m_oName.get2();
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()*/
ods_conversion_context_.start_sheet(name);
//CAtlMap<CString, OOX::Spreadsheet::CWorksheet*>::CPair* pair = aWorksheets.Lookup(pSheet->m_oRid->GetValue());
//if(NULL != pair)
//{
// nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::Worksheet);
// WriteWorksheet(*pSheet, *pair->m_value);
// m_oBcw.WriteItemWithLengthEnd(nCurPos);
//}
ods_conversion_context_.end_sheet();
}
}
//...
odf_conversion_context_.end_document();
}
}
}
ods_conversion_context_.end_document();
}
}
}
......@@ -107,9 +140,4 @@ namespace Oox2Odf
return impl_->write(path);
}
//void Converter::app2meta(const OOX::App& app, Odt::Meta::File& meta) const
//{
// return impl_->app2meta(app, meta);
//}
} // namespace Docx2Odt
\ 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