Commit 50fe29e4 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58990 954022d7-b5bf-4e40-9824-e11837661b57
parent 7429017e
......@@ -8,12 +8,12 @@
#include "XlsFormat\Binary\CompoundFile.h"
#include "XlsFormat\Binary\BinSmartPointers.h"
#include "XlsFormat\Binary\CFStreamCacheReader.h"
#include "XlsFormat\Binary\CFStreamCacheWriter.h"
//#include "XlsFormat\Binary\CFStreamCacheWriter.h"
#include "XlsFormat\Logic\GlobalWorkbookInfo.h"
#include "XlsFormat\Logic\WorkbookStreamObject.h"
#include "XlsFormat\Logic\BinProcessor.h"
#include "XlsFormat\Logic\SummaryInformationStream\SummaryInformation.h"
#include "XlsFormat\Auxiliary\HelpersTagsGenerator.h"
//#include "XlsFormat\Auxiliary\HelpersTagsGenerator.h"
HRESULT ConvertXls2Xlsx(const std::wstring &ext, const std::wstring & srcFile, const std::wstring & dstPath, bool bOnlyPresentation, const ProgressCallback* CallBack)
{
......@@ -21,9 +21,9 @@ HRESULT ConvertXls2Xlsx(const std::wstring &ext, const std::wstring & srcFile, c
try
{
XLS::CompoundFile cfile(srcFile, CompoundFile::cf_ReadMode);
XLS::CompoundFile cfile(srcFile, XLS::CompoundFile::cf_ReadMode);
Document doc;
Document doc(dstPath);
XLS::CFStreamPtr summary;
XLS::CFStreamPtr doc_summary;
......@@ -46,31 +46,33 @@ HRESULT ConvertXls2Xlsx(const std::wstring &ext, const std::wstring & srcFile, c
return AVS_ERROR_UNEXPECTED;
}
WORD workbook_code_page = WorkbookStreamObject::DefaultCodePage;
WORD workbook_code_page = XLS::WorkbookStreamObject::DefaultCodePage;
if(summary)
{
XLS::OLEPS::SummaryInformation summary_info(summary);
OLEPS::SummaryInformation summary_info(summary);
workbook_code_page = summary_info.GetCodePage();
}
else if(doc_summary)
{
XLS::OLEPS::SummaryInformation doc_summary_info(doc_summary);
OLEPS::SummaryInformation doc_summary_info(doc_summary);
workbook_code_page = doc_summary_info.GetCodePage();
}
if(1200/* UTF-16 */ == workbook_code_page || 0/*error*/ == workbook_code_page)
{
workbook_code_page = WorkbookStreamObject::DefaultCodePage;
workbook_code_page = XLS::WorkbookStreamObject::DefaultCodePage;
}
XLS::GlobalWorkbookInfoPtr global_info(new GlobalWorkbookInfo(workbook_code_page));
XLS::GlobalWorkbookInfoPtr global_info(new XLS::GlobalWorkbookInfo(workbook_code_page));
XLS::CFStreamCacheReader stream_reader(cfile.getWorkbookStream(), global_info);
XLS::BinReaderProcessor proc(stream_reader, doc.getRoot(), true);
//XLS::BiffStructurePtr root = boost::shared_ptr<XLS::BiffStructure>(new XLS::BiffStructure());
XLS::BinReaderProcessor proc(stream_reader , true);
return proc.mandatory(WorkbookStreamObject(workbook_code_page)) &&
XLS::AUX::HelpersTagsGenerator(doc.getRoot()).GenHelpers();
proc.mandatory(XLS::WorkbookStreamObject(workbook_code_page));
return S_OK;
}
catch(...)
......
......@@ -181,6 +181,14 @@
RelativePath=".\XlsFormat\Binary\CFStreamCacheReader.h"
>
</File>
<File
RelativePath=".\XlsFormat\Binary\CFStreamCacheWriter.cpp"
>
</File>
<File
RelativePath=".\XlsFormat\Binary\CFStreamCacheWriter.h"
>
</File>
<File
RelativePath=".\XlsFormat\Binary\CompoundFile.cpp"
>
......
......@@ -518,17 +518,17 @@ const std::wstring xti_indexes2sheet_name(const short itabFirst, const short ita
}
return escaped_prefix;
}
//
//const std::wstring make3dRef(const unsigned __int16 ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed)
//{
// std::wstring sheets_prefix = xti2sheets(ixti, xti_parsed);
// if(L"#REF!" == sheets_prefix)
// {
// return sheets_prefix;
// }
// return sheets_prefix + L'!' + cell_ref;
//}
//
const std::wstring make3dRef(const unsigned __int16 ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed)
{
std::wstring sheets_prefix = xti2sheets(ixti, xti_parsed);
if(L"#REF!" == sheets_prefix)
{
return sheets_prefix;
}
return sheets_prefix + L'!' + cell_ref;
}
//
//const std::wstring sheet_name2tabid(const std::wstring sheet_name, MSXML2::IXMLDOMDocumentPtr doc)
//{
......
......@@ -14,6 +14,10 @@ BinProcessor::BinProcessor(BiffStructurePtr & parent, GlobalWorkbookInfoPtr glob
global_info_(global_info)
{
}
BinProcessor::BinProcessor( GlobalWorkbookInfoPtr global_info)
: global_info_(global_info)
{
}
BinProcessor::~BinProcessor()
......@@ -52,6 +56,12 @@ BinReaderProcessor::BinReaderProcessor(CFStreamCacheReader& reader, BiffStructur
{
}
BinReaderProcessor::BinReaderProcessor(CFStreamCacheReader& reader, const bool is_mandatory)
: reader_(reader),
BinProcessor(reader.getGlobalWorkbookInfo()),
is_mandatory_(is_mandatory)
{
}
const bool BinReaderProcessor::optional(BaseObject& object)
{
......
......@@ -23,6 +23,7 @@ class BinProcessor
{
public:
BinProcessor(BiffStructurePtr & parent, GlobalWorkbookInfoPtr global_info);
BinProcessor(GlobalWorkbookInfoPtr global_info);
~BinProcessor();
// This function doesn't
......@@ -73,6 +74,7 @@ class BinReaderProcessor : public BinProcessor
{
public:
BinReaderProcessor(CFStreamCacheReader& reader, BiffStructurePtr parent, const bool is_mandatory);
BinReaderProcessor(CFStreamCacheReader& reader, const bool is_mandatory); //root ???
virtual const bool optional(BaseObject& object);
virtual const bool mandatory(BaseObject& object);
......
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