Commit 20d8bf5e authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - fix CustomViews на linux (guides)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68342 954022d7-b5bf-4e40-9824-e11837661b57
parent 71d548ca
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
#include "HelpFunc.h" #include "HelpFunc.h"
#ifndef _ASC_USE_UNICODE_CONVERTER_ #ifndef _ASC_USE_UNICODE_CONVERTER_
#if defined (_WIN32) || defined (_WIN64) #if defined (_WIN32) || defined (_WIN64)
#include "shlwapi.h" #include "shlwapi.h"
#else #else
#include <iconv.h> #include <iconv.h>
#endif #endif
#else #else
#include "../../../../UnicodeConverter/UnicodeConverter.h" #include "../../../../UnicodeConverter/UnicodeConverter.h"
#endif #endif
#include <Logic/Biff_structures/CellRangeRef.h> #include <Logic/Biff_structures/CellRangeRef.h>
...@@ -229,23 +229,16 @@ const std::string bin2str(const char* buf, const size_t nbuf) ...@@ -229,23 +229,16 @@ const std::string bin2str(const char* buf, const size_t nbuf)
const std::wstring guid2bstr(const _GUID_ guid) const std::wstring guid2bstr(const _GUID_ guid)
{ {
std::wstring guid_ret; std::wstring guid_ret=L"{";
#if defined(_WIN32) || defined(_WIN64)
LPOLESTR guid_str;
GUID guid1={};
memcpy(&guid1, &guid, sizeof(GUID));
if(S_OK != StringFromIID(guid1,&guid_str))
{
// The only case is E_OUTOFMEMORY, so just throw anything
throw;// EXCEPT::LE::WhatIsTheFuck("StringFromIID failed.", "guid2bstr");
}
guid_ret = guid_str;
CoTaskMemFree(guid_str);
#else
//todooooo
#endif guid_ret += int2hex_wstr(guid.Data1, 4) + L"-" +
return guid_ret; int2hex_wstr(guid.Data2, 2) + L"-" +
int2hex_wstr(guid.Data3, 2) + L"-" +
int2hex_wstr(guid.Data4[0], 1) + int2hex_wstr(guid.Data4[1], 1) + L"-" +
int2hex_wstr(guid.Data4[2], 1) + int2hex_wstr(guid.Data4[3], 1) +
int2hex_wstr(guid.Data4[4], 1) + int2hex_wstr(guid.Data4[5], 1) +
int2hex_wstr(guid.Data4[6], 1) + int2hex_wstr(guid.Data4[7], 1);
return guid_ret + L"}";
} }
...@@ -258,25 +251,25 @@ const std::string guid2str(const _GUID_ guid) ...@@ -258,25 +251,25 @@ const std::string guid2str(const _GUID_ guid)
const bool bstr2guid(const std::wstring & guid_str, _GUID_& guid) const bool bstr2guid(const std::wstring & guid_str, _GUID_& guid)
{ {
#if defined(_WIN32) || defined(_WIN64) //#if defined(_WIN32) || defined(_WIN64)
//
GUID guid1={}; // GUID guid1={};
HRESULT res = IIDFromString((LPWSTR)(guid_str.c_str()), &guid1); // HRESULT res = IIDFromString((LPWSTR)(guid_str.c_str()), &guid1);
if(S_OK != res) // if(S_OK != res)
{ // {
switch(res) // switch(res)
{ // {
case E_INVALIDARG: // case E_INVALIDARG:
return false; // return false;
case E_OUTOFMEMORY: // case E_OUTOFMEMORY:
throw;// EXCEPT::LE::WhatIsTheFuck("IIDFromString failed.", "bstr2guid"); // throw;// EXCEPT::LE::WhatIsTheFuck("IIDFromString failed.", "bstr2guid");
} // }
} // }
else memcpy(&guid, &guid1, sizeof(guid1)); // else memcpy(&guid, &guid1, sizeof(guid1));
#else //#else
//todooooo // //todooooo
//
#endif //#endif
return true; return true;
} }
......
...@@ -23,11 +23,8 @@ public: ...@@ -23,11 +23,8 @@ public:
static const ElementType type = typeGUIDTypeLib; static const ElementType type = typeGUIDTypeLib;
//----------------------------- //-----------------------------
BIFF_BSTR guid; std::wstring guid;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(guid)
//BO_ATTRIB_MARKUP_END
}; };
......
...@@ -31,6 +31,7 @@ void HLink::readFields(CFRecord& record) ...@@ -31,6 +31,7 @@ void HLink::readFields(CFRecord& record)
{ {
_GUID_ clsid; _GUID_ clsid;
record >> ref8 >> clsid >> hyperlink; record >> ref8 >> clsid >> hyperlink;
hlinkClsid = STR::guid2bstr(clsid); hlinkClsid = STR::guid2bstr(clsid);
} }
......
...@@ -24,11 +24,12 @@ public: ...@@ -24,11 +24,12 @@ public:
static const ElementType type = typeHeaderFooter; static const ElementType type = typeHeaderFooter;
//----------------------------- //-----------------------------
BIFF_BSTR guidSView; std::wstring guidSView;
bool fHFDiffOddEven; bool fHFDiffOddEven;
bool fHFDiffFirst; bool fHFDiffFirst;
bool fHFScaleWithDoc; bool fHFScaleWithDoc;
bool fHFAlignMargins; bool fHFAlignMargins;
BIFF_WORD cchHeaderEven; BIFF_WORD cchHeaderEven;
BIFF_WORD cchFooterEven; BIFF_WORD cchFooterEven;
BIFF_WORD cchHeaderFirst; BIFF_WORD cchHeaderFirst;
...@@ -39,23 +40,6 @@ public: ...@@ -39,23 +40,6 @@ public:
XLUnicodeString strHeaderFirst; XLUnicodeString strHeaderFirst;
XLUnicodeString strFooterFirst; XLUnicodeString strFooterFirst;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(guidSView)
//BO_ATTRIB_MARKUP_ATTRIB(fHFDiffOddEven)
//BO_ATTRIB_MARKUP_ATTRIB(fHFDiffFirst)
//BO_ATTRIB_MARKUP_ATTRIB(fHFScaleWithDoc)
//BO_ATTRIB_MARKUP_ATTRIB(fHFAlignMargins)
// //BO_ATTRIB_MARKUP_ATTRIB(cchHeaderEven)
// //BO_ATTRIB_MARKUP_ATTRIB(cchFooterEven)
// //BO_ATTRIB_MARKUP_ATTRIB(cchHeaderFirst)
// //BO_ATTRIB_MARKUP_ATTRIB(cchFooterFirst)
//BO_ATTRIB_MARKUP_ATTRIB(strHeaderEven)
//BO_ATTRIB_MARKUP_ATTRIB(strFooterEven)
//BO_ATTRIB_MARKUP_ATTRIB(strHeaderFirst)
//BO_ATTRIB_MARKUP_ATTRIB(strFooterFirst)
//BO_ATTRIB_MARKUP_END
}; };
} // namespace XLS } // namespace XLS
......
...@@ -113,6 +113,7 @@ void UserBView::readFields(CFRecord& record) ...@@ -113,6 +113,7 @@ void UserBView::readFields(CFRecord& record)
_GUID_ guid_num; _GUID_ guid_num;
record >> guid_num >> x >> y >> dx >> dy >> wTabRatio; record >> guid_num >> x >> y >> dx >> dy >> wTabRatio;
guid = STR::guid2bstr(guid_num); guid = STR::guid2bstr(guid_num);
unsigned short flags1; unsigned short flags1;
...@@ -183,7 +184,7 @@ int UserBView::serialize(std::wostream & stream) ...@@ -183,7 +184,7 @@ int UserBView::serialize(std::wostream & stream)
CP_XML_ATTR(L"windowWidth", dx); CP_XML_ATTR(L"windowWidth", dx);
CP_XML_ATTR(L"windowHeight", dy); CP_XML_ATTR(L"windowHeight", dy);
CP_XML_ATTR(L"activeSheetId", tabId); CP_XML_ATTR(L"activeSheetId", tabId);
CP_XML_ATTR(L"guid", *guid.value()); CP_XML_ATTR(L"guid", guid);
CP_XML_ATTR(L"mergeInterval", wMergeInterval); CP_XML_ATTR(L"mergeInterval", wMergeInterval);
if (fTimedUpdate) CP_XML_ATTR(L"autoUpdate" , true); if (fTimedUpdate) CP_XML_ATTR(L"autoUpdate" , true);
......
...@@ -25,15 +25,15 @@ public: ...@@ -25,15 +25,15 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
//----------------------------- //-----------------------------
BIFF_WORD tabId; BIFF_WORD tabId;
BIFF_BSTR guid; std::wstring guid;
BIFF_DWORD x; BIFF_DWORD x;
BIFF_DWORD y; BIFF_DWORD y;
BIFF_DWORD dx; BIFF_DWORD dx;
BIFF_DWORD dy; BIFF_DWORD dy;
BIFF_WORD wTabRatio; BIFF_WORD wTabRatio;
bool fDspFmlaBar; bool fDspFmlaBar;
bool fDspStatus; bool fDspStatus;
......
...@@ -98,7 +98,9 @@ void UserSViewBegin::readFields(CFRecord& record) ...@@ -98,7 +98,9 @@ void UserSViewBegin::readFields(CFRecord& record)
{ {
_GUID_ guid_num; _GUID_ guid_num;
record >> guid_num >> iTabid; record >> guid_num >> iTabid;
guid = STR::guid2bstr(guid_num); guid = STR::guid2bstr(guid_num);
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
record >> wScale >> icvHdr; record >> wScale >> icvHdr;
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
......
...@@ -24,11 +24,11 @@ public: ...@@ -24,11 +24,11 @@ public:
static const ElementType type = typeUserSViewBegin; static const ElementType type = typeUserSViewBegin;
//----------------------------- //-----------------------------
BIFF_BSTR guid; std::wstring guid;
TabId iTabid; TabId iTabid;
BIFF_DWORD wScale; BIFF_DWORD wScale;
Icv icvHdr; Icv icvHdr;
PaneType pnnSel; PaneType pnnSel;
bool fShowBrks; bool fShowBrks;
bool fDspFmlaSv; bool fDspFmlaSv;
......
...@@ -13,20 +13,6 @@ BiffStructurePtr FtNts::clone() ...@@ -13,20 +13,6 @@ BiffStructurePtr FtNts::clone()
} }
//void FtNts::setXMLAttributes(MSXML2::IXMLDOMElementPtr own_tag)
//{
// own_tag->setAttribute(L"guid", guid);
// own_tag->setAttribute(L"fSharedNote", fSharedNote);
//}
//
//
//void FtNts::getXMLAttributes(MSXML2::IXMLDOMElementPtr own_tag)
//{
// guid = getStructAttribute(own_tag, L"guid");
// fSharedNote = static_cast<bool>(getStructAttribute(own_tag, L"fSharedNote"));
//}
void FtNts::store(CFRecord& record) void FtNts::store(CFRecord& record)
{ {
unsigned short ft = 0x0D; // reserved unsigned short ft = 0x0D; // reserved
...@@ -48,7 +34,9 @@ void FtNts::load(CFRecord& record) ...@@ -48,7 +34,9 @@ void FtNts::load(CFRecord& record)
_GUID_ guid_num; _GUID_ guid_num;
record >> guid_num >> fSharedNote; record >> guid_num >> fSharedNote;
guid = STR::guid2bstr(guid_num); guid = STR::guid2bstr(guid_num);
record.skipNunBytes(4); record.skipNunBytes(4);
} }
......
...@@ -23,33 +23,6 @@ BiffStructurePtr NoteRR::clone() ...@@ -23,33 +23,6 @@ BiffStructurePtr NoteRR::clone()
} }
//void NoteRR::toXML(BiffStructurePtr & parent)
//{
// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent);
//
// rrd.toXML(own_tag);
// own_tag->setAttribute(L"bitfDelNote", bitfDelNote);
// own_tag->setAttribute(L"bitfAddNote", bitfAddNote);
// own_tag->setAttribute(L"row", row);
// own_tag->setAttribute(L"col", col);
// own_tag->setAttribute(L"fShow", fShow);
// own_tag->setAttribute(L"fRwHidden", fRwHidden);
// own_tag->setAttribute(L"fColHidden", fColHidden);
// own_tag->setAttribute(L"guid", STR::guid2bstr(guid));
// own_tag->setAttribute(L"ichEnd", ichEnd);
// own_tag->setAttribute(L"cchNote", cchNote);
// own_tag->setAttribute(L"stAuthor", stAuthor);
//}
//
//
//const bool NoteRR::fromXML(BiffStructurePtr & parent)
//{
//#pragma message("####################### NoteRR record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! NoteRR record has no BiffStructure::fromXML() implemented.");
// return false;
//}
void NoteRR::store(CFRecord& record) void NoteRR::store(CFRecord& record)
{ {
#pragma message("####################### NoteRR record has no BiffStructure::store() implemented") #pragma message("####################### NoteRR record has no BiffStructure::store() implemented")
......
...@@ -44,6 +44,7 @@ void URLMoniker::load(XLS::CFRecord& record) ...@@ -44,6 +44,7 @@ void URLMoniker::load(XLS::CFRecord& record)
{ {
_GUID_ guid; _GUID_ guid;
record >> guid >> serialVersion >> uriFlags; record >> guid >> serialVersion >> uriFlags;
serialGUID = STR::guid2bstr(guid); serialGUID = STR::guid2bstr(guid);
} }
} }
......
...@@ -105,7 +105,7 @@ int CUSTOMVIEW::serialize(std::wostream & stream) ...@@ -105,7 +105,7 @@ int CUSTOMVIEW::serialize(std::wostream & stream)
{ {
CP_XML_NODE(L"customSheetView") CP_XML_NODE(L"customSheetView")
{ {
CP_XML_ATTR(L"guid", *userSView->guid.value()); CP_XML_ATTR(L"guid", userSView->guid);
CP_XML_ATTR(L"showGridLines", userSView->fDspGridSv); CP_XML_ATTR(L"showGridLines", userSView->fDspGridSv);
if (userSView->wScale != 100) CP_XML_ATTR(L"scale", userSView->wScale); if (userSView->wScale != 100) CP_XML_ATTR(L"scale", userSView->wScale);
......
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