mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-02 15:51:48 +08:00
Compare commits
47 Commits
core-linux
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 709ee1942d | |||
| e59eff3a16 | |||
| 2206b3b366 | |||
| a2d37e8a22 | |||
| b13eba5f01 | |||
| a48058c7d5 | |||
| ab76aff379 | |||
| b8b8a14268 | |||
| e5ef749718 | |||
| 5d524369b8 | |||
| e78fc0befc | |||
| d9986d09cd | |||
| bd67f4bf1c | |||
| 475bfaf93d | |||
| 1a8af4d8ed | |||
| cdf8dc7a4c | |||
| d71552bddd | |||
| 548c5ab608 | |||
| 6a01384023 | |||
| d70f36e36d | |||
| f65984f079 | |||
| 5b48a7a330 | |||
| 1496aece57 | |||
| 60cf51ad0d | |||
| 8e7231b322 | |||
| 2b339b6842 | |||
| fb0dbfc231 | |||
| 756613e883 | |||
| ede03fafea | |||
| bdec91bfd5 | |||
| 260c2edd21 | |||
| 3eeec8fc67 | |||
| ba6c7e8151 | |||
| 41a213491e | |||
| b599a6bc43 | |||
| a0fd139027 | |||
| 48852bc618 | |||
| 20b781cb7e | |||
| 704b3b709f | |||
| e4674915c2 | |||
| 51fe936e5f | |||
| d8b177411f | |||
| 717b628055 | |||
| e4f94646b6 | |||
| dcec7447e4 | |||
| 5f12552f78 | |||
| e7bbbec0de |
@ -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;
|
||||
|
||||
@ -48,6 +48,8 @@
|
||||
#include "OleObjectMapping.h"
|
||||
#include "ConversionContext.h"
|
||||
#include "IMapping.h"
|
||||
#include "FormFieldData.h"
|
||||
#include "FormFieldDataMapping.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
|
||||
170
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
Normal file
170
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
126
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
Normal file
126
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
Normal 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;
|
||||
|
||||
};
|
||||
}
|
||||
87
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
Normal file
87
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
Normal 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;
|
||||
};
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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>();
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -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;
|
||||
@ -3746,6 +3763,21 @@ public:
|
||||
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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -477,8 +477,10 @@ extern int g_nCurFormatVersion;
|
||||
MoveFromRangeEnd = 19,
|
||||
MoveToRangeStart = 20,
|
||||
MoveToRangeEnd = 21,
|
||||
BookmarkStart = 22,
|
||||
BookmarkEnd = 23
|
||||
JsaProject = 22,
|
||||
BookmarkStart = 23,
|
||||
BookmarkEnd = 24
|
||||
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
|
||||
@ -2104,14 +2104,11 @@ namespace BinDocxRW
|
||||
SimpleTypes::EHeightRule eHRule = SimpleTypes::heightruleAtLeast;
|
||||
if(rowHeight.m_oHRule.IsInit())
|
||||
eHRule = rowHeight.m_oHRule->GetValue();
|
||||
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Rule);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(eHRule)
|
||||
{
|
||||
case SimpleTypes::heightruleAtLeast :
|
||||
case SimpleTypes::heightruleExact :m_oBcw.m_oStream.WriteBYTE(heightrule_AtLeast);break;
|
||||
default :m_oBcw.m_oStream.WriteBYTE(heightrule_Auto);break;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(eHRule);
|
||||
|
||||
|
||||
//Value
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rowPrType::Height_Value);
|
||||
@ -2992,6 +2989,7 @@ namespace BinDocxRW
|
||||
Binary_tblPrWriter btblPrs;
|
||||
OOX::Logic::CSectionProperty* pSectPr;
|
||||
OOX::Logic::CBackground * pBackground;
|
||||
OOX::CDocument* poDocument;
|
||||
|
||||
bool m_bWriteSectPr;//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
|
||||
//---------------------------------
|
||||
@ -3000,6 +2998,7 @@ namespace BinDocxRW
|
||||
{
|
||||
pBackground = NULL;
|
||||
pSectPr = NULL;
|
||||
poDocument = NULL;
|
||||
m_bWriteSectPr = false;
|
||||
}
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
|
||||
@ -3110,6 +3109,23 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
//Write JsaProject
|
||||
if (NULL != poDocument)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = poDocument->Get(OOX::FileTypes::JsaProject);
|
||||
if (pFile.IsInit() && OOX::FileTypes::JsaProject == pFile->type())
|
||||
{
|
||||
OOX::JsaProject& jsaProject = pFile.as<OOX::JsaProject>();
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if(NSFile::CFileBinary::ReadAllBytes(jsaProject.filename().GetPath(), &pData, nBytesCount))
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteBackground (OOX::Logic::CBackground* pBackground)
|
||||
{
|
||||
@ -7893,6 +7909,7 @@ namespace BinDocxRW
|
||||
|
||||
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
|
||||
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
|
||||
oBinaryDocumentTableWriter.poDocument = poDocument;
|
||||
|
||||
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
|
||||
//Write Vba
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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){}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
@ -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()));
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough=""
|
||||
WarningLevel="3"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
AdditionalIncludeDirectories=""
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough=""
|
||||
WarningLevel="3"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
@ -429,6 +429,14 @@
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/bigobj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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 ();
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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())
|
||||
|
||||
@ -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;}
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -1027,7 +1027,16 @@ bool RtfParagraphPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_BOOL( "intbl", paragraphProps->m_bInTable, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "itap", paragraphProps->m_nItap, sCommand, hasParameter, parameter )
|
||||
else if ( "itap" == sCommand && hasParameter)
|
||||
{
|
||||
//if (parameter == 0 && paragraphProps->m_bInTable && paragraphProps->m_nItap > 0)
|
||||
//{
|
||||
//
|
||||
//// paragraphProps->m_bInTable = 0;
|
||||
//}
|
||||
//else
|
||||
paragraphProps->m_nItap = parameter;
|
||||
}
|
||||
COMMAND_RTF_BOOL( "keep", paragraphProps->m_bKeep, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "keepn", paragraphProps->m_bKeepNext, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "pagebb", paragraphProps->m_bPageBB, sCommand, hasParameter, parameter )
|
||||
@ -2283,7 +2292,8 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
|
||||
{
|
||||
// 1 != oItem->m_oProperty.m_bInTable - параграф не в таблице
|
||||
// PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap - выставлено свойство,что вложенность - nTargetItap - это не таблица( Нужно для чтения параграфов в таблицах )
|
||||
if ( 1 != oItem->m_oProperty.m_bInTable || ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
|
||||
if ( ( 1 != oItem->m_oProperty.m_bInTable || 0 == oItem->m_oProperty.m_nItap ) //Платежное_поручение.rtf
|
||||
|| ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
|
||||
{
|
||||
if ( nCurItap > 0 ) //Если до этого были только параграфы в таблицах - завершаем таблицу
|
||||
{
|
||||
@ -2292,15 +2302,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
|
||||
|
||||
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
|
||||
{
|
||||
if ( aRowItaps[k] == nCurItap )
|
||||
{
|
||||
oNewTable->InsertItem( aRows[k], 0 );
|
||||
|
||||
aRows.erase(aRows.begin() + k);
|
||||
aRowItaps.erase(aRowItaps.begin() + k);
|
||||
}
|
||||
else
|
||||
if ( aRowItaps[k] != nCurItap )
|
||||
break;
|
||||
|
||||
oNewTable->InsertItem( aRows[k], 0 );
|
||||
|
||||
aRows.erase(aRows.begin() + k);
|
||||
aRowItaps.erase(aRowItaps.begin() + k);
|
||||
}
|
||||
//вычисляем свойства для OOX
|
||||
oNewTable->CalculateGridProp();
|
||||
@ -2339,15 +2347,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
|
||||
|
||||
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
|
||||
{
|
||||
if ( aRowItaps[k] == nCurItap )
|
||||
{
|
||||
oNewTable->InsertItem( aRows[k], 0 );
|
||||
|
||||
aRows.erase(aRows.begin() + k);
|
||||
aRowItaps.erase(aRowItaps.begin() + k);
|
||||
}
|
||||
else
|
||||
if ( aRowItaps[k] != nCurItap )
|
||||
break;
|
||||
|
||||
oNewTable->InsertItem( aRows[k], 0 );
|
||||
|
||||
aRows.erase(aRows.begin() + k);
|
||||
aRowItaps.erase(aRowItaps.begin() + k);
|
||||
}
|
||||
//вычисляем свойства для OOX
|
||||
oNewTable->CalculateGridProp();
|
||||
@ -2386,7 +2392,7 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
|
||||
//добавляем параграф во временные cell
|
||||
aCellRenderables.push_back( oItem ); //содержит все параграфы, не разложенные по cell
|
||||
aItaps.push_back( nCurItap ); //содержит все номера вложенности параграфов
|
||||
|
||||
|
||||
if ( bEndCell )
|
||||
{
|
||||
RtfTableCellPtr oNewTableCell ( new RtfTableCell() );
|
||||
@ -2456,6 +2462,9 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
|
||||
}
|
||||
else if ( "cell" == sCommand || "nestcell" == sCommand )
|
||||
{
|
||||
if (oReader.m_oState->m_oParagraphProp.m_bInTable == 1 && 0 == oReader.m_oState->m_oParagraphProp.m_nItap )//Платежное_поручение.rtf (ели по другому сбойная строка заменяется параграфами
|
||||
oReader.m_oState->m_oParagraphProp.m_nItap = 1;
|
||||
|
||||
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
|
||||
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
|
||||
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;
|
||||
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\XlsFileTestD.pdb"
|
||||
WarningLevel="3"
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of AxisLine record in BIFF8
|
||||
class AxisLine: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(AxisLine)
|
||||
|
||||
@ -35,9 +35,6 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DataFormat record in BIFF8
|
||||
class DataFormat: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(DataFormat)
|
||||
@ -47,11 +44,10 @@ public:
|
||||
~DataFormat();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeDataFormat;
|
||||
static const ElementType type = typeDataFormat;
|
||||
|
||||
_UINT16 xi;
|
||||
_UINT16 yi;
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
#include "ExternSheet.h"
|
||||
#include <Logic/Biff_structures/XTI.h>
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
#include "../Biff_structures/XTI.h"
|
||||
#include "../Biff_structures/BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -138,30 +138,13 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
|
||||
}
|
||||
else
|
||||
CP_XML_ATTR(L"i", false);
|
||||
//if (bCharSet.value())
|
||||
//{
|
||||
// CP_XML_NODE(L"charset")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", bCharSet);
|
||||
// }
|
||||
//}
|
||||
|
||||
switch(sss)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"cap", L"all");break;
|
||||
case 2: CP_XML_ATTR(L"cap", L"small");break;
|
||||
}
|
||||
|
||||
|
||||
//if ((fCondense.value()) && (*fCondense.value()))
|
||||
//{
|
||||
// CP_XML_NODE(L"condense")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", (int)(*fCondense.value()));
|
||||
// }
|
||||
//}
|
||||
|
||||
//if ((fExtend.value()) && (fExtend))
|
||||
// {
|
||||
// CP_XML_NODE(L"extend")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", fExtend);
|
||||
// }
|
||||
// }
|
||||
if ( (icv < 0x7fff) || color_ext.enabled )
|
||||
{
|
||||
if (color_ext.enabled )
|
||||
@ -236,66 +219,7 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
|
||||
{
|
||||
CP_XML_NODE(namespace_ + L"rtl");
|
||||
}
|
||||
//if ((fOutline.value()) && (fOutline))
|
||||
// {
|
||||
// CP_XML_NODE(L"outline")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", fOutline);
|
||||
// }
|
||||
// }
|
||||
|
||||
//if (font.scheme)
|
||||
//{
|
||||
// CP_XML_NODE(L"scheme")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", *font.scheme);
|
||||
// }
|
||||
//}
|
||||
|
||||
//if ((fShadow.value()) && (fShadow))
|
||||
// {
|
||||
// CP_XML_NODE(L"shadow")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", fShadow);
|
||||
// }
|
||||
// }
|
||||
|
||||
//if ((fStrikeOut.value()) && (fStrikeOut))
|
||||
//{
|
||||
// CP_XML_NODE(L"strike")
|
||||
// {
|
||||
// CP_XML_ATTR(L"val", fStrikeOut);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// if ((uls.value()) && (*uls.value() > 0))
|
||||
// {
|
||||
// CP_XML_NODE(L"u")
|
||||
// {
|
||||
//switch(uls)
|
||||
//{
|
||||
// case 1: CP_XML_ATTR(L"val", "single");break;
|
||||
// case 2: CP_XML_ATTR(L"val", "double");break;
|
||||
// case 33: CP_XML_ATTR(L"val", "singleAccounting");break;
|
||||
// case 34: CP_XML_ATTR(L"val", "doubleAccounting");break;
|
||||
//}
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ((sss.value()) && (*sss.value() > 0))
|
||||
// {
|
||||
// CP_XML_NODE(L"vertAlign")
|
||||
// {
|
||||
//switch(*sss.value())
|
||||
//{
|
||||
// case 1: CP_XML_ATTR(L"val", L"superscript");break;
|
||||
// case 2: CP_XML_ATTR(L"val", L"subscript");break;
|
||||
//}
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
// Logical representation of InterfaceEnd record in BIFF8
|
||||
class InterfaceEnd: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(InterfaceEnd)
|
||||
@ -47,6 +46,7 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
static const ElementType type = typeInterfaceEnd;
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
|
||||
@ -60,7 +60,9 @@ void String::readFields(CFRecord& record)
|
||||
string = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
record >> string;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecordContinued.h"
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
#include "../Biff_structures/BiffString.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of String record in BIFF8
|
||||
class String: public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(String)
|
||||
|
||||
@ -31,8 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "Theme.h"
|
||||
#include <fstream>
|
||||
#include <iostream> // endl
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -59,13 +58,15 @@ void Theme::readFields(CFRecord& record)
|
||||
{
|
||||
//default theme
|
||||
}
|
||||
else if (dwThemeVersion == 0)
|
||||
//else if (dwThemeVersion == 0)
|
||||
else
|
||||
{
|
||||
nThemeDataSize = record.getDataSize() - record.getRdPtr();
|
||||
pThemeData = boost::shared_array<char>(new char[nThemeDataSize]);
|
||||
|
||||
memcpy(pThemeData.get(), record.getCurData<char>(), nThemeDataSize);
|
||||
record.skipNunBytes(nThemeDataSize);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include "TxO.h"
|
||||
|
||||
#include <Logic/Biff_records/Font.h>
|
||||
#include "Font.h"
|
||||
|
||||
#include <utils.h>
|
||||
|
||||
@ -184,9 +184,9 @@ int TxO::serialize_vml (std::wostream & _stream)
|
||||
{
|
||||
iFmt = run->formatRun.ifnt;
|
||||
Font *font = NULL;
|
||||
if ((global_info->m_arFonts) && (iFmt >=0 && iFmt < global_info->m_arFonts->size()))
|
||||
if (iFmt >= 0 && iFmt < global_info->m_arFonts.size())
|
||||
{
|
||||
font = dynamic_cast<Font *>(global_info->m_arFonts->at(iFmt).get());
|
||||
font = dynamic_cast<Font *>(global_info->m_arFonts[iFmt].get());
|
||||
}
|
||||
if (font)
|
||||
{
|
||||
@ -281,12 +281,11 @@ int TxO::serialize (std::wostream & _stream)
|
||||
int TxO::serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_)
|
||||
{
|
||||
if (!global_info) return 0;
|
||||
if (!global_info->m_arFonts) return 0;
|
||||
|
||||
int sz = global_info->m_arFonts->size();
|
||||
int sz = global_info->m_arFonts.size();
|
||||
if (iFmt - 1 >= sz || iFmt < 1) return 0;
|
||||
|
||||
Font * font = dynamic_cast<Font*>(global_info->m_arFonts->at(iFmt-1).get());
|
||||
Font * font = dynamic_cast<Font*>(global_info->m_arFonts[iFmt-1].get());
|
||||
|
||||
if (!font) return 0;
|
||||
|
||||
|
||||
@ -35,11 +35,10 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
XF::XF(size_t& cell_xf_current_id, size_t& style_xf_current_id)
|
||||
: cell(cell_xf_current_id, style_xf_current_id),
|
||||
style(cell_xf_current_id, style_xf_current_id),
|
||||
ixfParent(0)
|
||||
XF::XF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell (cell_xf_current_id, style_xf_current_id),
|
||||
style(cell_xf_current_id, style_xf_current_id)
|
||||
{
|
||||
ixfParent = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,15 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/FontIndex.h>
|
||||
#include <Logic/Biff_structures/CellXF.h>
|
||||
#include <Logic/Biff_structures/StyleXF.h>
|
||||
#include "../Biff_structures/FontIndex.h"
|
||||
#include "../Biff_structures/CellXF.h"
|
||||
#include "../Biff_structures/StyleXF.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of XF record in BIFF8
|
||||
class XF: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(XF)
|
||||
|
||||
@ -38,13 +38,12 @@ namespace XLS
|
||||
|
||||
struct FillInfoExt
|
||||
{
|
||||
FillInfoExt() {enabled = false; xclrType = icv = 0; nTintShade = 0; xclrValue = 0;}
|
||||
bool enabled;
|
||||
bool enabled =false;
|
||||
|
||||
unsigned char xclrType;
|
||||
unsigned char icv;
|
||||
short nTintShade;
|
||||
unsigned int xclrValue;
|
||||
unsigned char xclrType = 0;
|
||||
unsigned char icv = 0;
|
||||
short nTintShade = 0;
|
||||
unsigned int xclrValue = 0;
|
||||
};
|
||||
|
||||
struct FillInfo
|
||||
@ -56,9 +55,9 @@ struct FillInfo
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char fls;
|
||||
unsigned char icvFore;
|
||||
unsigned char icvBack;
|
||||
unsigned char fls = 0;
|
||||
unsigned char icvFore = 0;
|
||||
unsigned char icvBack = 0;
|
||||
|
||||
bool operator < (const FillInfo& right) const
|
||||
{
|
||||
@ -84,17 +83,17 @@ struct FillInfo
|
||||
|
||||
struct BorderInfo
|
||||
{
|
||||
unsigned char dgLeft;
|
||||
unsigned char dgRight;
|
||||
unsigned char dgTop;
|
||||
unsigned char dgBottom;
|
||||
unsigned char dgDiag;
|
||||
unsigned char grbitDiag;
|
||||
unsigned char icvLeft;
|
||||
unsigned char icvRight;
|
||||
unsigned char icvTop;
|
||||
unsigned char icvBottom;
|
||||
unsigned char icvDiag;
|
||||
unsigned char dgLeft = 0;
|
||||
unsigned char dgRight = 0;
|
||||
unsigned char dgTop = 0;
|
||||
unsigned char dgBottom = 0;
|
||||
unsigned char dgDiag = 0;
|
||||
unsigned char grbitDiag = 0;
|
||||
unsigned char icvLeft = 0;
|
||||
unsigned char icvRight = 0;
|
||||
unsigned char icvTop = 0;
|
||||
unsigned char icvBottom = 0;
|
||||
unsigned char icvDiag = 0;
|
||||
|
||||
FillInfoExt leftFillInfo_;
|
||||
FillInfoExt rightFillInfo_;
|
||||
|
||||
@ -38,10 +38,11 @@ namespace XLS
|
||||
{
|
||||
|
||||
|
||||
CellXF::CellXF(size_t& cell_xf_current_id, size_t& style_xf_current_id)
|
||||
: cell_xf_current_id_(cell_xf_current_id), style_xf_current_id_(style_xf_current_id), font_id(0xFFFF)
|
||||
CellXF::CellXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell_xf_current_id_(cell_xf_current_id),
|
||||
style_xf_current_id_(style_xf_current_id)
|
||||
{
|
||||
alc = alcV = 0;
|
||||
font_id = 0xFFFF;
|
||||
}
|
||||
|
||||
|
||||
@ -152,6 +153,91 @@ void CellXF::load(CFRecord& record)
|
||||
}
|
||||
}
|
||||
|
||||
void CellXF::Update(ExtProp* ext_prop)
|
||||
{
|
||||
if (!ext_prop) return;
|
||||
|
||||
switch(ext_prop->extType)
|
||||
{
|
||||
case 0x0004:
|
||||
{
|
||||
fill.foreFillInfo_.enabled = true;
|
||||
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0005:
|
||||
{
|
||||
fill.backFillInfo_.enabled = true;
|
||||
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0007:
|
||||
{
|
||||
border.topFillInfo_.enabled = true;
|
||||
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0008:
|
||||
{
|
||||
border.bottomFillInfo_.enabled = true;
|
||||
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0009:
|
||||
{
|
||||
border.leftFillInfo_.enabled = true;
|
||||
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x000A:
|
||||
{
|
||||
border.rightFillInfo_.enabled = true;
|
||||
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
//case 0x000B: //diag color
|
||||
//case 0x000C: //diag color
|
||||
case 0x000D:
|
||||
{
|
||||
font_color.enabled = true;
|
||||
font_color.icv = ext_prop->extPropData.color.icv;
|
||||
font_color.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
//case 0x0006:
|
||||
// extPropData.gradient_fill.toXML(own_tag);
|
||||
// break;
|
||||
case 0x000E:
|
||||
{
|
||||
font_id = ext_prop->extPropData.font_scheme;
|
||||
}break;
|
||||
case 0x000F:
|
||||
{
|
||||
cIndent = ext_prop->extPropData.indent_level;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void CellXF::Update(XFProps* xfProps)
|
||||
{
|
||||
if (!xfProps) return;
|
||||
//
|
||||
// std::wstringstream strm;
|
||||
// xfProps->serialize_fill(strm);
|
||||
// fill.ext = strm.str();
|
||||
}
|
||||
void CellXF::RegisterFillBorder()
|
||||
{
|
||||
for (size_t i = 0; i < ext_props.size(); i++ )
|
||||
@ -231,6 +317,8 @@ void CellXF::RegisterFillBorder()
|
||||
|
||||
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border);
|
||||
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill);
|
||||
|
||||
m_GlobalWorkbookInfo->RegisterFontColorId(font_id, font_color);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class XFProps;
|
||||
class ExtProp;
|
||||
|
||||
class CFRecord;
|
||||
class GlobalWorkbookInfo;
|
||||
@ -74,19 +76,23 @@ public:
|
||||
BorderInfo border;
|
||||
FillInfo fill;
|
||||
|
||||
BiffStructurePtrVector ext_props;
|
||||
|
||||
FillInfoExt font_color;
|
||||
size_t font_id;
|
||||
|
||||
bool fHasXFExt;
|
||||
bool fsxButton;
|
||||
//------------------------------------------------------------------
|
||||
BiffStructurePtrVector ext_props;
|
||||
BiffStructurePtrVector xf_props;
|
||||
|
||||
size_t border_x_id;
|
||||
size_t fill_x_id;
|
||||
|
||||
size_t& cell_xf_current_id_;
|
||||
size_t& style_xf_current_id_;
|
||||
|
||||
void Update(ExtProp* extProp); // xls style
|
||||
void Update(XFProps* xfProps); //xlsx style
|
||||
|
||||
void RegisterFillBorder();
|
||||
};
|
||||
|
||||
@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record)
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
|
||||
nFirstColumn = GETBITS(flags, 0, 1);
|
||||
nLastColumn = GETBITS(flags, 1, 2);
|
||||
nRowStripes = GETBITS(flags, 3, 4);
|
||||
nColumnStripes = GETBITS(flags, 5, 6);
|
||||
nDefaultStyle = GETBITS(flags, 9, 10);
|
||||
fFirstColumn = GETBIT(flags, 0);
|
||||
fLastColumn = GETBIT(flags, 1);
|
||||
fRowStripes = GETBIT(flags, 2);
|
||||
fColumnStripes = GETBIT(flags, 3);
|
||||
fDefaultStyle = GETBIT(flags, 6);
|
||||
|
||||
record >> stListStyleName;
|
||||
}
|
||||
|
||||
@ -51,11 +51,11 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
unsigned char nFirstColumn;
|
||||
unsigned char nLastColumn;
|
||||
unsigned char nRowStripes;
|
||||
unsigned char nColumnStripes;
|
||||
unsigned char nDefaultStyle;
|
||||
bool fFirstColumn;
|
||||
bool fLastColumn;
|
||||
bool fRowStripes;
|
||||
bool fColumnStripes;
|
||||
bool fDefaultStyle;
|
||||
|
||||
XLUnicodeString stListStyleName;
|
||||
};
|
||||
|
||||
@ -37,24 +37,20 @@ namespace XLS
|
||||
{
|
||||
|
||||
|
||||
LongRGBA::LongRGBA()
|
||||
: is_alpha(true)
|
||||
LongRGBA::LongRGBA() : is_alpha(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LongRGBA::LongRGBA(const bool alpha_present)
|
||||
: is_alpha(alpha_present)
|
||||
LongRGBA::LongRGBA(const bool alpha_present) : is_alpha(alpha_present)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LongRGB::LongRGB()
|
||||
: LongRGBA(false)
|
||||
LongRGB::LongRGB() : LongRGBA(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BiffStructurePtr LongRGBA::clone()
|
||||
{
|
||||
return BiffStructurePtr(new LongRGBA(*this));
|
||||
@ -78,9 +74,14 @@ void LongRGBA::load(CFRecord& record)
|
||||
alpha = 0;
|
||||
record.skipNunBytes(1); // reserved
|
||||
}
|
||||
|
||||
strRGB = STR::toRGB (red, green, blue);
|
||||
strARGB = STR::toARGB(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
_UINT32 LongRGBA::ToRGBA()
|
||||
{
|
||||
return ((unsigned int)( ( (unsigned char)(red) )| ( ( (unsigned char)(green) ) << 8 ) | ( ( (unsigned char)(blue) ) << 16 ) | ( (unsigned char)(alpha) << 24 ) ) );
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -50,7 +50,6 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
@ -59,6 +58,8 @@ public:
|
||||
std::wstring strARGB;
|
||||
std::wstring strRGB;
|
||||
|
||||
_UINT32 ToRGBA();
|
||||
|
||||
bool is_alpha;
|
||||
};
|
||||
|
||||
|
||||
@ -94,7 +94,8 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
{
|
||||
_Name = field_db->stFieldName.value();
|
||||
|
||||
if (std::wstring::npos != _Name.find(L" "))
|
||||
if (std::wstring::npos != _Name.find(L" ") ||
|
||||
std::wstring::npos != _Name.find(L":"))
|
||||
{
|
||||
_Name = L"'" + _Name + L"'";
|
||||
}
|
||||
@ -104,7 +105,13 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
SXOPER* cache = dynamic_cast<SXOPER*>(field->m_arSRCSXOPER[pair->iCache].get());
|
||||
if (cache)
|
||||
{
|
||||
_Name += L"[" + cache->value + L"]";
|
||||
std::wstring value = cache->value;
|
||||
if (std::wstring::npos != value.find(L" ") ||
|
||||
std::wstring::npos != value.find(L":"))
|
||||
{
|
||||
value = L"'" + value + L"'";
|
||||
}
|
||||
_Name += L"[" + value + L"]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,23 +29,29 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
#include "StyleXF.h"
|
||||
#include "XFProps.h"
|
||||
#include "ExtProp.h"
|
||||
|
||||
#include <Binary/CFRecord.h>
|
||||
#include "XFProp.h"
|
||||
#include "ExtProp.h"
|
||||
#include "XFPropColor.h"
|
||||
#include "BitMarkedStructs.h"
|
||||
#include "XFPropBorder.h"
|
||||
#include "../Biff_records/Font.h"
|
||||
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
StyleXF::StyleXF(size_t& cell_xf_current_id, size_t& style_xf_current_id)
|
||||
: cell_xf_current_id_(cell_xf_current_id), style_xf_current_id_(style_xf_current_id), font_id(0xFFFF)
|
||||
StyleXF::StyleXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell_xf_current_id_(cell_xf_current_id),
|
||||
style_xf_current_id_(style_xf_current_id)
|
||||
{
|
||||
font_id = -1;
|
||||
font_id = 0xFFFF;
|
||||
border_x_id = -1;
|
||||
fill_x_id = -1;
|
||||
font = NULL;
|
||||
|
||||
fill.fls = 0;
|
||||
}
|
||||
@ -58,9 +64,9 @@ BiffStructurePtr StyleXF::clone()
|
||||
|
||||
void StyleXF::load(CFRecord& record)
|
||||
{
|
||||
m_GlobalWorkbookInfo = record.getGlobalWorkbookInfo();
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
|
||||
if (m_GlobalWorkbookInfo->Version < 0x0600)
|
||||
if (global_info->Version < 0x0600)
|
||||
{
|
||||
_UINT16 flags1;
|
||||
_UINT32 flags2;
|
||||
@ -146,86 +152,153 @@ void StyleXF::Update(ExtProp* ext_prop)
|
||||
{
|
||||
if (!ext_prop) return;
|
||||
|
||||
FillInfoExt color_out;
|
||||
|
||||
{
|
||||
color_out.enabled = true;
|
||||
color_out.icv = ext_prop->extPropData.color.icv;
|
||||
color_out.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
color_out.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
color_out.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}
|
||||
switch(ext_prop->extType)
|
||||
{
|
||||
case 0x0004:
|
||||
{
|
||||
fill.foreFillInfo_.enabled = true;
|
||||
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
fill.foreFillInfo_ = color_out;
|
||||
}break;
|
||||
case 0x0005:
|
||||
{
|
||||
fill.backFillInfo_.enabled = true;
|
||||
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
fill.backFillInfo_ = color_out;
|
||||
}break;
|
||||
case 0x0007:
|
||||
{
|
||||
border.topFillInfo_.enabled = true;
|
||||
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
border.topFillInfo_ = color_out;
|
||||
}break;
|
||||
case 0x0008:
|
||||
{
|
||||
border.bottomFillInfo_.enabled = true;
|
||||
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
border.bottomFillInfo_ = color_out;
|
||||
}break;
|
||||
case 0x0009:
|
||||
{
|
||||
border.leftFillInfo_.enabled = true;
|
||||
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
border.leftFillInfo_ = color_out;
|
||||
}break;
|
||||
case 0x000A:
|
||||
{
|
||||
border.rightFillInfo_.enabled = true;
|
||||
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
border.rightFillInfo_ = color_out;
|
||||
}break;
|
||||
//case 0x000B: //diag color
|
||||
//case 0x000C: //diag color
|
||||
case 0x000D:
|
||||
{
|
||||
font_color.enabled = true;
|
||||
font_color.icv = ext_prop->extPropData.color.icv;
|
||||
font_color.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
font_color = color_out;
|
||||
}break;
|
||||
//case 0x0006:
|
||||
// extPropData.gradient_fill.toXML(own_tag);
|
||||
// break;
|
||||
case 0x000E:
|
||||
{
|
||||
font_id = ext_prop->extPropData.font_scheme;
|
||||
font_id = ext_prop->extPropData.font_scheme;
|
||||
}break;
|
||||
case 0x000F:
|
||||
{
|
||||
cIndent = ext_prop->extPropData.indent_level;
|
||||
cIndent = ext_prop->extPropData.indent_level;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void StyleXF::Update(XFProps* xfProps)
|
||||
void StyleXF::Update(XFProp* xfProp)
|
||||
{
|
||||
if (!xfProps) return;
|
||||
if (!xfProp) return;
|
||||
|
||||
std::wstringstream strm;
|
||||
xfProps->serialize_fill(strm);
|
||||
fill.ext = strm.str();
|
||||
XFPropColor* color = dynamic_cast<XFPropColor*>(xfProp->xfPropDataBlob.get());
|
||||
if (color)
|
||||
{
|
||||
FillInfoExt color_out;
|
||||
|
||||
color_out.enabled = true;
|
||||
color_out.icv = color->icv;
|
||||
color_out.xclrType = color->xclrType;
|
||||
color_out.nTintShade = color->nTintShade;
|
||||
|
||||
if (color->xclrType == 3)color_out.xclrValue = color->icv;
|
||||
else color_out.xclrValue = color->dwRgba.ToRGBA();
|
||||
|
||||
switch(xfProp->xfPropType)
|
||||
{
|
||||
case 0x0001: fill.foreFillInfo_ = color_out; break;
|
||||
case 0x0002: fill.backFillInfo_ = color_out; break;
|
||||
case 0x0005: font_color = color_out; break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
BIFF_BYTE* byte_ = dynamic_cast<BIFF_BYTE*>(xfProp->xfPropDataBlob.get());
|
||||
|
||||
if (byte_)
|
||||
{
|
||||
switch(xfProp->xfPropType)
|
||||
{
|
||||
case 0x0025:
|
||||
{
|
||||
font_id = *byte_->value();
|
||||
if (font_id >=0 && font_id < global_info->m_arFonts.size())
|
||||
{
|
||||
font = dynamic_cast<Font*>(global_info->m_arFonts[font_id].get());
|
||||
}
|
||||
|
||||
}break;
|
||||
case 0x001C: if (font) font->fItalic = *byte_->value(); break;
|
||||
case 0x001D: if (font) font->fStrikeOut = *byte_->value(); break;
|
||||
case 0x001E: if (font) font->fOutline = *byte_->value(); break;
|
||||
case 0x001F: if (font) font->fShadow = *byte_->value(); break;
|
||||
case 0x0022: if (font) font->bCharSet = *byte_->value(); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(xfProp->xfPropDataBlob.get());
|
||||
|
||||
if (word)
|
||||
{
|
||||
switch(xfProp->xfPropType)
|
||||
{
|
||||
case 0x0019: if (font) font->bls = *word->value(); break;
|
||||
case 0x001A: if (font) font->uls = *word->value(); break;
|
||||
case 0x001B: if (font) font->sss = *word->value(); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
BIFF_DWORD* dword = dynamic_cast<BIFF_DWORD*>(xfProp->xfPropDataBlob.get());
|
||||
|
||||
if (dword)
|
||||
{
|
||||
switch(xfProp->xfPropType)
|
||||
{
|
||||
case 0x0024: if (font) font->dyHeight = *dword->value(); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
XFPropBorder *brdr = dynamic_cast<XFPropBorder*>(xfProp->xfPropDataBlob.get());
|
||||
if (brdr)
|
||||
{
|
||||
FillInfoExt color_out;
|
||||
|
||||
color_out.enabled = true;
|
||||
color_out.icv = brdr->color.icv;
|
||||
color_out.xclrType = brdr->color.xclrType;
|
||||
color_out.nTintShade = brdr->color.nTintShade;
|
||||
|
||||
if (brdr->color.xclrType == 3) color_out.xclrValue = brdr->color.icv;
|
||||
else color_out.xclrValue = brdr->color.dwRgba.ToRGBA();
|
||||
|
||||
switch(xfProp->xfPropType)
|
||||
{
|
||||
case 0x0006: border.topFillInfo_ = color_out; break;
|
||||
case 0x0007: border.bottomFillInfo_ = color_out; break;
|
||||
case 0x0008: border.leftFillInfo_ = color_out; break;
|
||||
case 0x0009: border.rightFillInfo_ = color_out; break;
|
||||
//horiz, vert, diag
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
void StyleXF::RegisterFillBorder()
|
||||
{
|
||||
@ -234,9 +307,15 @@ void StyleXF::RegisterFillBorder()
|
||||
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
|
||||
Update (ext_prop);
|
||||
}
|
||||
|
||||
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border);
|
||||
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill);
|
||||
for (size_t i = 0; i < xf_props.size(); i++ )
|
||||
{
|
||||
XFProp* xf_prop = dynamic_cast<XFProp*>(xf_props[i].get());
|
||||
Update (xf_prop);
|
||||
}
|
||||
border_x_id = global_info->RegisterBorderId(border);
|
||||
fill_x_id = global_info->RegisterFillId(fill);
|
||||
|
||||
global_info->RegisterFontColorId(font_id, font_color);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -36,9 +36,10 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class XFProps;
|
||||
class XFProp;
|
||||
class ExtProp;
|
||||
class CFRecord;
|
||||
class Font;
|
||||
|
||||
class GlobalWorkbookInfo;
|
||||
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
|
||||
@ -52,17 +53,10 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
GlobalWorkbookInfoPtr m_GlobalWorkbookInfo;
|
||||
|
||||
static const ElementType type = typeStyleXF;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
void Update(ExtProp* extProp); // xls style
|
||||
void Update(XFProps* xfProps); //xlsx style
|
||||
|
||||
void RegisterFillBorder();
|
||||
|
||||
unsigned char alc;
|
||||
bool fWrap;
|
||||
unsigned char alcV;
|
||||
@ -72,13 +66,22 @@ public:
|
||||
bool fShrinkToFit;
|
||||
unsigned char iReadOrder;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
|
||||
BorderInfo border;
|
||||
FillInfo fill;
|
||||
|
||||
FillInfoExt font_color;
|
||||
size_t font_id;
|
||||
Font *font;
|
||||
|
||||
BiffStructurePtrVector ext_props;
|
||||
BiffStructurePtrVector xf_props;
|
||||
|
||||
void Update(ExtProp* extProp); // xls style
|
||||
void Update(XFProp* xfProp); //xlsx style
|
||||
|
||||
void RegisterFillBorder();
|
||||
|
||||
size_t border_x_id;
|
||||
size_t fill_x_id;
|
||||
|
||||
@ -29,16 +29,15 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
#include "XFProp.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
#include "XFPropColor.h"
|
||||
#include "XFPropGradient.h"
|
||||
#include "XFPropGradientStop.h"
|
||||
#include "XFPropBorder.h"
|
||||
#include "BiffString.h"
|
||||
|
||||
#include <Logic/Biff_structures/BitMarkedStructs.h>
|
||||
#include "BitMarkedStructs.h"
|
||||
|
||||
#include <utils.h>
|
||||
|
||||
@ -145,8 +144,7 @@ static void serialize_color_prop(std::wostream & stream, const std::wstring & na
|
||||
XFPropColor * color = dynamic_cast<XFPropColor*>(val.get());
|
||||
if (!color) return;
|
||||
|
||||
color->node_name = name;
|
||||
color->serialize(stream);
|
||||
color->serialize(stream, name);
|
||||
}
|
||||
|
||||
static void serialize_val_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val)
|
||||
@ -218,7 +216,7 @@ static void serialize_border_prop(std::wostream & stream, const std::wstring & n
|
||||
}
|
||||
if (border->dgBorder != 0)
|
||||
{
|
||||
border->color.serialize(CP_XML_STREAM());
|
||||
border->color.serialize(CP_XML_STREAM(), L"color");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include <Logic/Biff_structures/FullColorExt.h>
|
||||
#include <Logic/Biff_structures/XFExtGradient.h>
|
||||
#include "FullColorExt.h"
|
||||
|
||||
#include <simple_xml_writer.h>
|
||||
|
||||
@ -59,5 +58,6 @@ public:
|
||||
unsigned short cb;
|
||||
BiffStructurePtr xfPropDataBlob;
|
||||
};
|
||||
typedef boost::shared_ptr<XFProp> XFPropPtr;
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
XFPropColor color;
|
||||
unsigned short dgBorder;
|
||||
};
|
||||
|
||||
@ -47,8 +47,6 @@ BiffStructurePtr XFPropColor::clone()
|
||||
|
||||
void XFPropColor::load(CFRecord& record)
|
||||
{
|
||||
node_name = L"color";
|
||||
|
||||
unsigned char flags;
|
||||
record >> flags;
|
||||
|
||||
@ -58,7 +56,7 @@ void XFPropColor::load(CFRecord& record)
|
||||
record >> icv >> nTintShade >> dwRgba;
|
||||
}
|
||||
|
||||
int XFPropColor::serialize(std::wostream & stream)
|
||||
int XFPropColor::serialize(std::wostream & stream, const std::wstring &node_name)
|
||||
{
|
||||
if (xclrType > 3 )return 0;//not set
|
||||
|
||||
@ -68,11 +66,11 @@ int XFPropColor::serialize(std::wostream & stream)
|
||||
{
|
||||
switch(xclrType)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"auto", 1); break;
|
||||
case 1: CP_XML_ATTR(L"indexed", icv); break;
|
||||
case 2:
|
||||
case 3: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
|
||||
//CP_XML_ATTR(L"theme", icv); break;
|
||||
case 0: CP_XML_ATTR(L"auto", 1); break;
|
||||
case 1: CP_XML_ATTR(L"indexed", icv); break;
|
||||
case 3: CP_XML_ATTR(L"theme", icv); break;
|
||||
default:
|
||||
CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
|
||||
}
|
||||
if (nTintShade != 0)
|
||||
{
|
||||
|
||||
@ -47,10 +47,9 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
static const ElementType type = typeXFPropColor;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
int serialize(std::wostream & stream, const std::wstring &sNode);
|
||||
|
||||
bool fValidRGBA;
|
||||
unsigned char xclrType;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include "XFPropGradientStop.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
#include <simple_xml_writer.h>
|
||||
|
||||
namespace XLS
|
||||
@ -59,7 +58,7 @@ int XFPropGradientStop::serialize(std::wostream & stream)
|
||||
CP_XML_NODE(L"stop")
|
||||
{
|
||||
CP_XML_ATTR(L"position", numPosition);
|
||||
color.serialize(CP_XML_STREAM());
|
||||
color.serialize(CP_XML_STREAM(), L"color");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -29,10 +29,15 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
#include "XFProps.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
#include <Logic/Biff_structures/BitMarkedStructs.h>
|
||||
#include "XFProp.h"
|
||||
#include "XFPropColor.h"
|
||||
#include "XFPropGradient.h"
|
||||
#include "XFPropGradientStop.h"
|
||||
|
||||
#include "BitMarkedStructs.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -43,8 +48,6 @@ BiffStructurePtr XFProps::clone()
|
||||
return BiffStructurePtr(new XFProps(*this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void XFProps::load(CFRecord& record)
|
||||
{
|
||||
arXFPropBorder.is_present = false;
|
||||
@ -54,21 +57,24 @@ void XFProps::load(CFRecord& record)
|
||||
|
||||
for(int i = 0; i < cprops; ++i)
|
||||
{
|
||||
XFProp prop;
|
||||
record >> prop;
|
||||
XFPropPtr prop(new XFProp);
|
||||
if (!prop) continue;
|
||||
|
||||
if (prop.xfPropType >= 0 && prop.xfPropType <= 3)
|
||||
prop->load(record);
|
||||
rgExt.push_back(prop);
|
||||
|
||||
if (prop->xfPropType >= 0 && prop->xfPropType <= 3)
|
||||
{
|
||||
arXFPropFill.push_back(prop);
|
||||
}
|
||||
else if (prop.xfPropType == 4)
|
||||
else if (prop->xfPropType == 4)
|
||||
{
|
||||
arXFPropGradient.push_back(prop);
|
||||
}
|
||||
else if (prop.xfPropType >= 6 && prop.xfPropType <= 14)
|
||||
else if (prop->xfPropType >= 6 && prop->xfPropType <= 14)
|
||||
{
|
||||
arXFPropBorder.is_present = true;
|
||||
switch(prop.xfPropType)
|
||||
switch(prop->xfPropType)
|
||||
{
|
||||
case 6: arXFPropBorder.top = prop; break;
|
||||
case 7: arXFPropBorder.bottom = prop; break;
|
||||
@ -78,20 +84,20 @@ void XFProps::load(CFRecord& record)
|
||||
arXFPropBorder.other.push_back(prop);
|
||||
}
|
||||
}
|
||||
else if (prop.xfPropType >= 15 && prop.xfPropType <= 22 || prop.xfPropType == 42)
|
||||
else if (prop->xfPropType >= 15 && prop->xfPropType <= 22 || prop->xfPropType == 42)
|
||||
{
|
||||
arXFPropAlignment.push_back(prop);
|
||||
}
|
||||
else if (prop.xfPropType >= 24 && prop.xfPropType <= 37 || prop.xfPropType == 5)
|
||||
else if (prop->xfPropType >= 24 && prop->xfPropType <= 37 || prop->xfPropType == 5)
|
||||
{
|
||||
arXFPropFont.push_back(prop);
|
||||
}
|
||||
else if (prop.xfPropType >= 38 && prop.xfPropType <= 41)
|
||||
else if (prop->xfPropType >= 38 && prop->xfPropType <= 41)
|
||||
{
|
||||
bool skip_codes = false;
|
||||
if (prop.xfPropType == 0x0029)
|
||||
if (prop->xfPropType == 0x0029)
|
||||
{
|
||||
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(prop.xfPropDataBlob.get());
|
||||
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(prop->xfPropDataBlob.get());
|
||||
if ((word) && (word->value() == (_UINT16)30))
|
||||
{
|
||||
skip_codes = true;
|
||||
@ -101,7 +107,7 @@ void XFProps::load(CFRecord& record)
|
||||
if (!skip_codes)
|
||||
arXFPropNumFmt.push_back(prop);
|
||||
}
|
||||
else if (prop.xfPropType >= 43 && prop.xfPropType <= 44)
|
||||
else if (prop->xfPropType >= 43 && prop->xfPropType <= 44)
|
||||
{
|
||||
arXFPropProtection.push_back(prop);
|
||||
}
|
||||
@ -115,23 +121,23 @@ int XFProps::serialize_fill(std::wostream & stream)
|
||||
{
|
||||
if (arXFPropFill.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
XFProp *pPatternType = NULL;
|
||||
XFPropGradient *pGradient = NULL;
|
||||
|
||||
for (size_t i = 0; i < arXFPropFill.size(); i++)
|
||||
XFProp *pPatternType = NULL;
|
||||
XFPropGradient *pGradient = NULL;
|
||||
|
||||
for (size_t i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
switch(arXFPropFill[i]->xfPropType)
|
||||
{
|
||||
switch(arXFPropFill[i].xfPropType)
|
||||
{
|
||||
case 1:
|
||||
case 0: pPatternType = &arXFPropFill[i]; break;
|
||||
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
|
||||
}
|
||||
case 0: pPatternType = arXFPropFill[i].get(); break;
|
||||
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i]->xfPropDataBlob.get()); break;
|
||||
}
|
||||
|
||||
}
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"fill")
|
||||
{
|
||||
if (pGradient || arXFPropGradient.size() > 0)
|
||||
{
|
||||
if (pGradient || arXFPropGradient.size() > 0)
|
||||
{
|
||||
CP_XML_NODE(L"gradientFill")
|
||||
{
|
||||
@ -140,26 +146,37 @@ int XFProps::serialize_fill(std::wostream & stream)
|
||||
|
||||
for (size_t i = 0 ; i < arXFPropGradient.size(); i++)
|
||||
{
|
||||
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue;
|
||||
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM());
|
||||
if (arXFPropGradient[i]->xfPropDataBlob == NULL) continue;
|
||||
arXFPropGradient[i]->xfPropDataBlob->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pPatternType)
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"patternFill")
|
||||
{
|
||||
pPatternType->serialize_attr(CP_GET_XML_NODE());
|
||||
|
||||
if (pPatternType)
|
||||
{
|
||||
pPatternType->serialize_attr(CP_GET_XML_NODE());
|
||||
}
|
||||
for (size_t i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
arXFPropFill[i].serialize(CP_XML_STREAM());
|
||||
XFPropColor *pColor = dynamic_cast<XFPropColor*>(arXFPropFill[i]->xfPropDataBlob.get());
|
||||
if (!pColor) continue;
|
||||
|
||||
std::wstring sNode = L"color";
|
||||
switch(arXFPropFill[i]->xfPropType)
|
||||
{
|
||||
case 1: sNode = L"fgColor"; break;
|
||||
case 2: sNode = L"bgColor"; break;
|
||||
}
|
||||
|
||||
pColor->serialize(CP_XML_STREAM(), sNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -173,7 +190,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
|
||||
{
|
||||
for (size_t i = 0; i < arXFPropFont.size(); i++)
|
||||
{
|
||||
arXFPropFont[i].serialize(CP_XML_STREAM());
|
||||
arXFPropFont[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -185,11 +202,11 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
|
||||
{
|
||||
if (dxf)
|
||||
{
|
||||
arXFPropNumFmt[i].serialize_attr(CP_GET_XML_NODE());
|
||||
arXFPropNumFmt[i]->serialize_attr(CP_GET_XML_NODE());
|
||||
}
|
||||
else
|
||||
{
|
||||
arXFPropNumFmt[i].serialize(CP_XML_STREAM());
|
||||
arXFPropNumFmt[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +219,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
|
||||
{
|
||||
for (size_t i = 0; i < arXFPropAlignment.size(); i++)
|
||||
{
|
||||
arXFPropAlignment[i].serialize(CP_XML_STREAM());
|
||||
arXFPropAlignment[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -219,7 +236,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
|
||||
//----------------------------------------
|
||||
for (size_t i = 0; i < arXFPropBorder.other.size(); i++)
|
||||
{
|
||||
arXFPropBorder.other[i].serialize(CP_XML_STREAM());
|
||||
arXFPropBorder.other[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,11 +32,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "XFProp.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class XFProp;
|
||||
typedef boost::shared_ptr<XFProp> XFPropPtr;
|
||||
|
||||
class CFRecord;
|
||||
|
||||
class XFProps : public BiffStructure
|
||||
@ -56,27 +58,31 @@ public:
|
||||
|
||||
int serialize_fill(std::wostream & stream);
|
||||
|
||||
std::vector<XFProp> arXFPropFont;
|
||||
std::vector<XFProp> arXFPropNumFmt;
|
||||
std::vector<XFProp> arXFPropFill;
|
||||
std::vector<XFProp> arXFPropAlignment;
|
||||
std::vector<XFPropPtr> arXFPropFont;
|
||||
std::vector<XFPropPtr> arXFPropNumFmt;
|
||||
std::vector<XFPropPtr> arXFPropFill;
|
||||
std::vector<XFPropPtr> arXFPropAlignment;
|
||||
|
||||
struct _b
|
||||
{
|
||||
bool is_present;
|
||||
bool is_present = false;
|
||||
|
||||
_CP_OPT(XFProp) left;
|
||||
_CP_OPT(XFProp) right;
|
||||
_CP_OPT(XFProp) top;
|
||||
_CP_OPT(XFProp) bottom;
|
||||
std::vector<XFProp> other;
|
||||
XFPropPtr left;
|
||||
XFPropPtr right;
|
||||
XFPropPtr top;
|
||||
XFPropPtr bottom;
|
||||
|
||||
std::vector<XFPropPtr> other;
|
||||
}arXFPropBorder;
|
||||
|
||||
std::vector<XFProp> arXFPropProtection;
|
||||
std::vector<XFProp> arXFPropGradient;
|
||||
std::vector<XFPropPtr> arXFPropProtection;
|
||||
std::vector<XFPropPtr> arXFPropGradient;
|
||||
|
||||
//-----------------------------------------------------
|
||||
BiffStructurePtrVector rgExt;
|
||||
|
||||
bool fNewBorder;
|
||||
bool bPresent;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -150,16 +150,15 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream)
|
||||
int XLUnicodeRichExtendedString::serialize_rPr (std::wostream & _stream, int iFmt)
|
||||
{
|
||||
if (!pGlobalWorkbookInfoPtr) return 0;
|
||||
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
|
||||
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size();
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
|
||||
if (iFmt -1 > sz || iFmt < 1) return 0;
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
CP_XML_NODE(L"rPr")
|
||||
{
|
||||
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get());
|
||||
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts[iFmt-1].get());
|
||||
|
||||
if (font) font->serialize_properties(CP_XML_STREAM(), true);
|
||||
}
|
||||
|
||||
@ -347,12 +347,11 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition)
|
||||
int ATTACHEDLABEL::serialize_rPr (std::wostream & _stream, int iFmt, bool rtl, bool defRPr)
|
||||
{
|
||||
if (!pGlobalWorkbookInfoPtr) return 0;
|
||||
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
|
||||
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size();
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
|
||||
if (iFmt -1 > sz || iFmt < 1) return 0;
|
||||
|
||||
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get());
|
||||
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts[iFmt-1].get());
|
||||
|
||||
Text * text_props = dynamic_cast<Text*>(m_TextProperties.get());
|
||||
|
||||
|
||||
@ -259,14 +259,13 @@ int AXS::serialize(std::wostream & _stream)
|
||||
|
||||
int AXS::serialize_rPr (std::wostream & _stream, int iFmt, _CP_OPT(unsigned int) color, bool rtl, bool defRPr)
|
||||
{
|
||||
if (!pGlobalWorkbookInfoPtr) return 0;
|
||||
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
|
||||
if (!pGlobalWorkbookInfoPtr) return 0;
|
||||
|
||||
Font * font = NULL;
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size();
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
|
||||
|
||||
if (iFmt > 0 && iFmt <= sz)
|
||||
font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get());
|
||||
font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts.at(iFmt-1).get());
|
||||
|
||||
if (font)
|
||||
{
|
||||
|
||||
@ -31,6 +31,12 @@
|
||||
*/
|
||||
|
||||
#include "CRT.h"
|
||||
#include "LD.h"
|
||||
#include "DROPBAR.h"
|
||||
#include "SS.h"
|
||||
#include "SHAPEPROPS.h"
|
||||
#include "DFTTEXT.h"
|
||||
|
||||
#include "../Biff_records/ChartFormat.h"
|
||||
#include "../Biff_records/Begin.h"
|
||||
#include "../Biff_records/Bar.h"
|
||||
@ -46,14 +52,9 @@
|
||||
#include "../Biff_records/CrtLink.h"
|
||||
#include "../Biff_records/SeriesList.h"
|
||||
#include "../Biff_records/Chart3d.h"
|
||||
#include "../Biff_unions/LD.h"
|
||||
#include "../Biff_unions/DROPBAR.h"
|
||||
#include "../Biff_records/CrtLine.h"
|
||||
#include "../Biff_records/LineFormat.h"
|
||||
#include "../Biff_unions/DFTTEXT.h"
|
||||
#include "../Biff_records/DataLabExtContents.h"
|
||||
#include "../Biff_unions/SS.h"
|
||||
#include "../Biff_unions/SHAPEPROPS.h"
|
||||
#include "../Biff_records/End.h"
|
||||
#include "../Biff_records/ValueRange.h"
|
||||
#include "../Biff_records/Tick.h"
|
||||
@ -65,6 +66,7 @@
|
||||
#include "../Biff_records/PlotArea.h"
|
||||
#include "../Biff_records/DropBar.h"
|
||||
#include "../Biff_records/CrtMlFrt.h"
|
||||
#include "../Biff_records/DataFormat.h"
|
||||
|
||||
#include "../Biff_records/StartObject.h"
|
||||
#include "../Biff_records/EndObject.h"
|
||||
|
||||
@ -76,11 +76,16 @@ const bool DFTTEXT::loadContent(BinProcessor& proc)
|
||||
m_DefaultText = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
if (proc.optional<DataLabExtContents>())
|
||||
{
|
||||
m_DataLabExtContents = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
if (!m_DefaultText && !m_DataLabExtContents)
|
||||
return false;
|
||||
|
||||
if (proc.mandatory<ATTACHEDLABEL>())
|
||||
{
|
||||
m_ATTACHEDLABEL = elements_.back();
|
||||
@ -89,10 +94,7 @@ const bool DFTTEXT::loadContent(BinProcessor& proc)
|
||||
|
||||
if (proc.optional<EndObject>()) elements_.pop_back();
|
||||
|
||||
if (m_DefaultText || m_DataLabExtContents)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DROPBAR union of records
|
||||
class DROPBAR: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(DROPBAR)
|
||||
|
||||
@ -31,15 +31,17 @@
|
||||
*/
|
||||
|
||||
#include "DROPBAR.h"
|
||||
#include <Logic/Biff_records/DropBar.h>
|
||||
#include <Logic/Biff_records/Begin.h>
|
||||
#include <Logic/Biff_records/LineFormat.h>
|
||||
#include <Logic/Biff_records/AreaFormat.h>
|
||||
#include <Logic/Biff_unions/GELFRAME.h>
|
||||
#include <Logic/Biff_unions/SHAPEPROPS.h>
|
||||
#include <Logic/Biff_records/End.h>
|
||||
#include <Logic/Biff_records/StartObject.h>
|
||||
#include <Logic/Biff_records/EndObject.h>
|
||||
#include "GELFRAME.h"
|
||||
#include "SHAPEPROPS.h"
|
||||
|
||||
#include "../Biff_records/DropBar.h"
|
||||
#include "../Biff_records/LineFormat.h"
|
||||
#include "../Biff_records/AreaFormat.h"
|
||||
|
||||
#include "../Biff_records/Begin.h"
|
||||
#include "../Biff_records/End.h"
|
||||
#include "../Biff_records/StartObject.h"
|
||||
#include "../Biff_records/EndObject.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -72,7 +74,7 @@ const bool DROPBAR::loadContent(BinProcessor& proc)
|
||||
|
||||
if (proc.mandatory<Begin>()) elements_.pop_back();
|
||||
|
||||
if (proc.mandatory<LineFormat>())
|
||||
if (proc.optional<LineFormat>())
|
||||
{
|
||||
m_LineFormat = elements_.back(); elements_.pop_back();
|
||||
}
|
||||
@ -81,11 +83,10 @@ const bool DROPBAR::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
if (proc.mandatory<EndObject>()) elements_.pop_back();
|
||||
}
|
||||
if (proc.mandatory<AreaFormat>())
|
||||
if (proc.optional<AreaFormat>())
|
||||
{
|
||||
m_AreaFormat = elements_.back(); elements_.pop_back();
|
||||
}
|
||||
|
||||
if (proc.optional<GELFRAME>())
|
||||
{
|
||||
m_GELFRAME = elements_.back(); elements_.pop_back();
|
||||
|
||||
@ -276,6 +276,9 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
|
||||
CP_XML_ATTR(L"id", field->idField);
|
||||
CP_XML_ATTR(L"name", field->strCaption.value());
|
||||
|
||||
if (!field->strTotal.value().empty())
|
||||
CP_XML_ATTR(L"totalsRowLabel", field->strTotal.value());
|
||||
|
||||
if (field->dxfFmtAgg.bExist ||
|
||||
field->dxfFmtInsertRow.bExist)
|
||||
{
|
||||
@ -294,11 +297,11 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
|
||||
{
|
||||
CP_XML_NODE(L"tableStyleInfo")
|
||||
{
|
||||
CP_XML_ATTR(L"name", table_style->stListStyleName.value());
|
||||
CP_XML_ATTR(L"showFirstColumn", table_style->nFirstColumn);
|
||||
CP_XML_ATTR(L"showLastColumn", table_style->nLastColumn);
|
||||
CP_XML_ATTR(L"showRowStripes", table_style->nRowStripes);
|
||||
CP_XML_ATTR(L"showColumnStripes", table_style->nColumnStripes);
|
||||
CP_XML_ATTR(L"name", table_style->stListStyleName.value());
|
||||
CP_XML_ATTR(L"showFirstColumn", table_style->fFirstColumn);
|
||||
CP_XML_ATTR(L"showLastColumn", table_style->fLastColumn);
|
||||
CP_XML_ATTR(L"showRowStripes", table_style->fRowStripes);
|
||||
CP_XML_ATTR(L"showColumnStripes", table_style->fColumnStripes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
|
||||
Font *font = dynamic_cast<Font *>(elements_.front().get());
|
||||
if ((font) && (font->correct))
|
||||
{
|
||||
m_arFonts.push_back(elements_.front());
|
||||
global_info->m_arFonts.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front();
|
||||
count--;
|
||||
@ -94,10 +94,10 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally Font follows by Format)
|
||||
int countFonts = m_arFonts.size();
|
||||
int countFonts = global_info->m_arFonts.size();
|
||||
while(count > 0)
|
||||
{
|
||||
m_arFonts.insert(m_arFonts.begin()+countFonts, elements_.back());
|
||||
global_info->m_arFonts.insert(global_info->m_arFonts.begin() + countFonts, elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
@ -156,40 +156,40 @@ void FORMATTING::update_xfs()
|
||||
|
||||
if (!xfs) return;
|
||||
|
||||
//for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
|
||||
//{
|
||||
// XLS::Style * style = dynamic_cast<Style*>(st->m_arStyles[i].first.get());
|
||||
// XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(st->m_arStyles[i].second.get());
|
||||
//
|
||||
// if (styleExt && style)
|
||||
// {
|
||||
// if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
|
||||
// {
|
||||
// bool bFound = false;
|
||||
// for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
|
||||
// {
|
||||
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
|
||||
for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
|
||||
{
|
||||
XLS::Style *style = dynamic_cast<Style*> (st->m_arStyles[i].first.get());
|
||||
XLS::StyleExt *styleExt = dynamic_cast<StyleExt*> (st->m_arStyles[i].second.get());
|
||||
|
||||
if (styleExt && style)
|
||||
{
|
||||
if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
|
||||
{
|
||||
bool bFound = false;
|
||||
for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
|
||||
{
|
||||
XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
|
||||
|
||||
// if (xf->ind_xf == style->ixfe)
|
||||
// {
|
||||
// xf->style.Update(&styleExt->xfProps);
|
||||
// bFound = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++)
|
||||
// //{
|
||||
// // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
|
||||
// // if (xf->ind_xf == style->ixfe)
|
||||
// // {
|
||||
// // xf->cell.Update(&styleExt->xfProps);
|
||||
// // bFound = true;
|
||||
// // break;
|
||||
// // }
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (xf->ind_xf == style->ixfe)
|
||||
{
|
||||
xf->style.xf_props = styleExt->xfProps.rgExt;
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++) небывает совпадений
|
||||
//{
|
||||
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
|
||||
// if (xf->ind_xf == style->ixfe)
|
||||
// {
|
||||
// xf->cell.xf_props = styleExt->xfProps.rgExt;
|
||||
// bFound = true;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
xfs->RegisterFillBorder();
|
||||
}
|
||||
void FORMATTING::concatinate(FORMATTING* ext)
|
||||
@ -234,20 +234,23 @@ int FORMATTING::serialize1(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_arFonts.size() > 0)
|
||||
if (!global_info->m_arFonts.empty())
|
||||
{
|
||||
CP_XML_NODE(L"fonts")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arFonts.size());
|
||||
for (size_t i = 0 ; i < m_arFonts.size(); i++)
|
||||
CP_XML_ATTR(L"count", global_info->m_arFonts.size());
|
||||
|
||||
for (size_t i = 0; i < global_info->m_arFonts.size(); i++)
|
||||
{
|
||||
Font * font = dynamic_cast<Font*>(m_arFonts[i].get());
|
||||
Font * font = dynamic_cast<Font*>(global_info->m_arFonts[i].get());
|
||||
|
||||
std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i);
|
||||
if (font && (it!=global_info->fonts_color_ext.end()))
|
||||
|
||||
if (font && (it != global_info->fonts_color_ext.end()))
|
||||
{
|
||||
font->set_color_ext(it->second);
|
||||
}
|
||||
m_arFonts[i]->serialize(CP_XML_STREAM());
|
||||
global_info->m_arFonts[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
BaseObjectPtr m_Styles;
|
||||
BaseObjectPtr m_XFS;
|
||||
std::vector<BaseObjectPtr> m_arFormats;
|
||||
std::vector<BaseObjectPtr> m_arFonts;
|
||||
//std::vector<BaseObjectPtr> m_arFonts; in global
|
||||
BaseObjectPtr m_Palette;
|
||||
BaseObjectPtr m_ClrtClient;
|
||||
std::vector<BaseObjectPtr> m_arDXF;
|
||||
|
||||
@ -31,16 +31,17 @@
|
||||
*/
|
||||
|
||||
#include "FORMULA.h"
|
||||
#include <Logic/Biff_records/Uncalced.h>
|
||||
#include <Logic/Biff_records/Formula.h>
|
||||
#include <Logic/Biff_records/Array.h>
|
||||
#include <Logic/Biff_records/Table.h>
|
||||
#include <Logic/Biff_records/ShrFmla.h>
|
||||
#include <Logic/Biff_unions/SUB.h>
|
||||
#include <Logic/Biff_records/String.h>
|
||||
#include <Logic/Biff_records/Continue.h>
|
||||
#include "../Biff_records/Uncalced.h"
|
||||
#include "../Biff_records/Formula.h"
|
||||
#include "../Biff_records/Array.h"
|
||||
#include "../Biff_records/Table.h"
|
||||
#include "../Biff_records/ShrFmla.h"
|
||||
#include "../Biff_unions/SUB.h"
|
||||
#include "../Biff_records/String.h"
|
||||
#include "../Biff_records/Continue.h"
|
||||
|
||||
#include <utils.h>
|
||||
#include "../../../../source/Common/utils.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -105,14 +106,18 @@ const bool FORMULA::loadContent(BinProcessor& proc)
|
||||
m_sharedIndex = shared_formulas_locations_ref_.size();
|
||||
shared_formulas_locations_ref_.push_back(shr_formula.ref_);
|
||||
}
|
||||
//proc.optional<SUB>();
|
||||
else
|
||||
{
|
||||
//proc.optional<SUB>();
|
||||
}
|
||||
}
|
||||
|
||||
if ((formula) && (formula->fShrFmla))
|
||||
{
|
||||
for (size_t i = 0; i < shared_formulas_locations_ref_.size(); i++)
|
||||
{
|
||||
if (shared_formulas_locations_ref_[i].inRange(location)) m_sharedIndex = i;
|
||||
if (shared_formulas_locations_ref_[i].inRange(location))
|
||||
m_sharedIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,21 +213,20 @@ int FORMULA::serialize(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
|
||||
//if (formula_cash.empty())
|
||||
//{ todooo неверно читается - general_formulas.xls
|
||||
// if (m_Cash)
|
||||
//
|
||||
// String * str = dynamic_cast<String*>(m_Cash.get());
|
||||
// if (str)
|
||||
// formula_cash =str->string.value();
|
||||
// }
|
||||
//}
|
||||
if (formula_cash.empty() && m_Cash)
|
||||
{
|
||||
String * str = dynamic_cast<String*>(m_Cash.get());
|
||||
if (str)
|
||||
{
|
||||
formula_cash =str->string.value();
|
||||
}
|
||||
}
|
||||
|
||||
if (!formula_cash.empty())
|
||||
{
|
||||
CP_XML_NODE(L"v")
|
||||
{
|
||||
CP_XML_STREAM() << xml::utils::replace_text_to_xml(formula_cash);
|
||||
CP_XML_STREAM() << XmlUtils::EncodeXmlString(formula_cash, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,8 @@ void SXFMLA::serialize_attr(CP_ATTR_NODE)
|
||||
|
||||
global_info->arPivotSxNames = m_arPivotSxNames;
|
||||
|
||||
CP_XML_ATTR(L"formula", sx_fmla->fmla.getAssembledFormula());
|
||||
std::wstring fmla = sx_fmla->fmla.getAssembledFormula();
|
||||
CP_XML_ATTR(L"formula", fmla);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -586,7 +586,7 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
|
||||
|
||||
if (ax_parent->iax == 0) //primary axes
|
||||
{
|
||||
for (int i = 0 ; i < parent->m_arCRT.size() ; i++)
|
||||
for (size_t i = 0 ; i < parent->m_arCRT.size() ; i++)
|
||||
{
|
||||
CRT* crt = dynamic_cast<CRT*>(parent->m_arCRT[i].get());
|
||||
if((crt) && (crt->m_Chart3d))
|
||||
|
||||
@ -94,8 +94,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
return std::pair<float, float>(width, maxHeight);
|
||||
}
|
||||
|
||||
GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConverter * xls_converter_)
|
||||
: CodePage(code_page)
|
||||
GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConverter * converter) : CodePage(code_page), xls_converter(converter)
|
||||
{
|
||||
fill_x_ids[FillInfo(0, 0, 0)] = 0;
|
||||
fill_x_ids[FillInfo(17, 64, 65)] = 1;
|
||||
@ -105,8 +104,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
|
||||
|
||||
Version = 0x0600;
|
||||
|
||||
xls_converter = xls_converter_;
|
||||
|
||||
startAddedSharedStrings = 0;
|
||||
current_sheet = 0;
|
||||
cmt_rules = 0;
|
||||
@ -122,6 +119,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
|
||||
|
||||
bVbaProjectExist = false;
|
||||
bMacrosExist = false;
|
||||
bThemePresent = false;
|
||||
|
||||
idPivotCache = 0;
|
||||
}
|
||||
@ -188,9 +186,9 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels()
|
||||
}
|
||||
|
||||
defaultDigitFontSize = std::pair<float, float>(7,8);
|
||||
if (m_arFonts->size() < 1) return;
|
||||
if (m_arFonts.empty()) return;
|
||||
|
||||
Font * font = dynamic_cast<Font*>(m_arFonts->at(0).get());
|
||||
Font * font = dynamic_cast<Font*>(m_arFonts[0].get());
|
||||
if (!font) return;
|
||||
|
||||
std::wstring fontName = font->fontName.value();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user