Commit 08ce8cb3 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat ...

parent 5efe043a
...@@ -89,17 +89,16 @@ public: ...@@ -89,17 +89,16 @@ public:
struct _ struct _
{ {
_() : bFill(false), enabled(false), fill(0), line(0), flag(0), flag2(0) {} bool enabled = false;
bool enabled;
ODRAW::OfficeArtRecordPtr anchor; ODRAW::OfficeArtRecordPtr anchor;
std::vector<BaseObjectPtr> additional; std::vector<BaseObjectPtr> additional;
bool bFill; bool bFill = false;
ShortXLAnsiString name; ShortXLAnsiString name;
_UINT32 fill; _UINT32 fill = 0;
_UINT32 line; _UINT32 line = 0;
_UINT16 flag; _UINT16 flag = 0;
_UINT16 flag2; _UINT16 flag2 = 0;
}old_version; }old_version;
}; };
......
...@@ -53,7 +53,10 @@ void PictFmlaKey::load(CFRecord& record) ...@@ -53,7 +53,10 @@ void PictFmlaKey::load(CFRecord& record)
{ {
char *buf = new char[cbKey]; char *buf = new char[cbKey];
memcpy(buf, record.getCurData<char>(), cbKey); memcpy(buf, record.getCurData<char>(), cbKey);
keyBuf = std::string(buf, cbKey);
std::string str = std::string(buf, cbKey);
keyBuf =std::wstring(str.begin(), str.end());
record.skipNunBytes(cbKey); record.skipNunBytes(cbKey);
delete []buf; delete []buf;
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "BiffStructure.h" #include "BiffStructure.h"
#include "ObjFmla.h" #include "ObjFmla.h"
#include <Logic/Biff_structures/FtPioGrbit.h> #include "FtPioGrbit.h"
namespace XLS namespace XLS
{ {
...@@ -51,8 +51,8 @@ public: ...@@ -51,8 +51,8 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
_UINT32 cbKey; _UINT32 cbKey;
std::string keyBuf; // ActiveX license key std::wstring keyBuf; // ActiveX license key
ObjFmla fmlaLinkedCell; ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange; ObjFmla fmlaListFillRange;
......
...@@ -1969,8 +1969,9 @@ void XlsConverter::convert(XLS::Obj * obj) ...@@ -1969,8 +1969,9 @@ void XlsConverter::convert(XLS::Obj * obj)
xlsx_context->get_drawing_context().set_control(objectId); xlsx_context->get_drawing_context().set_control(objectId);
xlsx_context->current_activeX().setClassId(info);
xlsx_context->current_activeX().setDataBinRid(objectId, target); xlsx_context->current_activeX().setDataBinRid(objectId, target);
xlsx_context->current_activeX().setProgId(info);
xlsx_context->current_activeX().setLicense(obj->pictFmla.key.keyBuf);
} }
else if (!obj->pictFlags.fPrstm) else if (!obj->pictFlags.fPrstm)
......
...@@ -59,8 +59,9 @@ class oox_activeX_context::Impl ...@@ -59,8 +59,9 @@ class oox_activeX_context::Impl
public: public:
Impl() {} Impl() {}
std::wstring activeXDataBinRid; std::wstring dataBinRid;
std::wstring activeXClassId; std::wstring progId;
std::wstring license;
std::vector<rel_> activeXRels_; std::vector<rel_> activeXRels_;
...@@ -110,13 +111,17 @@ oox_activeX_context::~oox_activeX_context() ...@@ -110,13 +111,17 @@ oox_activeX_context::~oox_activeX_context()
} }
void oox_activeX_context::setDataBinRid(const std::wstring &rid, const std::wstring &bin_data) void oox_activeX_context::setDataBinRid(const std::wstring &rid, const std::wstring &bin_data)
{ {
impl_->activeXDataBinRid = rid; impl_->dataBinRid = rid;
impl_->add_rels(true, rid, bin_data, L"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"); 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) void oox_activeX_context::setProgId(const std::wstring &progId)
{ {
impl_->activeXClassId = classId; impl_->progId = progId;
}
void oox_activeX_context::setLicense(const std::wstring &license)
{
impl_->license = license;
} }
void oox_activeX_context::add_rels( void oox_activeX_context::add_rels(
bool isInternal, bool isInternal,
...@@ -132,16 +137,95 @@ void oox_activeX_context::dump_rels(rels & Rels) ...@@ -132,16 +137,95 @@ void oox_activeX_context::dump_rels(rels & Rels)
} }
void oox_activeX_context::write_to(std::wostream & strm) void oox_activeX_context::write_to(std::wostream & strm)
{ {
//https://msdn.microsoft.com/en-us/library/ff533853(v=office.12).aspx
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"ax:ocx") CP_XML_NODE(L"ax:ocx")
{ {
CP_XML_ATTR(L"xmlns:ax", L"http://schemas.microsoft.com/office/2006/activeX"); std::wstring classId;
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
if (std::wstring::npos != impl_->progId.find(L"Forms.")) // Microsoft Forms 2.0
CP_XML_ATTR(L"ax:classid", impl_->activeXClassId); {
if (std::wstring::npos != impl_->progId.find(L".CommandButton."))
{
classId = L"{D7053240-CE69-11CD-A777-00DD01143C57}";
}
else if (std::wstring::npos != impl_->progId.find(L".CheckBox."))
{
classId = L"{8BD21D40-EC42-11CE-9E0D-00AA006002F3}";
}
else if (std::wstring::npos != impl_->progId.find(L".ComboBox."))
{
classId = L"{8BD21D30-EC42-11CE-9E0D-00AA006002F3}";
}
else if (std::wstring::npos != impl_->progId.find(L".Form."))
{
classId = L"{C62A69F0-16DC-11CE-9E98-00AA00574A4F}";
}
else if (std::wstring::npos != impl_->progId.find(L".Frame."))
{
classId = L"{6E182020-F460-11CE-9BCD-00AA00608E01}";
}
else if (std::wstring::npos != impl_->progId.find(L".Image."))
{
classId = L"{4C599241-6926-101B-9992-00000B65C6F9}";
}
else if (std::wstring::npos != impl_->progId.find(L".OptionButton."))
{
classId = L"{8BD21D50-EC42-11CE-9E0D-00AA006002F3}";
}
else if (std::wstring::npos != impl_->progId.find(L".Label."))
{
classId = L"{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}";
}
else if (std::wstring::npos != impl_->progId.find(L".ListBox."))
{
classId = L"{8BD21D20-EC42-11CE-9E0D-00AA006002F3}";
}
else if (std::wstring::npos != impl_->progId.find(L".ScrollBar."))
{
classId = L"{DFD181E0-5E2F-11CE-A449-00AA004A803D}";
}
else if (std::wstring::npos != impl_->progId.find(L".SpinButton."))
{
classId = L"{79176FB0-B7F2-11CE-97EF-00AA006D2776}";
}
else if (std::wstring::npos != impl_->progId.find(L".TabStrip."))
{
classId = L"{EAE50EB0-4A62-11CE-BED6-00AA00611080}";
}
else if (std::wstring::npos != impl_->progId.find(L".TextBox."))
{
classId = L"{8BD21D10-EC42-11CE-9E0D-00AA006002F3}";
}
}
if (!classId.empty())
{
//classId = L"{00000000-0000-0000-0000-000000000000}";
CP_XML_ATTR(L"ax:classid", classId);
}
CP_XML_ATTR(L"ax:persistence", L"persistStreamInit"); CP_XML_ATTR(L"ax:persistence", L"persistStreamInit");
CP_XML_ATTR(L"r:id", impl_->activeXDataBinRid); CP_XML_ATTR(L"r:id", impl_->dataBinRid);
if (!impl_->license.empty())
{
CP_XML_ATTR(L"ax:license", impl_->license);
}
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");
//if (!impl_->progId.empty())
//{
// CP_XML_NODE(L"ax:ocxPr")
// {
// CP_XML_ATTR(L"ax:name", L"Name");
// CP_XML_ATTR(L"ax:value", impl_->progId);
// }
//}
} }
} }
} }
......
...@@ -53,7 +53,8 @@ public: ...@@ -53,7 +53,8 @@ public:
external_items::Type type); external_items::Type type);
void setDataBinRid(const std::wstring &rid, const std::wstring &bin_data); void setDataBinRid(const std::wstring &rid, const std::wstring &bin_data);
void setClassId(const std::wstring &classId); void setProgId(const std::wstring &classId);
void setLicense(const std::wstring &license);
private: private:
class Impl; class Impl;
_CP_PTR(Impl) impl_; _CP_PTR(Impl) impl_;
......
...@@ -2172,9 +2172,9 @@ void xlsx_drawing_context::serialize_activeX(std::wostream & stream, _drawing_st ...@@ -2172,9 +2172,9 @@ void xlsx_drawing_context::serialize_activeX(std::wostream & stream, _drawing_st
CP_XML_ATTR(L"shapeId", drawing_state->id); CP_XML_ATTR(L"shapeId", drawing_state->id);
CP_XML_ATTR(L"r:id", drawing_state->objectId); CP_XML_ATTR(L"r:id", drawing_state->objectId);
if (!drawing_state->objectProgId.empty()) if (!drawing_state->name.empty())
{ {
CP_XML_ATTR(L"name", drawing_state->objectProgId); CP_XML_ATTR(L"name", drawing_state->name);
} }
CP_XML_NODE(L"controlPr") CP_XML_NODE(L"controlPr")
...@@ -2274,12 +2274,14 @@ void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_sta ...@@ -2274,12 +2274,14 @@ void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_sta
void xlsx_drawing_context::set_name(const std::wstring & str) void xlsx_drawing_context::set_name(const std::wstring & str)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (str.empty()) return;
current_drawing_states->back()->name = str; current_drawing_states->back()->name = str;
} }
void xlsx_drawing_context::set_description(const std::wstring & str) void xlsx_drawing_context::set_description(const std::wstring & str)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (str.empty()) return;
current_drawing_states->back()->description = str; current_drawing_states->back()->description = str;
} }
......
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