Compare commits

..

71 Commits

Author SHA1 Message Date
be0e9d4a08 Merge pull request #675 from ONLYOFFICE/fix/v6.4.0-fix-bugs-ppt
Fix/v6.4.0 fix bugs ppt
2021-07-30 18:08:12 +03:00
02310f1d64 merge with ppt_6. (Table + roundTrip Theme & Table) 2021-07-30 17:26:52 +03:00
1d04e2dddc remove some debug cout 2021-07-30 16:27:53 +03:00
9febebf33c Merge pull request #673 from ONLYOFFICE/fix/v6.4.0-fix-bugs
Fix/v6.4.0 fix bugs
2021-07-29 20:50:40 +03:00
ef365fc08e form. border & shd 2021-07-29 20:49:59 +03:00
6c28c529e3 fix bug #51584 2021-07-29 20:04:07 +03:00
86f7a181f8 Merge pull request #672 from ONLYOFFICE/fix/v6.4.0-fix-bugs-ppt
Fix/v6.4.0 fix bugs ppt
2021-07-29 16:57:16 +03:00
be6871a2a4 Merge pull request #671 from ONLYOFFICE/fix/v6.4.0-fix-bugs
Fix/v6.4.0 fix bugs
2021-07-29 16:53:23 +03:00
f43a38bdc9 convert empty files 2021-07-29 16:52:03 +03:00
2a8e8995bd add checker for empty
fix macro
2021-07-29 15:46:10 +03:00
95bba9d44a Fixed missing text when converting an EMF file 2021-07-28 18:26:31 +03:00
558cfb8048 refactoring ExHyperlinkContainer 2021-07-27 17:21:25 +03:00
c031c8e9cd Merge pull request #669 from ONLYOFFICE/fix/v6.4.0-fix-bugs
Fix/v6.4.0 fix bugs
2021-07-27 17:11:43 +03:00
b0363dad58 for bug #51543 2021-07-27 17:08:01 +03:00
4ff7be8245 fix bug #51543 2021-07-27 16:51:19 +03:00
476ebe6e95 fix bug #51541 2021-07-27 15:58:58 +03:00
09c30e2686 Merge pull request #668 from ONLYOFFICE/fix/v6.4.0-fix-bugs
Fix/v6.4.0 fix bugs
2021-07-27 09:42:18 +03:00
8210595178 fix bug #51522 2021-07-26 21:58:41 +03:00
f8f307aa29 add Other Files and http(s) hyperlinks 2021-07-26 18:06:40 +03:00
fb9d4d0460 add Other Presentation hyperlinks 2021-07-26 17:48:03 +03:00
ac865d292f text hyperlinks were corrected! Now it has problem with some visible hyperlink, but it goesn't work 2021-07-26 14:59:42 +03:00
bf0b1e8d97 trying to correct text hyperlinks 2021-07-25 22:49:10 +03:00
f591bcbd45 trying to correct text hyperlinks for hard cases. Problems with text after hyperlink 2021-07-25 18:03:53 +03:00
ef277b4656 fix bug #51489 2021-07-24 13:20:27 +03:00
ee19ab476f trying to correct hyperlinks 2021-07-23 18:31:23 +03:00
06c8c0e075 add text hyperlinks. But it has bugs 2021-07-23 15:58:01 +03:00
6973cec1a1 add client text box record for hyperlinks 2021-07-22 18:37:37 +03:00
974b9bcc1b add CRecordMouseInteractiveInfoContainer 2021-07-22 17:50:10 +03:00
a009d4d918 remove text hyperlinking. Need to rewrite it 2021-07-21 18:30:53 +03:00
2559e97f48 finish to rewrite table text. Can merge with develop 2021-07-12 17:52:37 +03:00
436b268e49 continue to rewrite table text 2021-07-09 18:43:11 +03:00
b85d11cc05 start to rewrite table text 2021-07-08 18:44:11 +03:00
9d35757245 add margins for top and down, but it fail with text. Some conditions were disable! 2021-07-08 16:44:20 +03:00
53accfc084 add styles for tables (not all) 2021-07-07 18:34:24 +03:00
eb032af457 correct some table properties 2021-07-06 18:36:08 +03:00
63cfded90c add zero height for proto table 2021-07-06 16:36:41 +03:00
ef3e4c2cfa add invizible table cells 2021-07-05 18:49:33 +03:00
7f6d04eb34 add round trip theme. Now it works fine. 2021-07-05 11:36:28 +03:00
09d3f946e7 add theme*.xml from CRecordRoundTripThemeAtom 2021-07-02 17:45:30 +03:00
5bf3e4d7ab add xml correct. Not works as I wanted 2021-07-01 16:41:39 +03:00
83230fb3ec xml table. It has some problem with color 2021-06-30 18:51:50 +03:00
e98b542eae Correct some class for xml tables. Last home's changes. 2021-06-30 09:19:23 +03:00
825a5d78af Merge branch 'feature/ppt_6' of https://github.com/ONLYOFFICE/core into feature/ppt_6 2021-06-29 15:53:06 +03:00
66e103fd94 I can exctract tableStyles.xml, but it's not perfect solition 2021-06-29 15:52:21 +03:00
01ee676614 add records: metafile, RoundTripOArtTextStyles12Atom 2021-06-25 12:16:54 +03:00
e5e0949f39 add bullets for text in table 2021-06-23 19:46:41 +03:00
08e6fee7a8 merge with home fork 2021-06-23 14:18:17 +03:00
06fb3f0203 add pt spacing 2021-06-18 18:07:39 +03:00
cb55300286 add line spacing 2021-06-18 17:12:12 +03:00
a2a65579c1 add common anchor 2021-06-18 16:01:44 +03:00
59c0abbee9 add horz align 2021-06-18 14:54:24 +03:00
90fd93de9a correct alpha and diagonal borders 2021-06-17 17:56:28 +03:00
30ab4a55d1 add border writer 2021-06-17 17:06:15 +03:00
c2d4d4f9bd add border writer, but it format is broken 2021-06-16 18:41:44 +03:00
0594d9decd add border setter 2021-06-16 12:46:05 +03:00
5dbc4b4d49 add cell's color 2021-06-11 17:42:28 +03:00
b2cd5f0211 add base styles fot text 2021-06-11 16:07:06 +03:00
5a10bb897e convert text but sometimes it's uncorrect 2021-06-10 18:32:25 +03:00
89bbbb0aac start new class for table text 2021-06-09 18:38:15 +03:00
12789ab7f6 empty table was converted 2021-06-09 17:19:09 +03:00
1e5819f9f9 add merging 2021-06-09 16:26:41 +03:00
810e01e7e9 add class ProtoTable 2021-06-09 14:10:13 +03:00
22bae397cf start to rewrite proto table 2021-06-07 18:43:23 +03:00
7c9444e086 add not work protoTable 2021-06-07 18:05:32 +03:00
46d0acb106 add getProtoTable method 2021-06-04 18:53:50 +03:00
04374ade42 add spliter for old table shapes 2021-06-04 17:22:04 +03:00
f5fa11dde5 add some methods for tables 2021-06-03 21:52:28 +03:00
389472e2fb add some methods for tables 2021-06-03 18:40:47 +03:00
190f1ffc10 add table class 2021-05-31 18:36:27 +03:00
d377bef3a1 catch table 2021-05-31 14:38:18 +03:00
65ceacc5ac add some things for recognizing table 2021-05-30 21:48:47 +03:00
53 changed files with 4404 additions and 2457 deletions

View File

@ -9359,7 +9359,8 @@ int Binary_DocumentTableReader::ReadSdtPicture(BYTE type, long length, void* poR
int Binary_DocumentTableReader::ReadSdtFormPr(BYTE type, long length, void* poResult)
{
int res = 0;
ComplexTypes::Word::CFormPr* pFormPr = static_cast<ComplexTypes::Word::CFormPr*>(poResult);
OOX::Logic::CFormPr* pFormPr = static_cast<OOX::Logic::CFormPr*>(poResult);
if (c_oSerSdt::FormPrKey == type)
{
pFormPr->m_oKey = m_oBufferedStream.GetString3(length);
@ -9376,6 +9377,16 @@ int Binary_DocumentTableReader::ReadSdtFormPr(BYTE type, long length, void* poRe
{
pFormPr->m_oRequired = m_oBufferedStream.GetBool();
}
else if (c_oSerSdt::FormPrBorder == type)
{
pFormPr->m_oBorder.Init();
READ2_DEF(length, res, oBinary_pPrReader.ReadBorder2, pFormPr->m_oBorder.GetPointer());
}
else if (c_oSerSdt::FormPrShd == type)
{
pFormPr->m_oShd.Init();
READ2_DEF(length, res, oBinary_CommonReader2.ReadShd, pFormPr->m_oShd.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -110,7 +110,7 @@ const double g_dKoef_mm_to_hps = 2 * g_dKoef_mm_to_pt;
const static wchar_t* g_sFormatSignature = L"DOCY";
const int g_nFormatVersion = 5;
const int g_nFormatVersionNoBase64 = 10;
const int g_nFormatVersionNoBase64 = 10;
extern int g_nCurFormatVersion;
namespace c_oAscWrapStyle{enum c_oSerFormat
{
@ -1241,7 +1241,9 @@ extern int g_nCurFormatVersion;
PictureFormPrLockProportions = 62,
PictureFormPrRespectBorders = 63,
PictureFormPrShiftX = 64,
PictureFormPrShiftY = 65
PictureFormPrShiftY = 65,
FormPrBorder = 70,
FormPrShd = 71
};}
namespace c_oSerFFData{enum c_oSerFFData
{

View File

@ -7843,7 +7843,7 @@ void BinaryDocumentTableWriter::WriteDropDownList(const OOX::Logic::CSdtDropDown
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryDocumentTableWriter::WriteSdtFormPr(const ComplexTypes::Word::CFormPr& oFormPr)
void BinaryDocumentTableWriter::WriteSdtFormPr(const OOX::Logic::CFormPr& oFormPr)
{
int nCurPos = 0;
if(oFormPr.m_oKey.IsInit())
@ -7870,6 +7870,18 @@ void BinaryDocumentTableWriter::WriteSdtFormPr(const ComplexTypes::Word::CFormPr
m_oBcw.m_oStream.WriteBOOL(oFormPr.m_oRequired.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oFormPr.m_oBorder.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrCombBorder);
m_oBcw.WriteBorder(oFormPr.m_oBorder.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oFormPr.m_oShd.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrCombBorder);
m_oBcw.WriteShd(oFormPr.m_oShd.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryDocumentTableWriter::WriteSdtTextFormPr(const OOX::Logic::CTextFormPr& oTextFormPr)
{

View File

@ -498,7 +498,7 @@ namespace BinDocxRW
void WriteSdtPrDate(const OOX::Logic::CDate& oDate);
void WriteDocPartList(const OOX::Logic::CSdtDocPart& oSdtDocPart);
void WriteDropDownList(const OOX::Logic::CSdtDropDownList& oDropDownList);
void WriteSdtFormPr(const ComplexTypes::Word::CFormPr& oFormPr);
void WriteSdtFormPr(const OOX::Logic::CFormPr& oFormPr);
void WriteSdtTextFormPr(const OOX::Logic::CTextFormPr& oTextFormPr);
void WriteSdtTextFormPrComb(const ComplexTypes::Word::CComb& oComb);
void WriteSdtPicture(const OOX::Logic::CSdtPicture& oSdtPicture);

View File

@ -122,6 +122,9 @@ namespace BinDocxRW
if (L"pkg:xmlData" == sName)
{
std::wstring data = oReader.GetInnerXml();
XmlUtils::replace_all(data, L"&#xA;", L"");
XmlUtils::replace_all(data, L"&#x9;", L"");
//todooo убрать "красивую" разметку xml
WriteXmlFile(*name, data);
}
if (L"pkg:binaryData" == sName)
@ -142,6 +145,7 @@ namespace BinDocxRW
NSFile::CFileBinary file;
if (file.CreateFileW(path.GetPath()))
{
file.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
file.WriteStringUTF8(data);
file.CloseFile();
}

View File

@ -89,6 +89,7 @@ namespace oox {
_CP_OPT(std::wstring) text;
_CP_OPT(std::wstring) formula2;
_CP_OPT(int) rank;
_CP_OPT(bool) bottom;
//color scale icon set data_bar
std::vector<_cfvo> cfvo;
//color scale data_bar(1 element)
@ -144,9 +145,8 @@ public:
if (c.rules[j].stopIfTrue) CP_XML_ATTR(L"stopIfTrue", *c.rules[j].stopIfTrue);
if (c.rules[j].text) CP_XML_ATTR(L"text", *c.rules[j].text);
if (c.rules[j].rank) CP_XML_ATTR(L"rank", *c.rules[j].rank);
//CP_XML_ATTR(L"bottom" , 0);
//CP_XML_ATTR(L"equalAverage" , 0);
if (c.rules[j].bottom) CP_XML_ATTR(L"bottom", *c.rules[j].bottom);
//CP_XML_ATTR(L"equalAverage" , 0);
//CP_XML_ATTR(L"aboveAverage" , 0);
if (c.rules[j].type == 1)
{
@ -362,6 +362,21 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
}
}
else if (0 <= (pos = f.find(L"bottom")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
impl_->conditionalFormattings_.back().rules.back().bottom = true;
if (0 < (pos = f.find(L"percent")))
{
impl_->conditionalFormattings_.back().rules.back().percent = true;
}
if (0 <= (pos = f.find(L"(")))
{
val = f.substr(pos + 1, f.length() - pos - 2);
if (!val.empty())
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
}
}
else
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"cellIs";

View File

@ -139,6 +139,13 @@ void xlsx_conversion_context::end_document()
{
std::wstringstream workbook_content;
if (sheets_.empty())
{ // owncloud new document ... oO
start_table(L"Sheet1", L"");
current_sheet().cols() << L"<col min=\"1\" max=\"1024\" width=\"11.6\" customWidth=\"0\"/>";
end_table();
}
for (size_t i = 0; i < sheets_.size(); i++)
{
xlsx_xml_worksheet_ptr& sheet = sheets_[i];

View File

@ -1630,7 +1630,7 @@ void ods_table_state::end_conditional_format()
{
current_level_.pop_back();
}
void ods_table_state::start_conditional_rule(int rule_type, _CP_OPT(unsigned int) rank)
void ods_table_state::start_conditional_rule(int rule_type, _CP_OPT(unsigned int) rank, _CP_OPT(bool) bottom, _CP_OPT(bool) percent)
{
office_element_ptr elm;
@ -1680,7 +1680,16 @@ void ods_table_state::start_conditional_rule(int rule_type, _CP_OPT(unsigned int
case 11: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 12: condition->attr_.calcext_value_ = L"is-no-error"; break;
case 13: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 15: condition->attr_.calcext_value_ = L"top-elements(" + std::to_wstring(rank.get_value_or(10)) + L")"; break;//bottom-elements ???
case 15:
{
if ((bottom) && (*bottom)) condition->attr_.calcext_value_ = L"bottom";
else condition->attr_.calcext_value_ = L"top";
if (percent && (*percent)) *condition->attr_.calcext_value_ += L"-percent(";
else *condition->attr_.calcext_value_ += L"-elements(";
*condition->attr_.calcext_value_ += std::to_wstring(rank.get_value_or(10)) + L")";
}break;
case 16: condition->attr_.calcext_value_ = L"unique"; break;
case 2: /*cellIs*/
default: break;

View File

@ -375,7 +375,7 @@ public:
void start_conditional_formats();
void start_conditional_format(std::wstring ref);
void start_conditional_rule(int rule_type, _CP_OPT(unsigned int) rank);
void start_conditional_rule(int rule_type, _CP_OPT(unsigned int) rank, _CP_OPT(bool) bottom, _CP_OPT(bool) percent);
void set_conditional_formula(std::wstring formula);
void set_conditional_value(int type, std::wstring value );
void set_conditional_iconset(int type_iconset);

View File

@ -3231,9 +3231,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_co
if (false == oox_cond_rule->m_oType.IsInit()) return;
_CP_OPT(unsigned int) rank;
if (oox_cond_rule->m_oRank.IsInit()) rank = oox_cond_rule->m_oRank->GetValue();
_CP_OPT(bool) bottom, percent;
ods_context->current_table()->start_conditional_rule(oox_cond_rule->m_oType->GetValue(), rank);
if (oox_cond_rule->m_oRank.IsInit()) rank = oox_cond_rule->m_oRank->GetValue();
if (oox_cond_rule->m_oBottom.IsInit()) bottom = oox_cond_rule->m_oBottom->ToBool();
if (oox_cond_rule->m_oPercent.IsInit()) percent = oox_cond_rule->m_oPercent->ToBool();
ods_context->current_table()->start_conditional_rule(oox_cond_rule->m_oType->GetValue(), rank, bottom, percent);
{
if (oox_cond_rule->m_oDxfId.IsInit())
{

View File

@ -27,339 +27,13 @@ DEFINES += UNICODE \
#DISABLE_FILE_DOWNLOADER
HEADERS += \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Animations.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Attributes.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/AudioOverlay.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Document.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Effects.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Interactive.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Metric.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/SlideShow.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/Structures.h \
# ../../../ASCOfficePPTXFile/Editor/Drawing/XmlStringWriter.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/AlbumLayout.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/AnimationDgmBuild.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/BWMode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/BaseLimit.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/BevelType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/BlendMode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/BlipCompression.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/CameraType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ChartBuild.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ChartBuildType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ColorSchemeIndex.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/CompoundLine.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/Conformance.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ContentStatus.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/CornerDirectionVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/DgmBuild.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/DgmBuildType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/EffectContainerType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/EightDirectionVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/FillPath.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/Flip.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/FontAlign.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/FontStyleIndex.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/FrameShape.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/HorzOverflow.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/InOutDirectionVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/IterateType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/LastView.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/LightRigType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/LineCap.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/LineEndSize.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/LineEndType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/Material.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/OnOff.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/Orient.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ParaBuildType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PathFillMode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PattFillVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PenAlign.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PlaceholderSize.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PlaceholderType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PresetShadowVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PrstClrVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/PrstDashVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/RectAlign.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SchemeClrVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/ShapeType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SideDirectionVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SlideLayoutType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SlideSize.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SplitterBarState.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/SysClrVal.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLAccumulate.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLAdditive.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLCalcMode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLChartSubElement.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLColorDirection.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLColorSpace.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLCommandType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLMasterRelation.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLNextAc.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLNodeFillType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLNodeType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLOrigin.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLOverride.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLPathEditMode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLPresetClass.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLPrevAc.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLRestart.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLRuntimeTrigger.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLSyncBehavior.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLTransform.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLTriggerEvent.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TLValueType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextAlign.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextAnchor.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextAutonumberScheme.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextCaps.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextShapeType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextStrike.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextTabAlignType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextUnderline.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextVerticalType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TextWrap.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/TransitionSpeed.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/VariantType.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Limit/VertOverflow.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Ah.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/AhBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/AhPolar.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/AhXY.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Backdrop.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bevel.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bg.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/BgPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/BodyPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuAutoNum.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuBlip.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuChar.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuClrTx.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuFontTx.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuNone.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuSzPct.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuSzPts.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BuSzTx.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/Bullet.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BulletColor.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BulletSize.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bullets/BulletTypeface.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvCxnSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvGraphicFramePr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvGrpSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvPicPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CSld.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Camera.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Cell3D.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ClrMap.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ClrMapOvr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/ColorBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/ColorModifier.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SysClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ContentPart.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Controls.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CustGeom.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Cxn.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/DefaultShapeDefinition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectDag.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectProperties.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaBiLevel.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaCeiling.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaFloor.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaInv.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaMod.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaModFix.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaOutset.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/AlphaRepl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/BiLevel.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Blend.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Blur.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/ClrChange.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/ClrRepl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Duotone.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/EffectElement.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/FillEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/FillOverlay.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Glow.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Grayscl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/HslEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/InnerShdw.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/LumEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/OuterShdw.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/PrstShdw.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/Reflection.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/RelOff.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/SoftEdge.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/TintEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Effects/XfrmEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ExtP.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/FillStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/GradFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/NoFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/PattFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/SolidFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Stretch.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Tile.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/FontCollection.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/FontRef.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Gd.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/GrpSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Gs.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/HeadingVariant.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Hf.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Hyperlink.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/LightRig.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Lin.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/LineEnd.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/LineJoin.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/LineStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Ln.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Media/AudioCD.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Media/MediaFile.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Media/WavAudioFile.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvCxnSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvGraphicFramePr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvGrpSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvPicPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvSpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Paragraph.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/PartTitle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/ArcTo.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/Close.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/CubicBezTo.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/LineTo.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/MoveTo.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/PathBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Path2D/QuadBezTo.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Ph.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/PrstDash.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/PrstGeom.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/PrstTxWarp.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Rect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Rot.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/RunElem.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/Br.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/Fld.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/Run.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/RunBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Scene3d.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ShapeStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Sp3d.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/StyleRef.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SupplementalFont.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Tab.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableCell.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableCellProperties.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableCol.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableProperties.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableRow.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TableBgStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TablePartStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TableStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TcBdr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TcStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TcTxStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextFit.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextFont.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextListStyle.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextParagraphPr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextSpacing.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Anim.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimClr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimMotion.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimRot.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimScale.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimVariant.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AttrName.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AttrNameLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Audio.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldDgm.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldGraphic.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldOleChart.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldP.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldSub.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BuildNodeBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CBhvr.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CMediaNode.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CTn.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/ChildTnLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Cmd.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Cond.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CondLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Excl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/GraphicEl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Iterate.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Par.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Seq.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Set.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/SpTgt.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Tav.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TavLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TgtEl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TimeNodeBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Timing.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Tmpl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TmplLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TnLst.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TxEl.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Video.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/CornerDirectionTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EightDirectionTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EmptyTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OptionalBlackTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OrientationTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SideDirectionTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SndAc.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/StSnd.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/Transition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/TransitionBase.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/WheelTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TxStyles.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniColor.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniEffect.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniMedia.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniPath2D.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Xfrm.h \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/XmlId.h \
../Enums/RecordType.h \
../Enums/_includer.h \
../Enums/enums.h \
../PPTFormatLib.h \
../PPTXWriter/Animation.h \
../PPTXWriter/TableWriter.h \
../PPTXWriter/TxBodyConverter.h \
../Reader/ClassesAtom.h \
../Reader/CommonZLib.h \
../Reader/PPTDocumentInfo.h \
@ -440,8 +114,11 @@ HEADERS += \
../Records/BuildAtom.h \
../Records/DocInfoListContainer.h \
../Records/DocProgTagsContainer.h \
../Records/MouseInteractiveInfoContainer.h \
../Records/OfficeArtClientData.h \
../Records/OfficeArtClientTextbox.h \
../Records/PlaceHolderAtom.h \
../Records/RoundTripOArtTextStyles12Atom.h \
../Records/ShapeProgBinaryTagSubContainerOrAtom.h \
../Records/CFMasks.h \
../Records/ColorSchemeAtom.h \
@ -611,45 +288,12 @@ SOURCES += \
}
SOURCES += \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Bg.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CNvGrpSpPr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/ContentPart.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectDag.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectLst.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectProperties.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/EffectStyle.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/GrpSpPr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Hyperlink.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Media/WavAudioFile.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvGraphicFramePr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/NvGrpSpPr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpPr.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/TableCell.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BuildNodeBase.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/TimeNodeBase.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/TransitionBase.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniColor.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniEffect.cpp \
# ../../../ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.cpp \
../Enums/RecordType.cpp \
../PPTFormatLib.cpp \
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.cpp \
../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.cpp \
../../../Common/3dParty/pole/pole.cpp \
../PPTXWriter/Animation.cpp \
../PPTXWriter/TableWriter.cpp \
../PPTXWriter/TxBodyConverter.cpp \
../Records/Animations/TimeVariant.cpp

File diff suppressed because it is too large Load Diff

View File

@ -76,7 +76,8 @@ namespace PPT_FORMAT
void WriteAll ();
void WriteThemes ();
void WriteTheme (CThemePtr pTheme, int & nIndexTheme, int & nStartLayout);
void WriteSlides ();
void WriteTheme (CRecordRoundTripThemeAtom *pTheme, int &nIndexTheme);
void WriteSlides ();
void WriteNotes ();
void WriteLayout (CLayoutPtr pLayout, int nIndexLayout, int nStartLayout, int nIndexTheme);
void WriteSlide (int nIndexSlide);

View File

@ -281,30 +281,55 @@ namespace PPT_FORMAT
std::wstring strMem = m_oWriter.GetData();
oFile.WriteStringUTF8(strMem);
oFile.CloseFile();
}
inline std::wstring WriteHyperlink(const std::wstring& strHyperlink)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapHyperlinks.find(strHyperlink);
}
inline std::wstring WriteHyperlink(const std::wstring& strHyperlink, bool isExternal = false)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapHyperlinks.find(strHyperlink);
if (m_mapHyperlinks.end() != pPair)
{
if (m_mapHyperlinks.end() != pPair)
{
std::wstring strRid = L"rId" + pPair->second;
return strRid;
}
m_mapHyperlinks[strHyperlink] = m_lNextRelsID;
return strRid;
}
m_mapHyperlinks[strHyperlink] = m_lNextRelsID;
std::wstring strRid = L"rId" + std::to_wstring( m_lNextRelsID++);
std::wstring strRels = L"<Relationship Id=\"";
std::wstring strRels = L"<Relationship Id=\"";
strRels += strRid + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\"";
strRels += strHyperlink + L"\"/>";
strRels += strHyperlink;
strRels += (isExternal ? L"\" TargetMode=\"External\" />" : L"\"/>");
m_oWriter.WriteString(strRels);
m_oWriter.WriteString(strRels);
return strRid;
}
inline std::wstring WriteFile(const std::wstring& strPath)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapHyperlinks.find(strPath);
if (m_mapHyperlinks.end() != pPair)
{
std::wstring strRid = L"rId" + pPair->second;
return strRid;
}
m_mapHyperlinks[strPath] = m_lNextRelsID;
std::wstring strRid = L"rId" + std::to_wstring( m_lNextRelsID++);
std::wstring strRels = L"<Relationship Id=\"";
strRels += strRid + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink\" Target=\"";
strRels += L"file:///" + strPath + L"\" TargetMode=\"External\" />";
m_oWriter.WriteString(strRels);
return strRid;
}
inline std::wstring WriteHyperlinkMedia(const std::wstring& strMedia, bool bExternal = true, bool newRIdAlways = false, std::wstring strRelsType = L"http://schemas.microsoft.com/office/2007/relationships/media")
{
if (!newRIdAlways)

View File

@ -691,7 +691,7 @@ void PPT_FORMAT::CShapeWriter::WriteImageInfo()
m_oWriter.WriteString(std::wstring(L">"));
WriteButton();
WriteHyperlink(m_pElement->m_arrActions);
m_oWriter.WriteString(std::wstring(L"</p:cNvPr><p:cNvPicPr><a:picLocks"));
@ -886,7 +886,7 @@ void PPT_FORMAT::CShapeWriter::WriteShapeInfo()
m_oWriter.WriteString(std::wstring(L"\""));
}
m_oWriter.WriteString(std::wstring(L">"));
WriteButton();
WriteHyperlink(m_pElement->m_arrActions);
if (!pShapeElement->m_sHyperlink.empty())
{
std::wstring rId = m_pRels->WriteHyperlink(pShapeElement->m_sHyperlink);
@ -1523,6 +1523,7 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L" lang=\"") + str_lang + _T("\""));
}
m_oWriter.WriteString(std::wstring(L">"));
WriteHyperlink(pParagraph->m_arSpans[nSpan].m_arrInteractive);
if (m_bWordArt)
{//порядок важен - линия, заливка, тень !!!
@ -1583,7 +1584,7 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L"<a:sym typeface=\"") + pCF->font.sym->Name + _T("\"/>"));
}
// WriteButton(nIndexPar);
// WriteHyperlink(nIndexPar);
m_oWriter.WriteString(std::wstring(L"</a:rPr>"));
@ -1684,9 +1685,8 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertGroup()
return m_oWriter.GetData();
}
void PPT_FORMAT::CShapeWriter::WriteButton(int paragraphNum)
void PPT_FORMAT::CShapeWriter::WriteHyperlink(const std::vector<CInteractiveInfo>& actions)
{
auto actions = getActionsByNum(paragraphNum);
for (unsigned i = 0; i < actions.size(); i++)
{
if (actions[i].m_lType == CInteractiveInfo::over
@ -1697,8 +1697,16 @@ void PPT_FORMAT::CShapeWriter::WriteButton(int paragraphNum)
PPTX::Logic::Hyperlink hlink;
if (actions[i].m_strHyperlink.size() && m_pRels)
{
std::wstring id = m_pRels->WriteSlideRef(actions[i].m_strHyperlink);
hlink.id = id;
std::wstring id;
switch (actions[i].m_lHyperlinkType)
{
case LT_SlideNumber: id = m_pRels->WriteSlideRef(actions[i].m_strHyperlink); break;
case LT_Url: id = m_pRels->WriteHyperlink(actions[i].m_strHyperlink, true); break;
case LT_OtherPresentation: id = m_pRels->WriteFile(actions[i].m_strHyperlink); break;
case LT_OtherFile: id = m_pRels->WriteFile(actions[i].m_strHyperlink); break;
}
if (!id.empty())
hlink.id = id;
}
if (actions[i].m_strAudioFileName.size() && m_pRels)
@ -1712,8 +1720,9 @@ void PPT_FORMAT::CShapeWriter::WriteButton(int paragraphNum)
if (actions[i].m_eActivation == CInteractiveInfo::over)
hlink.m_name = L"hlinkHover";
else
hlink.highlightClick = true;
// if (actions[i].m_bVisited)
// hlink.highlightClick = true;
switch (actions[i].m_lType)
{
@ -1773,16 +1782,31 @@ void PPT_FORMAT::CShapeWriter::WriteButton(int paragraphNum)
}
case II_HyperlinkAction:
{
if (actions[i].m_lHyperlinkType == 7)
switch (actions[i].m_lHyperlinkType)
{
case LT_SlideNumber:
{
if (hlink.id.is_init())
hlink.action = L"ppaction://hlinksldjump";
break;
}
case LT_Url:
{
break;
}
case LT_OtherPresentation:
{
if (hlink.id.is_init())
hlink.action = L"ppaction://hlinkpres?slideindex=1&slidetitle=";
break;
}
case LT_OtherFile:
{
break;
}
}
// else if (actions[i].m_lHyperlinkType == 8)
// hlink.action = L"";
// if (!hlink.action.is_init() || hlink.action->empty())
// hlink.action = L"ppaction://noaction";
break;
}
case II_MediaAction:

View File

@ -448,7 +448,7 @@ namespace PPT_FORMAT
void WriteGroupInfo();
void WriteTableInfo();
void WriteButton(int paragraphNum = -1);
void WriteHyperlink(const std::vector<CInteractiveInfo> &actions);
std::vector<CInteractiveInfo> getActionsByNum(const int num);
std::wstring ConvertTableCells();
std::wstring ConvertTableRow();

View File

@ -0,0 +1,670 @@
#include "TableWriter.h"
#include "TxBodyConverter.h"
#include <iostream>
TableWriter::TableWriter(CTableElement *pTableElement, CRelsGenerator* pRels) :
m_pTableElement(pTableElement), m_pRels(pRels)
{
}
void TableWriter::Convert(PPTX::Logic::GraphicFrame &oGraphicFrame)
{
if (!m_pTableElement)
return;
if (m_pTableElement->m_xmlRawData.empty()/* || true*/)
{
oGraphicFrame.nvGraphicFramePr = new PPTX::Logic::NvGraphicFramePr;
FillNvGraphicFramePr(oGraphicFrame.nvGraphicFramePr.get2());
oGraphicFrame.xfrm = new PPTX::Logic::Xfrm;
FillXfrm(oGraphicFrame.xfrm.get2());
oGraphicFrame.table = new PPTX::Logic::Table;
FillTable(oGraphicFrame.table.get2());
}
else
{
oGraphicFrame.fromXMLString(getXmlForGraphicFrame());
// CorrectGraphicFrame(oGraphicFrame);
}
}
void TableWriter::FillNvGraphicFramePr(PPTX::Logic::NvGraphicFramePr& oNvGFPr)
{
oNvGFPr.cNvPr.id = m_pTableElement->m_lID;
oNvGFPr.cNvPr.name = m_pTableElement->m_sName;
// not works in full
oNvGFPr.cNvGraphicFramePr.noGrp = true;
PPTX::Logic::Ext ext;
ext.uri = L"{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
oNvGFPr.nvPr.extLst.push_back(ext);
}
void TableWriter::FillXfrm(PPTX::Logic::Xfrm &oXFRM)
{
oXFRM.m_ns = L"p";
double multip1 = m_pTableElement->m_bAnchorEnabled ? 1587.5 : 1;
oXFRM.offX = round(m_pTableElement->m_rcAnchor.left * multip1);
oXFRM.offY = round(m_pTableElement->m_rcAnchor.top * multip1);
oXFRM.extX = round(m_pTableElement->m_rcAnchor.GetWidth() * multip1);
oXFRM.extY = round(m_pTableElement->m_rcAnchor.GetHeight() * multip1);
}
void TableWriter::FillTable(PPTX::Logic::Table &oTable)
{
oTable.tableProperties = new PPTX::Logic::TableProperties;
FillTblPr(oTable.tableProperties.get2());
std::vector<CShapeElement*> arrCells, arrSpliters;
prepareShapes(arrCells, arrSpliters);
m_nPTable = new ProtoTable(arrCells, arrSpliters, m_pRels);
FillTblGrid(oTable.TableCols , arrCells);
auto protoTable = m_nPTable->getTable();
auto arrHeight = ProtoTable::getHeight(arrCells);
for (UINT cRow = 0; cRow < protoTable.size(); cRow++)
{
PPTX::Logic::TableRow tr;
FillRow(tr, protoTable[cRow]);
tr.Height = ProtoTable::checkRowForZeroHeight(protoTable[cRow]) ? 0 : arrHeight[cRow];
oTable.TableRows.push_back(tr);
}
}
std::vector<int> ProtoTable::getWidth(std::vector<CShapeElement*>& arrCells, bool isWidth)
{
std::map<double, double> mapLeftWidth;
for (const auto* pCell : arrCells)
{
if (!pCell) continue;
double left = pCell->m_rcChildAnchor.left;
double width = pCell->m_rcChildAnchor.right - left;
// Here we search uniq left to answer: is it new colum?
auto iter = mapLeftWidth.find(left);
if (iter == mapLeftWidth.end())
{
mapLeftWidth.insert(std::make_pair(left, width));
}
// Here we check qestion: was it merged cell and now is it true width of colum?
else if (iter->second > width)
{
mapLeftWidth.erase(iter);
mapLeftWidth.insert(std::make_pair(left, width));
}
}
std::vector<int> gridWidth;
double multip = isWidth ? 1587.5 : 1.0;
for (const auto& w : mapLeftWidth)
{
double value = isWidth ? w.second : w.first;
gridWidth.push_back(round(value * multip));
}
return gridWidth;
}
std::vector<int> ProtoTable::getHeight(std::vector<CShapeElement*>& arrCells, bool isHeight)
{
std::map<double, double> mapTopHeight;
for (auto* pCell : arrCells)
{
if (!pCell) continue;
double top = pCell->m_rcChildAnchor.top;
double height = pCell->m_rcChildAnchor.bottom - top;
// Here we search uniq top to answer: is it new row?
auto iter = mapTopHeight.find(top);
if (iter == mapTopHeight.end())
{
mapTopHeight.insert(std::make_pair(top, height));
}
// Here we check qestion: was it merged cell and now is it true height of row?
else if (iter->second > height)
{
mapTopHeight.erase(iter);
mapTopHeight.insert(std::make_pair(top, height));
}
}
std::vector<int> gridHeight;
double multip = isHeight ? 1587.5 : 1.0;
for (const auto& h : mapTopHeight)
{
double value = isHeight ? h.second : h.first;
gridHeight.push_back(round(value * multip));
}
return gridHeight;
}
bool ProtoTable::checkRowForZeroHeight(const ProtoTableRow &oRow)
{
for (const auto& cell : oRow)
{
if (cell.isRealCell())
return false;
}
return true;
}
void ProtoTable::initProtoTable()
{
const UINT countRow = m_arrTop.size();
const UINT countCol = m_arrLeft.size();
m_table.clear();
for (UINT cRow = 0; cRow < countRow; cRow++)
{
ProtoTableRow protoRow;
for (UINT cCol = 0; cCol < countCol; cCol++)
protoRow.push_back(TCell(nullptr, cRow, cCol, m_pRels, nullptr));
m_table.push_back(protoRow);
}
}
bool ProtoTable::fillProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters)
{
if (m_table.empty() || m_arrTop.empty() || m_arrLeft.empty())
return false;
bool wasCellsFilled = fillCells(arrCells);
fillBorders(arrSpliters);
return wasCellsFilled;
}
bool ProtoTable::fillCells(std::vector<CShapeElement *> &arrCells)
{
const UINT countRow = m_arrTop.size();
const UINT countCol = m_arrLeft.size();
for (auto* pCell : arrCells)
{
int left = pCell->m_rcChildAnchor.left;
int top = pCell->m_rcChildAnchor.top;
int right = pCell->m_rcChildAnchor.right;
int bottom = pCell->m_rcChildAnchor.bottom;
UINT posRow = 0, posCol = 0;
for (; posRow < countRow; posRow++)
if (top == m_arrTop[posRow]) break;
for (; posCol < countCol; posCol++)
if (left == m_arrLeft[posCol]) break;
TCell* pParent = &m_table[posRow][posCol];
UINT posRightCol = 0, posBottomRow = 0;
for (; posBottomRow < countRow; posBottomRow++)
if (bottom == m_arrTop[posBottomRow]) break;
for (; posRightCol < countCol; posRightCol++)
if (right == m_arrLeft[posRightCol]) break;
for (UINT cRow = posRow; cRow < posBottomRow; cRow++)
for (UINT cCol = posCol; cCol < posRightCol; cCol++)
{
auto& tCell = m_table[cRow][cCol];
tCell.setPParent(pParent);
if (posCol == cCol)
tCell.setGridSpan(posRightCol - cCol);
if (posRow == cRow)
tCell.setRowSpan(posBottomRow - cRow);
}
pParent->setPParent(nullptr);
pParent->setPShape(pCell);
// pParent->setGridSpan(posRightCol - posCol);
// pParent->setRowSpan(posBottomRow - posRow);
}
return true;
}
void ProtoTable::fillBorders(std::vector<CShapeElement *> &arrSpliters)
{
for (auto* pBorder : arrSpliters)
{
int left = pBorder->m_rcChildAnchor.left;
int top = pBorder->m_rcChildAnchor.top;
int right = pBorder->m_rcChildAnchor.right;
int bottom = pBorder->m_rcChildAnchor.bottom;
UINT posFirstTop, posFirstLeft;
UINT posLastTop, posLastLeft;
findCellPos(top, left, posFirstTop, posFirstLeft);
findCellPos(bottom, right, posLastTop, posLastLeft);
if (!isDefaultBoard(pBorder))
{
setBorders(posFirstTop, posFirstLeft, posLastTop, posLastLeft, pBorder);
}
}
}
bool ProtoTable::findCellPos(const int top, const int left, UINT &posRow, UINT &posCol)
{
const UINT countRow = m_arrTop.size();
const UINT countCol = m_arrLeft.size();
for (posRow = 0; posRow < countRow; posRow++)
if (top == m_arrTop[posRow]) break;
for (posCol = 0; posCol < countCol; posCol++)
if (left == m_arrLeft[posCol]) break;
return !(posRow == countRow || posCol == countCol);
}
void ProtoTable::setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CShapeElement* pBorder)
{
const UINT countRow = m_arrTop.size();
const UINT countCol = m_arrLeft.size();
// lnTlToBr or lnBlToTr
if ((posFRow != posLRow) && (posFCol != posLCol))
{
auto borPos = posFRow > posLRow ? TCell::lnBlToTr : TCell::lnTlToBr;
m_table[posFRow][posFCol].setBorder(borPos, pBorder);
return;
}
// lnT or(and) lnB
if (posFCol != posLCol)
{
for (UINT i = posFCol; i < posLCol; i++)
{
if (posFRow < countRow)
m_table[posFRow][i].setBorder(TCell::lnT, pBorder);
if (posFRow > 0)
m_table[posFRow-1][i].setBorder(TCell::lnB, pBorder);
}
return;
}
// lnL or(and) lnR
if (posFRow != posLRow)
{
for (UINT i = posFRow; i < posLRow; i++)
{
if (posFCol < countCol)
m_table[i][posFCol].setBorder(TCell::lnL, pBorder);
if (posFCol > 0)
m_table[i][posFCol-1].setBorder(TCell::lnR, pBorder);
}
return;
}
}
bool ProtoTable::isDefaultBoard(const CShapeElement *pBorder)
{
if (pBorder == nullptr)
return false;
auto& color = pBorder->m_oPen.Color;
return color.m_lSchemeIndex == 13;
}
std::vector<std::vector<CShapeElement*> > ProtoTable::getRows(std::vector<CShapeElement *> &arrCells)
{
std::vector<std::vector<CShapeElement*> > arrRows;
int rowTop = -1;
for (auto* pCell : arrCells)
{
if (!pCell) continue;
int top = int(pCell->m_rcChildAnchor.top);
if (top != rowTop)
{
rowTop = top;
arrRows.push_back(std::vector<CShapeElement*>());
}
arrRows.back().push_back(pCell);
}
return arrRows;
}
MProtoTable ProtoTable::getTable() const
{
return m_table;
}
void TableWriter::FillTblPr(PPTX::Logic::TableProperties &oTblPr)
{
// oTblPr.TableStyleId = L"{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
// oTblPr.FirstRow = true;
// oTblPr.BandRow = true;
}
void TableWriter::FillTblGrid(std::vector<PPTX::Logic::TableCol> &tblGrid, std::vector<CShapeElement*>& arrCells)
{
auto grid = ProtoTable::getWidth(arrCells);
for (const auto& w : grid)
{
PPTX::Logic::TableCol tc;
tc.Width = w;
tblGrid.push_back(tc);
}
}
void TableWriter::prepareShapes(std::vector<CShapeElement *> &arrCells, std::vector<CShapeElement *> &arrSpliters)
{
for (const auto& ptrShape : m_pTableElement->m_pChildElements)
{
auto pShapeEl = dynamic_cast<CShapeElement*>(ptrShape.get());
switch (pShapeEl->m_lShapeType)
{
case 1:
arrCells.push_back(pShapeEl);
break;
case 20:
arrSpliters.push_back(pShapeEl);
break;
}
}
}
void TableWriter::FillRow(PPTX::Logic::TableRow &oRow, ProtoTableRow& arrCells)
{
if (arrCells.empty()) return;
for (auto& protoCell : arrCells)
{
PPTX::Logic::TableCell cell;
protoCell.FillTc(cell);
oRow.Cells.push_back(cell);
}
}
std::wstring TableWriter::getXmlForGraphicFrame() const
{
auto& rXml = m_pTableElement->m_xmlRawData;
auto startIter = rXml.find(L"<p:nvGraphicFramePr>");
auto endIter = rXml.find(L"</p:E2oFrame>");
std::wstring xml = L"<p:graphicFrame>";
xml += std::wstring(rXml.begin() + startIter, rXml.begin() + endIter);
xml += L"</p:graphicFrame>";
return xml;
}
void TableWriter::CorrectGraphicFrame(PPTX::Logic::GraphicFrame &oGraphicFrame)
{
FillnvPr(oGraphicFrame.nvGraphicFramePr->nvPr);
}
void TableWriter::FillnvPr(PPTX::Logic::NvPr &oNvPr)
{
PPTX::Logic::Ext ext;
ext.uri = L"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}";
oNvPr.extLst.push_back(ext);
}
TCell::TCell(CShapeElement *pShape, int row, int col, CRelsGenerator* pRels, TCell *pParent) :
m_pShape(pShape), m_row(row), m_col(col), m_rowSpan(1), m_gridSpan(1),
m_pParent(pParent), m_parentDirection(none), m_pRels(pRels)
{
setParentDirection();
}
void TCell::FillTc(PPTX::Logic::TableCell &oTc)
{
if (m_gridSpan > 1)
oTc.GridSpan = m_gridSpan;
if (m_rowSpan > 1)
oTc.RowSpan = m_rowSpan;
oTc.txBody = new PPTX::Logic::TxBody(L"a:txBody");
FillTxBody(oTc.txBody.get2());
if (m_pParent)
{
FillMergeDirection(oTc);
return;
}
oTc.CellProperties = new PPTX::Logic::TableCellProperties;
FillTcPr(oTc.CellProperties.get2());
}
void TCell::setBorder(TCell::eBorderPossition borderPos, CShapeElement *pBorder)
{
if (m_pShape)
m_mapBorders[borderPos] = pBorder;
else if (m_pParent)
m_pParent->setBorder(borderPos, pBorder);
}
TCell::eMergeDirection TCell::parentDirection() const
{
return m_parentDirection;
}
int TCell::getHeight() const
{
auto pShape = m_pParent ? m_pParent->m_pShape : m_pShape;
double multip = pShape->m_bAnchorEnabled ? 1587.5 : 1;
double height = pShape->m_rcChildAnchor.bottom - pShape->m_rcChildAnchor.top;
return round(height * multip);
}
void TCell::setPParent(TCell *pParent)
{
m_pParent = pParent;
setParentDirection();
}
void TCell::FillMergeDirection(PPTX::Logic::TableCell &oTc)
{
if (parentDirection() & horz)
oTc.HMerge = true;
if (parentDirection() & vert)
oTc.VMerge = true;
}
void TCell::setParentDirection()
{
if (m_pParent)
{
// Todo rewrite it
if (m_pParent->m_col == m_col && m_pParent->m_row != m_row)
m_parentDirection = vert;
else if (m_pParent->m_col != m_col && m_pParent->m_row == m_row)
m_parentDirection = horz;
else
m_parentDirection = hove;
}
}
void TCell::setGridSpan(int gridSpan)
{
m_gridSpan = gridSpan;
}
bool TCell::isRealCell() const
{
if (m_rowSpan == 2 || m_gridSpan == 2 || m_parentDirection != TCell::none)
return false;
return true;
}
void TCell::FillTxBody(PPTX::Logic::TxBody &oTxBody)
{
if (m_pShape == nullptr)
{
TxBodyConverter txBodyConverter(nullptr, m_pRels, TxBodyConverter::table);
txBodyConverter.FillTxBody(oTxBody);
} else
{
TxBodyConverter txBodyConverter(m_pShape, m_pRels, TxBodyConverter::table);
txBodyConverter.FillTxBody(oTxBody);
}
}
void TCell::FillTcPr(PPTX::Logic::TableCellProperties &oTcPr)
{
//anchor
auto& attr = m_pShape->m_pShape->m_oText.m_oAttributes;
if (attr.m_nTextAlignVertical != -1)
{
auto pAnchor = new PPTX::Limit::TextAnchor;
BYTE anchor[] = {4,1,0};
if (sizeof (anchor) > (UINT)attr.m_nTextAlignVertical)
pAnchor->SetBYTECode(anchor[attr.m_nTextAlignVertical]);
oTcPr.Anchor = pAnchor;
}
if (attr.m_nTextAlignHorizontal == 1)
{
oTcPr.AnchorCtr = true;
}
oTcPr.MarB = round(m_pShape->m_pShape->m_dTextMarginBottom); // 0
oTcPr.MarT = round(m_pShape->m_pShape->m_dTextMarginY); // 12512
oTcPr.MarL = round(m_pShape->m_pShape->m_dTextMarginX);
oTcPr.MarR = round(m_pShape->m_pShape->m_dTextMarginRight);
if (true)
{
oTcPr.HorzOverflow = new PPTX::Limit::HorzOverflow;
oTcPr.HorzOverflow->set(L"overflow");
}
auto pSolidFill = new PPTX::Logic::SolidFill;
auto& brush = m_pShape->m_oBrush;
auto& clr = brush.Color1;
pSolidFill->Color.SetRGBColor(clr.GetR(), clr.GetG(), clr.GetB());
if (brush.Alpha1 != 255)
{
PPTX::Logic::ColorModifier alpha;
alpha.name = L"a:alpha";
alpha.val = brush.Alpha1 * 392;
pSolidFill->Color.Color->Modifiers.push_back(alpha);
}
if (brush.Type == 5000)
{
PPTX::Logic::ColorModifier alpha;
alpha.name = L"a:alpha";
alpha.val = 0;
pSolidFill->Color.Color->Modifiers.push_back(alpha);
}
oTcPr.Fill.Fill.reset(pSolidFill);
for (auto IterBorder : m_mapBorders)
{
auto pLn = new PPTX::Logic::Ln;
FillLn(*pLn, IterBorder.first, IterBorder.second);
switch (IterBorder.first)
{
case lnL: oTcPr.LnL = pLn; break;
case lnR: oTcPr.LnR = pLn; break;
case lnT: oTcPr.LnT = pLn; break;
case lnB: oTcPr.LnB = pLn; break;
case lnBlToTr: oTcPr.LnBlToTr = pLn; break;
case lnTlToBr: oTcPr.LnTlToBr = pLn; break;
}
}
}
void TCell::FillLn(PPTX::Logic::Ln &Ln, TCell::eBorderPossition eBP, CShapeElement *pBorder)
{
if (pBorder == nullptr)
return;
switch (eBP)
{
case lnL: Ln.m_name = L"a:lnL"; break;
case lnR: Ln.m_name = L"a:lnR"; break;
case lnT: Ln.m_name = L"a:lnT"; break;
case lnB: Ln.m_name = L"a:lnB"; break;
case lnBlToTr: Ln.m_name = L"a:lnBlToTr"; break;
case lnTlToBr: Ln.m_name = L"a:lnTlToBr"; break;
}
auto& pen = pBorder->m_oPen;
Ln.w = pen.Size;
auto pSolidFill = new PPTX::Logic::SolidFill;
auto& clr = pen.Color;
pSolidFill->Color.SetRGBColor(clr.GetR(), clr.GetG(), clr.GetB());
if (pen.Alpha && pen.Alpha != 255)
{
PPTX::Logic::ColorModifier alpha;
alpha.name = L"a:alpha";
alpha.val = pen.Alpha * 392;
pSolidFill->Color.Color->Modifiers.push_back(alpha);
}
Ln.Fill.Fill.reset(pSolidFill);
Ln.prstDash = new PPTX::Logic::PrstDash;
Ln.prstDash->val = new PPTX::Limit::PrstDashVal;
auto oldDash = pen.DashStyle;
BYTE dash[] = {6,7,10,8,9,2,0,3,1,4};
if (sizeof (dash) > oldDash)
Ln.prstDash->val->SetBYTECode(dash[oldDash]);
// TODO?
Ln.cap = new PPTX::Limit::LineCap;
Ln.cmpd = new PPTX::Limit::CompoundLine;
Ln.algn = new PPTX::Limit::PenAlign;
auto* pLineEnd = new PPTX::Logic::LineEnd;
pLineEnd->m_name = L"a:headEnd";
pLineEnd->type = new PPTX::Limit::LineEndType;
pLineEnd->w = new PPTX::Limit::LineEndSize;
pLineEnd->len = new PPTX::Limit::LineEndSize;
Ln.headEnd = pLineEnd;
pLineEnd = new PPTX::Logic::LineEnd;
pLineEnd->m_name = L"a:tailEnd";
pLineEnd->type = new PPTX::Limit::LineEndType;
pLineEnd->w = new PPTX::Limit::LineEndSize;
pLineEnd->len = new PPTX::Limit::LineEndSize;
Ln.tailEnd = pLineEnd;
Ln.Join.type = PPTX::Logic::eJoin::JoinRound;
}
void TCell::setRowSpan(int rowSpan)
{
m_rowSpan = rowSpan;
}
void TCell::setPShape(CShapeElement *pShape)
{
m_pShape = pShape;
m_parentDirection = none;
}
ProtoTable::ProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters,
CRelsGenerator *pRels) : m_pRels(pRels)
{
m_arrLeft = getWidth(arrCells, false);
m_arrTop = getHeight(arrCells, false);
initProtoTable();
fillProtoTable(arrCells, arrSpliters);
}

View File

@ -0,0 +1,172 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h"
#include "ImageManager.h"
namespace PPT_FORMAT
{
class TCell
{
public:
TCell(CShapeElement *pShape, int row, int col, CRelsGenerator* pRels, TCell* pParent = nullptr);
void FillTc(PPTX::Logic::TableCell &oTc);
enum eMergeDirection {
none = 0b00,
vert = 0b01,
horz = 0b10,
hove = (horz | vert)
};
enum eBorderPossition
{
lnL,
lnR,
lnT,
lnB,
lnTlToBr,
lnBlToTr
};
void setBorder(eBorderPossition borderPos, CShapeElement *pBorder);
eMergeDirection parentDirection() const;
int getHeight()const;
void setPParent(TCell *pParent);
void setPShape(CShapeElement *pShape);
void setRowSpan(int rowSpan);
void setGridSpan(int gridSpan);
bool isRealCell()const;
private:
void FillTxBody(PPTX::Logic::TxBody &oTxBody);
void FillTcPr(PPTX::Logic::TableCellProperties& oTcPr);
void FillLn(PPTX::Logic::Ln& Ln, eBorderPossition eBP, CShapeElement* pBorder);
void FillMergeDirection(PPTX::Logic::TableCell& oTc);
void setParentDirection();
private:
CShapeElement* m_pShape;
std::map<eBorderPossition, CShapeElement*> m_mapBorders;
// Proto table's coord
int m_row, m_col;
int m_rowSpan;
int m_gridSpan;
// Parent
TCell* m_pParent;
eMergeDirection m_parentDirection;
// Common
CRelsGenerator* m_pRels;
};
typedef std::vector<TCell> ProtoTableRow;
typedef std::vector<ProtoTableRow> MProtoTable;
class ProtoTable
{
public:
ProtoTable(std::vector<CShapeElement *> &arrCells,
std::vector<CShapeElement*>& arrSpliters,
CRelsGenerator* pRels);
static std::vector<int> getWidth(std::vector<CShapeElement *> &arrCells, bool isWidth = true);
static std::vector<int> getHeight(std::vector<CShapeElement *> &arrCells, bool isHeight = true);
static bool checkRowForZeroHeight(const ProtoTableRow& oRow);
MProtoTable getTable() const;
private:
void initProtoTable();
bool fillProtoTable(std::vector<CShapeElement *> &arrCells, std::vector<CShapeElement *> &arrSpliters);
bool fillCells(std::vector<CShapeElement *> &arrCells);
void fillBorders(std::vector<CShapeElement *> &arrSpliters);
bool findCellPos(const int top, const int left, UINT& posRow, UINT& posCol);
std::list<TCell *> getParentCellFromTable(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol);
void setBorders(const UINT posFRow, const UINT posFCol, const UINT posLRow, const UINT posLCol, CShapeElement *pBorder);
bool isDefaultBoard(const CShapeElement *pBorder);
std::vector<std::vector<CShapeElement *> >
getRows(std::vector<CShapeElement *> &arrCells);
private:
std::vector<int> m_arrLeft;
std::vector<int> m_arrTop;
MProtoTable m_table;
CRelsGenerator* m_pRels;
};
class TableWriter
{
public:
TableWriter(CTableElement *pTableElement, CRelsGenerator* pRels);
void Convert(PPTX::Logic::GraphicFrame& oGraphicFrame);
private:
void FillNvGraphicFramePr(PPTX::Logic::NvGraphicFramePr& oNvGFPr);
void FillXfrm(PPTX::Logic::Xfrm& oXFRM);
void FillTable(PPTX::Logic::Table &oTable);
void FillTblPr(PPTX::Logic::TableProperties& oTblPr);
void FillTblGrid(std::vector<PPTX::Logic::TableCol>& tblGrid,
std::vector<CShapeElement *> &arrCells);
void prepareShapes(std::vector<CShapeElement*> &arrCells,
std::vector<CShapeElement*>& arrSpliters);
void FillRow(PPTX::Logic::TableRow& oRow, ProtoTableRow &arrCells);
private:
std::wstring getXmlForGraphicFrame()const;
void CorrectGraphicFrame(PPTX::Logic::GraphicFrame& oGraphicFrame);
void FillnvPr(PPTX::Logic::NvPr& oNvPr);
private:
CTableElement* m_pTableElement;
CRelsGenerator* m_pRels;
nullable<ProtoTable> m_nPTable;
};
}

View File

@ -0,0 +1,695 @@
#include "TxBodyConverter.h"
#include "../../../Common/MS-LCID.h"
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ShapeType.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h"
#include "StylesWriter.h"
using namespace PPT_FORMAT;
TxBodyConverter::TxBodyConverter(CShapeElement *pShapeElement, CRelsGenerator* pRels, TxBodyConverter::eTxType txType) :
m_pShapeElement(pShapeElement), m_pRels(pRels), m_txType(txType),
m_bWordArt(false)
{
if (pShapeElement && pShapeElement->m_pShape)
pText = &pShapeElement->m_pShape->m_oText;
else
pText = nullptr;
}
void TxBodyConverter::FillTxBody(PPTX::Logic::TxBody &oTxBody)
{
if (m_pShapeElement == nullptr)
{
FillMergedTxBody(oTxBody);
return;
}
switch (m_txType)
{
case shape: ConvertShapeTxBody(oTxBody); break;
case table: ConvertTableTxBody(oTxBody); break;
}
}
void TxBodyConverter::ConvertTableTxBody(PPTX::Logic::TxBody &oTxBody)
{
oTxBody.m_name = L"a:txBody";
oTxBody.bodyPr = new PPTX::Logic::BodyPr;
FillBodyPr(oTxBody.bodyPr.get2());
size_t nCount = pText->m_arParagraphs.size();
if (nCount == 0)
{
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
PPTX::Logic::Paragraph paragraph;
unsigned sz = m_pShapeElement->m_rcChildAnchor.GetHeight() * 10;
paragraph.endParaRPr = getNewEndParaRPr(false, sz > 2000 ? 2000 : sz);
oTxBody.Paragrs.push_back(paragraph);
return;
}
if (pText == nullptr)
return;
// todo
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
if (!m_bWordArt)
FillLstStyles(oTxBody.lstStyle.get2(), pText->m_oStyles);
for (size_t nIndexPar = 0; nIndexPar < nCount; ++nIndexPar)
{
PPTX::Logic::Paragraph p;
FillParagraph(p,pText->m_arParagraphs[nIndexPar]);
oTxBody.Paragrs.push_back(std::move(p));
}
// if (m_pText)
// {
// FillLstStyles(oTxBody.lstStyle.get2(), m_pText->m_oStyles);
// FillParagraphs(oTxBody.Paragrs, m_pText->m_arParagraphs);
// }
}
void TxBodyConverter::ConvertShapeTxBody(PPTX::Logic::TxBody &oTxBody)
{
}
void TxBodyConverter::FillMergedTxBody(PPTX::Logic::TxBody &oTxBody)
{
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
oTxBody.bodyPr = new PPTX::Logic::BodyPr;
oTxBody.lstStyle = new PPTX::Logic::TextListStyle;
PPTX::Logic::Paragraph paragraph;
paragraph.endParaRPr = getNewEndParaRPr();
oTxBody.Paragrs.push_back(paragraph);
}
void TxBodyConverter::FillBodyPr(PPTX::Logic::BodyPr &oBodyPr)
{
CDoubleRect oTextRect;
m_pShapeElement->m_pShape->GetTextRect(oTextRect);
oBodyPr.lIns = oTextRect.left;
oBodyPr.rIns = oTextRect.right;
oBodyPr.tIns = oTextRect.top;
oBodyPr.bIns = oTextRect.bottom;
auto pAnchor = new PPTX::Limit::TextAnchor;
switch (pText->m_oAttributes.m_nTextAlignVertical)
{
case 0: pAnchor->set(L"t"); break;
case 2: pAnchor->set(L"b"); break;
default:
pAnchor->set(L"ctr");
oBodyPr.anchorCtr = false;
}
oBodyPr.anchor = pAnchor;
if (m_pShapeElement->m_pShape->m_oText.m_bAutoFit)
oBodyPr.Fit.type = PPTX::Logic::TextFit::FitSpAuto;
if (pText->m_oAttributes.m_dTextRotate > 0)
oBodyPr.rot = round(pText->m_oAttributes.m_dTextRotate * 60000);
if (pText->m_nTextFlow >= 0)
{
auto *pVert = new PPTX::Limit::TextVerticalType;
switch(pText->m_nTextFlow)
{
case 1:
case 3: pVert->set(L"vert"); break;
case 2: pVert->set(L"vert270"); break;
case 5: pVert->set(L"wordArtVert"); break;
}
oBodyPr.vert = pVert;
}
else if (pText->m_bVertical)
{
auto *pVert = new PPTX::Limit::TextVerticalType;
pVert->set(L"eaVert");
oBodyPr.vert = pVert;
}
std::wstring prstGeom = oox::Spt2ShapeType_mini((oox::MSOSPT)m_pShapeElement->m_lShapeType);
std::wstring prstTxWarp = oox::Spt2WordArtShapeType((oox::MSOSPT)m_pShapeElement->m_lShapeType);
if (prstGeom.size() && prstTxWarp.size())
{
m_bWordArt = true;
auto pPrstTxWarp = new PPTX::Logic::PrstTxWarp;
pPrstTxWarp->prst.set(prstTxWarp);
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_pShape->getBaseShape().get());
std::wstring strVal;
for (size_t i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++)
{
PPTX::Logic::Gd gd;
switch(m_pShapeElement->m_lShapeType)
{
case oox::msosptTextFadeUp:
{
double kf = 4.63; //"волшебный"
std::wstring strVal = std::to_wstring(round(kf * pPPTShape->m_arAdjustments[i]));
gd.fmla = L"val";
gd.name = L"adj";
pPrstTxWarp->avLst.push_back(std::move(gd));
}break;
}
}
oBodyPr.prstTxWarp = pPrstTxWarp;
}
}
void TxBodyConverter::FillLstStyles(PPTX::Logic::TextListStyle &oTLS, CTextStyles &oStyles)
{
}
void TxBodyConverter::FillParagraph(PPTX::Logic::Paragraph &p, CParagraph &paragraph)
{
p.pPr = new PPTX::Logic::TextParagraphPr;
FillPPr(p.pPr.get2(), paragraph);
size_t nCountSpans = paragraph.m_arSpans.size();
for (size_t nSpan = 0; nSpan < nCountSpans; ++nSpan)
{
if ((nSpan == (nCountSpans - 1)) && (_T("\n") == paragraph.m_arSpans[nSpan].m_strText || paragraph.m_arSpans[nSpan].m_strText.empty()) )
{
PPT_FORMAT::CTextCFRun* pCF = &paragraph.m_arSpans[nSpan].m_oRun;
if ((pCF->Size.is_init()) && (pCF->Size.get() > 0) && (pCF->Size.get() < 4001))
p.endParaRPr = getNewEndParaRPr(-1, (100 * pCF->Size.get()), L"en-US");
else
p.endParaRPr = getNewEndParaRPr(-1, -1, L"en-US");
continue;
}
int span_sz = paragraph.m_arSpans[nSpan].m_strText.length() ;
if ((span_sz==1 && ( paragraph.m_arSpans[nSpan].m_strText[0] == (wchar_t)13 )) ||
((span_sz==2 && ( paragraph.m_arSpans[nSpan].m_strText[0] == (wchar_t)13 ) &&
( paragraph.m_arSpans[nSpan].m_strText[1] == (wchar_t)13 ))))
continue;
PPTX::Logic::RunElem runElem;
if (paragraph.m_arSpans[nSpan].m_bBreak)
{
auto pBr = new PPTX::Logic::Br;
pBr->rPr = new PPTX::Logic::RunProperties;
FillRPr(pBr->rPr.get2(), paragraph.m_arSpans[nSpan].m_oRun);
runElem.InitRun(pBr);
} else
{
auto pRun = new PPTX::Logic::Run();
FillRun(*pRun, paragraph.m_arSpans[nSpan]);
runElem.InitRun(pRun);
auto pFld = new PPTX::Logic::Fld;
if (m_pShapeElement->m_lPlaceholderType == PT_MasterSlideNumber/* && paragraph.m_arSpans[nSpan].m_bField*/)
{
pFld->id = L"{D038279B-FC19-497E-A7D1-5ADD9CAF016F}";
pFld->type = L"slidenum";
} else if (m_pShapeElement->m_lPlaceholderType == PT_MasterDate && m_pShapeElement->m_nFormatDate == 1/* && pParagraph->m_arSpans[nSpan].m_bField*/)
{
pFld->id = L"{D7E01130-044F-4930-9A27-C729C70D8524}";
pFld->type = L"datetime1";
} else {
delete pFld;
pFld = nullptr;
}
if (pFld)
{
PPTX::Logic::RunElem runElemFld;
runElemFld.InitRun(pFld);
p.RunElems.push_back(std::move(runElemFld));
}
}
p.RunElems.push_back(std::move(runElem));
}
}
void TxBodyConverter::FillPPr(PPTX::Logic::TextParagraphPr &oPPr, CParagraph &paragraph)
{
oPPr.lvl = paragraph.m_lTextLevel;
auto* pPF = &(paragraph.m_oPFRun);
if (pPF)
ConvertPFRun(oPPr, pPF);
}
void TxBodyConverter::ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF)
{
if (pPF->textDirection.is_init())
{
if (pPF->textDirection.get() == 1) oPPr.rtl = true;
else oPPr.rtl = false;
}
if (pPF->fontAlign.is_init())
{
oPPr.fontAlgn = new PPTX::Limit::FontAlign;
oPPr.fontAlgn->set(CStylesWriter::GetFontAlign(pPF->fontAlign.get()));
}
int leftMargin = 0;
if (pPF->leftMargin.is_init())
{
leftMargin = pPF->leftMargin.get();
oPPr.marL = leftMargin;
}
if (pPF->indent.is_init())
{
oPPr.indent = pPF->indent.get() - leftMargin;
}
if (pPF->textAlignment.is_init())
{
oPPr.algn = new PPTX::Limit::TextAlign;
oPPr.algn->set(CStylesWriter::GetTextAlign(pPF->textAlignment.get()));
}
if (pPF->defaultTabSize.is_init())
{
oPPr.defTabSz = pPF->defaultTabSize.get();
}
ConvertTabStops(oPPr.tabLst, pPF->tabStops);
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
auto pLnSpc = new PPTX::Logic::TextSpacing;
pLnSpc->m_name = L"a:lnSpc";
if (val > 0)
pLnSpc->spcPct = val * 12.5;
else if (val < 0 && val > -13200)
pLnSpc->spcPct = val * -1000;
oPPr.lnSpc = pLnSpc;
}
if (pPF->spaceAfter.is_init())
{
LONG val = pPF->spaceAfter.get();
auto pSpcAft = new PPTX::Logic::TextSpacing;
pSpcAft->m_name = L"a:spcAft";
if (val > 0)
pSpcAft->spcPts = round(12.5 * pPF->spaceAfter.get());
else if (val < 0 && val > -13200)
pSpcAft->spcPts = val * -1000;
oPPr.spcAft = pSpcAft;
}
if (pPF->spaceBefore.is_init())
{
LONG val = pPF->spaceBefore.get();
auto pSpcBef = new PPTX::Logic::TextSpacing;
pSpcBef->m_name = L"a:spcBef";
if (val > 0)
pSpcBef->spcPts = round(12.5 * pPF->spaceBefore.get());
else if (val < 0 && val > -13200)
pSpcBef->spcPts = val * -1000;
oPPr.spcBef = pSpcBef;
}
ConvertAllBullets(oPPr, pPF);
}
void TxBodyConverter::ConvertTabStops(std::vector<PPTX::Logic::Tab> &arrTabs, std::vector<std::pair<int, int> > &arrTabStops)
{
for (size_t t = 0 ; t < arrTabStops.size(); t++)
{
PPTX::Logic::Tab tab;
tab.pos = arrTabStops[t].first;
auto pAlgn = new PPTX::Limit::TextTabAlignType;
switch (arrTabStops[t].second)
{
case 1: pAlgn->set(L"ctr"); break;
case 2: pAlgn->set(L"r"); break;
case 3: pAlgn->set(L"dec"); break;
default: pAlgn->set(L"l");
}
tab.algn = pAlgn;
arrTabs.push_back(tab);
}
}
void TxBodyConverter::FillBuChar(PPTX::Logic::Bullet &oBullet, WCHAR symbol)
{
auto pBuChar = new PPTX::Logic::BuChar;
pBuChar->Char.clear();
pBuChar->Char.push_back(symbol);
oBullet.m_Bullet.reset(pBuChar);
}
void TxBodyConverter::ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF)
{
if (pPF->hasBullet.is_init())
{
if (pPF->hasBullet.get())
{
if (pPF->bulletColor.is_init())
{
FillBuClr(oPPr.buColor, pPF->bulletColor.get());
}
if (pPF->bulletSize.is_init())
{
PPTX::WrapperWritingElement* pBuSize;
if (pPF->bulletSize.get() > 24 && pPF->bulletSize.get() < 401)
{
pBuSize = new PPTX::Logic::BuSzPct;
static_cast<PPTX::Logic::BuSzPct*>(pBuSize)->val = pPF->bulletSize.get() * 1000 ;
}
if (pPF->bulletSize.get() < 0 && pPF->bulletSize.get() > -4001)
{
pBuSize = new PPTX::Logic::BuSzPts;
static_cast<PPTX::Logic::BuSzPts*>(pBuSize)->val = - (pPF->bulletSize.get());
}
oPPr.buSize.m_Size = pBuSize;
}
if (pPF->bulletFontProperties.is_init())
{
auto pBuFont = new PPTX::Logic::TextFont;
pBuFont->m_name = L"a:buFont";
pBuFont->typeface = pPF->bulletFontProperties->Name;
if ( pPF->bulletFontProperties->PitchFamily > 0)
pBuFont->pitchFamily = std::to_wstring(pPF->bulletFontProperties->PitchFamily);
if ( pPF->bulletFontProperties->Charset > 0)
pBuFont->charset = std::to_wstring(pPF->bulletFontProperties->Charset);
oPPr.buTypeface.m_Typeface.reset(pBuFont);
}
bool set = true;
if (pPF->bulletAutoNum.is_init())
{
auto pBuAutoNum = new PPTX::Logic::BuAutoNum;
oPPr.ParagraphBullet.m_Bullet.reset(pBuAutoNum);
if (pPF->bulletAutoNum->startAt.is_init() && pPF->bulletAutoNum->startAt.get() != 1)
pBuAutoNum->startAt = pPF->bulletAutoNum->startAt.get();
if (pPF->bulletAutoNum->type.is_init())
pBuAutoNum->type = pPF->bulletAutoNum->type.get();
set = false;
}
if (pPF->bulletFontProperties.is_init() == false && pPF->bulletSize.is_init() == false)
{
auto pBuFont = new PPTX::Logic::BuFontTx;
oPPr.buTypeface.m_Typeface.reset(pBuFont);
if (pPF->bulletColor.is_init() == false)
set = false;
}
if (pPF->bulletChar.is_init())
{
FillBuChar(oPPr.ParagraphBullet, pPF->bulletChar.get());
} else if (set)
{
FillBuChar(oPPr.ParagraphBullet, L'');
}
if (pPF->bulletColor.is_init())
{
FillBuClr(oPPr.buColor, pPF->bulletColor.get());
}
}
else
{
oPPr.buTypeface.m_Typeface.reset(new PPTX::Logic::BuNone);
}
}
}
void TxBodyConverter::FillBuClr(PPTX::Logic::BulletColor &oBuClr, CColor &oColor)
{
auto pBuClr = new PPTX::Logic::BuClr;
pBuClr->Color.SetRGBColor(oColor.GetR(), oColor.GetG(), oColor.GetB());
oBuClr.m_Color.reset(pBuClr);
}
void TxBodyConverter::FillRun(PPTX::Logic::Run &oRun, CSpan &oSpan)
{
oRun.SetText(oSpan.m_strText);
oRun.rPr = new PPTX::Logic::RunProperties;
FillRPr(oRun.rPr.get2(), oSpan.m_oRun);
}
PPTX::Logic::RunProperties *TxBodyConverter::getNewEndParaRPr(const int dirty, const int sz , const std::wstring& lang)
{
auto pEndParaRPr = new PPTX::Logic::RunProperties;
pEndParaRPr->m_name = L"a:endParaRPr";
if (dirty == 0 || dirty == 1)
pEndParaRPr->dirty = (bool)dirty;
if (sz > 0)
pEndParaRPr->sz = sz;
if (lang.size())
pEndParaRPr->lang = lang;
return pEndParaRPr;
}
void TxBodyConverter::FillRPr(PPTX::Logic::RunProperties &oRPr, CTextCFRun &oCFRun)
{
oRPr.normalizeH = false;
if ((oCFRun.Size.is_init()) && (oCFRun.Size.get() > 0) && (oCFRun.Size.get() < 4001))
{
oRPr.sz = int(100 * oCFRun.Size.get());
} else
{
oRPr.sz = 1800;
}
if (oCFRun.BaseLineOffset.is_init())
{
oRPr.baseline = int(1000 * oCFRun.BaseLineOffset.get());
}
if (oCFRun.FontBold.is_init())
{
oRPr.b = oCFRun.FontBold.get();
}
else
{
oRPr.b = false;
}
if (oCFRun.FontItalic.is_init())
{
oRPr.i = oCFRun.FontItalic.get();
}
if (oCFRun.FontUnderline.is_init())
{
oRPr.u = new PPTX::Limit::TextUnderline;
oRPr.u->set(oCFRun.FontUnderline.get() ? L"sng" : L"none");
}
if (oCFRun.Language.is_init())
{
std::wstring str_lang = msLCID2wstring(oCFRun.Language.get());
if (str_lang.length() > 0)
oRPr.lang = msLCID2wstring(oCFRun.Language.get());
}
if (m_bWordArt)
{//порядок важен - линия, заливка, тень !!!
if (m_pShapeElement->m_bLine)
{
oRPr.ln = new PPTX::Logic::Ln;
ConvertLine(oRPr.ln.get2());
}
// I don't know todo or not
// m_oWriter.WriteString(ConvertBrush(pShapeElement->m_oBrush));
// m_oWriter.WriteString(ConvertShadow(pShapeElement->m_oShadow));
}
else
{
if (oCFRun.Color.is_init())
{
if (oCFRun.Color->m_lSchemeIndex != -1)
{
FillSchemeClr(oRPr.Fill, oCFRun.Color.get());
}
else
{
FillSolidFill(oRPr.Fill, oCFRun.Color.get());
}
}
}
FillEffectLst(oRPr.EffectList, oCFRun);
if (oCFRun.Color.is_init())
FillSolidFill(oRPr.Fill, oCFRun.Color.get());
if (oCFRun.font.font.is_init())
{
oRPr.latin = new PPTX::Logic::TextFont;
oRPr.latin->m_name = L"a:latin";
oRPr.latin->typeface = oCFRun.font.font->Name;
oRPr.latin->charset = std::to_wstring(oCFRun.font.font->Charset);
oRPr.latin->pitchFamily = std::to_wstring(oCFRun.font.font->PitchFamily + 2);
} // todo else for fontRef.is_init() // it's theme
if (oCFRun.font.ea.is_init())
{
oRPr.ea = new PPTX::Logic::TextFont;
oRPr.ea->m_name = L"a:ea";
oRPr.ea->typeface = oCFRun.font.ea->Name;
oRPr.ea->charset = std::to_wstring(oCFRun.font.ea->Charset);
}
if (oCFRun.font.sym.is_init())
{
oRPr.sym = new PPTX::Logic::TextFont;
oRPr.sym->m_name = L"a:sym";
oRPr.sym->typeface = oCFRun.font.sym->Name;
oRPr.sym->charset = std::to_wstring(oCFRun.font.sym->Charset);
}
}
void TxBodyConverter::ConvertLine(PPTX::Logic::Ln &oLn)
{
auto& oPen = m_pShapeElement->m_oPen;
oLn.cmpd = new PPTX::Limit::CompoundLine;
switch(oPen.LineStyle)
{
case 1: oLn.cmpd->set(L"dbl"); break;
case 2: oLn.cmpd->set(L"thickThin"); break;
case 3: oLn.cmpd->set(L"thinThick"); break;
case 4: oLn.cmpd->set(L"tri"); break;
}
oLn.w = oPen.Size;
FillSolidFill(oLn.Fill, oPen.Color);
if (oPen.DashStyle > 0 && oPen.DashStyle < 11)
{
oLn.prstDash = new PPTX::Logic::PrstDash;
oLn.prstDash.get2().val = new PPTX::Limit::PrstDashVal;
auto& val = oLn.prstDash.get2().val;
switch(oPen.DashStyle)
{
case 1: val->set(L"sysDash"); break;
case 2: val->set(L"sysDot"); break;
case 3: val->set(L"sysDashDot"); break;
case 4: val->set(L"sysDashDotDot"); break;
case 5: val->set(L"dot"); break;
case 6: val->set(L"dash"); break;
case 7: val->set(L"lgDash"); break;
case 8: val->set(L"dashDot"); break;
case 9: val->set(L"lgDashDot"); break;
case 10: val->set(L"lgDashDotDot"); break;
}
}
switch(oPen.LineJoin)
{
case 0: oLn.Join.type = PPTX::Logic::eJoin::JoinBevel; break;
case 1: oLn.Join.type = PPTX::Logic::eJoin::JoinMiter; break;
case 2: oLn.Join.type = PPTX::Logic::eJoin::JoinRound; break;
}
oLn.headEnd = new PPTX::Logic::LineEnd;
oLn.tailEnd = new PPTX::Logic::LineEnd;
ConvertLineEnd(oLn.headEnd.get2(), oPen.LineStartCap, oPen.LineStartLength, oPen.LineStartWidth, true);
ConvertLineEnd(oLn.tailEnd.get2(), oPen.LineEndCap, oPen.LineEndLength, oPen.LineEndWidth, false);
}
void TxBodyConverter::ConvertLineEnd(PPTX::Logic::LineEnd &oLine, unsigned char cap, unsigned char length, unsigned char width, bool isHead)
{
if (cap < 1)
return;
if (isHead)
oLine.m_name = L"a:headEnd";
else
oLine.m_name = L"a:tailEnd";
oLine.type = new PPTX::Limit::LineEndType;
switch(cap)
{
case 1: oLine.type->set(L"triangle"); break;
case 2: oLine.type->set(L"stealth"); break;
case 3: oLine.type->set(L"diamond"); break;
case 4: oLine.type->set(L"oval"); break;
case 5: oLine.type->set(L"arrow"); break;
}
oLine.len = new PPTX::Limit::LineEndSize;
switch(length)
{
case 0: oLine.len->set(L"sm"); break;
case 1: oLine.len->set(L"med"); break;
case 2: oLine.len->set(L"lg"); break;
}
oLine.w = new PPTX::Limit::LineEndSize;
switch(width)
{
case 0: oLine.w->set(L"sm"); break;
case 1: oLine.w->set(L"med"); break;
case 2: oLine.w->set(L"lg"); break;
}
}
void TxBodyConverter::ConvertBrush(PPTX::Logic::RunProperties &oRPr)
{
CBrush& brush = m_pShapeElement->m_oBrush;
}
void TxBodyConverter::FillSolidFill(PPTX::Logic::UniFill &oUF, CColor &oColor)
{
auto pSolidFill = new PPTX::Logic::SolidFill;
pSolidFill->Color.SetRGBColor(oColor.GetR(), oColor.GetG(), oColor.GetB());
oUF.Fill.reset(pSolidFill);
}
void TxBodyConverter::FillSchemeClr(PPTX::Logic::UniFill &oUF, CColor &oColor)
{
auto pSolidFill = new PPTX::Logic::SolidFill;
auto pScheme = new PPTX::Logic::SchemeClr;
pScheme->val.set(CStylesWriter::GetColorInScheme(oColor.m_lSchemeIndex));
pSolidFill->Color.Color.reset(pScheme);
oUF.Fill.reset(pSolidFill);
}
void TxBodyConverter::FillEffectLst(PPTX::Logic::EffectProperties &oEList, CTextCFRun &oCFRun)
{
auto pELst = new PPTX::Logic::EffectLst;
if (oCFRun.FontShadow.is_init() && oCFRun.FontShadow.get())
{
pELst->outerShdw = new PPTX::Logic::OuterShdw;
pELst->outerShdw->blurRad = 38100;
pELst->outerShdw->dist = 38100;
pELst->outerShdw->dir = 2700000;
pELst->outerShdw->algn = new PPTX::Limit::RectAlign;
pELst->outerShdw->algn->set(L"tl");
pELst->outerShdw->Color.SetRGBColor(0, 0, 0);
}
oEList.List.reset(pELst);
}

View File

@ -0,0 +1,91 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.h"
#include "ImageManager.h"
namespace PPT_FORMAT
{
class TxBodyConverter
{
public:
enum eTxType
{
shape,
table
};
TxBodyConverter(CShapeElement* pShapeElement, CRelsGenerator* pRels, eTxType txType);
void FillTxBody(PPTX::Logic::TxBody& oTxBody);
private:
void ConvertTableTxBody(PPTX::Logic::TxBody& oTxBody);
void ConvertShapeTxBody(PPTX::Logic::TxBody& oTxBody);
void FillMergedTxBody(PPTX::Logic::TxBody& oTxBody);
private:
void FillBodyPr(PPTX::Logic::BodyPr& oBodyPr);
void FillLstStyles(PPTX::Logic::TextListStyle& oTLS, CTextStyles& oStyles);
void FillParagraph(PPTX::Logic::Paragraph& p, CParagraph& paragraph);
void FillPPr(PPTX::Logic::TextParagraphPr& oPPr, CParagraph &paragraph);
void ConvertPFRun(PPTX::Logic::TextParagraphPr &oPPr, PPT_FORMAT::CTextPFRun* pPF);
void ConvertTabStops(std::vector<PPTX::Logic::Tab>& arrTabs, std::vector<std::pair<int, int>>& arrTabStops);
void FillBuChar(PPTX::Logic::Bullet& oBullet, WCHAR symbol);
void ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTextPFRun *pPF);
void FillBuClr(PPTX::Logic::BulletColor& oBuClr, CColor& oColor);
void FillRun(PPTX::Logic::Run& oRun, CSpan &oSpan);
PPTX::Logic::RunProperties* getNewEndParaRPr(const int dirty = -1, const int sz = -1, const std::wstring& lang = L"");
void FillRPr(PPTX::Logic::RunProperties& oRPr, CTextCFRun& oCFRun);
void ConvertLine(PPTX::Logic::Ln& oLn);
void ConvertLineEnd(PPTX::Logic::LineEnd& oLine, unsigned char cap, unsigned char length, unsigned char width, bool isHead);
void ConvertBrush(PPTX::Logic::RunProperties& oRPr);
void FillSolidFill(PPTX::Logic::UniFill& oUF, CColor& oColor);
void FillSchemeClr(PPTX::Logic::UniFill& oUF, CColor& oColor);
void FillEffectLst(PPTX::Logic::EffectProperties &oEList, CTextCFRun& oCFRun);
void FillParagraphs(std::vector<PPTX::Logic::Paragraph>& arrP, std::vector<CParagraph>& arrParagraphs);
void ConvertStyleLevel(PPTX::Logic::TextParagraphPr &oLevel, CTextStyleLevel& oOldLevel, const int& nLevel);
void FillEndParaRPr(PPTX::Logic::RunProperties& oEndPr, CTextPFRun& oPFRun);
void FillCS(PPTX::Logic::TextFont& oCs, CFontProperties& font);
private:
CShapeElement* m_pShapeElement;
CRelsGenerator* m_pRels;
CTextAttributesEx* pText;
eTxType m_txType;
bool m_bWordArt;
};
}

View File

@ -536,8 +536,8 @@ void CPPTUserInfo::FromDocument()
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom)
{
m_bHasDate = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasDate/* ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
m_bHasFooter = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasFooter;
m_bHasSlideNumber = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasSlideNumber;
@ -731,8 +731,8 @@ void CPPTUserInfo::LoadNotes(_UINT32 dwNoteID, CSlide* pNotes)
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom)
{
bHasDate = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasDate/* ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
bHasFooter = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasFooter;
bHasSlideNumber = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasSlideNumber;
@ -963,8 +963,8 @@ void CPPTUserInfo::LoadSlide(_UINT32 dwSlideID, CSlide* pSlide)
if (oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom)
{
bHasDate = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasDate/* ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasTodayDate ||
oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasUserDate*/;
bHasFooter = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasFooter;
bHasSlideNumber = oArrayHeadersFootersInfo[0]->m_oHeadersFootersAtom->m_bHasSlideNumber;
@ -1629,6 +1629,14 @@ void CPPTUserInfo::LoadMainMaster(_UINT32 dwMasterID)
}
int lLayoutID = AddNewLayout(pTheme, pMaster, false, true);
for (auto& oMaster : m_mapMasters)
oMaster.second->GetRecordsByType(&pTheme->m_arrZipXml, false);
// for (auto& oNoteMaster : m_mapNotesMasters)
// oNoteMaster.second->GetRecordsByType(&pTheme->m_arrZipXml, false);
// for (auto& oHandoutMaster : m_mapHandoutMasters)
// oHandoutMaster.second->GetRecordsByType(&pTheme->m_arrZipXml, false);
if (lLayoutID >= 0 && false == pTheme->m_arLayouts.empty())
{
CLayout *pLayout_ = pTheme->m_arLayouts.back().get();
@ -2369,58 +2377,67 @@ void CPPTUserInfo::LoadExternal(CRecordExObjListContainer* pExObjects)
//--------------------------------------------------------------------
std::vector<CRecordExHyperlinkContainer*> oArrayHyperlinkContainer;
pExObjects->GetRecordsByType(&oArrayHyperlinkContainer , true);
for (size_t nIndex = 0; nIndex < oArrayHyperlinkContainer.size(); ++nIndex)
for (const auto* pExHyperlink : oArrayHyperlinkContainer)
{
std::vector<CRecordExHyperlinkAtom*> oArrayHyperlink;
std::vector<CRecordCString*> oArrayCString;
if (!pExHyperlink || !pExHyperlink->hasCString())
continue;
oArrayHyperlinkContainer[nIndex]->GetRecordsByType (&oArrayHyperlink, false);
oArrayHyperlinkContainer[nIndex]->GetRecordsByType (&oArrayCString, false);
PPT_FORMAT::CExFilesInfo oInfo;
oInfo.m_dwID = pExHyperlink->m_exHyperlinkAtom.m_nHyperlinkID;
if (oArrayCString.size() > 0 && oArrayHyperlink.size() > 0)
bool wasSlide = false;
// bool wasLink = false;
// it isn't normal that here we should catch slide number.
if (pExHyperlink->m_friendlyNameAtom.IsInit())
{
PPT_FORMAT::CExFilesInfo oInfo;
oInfo.m_dwID = oArrayHyperlink[0]->m_nHyperlinkID;
for (size_t i = 0 ; i < oArrayCString.size(); i++)
std::wstring& recStr =pExHyperlink->m_friendlyNameAtom->m_strText;
int slideNum = oInfo.GetSlideNumber(recStr);
if (slideNum != -1)
{
const auto& recStr = oArrayCString[i]->m_strText;
const auto recInst = oArrayCString[i]->m_oHeader.RecInstance;
// Target atom. It's for eigher local and external files.
if (recInst == 1)
{
oInfo.m_strFilePath = recStr;
oInfo.m_type = oInfo.isHTTPLink(recStr) ? CExFilesInfo::ExFilesType::eftHyperlink :
CExFilesInfo::ExFilesType::eftAudio;
}
// Location atom. It's for slides or other local pp objects.
else if (recInst == 3 && oInfo.GetSlideNumber(recStr) != -1)
{
oInfo.m_strFilePath = recStr;
oInfo.m_type = CExFilesInfo::ExFilesType::eftSlide;
}
else
continue;
}
switch (oInfo.m_type)
{
case CExFilesInfo::ExFilesType::eftHyperlink:
m_oExMedia.m_arHyperlinks.push_back(oInfo);
break;
case CExFilesInfo::ExFilesType::eftAudio:
m_oExMedia.m_arAudioCollection.push_back(oInfo);
break;
case CExFilesInfo::ExFilesType::eftSlide:
oInfo.m_strFilePath = recStr;
oInfo.m_type = CExFilesInfo::ExFilesType::eftSlide;
m_oExMedia.m_arSlides.push_back(oInfo);
break;
default:
wasSlide = true;
}
}
if (pExHyperlink->m_targetAtom.IsInit())
{
std::wstring& recStr =pExHyperlink->m_targetAtom->m_strText;
oInfo.m_strFilePath = recStr;
if (oInfo.isAudioLink(recStr))
{
oInfo.m_type = CExFilesInfo::ExFilesType::eftAudio;
m_oExMedia.m_arAudioCollection.push_back(oInfo);
}else if (oInfo.isHTTPLink(recStr))
{
oInfo.m_type = CExFilesInfo::ExFilesType::eftHyperlink;
m_oExMedia.m_arHyperlinks.push_back(oInfo);
}else{
oInfo.m_type = CExFilesInfo::ExFilesType::eftHyperlink;
m_oExMedia.m_arHyperlinks.push_back(oInfo);
}
}
if (pExHyperlink->m_locationAtom.IsInit())
{
// Here we need to write some records like file's path and slides
std::wstring& recStr = pExHyperlink->m_locationAtom->m_strText;
oInfo.m_strFilePath = recStr;
if (!wasSlide)
{
oInfo.m_type = CExFilesInfo::ExFilesType::eftSlide;
m_oExMedia.m_arSlides.push_back(oInfo);
} else if (!m_oExMedia.m_arSlides.empty())
{
oInfo.m_type = CExFilesInfo::ExFilesType::eftSlide;
m_oExMedia.m_arSlides.back().m_strFilePath = recStr;
}
}
}
}
@ -2532,7 +2549,7 @@ void CPPTUserInfo::AddAudioTransition (_UINT32 refID, CTransition* pTransition,
std::wstring audioName = strRecord->m_strText;
;
// audioName.erase(audioName.find(L"."), audioName.end()); todo
// audioName.erase(audioName.find(L"."), audioName.end()); todo
if (strRecord)
pTransition->m_oAudio.m_sImageName = audioName;

View File

@ -517,7 +517,7 @@ void CTextCFRunRecord::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation
namespace PPT_FORMAT
{
void ConvertPPTTextToEditorStructure(std::vector<CTextPFRunRecord>& oArrayPF, std::vector<CTextCFRunRecord>& oArrayCF,
std::wstring& strText, PPT_FORMAT::CTextAttributesEx& oAttributes)
std::wstring& strText, PPT_FORMAT::CTextAttributesEx& oAttributes)
{
int nCountPFs = (int)oArrayPF.size();
int nCountCFs = (int)oArrayCF.size();

View File

@ -342,6 +342,6 @@ public:
namespace PPT_FORMAT
{
void ConvertPPTTextToEditorStructure(std::vector<CTextPFRunRecord>& oArrayPF, std::vector<CTextCFRunRecord>& oArrayCF,
std::wstring& strText, PPT_FORMAT::CTextAttributesEx& oAttributes);
void ConvertPPTTextToEditorStructure(std::vector<CTextPFRunRecord>& oArrayPF, std::vector<CTextCFRunRecord>& oArrayCF,
std::wstring& strText, PPT_FORMAT::CTextAttributesEx& oAttributes);
}

View File

@ -528,7 +528,8 @@ IRecord* CreateByType(SRecordHeader oHeader)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPEID12 , CRecordRoundTripShapeId12Atom)
CREATE_BY_TYPE(RT_RoundTripHFPlaceholder12Atom , CRecordRoundTripHFPlaceholder12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERID , CRecordRoundTripContentMasterId12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12 , CRecordRoundTripOArtTextStyles12Atom)
CREATE_BY_TYPE(RT_RoundTripOArtTextStyles12Atom , CRecordRoundTripOArtTextStyles12Atom)
CREATE_BY_TYPE(RT_RoundTripHeaderFooterDefaults12Atom , CRecordRoundTripHeaderFooterDefaults12Atom)
CREATE_BY_TYPE(RT_RoundTripNotesMasterTextStyles12Atom , CRecordRoundTripNotesMasterTextStyles12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPDOCFLAGS12 , CRecordRoundTripDocFlags12Atom)
@ -613,6 +614,8 @@ IRecord* CreateByType(SRecordHeader oHeader)
CREATE_BY_TYPE(RTE_SPLITMENUCOLORS , CRecordSplitMenuColorRecord)
CREATE_BY_TYPE(RTE_COLORMRU , CRecordMostRecentlyUserColors)
CREATE_BY_TYPE(RTE_CLIENTDATA , CRecordOfficeArtClientData)
CREATE_BY_TYPE(RTE_CLIENTTEXTBOX , CRecordOfficeArtClientTextbox)
CREATE_BY_TYPE(RT_ExternalCdAudio , CRecordExCDAudioContainer)
CREATE_BY_TYPE(RT_ExternalWavAudioLink , CRecordWAVAudioLinkContainer)
@ -624,6 +627,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
// интерактив
CREATE_BY_TYPE(RT_InteractiveInfoAtom , CRecordInteractiveInfoAtom)
CREATE_BY_TYPE(RT_TextInteractiveInfoAtom , CRecordTextInteractiveInfoAtom)
CREATE_BY_TYPE(RT_InteractiveInfo , CRecordMouseInteractiveInfoContainer)
// читаем для анимации
@ -632,15 +636,14 @@ IRecord* CreateByType(SRecordHeader oHeader)
CREATE_BY_TYPE(RT_Sound , CRecordSoundContainer)
CREATE_BY_TYPE(RT_SoundDataBlob , CRecordSoundDataBlob)
CREATE_BY_TYPE(RT_MetaFile , CRecordMetafileBlob)
default:
{
// std::cout << GetRecordName(oHeader.RecType) << ": " << oHeader.RecLen << "\n";
}break;
};
// std::cout << GetRecordName(oHeader.RecType) << ": " << oHeader.RecLen << "\n";
if (NULL == pRecord)
{

View File

@ -225,7 +225,7 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream);
template <typename T>
void GetRecordsByType(std::vector<T>* pArray, bool bIsChild, bool bOnlyFirst = false)
void GetRecordsByType(std::vector<T>* pArray, bool bIsChild, bool bOnlyFirst = false) const
{
if (NULL == pArray)
return;

View File

@ -31,6 +31,7 @@
*/
#pragma once
#include "../Reader/Records.h"
#include <iostream>
class CRecordCString : public CUnknownRecord
{
@ -48,7 +49,7 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2);
m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2);
}
};
};

View File

@ -39,12 +39,13 @@
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
#include "../../../../OfficeUtils/src/OfficeUtils.h"
#include <fstream>
#include "../../Enums/_includer.h"
#define FIXED_POINT_unsigned(val) (double)((WORD)(val >> 16) + ((WORD)(val) / 65536.0))
ULONG xmlName = 1;
bool CPPTElement::ChangeBlack2ColorImage(std::wstring image_path, int rgbColor1, int rgbColor2)
{
CBgraFrame bgraFrame;
@ -814,6 +815,12 @@ void CPPTElement::SetUpProperty(CElementPtr pElement, CTheme* pTheme, CSlideInfo
pElement->m_bHidden = fHidden || fIsBullet;
//presentation_ticio_20100610.ppt
}break;
case tableProperties:
case tableRowProperties:
{
pElement->m_etType = etTable;
break;
}
default:
break;
}
@ -1637,7 +1644,14 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs,
}break;
default:
{
if (bGroupShape)
if (isTable())
{
CTableElement* pTableElem = new CTableElement();
pTableElem->m_xmlRawData = getTableXmlStr();
pTableElem->m_etType = etGroup;
pElement = CElementPtr(pTableElem);
}
else if (bGroupShape)
{
CGroupElement* pGroupElem = new CGroupElement();
pElement = CElementPtr(pGroupElem);
@ -1806,56 +1820,23 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs,
pElementLayout->m_bChildAnchorEnabled = pElement->m_bChildAnchorEnabled;
}
std::vector<CRecordInteractiveInfoAtom*> oArrayInteractive;
GetRecordsByType(&oArrayInteractive, true, false);
std::vector<CRecordCString*> oArrayMacro;
GetRecordsByType(&oArrayMacro, true, false);
std::vector<CRecordOfficeArtClientData*> oArrayArtClient;
GetRecordsByType(&oArrayArtClient, false, true);
std::vector<CRecordMouseInteractiveInfoContainer*> oArrayInteractive;
if (oArrayInteractive.size() == 2)
oArrayInteractive[1]->m_oHeader.RecInstance = 1;
if (oArrayArtClient.size())
oArrayArtClient[0]->GetRecordsByType(&oArrayInteractive, true, false);
for (auto const* interactiveAtom : oArrayInteractive)
for (auto const* interactiveCont : oArrayInteractive)
{
CInteractiveInfo interactiveInfo;
interactiveInfo.m_bPresent = true;
interactiveInfo.m_eActivation = (bool)interactiveAtom->m_oHeader.RecInstance;
if (pMapIDs)
{
CExFilesInfo* pInfo1 = pMapIDs->LockAudioFromCollection(interactiveAtom->m_nSoundIdRef);
if (NULL != pInfo1)
{
interactiveInfo.m_strAudioFileName = pInfo1->m_strFilePath;
interactiveInfo.m_strAudioName = pInfo1->m_name;
}
CExFilesInfo* pInfo2 = pMapIDs->LockSlide(interactiveAtom->m_nExHyperlinkIdRef);
if (NULL != pInfo2)
{
interactiveInfo.m_strHyperlink = pInfo2->m_strFilePath;
}
pInfo2 = pMapIDs->LockHyperlink(interactiveAtom->m_nExHyperlinkIdRef);
if (NULL != pInfo2)
{
interactiveInfo.m_strHyperlink = pInfo2->m_strFilePath;
}
}
if (oArrayMacro.size())
interactiveInfo.m_macro = oArrayMacro[0]->m_strText;
interactiveInfo.m_lType = interactiveAtom->m_nAction;
interactiveInfo.m_lOleVerb = interactiveAtom->m_nOleVerb;
interactiveInfo.m_lJump = interactiveAtom->m_nJump;
interactiveInfo.m_lHyperlinkType = interactiveAtom->m_nHyperlinkType;
interactiveInfo.m_bAnimated = interactiveAtom->m_bAnimated;
interactiveInfo.m_bStopSound = interactiveAtom->m_bStopSound;
interactiveInfo.m_bCustomShowReturn = interactiveAtom->m_bCustomShowReturn;
interactiveInfo.m_bVisited = interactiveAtom->m_bVisited;
ConvertInteractiveInfo(interactiveInfo, interactiveCont, pMapIDs);
pElement->m_arrActions.push_back(interactiveInfo);
}
//--------- наличие текста --------------------------------------------------------------------------
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShapeElem)
@ -1899,6 +1880,7 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs,
if (0 < oArrayTextBytes.size() && strShapeText.empty())
{
strShapeText = oArrayTextBytes[0]->m_strText;
pShapeElem->m_pShape->m_oText.m_originalText = strShapeText;
}
std::vector<CRecordTextCharsAtom*> oArrayTextChars;
@ -1946,8 +1928,24 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs,
}
std::vector<CRecordOfficeArtClientTextbox*> oArrayTextBox;
std::vector<CRecordMouseInteractiveInfoContainer*> oArrayInteractiveCont;
std::vector<CRecordTextInteractiveInfoAtom*> oArrayTextInteractive;
this->GetRecordsByType(&oArrayTextInteractive, true);
this->GetRecordsByType(&oArrayTextBox, false);
if (oArrayTextBox.size())
{
oArrayTextBox[0]->GetRecordsByType(&oArrayTextInteractive, false);
// oArrayTextBox[0]->GetRecordsByType(&oArrayInteractiveCont, false);
}
for (const auto* pInerAtom : oArrayInteractiveCont)
{
CInteractiveInfo interactive;
ConvertInteractiveInfo(interactive, pInerAtom, pMapIDs);
pShapeElem->m_textHyperlinks.push_back(interactive);
}
if (!oArrayTextInteractive.empty())
{
@ -2043,6 +2041,63 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs,
return pElement;
}
bool CRecordShapeContainer::isTable() const
{
std::vector<CRecordShapeProperties*> oArrayOptions;
GetRecordsByType(&oArrayOptions, true, false);
for (const auto* option : oArrayOptions)
{
for (const auto& prop : option->m_oProperties.m_arProperties)
{
if ((prop.m_ePID == tableProperties ||
prop.m_ePID == tableRowProperties) &&
bGroupShape)
{
return true;
}
}
}
return false;
}
std::wstring CRecordShapeContainer::getTableXmlStr() const
{
std::vector<CRecordShapeProperties*> oArrayOptions;
GetRecordsByType(&oArrayOptions, true, false);
std::wstring xmlStr = L"";
if (oArrayOptions.size() >= 2 &&
oArrayOptions[1]->m_oProperties.m_arProperties.size() >= 3)
{
COfficeUtils officeUtils(NULL);
BYTE *utf8Data = NULL;
ULONG utf8DataSize = 0;
auto& xmlProp = oArrayOptions[1]->m_oProperties.m_arProperties[2];
NSFile::CFileBinary file;
std::wstring temp = NSDirectory::GetTempPath();
std::wstring tempFileName = temp + FILE_SEPARATOR_STR + L"tempMetroBlob.zip";
if (file.CreateFileW(tempFileName))
{
file.WriteFile(xmlProp.m_pOptions, xmlProp.m_lValue);
file.CloseFile();
}
if (S_OK == officeUtils.LoadFileFromArchive(tempFileName, L"drs/e2oDoc.xml", &utf8Data, utf8DataSize))
{
xmlStr = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8(utf8Data, utf8DataSize);
}
delete [] utf8Data;
NSFile::CFileBinary::Remove(tempFileName);
}
return xmlStr;
}
void CRecordShapeContainer::ApplyThemeStyle(CElementPtr pElem, CTheme* pTheme, CRecordMasterTextPropAtom* master_levels)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem.get());
@ -2152,7 +2207,6 @@ void CRecordShapeContainer::SetUpTextStyle(std::wstring& strText, CTheme* pTheme
if ((0 != pSettings->m_arRanges.size()) && (0 == pShape->m_oTextActions.m_arRanges.size()))
{
pShape->m_oTextActions.m_bPresent = true;
pShape->m_oTextActions.m_arRanges = pSettings->m_arRanges;
}
@ -2502,64 +2556,162 @@ void CRecordShapeContainer::SetUpTextStyle(std::wstring& strText, CTheme* pTheme
void CRecordShapeContainer::ApplyHyperlink(CShapeElement* pShape, CColor& oColor)
{
std::vector<CTextRange>* pRanges = &pShape->m_oTextActions.m_arRanges;
CTextAttributesEx* pTextAttributes = &pShape->m_pShape->m_oText;
auto& oTextAttributes = pShape->m_pShape->m_oText;
const auto& originalText = oTextAttributes.m_originalText;
int lCountHyper = pRanges->size();
// lenght these ones shoud be equal
const auto& arrRanges = pShape->m_oTextActions.m_arRanges;
const auto arrSplitedInteractive = splitInteractive(pShape->m_textHyperlinks);
if (0 == lCountHyper)
// It cannot be changed
if (arrRanges.empty() || arrSplitedInteractive.empty())
return;
size_t nCountPars = pTextAttributes->m_arParagraphs.size();
for (int nIndexRange = 0; nIndexRange < lCountHyper; ++nIndexRange)
size_t posOrigText(0);
auto iterRange = arrRanges.begin();
auto iterInteractive = arrSplitedInteractive.begin();
for (auto& paragraph : oTextAttributes.m_arParagraphs)
{
int lStart = (*pRanges)[nIndexRange].m_lStart;
int lEnd = (*pRanges)[nIndexRange].m_lEnd;
int lCurrentStart = 0;
for (size_t nIndexPar = 0; nIndexPar < nCountPars; ++nIndexPar)
auto& arrSpans = paragraph.m_arSpans;
for (auto iterSpan = arrSpans.begin(); iterSpan != arrSpans.end(); iterSpan++)
{
CParagraph* pParagraph = &pTextAttributes->m_arParagraphs[nIndexPar];
for (size_t nIndexSpan = 0; nIndexSpan < pParagraph->m_arSpans.size(); ++nIndexSpan)
// if there isn't needed changes in next spans & paragraps
if (iterRange == arrRanges.end())
{
int lCurrentEnd = lCurrentStart + pParagraph->m_arSpans[nIndexSpan].m_strText.length() - 1;
return;
}
if (lCurrentStart > lEnd || lCurrentEnd < lStart)
const bool isHyperlink = iterRange->inRange(posOrigText);
const int posBlockStart = posOrigText;
const int posOrigSpanEnd = posBlockStart + iterSpan->m_strText.length();
const int posBlockEnd = isHyperlink ?
std::min(posOrigSpanEnd, iterRange->m_lEnd) :
std::min(posOrigSpanEnd, iterRange->m_lStart);
const size_t blockLen = posBlockEnd - posBlockStart;
const bool isNeedToSplit = posBlockEnd < posOrigSpanEnd && isHyperlink;
posOrigText += blockLen;
// Skipping span
if (iterRange->m_lStart > posBlockEnd)
{
continue;
}
// HYPERLINK
if (isHyperlink)
{
// case: HYPERLINK & text(or next HYPERLINK inside original span)
if (isNeedToSplit)
{
lCurrentStart = lCurrentEnd + 1;
continue;
// HYPERLINK
iterSpan->m_strText = originalText.substr(posBlockStart, blockLen);
const size_t nextBlockLen = posOrigSpanEnd - posBlockEnd;
iterSpan = arrSpans.insert(iterSpan, *iterSpan);
// Go to next new span and correct text
iterSpan++;
iterSpan->m_strText = originalText.substr(posBlockEnd, nextBlockLen);
iterSpan->m_arrInteractive.clear();
// Return to current span
iterSpan--;
}
int lStart_ = (std::max)(lStart, lCurrentStart);
int lEnd_ = (std::min)(lEnd, lCurrentEnd);
addHyperlinkToSpan(*iterSpan, *iterInteractive, oColor);
CSpan oRunProp = pParagraph->m_arSpans[nIndexSpan];
std::wstring strText = pParagraph->m_arSpans[nIndexSpan].m_strText;
if (lStart_ > lCurrentStart)
if (posBlockEnd == iterRange->m_lEnd)
{
pParagraph->m_arSpans.insert(pParagraph->m_arSpans.begin() + nIndexSpan, oRunProp);
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(0, lStart_ - lCurrentStart);
++nIndexSpan;
iterRange++;
iterInteractive++;
}
pParagraph->m_arSpans[nIndexSpan].m_oRun.Color = oColor;
pParagraph->m_arSpans[nIndexSpan].m_oRun.FontUnderline = (bool)true;
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(lStart_ - lCurrentStart, lEnd_ - lStart_ + 1);
if (lEnd_ < lCurrentEnd)
{
pParagraph->m_arSpans.insert(pParagraph->m_arSpans.begin() + nIndexSpan + 1, oRunProp);
++nIndexSpan;
}
// Hyperlink will be written in the next iteration
// case: text & HYPERLINK
else
{
iterSpan = arrSpans.insert(iterSpan, *iterSpan);
iterSpan->m_strText = originalText.substr(posBlockStart, blockLen);
iterSpan->m_arrInteractive.clear();
pParagraph->m_arSpans[nIndexSpan].m_strText = strText.substr(lEnd_ - lCurrentStart + 1, lCurrentEnd - lEnd_);
}
// Go to next new span and correct text
iterSpan++;
const size_t nextBlockLen = posOrigSpanEnd - posBlockEnd;
iterSpan->m_strText = originalText.substr(posBlockEnd, nextBlockLen);
iterSpan->m_arrInteractive.clear();
// Return to current span
iterSpan--;
}
}
// skipping '\r'
posOrigText++;
}
}
lCurrentStart = lCurrentEnd + 1;
void CRecordShapeContainer::addHyperlinkToSpan(CSpan &oSpan, const std::vector<CInteractiveInfo> &arrInteractive, const CColor &oColor)
{
oSpan.m_oRun.Color = oColor;
oSpan.m_oRun.FontUnderline = (bool)true;
oSpan.m_arrInteractive = arrInteractive;
}
std::vector<std::vector<CInteractiveInfo> > CRecordShapeContainer::splitInteractive(const std::vector<CInteractiveInfo> &arrInteractive)
{
std::vector<std::vector<CInteractiveInfo> > splited;
std::vector<CInteractiveInfo> inserting;
for (const auto& interactive : arrInteractive)
{
if (interactive.m_eActivation == interactive.click && !inserting.empty())
splited.push_back(std::move(inserting));
inserting.push_back(interactive);
}
if (!inserting.empty())
splited.push_back(std::move(inserting));
return splited;
}
void CRecordShapeContainer::ConvertInteractiveInfo(CInteractiveInfo &interactiveInfo, const CRecordMouseInteractiveInfoContainer *interactiveCont, CExMedia *pMapIDs)
{
auto& interactiveAtom = interactiveCont->interactiveInfoAtom;
interactiveInfo.m_bPresent = true;
interactiveInfo.m_eActivation = interactiveCont->isOver;
if (pMapIDs)
{
CExFilesInfo* pInfo1 = pMapIDs->LockAudioFromCollection(interactiveAtom.m_nSoundIdRef);
if (NULL != pInfo1)
{
interactiveInfo.m_strAudioFileName = pInfo1->m_strFilePath;
interactiveInfo.m_strAudioName = pInfo1->m_name;
}
CExFilesInfo* pInfo2 = pMapIDs->LockSlide(interactiveAtom.m_nExHyperlinkIdRef);
if (NULL != pInfo2)
{
interactiveInfo.m_strHyperlink = pInfo2->m_strFilePath;
} else {
pInfo2 = pMapIDs->LockHyperlink(interactiveAtom.m_nExHyperlinkIdRef);
if (NULL != pInfo2)
{
interactiveInfo.m_strHyperlink = pInfo2->m_strFilePath;
}
}
}
}
if (interactiveCont->macroNameAtom.is_init())
interactiveInfo.m_macro = interactiveCont->macroNameAtom->m_strText;
interactiveInfo.m_lType = interactiveAtom.m_nAction;
interactiveInfo.m_lOleVerb = interactiveAtom.m_nOleVerb;
interactiveInfo.m_lJump = interactiveAtom.m_nJump;
interactiveInfo.m_lHyperlinkType = interactiveAtom.m_nHyperlinkType;
interactiveInfo.m_bAnimated = interactiveAtom.m_bAnimated;
interactiveInfo.m_bStopSound = interactiveAtom.m_bStopSound;
interactiveInfo.m_bCustomShowReturn = interactiveAtom.m_bCustomShowReturn;
interactiveInfo.m_bVisited = interactiveAtom.m_bVisited;
}
void CRecordGroupShapeContainer::ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{

View File

@ -41,7 +41,7 @@
#include "../PlaceHolderAtom.h"
#include "../StyleTextPropAtom.h"
#include "../OutlineTextRefAtom.h"
#include "../InteractiveInfoAtom.h"
#include "../MouseInteractiveInfoContainer.h"
#include "../TextInteractiveInfoAtom.h"
#include "../MasterTextPropAtom.h"
#include "../HeadersFootersAtom.h"
@ -55,6 +55,7 @@
#include "../../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
#define FIXED_POINT_unsigned(val) (double)((WORD)(val >> 16) + ((WORD)(val) / 65536.0))
using namespace ODRAW;
@ -140,7 +141,14 @@ public:
protected:
bool isTable()const;
std::wstring getTableXmlStr()const;
void ApplyThemeStyle(CElementPtr pElem, CTheme* pTheme, CRecordMasterTextPropAtom* master_levels);
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, CElementPtr pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide, CRecordMasterTextPropAtom* master_levels);
void ApplyHyperlink(CShapeElement* pShape, CColor& oColor);
static void addHyperlinkToSpan(CSpan& oSpan, const std::vector<CInteractiveInfo> &arrInteractive, const CColor& oColor);
static std::vector<std::vector<CInteractiveInfo> > splitInteractive(const std::vector<CInteractiveInfo>& arrInteractive);
static void ConvertInteractiveInfo(CInteractiveInfo& interactiveInfo, const CRecordMouseInteractiveInfoContainer* interactiveCont, CExMedia* pMapIDs);
};

View File

@ -31,41 +31,82 @@
*/
#pragma once
#include "../Reader/Records.h"
#include "CString.h"
class CRecordExHyperlinkContainer : public CRecordsContainer
{
public:
CRecordExHyperlinkContainer()
{
}
~CRecordExHyperlinkContainer()
{
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
CRecordsContainer::ReadFromStream(oHeader, pStream);
}
};
class CRecordExHyperlinkAtom : public CUnknownRecord
{
public:
UINT m_nHyperlinkID;
CRecordExHyperlinkAtom()
{
}
UINT m_nHyperlinkID;
~CRecordExHyperlinkAtom()
{
}
CRecordExHyperlinkAtom()
{
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
~CRecordExHyperlinkAtom()
{
}
m_nHyperlinkID = StreamUtils::ReadDWORD(pStream);
}
};
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_nHyperlinkID = StreamUtils::ReadDWORD(pStream);
}
};
class CRecordExHyperlinkContainer : public CRecordsContainer
{
public:
CRecordExHyperlinkAtom m_exHyperlinkAtom;
nullable<CRecordCString> m_friendlyNameAtom;
nullable<CRecordCString> m_targetAtom;
nullable<CRecordCString> m_locationAtom;
CRecordExHyperlinkContainer()
{
}
~CRecordExHyperlinkContainer()
{
}
bool hasCString()const
{
return m_friendlyNameAtom.IsInit() || m_targetAtom.IsInit() || m_locationAtom.IsInit();
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
SRecordHeader header;
header.ReadFromStream(pStream);
m_exHyperlinkAtom.ReadFromStream(header, pStream);
unsigned currentLen = 12; // 12(atom)
while (currentLen < m_oHeader.RecLen)
{
header.ReadFromStream(pStream);
auto* pCString = new CRecordCString;
pCString->ReadFromStream(header, pStream);
switch (header.RecInstance)
{
case 0: m_friendlyNameAtom = pCString; break;
case 1: m_targetAtom = pCString; break;
case 3: m_locationAtom = pCString; break;
default: delete pCString;
}
currentLen += 8 + header.RecLen; // headerLen + CStringLen
}
// if (m_friendlyNameAtom.IsInit() && (int)m_friendlyNameAtom->m_strText.find(L"NEXT") == -1)
// std::wcout << m_exHyperlinkAtom.m_nHyperlinkID << L" "
// << (m_friendlyNameAtom.IsInit() ? m_friendlyNameAtom->m_strText : L"-") << L" "
// << (m_targetAtom.IsInit() ? m_targetAtom->m_strText : L"-") << L" "
// << (m_locationAtom.IsInit() ? m_locationAtom->m_strText : L"-")
// << std::endl;
}
};

View File

@ -31,8 +31,7 @@
*/
#pragma once
#include "../Reader/Records.h"
using namespace std;
#include <iostream>
class CRecordInteractiveInfoAtom : public CUnknownRecord
{
@ -76,5 +75,8 @@ public:
m_nHyperlinkType = StreamUtils::ReadBYTE(pStream);
StreamUtils::StreamSkip(3, pStream);
// if (m_nExHyperlinkIdRef)
// std::wcout << L"HyperlinkIDRef: " << m_nExHyperlinkIdRef << std::endl;;
}
};

View File

@ -31,6 +31,8 @@
*/
#pragma once
#include "../Reader/Records.h"
#include <iostream>
class CRecordMetafileBlob : public CUnknownRecord
{
@ -40,17 +42,26 @@ public:
SHORT m_nExtY;
BYTE* m_pData;
CRecordMetafileBlob()
CRecordMetafileBlob() :
m_nMM(-1), m_nExtX(-1), m_nExtY(-1), m_pData(nullptr)
{
}
~CRecordMetafileBlob()
{
RELEASEOBJECT (m_pData)
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
return CUnknownRecord::ReadFromStream(oHeader, pStream);
m_oHeader = oHeader;
m_nMM = StreamUtils::ReadSHORT(pStream);
m_nExtX = StreamUtils::ReadSHORT(pStream);
m_nExtY = StreamUtils::ReadSHORT(pStream);
pStream->read(m_pData, m_oHeader.RecLen - 6);
std::cout << m_pData << "\n\n";
}
};
};

View File

@ -0,0 +1,68 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "InteractiveInfoAtom.h"
#include "CString.h"
class CRecordMouseInteractiveInfoContainer : public CUnknownRecord
{
public:
CRecordInteractiveInfoAtom interactiveInfoAtom;
nullable<CRecordCString> macroNameAtom;
bool isOver; // click = 0, over = 1
CRecordMouseInteractiveInfoContainer() :
isOver(false)
{
}
~CRecordMouseInteractiveInfoContainer()
{
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
isOver = oHeader.RecInstance;
SRecordHeader header;
header.ReadFromStream(pStream);
interactiveInfoAtom.ReadFromStream(header, pStream);
if (m_oHeader.RecLen > 24)
{
header.ReadFromStream(pStream);
macroNameAtom.reset(new CRecordCString);
macroNameAtom->ReadFromStream(header, pStream);
}
}
};

View File

@ -57,6 +57,7 @@
#include "Drawing/DrawingContainer.h"
#include "OfficeArtClientData.h"
#include "OfficeArtClientTextbox.h"
// others
@ -128,6 +129,7 @@
#include "Animations/_includer.h"
#include "InteractiveInfoAtom.h"
#include "TextInteractiveInfoAtom.h"
#include "MouseInteractiveInfoContainer.h"
//sound
#include "ExMIDIAudioContainer.h"
@ -141,3 +143,6 @@
#include "RoundTripOriginalMainMasterId12Atom.h"
#include "RoundTripCompositeMainMasterId12Atom.h"
// Meta data
#include "RoundTripOArtTextStyles12Atom.h"

View File

@ -0,0 +1,68 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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 "../Reader/Records.h"
#include <iostream>
class CRecordRoundTripOArtTextStyles12Atom : public CUnknownRecord
{
BYTE* m_pData;
public:
CRecordRoundTripOArtTextStyles12Atom()
{
m_pData = NULL;
}
~CRecordRoundTripOArtTextStyles12Atom()
{
ReleaseData();
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
unsigned lSize = m_oHeader.RecLen;
if (0 < lSize)
{
m_pData = new BYTE[lSize];
pStream->read(m_pData, lSize);
}
}
void ReleaseData()
{
RELEASEARRAYOBJECTS(m_pData);
}
};

View File

@ -32,19 +32,23 @@
#pragma once
#include "../Reader/Records.h"
#include <fstream>
//ULONG ThemeCounter = 1;
class CRecordRoundTripThemeAtom : public CUnknownRecord
{
public:
std::pair<boost::shared_array<unsigned char>, _INT32> data;
CRecordRoundTripThemeAtom(){}
~CRecordRoundTripThemeAtom(){}
std::pair<boost::shared_array<unsigned char>, _INT32> data;
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
data = std::make_pair(boost::shared_array<unsigned char>(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen);
pStream->read(data.first.get(), data.second);
}
CRecordRoundTripThemeAtom(){}
~CRecordRoundTripThemeAtom(){}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
data = std::make_pair(boost::shared_array<unsigned char>(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen);
pStream->read(data.first.get(), data.second);
}
};

View File

@ -81,7 +81,8 @@ public:
eftAudio = 2,
eftHyperlink = 3,
eftObject = 4,
eftSlide
eftSlide = 5/*,
eftFile = 6*/
};
ExFilesType m_type;
@ -137,6 +138,13 @@ public:
int iter2 = str.find(L"https://");
return iter1 != -1 || iter2 != -1;
}
static bool isAudioLink(const std::wstring &str)
{
int iter1 = str.find(L".mp3");
int iter2 = str.find(L".wav");
int iter3 = str.find(L".waw");
return iter1 != -1 || iter2 != -1 || iter3 != -1;
}
};
class CExMedia
@ -149,6 +157,7 @@ public:
std::vector<CExFilesInfo> m_arAudios;
std::vector<CExFilesInfo> m_arHyperlinks;
std::vector<CExFilesInfo> m_arSlides;
std::vector<CExFilesInfo> m_arFiles;
std::vector<CExFilesInfo> m_arAudioCollection;

View File

@ -38,183 +38,186 @@ using namespace ODRAW;
namespace PPT_FORMAT
{
enum ElementType
{
etGroup = 0,
etVideo = 1,
etAudio = 2,
etPicture = 3,
etShape = 4,
etText = 5
};
enum ElementType
{
etGroup = 0,
etVideo = 1,
etAudio = 2,
etPicture = 3,
etShape = 4,
etText = 5,
etTable = 6
};
class CTheme;
class CLayout;
class CSlide;
class CTheme;
class CLayout;
class CSlide;
class CElement;
typedef boost::shared_ptr<CElement> CElementPtr;
class CElement;
typedef boost::shared_ptr<CElement> CElementPtr;
class CElement
{
public:
ElementType m_etType;
CDoubleRect m_rcChildAnchor;
CDoubleRect m_rcAnchor;
CDoubleRect m_rcGroupAnchor;
class CElement
{
public:
ElementType m_etType;
bool m_bChildAnchorEnabled;
bool m_bAnchorEnabled;
bool m_bGroupAnchorEnabled;
double m_dStartTime;
double m_dEndTime;
CDoubleRect m_rcChildAnchor;
CDoubleRect m_rcAnchor;
CDoubleRect m_rcGroupAnchor;
CTextInteractiveInfo m_oTextActions;
std::vector<CInteractiveInfo> m_arrActions;
bool m_bChildAnchorEnabled;
bool m_bAnchorEnabled;
bool m_bGroupAnchorEnabled;
CAnimationInfo m_oAnimations;
CEffects m_oEffects;
double m_dStartTime;
double m_dEndTime;
CPen m_oPen;
CBrush m_oBrush;
CShadow m_oShadow;
CTextInteractiveInfo m_oTextActions;
int m_lID;
int m_lLayoutID;
std::vector<CInteractiveInfo> m_arrActions;
std::vector<CInteractiveInfo> m_textHyperlinks;
int m_lPlaceholderID;
int m_lPlaceholderType;
bool m_bPlaceholderSet;
int m_lPlaceholderSizePreset;
int m_lPlaceholderUserStr;
int m_nFormatDate;
CAnimationInfo m_oAnimations;
CEffects m_oEffects;
double m_dRotate; // угол поворота в градусах
bool m_bFlipH; // симметричное отражение относительно горизонтальной оси
bool m_bFlipV; // симметричное отражение относительно вертикальной оси
CPen m_oPen;
CBrush m_oBrush;
CShadow m_oShadow;
bool m_bLine;
bool m_bIsFilled;
int m_lID;
int m_lLayoutID;
bool m_bIsBackground;
bool m_bHaveAnchor;
bool m_bHidden;
int m_lPlaceholderID;
int m_lPlaceholderType;
bool m_bPlaceholderSet;
int m_lPlaceholderSizePreset;
int m_lPlaceholderUserStr;
int m_nFormatDate;
CTheme* m_pTheme;
CLayout* m_pLayout;
double m_dRotate; // угол поворота в градусах
bool m_bFlipH; // симметричное отражение относительно горизонтальной оси
bool m_bFlipV; // симметричное отражение относительно вертикальной оси
std::wstring m_sName;
std::wstring m_sDescription;
bool m_bLine;
bool m_bIsFilled;
std::wstring m_sHyperlink;
bool m_bIsBackground;
bool m_bHaveAnchor;
bool m_bHidden;
std::vector<CElementPtr>* m_pParentElements;
std::vector<CElementPtr> m_pChildElements;
CTheme* m_pTheme;
CLayout* m_pLayout;
CElement()
{
m_bIsBackground = false;
m_bHaveAnchor = true;
m_bHidden = false;
std::wstring m_sName;
std::wstring m_sDescription;
m_bChildAnchorEnabled = false;
m_bAnchorEnabled = false;
m_bGroupAnchorEnabled = false;
std::wstring m_sHyperlink;
m_lID = -1;
m_lLayoutID = -1;
std::vector<CElementPtr>* m_pParentElements;
std::vector<CElementPtr> m_pChildElements;
m_lPlaceholderID = -1;
m_lPlaceholderType = -1;
m_bPlaceholderSet = false;
m_lPlaceholderSizePreset = -1;
m_lPlaceholderUserStr = -1;
m_nFormatDate = 1;
CElement()
{
m_bIsBackground = false;
m_bHaveAnchor = true;
m_bHidden = false;
m_etType = etShape;
m_dStartTime = 0.0;
m_dEndTime = 30.0;
m_bChildAnchorEnabled = false;
m_bAnchorEnabled = false;
m_bGroupAnchorEnabled = false;
m_dRotate = 0.0;
m_bFlipH = false;
m_bFlipV = false;
m_bLine = true;
m_bIsFilled = true;
m_lID = -1;
m_lLayoutID = -1;
m_pTheme = NULL;
m_pLayout = NULL;
m_pParentElements = NULL;
}
virtual ~CElement()
{
}
m_lPlaceholderID = -1;
m_lPlaceholderType = -1;
m_bPlaceholderSet = false;
m_lPlaceholderSizePreset = -1;
m_lPlaceholderUserStr = -1;
m_nFormatDate = 1;
virtual CElementPtr CreateDublicate() = 0;
m_etType = etShape;
virtual void SetProperiesToDublicate(CElementPtr pDublicate)
{
if (!pDublicate)
return;
m_dStartTime = 0.0;
m_dEndTime = 30.0;
pDublicate->m_bIsBackground = m_bIsBackground;
pDublicate->m_bHaveAnchor = m_bHaveAnchor;
pDublicate->m_bHidden = m_bHidden;
m_dRotate = 0.0;
m_bFlipH = false;
m_bFlipV = false;
m_bLine = true;
m_bIsFilled = true;
pDublicate->m_etType = m_etType;
pDublicate->m_rcChildAnchor = m_rcChildAnchor;
pDublicate->m_rcAnchor = m_rcAnchor;
pDublicate->m_rcGroupAnchor = m_rcGroupAnchor;
m_pTheme = NULL;
m_pLayout = NULL;
m_pParentElements = NULL;
}
virtual ~CElement()
{
}
pDublicate->m_bChildAnchorEnabled = m_bChildAnchorEnabled;
pDublicate->m_bAnchorEnabled = m_bAnchorEnabled;
pDublicate->m_bGroupAnchorEnabled = m_bGroupAnchorEnabled;
virtual CElementPtr CreateDublicate() = 0;
pDublicate->m_dStartTime = m_dStartTime;
pDublicate->m_dEndTime = m_dEndTime;
virtual void SetProperiesToDublicate(CElementPtr pDublicate)
{
if (!pDublicate)
return;
pDublicate->m_lID = m_lID;
pDublicate->m_lLayoutID = m_lLayoutID;
pDublicate->m_bIsBackground = m_bIsBackground;
pDublicate->m_bHaveAnchor = m_bHaveAnchor;
pDublicate->m_bHidden = m_bHidden;
pDublicate->m_arrActions = m_arrActions;
pDublicate->m_oTextActions = m_oTextActions;
pDublicate->m_oAnimations = m_oAnimations;
pDublicate->m_oEffects = m_oEffects;
pDublicate->m_etType = m_etType;
pDublicate->m_lPlaceholderID = m_lPlaceholderID;
pDublicate->m_lPlaceholderType = m_lPlaceholderType;
pDublicate->m_bPlaceholderSet = m_bPlaceholderSet;
pDublicate->m_lPlaceholderSizePreset = m_lPlaceholderSizePreset;
pDublicate->m_lPlaceholderUserStr = m_lPlaceholderUserStr;
pDublicate->m_nFormatDate = m_nFormatDate;
pDublicate->m_rcChildAnchor = m_rcChildAnchor;
pDublicate->m_rcAnchor = m_rcAnchor;
pDublicate->m_rcGroupAnchor = m_rcGroupAnchor;
pDublicate->m_dRotate = m_dRotate;
pDublicate->m_bFlipH = m_bFlipH;
pDublicate->m_bFlipV = m_bFlipV;
pDublicate->m_bLine = m_bLine;
pDublicate->m_bIsFilled = m_bIsFilled;
pDublicate->m_bChildAnchorEnabled = m_bChildAnchorEnabled;
pDublicate->m_bAnchorEnabled = m_bAnchorEnabled;
pDublicate->m_bGroupAnchorEnabled = m_bGroupAnchorEnabled;
pDublicate->m_pTheme = m_pTheme;
pDublicate->m_pLayout = m_pLayout;
pDublicate->m_oPen = m_oPen;
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
}
pDublicate->m_dStartTime = m_dStartTime;
pDublicate->m_dEndTime = m_dEndTime;
void NormalizeCoordsByMetric()
{
if (!m_bAnchorEnabled) return;
double dScale = 1587.5; //master to emu
m_rcAnchor.left = dScale * m_rcAnchor.left;
m_rcAnchor.right = dScale * m_rcAnchor.right;
m_rcAnchor.top = dScale * m_rcAnchor.top;
m_rcAnchor.bottom = dScale * m_rcAnchor.bottom;
}
};
pDublicate->m_lID = m_lID;
pDublicate->m_lLayoutID = m_lLayoutID;
pDublicate->m_arrActions = m_arrActions;
pDublicate->m_oTextActions = m_oTextActions;
pDublicate->m_oAnimations = m_oAnimations;
pDublicate->m_oEffects = m_oEffects;
pDublicate->m_lPlaceholderID = m_lPlaceholderID;
pDublicate->m_lPlaceholderType = m_lPlaceholderType;
pDublicate->m_bPlaceholderSet = m_bPlaceholderSet;
pDublicate->m_lPlaceholderSizePreset = m_lPlaceholderSizePreset;
pDublicate->m_lPlaceholderUserStr = m_lPlaceholderUserStr;
pDublicate->m_nFormatDate = m_nFormatDate;
pDublicate->m_dRotate = m_dRotate;
pDublicate->m_bFlipH = m_bFlipH;
pDublicate->m_bFlipV = m_bFlipV;
pDublicate->m_bLine = m_bLine;
pDublicate->m_bIsFilled = m_bIsFilled;
pDublicate->m_pTheme = m_pTheme;
pDublicate->m_pLayout = m_pLayout;
pDublicate->m_oPen = m_oPen;
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
}
void NormalizeCoordsByMetric()
{
if (!m_bAnchorEnabled) return;
double dScale = 1587.5; //master to emu
m_rcAnchor.left = dScale * m_rcAnchor.left;
m_rcAnchor.right = dScale * m_rcAnchor.right;
m_rcAnchor.top = dScale * m_rcAnchor.top;
m_rcAnchor.bottom = dScale * m_rcAnchor.bottom;
}
};
}

View File

@ -32,7 +32,6 @@
#pragma once
#include "Theme.h"
#include "Shapes/Shape.h"
#include "Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h"
namespace PPTX2EditorAdvanced
@ -731,7 +730,8 @@ namespace PPT_FORMAT
return pElement;
}
};
class CVideoElement : public CImageElement
class CVideoElement : public CImageElement
{
public:
std::wstring m_strVideoFileName;
@ -780,33 +780,62 @@ namespace PPT_FORMAT
}
};
class CGroupElement : public CElement
{
public:
CGroupElement() : CElement()
{
m_etType = etGroup;
}
virtual ~CGroupElement()
{
}
virtual CElementPtr CreateDublicate()
{
CGroupElement* pGroupElement = new CGroupElement();
class CGroupElement : public CElement
{
public:
CElementPtr pElement = CElementPtr( pGroupElement );
SetProperiesToDublicate(pElement);
public:
CGroupElement() : CElement()
{
m_etType = etGroup;
}
virtual ~CGroupElement()
{
}
virtual CElementPtr CreateDublicate()
{
CGroupElement* pGroupElement = new CGroupElement();
return pElement;
}
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
CElementPtr pElement = CElementPtr( pGroupElement );
return L"";
}
};
SetProperiesToDublicate(pElement);
return pElement;
}
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
return L"";
}
};
class CTableElement : public CElement
{
public:
std::wstring m_xmlRawData;
public:
CTableElement() : CElement()
{
m_etType = etTable;
}
virtual ~CTableElement()
{
}
virtual CElementPtr CreateDublicate()
{
CTableElement* pTableElement = new CTableElement();
CElementPtr pElement = CElementPtr( pTableElement );
SetProperiesToDublicate(pElement);
return pElement;
}
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
return L"";
}
};
}

View File

@ -36,118 +36,123 @@
namespace PPT_FORMAT
{
class CTextRange
{
public:
int m_lStart;
int m_lEnd;
public:
CTextRange()
{
m_lStart = 0;
m_lEnd = 0;
}
CTextRange& operator=(const CTextRange& oSrc)
{
m_lStart = oSrc.m_lStart;
m_lEnd = oSrc.m_lEnd;
class CTextRange
{
public:
int m_lStart;
int m_lEnd;
return *this;
}
CTextRange(const CTextRange& oSrc)
{
*this = oSrc;
}
};
class CInteractiveInfo
{
public:
enum : bool
{
click,
over
};
CInteractiveInfo()
{
m_bPresent = false;
}
public:
CTextRange()
{
m_lStart = 0;
m_lEnd = 0;
}
CTextRange& operator=(const CTextRange& oSrc)
{
m_lStart = oSrc.m_lStart;
m_lEnd = oSrc.m_lEnd;
CInteractiveInfo& operator=(const CInteractiveInfo& oSrc)
{
m_bPresent = oSrc.m_bPresent;
m_lType = oSrc.m_lType;
return *this;
}
CTextRange(const CTextRange& oSrc)
{
*this = oSrc;
}
bool inRange(const int pos)const
{
return (pos >= m_lStart && pos < m_lEnd);
}
};
class CInteractiveInfo
{
public:
enum : bool
{
click,
over
};
CInteractiveInfo()
{
m_bPresent = false;
}
m_lOleVerb = oSrc.m_lOleVerb;
m_lJump = oSrc.m_lJump;
m_lHyperlinkType = oSrc.m_lHyperlinkType;
m_bAnimated = oSrc.m_bAnimated;
m_bStopSound = oSrc.m_bStopSound;
m_bCustomShowReturn = oSrc.m_bCustomShowReturn;
m_bVisited = oSrc.m_bVisited;
CInteractiveInfo& operator=(const CInteractiveInfo& oSrc)
{
m_bPresent = oSrc.m_bPresent;
m_lType = oSrc.m_lType;
m_strAudioFileName = oSrc.m_strAudioFileName;
m_strHyperlink = oSrc.m_strHyperlink;
m_strAudioName = oSrc.m_strAudioName;
m_eActivation = oSrc.m_eActivation;
m_macro = oSrc.m_macro;
return *this;
}
CInteractiveInfo(const CInteractiveInfo& oSrc)
{
*this = oSrc;
}
m_lOleVerb = oSrc.m_lOleVerb;
m_lJump = oSrc.m_lJump;
m_lHyperlinkType = oSrc.m_lHyperlinkType;
m_bAnimated = oSrc.m_bAnimated;
m_bStopSound = oSrc.m_bStopSound;
m_bCustomShowReturn = oSrc.m_bCustomShowReturn;
m_bVisited = oSrc.m_bVisited;
bool m_bPresent;
m_strAudioFileName = oSrc.m_strAudioFileName;
m_strHyperlink = oSrc.m_strHyperlink;
m_strAudioName = oSrc.m_strAudioName;
m_eActivation = oSrc.m_eActivation;
m_macro = oSrc.m_macro;
return *this;
}
CInteractiveInfo(const CInteractiveInfo& oSrc)
{
*this = oSrc;
}
int m_lType;
int m_lOleVerb;
int m_lJump;
int m_lHyperlinkType;
bool m_bAnimated;
bool m_bStopSound;
bool m_bCustomShowReturn;
bool m_bVisited;
bool m_eActivation; // Click or over
bool m_bPresent;
std::wstring m_strAudioFileName;
std::wstring m_strHyperlink;
std::wstring m_strAudioName;
std::wstring m_macro;
};
class CTextInteractiveInfo
{
private:
long m_lType;
ASC_VARIANT m_varParameter;
public:
bool m_bPresent;
int m_lType;
int m_lOleVerb;
int m_lJump;
int m_lHyperlinkType;
bool m_bAnimated;
bool m_bStopSound;
bool m_bCustomShowReturn;
bool m_bVisited;
bool m_eActivation; // Click or over
std::vector<CTextRange> m_arRanges;
std::wstring m_strAudioFileName;
std::wstring m_strHyperlink;
std::wstring m_strAudioName;
std::wstring m_macro;
CTextInteractiveInfo()
{
m_bPresent = false;
}
~CTextInteractiveInfo()
{
}
};
class CTextInteractiveInfo
{
private:
long m_lType;
ASC_VARIANT m_varParameter;
CTextInteractiveInfo& operator=(const CTextInteractiveInfo& oSrc)
{
m_lType = oSrc.m_lType;
m_varParameter = oSrc.m_varParameter;
public:
bool m_bPresent;
m_bPresent = oSrc.m_bPresent;
std::vector<CTextRange> m_arRanges;
m_arRanges.insert(m_arRanges.end(), oSrc.m_arRanges.begin(), oSrc.m_arRanges.end());
CTextInteractiveInfo()
{
m_bPresent = false;
}
~CTextInteractiveInfo()
{
}
return *this;
}
CTextInteractiveInfo(const CTextInteractiveInfo& oSrc)
{
*this = oSrc;
}
};
CTextInteractiveInfo& operator=(const CTextInteractiveInfo& oSrc)
{
m_lType = oSrc.m_lType;
m_varParameter = oSrc.m_varParameter;
m_bPresent = oSrc.m_bPresent;
m_arRanges.insert(m_arRanges.end(), oSrc.m_arRanges.begin(), oSrc.m_arRanges.end());
return *this;
}
CTextInteractiveInfo(const CTextInteractiveInfo& oSrc)
{
*this = oSrc;
}
};
}

View File

@ -63,6 +63,7 @@ namespace PPT_FORMAT
// настройки по-умолчанию
CTextAttributes m_oAttributes;
std::vector<CParagraph> m_arParagraphs;
std::wstring m_originalText;
bool m_bVertical;
bool m_bAutoFit;

View File

@ -33,6 +33,7 @@
#include "Structures.h"
#include "../../../ASCOfficePPTFile/PPTFormatLib/Enums/enums.h"
#include "../../../Common/DocxFormat/Source/Base/Nullable.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Interactive.h"
using namespace ODRAW;
@ -163,7 +164,7 @@ namespace PPT_FORMAT
NSCommon::nullable_base<WORD> Cap; // 0 - none, 1 - TEXT, 2 - text
NSCommon::nullable_base<WORD> Language;
CFontProperties font;
CFontProperties font;
CTextCFRun()
{
@ -197,8 +198,7 @@ namespace PPT_FORMAT
Cap = oSrc.Cap;
Language = oSrc.Language;
Language = oSrc.Language;
return *this;
}
~CTextCFRun()
@ -637,6 +637,8 @@ namespace PPT_FORMAT
bool m_bField;
bool m_bBreak;
std::vector<CInteractiveInfo> m_arrInteractive;
CSpan() : m_bField(false), m_bBreak(false)
{
}
@ -650,6 +652,7 @@ namespace PPT_FORMAT
m_strText = oSrc.m_strText;
m_bField = oSrc.m_bField;
m_bBreak = oSrc.m_bBreak;
m_arrInteractive = oSrc.m_arrInteractive;
return *this;
}

View File

@ -30,6 +30,7 @@
*
*/
#pragma once
#include "../../../ASCOfficePPTFile/PPTFormatLib/Records/RoundTripThemeAtom.h"
#include "Structures.h"
#include "Layout.h"
@ -75,6 +76,8 @@ namespace PPT_FORMAT
std::wstring m_sThemeName;
std::vector<std::vector<CColor>>m_arExtraColorScheme;
std::vector<CRecordRoundTripThemeAtom*> m_arrZipXml;
bool m_bHasDate;
bool m_bHasSlideNumber;
@ -101,6 +104,7 @@ namespace PPT_FORMAT
m_mapTitleLayout.clear();
m_mapGeomToLayout.clear();
m_mapPlaceholders.clear();
m_arrZipXml.clear();
m_sThemeName = L"Default";

View File

@ -153,8 +153,8 @@ namespace PPTX
pReader->Seek(_end_rec);
}
//public:
private:
public:
// private:
smart_ptr<WrapperWritingElement> m_Typeface;
protected:
virtual void FillParentPointersForChilds(){};
@ -168,4 +168,4 @@ namespace PPTX
} // namespace Logic
} // namespace PPTX
#endif // PPTX_LOGIC_BULLETTYPEFACE_INCLUDE_H
#endif // PPTX_LOGIC_BULLETTYPEFACE_INCLUDE_H

View File

@ -296,10 +296,11 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("useBgFill"), useBgFill)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if( oReader, L"useBgFill", useBgFill)
WritingElement_ReadAttributes_Read_if(oReader, L"macro", macro)
WritingElement_ReadAttributes_End( oReader )
}
std::wstring GetText()const{if(txBody.IsInit()) return txBody->GetText(); return _T(""); };
std::wstring GetText()const{if(txBody.IsInit()) return txBody->GetText(); return L""; };
void FillLevelUp();
void Merge(Shape& shape, bool bIsSlidePlaceholder = false);

View File

@ -78,7 +78,8 @@ namespace PPTX
virtual void FillParentPointersForChilds(){}
public:
virtual void SetParentPointer(const WrapperWritingElement* pParent)
virtual void
SetParentPointer(const WrapperWritingElement* pParent)
{
parentElement = pParent;
parentFile = parentElement->parentFile;

View File

@ -55,59 +55,6 @@ namespace ComplexTypes
{
namespace Word
{
void CFormPr::FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase( oNode, L"w:key", m_oKey );
XmlMacroReadAttributeBase( oNode, L"w:label", m_oLabel );
XmlMacroReadAttributeBase( oNode, L"w:helpText", m_oHelpText );
XmlMacroReadAttributeBase( oNode, L"w:required", m_oRequired );
}
void CFormPr::FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
std::wstring CFormPr::ToString() const
{
std::wstring sResult;
if(m_oKey.IsInit())
{
sResult += L"w:key=\"" + XmlUtils::EncodeXmlString(m_oKey.get()) + L"\" ";
}
if(m_oLabel.IsInit())
{
sResult += L"w:label=\"" + XmlUtils::EncodeXmlString(m_oLabel.get()) + L"\" ";
}
if(m_oHelpText.IsInit())
{
sResult += L"w:helpText=\"" + XmlUtils::EncodeXmlString(m_oHelpText.get()) + L"\" ";
}
if(m_oRequired.IsInit())
{
if(*m_oRequired)
{
sResult += L"w:required=\"1\" ";
}
else
{
sResult += L"w:required=\"0\" ";
}
}
return sResult;
}
void CFormPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, L"key", m_oKey )
WritingElement_ReadAttributes_Read_else_if( oReader, L"label", m_oLabel )
WritingElement_ReadAttributes_Read_else_if( oReader, L"helpText", m_oHelpText )
WritingElement_ReadAttributes_Read_else_if( oReader, L"required", m_oRequired )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
void CComb::FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase( oNode, L"w:width", m_oWidth );
@ -154,9 +101,9 @@ namespace OOX
{
namespace Logic
{
//--------------------------------------------------------------------------------
// CSdtContent
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// CSdtContent
//--------------------------------------------------------------------------------
void CSdtContent::fromXML(XmlUtils::CXmlNode& oNode)
{
ClearItems();
@ -364,6 +311,87 @@ namespace OOX
return sResult;
}
//--------------------------------------------------------------------------------
EElementType CFormPr::getType() const
{
return et_w_formPr;
}
void CFormPr::fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
XmlMacroReadAttributeBase(oNode, L"w:key", m_oKey);
XmlMacroReadAttributeBase(oNode, L"w:label", m_oLabel);
XmlMacroReadAttributeBase(oNode, L"w:helpText", m_oHelpText);
XmlMacroReadAttributeBase(oNode, L"w:required", m_oRequired);
WritingElement_ReadNode(oNode, oChild, L"w:border", m_oBorder);
WritingElement_ReadNode(oNode, oChild, L"w:shd", m_oShd);
}
void CFormPr::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if (oReader.IsEmptyNode())
return;
int nParentDepth = oReader.GetDepth();
while (oReader.ReadNextSiblingNode(nParentDepth))
{
std::wstring sName = oReader.GetName();
if (L"w:shd" == sName)
m_oShd = oReader;
else if (L"w:border" == sName)
m_oBorder = oReader;
}
}
std::wstring CFormPr::toXML() const
{
std::wstring sResult = L"<w:formPr";
if (m_oKey.IsInit())
{
sResult += L"w:key=\"" + XmlUtils::EncodeXmlString(m_oKey.get()) + L"\" ";
}
if (m_oLabel.IsInit())
{
sResult += L"w:label=\"" + XmlUtils::EncodeXmlString(m_oLabel.get()) + L"\" ";
}
if (m_oHelpText.IsInit())
{
sResult += L"w:helpText=\"" + XmlUtils::EncodeXmlString(m_oHelpText.get()) + L"\" ";
}
if (m_oRequired.IsInit())
{
if (*m_oRequired)
{
sResult += L"w:required=\"1\" ";
}
else
{
sResult += L"w:required=\"0\" ";
}
}
sResult += L">";
WritingElement_WriteNode_1(L"<w:shd ", m_oShd);
WritingElement_WriteNode_1(L"<w:border ", m_oBorder);
sResult += L"</w:textFormPr>";
return sResult;
return sResult;
}
void CFormPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS(oReader)
WritingElement_ReadAttributes_Read_if(oReader, L"key", m_oKey)
WritingElement_ReadAttributes_Read_else_if(oReader, L"label", m_oLabel)
WritingElement_ReadAttributes_Read_else_if(oReader, L"helpText", m_oHelpText)
WritingElement_ReadAttributes_Read_else_if(oReader, L"required", m_oRequired)
WritingElement_ReadAttributes_End_No_NS(oReader)
}
//-----------------------------------------------------------------------------------------------------------------------------
void CTextFormPr::fromXML(XmlUtils::CXmlNode& oNode)
{
@ -739,7 +767,7 @@ namespace OOX
break;
}
}
WritingElement_WriteNode_1(L"<w:formPr ", m_oFormPr);
WritingElement_WriteNode_2(m_oFormPr);
WritingElement_WriteNode_2(m_oTextFormPr);
return sResult;

View File

@ -404,32 +404,6 @@ namespace ComplexTypes
nullable<SimpleTypes::CSdtAppearance<>> m_oVal;
};
//Not from specification
class CFormPr : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CFormPr)
CFormPr()
{
}
virtual ~CFormPr()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode);
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring ToString() const;
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
nullable_string m_oKey;
nullable_string m_oLabel;
nullable_string m_oHelpText;
nullable_bool m_oRequired;
};
//Not from specification
class CComb : public ComplexType
{
@ -462,6 +436,32 @@ namespace OOX
{
namespace Logic
{
//Not from specification
class CFormPr : public WritingElement
{
public:
WritingElement_AdditionConstructors(CFormPr)
CFormPr(OOX::Document *pMain = NULL) : WritingElement(pMain)
{
}
virtual ~CFormPr()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const;
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
nullable_string m_oKey;
nullable_string m_oLabel;
nullable_string m_oHelpText;
nullable_bool m_oRequired;
nullable<ComplexTypes::Word::CBorder> m_oBorder;
nullable<ComplexTypes::Word::CShading> m_oShd;
};
//Not from specification
class CTextFormPr : public WritingElement
{
@ -1163,7 +1163,7 @@ namespace OOX
nullable<ComplexTypes::Word::CSdtText> m_oText;
nullable<CSdtCheckBox> m_oCheckbox;
nullable<ComplexTypes::Word::CFormPr> m_oFormPr; //Not from specification
nullable<CFormPr> m_oFormPr; //Not from specification
nullable<CTextFormPr> m_oTextFormPr; //Not from specification
nullable<CSdtPicture> m_oPicture; //Not from specification
};

View File

@ -729,6 +729,7 @@ namespace OOX
et_w_cols, // <w:cols>
et_w_comboBox, // <w:comboBox>
et_w_textFormPr, // <w:textFormPr> custom!
et_w_formPr,// <w:formPr> custom!
et_w_comment, // <w:comment>
et_w_commentRangeEnd, // <w:commentRangeEnd>
et_w_commentRangeStart, // <w:commentRangeStart>

View File

@ -111,6 +111,18 @@ private:
return hRes;
}
// Todo for windows =)
HRESULT _Remove(const std::wstring& strFileName)
{
BYTE* pUtf8 = NULL;
LONG lLen = 0;
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false);
auto err = remove((char*)pUtf8);
return S_OK;
}
public:
CFile()
{
@ -198,6 +210,10 @@ public:
{
return _Open(strFileName, false, true, true);
}
HRESULT RemoveFile(const std::wstring& strFileName)
{
return _Remove(strFileName);
}
HRESULT SetPosition( ULONG nPos )
{
if (m_pFile && nPos <= (ULONG)m_lFileSize)

View File

@ -396,6 +396,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
}
//-----------------------------------------------------------------------------------------------
// others
bool bEmptyFile = false;
{
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
@ -408,6 +410,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
int sizeRead = (int)dwReadBytes;
bEmptyFile = (dwReadBytes < 1);
if ( isOOXFlatFormatFile(buffer,sizeRead) )
{
//nFileType;
@ -469,7 +473,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
if (buffer)delete []buffer;
buffer = NULL;
}
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)return true;
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
//------------------------------------------------------------------------------------------------
//// by Extension
@ -480,10 +484,28 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
sExt = fileName.substr(nExtPos);
std::transform(sExt.begin(), sExt.end(), sExt.begin(), tolower);
if (0 == sExt.compare(L".mht"))
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
if (bEmptyFile)
{
if (0 == sExt.compare(L".xlsx"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
else if ( 0 == sExt.compare(L".docx"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
else if (0 == sExt.compare(L".pptx"))
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
else if (0 == sExt.compare(L".ods"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
else if (0 == sExt.compare(L".odt"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT;
else if (0 == sExt.compare(L".odp"))
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
}
else if (0 == sExt.compare(L".mht"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
else if (0 == sExt.compare(L".csv"))
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xls"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;

View File

@ -192,8 +192,8 @@ namespace MetaFile
if (!pFont)
return;
UpdateClip();
UpdateTransform(iGraphicsMode);
UpdateClip();
int lLogicalFontHeight = pFont->GetHeight();
if (lLogicalFontHeight < 0)

View File

@ -91,7 +91,7 @@ LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDocxFormatLib
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib
#All dynamic libs
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, PdfWriter, PdfReader, HtmlFile2, EpubFile, XpsFile, DjVuFile, HtmlRenderer, doctrenderer, Fb2File)
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, Fb2File, PdfWriter, PdfReader, HtmlFile2, EpubFile, XpsFile, DjVuFile, HtmlRenderer, doctrenderer)
#####################################################
# внешнее подключение сторонних библиотек

View File

@ -99,6 +99,31 @@ namespace NExtractTools
}
return sExt;
}
bool create_if_empty(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &signature)
{
bool res = false;
NSFile::CFileBinary file;
if (file.OpenFile(sFrom))
{
long file_size = file.GetFileSize();
file.CloseFile();
if (file_size == 0)
{
file.CreateFileW(sTo);
if (false == signature.empty())
{
file.WriteStringUTF8(signature);
}
file.CloseFile();
res = true;
}
}
return res;
}
_UINT32 replaceContentType(const std::wstring &sDir, const std::wstring &sCTFrom, const std::wstring &sCTTo)
{
_UINT32 nRes = 0;
@ -231,7 +256,6 @@ namespace NExtractTools
// docx -> bin
_UINT32 docx2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
// Extract docx to temp directory
std::wstring sTempUnpackedDOCX = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedDOCX);
@ -246,11 +270,14 @@ namespace NExtractTools
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO)
return mscrypt2oot_bin(sFrom, sTo, sTemp, params);
else
return AVS_FILEUTILS_ERROR_CONVERT;
{
if (create_if_empty(sFrom, sTo, L"DOCY;v10;0;"))
return 0;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
else return AVS_FILEUTILS_ERROR_CONVERT;
}
return docx_dir2doct_bin(sTempUnpackedDOCX, sTo, sTemp, params);
}
_UINT32 docx_dir2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
@ -660,6 +687,8 @@ namespace NExtractTools
}
else
{
if (create_if_empty(sFrom, sTo, L"XLSY;v10;0;"))
return 0;
return AVS_FILEUTILS_ERROR_CONVERT;
}
}
@ -1060,7 +1089,11 @@ namespace NExtractTools
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO)
return mscrypt2oot_bin(sFrom, sTo, sTemp, params);
else
{
if (create_if_empty(sFrom, sTo, L"PPTY;v10;0;"))
return 0;
return AVS_FILEUTILS_ERROR_CONVERT;
}
}
else return AVS_FILEUTILS_ERROR_CONVERT;
}
@ -1229,7 +1262,11 @@ namespace NExtractTools
m_oCXlsxSerializer.setIsNoBase64(params.getIsNoBase64());
m_oCXlsxSerializer.setFontDir(params.getFontPath());
_UINT32 nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sCSV, params.getXmlOptions());
if (!params.m_nFormatFrom) params.m_nFormatFrom = new int(AVS_OFFICESTUDIO_FILE_UNKNOWN);
if (AVS_OFFICESTUDIO_FILE_UNKNOWN == *params.m_nFormatFrom)
*params.m_nFormatFrom = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
_UINT32 nRes = m_oCXlsxSerializer.saveToFile (sResultXlstFileEditor, sCSV, params.getXmlOptions());
if (SUCCEEDED_X2T(nRes))
{
@ -2642,21 +2679,30 @@ namespace NExtractTools
NSDirectory::CreateDirectory(sTempUnpackedOdf);
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
return -3;
_UINT32 nRes = 0;
NSDirectory::CreateDirectory(sTempUnpackedOox);
_UINT32 nRes = ConvertODF2OOXml(sTempUnpackedOdf, sTempUnpackedOox, params.getFontPath(), sTemp, params.getPassword(), NULL);
nRes = processEncryptionError(nRes, sFrom, params);
if(SUCCEEDED_X2T(nRes))
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
{
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
NSDirectory::CreateDirectory(sTempUnpackedOox);
m_oCDocxSerializer.setFontDir(params.getFontPath());
nRes = ConvertODF2OOXml(sTempUnpackedOdf, sTempUnpackedOox, params.getFontPath(), sTemp, params.getPassword(), NULL);
nRes = processEncryptionError(nRes, sFrom, params);
if (SUCCEEDED_X2T(nRes))
{
//???? todooo - xlsx, pptx
BinDocxRW::CDocxSerializer m_oCDocxSerializer;
nRes = m_oCDocxSerializer.saveToFile (sTo, sTempUnpackedOox, params.getXmlOptions(), sTemp) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
m_oCDocxSerializer.setFontDir(params.getFontPath());
nRes = m_oCDocxSerializer.saveToFile(sTo, sTempUnpackedOox, params.getXmlOptions(), sTemp) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
}
else
{
nRes = AVS_FILEUTILS_ERROR_CONVERT;
if (create_if_empty(sFrom, sTo, L"DOCY;v10;0;"))
nRes = 0;
}
return nRes;
}
@ -2667,7 +2713,7 @@ namespace NExtractTools
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
return AVS_FILEUTILS_ERROR_CONVERT;;
return AVS_FILEUTILS_ERROR_CONVERT;
_UINT32 nRes = ConvertOTF2ODF(sTempUnpackedOdf);
if(SUCCEEDED_X2T(nRes))
@ -2677,32 +2723,44 @@ namespace NExtractTools
}
return nRes;
}
_UINT32 odf2oox(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring sTempUnpackedOox = sTemp + FILE_SEPARATOR_STR + _T("oox_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedOox);
_UINT32 nRes = odf2oox_dir(sFrom, sTempUnpackedOox, sTemp, params);
if(SUCCEEDED_X2T(nRes))
{
_UINT32 nRes = odf2oox_dir(sFrom, sTempUnpackedOox, sTemp, params);
if (SUCCEEDED_X2T(nRes))
{
COfficeUtils oCOfficeUtils(NULL);
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedOox, sTo, true)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT;
}
else
{
nRes = AVS_FILEUTILS_ERROR_CONVERT;
if (create_if_empty(sFrom, sTo, L""))
nRes = 0;
}
return nRes;
}
_UINT32 odf2oox_dir(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
_UINT32 nRes = 0;
std::wstring sTempUnpackedOdf = sTemp + FILE_SEPARATOR_STR + _T("odf_unpacked");
NSDirectory::CreateDirectory(sTempUnpackedOdf);
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
return AVS_FILEUTILS_ERROR_CONVERT;;
_UINT32 nRes = ConvertODF2OOXml(sTempUnpackedOdf, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
nRes = processEncryptionError(nRes, sFrom, params);
return nRes;
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedOdf, NULL, 0))
{
nRes = ConvertODF2OOXml(sTempUnpackedOdf, sTo, params.getFontPath(), sTemp, params.getPassword(), NULL);
nRes = processEncryptionError(nRes, sFrom, params);
}
else
{
nRes = AVS_FILEUTILS_ERROR_CONVERT;
}
return nRes;
}
//odf flat
_UINT32 odf_flat2oot(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)