Commit c685af36 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

OdfFormat - небольшой рефакторинг

parent 0c0f2cf9
// ASCOfficeOdfFileTest.cpp : Defines the entry point for the console application.
//
// OdfFileTest.cpp
#include "stdafx.h"
#include <boost/timer.hpp>
#include <iostream>
#include <string>
#import "../../../Redist/ASCOfficeOdfFile.dll" rename_namespace("ASCOfficeOdfFile"), raw_interfaces_only
#define HR_RET(HR) if FAILED(hr = (HR)) { _ASSERTE(false); return -1; }
class CCallback : public ASCOfficeOdfFile::_IAVSOfficeFileTemplateEvents
{
public:
CCallback(){m_cnt=0;}
virtual ~CCallback(){}
STDMETHOD(GetTypeInfoCount)(UINT*) { return E_NOTIMPL; }
STDMETHOD(GetTypeInfo)(UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
STDMETHOD(GetIDsOfNames)(REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
#include "../../../OfficeUtils/src/OfficeUtils.h"
STDMETHOD(Invoke)(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
switch(dispIdMember)
{
case 1:
std::cout << "\nPercent : " << pDispParams->rgvarg[0].lVal / 10000. << "%\n";
return(S_OK);
break;
default:
return(E_NOTIMPL);
}
}
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/lexical_cast.hpp>
STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppv)
{
if ((iid == __uuidof(ASCOfficeOdfFile::_IAVSOfficeFileTemplateEvents)) ||
(iid == __uuidof(IDispatch)) ||
(iid == __uuidof(IUnknown)))
*ppv = this;
else {
*ppv = 0;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
STDMETHOD_(ULONG,AddRef)() {
return InterlockedIncrement(&m_cnt);
}
#include "../../src/ConvertOO2OOX.h"
STDMETHOD_(ULONG,Release)() {
InterlockedDecrement(&m_cnt);
if (m_cnt!=0) return m_cnt;
delete this;
return 0;
}
protected:
LONG m_cnt;
private:
};
int ConvertSingle(int argc, _TCHAR* argv[])
int _tmain(int argc, _TCHAR* argv[])
{
ATL::CComPtr<ASCOfficeOdfFile::IAVSOfficeFileTemplate> officeOdfFile;
HRESULT hr;
HR_RET(officeOdfFile.CoCreateInstance(__uuidof(ASCOfficeOdfFile::COfficeOdfFile)));
//_______________________________________________________________________________________________________
IUnknown *pUnk;
IConnectionPointContainer* pContainer;
IConnectionPoint* pCP;
CCallback *pEvents = NULL;
DWORD dwAdvise=0;
pEvents = new CCallback;
pEvents->AddRef();
HR_RET(officeOdfFile->QueryInterface(IID_IConnectionPointContainer, (void**)&pContainer));
HR_RET(pContainer->FindConnectionPoint(__uuidof(ASCOfficeOdfFile::_IAVSOfficeFileTemplateEvents),&pCP));
HRESULT hr = S_OK;
boost::timer t1;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argv[2];
std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath);
std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
HR_RET(pEvents->QueryInterface(IID_IUnknown,(VOID **)&pUnk));
HR_RET(pCP->Advise(pUnk,&dwAdvise));
//
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
return S_FALSE;
pContainer->Release();pContainer=NULL;
pUnk->Release(); pUnk=NULL;
//____________
boost::timer t1;
officeOdfFile->LoadFromFile(ATL::CComBSTR(argv[1]), ATL::CComBSTR(argv[2]), NULL);
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL);
FileSystem::Directory::DeleteDirectory(srcTempPath);
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
if (hr != S_OK) return hr;
return ConvertSingle(argc, argv);
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1))
return hr;
FileSystem::Directory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
......@@ -63,7 +63,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
AdditionalDependencies="gdi32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
......@@ -336,64 +336,16 @@
<File
RelativePath=".\ASCOfficeOdfFileTest.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
......
========================================================================
CONSOLE APPLICATION : ASCOfficeOdfFileTest Project Overview
========================================================================
AppWizard has created this ASCOfficeOdfFileTest application for you.
This file contains a summary of what you will find in each of the files that
make up your ASCOfficeOdfFileTest application.
ASCOfficeOdfFileTest.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
ASCOfficeOdfFileTest.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named ASCOfficeOdfFileTest.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// ASCOfficeOdfFileTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <windef.h>
#include <wingdi.h>
using namespace ATL;
// TODO: reference additional headers your program requires here
......@@ -16,9 +16,10 @@
HRESULT ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
{
cpdoccore::oox::package::xlsx_document outputXlsx;
cpdoccore::oox::xlsx_conversion_context conversionContext(&outputXlsx, &inputOdf);
cpdoccore::oox::xlsx_conversion_context conversionContext( &inputOdf);
conversionContext.set_font_directory(fontsPath);
conversionContext.set_output_document (&outputXlsx);
conversionContext.set_font_directory (fontsPath);
if (inputOdf.xlsx_convert(conversionContext) == false) return S_FALSE;
......@@ -28,9 +29,10 @@ HRESULT ConvertOds2Xlsx(cpdoccore::odf_reader::odf_document & inputOdf, const st
HRESULT ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
{
cpdoccore::oox::package::docx_document outputDocx;
cpdoccore::oox::docx_conversion_context conversionContext(&outputDocx, &inputOdf);
cpdoccore::oox::docx_conversion_context conversionContext(&inputOdf);
conversionContext.set_font_directory(fontsPath);
conversionContext.set_output_document (&outputDocx);
conversionContext.set_font_directory (fontsPath);
if (inputOdf.docx_convert(conversionContext) == false) return S_FALSE;
......@@ -41,9 +43,10 @@ HRESULT ConvertOdt2Docx(cpdoccore::odf_reader::odf_document & inputOdf, const st
HRESULT ConvertOdp2Pptx(cpdoccore::odf_reader::odf_document & inputOdf, const std::wstring & dstPath, const std::wstring & fontsPath)
{
cpdoccore::oox::package::pptx_document outputPptx;
cpdoccore::oox::pptx_conversion_context conversionContext(&outputPptx, &inputOdf);
cpdoccore::oox::pptx_conversion_context conversionContext(&inputOdf);
conversionContext.set_font_directory(fontsPath);
conversionContext.set_output_document (&outputPptx);
conversionContext.set_font_directory (fontsPath);
if (inputOdf.pptx_convert(conversionContext) == false) return S_FALSE;
outputPptx.write(dstPath);
......
......@@ -24,11 +24,6 @@ const wchar_t * default_content_type::name = L"Default";
CP_XML_ATTR(L"ContentType", content_type());
}
}
//_Wostream << L"<Default ";
//CP_XML_SERIALIZE_ATTR(L"Extension", extension());
//CP_XML_SERIALIZE_ATTR(L"ContentType", content_type());
//_Wostream << L" />";
return _Wostream;
}
......@@ -45,18 +40,13 @@ const wchar_t * override_content_type::name = L"Override";
CP_XML_ATTR(L"ContentType", content_type());
}
}
//_Wostream << L"<Override ";
//CP_XML_SERIALIZE_ATTR(L"PartName", part_name());
//CP_XML_SERIALIZE_ATTR(L"ContentType", content_type());
//_Wostream << L" />";
return _Wostream;
}
const wchar_t * content_type::ns = L"";
const wchar_t * content_type::name = L"Types";
const wchar_t * content_type_content::ns = L"";
const wchar_t * content_type_content::name = L"Types";
::std::wostream & content_type::xml_to_stream(::std::wostream & _Wostream) const
::std::wostream & content_type_content::xml_to_stream(::std::wostream & _Wostream) const
{
CP_XML_WRITER(_Wostream)
{
......@@ -77,21 +67,6 @@ const wchar_t * content_type::name = L"Types";
}
}
//_Wostream << L"<Types ";
//CP_XML_SERIALIZE_ATTR(L"xmlns", xmlns::types.value);
//_Wostream << L">";
//BOOST_FOREACH(const xml::element_wc & elm, default_)
//{
// elm.xml_to_stream(_Wostream);
//}
//BOOST_FOREACH(const xml::element_wc & elm, override_)
//{
// elm.xml_to_stream(_Wostream);
//}
//_Wostream << L"</Types>";
return _Wostream;
}
......
......@@ -55,8 +55,8 @@ public:
};
///////////////////////////////////////////////////////////////////////////////////////
/// \class content_type
class content_type : public xml::element_impl<content_type>
/// \class content_type_content
class content_type_content : public xml::element_impl<content_type_content>
{
public:
static const wchar_t * ns;
......@@ -85,12 +85,12 @@ public:
add_override(override_content_type(PartName, contentType));
}
std::vector<default_content_type> & get_default() { return default_; };
std::vector<override_content_type> & get_override() { return override_; };
std::vector<default_content_type> & get_default() { return default_; };
std::vector<override_content_type> & get_override() { return override_; };
private:
std::vector<default_content_type> default_;
std::vector<override_content_type> override_;
std::vector<default_content_type> default_;
std::vector<override_content_type> override_;
};
......
......@@ -25,10 +25,7 @@ namespace cpdoccore {
namespace oox {
docx_conversion_context::docx_conversion_context(package::docx_document * OutputDocument, odf_reader::odf_document * OdfDocument) :
streams_man_( streams_man::create(temp_stream_) ),
output_document_ (OutputDocument),
odf_document_ (OdfDocument),
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
mediaitems_ (OdfDocument->get_folder() ),
current_run_ (false),
page_break_after_ (false),
......@@ -37,6 +34,7 @@ docx_conversion_context::docx_conversion_context(package::docx_document * Output
in_automatic_style_ (false),
in_paragraph_ (false),
table_context_ (*this),
output_document_ (NULL),
section_properties_in_table_(NULL),
process_note_ (noNote),
new_list_style_number_ (0),
......@@ -44,15 +42,21 @@ docx_conversion_context::docx_conversion_context(package::docx_document * Output
delayed_converting_ (false),
process_headers_footers_(false),
process_comment_ (false),
process_math_formula_ (false)
process_math_formula_ (false),
odf_document_ (OdfDocument)
{
applicationFonts_ = new CApplicationFonts();
streams_man_ = streams_man::create(temp_stream_);
applicationFonts_ = new CApplicationFonts();
}
docx_conversion_context::~docx_conversion_context()
{
if (applicationFonts_)
delete applicationFonts_;
}
void docx_conversion_context::set_output_document(package::docx_document * document)
{
output_document_ = document;
}
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
{
if (applicationFonts_)
......@@ -266,13 +270,15 @@ void docx_conversion_context::start_document()
void docx_conversion_context::end_document()
{
output_stream() << L"</w:document>";
output_document_->get_word_files().set_document( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->content_type().set_media(mediaitems_);
output_document_->get_word_files().set_media( mediaitems_, applicationFonts_);
output_document_->get_word_files().set_headers_footers(headers_footers_);
output_document_->get_word_files().set_comments(comments_context_);
output_document_->get_word_files().set_settings(package::simple_element::create(L"settings.xml",dump_settings_document()));
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml",dump_settings_document()));
output_document_->get_word_files().set_media ( mediaitems_, applicationFonts_);
output_document_->get_word_files().set_comments ( comments_context_);
output_document_->get_word_files().set_headers_footers( headers_footers_);
package::content_types_file & content_file_ = output_document_->get_content_types_file();
content_file_.set_media( mediaitems_);
////////////////////////////////////////////////////////////////////////////
dump_hyperlinks (notes_context_.footnotesRels(), hyperlinks::footnote_place);
......
......@@ -398,11 +398,12 @@ private:
class docx_conversion_context : boost::noncopyable
{
public:
docx_conversion_context(package::docx_document * OutputDocument, odf_reader::odf_document * OdfDocument);
docx_conversion_context(odf_reader::odf_document * OdfDocument);
~docx_conversion_context();
void set_font_directory(std::wstring pathFonts);
void set_output_document (package::docx_document * document);
void set_font_directory (std::wstring pathFonts);
std::wostream & output_stream()
{
......
......@@ -10,21 +10,20 @@ namespace package {
docx_content_types_file::docx_content_types_file()
{
content_type_.add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_default(L"xml", L"application/xml");
content()->add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_default(L"xml", L"application/xml");
//
content_type_.add_default(L"jpg", L"image/jpeg");
content_type_.add_default(L"png", L"image/png");
content()->add_default(L"jpg", L"image/jpeg");
content()->add_default(L"png", L"image/png");
//
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/word/_rels/document.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/word/document.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml");
content_type_.add_override(L"/word/settings.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml");
content_type_.add_override(L"/word/styles.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml");
content_type_.add_override(L"/word/fontTable.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml");
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/word/_rels/document.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/word/document.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml");
content()->add_override(L"/word/settings.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml");
content()->add_override(L"/word/styles.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml");
content()->add_override(L"/word/fontTable.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml");
content()->add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content()->add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
}
......@@ -144,14 +143,14 @@ bool word_files::has_numbering()
void word_files::set_headers_footers(headers_footers & HeadersFooters)
{
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);
elm->set_main_document( this->get_main_document() );
elm->set_main_document( get_main_document() );
headers_footers_ = element_ptr( elm );
}
void word_files::set_notes(notes_context & notesContext)
{
notes_elements * elm = new notes_elements(notesContext);
elm->set_main_document( this->get_main_document() );
elm->set_main_document( get_main_document() );
notes_ = element_ptr( elm );
}
void word_files::set_comments(comments_context & commentsContext)
......@@ -159,7 +158,7 @@ void word_files::set_comments(comments_context & commentsContext)
if (commentsContext.comments_.size()<1)return;
comments_elements * elm = new comments_elements(commentsContext);
elm->set_main_document( this->get_main_document() );
elm->set_main_document( get_main_document() );
comments_ = element_ptr( elm );
}
///////////////////
......@@ -180,10 +179,10 @@ void docx_charts_files::write(const std::wstring & RootPath)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes.add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/word/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(path);
}
......@@ -212,7 +211,7 @@ void headers_footers_elements::write(const std::wstring & RootPath)
L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" :
L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";
doc->content_type().get_content_type().add_override(std::wstring(L"/word/") + inst->name_, ContentType);
doc->get_content_types_file().content()->add_override(std::wstring(L"/word/") + inst->name_, ContentType);
}
//
if (!inst->rels_.empty())
......@@ -283,7 +282,9 @@ namespace
simple_element(Name, content.str()).write(RootPath);
if (doc)
doc->content_type().get_content_type().add_override(std::wstring(L"/word/") + Name, ContentType);
{
doc->get_content_types_file().content()->add_override(std::wstring(L"/word/") + Name, ContentType);
}
if (Rels.relationships().size() > 0)
{
......@@ -357,7 +358,7 @@ void comments_elements::write(const std::wstring & RootPath)
simple_element(L"comments.xml", content.str()).write(RootPath);
if (get_main_document())
get_main_document()->content_type().get_content_type().add_override(L"/word/comments.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");
get_main_document()->get_content_types_file().content()->add_override(L"/word/comments.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");
}
if (!comments_context_.get_rels().empty())
{
......@@ -377,8 +378,10 @@ void comments_elements::write(const std::wstring & RootPath)
docx_document::docx_document()
{
this->set_main_document(this);
word_files_.set_main_document(this);
rels_file_ptr relFile = rels_file_ptr( new rels_file(L".rels") );
rels_file_ptr relFile = rels_file_ptr( new rels_file(L".rels") );
relFile->get_rels().relationships().push_back(
relationship(L"rId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml" )
);
......@@ -398,14 +401,14 @@ void docx_document::write(const std::wstring & RootPath)
if (word_files_.has_numbering())
{
content_type_.get_content_type().get_override().push_back( override_content_type(L"/word/numbering.xml",
L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml") );
content_type_file_.content()->get_override().push_back( override_content_type(L"/word/numbering.xml",
L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml") );
}
word_files_.write(RootPath);
rels_files_.write(RootPath);
docProps_files_.write(RootPath);
content_type_.write(RootPath);
word_files_.write (RootPath);
rels_files_.write (RootPath);
docProps_files_.write (RootPath);
content_type_file_.write(RootPath);
}
......
......@@ -93,17 +93,17 @@ public:
public:
virtual void write(const std::wstring & RootPath);
void set_styles(element_ptr Element);
void set_document(element_ptr Element);
void update_rels(docx_conversion_context & Context);
void set_fontTable(element_ptr Element);
void set_numbering(element_ptr Element);
void set_settings(element_ptr Element);
bool has_numbering();
void set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void set_headers_footers(headers_footers & HeadersFooters);
void set_notes(notes_context & notesContext);
void set_comments(comments_context & commentsContext);
void set_styles (element_ptr Element);
void set_document (element_ptr Element);
void update_rels (docx_conversion_context & Context);
void set_fontTable (element_ptr Element);
void set_numbering (element_ptr Element);
void set_settings (element_ptr Element);
bool has_numbering ();
void set_media (mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void set_headers_footers(headers_footers & HeadersFooters);
void set_notes (notes_context & notesContext);
void set_comments (comments_context & commentsContext);
void add_charts(chart_content_ptr chart);
......@@ -131,14 +131,13 @@ class docx_document : public document
public:
docx_document();
public:
word_files & get_word_files() { return word_files_; }
virtual content_types_file & content_type() { return content_type_; }
word_files & get_word_files() { return word_files_; }
virtual content_types_file & get_content_types_file() { return content_type_file_; }
virtual void write(const std::wstring & RootPath);
private:
docx_content_types_file content_type_;
docx_content_types_file content_type_file_;
word_files word_files_;
rels_files rels_files_;
docProps_files docProps_files_;
......
......@@ -52,7 +52,7 @@ private:
};
class docx_table_context : boost::noncopyable
class docx_table_context
{
public:
docx_table_context(docx_conversion_context & Context) : context_(Context)
......
......@@ -46,27 +46,44 @@ static std::wstring get_mime_type(const std::wstring & extension)
return L"";
}
//----------------------------------------------------------------
void element::set_main_document(document * _document)
{
document_ = _document;
}
document * element::get_main_document()
{
return document_;
}
content_types_file::content_types_file() : filename_(L"[Content_Types].xml")
{}
void content_types_file::write(const std::wstring & RootPath)
{
std::wstringstream resStream;
content_type_.xml_to_stream(resStream);
content_type_content_.xml_to_stream(resStream);
std::wstring res = resStream.str();
simple_element elm(filename_, resStream.str());
elm.write(RootPath);
}
content_type_content * content_types_file::content()
{
return &content_type_content_;
}
bool content_types_file::add_or_find_default(const std::wstring & extension)
{
for (int i = 0 ; i < content_type_.get_default().size(); i++)
for (int i = 0 ; i < content_type_content_.get_default().size(); i++)
{
if (content_type_.get_default()[i].extension() == extension)
if (content_type_content_.get_default()[i].extension() == extension)
return true;
}
content_type_.add_default(extension, get_mime_type(extension));
content_type_content_.add_default(extension, get_mime_type(extension));
return true;
}
void content_types_file::set_media(mediaitems & _Mediaitems)
......
......@@ -32,10 +32,9 @@ class element
{
public:
virtual ~element() = 0;
void set_main_document(document * _document) { document_ = _document; }
document * get_main_document() { return document_; }
void set_main_document(document * _document);
document * get_main_document();
public:
virtual void write(const std::wstring & RootPath) = 0;
private:
......@@ -48,17 +47,15 @@ inline element::~element()
class content_types_file : public element
{
public:
content_types_file();
virtual void write(const std::wstring & RootPath);
content_type & get_content_type() { return content_type_; }
bool add_or_find_default(const std::wstring & extension);
void set_media(mediaitems & _Mediaitems);
protected:
content_type content_type_;
content_types_file ();
void write (const std::wstring & RootPath);
bool add_or_find_default (const std::wstring & extension);
void set_media (mediaitems & _Mediaitems);
content_type_content * content ();
private:
std::wstring filename_;
content_type_content content_type_content_;
std::wstring filename_;
};
class simple_element : public element
......@@ -90,14 +87,14 @@ public:
public:
virtual void write(const std::wstring & RootPath);
rels & get_rels() { return rels_; }
const rels & get_rels() const { return rels_; }
rels & get_rels() { return rels_; }
const rels & get_rels() const { return rels_; }
bool empty() { return rels_.empty(); }
private:
std::wstring filename_;
rels rels_;
std::wstring filename_;
rels rels_;
};
/// \class rels_files
......@@ -141,7 +138,7 @@ private:
class document : public element
{
public:
virtual content_types_file & content_type() = 0;
virtual content_types_file & get_content_types_file() = 0;
};
class core_file : public element
......
......@@ -30,9 +30,8 @@ namespace package
class pptx_document;
}
pptx_conversion_context::pptx_conversion_context(cpdoccore::oox::package::pptx_document * outputDocument,
cpdoccore::odf_reader::odf_document * odfDocument):
output_document_(outputDocument)
pptx_conversion_context::pptx_conversion_context( odf_reader::odf_document * odfDocument):
output_document_(NULL)
,odf_document_(odfDocument)
,pptx_text_context_(odf_document_->odf_context(),*this)
,pptx_table_context_(*this)
......@@ -43,11 +42,18 @@ pptx_conversion_context::pptx_conversion_context(cpdoccore::oox::package::pptx_d
{
applicationFonts_ = new CApplicationFonts();
}
pptx_conversion_context::~pptx_conversion_context()
{
if (applicationFonts_)
delete applicationFonts_;
}
void pptx_conversion_context::set_output_document(package::pptx_document * document)
{
output_document_ = document;
}
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
{
if (applicationFonts_ )
......@@ -274,14 +280,13 @@ void pptx_conversion_context::end_document()
}
package::ppt_comments_files_ptr comments = package::ppt_comments_files::create(comments_context_handle_.content());
output_document_->get_ppt_files().set_comments(comments);
output_document_->get_ppt_files().set_presentation(presentation_);
output_document_->content_type().set_media(get_mediaitems());
output_document_->get_ppt_files().set_presentation(presentation_);
output_document_->get_ppt_files().set_comments(comments);
output_document_->get_ppt_files().set_authors_comments(authors_comments_);
output_document_->get_ppt_files().set_media(get_mediaitems(), applicationFonts_);
output_document_->get_ppt_files().set_authors_comments(authors_comments_);
output_document_->get_content_types_file().set_media(get_mediaitems());
}
void pptx_conversion_context::start_body()
......
......@@ -33,12 +33,11 @@ namespace package
class pptx_conversion_context : boost::noncopyable
{
public:
pptx_conversion_context(cpdoccore::oox::package::pptx_document * outputDocument,
cpdoccore::odf_reader::odf_document * odfDocument);
pptx_conversion_context(odf_reader::odf_document * odfDocument);
~pptx_conversion_context();
void set_font_directory(std::wstring pathFonts);
void set_output_document(package::pptx_document * document);
void set_font_directory (std::wstring pathFonts);
void start_document();
void end_document();
......
......@@ -15,19 +15,19 @@ namespace package {
pptx_content_types_file::pptx_content_types_file()
{
content_type_.add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_default(L"xml", L"application/xml");
content()->add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_default(L"xml", L"application/xml");
content_type_.add_default(L"jpg", L"image/jpeg");
content_type_.add_default(L"png", L"image/png");
content()->add_default(L"jpg", L"image/jpeg");
content()->add_default(L"png", L"image/png");
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/ppt/presentation.xml",L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml");
// content_type_.add_override(L"/ppt/tableStyles.xml", L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml");
content()->add_override(L"/ppt/presentation.xml",L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml");
// content()->add_override(L"/ppt/tableStyles.xml", L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml");
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
content()->add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content()->add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
}
pptx_document::pptx_document()
......@@ -45,10 +45,10 @@ pptx_document::pptx_document()
void pptx_document::write(const std::wstring & RootPath)
{
ppt_files_.write(RootPath);
docProps_files_.write(RootPath);
content_type_.write(RootPath);
rels_files_.write(RootPath);
ppt_files_.write (RootPath);
docProps_files_.write (RootPath);
rels_files_.write (RootPath);
content_type_file_.write(RootPath);
}
////////////////////////////////////////////
......@@ -90,7 +90,7 @@ void slides_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slides" ;
FileSystem::Directory::CreateDirectory(path.c_str());
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
size_t count = 0;
......@@ -102,7 +102,7 @@ void slides_files::write(const std::wstring & RootPath)
count++;
const std::wstring fileName = std::wstring(L"slide") + boost::lexical_cast<std::wstring>(count) + L".xml";
contentTypes.add_override(std::wstring(L"/ppt/slides/") + fileName, kWSConType);
contentTypes->add_override(std::wstring(L"/ppt/slides/") + fileName, kWSConType);
if (rels_)
{
......@@ -137,7 +137,7 @@ void slideMasters_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"slideMasters" ;
FileSystem::Directory::CreateDirectory(path.c_str());
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
size_t count = 0;
......@@ -148,7 +148,7 @@ void slideMasters_files::write(const std::wstring & RootPath)
{
count++;
const std::wstring fileName = std::wstring(L"slideMaster") + boost::lexical_cast<std::wstring>(count) + L".xml";
contentTypes.add_override(std::wstring(L"/ppt/slideMasters/") + fileName, kWSConType);
contentTypes->add_override(std::wstring(L"/ppt/slideMasters/") + fileName, kWSConType);
if (rels_)
{
......@@ -190,10 +190,11 @@ void slideLayouts_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"slideLayout") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
contentTypes.add_override(std::wstring(L"/ppt/slideLayouts/") + fileName, kWSConType);
const std::wstring fileName = std::wstring(L"slideLayout") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/ppt/slideLayouts/") + fileName, kWSConType);
item->get_rel_file()->set_file_name(fileName + L".rels");//
......@@ -223,7 +224,7 @@ void authors_comments_element::write(const std::wstring & RootPath)
if (get_main_document())
{
get_main_document()->content_type().get_content_type().add_override(std::wstring(L"/ppt/commentAuthors.xml"),
get_main_document()->get_content_types_file().content()->add_override(std::wstring(L"/ppt/commentAuthors.xml"),
L"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml");
}
......@@ -246,10 +247,10 @@ void ppt_charts_files::write(const std::wstring & RootPath)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes.add_override(std::wstring(L"/ppt/charts/") + fileName, kWSConType);
contentTypes->add_override(std::wstring(L"/ppt/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(path);
}
......@@ -272,11 +273,12 @@ void ppt_themes_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"theme") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
const std::wstring fileName = std::wstring(L"theme") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.theme+xml";
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.theme+xml";
contentTypes.add_override(std::wstring(L"/ppt/theme/") + fileName, kWSConType);
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/ppt/theme/") + fileName, kWSConType);
std::wstringstream content;
item->write_to(content);
......@@ -297,10 +299,10 @@ void ppt_comments_files::write(const std::wstring & RootPath)
BOOST_FOREACH(pptx_comment_elm const & e, comments_)
{
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.presentationml.comments+xml";
contentTypes.add_override(std::wstring(L"/ppt/comments/") + e.filename, kWSConType);
contentTypes->add_override(std::wstring(L"/ppt/comments/") + e.filename, kWSConType);
package::simple_element(e.filename, e.content).write( comm_path);
}
......
......@@ -33,11 +33,12 @@ class slide_content : noncopyable
public:
slide_content();
std::wostream & content() { return content_; }
void add_rel(relationship const & r);
void add_rels(rels & r);
rels_file_ptr get_rel_file() { return rels_; }
std::wstring str() { return content_.str(); }
static _CP_PTR(slide_content) create();
void add_rel(relationship const & r);
void add_rels(rels & r);
rels_file_ptr get_rel_file() { return rels_; }
std::wstring str() { return content_.str(); }
static _CP_PTR(slide_content) create();
private:
std::wstringstream content_;
......@@ -216,15 +217,15 @@ public:
public:
virtual void write(const std::wstring & RootPath);
virtual content_types_file & content_type() { return content_type_; }
ppt_files & get_ppt_files() { return ppt_files_; }
virtual content_types_file & get_content_types_file() { return content_type_file_; }
ppt_files & get_ppt_files() { return ppt_files_; }
private:
pptx_content_types_file content_type_;
ppt_files ppt_files_;
docProps_files docProps_files_;
rels_files rels_files_;
pptx_content_types_file content_type_file_;
ppt_files ppt_files_;
docProps_files docProps_files_;
rels_files rels_files_;
};
......
......@@ -14,21 +14,21 @@ namespace package {
xlsx_content_types_file::xlsx_content_types_file()
{
content_type_.add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_default(L"xml", L"application/xml");
content()->add_default(L"rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_default(L"xml", L"application/xml");
content_type_.add_default(L"jpg", L"image/jpeg");
content_type_.add_default(L"png", L"image/png");
content()->add_default(L"jpg", L"image/jpeg");
content()->add_default(L"png", L"image/png");
content_type_.add_default(L"vml", L"application/vnd.openxmlformats-officedocument.vmlDrawing");
content()->add_default(L"vml", L"application/vnd.openxmlformats-officedocument.vmlDrawing");
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/sharedStrings.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
content_type_.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
content_type_.add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content()->add_override(L"/xl/sharedStrings.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
content()->add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
content()->add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
content()->add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content()->add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
}
xlsx_document::xlsx_document()
......@@ -45,10 +45,10 @@ xlsx_document::xlsx_document()
void xlsx_document::write(const std::wstring & RootPath)
{
xl_files_.write(RootPath);
docProps_files_.write(RootPath);
content_type_.write(RootPath);
rels_files_.write(RootPath);
xl_files_.write (RootPath);
docProps_files_.write (RootPath);
rels_files_.write (RootPath);
content_type_file_.write(RootPath);
}
////////////////////////////////////////////
......@@ -97,10 +97,11 @@ void sheets_files::write(const std::wstring & RootPath)
if (item)
{
count++;
const std::wstring fileName = std::wstring(L"sheet") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
const std::wstring fileName = std::wstring(L"sheet") + boost::lexical_cast<std::wstring>(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
contentTypes->add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
if (rels_)
{
......@@ -247,10 +248,10 @@ void xl_charts_files::write(const std::wstring & RootPath)
{
count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
contentTypes.add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
contentTypes->add_override(std::wstring(L"/xl/charts/") + fileName, kWSConType);
package::simple_element(fileName, item->str()).write(path);
}
......@@ -274,16 +275,14 @@ void xl_drawings::write(const std::wstring & RootPath)
rels_files relFiles;
rels_file_ptr r = rels_file::create(e.filename + L".rels");
e.drawings->dump_rels(r->get_rels());
relFiles.add_rel_file(r);
relFiles.write(path);
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
contentTypes.add_override(L"/xl/drawings/" + e.filename, kDrawingCT);
contentTypes->add_override(L"/xl/drawings/" + e.filename, kDrawingCT);
}
}
......@@ -300,10 +299,10 @@ void xl_comments::write(const std::wstring & RootPath)
BOOST_FOREACH(comment_elm const & e, comments_)
{
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml";
contentTypes.add_override(std::wstring(L"/xl/") + e.filename, kWSConType);
contentTypes->add_override(std::wstring(L"/xl/") + e.filename, kWSConType);
package::simple_element(e.filename, e.content).write(RootPath);
package::simple_element(e.vml_filename, e.vml_content).write(vml_path);
......
......@@ -160,12 +160,13 @@ public:
xlsx_document();
public:
virtual void write(const std::wstring & RootPath);
virtual content_types_file & content_type() { return content_type_; }
xl_files & get_xl_files() { return xl_files_; }
virtual void write(const std::wstring & RootPath);
virtual content_types_file & get_content_types_file() { return content_type_file_; }
xl_files & get_xl_files() { return xl_files_; }
private:
xlsx_content_types_file content_type_;
xlsx_content_types_file content_type_file_;
xl_files xl_files_;
docProps_files docProps_files_;
rels_files rels_files_;
......
......@@ -254,7 +254,7 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
default_height = prop->style_table_row_properties_attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
}
std::wstringstream ht_s;
ht_s.precision(3);
ht_s.precision(1);
ht_s << std::fixed << default_height;
CP_XML_NODE(L"sheetFormatPr")
......
......@@ -29,20 +29,25 @@ namespace package
class xlsx_document;
}
xlsx_conversion_context::
xlsx_conversion_context(::cpdoccore::oox::package::xlsx_document * outputDocument,
::cpdoccore::odf_reader::odf_document * odfDocument): output_document_(outputDocument),
odf_document_(odfDocument),
xlsx_text_context_(odf_document_->odf_context().styleContainer()),
xlsx_table_context_(this, xlsx_text_context_),
xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfDocument) :
odf_document_ (odfDocument),
output_document_ (NULL),
xlsx_text_context_ (odf_document_->odf_context().styleContainer()),
xlsx_table_context_ (this, xlsx_text_context_),
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
default_style_( (std::numeric_limits<size_t>::max)() ),
mediaitems_(odf_document_->get_folder()),
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
default_style_ ( (std::numeric_limits<size_t>::max)() ),
mediaitems_ (odf_document_->get_folder()),
xlsx_drawing_context_handle_(mediaitems_)
{
applicationFonts_ = new CApplicationFonts();
}
void xlsx_conversion_context::set_output_document (package::xlsx_document * document)
{
output_document_ = document;
}
xlsx_conversion_context::~xlsx_conversion_context()
{
if (applicationFonts_)
......@@ -199,7 +204,7 @@ void xlsx_conversion_context::end_document()
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
output_document_->content_type().set_media(get_mediaitems());
output_document_->get_content_types_file().set_media(get_mediaitems());
output_document_->get_xl_files().set_media(get_mediaitems(), applicationFonts_);
package::xl_drawings_ptr drawings = package::xl_drawings::create(xlsx_drawing_context_handle_.content());
......
......@@ -41,10 +41,11 @@ namespace package
class xlsx_conversion_context : boost::noncopyable
{
public:
xlsx_conversion_context(cpdoccore::oox::package::xlsx_document * outputDocument, cpdoccore::odf_reader::odf_document * odfDocument);
xlsx_conversion_context(cpdoccore::odf_reader::odf_document * odfDocument);
~xlsx_conversion_context();
void set_font_directory(std::wstring pathFonts);
void set_output_document(package::xlsx_document * document);
void set_font_directory (std::wstring pathFonts);
void start_document();
void end_document();
......
......@@ -445,7 +445,7 @@ void process_build_chart::visit(office_text& val)
}
void process_build_chart::visit(office_math& val)
{
chart_build_.object_type_ = 3;
chart_build_.object_type_ = 0;//3; //
chart_build_.office_math_ = &val;//
}
......
......@@ -33,7 +33,7 @@ public:
const std::wstring & get_folder() const { return base_folder_; }
const office_element * get_content() const;
office_element * get_content();
office_element * get_content();
long get_office_mime_type() {return office_mime_type_;}
......
......@@ -5,11 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "cpxml.vcproj
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfCommon", "cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}"
......@@ -19,16 +19,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfCommon", "cpcommon.vcpro
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "..\ASCOfficeOdfFile\ASCOfficeOdfFile.vcproj", "{64B09C98-22DC-494E-A882-9E2D7D18557C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "..\Test\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "..\Test\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\Common\DocxFormat\Source\XML\libxml2\win_build\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
......@@ -45,20 +45,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\DesktopEd
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
......@@ -215,34 +215,6 @@ Global
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Unicode Release|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Unicode Release|x64.ActiveCfg = Release|x64
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Unicode Release|x64.Build.0 = Release|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Multithreaded|Win32.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Multithreaded|x64.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Multithreaded|x64.Build.0 = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Singlethreaded|Win32.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Singlethreaded|x64.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug Singlethreaded|x64.Build.0 = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug|Win32.ActiveCfg = Debug|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug|Win32.Build.0 = Debug|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug|x64.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Debug|x64.Build.0 = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Multithreaded|Win32.ActiveCfg = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Multithreaded|x64.ActiveCfg = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Multithreaded|x64.Build.0 = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Singlethreaded|Win32.ActiveCfg = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Singlethreaded|x64.ActiveCfg = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release Singlethreaded|x64.Build.0 = Release ASC|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release|Win32.ActiveCfg = Release|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release|Win32.Build.0 = Release|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release|x64.ActiveCfg = Release|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Release|x64.Build.0 = Release|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Debug|Win32.Build.0 = Debug|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Debug|x64.ActiveCfg = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Debug|x64.Build.0 = Debug|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Release|Win32.ActiveCfg = Release|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Release|Win32.Build.0 = Release|Win32
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Release|x64.ActiveCfg = Release|x64
{64B09C98-22DC-494E-A882-9E2D7D18557C}.Unicode Release|x64.Build.0 = Release|x64
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Debug Multithreaded|Win32.ActiveCfg = Debug|x64
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Debug Multithreaded|x64.ActiveCfg = Debug|x64
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Debug Multithreaded|x64.Build.0 = Debug|x64
......
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