Compare commits

..

92 Commits

Author SHA1 Message Date
b19191b286 openssl signing bugs 2017-06-15 11:13:18 +03:00
77f8ab6875 . 2017-06-14 19:04:46 +03:00
6fc6f9ead3 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-06-14 18:50:53 +03:00
270c1fa2ac . 2017-06-14 18:39:13 +03:00
f76a03fab8 openssl signing bugs 2017-06-14 18:09:28 +03:00
09e6d3f760 XlsFormat - read pivot table records 2017-06-14 17:31:57 +03:00
90d8055bcb up 2017-06-14 15:30:30 +03:00
01ba3b4182 openssl signing bugs 2017-06-14 15:13:44 +03:00
ddb67584b8 . 2017-06-14 12:14:10 +03:00
38ce5586bb ooxml signing developing... 2017-06-13 18:25:58 +03:00
f6d9ce83f0 . 2017-06-13 17:29:31 +03:00
03edd40850 Pptx binary - write notes & master notes 2017-06-13 15:38:13 +03:00
9ff87b3c6b Merge tag 'v4.3.6' into develop
v4.3.6 v4.3.6
2017-06-13 15:28:45 +03:00
645cbef1ef . 2017-06-09 17:46:00 +03:00
02238f7eea Fixed bug with drawing a char with negative size of the font. 2017-06-09 15:11:47 +03:00
907e00a3ac . 2017-06-09 12:19:35 +03:00
2470bfd335 Fixed bug with caching fonts for different pages. Fixed bug with drawing a text. 2017-06-09 11:25:56 +03:00
3ae52bd221 . 2017-06-08 18:15:43 +03:00
227d4f18d6 . 2017-06-08 17:24:17 +03:00
36bdbad685 for bug 27765
external OleLink/DdeLink
2017-06-08 17:08:08 +03:00
525b828540 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  TextParagraphPr swap marR/marL
  .
  .
  .
  Use `uname -m` for determine linux x64\x686
  Add travis example config
  .
2017-06-08 15:48:04 +03:00
f64ee80a1a add event 2017-06-08 15:47:56 +03:00
f6402813c4 TextParagraphPr swap marR/marL 2017-06-08 13:19:53 +03:00
224ac7d6e2 . 2017-06-07 18:53:35 +03:00
2e2bd8989d . 2017-06-07 18:39:24 +03:00
8f434efb95 . 2017-06-07 18:36:40 +03:00
244dafb02b Merge pull request #31 from ONLYOFFICE/ShockwaveNN-patch-1
Use `uname -m` for determine linux x64\x686
2017-06-07 18:35:57 +03:00
149a1bdbd5 Use uname -m for determine linux x64\x686
`uname -p` return `unknown` on several system (including debian, but not including ubuntu)
2017-06-07 18:34:18 +03:00
a79d9041bc Merge pull request #30 from ONLYOFFICE/fix/travis-status-green
Add travis example config
2017-06-07 17:26:08 +03:00
3954c42602 Add travis example config 2017-06-07 17:16:51 +03:00
29dc0aee32 . 2017-06-06 16:50:39 +03:00
d805972d6d Merge pull request #28 from ONLYOFFICE/hotfix/v4.3.5
Hotfix/v4.3.5
2017-06-05 17:19:24 +03:00
549d5a46a6 Merge branch 'develop' into hotfix/v4.3.5 2017-06-05 17:12:36 +03:00
9e867be756 Merge branch 'hotfix/v4.3.5' 2017-06-05 16:48:24 +03:00
771bf2d55c for bug 27765
EncodeXml
2017-06-05 15:03:29 +03:00
3c58cd96fc for bug 27765 2017-06-05 14:36:34 +03:00
e50864fa98 . 2017-06-05 10:39:58 +03:00
c8c0924c74 for oox2mscrypt 2017-06-02 18:43:38 +03:00
af732e4e85 . 2017-06-02 18:38:44 +03:00
47ffdae8cc PptxFormat - partly fix 35054 2017-06-02 14:35:41 +03:00
fd5870083b . 2017-06-02 11:16:59 +03:00
5ba62cb25d . 2017-06-01 16:54:16 +03:00
79e0588544 fix partly 35047 2017-06-01 16:16:39 +03:00
a3d08cfc35 XlsxFormat - fix object without replacement image 2017-06-01 14:39:41 +03:00
5caccb284a Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-06-01 12:27:46 +03:00
ce19969b52 PptxFormat - fix objects without replacement image 2017-06-01 12:24:27 +03:00
0f91dc392e test ParseAllCultureInfo 2017-06-01 11:52:36 +03:00
e9805cef30 PptxFormat - fix Ole object without image cash 2017-05-31 19:22:26 +03:00
e3e05eb2db test 2017-05-31 19:01:24 +03:00
c09f17cffb . 2017-05-31 17:56:45 +03:00
ce73dd5987 linux build error 2017-05-31 15:48:59 +03:00
77df8aacb9 . 2017-05-31 14:13:54 +03:00
ce45b2802f fix bug #34953 2017-05-31 13:46:49 +03:00
7886018d6f Oox file crypter 2017-05-31 12:35:27 +03:00
5b5cb4188e OfficeCryptReader - check data integrity 2017-05-30 19:49:54 +03:00
f797af5f17 . 2017-05-30 16:05:49 +03:00
055977535e fixed build error 2017-05-30 16:04:33 +03:00
6ab24f10f0 Added prefix for lib targets 2017-05-30 15:55:31 +03:00
12a03da231 Changed extension for ooxmlsignature 2017-05-30 15:29:43 +03:00
cb7088979a . 2017-05-30 15:26:56 +03:00
1fb1fc6c97 Added OOXMLSIGNATURE project 2017-05-30 13:15:14 +03:00
e633c3c5d1 fix bug 35012 2017-05-29 17:11:10 +03:00
0f04de34b1 OdfFormatWriter - dont write backgroud master notes, notes (errors in libre & open office) 2017-05-29 16:19:26 +03:00
3f8c2c293a XlsFormatReader - fix users file 2017-05-28 17:18:27 +03:00
2c97e743da . 2017-05-28 15:44:49 +03:00
2c83860c04 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
Conflicts:
	DesktopEditor/raster/Metafile/Emf/EmfFile.cpp
2017-05-27 15:27:51 +03:00
c64b624de2 . 2017-05-27 15:24:50 +03:00
5e3990937d OdfFormatReader - fix after testing 2017-05-27 15:17:46 +03:00
21744c1607 . 2017-05-26 17:50:23 +03:00
0892e2549f . 2017-05-26 17:48:13 +03:00
cff6f305d4 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-05-26 17:09:34 +03:00
5060071227 fix bug #35006 2017-05-26 17:07:38 +03:00
d64109eaa4 imagedata for document signature 2017-05-26 17:06:40 +03:00
ec064bbd50 signing documents 2017-05-26 16:53:02 +03:00
baf952a151 fix bug 35004 2017-05-26 16:22:25 +03:00
0dd36c5e6a . 2017-05-25 16:41:19 +03:00
474404a8f9 . 2017-05-24 16:41:05 +03:00
f2f6483b6f x2t linux build 2.4.461 2017-05-24 10:49:41 +03:00
c30161dbd0 . 2017-05-23 19:24:41 +03:00
ec4f4fe476 Fix for cross compiling 2017-05-23 15:04:53 +03:00
634509ae28 Fix for cross compilation 2017-05-23 14:50:07 +03:00
1244048c50 x2t - binary - read/write audio/video content for presentation 2017-05-23 14:30:50 +03:00
a62b69fb31 . 2017-05-22 18:12:18 +03:00
5eb36efb63 . 2017-05-22 10:46:00 +03:00
fb8c4231b0 PptFormat - actions 2017-05-21 16:52:09 +03:00
9774d1de46 PptFormatReader - add presentation video & audio 2017-05-20 15:32:00 +03:00
f5b141eeee . 2017-05-19 18:34:36 +03:00
1e47dc1111 . 2017-05-19 14:15:59 +03:00
d3f4a2127d OdfFormat, PptxFormat - presentation transitions 2017-05-19 13:09:05 +03:00
4d5f328c30 open/save vml signatureline 2017-05-19 12:58:31 +03:00
b18cd44cf6 . 2017-05-18 18:10:19 +03:00
8197fb8900 do not read theme.xml if there is rels file but there is no xml file 2017-05-16 18:18:55 +03:00
291 changed files with 8578 additions and 4734 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ Common/3dParty/v8/win_32
Common/3dParty/v8/linux_64
Common/3dParty/v8/linux_32
Common/3dParty/v8/mac_64
Common/3dParty/openssl/openssl
**/core_build
**/Release
**/Debug

View File

@ -1 +1,14 @@
language: cpp
language: cpp
compiler: gcc
dist: trusty
addons:
apt:
packages:
- p7zip-full
script:
- exit 0
# Build fails anyway. See explanation in
# https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
- cd Common/3dParty && ./make.sh
- cd ../../
- make

View File

@ -811,10 +811,10 @@ namespace DocFileFormat
{
Symbol s = getSymbol( chpx );
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
m_pXmlWriter->WriteNodeEnd(L"", true);
//m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
//m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
//m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
//m_pXmlWriter->WriteNodeEnd(L"", true);
}
else if ((TextMark::DrawnObject == code) && fSpec)
{
@ -1663,12 +1663,17 @@ namespace DocFileFormat
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( fontIndex ) );
ret.FontName = ffn->xszFtn;
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );//-123 - ShortToFormattedWideString
break;
}
}
if (ret.HexValue.length() > 4)
{
ret.HexValue = ret.HexValue.substr(ret.HexValue.length() - 4, 4);
}
return ret;
}

View File

@ -184,104 +184,100 @@ namespace DocFileFormat
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
for (std::vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
{
try
switch (iter->Type)
{
switch (iter->Type)
case PathSegment::msopathLineTo:
{
case PathSegment::msopathLineTo:
for (int i = 0; i < iter->Count; ++i)
{
for (int i = 0; i < iter->Count; ++i)
if (valuePointer + 1 > (int)m_arPoints.size())
{
if (valuePointer >= (int)m_arPoints.size())
{
break;
break;
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
++valuePointer;
//break;
}
else
{
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
++valuePointer;
//break;
}
}
break;
case PathSegment::msopathCurveTo:
{
for (int i = 0; i < iter->Count; ++i)
else
{
strVmlPath += L"c";
strVmlPath += L"l";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
++valuePointer;
}
}
break;
}
break;
case PathSegment::msopathMoveTo:
case PathSegment::msopathCurveTo:
{
for (int i = 0; i < iter->Count; ++i)
{
strVmlPath += L"m";
if (valuePointer + 3 > (int)m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
}
}
break;
case PathSegment::msopathMoveTo:
{
if (valuePointer < (int)m_arPoints.size())
{
strVmlPath += L"m";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
++valuePointer;
}
break;
case PathSegment::msopathClose:
{
strVmlPath += L"x";
}
break;
case PathSegment::msopathEnd:
{
strVmlPath += L"e";
}
break;
case PathSegment::msopathEscape:
{
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
strVmlPath += L"nf";
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
strVmlPath += L"ns";
}
case PathSegment::msopathClientEscape:
case PathSegment::msopathInvalid:
{
//ignore escape segments and invalid segments
}
break;
}
}
catch (...)
{
// Sometimes there are more Segments than available m_arPoints.
// Accordingly to the spec this should never happen :)
break;
case PathSegment::msopathClose:
{
strVmlPath += L"x";
}
break;
case PathSegment::msopathEnd:
{
strVmlPath += L"e";
}
break;
case PathSegment::msopathEscape:
{
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
strVmlPath += L"nf";
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
strVmlPath += L"ns";
}
case PathSegment::msopathClientEscape:
case PathSegment::msopathInvalid:
{
//ignore escape segments and invalid segments
}
break;
}
}

View File

@ -178,7 +178,9 @@ namespace BinXlsxRW{
{
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;

View File

@ -307,6 +307,7 @@ namespace
content << L"<w:" << Node << L"s \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \

View File

@ -33,9 +33,6 @@
#include "mediaitems.h"
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/utils.h>
@ -92,12 +89,18 @@ std::wstring static get_default_file_name(RelsType type)
return L"image";
case typeChart:
return L"chart";
case typeMedia:
return L"media";
case typeMsObject:
return L"msObject";
case typeOleObject:
return L"oleObject";
case typeMedia:
return L"media";
case typeSlide:
return L"slide";
case typeVideo:
return L"video";
case typeAudio:
return L"audio";
default:
return L"";
}
@ -142,8 +145,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
}
std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
{
CFile file;
@ -187,6 +189,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
else if ( type == typeImage) number = count_image + 1;
else if ( type == typeShape) number = count_shape + 1;
else if ( type == typeMedia) number = count_media + 1;
else if ( type == typeAudio) number = count_audio + 1;
else if ( type == typeVideo) number = count_video + 1;
else if ( type == typeSlide) number = count_slide + 1;
else if ( type == typeMsObject ||
type == typeOleObject) number = count_object + 1;
else
@ -240,6 +245,21 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
id = std::wstring(L"objId") + std::to_wstring(count_object + 1);
count_object++;
}
else if ( type == typeAudio)
{
id = std::wstring(L"aId") + std::to_wstring(count_audio + 1);
count_audio++;
}
else if ( type == typeVideo)
{
id = std::wstring(L"vId") + std::to_wstring(count_video + 1);
count_video++;
}
else if ( type == typeMedia)
{
id = std::wstring(L"mId") + std::to_wstring(count_media + 1);
count_media++;
}
else
{
id = std::wstring(L"rId") + std::to_wstring(count_shape + 1);

View File

@ -31,11 +31,10 @@
*/
#pragma once
#include <vector>
#include <string>
#include "oox_rels.h"
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore {
namespace oox {
@ -50,6 +49,9 @@ public:
count_tables = 0;
count_media = 0;
count_object = 0;
count_audio = 0;
count_video = 0;
count_slide = 0;
}
struct item
@ -74,6 +76,9 @@ public:
size_t count_charts;
size_t count_image;
size_t count_media;
size_t count_audio;
size_t count_video;
size_t count_slide;
size_t count_shape;
size_t count_tables;
size_t count_object;
@ -93,7 +98,7 @@ public:
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
case typeMedia: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/media";
case typeMedia: return L"http://schemas.microsoft.com/office/2007/relationships/media";
case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
@ -101,10 +106,34 @@ public:
return L"";
}
}
static RelsType detectMediaType(const std::wstring & fileName)
{
int pos = fileName.rfind(L".");
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
if (sExt.empty()) return typeMedia;
sExt = XmlUtils::GetLower(sExt);
if (sExt == L"wmv") return typeVideo;
if (sExt == L"avi") return typeVideo;
if (sExt == L"wmv") return typeVideo;
if (sExt == L"wma") return typeAudio;
if (sExt == L"wav") return typeAudio;
if (sExt == L"mp3") return typeAudio;
if (sExt == L"m4a") return typeAudio;
if (sExt == L"m4v") return typeVideo;
if (sExt == L"mp4") return typeVideo;
if (sExt == L"mov") return typeVideo;
return typeMedia;
}
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (std::wstring &fileName);
std::wstring detectImageFileExtension (const std::wstring &fileName);
items_array items_;
std::wstring odf_packet_;

View File

@ -526,14 +526,23 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"r:id", val.hId);
if (!val.action.empty())
CP_XML_ATTR(L"action", val.action);
if (val.highlightClick)
CP_XML_ATTR(L"highlightClick", val.highlightClick);
CP_XML_ATTR(L"r:id", val.hId);
if (!val.hSoundId.empty())
{
CP_XML_NODE(L"a:snd")
{
CP_XML_ATTR(L"r:embed", val.hSoundId);
CP_XML_ATTR(L"name", L"sound");
}
}
}
}
}

View File

@ -60,15 +60,22 @@ namespace oox {
enabled = false;
highlightClick = false;
hSoundId.clear();
hSoundRef.clear();
hId.clear();
hRef.clear();
action.clear();
}
bool enabled;
std::wstring action;
std::wstring hSoundId;
std::wstring hSoundRef;
std::wstring hId;
std::wstring hRef;
std::wstring action;
RelsType typeRels;
bool highlightClick;
@ -95,6 +102,8 @@ namespace oox {
std::wstring objectId;
std::wstring objectProgId;
std::wstring extId;
_action_desc action;
std::vector<_hlink_desc> hlinks;

View File

@ -71,7 +71,18 @@ static std::wstring get_mime_type(const std::wstring & extension)
else if (L"tif" == extension) return L"image/x-tiff";
else if (L"tiff" == extension) return L"image/x-tiff";
else if (L"pdf" == extension) return L"application/pdf";
else if (L"wav" == extension) return L"audio/wav";
else if (L"mp3" == extension) return L"audio/mpeg";
else if (L"wma" == extension) return L"audio/x-ms-wma";
else if (L"m4a" == extension) return L"audio/unknown";
else if (L"avi" == extension) return L"video/avi";
else if (L"wmv" == extension) return L"video/x-ms-wmv";
else if (L"mov" == extension) return L"video/unknown";
else if (L"mp4" == extension) return L"video/unknown";
else if (L"m4v" == extension) return L"video/unknown";
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
else if (L"docx" == extension) return L"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
@ -130,7 +141,7 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
{
std::vector<override_content_type> & override_ = content_type_content_.get_override();
for (int i = 0 ; i < override_.size(); i++)
for (size_t i = 0 ; i < override_.size(); i++)
{
if (override_[i].part_name() == fileName)
return true;
@ -158,14 +169,18 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
void content_types_file::set_media(mediaitems & _Mediaitems)
{
BOOST_FOREACH( mediaitems::item & item, _Mediaitems.items() )
std::vector<mediaitems::item> & items_ = _Mediaitems.items();
for (size_t i = 0; i < items_.size(); i++)
{
if ((item.type == typeImage || item.type == typeMedia) && item.mediaInternal)
if ((items_[i].type == typeImage ||
items_[i].type == typeMedia ||
items_[i].type == typeVideo ||
items_[i].type == typeAudio) && items_[i].mediaInternal)
{
int n = item.outputName.rfind(L".");
int n = items_[i].outputName.rfind(L".");
if (n > 0)
{
add_or_find_default(item.outputName.substr(n+1, item.outputName.length() - n));
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
}
}
}
@ -320,9 +335,12 @@ void media::write(const std::wstring & RootPath)
NSDirectory::CreateDirectory(path.c_str());
mediaitems::items_array & items = mediaitems_.items();
for (int i = 0; i < items.size(); i++ )
for (size_t i = 0; i < items.size(); i++ )
{
if (items[i].mediaInternal && items[i].valid && (items[i].type == typeImage || items[i].type == typeMedia))
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
items[i].type == typeMedia ||
items[i].type == typeAudio ||
items[i].type == typeVideo ))
{
std::wstring & file_name = items[i].href;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
@ -359,7 +377,7 @@ void embeddings::write(const std::wstring & RootPath)
content_types_file & content_types = get_main_document()->get_content_types_file();
mediaitems::items_array & items = embeddingsitems_.items();
for (int i = 0; i < items.size(); i++ )
for (size_t i = 0; i < items.size(); i++ )
{
if ( items[i].mediaInternal && items[i].valid &&
(items[i].type == typeMsObject || items[i].type == typeOleObject))

View File

@ -130,9 +130,29 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
}
CP_XML_NODE(L"p:nvPr")
{
CP_XML_NODE(L"a:videoFile")
std::wstring strNode;
if (val.type == typeVideo) strNode = L"a:videoFile";
else if (val.type == typeAudio) strNode = L"a:audioFile";
if (strNode.empty() == false)
{
CP_XML_ATTR(L"r:link", val.objectId);
CP_XML_NODE(strNode)
{
CP_XML_ATTR(L"r:link", val.objectId);
}
}
CP_XML_NODE(L"p:extLst")
{
CP_XML_NODE(L"p:ext")
{
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
CP_XML_NODE(L"p14:media")
{
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_ATTR(L"r:embed", val.extId);
}
}
}
}
}
@ -359,12 +379,11 @@ void _pptx_drawing::serialize(std::wostream & strm)
{
pptx_serialize_table(strm, *this);
}
else if (type == typeMsObject ||
type == typeOleObject)
else if (type == typeMsObject || type == typeOleObject)
{
pptx_serialize_object(strm, *this);
}
else if (type == typeMedia)
else if (type == typeMedia || type == typeAudio || type == typeVideo )
{
pptx_serialize_media(strm, *this);
}

View File

@ -71,7 +71,8 @@ public:
}
if (!d.action.hId.empty())
{
pptx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
bool bInternal = (d.action.typeRels != typeHyperlink);
pptx_drawing_rels_.push_back(_rel(bInternal, d.action.hId, d.action.hRef, d.action.typeRels));
}
}
@ -124,10 +125,13 @@ public:
}
else
{
std::wstring ref = pptx_drawing_rels_[i].ref;
if (pptx_drawing_rels_[i].is_internal && ref != L"NULL")
{
ref = L"../" + ref;
}
Rels.add(relationship( pptx_drawing_rels_[i].rid,
mediaitems::get_rel_type(pptx_drawing_rels_[i].type),
(pptx_drawing_rels_[i].is_internal ? std::wstring(L"../") + pptx_drawing_rels_[i].ref : pptx_drawing_rels_[i].ref),
(pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
mediaitems::get_rel_type(pptx_drawing_rels_[i].type), ref, (pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
}
}
}

View File

@ -54,7 +54,7 @@ std::wstring pptx_xml_slide::rId() const
pptx_xml_slide_ptr pptx_xml_slide::create(std::wstring const & name,int id)
{
const std::wstring rId = std::wstring(L"sId") + std::to_wstring(id);
return boost::make_shared<pptx_xml_slide>(name,rId);
return boost::make_shared<pptx_xml_slide>(name, rId);
}
pptx_xml_slide::pptx_xml_slide(std::wstring const & name,std::wstring const & id)
@ -273,7 +273,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
CP_XML_ATTR(L"accent6",L"accent6");
CP_XML_ATTR(L"accent5",L"accent5");
CP_XML_ATTR(L"accent4",L"accent4");
CP_XML_ATTR(L"accent3",L"accent5");
CP_XML_ATTR(L"accent3",L"accent3");
CP_XML_ATTR(L"accent2",L"accent2");
CP_XML_ATTR(L"accent1",L"accent1");
CP_XML_ATTR(L"tx2",L"dk2");
@ -283,7 +283,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
}
CP_XML_NODE(L"p:sldLayoutIdLst")
{
for (int i = 0; i < layoutsId_.size(); i++)
for (size_t i = 0; i < layoutsId_.size(); i++)
{
CP_XML_NODE(L"p:sldLayoutId")
{
@ -420,10 +420,14 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
{
CP_XML_STREAM() << slideMastersData_.str();
}
CP_XML_NODE(L"p:notesMasterIdLst")
{
CP_XML_STREAM() << slideNotesMastersData_.str();
}
std::wstring notesMaster = slideNotesMastersData_.str();
if (notesMaster.empty() == false)
{
CP_XML_NODE(L"p:notesMasterIdLst")
{
CP_XML_STREAM() << notesMaster;
}
}
CP_XML_NODE(L"p:sldIdLst")
{
CP_XML_STREAM() << slidesData_.str();

View File

@ -60,6 +60,7 @@ public:
_CP_OPT(std::wstring) Speed;
_CP_OPT(int) Time;
_CP_OPT(int) PageTime;
_CP_OPT(std::wstring) Dir;
_CP_OPT(std::wstring) Param;
bool onClick;
@ -135,6 +136,7 @@ private:
void process_chart (drawing_object_description& obj, _pptx_drawing & drawing);
void process_table (drawing_object_description& obj, _pptx_drawing & drawing);
void process_object (drawing_object_description& obj, _pptx_drawing & drawing);
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
size_t rId_;
mediaitems mediaitems_;
@ -160,7 +162,7 @@ void pptx_slide_context::Impl::process_drawings()
case typeChart: process_chart(objects_[i], drawing); break;
case typeShape: process_shape(objects_[i], drawing); break;
case typeTable: process_table(objects_[i], drawing); break;
case typeMedia:
case typeMedia: process_media(objects_[i], drawing); break;
case typeMsObject:
case typeOleObject: process_object(objects_[i], drawing); break;
}
@ -369,6 +371,7 @@ void pptx_slide_context::start_action(std::wstring action)
if (action == L"sound")
{
impl_->object_description_.action_.action = L"ppaction://noaction";
impl_->object_description_.action_.typeRels = typeAudio;
impl_->object_description_.action_.highlightClick = true;
}
@ -403,18 +406,29 @@ void pptx_slide_context::start_action(std::wstring action)
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
{
++hlinks_size_;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.highlightClick = true;
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
impl_->object_description_.action_.typeRels = typeRels;
if (typeRels == typeAudio)
{
bool isMediaInternal = true;
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
}
else
{
impl_->object_description_.action_.typeRels = typeRels;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
}
}
void pptx_slide_context::end_action()
{
@ -620,7 +634,26 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
}
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
{
std::wstring ref;
bool isMediaInternal = true;
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.extId = L"ext" + drawing.objectId;
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
add_additional_rels( true, drawing.extId, ref, typeMedia);
if (drawing.fill.bitmap)
{
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
}
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
{
if (pic.svg_rect_)
@ -714,8 +747,12 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
}
if (impl_->transition_.Time)
{
CP_XML_ATTR(L"advTm",impl_->transition_.Time.get());
}
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
}
if (impl_->transition_.PageTime)
{
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
}
CP_XML_ATTR(L"advClick", impl_->transition_.onClick);
CP_XML_NODE(std::wstring(L"p:" + impl_->transition_.Type))
@ -738,9 +775,22 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
//p:sndAc
}
}
//CP_XML_NODE(L"p:timing")- последовательности p:par
//{
//}
CP_XML_NODE(L"p:timing")
{
CP_XML_NODE(L"p:tnLst")
{
CP_XML_NODE(L"p:par")
{
CP_XML_NODE(L"p:cTn")
{
CP_XML_ATTR(L"nodeType", L"tmRoot");
CP_XML_ATTR(L"id", 1);
CP_XML_ATTR(L"dur", L"indefinite");
CP_XML_ATTR(L"restart", L"never");
}
}
}
}
}
}

View File

@ -191,6 +191,12 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}//props выше legacyDrawing !!
if (impl_->commentsId_.length()>0)
{
CP_XML_NODE(L"legacyDrawing")
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}

View File

@ -303,15 +303,15 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
if (filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
else if (filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
else if (filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
else if (filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
else if (filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
else if (filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
else if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";

View File

@ -84,22 +84,22 @@ std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
return _Wostream;
}
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
bool parseTime(std::wstring Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
{
try
{
boost::match_results<std::wstring::const_iterator> res;
//Full clock values:
// 02:30:03 = 2 hours, 30 minutes and 3 seconds
// 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds
boost::match_results<std::wstring::const_iterator> res1;
boost::wregex r1 (L"([\\d]+):([\\d]+):([\\d+(\\.\\d{0,})?]+)");
if (boost::regex_match(Time, res, r1))
if (boost::regex_match(Time, res1, r1))
{
Hours = boost::lexical_cast<int>(res[1].str());
Minutes = boost::lexical_cast<int>(res[2].str());
Seconds = boost::lexical_cast<double>(res[3].str());
Hours = boost::lexical_cast<int>(res1[1].str());
Minutes = boost::lexical_cast<int>(res1[2].str());
Seconds = boost::lexical_cast<double>(res1[3].str());
return true;
}
@ -107,11 +107,12 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
// 02:33 = 2 minutes and 33 seconds
// 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds
std::wstring Time2 = L"00:10.5";
boost::match_results<std::wstring::const_iterator> res2;
boost::wregex r2 (L"([\\d]+):([\\d+(\\.\\d{0,})?]+)");
if (boost::regex_match(Time, res, r2))
if (boost::regex_match(Time, res2, r2))
{
Minutes = boost::lexical_cast<int>(res[1].str());
Seconds = boost::lexical_cast<double>(res[2].str());
Minutes = boost::lexical_cast<int>(res2[1].str());
Seconds = boost::lexical_cast<double>(res2[2].str());
return true;
}
@ -121,32 +122,51 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
// 30s = 30 seconds
// 5ms = 5 milliseconds
// 12.467 = 12 seconds and 467 milliseconds
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]{0,})");
if (boost::regex_match(Time, res, r3))
{
if (!res[2].str().empty())
std::vector<std::wstring> values;
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]+)");
if (boost::regex_split(std::back_inserter(values), Time, r3, boost::match_default | boost::format_all))
{
int val = -1;
for (size_t i = 0; i < values.size() ; i++ )
{
std::wstring n = res[2].str();
std::transform(n.begin(), n.end(), n.begin(), ::tolower);
if (n == L"h")
if (values[i].empty()) continue;
if (values[i] == L"h")
{
Hours = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Hours = val;
val = -1;
}
else if (n == L"min")
else if (values[i] == L"min")
{
Minutes = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Minutes = val;
val = -1;
}
else if (n == L"s")
else if (values[i] == L"s")
{
Seconds = boost::lexical_cast<double>(res[1].str());
if (val >= 0)
Seconds = val;
val = -1;
}
else if (n == L"ms")
else if (values[i] == L"ms")
{
Ms = boost::lexical_cast<int>(res[1].str());
if (val >= 0)
Ms = val;
val = -1;
}
else
{
try
{
val = boost::lexical_cast<double>(values[i]);
}
catch(...)
{
continue;
}
}
}
else
Seconds = boost::lexical_cast<double>(res[1].str());
return true;
}

View File

@ -368,18 +368,18 @@ void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
void draw_plugin::pptx_convert(oox::pptx_conversion_context & Context)
{
// Context.get_slide_context().set_use_image_replacement();
//
// std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
// std::wstring folderPath = Context.root()->get_folder();
// std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
//
// Context.get_slide_context().set_media(href);
////params
// for (size_t i = 0; i < content_.size(); i++)
// {
// content_[i]->pptx_convert(Context);
// }
Context.get_slide_context().set_use_image_replacement();
std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
Context.get_slide_context().set_media(href);
//params
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
}
}
}

View File

@ -34,8 +34,6 @@
#include "office_presentation.h"
#include "draw_page.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->docx_convert(Context);
}
Context.end_office_text();
}
@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->xlsx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}
@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
for (size_t i = 0; i < footer_decls_.size(); i++)
{
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
for (size_t i = 0; i < date_time_decls_.size(); i++)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, pages_)
for (size_t i = 0; i < pages_.size(); i++)
{
elm->pptx_convert(Context);
pages_[i]->pptx_convert(Context);
}
Context.end_office_presentation();
}

View File

@ -161,10 +161,10 @@ struct anchor_settings
enum _drawing_part
{
Unknown=0,
Area,
Line,
Shadow
Unknown = 0,
Area = 1,
Line = 2,
Shadow = 3
};
struct odf_drawing_state
{
@ -192,6 +192,7 @@ struct odf_drawing_state
view_box_ = L"";
path_last_command_ = L"";
replacement_ = L"";
oox_shape_preset_ = -1;
oox_shape_.reset();
@ -222,12 +223,12 @@ struct odf_drawing_state
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_placeholder_;
std::wstring replacement_;
std::wstring path_;
std::wstring view_box_;
std::wstring path_last_command_;
oox_shape_ptr oox_shape_;
///////////////////////
//----------------------------------------------------------
int oox_shape_preset_;
bool in_group_;
bool text_box_tableframe_;
@ -236,7 +237,7 @@ struct odf_drawing_state
class odf_drawing_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
{
current_drawing_state_.clear();
styles_context_ = odf_context_->styles_context();
@ -250,7 +251,7 @@ public:
is_header_ = false;
is_footer_ = false;
is_background_ = false;
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
//некоторые свойства для объектов графики не поддерживаюися в редакторах Libre && OpenOffice.net
//в MS Office и в нашем - проблем таких нет.
}
@ -295,8 +296,7 @@ public:
};
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------------------------
odf_drawing_context::odf_drawing_context(odf_conversion_context *odf_context)
: impl_(new odf_drawing_context::Impl(odf_context))
{
@ -2277,9 +2277,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//вложенные элементы
//------------------------------------------------------------------------------------------------------------------
void odf_drawing_context::start_image(std::wstring odf_path)
{
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
@ -2359,9 +2357,31 @@ void odf_drawing_context::start_media(std::wstring name)
start_element(plugin_elm);
}
void odf_drawing_context::add_image_replacement()
{
if (impl_->current_drawing_state_.replacement_.empty()) return;
office_element_ptr image_elm;
create_element(L"draw", L"image", image_elm, impl_->odf_context_);
draw_image* image = dynamic_cast<draw_image*>(image_elm.get());
if (image == NULL)return;
image->common_xlink_attlist_.href_ = impl_->current_drawing_state_.replacement_;
image->common_xlink_attlist_.type_ = xlink_type::Simple;
image->common_xlink_attlist_.show_ = xlink_show::Embed;
image->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(image_elm);
set_image_style_repeat(1);//default
end_element();
}
void odf_drawing_context::end_media()
{
end_element();
add_image_replacement();
end_frame();
}
void odf_drawing_context::start_text_box()
@ -2475,8 +2495,10 @@ void odf_drawing_context::add_sound(std::wstring href)
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.script_event_name_ = L"dom:click";
event_->attlist_.presentation_action_ = L"sound";
event_->attlist_.script_event_name_ = L"dom:click";
if (!event_->attlist_.presentation_action_)
event_->attlist_.presentation_action_ = L"sound";
}
office_element_ptr elm;
@ -2619,6 +2641,36 @@ void odf_drawing_context::end_object()
end_frame();
}
void odf_drawing_context::start_object_ole(std::wstring ref)
{
start_frame();
office_element_ptr object_elm;
create_element(L"draw", L"object-ole", object_elm, impl_->odf_context_);
draw_object_ole* object = dynamic_cast<draw_object_ole*>(object_elm.get());
if (object == NULL)return;
object->common_xlink_attlist_.href_ = ref;
object->common_xlink_attlist_.type_ = xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(object_elm);
}
void odf_drawing_context::end_object_ole()
{
end_element();
add_image_replacement();
end_frame();
}
void odf_drawing_context::set_image_replacement(std::wstring ref)
{
impl_->current_drawing_state_.replacement_ = ref;
}
bool odf_drawing_context::is_exist_content()
{

View File

@ -141,12 +141,18 @@ public:
void set_text_box_tableframe (bool val);
void end_text_box ();
void start_object(std::wstring name);
void start_object(std::wstring ref); //формулы, диаграммы ...
void end_object();
void start_media(std::wstring name);
void start_object_ole(std::wstring ref);
void end_object_ole();
void start_media(std::wstring ref);
void end_media();
void add_image_replacement();
void set_image_replacement(std::wstring ref);
bool isLineShape();
void corrected_line_fill();

View File

@ -84,6 +84,12 @@ void odp_page_state::set_page_name(std::wstring name)
// master_page->attlist_.style_display_name_ = name;
}
}
void odp_page_state::set_page_duration(int id)
{
if (!page_properties_) return;
page_properties_->content_.presentation_page_duration_ = id;
}
void odp_page_state::set_layout_page(std::wstring name)
{
@ -224,6 +230,14 @@ void odp_page_state::set_transition_subtype(std::wstring val)
if (trans)
trans->filter_attlist_.smil_subtype_ = val;
}
void odp_page_state::set_transition_direction(std::wstring val)
{
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->common_attlist_.smil_direction_ = val;
}
void odp_page_state::set_transition_speed(int val)
{
if (transactions.empty()) return;

View File

@ -70,9 +70,10 @@ class odp_page_state
{
public:
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_page_name (std::wstring name);
void set_page_id (int id);
void set_page_style (office_element_ptr & _style);
void set_page_name (std::wstring name);
void set_page_id (int id);
void set_page_style (office_element_ptr & _style);
void set_page_duration (int id);
void set_master_page(std::wstring name);
void set_layout_page(std::wstring name);
@ -107,6 +108,7 @@ public:
void start_transition();
void set_transition_type (int val);
void set_transition_subtype (std::wstring val);
void set_transition_direction(std::wstring val);
void set_transition_speed (int val);
void set_transition_duration(int val);
void set_transition_sound (std::wstring ref, bool loop);

View File

@ -119,7 +119,7 @@ public:
_CP_OPT(bool) presentation_display_page_number_;
_CP_OPT(bool) presentation_display_date_time_;
_CP_OPT(bool) presentation_display_header_;
_CP_OPT(std::wstring) presentation_page_duration_;
_CP_OPT(odf_types::clockvalue) presentation_page_duration_;
office_element_ptr presentation_sound_;

View File

@ -202,6 +202,25 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
return;
}
}
//--------------------------------------------------------------------------------------
std::wstring odf_ref_image;
std::wstring pathImage;
if (oox_picture->blipFill.blip.IsInit())
{
bool bEmbedded = true;
if (oox_picture->blipFill.blip->embed.IsInit())
{
std::wstring sID = oox_picture->blipFill.blip->embed->get();
pathImage = find_link_by_id(sID, 1);
odf_ref_image = odf_context()->add_image(pathImage);
}
else if (oox_picture->blipFill.blip->link.IsInit())
{
odf_ref_image = oox_picture->blipFill.blip->link->get();
bEmbedded = false;
}
}
//--------------------------------------------------------------------------------------
if (oox_picture->nvPicPr.nvPr.media.is_init())
{
@ -226,15 +245,17 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
if (ext.end.IsInit()) end = *ext.end;
}
std::wstring odf_ref = odf_context()->add_media(pathMedia);
std::wstring odf_ref_media = odf_context()->add_media(pathMedia);
if (!odf_ref.empty())
if (!odf_ref_media.empty())
{
odf_context()->drawing_context()->start_media(odf_ref);
odf_context()->drawing_context()->start_media(odf_ref_media);
//... params
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
odf_context()->drawing_context()->end_media();
@ -242,26 +263,18 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
}
}
}
//--------------------------------------------------------------------------------------
std::wstring odf_ref;
std::wstring pathImage;
if (oox_picture->blipFill.blip.IsInit())
if (oox_picture->oleObject.IsInit())
{
bool bEmbedded = true;
if (oox_picture->blipFill.blip->embed.IsInit())
{
std::wstring sID = oox_picture->blipFill.blip->embed->get();
pathImage = find_link_by_id(sID, 1);
odf_ref = odf_context()->add_image(pathImage);
}
else if (oox_picture->blipFill.blip->link.IsInit())
{
odf_ref = oox_picture->blipFill.blip->link->get();
bEmbedded = false;
}
//nullable_limit<Limit::OLEDrawAspectType>m_oDrawAspect;
//nullable<OOX::RId> m_oId;
//nullable_string m_sObjectId;
//nullable_string m_sProgId;
//nullable_string m_sShapeId;
//nullable_limit<Limit::OLEType> m_oType;
//nullable_limit<Limit::OLEUpdateMode> m_oUpdateMode;
}
odf_context()->drawing_context()->start_image(odf_ref);
//--------------------------------------------------------------------------------------
odf_context()->drawing_context()->start_image(odf_ref_image);
{
double Width = 0, Height = 0;
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
@ -589,17 +602,24 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
bool bLine = odf_context()->drawing_context()->isLineShape();
if (!bLine)
if (custGeom && !custGeom->cxnLst.empty())
bLine = true;
odf_context()->drawing_context()->start_area_properties();
{
odf_context()->drawing_context()->start_area_properties();
if (bLine)
{
odf_context()->drawing_context()->set_no_fill();
}
else
{
if (oox_spPr->Fill.is_init())
convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
}
odf_context()->drawing_context()->end_area_properties();
}
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properties();
{

View File

@ -72,6 +72,7 @@ using namespace cpdoccore;
namespace Oox2Odf
{
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
current_clrMap = NULL;
@ -342,7 +343,7 @@ void PptxConverter::convert_slides()
current_slide = slide->Master.operator->();
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
convert_slide(&slide->Master->cSld, current_txStyles, false, true, Master);
else
convert(slide->Master->cSld.bg.GetPointer());
@ -350,7 +351,7 @@ void PptxConverter::convert_slides()
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, Layout);
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
else convert (slide->Master->transition.GetPointer());
@ -402,7 +403,7 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, Slide);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
@ -435,7 +436,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
odf_context()->page_layout_context()->set_page_size(width, height);
}
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
convert_slide(&oox_notes->cSld, NULL, true, true, NotesMaster);
odp_context->end_note();
@ -468,7 +469,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
odp_context->end_note();
@ -544,14 +545,24 @@ void PptxConverter::convert(PPTX::Comments *oox_comments)
void PptxConverter::convert( PPTX::Logic::Transition *oox_transition )
{
if (!oox_transition) return;
if (oox_transition->base.is_init() == false) return;
if (oox_transition->advTm.is_init())
{
odp_context->current_slide().set_page_duration(*oox_transition->dur);
}
if (oox_transition->base.is_init() == false) return;
odp_context->current_slide().start_transition();
if (oox_transition->spd.is_init())
{
odp_context->current_slide().set_transition_speed(oox_transition->spd->GetBYTECode());
}
if (oox_transition->dur.is_init())
{
odp_context->current_slide().set_transition_duration(*oox_transition->dur);
}
convert(oox_transition->base.base.operator->());
if (oox_transition->sndAc.is_init() && oox_transition->sndAc->stSnd.is_init())
@ -606,27 +617,52 @@ void PptxConverter::convert(PPTX::Logic::EmptyTransition *oox_transition)
if (oox_transition->name == L"random")
odp_context->current_slide().set_transition_type(40);
if (oox_transition->name == L"circle")
else if (oox_transition->name == L"circle")
{
odp_context->current_slide().set_transition_type(16);
odp_context->current_slide().set_transition_subtype(L"circle");
}
if (oox_transition->name == L"dissolve")
else if (oox_transition->name == L"dissolve")
odp_context->current_slide().set_transition_type(39);
if (oox_transition->name == L"diamond")
else if (oox_transition->name == L"diamond")
{
odp_context->current_slide().set_transition_type(11);
odp_context->current_slide().set_transition_subtype(L"diamond");
}
if (oox_transition->name == L"newsflash")
odp_context->current_slide().set_transition_type(24);
if (oox_transition->name == L"plus")
else if (oox_transition->name == L"newsflash")
odp_context->current_slide().set_transition_type(24); //fanWipe
else if (oox_transition->name == L"plus")
{
odp_context->current_slide().set_transition_type(19);
odp_context->current_slide().set_transition_type(19); //starWipe
odp_context->current_slide().set_transition_subtype(L"fourPoint");
}
if (oox_transition->name == L"wedge")
odp_context->current_slide().set_transition_type(24);
else if (oox_transition->name == L"wedge")
odp_context->current_slide().set_transition_type(24); //fanWipe
else if (oox_transition->name == L"vortex")
{
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
odp_context->current_slide().set_transition_subtype(L"vertical");
}
else if (oox_transition->name == L"doors")
{
odp_context->current_slide().set_transition_type(0); //barWipe
odp_context->current_slide().set_transition_subtype(L"topToBottom");
odp_context->current_slide().set_transition_direction(L"reverse");
}
else if (oox_transition->name == L"prism")
{
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
odp_context->current_slide().set_transition_subtype(L"cornersOut");
}
else if (oox_transition->name == L"switch")
{
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
odp_context->current_slide().set_transition_subtype(L"topToBottom");
}
else
{
odp_context->current_slide().set_transition_type(36); //fade
}
}
void PptxConverter::convert(PPTX::Logic::OrientationTransition *oox_transition)
{
@ -742,7 +778,8 @@ void PptxConverter::convert(PPTX::Logic::SplitTransition *oox_transition)
{
if (!oox_transition) return;
//name == split
odp_context->current_slide().set_transition_type(8);
odp_context->current_slide().set_transition_type(3);
odp_context->current_slide().set_transition_subtype(L"vertical");
}
void PptxConverter::convert(PPTX::Logic::ZoomTransition *oox_transition)
{
@ -1276,13 +1313,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
}
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
//необязательно
//if (page_props->content_.common_draw_fill_attlist_.draw_fill_image_name_)
//{
// page_props->content_.draw_background_size_ = L"border";
//}
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
odp_context->end_drawings();
}
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type)
{
if (oox_slide == NULL) return;
@ -1292,7 +1335,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
convert(oox_slide->bg.GetPointer());
if (type != Notes && type != NotesMaster)
{
convert(oox_slide->bg.GetPointer());
}
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
{
@ -1312,7 +1358,7 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);

View File

@ -100,6 +100,14 @@ using namespace cpdoccore;
namespace Oox2Odf
{
enum _typePages
{
Slide,
Master,
Layout,
NotesMaster,
Notes
};
class PptxConverter : public OoxConverter
{
public:
@ -119,7 +127,7 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type);
void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_notes);

View File

@ -158,7 +158,6 @@ HEADERS += \
../PPTXWriter/ShapeWriter.h \
../PPTXWriter/StylesWriter.h \
../../../ASCOfficePPTXFile/Editor/Drawing/Element.h \
../../../ASCOfficePPTXFile/Editor/Drawing/ElementProperties.h \
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h \
../../../ASCOfficePPTXFile/Editor/Drawing/Layout.h \
../../../ASCOfficePPTXFile/Editor/Drawing/Slide.h \

View File

@ -196,6 +196,15 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
<Default Extension=\"xml\" ContentType=\"application/xml\" />\
<Default Extension=\"gif\" ContentType=\"image/gif\"/>\
<Default Extension=\"emf\" ContentType=\"image/x-emf\"/>\
<Default Extension=\"wav\" ContentType=\"audio/wav\"/>\
<Default Extension=\"wma\" ContentType=\"audio/x-ms-wma\"/>\
<Default Extension=\"mp3\" ContentType=\"audio/unknown\"/>\
<Default Extension=\"m4a\" ContentType=\"audio/unknown\"/>\
<Default Extension=\"wmv\" ContentType=\"video/x-ms-wmv\"/>\
<Default Extension=\"avi\" ContentType=\"video/avi\"/>\
<Default Extension=\"m4v\" ContentType=\"video/unknown\"/>\
<Default Extension=\"mp4\" ContentType=\"video/unknown\"/>\
<Default Extension=\"mov\" ContentType=\"video/unknown\"/>\
<Default Extension=\"xls\" ContentType=\"application/vnd.ms-excel\"/>\
<Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>\
<Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\" />\
@ -770,25 +779,14 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter,
void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout)
{
CImageElement* pImageElem = dynamic_cast<CImageElement*>(pElement);
if (pImageElem)
{
pImageElem->m_oMetric = m_pDocument->m_oInfo;
pImageElem->NormalizeCoordsByMetric();
if (!pElement) return;
m_pShapeWriter->SetShape(pImageElem);
}
pElement->m_oMetric = m_pDocument->m_oInfo;
pElement->NormalizeCoordsByMetric();
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElement);
if (pShapeElem)
{
pShapeElem->m_oMetric = m_pDocument->m_oInfo;
pShapeElem->NormalizeCoordsByMetric();
bool bObject = m_pShapeWriter->SetElement(pElement);
m_pShapeWriter->SetShape(pShapeElem);
}
if (pImageElem || pShapeElem)
if (bObject)
{
m_pShapeWriter->SetRelsGenerator(&oRels);
@ -920,7 +918,11 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
oWriter.WriteString(std::wstring(L"<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>"));
WriteTransition(oWriter, pSlide->m_oSlideShow.m_oTransition);
oWriter.WriteString(std::wstring(L"<p:timing><p:tnLst><p:par><p:cTn id=\"1\" dur=\"indefinite\" restart=\"never\" nodeType=\"tmRoot\" /></p:par></p:tnLst></p:timing>"));
oWriter.WriteString(std::wstring(L"</p:sld>"));
oRels.CloseRels();
@ -937,6 +939,193 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
strFile = L"slide" + std::to_wstring(nIndexSlide + 1) + L".xml.rels";
oRels.SaveRels(strFileSlidePath + _T("_rels") + FILE_SEPARATOR_STR + strFile);
}
void NSPresentationEditor::CPPTXWriter::WriteTransition(CStringWriter& oWriter, CTransition& transition)
{
if (!transition.m_nEffectType == 0xFF) return;
std::wstring type;
std::wstring param_name, param_value;
std::wstring param_name2, param_value2;
switch(transition.m_nEffectType)
{
case 0:
{
type = L"p:cut";
param_name = L"thruBlk";
param_value = transition.m_nEffectDirection ? L"true" : L"false";
}break;
case 1:
{
type = L"p:random";
}break;
case 2:
{
type = L"p:blinds";
param_name = L"dir";
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
}break;
case 3:
{
type = L"p:checker";
param_name = L"dir";
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
}break;
case 5:
{
type = L"p:dissolve";
param_name = L"thruBlk";
param_value = transition.m_nEffectDirection ? L"true" : L"false";
}break;
case 6:
{
type = L"p:fade";
param_name = L"thruBlk";
param_value = transition.m_nEffectDirection ? L"true" : L"false";
}break;
case 4:
case 7:
{
if (transition.m_nEffectType == 4) type = L"p:cover";
if (transition.m_nEffectType == 7) type = L"p:pull";
param_name = L"dir";
switch(transition.m_nEffectDirection)
{
case 0: param_value = L"r"; break;
case 1: param_value = L"b"; break;
case 2: param_value = L"l"; break;
case 3: param_value = L"t"; break;
case 4: param_value = L"br"; break;
case 5: param_value = L"bl"; break;
case 6: param_value = L"tr"; break;
case 7: param_value = L"tl"; break;
}
}break;
case 8:
{
type = L"p:randomBars";
param_name = L"dir";
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
}break;
case 9:
{
type = L"p:strips";
param_name = L"dir";
switch(transition.m_nEffectDirection)
{
case 0: param_value = L"ru"; break;
case 1: param_value = L"lu"; break;
case 2: param_value = L"rd"; break;
case 3: param_value = L"ld"; break;
}
}break;
case 10:
case 20:
{
if (transition.m_nEffectType == 10) type = L"p:wipe";
if (transition.m_nEffectType == 20) type = L"p:push";
param_name = L"dir";
switch(transition.m_nEffectDirection)
{
case 0: param_value = L"l"; break;
case 1: param_value = L"u"; break;
case 2: param_value = L"r"; break;
case 3: param_value = L"d"; break;
}
}break;
case 11:
{
type = L"p:zoom";
param_name = L"dir";
param_value = transition.m_nEffectDirection ? L"in" : L"out";
}break;
case 13:
{
type = L"p:split";
param_name = L"dir";
param_name2 = L"orient";
switch(transition.m_nEffectDirection)
{
case 0: param_value = L"horz"; param_value2 = L"out"; break;
case 1: param_value = L"horz"; param_value2 = L"in"; break;
case 2: param_value = L"vert"; param_value2 = L"out"; break;
case 3: param_value = L"vert"; param_value2 = L"in"; break;
}
}break;
case 17:
{
type = L"p:diamond";
}break;
case 18:
{
type = L"p:plus";
}break;
case 19:
{
type = L"p:wedge";
}break;
case 21:
{
type = L"p:comb";
param_name = L"dir";
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
}break;
case 22:
{
type = L"p:newsflash";
}break;
case 23:
{
type = L"p:alphaFade";
}break;
case 26:
{
type = L"p:wheel";
param_name = L"spokes";
param_value = std::to_wstring(transition.m_nEffectDirection);
}break;
case 27:
{
type = L"p:circle";
}break;
default:
break;
}
if (type.empty()) return;
oWriter.WriteString(std::wstring(L"<p:transition"));
switch (transition.m_nSpeed)
{
case 0x00: oWriter.WriteString(L" spd=\"fast\""); break;
case 0x01: oWriter.WriteString(L" spd=\"med\""); break;
case 0x02:
default: oWriter.WriteString(L" spd=\"slow\""); break;
}
oWriter.WriteString(L">");
oWriter.WriteString(L"<" + type);
if (!param_name.empty() && !param_value.empty())
{
oWriter.WriteString(L" " + param_name + L"=\"" + param_value + L"\"");
}
if (!param_name2.empty() && !param_value2.empty())
{
oWriter.WriteString(L" " + param_name2 + L"=\"" + param_value2 + L"\"");
}
oWriter.WriteString(L"/>");
if (transition.m_bAudioPresent)
{
std::wstring rId = m_pShapeWriter->m_pRels->WriteAudio(transition.m_oAudio.m_strAudioFileName);
oWriter.WriteString(std::wstring(L"<p:sndAc><p:stSnd>"));
oWriter.WriteString(L"<p:snd r:embed=\"" + rId + L"\" name=\"" + transition.m_oAudio.m_sImageName + L"\"/>");
oWriter.WriteString(std::wstring(L"</p:stSnd></p:sndAc>"));
}
oWriter.WriteString(std::wstring(L"</p:transition>"));
}
void NSPresentationEditor::CPPTXWriter::WriteNotes(int nIndexNotes)
{
CStringWriter oWriter;

View File

@ -50,7 +50,7 @@ namespace NSPresentationEditor
CDocument * m_pDocument;
CPPTUserInfo* m_pUserInfo;
CImageManager m_oManager;
CMediaManager m_oManager;
CShapeWriter* m_pShapeWriter;
@ -79,6 +79,7 @@ namespace NSPresentationEditor
void WriteSlide (int nIndexSlide);
void WriteNotes (int nIndexNotes);
void WriteTransition (CStringWriter& oWriter, CTransition& transition);
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);
void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL);

View File

@ -37,56 +37,95 @@
namespace NSPresentationEditor
{
class CImageManager
class CMediaManager
{
private:
std::map<std::wstring, std::wstring> m_mapImages;
std::map<std::wstring, std::wstring> m_mapMedia;
long m_lIndexNextAudio;
long m_lIndexNextVideo;
long m_lIndexNextImage;
long m_lIndexNextImage;
std::wstring m_strDstMedia;
public:
CImageManager() : m_lIndexNextImage(0)
CMediaManager() : m_lIndexNextImage(0), m_lIndexNextAudio(0), m_lIndexNextVideo(0)
{
}
~CImageManager()
~CMediaManager()
{
}
inline void Clear()
{
m_mapImages.clear();
m_mapMedia.clear();
m_lIndexNextImage = 0;
m_lIndexNextAudio = 0;
m_lIndexNextVideo = 0;
}
inline std::wstring FindMedia(const std::wstring& strInput)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapMedia.find(strInput);
if (m_mapMedia.end() != pPair)
{
return pPair->second;
}
return L"";
}
inline void SetDstMedia(const std::wstring& strDst)
{
m_strDstMedia = strDst;
}
public:
inline std::wstring GenerateImage(const std::wstring& strInput)
inline std::wstring GenerateVideo(const std::wstring& strInput)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapImages.find(strInput);
if (m_mapImages.end() != pPair)
return GenerateMedia(strInput, L"video", m_lIndexNextVideo, L".avi");
}
inline std::wstring GenerateAudio(const std::wstring& strInput)
{
return GenerateMedia(strInput, L"audio", m_lIndexNextAudio, L".wav");
}
inline std::wstring GenerateImage(const std::wstring& strInput)
{
return GenerateMedia(strInput, L"image", m_lIndexNextImage, L".png");
}
inline std::wstring GenerateMedia(const std::wstring& strInput, const std::wstring& Template, long & Indexer, const std::wstring& strDefaultExt)
{
std::map<std::wstring, std::wstring>::iterator pPair = m_mapMedia.find(strInput);
if (m_mapMedia.end() != pPair)
{
return pPair->second;
}
if (IsNeedDownload(strInput))
return DownloadImage(strInput);
{
#ifndef DISABLE_FILE_DOWNLOADER
CFileDownloader oDownloader(strInput, TRUE);
if ( oDownloader.DownloadSync() )
{
return GenerateMedia( oDownloader.GetFilePath(), Template, Indexer, strDefaultExt);
}
#endif
}
std::wstring strExts = _T(".jpg");
int nIndexExt = strInput.rfind(wchar_t('.'));
std::wstring strExts = strDefaultExt;
int nIndexExt = strInput.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strInput.substr(nIndexExt);
if (strExts == _T(".tmp")) strExts = _T(".png");
if (strExts == _T(".video") || strExts == _T(".audio"))
{
std::wstring strInput1 = strInput.substr(0, nIndexExt);
nIndexExt = strInput1.rfind(wchar_t('.'));
strExts = nIndexExt < 0 ? L"" : strInput1.substr(nIndexExt);
}
if (strExts == _T(".tmp")) strExts = strDefaultExt;
std::wstring strImage = L"image" + std::to_wstring(m_lIndexNextImage++);
std::wstring strMediaName = Template + std::to_wstring(++Indexer);
std::wstring strOutput = m_strDstMedia + strImage + strExts;
strImage = _T("../media/") + strImage + strExts;
std::wstring strOutput = m_strDstMedia + strMediaName + strExts;
strMediaName = _T("../media/") + strMediaName + strExts;
// теперь нужно скопировать картинку
// теперь нужно скопировать
if (strOutput != strInput)
{
if (CDirectory::CopyFile(strInput, strOutput) == false)
@ -94,8 +133,8 @@ namespace NSPresentationEditor
return L"";
}
}
m_mapImages[strInput] = strImage;
return strImage;
m_mapMedia[strInput] = strMediaName;
return strMediaName;
}
inline bool IsNeedDownload(const std::wstring& strFile)
@ -108,18 +147,8 @@ namespace NSPresentationEditor
return true;
return false;
}
inline std::wstring DownloadImage(const std::wstring& strFile)
{
#ifndef DISABLE_FILE_DOWNLOADER
CFileDownloader oDownloader(strFile, TRUE);
if ( oDownloader.DownloadSync() )
{
return GenerateImage( oDownloader.GetFilePath() );
}
#endif
return _T("");
}
};
static std::wstring CorrectXmlString3(const std::wstring & str)
{
std::wstring buffer;
@ -128,12 +157,12 @@ namespace NSPresentationEditor
{
switch(str[pos])
{
case '&': buffer.append(_T("&amp;")); break;
case '\"': buffer.append(_T("&quot;")); break;
case '\'': buffer.append(_T("&apos;")); break;
case '<': buffer.append(_T("&lt;")); break;
case '>': buffer.append(_T("&gt;")); break;
default: buffer.append(&str[pos], 1); break;
case '&': buffer.append(_T("&amp;")); break;
case '\"': buffer.append(_T("&quot;")); break;
case '\'': buffer.append(_T("&apos;")); break;
case '<': buffer.append(_T("&lt;")); break;
case '>': buffer.append(_T("&gt;")); break;
default: buffer.append(&str[pos], 1); break;
}
}
return buffer;
@ -143,12 +172,12 @@ namespace NSPresentationEditor
private:
NSPresentationEditor::CStringWriter m_oWriter;
int m_lNextRelsID;
std::map<std::wstring, int> m_mapImages;
CImageManager* m_pManager;
std::map<std::wstring, int> m_mapMediaRelsID;
CMediaManager* m_pManager;
std::map<std::wstring, std::wstring> m_mapHyperlinks;
public:
CRelsGenerator(CImageManager* pManager) : m_oWriter(), m_lNextRelsID(1)
CRelsGenerator(CMediaManager* pManager) : m_oWriter(), m_lNextRelsID(1)
{
m_pManager = pManager;
}
@ -159,7 +188,7 @@ namespace NSPresentationEditor
{
m_oWriter.ClearNoAttack();
m_lNextRelsID = 1;
m_mapImages.clear();
m_mapMediaRelsID.clear();
m_mapHyperlinks.clear();
}
@ -262,23 +291,25 @@ namespace NSPresentationEditor
return strRid;
}
inline std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true)
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")
{
std::map<std::wstring, int>::iterator pPair = m_mapImages.find(strImage);
if (m_mapImages.end() != pPair)
if (!newRIdAlways)
{
std::wstring strRid = L"rId" + std::to_wstring(pPair->second);
return strRid;
std::map<std::wstring, int>::iterator pPair = m_mapMediaRelsID.find(strMedia);
if (m_mapMediaRelsID.end() != pPair)
{
std::wstring strRid = L"rId" + std::to_wstring(pPair->second);
return strRid;
}
m_mapMediaRelsID[strMedia] = m_lNextRelsID;
}
m_mapImages[strImage] = m_lNextRelsID;
std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++);
std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++);
std::wstring strRels = L"<Relationship Id=\"" + strRid + L"\"";
strRels += L" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\"";
strRels += L" Target=\"" + strImage + L"\"";
std::wstring strRels = L"<Relationship Id=\"" + strRid + L"\"" + L" Type=\"" + strRelsType + L"\""
+ L" Target=\"" + strMedia + L"\"";
if (bExternal)
strRels += L" TargetMode=\"External\"";
@ -288,13 +319,45 @@ namespace NSPresentationEditor
return strRid;
}
inline std::wstring WriteImage(const std::wstring& strImagePath)
inline std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true)
{
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image");
}
inline std::wstring WriteHyperlinkAudio(const std::wstring& strImage, bool bExternal = true)
{
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
}
inline std::wstring WriteHyperlinkVideo(const std::wstring& strImage, bool bExternal = true)
{
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video");
}
inline std::wstring WriteMedia(const std::wstring& strMediaPath)
{
std::wstring strMedia = m_pManager->FindMedia(strMediaPath);
if (strMedia.empty()) return WriteHyperlinkMedia(CorrectXmlString3(strMediaPath), true, true);
return WriteHyperlinkMedia(strMedia, false, true);
}
inline std::wstring WriteImage(const std::wstring& strImagePath)
{
std::wstring strImage = m_pManager->GenerateImage(strImagePath);
if (strImage.empty()) return WriteHyperlinkImage(CorrectXmlString3(strImagePath), true);
return WriteHyperlinkImage(strImage, false);
if (strImage.empty()) return WriteHyperlinkImage(CorrectXmlString3(strImagePath), true);
return WriteHyperlinkImage(strImage, false);
}
inline std::wstring WriteAudio(const std::wstring& strAudioPath)
{
std::wstring strAudio = m_pManager->GenerateAudio(strAudioPath);
if (strAudio.empty()) return WriteHyperlinkAudio(CorrectXmlString3(strAudioPath), true);
return WriteHyperlinkAudio(strAudio, false);
}
inline std::wstring WriteVideo(const std::wstring& strVideoPath)
{
std::wstring strVideo = m_pManager->GenerateVideo(strVideoPath);
if (strVideo.empty()) return WriteHyperlinkVideo(CorrectXmlString3(strVideoPath), true);
return WriteHyperlinkVideo(strVideo, false);
}
};
}

View File

@ -293,6 +293,31 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pImageElement = NULL;
m_pShapeElement = NULL;
}
bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem)
{
m_pShapeElement = dynamic_cast<CShapeElement*>(pElem);
m_pImageElement = dynamic_cast<CImageElement*>(pElem);
m_pSimpleGraphicsConverter->PathCommandEnd();
m_oMetricInfo = pElem->m_oMetric;
m_oBounds = pElem->m_rcBounds;
m_oTextRect = m_oBounds;
m_bWordArt = false;
m_bTextBox = false;
if (m_pShapeElement)
{
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect);
}
m_oWriter.ClearNoAttack();
m_oWriterPath.ClearNoAttack();
m_oWriterVML.ClearNoAttack();
return (m_pShapeElement || m_pImageElement);
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
{
NSPresentationEditor::CStringWriter line_writer;
@ -366,7 +391,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertLineEnd(unsigned char ca
}
return sResult;
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
{
NSPresentationEditor::CStringWriter brush_writer;
@ -458,7 +483,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
return brush_writer.GetData();
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
{
std::wstring Preset;
bool Inner = false;
@ -575,7 +600,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
return shadow_writer.GetData();
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long alpha)
std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long alpha)
{
NSPresentationEditor::CStringWriter color_writer;
if (color.m_lSchemeIndex == -1)
@ -606,14 +631,24 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, l
}
void NSPresentationEditor::CShapeWriter::WriteImageInfo()
{
CAudioElement* pAudioElement = dynamic_cast<CAudioElement*>(m_pImageElement);
CVideoElement* pVideoElement = dynamic_cast<CVideoElement*>(m_pImageElement);
m_oWriter.WriteString(std::wstring(L"<p:nvPicPr>"));
std::wstring strShapeID = std::to_wstring(m_lNextShapeID);
if (m_pImageElement->m_lID < 0)
m_pImageElement->m_lID = m_lNextShapeID;
std::wstring strShapeID = std::to_wstring(m_pImageElement->m_lID);
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") + strShapeID + L"\"" );
if (m_pImageElement->m_sName.empty())
m_pImageElement->m_sName = std::wstring(L"Image ") + strShapeID;
{
if (pAudioElement) m_pImageElement->m_sName = std::wstring(L"Audio ") + strShapeID;
else if (pVideoElement) m_pImageElement->m_sName = std::wstring(L"Video ") + strShapeID;
else m_pImageElement->m_sName = std::wstring(L"Image ") + strShapeID;
}
if (m_pImageElement->m_bHidden) m_oWriter.WriteString(std::wstring(L" hidden=\"1\""));
@ -627,14 +662,22 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
// m_oWriter.WriteStringXML(m_pImageElement->m_sDescription);
// m_oWriter.WriteString(std::wstring(L"\""));
//}
m_oWriter.WriteString(std::wstring(L">"));
m_oWriter.WriteString(std::wstring(L"></p:cNvPr><p:cNvPicPr><a:spLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>"));
if (pVideoElement || pAudioElement)
{
m_oWriter.WriteString(std::wstring(L"<a:hlinkClick r:id=\"\" action=\"ppaction://media\"/>"));
}
m_oWriter.WriteString(std::wstring(L"</p:cNvPr><p:cNvPicPr><a:picLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>"));
++m_lNextShapeID;
m_oWriter.WriteString(std::wstring(L"<p:nvPr>"));
if (-1 != m_pImageElement->m_lPlaceholderType)
{
m_oWriter.WriteString(std::wstring(L"<p:nvPr><p:ph"));
m_oWriter.WriteString(std::wstring(L"<p:ph"));
if (m_pImageElement->m_lPlaceholderType > 0)
m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(m_pImageElement->m_lPlaceholderType) + L"\"");
@ -644,12 +687,39 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
m_oWriter.WriteString(std::wstring(L" idx=\"") + strIdx + L"\"");
}
m_oWriter.WriteString(std::wstring(L"/></p:nvPr>"));
m_oWriter.WriteString(std::wstring(L"/>"));
}
else
std::wstring sMediaFile;
if ((pVideoElement) && (!pVideoElement->m_strVideoFileName.empty()))
{
m_oWriter.WriteString(std::wstring(L"<p:nvPr/>"));
std::wstring strRid = m_pRels->WriteVideo(pVideoElement->m_strVideoFileName);
m_oWriter.WriteString(L"<a:videoFile r:link=\"" + strRid + L"\"/>");
sMediaFile = pVideoElement->m_strVideoFileName;
}
if ((pAudioElement) && (!pAudioElement->m_strAudioFileName.empty()))
{
std::wstring strRid = m_pRels->WriteAudio(pAudioElement->m_strAudioFileName);
m_oWriter.WriteString(L"<a:audioFile r:link=\"" + strRid + L"\"/>");
sMediaFile = pAudioElement->m_strAudioFileName;
}
if (sMediaFile.empty() == false)
{
std::wstring strRid = m_pRels->WriteMedia(sMediaFile);
if (!strRid.empty())
{
m_oWriter.WriteString(L"<p:extLst><p:ext uri=\"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}\">\
<p14:media xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" r:embed=\"" + strRid + L"\"/></p:ext></p:extLst>");
}
}
m_oWriter.WriteString(std::wstring(L"</p:nvPr>"));
std::wstring str2 = _T("</p:nvPicPr>");
m_oWriter.WriteString(str2);
@ -1306,7 +1376,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertImage()
strRid = m_pRels->WriteHyperlinkImage(CorrectXmlString3(m_pImageElement->m_sImageName));
}
if (strRid.empty()) return _T("");
if (strRid.empty()) return _T("");
m_oWriter.WriteString(std::wstring(L"<p:pic>"));

View File

@ -163,57 +163,22 @@ namespace NSPresentationEditor
RELEASEOBJECT(m_pSimpleGraphicsConverter);
}
friend class CPPTXWriter;
AVSINLINE void InitNextId()
{
m_lNextShapeID = 1000;
}
AVSINLINE void SetShape(CImageElement* pShapeElem)
{
m_pSimpleGraphicsConverter->PathCommandEnd();
m_pImageElement = pShapeElem;
m_pShapeElement = NULL;
m_oMetricInfo = m_pImageElement->m_oMetric;
m_oBounds = m_pImageElement->m_rcBounds;
m_oTextRect = m_oBounds;
m_bWordArt = false;
m_bTextBox = false;
m_oWriter.ClearNoAttack();
m_oWriterPath.ClearNoAttack();
m_oWriterVML.ClearNoAttack();
}
AVSINLINE void SetShape(CShapeElement* pShapeElem)
{
m_pSimpleGraphicsConverter->PathCommandEnd();
m_pShapeElement = pShapeElem;
m_pImageElement = NULL;
m_oMetricInfo = m_pShapeElement->m_oMetric;
m_oBounds = m_pShapeElement->m_rcBounds;
m_oTextRect = m_oBounds;
m_bWordArt = false;
m_bTextBox = false;
if (m_pShapeElement)
{
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect);
}
m_oWriter.ClearNoAttack();
m_oWriterPath.ClearNoAttack();
m_oWriterVML.ClearNoAttack();
}
bool SetElement(IElement* pElem);
//--------------------------------------------------------------------
std::wstring ConvertShape ();
std::wstring ConvertImage ();
std::wstring ConvertLine (CPen & pen);
std::wstring ConvertShape ();
std::wstring ConvertImage ();
std::wstring ConvertLine (CPen & pen);
std::wstring ConvertShadow (CShadow & shadow);
std::wstring ConvertBrush (CBrush & brush);
std::wstring ConvertLineEnd (unsigned char cap, unsigned char length, unsigned char width);
static std::wstring ConvertColor (CColor & color, long alpha);
std::wstring ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width);
// тип рендерера-----------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType) ;
//-------- Функции для работы со страницей --------------------------------------------------

View File

@ -686,29 +686,9 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
pTransition->m_bStopSound = pAtom->m_bStopSound;
pTransition->m_nEffectDirection = pAtom->m_nEffectDirection;
pTransition->m_nEffectType = pAtom->m_nEffectType; // тут нужно сконвертить тип
pTransition->m_nSpeed = pAtom->m_nSpeed;
pSlide->m_oSlideShow.m_dSlideDuration = pAtom->m_nSlideTime;
switch (pAtom->m_nSpeed)
{
case 0x00:
pTransition->m_dSpeed = 750.0;
break;
case 0x01:
pTransition->m_dSpeed = 500.0;
break;
case 0x02:
pTransition->m_dSpeed = 250.0;
break;
default:
pTransition->m_dSpeed = 500.0;
break;
};
}
else
{
pTransition->m_dSpeed = 0.0;
}
CSlideShowSlideInfoAtom* pAtom = &pRecordSlide->m_oSlideShowSlideInfoAtom;

View File

@ -93,7 +93,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
//CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM , CRecordVBAInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM , CRecordSSDocInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordGridSpacing10Atom)
CREATE_BY_TYPE(RT_RoundTripTheme12Atom , CRecordRoundTripThemeAtom)
CREATE_BY_TYPE(RT_RoundTripColorMapping12Atom , CRecordRoundTripColorMappingAtom)
@ -148,6 +148,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
//CREATE_BY_TYPE(RECORD_TYPE_FONT_EMBEDDEDDATA , CRecordFontEmbedDataBlob)
//CREATE_BY_TYPE(RECORD_TYPE_METAFILE , CRecordMetafileBlob)
CREATE_BY_TYPE(RECORD_TYPE_CSTRING , CRecordCString)
CREATE_BY_TYPE(RECORD_TYPE_SOUNDCOLL_ATOM , CRecordSoundCollAtom)
CREATE_BY_TYPE(RECORD_TYPE_EXOLEOBJ_ATOM , CRecordExOleObjAtom)
CREATE_BY_TYPE(RECORD_TYPE_EXEMBEDATOM , CRecordExOleEmbedAtom)
//CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_ENTITY_ATOM , CRecordBookmarkEntityAtom)

View File

@ -37,7 +37,7 @@
#include "../../Reader/Records.h"
#include "../../../../ASCOfficePPTXFile/Editor/Drawing/Document.h"
#define __USE_ANIMATION__
#define MIN_SLIDE_TIME 5000.0
inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
@ -369,7 +369,13 @@ namespace Animations
delayTime = StreamUtils::ReadDWORD ( pStream );
}
virtual bool IsCorrect () { return m_oHeader.RecVersion == 0x1 && m_oHeader.RecInstance == 0x0 && m_oHeader.RecType == RT_ParaBuildAtom && m_oHeader.RecLen == 0x00000010; }
virtual bool IsCorrect ()
{
return m_oHeader.RecVersion == 0x1 &&
m_oHeader.RecInstance == 0x0 &&
m_oHeader.RecType == RT_ParaBuildAtom &&
m_oHeader.RecLen == 0x00000010;
}
public:
@ -3097,9 +3103,6 @@ namespace Animations
{
Clear ();
#if defined(_DEBUG_LOG) && (defined(_WIN32) || defined(_WIN64))
ATLTRACE(_T("======================================== Slide ========================================\n"));
#endif
m_bSaveEffect = false;
m_HaveAfterEffect = false;
@ -3115,15 +3118,13 @@ namespace Animations
return false;
}
inline EffectsMap& GetAnimation ()
inline EffectsMap& GetAnimation ()
{
return m_oAnimation;
}
inline double GetTime ()
inline double GetTime ()
{
#define MIN_SLIDE_TIME 5000.0
double dTime = m_oNodeTiming.GetTimeLine ();
if (dTime < MIN_SLIDE_TIME)
return MIN_SLIDE_TIME;
@ -3137,12 +3138,12 @@ namespace Animations
private:
inline void ExploreTree (ExtTimeNodeContainer* pContainer)
{
unsigned long nNodeType = pContainer->GetEffectNodeType ();
unsigned long nNodeType = pContainer->GetEffectNodeType ();
if (nNodeType)
{
if (CNodeTiming::MainSequenceNode != nNodeType && CNodeTiming::TimingRootNode != nNodeType)
{
m_oTopEffect = CreateEffectFromNode ( pContainer->timePropertyList );
m_oTopEffect = CreateEffectFromNode ( pContainer->timePropertyList );
m_ComposeEffectMothionPath = _T("");
@ -3200,7 +3201,7 @@ namespace Animations
}
}
int nID = GetShapeID ( pContainer );
int nID = GetShapeID ( pContainer );
if ( -1 != nID )
{
// TODO :
@ -3448,7 +3449,7 @@ namespace Animations
{
if (pChild->timeNodeAtom.m_bDurationProperty)
{
m_dEffectDuration = pChild->timeNodeAtom.m_nDuration;
m_dEffectDuration = pChild->timeNodeAtom.m_nDuration;
}
}
}
@ -3649,9 +3650,9 @@ namespace Animations
//
inline void ProcessMediaCall (ExtTimeNodeContainer* pContainer)
{
if (MediaCallEffect == m_oTopEffect.m_nEffectType) // если анимация применена к VIDEO или AUDIO элементу
if (MediaCallEffect == m_oTopEffect.m_nEffectType) // если анимация применена к VIDEO или AUDIO элементу
{
m_nMediaPush = GetAttachedShapeToVideo (pContainer); // если к видео добавлена картинка, надо учитывать смещение при поиск ID
m_nMediaPush = GetAttachedShapeToVideo (pContainer); // если к видео добавлена картинка, надо учитывать смещение при поиск ID
if (GetMediaID (pContainer))
{
@ -3844,8 +3845,6 @@ public:
if ( RECORD_PROG_BINARY_TAG == m_oHeaderChild.RecType )
{
#ifdef __USE_ANIMATION__
SRecordHeader rgSubRec;
rgSubRec.ReadFromStream(pStream) ;
@ -3874,7 +3873,6 @@ public:
}
}
#endif
}
StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream );

View File

@ -236,7 +236,6 @@ public:
{
case NSPresentationEditor::etVideo:
{
//default -> line = false
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
{
@ -246,7 +245,6 @@ public:
}
case NSPresentationEditor::etPicture:
{
//default -> line = false
pElement->m_oBrush.Type = c_BrushTypeTexture;
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
@ -257,7 +255,6 @@ public:
}
case NSPresentationEditor::etAudio:
{
//default -> line = false
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
{
@ -806,7 +803,7 @@ public:
}
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
@ -864,8 +861,6 @@ public:
CShape* pParentShape = &pElement->m_oShape;
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
CElementProperties* pElemProps = &pElement->m_oProperties;
if (NULL == pShape)
return;
@ -1199,7 +1194,9 @@ public:
}break;
default:
break;
{
int unknown_value = pProperty->m_lValue;
}break;
}
}
};
@ -1362,8 +1359,8 @@ public:
{
CVideoElement* pVideoElem = new CVideoElement();
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath ;
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
pElem = (IElement*)pVideoElem;
}
@ -1371,7 +1368,8 @@ public:
{
CAudioElement* pAudioElem = new CAudioElement();
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath;
pAudioElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
pAudioElem->m_dClipStartTime = oInfo.m_dStartTime;
pAudioElem->m_dClipEndTime = oInfo.m_dEndTime;
@ -1667,11 +1665,43 @@ public:
pShapeElem->m_oShape.m_oText.m_oRuler = oArrayTextRuler[0]->m_oTextRuler;
}
std::vector<CRecordTextInteractiveInfoAtom*> oArrayTextInteractive;
this->GetRecordsByType(&oArrayTextInteractive, true);
if (0 != oArrayTextInteractive.size())
std::vector<CRecordInteractiveInfoAtom*> oArrayInteractive;
GetRecordsByType(&oArrayInteractive, true, true);
if (!oArrayInteractive.empty())
{
pShapeElem->m_oActions.m_bPresent = true;
if (pMapIDs)
{
CExFilesInfo* pInfo1 = pMapIDs->LockAudioFromCollection(oArrayInteractive[0]->m_nSoundIdRef);
if (NULL != pInfo1)
{
pShapeElem->m_oActions.m_strAudioFileName = pInfo1->m_strFilePath;
}
CExFilesInfo* pInfo2 = pMapIDs->LockHyperlink(oArrayInteractive[0]->m_nExHyperlinkIdRef);
if (NULL != pInfo2)
{
pShapeElem->m_oActions.m_strHyperlink = pInfo2->m_strFilePath;
}
}
pShapeElem->m_oActions.m_lType = oArrayInteractive[0]->m_nAction;
pShapeElem->m_oActions.m_lOleVerb = oArrayInteractive[0]->m_nOleVerb;
pShapeElem->m_oActions.m_lJump = oArrayInteractive[0]->m_nJump;
pShapeElem->m_oActions.m_lHyperlinkType = oArrayInteractive[0]->m_nHyperlinkType;
pShapeElem->m_oActions.m_bAnimated = oArrayInteractive[0]->m_bAnimated;
pShapeElem->m_oActions.m_bStopSound = oArrayInteractive[0]->m_bStopSound;
pShapeElem->m_oActions.m_bCustomShowReturn = oArrayInteractive[0]->m_bCustomShowReturn;
pShapeElem->m_oActions.m_bVisited = oArrayInteractive[0]->m_bVisited;
}
std::vector<CRecordTextInteractiveInfoAtom*> oArrayTextInteractive;
this->GetRecordsByType(&oArrayTextInteractive, true);
if (!oArrayTextInteractive.empty())
{
pShapeElem->m_oTextActions.m_bPresent = true;
int nSize = oArrayTextInteractive.size();
for (int i = 0; i < nSize; ++i)
@ -1681,7 +1711,7 @@ public:
oRange.m_lStart = oArrayTextInteractive[i]->m_lStart;
oRange.m_lEnd = oArrayTextInteractive[i]->m_lEnd;
pShapeElem->m_oActions.m_arRanges.push_back(oRange);
pShapeElem->m_oTextActions.m_arRanges.push_back(oRange);
}
}
double dAngle = pShapeElem->m_dRotate;
@ -1926,11 +1956,11 @@ protected:
eTypePersist = (NSOfficePPT::TextType)pSettings->m_nTextType;
strText = pSettings->ApplyProperties(pTextSettings);
if ((0 != pSettings->m_arRanges.size()) && (0 == pShape->m_oActions.m_arRanges.size()))
if ((0 != pSettings->m_arRanges.size()) && (0 == pShape->m_oTextActions.m_arRanges.size()))
{
pShape->m_oActions.m_bPresent = true;
pShape->m_oTextActions.m_bPresent = true;
pShape->m_oActions.m_arRanges = pSettings->m_arRanges;
pShape->m_oTextActions.m_arRanges = pSettings->m_arRanges;
}
bIsPersistPresentSettings = ((NULL != pSettings->m_pTextStyleProp) && (0 < pSettings->m_pTextStyleProp->m_lCount));
@ -2204,7 +2234,7 @@ protected:
ApplyThemeStyle(pElem, pTheme, master_levels);
if (pShape->m_oActions.m_bPresent)
if (pShape->m_oTextActions.m_bPresent)
{
//todooo разобраться нужно ли менять цвет на гиперлинк - 1-(34).ppt
NSPresentationEditor::CColor oColor;
@ -2279,8 +2309,8 @@ protected:
void ApplyHyperlink(CShapeElement* pShape, CColor& oColor)
{
std::vector<CTextRange>* pRanges = &pShape->m_oActions.m_arRanges;
CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText;
std::vector<CTextRange>* pRanges = &pShape->m_oTextActions.m_arRanges;
CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText;
int lCountHyper = pRanges->size();

View File

@ -48,6 +48,7 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
return CUnknownRecord::ReadFromStream(oHeader, pStream);
m_oHeader = oHeader;
m_nSlideID = StreamUtils::ReadDWORD(pStream);
}
};

View File

@ -34,10 +34,9 @@
class CRecordExObjListAtom : public CUnknownRecord
{
public:
INT m_nObjectIdSeed;
public:
CRecordExObjListAtom()
{
}
@ -46,4 +45,11 @@ public:
{
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream);
}
};

View File

@ -35,6 +35,17 @@
class CRecordInteractiveInfoAtom : public CUnknownRecord
{
public:
UINT m_nSoundIdRef;
UINT m_nExHyperlinkIdRef;
BYTE m_nAction;
BYTE m_nOleVerb;
BYTE m_nJump;
BYTE m_nHyperlinkType;
bool m_bAnimated;
bool m_bStopSound;
bool m_bCustomShowReturn;
bool m_bVisited;
CRecordInteractiveInfoAtom()
{
@ -46,6 +57,22 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
CUnknownRecord::ReadFromStream(oHeader, pStream);
m_oHeader = oHeader;
m_nSoundIdRef = StreamUtils::ReadDWORD(pStream);
m_nExHyperlinkIdRef = StreamUtils::ReadDWORD(pStream);
m_nAction = StreamUtils::ReadBYTE(pStream);
m_nOleVerb = StreamUtils::ReadBYTE(pStream);
m_nJump = StreamUtils::ReadBYTE(pStream);
BYTE nFlag = StreamUtils::ReadBYTE(pStream);
m_bAnimated = ((nFlag & 0x01) == 0x01);
m_bStopSound = ((nFlag & 0x02) == 0x02);
m_bCustomShowReturn = ((nFlag & 0x04) == 0x04);
m_bVisited = ((nFlag & 0x08) == 0x08);
m_nHyperlinkType = StreamUtils::ReadBYTE(pStream);
StreamUtils::StreamSkip(3, pStream);
}
};

View File

@ -34,6 +34,7 @@
class CRecordNormalViewSetInfoAtom : public CUnknownRecord
{
public:
SRatioAtom m_oLeftPortion;
SRatioAtom m_oTopPortion;
@ -43,7 +44,6 @@ class CRecordNormalViewSetInfoAtom : public CUnknownRecord
BOOL1 m_fPreferSingleSet;
BYTE m_nFlags;
public:
CRecordNormalViewSetInfoAtom()
{

View File

@ -37,7 +37,6 @@ class CRecordOutlineTextRefAtom : public CUnknownRecord
public:
DWORD m_nIndex;
public:
CRecordOutlineTextRefAtom()
{

View File

@ -36,8 +36,6 @@ class CRecordTripOriginalMasterId12Atom : public CUnknownRecord
{
public:
DWORD m_dwID;
public:
CRecordTripOriginalMasterId12Atom()
{

View File

@ -34,9 +34,8 @@
class CRecordSlideColorSchemeAtom : public CUnknownRecord
{
SColorAtom m_arColors[8];
public:
SColorAtom m_arColors[8];
CRecordSlideColorSchemeAtom()
{

View File

@ -34,9 +34,8 @@
class CRecordSoundCollAtom : public CUnknownRecord
{
INT m_nObjectIdSeed;
public:
INT m_nObjectIdSeed;
CRecordSoundCollAtom()
{
@ -48,6 +47,8 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
return CUnknownRecord::ReadFromStream(oHeader, pStream);
m_oHeader = oHeader;
m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream);
}
};

View File

@ -38,8 +38,6 @@ public:
LONG m_lStart;
LONG m_lEnd;
public:
CRecordTextInteractiveInfoAtom()
{
m_lStart = 0;

View File

@ -750,10 +750,6 @@
RelativePath="..\Records\SlideListWithText.h"
>
</File>
<File
RelativePath="..\Records\SlideNumberMCAtom.h"
>
</File>
<File
RelativePath="..\Records\SlidePersistAtom.h"
>
@ -966,10 +962,6 @@
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Element.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\ElementProperties.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Elements.cpp"
>
@ -978,10 +970,6 @@
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Elements.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Enums.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Interactive.h"
>
@ -1058,10 +1046,6 @@
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\CommentsWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ContentTypesWriter.h"
>
</File>
<File
RelativePath="..\PPTXWriter\Converter.cpp"
>

View File

@ -2754,6 +2754,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
{
pShape->nvSpPr.cNvPr.id = -1;
}
pShape->signatureLine = pPPTShape->m_oSignatureLine;
elem->InitElem(pShape);
@ -4374,6 +4375,15 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const std::wstr
bOle = oPic.oleObject->isValid();
}
}
bool bSignatureLine = false;
if (oElem.is<PPTX::Logic::Shape>())
{
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
if(oShape.signatureLine.IsInit())
{
bSignatureLine = true;
}
}
m_pReader->m_nDocumentType = XMLWRITER_DOC_TYPE_PPTX;
@ -4393,6 +4403,12 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const std::wstr
{
ConvertPicVML(oElem, bsMainProps, oXmlWriter);
}
else if(bSignatureLine)
{
oXmlWriter.WriteString(L"<w:pict>");
ConvertShapeVML(oElem, bsMainProps, oXmlWriter, true);
oXmlWriter.WriteString(L"</w:pict>");
}
else
{
@ -4586,13 +4602,13 @@ void CDrawingConverter::ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const std:
oPic.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
}
void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, bool bSignature)
{
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
}
void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)

View File

@ -279,7 +279,7 @@ namespace NSBinPptxRW
void ConvertMainPropsToVML (const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem);
void ConvertPicVML (PPTX::Logic::SpTreeElem& oElem, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertShapeVML (PPTX::Logic::SpTreeElem& oShape, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertShapeVML (PPTX::Logic::SpTreeElem& oShape, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter, bool bSignature = false);
void ConvertGroupVML (PPTX::Logic::SpTreeElem& oGroup, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertTextVML (XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape);

View File

@ -186,6 +186,8 @@ namespace NSBinPptxRW
#define SPTREE_TYPE_SPTREE 4
#define SPTREE_TYPE_GRFRAME 5
#define SPTREE_TYPE_OLE 6
#define SPTREE_TYPE_VIDEO 7
#define SPTREE_TYPE_AUDIO 8
static BYTE SchemeClr_GetBYTECode(const std::wstring& sValue)
{

View File

@ -36,6 +36,8 @@
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/Base64.h"
@ -106,7 +108,7 @@ namespace NSBinPptxRW
CreateFontPicker(NULL);
}
CImageManager2::CImageManager2() : m_mapImages(), m_lIndexNextImage(0), m_lIndexNextOle(0)
CImageManager2::CImageManager2() : m_mapImages(), m_lIndexNextImage(0), m_lIndexCounter(0)
{
m_nDocumentType = XMLWRITER_DOC_TYPE_PPTX;
m_pContentTypes = new OOX::CContentTypes();
@ -118,8 +120,8 @@ namespace NSBinPptxRW
void CImageManager2::Clear()
{
m_mapImages.clear();
m_lIndexNextImage = 1;
m_lIndexNextOle = 1;
m_lIndexNextImage = 0;
m_lIndexCounter = 0;
}
void CImageManager2::SetDstMedia(const std::wstring& strDst)
{
@ -147,34 +149,50 @@ namespace NSBinPptxRW
{
if(nIndex1 + sFind1.length() < strInput.length())
{
wchar_t cRes = strInput[nIndex1 + sFind1.length()];
if('1' <= cRes && cRes <= '6')
wchar_t cRes1 = strInput[nIndex1 + sFind1.length()];
if('1' <= cRes1 && cRes1 <= '9')
{
wchar_t cRes2 = strInput[nIndex1 + sFind1.length() + 1];
int nImageIndex = nIndex1 + (int)sFind1.length() + 1;
if(nImageIndex == (int)strInput.find(_T("image"), nImageIndex))
nRes = cRes - '0';
if (std::wstring::npos != strInput.find(_T("image"), nImageIndex))
{
nRes = cRes1 - '0';
if('0' <= cRes2 && cRes2 <= '9')
{
nRes = nRes * 10 + (cRes2 - '0');
}
}
}
}
}
return nRes;
}
_imageManager2Info CImageManager2::GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image)
_imageManager2Info CImageManager2::GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image)
{
if (IsNeedDownload(strInput))
return DownloadImage(strInput);
std::map<std::wstring, _imageManager2Info>::const_iterator pPair = m_mapImages.find ((_T("") == strBase64Image) ? strInput : strBase64Image);
std::map<std::wstring, _imageManager2Info>::const_iterator pPair = m_mapImages.find ((strBase64Image.empty()) ? strInput : strBase64Image);
if (pPair != m_mapImages.end())
{
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit())
mediaFile->set_filename(pPair->second.sFilepathAdditional);
return pPair->second;
}
std::wstring strExts = _T(".jpg");
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strInput.substr(nIndexExt);
std::wstring strOleBin;
int typeAdditional = 0;
std::wstring strAdditional;
std::wstring strImage = strInput;
int nDisplayType = IsDisplayedImage(strInput);
@ -208,21 +226,52 @@ namespace NSBinPptxRW
}
if(0 != (nDisplayType & 4))
{
smart_ptr<OOX::OleObject> oleFile = additionalFile.smart_dynamic_cast<OOX::OleObject>();
if (oleFile.IsInit())
{
if (OOX::CSystemUtility::IsFileExist(oleFile->filename()) == false)
{
typeAdditional = 1;
std::wstring strOle = strFolder + strFileName + oleFile->filename().GetExtention();
if (OOX::CSystemUtility::IsFileExist(strOle))
{
m_pContentTypes->AddDefault(oleFile->filename().GetExtention(false));
strOleBin = strOle;
strAdditional = strOle;
}
else
{
strOle = strFolder + strFileName + L".bin";
if (OOX::CSystemUtility::IsFileExist(strOle))
strOleBin = strOle;
strAdditional = strOle;
}
}
}
}
if(0 != (nDisplayType & 8))
{
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit())
{
if (OOX::CSystemUtility::IsFileExist(mediaFile->filename()) == false)
{
typeAdditional = 2;
std::wstring strMedia = strFolder + strFileName + mediaFile->filename().GetExtention();
if (OOX::CSystemUtility::IsFileExist(strMedia))
{
m_pContentTypes->AddDefault(mediaFile->filename().GetExtention(false));
strAdditional = strMedia;
}
else
{
strMedia = strFolder + strFileName;
if (mediaFile.is<OOX::Audio>()) strMedia += L".wav";
if (mediaFile.is<OOX::Video>()) strMedia += L".avi";
if (OOX::CSystemUtility::IsFileExist(strMedia))
strAdditional = strMedia;
}
}
}
@ -233,10 +282,20 @@ namespace NSBinPptxRW
m_pContentTypes->AddDefault(strExts.substr(1));
}
_imageManager2Info oImageManagerInfo = GenerateImageExec(strImage, strExts, strOleBin, oleData);
if (oleData.empty() == false)
{
//plugins data - generate ole
typeAdditional = 1;
}
if (!oImageManagerInfo.sFilepathOle.empty())
oleFile->set_filename(oImageManagerInfo.sFilepathOle);
_imageManager2Info oImageManagerInfo = GenerateImageExec(strImage, strExts, strAdditional, typeAdditional, oleData);
if (!oImageManagerInfo.sFilepathAdditional.empty())
{
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit())
mediaFile->set_filename(oImageManagerInfo.sFilepathAdditional);
}
if (strBase64Image.empty())
m_mapImages[strInput] = oImageManagerInfo;
@ -281,7 +340,7 @@ namespace NSBinPptxRW
}
return bRes;
}
_imageManager2Info CImageManager2::GenerateImageExec(const std::wstring& strInput, const std::wstring& sExts, const std::wstring& strOleImage, const std::wstring& oleData)
_imageManager2Info CImageManager2::GenerateImageExec(const std::wstring& strInput, const std::wstring& sExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData)
{
OOX::CPath oPathOutput;
_imageManager2Info oImageManagerInfo;
@ -293,8 +352,11 @@ namespace NSBinPptxRW
{
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
if (oPathOutput.GetPath() != strInput)
CDirectory::CopyFile(strInput, oPathOutput.GetPath());
if (oPathOutput.GetPath() != strInput && NSFile::CFileBinary::Exists(strInput))
{
NSFile::CFileBinary::Copy(strInput, oPathOutput.GetPath());
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
}
}
else
{
@ -302,32 +364,52 @@ namespace NSBinPptxRW
strExts = _T(".png");
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
SaveImageAsPng(strInput, oPathOutput.GetPath());
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
}
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
if (!strOleImage.empty() || !oleData.empty() )
if ((!strAdditionalImage.empty() || !oleData.empty() ) && (nAdditionalType == 1))
{
std::wstring strExtsOle = L".bin";
std::wstring strAdditionalExt = L".bin";
int pos = (int)strOleImage.rfind(L".");
if (pos >= 0) strExtsOle = strOleImage.substr(pos);
int pos = (int)strAdditionalImage.rfind(L".");
if (pos >= 0) strAdditionalExt = strAdditionalImage.substr(pos);
std::wstring strImageOle = L"oleObject" + std::to_wstring(++m_lIndexNextOle) + strExtsOle;
std::wstring strImageAdditional = L"oleObject" + std::to_wstring(++m_lIndexCounter) + strAdditionalExt;
OOX::CPath pathOutputOle = m_strDstEmbed + FILE_SEPARATOR_STR + strImageOle;
OOX::CPath pathOutput = m_strDstEmbed + FILE_SEPARATOR_STR + strImageAdditional;
std::wstring strOleImageOut = pathOutputOle.GetPath();
std::wstring strAdditionalImageOut = pathOutput.GetPath();
if(!oleData.empty())
{
WriteOleData(strOleImageOut, oleData);
WriteOleData(strAdditionalImageOut, oleData);
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
}
else
else if (NSFile::CFileBinary::Exists(strAdditionalImage))
{
CDirectory::CopyFile(strOleImage, strOleImageOut);
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
}
oImageManagerInfo.sFilepathOle = strOleImageOut;
}
else if (!strAdditionalImage.empty() && nAdditionalType == 2)
{
std::wstring strAdditionalExt;
int pos = (int)strAdditionalImage.rfind(L".");
if (pos >= 0) strAdditionalExt = strAdditionalImage.substr(pos);
std::wstring strImageAdditional = L"media" + std::to_wstring(++m_lIndexCounter) + strAdditionalExt;
OOX::CPath pathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImageAdditional;
std::wstring strAdditionalImageOut = pathOutput.GetPath();
if (NSFile::CFileBinary::Exists(strAdditionalImage))
{
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
}
}
return oImageManagerInfo;
@ -372,7 +454,6 @@ namespace NSBinPptxRW
strExts = strUrl.substr(nIndexExt);
std::wstring strImage;
std::wstring strOleImage;
int nDisplayType = IsDisplayedImage(strUrl);
@ -380,11 +461,6 @@ namespace NSBinPptxRW
{
std::wstring strInputMetafile = strUrl.substr(0, strUrl.length() - strExts.length());
std::wstring sDownloadRes;
//todo
if(0 != (nDisplayType & 4))
{
strOleImage = DownloadImageExec(strInputMetafile + _T(".bin"));
}
if(0 != (nDisplayType & 1))
{
@ -414,11 +490,9 @@ namespace NSBinPptxRW
_imageManager2Info oImageManagerInfo;
if (!strImage.empty())
{
oImageManagerInfo = GenerateImageExec(strImage, strExts, strOleImage, L"");
oImageManagerInfo = GenerateImageExec(strImage, strExts, L"", 0, L"");
CDirectory::DeleteFile(strImage);
}
if (!strOleImage.empty())
CDirectory::DeleteFile(strOleImage);
m_mapImages[strUrl] = oImageManagerInfo;
return oImageManagerInfo;
@ -1041,6 +1115,16 @@ namespace NSBinPptxRW
m_pWriter->WriteString(str);
}
std::wstring s = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"../theme/theme" +
std::to_wstring(nIndexTheme + 1) + L".xml\"/>";
m_pWriter->WriteString(s);
}
void CRelsGenerator::StartNotesMaster(int nIndexTheme)
{
m_pWriter->WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
m_pWriter->WriteString(_T("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"));
std::wstring s = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"../theme/theme" +
std::to_wstring(nIndexTheme + 1) + L".xml\"/>";
@ -1056,7 +1140,7 @@ namespace NSBinPptxRW
std::to_wstring(nIndexTheme + 1) + L".xml\"/>";
m_pWriter->WriteString(str);
}
void CRelsGenerator::StartSlide(int nIndexSlide, int nIndexLayout)
void CRelsGenerator::StartSlide(int nIndexSlide, int nIndexLayout, int nIndexNotes)
{
m_pWriter->WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
m_pWriter->WriteString(_T("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"));
@ -1066,12 +1150,15 @@ namespace NSBinPptxRW
std::to_wstring(nIndexLayout + 1) + L".xml\"/>";
m_pWriter->WriteString(str);
str = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide" +
std::to_wstring(nIndexSlide + 1) + L".xml\"/>";
if (nIndexNotes >= 0)
{
str = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide\" Target=\"../notesSlides/notesSlide" +
std::to_wstring(nIndexNotes + 1) + L".xml\"/>";
}
m_pWriter->WriteString(str);
}
void CRelsGenerator::StartNote(int nIndexSlide)
void CRelsGenerator::StartNotes(int nIndexSlide)
{
m_pWriter->WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
m_pWriter->WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
@ -1166,36 +1253,42 @@ namespace NSBinPptxRW
oFile.CloseFile();
}
_relsGeneratorInfo CRelsGenerator::WriteImage(const std::wstring& strImage, smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image = _T(""))
_relsGeneratorInfo CRelsGenerator::WriteImage(const std::wstring& strImage, smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image = _T(""))
{
_imageManager2Info oImageManagerInfo = m_pManager->GenerateImage(strImage, oleFile, oleData, strBase64Image);
_imageManager2Info oImageManagerInfo = m_pManager->GenerateImage(strImage, additionalFile, oleData, strBase64Image);
std::wstring strImageRelsPath;
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strImageRelsPath = L"media/";
else strImageRelsPath = L"../media/";
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
if (m_mapImages.end() != pPair)
{
return pPair->second;
}
_relsGeneratorInfo oRelsGeneratorInfo;
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
L"\"/>");
if( oleFile.IsInit() )
if (!oImageManagerInfo.sFilepathImage.empty())
{
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
if (m_mapImages.end() != pPair)
{
return pPair->second;
}
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
L"\"/>");
}
if(additionalFile.is<OOX::OleObject>())
{
smart_ptr<OOX::OleObject> oleFile = additionalFile.smart_dynamic_cast<OOX::OleObject>();
std::wstring strOleRelsPath;
oRelsGeneratorInfo.nOleRId = m_lNextRelsID++;
@ -1222,7 +1315,29 @@ namespace NSBinPptxRW
}
}
}
else if(additionalFile.is<OOX::Media>())
{
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
std::wstring strMediaRelsPath;
oRelsGeneratorInfo.nMediaRId = m_lNextRelsID++;
oRelsGeneratorInfo.sFilepathOle = mediaFile->filename().GetPath();
if (m_pManager->m_nDocumentType != XMLWRITER_DOC_TYPE_XLSX)
{
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nMediaRId);
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strMediaRelsPath = L"media/";
else strMediaRelsPath = L"../media/";
strMediaRelsPath += mediaFile->filename().GetFilename();
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid
+ L"\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\" Target=\"" +
strMediaRelsPath + L"\"/>");
}
}
m_mapImages.insert(std::pair<std::wstring, _relsGeneratorInfo>(strImageRelsPath, oRelsGeneratorInfo));
return oRelsGeneratorInfo;
}

View File

@ -48,7 +48,7 @@ class COfficeFontPicker;
namespace OOX
{
class OleObject;
class File;
class CContentTypes;
class WritingElement;
class IFileContainer;
@ -91,7 +91,7 @@ namespace NSBinPptxRW
struct _imageManager2Info
{
std::wstring sFilepathOle;
std::wstring sFilepathAdditional;
std::wstring sFilepathImage;
};
@ -99,7 +99,9 @@ namespace NSBinPptxRW
{
int nImageRId;
int nOleRId;
int nMediaRId;
std::wstring sFilepathMedia;
std::wstring sFilepathOle;
std::wstring sFilepathImage;
@ -107,6 +109,7 @@ namespace NSBinPptxRW
{
nImageRId = -1;
nOleRId = -1;
nMediaRId = -1;
}
};
@ -158,17 +161,13 @@ namespace NSBinPptxRW
NSShapeImageGen::CImageManager* m_pImageManager;
//NSFontCutter::CFontDstManager m_oFontPicker;
NSFontCutter::CFontDstManager* m_pNativePicker;
COfficeFontPicker* m_pFontPicker;
bool m_bDeleteFontPicker;
public:
CCommonWriter();
~CCommonWriter();
public:
void CreateFontPicker(COfficeFontPicker* pPicker);
void CheckFontPicker();
};
@ -178,7 +177,7 @@ namespace NSBinPptxRW
private:
std::map<std::wstring, _imageManager2Info> m_mapImages;
_INT32 m_lIndexNextImage;
_INT32 m_lIndexNextOle;
_INT32 m_lIndexCounter;
std::wstring m_strDstMedia;
std::wstring m_strDstEmbed;
public:
@ -197,8 +196,8 @@ namespace NSBinPptxRW
int IsDisplayedImage(const std::wstring& strInput);
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image);
_imageManager2Info GenerateImageExec(const std::wstring& strInput, const std::wstring& strExts, const std::wstring& strOleImage, const std::wstring& oleData);
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
_imageManager2Info GenerateImageExec(const std::wstring& strInput, const std::wstring& strExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData);
void SaveImageAsPng(const std::wstring& strFileSrc, const std::wstring& strFileDst);
void SaveImageAsJPG(const std::wstring& strFileSrc, const std::wstring& strFileDst);
@ -408,8 +407,9 @@ namespace NSBinPptxRW
void StartMaster (int nIndexTheme, const _slideMasterInfo& oInfo);
void StartLayout (int nIndexTheme);
void StartSlide (int nIndexSlide, int nIndexLayout);
void StartNote (int nIndexSlide);
void StartSlide (int nIndexSlide, int nIndexLayout, int nIndexNotes);
void StartNotes (int nIndexSlide);
void StartNotesMaster(int nIndexTheme);
void WriteMasters (int nCount);
void WriteThemes (int nCount);
@ -426,7 +426,7 @@ namespace NSBinPptxRW
void AddRels (const std::wstring& strRels);
void SaveRels (const std::wstring& strFile);
_relsGeneratorInfo WriteImage (const std::wstring& strImage, NSCommon::smart_ptr<OOX::OleObject>& strOle, const std::wstring& oleData, std::wstring strBase64Image);
_relsGeneratorInfo WriteImage (const std::wstring& strImage, NSCommon::smart_ptr<OOX::File>& additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
};
class CBinaryFileReader

View File

@ -162,8 +162,7 @@ namespace PPTX2EditorAdvanced
}
// записываем все слайды
size_t nCount = presentation->sldIdLst.size();
for (size_t i = 0; i < nCount; ++i)
for (size_t i = 0; i < presentation->sldIdLst.size(); ++i)
{
std::wstring rId = presentation->sldIdLst[i].rid.get();
smart_ptr<PPTX::Slide> slide = ((*presentation)[rId]).smart_dynamic_cast<PPTX::Slide>();

View File

@ -303,7 +303,6 @@ namespace NSPresentationEditor
std::vector <std::wstring> m_oQuery;
public:
CAnimationInfo() : m_arAnimations()
{
}
@ -323,7 +322,6 @@ namespace NSPresentationEditor
{
}
public:
// std::wstring ToXml(const double& dStartTime, const double& dEndTime, bool bIgnore = false)
// {
@ -453,13 +451,5 @@ namespace NSPresentationEditor
// return baseXML;
// }
inline std::wstring FormatXml ()
{
std::wstring Xml;
for ( long i = 0; i < (long)m_oQuery.size(); ++i )
Xml += m_oQuery[i];
return Xml;
}
};
}

View File

@ -905,8 +905,6 @@ namespace NSPresentationEditor
std::wstring Panose;
bool Monospace;
public:
bool IsEqual(CFont* pFont)
{
if (NULL == pFont)
@ -974,8 +972,7 @@ namespace NSPresentationEditor
Monospace = false;
}
public:
CFont()
CFont()
{
SetDefaultParams();
}
@ -1034,8 +1031,6 @@ namespace NSPresentationEditor
int PerspectiveX;
int PerspectiveY;
public:
void SetDefaultParams()
{
Visible = false;
@ -1060,8 +1055,6 @@ namespace NSPresentationEditor
Color.SetRGB(0x80, 0x80, 0x80);
}
public:
CShadow()
{
SetDefaultParams();
@ -1123,8 +1116,6 @@ namespace NSPresentationEditor
CColor Color;
long Alpha;
public:
void SetDefaultParams()
{
Visible = 0;
@ -1133,8 +1124,6 @@ namespace NSPresentationEditor
Alpha = 255;
}
public:
CEdgeText()
{
SetDefaultParams();
@ -1172,7 +1161,6 @@ namespace NSPresentationEditor
int m_nTextAlignVertical;
double m_dTextRotate;
public:
CTextAttributes() : m_oFont(), m_oTextBrush(), m_oTextShadow(), m_oTextEdge()
{
m_oFont.Size = 36;
@ -1196,4 +1184,6 @@ namespace NSPresentationEditor
return (*this);
}
};
}

View File

@ -89,315 +89,6 @@ namespace NSPresentationEditor
}
m_arNotes.clear();
}
#if defined (_DEBUG)
std::wstring GetXmlSlideTransition ( CSlide& oSlide/*, CAudioOverlay& oAudioOverlay*/ )
{
std::wstring Source = std::wstring ( _T("") );
int EffectID = 1;
int lEffectDirection = oSlide.m_oSlideShow.m_oTransition.m_nEffectDirection;
switch ( oSlide.m_oSlideShow.m_oTransition.m_nEffectType )
{
case 0 : // Cut
{
// Отрабатывается выше ( выкидывать слайд, или вставлять на несколько ms )
}
break;
case 1 : // Random //
{
// рандом вставить
EffectID = 1; // Fade Solid Smal
}
break;
case 2 : // Blinds
{
if ( 0x00 == lEffectDirection ) // Vertical // Slide Side Top To Bottom
EffectID = 1003;
if ( 0x01 == lEffectDirection ) // Horizontal // Slide Side Left To Righ
EffectID = 1001;
}
break;
case 3 : // Checker
{
if ( 0x00 == lEffectDirection ) // Horizontal // WipeCheckerRightToLef
EffectID = 2901;
if ( 0x01 == lEffectDirection ) // Vertical // WipeCheckerTopToBottom
EffectID = 2903;
}
break;
case 4 : // Cover
{
//0x00 Left
#pragma message ("TODO : Cover - добавить такой эффект в ImageStudio")
//0x01 Up
//0x02 Right
//0x03 Down
//0x04 Left Up
//0x05 Right Up
//0x06 Left Down
//0x07 Right Down
}
break;
case 5 : // Dissolve
{
#pragma message ("TODO : Dissolve - добавить такой эффект в ImageStudio")
EffectID = 1; // Fade Solid Smal
}
break;
case 6 : // Fade
{
EffectID = 4904; // Flash Dark
}
break;
case 7 : // Uncover
{
#pragma message ("TODO : Uncover - добавить такой эффект в ImageStudio")
//0x00 Left
//0x01 Up
//0x02 Right
//0x03 Down
//0x04 Left Up
//0x05 Right Up
//0x06 Left Down
//0x07 Right Down
}
break;
case 8 : // Random Bars
{
if ( 0x00 == lEffectDirection ) // Horizontal
EffectID = 5331;
if ( 0x01 == lEffectDirection ) // Vertical
EffectID = 5332;
}
break;
case 9 : // Strips
{
if ( 0x04 == lEffectDirection ) // Left Up // Mosaic Right Bottom
EffectID = 110;
if ( 0x05 == lEffectDirection ) // Right Up // Mosaic Left Bottom
EffectID = 111;
if ( 0x06 == lEffectDirection ) // Left Down // Mosaic Right Top
EffectID = 109;
if ( 0x07 == lEffectDirection ) // Right Down // Mosaic Left Top
EffectID = 108;
}
break;
case 10: // Wipe
{
if ( 0x00 == lEffectDirection ) // Left // Reveal, Left
EffectID = 5322;
if ( 0x01 == lEffectDirection ) // Up // Reveal, Up
EffectID = 5323;
if ( 0x02 == lEffectDirection ) // Right // Reveal, Right
EffectID = 5321;
if ( 0x03 == lEffectDirection ) // Down // Reveal, Down
EffectID = 5320;
}
break;
case 11: // Box In/Out
{
if ( 0x00 == lEffectDirection ) // Wipe Center Box Out
EffectID = 702;
if ( 0x01 == lEffectDirection ) // Wipe Center Box In
EffectID = 701;
}
break;
case 13 :// Split
{
if ( 0x00 == lEffectDirection ) // Horizontally out // Split, Horizontal
EffectID = 5324;
#pragma message ("TODO : Split Horizontal In - добавить такой эффект в ImageStudio")
if ( 0x01 == lEffectDirection ) // Horizontally in //
EffectID = 5324;
if ( 0x02 == lEffectDirection ) // Vertically out // Split, Vertical
EffectID = 5325;
#pragma message ("TODO : Split Vertical In - добавить такой эффект в ImageStudio")
if ( 0x03 == lEffectDirection ) // Vertically in //
EffectID = 5325;
}
break;
case 17 : // Diamond
{
EffectID = 704; // Wipe Center Diamond Out
}
break;
case 18 : // Plus
{
EffectID = 708; // Wipe Center Cross Out
}
break;
case 19 : // Wedge
{
EffectID = 3006; // Clock Top Opposite
}
break;
case 20 : // Push
{
if ( 0x00 == lEffectDirection ) // Left // Push Side Right To Left
EffectID = 1402;
if ( 0x01 == lEffectDirection ) // Up // Push Side Bottom To Top
EffectID = 1404;
if ( 0x02 == lEffectDirection ) // Right // Push Side Left To Right
EffectID = 1401;
if ( 0x03 == lEffectDirection ) // Down // Push Side Top To Bottom
EffectID = 1403;
}
break;
case 21 : // Comb
{
if ( 0x00 == lEffectDirection ) // Horizontal // MosaicStrips
EffectID = 103;
#pragma message ("TODO : MosaicStrips Vertical - добавить такой эффект в ImageStudio")
if ( 0x01 == lEffectDirection ) // Vertical // MosaicStrips
EffectID = 103;
}
break;
case 22 : // Newsflash
{
EffectID = 313; // Rotate Twice Out Clockwise
}
break;
case 23 :// AlphaFade
{
EffectID = 1; // Fade Solid Smal
}
break;
case 26 : // Wheel
{
if ( 0x01 == lEffectDirection ) // ClockBottomReverse
EffectID = 3004;
if ( 0x02 == lEffectDirection ) // Clock2AnglesClockwise
EffectID = 3013;
if ( 0x03 == lEffectDirection ) // Clock4AnglesClockwise
EffectID = 3017;
if ( 0x04 == lEffectDirection ) // Clock6AnglesClockwise
EffectID = 3019;
if ( 0x08 == lEffectDirection ) // Clock8AnglesClockwise
EffectID = 3021;
}
break;
case 27 : // Circle
{
EffectID = 706; // Wipe Center Circle Out
}
break;
default :
{
return Source;
}
break;
}
Source = L"<VideoCompose Time=\"" + std::to_wstring(oSlide.m_oSlideShow.m_oTransition.m_dSpeed) + L"\" effectid=\"" + std::to_wstring(EffectID) + L"\"/>";
/*
if (oSlide.m_oSlideShow.m_oTransition.m_bAudioPresent)
{
CAudioElement oAudioElem;
oAudioElem.m_dStartTime = oSlide.m_dStartTime - oSlide.m_oSlideShow.m_oTransition.m_dSpeed;
oAudioElem.m_dEndTime = oAudioOverlay.m_dAllDuration;
oAudioElem.m_strFileName = oSlide.m_oSlideShow.m_oTransition.m_oAudio.m_strFileName;
CAudioPart oPart(&oAudioElem);
oPart.m_bStop = oSlide.m_oSlideShow.m_oTransition.m_bStopSound;
oPart.m_bLoop = oSlide.m_oSlideShow.m_oTransition.m_bLoopSound;
oPart.m_bIsTransition = true;
oAudioOverlay.m_arParts.Add(oPart);
}
*/
return Source;
}
#endif
double CalculateTimes(CAudioOverlay& oAudioOverlay)
{
CaclulateSlideTimes();
int lCount = (LONG)m_arSlides.size();
double dAllDuration = 0;
if (lCount > 0)
{
dAllDuration = m_arSlides[lCount - 1]->m_dEndTime;
}
oAudioOverlay.m_dAllDuration = dAllDuration;
for (LONG i = 0; i < lCount; ++i)
{
CalculateSlideElements(i, oAudioOverlay);
}
return dAllDuration;
}
void CaclulateSlideTimes()
{
double Transition1 = 0;
double Duration = 0;
double Transition2 = 0;
int nCount = (int)m_arSlides.size();
for (int i = 0; i < nCount; ++i)
{
CSlide* pSlide = m_arSlides[i];
double dSlideDuration = 0;
if (pSlide->m_oSlideShow.m_dSlideDuration > 0)
{
dSlideDuration = m_arSlides[i]->m_oSlideShow.m_dSlideDuration;
}
if (0 == dSlideDuration)
{
// решено сделать так: если время слайда не выставлено - то берем максимальную
// длительность видео, лежащего на нем. Если таких нет - то дефолтовая длительность,
// впрочем она уже выставлена
size_t nSize = pSlide->m_arElements.size();
for (size_t j = 0; j < nSize; ++j)
{
if (etVideo == pSlide->m_arElements[j]->m_etType)
{
dSlideDuration = (std::max)(dSlideDuration, ((CVideoElement*)pSlide->m_arElements[j])->m_dVideoDuration);
}
}
if (0 == dSlideDuration)
{
dSlideDuration = pSlide->m_dDuration;
}
}
pSlide->m_dDuration = dSlideDuration;
Transition1 = pSlide->m_oSlideShow.m_oTransition.m_dSpeed;
if (i < (nCount - 1))
Transition2 = m_arSlides[i + 1]->m_oSlideShow.m_oTransition.m_dSpeed;
Duration = pSlide->m_dDuration;
if (i == 0)
{
pSlide->m_dStartTime = Transition1;
}
else
{
pSlide->m_dStartTime = m_arSlides[i-1]->m_dStartTime + m_arSlides[i-1]->m_dDuration;
}
pSlide->m_dDuration = Transition1 + Duration + Transition2;
pSlide->m_dEndTime = pSlide->m_dStartTime + pSlide->m_dDuration;
}
}
void CalculateSlideElements(int nIndex, CAudioOverlay& oAudioOverlay)
{
double dStartTime = m_arSlides[nIndex]->m_dStartTime;
@ -413,16 +104,6 @@ namespace NSPresentationEditor
switch (pElement->m_etType)
{
//case etPicture:
//case etShape:
//case etVideo:
//case etText:
// {
// //pElement->m_dStartTime = 0;
// //pElement->m_dEndTime = dDuration;
//
// break;
// }
case etAudio:
{
CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement);
@ -520,8 +201,6 @@ namespace NSPresentationEditor
pElement->m_oMetric = m_oInfo;
pElement->NormalizeCoords(dScaleX, dScaleY);
pElement->SetupProperties(NULL, pTheme, NULL);
}
size_t nCountLayouts = pTheme->m_arLayouts.size();
@ -591,8 +270,6 @@ namespace NSPresentationEditor
}
}
}
pElement->SetupProperties(NULL, pTheme, pLayout);
}
}
}
@ -631,8 +308,6 @@ namespace NSPresentationEditor
pElement->m_pLayout = pLayout;
pElement->m_oMetric = m_oInfo;
pElement->SetupProperties(pSlide, pTheme, pLayout);
}
if (NULL != pLayout && bIsPlaceholderSetUp)

View File

@ -33,7 +33,6 @@
#include "TextAttributesEx.h"
#include "Interactive.h"
#include "Animations.h"
#include "ElementProperties.h"
namespace NSPresentationEditor
{
@ -127,6 +126,9 @@ namespace NSPresentationEditor
class IElement
{
protected:
ULONG m_lCountRef;
public:
ElementType m_etType;
CDoubleRect m_rcBounds;
@ -136,7 +138,9 @@ namespace NSPresentationEditor
double m_dStartTime;
double m_dEndTime;
CTextInteractiveInfo m_oTextActions;
CInteractiveInfo m_oActions;
CAnimationInfo m_oAnimations;
CEffects m_oEffects;
@ -169,8 +173,6 @@ namespace NSPresentationEditor
bool m_bIsChangeable; // можно ли редактировать элемент
CElementProperties m_oProperties;
CTheme* m_pTheme;
CLayout* m_pLayout;
@ -179,11 +181,6 @@ namespace NSPresentationEditor
std::wstring m_sHyperlink;
protected:
ULONG m_lCountRef;
public:
virtual ULONG AddRef()
{
++m_lCountRef;
@ -200,8 +197,6 @@ namespace NSPresentationEditor
return m_lCountRef;
}
public:
IElement()
{
m_bIsBackground = false;
@ -268,6 +263,7 @@ namespace NSPresentationEditor
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom;
}
virtual IElement* CreateDublicate() = 0;
protected:
virtual void SetProperiesToDublicate(IElement* pDublicate)
@ -295,6 +291,7 @@ namespace NSPresentationEditor
pDublicate->m_lLayoutID = m_lLayoutID;
pDublicate->m_oActions = m_oActions;
pDublicate->m_oTextActions = m_oTextActions;
pDublicate->m_oAnimations = m_oAnimations;
pDublicate->m_oEffects = m_oEffects;
@ -307,7 +304,6 @@ namespace NSPresentationEditor
pDublicate->m_nFormatDate = m_nFormatDate;
pDublicate->m_oMetric = m_oMetric;
pDublicate->m_oProperties = m_oProperties;
pDublicate->m_dRotate = m_dRotate;
pDublicate->m_bFlipH = m_bFlipH;
@ -321,29 +317,5 @@ namespace NSPresentationEditor
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
}
public:
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
std::map<CElementProperty::Type, CElementProperty>* pMap = &m_oProperties.m_arProperties;
for (std::map<CElementProperty::Type, CElementProperty>::iterator pPair = pMap->begin(); pPair != pMap->end(); ++pPair)
{
CElementProperty oProperty = pPair->second;
SetupProperty(pSlide, pTheme, pLayout, &oProperty);
}
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty) = 0;
virtual IElement* CreateDublicate() = 0;
virtual std::wstring SerializeToXml()
{
std::wstring strElement;
// strElement.Format(_T("<Element type='%d' id='%d' lid='%d' pid='%d' ptp='%d' />"),
// (int)m_etType, m_lID, m_lLayoutID, m_lPlaceholderID, m_lPlaceholderType);
return strElement;
}
};
}

View File

@ -1,672 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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 Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* 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 <map>
namespace NSPresentationEditor
{
class CElementProperty
{
public:
enum Type
{
epNil = 0,
//----------Transform----------------
epTop = 1,
epLeft = 2,
epRight = 3,
epBottom = 4,
epRotate = 5,
epFlipV = 6,
epFlipH = 7,
//----------Geometry-----------------
epAdjustments = 10,
epGuides = 11,
epPath = 12,
//----------Pen properties-----------
epPenIndex = 20,
epPenColor = 21,
epPenAlpha = 22,
epPenWidth = 23,
epPenJoin = 24,
epLineDash = 25,
epLineEndCap = 26,
epLineStartCap = 27,
epStroked = 28,
//----------Brush properties----------
epBrushTypeIndex = 40,
epBrushType = 41,
epBrushColor1 = 42,
epBrushColor2 = 43,
epBrushAlpha1 = 44,
epBrushAlpha2 = 45,
epBrushTxMode = 46,
epBrushLinearAngle = 47,
epBrushColors = 48,
epBrushTxPath = 49,
epFilled = 50,
//----------Text----------------------
epText = 60,
epTextMarginLeft = 61,
epTextMarginTop = 62,
epTextMarginRight = 63,
epTextMarginBottom = 64,
epTextWrap = 65,
//----------Font----------------------
epFontName = 80,
epFontSize = 81,
epFontVertAlign = 82,
epFontHorAlign = 83,
epFontItalic = 84,
epFontBold = 85,
epFontStrikeout = 86,
epFontUnderline = 87,
//----------Effects-------------------
epEffectIndex = 100,
//----------3D------------------------
//----------Shadow--------------------
//----------Edge----------------------
};
public:
CElementProperty(const Type& type = epNil)
{
m_ID = type;
m_dwValue = 0;
}
CElementProperty(const CElementProperty& oSrc)
{
*this = oSrc;
}
CElementProperty& operator=(const CElementProperty& oSrc)
{
m_ID = oSrc.m_ID;
m_dwValue = oSrc.m_dwValue;
m_strAdvanced = oSrc.m_strAdvanced;
return *this;
}
public:
Type m_ID;
DWORD m_dwValue;
std::wstring m_strAdvanced;
};
class CElementProperties
{
public:
std::map<CElementProperty::Type, CElementProperty> m_arProperties;
public:
CElementProperties() : m_arProperties()
{
}
public:
CElementProperties& operator=(const CElementProperties& oSrc)
{
m_arProperties.clear();
for (std::map<CElementProperty::Type, CElementProperty>::const_iterator pPair = oSrc.m_arProperties.begin(); pPair != oSrc.m_arProperties.end(); ++pPair)
{
CElementProperty oProperty = pPair->second;
m_arProperties[oProperty.m_ID] = oProperty;
}
return *this;
}
CElementProperties(const CElementProperties& oSrc)
{
*this = oSrc;
}
virtual ~CElementProperties()
{
m_arProperties.clear();
}
inline void SetAt(const CElementProperty::Type& eType, const DWORD& dwValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = dwValue;
m_arProperties[eType] = oProp;
}
inline void SetAt(const CElementProperty::Type& eType, const BYTE& nValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = (DWORD)nValue;
m_arProperties[eType] = oProp;
}
inline void SetAt(const CElementProperty::Type& eType, const long& lValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = (DWORD)lValue;
m_arProperties[eType] = oProp;
}
inline void SetAt(const CElementProperty::Type& eType, const bool& bValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = (true == bValue) ? 1 : 0;
m_arProperties[eType] = oProp;
}
inline void SetAt(const CElementProperty::Type& eType, std::wstring strValue)
{
CElementProperty oProp(eType);
oProp.m_dwValue = (DWORD)strValue.length() + 1;
oProp.m_strAdvanced = strValue;
m_arProperties[eType] = oProp;
}
};
}
/*
enum PropertyId
{
//Transform
left=0,
top=1,
right=2,
bottom=3,
rotation=4,
gvPage=5,
fChangePage=61,
fFlipV=62,
fFlipH=63,
//Protection
fLockAgainstUngrouping=118,
fLockRotation=119,
fLockAspectRatio=120,
fLockPosition=121,
fLockAgainstSelect=122,
fLockCropping=123,
fLockVertices=124,
fLockText=125,
fLockAdjustHandles=126,
fLockAgainstGrouping=127,
//Text
lTxid=128,
dxTextLeft=129,
dyTextTop=130,
dxTextRight=131,
dyTextBottom=132,
WrapText=133,
scaleText=134,
anchorText=135,
txflTextFlow=136,
cdirFont=137,
hspNext=138,
txdir=139,
ccol=140,
dzColMargin=141,
fSelectText=187,
fAutoTextMargin=188,
fRotateText=189,
fFitShapeToText=190,
fFitTextToShape=191,
//GeoText
gtextUNICODE=192,
gtextRTF=193,
gtextAlign=194,
gtextSize=195,
gtextSpacing=196,
gtextFont=197,
gtextCSSFont=198,
gtextFReverseRows=240,
fGtext=241,
gtextFVertical=242,
gtextFKern=243,
gtextFTight=244,
gtextFStretch=245,
gtextFShrinkFit=246,
gtextFBestFit=247,
gtextFNormalize=248,
gtextFDxMeasure=249,
gtextFBold=250,
gtextFItalic=251,
gtextFUnderline=252,
gtextFShadow=253,
gtextFSmallcaps=254,
gtextFStrikethrough=255,
//BLIP
cropFromTop=256,
cropFromBottom=257,
cropFromLeft=258,
cropFromRight=259,
Pib=260,
pibName=261,
pibFlags=262,
pictureTransparent=263,
pictureContrast=264,
pictureBrightness=265,
pictureGamma=266,
pictureId=267,
pictureDblCrMod=268,
pictureFillCrMod=269,
pictureLineCrMod=270,
pibPrint=271,
pibPrintName=272,
pibPrintFlags=273,
movie=274,
pictureRecolor=282,
picturePreserveGrays=313,
fRewind=314,
fLooping=315,
pictureGray=317,
pictureBiLevel=318,
pictureActive=319,
//Geometry
geoLeft=320,
geoTop=321,
geoRight=322,
geoBottom=323,
shapePath=324,
pVertices=325,
pSegmentInfo=326,
adjustValue=327,
adjust2Value=328,
adjust3Value=329,
adjust4Value=330,
adjust5Value=331,
adjust6Value=332,
adjust7Value=333,
adjust8Value=334,
adjust9Value=335,
adjust10Value=336,
pConnectionSites=337,
pConnectionSitesDir=338,
xLimo=339,
yLimo=340,
pAdjustHandles=341,
pGuides=342,
pInscribe=343,
cxk=344,
pFragments=345,
fColumnLineOK=377,
fShadowOK=378,
f3DOK=379,
fLineOK=380,
fGtextOK=381,
fFillShadeShapeOK=382,
fFillOK=383,
//Fill Style
fillType=384,
fillColor=385,
fillOpacity=386,
fillBackColor=387,
fillBackOpacity=388,
fillCrMod=389,
fillBlip=390,
fillBlipName=391,
fillBlipFlags=392,
fillWidth=393,
fillHeight=394,
fillAngle=395,
fillFocus=396,
fillToLeft=397,
fillToTop=398,
fillToRight=399,
fillToBottom=400,
fillRectLeft=401,
fillRectTop=402,
fillRectRight=403,
fillRectBottom=404,
fillDztype=405,
fillShadePreset=406,
fillShadeColors=407,
fillOriginX=408,
fillOriginY=409,
fillShapeOriginX=410,
fillShapeOriginY=411,
fillShadeType=412,
fRecolorFillAsPicture=441,
fUseShapeAnchor=442,
fFilled=443,
fHitTestFill=444,
fillShape=445,
fillUseRect=446,
fNoFillHitTest=447,
//Line Style
lineColor=448,
lineOpacity=449,
lineBackColor=450,
lineCrMod=451,
lineType=452,
lineFillBlip=453,
lineFillBlipName=454,
lineFillBlipFlags=455,
lineFillWidth=456,
lineFillHeight=457,
lineFillDztype=458,
lineWidth=459,
lineMiterLimit=460,
lineStyle=461,
lineDashing=462,
lineDashStyle=463,
lineStartArrowhead=464,
lineEndArrowhead=465,
lineStartArrowWidth=466,
lineStartArrowLength=467,
lineEndArrowWidth=468,
lineEndArrowLength=469,
lineJoinStyle=470,
lineEndCapStyle=471,
fInsetPen=505,
fInsetPenOK=506,
fArrowheadsOK=507,
fLine=508,
fHitTestLine=509,
lineFillShape=510,
fNoLineDrawDash=511,
//Shadow Style
shadowType=512,
shadowColor=513,
shadowHighlight=514,
shadowCrMod=515,
shadowOpacity=516,
shadowOffsetX=517,
shadowOffsetY=518,
shadowSecondOffsetX=519,
shadowSecondOffsetY=520,
shadowScaleXToX=521,
shadowScaleYToX=522,
shadowScaleXToY=523,
shadowScaleYToY=524,
shadowPerspectiveX=525,
shadowPerspectiveY=526,
shadowWeight=527,
shadowOriginX=528,
shadowOriginY=529,
fShadow=574,
fshadowObscured=575,
//Perspective Style
perspectiveType=576,
perspectiveOffsetX=577,
perspectiveOffsetY=578,
perspectiveScaleXToX=579,
perspectiveScaleYToX=580,
perspectiveScaleXToY=581,
perspectiveScaleYToY=582,
perspectivePerspectiveX=583,
perspectivePerspectiveY=584,
perspectiveWeight=585,
perspectiveOriginX=586,
perspectiveOriginY=587,
fPerspective=639,
//3D Object
c3DSpecularAmt=640,
c3DDiffuseAmt=641,
c3DShininess=642,
c3DEdgeThickness=643,
C3DExtrudeForward=644,
c3DExtrudeBackward=645,
c3DExtrudePlane=646,
c3DExtrusionColor=647,
c3DCrMod=648,
f3D=700,
fc3DMetallic=701,
fc3DUseExtrusionColor=702,
fc3DLightFace=703,
//3D Style
c3DYRotationAngle=704,
c3DXRotationAngle=705,
c3DRotationAxisX=706,
c3DRotationAxisY=707,
c3DRotationAxisZ=708,
c3DRotationAngle=709,
c3DRotationCenterX=710,
c3DRotationCenterY=711,
c3DRotationCenterZ=712,
c3DRenderMode=713,
c3DTolerance=714,
c3DXViewpoint=715,
c3DYViewpoint=716,
c3DZViewpoint=717,
c3DOriginX=718,
c3DOriginY=719,
c3DSkewAngle=720,
c3DSkewAmount=721,
c3DAmbientIntensity=722,
c3DKeyX=723,
c3DKeyY=724,
c3DKeyZ=725,
c3DKeyIntensity=726,
c3DFillX=727,
c3DFillY=728,
c3DFillZ=729,
c3DFillIntensity=730,
fc3DConstrainRotation=763,
fc3DRotationCenterAuto=764,
fc3DParallel=765,
fc3DKeyHarsh=766,
fc3DFillHarsh=767,
//Shape
hspMaster=769,
cxstyle=771,
bWMode=772,
bWModePureBW=773,
bWModeBW=774,
idDiscussAnchor=775,
dgmLayout=777,
dgmNodeKind=778,
dgmLayoutMRU=779,
wzEquationXML=780,
fPolicyLabel=822,
fPolicyBarcode=823,
fFlipHQFE5152=824,
fFlipVQFE5152=825,
fPreferRelativeResize=827,
fLockShapeType=828,
fInitiator=829,
fDeleteAttachedObject=830,
fBackground=831,
//Callout
spcot=832,
dxyCalloutGap=833,
spcoa=834,
spcod=835,
dxyCalloutDropSpecified=836,
dxyCalloutLengthSpecified=837,
fCallout=889,
fCalloutAccentBar=890,
fCalloutTextBorder=891,
fCalloutMinusX=892,
fCalloutMinusY=893,
fCalloutDropAuto=894,
fCalloutLengthSpecified=895,
//Groupe Shape
wzName=896,
wzDescription=897,
pihlShape=898,
pWrapPolygonVertices=899,
dxWrapDistLeft=900,
dyWrapDistTop=901,
dxWrapDistRight=902,
dyWrapDistBottom=903,
lidRegroup=904,
groupLeft=905,
groupTop=906,
groupRight=907,
groupBottom=908,
wzTooltip=909,
wzScript=910,
posh=911,
posrelh=912,
posv=913,
posrelv=914,
pctHR=915,
alignHR=916,
dxHeightHR=917,
dxWidthHR=918,
wzScriptExtAttr=919,
scriptLang=920,
wzScriptIdAttr=921,
wzScriptLangAttr=922,
borderTopColor=923,
borderLeftColor=924,
borderBottomColor=925,
borderRightColor=926,
tableProperties=927,
tableRowProperties=928,
scriptHtmlLocation=929,
wzApplet=930,
wzFrameTrgtUnused=932,
wzWebBot=933,
wzAppletArg=934,
wzAccessBlob=936,
metroBlob=937,
dhgt=938,
fLayoutInCell=944,
fIsBullet=945,
fStandardHR=946,
fNoshadeHR=947,
fHorizRule=948,
fUserDrawn=949,
fAllowOverlap=950,
fReallyHidden=951,
fScriptAnchor=952,
//Unknown HTML
wzLineId=1026,
wzFillId=1027,
wzPictureId=1028,
wzPathId=1029,
wzShadowId=1030,
wzPerspectiveId=1031,
wzGtextId=1032,
wzFormulaeId=1033,
wzHandlesId=1034,
wzCalloutId=1035,
wzLockId=1036,
wzTextId=1037,
wzThreeDId=1038,
FakeShapeType=1039,
fFakeMaster=1086,
//Diagramm
dgmt=1280,
dgmStyle=1281,
pRelationTbl=1284,
dgmScaleX=1285,
dgmScaleY=1286,
dgmDefaultFontSize=1287,
dgmConstrainBounds=1288,
dgmBaseTextScale=1289,
fBorderlessCanvas=1338,
fNonStickyInkCanvas=1339,
fDoFormat=1340,
fReverse=1341,
fDoLayout=1342,
fPseudoInline=1343,
// dashing
lineLeftDashStyle=1359,
lineTopDashStyle=1423,
lineRightDashStyle=1487,
lineBottomDashStyle=1551,
//Web Component
webComponentWzHtml=1664,
webComponentWzName=1665,
webComponentWzUrl=1666,
webComponentWzProperties=1667,
fIsWebComponent=1727,
//Clip
pVerticesClip=1728,
pSegmentInfoClip=1729,
shapePathClip=1730,
fClipToWrap=1790,
fClippedOK=1791,
//Ink
pInkData=1792,
fInkAnnotation=1852,
fHitTestInk=1853,
fRenderShape=1854,
fRenderInk=1855,
//Signature
wzSigSetupId=1921,
wzSigSetupProvId=192,
wzSigSetupSuggSigner=1923,
wzSigSetupSuggSigner2=1924,
wzSigSetupSuggSignerEmail=1925,
wzSigSetupSignInst=1926,
wzSigSetupAddlXml=1927,
wzSigSetupProvUrl=1928,
fSigSetupShowSignDate=1980,
fSigSetupAllowComments=1981,
fSigSetupSignInstSet=1982,
fIsSignatureLine=1983,
//Groupe Shape 2
pctHoriz=1984,
pctVert=1985,
pctHorizPos=1986,
pctVertPos=1987,
sizerelh=1988,
sizerelv=1989,
colStart=1990,
colSpan=1991
};
*/

View File

@ -310,7 +310,6 @@ namespace NSPresentationEditor
std::wstring m_sImageName;
public:
CImageElement() : IElement()
{
m_etType = etPicture;
@ -330,73 +329,9 @@ namespace NSPresentationEditor
m_bImagePresent = false;
}
virtual ~CImageElement()
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
std::wstring strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual std::wstring SaveToXML()
{
std::wstring strEffect;
// if (!m_oAnimations.m_arAnimations.empty())
// return ToAnimationXml();
// LONG lFlags = 0;
// if (m_bFlipH)
// lFlags |= 0x0001;
// if (m_bFlipV)
// lFlags |= 0x0002;
// strEffect.Format(_T("<ImagePaint-DrawImageFromFile left='%d' top='%d' right='%d' bottom='%d' angle='%lf' flags='%d' filepath='%ls' metric='0' backcolor='-1' scaletype='-1' scalecolor='255' widthmetric='%d' heightmetric='%d'>\
// <timeline type='1' begin='%lf' end='%lf' fadein='0' fadeout='0' completeness='1.0' /></ImagePaint-DrawImageFromFile>"),
// (LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom,
// m_dRotate, lFlags, m_strImageFileName,
// m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
// m_dStartTime, m_dEndTime);
return strEffect;
}
// std::wstring ToAnimationXml()
// {
// LONG lFlags = 0;
// if (m_bFlipH)
// lFlags |= 0x0001;
// if (m_bFlipV)
// lFlags |= 0x0002;
// std::wstring strEffect = _T("");
// strEffect.Format(_T("<ImagePaint-DrawImageFromFile left='%d' top='%d' right='%d' bottom='%d' angle='%lf' flags='%d' filepath='%ls' metric='0' backcolor='-1' scaletype='-1' scalecolor='255' widthmetric='%d' heightmetric='%d'>\
// <timeline type='1' begin='%lf' end='%lf' fadein='0' fadeout='0' completeness='1.0' /></ImagePaint-DrawImageFromFile>"),
// (LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom,
// m_dRotate, lFlags, m_strImageFileName,
// m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
// m_dStartTime, m_dEndTime);
// std::wstring TimeLine;
// TimeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "),
// m_dStartTime, m_dEndTime );
// std::wstring Source = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
// Source += TimeLine;
// Source += _T("</ImagePaint-DrawImageFromFileAnimate>");
// strEffect.Replace ( _T("</ImagePaint-DrawImageFromFile>"), Source );
// strEffect.Replace ( _T("<ImagePaint-DrawImageFromFile"), _T("<ImagePaint-DrawImageFromFileAnimate") );
// return strEffect;
// }
virtual IElement* CreateDublicate()
{
CImageElement* pImageElement = new CImageElement();
@ -420,10 +355,6 @@ namespace NSPresentationEditor
return (IElement*)pImageElement;
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
}
#ifdef ENABLE_PPT_TO_PPTX_CONVERT
@ -535,14 +466,6 @@ namespace NSPresentationEditor
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
std::map<CElementProperty::Type, CElementProperty>* pMap = &m_oProperties.m_arProperties;
for (std::map<CElementProperty::Type, CElementProperty>::iterator pPair = pMap->begin(); pPair != pMap->end(); ++pPair)
{
CElementProperty oProperty = pPair->second;
SetupProperty(pSlide, pTheme, pLayout, &oProperty);
}
m_oShape.m_oText.m_lPlaceholderType = m_lPlaceholderType;
m_oShape.m_oText.m_lPlaceholderID = m_lPlaceholderID;
@ -559,169 +482,6 @@ namespace NSPresentationEditor
void CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout);
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
const LONG _EMU_MM = 36000;
switch (pProperty->m_ID)
{
case CElementProperty::epTextMarginLeft:
{
m_oShape.m_dTextMarginX = (double)pProperty->m_dwValue / _EMU_MM;
break;
}
case CElementProperty::epTextMarginTop:
{
m_oShape.m_dTextMarginY = (double)pProperty->m_dwValue / _EMU_MM;
break;
}
case CElementProperty::epTextMarginRight:
{
m_oShape.m_dTextMarginRight = (double)pProperty->m_dwValue / _EMU_MM;
break;
}
case CElementProperty::epTextMarginBottom:
{
m_oShape.m_dTextMarginBottom = (double)pProperty->m_dwValue / _EMU_MM;
break;
}
case CElementProperty::epText:
{
//m_oShape.m_oText.m_sText = pProperty->m_strAdvanced;
}
case CElementProperty::epTextWrap:
{
m_oShape.m_oText.m_lWrapMode = (LONG)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushType:
{
m_oBrush.Type = (LONG)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushColor1:
{
m_oBrush.Color1.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oBrush.Color1, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epBrushColor2:
{
m_oBrush.Color2.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oBrush.Color2, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epBrushAlpha1:
{
m_oBrush.Alpha1 = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushAlpha2:
{
m_oBrush.Alpha2 = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epBrushTxPath:
{
m_oBrush.TexturePath = pProperty->m_strAdvanced;
break;
}
case CElementProperty::epBrushTxMode:
{
m_oBrush.TextureMode = (LONG)pProperty->m_dwValue;
break;
}
case CElementProperty::epFilled:
{
if (0 == pProperty->m_dwValue)
{
m_oBrush.Alpha1 = 0;
}
break;
}
case CElementProperty::epPenColor:
{
m_oPen.Color.SetSBGR(pProperty->m_dwValue);
CalculateColor(m_oPen.Color, pSlide, pTheme, pLayout);
break;
}
case CElementProperty::epPenAlpha:
{
m_oPen.Alpha = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epPenWidth:
{
m_oPen.Size = (double)pProperty->m_dwValue / 0xFFFF;
break;
}
case CElementProperty::epPenJoin:
{
m_oPen.LineJoin = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineDash:
{
m_oPen.DashStyle = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineStartCap:
{
m_oPen.LineStartCap = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epLineEndCap:
{
m_oPen.LineEndCap = (BYTE)pProperty->m_dwValue;
break;
}
case CElementProperty::epStroked:
{
if (0 == pProperty->m_dwValue)
m_oPen.Alpha = 0;
break;
}
case CElementProperty::epFontName:
{
m_oShape.m_oText.m_oAttributes.m_oFont.Name = pProperty->m_strAdvanced;
break;
}
case CElementProperty::epFontHorAlign:
{
m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = (int)pProperty->m_dwValue;
break;
}
case CElementProperty::epFontVertAlign:
{
m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical = (int)pProperty->m_dwValue;
break;
}
case CElementProperty::epFontSize:
{
m_oShape.m_oText.m_oAttributes.m_oFont.Size = (double)pProperty->m_dwValue / 0xFFFF;
break;
}
case CElementProperty::epFontBold:
{
m_oShape.m_oText.m_oAttributes.m_oFont.Bold = (pProperty->m_dwValue != 0);
break;
}
case CElementProperty::epFontItalic:
{
m_oShape.m_oText.m_oAttributes.m_oFont.Italic = (pProperty->m_dwValue != 0);
break;
}
case CElementProperty::epFontStrikeout:
{
m_oShape.m_oText.m_oAttributes.m_oFont.Strikeout = (BYTE)pProperty->m_dwValue;
break;
}
default:
break;
}
}
#ifdef ENABLE_PPT_TO_PPTX_CONVERT
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
@ -925,7 +685,7 @@ namespace NSPresentationEditor
};
class CAudioElement : public IElement
class CAudioElement : public CImageElement
{
public:
std::wstring m_strAudioFileName;
@ -938,8 +698,7 @@ namespace NSPresentationEditor
double m_dClipEndTime;
bool m_bLoop;
public:
CAudioElement() : IElement()
CAudioElement() : CImageElement()
{
m_etType = etAudio;
@ -957,60 +716,11 @@ namespace NSPresentationEditor
{
}
virtual std::wstring SaveToXML()
{
std::wstring element;
// element.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf'>"), m_dStartTime, m_dEndTime-m_dStartTime, (double)m_nAmplify);
// int lIndex = m_strAudioFileName.find(L"file:///");
// if (0 == lIndex)
// {
// m_strAudioFileName = m_strAudioFileName.substr(8);
// //m_strFileName.Replace('/', '\\');
// //m_strFileName.Replace(L"%20", L" ");
// }
// std::wstring strFileName = m_strAudioFileName;
// CorrectXmlString(strFileName);
// std::wstring source;
// source.Format(_T("<Source StartTime='%lf' EndTime='%lf' FilePath='%ls' loop='%d' />"), m_dClipStartTime, m_dClipEndTime, strFileName, m_bLoop);
// element += source;
// std::wstring animations;
// if(!m_oAnimations.m_arAnimations.empty()) // для audio только "media call's" - play - pause - stop
// {
// m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
// m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
// animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
// element += animations;
// }
// std::wstring timeLine;
// timeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
// element += timeLine;
// element += _T("</AudioSource>");
return element;
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
std::wstring strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual IElement* CreateDublicate()
{
CAudioElement* pAudioElement = new CAudioElement();
SetProperiesToDublicate((IElement*)pAudioElement);
SetProperiesToDublicate((CImageElement*)pAudioElement);
pAudioElement->m_strAudioFileName = m_strAudioFileName;
pAudioElement->m_nAmplify = m_nAmplify;
@ -1024,10 +734,6 @@ namespace NSPresentationEditor
return (IElement*)pAudioElement;
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
}
};
class CVideoElement : public CImageElement
{
@ -1041,7 +747,6 @@ namespace NSPresentationEditor
bool m_bLoop;
public:
CVideoElement() : CImageElement()
{
m_etType = etVideo;
@ -1057,31 +762,12 @@ namespace NSPresentationEditor
virtual ~CVideoElement()
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
std::wstring strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual std::wstring SaveToXML()
{
return L""; //GetVideoStream () + GetAudioStream ();
}
std::wstring ToAnimationXml()
{
return L"";
}
virtual IElement* CreateDublicate()
{
CVideoElement* pVideoElement = new CVideoElement();
SetProperiesToDublicate((IElement*)pVideoElement);
SetProperiesToDublicate((CImageElement*)pVideoElement);
pVideoElement->m_strVideoFileName = m_strVideoFileName;
pVideoElement->m_nAlpha = m_nAlpha;
@ -1094,87 +780,6 @@ namespace NSPresentationEditor
return (IElement*)pVideoElement;
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
}
// inline std::wstring GetVideoStream ()
// {
// int lIndex = m_strVideoFileName.find(L"file:///");
// if (0 == lIndex)
// {
// m_strVideoFileName = m_strVideoFileName.substr(8);
// /*m_strFileName.Replace('/', '\\');*/
// }
// std::wstring strFileName = m_strVideoFileName;
// CorrectXmlString(strFileName);
// std::wstring element;
// element.Format ( L"<VideoStream left='%d' top='%d' right='%d' bottom='%d' angle='%f' loop='%d' \
//widthmetric='%d' heightmetric='%d' file='%ls' begin='%f' end='%f' >",
// (LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom, m_dRotate, m_bLoop,
// m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
// strFileName, m_dClipStartTime, m_dClipEndTime );
// std::wstring animations;
// if(!m_oAnimations.m_arAnimations.empty())
// {
// m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
// m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
// animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
// element += animations;
// }
// std::wstring timeLine;
// timeLine.Format ( L"<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> ", m_dStartTime, m_dEndTime );
// element += timeLine;
// element += L"</VideoStream>";
// return element;
// }
// inline std::wstring GetAudioStream ()
// {
// std::wstring element;
// element.Format(L"<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf' loop='%d' >", m_dStartTime, m_dEndTime - m_dStartTime, 100.0, m_bLoop);
// int lIndex = m_strVideoFileName.find(L"file:///");
// if (0 == lIndex)
// {
// m_strVideoFileName = m_strVideoFileName.substr(8);
// //m_strFileName.Replace('/', '\\');
// //m_strFileName.Replace(L"%20", L" ");
// }
// std::wstring strFileName = m_strVideoFileName;
// CorrectXmlString(strFileName);
// std::wstring source;
// source.Format(L"<Source StartTime='%lf' EndTime='%lf' FilePath='%ls'/>", m_dClipStartTime, m_dClipEndTime, strFileName);
// element += source;
// std::wstring animations;
// if(!m_oAnimations.m_arAnimations.empty()) // для audio только "media call's" - play - pause - stop
// {
// m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
// m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
// animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
// element += animations;
// }
// std::wstring timeLine;
// timeLine.Format ( L"<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> ", m_dStartTime, m_dEndTime );
// element += timeLine;
// element += L"</AudioSource>";
// return element;
// }
};
}

View File

@ -60,9 +60,52 @@ namespace NSPresentationEditor
*this = oSrc;
}
};
class CInteractiveInfo
{
public:
CInteractiveInfo()
{
m_bPresent = false;
}
CInteractiveInfo& operator=(const CInteractiveInfo& oSrc)
{
m_bPresent = oSrc.m_bPresent;
m_lType = oSrc.m_lType;
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;
m_strAudioFileName = oSrc.m_strAudioFileName;
m_strHyperlink = oSrc.m_strHyperlink;
return *this;
}
CInteractiveInfo(const CInteractiveInfo& oSrc)
{
*this = oSrc;
}
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;
std::wstring m_strAudioFileName;
std::wstring m_strHyperlink;
};
class CTextInteractiveInfo
{
private:
long m_lType;
ASC_VARIANT m_varParameter;
@ -72,16 +115,15 @@ namespace NSPresentationEditor
std::vector<CTextRange> m_arRanges;
public:
CInteractiveInfo()
CTextInteractiveInfo()
{
m_bPresent = false;
}
~CInteractiveInfo()
~CTextInteractiveInfo()
{
}
CInteractiveInfo& operator=(const CInteractiveInfo& oSrc)
CTextInteractiveInfo& operator=(const CTextInteractiveInfo& oSrc)
{
m_lType = oSrc.m_lType;
m_varParameter = oSrc.m_varParameter;
@ -92,7 +134,7 @@ namespace NSPresentationEditor
return *this;
}
CInteractiveInfo(const CInteractiveInfo& oSrc)
CTextInteractiveInfo(const CTextInteractiveInfo& oSrc)
{
*this = oSrc;
}

View File

@ -629,12 +629,12 @@ public:
virtual HRESULT put_BrushType(const LONG& lType){ return S_OK; }
virtual HRESULT get_BrushColor1(LONG* lColor){ return S_OK; }
virtual HRESULT put_BrushColor1(const LONG& lColor){ return S_OK; }
virtual HRESULT get_BrushAlpha1(LONG* lAlpha)
virtual HRESULT get_BrushAlpha1(LONG* lAlpha){ return S_OK; }
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha)
{
m_bIsFillPart = (0 != lAlpha) ? true : false;
return S_OK;
m_bIsFillPart = (0 != lAlpha) ? true : false;
return S_OK;
}
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha){ return S_OK; }
virtual HRESULT get_BrushColor2(LONG* lColor){ return S_OK; }
virtual HRESULT put_BrushColor2(const LONG& lColor){ return S_OK; }
virtual HRESULT get_BrushAlpha2(LONG* lAlpha){ return S_OK; }

View File

@ -33,6 +33,7 @@
#include "./../BaseShape.h"
#include "CustomGeomShape.h"
#include "PPTShapeEnum.h"
#include "../../../../../../Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h"
using namespace NSOfficeDrawing;
using namespace NSPresentationEditor;
@ -53,6 +54,7 @@ public:
bool m_bIsFilled;
bool m_bIsStroked;
nullable<OOX::VmlOffice::CSignatureLine> m_oSignatureLine;
public:
CPPTShape() : CBaseShape(), m_arStringTextRects()
@ -278,6 +280,11 @@ public:
else
m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeSignature;
if (oNodeShapeType.GetNode(_T("o:signatureline"), oNodeSignature))
{
m_oSignatureLine = oNodeSignature;
}
ReCalculate();
return true;

View File

@ -72,7 +72,7 @@ namespace NSPresentationEditor
vector_string m_PlaceholdersReplaceString[3];
std::wstring m_strComment;
std::wstring m_sName;
public:
CSlide() : m_arElements(), m_oSlideShow()
{
Clear();
@ -154,7 +154,7 @@ namespace NSPresentationEditor
m_sName = oSrc.m_sName;
}
public:
void SetMetricInfo(const CMetricInfo& oInfo)
{
m_oInfo = oInfo;
@ -164,13 +164,6 @@ namespace NSPresentationEditor
m_lOriginalHeight = m_oInfo.m_lUnitsVer;
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
}
void SetUpPlaceholderStyles(NSPresentationEditor::CLayout* pLayout)
{
size_t nCountElements = m_arElements.size();

View File

@ -46,21 +46,19 @@ namespace NSPresentationEditor
bool m_bLoopSound; // зациклить аудио
bool m_bStopSound; // перед транзишном перестать играть все аудио до этого
double m_dSpeed; // длительность в миллисекундах
public:
int m_nSpeed;
CTransition() : m_oAudio()
{
m_bAudioPresent = false;
m_nEffectType = 0;
m_nEffectType = 0xff;
m_nEffectDirection = 0;
m_bLoopSound = false;
m_bStopSound = false;
m_dSpeed = 500.0;
m_nSpeed = 2;
}
~CTransition()
{
@ -76,7 +74,7 @@ namespace NSPresentationEditor
m_bLoopSound = oSrc.m_bLoopSound;
m_bStopSound = oSrc.m_bStopSound;
m_dSpeed = oSrc.m_dSpeed;
m_nSpeed = oSrc.m_nSpeed;
return *this;
}
@ -97,8 +95,6 @@ namespace NSPresentationEditor
bool m_bOnlyClick; // переход на следующий по щелчку
public:
CSlideShowInfo() : m_oTransition()
{
m_dSlideDuration = 30000.0;

View File

@ -329,7 +329,6 @@ namespace NSPresentationEditor
LONG m_lID;
public:
CElemInfo()
{
m_bIsBackground = false;

View File

@ -58,10 +58,12 @@ namespace NSBinPptxRW
std::vector<PPTX::Slide> m_arSlides;
std::vector<LONG> m_arSlides_Layout;
std::vector<LONG> m_arSlides_Notes;
std::vector<PPTX::NotesMaster> m_arNotesMasters;
std::vector<PPTX::NotesSlide> m_arNotesSlides;
std::vector<LONG> m_arNotesSlides_Master;
std::vector<LONG> m_arNotesMasters_Theme;
PPTX::Presentation m_oPresentation;
PPTX::TableStyles m_oTableStyles;
@ -175,10 +177,9 @@ namespace NSBinPptxRW
std::map<BYTE, LONG>::iterator pPair;
// writer
CXmlWriter oXmlWriter;
// первым делом определим количество необходимого. если хоть одно из этих чисел - ноль, то ппту не корректный
// первым делом определим количество необходимого. если хоть одно из этих чисел - ноль, то ппту не корректный
LONG nCountThemes = 0;
LONG nCountMasters = 0;
LONG nCountLayouts = 0;
@ -214,7 +215,7 @@ namespace NSBinPptxRW
return;
}
// теперь создадим массивы для рельсов
// теперь создадим массивы для рельсов
for (LONG i = 0; i < nCountMasters; ++i)
{
_slideMasterInfo elm;
@ -226,8 +227,11 @@ namespace NSBinPptxRW
}
for (LONG i = 0; i < nCountSlides; ++i)
m_arSlides_Layout.push_back(0);
for (LONG i = 0; i < nCountSlides; ++i)
m_arSlides_Notes.push_back(-1);
// ThemeRels
// ThemeRels
pPair = m_mainTables.find(NSMainTables::ThemeRels);
if (m_mainTables.end() != pPair)
{
@ -242,7 +246,7 @@ namespace NSBinPptxRW
}
}
// нужно проставить всем шаблонам мастер.
// нужно проставить всем шаблонам мастер.
for (LONG i = 0; i < nCountMasters; ++i)
{
size_t _countL = m_arSlideMasters_Theme[i].m_arLayouts.size();
@ -252,7 +256,7 @@ namespace NSBinPptxRW
}
}
// готово, теперь нужно слайдам проставить шаблоны
// готово, теперь нужно слайдам проставить шаблоны
pPair = m_mainTables.find(NSMainTables::SlideRels);
if (m_mainTables.end() != pPair)
{
@ -271,11 +275,46 @@ namespace NSBinPptxRW
m_arSlides_Layout[index++] = m_oReader.GetULong();
}
}
pPair = m_mainTables.find(NSMainTables::SlideNotesRels);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
m_oReader.Skip(6); // type + len + start attr
// теперь нужно удалить все themes, которые не ведут на мастерслайд
size_t index =0;
while (true)
{
BYTE _at = m_oReader.GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
//m_arSlides_Layout[_at] = m_oReader.GetULong(); тут прописан не индекс, а тип - смотри - oBinaryWriter.WriteInt1(0, oBinaryWriter.m_pCommon->m_oSlide_Layout_Rels[i]);
if (index < m_arSlides_Notes.size())
m_arSlides_Notes[index++] = m_oReader.GetULong();
}
}
pPair = m_mainTables.find(NSMainTables::NotesMastersRels);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
m_oReader.Skip(6); // type + len + start attr
size_t index =0;
while (true)
{
BYTE _at = m_oReader.GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
m_arNotesMasters_Theme.push_back( m_oReader.GetULong());
}
}
// теперь нужно удалить все themes, которые не ведут на мастерслайды
std::vector<LONG> arThemes;
std::vector<LONG> arThemesDst;
std::vector<bool> arThemesSave;
for (LONG i = 0; i < nCountThemes; ++i)
{
arThemes.push_back(i);
@ -286,6 +325,11 @@ namespace NSBinPptxRW
{
arThemesSave[m_arSlideMasters_Theme[i].m_lThemeIndex] = true;
}
for (size_t i = 0; i < m_arNotesMasters_Theme.size(); i++)
{
arThemesSave[m_arNotesMasters_Theme[i]] = true;
}
LONG lCurrectTheme = 0;
for (LONG i = 0; i < nCountMasters; ++i)
{
@ -298,9 +342,8 @@ namespace NSBinPptxRW
for (LONG i = 0; i < nCountMasters; ++i)
{
m_arSlideMasters_Theme[i].m_lThemeIndex = arThemesDst[i];
}
// themes
}
// themes
pPair = m_mainTables.find(NSMainTables::Themes);
if (m_mainTables.end() != pPair)
{
@ -343,7 +386,7 @@ namespace NSBinPptxRW
}
}
// slideMasters
// slideMasters
pPair = m_mainTables.find(NSMainTables::SlideMasters);
if (m_mainTables.end() != pPair)
{
@ -396,7 +439,7 @@ namespace NSBinPptxRW
}
}
// slideLayouts
// slideLayouts
pPair = m_mainTables.find(NSMainTables::SlideLayouts);
if (m_mainTables.end() != pPair)
{
@ -431,8 +474,99 @@ namespace NSBinPptxRW
m_oReader.m_pRels->SaveRels(pathFileRels.GetPath());
}
}
// notes
pPair = m_mainTables.find(NSMainTables::NotesSlides);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
LONG lCount = m_oReader.GetLong();
// slides
if ( lCount > 0 )
{
OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("notesSlides");
OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels");
NSDirectory::CreateDirectory (pathFolder.GetPath());
NSDirectory::CreateDirectory (pathFolderRels.GetPath());
for (LONG i = 0; i < lCount; ++i)
{
PPTX::NotesSlide elm;
m_arNotesSlides.push_back(elm);
m_oReader.m_pRels->Clear();
size_t indexSlide = 0;
for (indexSlide = 0; indexSlide < m_arSlides_Notes.size(); indexSlide++)
{//todooo -> make map
if (m_arSlides_Notes[indexSlide] == i)
{
break;
}
}
m_oReader.m_pRels->StartNotes(indexSlide);
m_arNotesSlides[i].fromPPTY(&m_oReader);
m_oReader.m_pRels->CloseRels();
std::wstring strNotesXml = L"notesSlide" + std::to_wstring(i + 1) + L".xml";
oXmlWriter.ClearNoAttack();
m_arNotesSlides[i].toXmlWriter(&oXmlWriter);
OOX::CPath pathFile = pathFolder + FILE_SEPARATOR_STR + strNotesXml;
oXmlWriter.SaveToFile(pathFile.GetPath());
OOX::CPath pathFileRels = pathFolderRels + FILE_SEPARATOR_STR + strNotesXml + _T(".rels");
m_oReader.m_pRels->SaveRels(pathFileRels.GetPath());
}
}
}
// noteMasters
pPair = m_mainTables.find(NSMainTables::NotesMasters);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
LONG lCount = m_oReader.GetLong();
if (lCount > 0 || m_arNotesSlides.size() > 0)//один элемент
{
OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("notesMasters");
OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels");
NSDirectory::CreateDirectory(pathFolder.GetPath());
NSDirectory::CreateDirectory(pathFolderRels.GetPath());
PPTX::NotesMaster elm;
m_arNotesMasters.push_back(elm);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartNotesMaster(m_arSlideMasters_Theme.size());
if (lCount > 0)
{
m_arNotesMasters.back().fromPPTY(&m_oReader);
m_oReader.m_pRels->CloseRels();
std::wstring strMasterNotesXml = L"notesMaster1.xml";
oXmlWriter.ClearNoAttack();
m_arNotesMasters.back().toXmlWriter(&oXmlWriter);
OOX::CPath pathFile = pathFolder + FILE_SEPARATOR_STR + strMasterNotesXml;
oXmlWriter.SaveToFile(pathFile.GetPath());
OOX::CPath pathFileRels = pathFolderRels + FILE_SEPARATOR_STR + strMasterNotesXml + _T(".rels");
m_oReader.m_pRels->SaveRels(pathFileRels.GetPath());
}
else
{
CreateDefaultNotesMasters(m_arSlideMasters_Theme.size());
}
}
}
// slides
int nComment = 1;
pPair = m_mainTables.find(NSMainTables::Slides);
if (m_mainTables.end() != pPair)
@ -452,7 +586,7 @@ namespace NSBinPptxRW
m_arSlides.push_back(elm);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartSlide(i, m_arSlides_Layout[i]);
m_oReader.m_pRels->StartSlide(i, m_arSlides_Layout[i], m_arSlides_Notes[i]);
m_arSlides[i].fromPPTY(&m_oReader);
if (m_arSlides[i].comments.is_init())
@ -488,71 +622,6 @@ namespace NSBinPptxRW
m_oReader.m_pRels->SaveRels(pathFileRels.GetPath());
}
}
if (false)
{
// noteMasters
pPair = m_mainTables.find(NSMainTables::NotesMasters);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
LONG lCount = m_oReader.GetLong();
for (LONG i = 0; i < lCount; ++i)
{
PPTX::NotesMaster elm;
m_arNotesMasters.push_back(elm);
m_arNotesMasters[i].fromPPTY(&m_oReader);
}
}
// notes
pPair = m_mainTables.find(NSMainTables::NotesSlides);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
LONG lCount = m_oReader.GetLong();
for (LONG i = 0; i < lCount; ++i)
{
PPTX::NotesSlide elm;
m_arNotesSlides.push_back(elm);
m_arNotesSlides[i].fromPPTY(&m_oReader);
}
}
}
else
{
// create default
CreateDefaultNotesMasters((int)m_arThemes.size() + 1);
CreateDefaultNote();
OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("notesSlides");
OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels");
NSDirectory::CreateDirectory (pathFolder.GetPath());
NSDirectory::CreateDirectory (pathFolderRels.GetPath());
LONG lCount = (LONG)m_arSlides.size();
for (LONG i = 0; i < lCount; ++i)
{
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartNote(i);
m_oReader.m_pRels->CloseRels();
std::wstring strMasterXml = L"notesSlide" + std::to_wstring(i + 1) + L".xml";
oXmlWriter.ClearNoAttack();
m_oDefaultNote.toXmlWriter(&oXmlWriter);
OOX::CPath pathFile = pathFolder + FILE_SEPARATOR_STR + strMasterXml;
oXmlWriter.SaveToFile(pathFile.GetPath());
OOX::CPath pathFileRels = pathFolderRels + FILE_SEPARATOR_STR + strMasterXml + _T(".rels");
m_oReader.m_pRels->SaveRels(pathFileRels.GetPath());
}
}
if (false)
{
// app
@ -595,15 +664,13 @@ namespace NSBinPptxRW
m_oViewProps.fromPPTY(&m_oReader);
}
//CreateDefaultPresProps();
}
else
{
// create default
CreateDefaultApp();
CreateDefaultCore();
//CreateDefaultPresProps();
//CreateDefaultTableStyles();
CreateDefaultViewProps();
// presProps
@ -760,15 +827,13 @@ namespace NSBinPptxRW
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.extended-properties+xml", L"/docProps", L"app.xml");
// themes
for (LONG i = 0; i < (LONG)m_arThemes.size(); ++i)
for (size_t i = 0; i < m_arThemes.size(); ++i)
{
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.theme+xml", L"/ppt/theme", L"theme" + std::to_wstring(i + 1) + L".xml");
}
if (true)
{
// notes theme
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.theme+xml", L"/ppt/theme", L"theme" + std::to_wstring((int)m_arThemes.size() + 1) + L".xml");
// notes master
if (!m_arNotesMasters.empty())
{
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml", L"/ppt/notesMasters", L"notesMaster1.xml");
}
@ -785,13 +850,13 @@ namespace NSBinPptxRW
}
// slides
for (LONG i = 0; i < nCountSlides; ++i)
for (size_t i = 0; i < m_arSlides.size(); ++i)
{
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml", L"/ppt/slides", L"slide" + std::to_wstring(i + 1) + L".xml");
}
// notes
for (LONG i = 0; i < nCountSlides; ++i)
for (size_t i = 0; i < m_arNotesSlides.size(); ++i)
{
pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", L"/ppt/notesSlides", L"notesSlide" + std::to_wstring(i + 1) + L".xml");
}

View File

@ -104,16 +104,14 @@ namespace NSShapeImageGen
return *this;
}
void SetNameModificator(NSShapeImageGen::ImageType eType, bool bOle)
void SetNameModificator(NSShapeImageGen::ImageType eType, int typeAdditionalFile )
{
std::wstring sPrefix;
int nRes = 0;
if(itWMF == eType)
nRes += 1;
if(itEMF == eType)
nRes += 2;
if(bOle)
nRes += 4;
if(itWMF == eType) nRes += 1;
if(itEMF == eType) nRes += 2;
if(typeAdditionalFile == 1) nRes += 4;
if(typeAdditionalFile == 2) nRes += 8;
if(0 != nRes)
m_sName = L"display" + std::to_wstring(nRes) + L"image";
}
@ -199,7 +197,7 @@ namespace NSShapeImageGen
return GenerateImageID(punkImage, (std::max)(1.0, width), (std::max)(1.0, height));
}
CImageInfo WriteImage(const std::wstring& strFile, const std::wstring& strOleFile, double& x, double& y, double& width, double& height)
CImageInfo WriteImage(const std::wstring& strFile, double& x, double& y, double& width, double& height, const std::wstring& strAdditionalFile, int typeAdditionalFile)
{
bool bIsDownload = false;
int n1 = (int)strFile.find (L"www");
@ -215,16 +213,16 @@ namespace NSShapeImageGen
if (bIsDownload)
{
std::wstring strFile1 = strFile;
std::wstring strFileUrl = strFile;
XmlUtils::replace_all(strFile1, L"\\", L"/");
XmlUtils::replace_all(strFile1, L"http:/", L"http://");
XmlUtils::replace_all(strFile1, L"https:/", L"https://");
XmlUtils::replace_all(strFile1, L"ftp:/", L"ftp://");
XmlUtils::replace_all(strFileUrl, L"\\", L"/");
XmlUtils::replace_all(strFileUrl, L"http:/", L"http://");
XmlUtils::replace_all(strFileUrl, L"https:/", L"https://");
XmlUtils::replace_all(strFileUrl, L"ftp:/", L"ftp://");
CImageInfo oInfo;
std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.find(strFile1);
std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.find(strFileUrl);
if (pPair != m_mapImagesFile.end())
return pPair->second;
@ -233,7 +231,7 @@ namespace NSShapeImageGen
#ifndef DISABLE_FILE_DOWNLOADER
CFileDownloader oDownloader(strFile1, true);
CFileDownloader oDownloader(strFileUrl, true);
if (oDownloader.DownloadSync())
{
strDownload = oDownloader.GetFilePath();
@ -241,21 +239,23 @@ namespace NSShapeImageGen
#endif
return GenerateImageID(strDownload, strFile1, strOleFile, (std::max)(1.0, width), (std::max)(1.0, height));
return GenerateImageID(strDownload, strFileUrl, (std::max)(1.0, width), (std::max)(1.0, height), strAdditionalFile, typeAdditionalFile);
}
CImageInfo info;
CFile oFile;
if (S_OK != oFile.OpenFile(strFile))
return info;
if (strAdditionalFile.empty())
{
CImageInfo info;
CFile oFile;
if (S_OK != oFile.OpenFile(strFile))
return info;
oFile.CloseFile();
}
oFile.CloseFile();
if (-1 == width && -1 == height)
return GenerateImageID(strFile, L"", strOleFile, width, height);
return GenerateImageID(strFile, L"", strOleFile, (std::max)(1.0, width), (std::max)(1.0, height));
if (width < 0 && height < 0) return GenerateImageID(strFile, L"", -1, -1, strAdditionalFile, typeAdditionalFile);
return GenerateImageID(strFile, L"", (std::max)(1.0, width), (std::max)(1.0, height), strAdditionalFile, typeAdditionalFile);
}
void SetFontManager(CFontManager* pFontManager)
{
@ -413,12 +413,12 @@ namespace NSShapeImageGen
return oInfo;
}
CImageInfo GenerateImageID(const std::wstring& strFileName, const std::wstring & strUrl, const std::wstring& strOleFile, double dWidth, double dHeight)
CImageInfo GenerateImageID(const std::wstring& strFileName, const std::wstring & strUrl, double dWidth, double dHeight, const std::wstring& strAdditionalFile, int typeAdditionalFile)
{
std::wstring sMapKey = strFileName;
if(!strUrl.empty()) sMapKey = strUrl;
if(!strOleFile.empty()) sMapKey += strOleFile;
if(!strAdditionalFile.empty()) sMapKey += strAdditionalFile;
CImageInfo oInfo;
std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.find(sMapKey);
@ -434,26 +434,30 @@ namespace NSShapeImageGen
LONG lImageType = m_oImageExt.GetImageType(strFileName);
bool bVector = (1 == lImageType || 2 == lImageType);
bool bOle = !strOleFile.empty();
bool bOle = !strAdditionalFile.empty() && (typeAdditionalFile == 1);
bool bMedia = !strAdditionalFile.empty() && (typeAdditionalFile == 2);
if(bVector)
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
oInfo.SetNameModificator(oInfo.m_eType, bOle);
oInfo.SetNameModificator(oInfo.m_eType, typeAdditionalFile);
std::wstring strSaveDir = m_strDstMedia + FILE_SEPARATOR_STR;
std::wstring strSaveItemWE = strSaveDir + std::wstring(oInfo.GetPathWithoutExtension());
//copy ole bin
if(bOle)
//copy ole bin or media
if(bOle || bMedia)
{
std::wstring strExts = _T(".bin");
int nIndexExt = (int)strOleFile.rfind(wchar_t('.'));
std::wstring strExts;
int nIndexExt = (int)strAdditionalFile.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strOleFile.substr(nIndexExt);
strExts = strAdditionalFile.substr(nIndexExt);
std::wstring sCopyOlePath = strSaveItemWE + strExts;//L".bin";
CDirectory::CopyFile(strOleFile, sCopyOlePath);
if(bOle && strExts.empty()) strExts = L".bin";
std::wstring sCopyOlePath = strSaveItemWE + strExts;
CDirectory::CopyFile(strAdditionalFile, sCopyOlePath);
}
if (bVector)

View File

@ -86,12 +86,12 @@ namespace PPTX
void FileContainer::read(const OOX::CPath& filename)
{
//not implement FileContainer.read
//OOX::IFileContainer::read(filename);
}
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path)
{
//not implement FileContainer.read
//OOX::IFileContainer::read(rels, path);
}
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
{
@ -157,8 +157,6 @@ namespace PPTX
pContainer->read(normPath, map, Event);
m_bCancelled = pContainer->m_bCancelled;
}
//todo детально разобраться и вернуть проверку res.(до перехода на cross platform все было хорошо)
//на презентация с hyperlink выходим при достижении 100%. Проценты считаются от количества обработанных файлов, а hyperlink не файл(Ligninger_og_uligheder.pptx)
if (m_bCancelled)
{
break;

View File

@ -187,8 +187,25 @@ namespace PPTX
break;
}
case BULLET_TYPE_BULLET_BLIP:
// TODO:
break;
{
pReader->Skip(5); // len + type + start attr
Logic::BuBlip *pBuBlip = new Logic::BuBlip();
pBuBlip->blip.fromPPTY(pReader);
if (pBuBlip->blip.embed.IsInit())
{
m_Bullet.reset(pBuBlip);
}
else
{//??? сбой ???
delete pBuBlip;
Logic::BuChar *pBuChar = new Logic::BuChar();
pBuChar->Char = wchar_t(L'\x2022');
m_Bullet.reset(pBuChar);
}
}break;
default:
m_Bullet.reset(new Logic::BuNone());
break;

View File

@ -44,7 +44,11 @@ namespace PPTX
{
public:
WritingElement_AdditionConstructors(ClrMap)
PPTX_LOGIC_BASE2(ClrMap)
ClrMap(std::wstring name = L"p:clrMap")
{
m_name = name;
}
virtual OOX::EElementType getType() const
{

View File

@ -165,12 +165,26 @@ namespace PPTX
XmlUtils::CAttribute oAttr;
XmlUtils::CNodeValue oValue;
return XmlUtils::CreateNode(_T("p:ext"), oValue);
return XmlUtils::CreateNode(L"p:ext", oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
// TODO:
if (link.IsInit() && uri.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", *uri);
pWriter->EndAttributes();
pWriter->StartNode(L"p14:media");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"xmlns:p14", std::wstring(L"http://schemas.microsoft.com/office/powerpoint/2010/main"));
pWriter->WriteAttribute(L"r:embed", link->get());
pWriter->EndAttributes();
pWriter->EndNode(L"p14:media");
pWriter->EndNode(L"p:ext");
}
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const

View File

@ -156,5 +156,230 @@ namespace PPTX
return L"";
}
void Blip::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring strName = (_T("") == m_namespace) ? _T("blip") : (m_namespace + _T(":blip"));
pWriter->StartNode(strName);
pWriter->StartAttributes();
if (embed.IsInit())
pWriter->WriteAttribute(_T("r:embed"), embed->ToString());
if (link.IsInit())
pWriter->WriteAttribute(_T("r:link"), link->ToString());
pWriter->WriteAttribute(_T("cstate"), cstate);
pWriter->EndAttributes();
// TODO:
size_t nCount = Effects.size();
for (size_t i = 0; i < nCount; ++i)
{
Effects[i].toXmlWriter(pWriter);
}
pWriter->EndNode(strName);
}
void Blip::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteLimit2(0, cstate);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
if (embed.is_init())
pWriter->WriteString1(10, embed->get());
if (link.is_init())
pWriter->WriteString1(11, link->get());
pWriter->StartRecord(2);
ULONG len = (ULONG)Effects.size();
pWriter->WriteULONG(len);
for (ULONG i = 0; i < len; ++i)
{
pWriter->WriteRecord1(3, Effects[i]);
}
pWriter->EndRecord();
double dX = pWriter->GetShapeX(); //mm
double dY = pWriter->GetShapeY();
double dW = pWriter->GetShapeWidth(); //mm
double dH = pWriter->GetShapeHeight();
OOX::IFileContainer* pRels = NULL;
if (pWriter->m_pCurrentContainer->is_init())
pRels = pWriter->m_pCurrentContainer->operator ->();
std::wstring additionalPath;
int additionalType = 0;
if(!oleFilepathBin.empty())
{
additionalPath = oleFilepathBin;
additionalType = 1;
}
else if(!oleRid.empty())
{
additionalPath = this->GetFullOleName(OOX::RId(oleRid), pRels);
additionalType = 1;
}
else if(!mediaRid.empty())
{
additionalPath = this->GetFullOleName(OOX::RId(mediaRid), pRels);
additionalType = 2;
}
else if(!mediaFilepath.empty())
{
additionalPath = mediaFilepath;
additionalType = 2;
}
std::wstring imagePath;
if(!oleFilepathImage.empty())
{
imagePath = oleFilepathImage;
}
else
{
imagePath = this->GetFullPicName(pRels);
}
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(imagePath, dX, dY, dW, dH, additionalPath, additionalType);
std::wstring s = oId.GetPath2();
pWriter->StartRecord(3);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString1(0, s);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->EndRecord();
}
void Blip::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _s2 = pReader->GetPos();
LONG _e2 = _s2 + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
break;
if (_at == 0)
pReader->Skip(1);
}
while (pReader->GetPos() < _e2)
{
BYTE _t = pReader->GetUChar();
switch (_t)
{
case 0:
case 1:
{
// id. embed / link
pReader->Skip(4);
break;
}
case 10:
case 11:
{
// id. embed / link
pReader->GetString2();
break;
}
case 2:
{
pReader->Skip(4);
ULONG count_effects = pReader->GetULong();
for (ULONG _eff = 0; _eff < count_effects; ++_eff)
{
pReader->Skip(1); // type
ULONG rec_len = pReader->GetULong();
if (0 == rec_len)
continue;
BYTE rec = pReader->GetUChar();
if (rec == EFFECT_TYPE_ALPHAMODFIX)
{
// alpha!!!
LONG _e22 = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // startattr
PPTX::Logic::AlphaModFix* pEffect = new PPTX::Logic::AlphaModFix();
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
break;
if (_at == 0)
pEffect->amt = pReader->GetLong();
}
Effects.push_back(UniEffect());
Effects[0].InitPointer(pEffect);
pReader->Seek(_e22);
}
else
{
pReader->SkipRecord();
}
}
break;
}
case 3:
{
pReader->Skip(6); // len + start attributes + type
std::wstring strImagePath = pReader->GetString2();
if (0 != strImagePath.find(_T("http:")) &&
0 != strImagePath.find(_T("https:")) &&
0 != strImagePath.find(_T("ftp:")) &&
0 != strImagePath.find(_T("file:")))
{
if (0 == strImagePath.find(_T("theme")))
{
strImagePath = pReader->m_strFolderExternalThemes + FILE_SEPARATOR_STR + strImagePath;
}
else
{
strImagePath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strImagePath;
}
OOX::CPath pathUrl = strImagePath;
strImagePath = pathUrl.GetPath();
}
smart_ptr<OOX::File> additionalFile;
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, additionalFile, L"", L"");
if (oRelsGeneratorInfo.nImageRId > 0)
{
embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
}
pReader->Skip(1); // end attribute
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(_e2);
}
} // namespace Logic
} // namespace PPTX

View File

@ -63,16 +63,22 @@ namespace PPTX
link = oSrc.link;
m_namespace = oSrc.m_namespace;
oleRid = oSrc.oleRid;
oleFilepathBin = oSrc.oleFilepathBin;
mediaRid = oSrc.mediaRid;
mediaFilepath = oSrc.mediaFilepath;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_blip;
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
@ -81,96 +87,12 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cstate"), cstate )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring strName = (_T("") == m_namespace) ? _T("blip") : (m_namespace + _T(":blip"));
pWriter->StartNode(strName);
pWriter->StartAttributes();
if (embed.IsInit())
pWriter->WriteAttribute(_T("r:embed"), embed->ToString());
if (link.IsInit())
pWriter->WriteAttribute(_T("r:link"), link->ToString());
pWriter->WriteAttribute(_T("cstate"), cstate);
pWriter->EndAttributes();
// TODO:
size_t nCount = Effects.size();
for (size_t i = 0; i < nCount; ++i)
{
Effects[i].toXmlWriter(pWriter);
}
pWriter->EndNode(strName);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteLimit2(0, cstate);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
if (embed.is_init())
pWriter->WriteString1(10, embed->get());
if (link.is_init())
pWriter->WriteString1(11, link->get());
pWriter->StartRecord(2);
ULONG len = (ULONG)Effects.size();
pWriter->WriteULONG(len);
for (ULONG i = 0; i < len; ++i)
{
pWriter->WriteRecord1(3, Effects[i]);
}
pWriter->EndRecord();
double dX = pWriter->GetShapeX(); //mm
double dY = pWriter->GetShapeY();
double dW = pWriter->GetShapeWidth(); //mm
double dH = pWriter->GetShapeHeight();
OOX::IFileContainer* pRels = NULL;
if (pWriter->m_pCurrentContainer->is_init())
pRels = pWriter->m_pCurrentContainer->operator ->();
std::wstring olePath;
if(!oleFilepathBin.empty())
{
olePath = oleFilepathBin;
}
else if(!oleRid.empty())
{
olePath= this->GetFullOleName(OOX::RId(oleRid), pRels);
}
std::wstring imagePath;
if(!oleFilepathImage.empty())
{
imagePath = oleFilepathImage;
}
else
{
imagePath = this->GetFullPicName(pRels);
}
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(imagePath, olePath, dX, dY, dW, dH);
std::wstring s = oId.GetPath2();
pWriter->StartRecord(3);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString1(0, s);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->EndRecord();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
virtual std::wstring GetFullPicName(OOX::IFileContainer* pRels = NULL)const;
virtual std::wstring GetFullOleName(const OOX::RId& pRId, OOX::IFileContainer* pRels = NULL)const;
@ -180,9 +102,11 @@ namespace PPTX
nullable<OOX::RId> embed;
nullable<OOX::RId> link;
std::wstring m_namespace;
//internal
std::wstring mediaRid;
std::wstring mediaFilepath;
std::wstring oleRid;
//internal
std::wstring oleFilepathBin;
std::wstring oleFilepathImage;
protected:

View File

@ -69,6 +69,9 @@ namespace PPTX
dpi = oSrc.dpi;
rotWithShape = oSrc.rotWithShape;
additionalFile = oSrc.additionalFile;
oleData = oSrc.oleData;
m_namespace = oSrc.m_namespace;
return *this;
}
@ -432,10 +435,10 @@ namespace PPTX
strImagePath = pathUrl.GetPath();
}
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, oleFile, oleData, strOrigBase64);
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, additionalFile, oleData, strOrigBase64);
// -------------------
if (strTempFile != _T(""))
if (!strTempFile.empty())
{
CDirectory::DeleteFile(strTempFile);
}
@ -444,15 +447,22 @@ namespace PPTX
if (!blip.is_init())
blip = new PPTX::Logic::Blip();
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
blip->oleFilepathImage = oRelsGeneratorInfo.sFilepathImage;
if (oRelsGeneratorInfo.nImageRId > 0)
{
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
}
if(oRelsGeneratorInfo.nOleRId > 0)
{
blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.nOleRId).get();
blip->oleFilepathBin = oRelsGeneratorInfo.sFilepathOle;
blip->oleFilepathImage = oRelsGeneratorInfo.sFilepathImage;
}
if(oRelsGeneratorInfo.nMediaRId > 0)
{
blip->mediaRid = OOX::RId((size_t)oRelsGeneratorInfo.nMediaRId).get();
blip->mediaFilepath = oRelsGeneratorInfo.sFilepathMedia;
}
pReader->Skip(1); // end attribute
break;
}
@ -507,8 +517,8 @@ namespace PPTX
nullable_bool rotWithShape;
//internal
smart_ptr<OOX::OleObject> oleFile;
std::wstring oleData;
mutable smart_ptr<OOX::File> additionalFile;
std::wstring oleData;
protected:
virtual void FillParentPointersForChilds()
{

View File

@ -45,8 +45,9 @@ namespace PPTX
public:
WritingElement_AdditionConstructors(MediaFile)
MediaFile()
MediaFile(std::wstring name_)
{
name = name_;
}
MediaFile& operator=(const MediaFile& oSrc)
@ -75,19 +76,28 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:link"), link)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("contentType"), contentType)
WritingElement_ReadAttributes_Read_if ( oReader, L"r:link", link)
WritingElement_ReadAttributes_Read_else_if ( oReader, L"contentType", contentType)
WritingElement_ReadAttributes_End( oReader )
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("r:link"), link.ToString());
oAttr.Write(_T("contentType"), contentType);
oAttr.Write(L"r:link", link.ToString());
oAttr.Write(L"contentType", contentType);
return XmlUtils::CreateNode(_T("a:") + name, oAttr);
return XmlUtils::CreateNode(L"a:" + name, oAttr);
}
public:
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"a:" + name);
pWriter->StartAttributes();
pWriter->WriteAttribute (L"r:link", link.ToString());
pWriter->WriteAttribute (L"contentType", contentType);
pWriter->EndAttributes();
pWriter->EndNode(L"a:" + name);
}
std::wstring name;
OOX::RId link;
nullable_string contentType;

View File

@ -41,7 +41,10 @@
#include "Media/MediaFile.h"
#include "Media/WavAudioFile.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../../Common/DocxFormat/Source/MathEquation/MathEquation.h"
#include "../../../ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h"
@ -134,9 +137,11 @@ namespace PPTX
pWriter->WriteLimit2(4, m_oDrawAspect);
pWriter->WriteLimit2(5, m_oType);
pWriter->WriteLimit2(6, m_oUpdateMode);
if (ole_file.IsInit() == false || ole_file->isMsPackage() == false)
if (ole_file.IsInit() && ole_file->isMsPackage() == false)
{
pWriter->WriteString1(7, ole_file->filename().GetFilename()); //OleObject Binary FileName (bin, xls, doc, ... other stream file)
std::wstring sExt = ole_file->filename().GetExtention(false);
if (!sExt.empty())
pWriter->WriteString1(7, L"maskFile." + sExt); //OleObject Binary FileName Extension (bin, xls, doc, ... other stream file)
}
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
@ -608,6 +613,137 @@ namespace PPTX
return XmlUtils::CreateNode(m_namespace + L":pic", oValue);
}
void Pic::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
if(oleObject.IsInit())
{
pWriter->StartRecord(SPTREE_TYPE_OLE);
}
else if (nvPicPr.nvPr.media.is_init())
{
blipFill.additionalFile = GetMediaLink();
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit() && blipFill.blip.IsInit())
{
blipFill.blip->mediaFilepath = mediaFile->filename().GetPath();
}
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
else
pWriter->StartRecord(SPTREE_TYPE_PIC);
}
else
{
pWriter->StartRecord(SPTREE_TYPE_PIC);
}
if (blipFill.additionalFile.is<OOX::Media>())
{
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
pWriter->StartRecord(5);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
std::wstring sExt = mediaFile->filename().GetExtention(false);
if (!sExt.empty())
pWriter->WriteString1(0, L"maskFile." + sExt);
//todoo start, end positions ..
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->EndRecord();
}
pWriter->WriteRecord2(4, oleObject);
pWriter->WriteRecord1(0, nvPicPr);
pWriter->WriteRecord1(1, blipFill);
pWriter->WriteRecord1(2, spPr);
pWriter->WriteRecord2(3, style);
pWriter->EndRecord();
}
void Pic::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring namespace_ = m_namespace;
bool bOle = false;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
if(oleObject.IsInit() && oleObject->isValid())
{
bOle = true;
pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>");
if(spPr.xfrm.IsInit())
{
std::wstring oldNamespace = spPr.xfrm->m_ns;
spPr.xfrm->m_ns = _T("p");
spPr.xfrm->toXmlWriter(pWriter);
spPr.xfrm->m_ns = oldNamespace;
}
pWriter->WriteString(L"<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/presentationml/2006/ole\">");
pWriter->StartNode(_T("p:oleObj"));
pWriter->WriteAttribute(L"name", (std::wstring)L"oleObj");
if(oleObject->m_oId.IsInit())
{
pWriter->WriteAttribute2(L"r:id", oleObject->m_oId->get());
}
if(oleObject->m_oDxaOrig.IsInit())
{
int nDxaOrig = oleObject->m_oDxaOrig.get();
pWriter->WriteAttribute(L"imgW", 635 * nDxaOrig); //twips to emu
}
if(oleObject->m_oDyaOrig.IsInit())
{
int nDyaOrig = oleObject->m_oDyaOrig.get();
pWriter->WriteAttribute(L"imgH", 635 * nDyaOrig); //twips to emu
}
pWriter->WriteAttribute2(L"progId", oleObject->m_sProgId);
pWriter->EndAttributes();
pWriter->WriteString(L"<p:embed/>");
}
}
pWriter->StartNode(namespace_ + L":pic");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:pic"), (std::wstring)_T("http://schemas.openxmlformats.org/drawingml/2006/picture"));
}
pWriter->EndAttributes();
nvPicPr.toXmlWriter(pWriter);
blipFill.m_namespace = namespace_;
blipFill.toXmlWriter(pWriter);
pWriter->m_lFlag = 1;
spPr.toXmlWriter(pWriter);
pWriter->m_lFlag = 0;
pWriter->Write(style);
pWriter->EndNode(namespace_ + L":pic");
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
if(bOle)
{
pWriter->WriteString(L"</p:oleObj></a:graphicData></a:graphic></p:graphicFrame>");
}
}
}
void Pic::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
@ -621,9 +757,8 @@ namespace PPTX
{
case 0:
{
nvPicPr.fromPPTY(pReader);
break;
}
nvPicPr.fromPPTY(pReader);
}break;
case 1:
{
blipFill.fromPPTY(pReader);
@ -637,19 +772,23 @@ namespace PPTX
if (NSFile::CFileBinary::Exists(oleObject->m_OleObjectFile->filename().GetPath()) == false)
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin);
}
break;
}
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit() && blipFill.blip.IsInit())
{
if (NSFile::CFileBinary::Exists(mediaFile->filename().GetPath()) == false)
mediaFile->set_filename (blipFill.blip->mediaFilepath);
}
}break;
case 2:
{
spPr.fromPPTY(pReader);
break;
}
spPr.fromPPTY(pReader);
}break;
case 3:
{
style = new ShapeStyle(L"p");
style->fromPPTY(pReader);
break;
}
style->fromPPTY(pReader);
}break;
case 4:
{
oleObject = new COLEObject();
@ -658,15 +797,34 @@ namespace PPTX
if(oleObject->m_sData.IsInit())
blipFill.oleData = oleObject->m_sData.get();
blipFill.oleFile = oleObject->m_OleObjectFile;
blipFill.additionalFile = oleObject->m_OleObjectFile.smart_dynamic_cast<OOX::File>();
}break;
case 5:
{
LONG _end_rec1 = pReader->GetPos() + pReader->GetLong() + 4;
//if (oleObject->m_OleObjectFile.IsInit())
//{
// blipFill.olePath = oleObject->m_OleObjectFile->filename().GetPath();
// if (NSFile::CFileBinary::Exists(blipFill.olePath))
// blipFill.olePath.clear();
//}
break;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
if (0 == _at)
{
std::wstring strMediaFileMask = pReader->GetString2();
smart_ptr<OOX::Media> mediaFile = blipFill.additionalFile.smart_dynamic_cast<OOX::Media>();
if (mediaFile.IsInit())
{
mediaFile->set_filename(strMediaFileMask);
}
}
else
break;
}
pReader->Seek(_end_rec1);
}
default:
{
@ -674,16 +832,53 @@ namespace PPTX
}
}
}
if(blipFill.blip.IsInit() && !blipFill.blip->oleRid.empty() && oleObject.IsInit())
if(blipFill.blip.IsInit() && blipFill.additionalFile.IsInit())
{
oleObject->m_oId = OOX::RId(blipFill.blip->oleRid);
if (oleObject->m_OleObjectFile.IsInit() == false)
if (!blipFill.blip->oleRid.empty() && oleObject.IsInit())
{
oleObject->m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin);
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
oleObject->m_oId = OOX::RId(blipFill.blip->oleRid);
if (oleObject->m_OleObjectFile.IsInit() == false)
{
oleObject->m_OleObjectFile = new OOX::OleObject(false, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
oleObject->m_OleObjectFile->set_filename (blipFill.blip->oleFilepathBin);
oleObject->m_OleObjectFile->set_filename_cache (blipFill.blip->oleFilepathImage);
}
}
if (!blipFill.blip->mediaRid.empty())
{
PPTX::Logic::Ext ext;
ext.link = OOX::RId(blipFill.blip->mediaRid);
ext.uri = L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}";
nvPicPr.nvPr.extLst.push_back(ext);
int nRId = -1;
if (blipFill.additionalFile.is<OOX::Audio>())
{
nvPicPr.nvPr.media.Media = new PPTX::Logic::MediaFile(L"audioFile");
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio",
L"NULL", L"External");
}
if (blipFill.additionalFile.is<OOX::Video>())
{
nvPicPr.nvPr.media.Media = new PPTX::Logic::MediaFile(L"videoFile");
nRId = pReader->m_pRels->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video",
L"NULL", L"External");
}
if (nvPicPr.nvPr.media.Media.IsInit() && nRId > 0)
{
PPTX::Logic::MediaFile& mediaFile = nvPicPr.nvPr.media.Media.as<PPTX::Logic::MediaFile>();
mediaFile.link = OOX::RId((size_t)nRId);
}
if (nvPicPr.cNvPr.hlinkClick.IsInit() == false)
nvPicPr.cNvPr.hlinkClick.Init();
nvPicPr.cNvPr.hlinkClick->id = L"";
nvPicPr.cNvPr.hlinkClick->action = L"ppaction://media";
}
}
@ -726,57 +921,28 @@ namespace PPTX
return blipFill.blip->GetFullPicName();
return _T("");
}
std::wstring Pic::GetVideoLink()const
smart_ptr<OOX::File> Pic::GetMediaLink()const
{
std::wstring file = _T("");
if (parentFileIs<Slide>())
smart_ptr<OOX::File> file;
if (!parentFileIs<Slide>()) return file;
if (nvPicPr.nvPr.media.is<WavAudioFile>())
{
if (nvPicPr.nvPr.media.is<MediaFile>())
{
if ((nvPicPr.nvPr.media.as<MediaFile>().name == _T("videoFile")) || (nvPicPr.nvPr.media.as<MediaFile>().name == _T("quickTimeFile")))
{
file = parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get());
if (std::wstring (_T("NULL")) == file) // HAVE TRIM
{
if(nvPicPr.nvPr.extLst.size())
{
file = parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.extLst[0].link.get());
}
}
}
}
return parentFileAs<Slide>().Find(nvPicPr.nvPr.media.as<WavAudioFile>().embed.get());
}
return file;
}
std::wstring Pic::GetAudioLink()const
{
std::wstring file = _T("");
if (parentFileIs<Slide>())
if (nvPicPr.nvPr.media.is<MediaFile>())
{
if (nvPicPr.nvPr.media.is<WavAudioFile>())
file = parentFileAs<Slide>().Find(nvPicPr.nvPr.media.as<MediaFile>().link.get());
smart_ptr<OOX::Media> mediaFile = file.smart_dynamic_cast<OOX::Media>();
if ( mediaFile.IsInit() == false && !nvPicPr.nvPr.extLst.empty())
{
return parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<WavAudioFile>().embed.get());
}
if (nvPicPr.nvPr.media.is<MediaFile>())
{
if (nvPicPr.nvPr.media.as<MediaFile>().name == _T("audioFile"))
{
file = parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.media.as<MediaFile>().link.get());
if (std::wstring (_T("NULL")) == file) // HAVE TRIM
{
if(nvPicPr.nvPr.extLst.size())
{
file = parentFileAs<Slide>().GetLinkFromRId(nvPicPr.nvPr.extLst[0].link.get());
}
}
}
}
}
//todooo - почему везде нулевой то? - сделать по всем поиск по uri
file = parentFileAs<Slide>().Find(nvPicPr.nvPr.extLst[0].link.get());
}
}//удалять ли c UnknownType ???? (если не найден щас генерится)
return file;
}
@ -970,8 +1136,18 @@ namespace PPTX
}
}
if (spPr.Geometry.is_init())
bool bRect = bOle; //ole ВСЕГДА rect
if (spPr.Geometry.is<PPTX::Logic::PrstGeom>())
{
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
if( lpGeom.prst.get() == L"rect" )
bRect = true;
}
if (bRect == false)
{//custom vml shape
std::wstring strPath;
std::wstring strTextRect;
@ -1026,12 +1202,12 @@ namespace PPTX
}
if(bOle)
{
pWriter->WriteAttribute(L"filled", L"f");
pWriter->WriteAttribute(L"filled", (std::wstring)L"f");
}
std::wstring strNodeVal;
if (!spPr.ln.is_init())
{
pWriter->WriteAttribute(L"stroked", L"false");
pWriter->WriteAttribute(L"stroked", (std::wstring)L"false");
}
else
{
@ -1061,7 +1237,7 @@ namespace PPTX
{
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
}
pWriter->WriteAttribute(L"o:title", L"");
pWriter->WriteAttribute(L"o:title", (std::wstring)L"");
pWriter->EndAttributes();
pWriter->EndNode(L"v:imagedata");
}
@ -1097,8 +1273,8 @@ namespace PPTX
}
if(bOle)
{
pWriter->WriteAttribute(L"filled", L"f");
pWriter->WriteAttribute(L"stroked", L"f");
pWriter->WriteAttribute(L"filled", (std::wstring)L"f");
pWriter->WriteAttribute(L"stroked", (std::wstring)L"f");
}
pWriter->EndAttributes();
@ -1108,7 +1284,7 @@ namespace PPTX
pWriter->StartNode(L"v:imagedata");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
pWriter->WriteAttribute(L"o:title", L"");
pWriter->WriteAttribute(L"o:title", (std::wstring)L"");
pWriter->EndAttributes();
pWriter->EndNode(L"v:imagedata");
}
@ -1158,7 +1334,9 @@ namespace PPTX
}
if(oleObject->m_oId.IsInit())
{
blipFill.blip->oleRid = oleObject->m_oId.get().ToString();
if (blipFill.blip.IsInit() == false)
blipFill.blip.Init();
blipFill.blip->oleRid = oleObject->m_oId->get();
}
}
} // namespace Logic

View File

@ -237,127 +237,35 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
void fromXMLOle(XmlUtils::CXmlNode& node);
virtual void GetRect(Aggplus::RECT& pRect)const;
virtual std::wstring GetFullPicName()const;
virtual std::wstring GetVideoLink()const;
virtual std::wstring GetAudioLink()const;
smart_ptr<OOX::File> GetMediaLink()const;
DWORD GetFill(UniFill& fill)const;
DWORD GetLine(Ln& line)const;
double GetStTrim () const;
double GetEndTrim () const;
long GetRefId() const;
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
if(oleObject.IsInit())
{
pWriter->StartRecord(SPTREE_TYPE_OLE);
}
else
{
pWriter->StartRecord(SPTREE_TYPE_PIC);
}
pWriter->WriteRecord2(4, oleObject);
pWriter->WriteRecord1(0, nvPicPr);
pWriter->WriteRecord1(1, blipFill);
pWriter->WriteRecord1(2, spPr);
pWriter->WriteRecord2(3, style);
pWriter->EndRecord();
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring namespace_ = m_namespace;
bool bOle = false;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
if(oleObject.IsInit() && oleObject->isValid())
{
bOle = true;
pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>");
if(spPr.xfrm.IsInit())
{
std::wstring oldNamespace = spPr.xfrm->m_ns;
spPr.xfrm->m_ns = _T("p");
spPr.xfrm->toXmlWriter(pWriter);
spPr.xfrm->m_ns = oldNamespace;
}
pWriter->WriteString(L"<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/presentationml/2006/ole\">");
pWriter->StartNode(_T("p:oleObj"));
pWriter->WriteAttribute(L"name", (std::wstring)L"oleObj");
if(oleObject->m_oId.IsInit())
{
pWriter->WriteAttribute2(L"r:id", oleObject->m_oId->get());
}
if(oleObject->m_oDxaOrig.IsInit())
{
int nDxaOrig = oleObject->m_oDxaOrig.get();
pWriter->WriteAttribute(L"imgW", 635 * nDxaOrig); //twips to emu
}
if(oleObject->m_oDyaOrig.IsInit())
{
int nDyaOrig = oleObject->m_oDyaOrig.get();
pWriter->WriteAttribute(L"imgH", 635 * nDyaOrig); //twips to emu
}
pWriter->WriteAttribute2(L"progId", oleObject->m_sProgId);
pWriter->EndAttributes();
pWriter->WriteString(L"<p:embed/>");
}
}
pWriter->StartNode(namespace_ + L":pic");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:pic"), (std::wstring)_T("http://schemas.openxmlformats.org/drawingml/2006/picture"));
}
pWriter->EndAttributes();
nvPicPr.toXmlWriter(pWriter);
blipFill.m_namespace = namespace_;
blipFill.toXmlWriter(pWriter);
pWriter->m_lFlag = 1;
spPr.toXmlWriter(pWriter);
pWriter->m_lFlag = 0;
pWriter->Write(style);
pWriter->EndNode(namespace_ + L":pic");
if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
{
if(bOle)
{
pWriter->WriteString(L"</p:oleObj></a:graphicData></a:graphic></p:graphicFrame>");
}
}
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
void fromXMLOle(XmlUtils::CXmlNode& node);
//----------------------------------------------------------------------
NvPicPr nvPicPr;
BlipFill blipFill;
SpPr spPr;
nullable<ShapeStyle> style;
//internal
nullable<COLEObject> oleObject;
std::wstring m_namespace;
nullable<COLEObject> oleObject;
nullable_string m_sClientDataXml;
protected:
virtual void FillParentPointersForChilds();

View File

@ -357,8 +357,15 @@ namespace PPTX
txXfrm->fromPPTY(pReader);
break;
}
case 7:
{
signatureLine = new OOX::VmlOffice::CSignatureLine();
signatureLine->fromPPTY(pReader);
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
@ -402,7 +409,6 @@ namespace PPTX
pWriter->StartRecord(4);
pWriter->m_pMainDocument->getBinaryContentElem(OOX::et_w_sdtContent, oTextBoxShape.GetPointer(), *pWriter, lDataSize);
//pWriter->m_pMainDocument->getBinaryContent(TextBoxShape.get(), *pWriter, lDataSize);
pWriter->EndRecord();
if (oTextBoxBodyPr.is_init())
@ -412,6 +418,24 @@ namespace PPTX
pWriter->EndRecord();
}
}
else if (strTextBoxShape.is_init())//после конвертации старого шейпа (vml)
{
long lDataSize = 0;
ULONG lPos = pWriter->GetPosition();
pWriter->SetPosition(lPos);
pWriter->StartRecord(4);
pWriter->m_pMainDocument->getBinaryContent(strTextBoxShape.get(), *pWriter, lDataSize);
pWriter->EndRecord();
if (oTextBoxBodyPr.is_init())
{
pWriter->StartRecord(5);
oTextBoxBodyPr->toPPTY(pWriter);
pWriter->EndRecord();
}
}
else if (txBody.is_init())
{
std::wstring strContent = txBody->GetDocxTxBoxContent(pWriter, style);
@ -433,6 +457,7 @@ namespace PPTX
}
pWriter->WriteRecord2(6, txXfrm);
pWriter->WriteRecord2(7, signatureLine);
pWriter->EndRecord();
}
@ -505,7 +530,7 @@ namespace PPTX
}
}
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group)
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group, bool bSignature)
{
std::wstring strPath, strTextRect;
bool bOle = false;
@ -545,8 +570,8 @@ namespace PPTX
std::wstring strFillNode;
std::wstring strStrokeNode;;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle);
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle, bSignature);
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle, bSignature);
pWriter->StartNode(L"v:shape");
@ -637,7 +662,7 @@ namespace PPTX
//oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
//oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100);
//pWriter->WriteAttribute(L"coordsize", oStylesWriter.GetXmlString());
pWriter->WriteAttribute(L"coordsize", L"100000,100000");
pWriter->WriteAttribute(L"coordsize", (std::wstring)L"100000,100000");
pWriter->WriteAttribute(L"path", strPath);
}
@ -672,6 +697,10 @@ namespace PPTX
pWriter->WriteString(*strTextBoxShape); //??? todooo -> oTextBoxShape
pWriter->EndNode(L"v:textbox");
}
if (signatureLine.is_init())
{
signatureLine->toXmlWriter(pWriter);
}
pWriter->EndNode(L"v:shape");

View File

@ -44,6 +44,7 @@
#include "../../../ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Vml.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Sdt.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h"
namespace OOX
{
@ -308,7 +309,7 @@ namespace PPTX
void SetLevelUpElement( Shape* p){m_pLevelUp = p;};
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
void toXmlWriterVML (NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false, bool bSignature = false);
void toXmlWriterVMLBackground (NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap);
virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const;
@ -330,6 +331,7 @@ namespace PPTX
nullable<BodyPr> oTextBoxBodyPr;
nullable_bool attrUseBgFill;
nullable<OOX::VmlOffice::CSignatureLine> signatureLine;
protected:
virtual void FillParentPointersForChilds();
};

View File

@ -37,8 +37,11 @@
#include "CxnSp.h"
#include "SpTree.h"
#include "GraphicFrame.h"
#include "./../SlideMaster.h"
#include "../SlideMaster.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
namespace PPTX
{
namespace Logic
@ -56,7 +59,7 @@ namespace PPTX
}
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
{
PPTX::Logic::UniFill fill;
DWORD ARGB = 0;
@ -110,7 +113,7 @@ namespace PPTX
std::wstring strId = oBlip.blip->embed->ToString();
if(bOle)
if (bOle || bSignature)
{
strAttr = _T(" filled=\"f\"");
strNode = _T("<v:imagedata r:id=\"") + strId + _T("\" o:title=\"\" />");
@ -178,7 +181,7 @@ namespace PPTX
*/
}
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::Theme>& oTheme,
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle, bool bSignature)
{
PPTX::Logic::Ln line;
DWORD ARGB = 0;
@ -196,7 +199,7 @@ namespace PPTX
ARGB = line.Fill.as<SolidFill>().Color.GetRGBColor(oTheme, oClrMap, ARGB);
strAttr = _T(" strokecolor=\"") + GetHexColor(ARGB) + _T("\"");
}
else if (bOle)
else if (bOle || bSignature)
strAttr = _T(" stroked=\"f\"");
if (line.w.is_init())
@ -346,8 +349,22 @@ namespace PPTX
}
case SPTREE_TYPE_OLE:
case SPTREE_TYPE_PIC:
case SPTREE_TYPE_AUDIO:
case SPTREE_TYPE_VIDEO:
{
Logic::Pic* p = new Logic::Pic();
if (_type == SPTREE_TYPE_AUDIO)
{
OOX::Audio *pAudio = new OOX::Audio(pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
p->blipFill.additionalFile = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(pAudio));
}
else if (_type == SPTREE_TYPE_VIDEO)
{
OOX::Video* pVideo = new OOX::Video(pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX);
p->blipFill.additionalFile = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(pVideo));
}
p->fromPPTY(pReader);
m_elem.reset(p);
break;

View File

@ -44,10 +44,10 @@ namespace PPTX
namespace Logic
{
void CalculateFill(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, smart_ptr<PPTX::Theme>& oTheme,
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle,
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false);
smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle = false, bool bSignature = false);
class SpTreeElem : public WrapperWritingElement
{

View File

@ -46,9 +46,9 @@ namespace PPTX
public:
WritingElement_AdditionConstructors(TextListStyle)
TextListStyle()
TextListStyle(std::wstring name = L"a:lstStyle")
{
m_name = L"a:lstStyle";
m_name = name;
}
virtual void fromXML(XmlUtils::CXmlNode& node)

View File

@ -189,8 +189,8 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lvl"), lvl)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algn"), algn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("fontAlgn"),fontAlgn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marL"), marR)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marR"), marL)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marL"), marL)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marR"), marR)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("indent"), indent)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("defTabSz"),defTabSz)
WritingElement_ReadAttributes_End ( oReader )
@ -541,4 +541,4 @@ namespace PPTX
} // namespace Logic
} // namespace PPTX
#endif // PPTX_LOGIC_TEXTPARAGRAPHPR_INCLUDE_H_
#endif // PPTX_LOGIC_TEXTPARAGRAPHPR_INCLUDE_H_

View File

@ -48,17 +48,36 @@ namespace PPTX
public:
PPTX_LOGIC_BASE(Transition)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"advClick", advClick);
node.ReadAttributeBase(L"advTm", advTm);
node.ReadAttributeBase(L"p14:dur", dur);
node.ReadAttributeBase(L"spd", spd);
node.ReadAttributeBase(L"advTm", advTm);
node.ReadAttributeBase(L"p14:dur", dur);
node.ReadAttributeBase(L"spd", spd);
base.GetTransitionTypeFrom(node);
trSerialize.GetTransitionTypeFrom(node);
sndAc = node.ReadNode(_T("p:sndAc"));
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
{
int count = oNodes.GetCount();
for (int i = 0; i < count; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (strName == L"sndAc")
sndAc = oNode;
else
{
trSerialize.fromXML(oNode);
base.fromXML(oNode);
}
}
}
FillParentPointersForChilds();
}
@ -136,7 +155,6 @@ namespace PPTX
}
}
}
pReader->Seek(end);
}
@ -174,16 +192,14 @@ namespace PPTX
pWriter->WriteString(_T("</mc:Fallback></mc:AlternateContent>"));
}
TransitionBase base;
nullable<SndAc> sndAc;
public:
/*nullable<*/TransitionBase/*>*/ base;
nullable<SndAc> sndAc;
TransitionSerialize trSerialize;
TransitionSerialize trSerialize;
nullable_bool advClick;
nullable_int advTm;
nullable_int dur;
nullable_bool advClick;
nullable_int advTm;
nullable_int dur;
nullable_limit<Limit::TransitionSpeed> spd;
protected:
virtual void FillParentPointersForChilds()

View File

@ -66,103 +66,53 @@ namespace PPTX
return *this;
}
void TransitionBase::fromXML(XmlUtils::CXmlNode& node)
void TransitionBase::fromXML(XmlUtils::CXmlNode& oNode)
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
if (name == _T("random"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("circle"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("dissolve"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("diamond"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("newsflash"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("plus"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("wedge"))
base.reset(new Logic::EmptyTransition(node));
else if (name == _T("blinds"))
base.reset(new Logic::OrientationTransition(node));
else if (name == _T("checker"))
base.reset(new Logic::OrientationTransition(node));
else if (name == _T("comb"))
base.reset(new Logic::OrientationTransition(node));
else if (name == _T("randomBar"))
base.reset(new Logic::OrientationTransition(node));
else if (name == _T("cover"))
base.reset(new Logic::EightDirectionTransition(node));
else if (name == _T("pull"))
base.reset(new Logic::EightDirectionTransition(node));
else if (name == _T("cut"))
base.reset(new Logic::OptionalBlackTransition(node));
else if (name == _T("fade"))
base.reset(new Logic::OptionalBlackTransition(node));
else if (name == _T("push"))
base.reset(new Logic::SideDirectionTransition(node));
else if (name == _T("wipe"))
base.reset(new Logic::SideDirectionTransition(node));
else if (name == _T("strips"))
base.reset(new Logic::CornerDirectionTransition(node));
else if (name == _T("wheel"))
base.reset(new Logic::WheelTransition(node));
else if (name == _T("split"))
base.reset(new Logic::SplitTransition(node));
else if (name == _T("zoom"))
base.reset(new Logic::ZoomTransition(node));
else base.reset();
}
void TransitionBase::GetTransitionTypeFrom(XmlUtils::CXmlNode& element)
{
XmlUtils::CXmlNode oNode;
if(element.GetNode(_T("p:random"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:circle"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:dissolve"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:diamond"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:newsflash"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:plus"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:wedge"), oNode))
base.reset(new Logic::EmptyTransition(oNode));
else if(element.GetNode(_T("p:blinds"), oNode))
std::wstring strName = oNode.GetName();
if ( strName == L"p:blinds" ||
strName == L"p:checker" ||
strName == L"p:comb" ||
strName == L"p:randomBar")
{
base.reset(new Logic::OrientationTransition(oNode));
else if(element.GetNode(_T("p:checker"), oNode))
base.reset(new Logic::OrientationTransition(oNode));
else if(element.GetNode(_T("p:comb"), oNode))
base.reset(new Logic::OrientationTransition(oNode));
else if(element.GetNode(_T("p:randomBar"), oNode))
base.reset(new Logic::OrientationTransition(oNode));
else if(element.GetNode(_T("p:cover"), oNode))
}
else if ( strName == L"p:cover" ||
strName == L"p:pull")
{
base.reset(new Logic::EightDirectionTransition(oNode));
else if(element.GetNode(_T("p:pull"), oNode))
base.reset(new Logic::EightDirectionTransition(oNode));
else if(element.GetNode(_T("p:cut"), oNode))
}
else if ( strName == L"p:cut" ||
strName == L"p:fade")
{
base.reset(new Logic::OptionalBlackTransition(oNode));
else if(element.GetNode(_T("p:fade"), oNode))
base.reset(new Logic::OptionalBlackTransition(oNode));
else if(element.GetNode(_T("p:push"), oNode))
}
else if ( strName == L"p:push" ||
strName == L"p:wipe")
{
base.reset(new Logic::SideDirectionTransition(oNode));
else if(element.GetNode(_T("p:wipe"), oNode))
base.reset(new Logic::SideDirectionTransition(oNode));
else if(element.GetNode(_T("p:strips"), oNode))
}
else if ( strName == L"p:strips")
{
base.reset(new Logic::CornerDirectionTransition(oNode));
else if(element.GetNode(_T("p:wheel"), oNode))
}
else if ( strName == L"p:wheel")
{
base.reset(new Logic::WheelTransition(oNode));
else if(element.GetNode(_T("p:split"), oNode))
}
else if ( strName == L"p:split")
{
base.reset(new Logic::SplitTransition(oNode));
else if(element.GetNode(_T("p:zoom"), oNode))
}
else if ( strName == L"p:zoom")
{
base.reset(new Logic::ZoomTransition(oNode));
else base.reset();
}
else
{
base.reset(new Logic::EmptyTransition(oNode));
}
}
std::wstring TransitionBase::toXML() const
{
if (base.IsInit())
@ -189,25 +139,6 @@ namespace PPTX
node.ReadAllAttributes(m_strAttributesNames, m_strAttributesValues);
}
void TransitionSerialize::GetTransitionTypeFrom(XmlUtils::CXmlNode& element)
{
XmlUtils::CXmlNodes oNodes;
element.GetNodes(_T("*"), oNodes);
if (!oNodes.IsValid())
return;
int nCount = oNodes.GetCount();
if (1 == nCount)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(0, oNode);
m_strNodeName = oNode.GetName();
oNode.ReadAllAttributes(m_strAttributesNames, m_strAttributesValues);
}
}
std::wstring TransitionSerialize::toXML() const
{
return _T("");

View File

@ -50,7 +50,6 @@ namespace PPTX
const TransitionBase& operator =(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void GetTransitionTypeFrom(XmlUtils::CXmlNode& element);
virtual bool is_init()const{return (base.IsInit());};
template<class T> const bool is() const { return base.is<T>(); }
@ -75,7 +74,6 @@ namespace PPTX
public:
TransitionSerialize()
{
m_strNodeName = _T("");
}
virtual ~TransitionSerialize()
{
@ -94,10 +92,7 @@ namespace PPTX
m_strAttributesValues = src.m_strAttributesValues;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void GetTransitionTypeFrom(XmlUtils::CXmlNode& element);
virtual std::wstring toXML() const;
@ -253,8 +248,9 @@ namespace PPTX
pWriter->EndNode(name);
}
public:
std::wstring m_strNodeName;
std::wstring m_strNodeName;
std::list<std::wstring> m_strAttributesNames;
std::list<std::wstring> m_strAttributesValues;

View File

@ -434,10 +434,10 @@ namespace PPTX
}
// -------------------
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strUrl, pFill->oleFile, pFill->oleData, strOrigBase64);
NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strUrl, pFill->additionalFile, pFill->oleData, strOrigBase64);
// -------------------
if (strTempFile != _T(""))
if (!strTempFile.empty())
{
CDirectory::DeleteFile(strTempFile);
}
@ -455,7 +455,11 @@ namespace PPTX
pFill->blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.nOleRId).get();
pFill->blip->oleFilepathBin = oRelsGeneratorInfo.sFilepathOle;
}
if(oRelsGeneratorInfo.nMediaRId > 0)
{
pFill->blip->mediaRid = OOX::RId((size_t)oRelsGeneratorInfo.nMediaRId).get();
pFill->blip->mediaFilepath = oRelsGeneratorInfo.sFilepathMedia;
}
pReader->Skip(1); // end attribute
break;
}

View File

@ -107,16 +107,13 @@ namespace PPTX
return Media->toXML();
return _T("");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
// TODO:
}
virtual void toPPTY(NSBinPptxRW::CXmlWriter* pWriter) const
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
// TODO:
if (Media.is_init())
Media->toXmlWriter(pWriter);
}
@ -126,8 +123,7 @@ namespace PPTX
template<class T> AVSINLINE const bool is() const { return Media.is<T>(); }
template<class T> AVSINLINE T& as() { return Media.as<T>(); }
template<class T> AVSINLINE const T& as() const { return Media.as<T>(); }
//public:
private:
smart_ptr<WrapperWritingElement> Media;
protected:
virtual void FillParentPointersForChilds(){};

View File

@ -131,11 +131,11 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink);
pWriter->WriteAttribute(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink);
pWriter->EndAttributes();
cSld.toXmlWriter(pWriter);
clrMap.toXmlWriter(pWriter);
pWriter->Write(hf);
pWriter->Write(notesStyle);
@ -172,7 +172,7 @@ namespace PPTX
}
case 3:
{
notesStyle = new Logic::TextListStyle();
notesStyle = new Logic::TextListStyle(L"p:notesStyle");
notesStyle->fromPPTY(pReader);
break;
}

View File

@ -74,7 +74,7 @@ namespace PPTX
}
virtual void read(const OOX::CPath& filename, FileMap& map)
{
//FileContainer::read(filename, map);
//FileContainer::read(filename);
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(filename.m_strFilename);

View File

@ -488,7 +488,6 @@ HEADERS += pptxformatlib.h \
../../../Editor/imagemanager.h \
../../../Editor/PPTXWriter.h \
../../../Editor/WMFToImageConverter.h \
../../../Editor/XmlStringWriter.h \
../../../Editor/PresentationDrawingsDef.h \
../../../Editor/DefaultNotesMaster.h \
../../../Editor/DefaultNotesTheme.h \

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="PPTXFormat"
ProjectGUID="{36636678-AE25-4BE6-9A34-2561D1BCF302}"
RootNamespace="PPTXFormat"

View File

@ -534,10 +534,10 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
OOX::VmlOffice::CSignatureLine *signature = dynamic_cast<OOX::VmlOffice::CSignatureLine*>(m_arrElement->m_arrItems[i]);
if ( signature )
{
if (signature->m_oIsSignatureLine.GetValue() == SimpleTypes::booleanTrue)
if (signature->m_oIsSignatureLine.IsInit() && signature->m_oIsSignatureLine->ToBool())
pOutput->m_bIsSignatureLine = 1;
if (signature->m_oAllowComments.GetValue() == SimpleTypes::booleanTrue)
if (signature->m_oAllowComments.IsInit() && signature->m_oAllowComments->ToBool())
pOutput->m_bSigSetupAllowComments = 1;
if (signature->m_oProvId.IsInit())

View File

@ -48,7 +48,6 @@ public:
~AutoFilter();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -31,7 +31,7 @@
*/
#include "ChartFrtInfo.h"
#include <Logic/Biff_structures/FrtHeaderOld.h>
#include "../Biff_structures/FrtHeaderOld.h"
namespace XLS
{

View File

@ -37,6 +37,8 @@ namespace XLS
DConRef::DConRef()
{
bFilePath = false;
bSheetName = false;
}
@ -52,10 +54,33 @@ BaseObjectPtr DConRef::clone()
void DConRef::readFields(CFRecord& record)
{
#pragma message("####################### DConRef record is not implemented")
Log::error("DConRef record is not implemented.");
record >> ref >> cchFile;
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
if (cchFile > 1)
{
XLUnicodeStringNoCch stFile_;
stFile_.setSize(cchFile);
record >> stFile_;
//dcon-file = external-virt-path / self-reference
//external-virt-path = volume / unc-volume / rel-volume / transfer-protocol / startup / alt-startup / library / simple-file-path-dcon
//simple-file-path-dcon = %x0001 file-path
//self-reference = %x0002 sheet-name
stFile = stFile_.value();
if (stFile.substr(0, 1) == L"\x0001")
{
bFilePath = true;
stFile = stFile.substr(1);
}
else if (stFile.substr(0, 1) == L"\x0002")
{
bSheetName = true;
stFile = stFile.substr(1);
}
}
int unused = record.getDataSize() - record.getRdPtr();
record.skipNunBytes(unused);
}
} // namespace XLS

View File

@ -33,11 +33,12 @@
#include "BiffRecord.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
// Logical representation of DConRef record in BIFF8
class DConRef: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(DConRef)
@ -47,12 +48,17 @@ public:
~DConRef();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeDConRef;
static const ElementType type = typeDConRef;
RefU ref;
unsigned short cchFile;
std::wstring stFile;
bool bFilePath;
bool bSheetName;
};

View File

@ -31,7 +31,7 @@
*/
#include "EndObject.h"
#include <Logic/Biff_structures/FrtHeaderOld.h>
#include "../Biff_structures/FrtHeaderOld.h"
namespace XLS
{

View File

@ -54,7 +54,7 @@ void MTRSettings::readFields(CFRecord& record)
{
record.skipNunBytes(12);
_UINT32 temp1, temp2;
#pragma message("############################ frtHeader skipped here")
record >> temp1 >> temp2 >> cUserThreadCount;
fMTREnabled = temp1;

Some files were not shown because too many files have changed in this diff Show More