Compare commits

...

79 Commits

Author SHA1 Message Date
709ee1942d fix bug #36568 2017-12-19 16:31:54 +03:00
e59eff3a16 fix user file 2017-12-18 18:57:05 +03:00
2206b3b366 Remove unused code 2017-12-18 16:43:12 +03:00
a2d37e8a22 OdfFormaReader - fix 3d charts with 2 axis 2017-12-16 16:24:51 +03:00
b13eba5f01 x2t optimization rels 2017-12-15 17:05:47 +03:00
a48058c7d5 merge from 5.0.7 2017-12-15 14:52:11 +03:00
ab76aff379 . 2017-12-15 14:49:54 +03:00
b8b8a14268 fix bug 36524 (fix MathType equation) 2017-12-15 14:47:57 +03:00
e5ef749718 . 2017-12-15 12:24:35 +03:00
5d524369b8 . 2017-12-14 19:31:33 +03:00
e78fc0befc x2t - fix users files 2017-12-14 16:46:29 +03:00
d9986d09cd x2t - fix users file 2017-12-13 19:15:13 +03:00
bd67f4bf1c . 2017-12-13 15:13:37 +03:00
475bfaf93d Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop 2017-12-13 15:12:19 +03:00
1a8af4d8ed x2t - fix users file 2017-12-13 15:11:16 +03:00
cdf8dc7a4c Changed cef update condition 2017-12-13 12:55:54 +03:00
d71552bddd Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop
# Conflicts:
#	ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
2017-12-13 12:40:08 +03:00
548c5ab608 x2t - fix users files 2017-12-13 11:59:49 +03:00
6a01384023 . 2017-12-13 00:01:15 +03:00
d70f36e36d DocFormat - fix users files 2017-12-12 19:41:50 +03:00
f65984f079 . 2017-12-12 19:41:16 +03:00
5b48a7a330 DocFormat - fix users file, add data form field 2017-12-12 19:10:08 +03:00
1496aece57 v8 (mac os) 2017-12-12 19:06:09 +03:00
60cf51ad0d Move ASCDOCUMENTSCORE to separated target 2017-12-12 16:30:44 +03:00
8e7231b322 removed unused code 2017-12-12 12:43:33 +03:00
2b339b6842 Cherrypick from develop 2017-12-12 12:43:03 +03:00
fb0dbfc231 Cherrypick from develop 2017-12-12 12:40:28 +03:00
756613e883 Merge pull request #56 from ONLYOFFICE/hotfix/v5.0.7
for b599a6bc43 to fix build error
2017-12-11 20:17:01 +03:00
ede03fafea for b599a6bc43 to fix build error 2017-12-11 19:52:44 +03:00
bdec91bfd5 Merge remote-tracking branch 'origin/hotfix/v5.0.7' into develop 2017-12-11 18:44:50 +03:00
260c2edd21 . 2017-12-11 18:42:11 +03:00
3eeec8fc67 RtfFormat - fix users file 2017-12-11 18:39:37 +03:00
ba6c7e8151 Merge remote-tracking branch 'origin/feature/v5.0.7.1' into develop 2017-12-11 14:05:03 +03:00
41a213491e fix image content type 2017-12-11 13:45:28 +03:00
b599a6bc43 Add open/save JsaProject.bin for OnlyOffice Macros 2017-12-11 13:31:48 +03:00
a0fd139027 Merge pull request #55 from ONLYOFFICE/feature/v5.0.7.1
Feature/v5.0.7.1
2017-12-06 18:54:01 +03:00
48852bc618 removed unused code 2017-12-06 18:51:58 +03:00
20b781cb7e pdf checker bug 2017-12-06 18:50:09 +03:00
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
e7bbbec0de v5.0.5 2017-11-27 17:06:49 +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
bae854027b fix bug #36380
Problem with picture in footnote
2017-11-17 13:18:20 +03:00
07562a9582 v5.0.4 2017-11-13 17:44:36 +03:00
407 changed files with 19320 additions and 4524 deletions

View File

@ -559,7 +559,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteString(elem.GetXMLString());
}
else if (TextMark::FieldBeginMark == code)
{
{//todooo в отдельный mapping
int cpFieldStart = initialCp + i;
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
@ -599,20 +599,38 @@ namespace DocFileFormat
if ( bFORM )
{
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
std::wstring FORMTEXT ( L" FORMTEXT" );
std::wstring FORMCHECKBOX ( L" FORMCHECKBOX" );
std::wstring FORMDROPDOWN ( L" FORMDROPDOWN" );
m_pXmlWriter->WriteNodeBegin( L"w:fldChar" , true );
m_pXmlWriter->WriteAttribute( L"w:fldCharType" , L"begin" );
m_pXmlWriter->WriteNodeEnd( L"", true, false );
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
bool bFORMTEXT = search( f.begin(), f.end(), FORMTEXT.begin(), FORMTEXT.end()) != f.end();
bool bFORMCHECKBOX = search( f.begin(), f.end(), FORMCHECKBOX.begin(), FORMCHECKBOX.end()) != f.end();
bool bFORMDROPDOWN = search( f.begin(), f.end(), FORMDROPDOWN.begin(), FORMDROPDOWN.end()) != f.end();
/*if (cpPic < cpFieldEnd)
if (bFORMTEXT || bFORMCHECKBOX || bFORMDROPDOWN)
{
int fcPic = _doc.PieceTable.FileCharacterPositions[cpPic];
CharacterPropertyExceptions chpxPic = _doc.GetCharacterPropertyExceptions(fcPic, fcPic + 1)[0];
NilPicfAndBinData npbd = new NilPicfAndBinData(chpxPic, _doc.DataStream);
FormFieldData ffdata = new FormFieldData(npbd.binData);
ffdata.Convert(new FormFieldDataMapping(m_pXmlWriter));
}*/
int cpPic = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::Picture );
if (cpPic < cpFieldEnd)
{
int fcPic = m_document->FindFileCharPos( cpPic );
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
if (chpxs)
{
CharacterPropertyExceptions* chpxSep = chpxs->front();
FormFieldData ffdata (2, chpxSep, m_document->DataStream, false);
FormFieldDataMapping data_mapping(m_pXmlWriter, m_context, _caller);
ffdata.Convert(&data_mapping);
RELEASEOBJECT( chpxs );
}
}
}
m_pXmlWriter->WriteNodeEnd( L"w:fldChar" );
@ -809,6 +827,13 @@ namespace DocFileFormat
{
if (_fldCharCounter > 0)
{
if (_writeInstrText == true && !text.empty())
{
writeTextElement(text, textType);
text.clear();
}
_writeInstrText = false;
XMLTools::XMLElement elem( L"w:fldChar" );
elem.AppendAttribute( L"w:fldCharType", L"end" );
@ -1257,20 +1282,20 @@ namespace DocFileFormat
{
case sprmTDefTable:
case sprmOldTDefTable:
{
unsigned char itcMac = iter->Arguments[0];
{
unsigned char itcMac = iter->Arguments[0];
while(boundaries.size() < itcMac + 1)
boundaries.push_back(-0x7fff);
short boundary0 = -0x7fff;
for (unsigned char i = 0; i < itcMac; i++)
{
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
{
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 2 ), iter->argumentsSize );
if (boundary2 - boundary1 > 1 && boundary1 - boundary0 > 1)
{
{
if ( boundaries[i] == -0x7fff || boundaries[i+1] == -0x7fff)
{
boundaries[i] = boundary1;
@ -1280,12 +1305,12 @@ namespace DocFileFormat
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary1 ) == boundaries_all.end() )
{
boundaries_all.push_back( boundary1 );
}
}
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary2 ) == boundaries_all.end() )
{
{
boundaries_all.push_back( boundary2 );
}
}
boundary0 = boundary1;
}break;
}
@ -1513,11 +1538,11 @@ namespace DocFileFormat
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int DocumentMapping::writeTableCell(int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel )
{
int cp = initialCp;
int cp = initialCp;
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, grid_write, gridIndex, cellIndex );
@ -1530,7 +1555,7 @@ namespace DocFileFormat
RELEASEOBJECT( tcpMapping );
//write the paragraphs of the cell
//write the paragraphs of the cell
while ( cp < cpCellEnd )
{
//cp = writeParagraph(cp);
@ -1561,7 +1586,7 @@ namespace DocFileFormat
}
}
//end w:tc
//end w:tc
m_pXmlWriter->WriteNodeEnd( L"w:tc" );
return cp;

View File

@ -48,6 +48,8 @@
#include "OleObjectMapping.h"
#include "ConversionContext.h"
#include "IMapping.h"
#include "FormFieldData.h"
#include "FormFieldDataMapping.h"
namespace DocFileFormat
{

View File

@ -0,0 +1,170 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "FormFieldData.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
namespace DocFileFormat
{
std::wstring readXstz(VirtualStreamReader *reader)
{
if (!reader) return L"";
unsigned short flags, cch, chTerm;
cch = reader->ReadUInt16();
std::wstring ret;
if (cch > 0)
{
std::shared_ptr<unsigned char>data = std::shared_ptr<unsigned char>(reader->ReadBytes(cch * 2, true));
#if defined(_WIN32) || defined(_WIN64)
ret = std::wstring((wchar_t*)data.get(), cch );
#else
ret = convertUtf16ToWString((UTF16*)data.get(), cch );
#endif
}
chTerm = reader->ReadUInt16();
return ret;
};
void FormFieldData::_HFD::read(VirtualStreamReader *reader)
{
if (!reader) return;
}
void FormFieldData::_FFData::read(VirtualStreamReader *reader)
{
if (!reader) return;
bExist = true;
unsigned short flags;
version = reader->ReadUInt32();
flags = reader->ReadUInt16();
iType = GETBITS(flags, 0, 1);
iRes = GETBITS(flags, 2, 6);
fOwnHelp = GETBIT(flags, 7);
fOwnStat = GETBIT(flags, 8);
fProt = GETBIT(flags, 9);
iSize = GETBIT(flags, 10);
iTypeTxt = GETBITS(flags, 11, 13);
fRecalc = GETBIT(flags, 14);
fHasListBox = GETBIT(flags, 15);
cch_field = reader->ReadUInt16();
hps = reader->ReadUInt16();
xstzName = readXstz(reader);
xstzTextDef = readXstz(reader);
wDef = reader->ReadUInt16();
xstzTextFormat = readXstz(reader);
xstzHelpText = readXstz(reader);
xstzStatText = readXstz(reader);
xstzEntryMcr = readXstz(reader);
xstzExitMcr = readXstz(reader);
}
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion_ )
{
binary_data_size = 0;
if (!chpx) return;
int fc = -1;
bool bNilPICFAndBinData = false;
for ( std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{
switch ( iter->OpCode)
{
case sprmCFSpec:
{
}
break;
case sprmCFFldVanish:
{
}
break;
case sprmCPicLocation:
{
fc = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
}
break;
case sprmCRsidText:
{
rsid = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), L"%08x");
}
break;
case sprmCFData:
{
bNilPICFAndBinData = true; // or bPICFAndOfficeArtData - shape, pic, ole
}
break;
}
}
if (fc >= 0 && bNilPICFAndBinData)
{
VirtualStreamReader reader(stream, fc, bOlderVersion_);
int sz_stream = reader.GetSize();
int lcb = reader.ReadUInt32();
int cbHeader = reader.ReadUInt16();
if (cbHeader != 0x44) return;
//ignored
reader.ReadBytes(62, false);
switch(type)
{
case 1:
HFD.read(&reader);
case 2:
FFData.read(&reader);
break;
default:
binary_data_size = lcb - cbHeader;
binary_data = std::shared_ptr<unsigned char>(reader.ReadBytes(binary_data_size, true));
break;
}
}
}
}

View File

@ -0,0 +1,126 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "IVisitable.h"
#include "CharacterPropertyExceptions.h"
#include "StructuredStorageReader.h"
#include "VirtualStreamReader.h"
namespace DocFileFormat
{
class FormFieldData : public IVisitable
{
public:
struct _HFD
{
bool bExist = false;
bool fNew = false;
bool fNoHist = false;
bool fImageMap = false;
bool fLocation = false;
bool fTooltip = false;
std::wstring clsid;
_UINT32 streamVersion = 0;
bool hlstmfHasMoniker = false;
bool hlstmfIsAbsolute = false;
bool hlstmfSiteGaveDisplayName = false;
bool hlstmfHasLocationStr = false;
bool hlstmfHasDisplayName = false;
bool hlstmfHasGUID = false;
bool hlstmfHasCreationTime = false;
bool hlstmfHasFrameName = false;
bool hlstmfMonikerSavedAsStr = false;
bool hlstmfAbsFromGetdataRel = false;
std::wstring displayName;
std::wstring targetFrameName;
std::wstring moniker;
std::wstring oleMoniker_clsid;
std::wstring oleMoniker_data;
std::wstring location;
std::wstring guid;
_UINT64 fileTime = 0;
void read(VirtualStreamReader* reader);
};
struct _FFData
{
bool bExist = false;
_UINT32 version = 0;
unsigned char iType = 0;
unsigned char iRes = 0;
bool fOwnHelp = false;
bool fOwnStat = false;
bool fProt = false;
bool iSize = false;
unsigned char iTypeTxt = 0;
bool fRecalc = false;
bool fHasListBox = false;
unsigned short cch_field = 0;
unsigned short hps = 0;
std::wstring xstzName;
std::wstring xstzTextDef;
unsigned short wDef = 0;
std::wstring xstzTextFormat;
std::wstring xstzHelpText;
std::wstring xstzStatText;
std::wstring xstzEntryMcr;
std::wstring xstzExitMcr;
//STTB hsttbDropList;
void read(VirtualStreamReader* reader);
};
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion );
virtual ~FormFieldData() {}
private:
friend class FormFieldDataMapping;
std::wstring name;
std::wstring rsid;
_FFData FFData;
_HFD HFD;
std::shared_ptr<unsigned char> binary_data;
int binary_data_size;
};
}

View File

@ -0,0 +1,87 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "ConversionContext.h"
#include "FormFieldData.h"
#include "AbstractOpenXmlMapping.h"
#include "IMapping.h"
namespace DocFileFormat
{
class FormFieldDataMapping: public AbstractOpenXmlMapping, public IMapping
{
public:
FormFieldDataMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, IMapping* caller)
: AbstractOpenXmlMapping(writer), m_context(NULL),_caller(NULL)
{
m_context = context;
_caller = caller;
}
virtual void Apply(IVisitable* visited)
{
FormFieldData* ffData = static_cast<FormFieldData*>(visited);
if ( ffData == NULL ) return;
if (ffData->FFData.bExist)
{
m_pXmlWriter->WriteNodeBegin( L"w:ffData");
m_pXmlWriter->WriteNodeBegin( L"w:name", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.xstzName);
m_pXmlWriter->WriteNodeEnd(L"w:name", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:calcOnExit", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.fRecalc);
m_pXmlWriter->WriteNodeEnd(L"w:calcOnExit", true, true );
m_pXmlWriter->WriteNodeBegin( L"w:textInput");
m_pXmlWriter->WriteNodeBegin( L"w:maxLength", true);
m_pXmlWriter->WriteAttribute(L"w:val", ffData->FFData.cch_field);
m_pXmlWriter->WriteNodeEnd(L"w:maxLength", true, true );
m_pXmlWriter->WriteNodeEnd( L"w:textInput" );
m_pXmlWriter->WriteNodeEnd( L"w:ffData" );
}
}
private:
ConversionContext* m_context;
IMapping* _caller;
};
}

View File

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

View File

@ -53,62 +53,31 @@ namespace DocFileFormat
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
{
int offset = 6;
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
{
int offset = 6;
unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize);
// видимо без шапки сразу пишутся все элементы
bool headerIs = ((0xfff0 != cb) && (cb > 8) || nElems > nElemsAlloc);
if (headerIs)
{
cb = 2;
offset = 0;
nElems = pSegmentInfoSize / 2;
unsigned short cbElement = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
}
else
if (cb == 0xfff0)
cbElement = 2;
if (nElems == 0)
{
if ((0xfff0 != cb) && (8 != cb) && (4 != cb) && (2 != cb))
{
cb = 0xfff0;
offset = 0;
nElems = pSegmentInfoSize / 2;
}
if (0xfff0 == cb)
{
cb = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
}
else
{
if ((2 != cb) && (1 != cb))
cb = 8;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb*nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
nElems = (pSegmentInfoSize - offset) / cbElement;
}
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cbElement), pSegmentInfoSize - offset));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb * nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
if ((NULL != pVertices) && (pVerticesSize > 0))
@ -117,26 +86,30 @@ namespace DocFileFormat
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
unsigned short cbElement = cb;
if (cb == 0xfff0)
cbElement = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
if (0xfff0 == cb)
if (cbElement == 4)
{
cb = 4;
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
point.x = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
}
else
{
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
point.x = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
}
LONG lMinF = (LONG)0x80000000;
if (lMinF <= point.x)
{
int index = (DWORD)point.x - 0x80000000;
if (index >= 0 && index < (int)guides.size())
if (index >= 0 && index < guides.size())
{
point.x = guides[index].param3;
}
@ -144,7 +117,7 @@ namespace DocFileFormat
if (lMinF <= point.y)
{
int index = (DWORD)point.y - 0x80000000;
if (index >= 0 && index < (int)guides.size())
if (index >= 0 && index < guides.size())
{
point.y = guides[index].param3;
}

View File

@ -597,16 +597,12 @@ namespace DocFileFormat
virtual ~ShapeOptions()
{
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
// RELEASEARRAYOBJECTS( iter->opComplex );
}
ShapeOptions (IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance) : Record (_reader, size, typeCode, version, instance)
{
long pos = Reader->GetPosition();
//instance is the count of properties stored in this record
//parse the flags and the simple values
for (unsigned int i = 0; i < instance; ++i)
{
@ -621,9 +617,7 @@ namespace DocFileFormat
Options.push_back( entry );
}
//parse the complex values
//these values are stored directly at the end
//of the OptionEntry arry, sorted by pid
//parse the complex values & sorted by pid
for (unsigned int i = 0; i < instance; ++i)
{
if (Options[i]->fComplex && Options[i]->op > 0)

View File

@ -43,6 +43,7 @@
#include "MainDocumentMapping.h"
#include "OleObjectMapping.h"
#include "VMLPictureMapping.h"
#include "FormFieldDataMapping.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
@ -144,9 +145,9 @@ namespace DocFileFormat
{
if (docFile == NULL) return S_FALSE;
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL) return S_FALSE;
if (storageOut->open(true, true)==false)
{
delete storageOut;

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

@ -40,19 +40,13 @@ namespace DocFileFormat
RELEASEOBJECT( Changes );
}
/*========================================================================================================*/
RevisionData::RevisionData():
Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
{
this->Changes = new std::list<SinglePropertyModifier>();
}
/*========================================================================================================*/
/// Collects the revision data of a CHPX
RevisionData::RevisionData( CharacterPropertyExceptions* chpx ):
Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
RevisionData::RevisionData( CharacterPropertyExceptions* chpx ) : Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
{
bool collectRevisionData = true;
this->Changes = new std::list<SinglePropertyModifier>();

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

@ -288,6 +288,7 @@ namespace DocFileFormat
int ndyTextBottom = -1;
bool bHavePath = false;
int nShapePath = -1;
int nAdjValues = 0;
int nLTxID = -1;
@ -361,6 +362,7 @@ namespace DocFileFormat
case shapePath :
{
bHavePath = true;
nShapePath = iter->op;
}break;
case pVertices:
{
@ -1653,7 +1655,7 @@ namespace DocFileFormat
}
if (!bRelV && m_pSpa)
{
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->bx));
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
}
if (!m_isInlineShape && !bZIndex)
{
@ -2165,7 +2167,7 @@ namespace DocFileFormat
//todooo нарисовать кастомный шейп
}
else
WritePrimitiveProps(primitive, (index==0 ? true : false));
WritePrimitiveProps(primitive, (index==0?true:false));
if (primitive->type == 0x0000)

View File

@ -94,6 +94,7 @@ SOURCES += \
../../DocDocxConverter/VMLShapeTypeMapping.cpp \
../../DocDocxConverter/WordDocument.cpp \
../../DocDocxConverter/WordprocessingDocument.cpp \
../../DocDocxConverter/FormFieldData.cpp \
../../DocDocxConverter/OfficeDrawing/Record.cpp \
../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp \
../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp

View File

@ -74,6 +74,7 @@
#include "../../DocDocxConverter/VMLShapeTypeMapping.cpp"
#include "../../DocDocxConverter/WordDocument.cpp"
#include "../../DocDocxConverter/WordprocessingDocument.cpp"
#include "../../DocDocxConverter/FormFieldData.cpp"
#include "../../DocDocxConverter/OfficeDrawing/Record.cpp"
#include "../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp"
#include "../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp"

View File

@ -44,10 +44,10 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
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"
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"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
@ -479,6 +479,14 @@
RelativePath="..\..\DocDocxConverter\FormattedDiskPagePAPX.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldData.cpp"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldData.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\Global.h"
>
@ -1090,6 +1098,10 @@
RelativePath="..\..\DocDocxConverter\FootnotesMapping.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\FormFieldDataMapping.h"
>
</File>
<File
RelativePath="..\..\DocDocxConverter\HeaderMapping.cpp"
>

View File

@ -29,19 +29,17 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
// DocFormatTest.cpp : Defines the entry point for the console application.
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include <iostream>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../DocFormatLib/DocFormatLib.h"
#include <string>
#include <windows.h>
#include <tchar.h>
#pragma comment(lib,"Shell32.lib")
#pragma comment(lib,"Advapi32.lib")
#pragma comment(lib,"Rpcrt4.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
@ -49,34 +47,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT convert_single(std::wstring sSrcDoc)
HRESULT convert_single(std::wstring srcFileName)
{
HRESULT hr = S_OK;
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstPath;
COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir;
bool bMacros = true;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
HRESULT hRes = docFile.LoadFromFile( srcFileName, dstTempPath, L"password", bMacros, NULL);
std::wstring sDstDocx;
if (bMacros)
{
sDstDocx = sSrcDoc + L"-my.docm";
dstPath = srcFileName + L"-my.docm";
}
else
{
sDstDocx = sSrcDoc + L"-my.docx";
dstPath = srcFileName + L"-my.docx";
}
if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, -1);
}
NSDirectory::DeleteDirectory(dstTempPath);

View File

@ -48,7 +48,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
@ -392,6 +392,14 @@
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
</Filter>
<File
@ -442,6 +450,10 @@
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -100,10 +100,10 @@ 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

@ -61,6 +61,13 @@ enum ETblStyleOverrideType
tblstyleoverridetypeSwCell = 11,
tblstyleoverridetypeWholeTable = 12
};
struct RowHeight
{
unsigned char HRule = 0;
long nHeight = 0;
};
class SdtWraper
{
public:
@ -2111,7 +2118,17 @@ public:
}
else if( c_oSerProp_rowPrType::Height == type )
{
res = Read2(length, &Binary_tblPrReader::ReadHeight, this, poResult);
RowHeight val;
res = Read2(length, &Binary_tblPrReader::ReadHeight, this, &val);
pCStringWriter->WriteString(L"<w:trHeight w:val=\"" + std::to_wstring(val.nHeight) + L"\"");
switch (val.HRule)
{
case 1: pCStringWriter->WriteString(L" w:hRule=\"auto\""); break;
case 2: pCStringWriter->WriteString(L" w:hRule=\"exact\""); break;
}
pCStringWriter->WriteString(L"/>");
}
else if( c_oSerProp_rowPrType::TableHeader == type )
{
@ -2180,17 +2197,17 @@ public:
int ReadHeight(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
XmlUtils::CStringWriter* pCStringWriter = static_cast<XmlUtils::CStringWriter*>(poResult);
/*if( c_oSerProp_rowPrType::Height_Rule == type )
RowHeight* pHeight = static_cast<RowHeight*>(poResult);
if( c_oSerProp_rowPrType::Height_Rule == type )
{
Height.HRule = this.stream.GetUChar();
pHeight->HRule = m_oBufferedStream.GetUChar();
}
else */if( c_oSerProp_rowPrType::Height_Value == type )
else if( c_oSerProp_rowPrType::Height_Value == type )
{
double dHeight = m_oBufferedStream.GetDouble();
long nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
pCStringWriter->WriteString(L"<w:trHeight w:val=\"" + std::to_wstring(nHeight) + L"\"/>");
pHeight->nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
}
else
res = c_oSerConstants::ReadUnknown;
@ -3734,6 +3751,33 @@ 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 if(c_oSerParType::JsaProject == type)
{
BYTE* pData = m_oBufferedStream.GetPointer(length);
OOX::CPath sJsaProject = OOX::FileTypes::JsaProject.DefaultFileName();
std::wstring filePath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"+ FILE_SEPARATOR_STR + sJsaProject.GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
oFile.WriteFile(pData, length);
oFile.CloseFile();
long lId;
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), sJsaProject.GetPath(), L"", &lId);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(sJsaProject.GetExtention(false));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -3872,6 +3916,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 +4323,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 +4567,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 +7042,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 +7091,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;

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);
@ -614,7 +618,7 @@ namespace MathEquation
nRows = m_aRowsCounter.top();
m_aRowsCounter.pop();
}
int nPos = 0;
int nPos = m_oStream.GetPosition();
if (!m_aRowsPosCounter.empty())
{
nPos = m_aRowsPosCounter.top();
@ -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,11 @@ extern int g_nCurFormatVersion;
MoveFromRangeStart = 18,
MoveFromRangeEnd = 19,
MoveToRangeStart = 20,
MoveToRangeEnd = 21
MoveToRangeEnd = 21,
JsaProject = 22,
BookmarkStart = 23,
BookmarkEnd = 24
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
@ -491,7 +495,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 +906,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 +1113,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

@ -2104,14 +2104,11 @@ namespace BinDocxRW
SimpleTypes::EHeightRule eHRule = SimpleTypes::heightruleAtLeast;
if(rowHeight.m_oHRule.IsInit())
eHRule = rowHeight.m_oHRule->GetValue();
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Rule);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
switch(eHRule)
{
case SimpleTypes::heightruleAtLeast :
case SimpleTypes::heightruleExact :m_oBcw.m_oStream.WriteBYTE(heightrule_AtLeast);break;
default :m_oBcw.m_oStream.WriteBYTE(heightrule_Auto);break;
}
m_oBcw.m_oStream.WriteBYTE(eHRule);
//Value
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Value);
@ -2992,6 +2989,7 @@ namespace BinDocxRW
Binary_tblPrWriter btblPrs;
OOX::Logic::CSectionProperty* pSectPr;
OOX::Logic::CBackground * pBackground;
OOX::CDocument* poDocument;
bool m_bWriteSectPr;//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
//---------------------------------
@ -3000,6 +2998,7 @@ namespace BinDocxRW
{
pBackground = NULL;
pSectPr = NULL;
poDocument = NULL;
m_bWriteSectPr = false;
}
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
@ -3076,6 +3075,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;
}
@ -3096,6 +3109,23 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
}
//Write JsaProject
if (NULL != poDocument)
{
smart_ptr<OOX::File> pFile = poDocument->Get(OOX::FileTypes::JsaProject);
if (pFile.IsInit() && OOX::FileTypes::JsaProject == pFile->type())
{
OOX::JsaProject& jsaProject = pFile.as<OOX::JsaProject>();
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(jsaProject.filename().GetPath(), &pData, nBytesCount))
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
m_oBcw.WriteItemEnd(nCurPos);
}
}
}
}
void WriteBackground (OOX::Logic::CBackground* pBackground)
{
@ -3249,6 +3279,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 +3706,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 +3772,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 +4188,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 +6745,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 +6819,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)
@ -7774,6 +7909,7 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.poDocument = poDocument;
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -48,13 +48,19 @@ _CP_PTR(oox_axis_content) oox_axis_content::create(int type)
oox_axis_content::oox_axis_content(int type/*,std::wstring name*/)
{
//id_ = abs((int)*((_UINT32*)this));
id_ = abs((long)this);
type_=type; //dimension
if (type == 0)
{
id_ = 0;
}
else
{
id_ = abs((long)this);
}
type_ = type;
}
void oox_axis_content::oox_serialize(std::wostream & _Wostream)
{
if (id_ <0 )return;//not activate
if (id_ < 1 )return; //not activate, blank axis
CP_XML_WRITER(_Wostream)
{

View File

@ -153,7 +153,7 @@ void oox_chart_context::serialize(std::wostream & strm)
}
CP_XML_NODE(L"c:dispBlanksAs")
{
CP_XML_ATTR(L"val", L"zero");
CP_XML_ATTR(L"val", plot_area_.current_chart_->dispBlanksAs_);
}
CP_XML_NODE(L"c:showDLblsOverMax")
{

View File

@ -250,7 +250,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
CP_XML_CONTENT(values_[i].numRef_.formula);
}
if (values_[i].numRef_.num_cache_count>0)
if (values_[i].numRef_.num_cache_count > 0)
{
CP_XML_NODE(L"c:numCache")
{

View File

@ -31,10 +31,10 @@
*/
#include "oox_plot_area.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/style_text_properties.h"
#include "oox_chart_shape.h"
@ -90,7 +90,7 @@ void oox_plot_area::add_chart(int type)
void oox_plot_area::add_axis(int type, odf_reader::chart::axis & content)
{
oox_axis_content_ptr ax=oox_axis_content::create(type);
oox_axis_content_ptr ax = oox_axis_content::create(type);
ax->content_ = content;
axis_.push_back(ax);
@ -98,21 +98,25 @@ void oox_plot_area::add_axis(int type, odf_reader::chart::axis & content)
void oox_plot_area::reset_cross_axis()//обязательно после всех добавлений
{
BOOST_FOREACH(oox_axis_content_ptr const & ax, axis_)
for (size_t i = 0; i < axis_.size(); i++)
{
BOOST_FOREACH(oox_chart_ptr const & ch, charts_)
for (size_t j = 0; j < charts_.size(); j++)
{
ch->add_axis(ax->get_Id());
charts_[j]->add_axis(axis_[i]->get_Id());
}
}
BOOST_FOREACH(oox_axis_content_ptr const & a, axis_)
{
int curr_id = a->get_Id();
BOOST_FOREACH(oox_axis_content_ptr const & b, axis_)
{
if (b->get_Id()==curr_id)continue;
b->add_CrossedId(curr_id);
for (size_t i = 0; i < axis_.size(); i++)
{
int curr_id = axis_[i]->get_Id();
if (curr_id < 1) continue;
for (size_t j = 0; j < axis_.size(); j++)
{
if (axis_[j]->get_Id() == curr_id)continue;
axis_[j]->add_CrossedId(curr_id);
}
}
}
@ -130,18 +134,18 @@ void oox_plot_area::oox_serialize(std::wostream & _Wostream)
//CP_XML_NODE(L"c:layout"){}
bool axisPresent = true;
BOOST_FOREACH(oox_chart_ptr const & ch, charts_)
{
ch->oox_serialize(CP_XML_STREAM());
for (size_t i = 0; i < charts_.size(); i++)
{
charts_[i]->oox_serialize(CP_XML_STREAM());
if (ch->type_ == CHART_TYPE_PIE ||
ch->type_ == CHART_TYPE_DOUGHNUT) axisPresent = false;
if (charts_[i]->type_ == CHART_TYPE_PIE ||
charts_[i]->type_ == CHART_TYPE_DOUGHNUT) axisPresent = false;
}
if (axisPresent)
{
BOOST_FOREACH(oox_axis_content_ptr const & a, axis_)
{
a->oox_serialize(CP_XML_STREAM());
for (size_t i = 0; i < axis_.size(); i++)
{
axis_[i]->oox_serialize(CP_XML_STREAM());
}
}
shape.oox_serialize(CP_XML_STREAM());

View File

@ -63,7 +63,7 @@ void oox_chart::set_content_series(odf_reader::chart::series & content)
}
void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
{
if (val.size()<1)return;
if (val.empty())return;
oox_series_ptr & current_ptr = series_.back();
current_ptr->setValues (ind, val);
@ -74,9 +74,11 @@ void oox_chart::set_properties(std::vector<odf_reader::_property> g)
_CP_OPT(bool) bStacked;
_CP_OPT(bool) bPercent;
_CP_OPT(int) iGapWidth;
odf_reader::GetProperty(g, L"stacked",bStacked);
odf_reader::GetProperty(g, L"percentage",bPercent);
odf_reader::GetProperty(g, L"stacked", bStacked);
odf_reader::GetProperty(g, L"percentage", bPercent);
odf_reader::GetProperty(g, L"gap-width", iGapWidth);
if ( (bStacked) && (bStacked.get()))
{
@ -87,6 +89,10 @@ void oox_chart::set_properties(std::vector<odf_reader::_property> g)
{
grouping_ = L"percentStacked";
}
if (iGapWidth)
{
dispBlanksAs_ = L"gap";
}
//solid-type - трехмерные
}
void oox_chart::oox_serialize_common(std::wostream & _Wostream)
@ -128,17 +134,15 @@ void oox_bar_chart::set_properties(std::vector<odf_reader::_property> g)
{
oox_chart::set_properties(g);
odf_reader::GetProperty(g, L"vertical",bVertical);
odf_reader::GetProperty(g, L"connect-bars",bConnectBars);
odf_reader::GetProperty(g, L"vertical", bVertical);
odf_reader::GetProperty(g, L"connect-bars", bConnectBars);
odf_reader::GetProperty(g, L"gap-width",iGapWidth);
odf_reader::GetProperty(g, L"overlap",iOverlap);
odf_reader::GetProperty(g, L"gap-width", iGapWidth);
odf_reader::GetProperty(g, L"overlap", iOverlap);
}
void oox_bar_chart::set_additional_properties(std::vector<odf_reader::_property> g)
{
odf_reader::GetProperty(g, L"gap-width",iGapWidth);
odf_reader::GetProperty(g, L"overlap",iOverlap);
}
void oox_bar_chart::oox_serialize(std::wostream & _Wostream)
@ -169,13 +173,13 @@ void oox_bar_chart::oox_serialize(std::wostream & _Wostream)
}
CP_XML_NODE(L"c:overlap")//-100 to 100
{
CP_XML_ATTR(L"val",Overlap);
CP_XML_ATTR(L"val", Overlap);
}
if (iGapWidth)
{
CP_XML_NODE(L"c:gapWidth")
{
CP_XML_ATTR(L"val",iGapWidth.get());
CP_XML_ATTR(L"val", iGapWidth.get());
}
}
CP_XML_NODE(L"c:varyColors")

View File

@ -63,9 +63,10 @@ public:
oox_chart()
{
grouping_ = L"standard";
is3D_ = false;
type_ = 0;
grouping_ = L"standard";
is3D_ = false;
type_ = 0;
dispBlanksAs_ = L"zero";
}
~oox_chart(){}
@ -98,9 +99,10 @@ public:
int type_;
bool is3D_;
std::vector<int> axisId_; //axId (Axis ID) §21.2.2.9
std::wstring dispBlanksAs_;
std::vector<int> axisId_; // axId (Axis ID) §21.2.2.9
std::wstring grouping_; // clustered | percentStacked | stacked | standard
std::vector<oox_series_ptr> series_; //ser (Bar Chart Series) §21.2.2.170
std::vector<oox_series_ptr> series_; // ser (Bar Chart Series) §21.2.2.170
virtual void set_properties(std::vector<odf_reader::_property> g);
virtual void set_additional_properties(std::vector<odf_reader::_property> g){}

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

@ -401,7 +401,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
std::vector<std::wstring> cell_cash;
std::vector<std::wstring> cat_cash;
calc_cache_series (domain_cell_range_adress_, domain_cash);
calc_cache_series (domain_cell_range_adress_, domain_cash);
calc_cache_series (series_[i].cell_range_address_, cell_cash);
if (categories_.size() >0)
@ -462,10 +462,19 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
std::sort(axises_.begin(), axises_.end(), axises_sort());//file_1_ (1).odp
bool x_enabled = false;
bool y_enabled = false;
bool z_enabled = false;
bool x_enabled = false;
bool y_enabled = false;
bool z_enabled = false;
bool is3D = false;
_CP_OPT(bool) boolVal;
odf_reader::GetProperty(plot_area_.properties_, L"three-dimensional", boolVal);
if ((boolVal) && (*boolVal))
{
is3D = true;
}
for (int i = 0; i < axises_.size(); i++)
{
axis & a = axises_[i];
@ -481,6 +490,8 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
if (class_ == chart_stock && a.type_ == 3 )
a.type_ = 4; //шкала дат.
if (is3D) a.type_ = 1; // шкала категорий
x_enabled = true;
}
@ -499,7 +510,7 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
}
else if (a.dimension_ == L"z")
{
chart_context.set_3D_chart (true);
is3D = true;
continue;
a.type_ = 2;
z_enabled = true;
@ -507,6 +518,18 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
chart_context.add_axis(a.type_, a);
}
if (is3D)
{
if (!z_enabled)
{
chart::axis a;
a.type_ = 0; // blank
chart_context.add_axis(a.type_, a);
}
chart_context.set_3D_chart (true);
}
}
//----------------------------------------------------------------------------------------

View File

@ -88,8 +88,8 @@ void style_chart_properties::add_attributes( const xml::attributes_wc_ptr & Attr
_CP_OPT(int) iVal;
//CP_APPLY_ATTR(L"chart:symbol-type", iVal); if (iVal)content_.push_back(_property(L"symbol-type", iVal.get()));
CP_APPLY_ATTR(L"chart:gap-width", iVal); if (iVal)content_.push_back(_property(L"gap-width", iVal.get()));
//CP_APPLY_ATTR(L"chart:symbol-type", iVal); if (iVal)content_.push_back(_property(L"symbol-type", iVal.get()));
CP_APPLY_ATTR(L"chart:gap-width", iVal); if (iVal)content_.push_back(_property(L"gap-width", iVal.get()));
CP_APPLY_ATTR(L"chart:overlap", iVal); if (iVal)content_.push_back(_property(L"overlap", iVal.get()));
CP_APPLY_ATTR(L"chart:spline-order", iVal); if (iVal)content_.push_back(_property(L"spline-order", iVal.get()));
CP_APPLY_ATTR(L"chart:spline-resolution",iVal); if (iVal)content_.push_back(_property(L"spline-resolution", iVal.get()));
@ -100,8 +100,8 @@ void style_chart_properties::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"chart:maximum", dVal); if (dVal)content_.push_back(_property(L"maximum", dVal.get()));
CP_APPLY_ATTR(L"chart:minimum", dVal); if (dVal)content_.push_back(_property(L"minimum", dVal.get()));
CP_APPLY_ATTR(L"chart:origin", dVal); if (dVal)content_.push_back(_property(L"origin", dVal.get()));
CP_APPLY_ATTR(L"chart:interval-major", dVal); if (dVal)content_.push_back(_property(L"interval-major", dVal.get()));
CP_APPLY_ATTR(L"chart:origin", dVal); if (dVal)content_.push_back(_property(L"origin", dVal.get()));
CP_APPLY_ATTR(L"chart:interval-major", dVal); if (dVal)content_.push_back(_property(L"interval-major", dVal.get()));
CP_APPLY_ATTR(L"chart:error-percentage",dVal); if (dVal)content_.push_back(_property(L"error-percentage", dVal.get()));
CP_APPLY_ATTR(L"chart:error-margin", dVal); if (dVal)content_.push_back(_property(L"error-margin", dVal.get()));
CP_APPLY_ATTR(L"chart:error-lower-limit",dVal); if (dVal)content_.push_back(_property(L"error-lower-limit", dVal.get()));

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;
}
}
}
}
@ -999,7 +1018,15 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
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();
}
}
}
}

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"

View File

@ -45,7 +45,7 @@
AdditionalIncludeDirectories=""
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="_DEBUG;_LIB;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
WarningLevel="3"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="Oox2OdfConverter"
ProjectGUID="{BEE01B53-244A-44E6-8947-ED9342D9247E}"
RootNamespace="Oox2OdfConverter"
@ -47,7 +47,7 @@
PreprocessorDefinitions="NDEBUG;_LIB;_USE_XMLLITE_READER_;USE_LITE_READER;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

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.getBaseShape());
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,11 +1308,11 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"</a:xfrm>"));
}
CBaseShape *shape = m_pShapeElement->m_oShape.getBaseShape();
CBaseShapePtr shape = m_pShapeElement->m_pShape->getBaseShape();
if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic || shape->m_bCustomShape)
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() && !shape->m_bCustomShape)

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.getBaseShape());
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->getBaseShape());
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,39 +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.getBaseShape());
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;
//---------внешние ссылки
{
@ -1426,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;
@ -1437,7 +1439,7 @@ public:
if (CExFilesInfo::eftHyperlink == exType && pInfo)
{
pElem->m_sHyperlink = pInfo->m_strFilePath;
pElement->m_sHyperlink = pInfo->m_strFilePath;
}
}
}
@ -1446,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;
}
}
}
@ -1479,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;
}
}
//------------- привязки ---------------------------------------------------------------------------------
@ -1514,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
@ -1529,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
@ -1544,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;
}
}
}
@ -1563,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;
@ -1594,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;
}
@ -1630,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;
@ -1663,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;
@ -1750,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)
@ -1847,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)
@ -1871,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
// затем применяем все настройки по-очереди
@ -1891,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 (для шаблонного элемента)
// как узнать - просто есть ли массивы (т.к. они могли появиться пока только оттуда)
@ -1924,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;
}
}
@ -1985,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);
@ -2113,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
{
@ -2225,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);
@ -2247,7 +2249,7 @@ protected:
ApplyHyperlink(pShape, oColor);
}
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_oShape.getBaseShape());
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_pShape->getBaseShape().get());
if (NULL != pPPTShape) // проверка на wordart
{
@ -2294,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:
@ -2311,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

@ -59,7 +59,7 @@
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"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
@ -429,6 +429,14 @@
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>

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"

File diff suppressed because it is too large Load Diff

View File

@ -43,11 +43,14 @@
#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;
@ -273,11 +276,11 @@ namespace NSBinPptxRW
std::wstring GetVMLShapeXml (CPPTShape* pPPTShape);
std::wstring GetVMLShapeXml (PPTX::Logic::SpTreeElem& oElem);
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 CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShape* pShape);
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShape* pShape);
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);

View File

@ -40,6 +40,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/Base64.h"
@ -292,7 +293,7 @@ namespace NSBinPptxRW
}
}
}
else if (!strExts.empty())
if (!strExts.empty())
{
m_pContentTypes->AddDefault(strExts.substr(1));
}
@ -1235,7 +1236,7 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels);
}
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject)
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject, bool bIsJsaProject)
{
if (bIsNotesMaster)
{
@ -1266,6 +1267,12 @@ namespace NSBinPptxRW
L"\" Type=\"http://schemas.microsoft.com/office/2006/relationships/vbaProject\" Target=\"vbaProject.bin\"/>";
m_pWriter->WriteString(strRels4);
}
if (bIsJsaProject)
{
std::wstring strRels5 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"" + OOX::FileTypes::JsaProject.RelationType() + L"\" Target=\"" + OOX::FileTypes::JsaProject.DefaultFileName().GetPath() + L"\"/>";
m_pWriter->WriteString(strRels5);
}
}
int CRelsGenerator::GetNextId()
{

View File

@ -425,7 +425,7 @@ namespace NSBinPptxRW
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false );
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false, bool bIsJsaProject = false );
int GetNextId ();
void CloseRels ();

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

@ -284,7 +284,7 @@ namespace PPTX2EditorAdvanced
namespace NSPresentationEditor
{
class CImageElement : public IElement
class CImageElement : public CElement
{
public:
std::wstring m_strImageFileName;
@ -306,7 +306,7 @@ namespace NSPresentationEditor
std::wstring m_sImageName;
CImageElement() : IElement()
CImageElement() : CElement()
{
m_etType = etPicture;
@ -328,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;
@ -349,7 +351,7 @@ namespace NSPresentationEditor
pImageElement->m_bImagePresent = m_bImagePresent;
pImageElement->m_bOLE = m_bOLE;
return (IElement*)pImageElement;
return pElement;
}
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
@ -389,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.getBaseShape()->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.getBaseShape()->ReCalculate();
m_pShape->getBaseShape()->ReCalculate();
SetupTextProperties(pSlide, pTheme, pLayout);
@ -476,7 +489,7 @@ namespace NSPresentationEditor
AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false)
{
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_oShape.getBaseShape());
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape->getBaseShape().get());
if (NULL == pPPTShape)
{
// такого быть не может
@ -578,7 +591,7 @@ namespace NSPresentationEditor
#else
std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false)
{
if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame)
if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame || pPPTShape->m_eType == PPTShapes::sptCTextBox)
{
if (bIsNamespace)
{
@ -712,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;
@ -728,7 +742,7 @@ namespace NSPresentationEditor
pAudioElement->m_dClipStartTime = m_dClipStartTime;
pAudioElement->m_dClipEndTime = m_dClipEndTime;
return (IElement*)pAudioElement;
return pElement;
}
};
class CVideoElement : public CImageElement
@ -759,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;
@ -774,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

@ -36,8 +36,9 @@
#include "PPTXShape/PptxShape.h"
#include "PPTShape/PptShape.h"
using namespace NSPresentationEditor;
NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType(NSPresentationEditor::NSBaseShape::ClassType ClassType, int ShapeType)
CBaseShapePtr CBaseShape::CreateByType(NSBaseShape::ClassType ClassType, int ShapeType)
{
if(ClassType == pptx)
{
@ -52,7 +53,7 @@ NSPresentationEditor::CBaseShape* NSPresentationEditor::CBaseShape::CreateByType
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;

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

@ -48,34 +48,40 @@ LONG NSGuidesVML::CFormula::Calculate(NSGuidesVML::CFormulasManager* pManager)
LONG lAdjCount = (LONG)pManager->m_pAdjustments->size();
LONG a1 = m_lParam1;
if (ptFormula == m_eType1)
if (ptFormula == m_eType1 && !pManager->m_bCalc)
{
pManager->m_bCalc = true;
a1 = (m_lParam1 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam1].Calculate(pManager);
}
else if (ptAdjust == m_eType1)
{
a1 = (m_lParam1 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam1];
}
pManager->m_bCalc = false;
LONG b1 = m_lParam2;
if (ptFormula == m_eType2)
if (ptFormula == m_eType2 && !pManager->m_bCalc)
{
pManager->m_bCalc = true;
b1 = (m_lParam2 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam2].Calculate(pManager);
}
else if (ptAdjust == m_eType2)
{
b1 = (m_lParam2 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam2];
}
pManager->m_bCalc = false;
LONG c1 = m_lParam3;
if (ptFormula == m_eType3)
if (ptFormula == m_eType3 && !pManager->m_bCalc)
{
pManager->m_bCalc = true;
c1 = (m_lParam3 >= lGuidesCount) ? 0 : pManager->m_arFormulas[m_lParam3].Calculate(pManager);
}
else if (ptAdjust == m_eType3)
{
c1 = (m_lParam3 >= lAdjCount) ? 0 : (*(pManager->m_pAdjustments))[m_lParam3];
}
pManager->m_bCalc = false;
double a = (double)a1;
double b = (double)b1;

View File

@ -341,8 +341,9 @@ namespace NSGuidesVML
long m_lShapeWidth;
long m_lShapeHeight;
public:
CFormulasManager() : m_arFormulas(), m_arResults()
bool m_bCalc; //status
CFormulasManager() : m_bCalc(false)
{
m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML;
@ -350,6 +351,7 @@ namespace NSGuidesVML
}
CFormulasManager& operator =(const CFormulasManager& oSrc)
{
m_bCalc = oSrc.m_bCalc;
m_pAdjustments = oSrc.m_pAdjustments;
m_lShapeWidth = oSrc.m_lShapeWidth;
m_lShapeHeight = oSrc.m_lShapeHeight;
@ -370,6 +372,7 @@ namespace NSGuidesVML
void Clear()
{
m_bCalc = false;
m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML;
m_lShapeHeight = ShapeSizeVML;

View File

@ -42,7 +42,26 @@ const double EMU_MM = 36000;
//-------------------------------------------------------------------------------
using namespace PPTShapes;
CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
using namespace NSPresentationEditor;
CPPTShape::CPPTShape() : CBaseShape(), m_arStringTextRects()
{
m_eType = PPTShapes::sptMin;
m_arStringTextRects.push_back(_T("0,0,21600,21600"));
m_strPathLimoX = _T("");
m_strPathLimoY = _T("");
m_bIsShapeType = false;
m_bIsFilled = true;
m_bIsStroked = true;
}
CPPTShape::~CPPTShape()
{
}
CBaseShapePtr CPPTShape::CreateByType(PPTShapes::ShapeType type)
{
CPPTShape* pShape = NULL;
switch (type)
@ -288,6 +307,143 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
if (NULL != pShape)
pShape->m_eType = type;
return pShape;
return CBaseShapePtr(pShape);
}
bool CPPTShape::LoadFromXML(const std::wstring& xml)
{
XmlUtils::CXmlNode oNodePict;
if (oNodePict.FromXmlString(xml))
{
return LoadFromXML(oNodePict);
}
return false;
}
bool CPPTShape::LoadFromXML(XmlUtils::CXmlNode& oNodePict)
{
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
bool isPathList = false;
if (id != _T(""))
{
SetShapeType((PPTShapes::ShapeType)XmlUtils::GetInteger(id));
}
else
{
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
{
std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
}
XmlUtils::CXmlNode oNodeGuides;
if (oNodePict.GetNode(_T("path"), oNodeGuides))
{
std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
if (!isPathList)
ReCalculate();
return true;
}
bool CPPTShape::LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType) // vml object
{ // из за особенносей форматирования vmlDrawing могут вылезти пустые текстовые значения - value ..
std::wstring sId = oNodeShapeType.GetAttribute(_T("o:spt"));
bool bIsNeedRecalc = true;
if (sId != _T(""))
{
int id = XmlUtils::GetInteger(sId);
if (id > 0)
{
SetShapeType((PPTShapes::ShapeType)id);
//ReCalculate();
m_eType = (PPTShapes::ShapeType)id;
}
}
std::wstring strAdj = oNodeShapeType.GetAttribute(_T("adj"));
if (strAdj != _T(""))
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
XmlUtils::CXmlNode oNodePath;
if (oNodeShapeType.GetNode(_T("v:path"), oNodePath))
{
std::wstring strTextR = oNodePath.GetAttribute(_T("textboxrect"));
if (strTextR != _T(""))
LoadTextRect(strTextR);
}
XmlUtils::CXmlNode oNodeAHs;
if (oNodeShapeType.GetNode(_T("v:handles"), oNodeAHs))
{
LoadAHList(oNodeAHs);
}
std::wstring strPath = oNodeShapeType.GetAttribute(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
}
XmlUtils::CXmlNode oNodeTextPath;
if (oNodeShapeType.GetNode(_T("v:textpath"), oNodeTextPath))
{
if (m_eType < PPTShapes::ShapeType::sptCTextPlain || m_eType > PPTShapes::ShapeType::sptCTextCanDown)
m_eType = PPTShapes::ShapeType::sptCTextPlain;
}
std::wstring strFilled = oNodeShapeType.GetAttribute(_T("filled"));
std::wstring strStroked = oNodeShapeType.GetAttribute(_T("stroked"));
if (strFilled != _T(""))
{
if (strFilled == _T("false") || strFilled == _T("f"))
m_bIsFilled = false;
else
m_bIsFilled = true;
}
if (strStroked != _T(""))
{
if (strStroked == _T("false") || strStroked == _T("f"))
m_bIsStroked = false;
else
m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeSignature;
if (oNodeShapeType.GetNode(_T("o:signatureline"), oNodeSignature))
{
m_oSignatureLine = oNodeSignature;
}
ReCalculate();
return true;
}

View File

@ -56,240 +56,12 @@ public:
bool m_bIsStroked;
nullable<OOX::VmlOffice::CSignatureLine> m_oSignatureLine;
public:
CPPTShape() : CBaseShape(), m_arStringTextRects()
{
m_eType = PPTShapes::sptMin;
m_arStringTextRects.push_back(_T("0,0,21600,21600"));
m_strPathLimoX = _T("");
m_strPathLimoY = _T("");
m_bIsShapeType = false;
m_bIsFilled = true;
m_bIsStroked = true;
}
~CPPTShape()
{
}
virtual bool LoadFromXML(const std::wstring& xml)
{
XmlUtils::CXmlNode oNodePict;
if (oNodePict.FromXmlString(xml))
{
return LoadFromXML(oNodePict);
}
return false;
}
//virtual bool LoadFromXML(const std::wstring& xml)
//{
// XmlUtils::CXmlNode oNodePict;
// if (oNodePict.FromXmlString(xml))
// {
// if (_T("shape") == oNodePict.GetName())
// {
// std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
// if (id != _T(""))
// {
// SetShapeType((PPTShapes::ShapeType)Strings::ToInteger(id));
// }
// else
// {
// XmlUtils::CXmlNode oNodeTemplate;
// if (oNodePict.GetNode(_T("template"), oNodeTemplate))
// {
// std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodePict.GetNode(_T("path"), oNodeGuides))
// {
// std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
// LoadPathList(strPath);
// }
// /*XmlUtils::CXmlNode oNodeShapeType;
// if (oNodePict.GetNode(_T("v:shapetype"), oNodeShapeType))
// {
// std::wstring strAdj = oNodeShapeType.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShapeType.GetAttributeOrValue(_T("path"));
// LoadAdjustValuesList(strPath);
// }
// else
// {
// XmlUtils::CXmlNode oNodeShape;
// if (oNodePict.GetNode(_T("v:shape"), oNodeShape))
// {
// std::wstring strAdj = oNodeShape.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShape.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShape.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }*/
// return true;
// }
// }
// return false;
//}
virtual bool LoadFromXML(XmlUtils::CXmlNode& oNodePict)
{
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
bool isPathList = false;
if (id != _T(""))
{
SetShapeType((PPTShapes::ShapeType)XmlUtils::GetInteger(id));
}
else
{
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
{
std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
}
XmlUtils::CXmlNode oNodeGuides;
if (oNodePict.GetNode(_T("path"), oNodeGuides))
{
std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
if (strPath != _T(""))
{
LoadPathList(strPath);
isPathList = true;
}
}
if (!isPathList)
ReCalculate();
return true;
}
virtual bool LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType) // vml object
{ // из за особенносей форматирования vmlDrawing могут вылезти пустые текстовые значения - value ..
std::wstring sId = oNodeShapeType.GetAttribute(_T("o:spt"));
bool bIsNeedRecalc = true;
if (sId != _T(""))
{
int id = XmlUtils::GetInteger(sId);
if (id > 0)
{
SetShapeType((PPTShapes::ShapeType)id);
//ReCalculate();
m_eType = (PPTShapes::ShapeType)id;
}
}
std::wstring strAdj = oNodeShapeType.GetAttribute(_T("adj"));
if (strAdj != _T(""))
LoadAdjustValuesList(strAdj);
XmlUtils::CXmlNode oNodeGuides;
if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
{
LoadGuidesList(oNodeGuides.GetXml());
}
XmlUtils::CXmlNode oNodePath;
if (oNodeShapeType.GetNode(_T("v:path"), oNodePath))
{
std::wstring strTextR = oNodePath.GetAttribute(_T("textboxrect"));
if (strTextR != _T(""))
LoadTextRect(strTextR);
}
XmlUtils::CXmlNode oNodeAHs;
if (oNodeShapeType.GetNode(_T("v:handles"), oNodeAHs))
{
LoadAHList(oNodeAHs);
}
std::wstring strPath = oNodeShapeType.GetAttribute(_T("path"));
if (strPath != _T(""))
{
LoadPathList(strPath);
}
XmlUtils::CXmlNode oNodeTextPath;
if (oNodeShapeType.GetNode(_T("v:textpath"), oNodeTextPath))
{
if (m_eType < PPTShapes::ShapeType::sptCTextPlain || m_eType > PPTShapes::ShapeType::sptCTextCanDown)
m_eType = PPTShapes::ShapeType::sptCTextPlain;
}
std::wstring strFilled = oNodeShapeType.GetAttribute(_T("filled"));
std::wstring strStroked = oNodeShapeType.GetAttribute(_T("stroked"));
if (strFilled != _T(""))
{
if (strFilled == _T("false") || strFilled == _T("f"))
m_bIsFilled = false;
else
m_bIsFilled = true;
}
if (strStroked != _T(""))
{
if (strStroked == _T("false") || strStroked == _T("f"))
m_bIsStroked = false;
else
m_bIsStroked = true;
}
XmlUtils::CXmlNode oNodeSignature;
if (oNodeShapeType.GetNode(_T("o:signatureline"), oNodeSignature))
{
m_oSignatureLine = oNodeSignature;
}
ReCalculate();
return true;
}
CPPTShape();
virtual ~CPPTShape();
virtual bool LoadFromXML(const std::wstring& xml);
virtual bool LoadFromXML(XmlUtils::CXmlNode& oNodePict);
virtual bool LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType);
virtual bool LoadAdjustValuesList(const std::wstring& xml)
{
std::wstring strXml = xml;
@ -484,8 +256,9 @@ public:
LoadPathList(m_strPath);
}
static CPPTShape* CreateByType(PPTShapes::ShapeType type);
virtual const ClassType GetClassType()const
static CBaseShapePtr CreateByType(PPTShapes::ShapeType type);
virtual const ClassType GetClassType()const
{
return NSBaseShape::ppt;
}
@ -533,13 +306,13 @@ public:
bool SetShapeType(PPTShapes::ShapeType type)
{
CPPTShape* l_pShape = CreateByType(type);
if(l_pShape != NULL)
CBaseShapePtr pShape = CreateByType(type);
if(pShape)
{
m_eType = type;
SetProperties(l_pShape);
delete l_pShape;
SetProperties(pShape.get());
return true;
}

View File

@ -34,8 +34,9 @@
#include "PptxShape.h"
//#include "PresetShapesHeader.h"
CPPTXShape* CPPTXShape::CreateByType(OOXMLShapes::ShapeType type)
CBaseShapePtr CPPTXShape::CreateByType(OOXMLShapes::ShapeType type)
{
CBaseShapePtr shape;
// switch(type)
// {
// case OOXMLShapes::sptCAccentBorderCallout1: return new OOXMLShapes::CAccentBorderCallout1();
@ -266,5 +267,5 @@ CPPTXShape* CPPTXShape::CreateByType(OOXMLShapes::ShapeType type)
// case OOXMLShapes::sptCWedgeRectCallout: return new OOXMLShapes::CWedgeRectCallout();
// case OOXMLShapes::sptCWedgeRoundRectCallout: return new OOXMLShapes::CWedgeRoundRectCallout();
// }
return NULL;
return shape;
}

View File

@ -280,7 +280,7 @@ public:
OOXMLShapes::ShapeType m_eType;
NSGuidesOOXML::CFormulaManager FManager;
public:
CPPTXShape() : CBaseShape(), FManager(m_arAdjustments, m_arGuides)
{
m_eType = OOXMLShapes::sptMin;
@ -507,7 +507,7 @@ public:
LoadPathList(m_strPath);
}
static CPPTXShape* CreateByType(OOXMLShapes::ShapeType type);
static CBaseShapePtr CreateByType(OOXMLShapes::ShapeType type);
virtual const ClassType GetClassType()const
{
@ -540,13 +540,12 @@ public:
bool SetShapeType(OOXMLShapes::ShapeType type)
{
CPPTXShape* l_pShape = CreateByType(type);
if(l_pShape != NULL)
CBaseShapePtr pShape = CreateByType(type);
if(pShape)
{
m_eType = type;
SetProperties(l_pShape);
delete l_pShape;
SetProperties(pShape.get());
return true;
}

View File

@ -49,10 +49,13 @@ const LONG c_ShapeDrawType_Graphic = 0x01;
const LONG c_ShapeDrawType_Text = 0x02;
const LONG c_ShapeDrawType_All = c_ShapeDrawType_Graphic | c_ShapeDrawType_Text;
class CShape;
typedef boost::shared_ptr<CShape> CShapePtr;
class CShape
{
private:
CBaseShape* m_pShape;
CBaseShapePtr m_pShape;
public:
double m_dStartTime;
double m_dEndTime;
@ -103,15 +106,11 @@ public:
m_dTextMarginRight = 0;
m_dTextMarginBottom = 0;
m_strPPTXShape = _T("");
m_pShape = NULL;
m_classType = classType;
if (m_classType == NSBaseShape::pptx)
{
m_pShape = new CPPTXShape();
m_pShape = CBaseShapePtr(new CPPTXShape());
m_pShape->SetType(NSBaseShape::pptx, ShapeType_);
}
else if (m_classType == NSBaseShape::ppt)
@ -119,7 +118,7 @@ public:
m_pShape = CPPTShape::CreateByType((PPTShapes::ShapeType)ShapeType_ );
if (m_pShape == NULL)
{
m_pShape = new CPPTShape();
m_pShape = CBaseShapePtr(new CPPTShape());
m_pShape->SetType(NSBaseShape::ppt, ShapeType_);
}
@ -135,20 +134,17 @@ public:
~CShape()
{
RELEASEOBJECT(m_pShape);
}
CBaseShape* getBaseShape()
CBaseShapePtr getBaseShape()
{
return m_pShape;
}
void setBaseShape(CBaseShape* pShape)
void setBaseShape(CBaseShapePtr pShape)
{
if (pShape == NULL) return;
CPPTXShape *pptxShape = dynamic_cast<CPPTXShape*>(pShape);
CPPTShape *pptShape = dynamic_cast<CPPTShape*>(pShape);
CPPTXShape *pptxShape = dynamic_cast<CPPTXShape*>(pShape.get());
CPPTShape *pptShape = dynamic_cast<CPPTShape*>(pShape.get());
if (pptxShape) m_classType = NSBaseShape::pptx;
if (pptShape) m_classType = NSBaseShape::ppt;
@ -180,7 +176,7 @@ public:
if (NSBaseShape::ppt == m_pShape->GetClassType())
{
// как будто могло быть иначе
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape);
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape.get());
if (NULL != pPPTShape)
{
pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom);
@ -251,7 +247,7 @@ public:
if ((m_pShape) && (NSBaseShape::ppt == m_pShape->GetClassType()))
{
// как будто могло быть иначе
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape);
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(m_pShape.get());
if (NULL != pPPTShape)
{
//pPPTShape->CalcTextRectOffsets(dPercentLeft, dPercentTop, dPercentRight, dPercentBottom);
@ -338,23 +334,23 @@ public:
{
if(_T("ooxml-shape") == root.GetName())
{
if(m_pShape != NULL)
delete m_pShape;
m_pShape = new CPPTXShape();
//return m_pShape->LoadFromXML(xml);
return ((CPPTXShape*)m_pShape)->LoadFromXML(root);
m_pShape = CBaseShapePtr(new CPPTXShape());
CPPTXShape* pptx_shape = dynamic_cast<CPPTXShape*>(m_pShape.get());
return pptx_shape ? pptx_shape->LoadFromXML(root) : false;
}
else if(_T("shape") == root.GetName())
{
if(m_pShape != NULL)
delete m_pShape;
m_pShape = new CPPTShape();
m_pShape = CBaseShapePtr(new CPPTShape());
SetCoordSize(root);
SetPen (root);
SetBrush (root);
return ((CPPTShape*)m_pShape)->LoadFromXML(root);
CPPTShape* ppt_shape = dynamic_cast<CPPTShape*>(m_pShape.get());
return ppt_shape ? ppt_shape->LoadFromXML(root) : false;
}
return false;
@ -386,7 +382,7 @@ public:
Shape->m_dTextMarginBottom = m_dTextMarginBottom;
if (m_pShape)
return m_pShape->SetToDublicate(Shape->m_pShape);
return m_pShape->SetToDublicate(Shape->m_pShape.get());
return true;
}

View File

@ -44,7 +44,7 @@ namespace NSPresentationEditor
LONG m_lSlideID; //for notes rels
LONG m_lNotesID; //for slide rels
std::vector<IElement*> m_arElements;
std::vector<CElementPtr>m_arElements;
CSlideShowInfo m_oSlideShow;
std::multimap<int,int> m_mapPlaceholders;
@ -73,7 +73,7 @@ namespace NSPresentationEditor
std::wstring m_strComment;
std::wstring m_sName;
CSlide() : m_arElements(), m_oSlideShow()
CSlide() : m_oSlideShow()
{
Clear();
}
@ -84,11 +84,6 @@ namespace NSPresentationEditor
void Clear()
{
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
RELEASEINTERFACE(pElem);
}
m_arColorScheme.clear();
m_arElements.clear();
@ -111,7 +106,8 @@ namespace NSPresentationEditor
m_strComment.clear();
m_sName.clear();
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear();
for (int i = 0 ; i < 3 ; i++)
m_PlaceholdersReplaceString[i].clear();
}
CSlide(const CSlide& oSrc)
@ -171,7 +167,7 @@ namespace NSPresentationEditor
{
if (-1 != m_arElements[nEl]->m_lPlaceholderType && etShape == m_arElements[nEl]->m_etType)
{
CShapeElement* pSlideElement = dynamic_cast<CShapeElement*>(m_arElements[nEl]);
CShapeElement* pSlideElement = dynamic_cast<CShapeElement*>(m_arElements[nEl].get());
if (NULL != pSlideElement)
{
@ -185,10 +181,10 @@ namespace NSPresentationEditor
if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) &&
(pLayout->m_arElements[i]->m_etType == etShape))
{
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]);
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i].get());
if (NULL != pLayoutElement)
{
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles;
pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles;
}
}
}
@ -198,10 +194,10 @@ namespace NSPresentationEditor
(pLayout->m_arElements[i]->m_lPlaceholderID == pSlideElement->m_lPlaceholderID) &&
(pLayout->m_arElements[i]->m_etType == etShape))
{
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]);
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i].get());
if (NULL != pLayoutElement)
{
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles;
pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles;
}
}
}

View File

@ -57,7 +57,7 @@ namespace NSPresentationEditor
bool m_bIsBackground;
CBrush m_oBackground;
std::vector<IElement*> m_arElements;
std::vector<CElementPtr> m_arElements;
CMetricInfo m_oInfo;
@ -133,11 +133,6 @@ namespace NSPresentationEditor
m_arElements = oSrc.m_arElements;
nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
ADDREFINTERFACE((m_arElements[nIndex]));
}
CreateDublicateElements();
for (long nIndexStyle = 0; nIndexStyle < g_ThemeTextStylesCount; ++nIndexStyle)
@ -154,23 +149,16 @@ namespace NSPresentationEditor
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
CElementPtr pElem = m_arElements[nIndex];
if (NULL != pElem)
{
m_arElements[nIndex] = pElem->CreateDublicate();
}
RELEASEINTERFACE(pElem);
}
}
void Clear()
{
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
RELEASEINTERFACE((m_arElements[nIndex]));
}
m_arElements.clear();
m_arLayouts.clear();
m_mapTitleLayout.clear();
@ -186,15 +174,13 @@ namespace NSPresentationEditor
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();
}
~CTheme()
{
}
public:
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{
if (lIndexScheme < (LONG)m_arColorScheme.size())

View File

@ -812,7 +812,7 @@ namespace NSBinPptxRW
++nCurrentRels;
}
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init());
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
m_oReader.m_pRels->CloseRels();
oXmlWriter.ClearNoAttack();

View File

@ -103,11 +103,9 @@ namespace PPTX
pSrcFile->type() == OOX::Presentation::FileTypes::NotesSlide) ? true : false;
}
size_t nCount = rels.m_arrRelations.size();
for (size_t i = 0; i < nCount; ++i)
{
OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
for (std::map<std::wstring, OOX::Rels::CRelationShip*>::const_iterator it = rels.m_mapRelations.begin(); it != rels.m_mapRelations.end(); it++)
{
OOX::Rels::CRelationShip* pRelation = it->second;
OOX::CPath normPath = CorrectPathRels(path, pRelation);

View File

@ -63,6 +63,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
@ -144,6 +145,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
else if (relation.Type() == OOX::FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( filename, filename ));
else if (relation.Type() == OOX::FileTypes::JsaProject)
return smart_ptr<OOX::File>(new OOX::JsaProject( filename ));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}

View File

@ -81,6 +81,10 @@ namespace PPTX
_presentation->m_bMacroEnabled = true;
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
}
if (_presentation->IsExist(OOX::FileTypes::JsaProject))
{
_presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>();
}
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)

View File

@ -112,6 +112,10 @@ namespace PPTX
virtual std::wstring toXML() const
{
std::wstring namespaceLocks = L"a";
std::wstring namespaceLocksLink = PPTX::g_Namespaces.a.m_strLink;
//if (m_namespace == L"wp") namespaceLocks = L"wp";
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("noChangeAspect"), noChangeAspect);
oAttr.Write(_T("noDrilldown"), noDrilldown);
@ -120,21 +124,23 @@ namespace PPTX
oAttr.Write(_T("noResize"), noResize);
oAttr.Write(_T("noSelect"), noSelect);
std::wstring namespaceLocks = L"a";
//if (m_namespace == L"wp") namespaceLocks = L"wp";
bool isAttrEmpty = oAttr.m_strValue.empty();
oAttr.Write(_T("xmlns:") + namespaceLocks, namespaceLocksLink);
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", isAttrEmpty ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring namespace_ = m_namespace;
std::wstring namespaceLock_ = L"a";
std::wstring namespaceLockLink_ = PPTX::g_Namespaces.a.m_strLink;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
namespaceLock_ = L"a";
namespaceLockLink_ = PPTX::g_Namespaces.a.m_strLink;
namespace_ = L"wp";
}
@ -145,7 +151,7 @@ namespace PPTX
pWriter->StartNode(namespaceLock_ + L":graphicFrameLocks");
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:") + namespaceLock_, namespaceLockLink_);
pWriter->WriteAttribute(_T("noChangeAspect"), noChangeAspect);
pWriter->WriteAttribute(_T("noDrilldown"), noDrilldown);
pWriter->WriteAttribute(_T("noGrp"), noGrp);

View File

@ -54,7 +54,7 @@ namespace PPTX
lpShapeElement = new NSPresentationEditor::CShapeElement(NSBaseShape::pptx, (int)_lspt);
std::wstring strAdjustValues = lpGeom.GetODString();
lpShapeElement->m_oShape.getBaseShape()->LoadAdjustValuesList(strAdjustValues);
lpShapeElement->m_pShape->getBaseShape()->LoadAdjustValuesList(strAdjustValues);
}
else if (this->is<PPTX::Logic::CustGeom>())
{
@ -71,8 +71,8 @@ namespace PPTX
LONG lCoordSize = 100000;
lpShapeElement->m_oShape.getBaseShape()->SetWidthHeightLogic(dCoordSizeX, dCoordSizeY);
lpShapeElement->m_oShape.getBaseShape()->ReCalculate();
lpShapeElement->m_pShape->getBaseShape()->SetWidthHeightLogic(dCoordSizeX, dCoordSizeY);
lpShapeElement->m_pShape->getBaseShape()->ReCalculate();
pOOXToVMLRenderer->put_Width((double)lCoordSize / dCoordSizeX);
pOOXToVMLRenderer->put_Height((double)lCoordSize / dCoordSizeY);
@ -85,7 +85,7 @@ namespace PPTX
oInfo.m_dWidth = dCoordSizeX;
oInfo.m_dHeight = dCoordSizeY;
NSPresentationEditor::CPath& oPath = lpShapeElement->m_oShape.getBaseShape()->m_oPath;
NSPresentationEditor::CPath& oPath = lpShapeElement->m_pShape->getBaseShape()->m_oPath;
COOXToVMLGeometry* pOOXToVMLGeometry = dynamic_cast<COOXToVMLGeometry*>(pOOXToVMLRenderer);
@ -111,19 +111,19 @@ namespace PPTX
if(NULL != pOOXToVMLGeometry)
pOOXToVMLGeometry->ResultPath(&strPath);
if (lpShapeElement->m_oShape.getBaseShape()->m_arTextRects.size() <= 0)
if (lpShapeElement->m_pShape->getBaseShape()->m_arTextRects.size() <= 0)
{
strRect = _T("0,0,100000,100000");
}
else
{
Aggplus::RECT& txRect = lpShapeElement->m_oShape.getBaseShape()->m_arTextRects[0];
Aggplus::RECT& txRect = lpShapeElement->m_pShape->getBaseShape()->m_arTextRects[0];
//double dkoefX = (double)lCoordSize / max(1, dCoordSizeX);
//double dkoefY = (double)lCoordSize / max(1, dCoordSizeY);
double _dWidth = ShapeSize;
double _dHeight = ShapeSize;
lpShapeElement->m_oShape.getBaseShape()->GetWidthHeightLogic(_dWidth, _dHeight);
lpShapeElement->m_pShape->getBaseShape()->GetWidthHeightLogic(_dWidth, _dHeight);
double dkoefX = (double)lCoordSize / (std::max)(1., _dWidth);
double dkoefY = (double)lCoordSize / (std::max)(1., _dHeight);

View File

@ -295,6 +295,12 @@ namespace PPTX
oNode.ReadAttributeBase(L"spid", vmlSpid);
result = true;
}
else
{
element.fromXML( oNode );
if (element.is_init())
result = true;
}
}
}
return result;

View File

@ -233,7 +233,7 @@ namespace PPTX
}
NSDirectory::DeleteDirectory(oox_unpacked.GetPath());
}
else if ( L"Equation.3" == sProgID || L"Equation.2" == sProgID )
else if ( std::wstring::npos != sProgID.find(L"Equation"))
{
pWriter->StartRecord(1);
pWriter->WriteBYTE(4);
@ -637,11 +637,18 @@ namespace PPTX
{
pWriter->StartRecord(SPTREE_TYPE_OLE);
if (oleObject->m_sShapeId.IsInit() && (!blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty()) &&
parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
OOX::CVmlDrawing *pVml = NULL;
if (parentFileIs<PPTX::Slide>())
{
OOX::CVmlDrawing *pVml = parentFileAs<PPTX::Slide>().Vml.operator->();
pVml = parentFileAs<PPTX::Slide>().Vml.operator->();
}
else if (parentFileIs<PPTX::SlideMaster>())
{
pVml = parentFileAs<PPTX::SlideMaster>().Vml.operator->();
}
if (oleObject->m_sShapeId.IsInit() && pVml && !blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty())
{
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
if (pVml->m_mapShapes.end() != pPair)
{
@ -743,7 +750,7 @@ namespace PPTX
if(oleObject.IsInit() && oleObject->isValid())
{
bOle = true;
pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>");
pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>");
if(spPr.xfrm.IsInit())
{
std::wstring oldNamespace = spPr.xfrm->m_ns;

View File

@ -123,18 +123,18 @@ namespace PPTX
oWriter.StartNode(_T("w:ind"));
oWriter.StartAttributes();
if (oPar.pPr->marL.is_init())
oWriter.WriteAttribute(_T("w:left"), (int)((double)(*pPr->marL) / 635));
oWriter.WriteAttribute(_T("w:left"), (int)((double)(*pPr->marL) / 635.) + 0.5);
if (oPar.pPr->marR.is_init())
oWriter.WriteAttribute(_T("w:right"), (int)((double)(*pPr->marR) / 635));
oWriter.WriteAttribute(_T("w:right"), (int)((double)(*pPr->marR) / 635.) + 0.5);
if (oPar.pPr->indent.is_init())
oWriter.WriteAttribute(_T("w:firstLine"), (int)((double)(*pPr->indent) / 635));
oWriter.WriteAttribute(_T("w:firstLine"), (int)((double)(*pPr->indent) / 635.) + 0.5);
oWriter.EndAttributes();
oWriter.EndNode(_T("w:ind"));
}
if (true)
{
oWriter.WriteString(_T("<w:spacing w:before=\"0\" w:after=\"0\" />"));
oWriter.WriteString(_T("<w:spacing w:before=\"0\" w:after=\"0\"/>"));
}
if (pPr->algn.is_init())

View File

@ -51,6 +51,7 @@
#include "Theme/ClrScheme.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
namespace PPTX
{
@ -233,6 +234,7 @@ namespace PPTX
}
pWriter->EndRecord();
}
pWriter->WriteRecord2(9, m_pJsaProject);
pWriter->EndRecord();
}
@ -352,9 +354,17 @@ namespace PPTX
m_bMacroEnabled = true;
}break;
case 9:
{
m_pJsaProject = new OOX::JsaProject();
m_pJsaProject->fromPPTY(pReader);
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
FileContainer::Add(file);
}break;
default:
{
pReader->Seek(_end_pos);
pReader->SkipRecord();
return;
}
}
@ -468,6 +478,7 @@ namespace PPTX
public:
bool m_bMacroEnabled;
smart_ptr<OOX::VbaProject> m_pVbaProject;
smart_ptr<OOX::JsaProject> m_pJsaProject;
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;}
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;}

View File

@ -48,7 +48,7 @@
PreprocessorDefinitions="WIN32;_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"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -46,7 +46,7 @@
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"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -1027,7 +1027,16 @@ bool RtfParagraphPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
}
}
COMMAND_RTF_BOOL( "intbl", paragraphProps->m_bInTable, sCommand, hasParameter, parameter )
COMMAND_RTF_INT ( "itap", paragraphProps->m_nItap, sCommand, hasParameter, parameter )
else if ( "itap" == sCommand && hasParameter)
{
//if (parameter == 0 && paragraphProps->m_bInTable && paragraphProps->m_nItap > 0)
//{
//
//// paragraphProps->m_bInTable = 0;
//}
//else
paragraphProps->m_nItap = parameter;
}
COMMAND_RTF_BOOL( "keep", paragraphProps->m_bKeep, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "keepn", paragraphProps->m_bKeepNext, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "pagebb", paragraphProps->m_bPageBB, sCommand, hasParameter, parameter )
@ -2283,7 +2292,8 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
{
// 1 != oItem->m_oProperty.m_bInTable - параграф не в таблице
// PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap - выставлено свойство,что вложенность - nTargetItap - это не таблица( Нужно для чтения параграфов в таблицах )
if ( 1 != oItem->m_oProperty.m_bInTable || ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
if ( ( 1 != oItem->m_oProperty.m_bInTable || 0 == oItem->m_oProperty.m_nItap ) //Платежное_поручение.rtf
|| ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
{
if ( nCurItap > 0 ) //Если до этого были только параграфы в таблицах - завершаем таблицу
{
@ -2292,15 +2302,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
{
if ( aRowItaps[k] == nCurItap )
{
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
else
if ( aRowItaps[k] != nCurItap )
break;
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
@ -2339,15 +2347,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
{
if ( aRowItaps[k] == nCurItap )
{
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
else
if ( aRowItaps[k] != nCurItap )
break;
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
@ -2386,7 +2392,7 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
//добавляем параграф во временные cell
aCellRenderables.push_back( oItem ); //содержит все параграфы, не разложенные по cell
aItaps.push_back( nCurItap ); //содержит все номера вложенности параграфов
if ( bEndCell )
{
RtfTableCellPtr oNewTableCell ( new RtfTableCell() );
@ -2456,6 +2462,9 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
}
else if ( "cell" == sCommand || "nestcell" == sCommand )
{
if (oReader.m_oState->m_oParagraphProp.m_bInTable == 1 && 0 == oReader.m_oState->m_oParagraphProp.m_nItap )//Платежное_поручение.rtf (ели по другому сбойная строка заменяется параграфами
oReader.m_oState->m_oParagraphProp.m_nItap = 1;
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;

View File

@ -1116,7 +1116,8 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
//Custom
if (!m_aPVerticles.empty() || !m_aPSegmentInfo.empty())
{
CPPTShape * custom_shape = CPPTShape::CreateByType((PPTShapes::ShapeType)m_nShapeType);
CBaseShapePtr base_shape = CPPTShape::CreateByType((PPTShapes::ShapeType)m_nShapeType);
CPPTShape *custom_shape = dynamic_cast<CPPTShape*>(base_shape.get());
if (custom_shape)
{
custom_shape->m_bCustomShape = true;

View File

@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
AdditionalDependencies="Urlmon.lib Rpcrt4.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMT.lib"
IgnoreEmbeddedIDL="true"
@ -407,6 +407,10 @@
RelativePath="..\..\ASCOfficeOdfFile\src\odf\svg_parser.cpp"
>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -47,7 +47,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -60,7 +60,7 @@ HRESULT convert_single(std::wstring srcFileName)
std::wstring dstPath;
bool bMacros = true;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL, bMacros);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", L"C:\\Windows\\Temp", NULL, bMacros);
if (bMacros)
{

View File

@ -46,7 +46,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\XlsFileTestD.pdb"
WarningLevel="3"

View File

@ -57,6 +57,8 @@ namespace writer
static const char colon = ':';
static const char amp = '&';
static const char apos = '\'';
static const char a = '\x0a';
static const char * cdata_open() { return "<![CDATA["; }
static const char * cdata_close() { return "]]>"; }
static const char * amp_str(){ return "&amp;"; }
@ -64,6 +66,7 @@ namespace writer
static const char * right_brocket_str() { return "&gt;"; }
static const char * apos_str() { return "&apos;"; }
static const char * quote_str() { return "&quot;"; }
static const char * a_str() { return "&#10;"; }
};
template <>
@ -78,14 +81,17 @@ namespace writer
static const wchar_t colon = L':';
static const wchar_t amp = L'&';
static const wchar_t apos = L'\'';
static const wchar_t * cdata_open() { return L"<![CDATA["; }
static const wchar_t a = L'\x0a';
static const wchar_t * cdata_open() { return L"<![CDATA["; }
static const wchar_t * cdata_close() { return L"]]>"; }
static const wchar_t * amp_str(){ return L"&amp;"; }
static const wchar_t * left_brocket_str() { return L"&lt;"; }
static const wchar_t * right_brocket_str() { return L"&gt;"; }
static const wchar_t * apos_str() { return L"&apos;"; }
static const wchar_t * quote_str() { return L"&quot;"; }
};
static const wchar_t * a_str() { return L"&#10;"; }
};
template <class V>
class element;
@ -279,7 +285,9 @@ namespace writer
case chars<T>::quote:
wr_.puts(chars<T>::quote_str()); break;
default:
case chars<T>::a:
wr_.puts(chars<T>::a_str()); break;
default:
wr_.putc(*str); break;
}
}

View File

@ -513,7 +513,23 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
}
return L"#REF";
}
const std::wstring name2sheet_name(std::wstring name, const std::wstring prefix)
{
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
static boost::wregex test_sheet_name(L"[\\s)(\\!\\'&:-]+"); //.??? 6442946.xls
std::wstring sheet_first = prefix + name;
if(!boost::regex_search(sheet_first.begin(), sheet_first.end(), correct_sheet_name))
{
if(boost::regex_search(sheet_first.begin(), sheet_first.end(), test_sheet_name))
{
sheet_first = boost::algorithm::replace_all_copy(sheet_first, L"'", L"''");
sheet_first = std::wstring(L"'") + sheet_first + std::wstring(L"'");
}
}
return sheet_first;
}
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix)
{
if(-1 == tabFirst)
@ -521,7 +537,7 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
return L"#REF";
}
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
static boost::wregex test_sheet_name(L"[\\s)(\\'&:-]+"); //.??? 6442946.xls
static boost::wregex test_sheet_name(L"[\\s)(\\!\\'&:-]+"); //.??? 6442946.xls
std::wstring sheet_first = prefix + tab2sheet_name(tabFirst, names);
@ -538,7 +554,7 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
std::wstring sheet_last;
if (tabLast != tabFirst)
{
sheet_last = prefix + tab2sheet_name(tabLast, names);
sheet_last = std::wstring(L":") + prefix + tab2sheet_name(tabLast, names);
if(!boost::regex_search(sheet_last.begin(), sheet_last.end(), correct_sheet_name))
{
@ -548,7 +564,6 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
sheet_last = std::wstring(L"\'") + sheet_last + std::wstring(L"\'");
}
}
sheet_last = std::wstring(L":") + sheet_last;
}
return sheet_first + sheet_last;

View File

@ -95,6 +95,7 @@ namespace STR
namespace XMLSTUFF
{;
const std::wstring name2sheet_name(std::wstring name, const std::wstring prefix);
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix = L"");
}

View File

@ -73,6 +73,47 @@ void CFStream::read(void* buf, const size_t size)
return;// EndOfStreamReached
}
}
void CFStream::copy( std::wstring streamNameCreate, POLE::Storage * storageOut)
{
stream_->seek(0);
int size_stream = stream_->size();
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamNameCreate, true, size_stream);
if (!streamNew) return;
unsigned char buffer[4096];
int bytesRead = 0;
while(true)
{
int bytesToRead = size_stream - bytesRead;
if (bytesToRead <= 0)
break;
if (bytesToRead > 4096)
bytesToRead = 4096;
stream_->read(buffer, bytesToRead);
streamNew->write(buffer, bytesToRead);
bytesRead += bytesToRead;
}
//unsigned char* data_stream = new unsigned char[size_stream + 64];
//memset(data_stream, 0, size_stream + 64);
//if (data_stream)
//{
// stream->read(data_stream, size_stream);
// streamNew->write(data_stream, size_stream);
// delete []data_stream;
// data_stream = NULL;
//}
streamNew->flush();
delete streamNew;
}
// Write 'size' unsigned chars to the stream

View File

@ -46,6 +46,8 @@ class CFStream
public:
CFStream(POLE::Stream* stream);
~CFStream();
void copy( std::wstring streamNameCreate, POLE::Storage * storageOut);
template<class Type>
CFStream& operator>>(Type& val) // Read a simple type or an object (not array)

View File

@ -49,6 +49,7 @@ global_info_(global_info)
skippable_records_names.push_back("StartBlock");
skippable_records_names.push_back("EndBlock");
skippable_records_names.push_back("ChartFrtInfo");
skippable_records_names.push_back("FrtWrapper");
}
@ -100,7 +101,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
}
if(skippable_records_names.end() != std::find(skippable_records_names.begin(), skippable_records_names.end(), rec_name))
{
Log::warning("The extracted record has been skipped (" + rec_name + ")");
//Log::warning("The extracted record has been skipped (" + rec_name + ")");
records_cache.pop_front();
continue;
}

View File

@ -103,7 +103,7 @@ void CompoundFile::copy_stream(std::wstring streamNameOpen, std::wstring streamN
if (!stream) return;
stream->seek(0);
int size_stream = stream->size();
POLE::uint64 size_stream = stream->size();
if (bWithRoot == false)
{

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