Compare commits

...

81 Commits

Author SHA1 Message Date
310cff0dfe change non-defined temp directory to unique 2017-12-23 14:48:44 +03:00
7f6611ab21 .. 2017-12-23 14:35:52 +03:00
bb37e348f5 . 2017-12-23 13:26:11 +03:00
6b5e03df5e . 2017-12-23 12:29:40 +03:00
d0e0109560 . 2017-12-22 15:10:45 +03:00
dc33f7f197 fix WriteAutoFilter error 2017-12-21 19:06:21 +03:00
85f4aa5679 fix error in sheetViews toXML 2017-12-21 17:28:55 +03:00
d2c5ea026f OOXML - fix ole object read 2017-12-21 13:52:17 +03:00
419ec7ed33 x2t version up 2017-12-20 19:17:15 +03:00
5f7d9eea02 x2t - optimization read ooxml files 2017-12-20 18:33:35 +03:00
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
436 changed files with 19296 additions and 5357 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

@ -34,6 +34,7 @@
#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
{

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

@ -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

@ -159,30 +159,32 @@ namespace DocFileFormat
OOX::CDocument docEmbedded(path, path);
bool res = false;
for (size_t i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); it++)
{
if (docEmbedded.m_arrItems[i]->getType() == OOX::et_w_p)
if ((*it)->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(docEmbedded.m_arrItems[i]);
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(*it);
for (size_t j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
for (std::list<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
(paragraph) && (jt != paragraph->m_arrItems.end()); jt++)
{
if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMath)
if ((*jt)->getType() == OOX::et_m_oMath)
{
res = true;
newXmlString = paragraph->m_arrItems[j]->toXML();
newXmlString = (*jt)->toXML();
break;
}
else if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMathPara)
else if ((*jt)->getType() == OOX::et_m_oMathPara)
{
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(paragraph->m_arrItems[j]);
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(*jt);
for (size_t k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
for (std::list<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
(mathPara) && (kt != mathPara->m_arrItems.end()); kt++)
{
if (mathPara->m_arrItems[k]->getType() == OOX::et_m_oMath)
if ((*kt)->getType() == OOX::et_m_oMath)
{
res = true;
newXmlString = mathPara->m_arrItems[k]->toXML();
newXmlString = (*kt)->toXML();
break;
}
}

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,36 +47,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
#pragma comment(lib, "Rpcrt4.lib")
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

@ -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

@ -618,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();

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

File diff suppressed because it is too large Load Diff

View File

@ -182,12 +182,12 @@ namespace BinXlsxRW{
}
OOX::Spreadsheet::CSi* pSi = new OOX::Spreadsheet::CSi();
pSi->m_arrItems.push_back(pText);
pSharedStrings->m_arrItems.push_back(pSi);
pSharedStrings->AddSi(pSi);
}
pSharedStrings->m_oCount.Init();
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_arrItems.size());
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_nCount);
pSharedStrings->m_oUniqueCount.Init();
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_arrItems.size());
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_nCount);
//Styles
OOX::Spreadsheet::CStyles* pStyles = oXlsx.CreateStyles();
pStyles->m_oCellXfs.Init();

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,8 +47,9 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\OdfFileWriterTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -66,7 +67,7 @@
Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBCMTD.lib"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@ -450,6 +451,14 @@
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>

View File

@ -1478,6 +1478,13 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
impl_->current_level_.back().chart_properties_->content_.chart_pie_offset_ = val;
}
void odf_chart_context::set_series_pie_bubble(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content_.chart_pie_bubble_ = val;
}
//void odf_chart_context::set_cash(std::wstring format, std::vector<double> &data_double)
//{
// if (data_double.size() <1 || impl_->data_cell_ranges_.size() < 1) return;

View File

@ -89,6 +89,7 @@ public:
long get_count_data_points_series();
void set_series_pie_explosion(int val);
void set_series_pie_bubble(bool val);
void end_series();
void end_group_series();

View File

@ -100,6 +100,7 @@ public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
default_column_width = -1;
optimal_column_width = false;
}
odf_table_state & current_table() {return tables_.back();}
@ -107,13 +108,21 @@ public:
void start_table(odf_table_state & state) {tables_.push_back(state);}
void end_table() {if (tables_.size() > 0) tables_.pop_back(); default_column_width = -1; default_cell_properties = L"";}
void end_table()
{
if (tables_.size() > 0) tables_.pop_back();
default_column_width = -1; // todo .. in level ???
default_cell_properties = L"";
optimal_column_width = false;
}
odf_style_context * styles_context() {return odf_context_->styles_context();}
odf_conversion_context *odf_context_;
double default_column_width;
double default_column_width;
bool optimal_column_width;
std::wstring default_cell_properties; // для предустановки ..
private:
@ -307,6 +316,10 @@ void odf_table_context::set_default_column_width(double width)
{
impl_->default_column_width = width;
}
void odf_table_context::set_optimal_column_width(bool val)
{
impl_->optimal_column_width = val;
}
void odf_table_context::set_column_optimal(bool val)
{
if (impl_->empty()) return;
@ -362,7 +375,11 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
if (impl_->optimal_column_width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
}
impl_->current_table().table_width += width;
}
@ -370,7 +387,7 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
if (impl_->default_column_width >=0)
if (impl_->default_column_width >= 0)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);

View File

@ -66,6 +66,7 @@ public:
void start_table(office_element_ptr &elm, bool styled = false);
void set_default_column_width(double width);
void set_optimal_column_width(bool val);
void change_current_column_width(double width);
void end_table();

View File

@ -95,6 +95,7 @@ public:
_CP_OPT(int) chart_spline_order_;
_CP_OPT(int) chart_spline_resolution_;
_CP_OPT(int) chart_pie_offset_;
_CP_OPT(bool) chart_pie_bubble_;
_CP_OPT(int) chart_interval_minor_divisor_;
_CP_OPT(double) chart_maximum_;

View File

@ -565,9 +565,9 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); it++)
{
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
docx_converter->convert(*it);
convert(oox_shape->oTextBoxBodyPr.GetPointer());

View File

@ -70,9 +70,9 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
}
//m_oPreferRelative//типо можно менять размер
for (size_t i = 0; i < vml_shape_type->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = vml_shape_type->m_arrItems.begin(); it != vml_shape_type->m_arrItems.end(); it++)
{
convert(vml_shape_type->m_arrItems[i]);
convert(*it);
}
if (vml_shape_type->m_sAdj.IsInit())//настройка дл фигуры заданной формулами
@ -90,9 +90,9 @@ void OoxConverter::convert(OOX::Vml::CFormulas *vml_formulas)
{
if (vml_formulas == NULL) return;
for (size_t i = 0; i < vml_formulas->m_arrItems.size(); i++)
for (std::list<OOX::Vml::CF*>::iterator it = vml_formulas->m_arrItems.begin(); it != vml_formulas->m_arrItems.end(); it++)
{
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(vml_formulas->m_arrItems[i]);
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(*it);
if (cf == NULL) continue;
//odf_context()->drawing_context()->add_formula(L"", cf->m_sEqn);
@ -717,9 +717,9 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
{
odf_context()->start_text_context();
{
for (size_t i = 0; i < vml_textbox->m_oTxtbxContent->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = vml_textbox->m_oTxtbxContent->m_arrItems.begin(); it != vml_textbox->m_oTxtbxContent->m_arrItems.end(); it++)
{
docx_converter->convert(vml_textbox->m_oTxtbxContent->m_arrItems[i]);
docx_converter->convert(*it);
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
}
@ -890,9 +890,9 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
delete oRgbColor;
}
}
for (size_t i = 0; i < vml_common->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = vml_common->m_arrItems.begin(); it != vml_common->m_arrItems.end(); it++)
{
convert(vml_common->m_arrItems[i]);
convert(*it);
}
if (vml_common->m_oFilled.IsInit() && vml_common->m_oFilled->GetValue() == SimpleTypes::booleanFalse)
@ -920,27 +920,27 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
odf_context()->drawing_context()->set_group_shift(vml_group->m_oCoordOrigin->GetX(), vml_group->m_oCoordOrigin->GetY());
}
for (size_t i = 0; i < vml_group->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = vml_group->m_arrItems.begin(); it != vml_group->m_arrItems.end(); it++)
{
if (vml_group->m_arrItems[i] == NULL) continue;
if (*it == NULL) continue;
if (vml_group->m_arrItems[i]->getType() == OOX::et_v_group)
if ((*it)->getType() == OOX::et_v_group)
{
OOX::Vml::CGroup * vml = dynamic_cast<OOX::Vml::CGroup*>(vml_group->m_arrItems[i]);
OOX::Vml::CGroup * vml = dynamic_cast<OOX::Vml::CGroup*>(*it);
convert(vml);
continue;
}
OOX::Vml::CVmlCommonElements * vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements*>(vml_group->m_arrItems[i]);
OOX::Vml::CVmlCommonElements * vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements*>(*it);
if (vml_common == NULL) continue; // не элемент
odf_context()->drawing_context()->start_drawing();
switch(vml_group->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_v_shape:
{
OOX::Vml::CShape * vml = dynamic_cast<OOX::Vml::CShape*>(vml_group->m_arrItems[i]);
OOX::Vml::CShape * vml = dynamic_cast<OOX::Vml::CShape*>(*it);
bool bSet = false;
if (vml)
{
@ -973,7 +973,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
}break;
case OOX::et_v_shapetype:
{
OOX::Vml::CShapeType * vml = dynamic_cast<OOX::Vml::CShapeType*>(vml_group->m_arrItems[i]);
OOX::Vml::CShapeType * vml = dynamic_cast<OOX::Vml::CShapeType*>(*it);
SimpleTypes::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive;
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
@ -982,34 +982,34 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
}break;
case OOX::et_v_oval:
{
OOX::Vml::COval * vml = dynamic_cast<OOX::Vml::COval*>(vml_group->m_arrItems[i]);
OOX::Vml::COval * vml = dynamic_cast<OOX::Vml::COval*>(*it);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeEllipse);
OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape();
}break;
case OOX::et_v_rect:
{
OOX::Vml::CRect * vml = dynamic_cast<OOX::Vml::CRect*>(vml_group->m_arrItems[i]);
OOX::Vml::CRect * vml = dynamic_cast<OOX::Vml::CRect*>(*it);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape();
}break;
case OOX::et_v_line:
{
OOX::Vml::CLine * vml = dynamic_cast<OOX::Vml::CLine*>(vml_group->m_arrItems[i]);
OOX::Vml::CLine * vml = dynamic_cast<OOX::Vml::CLine*>(*it);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine);
OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape();
}break;
case OOX::et_v_curve:
{
OOX::Vml::CCurve * vml = dynamic_cast<OOX::Vml::CCurve*>(vml_group->m_arrItems[i]);
OOX::Vml::CCurve * vml = dynamic_cast<OOX::Vml::CCurve*>(*it);
odf_context()->drawing_context()->start_shape(1000);
OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape();
}break;
default:
convert(vml_group->m_arrItems[i]);
convert(*it);
}
odf_context()->drawing_context()->end_drawing();
}

View File

@ -971,6 +971,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, std::vector<OOX:
convert(dPt[i]->m_marker);
if (dPt[i]->m_explosion && dPt[i]->m_explosion->m_val)
odf_context()->chart_context()->set_series_pie_explosion(*dPt[i]->m_explosion->m_val);
if (dPt[i]->m_bubble3D && dPt[i]->m_bubble3D->m_val)
odf_context()->chart_context()->set_series_pie_bubble(*dPt[i]->m_bubble3D->m_val);
odf_context()->chart_context()->end_element();
current_point = set_point+1;

View File

@ -181,28 +181,41 @@ void DocxConverter::convert_document()
std::vector<_section> sections;
//----------------------------------------------------------------------------------------------------------
int last_section_start = 0;
std::list<OOX::WritingElement*>::const_iterator last_section_start = document->m_arrItems.begin();
//считаем количесво секций и запоминаем их свойства ..
for (size_t i = 0; i < document->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::const_iterator it = document->m_arrItems.begin(); it != document->m_arrItems.end(); it++)
{
if (document->m_arrItems[i] == NULL) continue;
if ((*it) == NULL) continue;
if (document->m_arrItems[i]->getType() == OOX::et_w_p)
if ((*it)->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(document->m_arrItems[i]);
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(*it);
if ((para) && (para->m_oParagraphProperty))
{
if (para->m_oParagraphProperty->m_oSectPr.IsInit() )
{
sections.push_back(_section(para->m_oParagraphProperty->m_oSectPr.GetPointer(), last_section_start, (int)i + 1));
last_section_start = (int)i + 1;
_section section;
section.props = para->m_oParagraphProperty->m_oSectPr.GetPointer();
section.start_para = last_section_start;
section.end_para = it; section.end_para++;
sections.push_back(section);
last_section_start = it; last_section_start++;
}
}
}
}
sections.push_back(_section(document->m_oSectPr.GetPointer(), last_section_start, (int)document->m_arrItems.size(), true));
_section section;
section.props = document->m_oSectPr.GetPointer();
section.start_para = last_section_start;
section.end_para = document->m_arrItems.end();
sections.push_back(section);
//----------------------------------------------------------------------------------------------------------
odt_context->text_context()->clear_params();
@ -211,9 +224,9 @@ void DocxConverter::convert_document()
{
current_section_properties = &sections[sect];
for (long i = sections[sect].start_para; i < sections[sect].end_para; i++)
for (std::list<OOX::WritingElement*>::const_iterator it = sections[sect].start_para; it != sections[sect].end_para; it++)
{
convert(document->m_arrItems[i]);
convert(*it);
}
}
}
@ -361,9 +374,9 @@ void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
{
if (oox_sdt == NULL) return;
for (size_t i = 0; i < oox_sdt->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_sdt->m_arrItems.begin(); it != oox_sdt->m_arrItems.end(); it++)
{
convert(oox_sdt->m_arrItems[i]);
convert(*it);
}
}
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
@ -519,9 +532,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{//rapcomnat12.docx - стр 185
bool empty_para = true;
for (size_t nIndex = 0; empty_para && nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
for (std::list<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); it++)
{
switch(oox_paragraph->m_arrItems[nIndex]->getType())
switch((*it)->getType())
{
case OOX::et_w_pPr: break;
default:
@ -543,17 +556,17 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
}
//---------------------------------------------------------------------------------------------------------------------
for (size_t nIndex = 0; nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
for (std::list<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); it++)
{
//те элементы которые тока для Paragraph - здесь - остальные в общей куче
switch(oox_paragraph->m_arrItems[nIndex]->getType())
switch((*it)->getType())
{
case OOX::et_w_pPr:
{
// пропускаем ..
}break;
default:
convert(oox_paragraph->m_arrItems[nIndex]);
convert(*it);
break;
}
}
@ -583,7 +596,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
////test for break - 2 first element ЭТОТ элемент НУЖНО вытащить отдельно !!!
//for(size_t i = 0; i < (std::min) ( (size_t)2, oox_run->m_arrItems.size()); ++i)
//{
// if (oox_run->m_arrItems[i]->getType() == OOX::et_w_lastRenderedPageBreak)
// if (*it->getType() == OOX::et_w_lastRenderedPageBreak)
// {
// odt_context->add_page_break();
// }
@ -605,24 +618,24 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
odt_context->start_run(styled);
for(size_t i = 0; i < oox_run->m_arrItems.size(); ++i)
for (std::list<OOX::WritingElement*>::iterator it = oox_run->m_arrItems.begin(); it != oox_run->m_arrItems.end(); it++)
{
//те элементы которые тока для Run - здесь - остальные в общей куче
switch(oox_run->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_w_fldChar:
{
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(oox_run->m_arrItems[i]);
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(*it);
convert(pFldChar);
}break;
case OOX::et_w_instrText:
{
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(oox_run->m_arrItems[i]);
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(*it);
convert(pInstrText);
}break;
case OOX::et_w_delText:
{
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(oox_run->m_arrItems[i]);
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(*it);
convert(pDelText);
}break;
case OOX::et_w_rPr: // пропускаем ..
@ -633,7 +646,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
}break;
case OOX::et_w_br:
{
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(oox_run->m_arrItems[i]);
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(*it);
if (pBr)
{
int type = pBr->m_oType.GetValue();
@ -646,17 +659,17 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
}break;
case OOX::et_w_t:
{
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(oox_run->m_arrItems[i]);
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(*it);
convert(pText);
}break;
case OOX::et_w_sym:
{
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(oox_run->m_arrItems[i]);
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(*it);
convert(pSym);
}break;
case OOX::et_w_tab:
{
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(oox_run->m_arrItems[i]);
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(*it);
odt_context->text_context()->add_tab();
}break;
@ -673,7 +686,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
//softHyphen
//delInstrText
default:
convert(oox_run->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_run();
@ -775,9 +788,9 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
if (oox_fld->m_sInstr.IsInit())
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
for (size_t i=0; i< oox_fld->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_fld->m_arrItems.begin(); it != oox_fld->m_arrItems.end(); it++)
{
convert(oox_fld->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_field();
@ -812,9 +825,9 @@ void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
bool start_change = odt_context->start_change(id, 1, author, userId, date);
for (size_t i=0; i< oox_ins->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_ins->m_arrItems.begin(); it != oox_ins->m_arrItems.end(); it++)
{
convert(oox_ins->m_arrItems[i]);
convert(*it);
}
if (start_change)
@ -1016,9 +1029,10 @@ void DocxConverter::convert(OOX::Logic::CDel *oox_del)
std::wstring date = oox_del->m_oDate.IsInit() ? oox_del->m_oDate->GetValue() : L"";
bool res_change = odt_context->start_change(id, 2, author, userId, date);
for (size_t i=0; i< oox_del->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_del->m_arrItems.begin(); it != oox_del->m_arrItems.end(); it++)
{
convert(oox_del->m_arrItems[i]);
convert(*it);
}
if (res_change)
odt_context->end_change(id, 2);
@ -1027,9 +1041,9 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag)
{
if (oox_tag == NULL) return;
for (size_t i=0; i< oox_tag->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_tag->m_arrItems.begin(); it != oox_tag->m_arrItems.end(); it++)
{
convert(oox_tag->m_arrItems[i]);
convert(*it);
}
}
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties)
@ -2900,18 +2914,18 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
odt_context->start_hyperlink(ref);
for (size_t i=0; i< oox_hyperlink->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); it++)
{
convert(oox_hyperlink->m_arrItems[i]);
convert(*it);
}
odt_context->end_hyperlink();
}
else
{//ссылка внутри дока
//anchor todooo
for (size_t i=0; i< oox_hyperlink->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); it++)
{
convert(oox_hyperlink->m_arrItems[i]);
convert(*it);
}
}
//nullable<std::wstring > m_sAnchor;
@ -3464,9 +3478,9 @@ void DocxConverter::convert_comment(int oox_comm_id)
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
for (size_t i = 0; i <oox_comment->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); it++)
{
convert(oox_comment->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_comment_content();
@ -3491,9 +3505,9 @@ void DocxConverter::convert_footnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (size_t i = 0; i < oox_note->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); it++)
{
convert(oox_note->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_note_content();
@ -3519,9 +3533,9 @@ void DocxConverter::convert_endnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (size_t i = 0; i < oox_note->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); it++)
{
convert(oox_note->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_note_content();
@ -3536,9 +3550,9 @@ void DocxConverter::convert_hdr_ftr (std::wstring sId)
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
for ( size_t nIndex = 0; nIndex < oox_hdr_ftr->m_arrItems.size(); nIndex++ )
for (std::list<OOX::WritingElement*>::iterator it = oox_hdr_ftr->m_arrItems.begin(); it != oox_hdr_ftr->m_arrItems.end(); it++)
{
convert(oox_hdr_ftr->m_arrItems[nIndex]);
convert(*it);
}
oox_current_child_document = NULL;
}
@ -3715,16 +3729,16 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
convert(oox_table->m_oTblGrid.GetPointer());
//------ строки
for (size_t i =0 ; i < oox_table->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_table->m_arrItems.begin(); it != oox_table->m_arrItems.end(); it++)
{
switch(oox_table->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_w_tblPr:
{
//skip
}break;
default:
convert(oox_table->m_arrItems[i]);
convert(*it);
}
}
if (in_frame)
@ -3809,38 +3823,38 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
{
if (oox_table_row == NULL) return;
bool styled = oox_table_row->m_oTableRowProperties ? true : false;
bool styled = oox_table_row->m_pTableRowProperties ? true : false;
bool is_header = false;
int id_insert_row = -1;
int id_delete_row = -1;
if (oox_table_row->m_oTableRowProperties)
if (oox_table_row->m_pTableRowProperties)
{//+ Format ???
//id_insert_row = convert(oox_table_row->m_oTableRowProperties->m_oIns.GetPointer(), 1);
//id_delete_row = convert(oox_table_row->m_oTableRowProperties->m_oDel.GetPointer(), 2);
//id_insert_row = convert(oox_table_row->m_pTableRowProperties->m_oIns.GetPointer(), 1);
//id_delete_row = convert(oox_table_row->m_pTableRowProperties->m_oDel.GetPointer(), 2);
//??? как в электороных таблицах? или ваще нету?
}
if (styled && oox_table_row->m_oTableRowProperties->m_oTblHeader.IsInit()
&& oox_table_row->m_oTableRowProperties->m_oTblHeader->m_oVal.ToBool() )is_header = true;
if (styled && oox_table_row->m_pTableRowProperties->m_oTblHeader.IsInit()
&& oox_table_row->m_pTableRowProperties->m_oTblHeader->m_oVal.ToBool() )is_header = true;
if (is_header)odt_context->start_table_header_rows();
odt_context->start_table_row(styled);
convert(oox_table_row->m_oTableRowProperties);
convert(oox_table_row->m_pTableRowProperties);
for (size_t i =0 ; i < oox_table_row->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_table_row->m_arrItems.begin(); it != oox_table_row->m_arrItems.end(); it++)
{
switch(oox_table_row->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_w_trPr:
{
//skip
}break;
default:
convert(oox_table_row->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_table_row();
@ -3860,47 +3874,47 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
bool covered = false;
int id_change_properties = -1;
if (oox_table_cell->m_oTableCellProperties)
if (oox_table_cell->m_pTableCellProperties)
{
//id_change_properties = convert(oox_table_cell->m_oTableCellProperties->m_oCellIns.GetPointer()); ??
//id_change_properties = convert(oox_table_cell->m_oTableCellProperties->m_oCellDel.GetPointer()); ??
//id_change_properties = convert(oox_table_cell->m_oTableCellProperties->m_oTcPrChange.GetPointer());
//id_change_properties = convert(oox_table_cell->m_pTableCellProperties->m_oCellIns.GetPointer()); ??
//id_change_properties = convert(oox_table_cell->m_pTableCellProperties->m_oCellDel.GetPointer()); ??
//id_change_properties = convert(oox_table_cell->m_pTableCellProperties->m_oTcPrChange.GetPointer());
//??? как в электороных таблицах? или ваще нету?
if (oox_table_cell->m_oTableCellProperties->m_oVMerge.IsInit())
if (oox_table_cell->m_pTableCellProperties->m_oVMerge.IsInit())
{
if (!(oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal.IsInit() &&
oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
if (!(oox_table_cell->m_pTableCellProperties->m_oVMerge->m_oVal.IsInit() &&
oox_table_cell->m_pTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
covered = true;
}
}
odt_context->start_table_cell( oox_table_cell->m_nNumCol, covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol + 1));
odt_context->start_table_cell( oox_table_cell->m_nNumCol, covered, convert(oox_table_cell->m_pTableCellProperties, oox_table_cell->m_nNumCol + 1));
if (oox_table_cell->m_oTableCellProperties)
if (oox_table_cell->m_pTableCellProperties)
{
if (oox_table_cell->m_oTableCellProperties->m_oVMerge.IsInit())
if (oox_table_cell->m_pTableCellProperties->m_oVMerge.IsInit())
{
if (oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal.IsInit() &&
oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart)
if (oox_table_cell->m_pTableCellProperties->m_oVMerge->m_oVal.IsInit() &&
oox_table_cell->m_pTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart)
odt_context->table_context()->set_cell_row_span_restart();
else
odt_context->table_context()->set_cell_row_span();
}
if (oox_table_cell->m_oTableCellProperties->m_oGridSpan.IsInit() && oox_table_cell->m_oTableCellProperties->m_oGridSpan->m_oVal.IsInit())
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_oTableCellProperties->m_oGridSpan->m_oVal->GetValue());
if (oox_table_cell->m_pTableCellProperties->m_oGridSpan.IsInit() && oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal.IsInit())
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal->GetValue());
}
for (size_t i =0 ; i < oox_table_cell->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = oox_table_cell->m_arrItems.begin(); it != oox_table_cell->m_arrItems.end(); it++)
{
switch(oox_table_cell->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_w_tcPr:
{
//skip
}break;
default:
convert(oox_table_cell->m_arrItems[i]);
convert(*it);
}
}
odt_context->end_table_cell();
@ -3913,13 +3927,22 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
if (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false;
if (oox_table_pr->m_oTblW.IsInit())
if (oox_table_pr->m_oTblW.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if ((oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa) &&
(oox_table_pr->m_oTblW->m_oW.IsInit() && oox_table_pr->m_oTblW->m_oW->GetValue() >0))
if (oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if (oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue()/20.);
if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa &&
oox_table_pr->m_oTblW->m_oW->GetValue() > 0 )
{
if ( oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue() / 20.);
}
else if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthAuto &&
oox_table_pr->m_oTblW->m_oW->GetValue() == 0 )
{
//динамическое расширение - автоподбор по содержимому.
odt_context->table_context()->set_optimal_column_width(true);
}
}
}
@ -4020,7 +4043,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_
{//напрямую задать cell_prop на саму таблицу низя - тока как default-cell-style-name на columns & row
//общие свойства ячеек
odt_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->create_style(L"", odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->last_state()->set_dont_write(true);
odf_writer::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->last_state()->get_table_cell_properties();

View File

@ -158,13 +158,9 @@ namespace Oox2Odf
private:
struct _section
{
_section() : start_para(0), end_para(-1), props(NULL), root(false) {}
_section(OOX::Logic::CSectionProperty *s, int start = 0, int end = -1, bool r = false) : props(s), start_para(start), end_para(end), root(r) {}
OOX::Logic::CSectionProperty *props;
int start_para;
int end_para;
OOX::Logic::CSectionProperty *props;
std::list<OOX::WritingElement*>::const_iterator start_para;
std::list<OOX::WritingElement*>::const_iterator end_para;
bool root;
} *current_section_properties;

View File

@ -166,16 +166,18 @@ void XlsxConverter::convert_sheets()
if(Workbook->m_oBookViews.IsInit())
{
for (size_t i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CWorkbookView*>::iterator it = Workbook->m_oBookViews->m_arrItems.begin();
it != Workbook->m_oBookViews->m_arrItems.end(); it++)
{
convert(Workbook->m_oBookViews->m_arrItems[i]);
convert(*it);
}
}
if(Workbook->m_oSheets.IsInit())
{
for(size_t i = 0, length = Workbook->m_oSheets->m_arrItems.size(); i < length; ++i)
for (std::list<OOX::Spreadsheet::CSheet*>::iterator it = Workbook->m_oSheets->m_arrItems.begin();
it != Workbook->m_oSheets->m_arrItems.end(); it++)
{
OOX::Spreadsheet::CSheet* pSheet = Workbook->m_oSheets->m_arrItems[i];
OOX::Spreadsheet::CSheet* pSheet = *it;
if(pSheet->m_oRid.IsInit())
{
@ -198,9 +200,10 @@ void XlsxConverter::convert_sheets()
}
if (Workbook->m_oDefinedNames.IsInit())
{
for (size_t i = 0; i < Workbook->m_oDefinedNames->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CDefinedName*>::iterator it = Workbook->m_oDefinedNames->m_arrItems.begin();
it != Workbook->m_oDefinedNames->m_arrItems.end(); it++)
{
convert(Workbook->m_oDefinedNames->m_arrItems[i]);
convert(*it);
}
}
}
@ -244,10 +247,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oSheetPr.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Предобработка
//гиперлинки
for (size_t hyp = 0; oox_sheet->m_oHyperlinks.IsInit() && hyp < oox_sheet->m_oHyperlinks->m_arrItems.size(); hyp++)
for (std::list<OOX::Spreadsheet::CHyperlink*>::iterator it = oox_sheet->m_oHyperlinks->m_arrItems.begin();
it != oox_sheet->m_oHyperlinks->m_arrItems.end(); it++)
{
convert(oox_sheet->m_oHyperlinks->m_arrItems[hyp],oox_sheet);
convert(*it, oox_sheet);
}
//комментарии
std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::iterator pos = oox_sheet->m_mapComments.begin();
@ -260,33 +263,37 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//колонки
ods_context->start_columns();
for (size_t col = 0 ; oox_sheet->m_oCols.IsInit() && col < oox_sheet->m_oCols->m_arrItems.size(); col++)
for (std::list<OOX::Spreadsheet::CCol*>::iterator it = oox_sheet->m_oCols->m_arrItems.begin();
it != oox_sheet->m_oCols->m_arrItems.end(); it++)
{
convert(oox_sheet->m_oCols->m_arrItems[col]);
convert(*it);
}
ods_context->end_columns();
//строки
if (oox_sheet->m_oSheetData.IsInit() )
{
ods_context->start_rows();
for (size_t row = 0 ; row < oox_sheet->m_oSheetData->m_arrItems.size(); row++)
for (std::list<OOX::Spreadsheet::CRow*>::iterator it = oox_sheet->m_oSheetData->m_arrItems.begin();
it != oox_sheet->m_oSheetData->m_arrItems.end(); it++)
{
convert(oox_sheet->m_oSheetData->m_arrItems[row]);
convert(*it);
if ( oox_sheet->m_oSheetData->m_arrItems[row] )
delete oox_sheet->m_oSheetData->m_arrItems[row];
oox_sheet->m_oSheetData->m_arrItems[row] = NULL;
//оптимизация памяти - удаляем уже не нужное
if ( *it ) delete *it;
*it = NULL;
}
ods_context->end_rows();
oox_sheet->m_oSheetData.reset();
}
//мержи
for (size_t mrg = 0 ; oox_sheet->m_oMergeCells.IsInit() && mrg < oox_sheet->m_oMergeCells->m_arrItems.size(); mrg++)
for (std::list<OOX::Spreadsheet::CMergeCell*>::iterator it = oox_sheet->m_oMergeCells->m_arrItems.begin();
it != oox_sheet->m_oMergeCells->m_arrItems.end(); it++)
{
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
ods_context->add_merge_cells(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get());
if ((*it) && ((*it)->m_oRef.IsInit()))
{
ods_context->add_merge_cells((*it)->m_oRef.get());
}
}
if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit())
{
@ -320,9 +327,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
//выносные части таблицы
if (oox_sheet->m_oTableParts.IsInit())
{
for (size_t i=0 ; i < oox_sheet->m_oTableParts->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CTablePart*>::iterator it = oox_sheet->m_oTableParts->m_arrItems.begin();
it != oox_sheet->m_oTableParts->m_arrItems.end(); it++)
{
OOX::Spreadsheet::CTablePart *oox_table_part = oox_sheet->m_oTableParts->m_arrItems[i];
OOX::Spreadsheet::CTablePart *oox_table_part = *it;
if (!oox_table_part)continue;
if (!oox_table_part->m_oRId.IsInit())continue;
@ -426,9 +434,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
if (oox_comment->m_oText.IsInit())
{
for(size_t i = 0; i < oox_comment->m_oText->m_arrItems.size(); ++i)
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_comment->m_oText->m_arrItems.begin();
it != oox_comment->m_oText->m_arrItems.end(); it++)
{
convert(oox_comment->m_oText->m_arrItems[i]);
convert(*it);
}
}
ods_context->end_comment();
@ -506,9 +515,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row)
}else
ods_context->current_table().set_row_optimal_height(true);
for (size_t cell = 0 ; cell < oox_row->m_arrItems.size();cell++)
for (std::list<OOX::Spreadsheet::CCell*>::iterator it = oox_row->m_arrItems.begin(); it != oox_row->m_arrItems.end(); it++)
{
convert(oox_row->m_arrItems[cell]);
convert(*it);
}
ods_context->end_row();
}
@ -567,9 +576,12 @@ void XlsxConverter::convert_sharing_string(int number)
const OOX::Spreadsheet::CSharedStrings *SharedStrings= xlsx_document->GetSharedStrings();
if (!SharedStrings) return;
if (number <0 || (SharedStrings->m_oCount.IsInit() && number > SharedStrings->m_oCount->GetValue()))return;//???? m_oUniqueCount;
std::unordered_map<int, OOX::Spreadsheet::CSi*>::const_iterator pFind = SharedStrings->m_mapItems.find(number);
convert(dynamic_cast<OOX::Spreadsheet::CSi*>(SharedStrings->m_arrItems[number]));
if (pFind != SharedStrings->m_mapItems.end())
{
convert(pFind->second);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
@ -578,9 +590,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
ods_context->start_cell_text();
for(size_t i = 0; i < oox_rtf_text->m_arrItems.size(); ++i)
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_rtf_text->m_arrItems.begin(); it != oox_rtf_text->m_arrItems.end(); it++)
{
convert(oox_rtf_text->m_arrItems[i]);
convert(*it);
}
ods_context->end_cell_text();
@ -631,9 +643,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRun *oox_text_run)
convert(oox_text_run->m_oRPr.GetPointer());
ods_context->text_context()->start_span(oox_text_run->m_oRPr.GetPointer() ? true : false);
for(size_t i = 0; i < oox_text_run->m_arrItems.size(); ++i)
for (std::list<OOX::Spreadsheet::CText*>::iterator it = oox_text_run->m_arrItems.begin(); it != oox_text_run->m_arrItems.end(); it++)
{
convert(oox_text_run->m_arrItems[i]);
convert(*it);
}
ods_context->text_context()->end_span();
}
@ -871,16 +883,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorkbookView *oox_book_views)
if (oox_book_views->m_oActiveTab.IsInit())
{
int table_id = oox_book_views->m_oActiveTab->GetValue();
int table_id = oox_book_views->m_oActiveTab->GetValue();
if (table_id >=0 && table_id < Workbook->m_oSheets->m_arrItems.size())
std::map<int, OOX::Spreadsheet::CSheet*>::iterator pFind = Workbook->m_oSheets->mapSheets.find(table_id);
if (pFind != Workbook->m_oSheets->mapSheets.end())
{
OOX::Spreadsheet::CSheet* pSheet = Workbook->m_oSheets->m_arrItems[table_id];
if (pSheet)
{
ods_context->settings_context()->add_property(L"ActiveTable", L"string", pSheet->m_oName.get2());
}
ods_context->settings_context()->add_property(L"ActiveTable", L"string", pFind->second->m_oName.get2());
}
}
if (oox_book_views->m_oShowSheetTabs.IsInit())
@ -915,9 +924,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
if (!oox_sheet_views)return;
for (unsigned long i =0; i < oox_sheet_views->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CSheetView*>::iterator it = oox_sheet_views->m_arrItems.begin(); it != oox_sheet_views->m_arrItems.end(); it++)
{
OOX::Spreadsheet::CSheetView *sheet_view = oox_sheet_views->m_arrItems[i];
OOX::Spreadsheet::CSheetView *sheet_view = *it;
if (!sheet_view) continue;
int view_id = sheet_view->m_oWorkbookViewId->GetValue();
@ -959,9 +968,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
bool bPaneY = false;
int ActiveCellX = -1, ActiveCellY = -1;
for (size_t j = 0; j < sheet_view->m_arrItems.size(); j++)
for (std::list<OOX::Spreadsheet::CSelection*>::iterator it = sheet_view->m_arrItems.begin();
it != sheet_view->m_arrItems.end(); it++)
{
OOX::Spreadsheet::CSelection *selection = sheet_view->m_arrItems[j];
OOX::Spreadsheet::CSelection *selection = *it;
if (selection->m_oActiveCell.IsInit())
{
@ -1201,35 +1211,42 @@ void XlsxConverter::convert_styles()
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
if (!xlsx_styles)return;
int i = 0;
//todooo ?? стоит ли обращать на параметр Count ??
////////////форматы данных
for (size_t i = 0; xlsx_styles->m_oNumFmts.IsInit() && i < xlsx_styles->m_oNumFmts->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CNumFmt*>::iterator it = xlsx_styles->m_oNumFmts->m_arrItems.begin();
xlsx_styles->m_oNumFmts.IsInit() && it != xlsx_styles->m_oNumFmts->m_arrItems.end(); it++)
{
convert(xlsx_styles->m_oNumFmts->m_arrItems[i]);
convert(*it);
}
/////////////стили ячеек
for (size_t i = 0; xlsx_styles->m_oCellStyleXfs.IsInit() && i < xlsx_styles->m_oCellStyleXfs->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CXfs*>::iterator it = xlsx_styles->m_oCellStyleXfs->m_arrItems.begin();
xlsx_styles->m_oCellStyleXfs.IsInit() && it != xlsx_styles->m_oCellStyleXfs->m_arrItems.end(); it++)
{
//automatical, root - noname - они тока для named
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i, true, true);
convert(*it , i++, true, true);
}
for (size_t i = 0; xlsx_styles->m_oCellStyles.IsInit() && i < xlsx_styles->m_oCellStyles->m_arrItems.size(); i++)//styles.xml
for (std::list<OOX::Spreadsheet::CCellStyle*>::iterator it = xlsx_styles->m_oCellStyles->m_arrItems.begin();
xlsx_styles->m_oCellStyles.IsInit() && it != xlsx_styles->m_oCellStyles->m_arrItems.end(); it++)
{
//non automatical, root - named
convert(xlsx_styles->m_oCellStyles->m_arrItems[i]);
convert(*it);
}
i = 0;
//кастомные стили ячеек
for (size_t i = 0; xlsx_styles->m_oCellXfs.IsInit() && i < xlsx_styles->m_oCellXfs->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CXfs*>::iterator it = xlsx_styles->m_oCellXfs->m_arrItems.begin();
xlsx_styles->m_oCellXfs.IsInit() && it != xlsx_styles->m_oCellXfs->m_arrItems.end(); it++)
{
//automatical, non root
convert(xlsx_styles->m_oCellXfs->m_arrItems[i], i, true, false);
convert(*it, i++, true, false);
}
////////////стили условного форматирования
for (size_t i=0; xlsx_styles->m_oDxfs.IsInit() && i < xlsx_styles->m_oDxfs->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::CDxf*>::iterator it = xlsx_styles->m_oDxfs->m_arrItems.begin();
xlsx_styles->m_oDxfs.IsInit() && it != xlsx_styles->m_oDxfs->m_arrItems.end(); it++)
{
convert(xlsx_styles->m_oDxfs->m_arrItems[i], i);
convert(*it, i);
}
}
@ -1626,16 +1643,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::
int ind = color->m_oIndexed->GetValue();
if(xlsx_styles->m_oColors.IsInit() && xlsx_styles->m_oColors->m_oIndexedColors.IsInit() &&
ind < xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems.size())
if(xlsx_styles->m_oColors.IsInit() && xlsx_styles->m_oColors->m_oIndexedColors.IsInit() )
{
if ((xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]) &&
(xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]->m_oRgb.IsInit()))
std::map<int, OOX::Spreadsheet::CRgbColor*>::iterator pFind = xlsx_styles->m_oColors->m_oIndexedColors->mapIndexedColors.find(ind);
if (pFind != xlsx_styles->m_oColors->m_oIndexedColors->mapIndexedColors.end());
{
ucR = xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]->m_oRgb->Get_R();
ucB = xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]->m_oRgb->Get_B();
ucG = xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]->m_oRgb->Get_G();
ucA = xlsx_styles->m_oColors->m_oIndexedColors->m_arrItems[ind]->m_oRgb->Get_A();
ucR = pFind->second->m_oRgb->Get_R();
ucB = pFind->second->m_oRgb->Get_B();
ucG = pFind->second->m_oRgb->Get_G();
ucA = pFind->second->m_oRgb->Get_A();
result = true;
}
}
@ -1760,20 +1777,32 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
if (xlsx_styles->m_oFonts.IsInit() && font_id >=0 && (id_parent < 0 || xfc_style->m_oApplyFont.IsInit()))
{
convert(xlsx_styles->m_oFonts->m_arrItems[font_id], text_properties);
std::map<int, OOX::Spreadsheet::CFont*>::iterator pFind = xlsx_styles->m_oFonts->m_mapFonts.find(font_id);
if (pFind != xlsx_styles->m_oFonts->m_mapFonts.end())
{
convert(pFind->second, text_properties);
}
}
if (xlsx_styles->m_oFills.IsInit() && fill_id >=0 && (id_parent < 0 || xfc_style->m_oApplyFill.IsInit()))
if (xlsx_styles->m_oFills.IsInit() && fill_id >= 0 && (id_parent < 0 || xfc_style->m_oApplyFill.IsInit()))
{
convert(xlsx_styles->m_oFills->m_arrItems[fill_id], table_cell_properties);
std::map<int, OOX::Spreadsheet::CFill*>::iterator pFind = xlsx_styles->m_oFills->m_mapFills.find(fill_id);
if (pFind != xlsx_styles->m_oFills->m_mapFills.end())
{
convert(pFind->second, table_cell_properties);
}
}
if (numFmt_id>=0/* && (id_parent < 0 || xfc_style->m_oApplyNumberFormat.IsInit())*/)
if (numFmt_id >= 0/* && (id_parent < 0 || xfc_style->m_oApplyNumberFormat.IsInit())*/)
{
ods_context->styles_context()->last_state()->set_data_style_name(ods_context->numbers_styles_context()->add_or_find(numFmt_id).style_name);
ods_context->styles_context()->last_state()->set_number_format(numFmt_id);
}
if (xlsx_styles->m_oBorders.IsInit() && border_id >=0 && (id_parent < 0 || xfc_style->m_oApplyBorder.IsInit()))
{
convert(xlsx_styles->m_oBorders->m_arrItems[border_id], table_cell_properties);
std::map<int, OOX::Spreadsheet::CBorder*>::iterator pFind = xlsx_styles->m_oBorders->m_mapBorders.find(border_id);
if (pFind != xlsx_styles->m_oBorders->m_mapBorders.end())
{
convert(pFind->second, table_cell_properties);
}
}
odf_writer::style_paragraph_properties * paragraph_properties = ods_context->styles_context()->last_state()->get_paragraph_properties();
@ -1982,8 +2011,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_f
{
ods_context->current_table().start_conditional_format(oox_cond_fmt->m_oSqRef.get());
for (size_t i=0; i< oox_cond_fmt->m_arrItems.size(); i++)
convert(oox_cond_fmt->m_arrItems[i]);//rule
for (std::list<OOX::Spreadsheet::CConditionalFormattingRule*>::iterator it = oox_cond_fmt->m_arrItems.begin();
it != oox_cond_fmt->m_arrItems.end(); it++)
{
convert(*it);//rule
}
ods_context->current_table().end_conditional_format();
}
@ -2005,8 +2037,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_co
if (oox_cond_rule->m_oOperator.IsInit())
ods_context->current_table().set_conditional_operator(oox_cond_rule->m_oOperator->GetValue());
for (size_t i=0; i< oox_cond_rule->m_arrItems.size(); i++)
convert(oox_cond_rule->m_arrItems[i]);
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_rule->m_arrItems.begin();
it != oox_cond_rule->m_arrItems.end(); it++)
{
convert(*it);
}
}
ods_context->current_table().end_conditional_rule();
}
@ -2022,27 +2057,32 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (size_t i=0; i< oox_cond_databar->m_arrItems.size(); i++)
convert(oox_cond_databar->m_arrItems[i]);
for (std::list<OOX::Spreadsheet::CConditionalFormatValueObject*>::iterator it = oox_cond_databar->m_arrItems.begin();
it != oox_cond_databar->m_arrItems.end(); it++)
{
convert(*it);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
{
if (!oox_cond_colorscale)return;
for (size_t i=0; i< oox_cond_colorscale->m_arrItems.size(); i++)
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
it != oox_cond_colorscale->m_arrItems.end(); it++)
{
if (!oox_cond_colorscale->m_arrItems[i])continue;
if (*it == NULL )continue;
OOX::EElementType type = oox_cond_colorscale->m_arrItems[i]->getType();
OOX::EElementType type = (*it)->getType();
if (type == OOX::et_x_ConditionalFormatValueObject)
{
convert(oox_cond_colorscale->m_arrItems[i]);
convert(*it);
}
else
{
_CP_OPT(odf_types::color) color;
convert(dynamic_cast<OOX::Spreadsheet::CColor*>(oox_cond_colorscale->m_arrItems[i]),color);
ods_context->current_table().add_conditional_colorscale(color);
convert(dynamic_cast<OOX::Spreadsheet::CColor*>(*it), color);
ods_context->current_table().add_conditional_colorscale( color );
}
}
}
@ -2055,8 +2095,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CIconSet *oox_cond_iconset)
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (size_t i=0; i< oox_cond_iconset->m_arrItems.size(); i++)
convert(oox_cond_iconset->m_arrItems[i]);
for (std::list<OOX::Spreadsheet::CConditionalFormatValueObject*>::iterator it = oox_cond_iconset->m_arrItems.begin();
it != oox_cond_iconset->m_arrItems.end(); it++)
{
convert(*it);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox_cond_value)
{

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

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

View File

@ -46,10 +46,12 @@
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
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"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\PptFileFormatTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -67,7 +69,7 @@
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMTD.lib;libcmt.lib"
IgnoreDefaultLibraryNames=""
IgnoreEmbeddedIDL="true"
GenerateDebugInformation="true"
SubSystem="1"

File diff suppressed because it is too large Load Diff

View File

@ -276,8 +276,8 @@ 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, ::CShapePtr pShape);
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);

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

@ -591,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)
{

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

@ -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

@ -637,19 +637,28 @@ 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)
{
pPair->second.bUsed = true;
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
for(size_t j = 0; (pShape) && (j < pShape->m_arrItems.size()); ++j)
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
(pShape) && (it != pShape->m_arrItems.end()); it++)
{
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[j];
OOX::WritingElement* pChildElemShape = *it;
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
@ -1203,7 +1212,7 @@ namespace PPTX
}
}
bool bRect = bOle; //ole ВСЕГДА rect
bool bRect = bOle; //ole ВСЕГДА rect или shape c типом ctPictFrame(75)
if (spPr.Geometry.is<PPTX::Logic::PrstGeom>())
{

View File

@ -30,9 +30,9 @@
*
*/
#include "MathParaWrapper.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathPara.h"
#include "../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
#include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathPara.h"
#include "../../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
#include "../../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
namespace PPTX
{

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,8 @@
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"
EnableEnhancedInstructionSet="0"
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

@ -434,14 +434,13 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
{
section.props->m_bFinalize = true;
section.props->m_oProperty = oReader.m_oCurSectionProp;
}
RtfSectionPtr oNewSection ( new RtfSection() );
_section new_section(oNewSection);
}
_section new_section;
new_section.props = RtfSectionPtr( new RtfSection() );
oDocument.AddItem( new_section );
oParagraphReaderDestination.m_oTextItems = oNewSection;
oParagraphReaderDestination.m_oTextItems = new_section.props;
//вручную обнуляем footer, т.к. sectd может встретиться и после field
///?????
@ -1027,7 +1026,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 +2291,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 +2301,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 +2346,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 +2391,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 +2461,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

@ -68,25 +68,28 @@ public:
oBackgroundReader.Parse( oParam, m_poDocument->m_pBackground);
}
int last_section_start = 0;
std::list<OOX::WritingElement*>::iterator last_section_start = m_ooxDocument->m_arrItems.begin();
//считаем количесво секций и заполняем их свойства ..
for (size_t i = 0; i < m_ooxDocument->m_arrItems.size(); i++)
{
if (m_ooxDocument->m_arrItems[i] == NULL) continue;
for (std::list<OOX::WritingElement*>::iterator it = m_ooxDocument->m_arrItems.begin(); it != m_ooxDocument->m_arrItems.end(); it++)
{
if ((*it) == NULL) continue;
if (m_ooxDocument->m_arrItems[i]->getType() == OOX::et_w_p)
if ((*it)->getType() == OOX::et_w_p)
{
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(m_ooxDocument->m_arrItems[i]);
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(*it);
if ((para) && (para->m_oParagraphProperty))
{
if (para->m_oParagraphProperty->m_oSectPr.IsInit() )
{
RtfSectionPtr s(new RtfSection());
_section section(s, last_section_start, i + 1);
_section section;
section.props = RtfSectionPtr(new RtfSection());
section.start_para = last_section_start;
section.end_para = it;
section.end_para++;
last_section_start = (int)i + 1;
last_section_start = it; last_section_start++;
section.props->m_oProperty.SetDefaultOOX();
@ -103,11 +106,13 @@ public:
_section last_section;
m_poDocument->GetItem(last_section);
if (last_section.end_para < m_ooxDocument->m_arrItems.size())
if (last_section.end_para != m_ooxDocument->m_arrItems.end())
{
RtfSectionPtr s(new RtfSection());
_section section(s, last_section.end_para, (int)m_ooxDocument->m_arrItems.size());
_section section;
section.props = RtfSectionPtr(new RtfSection());
section.start_para = last_section.end_para;
section.end_para = m_ooxDocument->m_arrItems.end();
section.props->m_oProperty.SetDefaultOOX();
if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
{
@ -126,9 +131,9 @@ public:
{
m_oTextItemReader.m_oTextItems = m_poDocument->m_aArray[sect].props;
for (long i = m_poDocument->m_aArray[sect].start_para; i < m_poDocument->m_aArray[sect].end_para; i++)
for (std::list<OOX::WritingElement*>::iterator it = m_poDocument->m_aArray[sect].start_para; it != m_poDocument->m_aArray[sect].end_para; it++)
{
m_oTextItemReader.Parse(m_ooxDocument->m_arrItems[i], oParam );
m_oTextItemReader.Parse(*it, oParam );
}
}
return true;

View File

@ -135,14 +135,14 @@ public:
int nId = ooxFtnEdn->m_oId->GetValue();
OOXTextItemReader oTextItemReader;
for (size_t i = 0 ; i < ooxFtnEdn->m_arrItems.size(); i++)
{
for (std::list<OOX::WritingElement*>::iterator it = ooxFtnEdn->m_arrItems.begin(); it != ooxFtnEdn->m_arrItems.end(); it++)
{
if( nSeparatorId == nId )
{
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
if( true == oTextItemReader.Parse( *it, oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteSep = oNewTextItem;
@ -155,7 +155,7 @@ public:
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
if( true == oTextItemReader.Parse( *it, oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteCon = oNewTextItem;
@ -168,7 +168,7 @@ public:
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
if( true == oTextItemReader.Parse( *it, oParam ) )
{
if( true == bFootnote )
oParam.oReader->m_mapFootnotes[ nId] = oNewTextItem;

View File

@ -47,9 +47,9 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, std::wstring sRID, TextItem
oOutput = TextItemContainerPtr ( new TextItemContainer() );
oOOXTextItemReader.m_oTextItems = oOutput;
for (size_t i=0; i < pHdrFtr->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = pHdrFtr->m_arrItems.begin(); it != pHdrFtr->m_arrItems.end(); it++)
{
oOOXTextItemReader.Parse(pHdrFtr->m_arrItems[i], oParam );
oOOXTextItemReader.Parse(*it, oParam );
}
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(oParam.oDocx->GetDocument());

View File

@ -57,10 +57,11 @@ public:
{
if (m_ooxElem == NULL) return false;
for (size_t i = 0; i < m_ooxElem->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = m_ooxElem->m_arrItems.begin(); it != m_ooxElem->m_arrItems.end(); it++)
{
RtfMathPtr pNewMath;
if (ParseElement(oParam, m_ooxElem->m_arrItems[i], pNewMath))
if (ParseElement(oParam, *it, pNewMath))
{
oOutput.AddItem( pNewMath );
}

View File

@ -120,9 +120,9 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
{
if (m_ooxElement == NULL) return false;
for (size_t i = 0; i< m_ooxElement->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = m_ooxElement->m_arrItems.begin(); it != m_ooxElement->m_arrItems.end(); it++)
{
Parse3(oParam , oOutputParagraph, oConditionalTableStyle, poStyle , m_ooxElement->m_arrItems[i]);
Parse3(oParam , oOutputParagraph, oConditionalTableStyle, poStyle , *it);
}
return true;
}
@ -400,9 +400,9 @@ bool OOXParagraphReader::Parse3( ReaderParameter oParam , RtfParagraph& oOutputP
{
OOX::Logic::CSmartTag * pSmartTag = dynamic_cast<OOX::Logic::CSmartTag*>(m_ooxElement);
for (size_t i = 0 ; i < pSmartTag->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = pSmartTag->m_arrItems.begin(); it != pSmartTag->m_arrItems.end(); it++)
{
OOX::Logic::CRun * pRun = dynamic_cast<OOX::Logic::CRun*>(pSmartTag->m_arrItems[i]);
OOX::Logic::CRun * pRun = dynamic_cast<OOX::Logic::CRun*>(*it);
if (pRun == NULL) continue;
OOXRunReader oRunReader(pRun);
@ -1018,9 +1018,9 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
orPrReader.Parse( oParam, oNewProperty );
}
for (size_t i =0 ; i < m_ooxRun->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = m_ooxRun->m_arrItems.begin(); it != m_ooxRun->m_arrItems.end(); it++)
{
Parse(oParam, oOutputParagraph, poStyle, oNewProperty, m_ooxRun->m_arrItems[i]);
Parse(oParam, oOutputParagraph, poStyle, oNewProperty, *it);
}
}
return true;

View File

@ -290,15 +290,15 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
{
if (m_arrElement == NULL) return false;
for (size_t i = 0; i < m_arrElement->m_arrItems.size(); i++ )
for (std::list<OOX::WritingElement*>::iterator it = m_arrElement->m_arrItems.begin(); it != m_arrElement->m_arrItems.end(); it++)
{
if (m_arrElement->m_arrItems[i] == NULL) continue;
if ((*it) == NULL) continue;
switch(m_arrElement->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_v_fill:
{
OOX::Vml::CFill* fill = dynamic_cast<OOX::Vml::CFill*>(m_arrElement->m_arrItems[i]);
OOX::Vml::CFill* fill = dynamic_cast<OOX::Vml::CFill*>(*it);
if (!fill) break;
std::wstring srId = fill->m_sId.IsInit() ? fill->m_sId.get2() : L"" ;
@ -374,7 +374,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_v_stroke:
{
OOX::Vml::CStroke* stroke = dynamic_cast<OOX::Vml::CStroke*>(m_arrElement->m_arrItems[i]);
OOX::Vml::CStroke* stroke = dynamic_cast<OOX::Vml::CStroke*>(*it);
if (!stroke) break;
pOutput->m_nLineDashing = stroke->m_oDahsStyle.GetValue(); //совпадают значения
@ -383,7 +383,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_v_imagedata:
{
OOX::Vml::CImageData* image_data = dynamic_cast<OOX::Vml::CImageData*>(m_arrElement->m_arrItems[i]);
OOX::Vml::CImageData* image_data = dynamic_cast<OOX::Vml::CImageData*>(*it);
if (!image_data) break;
std::wstring srId = image_data->m_oId.IsInit() ? image_data->m_oId.get2() : L"" ;
@ -462,7 +462,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_wd_wrap:
{
OOX::VmlWord::CWrap *wrap = dynamic_cast<OOX::VmlWord::CWrap*>(m_arrElement->m_arrItems[i]);
OOX::VmlWord::CWrap *wrap = dynamic_cast<OOX::VmlWord::CWrap*>(*it);
if (wrap->m_oType.IsInit() && pOutput->m_nZOrderRelative == PROP_DEF)
{
@ -488,15 +488,17 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_v_textbox:
{
OOX::Vml::CTextbox *text_box= dynamic_cast<OOX::Vml::CTextbox*>(m_arrElement->m_arrItems[i]);
OOX::Vml::CTextbox *text_box= dynamic_cast<OOX::Vml::CTextbox*>(*it);
if ((text_box) && (text_box->m_oTxtbxContent.IsInit()))
{
OOXTextItemReader oTextItemReader;
for (size_t i = 0; i < text_box->m_oTxtbxContent->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = text_box->m_oTxtbxContent->m_arrItems.begin();
it != text_box->m_oTxtbxContent->m_arrItems.end(); it++)
{
oTextItemReader.Parse( text_box->m_oTxtbxContent->m_arrItems[i], oParam );
oTextItemReader.Parse( *it, oParam );
}
if( oTextItemReader.m_oTextItems->GetCount() > 0 )
@ -505,7 +507,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_v_textpath:
{
OOX::Vml::CTextPath *text_path= dynamic_cast<OOX::Vml::CTextPath*>(m_arrElement->m_arrItems[i]);
OOX::Vml::CTextPath *text_path= dynamic_cast<OOX::Vml::CTextPath*>(*it);
if (text_path)
{
pOutput->m_bGtext = 1;
@ -531,7 +533,7 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}break;
case OOX::et_o_signatureline:
{
OOX::VmlOffice::CSignatureLine *signature = dynamic_cast<OOX::VmlOffice::CSignatureLine*>(m_arrElement->m_arrItems[i]);
OOX::VmlOffice::CSignatureLine *signature = dynamic_cast<OOX::VmlOffice::CSignatureLine*>(*it);
if ( signature )
{
if (signature->m_oIsSignatureLine.IsInit() && signature->m_oIsSignatureLine->ToBool())
@ -1514,31 +1516,31 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
pOutput->m_nGroupBottom =(pOutput->m_nGroupTop != PROP_DEF ? pOutput->m_nGroupTop : 0) + m_vmlGroup->m_oCoordSize->GetY();
}
for (size_t i = 0; i < m_vmlGroup->m_arrItems.size() ; i++ )
for (std::list<OOX::WritingElement*>::iterator it = m_vmlGroup->m_arrItems.begin(); it != m_vmlGroup->m_arrItems.end(); it++)
{
if (m_vmlGroup->m_arrItems[i] == NULL) continue;
if (*it == NULL) continue;
if (m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_group)
if ((*it)->getType() == OOX::et_v_group)
{
RtfShapePtr pNewShape( new RtfShape() );
OOXShapeGroupReader oShapeReader(dynamic_cast<OOX::Vml::CGroup*>(m_vmlGroup->m_arrItems[i]));
OOXShapeGroupReader oShapeReader(dynamic_cast<OOX::Vml::CGroup*>(*it));
if( true == oShapeReader.Parse( oParam, pNewShape ) )
pOutput->AddItem( pNewShape );
}
else if ( m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_arc ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_line ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_oval ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_shape ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_rect ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_roundrect ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_polyline ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_shapetype)
else if ( (*it)->getType() == OOX::et_v_arc ||
(*it)->getType() == OOX::et_v_line ||
(*it)->getType() == OOX::et_v_oval ||
(*it)->getType() == OOX::et_v_shape ||
(*it)->getType() == OOX::et_v_rect ||
(*it)->getType() == OOX::et_v_roundrect ||
(*it)->getType() == OOX::et_v_polyline ||
(*it)->getType() == OOX::et_v_shapetype)
{
RtfShapePtr pNewShape ( new RtfShape() );//set type .. .todooo
OOXShapeReader oShapeReader(dynamic_cast<OOX::Vml::CVmlCommonElements*>(m_vmlGroup->m_arrItems[i]));
OOXShapeReader oShapeReader(dynamic_cast<OOX::Vml::CVmlCommonElements*>(*it));
pNewShape->m_bInGroup = true;
if( true == oShapeReader.Parse( oParam, pNewShape ) )

View File

@ -53,9 +53,9 @@ public:
{
if (m_ooxTableCell == NULL) return false;
if( m_ooxTableCell->m_oTableCellProperties )
if( m_ooxTableCell->m_pTableCellProperties )
{
OOXtcPrReader oCellPropReader(m_ooxTableCell->m_oTableCellProperties, m_ooxTableProps);
OOXtcPrReader oCellPropReader(m_ooxTableCell->m_pTableCellProperties, m_ooxTableProps);
oCellPropReader.Parse( oParam, oOutputCell.m_oProperty, oConditionalTableStyle, nCurCell, nCellCount, nCurRow, nRowCount );//может поменяться на любой condition (firstRow)
}
else
@ -66,13 +66,13 @@ public:
oConditionalTableStyle.ApplyTableStyleToCellBorder( oParam.poTableStyle, oOutputCell.m_oProperty, nCurCell, nCellCount, nCurRow, nRowCount );
}
for (size_t i = 0; i < m_ooxTableCell->m_arrItems.size(); i++ )
for (std::list<OOX::WritingElement*>::iterator it = m_ooxTableCell->m_arrItems.begin(); it != m_ooxTableCell->m_arrItems.end(); it++)
{
switch(m_ooxTableCell->m_arrItems[i]->getType())
switch((*it)->getType())
{
case OOX::et_w_p:
{
OOX::Logic::CParagraph * pParagraph = dynamic_cast<OOX::Logic::CParagraph*>(m_ooxTableCell->m_arrItems[i]);
OOX::Logic::CParagraph * pParagraph = dynamic_cast<OOX::Logic::CParagraph*>(*it);
RtfParagraphPtr oNewParagraph( new RtfParagraph() );
//применяем к новому параграфу default property
@ -92,7 +92,7 @@ public:
}break;
case OOX::et_w_tbl:
{
OOX::Logic::CTbl * pTbl = dynamic_cast<OOX::Logic::CTbl*>(m_ooxTableCell->m_arrItems[i]);
OOX::Logic::CTbl * pTbl = dynamic_cast<OOX::Logic::CTbl*>(*it);
oParam.oReader->m_nCurItap ++ ;
RtfTablePtr oNewTabel( new RtfTable() );
@ -104,7 +104,7 @@ public:
default:
{
//todooo - универсальный риадер
//OOXElementReader oElementReader(m_ooxTableCell->m_arrItems[i]);
//OOXElementReader oElementReader((*it));
//ITextItemPtr *rtfElement = oElementReader.Parse( oParam);
//oOutputCell.AddItem( rtfElement );
}break;

View File

@ -172,10 +172,10 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
long nRowCount = m_ooxTable->m_nCountRow, nCurRow = 0;
for (size_t i = 0; i < m_ooxTable->m_arrItems.size(); i++ )
{
if (m_ooxTable->m_arrItems[i] == NULL) continue;
if (m_ooxTable->m_arrItems[i]->getType() != OOX::et_w_tr) continue;
for (std::list<OOX::WritingElement*>::iterator it = m_ooxTable->m_arrItems.begin(); it != m_ooxTable->m_arrItems.end(); it++)
{
if ( (*it) == NULL) continue;
if ( (*it)->getType() != OOX::et_w_tr) continue;
ReaderParameter newParam = oParam;
newParam.poTableStyle = poTableStyle;
@ -185,7 +185,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
//т.к. в RTF нет свойств таблиц и все свойства записываются в свойства row
(*((RtfTableProperty*)&oNewRow->m_oProperty)).Merge( oOutputTable.m_oProperty );
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(m_ooxTable->m_arrItems[i]);
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(*it);
OOXTableRowReader oRowReader(ooxRow, m_ooxTable->m_oTableProperties);
oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount );

View File

@ -55,25 +55,27 @@ public:
CcnfStyle oConditionStyle;
//с начала применяем свойства
if( m_ooxRowTable->m_oTableRowProperties )
if( m_ooxRowTable->m_pTableRowProperties )
{
OOXtrPrReader otrPrReader(m_ooxRowTable->m_oTableRowProperties);
OOXtrPrReader otrPrReader(m_ooxRowTable->m_pTableRowProperties);
otrPrReader.Parse( oParam, oOutputRow.m_oProperty, oConditionStyle);// может поменяться на любой condition(first row)
}
int nCellCount = m_ooxRowTable->m_nCountCell, nCurCell = 0;
for (size_t i = 0; i < m_ooxRowTable->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = m_ooxRowTable->m_arrItems.begin(); it != m_ooxRowTable->m_arrItems.end(); it++)
{
if (m_ooxRowTable->m_arrItems[i] == NULL) continue;
if (m_ooxRowTable->m_arrItems[i]->getType() != OOX::et_w_tc)continue;//todooo bookmarks
if ( (*it) == NULL ) continue;
if ( (*it)->getType() != OOX::et_w_tc)continue;//todooo bookmarks
RtfTableCellPtr oNewCell( new RtfTableCell() );
OOX::Logic::CTc *ooxCell = NULL;
if (nCurCell < m_ooxRowTable->m_arrItems.size())
ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[i]);
{
ooxCell = dynamic_cast<OOX::Logic::CTc *>(*it);
}
OOXTableCellReader oCellReader(ooxCell, m_ooxTableProps );
oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell++, nCurRow, nCellCount, nRowCount );

View File

@ -113,9 +113,10 @@ public:
case OOX::et_w_sdtContent:
{
OOX::Logic::CSdtContent * pSdt = dynamic_cast<OOX::Logic::CSdtContent*>(ooxElement);
for (size_t i = 0; i < pSdt->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = pSdt->m_arrItems.begin(); it != pSdt->m_arrItems.end(); it++)
{
Parse( pSdt->m_arrItems[i], oParam );
Parse( *it, oParam );
}
}break;

View File

@ -41,9 +41,9 @@
RtfDocument::RtfDocument()
{
RtfSectionPtr s(new RtfSection());
_section section(s, 0, 0);
_section section;
section.props = RtfSectionPtr(new RtfSection());
m_aArray.push_back( section );
m_oProperty.SetDefaultOOX();

View File

@ -37,15 +37,16 @@
#include "RtfMath.h"
#include "RtfShape.h"
namespace OOX
{
class WritingElement;
}
struct _section
{
_section() : start_para(0), end_para(-1) {}
_section(RtfSectionPtr &p, int start = 0, int end = -1) : props(p), start_para(start), end_para(end) {}
RtfSectionPtr props;
int start_para;
int end_para;
RtfSectionPtr props;
std::list<OOX::WritingElement*>::iterator start_para;
std::list<OOX::WritingElement*>::iterator end_para;
};
class RtfDocument : public ItemContainer<_section>

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

@ -72,7 +72,7 @@ namespace Docx2Txt
OOX::CDocx m_inputFile;
private:
void convert(std::vector<OOX::WritingElement *> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event, bool isFirstLevel,
void convert(std::list<OOX::WritingElement *> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event, bool isFirstLevel,
OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles);
int m_lPercent;
@ -248,17 +248,19 @@ namespace Docx2Txt
}
void Converter_Impl::convert(std::vector<OOX::WritingElement *> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event,
void Converter_Impl::convert(std::list<OOX::WritingElement*> & items, std::list<std::wstring>& textOut, TxtXml::ITxtXmlEvent& Event,
bool isFirstLevel, OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles)
{
if(items.size() > 0)
if( !items.empty() )
{
if(isFirstLevel)
m_lAddition = m_lAddition / items.size();
for (int i=0 ; i< items.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = items.begin(); it != items.end(); it++)
{
OOX::WritingElement * item = items[i];
OOX::WritingElement* item = *it;
if (!item)continue;
if (item->getType() == OOX::et_w_p)
{
@ -301,6 +303,7 @@ namespace Docx2Txt
{
//todoooo проверить - это общий случай - вместо CSdt ... да и Tbl тож
OOX::WritingElementWithChilds<OOX::WritingElement> *item_with_items = dynamic_cast<OOX::WritingElementWithChilds<OOX::WritingElement>*>(item);
if (item_with_items)
{
convert(item_with_items->m_arrItems, textOut, Event, false, pDocument, pNumbering, pStyles);
@ -461,16 +464,23 @@ namespace Docx2Txt
bool inField = false;
for (long i=0; i < pParagraph->m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin();
it != pParagraph->m_arrItems.end(); it++)
{
if (pParagraph->m_arrItems[i]->getType() == OOX::et_w_r)
if (*it== NULL) continue;
if ((*it)->getType() == OOX::et_w_r)
{
OOX::Logic::CRun *run = dynamic_cast<OOX::Logic::CRun*>(pParagraph->m_arrItems[i]);
for (long j = 0 ; j < run->m_arrItems.size();j++)
OOX::Logic::CRun *run = dynamic_cast<OOX::Logic::CRun*>(*it);
for (std::list<OOX::WritingElement*>::iterator jt = run->m_arrItems.begin(); jt != run->m_arrItems.end(); jt++)
{
if (run->m_arrItems[j]->getType() == OOX::et_w_fldChar)
if (*jt== NULL) continue;
if ((*jt)->getType() == OOX::et_w_fldChar)
{
OOX::Logic::CFldChar *fldChar = dynamic_cast<OOX::Logic::CFldChar*>(run->m_arrItems[j]);
OOX::Logic::CFldChar *fldChar = dynamic_cast<OOX::Logic::CFldChar*>(*jt);
if ((fldChar) && (fldChar->m_oFldCharType.IsInit()))
{
if (fldChar->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeBegin) inField = true;
@ -484,13 +494,13 @@ namespace Docx2Txt
if ((run->m_oRunProperty) && (run->m_oRunProperty->m_oCaps.Init()) && (run->m_oRunProperty->m_oCaps->m_oVal.ToBool())) caps = true;
std::wstring wstr;
if (run->m_arrItems[j]->getType() == OOX::et_w_tab)
if ((*jt)->getType() == OOX::et_w_tab)
{
wstr = L"\x09";
}
else if (run->m_arrItems[j]->getType() == OOX::et_w_t)
else if ((*jt)->getType() == OOX::et_w_t)
{
OOX::Logic::CText* text = dynamic_cast<OOX::Logic::CText*>(run->m_arrItems[j]);
OOX::Logic::CText* text = dynamic_cast<OOX::Logic::CText*>(*jt);
wstr = text->m_sText;
if(caps)
{
@ -499,13 +509,13 @@ namespace Docx2Txt
}
}
if (run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference || run->m_arrItems[j]->getType() == OOX::et_w_endnoteReference)
if ((*jt)->getType() == OOX::et_w_footnoteReference || (*it)->getType() == OOX::et_w_endnoteReference)
{// todooo Ref ????
std::list<std::wstring> notes_content;
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(run->m_arrItems[j]);
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(run->m_arrItems[j]);
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(*jt);
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(*jt);
NoteCount++;
if (footnote_ref)
@ -514,6 +524,7 @@ namespace Docx2Txt
if (pFile.IsInit())
{
OOX::CFootnotes *pFootnotes = (OOX::CFootnotes*)pFile.operator->();
for (size_t r = 0; r < pFootnotes->m_arrFootnote.size(); r++)
{
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pFootnotes->m_arrFootnote[r]);

View File

@ -69,10 +69,11 @@ namespace Txt2Docx
void Converter::write(/*const std::wstring& path*/XmlUtils::CStringWriter & stringWriter)
{
for (long i=0;i < converter_->m_outputFile.m_arrItems.size(); i++)
for (std::list<OOX::WritingElement*>::iterator it = converter_->m_outputFile.m_arrItems.begin();
it != converter_->m_outputFile.m_arrItems.end(); it++)
{
if (converter_->m_outputFile.m_arrItems[i] != NULL)
stringWriter.WriteString(converter_->m_outputFile.m_arrItems[i]->toXML());
if ( *it )
stringWriter.WriteString((*it)->toXML());
}
//BOOL res = converter_->m_outputFile.Write(std_string2string(path.string()));
return;

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

@ -516,7 +516,7 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
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
static boost::wregex test_sheet_name(L"[\\s)(\\!\\'&:-]+"); //.??? 6442946.xls
std::wstring sheet_first = prefix + name;
@ -537,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);

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

@ -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)
{

View File

@ -35,8 +35,7 @@
namespace XLS
{
Array::Array(const CellRef& cell_base_ref_init)
: formula(false, cell_base_ref_init)
Array::Array(const CellRef& cell_base_ref_init) :formula(false, cell_base_ref_init)
{
}

View File

@ -32,8 +32,8 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/CellRangeRef.h>
#include <Logic/Biff_structures/ArrayParsedFormula.h>
#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_structures/ArrayParsedFormula.h"
namespace XLS
{
@ -49,7 +49,6 @@ public:
~Array();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -46,13 +46,15 @@ static inline void trim(std::wstring &s)
if (s[i] != 0) break;
else new_size--;
}
if (new_size < s.length())
if (new_size < (int)s.length())
s.erase(new_size);
}
AutoFilter::AutoFilter()
{
wTopN = wJoin = 0;
size = 0xffffffff;
bExist = false;
}
@ -68,6 +70,15 @@ BaseObjectPtr AutoFilter::clone()
void AutoFilter::readFields(CFRecord& record)
{
size_t pos_record = record.getRdPtr();
if (size == 0xffffffff) size = record.getDataSize() - pos_record;
if (size > 0)
{
bExist = true;
}
m_bAutoFilter12 = false;
unsigned short flags;
@ -93,13 +104,13 @@ void AutoFilter::readFields(CFRecord& record)
record >> doper2;
}
if ((doper1.vt == BIFF_BYTE(0)) && (doper2.vt == BIFF_BYTE(0)))
if (doper1.vt == 0 && doper2.vt == 0)
{
m_bAutoFilter12 = true;
return;
}
if (doper1.vt == BIFF_BYTE(0x06))
if (doper1.vt == 0x06)
{
XLUnicodeStringNoCch s;
s.setSize(doper1.vtValueStr.cch);
@ -109,7 +120,7 @@ void AutoFilter::readFields(CFRecord& record)
trim(str1);
}
if (doper2.vt == BIFF_BYTE(0x06))
if (doper2.vt == 0x06)
{
XLUnicodeStringNoCch s;
s.setSize(doper2.vtValueStr.cch);
@ -119,9 +130,9 @@ void AutoFilter::readFields(CFRecord& record)
trim(str2);
}
if (record.getRdPtr() < record.getDataSize())
if (record.getRdPtr() - pos_record < size)
{
int sz = record.getDataSize() - record.getRdPtr();
int sz = size - (record.getRdPtr() - pos_record);
char *dd = new char [sz];
memcpy(dd, record.getCurData<char>(), sz);

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/AFDOper.h>
#include "../Biff_structures/AFDOper.h"
namespace XLS
{
// Logical representation of AutoFilter record in BIFF8
class AutoFilter: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(AutoFilter)
@ -74,6 +72,9 @@ public:
std::wstring str1;
std::wstring str2;
//----------------------------------------
bool bExist;
_UINT32 size;
};
} // namespace XLS

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