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

конвертация Svm в Png (так как MS не открывает эту векторную графику)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62930 954022d7-b5bf-4e40-9824-e11837661b57
parent 6c5687a4
......@@ -17,6 +17,8 @@
#include "../../Common/ASCATLError.h"
#include <string>
#include <Shlobj.h>
// : 1 , xlsx docx
// 0 , package
......@@ -90,8 +92,11 @@ HRESULT COfficeOdfFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXML
//
FileSystem::Directory::CreateDirectory(dstTempPath);
#endif
//hr = LoadFromFileImpl(bstr2wstring(sSrcFileName), srcTempPath.string<std::wstring>(), dstTempPath.string<std::wstring>(), bstr2wstring(sDstPath));
hr = LoadFromFileImpl(bstr2wstring(sSrcFileName), srcTempPath, dstTempPath, bstr2wstring(sDstPath));
std::wstring fontsPath = GetDefWinFontDirectory();
///
///
hr = LoadFromFileImpl(bstr2wstring(sSrcFileName), srcTempPath, dstTempPath, bstr2wstring(sDstPath), fontsPath);
}
catch(...)
......@@ -125,7 +130,8 @@ HRESULT COfficeOdfFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXML
HRESULT COfficeOdfFile::LoadFromFileImpl(const std::wstring & srcFileName,
const std::wstring & srcTempPath,
const std::wstring & dstTempPath,
const std::wstring & dstPath)
const std::wstring & dstPath,
const std::wstring & fontsPath)
{
HRESULT hr = AVS_ERROR_UNEXPECTED;
......@@ -140,7 +146,7 @@ HRESULT COfficeOdfFile::LoadFromFileImpl(const std::wstring & srcFileName,
ffCallBack.OnProgressEx = OnProgressExFunc;
ffCallBack.caller = this;
hr = ConvertOO2OOX(srcTempPath, dstTempPath,bOnlyPresentation, &ffCallBack);
hr = ConvertOO2OOX(srcTempPath, dstTempPath, fontsPath, bOnlyPresentation, &ffCallBack);
if (hr != S_OK) return hr;
......@@ -175,3 +181,15 @@ void COfficeOdfFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercent,
pOdfFile->OnProgressEx(nID, nPercent, pStop);
}
}
std::wstring COfficeOdfFile::GetDefWinFontDirectory()
{
std::wstring strPath;
wchar_t wsWinFontDir[1024] ={};
if ( !SHGetSpecialFolderPathW( NULL, wsWinFontDir, CSIDL_FONTS, FALSE ) )
wsWinFontDir[0] = '\0';
strPath = std::wstring(wsWinFontDir);
return strPath;
}
......@@ -81,7 +81,10 @@ private:
HRESULT LoadFromFileImpl(const std::wstring & srcFileName,
const std::wstring & srcTempPath,
const std::wstring & dstTempPath,
const std::wstring & dstPath);
const std::wstring & dstPath,
const std::wstring & fontsPath);
std::wstring GetDefWinFontDirectory();
protected:
......
......@@ -13,39 +13,44 @@
#include "../include/cpdoccore/odf/odf_document.h"
HRESULT ConvertOds2Xlsx(cpdoccore::odf::odf_document & inputOdf, const std::wstring & dstPath)
HRESULT ConvertOds2Xlsx(cpdoccore::odf::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);
conversionContext.set_font_directory(fontsPath);
if (inputOdf.xlsx_convert(conversionContext) == false) return S_FALSE;
outputXlsx.write(dstPath);
return S_OK;
}
HRESULT ConvertOdt2Docx(cpdoccore::odf::odf_document & inputOdf, const std::wstring & dstPath)
HRESULT ConvertOdt2Docx(cpdoccore::odf::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);
conversionContext.set_font_directory(fontsPath);
if (inputOdf.docx_convert(conversionContext) == false) return S_FALSE;
outputDocx.write(dstPath);
return S_OK;
}
HRESULT ConvertOdp2Pptx(cpdoccore::odf::odf_document & inputOdf, const std::wstring & dstPath)
HRESULT ConvertOdp2Pptx(cpdoccore::odf::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);
conversionContext.set_font_directory(fontsPath);
if (inputOdf.pptx_convert(conversionContext) == false) return S_FALSE;
outputPptx.write(dstPath);
return S_OK;
}
HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath, bool bOnlyPresentation, const ProgressCallback* CallBack)
HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, bool bOnlyPresentation, const ProgressCallback* CallBack)
{
HRESULT hr = S_OK;
......@@ -71,13 +76,13 @@ HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath
switch (type)
{
case 1:
hr = ConvertOdt2Docx(inputOdf,dstPath);
hr = ConvertOdt2Docx(inputOdf,dstPath, fontsPath);
break;
case 2:
hr = ConvertOds2Xlsx(inputOdf,dstPath);
hr = ConvertOds2Xlsx(inputOdf,dstPath, fontsPath);
break;
case 3:
hr = ConvertOdp2Pptx(inputOdf,dstPath);
hr = ConvertOdp2Pptx(inputOdf,dstPath, fontsPath);
break;
}
if (hr == S_OK)
......
......@@ -4,4 +4,4 @@
struct ProgressCallback;
HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath, bool bOnlyPresentation, const ProgressCallback* CallBack);
HRESULT ConvertOO2OOX(const std::wstring & srcPath, const std::wstring & dstPath, const std::wstring & fontsPath, bool bOnlyPresentation, const ProgressCallback* CallBack);
......@@ -19,6 +19,8 @@
#include "docx_rels.h"
#include "logging.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
namespace cpdoccore {
namespace oox {
......@@ -41,8 +43,20 @@ docx_conversion_context::docx_conversion_context(package::docx_document * Output
delayed_converting_(false),
process_headers_footers_(false),
process_note_(noNote)
{}
{
applicationFonts_ = new CApplicationFonts();
}
docx_conversion_context::~docx_conversion_context()
{
if (applicationFonts_)
delete applicationFonts_;
}
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
{
if (applicationFonts_ == NULL) return;
applicationFonts_->InitializeFromFolder(pathFonts);
}
std::wstring styles_map::get(const std::wstring & Name, odf::style_family::type Type)
{
const std::wstring n = name(Name, Type);
......@@ -219,7 +233,7 @@ 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_->get_word_files().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_notes(notes_context_);
output_document_->get_word_files().set_comments(comments_context_);
......
......@@ -16,6 +16,8 @@
#include "oox_conversion_context.h"
#include "oox_chart_context.h"
class CApplicationFonts;
namespace cpdoccore {
namespace odf
......@@ -351,8 +353,11 @@ class docx_conversion_context : boost::noncopyable
public:
docx_conversion_context(package::docx_document * OutputDocument, odf::odf_document * OdfDocument);
public:
std::wostream & output_stream()
~docx_conversion_context();
void set_font_directory(std::wstring pathFonts);
std::wostream & output_stream()
{
if ( streams_man_)
return streams_man_->get();
......@@ -506,8 +511,9 @@ private:
boost::shared_ptr<streams_man> streams_man_;
package::docx_document * output_document_;
odf::odf_document * odf_document_;
package::docx_document * output_document_;
odf::odf_document * odf_document_;
CApplicationFonts * applicationFonts_;
std::vector<odf::_property> settings_properties_;
......
......@@ -106,9 +106,9 @@ void word_files::update_rels(docx_conversion_context & Context)
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
}
void word_files::set_media(mediaitems & _Mediaitems)
void word_files::set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts)
{
media_ = element_ptr( new media(_Mediaitems) );
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
}
void word_files::set_styles(element_ptr Element)
......
......@@ -10,6 +10,8 @@
#include "docx_content_type.h"
#include "oox_package.h"
class CApplicationFonts;
namespace cpdoccore {
namespace oox {
......@@ -98,7 +100,7 @@ public:
void set_numbering(element_ptr Element);
void set_settings(element_ptr Element);
bool has_numbering();
void set_media(mediaitems & _Mediaitems);
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);
......
......@@ -88,6 +88,12 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, Type type, bool
}
else if ( type == typeImage)
{
int n_svm = inputPath.rfind (L".svm");
if ( n_svm >= 0 )
{
outputPath = outputPath.substr(0, n_svm) + L".png";
}
id = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image+1);
count_image++;
}
......
......@@ -82,8 +82,8 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(std::wstring(val.bitmap->name_space + L":blipFill"))
{
if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
else CP_XML_ATTR(L"a:rotWithShape",1);
//if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
//else CP_XML_ATTR(L"a:rotWithShape",1);
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi",*val.bitmap->dpi);
......
......@@ -8,11 +8,25 @@
#include "mediaitems.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/MetaFile/MetaFile.h"
namespace cpdoccore {
namespace oox {
namespace package {
static void ConvertSvmToImage(std::wstring &file_svm, std::wstring &file_png, CApplicationFonts *pAppFonts)
{
MetaFile::CMetaFile oMetaFile(pAppFonts);
if (oMetaFile.LoadFromFile(file_svm.c_str()))
{
double w, h, x, y;
oMetaFile.GetBounds(&x, &y, &w, &h);
oMetaFile.ConvertToRaster(file_png.c_str(), 4, w);
oMetaFile.Close();
}
}
content_types_file::content_types_file() : filename_(L"[Content_Types].xml")
{}
......@@ -164,7 +178,7 @@ void docProps_files::write(const std::wstring & RootPath)
////////////
media::media(mediaitems & _Mediaitems) : mediaitems_(_Mediaitems)
media::media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
{
}
......@@ -180,7 +194,13 @@ void media::write(const std::wstring & RootPath)
std::wstring & file_name = item.href;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.outputName;
NSFile::CFileBinary::Copy(item.href, file_name_out);
int pos_svm = file_name.rfind(L".svm");
if ( pos_svm >= 0)
{
ConvertSvmToImage(file_name, file_name_out, appFonts_);
}
else
NSFile::CFileBinary::Copy(item.href, file_name_out);
}
}
......
......@@ -11,6 +11,8 @@
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
class CApplicationFonts;
namespace cpdoccore {
namespace oox {
......@@ -166,21 +168,20 @@ private:
};
/// \class media
class media : public element
{
public:
media(mediaitems & _Mediaitems);
media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems & mediaitems_;
mediaitems & mediaitems_;
CApplicationFonts * appFonts_;
};
/// \class charts
class charts : public element
{
public:
......
......@@ -14,6 +14,8 @@
#include "pptx_default_serializes.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
namespace cpdoccore {
namespace odf
......@@ -28,9 +30,8 @@ namespace package
class pptx_document;
}
pptx_conversion_context::
pptx_conversion_context(::cpdoccore::oox::package::pptx_document * outputDocument,
::cpdoccore::odf::odf_document * odfDocument):
pptx_conversion_context::pptx_conversion_context(cpdoccore::oox::package::pptx_document * outputDocument,
cpdoccore::odf::odf_document * odfDocument):
output_document_(outputDocument)
,odf_document_(odfDocument)
,pptx_text_context_(odf_document_->odf_context(),*this)
......@@ -39,6 +40,18 @@ pptx_conversion_context(::cpdoccore::oox::package::pptx_document * outputDocumen
,pptx_slide_context_(*this/*, pptx_text_context_*/)
,last_idx_placeHolder(1)
{
applicationFonts_ = new CApplicationFonts();
}
pptx_conversion_context::~pptx_conversion_context()
{
if (applicationFonts_)
delete applicationFonts_;
}
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
{
if (applicationFonts_ == NULL) return;
applicationFonts_->InitializeFromFolder(pathFonts);
}
//
//void pptx_conversion_context::start_chart(std::wstring const & name)
......@@ -265,7 +278,7 @@ void pptx_conversion_context::end_document()
output_document_->get_ppt_files().set_presentation(presentation_);
output_document_->get_ppt_files().set_media(get_mediaitems());
output_document_->get_ppt_files().set_media(get_mediaitems(), applicationFonts_);
output_document_->get_ppt_files().set_authors_comments(authors_comments_);
}
......
......@@ -13,6 +13,7 @@
#include "mediaitems.h"
class CApplicationFonts;
namespace cpdoccore {
......@@ -32,10 +33,14 @@ namespace package
class pptx_conversion_context : boost::noncopyable
{
public:
pptx_conversion_context(::cpdoccore::oox::package::pptx_document * outputDocument,
::cpdoccore::odf::odf_document * odfDocument);
pptx_conversion_context(cpdoccore::oox::package::pptx_document * outputDocument,
cpdoccore::odf::odf_document * odfDocument);
void start_document();
~pptx_conversion_context();
void set_font_directory(std::wstring pathFonts);
void start_document();
void end_document();
void start_chart(std::wstring const & name);
......@@ -102,9 +107,9 @@ private:
void create_new_slideLayout(int id);
void create_new_slideMaster(int id);
package::pptx_document * output_document_;
odf::odf_document * odf_document_;
package::pptx_document * output_document_;
odf::odf_document * odf_document_;
CApplicationFonts *applicationFonts_;
pptx_slide_context pptx_slide_context_;
pptx_text_context pptx_text_context_;
......
......@@ -401,9 +401,9 @@ void ppt_files::add_slideMaster(slide_content_ptr slide)
slideMasters_files_.add_slide(slide);
}
void ppt_files::set_media(mediaitems & _Mediaitems)
void ppt_files::set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts)
{
media_ = element_ptr( new media(_Mediaitems) );
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
}
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)
{
......
......@@ -4,6 +4,8 @@
#include <cpdoccore/CPNoncopyable.h>
#include "pptx_comments.h"
class CApplicationFonts;
namespace cpdoccore {
namespace oox {
......@@ -176,7 +178,7 @@ public:
void add_slideLayout(slide_content_ptr sheet);
void add_slideMaster(slide_content_ptr sheet);
void set_media(mediaitems & _Mediaitems);
void set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void add_charts(chart_content_ptr chart);
void add_theme (pptx_xml_theme_ptr theme);
......
......@@ -150,6 +150,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing const & val)
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", val.id);// val.rId
CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
......
......@@ -212,9 +212,9 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
sheets_files_.add_sheet(sheet);
}
void xl_files::set_media(mediaitems & _Mediaitems)
void xl_files::set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts)
{
media_ = element_ptr( new media(_Mediaitems) );
media_ = element_ptr( new media(_Mediaitems, pAppFonts) );
}
void xl_files::set_comments(element_ptr Element)
{
......
......@@ -7,6 +7,8 @@
#include "xlsx_drawings.h"
#include "xlsx_comments.h"
class CApplicationFonts;
namespace cpdoccore {
namespace oox {
namespace package {
......@@ -147,7 +149,7 @@ public:
void set_styles(element_ptr Element);
void set_sharedStrings(element_ptr Element);
void add_sheet(sheet_content_ptr sheet);
void set_media(mediaitems & _Mediaitems);
void set_media(mediaitems & _Mediaitems, CApplicationFonts *pAppFonts);
void set_drawings(element_ptr Element);
void set_vml_drawings(element_ptr Element);
void set_comments(element_ptr Element);
......

#include "xlsx_textcontext.h"
#include "xlsxconversioncontext.h"
#include <iostream>
......@@ -45,7 +45,7 @@ public:
void ApplyTextProperties(std::wstring style,odf::text_format_properties_content & propertiesOut, odf::style_family::type Type);
void set_local_styles_container(odf::styles_container* local_styles_);//
void set_local_styles_container(odf::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
bool is_drawing_context(){return in_draw;}
......@@ -68,13 +68,13 @@ private:
std::wstring dump_text();
void write_rPr(std::wostream & strm);
size_t paragraphs_cout_; //???? ?
size_t paragraphs_cout_; //???? тока из за начала отсчета?
std::wstringstream text_;
std::wstringstream output_;
xlsx_shared_strings xlsx_shared_strings_;
std::wstring paragraph_style_name_;// ... , ,, -
std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится
std::wstring span_style_name_;
};
......@@ -129,7 +129,7 @@ void xlsx_text_context::Impl::end_paragraph()
in_paragraph = false;
}
void xlsx_text_context::Impl::start_span(const std::wstring & styleName)// () - 1
void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кусок текста в абзаце(параграфе) со своими свойствами - этто может быть и 1 буква
{
if (!in_comment && !in_draw)
{
......@@ -146,8 +146,8 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//
in_span=true;
}
void xlsx_text_context::Impl::end_span() //odf -
// - ..
void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста
//пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом
{
if (!in_comment && !in_draw)
{
......@@ -220,7 +220,7 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
_CP_OPT(std::wstring) sValFontFamily;
if (text_properties_.fo_font_family_)
sValFontFamily=text_properties_.fo_font_family_.get();
//else if (text_properties_.style_font_name_) - font_face)decl !!!!
//else if (text_properties_.style_font_name_) - тут может быть отсылка к font_face)decl !!!!
// sValFontFamily=text_properties_.style_font_name_.get();
_CP_OPT(std::wstring) sValFontColor;
......@@ -243,11 +243,11 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
//oox_serialize_style_text(strm,odf::text_format_properties_content & properties);
CP_XML_NODE(L"a:rPr")
{
// 3197
//стр 3197
if (dValFontSize) {CP_XML_ATTR(L"sz", (int)(dValFontSize.get()*100));}
if ((iValFontStyle) && (iValFontStyle.get() >0)) {CP_XML_ATTR(L"i", "true");}
if ((iValFontWeight) && (iValFontWeight.get() >0)) {CP_XML_ATTR(L"b", "true");}
if (sValFontFamily) {CP_XML_ATTR(L"typeface", sValFontFamily.get());}
if ((iValFontStyle) && (iValFontStyle.get() >0)) {CP_XML_ATTR(L"i", "1");} //"true");} Exercícios de Aprendizagem.ods
if ((iValFontWeight) && (iValFontWeight.get() >0)) {CP_XML_ATTR(L"b", "1");} //"true");} Exercícios de Aprendizagem.ods
if (sValFontFamily) {CP_XML_ATTR(L"typeface", sValFontFamily.get());} //'Arial' глючит
if (sValFontColor){CP_XML_NODE(L"a:solidFill") {CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sValFontColor.get());}}}
......@@ -312,9 +312,9 @@ void xlsx_text_context::Impl::start_cell_content()
paragraphs_cout_ = 0;
local_styles_ptr_ =NULL;
output_.str(std::wstring());//
output_.str(std::wstring());//строка дампа
text_.str(std::wstring()); //
text_.str(std::wstring()); //приходящие куски текста
paragraph_style_name_ = L"";
span_style_name_ = L"";
......@@ -348,7 +348,7 @@ void xlsx_text_context::Impl::start_drawing_content()
}
std::wstring xlsx_text_context::Impl::end_comment_content()
{
dump_text();// - -
dump_text();//если в комменте куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля
std::wstring comment= output_.str();
......@@ -365,7 +365,7 @@ std::wstring xlsx_text_context::Impl::end_comment_content()
}
std::wstring xlsx_text_context::Impl::end_drawing_content()
{
dump_text();// draw - -
dump_text();//если в draw куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля
std::wstring draw= output_.str();
......@@ -385,7 +385,7 @@ int xlsx_text_context::Impl::end_cell_content()
dump_text();
const int sharedStrId = output_.str().empty() ? (-1) : static_cast<int>(xlsx_shared_strings_.add(output_.str()));
//???? ????? - - -
//???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля
in_cell_content = false;
return sharedStrId;
}
......
......@@ -41,19 +41,19 @@ xlsx_conversion_context(::cpdoccore::oox::package::xlsx_document * outputDocumen
mediaitems_(odf_document_->get_folder()),
xlsx_drawing_context_handle_(mediaitems_)
{
fontsApplication_ = new CApplicationFonts();
applicationFonts_ = new CApplicationFonts();
}
xlsx_conversion_context::~xlsx_conversion_context()
{
if (fontsApplication_)
delete fontsApplication_;
if (applicationFonts_)
delete applicationFonts_;
}
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
{
if (fontsApplication_ == NULL) return;
if (applicationFonts_ == NULL) return;
fontsApplication_->InitializeFromFolder(pathFonts);
applicationFonts_->InitializeFromFolder(pathFonts);
}
void xlsx_conversion_context::start_chart(std::wstring const & name)
......@@ -198,7 +198,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_->get_xl_files().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());
output_document_->get_xl_files().set_drawings(drawings);
......@@ -482,7 +482,7 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
else
font_size =10;
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, /*getDefaultDpi()*/96., 0, fontsApplication_->GenerateFontManager());
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, /*getDefaultDpi()*/96., 0, applicationFonts_->GenerateFontManager());
}
return maxDigitSize_;
}
......
......@@ -134,7 +134,7 @@ private:
const odf::office_element *spreadsheet_;
odf::odf_document *odf_document_;
CApplicationFonts *fontsApplication_;
CApplicationFonts *applicationFonts_;
std::vector<xlsx_xml_worksheet_ptr> sheets_;
std::vector<oox_chart_context_ptr> charts_;
......
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