Commit e95a0fb7 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - activeX objects

parent c5ce1e27
......@@ -89,7 +89,7 @@ void NoteSh::load(CFRecord& record)
void NoteSh::calculate()
{
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >=0 ?
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
ref_ = CellRef(row, col, true, true).toString();
......
......@@ -80,7 +80,7 @@ void OfficeArtClientAnchorSheet::calculate()
global_info->GetDigitFontSizePixels();
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >=0 ?
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
//----------------------------------------------------------------------------------------------------
......@@ -92,7 +92,7 @@ void OfficeArtClientAnchorSheet::calculate()
double Digit_Width = global_info->defaultDigitFontSize.first;
double Digit_Height = global_info->defaultDigitFontSize.second;
double width = 0 , column_width = 0;
double width = 0, column_width = 0;
if (sheet_info.customColumnsWidth.find(colL) != sheet_info.customColumnsWidth.end())
{
......@@ -129,47 +129,68 @@ void OfficeArtClientAnchorSheet::calculate()
}
else
_dyB = dyB * kfRow * sheet_info.defaultRowHeight;
}
void OfficeArtClientAnchorSheet::calculate_1()
{
global_info->GetDigitFontSizePixels();
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
double Digit_Width = global_info->defaultDigitFontSize.first;
double Digit_Height = global_info->defaultDigitFontSize.second;
double column_width = 0;
for (int i = 0 ; i < colL; i++)
{
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
column_width += sheet_info.customColumnsWidth[i];
else
column_width += sheet_info.defaultColumnWidth;
}
_x = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
_x = (int)(((256. * _x + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
_x = _x * 9525. + _dxL;
column_width = 0;
for (int i = 0; i < colR; i++)
{
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
column_width += sheet_info.customColumnsWidth[i];
else
column_width += sheet_info.defaultColumnWidth;
}
_cx = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
_cx = (int)(((256. * _cx + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
_cx += _cx * 9525. + _dxR - _x;
for (int i = 0 ; i < rwT; i++)
{
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
{
_y += 256 * kfRow * sheet_info.customRowsHeight[i];
}
else
_y += 256 * kfRow * sheet_info.defaultRowHeight;
}
_y += _dyT;
for (int i = 0 ; i < rwB; i++)
{
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
{
_cy += 256 * kfRow * sheet_info.customRowsHeight[i];
}
else
_cy += 256 * kfRow * sheet_info.defaultRowHeight;
}
_cy += _dyT - _y;
//----------------------------------------------------------------------------------------------------
//for (int i = 0 ; i < colL; i++)
//{
// if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
// _x += 256 * kfCol * sheet_info.customColumnsWidth[i];
// else
// _x += 256 * kfCol * sheet_info.defaultColumnWidth;
//}
//_x += _dxL;
//for (int i = colL ; i < colR; i++)
//{
// if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
// _cx += 256 * kfCol * sheet_info.customColumnsWidth[i];
// else
// _cx += 256 * kfCol * sheet_info.defaultColumnWidth;
//}
//_cx += _dxR;
//for (int i = 0 ; i < rwT; i++)
//{
// if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
// {
// _y += 256 * kfRow * sheet_info.customRowsHeight[i];
// }
// else
// _y += 256 * kfRow * sheet_info.defaultRowHeight;
//}
//_y += _dyT;
//for (int i = rwT ; i < rwB; i++)
//{
// if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
// {
// _cy += 256 * kfRow * sheet_info.customRowsHeight[i];
// }
// else
// _cy += 256 * kfRow * sheet_info.defaultRowHeight;
//}
//_cy += _dyT;
}
......
......@@ -70,6 +70,7 @@ public:
XLS::GlobalWorkbookInfoPtr global_info;
void calculate();
void calculate_1();
_UINT32 _dxL;
_UINT32 _dyT;
......
......@@ -36,9 +36,7 @@
namespace ODRAW
{
OfficeArtFSPGR::OfficeArtFSPGR()
: OfficeArtRecord(0x01, FSPGR)
OfficeArtFSPGR::OfficeArtFSPGR() : OfficeArtRecord(0x01, FSPGR)
{
}
......
......@@ -38,7 +38,6 @@ namespace XLS
class CFRecord;
}
namespace ODRAW
{
......
......@@ -219,5 +219,68 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels()
}
}
void GlobalWorkbookInfo::CalculateAnchor(int colL, int colR, int rwT, int rwB, _UINT32 & x, _UINT32 &y, _UINT32 &cx, _UINT32 & cy)
{
_sheet_size_info zero;
_sheet_size_info & sheet_info = current_sheet >= 0 ? sheet_size_info[current_sheet - 1] : zero;
GetDigitFontSizePixels();
//----------------------------------------------------------------------------------------------------
x = y = cx = cy = 0;
//1 inch = 72 point
//1 emu = 360000 * 2.54 inch
double kfCol = 1;// 1250.;//360000 / 72. / 4.;
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
double Digit_Width = defaultDigitFontSize.first;
double Digit_Height = defaultDigitFontSize.second;
double width = 0, column_width = 0;
for (int i = 0 ; i < colL; i++)
{
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
x += 256 * kfCol * sheet_info.customColumnsWidth[i];
else
x += 256 * kfCol * sheet_info.defaultColumnWidth;
}
for (int i = colL ; i < colR; i++)
{
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
cx += 256 * kfCol * sheet_info.customColumnsWidth[i];
else
cx += 256 * kfCol * sheet_info.defaultColumnWidth;
}
for (int i = 0 ; i < rwT; i++)
{
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
{
y += 256 * kfRow * sheet_info.customRowsHeight[i];
}
else
y += 256 * kfRow * sheet_info.defaultRowHeight;
}
for (int i = rwT ; i < rwB; i++)
{
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
{
cy += 256 * kfRow * sheet_info.customRowsHeight[i];
}
else
cy += 256 * kfRow * sheet_info.defaultRowHeight;
}
cx = ((int)((cx * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
cx = (int)(((256. * cx + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
x = ((int)((x * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
x = (int)(((256. * x + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
}
} // namespace XLS
\ No newline at end of file
......@@ -80,7 +80,8 @@ public:
void RegisterPaletteColor(int id, const std::wstring & argb);
void GetDigitFontSizePixels();
void CalculateAnchor(int colL, int colR, int rowT, int rowB, _UINT32 & x, _UINT32 &y, _UINT32 &cx, _UINT32 & cy);
//-----------------------------------------------------------------------------
bool bVbaProjectExist;
bool bMacrosExist;
......
......@@ -1181,7 +1181,12 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
ODRAW::OfficeArtClientAnchorSheet * ch = dynamic_cast<ODRAW::OfficeArtClientAnchorSheet *>(art);
ch->calculate();
//xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
if (xlsx_context->get_drawing_context().getType() == oox::external_items::typeGroup &&
xlsx_context->get_drawing_context().getLevel() == 1)
{
ch->calculate_1();
xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
}
xlsx_context->get_drawing_context().set_sheet_anchor(ch->colL, ch->_dxL, ch->rwT, ch->_dyT, ch->colR, ch->_dxR, ch->rwB, ch->_dyB);
}break;
case XLS::typeOfficeArtBStoreContainer:
......@@ -1948,17 +1953,25 @@ void XlsConverter::convert(XLS::Obj * obj)
}
if (obj->pictFlags.fCtl && obj->pictFlags.fPrstm)//Controls Storage
{
xlsx_context->start_activeX();
xlsx_context->get_mediaitems().create_activeX_path(xlsx_path);
int id = ++xlsx_context->get_mediaitems().count_activeX;
std::wstring file_name = xlsx_context->get_mediaitems().activeX_path() + L"activeX" + std::to_wstring(id) + L".bin";
//binary data
std::wstring target;
std::wstring objectId = xlsx_context->get_mediaitems().add_activeX(target);
NSFile::CFileBinary file;
if ( file.CreateFileW(file_name) )
if ( file.CreateFileW(xlsx_context->get_mediaitems().activeX_path() + target) )
{
file.WriteFile(xls_global_info->controls_data.first.get() + obj->pictFmla.lPosInCtlStm, obj->pictFmla.cbBufInCtlStm);
file.CloseFile();
}
xlsx_context->get_drawing_context().set_control(objectId);
xlsx_context->current_activeX().setClassId(info);
xlsx_context->current_activeX().setDataBinRid(objectId, target);
}
else if (!obj->pictFlags.fPrstm)
{
......
......@@ -32,12 +32,8 @@
#include "external_items.h"
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/lexical_cast.hpp>
#include <utils.h>
#include "simple_xml_writer.h"
#include "oox_rels.h"
#include "mediaitems_utils.h"
......@@ -55,12 +51,6 @@ external_items::item::item( std::wstring const & _uri, Type _type, bool _mediaIn
{
}
//std::wstring external_items::add_or_find(const std::wstring & href, Type type, bool & isInternal)
//{
// std::wstring ref;
// return add_or_find(href, type, isInternal, ref);
//}
std::wstring static get_default_file_name(external_items::Type type)
{
switch (type)
......@@ -71,33 +61,18 @@ std::wstring static get_default_file_name(external_items::Type type)
return L"chart";
case external_items::typeMedia:
return L"media";
case external_items::typeActiveX:
return L"activeX";
default:
return L"";
}
}
//std::wstring external_items::create_file_name(const std::wstring & uri, external_items::Type type, size_t Num)
//{
// if (uri.empty()) return L"";
//
// std::wstring sExt;
// int n = uri.rfind(L".");
// if (n>0) sExt = uri.substr(n);
// else if (n==0)
// {
//
// }
// //todooo проверить
//
// return get_default_file_name(type) + std::to_wstring(Num) + sExt;
//}
std::wstring external_items::add_image(const std::wstring & image, int bin_id)
{
const bool isMediaInternal = true;
std::wstring rId = std::wstring(L"picId") + std::to_wstring(count_image+1);
std::wstring rId = std::wstring(L"picId") + std::to_wstring(count_image + 1);
count_image++;
items_.push_back( item(image, typeImage, isMediaInternal, bin_id, rId) );
......@@ -117,6 +92,20 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
return rId;
}
std::wstring external_items::add_activeX(std::wstring & oox_target)
{
const bool isMediaInternal = true;
count_controls++;
std::wstring rId = std::wstring(L"ctrlId") + std::to_wstring(count_controls);
oox_target = std::wstring(L"activeX") + std::to_wstring(count_controls) + L".bin";
items_.push_back( item(oox_target, typeActiveX, isMediaInternal, -1, rId) );
return rId;
}
std::wstring external_items::add_embedding(std::wstring & oox_target, const std::wstring & info)
{
const bool isMediaInternal = true;
......@@ -139,7 +128,7 @@ std::wstring external_items::add_embedding(std::wstring & oox_target, const std:
}
std::wstring external_items::find_image(int _id, std::wstring & oox_target, bool & isInternal)
{
for (int i=0 ; i <items_.size(); i ++)
for (size_t i=0 ; i <items_.size(); i ++)
{
if (items_[i].type == typeImage && items_[i].id == _id)
{
......@@ -152,7 +141,7 @@ std::wstring external_items::find_image(int _id, std::wstring & oox_target, bool
}
std::wstring external_items::find_image(const std::wstring & oox_target, bool & isInternal)
{
for (int i=0 ; i <items_.size(); i ++)
for (size_t i = 0; i <items_.size(); i ++)
{
if (items_[i].type == typeImage && items_[i].uri == oox_target)
{
......@@ -164,14 +153,13 @@ std::wstring external_items::find_image(const std::wstring & oox_target, bool &
}
void external_items::dump_rels(rels & Rels)
{
size_t i = 0;
BOOST_FOREACH(item & elm, items_)
{
for (size_t i = 0 ; i <items_.size(); i ++)
{
Rels.add( relationship(
elm.rId,
utils::media::get_rel_type(elm.type),
elm.uri,
elm.mediaInternal ? L"" : L"External" )
items_[i].rId,
utils::media::get_rel_type(items_[i].type),
items_[i].uri,
items_[i].mediaInternal ? L"" : L"External" )
);
}
}
......
......@@ -100,6 +100,7 @@ public:
//std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal);//возможны ссылки на один и тот же объект
std::wstring add_image (const std::wstring & file_name, int bin_id);
std::wstring add_chart (std::wstring & oox_target);
std::wstring add_activeX (std::wstring & oox_target);
std::wstring add_embedding (std::wstring & oox_target, const std::wstring & info);
std::wstring find_image (int id, std::wstring & oox_target, bool & isExternal);
......
......@@ -62,6 +62,8 @@ std::wstring get_rel_type(external_items::Type type)
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
case external_items::typeExternalLink:
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath";
case external_items::typeActiveX:
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control";
default:
return L"";
}
......
......@@ -102,23 +102,7 @@ const wchar_t * content_type::name = L"Types";
elm.xml_to_stream(CP_XML_STREAM());
}
}
}
//_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;
}
......
......@@ -113,6 +113,11 @@ void content_types_file::set_media(external_items & _Mediaitems)
else
content_type_.add_override(L"/xl/embeddings/" + item.uri, link);
}
else if (item.type == external_items::typeActiveX)
{
std::wstring link = L"application/vnd.ms-office.activeX";
content_type_.add_override(L"/xl/activeX/" + item.uri, link);
}
}
}
......@@ -252,37 +257,15 @@ void docProps_files::write(const std::wstring & RootPath)
////////////
media::media(external_items & _Mediaitems) : mediaitems_(_Mediaitems)
media::media(external_items & _items) : items_(_items)
{
}
void media::write(const std::wstring & RootPath)
{
// std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
// BOOST_FOREACH( external_items::item & item, mediaitems_.items() )
// {
// if (item.mediaInternal && item.type == external_items::typeImage )
// {
////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);
// }
// }
}
///////////////////////////////////////////////////////////////////////////////////
charts::charts(external_items & _ChartsItems) : chartsitems_(_ChartsItems)
{
}
void charts::write(const std::wstring & RootPath)
{
}
}
}
......@@ -161,7 +161,7 @@ public:
static _CP_PTR(chart_content) create();
std::wostream & content() { return content_; }
rels & get_rels() { return rels_file_->get_rels(); }
rels & get_rels(){ return rels_file_->get_rels(); }
std::wstring str() { return content_.str(); }
......@@ -170,7 +170,26 @@ private:
std::wstringstream content_;
rels_file_ptr rels_file_;
};
//------------------------------------------------------------------------
class activeX_content;
typedef _CP_PTR(activeX_content) activeX_content_ptr;
class activeX_content : boost::noncopyable
{
public:
activeX_content();
static _CP_PTR(activeX_content) create();
std::wostream & content() { return content_; }
rels & get_rels(){ return rels_file_->get_rels(); }
std::wstring str() { return content_.str(); }
friend class xl_activeX_files;
private:
std::wstringstream content_;
rels_file_ptr rels_file_;
};
//------------------------------------------------------------------------
class document : public element
{
......@@ -207,26 +226,11 @@ private:
class media : public element
{
public:
media(external_items & _Mediaitems);
public:
virtual void write(const std::wstring & RootPath);
private:
external_items & mediaitems_;
};
class charts : public element
{
public:
charts(external_items & _ChartsItems);
public:
media(external_items & _items);
virtual void write(const std::wstring & RootPath);
private:
external_items & chartsitems_;
external_items & items_;
};
......
......@@ -97,17 +97,6 @@ const wchar_t * rels::name = L"Relationships";
}
} // "Relationships"
}
//_Wostream << L"<Relationships ";
//CP_XML_SERIALIZE_ATTR(L"xmlns", xmlns::rels.value);
//_Wostream << L">";
//BOOST_FOREACH(const relationship & r, relationship_)
//{
// r.xml_to_stream(_Wostream);
//}
//_Wostream << L"</Relationships>";
return _Wostream;
}
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "xlsx_conversion_context.h"
#include "oox_rels.h"
#include "mediaitems_utils.h"
#include <boost/make_shared.hpp>
#include <simple_xml_writer.h>
namespace oox {
class oox_activeX_context::Impl
{
struct rel_
{
rel_(bool is_internal, std::wstring const & rid, std::wstring const & target, std::wstring const & type) :
is_internal_(is_internal),
rid_(rid),
target_(target),
type_(type)
{}
bool is_internal_;
std::wstring rid_;
std::wstring target_;
std::wstring type_;
};
public:
Impl() {}
std::wstring activeXDataBinRid;
std::wstring activeXClassId;
std::vector<rel_> activeXRels_;
void dump_rels(rels & Rels)
{
for (size_t i = 0; i < activeXRels_.size(); i++)
{
rel_ & r = activeXRels_[i];
Rels.add(relationship(r.rid_, r.type_, r.target_, (r.is_internal_ ? L"" : L"External")));
}
}
void add_rels(
bool isInternal,
std::wstring const & rid,
std::wstring const & target,
std::wstring const & type)
{
bool present = false;
for (size_t i = 0; i < activeXRels_.size(); i++)
{
rel_ & r = activeXRels_[i];
if (r.rid_ == rid && r.target_ == target)
present = true;
}
if (!present)
{
activeXRels_.push_back(rel_(isInternal, rid, target, type));
}
}
};
oox_activeX_context_ptr oox_activeX_context::create()
{
return boost::make_shared<oox_activeX_context>();
}
oox_activeX_context::oox_activeX_context() : impl_(new oox_activeX_context::Impl())
{
}
oox_activeX_context::~oox_activeX_context()
{
}
void oox_activeX_context::setDataBinRid(const std::wstring &rid, const std::wstring &bin_data)
{
impl_->activeXDataBinRid = rid;
impl_->add_rels(true, rid, bin_data, L"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary");
}
void oox_activeX_context::setClassId(const std::wstring &classId)
{
impl_->activeXClassId = classId;
}
void oox_activeX_context::add_rels(
bool isInternal,
std::wstring const & rid,
std::wstring const & target,
external_items::Type type)
{
impl_->add_rels(isInternal, rid, target, utils::media::get_rel_type(type));
}
void oox_activeX_context::dump_rels(rels & Rels)
{
impl_->dump_rels(Rels);
}
void oox_activeX_context::write_to(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"ax:ocx")
{
CP_XML_ATTR(L"xmlns:ax", L"http://schemas.microsoft.com/office/2006/activeX");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"ax:classid", impl_->activeXClassId);
CP_XML_ATTR(L"ax:persistence", L"persistStreamInit");
CP_XML_ATTR(L"r:id", impl_->activeXDataBinRid);
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "oox_package.h"
namespace oox {
class oox_activeX_context;
typedef _CP_PTR(oox_activeX_context) oox_activeX_context_ptr;
class oox_activeX_context
{
public:
oox_activeX_context();
~oox_activeX_context();
void write_to (std::wostream & strm);
void dump_rels (rels & Rels);
static oox_activeX_context_ptr create();
void add_rels( bool isInternal,
std::wstring const & rid,
std::wstring const & target,
external_items::Type type);
void setDataBinRid(const std::wstring &rid, const std::wstring &bin_data);
void setClassId(const std::wstring &classId);
private:
class Impl;
_CP_PTR(Impl) impl_;
};
}
......@@ -107,6 +107,17 @@ oox_external_context & xlsx_conversion_context::current_external()
throw std::runtime_error("internal error");
}
}
oox_activeX_context & xlsx_conversion_context::current_activeX()
{
if (!activeXs_.empty())
{
return *activeXs_.back().get();
}
else
{
throw std::runtime_error("internal error");
}
}
bool xlsx_conversion_context::start_table(const std::wstring & name)
{
sheets_.push_back(xlsx_xml_worksheet::create(name));
......@@ -137,10 +148,18 @@ void xlsx_conversion_context::start_chart()
//этот контекст нужно передавать в файл
}
void xlsx_conversion_context::end_chart()
void xlsx_conversion_context::start_activeX()
{
}
activeXs_.push_back(oox_activeX_context::create());
size_t index = activeXs_.size();
current_sheet().sheet_rels().add(oox::relationship(L"ctrlId" + std::to_wstring(index),
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control",
L"../activeX/activeX" + std::to_wstring(index) +L".xml"));
}
void xlsx_conversion_context::start_external()
{
externals_.push_back(oox_external_context::create());
......@@ -153,7 +172,8 @@ void xlsx_conversion_context::end_external()
void xlsx_conversion_context::end_table()
{
get_table_context().serialize_ole_objects(current_sheet().ole_objects());
get_table_context().dump_rels_ole_objects(current_sheet().sheet_rels());
get_table_context().serialize_activeXs(current_sheet().activeXs());
get_table_context().dump_rels_drawing(current_sheet().sheet_rels());
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
......@@ -235,6 +255,15 @@ void xlsx_conversion_context::end_document()
}
}
for (size_t i = 0; i < activeXs_.size(); i++)
{
package::activeX_content_ptr content = package::activeX_content::create();
activeXs_[i]->dump_rels(content->get_rels());
activeXs_[i]->write_to(content->content());
output_document_->get_xl_files().add_activeX(content);
}
for (size_t i = 0; i < charts_.size(); i++)
{
package::chart_content_ptr content = package::chart_content::create();
......@@ -242,9 +271,8 @@ void xlsx_conversion_context::end_document()
charts_[i]->dump_rels(content->get_rels());
charts_[i]->write_to(content->content());
output_document_->get_xl_files().add_charts(content);
output_document_->get_xl_files().add_chart(content);
}
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", xlsx_shared_strings_.str()) );
......
......@@ -43,6 +43,7 @@
#include "xlsx_comments_context.h"
#include "xlsx_pivots_context.h"
#include "xlsx_external_context.h"
#include "xlsx_activeX_context.h"
#include "xlsx_output_xml.h"
......@@ -71,7 +72,10 @@ public:
void end_table();
void start_chart();
void end_chart();
void end_chart(){}
void start_activeX();
void end_activeX(){}
void start_external();
void end_external();
......@@ -88,6 +92,7 @@ public:
oox_chart_context & current_chart();
oox_external_context & current_external();
oox_activeX_context & current_activeX();
xlsx_pivots_context & get_pivots_context() {return xlsx_pivots_context_;}
xlsx_drawing_context & get_drawing_context();
......@@ -110,6 +115,7 @@ private:
std::vector<oox_chart_context_ptr> charts_;
std::vector<oox_external_context_ptr> externals_;
std::vector<oox_activeX_context_ptr> activeXs_;
//std::wstringstream defaultOutput_;
//std::pair<float,float> maxDigitSize_;
......
......@@ -30,9 +30,6 @@
*
*/
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include "xlsx_conversion_context.h"
#include <simple_xml_writer.h>
......@@ -493,11 +490,17 @@ external_items::Type xlsx_drawing_context::getType()
return current_drawing_states->back()->type;
}
int xlsx_drawing_context::getLevel()
{
if (current_drawing_states == NULL) return -1;
if (current_drawing_states->empty()) return -1;
return current_level;
}
_drawing_state_ptr create_drawing_state()
{
return _drawing_state_ptr(new _drawing_state());
}
void xlsx_drawing_context::start_image()
{
if (current_drawing_states == NULL) return;
......@@ -548,6 +551,32 @@ void xlsx_drawing_context::end_group()
if (current_level < 1) return;
serialize_group();
std::vector<_drawing_state_ptr>* cur_states = NULL;
for (size_t i = 0; i < current_drawing_states->size(); i++)
{
int level = current_level;
cur_states = current_drawing_states;
while (level > 0)
{
_drawing_state_ptr & drawing_state = cur_states->front();
if (i != 0 || level != current_level) // группа сама себя
{
double kf_x = (double)drawing_state->child_anchor.cx / drawing_state->group_anchor.cx;
double kf_y = (double)drawing_state->child_anchor.cy / drawing_state->group_anchor.cy;
current_drawing_states->at(i)->child_anchor.cx *= kf_x;
current_drawing_states->at(i)->child_anchor.cy *= kf_y;
current_drawing_states->at(i)->child_anchor.x = current_drawing_states->at(i)->child_anchor.x * kf_x + drawing_state->child_anchor.x;
current_drawing_states->at(i)->child_anchor.y = current_drawing_states->at(i)->child_anchor.y * kf_y + drawing_state->child_anchor.y;
}
level--;
cur_states = cur_states->front()->parent_drawing_states;
}
}
current_drawing_states = current_drawing_states->front()->parent_drawing_states;
current_level--;
......@@ -716,6 +745,14 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
if ( drawing_state->type == external_items::typeOleObject )
{
serialize_shape(drawing_state);
drawing_states_objects.push_back(drawing_state); // for serialize in sheet
}
if ( drawing_state->type == external_items::typeActiveX)
{
context_.end_activeX();
serialize_shape(drawing_state);
drawing_states_activeX.push_back(drawing_state); // for serialize in sheet
}
if ( drawing_state->type == external_items::typeChart )
{
......@@ -1284,6 +1321,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else if ( drawing_state->type == external_items::typeOleObject )
drawing_state->name = L"Object_" + std::to_wstring(count_object);
else if ( drawing_state->type == external_items::typeActiveX )
drawing_state->name = L"ActiveX_" + std::to_wstring(count_object);
else
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
}
......@@ -2077,7 +2116,7 @@ void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr
if (drawing_state->type_anchor == 1) sNodeAnchor = L"xdr:twoCellAnchor";
else if (drawing_state->type_anchor == 2) sNodeAnchor = L"xdr:oneCellAnchor";
else sNodeAnchor = L"xdr:absoluteAnchor";
else if (drawing_state->type_anchor == 3) sNodeAnchor = L"xdr:absoluteAnchor";
if (sNodeAnchor.empty()) return;
......@@ -2095,10 +2134,106 @@ void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr
}
}
}
void xlsx_drawing_context::serialize_activeX(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
if (drawing_state->type != external_items::typeActiveX) return;
if (drawing_state->type_anchor == 3)
{//absolute
drawing_state->sheet_anchor.colFrom = 1;
drawing_state->sheet_anchor.colTo = 1;
drawing_state->sheet_anchor.rwFrom = 0;
drawing_state->sheet_anchor.rwTo = 0;
drawing_state->sheet_anchor.xFrom = drawing_state->absolute_anchor.x;
drawing_state->sheet_anchor.yFrom = drawing_state->absolute_anchor.y;
drawing_state->sheet_anchor.xTo = drawing_state->absolute_anchor.x + drawing_state->absolute_anchor.cx;
drawing_state->sheet_anchor.yTo = drawing_state->absolute_anchor.y + drawing_state->absolute_anchor.cy;
drawing_state->type_anchor = 1;
}
else if (drawing_state->type_anchor == 0)
{//child in group
drawing_state->sheet_anchor.colFrom = 1;
drawing_state->sheet_anchor.colTo = 1;
drawing_state->sheet_anchor.rwFrom = 0;
drawing_state->sheet_anchor.rwTo = 0;
drawing_state->sheet_anchor.xFrom = drawing_state->child_anchor.x;
drawing_state->sheet_anchor.yFrom = drawing_state->child_anchor.y;
drawing_state->sheet_anchor.xTo = drawing_state->child_anchor.x + drawing_state->child_anchor.cx;
drawing_state->sheet_anchor.yTo = drawing_state->child_anchor.y + drawing_state->child_anchor.cy;
drawing_state->type_anchor = 1;
}
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"control")
{
CP_XML_ATTR(L"shapeId", drawing_state->id);
CP_XML_ATTR(L"r:id", drawing_state->objectId);
if (!drawing_state->objectProgId.empty())
{
CP_XML_ATTR(L"name", drawing_state->objectProgId);
}
CP_XML_NODE(L"controlPr")
{
CP_XML_ATTR(L"defaultSize", 0);
//CP_XML_ATTR(L"autoPict", 0);
if (!drawing_state->fill.texture_target.empty())
{
bool isIternal = false;
std::wstring rId = handle_.impl_->get_mediaitems().find_image( drawing_state->fill.texture_target, isIternal);
CP_XML_ATTR(L"r:id", rId);
sheet_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
}
CP_XML_NODE(L"anchor")
{
CP_XML_ATTR(L"moveWithCells", 1);
serialize_anchor(CP_XML_STREAM(), drawing_state, L"");
}
}
}
}
}
void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
if (drawing_state->type != external_items::typeOleObject) return;
if (drawing_state->type_anchor == 3)
{//absolute
drawing_state->sheet_anchor.colFrom = 1;
drawing_state->sheet_anchor.colTo = 1;
drawing_state->sheet_anchor.rwFrom = 0;
drawing_state->sheet_anchor.rwTo = 0;
drawing_state->sheet_anchor.xFrom = drawing_state->absolute_anchor.x;
drawing_state->sheet_anchor.yFrom = drawing_state->absolute_anchor.y;
drawing_state->sheet_anchor.xTo = drawing_state->absolute_anchor.x + drawing_state->absolute_anchor.cx;
drawing_state->sheet_anchor.yTo = drawing_state->absolute_anchor.y + drawing_state->absolute_anchor.cy;
drawing_state->type_anchor = 1;
}
else if (drawing_state->type_anchor == 0)
{//child in group
drawing_state->sheet_anchor.colFrom = 1;
drawing_state->sheet_anchor.colTo = 1;
drawing_state->sheet_anchor.rwFrom = 0;
drawing_state->sheet_anchor.rwTo = 0;
drawing_state->sheet_anchor.xFrom = drawing_state->child_anchor.x;
drawing_state->sheet_anchor.yFrom = drawing_state->child_anchor.y;
drawing_state->sheet_anchor.xTo = drawing_state->child_anchor.x + drawing_state->child_anchor.cx;
drawing_state->sheet_anchor.yTo = drawing_state->child_anchor.y + drawing_state->child_anchor.cy;
drawing_state->type_anchor = 1;
}
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"oleObject")
......@@ -2162,7 +2297,13 @@ void xlsx_drawing_context::set_ole_object(const std::wstring & id, const std::ws
current_drawing_states->back()->objectId = id;
current_drawing_states->back()->objectProgId = info;
}
void xlsx_drawing_context::set_control(const std::wstring & rid)
{
if (current_drawing_states == NULL) return;
current_drawing_states->back()->type = external_items::typeActiveX;
current_drawing_states->back()->objectId = rid;
}
void xlsx_drawing_context::set_sheet_anchor(int colFrom, int xFrom, int rwFrom, int yFrom, int colTo, int xTo, int rwTo,int yTo)
{
if (current_drawing_states == NULL) return;
......@@ -2928,12 +3069,19 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
}
void xlsx_drawing_context::serialize_objects(std::wostream & strm)
{
for (size_t i = 0; i < drawing_states.size(); i++)
for (size_t i = 0; i < drawing_states_objects.size(); i++)
{
if (drawing_states[i]->type != external_items::typeOleObject) continue;
serialize_object(strm, drawing_states[i]);
serialize_object(strm, drawing_states_objects[i]);
}
drawing_states_objects.clear();
}
void xlsx_drawing_context::serialize_activeXs(std::wostream & strm)
{
for (size_t i = 0; i < drawing_states_activeX.size(); i++)
{
serialize_activeX(strm, drawing_states_activeX[i]);
}
drawing_states_activeX.clear();
}
//-------------------------------------------------------------------------------------------------------------------
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
......
......@@ -322,6 +322,7 @@ public:
~xlsx_drawing_context(){}
external_items::Type getType();
int getLevel();
xlsx_drawings_rels_ptr get_rels();
xlsx_drawings_rels_ptr get_vml_HF_rels();
......@@ -353,6 +354,7 @@ public:
void set_description (const std::wstring & str);
void set_macro (const std::wstring & str);
void set_ole_object (const std::wstring & id, const std::wstring & info);
void set_control (const std::wstring & id);
void set_crop_top (double val);
void set_crop_bottom (double val);
......@@ -448,16 +450,18 @@ public:
void serialize_vml_shape (_drawing_state_ptr & drawing_state);
void serialize_vml_pic (_drawing_state_ptr & drawing_state, std::wstring rId );
//-----------------------------------------------------------------------------------
void serialize_fill (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_fill (std::wostream & stream);
void serialize_fill (std::wostream & strm, _drawing_state_ptr & drawing_state);
void serialize_fill (std::wostream & strm);
//-----------------------------------------------------------------------------------
void serialize (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_object (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_objects (std::wostream & stream);
void serialize (std::wostream & strm, _drawing_state_ptr & drawing_state);
void serialize_object (std::wostream & strm, _drawing_state_ptr & drawing_state);
void serialize_activeX (std::wostream & strm, _drawing_state_ptr & drawing_state);
//-----------------------------------------------------------------------------------
void serialize_vml_HF (std::wostream & stream);
void serialize_vml (std::wostream & stream);
void serialize (std::wostream & stream);
void serialize_activeXs (std::wostream & strm);
void serialize_objects (std::wostream & strm);
void serialize_vml_HF (std::wostream & strm);
void serialize_vml (std::wostream & strm);
void serialize (std::wostream & strm);
//-----------------------------------------------------------------------------------
bool is_lined_shape (_drawing_state_ptr & drawing_state);
void end_drawing();
......@@ -483,6 +487,9 @@ private:
std::vector<_drawing_state_ptr> drawing_states;
std::vector<_drawing_state_ptr>* current_drawing_states;
std::vector<_drawing_state_ptr> drawing_states_objects;//копии для сериализации ole
std::vector<_drawing_state_ptr> drawing_states_activeX;//копии для сериализации activeX
void end_drawing (_drawing_state_ptr & drawing_state);
void reset_fill_pattern (_drawing_state_ptr & drawing_state);
......
......@@ -55,6 +55,7 @@ public:
std::wstringstream sheetData_;
std::wstringstream mergeCells_;
std::wstringstream ole_objects_;
std::wstringstream activeXs_;
std::wstringstream drawing_;
std::wstringstream hyperlinks_;
std::wstringstream comments_;
......@@ -137,6 +138,10 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::activeXs()
{
return impl_->activeXs_;
}
std::wostream & xlsx_xml_worksheet::drawing()
{
......@@ -243,7 +248,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
{
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
}
if (!impl_->activeXs_.str().empty())
{
CP_XML_NODE(L"controls")
{
CP_XML_STREAM() << impl_->activeXs_.str();
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"rowBreaks){}
......
......@@ -61,6 +61,7 @@ public:
std::wostream & mergeCells();
std::wostream & drawing();
std::wostream & ole_objects();
std::wostream & activeXs();
//std::wostream & comments();
std::wostream & sheetSortAndFilters();
std::wostream & pageProperties();
......
......@@ -106,6 +106,15 @@ _CP_PTR(external_content) external_content::create()
return boost::make_shared<external_content>();
}
//--------------------------------------------------------------------------------------------
activeX_content::activeX_content() : rels_file_(rels_file::create(L""))
{
}
_CP_PTR(activeX_content) activeX_content::create()
{
return boost::make_shared<activeX_content>();
}
//--------------------------------------------------------------------------------------------
sheet_content::sheet_content() : rels_(rels_file::create(L""))
{
......@@ -254,14 +263,17 @@ void xl_files::write(const std::wstring & RootPath)
}
{
charts_files_.set_main_document(get_main_document());
charts_files_.write(path);
charts_files_.write(path);
}
{
activeXs_files_.set_main_document(get_main_document());
activeXs_files_.write(path);
}
{
externals_files_.set_rels(&rels_files_);
externals_files_.set_main_document(get_main_document());
externals_files_.write(path);
}
if (drawings_)
{
drawings_->set_main_document(get_main_document());
......@@ -328,10 +340,14 @@ void xl_files::set_vml_drawings(element_ptr Element)
xl_drawings* d = dynamic_cast<xl_drawings*>(vml_drawings_.get());
d->vml = true;
}
void xl_files::add_charts(chart_content_ptr chart)
void xl_files::add_chart(chart_content_ptr chart)
{
charts_files_.add_chart(chart);
}
void xl_files::add_activeX(activeX_content_ptr activeX)
{
activeXs_files_.add_activeX(activeX);
}
void xl_files::add_external(external_content_ptr external)
{
externals_files_.add_external(external);
......@@ -446,23 +462,54 @@ void xl_charts_files::write(const std::wstring & RootPath)
for (size_t i = 0; i < charts_.size(); i++)
{
if (charts_[i])
{
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".xml";
if (!charts_[i])continue;
const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(i + 1) + L".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, charts_[i]->str()).write(path);
package::simple_element(fileName, charts_[i]->str()).write(path);
if (charts_[i]->get_rels().empty() == false)
{
rels_files relFiles;
charts_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(charts_[i]->rels_file_);
relFiles.write(path);
}
}
if (charts_[i]->get_rels().empty() == false)
{
rels_files relFiles;
charts_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(charts_[i]->rels_file_);
relFiles.write(path);
}
}
}
//----------------------------------------------------------------------------------------
void xl_activeX_files::add_activeX(activeX_content_ptr activeX)
{
activeXs_.push_back(activeX);
}
void xl_activeX_files::write(const std::wstring & RootPath)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"activeX";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.ms-office.activeX+xml";
for (size_t i = 0; i < activeXs_.size(); i++)
{
if (!activeXs_[i])continue;
const std::wstring fileName = std::wstring(L"activeX") + std::to_wstring(i + 1) + L".xml";
contentTypes.add_override(std::wstring(L"/xl/activeX/") + fileName, kWSConType);
package::simple_element(fileName, activeXs_[i]->str()).write(path);
if (activeXs_[i]->get_rels().empty() == false)
{
rels_files relFiles;
activeXs_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(activeXs_[i]->rels_file_);
relFiles.write(path);
}
}
}
//----------------------------------------------------------------------------------------
......
......@@ -150,7 +150,16 @@ public:
std::vector<chart_content_ptr> charts_;
};
class xl_activeX_files : public element
{
public:
xl_activeX_files(){}
void add_activeX(activeX_content_ptr activeX);
virtual void write(const std::wstring & RootPath);
std::vector<activeX_content_ptr> activeXs_;
};
class xl_externals_files : public element
{
public:
......@@ -257,7 +266,9 @@ public:
void set_drawings (element_ptr Element);
void set_vml_drawings (element_ptr Element);
void set_comments (element_ptr Element);
void add_charts (chart_content_ptr chart);
void add_chart (chart_content_ptr chart);
void add_activeX (activeX_content_ptr activeX);
void add_external (external_content_ptr external);
void add_pivot_cache (pivot_cache_content_ptr cache);
void add_pivot_table (pivot_table_content_ptr table);
......@@ -270,6 +281,7 @@ private:
xl_externals_files externals_files_;
xl_pivot_cache_files pivot_cache_files_;
xl_pivot_table_files pivot_table_files_;
xl_activeX_files activeXs_files_;
element_ptr theme_;
element_ptr workbook_;
......
......@@ -39,7 +39,6 @@
#include "simple_xml_writer.h"
namespace oox {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -151,15 +150,18 @@ void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_table_context::dump_rels_ole_objects(rels & Rels)
void xlsx_table_context::dump_rels_drawing(rels & Rels)
{
xlsx_drawings_rels_ptr ole_rels = state()->drawing_context_.get_sheet_rels();
xlsx_drawings_rels_ptr drawing_rels = state()->drawing_context_.get_sheet_rels();
ole_rels->dump_rels(Rels);
drawing_rels->dump_rels(Rels);
}
void xlsx_table_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
void xlsx_table_context::serialize_activeXs(std::wostream & strm)
{
state()->drawing_context_.serialize_activeXs(strm);
}
}
......@@ -72,9 +72,9 @@ public:
void dump_rels_hyperlinks(rels & Rels);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_ole_objects(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
void serialize_activeXs(std::wostream & _Wostream);
void dump_rels_drawing(rels & Rels);
private:
xlsx_conversion_context & context_;
......
......@@ -45,12 +45,11 @@ class xlsx_conversion_context;
class xlsx_text_context: boost::noncopyable
{
public:
//xlsx_text_context();
xlsx_text_context();
~xlsx_text_context();
public:
void set_local_styles_container (/*odf_reader::styles_container *local_styles_*/);
void set_cell_text_properties (/*odf_reader::text_format_properties_content *text_properties*/);
void set_local_styles_container ();
void set_cell_text_properties ();
void start_paragraph(const std::wstring & styleName);
void end_paragraph();
......
......@@ -842,6 +842,7 @@ SOURCES += \
../XlsXlsxConverter/xlsx_chart_context.cpp \
../XlsXlsxConverter/xlsx_pivots_context.cpp \
../XlsXlsxConverter/xlsx_external_context.cpp \
../XlsXlsxConverter/xlsx_activeX_context.cpp \
../XlsXlsxConverter/xlsx_comments.cpp \
../XlsXlsxConverter/xlsx_comments_context.cpp \
......@@ -1607,6 +1608,7 @@ HEADERS += \
../XlsXlsxConverter/xlsx_tablecontext.h \
../XlsXlsxConverter/xlsx_textcontext.h \
../XlsXlsxConverter/xlsx_external_context.h \
../XlsXlsxConverter/xlsx_activeX_context.h \
../XlsFormat/Logic/AnyObject.h \
../XlsFormat/Logic/AnySubstream.h \
../XlsFormat/Logic/BaseObject.h \
......
......@@ -344,6 +344,14 @@
RelativePath="..\XlsXlsxConverter\ShapeType.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_activeX_context.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_activeX_context.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_chart_context.cpp"
>
......
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