Compare commits

..

59 Commits

Author SHA1 Message Date
704b3b709f update cef if newer version exist 2017-12-06 18:21:58 +03:00
e4674915c2 Update cef if exist newer version 2017-12-06 17:19:46 +03:00
51fe936e5f ... 2017-12-06 12:18:06 +03:00
d8b177411f x2t - options for check macro in file 2017-12-05 16:56:50 +03:00
717b628055 ... 2017-12-05 14:37:10 +03:00
e4f94646b6 x2t version up 2017-12-05 10:54:43 +03:00
dcec7447e4 XlsFormat - apply theme style from format office 2010 and later 2017-12-04 19:24:27 +03:00
5f12552f78 XlsFormat - theme 2017-12-03 16:09:35 +03:00
d293769c1f XlsFormat .. 2017-12-02 17:31:10 +03:00
b45e772a50 remove stub for hyperlink without link 2017-12-01 18:34:04 +03:00
fdb7716abc builder error (save to pdf & open file by url) 2017-12-01 14:23:21 +03:00
f72d6dfe0e XlsFormat-... 2017-11-30 20:04:08 +03:00
23029a6a92 Change cef number 2017-11-30 16:28:48 +03:00
eda8e4d13f add c_oSerCellTypes::ValueText for cell value; Read1 error with empty length 2017-11-30 14:18:46 +03:00
64f578e59f XlsFormat - ... 2017-11-29 19:32:21 +03:00
16c57b50cc XlsFormat - table parts 2017-11-29 14:48:02 +03:00
83c0ba9dab XlsFormat - table parts 2017-11-28 19:41:16 +03:00
a2443dadeb use external directory for fonts 2017-11-28 19:17:30 +03:00
789bb1d4b3 add open/save bookmarks 2017-11-28 17:49:14 +03:00
4138ae5ce2 add save to odp 2017-11-28 17:29:12 +03:00
239b5dbf11 fix bug #36451 (ole object old style in master slide) 2017-11-28 17:01:03 +03:00
c046776b9c Merge branch 'hotfix/v5.0.5' into develop
# Conflicts:
#	X2tConverter/src/cextracttools.h
2017-11-27 18:14:40 +03:00
055a02570b XlsFormat - ... 2017-11-27 17:44:55 +03:00
1e2e5996f3 . 2017-11-23 19:40:37 +03:00
875717acd4 Add m_sSavePassword (m_sPassword - only for open) 2017-11-23 18:40:31 +03:00
033feeaf9d fix bug #18178 2017-11-23 18:16:44 +03:00
de336e5f96 Merge remote-tracking branch 'origin/hotfix/v5.0.5' into develop 2017-11-23 17:43:20 +03:00
82b3dbdae6 OdfFormatReader - fix users files 2017-11-23 17:42:09 +03:00
d1227f7759 x2t - add native commands for crypt file 2017-11-23 17:28:28 +03:00
4d134387f9 . 2017-11-23 17:15:06 +03:00
3f8600dfb7 XlsFormat - attachedToolbar,refactoring 2017-11-23 15:34:55 +03:00
511f043d63 . 2017-11-23 14:26:49 +03:00
69a41343c2 build with clang++ 2017-11-23 10:55:04 +03:00
578327bab6 XlsFormat - split sheets by type (ala original file) 2017-11-22 20:05:03 +03:00
52908908a5 fix linux build 2017-11-22 11:44:33 +03:00
24d9b99a44 Merge remote-tracking branch 'origin/hotfix/v5.0.5' into develop 2017-11-21 18:10:56 +03:00
dce58b628f fix bug #36322 2017-11-21 18:10:05 +03:00
f42cb4580c fix users files
XlsFormat olap hierarchy
...
2017-11-21 17:02:22 +03:00
52777e36cb refactoring 2017-11-21 12:49:32 +03:00
7b7e9f3e6e . 2017-11-20 16:21:58 +03:00
d39fa156e7 fix build 2017-11-20 15:47:40 +03:00
48bf40919c fix... 2017-11-17 19:33:38 +03:00
fd53a987be fix bug #36272 2017-11-17 19:02:51 +03:00
b4d298542a fix bug #36251 2017-11-17 15:58:19 +03:00
bae854027b fix bug #36380
Problem with picture in footnote
2017-11-17 13:18:20 +03:00
9723c379dd . 2017-11-17 12:44:51 +03:00
e8d8b2e56c . 2017-11-17 12:27:58 +03:00
adb84b0f05 x2t version up 2017-11-17 12:01:51 +03:00
a4ee30d031 fix bug #36201 2017-11-17 11:44:07 +03:00
e05194b277 Move ASCDOCUMENTSCORE to separated target 2017-11-16 18:14:37 +03:00
21f7f6ed5b fix bug #36335 2017-11-15 13:28:19 +03:00
80863ae25b v5.0.4 2017-11-13 17:46:10 +03:00
07562a9582 v5.0.4 2017-11-13 17:44:36 +03:00
6da196e426 fix bug #36311 2017-11-13 11:48:28 +03:00
f53c3d9f50 Merge pull request #51 from ONLYOFFICE/feature/pre5.0.4
pdf reader bug
2017-11-07 10:40:46 +03:00
b0f0f656af Merge pull request #50 from ONLYOFFICE/feature/bug36176
fix bug 36176
2017-11-02 18:00:26 +03:00
e69c1677b2 v5.0.3 2017-10-31 18:49:25 +03:00
e1340c63ec pdf reader bug 2017-10-30 15:06:43 +03:00
867438833b fix bug 36176 2017-10-30 13:40:57 +03:00
508 changed files with 14690 additions and 7515 deletions

View File

@ -33,6 +33,8 @@
#include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
namespace DocFileFormat
{
class IVisitable

View File

@ -582,7 +582,7 @@ namespace DocFileFormat
// The style id is used for a reverse reference.
// It can happen that the reference points to the wrong style.
if (styleIndex != ListData::ISTD_NIL)
if (styleIndex != ListData::ISTD_NIL && styleIndex < m_document->Styles->Styles->size())
{
m_pXmlWriter->WriteNodeBegin( L"w:pStyle", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))));

View File

@ -462,57 +462,60 @@ namespace DocFileFormat
void PropertiesMapping::appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc )
{
std::wstring pattern = getShadingPattern( desc );
if ( ( parent != NULL ) && ( desc.shadingSpecialValue == shadingSpecialValueNormal ))
{
XMLTools::XMLElement shd( L"w:shd" );
//fill color
XMLTools::XMLAttribute fill( L"w:fill" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvBackAuto )
{
fill.SetValue( L"auto" );
}
else
{
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
}
}
else
{
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( fill );
//foreground color
XMLTools::XMLAttribute color( L"w:color" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvForeAuto )
{
color.SetValue( L"auto" );
}
else
{
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
}
}
else
{
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( color );
//pattern
XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( getShadingPattern( desc ));
val.SetValue( pattern);
shd.AppendAttribute( val );
if (pattern != L"nil")
{
//fill color
XMLTools::XMLAttribute fill( L"w:fill" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvBackAuto )
{
fill.SetValue( L"auto" );
}
else
{
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
}
}
else
{
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( fill );
//foreground color
XMLTools::XMLAttribute color( L"w:color" );
if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvForeAuto )
{
color.SetValue( L"auto" );
}
else
{
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
}
}
else
{
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( color );
}
parent->RemoveChildByName( L"w:shd" );
parent->AppendChild( shd );
}

View File

@ -174,9 +174,9 @@ namespace DocFileFormat
//it's a Word 97 SPRM
short val = FormatUtils::BytesToInt16(bytes, 0, size);
icoFore = (val & 0x1F);
icoBack = ((val >> 5) & 0x1F);
ipat = (ShadingPattern) ((val >> 10) & 0x3F);
icoFore = GETBITS(val, 0, 4);
icoBack = GETBITS(val, 5, 9);
ipat = (ShadingPattern) GETBITS(val, 10, 15);
shadingType = shadingTypeShd80;
@ -209,7 +209,7 @@ namespace DocFileFormat
else if (0x0F == icoFore) { cvFore = RGB2 (0x80, 0x80, 0x80); }
else if (0x10 == icoFore) { cvFore = RGB2 (0xC0, 0xC0, 0xC0); }
if (0x00 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); cvBackAuto = true; }
if (0x00 == icoBack) { cvBack = RGB2 (0xFF, 0xFF, 0xFF); cvBackAuto = true; }
else if (0x01 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); }
else if (0x02 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0xFF); }
else if (0x03 == icoBack) { cvBack = RGB2 (0x00, 0xFF, 0xFF); }

View File

@ -354,7 +354,7 @@ namespace DocFileFormat
void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex)
{
if (sprmArg)
if (sprmArg && cellIndex >= 0)
{
//shading descriptor can have 10 bytes (Word 2000) or 2 bytes (Word 97)
int shdLength = 2;

View File

@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -49,6 +49,8 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
#pragma comment(lib, "Rpcrt4.lib")
HRESULT convert_single(std::wstring sSrcDoc)
{
HRESULT hr = S_OK;

View File

@ -55,7 +55,9 @@ namespace Writers
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8( std::wstring(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")));
oFile.WriteStringUTF8( std::wstring(_T("<w:document \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \

View File

@ -60,16 +60,50 @@ namespace Writers
std::wstring rId;
SimpleTypes::EHdrFtr eType;
};
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_hdr_End = _T("</w:hdr>");
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_ftr_End = _T("</w:ftr>");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
class HeaderFooterWriter

View File

@ -3734,6 +3734,18 @@ public:
res = Read2(length, &Binary_DocumentTableReader::Read_Background, this, &oBackground);
m_oDocumentWriter.m_oBackground.WriteString(oBackground.Write());
}
else if ( c_oSerParType::BookmarkStart == type )
{
OOX::Logic::CBookmarkStart oBookmarkStart;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
m_oDocumentWriter.m_oContent.WriteString(oBookmarkStart.toXML());
}
else if ( c_oSerParType::BookmarkEnd == type )
{
OOX::Logic::CBookmarkEnd oBookmarkEnd;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3872,6 +3884,18 @@ public:
SdtWraper oSdt(1);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else if ( c_oSerParType::BookmarkStart == type )
{
OOX::Logic::CBookmarkStart oBookmarkStart;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
m_oDocumentWriter.m_oContent.WriteString(oBookmarkStart.toXML());
}
else if ( c_oSerParType::BookmarkEnd == type )
{
OOX::Logic::CBookmarkEnd oBookmarkEnd;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -4267,6 +4291,57 @@ public:
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadBookmarkStart(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(poResult);
if ( c_oSerBookmark::Id == type )
{
pBookmarkStart->m_oId.Init();
pBookmarkStart->m_oId->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerBookmark::Name == type )
{
pBookmarkStart->m_sName.Init();
pBookmarkStart->m_sName->append(m_oBufferedStream.GetString3(length));
}
else if ( c_oSerBookmark::DisplacedByCustomXml == type )
{
pBookmarkStart->m_oDisplacedByCustomXml.Init();
pBookmarkStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
}
else if ( c_oSerBookmark::ColFirst == type )
{
pBookmarkStart->m_oColFirst.Init();
pBookmarkStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerBookmark::ColLast == type )
{
pBookmarkStart->m_oColLast.Init();
pBookmarkStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadBookmarkEnd(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(poResult);
if ( c_oSerBookmark::Id == type )
{
pBookmarkEnd->m_oId.Init();
pBookmarkEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
}
else if ( c_oSerBookmark::DisplacedByCustomXml == type )
{
pBookmarkEnd->m_oDisplacedByCustomXml.Init();
pBookmarkEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadHyperlink(BYTE type, long length, void* poResult)
{
@ -4460,6 +4535,18 @@ public:
res = Read1(length, &Binary_DocumentTableReader::ReadMathSSup, this, poResult);
GetRunStringWriter().WriteString(std::wstring(_T("</m:sSup>")));
}
else if ( c_oSer_OMathContentType::BookmarkStart == type )
{
OOX::Logic::CBookmarkStart oBookmarkStart;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
GetRunStringWriter().WriteString(oBookmarkStart.toXML());
}
else if ( c_oSer_OMathContentType::BookmarkEnd == type )
{
OOX::Logic::CBookmarkEnd oBookmarkEnd;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
GetRunStringWriter().WriteString(oBookmarkEnd.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -6923,6 +7010,18 @@ public:
SdtWraper oSdt(2);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else if (c_oSerDocTableType::BookmarkStart == type)
{
OOX::Logic::CBookmarkStart oBookmarkStart;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
pCStringWriter->WriteString(oBookmarkStart.toXML());
}
else if (c_oSerDocTableType::BookmarkEnd == type)
{
OOX::Logic::CBookmarkEnd oBookmarkEnd;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
pCStringWriter->WriteString(oBookmarkEnd.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -6960,6 +7059,18 @@ public:
SdtWraper oSdt(3);
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
}
else if (c_oSerDocTableType::BookmarkStart == type)
{
OOX::Logic::CBookmarkStart oBookmarkStart;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
pCStringWriter->WriteString(oBookmarkStart.toXML());
}
else if (c_oSerDocTableType::BookmarkEnd == type)
{
OOX::Logic::CBookmarkEnd oBookmarkEnd;
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
pCStringWriter->WriteString(oBookmarkEnd.toXML());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -7125,21 +7236,22 @@ public:
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(nChartIndex) + L".xlsx";
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
if (oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace))
{
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
pChartSpace->m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rIdXlsx));
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(L"xlsx");
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
pChartSpace->m_oChartSpace.m_externalData->m_id = new std::wstring();
pChartSpace->m_oChartSpace.m_externalData->m_id->append(L"rId");
pChartSpace->m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rIdXlsx));
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
//save chart.xml
NSStringUtils::CStringBuilder sw;

View File

@ -144,9 +144,13 @@ namespace MathEquation
void AddAccent (MEMBELTYPE eType)
{
LONG lPos = GetSize() - 1;
if (lPos < 0) return;
EquationRun oRun;
oRun = arrRun[lPos];
RemoveElem(lPos);
oRun.bAccent = true;
oRun.eType = eType;
Add(oRun);
@ -1675,7 +1679,7 @@ namespace MathEquation
void WriteEndNode(BinaryEquationWriter* pWriter)
{
int nCurPos;
int nCurPos = -1;
if (!m_aBaseStack.empty())
{
nCurPos = m_aBaseStack.top();
@ -1687,14 +1691,20 @@ namespace MathEquation
}
if (bPile && bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && !bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && bEqArrayStart)
{
pWriter->m_aRowsCounter.push(nRows);
bEqArrayStart = false;
pWriter->WriteItemEnd(nCurPos);//eqArr
if (nCurPos > 0)
pWriter->WriteItemEnd(nCurPos);//eqArr
if (!m_aBaseStack.empty())
{

View File

@ -476,7 +476,9 @@ extern int g_nCurFormatVersion;
MoveFromRangeStart = 18,
MoveFromRangeEnd = 19,
MoveToRangeStart = 20,
MoveToRangeEnd = 21
MoveToRangeEnd = 21,
BookmarkStart = 22,
BookmarkEnd = 23
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
@ -491,7 +493,9 @@ extern int g_nCurFormatVersion;
Cell_Pr = 7,
Cell_Content = 8,
tblGridChange = 9,
Sdt = 10
Sdt = 10,
BookmarkStart = 11,
BookmarkEnd = 12
};}
namespace c_oSerRunType{enum c_oSerRunType
{
@ -900,7 +904,9 @@ extern int g_nCurFormatVersion;
Ins = 62,
Del = 63,
columnbreak = 64,
ARPr = 65
ARPr = 65,
BookmarkStart = 66,
BookmarkEnd = 67
};}
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
{
@ -1105,6 +1111,14 @@ extern int g_nCurFormatVersion;
Name = 6,
UserId = 7
};}
namespace c_oSerBookmark{enum c_oSerBookmark
{
Id = 0,
Name = 1,
DisplacedByCustomXml = 2,
ColFirst = 3,
ColLast = 4
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES

View File

@ -3076,6 +3076,20 @@ namespace BinDocxRW
OOX::Logic::CBdo* pBdo = static_cast<OOX::Logic::CBdo*>(item);
WriteDocumentContent(pBdo->m_arrItems);
}break;
case OOX::et_w_bookmarkStart:
{
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::BookmarkStart);
WriteBookmarkStart(*pBookmarkStart);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}break;
case OOX::et_w_bookmarkEnd:
{
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::BookmarkEnd);
WriteBookmarkEnd(*pBookmarkEnd);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}break;
default:
break;
}
@ -3249,6 +3263,22 @@ namespace BinDocxRW
WriteComment(OOX::et_w_commentRangeEnd, pCommentRangeEnd->m_oId);
break;
}
case OOX::et_w_bookmarkStart:
{
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::BookmarkStart);
WriteBookmarkStart(*pBookmarkStart);
m_oBcw.WriteItemEnd(nCurPos);
break;
}
case OOX::et_w_bookmarkEnd:
{
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::BookmarkEnd);
WriteBookmarkEnd(*pBookmarkEnd);
m_oBcw.WriteItemEnd(nCurPos);
break;
}
//todo moveRange on all levels(body, p ...)
// case OOX::et_w_moveFromRangeStart:
// {
@ -3660,11 +3690,60 @@ namespace BinDocxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteBookmarkStart(const OOX::Logic::CBookmarkStart& oBookmarkStart)
{
int nCurPos = 0;
if (oBookmarkStart.m_oId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::Id);
m_oBcw.m_oStream.WriteLONG(oBookmarkStart.m_oId->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oBookmarkStart.m_sName.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::Name);
m_oBcw.m_oStream.WriteStringW3(oBookmarkStart.m_sName.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oBookmarkStart.m_oDisplacedByCustomXml.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::DisplacedByCustomXml);
m_oBcw.m_oStream.WriteBYTE((BYTE)oBookmarkStart.m_oDisplacedByCustomXml->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oBookmarkStart.m_oColFirst.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::ColFirst);
m_oBcw.m_oStream.WriteLONG(oBookmarkStart.m_oColFirst->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oBookmarkStart.m_oColLast.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::ColLast);
m_oBcw.m_oStream.WriteLONG(oBookmarkStart.m_oColLast->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteBookmarkEnd(const OOX::Logic::CBookmarkEnd& oBookmarkEnd)
{
int nCurPos = 0;
if (oBookmarkEnd.m_oId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::Id);
m_oBcw.m_oStream.WriteLONG(oBookmarkEnd.m_oId->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oBookmarkEnd.m_oDisplacedByCustomXml.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerBookmark::DisplacedByCustomXml);
m_oBcw.m_oStream.WriteBYTE((BYTE)oBookmarkEnd.m_oDisplacedByCustomXml->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteHyperlink(OOX::Logic::CHyperlink* pHyperlink)
{
int nCurPos = 0;
std::wstring sField;
std::wstring sLink;
if(pHyperlink->m_oId.IsInit())
{
@ -3677,24 +3756,20 @@ namespace BinDocxRW
}
}
if(!sLink.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Hyperlink);
WriteHyperlinkContent(sLink, pHyperlink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else
{
WriteParagraphContent(pHyperlink->m_arrItems, true);
}
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::Hyperlink);
WriteHyperlinkContent(sLink, pHyperlink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
void WriteHyperlinkContent(std::wstring& sLink, OOX::Logic::CHyperlink* pHyperlink)
{
int nCurPos = 0;
//Link
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Link);
m_oBcw.m_oStream.WriteStringW3(sLink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
if(!sLink.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_HyperlinkType::Link);
m_oBcw.m_oStream.WriteStringW3(sLink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Anchor
if(pHyperlink->m_sAnchor.IsInit())
{
@ -4097,6 +4172,22 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
break;
}
case OOX::et_w_bookmarkStart:
{
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::BookmarkStart);
WriteBookmarkStart(*pBookmarkStart);
m_oBcw.WriteItemEnd(nCurPos);
break;
}
case OOX::et_w_bookmarkEnd:
{
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSer_OMathContentType::BookmarkEnd);
WriteBookmarkEnd(*pBookmarkEnd);
m_oBcw.WriteItemEnd(nCurPos);
break;
}
default:
break;
}
@ -6638,6 +6729,20 @@ namespace BinDocxRW
OOX::Logic::CBdo* pBdo = static_cast<OOX::Logic::CBdo*>(item);
WriteTableContent(pBdo->m_arrItems, pTblPr, nRows, nCols);
}
else if(OOX::et_w_bookmarkStart == item->getType())
{
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::BookmarkStart);
WriteBookmarkStart(*pBookmarkStart);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_bookmarkEnd == item->getType())
{
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::BookmarkEnd);
WriteBookmarkEnd(*pBookmarkEnd);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteRow(const OOX::Logic::CTr& Row, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nRows, int nCols)
@ -6698,6 +6803,20 @@ namespace BinDocxRW
OOX::Logic::CBdo* pBdo = static_cast<OOX::Logic::CBdo*>(item);
WriteRowContent(pBdo->m_arrItems, pTblPr, nCurRowIndex, nRows, nCols);
}
else if(OOX::et_w_bookmarkStart == item->getType())
{
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::BookmarkStart);
WriteBookmarkStart(*pBookmarkStart);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
else if(OOX::et_w_bookmarkEnd == item->getType())
{
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(item);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::BookmarkEnd);
WriteBookmarkEnd(*pBookmarkEnd);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteCell(OOX::Logic::CTc& tc, OOX::Logic::CTableProperty* pTblPr, int nCurRowIndex, int nCurColIndex, int nRows, int nCols)

View File

@ -658,8 +658,7 @@ namespace BinXlsxRW{
std::wstring wb, sheetFrom, sheetTo;
int nRow1, nCol1, nRow2, nCol2;
if(OOX::Spreadsheet::CCell::parse3DRef(*pStrRef->m_f, wb, sheetFrom, sheetTo, nRow1, nCol1, nRow2, nCol2) &&
sheetFrom.length() > 0 && 0 == wb.length() && 0 == sheetTo.length() &&
NULL != pStrRef->m_strCache)
sheetFrom.length() > 0 && 0 == sheetTo.length() && NULL != pStrRef->m_strCache)
{
bool bRow = nRow1 == nRow2;
if(bUpdateRange)
@ -727,7 +726,7 @@ namespace BinXlsxRW{
std::wstring wb, sheetFrom, sheetTo;
int nRow1, nCol1, nRow2, nCol2;
if(OOX::Spreadsheet::CCell::parse3DRef(*pNumRef->m_f, wb, sheetFrom, sheetTo, nRow1, nCol1, nRow2, nCol2) &&
sheetFrom.length() > 0 && 0 == wb.length() && 0 == sheetTo.length() && NULL != pNumRef->m_numCache)
sheetFrom.length() > 0 && 0 == sheetTo.length() && NULL != pNumRef->m_numCache)
{
bool bRow = nRow1 == nRow2;
if(bUpdateRange)

View File

@ -181,20 +181,22 @@ 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");
if (writeChartXlsx(sXlsxPath, oChartSpace))
{
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
}
std::wstring strFilepath = sFilepath;
@ -233,7 +235,7 @@ namespace BinXlsxRW{
m_bIsNoBase64 = bIsNoBase64;
}
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
bool CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
{
//анализируем chart
BinXlsxRW::ChartWriter helper;
@ -252,11 +254,15 @@ namespace BinXlsxRW{
helper.toXlsx(oXlsx);
//write
OOX::CContentTypes oContentTypes;
oXlsx.Write(oPath, oContentTypes);
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
bool res = oXlsx.Write(oPath, oContentTypes);
if (res)
{
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
}
//clean
NSDirectory::DeleteDirectory(sTempDir);
return res;
}
};

View File

@ -72,7 +72,7 @@ namespace BinXlsxRW {
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
void setIsNoBase64 (bool bIsNoBase64);
void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
bool writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart);
};
}
#endif // #ifndef XLSX_SERIALIZER

View File

@ -356,6 +356,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -133,7 +133,8 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
xlsx_drawing_context_ (Context->get_drawing_context_handle()),
xlsx_comments_context_ (Context->get_comments_context_handle()),
table_column_last_width_(0.0),
in_cell(false)
in_cell(false),
bEndTable(false)
{
memset(&group_row_,0,sizeof(_group_row));

View File

@ -91,6 +91,9 @@ public:
void end_row ();
void add_empty_row(int count);
void set_end_table(){ bEndTable = true; }
bool get_end_table(){ return bEndTable; }
std::wstring current_row_style () const;
std::wstring default_row_cell_style () const;
@ -153,6 +156,7 @@ public:
friend class xlsx_table_context;
private:
bool bEndTable;
xlsx_conversion_context * context_;
std::wstring tableName_;

View File

@ -195,7 +195,14 @@ std::wstring cellType2Str(XlsxCellType::type type)
boost::int64_t convertDate(int Year, int Month, int Day)
{
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
if (Year < 1400 || Year >10000)
return - 1;
if (Month < 1 || Month > 12)
return - 1;
if (Day < 1 || Day > 31)
return - 1;
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
if (Year <= 1900 &&
Month <= 2 &&

View File

@ -78,13 +78,16 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
{
bool bEndTable = Context.get_table_context().state()->get_end_table();
if (attlist_.table_number_rows_repeated_ > 1 && empty())
{
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return;
}
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
if (attlist_.table_number_rows_repeated_ > 0x0f00 && empty_content_cells() || bEndTable)//0xf000 - conv_KDZO3J3xLIbZ5fC0HR0__xlsx.ods
{
Context.get_table_context().state()->set_end_table();
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
}
@ -731,7 +734,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
int y, m, d;
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
{
number_val = boost::lexical_cast<std::wstring>(oox::convertDate(y, m, d));
boost::int64_t intDate = oox::convertDate(y, m, d);
if (intDate > 0)
{
number_val = boost::lexical_cast<std::wstring>(intDate);
}
else
{
str_val = attr.office_date_value_.get();
}
}
}
}
@ -742,11 +753,19 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
if (attr.office_time_value_)
{
const std::wstring tv = attr.office_time_value_.get();
int h,m;
int h, m;
double s;
if (oox::parseTime(tv, h, m, s))
{
number_val = boost::lexical_cast<std::wstring>(oox::convertTime(h, m, s));
boost::int64_t intTime = oox::convertTime(h, m, s);
if (intTime > 0)
{
number_val = boost::lexical_cast<std::wstring>(intTime);
}
else
{
str_val = tv;
}
}
}
}
@ -899,34 +918,262 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std::wostream & strm = Context.current_sheet().sheetData();
const int sharedStringId = content_.xlsx_convert(Context, NULL);
const common_value_and_type_attlist & attr = attlist_.common_value_and_type_attlist_;
office_value_type::type odf_value_type = office_value_type::Custom;
oox::XlsxCellType::type t_val = oox::XlsxCellType::s;
std::wstring formula = attlist_.table_formula_.get_value_or(L"");
std::wstring number_val;
_CP_OPT(bool) bool_val;
_CP_OPT(std::wstring) str_val;
std::wstring num_format;
size_t xfId_last_set = 0;
int empty_cell_count = 0;
bool skip_next_cell = false;
bool is_style_visible = true;
bool is_data_visible = false;
// вычислить стиль для ячейки
std::wstring cellStyleName = attlist_.table_style_name_.get_value_or(L"");
std::wstring columnStyleName = Context.get_table_context().default_column_cell_style();
std::wstring rowStyleName = Context.get_table_context().default_row_cell_style();
if (attlist_.table_number_columns_repeated_ > 1)
columnStyleName.clear(); // могут быть разные стили колонок Book 24.ods
odf_read_context & odfContext = Context.root()->odf_context();
style_instance *defaultCellStyle=NULL, *defaultColumnCellStyle = NULL, *defaultRowCellStyle =NULL, *cellStyle = NULL;
try
{
defaultCellStyle = odfContext.styleContainer().style_default_by_type(style_family::TableCell);
defaultColumnCellStyle = odfContext.styleContainer().style_by_name(columnStyleName, style_family::TableCell, false);
defaultRowCellStyle = odfContext.styleContainer().style_by_name(rowStyleName, style_family::TableCell, false);
cellStyle = odfContext.styleContainer().style_by_name(cellStyleName, style_family::TableCell, false);
}
catch(...)
{
_CP_LOG << L"[error]: style wrong\n";
}
std::wstring data_style = CalcCellDataStyle(Context, columnStyleName, rowStyleName, cellStyleName);
// стили не наследуются
std::vector<const style_instance *> instances;
instances.push_back(defaultCellStyle);
if (defaultColumnCellStyle)
instances.push_back(defaultColumnCellStyle);
if (defaultRowCellStyle)
{
if (instances.size() > 1)
instances[1] = defaultRowCellStyle;
else
instances.push_back(defaultRowCellStyle);
}
if (cellStyle)
{
if (instances.size() > 1)
instances[1] = cellStyle;
else
instances.push_back(cellStyle);
}
text_format_properties_content textFormatProperties = calc_text_properties_content (instances);
paragraph_format_properties parFormatProperties = calc_paragraph_properties_content (instances);
style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties (instances);
if (attr.office_value_type_)
odf_value_type = attr.office_value_type_->get_type();
if ((odf_value_type == office_value_type::Float) ||
(odf_value_type == office_value_type::Custom && attr.office_value_))
{
t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L"");
}
else if (odf_value_type == office_value_type::Percentage)
{
t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L"");
}
else if (odf_value_type == office_value_type::Currency)
{
t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L"");
}
else if ((odf_value_type == office_value_type::Date) ||
(odf_value_type == office_value_type::Custom && attr.office_date_value_))
{
t_val = oox::XlsxCellType::n;
if (attr.office_date_value_)
{
int y, m, d;
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
{
boost::int64_t intDate = oox::convertDate(y, m, d);
if (intDate > 0)
{
number_val = boost::lexical_cast<std::wstring>(intDate);
}
else
{
str_val = attr.office_date_value_.get();
}
}
}
}
else if ((odf_value_type == office_value_type::Time) ||
(odf_value_type == office_value_type::Custom && attr.office_time_value_))
{
t_val = oox::XlsxCellType::n;
if (attr.office_time_value_)
{
const std::wstring tv = attr.office_time_value_.get();
int h,m;
double s;
if (oox::parseTime(tv, h, m, s))
{
number_val = boost::lexical_cast<std::wstring>(oox::convertTime(h, m, s));
}
}
}
else if ((odf_value_type == office_value_type::Boolean) ||
(odf_value_type == office_value_type::Custom && attr.office_boolean_value_))
{
t_val = oox::XlsxCellType::b;
if (attr.office_boolean_value_) bool_val = oox::parseBoolVal(attr.office_boolean_value_.get());
}
else if ((odf_value_type == office_value_type::String) ||
(odf_value_type == office_value_type::Custom && attr.office_string_value_))
{
t_val = oox::XlsxCellType::str;
if (attr.office_string_value_) str_val = attr.office_string_value_.get();
}
if (!data_style.empty())
{
office_element_ptr elm = odfContext.numberStyles().find_by_style_name(data_style);
number_style_base *num_style = dynamic_cast<number_style_base*>(elm.get());
if (num_style)
{
Context.get_num_format_context().start_complex_format();
num_style->oox_convert(Context.get_num_format_context());
Context.get_num_format_context().end_complex_format();
num_format = Context.get_num_format_context().get_last_format();
}
}
oox::xlsx_cell_format cellFormat;
cellFormat.set_cell_type(t_val);
cellFormat.set_num_format(oox::odf_string_to_build_in(odf_value_type));
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
if ( content_.elements_.size() > 0 ||
!formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
( t_val == oox::XlsxCellType::b && bool_val) ||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
if (attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
int cell_repeated_max = Context.current_table_column() + attlist_.table_number_columns_repeated_ + 1;
if (cell_repeated_max >= 1024 && cellStyleName.empty() && last_cell_ && !is_data_visible)
{//Book 24.ods
return;
}
if (is_style_visible)
{
xfId_last_set = Context.get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, num_format, false, is_style_visible);
}
for (unsigned int r = 0; r < attlist_.table_number_columns_repeated_; ++r)
{
Context.start_table_covered_cell();
const int xfId = Context.get_current_cell_style_id();
Context.start_table_covered_cell ();
if (is_style_visible)
Context.set_current_cell_style_id(xfId_last_set);
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
if (skip_next_cell)break;
CP_XML_WRITER(strm)
// пустые ячейки пропускаем.
if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible))
{
CP_XML_NODE(L"c")
CP_XML_WRITER(strm)
{
CP_XML_ATTR(L"r", Context.current_cell_address());
if (xfId >= 0)
{
CP_XML_ATTR(L"s", xfId);
}
CP_XML_NODE(L"c")
{
CP_XML_ATTR(L"r", oox::getCellAddress(Context.current_table_column(), Context.current_table_row()));
CP_XML_ATTR(L"t", oox::cellType2Str(t_val));
CP_XML_ATTR(L"s", xfId_last_set);
if (sharedStringId >=0)
{
CP_XML_NODE(L"v")
if (!formula.empty())
{
CP_XML_CONTENT(sharedStringId);
const std::wstring xlsxFormula = formulas_converter.convert(formula);
if (!xlsxFormula.empty())
{
CP_XML_NODE(L"f")
{
CP_XML_CONTENT(xlsxFormula);
}
}
}
}
} // c
if (sharedStringId >= 0 && t_val == oox::XlsxCellType::s)
{
CP_XML_NODE(L"v") { CP_XML_CONTENT(sharedStringId); }
}
else if ((t_val == oox::XlsxCellType::str || t_val == oox::XlsxCellType::inlineStr) && str_val)
{
CP_XML_NODE(L"v") { CP_XML_CONTENT(str_val.get()); }
}
else if (t_val == oox::XlsxCellType::n && !number_val.empty())
{
CP_XML_NODE(L"v") { CP_XML_CONTENT(number_val);}
}
else if (t_val == oox::XlsxCellType::b && bool_val)
{
CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
}
}
if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
{
Context.non_empty_row();
empty_cell_count = 0 ;
}
else
{
empty_cell_count++;
//Уведомление_оручении.ods - 13 повторов пустых с cellStyle=NULL - нужные !!!
if (empty_cell_count > 19 && last_cell_&& (attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL))
{//пишем простыню только если задан стиль тока для этих ячеек
skip_next_cell = true;
}
}
}
}
else
{
if (last_cell_) // Vehicle log book.ods (row = 24 and more)
skip_next_cell = true;
}
Context.end_table_covered_cell();

View File

@ -2057,11 +2057,12 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content_.fo_color_);
}
text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);
//text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None); //нельзя..если будет выше наследуемого то подчеркивания не будет
if (oox_run_pr->m_oU.IsInit())
{
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Solid);
text_properties->content_.style_text_underline_type_ = odf_types::line_type(odf_types::line_type::Single);
text_properties->content_.style_text_underline_width_ = odf_types::line_width(odf_types::line_width::Auto);
_CP_OPT(odf_types::color) color;
convert(oox_run_pr->m_oU->m_oColor.GetPointer(), oox_run_pr->m_oU->m_oThemeColor.GetPointer(),
@ -3187,9 +3188,9 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
{
if (oox_style == NULL)return;
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
std::wstring oox_name_id = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->table_styles().start_style(oox_name);
odt_context->styles_context()->table_styles().start_style(oox_name_id);
//общие
if (oox_style->m_oTblPr.IsInit())
@ -3303,17 +3304,21 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
return;
}
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->create_style(oox_name, family, false, true, -1);
std::wstring oox_name_id = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->create_style(oox_name_id, family, false, true, -1);
std::wstring style_name;
if (oox_style->m_oName.IsInit() && oox_style->m_oName->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_display_name(*oox_style->m_oName->m_sVal);
{
style_name = *oox_style->m_oName->m_sVal;
odt_context->styles_context()->last_state()->set_display_name(style_name);
}
odf_writer::style_text_properties* text_properties = NULL;
if (oox_style->m_oRunPr.IsInit())
{
odf_writer::style_text_properties* text_properties = odt_context->styles_context()->last_state()->get_text_properties();
text_properties = odt_context->styles_context()->last_state()->get_text_properties();
if (oox_style->m_oDefault.IsInit() && oox_style->m_oDefault->ToBool())
{
@ -3330,14 +3335,14 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
}
if (oox_style->m_oParPr.IsInit())
{
odf_writer::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
odf_writer::style_paragraph_properties *paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
if (oox_style->m_oDefault.IsInit() && oox_style->m_oDefault->ToBool())
{
//основан на дефолтовом - накатить
odf_writer::odf_style_state_ptr def_style_state;
if (odt_context->styles_context()->find_odf_default_style_state(odf_types::style_family::Paragraph, def_style_state) && def_style_state)
{
odf_writer::style_paragraph_properties * props = def_style_state->get_paragraph_properties();
odf_writer::style_paragraph_properties *props = def_style_state->get_paragraph_properties();
paragraph_properties->apply_from(props);
}
}
@ -3367,9 +3372,19 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_parent_style_name(*oox_style->m_oBasedOn->m_sVal);
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oQFormat;
//nullable<ComplexTypes::Word::std::wstring_> m_oAliases;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oQFormat;
//nullable<ComplexTypes::Word::std::wstring_> m_oAliases;
//-------------------------------------------------------------------------------------------------------------------------
if (style_name == L"Hyperlink")
{
odt_context->styles_context()->create_style(L"Internet_20_link", family, false, true, -1);
//odt_context->styles_context()->last_state()->set_parent_style_name(oox_name_id);
odt_context->styles_context()->last_state()->set_display_name(L"Internet link");
odf_writer::style_text_properties* hyperlink_text_props = odt_context->styles_context()->last_state()->get_text_properties();
hyperlink_text_props->apply_from(text_properties);
}
}
void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start)

View File

@ -21,9 +21,6 @@ include($$PWD/../../../Common/3dParty/boost/boost.pri)
DEFINES += UNICODE \
_UNICODE \
PPTX_DEF \
PPT_DEF \
ENABLE_PPT_TO_PPTX_CONVERT \
_USE_LIBXML2_READER_ \
LIBXML_READER_ENABLED \
USE_LITE_READER \

View File

@ -67,7 +67,9 @@ public:
}
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros);
long OpenFile(const std::wstring & fileName, const std::wstring & password, bool &bMacros);
bool CloseFile();
private:
int m_Status;
@ -76,8 +78,7 @@ private:
std::wstring m_strTempDirectory;
std::wstring m_sTempDecryptFileName;
long OpenFile(const std::wstring & fileName, const std::wstring & password, bool &bMacros);
bool CloseFile();
std::wstring GetDirectory(std::wstring strFileName);
};

View File

@ -794,7 +794,7 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter,
oWriter.WriteString(std::wstring(L"</p:bgPr></p:bg>"));
}
void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout)
void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, CElementPtr pElement, CLayout* pLayout)
{
if (!pElement) return;
@ -817,7 +817,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe
if ((pElement->m_lPlaceholderType == pLayout->m_arElements[nIndex]->m_lPlaceholderType) &&
(pElement->m_lPlaceholderID == pLayout->m_arElements[nIndex]->m_lPlaceholderID))
{
IElement* pElLayout = pLayout->m_arElements[nIndex];
CElementPtr pElLayout = pLayout->m_arElements[nIndex];
bool bIsEqualTransform = ((pElement->m_dRotate == pElLayout->m_dRotate)
&& (pElement->m_bFlipH == pElLayout->m_bFlipH) && (pElement->m_bFlipV == pElLayout->m_bFlipV));

View File

@ -82,7 +82,7 @@ namespace NSPresentationEditor
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);
void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, CElementPtr pElement, CLayout* pLayout = NULL);
};

View File

@ -293,10 +293,10 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
m_pImageElement = NULL;
m_pShapeElement = NULL;
}
bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem)
bool NSPresentationEditor::CShapeWriter::SetElement(CElementPtr pElem)
{
m_pShapeElement = dynamic_cast<CShapeElement*>(pElem);
m_pImageElement = dynamic_cast<CImageElement*>(pElem);
m_pShapeElement = dynamic_cast<CShapeElement*>(pElem.get());
m_pImageElement = dynamic_cast<CImageElement*>(pElem.get());
m_pSimpleGraphicsConverter->PathCommandEnd();
@ -309,7 +309,7 @@ bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem)
if (m_pShapeElement)
{
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect);
m_pShapeElement->m_pShape->GetTextRect(m_oTextRect);
}
m_oWriter.ClearNoAttack();
@ -809,7 +809,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
}
void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
size_t nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size();
size_t nCount = m_pShapeElement->m_pShape->m_oText.m_arParagraphs.size();
m_oWriter.WriteString(std::wstring(L"<p:txBody>"));
@ -826,21 +826,21 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
// m_oWriter.WriteString(std::wstring(L" lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\""));
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 0 )
if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 0 )
m_oWriter.WriteString(L" anchor=\"t\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 2 )
else if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 2 )
m_oWriter.WriteString(L" anchor=\"b\"");
else if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
else if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical == 1 )
{
m_oWriter.WriteString(L" anchor=\"ctr\"");
m_oWriter.WriteString(L" anchorCtr=\"0\"");
}
if (m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate > 0)
if (m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_dTextRotate > 0)
{
std::wstring strProp = std::to_wstring((int)(m_pShapeElement->m_oShape.m_oText.m_oAttributes.m_dTextRotate * 60000));
std::wstring strProp = std::to_wstring((int)(m_pShapeElement->m_pShape->m_oText.m_oAttributes.m_dTextRotate * 60000));
m_oWriter.WriteString(L" rot=\"" + strProp + L"\"");
}
if (m_pShapeElement->m_oShape.m_oText.m_bVertical)
if (m_pShapeElement->m_pShape->m_oText.m_bVertical)
{
m_oWriter.WriteString(L" vert=\"eaVert\"");
}
@ -853,7 +853,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstTxWarp + _T("\">"));
m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//модификаторы
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_oShape.m_pShape);
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_pShape->getBaseShape().get());
std::wstring strVal;
for (int i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++)
@ -875,7 +875,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(L"</a:avLst>");
m_oWriter.WriteString(L"</a:prstTxWarp>");
}
if (m_pShapeElement->m_oShape.m_oText.m_bAutoFit)
if (m_pShapeElement->m_pShape->m_oText.m_bAutoFit)
{
m_oWriter.WriteString(L"<a:spAutoFit/>");
}
@ -890,14 +890,14 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if (!m_bWordArt)
{
CStylesWriter::ConvertStyles(m_pShapeElement->m_oShape.m_oText.m_oStyles, m_oMetricInfo, m_oWriter);
CStylesWriter::ConvertStyles(m_pShapeElement->m_pShape->m_oText.m_oStyles, m_oMetricInfo, m_oWriter);
}
m_oWriter.WriteString(std::wstring(L"</a:lstStyle>"));
for (size_t nIndexPar = 0; nIndexPar < nCount; ++nIndexPar)
{
NSPresentationEditor::CParagraph* pParagraph = &m_pShapeElement->m_oShape.m_oText.m_arParagraphs[nIndexPar];
NSPresentationEditor::CParagraph* pParagraph = &m_pShapeElement->m_pShape->m_oText.m_arParagraphs[nIndexPar];
//if (m_bWordArt && nIndexPar == nCount-1)
//{
@ -1308,12 +1308,14 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"</a:xfrm>"));
}
if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic || m_pShapeElement->m_oShape.m_pShape->m_bCustomShape)
CBaseShapePtr shape = m_pShapeElement->m_pShape->getBaseShape();
if (m_pShapeElement->m_pShape->m_lDrawType & c_ShapeDrawType_Graphic || shape->m_bCustomShape)
{
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
m_pShapeElement->m_pShape->ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
}
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !m_pShapeElement->m_oShape.m_pShape->m_bCustomShape)
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !shape->m_bCustomShape)
{
if (prstGeom.empty()) prstGeom = L"rect";
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));

View File

@ -170,7 +170,7 @@ namespace NSPresentationEditor
m_lNextShapeID = 1000;
}
bool SetElement(IElement* pElem);
bool SetElement(CElementPtr pElem);
//--------------------------------------------------------------------
std::wstring ConvertShape ();
std::wstring ConvertImage ();

View File

@ -93,7 +93,8 @@ public:
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
m_bMacros = pInfo->m_bMacros;
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt;
if (bResult == false)

View File

@ -757,16 +757,14 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
IElement* pElement = NULL;
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, pNotes->m_lOriginalWidth, pNotes->m_lOriginalHeight,
CElementPtr pElement = oArrayShapes[nShape]->GetElement(&m_oExMedia, pNotes->m_lOriginalWidth, pNotes->m_lOriginalHeight,
pTheme, pLayout, pThemeWrapper, pNotesWrapper, pNotes);
if (NULL != pElement)
{
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor && !bMasterBackGround)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
pShape->SetupProperties(pNotes, pTheme, pLayout);
@ -774,7 +772,6 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
pNotes->m_bIsBackground = true;
pNotes->m_oBackground = pShape->m_oBrush;
}
RELEASEOBJECT(pElement);
continue;
}
@ -1002,16 +999,14 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
IElement* pElement = NULL;
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight,
CElementPtr pElement = oArrayShapes[nShape]->GetElement(&m_oExMedia, pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight,
pTheme, pLayout, pThemeWrapper, pSlideWrapper, pSlide);
if (NULL != pElement)
{
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor && !bMasterBackGround)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
pShape->SetupProperties(pSlide, pTheme, pLayout);
@ -1019,7 +1014,6 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
pSlide->m_bIsBackground = true;
pSlide->m_oBackground = pShape->m_oBrush;
}
RELEASEOBJECT(pElement);
continue;
}else
@ -1044,13 +1038,12 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
//-------------элементы колонтитулов
std::multimap<int, int>::iterator it;
IElement* pElement = NULL;
if (bHasSlideNumber) AddLayoutSlidePlaceholder(pSlide, MasterSlideNumber, pLayout, true);
if (bHasDate)
{
IElement *pElement = AddLayoutSlidePlaceholder(pSlide, MasterDate, pLayout, true);
CElementPtr pElement = AddLayoutSlidePlaceholder(pSlide, MasterDate, pLayout, true);
if (pElement) pElement->m_nFormatDate = nFormatDate;
}
@ -1058,9 +1051,9 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
if (bHasFooter) AddLayoutSlidePlaceholder(pSlide, MasterFooter, pLayout, true);
}
IElement* CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only)
CElementPtr CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only)
{
IElement* pElement = NULL;
CElementPtr pElement;
for (std::multimap<int, int>::iterator it = pLayout->m_mapPlaceholders.begin(); it != pLayout->m_mapPlaceholders.end(); it++)
{
@ -1073,7 +1066,7 @@ IElement* CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placehold
pElement = pLayout->m_arElements[it->second]->CreateDublicate();
pSlide->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pSlide->m_arElements.push_back(pElement);
pSlide->m_mapPlaceholders.insert(std::pair<int, int>(placeholderType, pSlide->m_arElements.size()-1));
}
else
@ -1092,7 +1085,7 @@ IElement* CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placehold
{
pElement = pLayout->m_arElements[it->second]->CreateDublicate();
pSlide->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pSlide->m_arElements.push_back(pElement);
pSlide->m_mapPlaceholders.insert(std::pair<int, int>(placeholderType, pSlide->m_arElements.size()-1));
}
}
@ -1102,9 +1095,9 @@ IElement* CPPTUserInfo::AddLayoutSlidePlaceholder (CSlide *pSlide, int placehold
return pElement;
}
IElement* CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only)
CElementPtr CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only)
{
IElement* pElement = NULL;
CElementPtr pElement;
for (std::multimap<int, int>::iterator it = pTheme->m_mapPlaceholders.begin(); it != pTheme->m_mapPlaceholders.end(); it++)
{
@ -1116,7 +1109,7 @@ IElement* CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int placeho
pElement->m_bPlaceholderSet = true;
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElement));
pLayout->m_arElements.push_back(pElement);
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(placeholderType, pLayout->m_arElements.size()-1));
}
}
@ -1124,9 +1117,9 @@ IElement* CPPTUserInfo::AddThemeLayoutPlaceholder (CLayout *pLayout, int placeho
return pElement; //last added
}
IElement* CPPTUserInfo::AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset)
CElementPtr CPPTUserInfo::AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset)
{
if (placeholderType < 1) return NULL;
if (placeholderType < 1) return CElementPtr();
CShapeElement* pShape = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
@ -1139,10 +1132,12 @@ IElement* CPPTUserInfo::AddNewLayoutPlaceholder (CLayout *pLayout, int placehold
CorrectPlaceholderType(pShape->m_lPlaceholderType);
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pShape));
CElementPtr pElement = CElementPtr(pShape);
pLayout->m_arElements.push_back(pElement);
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(pShape->m_lPlaceholderType, pLayout->m_arElements.size()-1));
return pShape;
return pElement;
}
int CPPTUserInfo::AddNewLayout(CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects)
@ -1244,7 +1239,7 @@ int CPPTUserInfo::AddNewLayout(CTheme* pTheme, CRecordSlide* pRecordSlide, bool
{
if (it1->first == it->first)
{
IElement* pElemLayout = pLayout->m_arElements[it1->second];
CElementPtr pElemLayout = pLayout->m_arElements[it1->second];
if (pElemLayout->m_lPlaceholderID == pTheme->m_arElements[it->second]->m_lPlaceholderID)
{
found = true;
@ -1254,9 +1249,9 @@ int CPPTUserInfo::AddNewLayout(CTheme* pTheme, CRecordSlide* pRecordSlide, bool
}
if (found == false)
{
IElement *pElemTheme = pTheme->m_arElements[it->second]->CreateDublicate();
CElementPtr pElemTheme = pTheme->m_arElements[it->second]->CreateDublicate();
pLayout->m_arElements.push_back(dynamic_cast<IElement*>(pElemTheme));
pLayout->m_arElements.push_back(pElemTheme);
pLayout->m_mapPlaceholders.insert(std::pair<int, int>(it->first, pLayout->m_arElements.size()-1));
}
}
@ -1275,9 +1270,9 @@ int CPPTUserInfo::AddNewLayout(CTheme* pTheme, CRecordSlide* pRecordSlide, bool
return ind;
}
IElement* CPPTUserInfo::AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset)
CElementPtr CPPTUserInfo::AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset)
{
if (placeholderType < 1) return NULL;
if (placeholderType < 1) return CElementPtr();
CShapeElement* pShape = new CShapeElement(NSBaseShape::ppt, PPTShapes::sptCRect);
@ -1290,10 +1285,12 @@ IElement* CPPTUserInfo::AddNewThemePlaceholder (CTheme* pTheme, int placeholderT
CorrectPlaceholderType(pShape->m_lPlaceholderType);
pTheme->m_arElements.push_back(dynamic_cast<IElement*>(pShape));
CElementPtr pElement = CElementPtr(pShape);
pTheme->m_arElements.push_back(pElement);
pTheme->m_mapPlaceholders.insert(std::pair<int, int>(pShape->m_lPlaceholderType, pTheme->m_arElements.size()-1));
return pShape;
return pElement;
}
void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight)
{
@ -1507,16 +1504,15 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
NSPresentationEditor::IElement* pElement = NULL;
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
NSPresentationEditor::CElementPtr pElement = oArrayShapes[nShape]->GetElement(&m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
if (NULL != pElement)
if (pElement)
{
AddAnimation ( dwMasterID, lOriginWidth, lOriginHeight, pElement );
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
pShape->SetupProperties(NULL, pTheme, pLayout);
@ -1524,8 +1520,6 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
pTheme->m_bIsBackground = true;
pTheme->m_oBackground = pShape->m_oBrush;
}
RELEASEINTERFACE(pElement);
continue;
}
pTheme->m_arElements.push_back(pElement);
@ -1756,16 +1750,15 @@ void CPPTUserInfo::LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrappe
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
NSPresentationEditor::IElement* pElement = NULL;
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
NSPresentationEditor::CElementPtr pElement = oArrayShapes[nShape]->GetElement(&m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pMasterWrapper, pMasterWrapper);
if (NULL != pElement)
if (pElement)
{
//AddAnimation ( dwMasterID, lOriginWidth, lOriginHeight, pElement );
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
pShape->SetupProperties(NULL, pTheme, pLayout);
@ -1773,8 +1766,6 @@ void CPPTUserInfo::LoadMaster(CRecordSlide* pMaster, CSlideInfo *& pMasterWrappe
pTheme->m_bIsBackground = true;
pTheme->m_oBackground = pShape->m_oBrush;
}
RELEASEINTERFACE(pElement);
continue;
}
pTheme->m_arElements.push_back(pElement);
@ -1948,16 +1939,15 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
for (size_t nShape = 0; nShape < oArrayShapes.size(); ++nShape)
{
IElement* pElement = NULL;
oArrayShapes[nShape]->GetElement(&pElement, &m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pThemeWrapper, pMasterWrapper);
CElementPtr pElement =oArrayShapes[nShape]->GetElement(&m_oExMedia, lOriginWidth, lOriginHeight, pTheme, pLayout, pThemeWrapper, pMasterWrapper);
if (NULL != pElement)
if (pElement)
{
AddAnimation ( dwMasterID, lOriginWidth, lOriginHeight, pElement );
if (pElement->m_bIsBackground && !pElement->m_bHaveAnchor)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
{
@ -1966,7 +1956,6 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
pLayout->m_bIsBackground = true;
pLayout->m_oBackground = pShape->m_oBrush;
}
RELEASEINTERFACE(pElement);
continue;
}
@ -2385,7 +2374,7 @@ void CPPTUserInfo::LoadExAudio(CRecordsContainer* pExObject)
oArrayCString.clear();
}
void CPPTUserInfo::AddAnimation ( DWORD dwSlideID, double Width, double Height, IElement* pElement )
void CPPTUserInfo::AddAnimation ( DWORD dwSlideID, double Width, double Height, CElementPtr pElement )
{
std::map <DWORD, Animations::CSlideTimeLine*>::iterator pPair = m_mapAnimations.find( dwSlideID );
@ -2439,7 +2428,7 @@ void CPPTUserInfo::AddAudioTransition (DWORD dwSlideID, CTransition* pTransition
}
// ??? недоделка ???
pAudio->Release();
delete pAudio;
}
void CPPTUserInfo::CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme)

View File

@ -310,15 +310,15 @@ public:
return _T("blank");
}
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
void AddAnimation (DWORD dwSlideID, double Width, double Height, CElementPtr pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const std::wstring& strFilePath);
int AddNewLayout(NSPresentationEditor::CTheme* pTheme, CRecordSlide* pRecordSlide, bool addShapes, bool bMasterObjects);
IElement* AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1);
CElementPtr AddNewLayoutPlaceholder (CLayout *pLayout, int placeholderType, int placeholderSizePreset = -1);
IElement* AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1);
CElementPtr AddNewThemePlaceholder (CTheme* pTheme, int placeholderType, int placeholderSizePreset = -1);
IElement* AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only = false);
IElement* AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only = false);
CElementPtr AddThemeLayoutPlaceholder (CLayout *pLayout, int placeholderType, CTheme* pTheme, bool idx_only = false);
CElementPtr AddLayoutSlidePlaceholder (CSlide *pSlide, int placeholderType, CLayout *pLayout, bool idx_only = false);
};

View File

@ -113,9 +113,9 @@ public:
}
return false;
}
CColor CorrectSysColor(int nColorCode, IElement* pElement, CTheme* pTheme)
CColor CorrectSysColor(int nColorCode, CElementPtr pElement, CTheme* pTheme)
{
if (pElement == NULL) return CColor();
if (!pElement) return CColor();
CColor color;
@ -229,7 +229,7 @@ public:
return color;
}
inline void SetUpProperties(IElement* pElement, CTheme* pTheme, CSlideInfo* pWrapper, CSlide* pSlide, CProperties* pProperties)
inline void SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pWrapper, CSlide* pSlide, CProperties* pProperties)
{
long lCount = pProperties->m_lCount;
switch (pElement->m_etType)
@ -239,7 +239,7 @@ public:
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
{
SetUpPropertyVideo((CVideoElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
SetUpPropertyVideo(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
break;
}
@ -249,7 +249,7 @@ public:
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
SetUpPropertyImage(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
break;
}
@ -258,14 +258,14 @@ public:
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
{
SetUpPropertyAudio((CAudioElement*)pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
SetUpPropertyAudio(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
break;
}
case NSPresentationEditor::etShape:
{
CShapeElement* pShapeElem = (CShapeElement*)pElement;
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShapeElem->m_oShape.m_pShape);
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElement.get());
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShapeElem->m_pShape->getBaseShape().get());
if (NULL != pPPTShape)
{
@ -274,7 +274,7 @@ public:
for (long i = 0; i < lCount; ++i)
{
SetUpPropertyShape(pShapeElem, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
SetUpPropertyShape(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
if (NULL != pPPTShape)
@ -289,7 +289,7 @@ public:
}
}
inline void SetUpProperty(IElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
inline void SetUpProperty(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
bool bIsFilled = true;
@ -797,17 +797,19 @@ public:
}
}
inline void SetUpPropertyVideo(CVideoElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
inline void SetUpPropertyVideo(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpPropertyImage(pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
inline void SetUpPropertyAudio(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpPropertyImage(pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
inline void SetUpPropertyImage(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpProperty(pElement, pTheme, pInfo, pSlide, pProperty);
CImageElement* image_element = dynamic_cast<CImageElement*>(pElement.get());
switch(pProperty->m_ePID)
{
@ -816,50 +818,55 @@ public:
int dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
if (dwOffset >=0)
{
pElement->m_strImageFileName += pInfo->GetFileNamePicture(dwOffset);
pElement->m_bImagePresent = true;
image_element->m_strImageFileName += pInfo->GetFileNamePicture(dwOffset);
image_element->m_bImagePresent = true;
}
}break;
case pictureId://OLE identifier of the picture.
{
pElement->m_bOLE = true;
image_element->m_bOLE = true;
}break;
case pibName:
{
pElement->m_sImageName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2-1);
image_element->m_sImageName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)pProperty->m_pOptions, pProperty->m_lValue /2-1);
// TextMining05.ppt, слайд 20 - некорректное имя ( - todooo потом подчистить его
}break;
case cropFromTop:
{
pElement->m_lcropFromTop = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
image_element->m_lcropFromTop = pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromBottom:
{
pElement->m_lcropFromBottom = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
image_element->m_lcropFromBottom = pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromLeft:
{
pElement->m_lcropFromLeft = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
image_element->m_lcropFromLeft = pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromRight:
{
pElement->m_lcropFromRight = pProperty->m_lValue;
pElement->m_bCropEnabled = true;
image_element->m_lcropFromRight = pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case pibFlags:
{
}break;
}
}
inline void SetUpPropertyShape(CShapeElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
inline void SetUpPropertyShape(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpProperty(pElement, pTheme, pInfo, pSlide, pProperty);
CShape* pParentShape = &pElement->m_oShape;
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
CShapeElement* shape_element = dynamic_cast<CShapeElement*>(pElement.get());
CShapePtr pParentShape = shape_element->m_pShape;
if (NULL == pParentShape)
return;
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->getBaseShape().get());
if (NULL == pShape)
return;
@ -1238,22 +1245,19 @@ public:
}
virtual void GetElement (IElement** ppElement, CExMedia* pMapIDs,
CElementPtr GetElement (CExMedia* pMapIDs,
long lSlideWidth, long lSlideHeight, CTheme* pTheme, CLayout* pLayout,
CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide = NULL)
{
if (NULL == ppElement)
return;
if (bGroupShape) return CElementPtr();
if (bGroupShape) return;
*ppElement = NULL;
CElementPtr pElement;
std::vector<CRecordShape*> oArrayShape;
GetRecordsByType(&oArrayShape, true, true);
if (0 == oArrayShape.size())
return;
return pElement;
std::vector<CRecordPlaceHolderAtom*> oArrayPlaceHolder;
GetRecordsByType(&oArrayPlaceHolder, true, true);
@ -1266,7 +1270,7 @@ public:
int lMasterID = -1;
IElement * pElementLayout = NULL;
CElementPtr pElementLayout;
if (NULL != pSlide)
{
@ -1301,13 +1305,13 @@ public:
pLayout->m_arElements[nIndex]->m_lPlaceholderID = placeholder_id;
}
*ppElement = pLayout->m_arElements[nIndex]->CreateDublicate();
pElement = pLayout->m_arElements[nIndex]->CreateDublicate();
if (elType == etShape)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(*ppElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShape)
pShape->m_oShape.m_oText.m_arParagraphs.clear();
pShape->m_pShape->m_oText.m_arParagraphs.clear();
}
break;
@ -1321,9 +1325,7 @@ public:
}
// раньше искался шейп - и делался дубликат. Теперь думаю это не нужно
// нужно ориентироваться на placeholder (type & id)
IElement* pElem = *ppElement;
if (NULL == pElem)
if (!pElement)
{
switch (eType)
{
@ -1362,11 +1364,12 @@ public:
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath ;
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
pElem = (IElement*)pVideoElem;
pElement = CElementPtr(pVideoElem);
}
else if (CExFilesInfo::eftAudio == exType)
{
CAudioElement* pAudioElem = new CAudioElement();
pElement = CElementPtr(pAudioElem);
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath;
pAudioElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
@ -1385,38 +1388,38 @@ public:
else
{
if (pLayout)
pLayout->m_arElements.push_back(pAudioElem);
pLayout->m_arElements.push_back(pElement);
}
pElem = (IElement*)pAudioElem;
}
else
{
CImageElement* pImageElem = new CImageElement();
pImageElem->m_strImageFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pElem = (IElement*)pImageElem;
pElement = CElementPtr(pImageElem);
}
}break;
default:
{
// shape
CShapeElement* pShape = new CShapeElement(NSBaseShape::ppt, eType);
CPPTShape *ppt_shape = dynamic_cast<CPPTShape *>(pShape->m_oShape.m_pShape);
CPPTShape *ppt_shape = dynamic_cast<CPPTShape *>(pShape->m_pShape->getBaseShape().get());
if ( (ppt_shape) && (OOXMLShapes::sptCustom == ppt_shape->m_eType))
{
pShape->m_bShapePreset = true;
}
pElem = (IElement*)pShape;
pElement = CElementPtr(pShape);
}break;
}
}
if (NULL == pElem)
return;
if (!pElement)
return pElement;
pElem->m_lID = oArrayShape[0]->m_nID;
pElem->m_lLayoutID = lMasterID;
pElement->m_lID = oArrayShape[0]->m_nID;
pElement->m_lLayoutID = lMasterID;
//---------внешние ссылки
{
@ -1425,7 +1428,7 @@ public:
if (NULL != pTextureInfo)
{
pElem->m_oBrush.TexturePath = pTextureInfo->m_strFilePath + FILE_SEPARATOR_STR;
pElement->m_oBrush.TexturePath = pTextureInfo->m_strFilePath + FILE_SEPARATOR_STR;
}
std::vector<CRecordExObjRefAtom*> oArrayEx;
@ -1436,7 +1439,7 @@ public:
if (CExFilesInfo::eftHyperlink == exType && pInfo)
{
pElem->m_sHyperlink = pInfo->m_strFilePath;
pElement->m_sHyperlink = pInfo->m_strFilePath;
}
}
}
@ -1445,30 +1448,30 @@ public:
// placeholders
if (0 < oArrayPlaceHolder.size())
{
pElem->m_bLine = false; //по умолчанию у них нет линий
pElem->m_lPlaceholderID = oArrayPlaceHolder[0]->m_nPosition;
pElem->m_lPlaceholderType = oArrayPlaceHolder[0]->m_nPlacementID;
pElem->m_lPlaceholderSizePreset = oArrayPlaceHolder[0]->m_nSize;
pElement->m_bLine = false; //по умолчанию у них нет линий
pElement->m_lPlaceholderID = oArrayPlaceHolder[0]->m_nPosition;
pElement->m_lPlaceholderType = oArrayPlaceHolder[0]->m_nPlacementID;
pElement->m_lPlaceholderSizePreset = oArrayPlaceHolder[0]->m_nSize;
if (pElementLayout)
pElementLayout->m_lPlaceholderSizePreset = oArrayPlaceHolder[0]->m_nSize;
CorrectPlaceholderType(pElem->m_lPlaceholderType);
CorrectPlaceholderType(pElement->m_lPlaceholderType);
}
std::vector<CRecordRoundTripHFPlaceholder12Atom*> oArrayHFPlaceholder;
GetRecordsByType(&oArrayHFPlaceholder, true, true);
if (0 < oArrayHFPlaceholder.size())
{
pElem->m_lPlaceholderType = oArrayHFPlaceholder[0]->m_nPlacementID;//PT_MasterDate, PT_MasterSlideNumber, PT_MasterFooter, or PT_MasterHeader
CorrectPlaceholderType(pElem->m_lPlaceholderType);
pElement->m_lPlaceholderType = oArrayHFPlaceholder[0]->m_nPlacementID;//PT_MasterDate, PT_MasterSlideNumber, PT_MasterFooter, or PT_MasterHeader
CorrectPlaceholderType(pElement->m_lPlaceholderType);
if (pLayout)
{
std::multimap<int, int>::iterator it = pLayout->m_mapPlaceholders.find(pElem->m_lPlaceholderType);
std::multimap<int, int>::iterator it = pLayout->m_mapPlaceholders.find(pElement->m_lPlaceholderType);
if (it != pLayout->m_mapPlaceholders.end())
{
pElem->m_lPlaceholderID = pLayout->m_arElements[it->second]->m_lPlaceholderID;
pElement->m_lPlaceholderID = pLayout->m_arElements[it->second]->m_lPlaceholderID;
}
}
}
@ -1478,31 +1481,31 @@ public:
GetRecordsByType(&oArrayFooterMeta, true, true);
if (0 < oArrayFooterMeta.size())
{
pElem->m_lPlaceholderType = PT_MasterFooter;
pElem->m_lPlaceholderUserStr = oArrayFooterMeta[0]->m_nPosition;
pElement->m_lPlaceholderType = PT_MasterFooter;
pElement->m_lPlaceholderUserStr = oArrayFooterMeta[0]->m_nPosition;
}
std::vector<CRecordSlideNumberMetaAtom*> oArraySlideNumberMeta;
GetRecordsByType(&oArraySlideNumberMeta, true, true);
if (0 < oArraySlideNumberMeta.size())
{
pElem->m_lPlaceholderType = PT_MasterSlideNumber;
pElement->m_lPlaceholderType = PT_MasterSlideNumber;
}
std::vector<CRecordGenericDateMetaAtom*> oArrayDateMeta;
GetRecordsByType(&oArrayDateMeta, true, true);
if (0 < oArrayDateMeta.size())
{
pElem->m_lPlaceholderType = PT_MasterDate;
pElement->m_lPlaceholderType = PT_MasterDate;
CRecordDateTimeMetaAtom* format_data = dynamic_cast<CRecordDateTimeMetaAtom*>(oArrayDateMeta[0]);
if (format_data)
{
pElem->m_nFormatDate = 1;
pElement->m_nFormatDate = 1;
//todooo сделать форматированый вывод
}
else
{
pElem->m_lPlaceholderUserStr = oArrayDateMeta[0]->m_nPosition;
pElem->m_nFormatDate = 2;
pElement->m_lPlaceholderUserStr = oArrayDateMeta[0]->m_nPosition;
pElement->m_nFormatDate = 2;
}
}
//------------- привязки ---------------------------------------------------------------------------------
@ -1513,12 +1516,12 @@ public:
if (0 != oArrayAnchor.size())
{
pElem->m_rcBoundsOriginal.left = (LONG)oArrayAnchor[0]->m_oBounds.Left;
pElem->m_rcBoundsOriginal.top = (LONG)oArrayAnchor[0]->m_oBounds.Top;
pElem->m_rcBoundsOriginal.right = (LONG)oArrayAnchor[0]->m_oBounds.Right;
pElem->m_rcBoundsOriginal.bottom = (LONG)oArrayAnchor[0]->m_oBounds.Bottom;
pElement->m_rcBoundsOriginal.left = (LONG)oArrayAnchor[0]->m_oBounds.Left;
pElement->m_rcBoundsOriginal.top = (LONG)oArrayAnchor[0]->m_oBounds.Top;
pElement->m_rcBoundsOriginal.right = (LONG)oArrayAnchor[0]->m_oBounds.Right;
pElement->m_rcBoundsOriginal.bottom = (LONG)oArrayAnchor[0]->m_oBounds.Bottom;
pElem->m_bBoundsEnabled = true;
pElement->m_bBoundsEnabled = true;
bAnchor = true;
}
else
@ -1528,14 +1531,14 @@ public:
if (0 != oArrayChildAnchor.size())
{
pElem->m_rcBoundsOriginal.left = oArrayChildAnchor[0]->m_oBounds.left;
pElem->m_rcBoundsOriginal.top = oArrayChildAnchor[0]->m_oBounds.top;
pElem->m_rcBoundsOriginal.right = oArrayChildAnchor[0]->m_oBounds.right;
pElem->m_rcBoundsOriginal.bottom = oArrayChildAnchor[0]->m_oBounds.bottom;
pElement->m_rcBoundsOriginal.left = oArrayChildAnchor[0]->m_oBounds.left;
pElement->m_rcBoundsOriginal.top = oArrayChildAnchor[0]->m_oBounds.top;
pElement->m_rcBoundsOriginal.right = oArrayChildAnchor[0]->m_oBounds.right;
pElement->m_rcBoundsOriginal.bottom = oArrayChildAnchor[0]->m_oBounds.bottom;
RecalcGroupShapeAnchor(pElem->m_rcBoundsOriginal);
RecalcGroupShapeAnchor(pElement->m_rcBoundsOriginal);
pElem->m_bBoundsEnabled = true;
pElement->m_bBoundsEnabled = true;
bAnchor = true;
}
else
@ -1543,18 +1546,18 @@ public:
if (oArrayShape[0]->m_bBackground)
{
// здесь background
pElem->m_rcBoundsOriginal.left = 0;
pElem->m_rcBoundsOriginal.top = 0;
pElem->m_rcBoundsOriginal.right = lSlideWidth;
pElem->m_rcBoundsOriginal.bottom = lSlideHeight;
pElement->m_rcBoundsOriginal.left = 0;
pElement->m_rcBoundsOriginal.top = 0;
pElement->m_rcBoundsOriginal.right = lSlideWidth;
pElement->m_rcBoundsOriginal.bottom = lSlideHeight;
}
else
{
// не понятно...
pElem->m_rcBoundsOriginal.left = 0;
pElem->m_rcBoundsOriginal.top = 0;
pElem->m_rcBoundsOriginal.right = 0;
pElem->m_rcBoundsOriginal.bottom = 0;
pElement->m_rcBoundsOriginal.left = 0;
pElement->m_rcBoundsOriginal.top = 0;
pElement->m_rcBoundsOriginal.right = 0;
pElement->m_rcBoundsOriginal.bottom = 0;
}
}
}
@ -1562,30 +1565,30 @@ public:
double dScaleX = c_dMasterUnitsToMillimetreKoef;
double dScaleY = c_dMasterUnitsToMillimetreKoef;
pElem->NormalizeCoords(dScaleX, dScaleY);
pElement->NormalizeCoords(dScaleX, dScaleY);
pElem->m_bFlipH = oArrayShape[0]->m_bFlipH;
pElem->m_bFlipV = oArrayShape[0]->m_bFlipV;
pElement->m_bFlipH = oArrayShape[0]->m_bFlipH;
pElement->m_bFlipV = oArrayShape[0]->m_bFlipV;
if (pElementLayout && bAnchor)
{
pElementLayout->m_rcBoundsOriginal = pElem->m_rcBoundsOriginal;
pElementLayout->m_rcBounds = pElem->m_rcBounds;
pElementLayout->m_rcBoundsOriginal = pElement->m_rcBoundsOriginal;
pElementLayout->m_rcBounds = pElement->m_rcBounds;
pElementLayout->m_bPlaceholderSet = true;
pElementLayout->m_bBoundsEnabled = true;
}
//--------- наличие текста --------------------------------------------------------------------------
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElem);
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL != pShapeElem)
{
CElementInfo oElementInfo;
oElementInfo.m_lMasterPlaceholderType = pElem->m_lPlaceholderType;
oElementInfo.m_lMasterPlaceholderType = pElement->m_lPlaceholderType;
pShapeElem->m_oShape.m_dWidthLogic = ShapeSizeVML;
pShapeElem->m_oShape.m_dHeightLogic = ShapeSizeVML;
pShapeElem->m_pShape->m_dWidthLogic = ShapeSizeVML;
pShapeElem->m_pShape->m_dHeightLogic = ShapeSizeVML;
// проверка на textheader present
std::vector<CRecordTextHeaderAtom*> oArrayTextHeader;
@ -1593,14 +1596,14 @@ public:
if (0 < oArrayTextHeader.size())
{
pShapeElem->m_oShape.m_oText.m_lTextType = oArrayTextHeader[0]->m_nTextType;
pShapeElem->m_oShape.m_oText.m_lTextMasterType = oArrayTextHeader[0]->m_nTextType;
pShapeElem->m_pShape->m_oText.m_lTextType = oArrayTextHeader[0]->m_nTextType;
pShapeElem->m_pShape->m_oText.m_lTextMasterType = oArrayTextHeader[0]->m_nTextType;
oElementInfo.m_lMasterTextType = oArrayTextHeader[0]->m_nTextType;
}
else
{
pShapeElem->m_oShape.m_oText.m_lTextType = NSOfficePPT::NoPresent;
pShapeElem->m_oShape.m_oText.m_lTextMasterType = NSOfficePPT::NoPresent;
pShapeElem->m_pShape->m_oText.m_lTextType = NSOfficePPT::NoPresent;
pShapeElem->m_pShape->m_oText.m_lTextMasterType = NSOfficePPT::NoPresent;
oElementInfo.m_lMasterTextType = NSOfficePPT::NoPresent;
}
@ -1629,17 +1632,17 @@ public:
strShapeText = oArrayTextChars[0]->m_strText;
}
if (pElem->m_lPlaceholderType == PT_MasterSlideNumber && strShapeText.length() > 5)
if (pElement->m_lPlaceholderType == PT_MasterSlideNumber && strShapeText.length() > 5)
{
int pos = strShapeText.find(L"*");
if (pos < 0) pElem->m_lPlaceholderType = PT_MasterFooter; ///???? 1-(33).ppt
if (pos < 0) pElement->m_lPlaceholderType = PT_MasterFooter; ///???? 1-(33).ppt
}
//------ shape properties ----------------------------------------------------------------------------------------
for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
{
CPPTElement oElement;
oElement.SetUpProperties(pElem, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
oElement.SetUpProperties(pElement, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
}
std::vector<CRecordStyleTextPropAtom*> oArrayTextStyle;
@ -1662,7 +1665,7 @@ public:
this->GetRecordsByType(&oArrayTextRuler, true, true);
if (0 != oArrayTextRuler.size())
{
pShapeElem->m_oShape.m_oText.m_oRuler = oArrayTextRuler[0]->m_oTextRuler;
pShapeElem->m_pShape->m_oText.m_oRuler = oArrayTextRuler[0]->m_oTextRuler;
}
std::vector<CRecordInteractiveInfoAtom*> oArrayInteractive;
@ -1749,38 +1752,38 @@ public:
pSlideWrapper->m_mapElements.insert(std::pair<LONG, CElementInfo>(pShapeElem->m_lID, oElementInfo));
SetUpTextStyle(strShapeText, pTheme, pLayout, pElem, pThemeWrapper, pSlideWrapper, pSlide, master_level);
SetUpTextStyle(strShapeText, pTheme, pLayout, pElement, pThemeWrapper, pSlideWrapper, pSlide, master_level);
}
else
{//image, audio, video ....
for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
{
CPPTElement oElement;
oElement.SetUpProperties(pElem, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
oElement.SetUpProperties(pElement, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
}
pElem->m_lLayoutID = lMasterID;
pElement->m_lLayoutID = lMasterID;
}
//----------------------------------------------------------------------------------------------------
if (NULL != pSlide)
{
pElem->m_dStartTime = pSlide->m_dStartTime;
pElem->m_dEndTime = pSlide->m_dEndTime;
pElement->m_dStartTime = pSlide->m_dStartTime;
pElement->m_dEndTime = pSlide->m_dEndTime;
pElem->m_oMetric.SetUnitsContainerSize(pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight);
pElement->m_oMetric.SetUnitsContainerSize(pSlide->m_lOriginalWidth, pSlide->m_lOriginalHeight);
}
else
{
pElem->m_dStartTime = 0;
pElem->m_dEndTime = 0;
pElement->m_dStartTime = 0;
pElement->m_dEndTime = 0;
pElem->m_oMetric.SetUnitsContainerSize(lSlideWidth, lSlideHeight);
pElement->m_oMetric.SetUnitsContainerSize(lSlideWidth, lSlideHeight);
}
pElem->m_bIsBackground = (true == oArrayShape[0]->m_bBackground);
pElem->m_bHaveAnchor = (true == oArrayShape[0]->m_bHaveAnchor);
pElement->m_bIsBackground = (true == oArrayShape[0]->m_bBackground);
pElement->m_bHaveAnchor = (true == oArrayShape[0]->m_bHaveAnchor);
*ppElement = pElem;
return pElement;
}
void RecalcGroupShapeAnchor(CDoubleRect& rcChildAnchor)
@ -1846,13 +1849,13 @@ public:
protected:
void ApplyThemeStyle(IElement* pElem, CTheme* pTheme, CRecordMasterTextPropAtom* master_levels)
void ApplyThemeStyle(CElementPtr pElem, CTheme* pTheme, CRecordMasterTextPropAtom* master_levels)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem.get());
if (NULL == pShape)
return;
CTextAttributesEx* pText = &(pShape->m_oShape.m_oText);
CTextAttributesEx* pText = &(pShape->m_pShape->m_oText);
if (master_levels)
@ -1870,7 +1873,7 @@ protected:
pText->ApplyThemeStyle(pTheme);
}
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, IElement* pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide, CRecordMasterTextPropAtom* master_levels)
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, CElementPtr pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide, CRecordMasterTextPropAtom* master_levels)
{
// сначала проверяем на shape
// затем применяем все настройки по-очереди
@ -1890,11 +1893,11 @@ protected:
if (etShape != pElem->m_etType)
return;
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem.get());
if (NULL == pShape)
return;
CTextAttributesEx* pTextSettings = &(pShape->m_oShape.m_oText);
CTextAttributesEx* pTextSettings = &(pShape->m_pShape->m_oText);
// сначала применим ссылки на masterstyle (для шаблонного элемента)
// как узнать - просто есть ли массивы (т.к. они могли появиться пока только оттуда)
@ -1923,11 +1926,11 @@ protected:
{
for (size_t i = 0; i < pLayout->m_arElements.size(); ++i)
{
IElement* pPh = pLayout->m_arElements[i];
CElementPtr & pPh = pLayout->m_arElements[i];
if ((etShape == pPh->m_etType) && (ph_type == pPh->m_lPlaceholderType) && (/*ph_pos == pPh->m_lPlaceholderID*/true))
{
pElementLayoutPH = dynamic_cast<CShapeElement*>(pPh);
eTypeMaster = (NSOfficePPT::TextType)pElementLayoutPH->m_oShape.m_oText.m_lTextMasterType;
pElementLayoutPH = dynamic_cast<CShapeElement*>(pPh.get());
eTypeMaster = (NSOfficePPT::TextType)pElementLayoutPH->m_pShape->m_oText.m_lTextMasterType;
break;
}
}
@ -1984,7 +1987,7 @@ protected:
pStyle->ReadFromStream(oHeader, oElemInfo.m_pStream);
NSPresentationEditor::ConvertPPTTextToEditorStructure(pStyle->m_arrPFs, pStyle->m_arrCFs, strText, pShape->m_oShape.m_oText);
NSPresentationEditor::ConvertPPTTextToEditorStructure(pStyle->m_arrPFs, pStyle->m_arrCFs, strText, pShape->m_pShape->m_oText);
bIsOwnPresentSettings = (0 < pStyle->m_lCount);
@ -2112,9 +2115,9 @@ protected:
{
if (NULL != pElementLayoutPH)
{
pTextSettings->m_oLayoutStyles = pElementLayoutPH->m_oShape.m_oText.m_oStyles;
pTextSettings->m_lTextType = pElementLayoutPH->m_oShape.m_oText.m_lTextType;
pTextSettings->m_lStyleThemeIndex = pElementLayoutPH->m_oShape.m_oText.m_lStyleThemeIndex;
pTextSettings->m_oLayoutStyles = pElementLayoutPH->m_pShape->m_oText.m_oStyles;
pTextSettings->m_lTextType = pElementLayoutPH->m_pShape->m_oText.m_lTextType;
pTextSettings->m_lStyleThemeIndex = pElementLayoutPH->m_pShape->m_oText.m_lStyleThemeIndex;
}
else
{
@ -2224,13 +2227,13 @@ protected:
pSpecInfo->m_lCount = -1;
pSpecInfo->ReadFromStream(oHeader, oElemInfo.m_pStream);
pSpecInfo->ApplyProperties(&(pShape->m_oShape.m_oText));
pSpecInfo->ApplyProperties(&(pShape->m_pShape->m_oText));
RELEASEOBJECT(pSpecInfo);
}
StreamUtils::StreamSeek(lPosition, oElemInfo.m_pStream);
}
pShape->m_oShape.m_oText.RecalcParagraphsPPT();
pShape->m_pShape->m_oText.RecalcParagraphsPPT();
ApplyThemeStyle(pElem, pTheme, master_levels);
@ -2246,7 +2249,7 @@ protected:
ApplyHyperlink(pShape, oColor);
}
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_oShape.m_pShape);
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_pShape->getBaseShape().get());
if (NULL != pPPTShape) // проверка на wordart
{
@ -2293,12 +2296,12 @@ protected:
case sptTextCanUp:
case sptTextCanDown:
{
pShape->m_oShape.m_oText.m_oAttributes.m_oTextBrush = pShape->m_oBrush;
pShape->m_pShape->m_oText.m_oAttributes.m_oTextBrush = pShape->m_oBrush;
pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical = 1;
pShape->m_pShape->m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
pShape->m_pShape->m_oText.m_oAttributes.m_nTextAlignVertical = 1;
pShape->m_oShape.m_lDrawType = c_ShapeDrawType_Text;
pShape->m_pShape->m_lDrawType = c_ShapeDrawType_Text;
break;
}
default:
@ -2310,7 +2313,7 @@ protected:
void ApplyHyperlink(CShapeElement* pShape, CColor& oColor)
{
std::vector<CTextRange>* pRanges = &pShape->m_oTextActions.m_arRanges;
CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText;
CTextAttributesEx* pTextAttributes = &pShape->m_pShape->m_oText;
int lCountHyper = pRanges->size();

View File

@ -56,7 +56,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -38,6 +38,8 @@
#include <tchar.h>
#pragma comment(lib, "Rpcrt4.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
@ -46,6 +48,10 @@
int _tmain(int argc, _TCHAR* argv[])
{
//#ifdef _DEBUG
// _CrtDumpMemoryLeaks();
//#endif
if (argc < 2) return 1;
std::wstring sSrcPpt = argv[1];

View File

@ -45,7 +45,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="_DEBUG;_CONSOLE;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

View File

@ -48,7 +48,7 @@
#include "./PPTXFormat/LegacyDiagramText.h"
#include "./Editor/Drawing/Elements.h"
#include "./Editor/Drawing/Shapes/BaseShape/PPTXShape/pptx2pptshapeconverter.h"
#include "./Editor/Drawing/Shapes/BaseShape/PPTXShape/Pptx2PptShapeConverter.h"
#include "../DesktopEditor/common/Directory.h"
@ -974,7 +974,6 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
if (oNode.IsValid())
{
#ifdef PPT_DEF
CPPTShape* pShape = new CPPTShape();
pShape->m_bIsShapeType = true;
@ -983,12 +982,12 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
std::wstring strId = oNodeST.GetAttribute(L"id");
pShape->LoadFromXMLShapeType(oNodeST);
CShape* pS = new CShape(NSBaseShape::unknown, 0);
pS->m_pShape = pShape;
CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
pS->setBaseShape(CBaseShapePtr(pShape));
LoadCoordSize(oNodeST, pS);
m_mapShapeTypes.insert(std::pair<std::wstring, CShape*>(strId, pS));
#endif
m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
}
return S_OK;
@ -1688,6 +1687,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
NSPresentationEditor::CShapeElement oShapeElem;
CPPTShape* pPPTShape = NULL;
bool bSetShape = false;
if (L"v:background" == strNameNode)
{
@ -1846,12 +1846,16 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
{
strType = strType.substr(1);
std::map<std::wstring, CShape*>::iterator pPair = m_mapShapeTypes.find(strType);
std::map<std::wstring, CShapePtr>::iterator pPair = m_mapShapeTypes.find(strType);
if (m_mapShapeTypes.end() != pPair)
{
CBaseShapePtr base_shape_type = pPair->second->getBaseShape();
CPPTShape* ppt_shape_type = dynamic_cast<CPPTShape*>(base_shape_type.get());
pPPTShape = new CPPTShape();
pPair->second->m_pShape->SetToDublicate(pPPTShape);
pPPTShape->m_eType = ((CPPTShape*)(pPair->second->m_pShape))->m_eType;
base_shape_type->SetToDublicate(pPPTShape);
pPPTShape->m_eType = ppt_shape_type->m_eType;
}
}
@ -1881,22 +1885,30 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
pPPTShape->m_eType = PPTShapes::sptCustom;
}
}
oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
bSetShape = true;
if (bIsNeedCoordSizes)
{
LoadCoordPos(oNodeShape, oShapeElem.m_pShape); //for path calculate
}
pPPTShape->LoadFromXMLShapeType(oNodeShape);
}
if (pPPTShape != NULL)
{
oShapeElem.m_oShape.m_pShape = pPPTShape;
{
if (!bSetShape)
oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
if (bIsNeedCoordSizes)
LoadCoordSize(oNodeShape, &oShapeElem.m_oShape);
{
LoadCoordSize(oNodeShape, oShapeElem.m_pShape);
}
else
{
oShapeElem.m_oShape.m_dWidthLogic = 21600;
oShapeElem.m_oShape.m_dHeightLogic = 21600;
oShapeElem.m_pShape->m_dWidthLogic = 21600;
oShapeElem.m_pShape->m_dHeightLogic = 21600;
oShapeElem.m_oShape.m_pShape->m_oPath.SetCoordsize(21600, 21600);
oShapeElem.m_pShape->getBaseShape()->m_oPath.SetCoordsize(21600, 21600);
}
std::wstring strXmlPPTX;
@ -2807,11 +2819,12 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
pShape->LoadFromXMLShapeType(oNodeT);
CShape* pS = new CShape(NSBaseShape::unknown, 0);
pS->m_pShape = pShape;
CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
pS->setBaseShape(CBaseShapePtr(pShape));
LoadCoordSize(oNodeT, pS);
m_mapShapeTypes.insert(std::pair<std::wstring, CShape*>(strId, pS));
m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
}
}
}
@ -2983,16 +2996,61 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
result->InitElem(pTree);
}
void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShape* pShape)
void CDrawingConverter::LoadCoordPos(XmlUtils::CXmlNode& oNode, CShapePtr pShape)
{
pShape->m_dWidthLogic = ShapeSizeVML;
pShape->m_dHeightLogic = ShapeSizeVML;
if (!pShape) return;
pShape->m_dXLogic = 0;
pShape->m_dYLogic = 0;
XmlUtils::CXmlNode oNodeTemplate;
if (oNode.GetNode(L"coordorigin", oNodeTemplate))
{
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(L"val");
if (!strCoordSize.empty())
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
if (oArray.size() >= 2)
{
pShape->m_dXLogic = XmlUtils::GetInteger(oArray[0]);
pShape->m_dYLogic = XmlUtils::GetInteger(oArray[1]);
}
}
}
else
{
std::wstring strCoordSize = oNode.GetAttributeOrValue(L"coordorigin");
if (!strCoordSize.empty())
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
if (oArray.size() >= 2)
{
pShape->m_dXLogic = XmlUtils::GetInteger(oArray[0]);
pShape->m_dYLogic = XmlUtils::GetInteger(oArray[1]);
}
}
}
pShape->getBaseShape()->m_oPath.SetCoordpos((LONG)pShape->m_dXLogic, (LONG)pShape->m_dYLogic);
}
void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShapePtr pShape)
{
if (!pShape) return;
pShape->m_dWidthLogic = ShapeSizeVML;
pShape->m_dHeightLogic = ShapeSizeVML;
XmlUtils::CXmlNode oNodeTemplate;
if (oNode.GetNode(L"coordsize", oNodeTemplate))
{
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(L"val");
if (strCoordSize != L"")
if (!strCoordSize.empty())
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
@ -3007,7 +3065,7 @@ void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShape* pShape)
else
{
std::wstring strCoordSize = oNode.GetAttributeOrValue(L"coordsize");
if (strCoordSize != L"")
if (!strCoordSize.empty())
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
@ -3020,7 +3078,7 @@ void CDrawingConverter::LoadCoordSize(XmlUtils::CXmlNode& oNode, CShape* pShape)
}
}
pShape->m_pShape->m_oPath.SetCoordsize((LONG)pShape->m_dWidthLogic, (LONG)pShape->m_dHeightLogic);
pShape->getBaseShape()->m_oPath.SetCoordsize((LONG)pShape->m_dWidthLogic, (LONG)pShape->m_dHeightLogic);
}
std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps)
@ -5280,16 +5338,10 @@ int CDrawingConverter::GetDocumentChartsCount ()
OOX::CContentTypes* CDrawingConverter::GetContentTypes()
{
return m_pImageManager->m_pContentTypes;
//return m_pReader->mm_strContentTypes;
}
void CDrawingConverter::Clear()
{
for (std::map<std::wstring, CShape*>::iterator pPair = m_mapShapeTypes.begin(); pPair != m_mapShapeTypes.end(); ++pPair)
{
CShape* pMem = pPair->second;
RELEASEOBJECT(pMem);
}
m_mapShapeTypes.clear();
}
void CDrawingConverter::SetRels(smart_ptr<OOX::IFileContainer> container)

View File

@ -37,17 +37,20 @@
#include "../Common/DocxFormat/Source/Base/Base.h"
#include "../Common/DocxFormat/Source/Base/Nullable.h"
#include "./Editor/Drawing/Shapes/BaseShape/PPTShape/PPTShapeEnum.h"
#include "./Editor/Drawing/Shapes/BaseShape/PPTShape/PptShapeEnum.h"
#include <vector>
#include <map>
class IRenderer;
class CShape;
class CPPTShape;
class CFontManager;
class COfficeFontPicker;
class CShape;
typedef boost::shared_ptr<CShape> CShapePtr;
class CPPTShape;
namespace XmlUtils
{
class CXmlNode;
@ -187,7 +190,7 @@ namespace NSBinPptxRW
};
std::map<std::wstring, CShape*> m_mapShapeTypes;
std::map<std::wstring, CShapePtr> m_mapShapeTypes;
NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter;
int m_lNextId;
@ -276,8 +279,10 @@ namespace NSBinPptxRW
void CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShape* pShape);
std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
std::wstring GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
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);

View File

@ -46,7 +46,6 @@
#include "Editor/PPTXWriter.h"
#include "PPTXFormat/PPTXEvent.h"
#include "Editor/PresentationDrawingsDef.h"
CPPTXFile::CPPTXFile(extract_to_directory fCallbackExtract, compress_from_directory fCallbackCompress, progress_operation fCallbackProgress, void* pCallbackArg)
{

View File

@ -103,13 +103,13 @@ namespace NSPresentationEditor
size_t nCountElems = pSlide->m_arElements.size();
for (size_t i = 0; i < nCountElems; ++i)
{
IElement* pElement = pSlide->m_arElements[i];
CElementPtr pElement = pSlide->m_arElements[i];
switch (pElement->m_etType)
{
case etAudio:
{
CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement);
CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement.get());
if (NULL != pAudioElem)
{
@ -147,9 +147,9 @@ namespace NSPresentationEditor
}
}
void ResetAutoText(IElement *pElement, vector_string const (&placeholdersReplaceString)[3])
void ResetAutoText(CElementPtr pElement, vector_string const (&placeholdersReplaceString)[3])
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (NULL == pShape) return;
@ -193,7 +193,7 @@ namespace NSPresentationEditor
size_t nCountElems = pTheme->m_arElements.size();
for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl)
{
IElement* pElement = pTheme->m_arElements[nIndexEl];
CElementPtr pElement = pTheme->m_arElements[nIndexEl];
if (pElement->m_lPlaceholderType > 0)
{
@ -219,7 +219,7 @@ namespace NSPresentationEditor
size_t nCountLayoutElements = pLayout->m_arElements.size();
for (size_t nIndexLayoutEl = 0; nIndexLayoutEl < nCountLayoutElements; ++nIndexLayoutEl)
{
IElement* pElement = pLayout->m_arElements[nIndexLayoutEl];
CElementPtr pElement = pLayout->m_arElements[nIndexLayoutEl];
if (pElement->m_lPlaceholderType > 0)
{
@ -232,7 +232,7 @@ namespace NSPresentationEditor
pElement->m_pTheme = pTheme;
pElement->m_pLayout = NULL;
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement);
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElement.get());
if (!pLayout->m_bUseThemeColorScheme && NULL != pShape)
{
int lPhType = pElement->m_lPlaceholderType;
@ -253,20 +253,20 @@ namespace NSPresentationEditor
if (pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex == -1)
continue;
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0].is_init())
if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0].is_init())
{
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init())
if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color.is_init())
{
if (pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1)
if (pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex != -1)
continue;
LONG lIndexSchemeT = pThemeStyles->m_pLevels[nIndexLevel]->m_oCFRun.Color->m_lSchemeIndex;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = -1;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G;
pShape->m_oShape.m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B;
pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->m_lSchemeIndex = -1;
pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->R = pLayout->m_arColorScheme[lIndexSchemeT].R;
pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->G = pLayout->m_arColorScheme[lIndexSchemeT].G;
pShape->m_pShape->m_oText.m_oStyles.m_pLevels[0]->m_oCFRun.Color->B = pLayout->m_arColorScheme[lIndexSchemeT].B;
bIsPlaceholderSetUp = true;
}
@ -301,7 +301,7 @@ namespace NSPresentationEditor
size_t nCountElems = pSlide->m_arElements.size();
for (size_t nIndexEl = 0; nIndexEl < nCountElems; ++nIndexEl)
{
IElement* pElement = pSlide->m_arElements[nIndexEl];
CElementPtr pElement = pSlide->m_arElements[nIndexEl];
if (pElement->m_lPlaceholderType > 0)
{

View File

@ -124,11 +124,11 @@ namespace NSPresentationEditor
class CLayout;
class CSlide;
class IElement
class CElement;
typedef boost::shared_ptr<CElement> CElementPtr;
class CElement
{
protected:
ULONG m_lCountRef;
public:
ElementType m_etType;
CDoubleRect m_rcBounds;
@ -181,23 +181,7 @@ namespace NSPresentationEditor
std::wstring m_sHyperlink;
virtual ULONG AddRef()
{
++m_lCountRef;
return m_lCountRef;
}
virtual ULONG Release()
{
--m_lCountRef;
if (0 == m_lCountRef)
{
delete this;
return 0;
}
return m_lCountRef;
}
IElement()
CElement()
{
m_bIsBackground = false;
m_bHaveAnchor = true;
@ -237,12 +221,10 @@ namespace NSPresentationEditor
m_bFlipV = false;
m_bLine = true;
m_lCountRef = 1;
m_pTheme = NULL;
m_pLayout = NULL;
}
virtual ~IElement()
virtual ~CElement()
{
}
@ -263,12 +245,11 @@ namespace NSPresentationEditor
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom;
}
virtual IElement* CreateDublicate() = 0;
virtual CElementPtr CreateDublicate() = 0;
protected:
virtual void SetProperiesToDublicate(IElement* pDublicate)
virtual void SetProperiesToDublicate(CElementPtr pDublicate)
{
if (NULL == pDublicate)
if (!pDublicate)
return;
pDublicate->m_bBoundsEnabled = m_bBoundsEnabled;

View File

@ -63,7 +63,7 @@ void NSPresentationEditor::CShapeElement::CalculateColor(CColor& oColor, CSlide*
void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
NSPresentationEditor::CTextAttributesEx* pAttributes = &m_oShape.m_oText;
NSPresentationEditor::CTextAttributesEx* pAttributes = &m_pShape->m_oText;
int nCountColors = 0;
if (NULL != pTheme)
nCountColors = (int)pTheme->m_arColorScheme.size();
@ -123,7 +123,7 @@ void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CT
bool NSPresentationEditor::CShapeElement::SetUpTextPlaceholder(std::wstring newText)
{
bool result = false;
NSPresentationEditor::CTextAttributesEx* pText = &m_oShape.m_oText;
NSPresentationEditor::CTextAttributesEx* pText = &m_pShape->m_oText;
for (size_t p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt
{

View File

@ -37,12 +37,8 @@
#include "../../../Common/FileDownloader/FileDownloader.h"
#endif
#include "Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h"
#ifdef ENABLE_PPT_TO_PPTX_CONVERT
#include "Shapes/BaseShape/PPTShape/ppt2pptxshapeconverter.h"
#endif
#if defined(PPTX_DEF)
namespace PPTX2EditorAdvanced
{
AVSINLINE OOXMLShapes::ShapeType GetShapeTypeFromStr(const std::wstring& str)//const
@ -284,11 +280,11 @@ namespace PPTX2EditorAdvanced
return OOXMLShapes::sptNil;
}
}
#endif
namespace NSPresentationEditor
{
class CImageElement : public IElement
class CImageElement : public CElement
{
public:
std::wstring m_strImageFileName;
@ -310,7 +306,7 @@ namespace NSPresentationEditor
std::wstring m_sImageName;
CImageElement() : IElement()
CImageElement() : CElement()
{
m_etType = etPicture;
@ -332,11 +328,13 @@ namespace NSPresentationEditor
virtual ~CImageElement()
{
}
virtual IElement* CreateDublicate()
virtual CElementPtr CreateDublicate()
{
CImageElement* pImageElement = new CImageElement();
CElementPtr pElement = CElementPtr( pImageElement );
SetProperiesToDublicate((IElement*)pImageElement);
SetProperiesToDublicate(pElement);
pImageElement->m_strImageFileName = m_strImageFileName;
pImageElement->m_nAlpha = m_nAlpha;
@ -353,11 +351,8 @@ namespace NSPresentationEditor
pImageElement->m_bImagePresent = m_bImagePresent;
pImageElement->m_bOLE = m_bOLE;
return (IElement*)pImageElement;
return pElement;
}
#ifdef ENABLE_PPT_TO_PPTX_CONVERT
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
NSGuidesVML::CFormParam pParamCoef;
@ -383,7 +378,6 @@ namespace NSPresentationEditor
return strXmlPPTX;
}
#endif
AVSINLINE std::wstring DownloadImage(const std::wstring& strFile)
{
#ifndef DISABLE_FILE_DOWNLOADER
@ -397,79 +391,90 @@ namespace NSPresentationEditor
}
};
class CShapeElement : public IElement
class CShapeElement : public CElement
{
public:
NSBaseShape::ClassType m_ClassType;
int m_lShapeType;
CShape m_oShape;
CShapePtr m_pShape;
bool m_bShapePreset; // or rect (
CShapeElement(NSBaseShape::ClassType ClassType, int eType) : IElement(), m_lShapeType(eType), m_oShape(ClassType, eType)
CShapeElement(NSBaseShape::ClassType ClassType, int eType) : CElement()
{
m_lShapeType = eType;
m_ClassType = ClassType;
m_etType = etShape;
m_oShape.m_rcBounds = m_rcBounds;
m_pShape = CShapePtr( new CShape(ClassType, eType));
m_oShape.m_dStartTime = m_dStartTime;
m_oShape.m_dStartTime = m_dEndTime;
m_pShape->m_rcBounds = m_rcBounds;
m_pShape->m_dStartTime = m_dStartTime;
m_pShape->m_dStartTime = m_dEndTime;
m_bShapePreset = false;
}
CShapeElement() : m_oShape(NSBaseShape::unknown, 0x1000)
CShapeElement() : CElement()
{
m_lShapeType = 0x1000;
m_etType = etShape;
m_bShapePreset = false;
m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000));
}
CShapeElement(const std::wstring& str) : IElement(), m_oShape(NSBaseShape::unknown, 0x1000)
CShapeElement(const std::wstring& str) : CElement()
{
m_lShapeType = 0x1000;
m_bShapePreset = false;
m_oShape.LoadFromXML(str);
m_ClassType = m_oShape.m_pShape->GetClassType();
m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000));
m_pShape->LoadFromXML(str);
m_ClassType = m_pShape->getBaseShape()->GetClassType();
}
virtual void NormalizeCoordsByMetric()
{
IElement::NormalizeCoordsByMetric();
CElement::NormalizeCoordsByMetric();
double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor;
double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer;
m_oShape.m_oText.m_oBounds.left = (int)(dScaleX * m_oShape.m_oText.m_oBounds.left);
m_oShape.m_oText.m_oBounds.right = (int)(dScaleX * m_oShape.m_oText.m_oBounds.right);
m_oShape.m_oText.m_oBounds.top = (int)(dScaleY * m_oShape.m_oText.m_oBounds.top);
m_oShape.m_oText.m_oBounds.bottom = (int)(dScaleY * m_oShape.m_oText.m_oBounds.bottom);
m_pShape->m_oText.m_oBounds.left = (int)(dScaleX * m_pShape->m_oText.m_oBounds.left);
m_pShape->m_oText.m_oBounds.right = (int)(dScaleX * m_pShape->m_oText.m_oBounds.right);
m_pShape->m_oText.m_oBounds.top = (int)(dScaleY * m_pShape->m_oText.m_oBounds.top);
m_pShape->m_oText.m_oBounds.bottom = (int)(dScaleY * m_pShape->m_oText.m_oBounds.bottom);
}
virtual ~CShapeElement()
{
}
virtual IElement* CreateDublicate()
virtual CElementPtr CreateDublicate()
{
CShapeElement* pShapeElement = new CShapeElement(m_ClassType, m_lShapeType);
SetProperiesToDublicate((IElement*)pShapeElement);
CElementPtr pElement = CElementPtr( pShapeElement );
SetProperiesToDublicate(pElement);
pShapeElement->m_lShapeType = m_lShapeType;
pShapeElement->m_bShapePreset = m_bShapePreset;
m_oShape.SetToDublicate(&pShapeElement->m_oShape);
return (IElement*)pShapeElement;
m_pShape->SetToDublicate(pShapeElement->m_pShape.get());
return pElement;
}
bool SetUpTextPlaceholder(std::wstring newText);
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
m_oShape.m_oText.m_lPlaceholderType = m_lPlaceholderType;
m_oShape.m_oText.m_lPlaceholderID = m_lPlaceholderID;
m_pShape->m_oText.m_lPlaceholderType = m_lPlaceholderType;
m_pShape->m_oText.m_lPlaceholderID = m_lPlaceholderID;
m_oShape.m_pShape->ReCalculate();
m_pShape->getBaseShape()->ReCalculate();
SetupTextProperties(pSlide, pTheme, pLayout);
@ -482,11 +487,9 @@ namespace NSPresentationEditor
void CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout);
#ifdef ENABLE_PPT_TO_PPTX_CONVERT
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_oShape.m_pShape);
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape->getBaseShape().get());
if (NULL == pPPTShape)
{
// такого быть не может
@ -608,7 +611,7 @@ namespace NSPresentationEditor
{
if (bIsNamespace)
{
return _T("<a:prstGeom xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" prst=\"line\"><a:avLst/></a:prstGeom>");
return _T("<a:prstGeom xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" prst=\"ellipse\"><a:avLst/></a:prstGeom>");
}
return _T("<a:prstGeom prst=\"ellipse\"><a:avLst/></a:prstGeom>");
}
@ -688,7 +691,6 @@ namespace NSPresentationEditor
}
#endif
#endif
};
@ -723,11 +725,12 @@ namespace NSPresentationEditor
{
}
virtual IElement* CreateDublicate()
virtual CElementPtr CreateDublicate()
{
CAudioElement* pAudioElement = new CAudioElement();
CElementPtr pElement = CElementPtr( pAudioElement );
SetProperiesToDublicate((CImageElement*)pAudioElement);
SetProperiesToDublicate(pElement);
pAudioElement->m_strAudioFileName = m_strAudioFileName;
pAudioElement->m_nAmplify = m_nAmplify;
@ -739,7 +742,7 @@ namespace NSPresentationEditor
pAudioElement->m_dClipStartTime = m_dClipStartTime;
pAudioElement->m_dClipEndTime = m_dClipEndTime;
return (IElement*)pAudioElement;
return pElement;
}
};
class CVideoElement : public CImageElement
@ -770,11 +773,13 @@ namespace NSPresentationEditor
{
}
virtual IElement* CreateDublicate()
virtual CElementPtr CreateDublicate()
{
CVideoElement* pVideoElement = new CVideoElement();
SetProperiesToDublicate((CImageElement*)pVideoElement);
CElementPtr pElement = CElementPtr( pVideoElement );
SetProperiesToDublicate(pElement);
pVideoElement->m_strVideoFileName = m_strVideoFileName;
pVideoElement->m_nAlpha = m_nAlpha;
@ -785,7 +790,7 @@ namespace NSPresentationEditor
pVideoElement->m_dClipEndTime = m_dClipEndTime;
pVideoElement->m_bLoop = m_bLoop;
return (IElement*)pVideoElement;
return pElement;
}
};

View File

@ -37,7 +37,7 @@ namespace NSPresentationEditor
class CLayout
{
public:
std::vector<IElement*> m_arElements;
std::vector<CElementPtr>m_arElements;
std::vector<CColor> m_arColorScheme;
std::multimap<int,int> m_mapPlaceholders;
@ -66,7 +66,7 @@ namespace NSPresentationEditor
std::wstring m_strLayoutType;
std::wstring m_sName;
public:
CLayout()
{
Clear();
@ -81,12 +81,10 @@ namespace NSPresentationEditor
{
Clear();
m_arElements = oSrc.m_arElements;
size_t nCount = m_arElements.size();
size_t nCount = oSrc.m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
ADDREFINTERFACE((m_arElements[nIndex]));
m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate());
}
m_mapPlaceholders = oSrc.m_mapPlaceholders;
@ -108,7 +106,8 @@ namespace NSPresentationEditor
m_bHasFooter = oSrc.m_bHasFooter;
m_nFormatDate = oSrc.m_nFormatDate;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i];
for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i];
m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
m_strLayoutType = oSrc.m_strLayoutType;
@ -127,15 +126,8 @@ namespace NSPresentationEditor
m_lOriginalHeight = m_oInfo.m_lUnitsVer;
}
public:
void Clear()
{
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
RELEASEINTERFACE((m_arElements[nIndex]));
}
m_arElements.clear();
m_mapPlaceholders.clear();
@ -143,7 +135,9 @@ namespace NSPresentationEditor
m_bHasSlideNumber = false;
m_bHasFooter = false;
m_nFormatDate = 1;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear();
for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i].clear();
m_bUseThemeColorScheme = true;
m_bShowMasterShapes = true;
@ -159,12 +153,11 @@ namespace NSPresentationEditor
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
CElementPtr pElem = m_arElements[nIndex];
if (NULL != pElem)
{
m_arElements[nIndex] = pElem->CreateDublicate();
}
RELEASEINTERFACE(pElem);
}
}
@ -175,24 +168,21 @@ namespace NSPresentationEditor
return pNew;
}
IElement* GetPlaceholder(LONG lID, bool bIsAddRef)
CElementPtr GetPlaceholder(LONG lID)
{
size_t nCount = m_arElements.size();
for (size_t i = 0; i < nCount; ++i)
{
IElement* pElem = m_arElements[i];
CElementPtr pElem = m_arElements[i];
if (pElem->m_lPlaceholderType == lID)
{
if (bIsAddRef)
ADDREFINTERFACE(pElem);
return pElem;
}
}
return NULL;
return CElementPtr();
}
LONG GetCountPlaceholderWithType(LONG lType)
@ -209,10 +199,6 @@ namespace NSPresentationEditor
return lFound;
}
public:
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{
if (lIndexScheme < (LONG)m_arColorScheme.size())

View File

@ -33,55 +33,39 @@
#include "BaseShape.h"
#if defined(PPTX_DEF)
#include "PPTXShape/PPTXShape.h"
#endif
#include "PPTXShape/PptxShape.h"
#include "PPTShape/PptShape.h"
#if defined(PPT_DEF)
#include "PPTShape/PPTShape.h"
#endif
using namespace NSPresentationEditor;
NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType)
CBaseShapePtr CBaseShape::CreateByType(NSBaseShape::ClassType ClassType, int ShapeType)
{
#if defined(PPTX_DEF)
if(ClassType == pptx)
{
return CPPTXShape::CreateByType((OOXMLShapes::ShapeType)ShapeType);
}
#endif
#if defined(PPT_DEF)
if (ClassType == ppt)
{
return CPPTShape::CreateByType((PPTShapes::ShapeType)ShapeType);
}
#endif
return NULL;
}
bool NSPresentationEditor::CBaseShape::SetType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType)
bool CBaseShape::SetType(NSBaseShape::ClassType ClassType, int ShapeType)
{
if (ClassType != GetClassType())
return false;
#if defined(PPTX_DEF)
if(ClassType == pptx)
{
return ((CPPTXShape*)this)->SetShapeType((OOXMLShapes::ShapeType)ShapeType);
}
#endif
#if defined(PPT_DEF)
if(ClassType == ppt)
{
return ((CPPTShape*)this)->SetShapeType((PPTShapes::ShapeType)ShapeType);
}
#endif
return false;
}
}

View File

@ -30,9 +30,12 @@
*
*/
#pragma once
#include "Path.h"
#include "../../../../../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
#include <boost/shared_ptr.hpp>
namespace NSPresentationEditor
{
using namespace NSBaseShape;
@ -61,7 +64,10 @@ namespace NSPresentationEditor
return (*this);
}
};
//
class CBaseShape;
typedef boost::shared_ptr<CBaseShape> CBaseShapePtr;
class CBaseShape
{
public:
@ -120,7 +126,7 @@ namespace NSPresentationEditor
virtual void AddGuide(const std::wstring& strGuide) {}
static CBaseShape* CreateByType(ClassType ClassType, int ShapeType);
static CBaseShapePtr CreateByType(ClassType ClassType, int ShapeType);
virtual const ClassType GetClassType()const = 0;
bool SetType(ClassType ClassType, int ShapeType);

View File

@ -34,7 +34,7 @@
#include "ElementSettings.h"
#include "../BaseShape.h"
#include "../../../Attributes.h"
#include "Formula.h"
#include "PptFormula.h"
namespace NSCustomVML
{

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 51
class CAccentBorderCallout2Type : public CPPTShape
@ -73,4 +73,4 @@ public:
oHandle3.position = _T("#4,#5");
m_arHandles.push_back(oHandle3);
}
};
};

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 44
class CAccentCallout1Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 45
class CAccentCallout2Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 46
class CAccentCallout3Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 179
class CAccentCallout90Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 194
class CActionButtonBackType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 196
class CActionButtonBeginType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 189
class CActionButtonBlankType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 198
class CActionButtonDocType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 195
class CActionButtonEndType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 191
class CActionButtonHelpType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 190
class CActionButtonHomeType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 192
class CActionButtonInfoType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 200
class CActionButtonMovieType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 193
class CActionButtonNextType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 197
class CActionButtonReturnType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 199
class CActionButtonSoundType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 91
class CBentArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 34
class CBentConnectorType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 90
class CBentUpArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 84
class CBevelType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 95
class CBlockArcType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 47
class CBorderCallout1Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 48
class CBorderCallout2Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 49
class CBorderCallout3Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 180
class CBorderCallout90Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 186
class CBracePairType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 185
class CBracketPairType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 41
class CCallout1Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 42
class CCallout2Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 43
class CCallout3Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 178
class CCallout90Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 22
class CCanType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 55
class CChevronType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 99
class CCircularArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 106
class CCloudCalloutType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 16
class CCubeType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 38
class CCurvedConnectorType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 105
class CCurvedDownArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 103
class CCurvedLeftArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 102
class CCurvedRightArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
//104
class CCurvedUpArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 4
class CDiamondType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 23
class CDonutType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 80
class CDownArrowCalloutType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 67
class CDownArrowType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 108
class CEllipceRibbon2Type : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 107
class CEllipceRibbonType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 3
class CEllipseType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 176
class CFlowChartAlternateProcessType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 125
class CFlowChartCollateType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 120
class CFlowChartConnectorType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 110
class CFlowChartDecisionType : public CPPTShape

View File

@ -30,7 +30,7 @@
*
*/
#pragma once
#include "../PPTShape.h"
#include "../PptShape.h"
// 135
class CFlowChartDelayType : public CPPTShape

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