Commit 65e7372c authored by ElenaSubbotina's avatar ElenaSubbotina

Merge remote-tracking branch 'origin/release/v5.0.0' into develop

parents 1ea27ad7 2ce57085
......@@ -75,6 +75,8 @@ namespace DocFileFormat
while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] )
{
int cpStart = cp;
int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
......@@ -93,6 +95,8 @@ namespace DocFileFormat
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
}
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
cp++;
}
m_pXmlWriter->WriteNodeEnd( L"w:footnote");
......
......@@ -124,11 +124,14 @@ namespace DocFileFormat
TableInfo tai(papx);
if (tai.fInTable)
{
int cpStart = cp;
//this PAPX is for a table
//cp = writeTable( cp, tai.iTap );
Table table( this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ) );
table.Convert(this);
cp = table.GetCPEnd();
while (cp <= cpStart) //conv_eznHsm8em2unSv6_2QE__docx.doc
cp++;
}
else
{
......
......@@ -2,34 +2,38 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\OfficeUtils\win32\OfficeUtilsLib.vcproj", "{F8274B05-168E-4D6E-B843-AA7510725363}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
......@@ -54,17 +58,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOffic
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
......
......@@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\..\Common\OfficeDrawing;&quot;..\..\..\..\..\DesktopEditor\freetype-2.5.2\include&quot;;..\..\..\..\..\Common\OfficeDrawing\Shapes"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
BasicRuntimeChecks="3"
......
......@@ -43,6 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
......
......@@ -74,6 +74,8 @@ xlsx_document::xlsx_document()
void xlsx_document::write(const std::wstring & RootPath)
{
_CP_LOG << L"[info][xlsx] process writing" << std::endl;
xl_files_.write (RootPath);
docProps_files_.write (RootPath);
rels_files_.write (RootPath);
......
......@@ -160,7 +160,10 @@ void xlsx_table_state::set_table_row_group(int count, bool collapsed, int level)
group_row_.collapsed = collapsed;
group_row_.level = level;
}
void xlsx_table_state::add_empty_row(int count)
{
current_table_row_ += count;
}
void xlsx_table_state::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
{
empty_row_ = true;
......
......@@ -89,6 +89,8 @@ public:
void non_empty_row ();
bool is_empty_row () const;
void end_row ();
void add_empty_row(int count);
std::wstring current_row_style () const;
std::wstring default_row_cell_style () const;
......
......@@ -356,7 +356,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
*/
}
// table-table-cell-content
//////////////////////////////////////////////////////////////////////////////////////////////////
std::wostream & table_table_cell_content::text_to_stream(std::wostream & _Wostream) const
......@@ -393,9 +392,14 @@ void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring
void table_table_cell::add_text(const std::wstring & Text)
{
}
bool table_table_cell::empty()
{
if (!content_.elements_.empty()) return false;
if (attlist_.table_formula_) return false;
return true;
}
// table:covered-table-cell
// table-covered-table-cell
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_covered_table_cell::ns = L"table";
const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
......@@ -412,13 +416,19 @@ void table_covered_table_cell::add_attributes( const xml::attributes_wc_ptr & At
void table_covered_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
empty_ = false;
content_.add_child_element(Reader, Ns, Name, getContext());
}
void table_covered_table_cell::add_text(const std::wstring & Text)
{
}
bool table_covered_table_cell::empty()
{
if (!content_.elements_.empty()) return false;
if (attlist_.table_formula_) return false;
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-row
......@@ -445,7 +455,38 @@ void table_table_row::add_child_element( xml::sax * Reader, const std::wstring &
else
CP_NOT_APPLICABLE_ELM();
}
bool table_table_row::empty()
{
if (content_.empty() && !attlist_.table_style_name_ && !attlist_.table_default_cell_style_name_) return true;
return false;
}
bool table_table_row::empty_content_cells()
{
bool res = true;
for (size_t i = 0 ; i < content_.size(); i++)
{
table_table_cell *cell = dynamic_cast<table_table_cell*>(content_[i].get());
table_covered_table_cell *cover_cell = dynamic_cast<table_covered_table_cell*>(content_[i].get());
if (!cell && !cover_cell)
{
res = false;
break;
}
if (cell && cell->empty() == false)
{
res = false;
break;
}
if (cover_cell && cover_cell->empty() == false)
{
res = false;
break;
}
}
return res;
}
// table:table-rows
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_rows::ns = L"table";
......
......@@ -361,6 +361,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
bool empty();
bool empty_content_cells();
table_table_row_attlist attlist_;
office_element_ptr_array content_; // table-table-cell or table-covered-table-cell
......@@ -408,6 +411,7 @@ private:
public:
bool last_cell_;
bool empty();
table_table_cell_attlist attlist_;
table_table_cell_attlist_extra attlist_extra_;
......@@ -427,7 +431,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
table_covered_table_cell() : last_cell_(false), empty_(true) {}
table_covered_table_cell() : last_cell_(false){}
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
......@@ -443,7 +447,7 @@ private:
public:
bool last_cell_;
bool empty_;
bool empty();
table_table_cell_attlist attlist_;
table_table_cell_content content_;
......
......@@ -54,6 +54,7 @@ void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::w
}
void table_data_pilot_tables::xlsx_convert(oox::xlsx_conversion_context & Context)
{
return;
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
......
......@@ -78,6 +78,17 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (attlist_.table_number_rows_repeated_ > 1 && empty())
{
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return;
}
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
{
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
}
std::wostream & strm = Context.current_sheet().sheetData();
///обработка чтилей для роу -
size_t Default_Cell_style_in_row_ = 0;
......@@ -259,20 +270,22 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_row* row_last = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 1].get());
table_table_row* row_last_1 = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 2].get());
if (row_last->attlist_.table_number_rows_repeated_ > 1000 &&
row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
if (row_last->empty_content_cells() && row_last_1->empty_content_cells())
{
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
if (style == style_1)//check for empty also ????
if (row_last->attlist_.table_number_rows_repeated_ > 1000 &&
row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
{
row_last_1->attlist_.table_number_rows_repeated_ = 1024;
table_table_row_.pop_back();
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
if (style == style_1)//check for empty also ????
{
row_last_1->attlist_.table_number_rows_repeated_ = 1024;
table_table_row_.pop_back();
}
}
}
}
for (size_t i = 0; i < table_table_row_.size(); i++)
{
......
......@@ -125,6 +125,19 @@ namespace NSBinPptxRW
m_lIndexNextImage = 0;
m_lIndexCounter = 0;
}
void CImageManager2::SetDstFolder(const std::wstring& strDst)
{
m_strDstFolder = strDst;
m_strDstMedia = m_strDstFolder + FILE_SEPARATOR_STR + _T("media");
m_strDstEmbed = m_strDstFolder + FILE_SEPARATOR_STR + _T("embeddings");
NSDirectory::CreateDirectory(m_strDstMedia);
NSDirectory::CreateDirectory(m_strDstEmbed);
}
std::wstring CImageManager2::GetDstFolder()
{
return m_strDstFolder;
}
void CImageManager2::SetDstMedia(const std::wstring& strDst)
{
m_strDstMedia = strDst;
......@@ -1222,7 +1235,7 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels);
}
void CRelsGenerator::EndPresentationRels(const bool& bIsCommentsAuthors = false, const bool& bIsNotesMaster)
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject)
{
if (bIsNotesMaster)
{
......@@ -1247,6 +1260,12 @@ namespace NSBinPptxRW
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors\" Target=\"commentAuthors.xml\"/>";
m_pWriter->WriteString(strRels4);
}
if (bIsVbaProject)
{
std::wstring strRels4 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.microsoft.com/office/2006/relationships/vbaProject\" Target=\"vbaProject.bin\"/>";
m_pWriter->WriteString(strRels4);
}
}
int CRelsGenerator::GetNextId()
{
......
......@@ -178,8 +178,10 @@ namespace NSBinPptxRW
std::map<std::wstring, _imageManager2Info> m_mapImages;
_INT32 m_lIndexNextImage;
_INT32 m_lIndexCounter;
std::wstring m_strDstMedia;
std::wstring m_strDstEmbed;
std::wstring m_strDstFolder;
public:
int m_nDocumentType;
OOX::CContentTypes* m_pContentTypes;
......@@ -194,6 +196,9 @@ namespace NSBinPptxRW
void SetDstEmbed(const std::wstring& strDst);
std::wstring GetDstEmbed();
void SetDstFolder(const std::wstring& strDst);
std::wstring GetDstFolder();
int IsDisplayedImage(const std::wstring& strInput);
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
......@@ -419,8 +424,8 @@ namespace NSBinPptxRW
int WriteChart (int nChartNumber, _INT32 lDocType);
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
void EndPresentationRels (const bool& bIsCommentsAuthors, const bool& bIsNotesMaster = false);
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false );
int GetNextId ();
void CloseRels ();
......
......@@ -100,7 +100,9 @@ namespace NSBinPptxRW
m_oImageManager.Clear();
OOX::CPath pathMedia = pathPPT / _T("media");
m_oImageManager.SetDstFolder(pathPPT.GetPath());
OOX::CPath pathMedia = pathPPT / _T("media");
NSDirectory::CreateDirectory(pathMedia.GetPath());
m_oImageManager.SetDstMedia(pathMedia.GetPath());
......@@ -809,7 +811,8 @@ namespace NSBinPptxRW
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
++nCurrentRels;
}
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent);
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init());
m_oReader.m_pRels->CloseRels();
oXmlWriter.ClearNoAttack();
......@@ -840,7 +843,16 @@ namespace NSBinPptxRW
// content types
OOX::CContentTypes *pContentTypes = m_oImageManager.m_pContentTypes;
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml", L"/ppt", L"presentation.xml");
pContentTypes->Registration(m_oPresentation.type().OverrideType(),
m_oPresentation.type().DefaultDirectory(),
m_oPresentation.type().DefaultFileName());
if (m_oPresentation.m_pVbaProject.IsInit())
{
pContentTypes->Registration(m_oPresentation.m_pVbaProject->type().OverrideType(),
m_oPresentation.type().DefaultDirectory() / m_oPresentation.m_pVbaProject->type().DefaultDirectory(),
m_oPresentation.m_pVbaProject->type().DefaultFileName());
}
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml", L"/ppt", L"presProps.xml");
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml", L"/ppt", L"viewProps.xml");
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml", L"/ppt", L"tableStyles.xml");
......
......@@ -84,7 +84,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new PPTX::App(filename, map));
else if (relation.Type() == OOX::FileTypes::Core)
return smart_ptr<OOX::File>(new PPTX::Core(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation)
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation ||
relation.Type() == OOX::Presentation::FileTypes::PresentationMacro)
return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map));
else if (relation.Type() == OOX::FileTypes::Theme)
return smart_ptr<OOX::File>(new PPTX::Theme(filename, map));
......@@ -141,6 +142,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::OleObject(filename));
else if (relation.Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
else if (relation.Type() == OOX::FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( filename, filename ));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}
......
......@@ -44,6 +44,9 @@ namespace Presentation
const FileType Presentation (L"ppt", L"presentation.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType PresentationMacro(L"ppt", L"presentation.xml",
_T("application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType Slide (L"slides", L"slide.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slide+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"));
......
......@@ -75,6 +75,12 @@ namespace PPTX
if (_presentation.is_init())
{
_presentation->commentAuthors = _presentation->Get(OOX::Presentation::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>();
if (_presentation->IsExist(OOX::FileTypes::VbaProject))
{
_presentation->m_bMacroEnabled = true;
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
}
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
......
......@@ -50,6 +50,8 @@
#include "Logic/ExtP.h"
#include "Theme/ClrScheme.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
namespace PPTX
{
class Presentation : public WrapperFile, public PPTX::FileContainer
......@@ -57,16 +59,16 @@ namespace PPTX
public:
Presentation()
{
m_bMacroEnabled = false;
}
Presentation(const OOX::CPath& filename, FileMap& map)
{
m_bMacroEnabled = false;
read(filename, map);
}
virtual ~Presentation()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
//FileContainer::read(filename, map);
......@@ -182,6 +184,7 @@ namespace PPTX
}
}
}
//smartTags (Smart Tags)
Normalize();
}
......@@ -222,6 +225,15 @@ namespace PPTX
pWriter->WriteRecord2(6, commentAuthors);
pWriter->WriteRecord2(7, sectionLst);
if (m_pVbaProject.IsInit())
{
pWriter->StartRecord(8);
{
m_pVbaProject->toPPTY(pWriter);
}
pWriter->EndRecord();
}
pWriter->EndRecord();
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
......@@ -318,22 +330,28 @@ namespace PPTX
default:
return;
}
}
break;
}
}
}break;
case 6:
{
commentAuthors = new PPTX::Authors();
commentAuthors->fromPPTY(pReader);
break;
}
commentAuthors->fromPPTY(pReader);
}break;
case 7:
{
sectionLst = new nsPresentation::SectionLst();
sectionLst->fromPPTY(pReader);
break;
}
sectionLst->fromPPTY(pReader);
}break;
case 8:
{
m_pVbaProject = new OOX::VbaProject();
m_pVbaProject->fromPPTY(pReader);
smart_ptr<OOX::File> file = m_pVbaProject.smart_dynamic_cast<OOX::File>();
FileContainer::Add(file);
m_bMacroEnabled = true;
}break;
default:
{
pReader->Seek(_end_pos);
......@@ -397,10 +415,10 @@ namespace PPTX
pWriter->EndNode(L"p:presentation");
}
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::Presentation;
if (m_bMacroEnabled) return OOX::Presentation::FileTypes::PresentationMacro;
else return OOX::Presentation::FileTypes::Presentation;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -411,7 +429,6 @@ namespace PPTX
return type().DefaultFileName();
}
public:
//Childs
//custDataLst (Customer Data List)
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
......@@ -446,9 +463,12 @@ namespace PPTX
smart_ptr<PPTX::Authors> commentAuthors;
private:
Logic::ClrMap m_clrMap;
nsTheme::ClrScheme m_clrScheme;
Logic::ClrMap m_clrMap;
nsTheme::ClrScheme m_clrScheme;
public:
bool m_bMacroEnabled;
smart_ptr<OOX::VbaProject> m_pVbaProject;
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;};
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;};
......
......@@ -363,7 +363,7 @@ namespace PPTX
}
if (IsExist(OOX::FileTypes::VmlDrawing))
{
Vml = FileContainer::Get(OOX::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();//boost::shared_dynamic_cast<PPTX::VmlDrawing, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::VmlDrawing));
Vml = FileContainer::Get(OOX::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();
}
}
}
......
......@@ -249,17 +249,16 @@ int FDB::serialize(std::wostream & strm, bool bSql)
// CP_XML_ATTR(L"containsString", 0);
// }
//}
if (bInteger)
if (bInteger && bNumber)
{
if (bNumber) bInteger = false;
else bNumber = true;
bInteger = false;
}
if ((bDate & bNumber) || (bNumber & bString))
{
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
}
else if ( bDate & bString)
else if (bDate & bString)
{
CP_XML_ATTR(L"containsMixedTypes", 1);
}
......@@ -277,9 +276,9 @@ int FDB::serialize(std::wostream & strm, bool bSql)
CP_XML_ATTR(L"containsString", 0);
}
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger && !bDate & bString) CP_XML_ATTR(L"containsInteger", 1);
if (fdb->fnumMinMaxValid)
{
......
......@@ -34,6 +34,9 @@
#define OOX_VBA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../../../../../ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h"
#include "../../../../../ASCOfficePPTXFile/Editor/imagemanager.h"
#include "../IFileContainer.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
......@@ -72,6 +75,49 @@ namespace OOX
{
return m_filename.GetFilename();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString1(0, m_filename.GetFilename());
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
copy_to(pWriter->m_pCommon->m_pImageManager->m_strDstMedia);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
std::wstring file_name = pReader->GetString2();
OOX::CPath inputPath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + file_name;
OOX::CPath outputPath = pReader->m_pRels->m_pManager->GetDstFolder() + FILE_SEPARATOR_STR + _T("vbaProject.bin");
NSFile::CFileBinary::Copy(inputPath.GetPath(), outputPath.GetPath());
set_filename(outputPath.GetPath());
}break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
protected:
};
} // namespace OOX
......
......@@ -195,7 +195,7 @@ public:
_LOGGING_ERROR_(L"execute_compile_code", strCode);
_LOGGING_ERROR_(L"execute_compile", strException);
return false;
return "";
}
else
{
......@@ -209,7 +209,7 @@ public:
_LOGGING_ERROR_(L"execute_run_code", strCode);
_LOGGING_ERROR_(L"execute_run", strException);
return false;
return "";
}
if (_value->IsString())
......
......@@ -2170,7 +2170,7 @@ namespace NExtractTools
return nRes;
}
int fromXlsxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
int fromXlsxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params, bool isSavedXFile)
{
int nRes = 0;
if(0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo) && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV != nFormatTo)
......@@ -2221,6 +2221,11 @@ namespace NExtractTools
nRes = fromXlstBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
}
}
if (SUCCEEDED_X2T(nRes) && !isSavedXFile && params.getSaveXFile())
{
std::wstring sToDir = NSDirectory::GetFolderPath(sTo);
nRes = dir2zip(sFrom, sToDir + FILE_SEPARATOR_STR + _T("Editor.xlsx"));
}
return nRes;
}
int fromXlstBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
......@@ -2252,7 +2257,7 @@ namespace NExtractTools
nRes = xlst_bin2xlsx_dir(sFrom, sTo, sXlsxDir, bFromChanges, sThemeDir, params);
if(SUCCEEDED_X2T(nRes))
{
nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params, false);
}
}
else
......@@ -2302,9 +2307,15 @@ namespace NExtractTools
{
std::wstring sXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked");
NSDirectory::CreateDirectory(sXlsxDir);
bool isSavedXFile = false;
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatFrom)
{
nRes = zip2dir(sFrom, sXlsxDir);
if (SUCCEEDED_X2T(nRes) && params.getSaveXFile())
{
NSFile::CFileBinary::Copy(sFrom, NSSystemPath::GetDirectoryName(sTo) + FILE_SEPARATOR_STR + _T("Editor.xlsx"));
isSavedXFile = true;
}
}
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatFrom)
{
......@@ -2318,7 +2329,7 @@ namespace NExtractTools
nRes = AVS_FILEUTILS_ERROR_CONVERT;
if(SUCCEEDED_X2T(nRes))
{
nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params, isSavedXFile);
}
}
return nRes;
......
......@@ -145,7 +145,7 @@ namespace NExtractTools
int fromDoctBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params);
int fromDocument (const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTemp, InputParams& params);
int fromXlsxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params);
int fromXlsxDir (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params, bool isSavedXFile);
int fromXlstBin (const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params);
int fromSpreadsheet (const std::wstring &sFrom, int nFormatFrom, const std::wstring &sTemp, InputParams& params);
......
......@@ -359,6 +359,7 @@ namespace NExtractTools
std::wstring* m_sPassword;
std::wstring* m_sTempDir;
bool* m_bIsNoBase64;
bool* m_bSaveXFile;
//output params
mutable bool m_bOutputConvertCorrupted;
public:
......@@ -385,6 +386,7 @@ namespace NExtractTools
m_sPassword = NULL;
m_sTempDir = NULL;
m_bIsNoBase64 = NULL;
m_bSaveXFile = NULL;
m_bOutputConvertCorrupted = false;
}
......@@ -411,6 +413,7 @@ namespace NExtractTools
RELEASEOBJECT(m_sPassword);
RELEASEOBJECT(m_sTempDir);
RELEASEOBJECT(m_bIsNoBase64);
RELEASEOBJECT(m_bSaveXFile);
}
bool FromXmlFile(const std::wstring& sFilename)
......@@ -501,6 +504,8 @@ namespace NExtractTools
m_sTempDir = new std::wstring(sValue);
else if(_T("m_bIsNoBase64") == sName)
m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue));
else if(_T("m_bSaveXFile") == sName)
m_bSaveXFile = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_nCsvDelimiterChar") == sName)
{
......@@ -532,6 +537,10 @@ namespace NExtractTools
{
return (NULL != m_bIsNoBase64) ? (*m_bIsNoBase64) : false;
}
bool getSaveXFile() const
{
return (NULL != m_bSaveXFile) ? (*m_bSaveXFile) : false;
}
std::wstring getXmlOptions()
{
std::wstring sRes;
......
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