mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-17 13:25:58 +08:00
Compare commits
95 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 58f8d13d71 | |||
| d6413057e2 | |||
| 008382213b | |||
| dd5b4a719b | |||
| 3d198bc211 | |||
| 05ff75eeb2 | |||
| 597414ea6b | |||
| 7f06ce7064 | |||
| adf39680b6 | |||
| ce77d478e3 | |||
| e1e14ae243 | |||
| 4f6e364225 | |||
| 26c02c5766 | |||
| 0d8c668f95 | |||
| 310cff0dfe | |||
| 7f6611ab21 | |||
| bb37e348f5 | |||
| 6b5e03df5e | |||
| d0e0109560 | |||
| dc33f7f197 | |||
| 85f4aa5679 | |||
| d2c5ea026f | |||
| 419ec7ed33 | |||
| 5f7d9eea02 | |||
| 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 | |||
| d293769c1f | |||
| b45e772a50 | |||
| fdb7716abc | |||
| f72d6dfe0e | |||
| 23029a6a92 | |||
| eda8e4d13f | |||
| 64f578e59f | |||
| 16c57b50cc | |||
| 83c0ba9dab | |||
| a2443dadeb | |||
| 789bb1d4b3 | |||
| 4138ae5ce2 | |||
| 239b5dbf11 | |||
| c046776b9c | |||
| 055a02570b | |||
| e7bbbec0de | |||
| 1e2e5996f3 | |||
| 875717acd4 | |||
| 033feeaf9d | |||
| de336e5f96 | |||
| 82b3dbdae6 | |||
| d1227f7759 | |||
| 4d134387f9 | |||
| 3f8600dfb7 | |||
| 511f043d63 |
@ -47,30 +47,17 @@ namespace DocFileFormat
|
||||
|
||||
virtual ~ConversionContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Adds a new RSID to the set
|
||||
inline void AddRsid(const std::wstring& rsid)
|
||||
{
|
||||
if (AllRsids.find(rsid) == AllRsids.end())
|
||||
AllRsids.insert(rsid);
|
||||
}
|
||||
|
||||
inline WordDocument* GetDocument()
|
||||
{
|
||||
return _doc;
|
||||
}
|
||||
|
||||
inline WordprocessingDocument* GetXmlDocument()
|
||||
{
|
||||
return _docx;
|
||||
}
|
||||
|
||||
public:
|
||||
WordprocessingDocument* _docx;
|
||||
WordDocument* _doc;
|
||||
/// A set thta contains all revision ids.
|
||||
|
||||
std::set<std::wstring> AllRsids;
|
||||
};
|
||||
}
|
||||
@ -63,8 +63,16 @@ namespace DocFileFormat
|
||||
{
|
||||
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
|
||||
{
|
||||
if (!doc || !docx) return S_FALSE;
|
||||
|
||||
ConversionContext context( doc, docx );
|
||||
|
||||
//Write fontTable.xml
|
||||
if (doc->FontTable)
|
||||
{
|
||||
FontTableMapping fontTableMapping( &context );
|
||||
doc->FontTable->Convert( &fontTableMapping );
|
||||
}
|
||||
//Write styles.xml
|
||||
if (doc->Styles)
|
||||
{
|
||||
@ -107,14 +115,6 @@ namespace DocFileFormat
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//Write fontTable.xml
|
||||
if (doc->FontTable)
|
||||
{
|
||||
FontTableMapping fontTableMapping( &context );
|
||||
doc->FontTable->Convert( &fontTableMapping );
|
||||
}
|
||||
|
||||
if ( progress != NULL )
|
||||
{
|
||||
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -48,7 +48,8 @@ namespace DocFileFormat
|
||||
|
||||
class FontFamilyName: public ByteStructure
|
||||
{
|
||||
friend class CharacterPropertiesMapping;
|
||||
friend class WordDocument;
|
||||
friend class CharacterPropertiesMapping;
|
||||
friend class DocumentMapping;
|
||||
friend class FontTableMapping;
|
||||
friend class StyleSheetMapping;
|
||||
|
||||
@ -34,32 +34,30 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
|
||||
FontTableMapping::FontTableMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
|
||||
{
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
FontTableMapping::~FontTableMapping()
|
||||
{
|
||||
RELEASEOBJECT (m_pXmlWriter);
|
||||
}
|
||||
|
||||
/*========================================================================================================*/
|
||||
|
||||
void FontTableMapping::Apply( IVisitable* visited )
|
||||
{
|
||||
StringTable<FontFamilyName>* table = static_cast<StringTable<FontFamilyName>*>( visited );
|
||||
|
||||
this->_ctx->_docx->RegisterFontTable();
|
||||
_ctx->_docx->RegisterFontTable();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
int sz_fonts = table->Data.size();
|
||||
int sz_fonts = table->Data.size();
|
||||
int users_fonts = 0;
|
||||
|
||||
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
|
||||
@ -140,6 +138,6 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:fonts");
|
||||
|
||||
this->_ctx->_docx->FontTableXML = std::wstring( m_pXmlWriter->GetXmlString() );
|
||||
_ctx->_docx->FontTableXML = m_pXmlWriter->GetXmlString() ;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@ -38,8 +38,8 @@ namespace DocFileFormat
|
||||
{
|
||||
if (m_context)
|
||||
{
|
||||
m_document = m_context->GetDocument();
|
||||
m_xmldocument = m_context->GetXmlDocument();
|
||||
m_document = m_context->_doc;
|
||||
m_xmldocument = m_context->_docx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -163,7 +164,7 @@ namespace DocFileFormat
|
||||
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
|
||||
|
||||
std::list<std::wstring> entries = storageInp->entries(path);
|
||||
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++)
|
||||
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it)
|
||||
{
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ (*it));
|
||||
if (stream_inp == NULL)continue;
|
||||
|
||||
@ -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>();
|
||||
|
||||
@ -41,6 +41,7 @@ namespace DocFileFormat
|
||||
{
|
||||
template<class T> class StringTable: public IVisitable
|
||||
{
|
||||
friend class WordDocument;
|
||||
friend class CharacterPropertiesMapping;
|
||||
friend class FontTableMapping;
|
||||
friend class StyleSheetMapping;
|
||||
|
||||
@ -90,7 +90,7 @@ namespace DocFileFormat
|
||||
std::list<std::wstring> entries, entries_sort;
|
||||
entries = m_pStorage->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
@ -104,8 +104,8 @@ namespace DocFileFormat
|
||||
entries_sort.push_front(name);
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
@ -159,30 +159,32 @@ namespace DocFileFormat
|
||||
OOX::CDocument docEmbedded(path, path);
|
||||
|
||||
bool res = false;
|
||||
for (size_t i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = docEmbedded.m_arrItems.begin(); it != docEmbedded.m_arrItems.end(); ++it)
|
||||
{
|
||||
if (docEmbedded.m_arrItems[i]->getType() == OOX::et_w_p)
|
||||
if ((*it)->getType() == OOX::et_w_p)
|
||||
{
|
||||
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(docEmbedded.m_arrItems[i]);
|
||||
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(*it);
|
||||
|
||||
for (size_t j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator jt = paragraph->m_arrItems.begin();
|
||||
(paragraph) && (jt != paragraph->m_arrItems.end()); jt++)
|
||||
{
|
||||
if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMath)
|
||||
if ((*jt)->getType() == OOX::et_m_oMath)
|
||||
{
|
||||
res = true;
|
||||
newXmlString = paragraph->m_arrItems[j]->toXML();
|
||||
newXmlString = (*jt)->toXML();
|
||||
break;
|
||||
}
|
||||
else if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMathPara)
|
||||
else if ((*jt)->getType() == OOX::et_m_oMathPara)
|
||||
{
|
||||
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(paragraph->m_arrItems[j]);
|
||||
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(*jt);
|
||||
|
||||
for (size_t k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator kt = mathPara->m_arrItems.begin();
|
||||
(mathPara) && (kt != mathPara->m_arrItems.end()); kt++)
|
||||
{
|
||||
if (mathPara->m_arrItems[k]->getType() == OOX::et_m_oMath)
|
||||
if ((*kt)->getType() == OOX::et_m_oMath)
|
||||
{
|
||||
res = true;
|
||||
newXmlString = mathPara->m_arrItems[k]->toXML();
|
||||
newXmlString = (*kt)->toXML();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -40,8 +40,45 @@
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
static const int aCodePages[][2] = {
|
||||
//charset codepage
|
||||
0, 1252, //ANSI
|
||||
1, 0,//Default
|
||||
2, 42,//Symbol
|
||||
77, 10000,//Mac Roman
|
||||
78, 10001,//Mac Shift Jis
|
||||
79, 10003,//Mac Hangul
|
||||
80, 10008,//Mac GB2312
|
||||
81, 10002,//Mac Big5
|
||||
83, 10005,//Mac Hebrew
|
||||
84, 10004,//Mac Arabic
|
||||
85, 10006,//Mac Greek
|
||||
86, 10081,//Mac Turkish
|
||||
87, 10021,//Mac Thai
|
||||
88, 10029,//Mac East Europe
|
||||
89, 10007,//Mac Russian
|
||||
128, 932,//Shift JIS
|
||||
129, 949,//Hangul
|
||||
130, 1361,//Johab
|
||||
134, 936,//GB2312
|
||||
136, 950,//Big5
|
||||
238, 1250,//Greek
|
||||
161, 1253,//Greek
|
||||
162, 1254,//Turkish
|
||||
163, 1258,//Vietnamese
|
||||
177, 1255,//Hebrew
|
||||
178, 1256, //Arabic
|
||||
186, 1257,//Baltic
|
||||
204, 1251,//Russian
|
||||
222, 874,//Thai
|
||||
238, 1250,//Eastern European
|
||||
254, 437,//PC 437
|
||||
255, 850//OEM
|
||||
};
|
||||
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) :
|
||||
m_PieceTable(NULL), WordDocumentStream(NULL), TableStream(NULL), DataStream(NULL), FIB(NULL),
|
||||
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
|
||||
@ -55,12 +92,15 @@ namespace DocFileFormat
|
||||
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
|
||||
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
|
||||
{
|
||||
m_pCallFunc = pCallFunc;
|
||||
m_sTempFolder = sTempFolder;
|
||||
m_pCallFunc = pCallFunc;
|
||||
m_sTempFolder = sTempFolder;
|
||||
|
||||
m_pStorage = NULL;
|
||||
officeArtContent = NULL;
|
||||
bOlderVersion = false;
|
||||
m_pStorage = NULL;
|
||||
officeArtContent = NULL;
|
||||
bOlderVersion = false;
|
||||
|
||||
bDocumentCodePage = false;
|
||||
nDocumentCodePage = ENCODING_WINDOWS_1250;
|
||||
}
|
||||
|
||||
WordDocument::~WordDocument()
|
||||
@ -178,8 +218,6 @@ namespace DocFileFormat
|
||||
|
||||
m_pStorage->GetStream (L"SummaryInformation", &Summary);
|
||||
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
|
||||
|
||||
document_code_page = ENCODING_WINDOWS_1250;
|
||||
|
||||
if ((Summary) && (Summary->size() > 0))
|
||||
{
|
||||
@ -188,7 +226,10 @@ namespace DocFileFormat
|
||||
int document_code_page1 = summary_info.GetCodePage(); //from software last open
|
||||
|
||||
if (document_code_page1 > 0)
|
||||
document_code_page = document_code_page1;
|
||||
{
|
||||
nDocumentCodePage = document_code_page1;
|
||||
bDocumentCodePage = true;
|
||||
}
|
||||
}
|
||||
if ((DocSummary) && (DocSummary->size() > 0))
|
||||
{
|
||||
@ -197,12 +238,18 @@ namespace DocFileFormat
|
||||
int document_code_page2 = doc_summary_info.GetCodePage();
|
||||
|
||||
if (document_code_page2 > 0)
|
||||
document_code_page = document_code_page2;
|
||||
{
|
||||
nDocumentCodePage = document_code_page2;
|
||||
bDocumentCodePage = true;
|
||||
}
|
||||
}
|
||||
if (!bOlderVersion)
|
||||
document_code_page = ENCODING_UTF16;
|
||||
{
|
||||
nDocumentCodePage = ENCODING_UTF16;
|
||||
bDocumentCodePage = true;
|
||||
}
|
||||
|
||||
FIB->m_CodePage = document_code_page;
|
||||
FIB->m_CodePage = nDocumentCodePage;
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
@ -353,6 +400,31 @@ namespace DocFileFormat
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
}
|
||||
if (!bDocumentCodePage && FontTable)
|
||||
{
|
||||
std::unordered_map<int, int> fonts_charsets;
|
||||
|
||||
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin();!bDocumentCodePage && iter != FontTable->Data.end(); iter++ )
|
||||
{
|
||||
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
|
||||
if (!font) continue;
|
||||
|
||||
if (fonts_charsets.find(font->chs) == fonts_charsets.end())
|
||||
{
|
||||
fonts_charsets.insert(std::make_pair(font->chs, font->ff));
|
||||
|
||||
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
|
||||
{
|
||||
if (aCodePages[i][0] == font->chs && font->chs != 0)
|
||||
{
|
||||
nDocumentCodePage = aCodePages[i][1];
|
||||
bDocumentCodePage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FIB->m_FibWord97.lcbClx > 0)
|
||||
{
|
||||
@ -371,7 +443,7 @@ namespace DocFileFormat
|
||||
WordDocumentStream->read (bytes, cb);
|
||||
|
||||
Text = new std::vector<wchar_t>();
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, document_code_page);
|
||||
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, nDocumentCodePage);
|
||||
|
||||
RELEASEARRAYOBJECTS(bytes);
|
||||
}
|
||||
@ -487,7 +559,7 @@ namespace DocFileFormat
|
||||
|
||||
//std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); ++it)
|
||||
//{
|
||||
// if (storageIn->isDirectory(*it))
|
||||
// {
|
||||
@ -531,7 +603,7 @@ namespace DocFileFormat
|
||||
std::list<std::wstring> entries, entries_files, entries_dir;
|
||||
entries = storageIn->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it )
|
||||
{
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
@ -69,7 +69,6 @@ namespace DocFileFormat
|
||||
{
|
||||
class WordDocument: public IVisitable
|
||||
{
|
||||
/*Mapping classes with direct access to the Word Document.*/
|
||||
friend class FootnotesMapping;
|
||||
friend class EndnotesMapping;
|
||||
friend class CommentsMapping;
|
||||
@ -98,7 +97,8 @@ namespace DocFileFormat
|
||||
long LoadDocument (const std::wstring & fileName, const std::wstring & password);
|
||||
|
||||
bool bOlderVersion;
|
||||
int document_code_page;
|
||||
int nDocumentCodePage;
|
||||
bool bDocumentCodePage;
|
||||
|
||||
inline StructuredStorageReader* GetStorage() const
|
||||
{
|
||||
|
||||
@ -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"
|
||||
@ -67,7 +67,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Urlmon.lib"
|
||||
LinkIncremental="1"
|
||||
IgnoreDefaultLibraryNames="LIBCMT.lib"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
IgnoreEmbeddedIDL="true"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
@ -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"
|
||||
>
|
||||
|
||||
@ -372,7 +372,7 @@ public:
|
||||
class rPr
|
||||
{
|
||||
private:
|
||||
std::map<std::wstring, int>& m_mapFonts;
|
||||
boost::unordered_map<std::wstring, int>& m_mapFonts;
|
||||
public:
|
||||
bool Bold;
|
||||
bool Italic;
|
||||
@ -445,7 +445,7 @@ public:
|
||||
|
||||
bool bDoNotWriteNullProp;
|
||||
public:
|
||||
rPr(std::map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
rPr(boost::unordered_map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
{
|
||||
Reset();
|
||||
|
||||
@ -1787,8 +1787,8 @@ w15:paraIdParent=\"" + pComment->m_sParaIdParent + L"\" w15:done=\"" + sDone + L
|
||||
};
|
||||
class CComments
|
||||
{
|
||||
std::map<int, CComment*> m_mapComments;
|
||||
std::map<std::wstring, CComment*> m_mapAuthors;
|
||||
boost::unordered_map<int, CComment*> m_mapComments;
|
||||
boost::unordered_map<std::wstring, CComment*> m_mapAuthors;
|
||||
public:
|
||||
IdCounter m_oFormatIdCounter;
|
||||
IdCounter m_oParaIdCounter;
|
||||
@ -1798,7 +1798,7 @@ public:
|
||||
}
|
||||
~CComments()
|
||||
{
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
@ -1822,7 +1822,7 @@ public:
|
||||
CComment* get(int nInd)
|
||||
{
|
||||
CComment* pRes = NULL;
|
||||
std::map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
|
||||
boost::unordered_map<int, CComment*>::const_iterator pair = m_mapComments.find(nInd);
|
||||
if(m_mapComments.end() != pair)
|
||||
pRes = pair->second;
|
||||
return pRes;
|
||||
@ -1834,7 +1834,7 @@ public:
|
||||
std::wstring writeContent()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writeTemplates(CComment::writeContent));
|
||||
}
|
||||
@ -1843,7 +1843,7 @@ public:
|
||||
std::wstring writeContentExt()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writeTemplates(CComment::writeContentExt));
|
||||
}
|
||||
@ -1852,7 +1852,7 @@ public:
|
||||
std::wstring writePeople()
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (std::map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, CComment*>::const_iterator it = m_mapAuthors.begin(); it != m_mapAuthors.end(); ++it)
|
||||
{
|
||||
sRes += (it->second->writePeople(it->second));
|
||||
}
|
||||
|
||||
@ -61,6 +61,13 @@ enum ETblStyleOverrideType
|
||||
tblstyleoverridetypeSwCell = 11,
|
||||
tblstyleoverridetypeWholeTable = 12
|
||||
};
|
||||
|
||||
struct RowHeight
|
||||
{
|
||||
unsigned char HRule = 0;
|
||||
long nHeight = 0;
|
||||
};
|
||||
|
||||
class SdtWraper
|
||||
{
|
||||
public:
|
||||
@ -2111,7 +2118,17 @@ public:
|
||||
}
|
||||
else if( c_oSerProp_rowPrType::Height == type )
|
||||
{
|
||||
res = Read2(length, &Binary_tblPrReader::ReadHeight, this, poResult);
|
||||
RowHeight val;
|
||||
res = Read2(length, &Binary_tblPrReader::ReadHeight, this, &val);
|
||||
|
||||
pCStringWriter->WriteString(L"<w:trHeight w:val=\"" + std::to_wstring(val.nHeight) + L"\"");
|
||||
|
||||
switch (val.HRule)
|
||||
{
|
||||
case 1: pCStringWriter->WriteString(L" w:hRule=\"auto\""); break;
|
||||
case 2: pCStringWriter->WriteString(L" w:hRule=\"exact\""); break;
|
||||
}
|
||||
pCStringWriter->WriteString(L"/>");
|
||||
}
|
||||
else if( c_oSerProp_rowPrType::TableHeader == type )
|
||||
{
|
||||
@ -2180,17 +2197,17 @@ public:
|
||||
int ReadHeight(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
XmlUtils::CStringWriter* pCStringWriter = static_cast<XmlUtils::CStringWriter*>(poResult);
|
||||
/*if( c_oSerProp_rowPrType::Height_Rule == type )
|
||||
|
||||
RowHeight* pHeight = static_cast<RowHeight*>(poResult);
|
||||
|
||||
if( c_oSerProp_rowPrType::Height_Rule == type )
|
||||
{
|
||||
Height.HRule = this.stream.GetUChar();
|
||||
pHeight->HRule = m_oBufferedStream.GetUChar();
|
||||
}
|
||||
else */if( c_oSerProp_rowPrType::Height_Value == type )
|
||||
else if( c_oSerProp_rowPrType::Height_Value == type )
|
||||
{
|
||||
double dHeight = m_oBufferedStream.GetDouble();
|
||||
long nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
|
||||
|
||||
pCStringWriter->WriteString(L"<w:trHeight w:val=\"" + std::to_wstring(nHeight) + L"\"/>");
|
||||
pHeight->nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight);
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
@ -3734,6 +3751,33 @@ public:
|
||||
res = Read2(length, &Binary_DocumentTableReader::Read_Background, this, &oBackground);
|
||||
m_oDocumentWriter.m_oBackground.WriteString(oBackground.Write());
|
||||
}
|
||||
else if ( c_oSerParType::BookmarkStart == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::BookmarkEnd == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else if(c_oSerParType::JsaProject == type)
|
||||
{
|
||||
BYTE* pData = m_oBufferedStream.GetPointer(length);
|
||||
OOX::CPath sJsaProject = OOX::FileTypes::JsaProject.DefaultFileName();
|
||||
std::wstring filePath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"+ FILE_SEPARATOR_STR + sJsaProject.GetPath();
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath);
|
||||
oFile.WriteFile(pData, length);
|
||||
oFile.CloseFile();
|
||||
|
||||
long lId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), sJsaProject.GetPath(), L"", &lId);
|
||||
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(sJsaProject.GetExtention(false));
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -3872,6 +3916,18 @@ public:
|
||||
SdtWraper oSdt(1);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else if ( c_oSerParType::BookmarkStart == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if ( c_oSerParType::BookmarkEnd == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
|
||||
m_oDocumentWriter.m_oContent.WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -4267,6 +4323,57 @@ public:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadBookmarkStart(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CBookmarkStart* pBookmarkStart = static_cast<OOX::Logic::CBookmarkStart*>(poResult);
|
||||
if ( c_oSerBookmark::Id == type )
|
||||
{
|
||||
pBookmarkStart->m_oId.Init();
|
||||
pBookmarkStart->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerBookmark::Name == type )
|
||||
{
|
||||
pBookmarkStart->m_sName.Init();
|
||||
pBookmarkStart->m_sName->append(m_oBufferedStream.GetString3(length));
|
||||
}
|
||||
else if ( c_oSerBookmark::DisplacedByCustomXml == type )
|
||||
{
|
||||
pBookmarkStart->m_oDisplacedByCustomXml.Init();
|
||||
pBookmarkStart->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else if ( c_oSerBookmark::ColFirst == type )
|
||||
{
|
||||
pBookmarkStart->m_oColFirst.Init();
|
||||
pBookmarkStart->m_oColFirst->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerBookmark::ColLast == type )
|
||||
{
|
||||
pBookmarkStart->m_oColLast.Init();
|
||||
pBookmarkStart->m_oColLast->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
int ReadBookmarkEnd(BYTE type, long length, void* poResult)
|
||||
{
|
||||
int res = c_oSerConstants::ReadOk;
|
||||
OOX::Logic::CBookmarkEnd* pBookmarkEnd = static_cast<OOX::Logic::CBookmarkEnd*>(poResult);
|
||||
if ( c_oSerBookmark::Id == type )
|
||||
{
|
||||
pBookmarkEnd->m_oId.Init();
|
||||
pBookmarkEnd->m_oId->SetValue(m_oBufferedStream.GetLong());
|
||||
}
|
||||
else if ( c_oSerBookmark::DisplacedByCustomXml == type )
|
||||
{
|
||||
pBookmarkEnd->m_oDisplacedByCustomXml.Init();
|
||||
pBookmarkEnd->m_oDisplacedByCustomXml->SetValue((SimpleTypes::EDisplacedByCustomXml)m_oBufferedStream.GetUChar());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
}
|
||||
|
||||
int ReadHyperlink(BYTE type, long length, void* poResult)
|
||||
{
|
||||
@ -4460,6 +4567,18 @@ public:
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadMathSSup, this, poResult);
|
||||
GetRunStringWriter().WriteString(std::wstring(_T("</m:sSup>")));
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::BookmarkStart == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
|
||||
GetRunStringWriter().WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if ( c_oSer_OMathContentType::BookmarkEnd == type )
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
|
||||
GetRunStringWriter().WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6923,6 +7042,18 @@ public:
|
||||
SdtWraper oSdt(2);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else if (c_oSerDocTableType::BookmarkStart == type)
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
|
||||
pCStringWriter->WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if (c_oSerDocTableType::BookmarkEnd == type)
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
|
||||
pCStringWriter->WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
@ -6960,6 +7091,18 @@ public:
|
||||
SdtWraper oSdt(3);
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadSdt, this, &oSdt);
|
||||
}
|
||||
else if (c_oSerDocTableType::BookmarkStart == type)
|
||||
{
|
||||
OOX::Logic::CBookmarkStart oBookmarkStart;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkStart, this, &oBookmarkStart);
|
||||
pCStringWriter->WriteString(oBookmarkStart.toXML());
|
||||
}
|
||||
else if (c_oSerDocTableType::BookmarkEnd == type)
|
||||
{
|
||||
OOX::Logic::CBookmarkEnd oBookmarkEnd;
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadBookmarkEnd, this, &oBookmarkEnd);
|
||||
pCStringWriter->WriteString(oBookmarkEnd.toXML());
|
||||
}
|
||||
else
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
return res;
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../DesktopEditor/fontengine/FontManager.h"
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
@ -48,7 +49,7 @@ namespace Writers
|
||||
CApplicationFonts m_oApplicationFonts;
|
||||
CFontManager* m_pFontManager;
|
||||
public:
|
||||
std::map<std::wstring, int> m_mapFonts;
|
||||
boost::unordered_map<std::wstring, int> m_mapFonts;
|
||||
|
||||
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir):m_sDir(sDir)
|
||||
{
|
||||
@ -81,7 +82,7 @@ namespace Writers
|
||||
bool bCalibri = false;
|
||||
bool bTimes = false;
|
||||
bool bCambria = false;
|
||||
for (std::map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
{
|
||||
const std::wstring& sFontName = it->first;
|
||||
if(_T("Calibri") == sFontName)
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -476,7 +476,11 @@ extern int g_nCurFormatVersion;
|
||||
MoveFromRangeStart = 18,
|
||||
MoveFromRangeEnd = 19,
|
||||
MoveToRangeStart = 20,
|
||||
MoveToRangeEnd = 21
|
||||
MoveToRangeEnd = 21,
|
||||
JsaProject = 22,
|
||||
BookmarkStart = 23,
|
||||
BookmarkEnd = 24
|
||||
|
||||
};}
|
||||
namespace c_oSerDocTableType{enum c_oSerDocTableType
|
||||
{
|
||||
@ -491,7 +495,9 @@ extern int g_nCurFormatVersion;
|
||||
Cell_Pr = 7,
|
||||
Cell_Content = 8,
|
||||
tblGridChange = 9,
|
||||
Sdt = 10
|
||||
Sdt = 10,
|
||||
BookmarkStart = 11,
|
||||
BookmarkEnd = 12
|
||||
};}
|
||||
namespace c_oSerRunType{enum c_oSerRunType
|
||||
{
|
||||
@ -900,7 +906,9 @@ extern int g_nCurFormatVersion;
|
||||
Ins = 62,
|
||||
Del = 63,
|
||||
columnbreak = 64,
|
||||
ARPr = 65
|
||||
ARPr = 65,
|
||||
BookmarkStart = 66,
|
||||
BookmarkEnd = 67
|
||||
};}
|
||||
namespace c_oSer_FramePrType{ enum c_oSer_FramePrType
|
||||
{
|
||||
@ -1105,6 +1113,14 @@ extern int g_nCurFormatVersion;
|
||||
Name = 6,
|
||||
UserId = 7
|
||||
};}
|
||||
namespace c_oSerBookmark{enum c_oSerBookmark
|
||||
{
|
||||
Id = 0,
|
||||
Name = 1,
|
||||
DisplacedByCustomXml = 2,
|
||||
ColFirst = 3,
|
||||
ColLast = 4
|
||||
};}
|
||||
}
|
||||
|
||||
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -127,10 +127,11 @@ namespace BinXlsxRW{
|
||||
}
|
||||
ChartWriter::~ChartWriter()
|
||||
{
|
||||
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); it++)
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = it->second;
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRow = rows->begin(); itRow != rows->end(); itRow++)
|
||||
{
|
||||
delete itRow->second;
|
||||
}
|
||||
@ -143,10 +144,12 @@ namespace BinXlsxRW{
|
||||
//Sheet
|
||||
OOX::Spreadsheet::CWorkbook* pWorkbook = oXlsx.CreateWorkbook();
|
||||
pWorkbook->m_oSheets.Init();
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets = oXlsx.GetWorksheets();
|
||||
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets = oXlsx.GetWorksheets();
|
||||
int nSheetId = 1;
|
||||
OOX::Spreadsheet::CWorksheet* pFirstWorksheet = NULL;
|
||||
for (std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); it++)
|
||||
|
||||
for (boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::iterator it = m_mapSheets.begin(); it != m_mapSheets.end(); ++it)
|
||||
{
|
||||
const std::wstring& sSheetName = it->first;
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = toXlsxGetSheet(mapWorksheets, sSheetName);
|
||||
@ -182,12 +185,12 @@ namespace BinXlsxRW{
|
||||
}
|
||||
OOX::Spreadsheet::CSi* pSi = new OOX::Spreadsheet::CSi();
|
||||
pSi->m_arrItems.push_back(pText);
|
||||
pSharedStrings->m_arrItems.push_back(pSi);
|
||||
pSharedStrings->AddSi(pSi);
|
||||
}
|
||||
pSharedStrings->m_oCount.Init();
|
||||
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_arrItems.size());
|
||||
pSharedStrings->m_oCount->SetValue(pSharedStrings->m_nCount);
|
||||
pSharedStrings->m_oUniqueCount.Init();
|
||||
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_arrItems.size());
|
||||
pSharedStrings->m_oUniqueCount->SetValue(pSharedStrings->m_nCount);
|
||||
//Styles
|
||||
OOX::Spreadsheet::CStyles* pStyles = oXlsx.CreateStyles();
|
||||
pStyles->m_oCellXfs.Init();
|
||||
@ -196,7 +199,8 @@ namespace BinXlsxRW{
|
||||
pStyles->m_oCellXfs->m_arrItems.push_back(m_aXfs[i]);
|
||||
}
|
||||
pStyles->m_oNumFmts.Init();
|
||||
for (std::map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); it++)
|
||||
|
||||
for (boost::unordered_map<std::wstring, int>::iterator it = m_mapFormats.begin(); it != m_mapFormats.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::CNumFmt* pNumFmt = new OOX::Spreadsheet::CNumFmt();
|
||||
pNumFmt->m_oFormatCode.Init();
|
||||
@ -458,18 +462,22 @@ namespace BinXlsxRW{
|
||||
//проверяем можем ли создать таблицу
|
||||
if(m_mapSheets.size() > 0 && m_nRow1 > 0 && m_nRow2 > 0 && m_nCol1 > 0 && m_nCol2 > 0 && m_nRow1 < m_nRow2)
|
||||
{
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
if(itRows != rows->end())
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = m_mapSheets.begin()->second;
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::iterator itRows = rows->find(m_nRow1);
|
||||
|
||||
if(itRows != rows->end())
|
||||
{
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = itRows->second;
|
||||
std::vector<int> aIndexesCell;
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells->begin(); it != cells->end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
|
||||
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
|
||||
if(m_nCol2 - m_nCol1 + 1 == aIndexesCell.size() && m_nCol1 == aIndexesCell[0] && m_nCol2 == aIndexesCell[aIndexesCell.size() - 1])
|
||||
{
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
{
|
||||
@ -482,11 +490,12 @@ namespace BinXlsxRW{
|
||||
}
|
||||
}
|
||||
}
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
OOX::Spreadsheet::CWorksheet* ChartWriter::toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName)
|
||||
{
|
||||
OOX::Spreadsheet::CWorksheet* pWorksheet = NULL;
|
||||
std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
|
||||
if (it == mapWorksheets.end())
|
||||
boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>::const_iterator it = mapWorksheets.find(sName);
|
||||
|
||||
if (it == mapWorksheets.end())
|
||||
{
|
||||
pWorksheet = new OOX::Spreadsheet::CWorksheet();
|
||||
pWorksheet->m_oSheetFormatPr.Init();
|
||||
@ -515,32 +524,40 @@ namespace BinXlsxRW{
|
||||
}
|
||||
return pWorksheet;
|
||||
}
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
void ChartWriter::toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings)
|
||||
{
|
||||
pWorksheet->m_oSheetData.Init();
|
||||
std::vector<int> aIndexesRow;
|
||||
for(std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
{
|
||||
aIndexesRow.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesRow.begin(), aIndexesRow.end());
|
||||
for(size_t i = 0; i < aIndexesRow.size(); ++i)
|
||||
|
||||
std::sort(aIndexesRow.begin(), aIndexesRow.end());
|
||||
|
||||
for(size_t i = 0; i < aIndexesRow.size(); ++i)
|
||||
{
|
||||
int nIndexRow = aIndexesRow[i];
|
||||
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
|
||||
|
||||
OOX::Spreadsheet::CRow* pRow = new OOX::Spreadsheet::CRow();
|
||||
pRow->m_oR.Init();
|
||||
pRow->m_oR->SetValue(nIndexRow);
|
||||
const std::map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
|
||||
const boost::unordered_map<int, OOX::Spreadsheet::CCell*>& cells = *rows.at(nIndexRow);
|
||||
std::vector<int> aIndexesCell;
|
||||
for(std::map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); it++)
|
||||
|
||||
for(boost::unordered_map<int, OOX::Spreadsheet::CCell*>::const_iterator it = cells.begin(); it != cells.end(); ++it)
|
||||
{
|
||||
aIndexesCell.push_back(it->first);
|
||||
}
|
||||
std::sort(aIndexesCell.begin(), aIndexesCell.end());
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
|
||||
for(size_t j = 0; j < aIndexesCell.size(); ++j)
|
||||
{
|
||||
int nIndexCell = aIndexesCell[j];
|
||||
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
|
||||
|
||||
OOX::Spreadsheet::CCell* pCell = cells.at(nIndexCell);
|
||||
//SharedStrings
|
||||
if(pCell->m_oValue.IsInit())
|
||||
{
|
||||
@ -588,22 +605,24 @@ namespace BinXlsxRW{
|
||||
}
|
||||
void ChartWriter::parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format = NULL)
|
||||
{
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
if(itSheets == m_mapSheets.end())
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*>::const_iterator itSheets = m_mapSheets.find(sheet);
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>* rows = NULL;
|
||||
|
||||
if(itSheets == m_mapSheets.end())
|
||||
{
|
||||
rows = new std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
rows = new boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>();
|
||||
m_mapSheets.insert(std::make_pair(sheet, rows));
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = itSheets->second;
|
||||
}
|
||||
std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
std::map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
if(itRows == rows->end())
|
||||
boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>::const_iterator itRows = rows->find(nRow);
|
||||
boost::unordered_map<int, OOX::Spreadsheet::CCell*>* cells = NULL;
|
||||
|
||||
if(itRows == rows->end())
|
||||
{
|
||||
cells = new std::map<int, OOX::Spreadsheet::CCell*>();
|
||||
cells = new boost::unordered_map<int, OOX::Spreadsheet::CCell*>();
|
||||
rows->insert(std::make_pair(nRow, cells));
|
||||
}
|
||||
else
|
||||
@ -622,10 +641,12 @@ namespace BinXlsxRW{
|
||||
//пока добавляем как есть, shared string после записи таблицы
|
||||
pNewCell->m_oValue.Init();
|
||||
pNewCell->m_oValue->m_sText = val;
|
||||
if(NULL != format)
|
||||
|
||||
if(NULL != format)
|
||||
{
|
||||
int nXfsIndex = m_aXfs.size();
|
||||
std::map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
|
||||
boost::unordered_map<std::wstring, int>::const_iterator itFormat = m_mapFormats.find(*format);
|
||||
if(itFormat == m_mapFormats.end())
|
||||
{
|
||||
m_mapFormats[*format] = nXfsIndex;
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
#define CHART_WRITER
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
@ -59,22 +59,25 @@ namespace BinXlsxRW {
|
||||
class ChartWriter
|
||||
{
|
||||
public:
|
||||
std::map<std::wstring, std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
std::map<std::wstring, int> m_mapFormats;
|
||||
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
|
||||
std::vector<std::wstring> m_aTableNames;
|
||||
int m_nRow1;
|
||||
boost::unordered_map<std::wstring, boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>*> m_mapSheets;
|
||||
boost::unordered_map<std::wstring, int> m_mapFormats;
|
||||
|
||||
std::vector<OOX::Spreadsheet::CXfs*> m_aXfs;
|
||||
std::vector<std::wstring> m_aTableNames;
|
||||
|
||||
int m_nRow1;
|
||||
int m_nCol1;
|
||||
int m_nRow2;
|
||||
int m_nCol2;
|
||||
public:
|
||||
ChartWriter();
|
||||
|
||||
ChartWriter();
|
||||
~ChartWriter();
|
||||
void toXlsx(OOX::Spreadsheet::CXlsx& oXlsx);
|
||||
void parseChart(const OOX::Spreadsheet::CT_Chart* pChart);
|
||||
private:
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(std::map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
|
||||
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const std::map<int, std::map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
|
||||
|
||||
private:
|
||||
OOX::Spreadsheet::CWorksheet* toXlsxGetSheet(boost::unordered_map<std::wstring, OOX::Spreadsheet::CWorksheet*>& mapWorksheets, const std::wstring& sName);
|
||||
void toXlsxSheetdata(OOX::Spreadsheet::CWorksheet* pWorksheet, const boost::unordered_map<int, boost::unordered_map<int, OOX::Spreadsheet::CCell*>*>& rows, std::vector<std::wstring>& aSharedStrings);
|
||||
void parseCell(const std::wstring& sheet, const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
|
||||
OOX::Spreadsheet::CCell* parseCreateCell(const int& nRow, const int& nCol, const std::wstring& val, std::wstring* format);
|
||||
void parseStrRef(const OOX::Spreadsheet::CT_StrRef* pStrRef, bool bUpdateRange, const wchar_t* cRangeName);
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
@ -68,6 +68,7 @@
|
||||
ShowProgress="0"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
|
||||
@ -407,11 +407,11 @@ namespace formulasconvert {
|
||||
std::wstring is_forbidden(const std::wstring & formula)
|
||||
{
|
||||
std::wstring result = formula;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
std::map<std::wstring, std::wstring> forbidden_formulas;
|
||||
|
||||
forbidden_formulas.insert(std::make_pair(L"FORMULA", L"_xlfn.FORMULATEXT"));
|
||||
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); it++)
|
||||
for (std::map<std::wstring, std::wstring>::iterator it = forbidden_formulas.begin(); it != forbidden_formulas.end(); ++it)
|
||||
{
|
||||
if (boost::algorithm::contains(formula, it->first))
|
||||
{
|
||||
|
||||
@ -335,8 +335,8 @@ namespace internal
|
||||
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
|
||||
{
|
||||
return (
|
||||
((it != end) && (internal::mask8(*it++)) == bom[0]) &&
|
||||
((it != end) && (internal::mask8(*it++)) == bom[1]) &&
|
||||
((it != end) && (internal::mask8(*++it)) == bom[0]) &&
|
||||
((it != end) && (internal::mask8(*++it)) == bom[1]) &&
|
||||
((it != end) && (internal::mask8(*it)) == bom[2])
|
||||
);
|
||||
}
|
||||
@ -346,8 +346,8 @@ namespace internal
|
||||
inline bool is_bom (octet_iterator it)
|
||||
{
|
||||
return (
|
||||
(internal::mask8(*it++)) == bom[0] &&
|
||||
(internal::mask8(*it++)) == bom[1] &&
|
||||
(internal::mask8(*++it)) == bom[0] &&
|
||||
(internal::mask8(*++it)) == bom[1] &&
|
||||
(internal::mask8(*it)) == bom[2]
|
||||
);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace utf8
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
it++;
|
||||
++it;
|
||||
cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@ -1320,7 +1320,7 @@ void docx_conversion_context::start_changes()
|
||||
text_tracked_context_.dumpTcPr_.clear();
|
||||
text_tracked_context_.dumpTblPr_.clear();
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
@ -1413,7 +1413,7 @@ void docx_conversion_context::end_changes()
|
||||
{
|
||||
if (process_comment_) return;
|
||||
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); ++it)
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
reset_fill(l.fill_);
|
||||
//floor_.content_= l;
|
||||
}
|
||||
void set_legend(odf_reader::chart::simple & l)
|
||||
void set_legend(odf_reader::chart::legend & l)
|
||||
{
|
||||
reset_fill(l.fill_);
|
||||
legend_.content_= l;
|
||||
|
||||
@ -52,10 +52,9 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"c:legend")
|
||||
{
|
||||
|
||||
CP_XML_NODE(L"c:legendPos")
|
||||
{
|
||||
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
|
||||
CP_XML_ATTR(L"val", content_.position);
|
||||
|
||||
}
|
||||
layout_.oox_serialize(CP_XML_STREAM());
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
void oox_serialize(std::wostream & _Wostream);
|
||||
|
||||
odf_reader::chart::simple content_;
|
||||
odf_reader::chart::legend content_;
|
||||
private:
|
||||
|
||||
cpdoccore::oox::oox_layout layout_; //layout (Layout) §21.2.2.88
|
||||
|
||||
@ -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")
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
|
||||
{
|
||||
oox_serialize_default_text(CP_XML_STREAM(), textPr_);
|
||||
|
||||
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); it++)
|
||||
for (std::map<int, std::vector<odf_reader::_property>>::iterator it = dLbls_.begin(); it != dLbls_.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLbl")
|
||||
{
|
||||
|
||||
@ -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){}
|
||||
|
||||
@ -194,7 +194,7 @@ private:
|
||||
std::map<size_t, size_t> count;
|
||||
|
||||
size_t max_size = 0;
|
||||
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator pFind = count.find(it->second);
|
||||
if (pFind != count.end())
|
||||
@ -215,7 +215,7 @@ private:
|
||||
|
||||
size_t found = 0;
|
||||
|
||||
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = count.begin() ; it != count.end(); ++it)
|
||||
{
|
||||
if (it->second == max_size)
|
||||
{
|
||||
@ -229,16 +229,16 @@ private:
|
||||
{
|
||||
if (it->second != found)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator del = it; it++;
|
||||
std::map<size_t, size_t>::iterator del = it; ++it;
|
||||
map.erase(del);
|
||||
}
|
||||
else it++;
|
||||
else ++it;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void clear_header_map2(std::map<size_t, size_t> & map, std::map<size_t, size_t> & map_by)
|
||||
{//отсев тех кто во втором
|
||||
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); it++)
|
||||
for (std::map<size_t, size_t>::iterator it = map_by.begin() ; it != map_by.end(); ++it)
|
||||
{
|
||||
std::map<size_t, size_t>::iterator pFind = map.find(it->second);
|
||||
if (pFind != map.end())
|
||||
|
||||
@ -133,7 +133,8 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
xlsx_drawing_context_ (Context->get_drawing_context_handle()),
|
||||
xlsx_comments_context_ (Context->get_comments_context_handle()),
|
||||
table_column_last_width_(0.0),
|
||||
in_cell(false)
|
||||
in_cell(false),
|
||||
bEndTable(false)
|
||||
|
||||
{
|
||||
memset(&group_row_,0,sizeof(_group_row));
|
||||
|
||||
@ -91,6 +91,9 @@ public:
|
||||
void end_row ();
|
||||
|
||||
void add_empty_row(int count);
|
||||
|
||||
void set_end_table(){ bEndTable = true; }
|
||||
bool get_end_table(){ return bEndTable; }
|
||||
|
||||
std::wstring current_row_style () const;
|
||||
std::wstring default_row_cell_style () const;
|
||||
@ -153,6 +156,7 @@ public:
|
||||
friend class xlsx_table_context;
|
||||
|
||||
private:
|
||||
bool bEndTable;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
std::wstring tableName_;
|
||||
|
||||
@ -253,7 +253,7 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
|
||||
}
|
||||
@ -271,7 +271,7 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
|
||||
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
|
||||
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; it++)
|
||||
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
|
||||
{
|
||||
if (xlsx_data_ranges_[it->second]->filter)
|
||||
{
|
||||
|
||||
@ -195,7 +195,14 @@ std::wstring cellType2Str(XlsxCellType::type type)
|
||||
|
||||
boost::int64_t convertDate(int Year, int Month, int Day)
|
||||
{
|
||||
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
|
||||
if (Year < 1400 || Year >10000)
|
||||
return - 1;
|
||||
if (Month < 1 || Month > 12)
|
||||
return - 1;
|
||||
if (Day < 1 || Day > 31)
|
||||
return - 1;
|
||||
|
||||
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
|
||||
|
||||
if (Year <= 1900 &&
|
||||
Month <= 2 &&
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
@ -739,6 +762,28 @@ void process_build_object::visit(const chart_footer& val)
|
||||
void process_build_object::visit(const chart_legend& val)
|
||||
{
|
||||
object_odf_context_.legend_.bEnabled = true;
|
||||
object_odf_context_.legend_.position = L"r";
|
||||
|
||||
if (val.attlist_.chart_legend_position_)
|
||||
{
|
||||
std::wstring pos = val.attlist_.chart_legend_position_.get();
|
||||
|
||||
if ( pos == L"bottom") object_odf_context_.legend_.position = L"b";
|
||||
if ( pos == L"start") object_odf_context_.legend_.position = L"l";
|
||||
if ( pos == L"top") object_odf_context_.legend_.position = L"t";
|
||||
if ( pos == L"top-end") object_odf_context_.legend_.position = L"tr";
|
||||
if ( pos == L"top-start") object_odf_context_.legend_.position = L"tl";
|
||||
if ( pos == L"bottom-start") object_odf_context_.legend_.position = L"bl";
|
||||
if ( pos == L"bottom-end") object_odf_context_.legend_.position = L"br";
|
||||
}
|
||||
if (val.attlist_.chart_legend_align_)
|
||||
{
|
||||
std::wstring align = val.attlist_.chart_legend_align_.get();
|
||||
|
||||
//if ( pos == L"start") object_odf_context_.legend_.align = L"b";
|
||||
//if ( pos == L"center") object_odf_context_.legend_.align = L"l";
|
||||
//if ( pos == L"end") object_odf_context_.legend_.align = L"t";
|
||||
}
|
||||
|
||||
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
|
||||
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);
|
||||
|
||||
@ -188,7 +188,7 @@ public:
|
||||
office_element_ptr_array title_odf_context_;
|
||||
|
||||
chart::title sub_title_;
|
||||
chart::simple legend_;
|
||||
chart::legend legend_;
|
||||
chart::plot_area plot_area_;
|
||||
|
||||
chart::simple wall_;
|
||||
|
||||
@ -76,6 +76,7 @@ namespace chart {
|
||||
struct simple
|
||||
{
|
||||
simple() : bEnabled(false) {}
|
||||
|
||||
bool bEnabled;
|
||||
std::vector<_property> properties_;
|
||||
std::vector<_property> text_properties_;
|
||||
@ -92,6 +93,11 @@ namespace chart {
|
||||
treadline(){bEquation = false; bREquation = false;}
|
||||
|
||||
};
|
||||
struct legend : public simple
|
||||
{
|
||||
std::wstring position;
|
||||
std::wstring align;
|
||||
};
|
||||
struct plot_area : public simple
|
||||
{
|
||||
std::wstring cell_range_address_;
|
||||
|
||||
@ -58,6 +58,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va
|
||||
break;
|
||||
case calcext_type::Minimum:
|
||||
_Wostream << L"minimum";
|
||||
break;
|
||||
case calcext_type::Percentile:
|
||||
_Wostream << L"percentile";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str)
|
||||
return calcext_type( Minimum );
|
||||
else if (tmp == L"formula")
|
||||
return calcext_type( Formula );
|
||||
else if (tmp == L"percentile")
|
||||
return calcext_type( Percentile );
|
||||
else
|
||||
{
|
||||
return calcext_type( Number );
|
||||
|
||||
@ -49,7 +49,8 @@ public:
|
||||
Minimum,
|
||||
AutoMaximum,
|
||||
AutoMinimum,
|
||||
Formula
|
||||
Formula,
|
||||
Percentile
|
||||
};
|
||||
|
||||
calcext_type() {}
|
||||
|
||||
@ -72,7 +72,6 @@ class common_chart_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) chart_style_name_;
|
||||
};
|
||||
|
||||
@ -117,7 +116,6 @@ class chart_title_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) table_cell_range_;
|
||||
odf_types::common_draw_position_attlist common_draw_position_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
@ -194,13 +192,13 @@ class chart_legend_attlist
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
_CP_OPT(std::wstring) chart_legend_position_;
|
||||
_CP_OPT(std::wstring) chart_legend_align_;
|
||||
odf_types::common_draw_position_attlist common_draw_position_attlist_;
|
||||
_CP_OPT(std::wstring) style_legend_expansion_;
|
||||
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
odf_types::common_draw_position_attlist common_draw_position_attlist_;
|
||||
common_chart_attlist common_attlist_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -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()));
|
||||
|
||||
@ -67,10 +67,11 @@ void table_format_properties::add_attributes( const xml::attributes_wc_ptr & Att
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"style:may-break-between-rows", style_may_break_between_rows_);
|
||||
|
||||
CP_APPLY_ATTR(L"table:align", table_align_);
|
||||
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
|
||||
CP_APPLY_ATTR(L"table:align", table_align_);
|
||||
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
|
||||
CP_APPLY_ATTR(L"style:use-optimal-column-width",style_use_optimal_column_width_);
|
||||
}
|
||||
|
||||
bool table_format_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
|
||||
@ -94,17 +95,22 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
if (style_rel_width_)
|
||||
{
|
||||
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
|
||||
}
|
||||
else if (style_width_)
|
||||
else if (style_use_optimal_column_width_)
|
||||
{
|
||||
_tblPr << L"<w:tblW w:type=\"auto\" w:w=\"0\"/>";
|
||||
}
|
||||
else if (style_width_)
|
||||
{
|
||||
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
|
||||
if (w_w > 31680)w_w = 31680;
|
||||
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
|
||||
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\" />";
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\"/>";
|
||||
}
|
||||
|
||||
if (common_break_attlist_.fo_break_before_)
|
||||
@ -127,23 +133,26 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
{
|
||||
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
|
||||
|
||||
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
|
||||
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\"/>";
|
||||
}
|
||||
}
|
||||
else //if (table_align_->get_type() == table_align::Center)
|
||||
w_val = boost::lexical_cast<std::wstring>(*table_align_);
|
||||
|
||||
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
|
||||
_tblPr << L"<w:jc w:val=\"" << w_val << "\"/>";
|
||||
}
|
||||
|
||||
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
|
||||
if (!style_use_optimal_column_width_)
|
||||
{
|
||||
_tblPr << "<w:tblLayout w:type=\"fixed\"/>";
|
||||
}
|
||||
|
||||
if (common_background_color_attlist_.fo_background_color_)
|
||||
{
|
||||
const std::wstring w_fill = (common_background_color_attlist_.fo_background_color_->get_type() == background_color::Enabled
|
||||
? common_background_color_attlist_.fo_background_color_->get_color().get_hex_value() : L"auto");
|
||||
|
||||
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\" />";
|
||||
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\"/>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -79,7 +79,6 @@ public:
|
||||
|
||||
_CP_OPT(odf_types::length) style_width_;
|
||||
_CP_OPT(odf_types::percent) style_rel_width_;
|
||||
office_element_ptr style_background_image_;
|
||||
_CP_OPT(bool) style_may_break_between_rows_;
|
||||
|
||||
_CP_OPT(odf_types::border_model) table_border_model_;
|
||||
@ -87,6 +86,8 @@ public:
|
||||
_CP_OPT(bool) table_display_;
|
||||
_CP_OPT(odf_types::color) tableooo_tab_color_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_; //not specification
|
||||
office_element_ptr style_background_image_;
|
||||
};
|
||||
|
||||
class style_table_properties : public office_element_impl<style_table_properties>
|
||||
|
||||
@ -337,23 +337,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
|
||||
}
|
||||
else
|
||||
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
|
||||
/*
|
||||
if (CP_CHECK_NAME(L"table", L"table-column-group") && type_ != 1)
|
||||
{
|
||||
type_ = 0;
|
||||
CP_CREATE_ELEMENT_SIMPLE(table_table_column_group_);
|
||||
}
|
||||
else if (( CP_CHECK_NAME(L"table", L"table-columns") ||
|
||||
CP_CHECK_NAME(L"table", L"table-column") ||
|
||||
CP_CHECK_NAME(L"table", L"table-header-columns") )
|
||||
&& type_ != 0)
|
||||
{
|
||||
type_ = 1;
|
||||
table_columns_no_group_.add_child_element(Reader, Ns, Name, Context);
|
||||
}
|
||||
else
|
||||
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -164,7 +164,6 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (inst && inst->content())
|
||||
inst->content()->docx_convert(Context);
|
||||
|
||||
|
||||
Context.get_styles_context().docx_serialize_table_style(_Wostream, Context.get_text_tracked_context().dumpTblPr_);
|
||||
|
||||
_Wostream << L"<w:tblGrid>";
|
||||
|
||||
@ -78,13 +78,16 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
|
||||
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
bool bEndTable = Context.get_table_context().state()->get_end_table();
|
||||
|
||||
if (attlist_.table_number_rows_repeated_ > 1 && empty())
|
||||
{
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return;
|
||||
}
|
||||
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
|
||||
if (attlist_.table_number_rows_repeated_ > 0x0f00 && empty_content_cells() || bEndTable)//0xf000 - conv_KDZO3J3xLIbZ5fC0HR0__xlsx.ods
|
||||
{
|
||||
Context.get_table_context().state()->set_end_table();
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
|
||||
}
|
||||
@ -731,7 +734,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
int y, m, d;
|
||||
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertDate(y, m, d));
|
||||
boost::int64_t intDate = oox::convertDate(y, m, d);
|
||||
if (intDate > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = attr.office_date_value_.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -742,11 +753,19 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (attr.office_time_value_)
|
||||
{
|
||||
const std::wstring tv = attr.office_time_value_.get();
|
||||
int h,m;
|
||||
int h, m;
|
||||
double s;
|
||||
if (oox::parseTime(tv, h, m, s))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertTime(h, m, s));
|
||||
boost::int64_t intTime = oox::convertTime(h, m, s);
|
||||
if (intTime > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = tv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -999,7 +1018,15 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
int y, m, d;
|
||||
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertDate(y, m, d));
|
||||
boost::int64_t intDate = oox::convertDate(y, m, d);
|
||||
if (intDate > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = attr.office_date_value_.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -32,17 +32,14 @@
|
||||
// ASCOfficeOdfFileWTest.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "../../Common/OfficeFileFormatChecker.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
|
||||
|
||||
@ -52,81 +49,31 @@
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
std::wstring DetectTypeDocument(const std::wstring & pathOOX)
|
||||
HRESULT convert_single(std::wstring srcFileName)
|
||||
{
|
||||
std::wstring sRes;
|
||||
COfficeFileFormatChecker fileChecker(srcFileName);
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
std::wstring dstPath = srcFileName;// + ....
|
||||
|
||||
std::wstring fileContentType = pathOOX + FILE_SEPARATOR_STR + L"[Content_Types].xml";
|
||||
|
||||
if (file.OpenFile(fileContentType) ==false) return sRes;
|
||||
|
||||
DWORD nBufferSize = min (file.GetFileSize(), 10000);
|
||||
BYTE *pBuffer = new BYTE[nBufferSize];
|
||||
|
||||
file.ReadFile(pBuffer, nBufferSize, nBufferSize);
|
||||
file.CloseFile();
|
||||
|
||||
if (pBuffer != NULL)
|
||||
std::wstring type;
|
||||
switch(fileChecker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: dstPath += L"-my.odt"; type = L"document"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: dstPath += L"-my.ods"; type = L"spreadsheet"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: dstPath += L"-my.odp"; type = L"presentation"; break;
|
||||
|
||||
const char *docxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
|
||||
const char *dotxFormatLine = "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
|
||||
const char *docmFormatLine = "application/vnd.ms-word.document.macroEnabled.main+xml";
|
||||
const char *dotmFormatLine = "application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
|
||||
|
||||
const char *xlsxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
|
||||
const char *xltxFormatLine = "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml";
|
||||
const char *xlsmFormatLine = "application/vnd.ms-excel.sheet.macroEnabled.main+xml";
|
||||
const char *xltmFormatLine = "application/vnd.ms-excel.template.macroEnabled.main+xml";
|
||||
|
||||
const char *pptxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
||||
const char *ppsxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml";
|
||||
const char *potxFormatLine = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml";
|
||||
const char *pptmFormatLine = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml";
|
||||
const char *ppsmFormatLine = "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml";
|
||||
const char *potmFormatLine = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml";
|
||||
|
||||
std::string strContentTypes((char*)pBuffer, nBufferSize);
|
||||
|
||||
int res = 0;
|
||||
if ( (res = strContentTypes.find(docxFormatLine))>0 || (res = strContentTypes.find(dotxFormatLine))>0 ||
|
||||
(res = strContentTypes.find(docmFormatLine))>0 || (res = strContentTypes.find(dotmFormatLine))>0)
|
||||
{
|
||||
sRes = L"text";
|
||||
}
|
||||
|
||||
else if ((res = strContentTypes.find(xlsxFormatLine))>0 || (res = strContentTypes.find(xltxFormatLine))>0 ||
|
||||
(res = strContentTypes.find(xlsmFormatLine))>0 || (res = strContentTypes.find(xltmFormatLine))>0)
|
||||
{
|
||||
sRes = L"spreadsheet";
|
||||
}
|
||||
|
||||
else if ((res = strContentTypes.find(pptxFormatLine) > 0) || /*(res = strContentTypes.find(ppsxFormatLine))>0 ||*/
|
||||
(res = strContentTypes.find(potxFormatLine))>0 || (res = strContentTypes.find(pptmFormatLine))>0 ||
|
||||
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
|
||||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
|
||||
{
|
||||
sRes = L"presentation";
|
||||
}
|
||||
|
||||
delete []pBuffer;
|
||||
pBuffer = NULL;
|
||||
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
return sRes;
|
||||
}
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 3) return 0;
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argv[2];
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
@ -137,8 +84,6 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
|
||||
return S_FALSE;
|
||||
|
||||
std::wstring type = DetectTypeDocument(srcTempPath);
|
||||
|
||||
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
|
||||
|
||||
converter.convert();
|
||||
@ -155,3 +100,32 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
HRESULT convert_directory(std::wstring pathName)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
|
||||
|
||||
for (size_t i = 0; i < arFiles.size(); i++)
|
||||
{
|
||||
convert_single(arFiles[i]);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
HRESULT hr = -1;
|
||||
if (NSFile::CFileBinary::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_single(argv[1]);
|
||||
}
|
||||
else if (NSDirectory::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_directory(argv[1]);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@ -47,8 +47,9 @@
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\OdfFileWriterTest.pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
@ -66,7 +67,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="
Rpcrt4.lib"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBCMTD.lib"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
@ -450,6 +451,14 @@
|
||||
<File
|
||||
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/bigobj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
|
||||
@ -140,7 +140,7 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -170,6 +170,7 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
if (!content_[i]) continue;
|
||||
content_[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
@ -194,7 +195,7 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -206,8 +207,8 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
|
||||
|
||||
// calcext_formatting_entry
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_formatting_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
|
||||
const wchar_t * calcext_formatting_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
|
||||
|
||||
void calcext_formatting_entry::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -223,8 +224,8 @@ void calcext_formatting_entry::serialize(std::wostream & _Wostream)
|
||||
|
||||
// calcext_color_scale_entry
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_color_scale_entry::name = L"color_scale_entry";
|
||||
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
|
||||
const wchar_t * calcext_color_scale_entry::name = L"color-scale-entry";
|
||||
|
||||
void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -240,7 +241,7 @@ void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
|
||||
}
|
||||
// calcext_condition
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * calcext_condition::ns = L"calcext";
|
||||
const wchar_t * calcext_condition::ns = L"calcext";
|
||||
const wchar_t * calcext_condition::name = L"condition";
|
||||
|
||||
void calcext_condition::serialize(std::wostream & _Wostream)
|
||||
@ -249,7 +250,7 @@ void calcext_condition::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_condition_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +265,7 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
calcext_date_is_attr_.serialize(CP_GET_XML_NODE());
|
||||
attr_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public:
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// \brief calcext:color-scale-entry
|
||||
/// calcext:color-scale-entry
|
||||
class calcext_color_scale_entry : public office_element_impl<calcext_color_scale_entry>
|
||||
{
|
||||
public:
|
||||
@ -104,13 +104,13 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(odf_types::color) calcext_color_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale_entry);
|
||||
|
||||
/// \brief calcext:formatting-entry
|
||||
/// calcext:formatting-entry
|
||||
class calcext_formatting_entry : public office_element_impl<calcext_formatting_entry>
|
||||
{
|
||||
public:
|
||||
@ -125,13 +125,13 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
_CP_OPT(std::wstring) calcext_value_;
|
||||
_CP_OPT(odf_types::calcext_type) calcext_type_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_formatting_entry);
|
||||
|
||||
/// \brief calcext:icon-set
|
||||
/// calcext:icon-set
|
||||
class calcext_icon_set : public office_element_impl<calcext_icon_set>
|
||||
{
|
||||
public:
|
||||
@ -146,15 +146,13 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_icon_set_attr calcext_icon_set_attr_;
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//entries
|
||||
calcext_icon_set_attr attr_;
|
||||
office_element_ptr_array content_;//entries
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_icon_set);
|
||||
|
||||
/// \brief calcext:data-bar
|
||||
/// calcext:data-bar
|
||||
class calcext_data_bar: public office_element_impl<calcext_data_bar>
|
||||
{
|
||||
public:
|
||||
@ -169,14 +167,12 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_data_bar_attr calcext_data_bar_attr_;
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//entries
|
||||
calcext_data_bar_attr attr_;
|
||||
office_element_ptr_array content_;//entries
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar)
|
||||
|
||||
/// \brief calcext:color-scale
|
||||
/// calcext:color-scale
|
||||
class calcext_color_scale: public office_element_impl<calcext_color_scale>
|
||||
{
|
||||
public:
|
||||
@ -191,12 +187,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;//color_scale_entries
|
||||
office_element_ptr_array content_; //color_scale_entries
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale)
|
||||
|
||||
/// \brief calcext:date-is
|
||||
/// calcext:date-is
|
||||
class calcext_date_is: public office_element_impl<calcext_date_is>
|
||||
{
|
||||
public:
|
||||
@ -211,11 +206,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_date_is_attr calcext_date_is_attr_;
|
||||
calcext_date_is_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is)
|
||||
|
||||
/// \brief calcext:condition
|
||||
/// calcext:condition
|
||||
class calcext_condition: public office_element_impl<calcext_condition>
|
||||
{
|
||||
public:
|
||||
@ -230,11 +225,11 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
calcext_condition_attr calcext_condition_attr_;
|
||||
calcext_condition_attr attr_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition)
|
||||
|
||||
/// \brief calcext:conditional-format
|
||||
/// calcext:conditional-format
|
||||
class calcext_conditional_format: public office_element_impl<calcext_conditional_format>
|
||||
{
|
||||
public:
|
||||
@ -257,7 +252,7 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_format)
|
||||
|
||||
/// \brief calcext:conditional-formats
|
||||
/// calcext:conditional-formats
|
||||
class calcext_conditional_formats: public office_element_impl<calcext_conditional_formats>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -86,7 +86,7 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
|
||||
|
||||
std::wstring input_path = oox_ref;
|
||||
|
||||
#if defined (_WIN32) || defined(_WIN64) // + mac???
|
||||
#if defined (_WIN32) || defined(_WIN64)
|
||||
boost::to_lower(input_path);
|
||||
#endif
|
||||
|
||||
@ -100,7 +100,7 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (output_path.length() < 1)
|
||||
if (output_path.empty())
|
||||
{
|
||||
output_path = ( output_sub_path + output_fileName) ;
|
||||
if ( type == typeImage)
|
||||
|
||||
@ -68,8 +68,8 @@ std::wstring create_file_name(const std::wstring & uri, _mediaitems::Type type,
|
||||
{
|
||||
std::wstring sExt;
|
||||
|
||||
if (type == _mediaitems::typeOleObject &&
|
||||
type == _mediaitems::typeObjectReplacement)
|
||||
//if (type == _mediaitems::typeOleObject &&
|
||||
// type == _mediaitems::typeObjectReplacement)
|
||||
{
|
||||
int n = uri.rfind(L".");
|
||||
if (n >= 0) sExt = uri.substr(n);
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
@ -180,8 +180,8 @@ namespace odf_writer
|
||||
|
||||
void media::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_;
|
||||
NSDirectory::CreateDirectory(path);
|
||||
OOX::CPath path (RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_);
|
||||
NSDirectory::CreateDirectory(path.GetPath());
|
||||
|
||||
std::vector< _mediaitems::item > & items = mediaitems_.items();
|
||||
|
||||
@ -189,9 +189,10 @@ namespace odf_writer
|
||||
{
|
||||
if (items[i].type == type_)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
|
||||
OOX::CPath file_name_inp ( items[i].oox_ref);
|
||||
OOX::CPath file_name_out ( RootPath + FILE_SEPARATOR_STR + items[i].odf_ref); //ref содержит уже folder_
|
||||
|
||||
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
|
||||
NSFile::CFileBinary::Copy(file_name_inp.GetPath(), file_name_out.GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +207,7 @@ namespace odf_writer
|
||||
{
|
||||
if (mediaitems.count_image > 0)
|
||||
{
|
||||
pictures_ = element_ptr( new media(mediaitems, L"Picture", 1) );
|
||||
pictures_ = element_ptr( new media(mediaitems, L"Pictures", 1) );
|
||||
}
|
||||
if (mediaitems.count_media > 0)
|
||||
{
|
||||
|
||||
@ -125,7 +125,7 @@ namespace odf_writer
|
||||
class odf_chart_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
|
||||
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
|
||||
{
|
||||
styles_context_ = NULL;
|
||||
current_series_count_ = 0;
|
||||
@ -151,6 +151,9 @@ public:
|
||||
std::vector<office_element_ptr> group_series_;
|
||||
std::vector<unsigned int> axis_group_series_;
|
||||
|
||||
_CP_OPT(int) bar_overlap;
|
||||
_CP_OPT(int) bar_gap_width;
|
||||
|
||||
struct _range
|
||||
{
|
||||
_range(std::wstring &r, bool l, chart_series *s) : label(l), index_cash(-1), series(s), ref(r) {}
|
||||
@ -277,6 +280,9 @@ void odf_chart_context::Impl::clear_current()
|
||||
group_series_.clear();
|
||||
data_cell_ranges_.clear();
|
||||
cash_.clear();
|
||||
|
||||
bar_gap_width = boost::none;
|
||||
bar_overlap = boost::none;
|
||||
|
||||
current_series_count_ = 0;
|
||||
local_table_reset_ref_ = false;
|
||||
@ -335,7 +341,7 @@ void odf_chart_context::start_chart(office_element_ptr & root)
|
||||
|
||||
root->add_child_element(chart_elm);
|
||||
//////////
|
||||
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
|
||||
|
||||
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
|
||||
@ -427,8 +433,6 @@ void odf_chart_context::set_chart_bar_direction(int type)
|
||||
}
|
||||
void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_) return;
|
||||
|
||||
int res = val.find(L"%");
|
||||
|
||||
bool percent=false;
|
||||
@ -438,21 +442,22 @@ void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
|
||||
percent=true;
|
||||
}
|
||||
double dVal = boost::lexical_cast<double>(val);
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = (int)dVal;
|
||||
|
||||
impl_->bar_gap_width = (int)dVal;
|
||||
}
|
||||
void odf_chart_context::set_chart_bar_overlap(std::wstring val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_) return;
|
||||
int res = val.find(L"%");
|
||||
|
||||
bool percent=false;
|
||||
bool percent = false;
|
||||
if (res > 0)
|
||||
{
|
||||
val = val.substr(0,res);
|
||||
percent=true;
|
||||
percent = true;
|
||||
}
|
||||
double dVal = boost::lexical_cast<double>(val);
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = (int)dVal;
|
||||
|
||||
impl_->bar_overlap = (int)dVal;
|
||||
}
|
||||
|
||||
void odf_chart_context::set_chart_stock_candle_stick(bool val)
|
||||
@ -702,15 +707,17 @@ void odf_chart_context::end_group_series()
|
||||
|
||||
std::wstring axis_name;
|
||||
|
||||
bool presentZ = false;
|
||||
long countX = 0;
|
||||
long countY = 0;
|
||||
long countZ = 0;
|
||||
|
||||
for (size_t j = 0; j < impl_->axis_.size(); j++)
|
||||
{
|
||||
if (impl_->axis_[j].dimension ==1) countX++;
|
||||
else if (impl_->axis_[j].dimension ==3) presentZ = true;
|
||||
else countY++;
|
||||
if (impl_->axis_[j].dimension == 1) countX++;
|
||||
else if (impl_->axis_[j].dimension == 2) countY++;
|
||||
else if (impl_->axis_[j].dimension == 3) countZ++;
|
||||
}
|
||||
|
||||
if (countX < 1 && countY > 1)
|
||||
{
|
||||
impl_->axis_[0].dimension == 1;
|
||||
@ -718,15 +725,15 @@ void odf_chart_context::end_group_series()
|
||||
axis->chart_axis_attlist_.chart_dimension_ = L"x";
|
||||
countY--;
|
||||
}
|
||||
if (presentZ == false && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
|
||||
{
|
||||
impl_->axis_.back().dimension == 3;
|
||||
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
|
||||
axis->chart_axis_attlist_.chart_dimension_ = L"z";
|
||||
countY--;
|
||||
}
|
||||
//if (countZ > 0 && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
|
||||
//{
|
||||
// impl_->axis_.back().dimension == 3;
|
||||
// chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
|
||||
// axis->chart_axis_attlist_.chart_dimension_ = L"z";
|
||||
// countY--;
|
||||
//}
|
||||
|
||||
for (size_t i=0; i < impl_->axis_group_series_.size(); i++)
|
||||
for (size_t i = 0; i < impl_->axis_group_series_.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < impl_->axis_.size(); j++)
|
||||
{
|
||||
@ -740,7 +747,7 @@ void odf_chart_context::end_group_series()
|
||||
}
|
||||
|
||||
|
||||
for (size_t i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
|
||||
for (size_t i = 0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
|
||||
{
|
||||
chart_series *series= dynamic_cast<chart_series*>(impl_->group_series_[i].get());
|
||||
if (series)
|
||||
@ -796,7 +803,7 @@ void odf_chart_context::start_axis()
|
||||
chart_axis *axis = dynamic_cast<chart_axis*>(elm.get());
|
||||
if (axis == NULL)return;
|
||||
//////////
|
||||
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
|
||||
|
||||
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
|
||||
@ -810,10 +817,19 @@ void odf_chart_context::start_axis()
|
||||
}
|
||||
start_element(elm, style_elm, style_name);
|
||||
|
||||
odf_axis_state axis_state={0,0,L"",elm};
|
||||
odf_axis_state axis_state={0, 0, L"", elm};
|
||||
impl_->axis_.push_back(axis_state);
|
||||
/////////////////////defaults
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_reverse_direction_ = false;
|
||||
|
||||
if (impl_->bar_overlap)
|
||||
{
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = impl_->bar_overlap.get();
|
||||
}
|
||||
if (impl_->bar_gap_width)
|
||||
{
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = impl_->bar_gap_width.get();
|
||||
}
|
||||
}
|
||||
void odf_chart_context::start_grid(int type)
|
||||
{
|
||||
@ -826,7 +842,7 @@ void odf_chart_context::start_grid(int type)
|
||||
if (type == 1) grid->chart_grid_attlist_.chart_class_ = L"major";
|
||||
if (type == 2) grid->chart_grid_attlist_.chart_class_ = L"minor";
|
||||
|
||||
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
|
||||
|
||||
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
|
||||
@ -850,7 +866,7 @@ void odf_chart_context::start_title()
|
||||
chart_title *title = dynamic_cast<chart_title*>(chart_elm.get());
|
||||
if (title == NULL)return;
|
||||
//////////
|
||||
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
|
||||
|
||||
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
|
||||
@ -874,7 +890,7 @@ void odf_chart_context::start_plot_area()
|
||||
|
||||
plot_area->chart_plot_area_attlist_.chart_data_source_has_labels_ = L"both";
|
||||
//////////
|
||||
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
|
||||
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
|
||||
|
||||
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
|
||||
@ -911,23 +927,22 @@ void odf_chart_context::start_text()
|
||||
impl_->odf_context_->start_text_context();
|
||||
impl_->odf_context_->text_context()->set_styles_context(impl_->styles_context_);
|
||||
|
||||
style_text_properties *text_props = NULL;
|
||||
|
||||
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
|
||||
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
|
||||
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
|
||||
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
|
||||
}
|
||||
|
||||
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
|
||||
impl_->odf_context_->text_context()->set_single_object(true, impl_->current_level_.back().paragraph_properties_, impl_->current_level_.back().text_properties_);
|
||||
}
|
||||
void odf_chart_context::end_text()
|
||||
{
|
||||
odf_text_context * text_context_ = text_context();
|
||||
if (text_context_ == NULL || impl_->current_level_.size() <1 )return;
|
||||
odf_text_context *text_context_ = text_context();
|
||||
|
||||
if (text_context_ == NULL || impl_->current_level_.size() < 1 )return;
|
||||
|
||||
for (size_t i=0; i< text_context_->text_elements_list_.size(); i++)
|
||||
for (size_t i = 0; i < text_context_->text_elements_list_.size(); i++)
|
||||
{
|
||||
if (text_context_->text_elements_list_[i].level ==0)
|
||||
{
|
||||
@ -945,6 +960,45 @@ void odf_chart_context::end_text()
|
||||
|
||||
impl_->odf_context_->end_text_context();
|
||||
}
|
||||
void odf_chart_context::set_textarea_vertical_align(int align)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
//switch(align)
|
||||
//{
|
||||
//case 0://SimpleTypes::textanchoringtypeB:
|
||||
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
|
||||
//case 1://SimpleTypes::textanchoringtypeCtr:
|
||||
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
|
||||
//case 2://SimpleTypes::textanchoringtypeDist:
|
||||
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Baseline);break;
|
||||
//case 3://SimpleTypes::textanchoringtypeJust:
|
||||
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
|
||||
//case 4://SimpleTypes::textanchoringtypeT:
|
||||
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
|
||||
//}
|
||||
}
|
||||
void odf_chart_context::set_textarea_rotation(double val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
if (val < 0.001 && val > -0.001) return;
|
||||
if (val < -360 || val > 360) return;
|
||||
|
||||
if (val < 0) val += 360;
|
||||
val = 360 - val;
|
||||
|
||||
impl_->current_level_.back().chart_properties_->content_.common_rotation_angle_attlist_.style_rotation_angle_ = (unsigned int)val;
|
||||
}
|
||||
|
||||
void odf_chart_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
|
||||
//if (left) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_left_ = length(*left, length::pt);
|
||||
//if (top) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_top_ = length(*top, length::pt);
|
||||
//if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
|
||||
//if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
|
||||
}
|
||||
|
||||
void odf_chart_context::start_floor()
|
||||
{
|
||||
office_element_ptr elm;
|
||||
@ -1478,6 +1532,13 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
|
||||
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_pie_offset_ = val;
|
||||
}
|
||||
void odf_chart_context::set_series_pie_bubble(bool val)
|
||||
{
|
||||
if (!impl_->current_level_.back().chart_properties_)return;
|
||||
|
||||
impl_->current_level_.back().chart_properties_->content_.chart_pie_bubble_ = val;
|
||||
|
||||
}
|
||||
//void odf_chart_context::set_cash(std::wstring format, std::vector<double> &data_double)
|
||||
//{
|
||||
// if (data_double.size() <1 || impl_->data_cell_ranges_.size() < 1) return;
|
||||
|
||||
@ -89,6 +89,7 @@ public:
|
||||
long get_count_data_points_series();
|
||||
|
||||
void set_series_pie_explosion(int val);
|
||||
void set_series_pie_bubble(bool val);
|
||||
void end_series();
|
||||
void end_group_series();
|
||||
|
||||
@ -136,6 +137,10 @@ public:
|
||||
void start_text();
|
||||
void end_text();
|
||||
|
||||
void set_textarea_vertical_align(int align);
|
||||
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
|
||||
void set_textarea_rotation (double val);
|
||||
|
||||
void add_domain(std::wstring formula);
|
||||
void add_categories(std::wstring formula, office_element_ptr & axis);
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ void odf_conversion_context::start_chart()
|
||||
create_object();
|
||||
create_element(L"office", L"chart", objects_.back().content, this, true);
|
||||
|
||||
chart_context_.set_styles_context(styles_context());
|
||||
chart_context_.set_styles_context(odf_conversion_context::styles_context());
|
||||
chart_context_.start_chart(get_current_object_element());
|
||||
}
|
||||
void odf_conversion_context::start_spreadsheet()
|
||||
|
||||
@ -2101,6 +2101,36 @@ void odf_drawing_context::set_line_dash_preset(int style)
|
||||
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid); break;
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
if (!impl_->current_paragraph_properties)
|
||||
{
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (draw)
|
||||
{
|
||||
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//??? find by name
|
||||
}
|
||||
}
|
||||
}
|
||||
if (impl_->current_paragraph_properties)
|
||||
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_textarea_vertical_align(int align)
|
||||
{
|
||||
@ -2136,6 +2166,18 @@ void odf_drawing_context::set_textarea_fit_to_size(bool val)
|
||||
impl_->current_graphic_properties->draw_fit_to_size_ = val;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_textarea_rotation(double val)
|
||||
{
|
||||
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
|
||||
if (style_state)
|
||||
{
|
||||
impl_->current_text_properties = style_state->get_text_properties();
|
||||
}
|
||||
|
||||
if (!impl_->current_text_properties) return;
|
||||
|
||||
impl_->current_text_properties->content_.style_text_rotation_angle_ = (int)val;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
|
||||
{
|
||||
@ -2249,36 +2291,6 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
if (!impl_->current_paragraph_properties)
|
||||
{
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (draw)
|
||||
{
|
||||
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
|
||||
{
|
||||
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
|
||||
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
|
||||
if (style_)
|
||||
{
|
||||
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
|
||||
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//??? find by name
|
||||
}
|
||||
}
|
||||
}
|
||||
if (impl_->current_paragraph_properties)
|
||||
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
|
||||
}
|
||||
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
|
||||
@ -231,6 +231,7 @@ public:
|
||||
void set_textarea_fontcolor (std::wstring hexColor);
|
||||
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
|
||||
void set_textarea_fit_to_size (bool val);
|
||||
void set_textarea_rotation (double val);
|
||||
|
||||
void set_placeholder_id (std::wstring val);
|
||||
void set_placeholder_type (int val);
|
||||
|
||||
@ -199,7 +199,7 @@ std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_fami
|
||||
}
|
||||
//office_element_ptr odf_style_context::find_odf_style(int oox_id_style, style_family::type family, bool root, _CP_OPT(bool) automatic)
|
||||
//{
|
||||
// //for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
|
||||
// //for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); ++it)
|
||||
// for (size_t i=0;i<style_state_list_.size(); i++)
|
||||
// {
|
||||
// if (style_state_list_[i]->odf_style_)
|
||||
|
||||
@ -100,6 +100,7 @@ public:
|
||||
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
|
||||
{
|
||||
default_column_width = -1;
|
||||
optimal_column_width = false;
|
||||
}
|
||||
|
||||
odf_table_state & current_table() {return tables_.back();}
|
||||
@ -107,13 +108,21 @@ public:
|
||||
|
||||
void start_table(odf_table_state & state) {tables_.push_back(state);}
|
||||
|
||||
void end_table() {if (tables_.size() > 0) tables_.pop_back(); default_column_width = -1; default_cell_properties = L"";}
|
||||
void end_table()
|
||||
{
|
||||
if (tables_.size() > 0) tables_.pop_back();
|
||||
|
||||
default_column_width = -1; // todo .. in level ???
|
||||
default_cell_properties = L"";
|
||||
optimal_column_width = false;
|
||||
}
|
||||
|
||||
odf_style_context * styles_context() {return odf_context_->styles_context();}
|
||||
|
||||
odf_conversion_context *odf_context_;
|
||||
|
||||
double default_column_width;
|
||||
double default_column_width;
|
||||
bool optimal_column_width;
|
||||
std::wstring default_cell_properties; // для предустановки ..
|
||||
|
||||
private:
|
||||
@ -307,6 +316,10 @@ void odf_table_context::set_default_column_width(double width)
|
||||
{
|
||||
impl_->default_column_width = width;
|
||||
}
|
||||
void odf_table_context::set_optimal_column_width(bool val)
|
||||
{
|
||||
impl_->optimal_column_width = val;
|
||||
}
|
||||
void odf_table_context::set_column_optimal(bool val)
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
@ -362,7 +375,11 @@ void odf_table_context::set_column_width(double width)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
|
||||
|
||||
if (impl_->optimal_column_width)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
}
|
||||
|
||||
impl_->current_table().table_width += width;
|
||||
}
|
||||
@ -370,7 +387,7 @@ void odf_table_context::set_column_width(double width)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
|
||||
if (impl_->default_column_width >=0)
|
||||
if (impl_->default_column_width >= 0)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
@ -66,6 +66,7 @@ public:
|
||||
|
||||
void start_table(office_element_ptr &elm, bool styled = false);
|
||||
void set_default_column_width(double width);
|
||||
void set_optimal_column_width(bool val);
|
||||
void change_current_column_width(double width);
|
||||
void end_table();
|
||||
|
||||
|
||||
@ -54,10 +54,10 @@ namespace cpdoccore {
|
||||
namespace odf_writer
|
||||
{
|
||||
|
||||
odf_text_context::odf_text_context(odf_conversion_context *odf_context)
|
||||
odf_text_context::odf_text_context(odf_conversion_context *odf_context, odf_style_context *styles_context)
|
||||
{
|
||||
odf_context_ = odf_context;
|
||||
styles_context_ = odf_context->styles_context();
|
||||
styles_context_ = styles_context;
|
||||
|
||||
single_paragraph_ = false;
|
||||
paragraph_properties_ = NULL;
|
||||
|
||||
@ -53,7 +53,7 @@ class style_text_properties;
|
||||
class odf_text_context: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
odf_text_context (odf_conversion_context *odf_context);
|
||||
odf_text_context (odf_conversion_context *odf_context, odf_style_context *styles_context);
|
||||
~odf_text_context ();
|
||||
public:
|
||||
odf_style_context* get_styles_context();//для embedded
|
||||
|
||||
@ -132,8 +132,7 @@ void odp_conversion_context::end_layout_slide()
|
||||
}
|
||||
void odp_conversion_context::start_text_context()
|
||||
{
|
||||
text_context_ = new odf_text_context(this);
|
||||
text_context_->set_styles_context(slide_context_.get_styles_context());
|
||||
text_context_ = new odf_text_context(this, slide_context_.get_styles_context());
|
||||
}
|
||||
void odp_conversion_context::end_text_context()
|
||||
{
|
||||
|
||||
@ -472,8 +472,7 @@ void ods_conversion_context::add_column(int start_column, int repeated, int leve
|
||||
}
|
||||
void ods_conversion_context::start_text_context()
|
||||
{
|
||||
current_text_context_ = new odf_text_context(this);
|
||||
|
||||
current_text_context_ = new odf_text_context(this, styles_context());
|
||||
}
|
||||
void ods_conversion_context::end_text_context()
|
||||
{
|
||||
|
||||
@ -1137,20 +1137,20 @@ void ods_table_state::start_conditional_rule(int rule_type)
|
||||
boost::algorithm::split(splitted, test, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
cell = splitted[0];
|
||||
|
||||
condition->calcext_condition_attr_.calcext_base_cell_address_ = table + cell;
|
||||
condition->attr_.calcext_base_cell_address_ = table + cell;
|
||||
}
|
||||
switch(rule_type)
|
||||
{
|
||||
case 4: condition->calcext_condition_attr_.calcext_value_ = L"contains-text( )"; break;
|
||||
case 5: condition->calcext_condition_attr_.calcext_value_ = L"is-error"; break;
|
||||
case 6: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 8: condition->calcext_condition_attr_.calcext_value_ = L"duplicate"; break;
|
||||
case 9: condition->calcext_condition_attr_.calcext_value_ = L"formula-is()"; break;
|
||||
case 11: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text( )"; break;
|
||||
case 12: condition->calcext_condition_attr_.calcext_value_ = L"is-no-error"; break;
|
||||
case 13: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 15: condition->calcext_condition_attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
|
||||
case 16: condition->calcext_condition_attr_.calcext_value_ = L"unique"; break;
|
||||
case 4: condition->attr_.calcext_value_ = L"contains-text( )"; break;
|
||||
case 5: condition->attr_.calcext_value_ = L"is-error"; break;
|
||||
case 6: condition->attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 8: condition->attr_.calcext_value_ = L"duplicate"; break;
|
||||
case 9: condition->attr_.calcext_value_ = L"formula-is()"; break;
|
||||
case 11: condition->attr_.calcext_value_ = L"not-contains-text( )"; break;
|
||||
case 12: condition->attr_.calcext_value_ = L"is-no-error"; break;
|
||||
case 13: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 15: condition->attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
|
||||
case 16: condition->attr_.calcext_value_ = L"unique"; break;
|
||||
case 0: /*aboveAverage*/
|
||||
case 1: /*beginsWith*/
|
||||
case 2: /*cellIs*/
|
||||
@ -1178,9 +1178,9 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
|
||||
|
||||
std::wstring operator_;
|
||||
bool s = false;
|
||||
if (condition->calcext_condition_attr_.calcext_value_)//есть опреатор
|
||||
if (condition->attr_.calcext_value_)//есть опреатор
|
||||
{
|
||||
operator_ = *condition->calcext_condition_attr_.calcext_value_;
|
||||
operator_ = *condition->attr_.calcext_value_;
|
||||
int f = operator_.find(L"(");
|
||||
if (f > 0)
|
||||
{
|
||||
@ -1188,7 +1188,7 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
|
||||
operator_ = operator_.substr(0,operator_.length() - 2);
|
||||
}
|
||||
}
|
||||
condition->calcext_condition_attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
|
||||
condition->attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
|
||||
}
|
||||
}
|
||||
void ods_table_state::set_conditional_style_name(std::wstring style_name)
|
||||
@ -1196,8 +1196,8 @@ void ods_table_state::set_conditional_style_name(std::wstring style_name)
|
||||
calcext_condition* condition = dynamic_cast<calcext_condition*> (current_level_.back().get());
|
||||
calcext_date_is* date_is = dynamic_cast<calcext_date_is*> (current_level_.back().get());
|
||||
|
||||
if (condition) condition->calcext_condition_attr_.calcext_apply_style_name_= style_name;
|
||||
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_name;
|
||||
if (condition) condition->attr_.calcext_apply_style_name_ = style_name;
|
||||
if (date_is) date_is->attr_.calcext_style_ = style_name;
|
||||
}
|
||||
void ods_table_state::set_conditional_operator(int _operator)
|
||||
{
|
||||
@ -1206,18 +1206,18 @@ void ods_table_state::set_conditional_operator(int _operator)
|
||||
{
|
||||
switch(_operator)
|
||||
{
|
||||
case 0: condition->calcext_condition_attr_.calcext_value_ = L"begins-with()"; break;
|
||||
case 1: condition->calcext_condition_attr_.calcext_value_ = L"between()"; break;
|
||||
case 2: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 3: condition->calcext_condition_attr_.calcext_value_ = L"ends-with()"; break;
|
||||
case 4: condition->calcext_condition_attr_.calcext_value_ = L"="; break;
|
||||
case 5: condition->calcext_condition_attr_.calcext_value_ = L">"; break;
|
||||
case 6: condition->calcext_condition_attr_.calcext_value_ = L">="; break;
|
||||
case 7: condition->calcext_condition_attr_.calcext_value_ = L"<"; break;
|
||||
case 8: condition->calcext_condition_attr_.calcext_value_ = L"<="; break;
|
||||
case 9: condition->calcext_condition_attr_.calcext_value_ = L"not-between()"; break;
|
||||
case 10:condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 11:condition->calcext_condition_attr_.calcext_value_ = L"!="; break;
|
||||
case 0: condition->attr_.calcext_value_ = L"begins-with()"; break;
|
||||
case 1: condition->attr_.calcext_value_ = L"between()"; break;
|
||||
case 2: condition->attr_.calcext_value_ = L"contains-text()"; break;
|
||||
case 3: condition->attr_.calcext_value_ = L"ends-with()"; break;
|
||||
case 4: condition->attr_.calcext_value_ = L"="; break;
|
||||
case 5: condition->attr_.calcext_value_ = L">"; break;
|
||||
case 6: condition->attr_.calcext_value_ = L">="; break;
|
||||
case 7: condition->attr_.calcext_value_ = L"<"; break;
|
||||
case 8: condition->attr_.calcext_value_ = L"<="; break;
|
||||
case 9: condition->attr_.calcext_value_ = L"not-between()"; break;
|
||||
case 10:condition->attr_.calcext_value_ = L"not-contains-text()"; break;
|
||||
case 11:condition->attr_.calcext_value_ = L"!="; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1229,8 +1229,8 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
|
||||
if (icon_set || data_bar)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"formatting-entry",elm, context_);
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"formatting-entry", elm, context_);
|
||||
|
||||
current_level_.back()->add_child_element(elm);
|
||||
|
||||
@ -1247,13 +1247,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
case 3: //Number
|
||||
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
|
||||
}
|
||||
entry->calcext_value_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (color_scale)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"color-scale-entry",elm, context_);
|
||||
office_element_ptr elm;
|
||||
create_element(L"calcext", L"color-scale-entry", elm, context_);
|
||||
|
||||
current_level_.back()->add_child_element(elm);
|
||||
|
||||
@ -1263,13 +1264,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
|
||||
switch(type)
|
||||
{
|
||||
case 0: //Formula
|
||||
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
|
||||
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
|
||||
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
|
||||
case 5: //Percentile
|
||||
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
|
||||
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
|
||||
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
|
||||
case 5: entry->calcext_type_ = calcext_type(calcext_type::Percentile); break;
|
||||
case 3: //Number
|
||||
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
|
||||
}
|
||||
entry->calcext_value_ = value;
|
||||
}
|
||||
///color???? - прихоодят выше уровнем !!
|
||||
}
|
||||
@ -1281,11 +1283,22 @@ void ods_table_state::set_conditional_iconset(int type_iconset)
|
||||
|
||||
if (cond_format)
|
||||
{
|
||||
cond_format->calcext_icon_set_attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
|
||||
cond_format->attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
|
||||
}
|
||||
}
|
||||
void ods_table_state::add_conditional_colorscale(_CP_OPT(color) color)
|
||||
void ods_table_state::add_conditional_colorscale(int index, _CP_OPT(color) color)
|
||||
{
|
||||
calcext_color_scale *scale = dynamic_cast<calcext_color_scale*>(current_level_.back().get());
|
||||
|
||||
if (!scale) return;
|
||||
if (index >= scale->content_.size() || index < 0) return;
|
||||
|
||||
calcext_color_scale_entry* color_scale_entry = dynamic_cast<calcext_color_scale_entry*>(scale->content_[index].get());
|
||||
|
||||
if (color_scale_entry)
|
||||
{
|
||||
color_scale_entry->calcext_color_ = color;
|
||||
}
|
||||
}
|
||||
void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
|
||||
{
|
||||
@ -1293,7 +1306,7 @@ void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
|
||||
|
||||
if (cond_format)
|
||||
{
|
||||
cond_format->calcext_data_bar_attr_.calcext_positive_color_ = color;
|
||||
cond_format->attr_.calcext_positive_color_ = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ public:
|
||||
void set_conditional_formula(std::wstring formula);
|
||||
void set_conditional_value(int type, std::wstring value );
|
||||
void set_conditional_iconset(int type_iconset);
|
||||
void add_conditional_colorscale(_CP_OPT(odf_types::color) color);
|
||||
void add_conditional_colorscale(int index, _CP_OPT(odf_types::color) color);
|
||||
void set_conditional_databar_color(_CP_OPT(odf_types::color) color);
|
||||
|
||||
void set_conditional_style_name(std::wstring style_name);
|
||||
|
||||
@ -105,7 +105,8 @@ void odt_conversion_context::start_document()
|
||||
|
||||
root_document_ = get_current_object_element();
|
||||
root_text_ = dynamic_cast<office_text*>(root_document_.get());
|
||||
main_text_context_ = new odf_text_context(this);
|
||||
|
||||
main_text_context_ = new odf_text_context(this, styles_context());
|
||||
|
||||
page_layout_context()->set_styles_context(styles_context());
|
||||
|
||||
@ -182,7 +183,7 @@ odf_text_context* odt_conversion_context::text_context()
|
||||
}
|
||||
void odt_conversion_context::start_text_context()
|
||||
{
|
||||
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this));
|
||||
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this, odf_conversion_context::styles_context()));
|
||||
if (!new_text_context_)return;
|
||||
|
||||
text_context_.push_back(new_text_context_);
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
/// \brief office:chart
|
||||
/// office:chart
|
||||
class office_chart : public office_element_impl<office_chart>
|
||||
{
|
||||
public:
|
||||
@ -86,7 +86,7 @@ public:
|
||||
_CP_OPT(std::wstring) chart_row_mapping_;
|
||||
};
|
||||
|
||||
/// \brief chart:chart
|
||||
/// chart:chart
|
||||
class chart_chart : public office_element_impl<chart_chart>
|
||||
{
|
||||
public:
|
||||
@ -118,7 +118,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:title
|
||||
/// chart:title
|
||||
class chart_title : public office_element_impl<chart_title>
|
||||
{
|
||||
public:
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_title);
|
||||
|
||||
/// \brief chart:subtitle
|
||||
/// chart:subtitle
|
||||
class chart_subtitle : public office_element_impl<chart_subtitle>
|
||||
{
|
||||
public:
|
||||
@ -161,7 +161,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_subtitle);
|
||||
|
||||
/// \brief chart:footer
|
||||
/// chart:footer
|
||||
class chart_footer : public office_element_impl<chart_footer>
|
||||
{
|
||||
public:
|
||||
@ -200,7 +200,7 @@ public:
|
||||
_CP_OPT(odf_types::length) chartooo_width_;
|
||||
};
|
||||
|
||||
/// \brief chart:legend
|
||||
/// chart:legend
|
||||
class chart_legend : public office_element_impl<chart_legend>
|
||||
{
|
||||
public:
|
||||
@ -239,7 +239,7 @@ public:
|
||||
// common-dr3d-transform-attlist
|
||||
};
|
||||
|
||||
/// \brief chart:plot-area
|
||||
/// chart:plot-area
|
||||
class chart_plot_area : public office_element_impl<chart_plot_area>
|
||||
{
|
||||
public:
|
||||
@ -291,7 +291,7 @@ public:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_wall);
|
||||
|
||||
|
||||
/// \brief chart:floor
|
||||
/// chart:floor
|
||||
class chart_floor : public office_element_impl<chart_floor>
|
||||
{
|
||||
public:
|
||||
@ -322,7 +322,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:axis
|
||||
/// chart:axis
|
||||
class chart_axis : public office_element_impl<chart_axis>
|
||||
{
|
||||
public:
|
||||
@ -354,7 +354,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/// \brief chart:grid
|
||||
/// chart:grid
|
||||
class chart_grid : public office_element_impl<chart_grid>
|
||||
{
|
||||
public:
|
||||
@ -375,7 +375,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_grid);
|
||||
|
||||
/// \brief chart:categories
|
||||
/// chart:categories
|
||||
class chart_categories : public office_element_impl<chart_categories>
|
||||
{
|
||||
public:
|
||||
@ -409,7 +409,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/// \brief chart:series
|
||||
/// chart:series
|
||||
class chart_series : public office_element_impl<chart_series>
|
||||
{
|
||||
public:
|
||||
@ -431,7 +431,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_series);
|
||||
|
||||
/// \brief chart:domain
|
||||
/// chart:domain
|
||||
class chart_domain : public office_element_impl<chart_domain>
|
||||
{
|
||||
public:
|
||||
@ -461,7 +461,7 @@ public:
|
||||
common_chart_attlist common_attlist_;
|
||||
};
|
||||
|
||||
/// \brief chart:data-point
|
||||
/// chart:data-point
|
||||
class chart_data_point : public office_element_impl<chart_data_point>
|
||||
{
|
||||
public:
|
||||
@ -482,7 +482,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_data_point);
|
||||
|
||||
/// \brief chart:mean-value
|
||||
/// chart:mean-value
|
||||
class chart_mean_value : public office_element_impl<chart_mean_value>
|
||||
{
|
||||
public:
|
||||
@ -503,7 +503,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_mean_value);
|
||||
|
||||
/// \brief chart:error-indicator
|
||||
/// chart:error-indicator
|
||||
class chart_error_indicator : public office_element_impl<chart_error_indicator>
|
||||
{
|
||||
public:
|
||||
@ -566,7 +566,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_regression_curve);
|
||||
|
||||
/// \brief chart:stock-gain-marker
|
||||
/// chart:stock-gain-marker
|
||||
class chart_stock_gain_marker : public office_element_impl<chart_stock_gain_marker>
|
||||
{
|
||||
public:
|
||||
@ -587,7 +587,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_gain_marker);
|
||||
|
||||
/// \brief chart:stock-loss-marker
|
||||
/// chart:stock-loss-marker
|
||||
class chart_stock_loss_marker : public office_element_impl<chart_stock_loss_marker>
|
||||
{
|
||||
public:
|
||||
@ -608,7 +608,7 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_loss_marker);
|
||||
|
||||
/// \brief chart:stock-range-line
|
||||
/// chart:stock-range-line
|
||||
class chart_stock_range_line : public office_element_impl<chart_stock_range_line>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -95,6 +95,7 @@ public:
|
||||
_CP_OPT(int) chart_spline_order_;
|
||||
_CP_OPT(int) chart_spline_resolution_;
|
||||
_CP_OPT(int) chart_pie_offset_;
|
||||
_CP_OPT(bool) chart_pie_bubble_;
|
||||
_CP_OPT(int) chart_interval_minor_divisor_;
|
||||
|
||||
_CP_OPT(double) chart_maximum_;
|
||||
@ -105,15 +106,15 @@ public:
|
||||
_CP_OPT(double) chart_error_margin_;
|
||||
_CP_OPT(double) chart_error_upper_limit_;
|
||||
|
||||
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
|
||||
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
|
||||
_CP_OPT(odf_types::chart_solid_type) chart_solid_type_;
|
||||
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
|
||||
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
|
||||
_CP_OPT(odf_types::direction) style_direction_;
|
||||
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
|
||||
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
|
||||
_CP_OPT(odf_types::length) chart_symbol_width_;
|
||||
_CP_OPT(odf_types::length) chart_symbol_height_;
|
||||
_CP_OPT(odf_types::chart_regression_type) chart_regression_type_;
|
||||
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
|
||||
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
|
||||
_CP_OPT(odf_types::chart_error_category) chart_error_category_;
|
||||
|
||||
_CP_OPT(std::wstring) chart_axis_label_position_;
|
||||
|
||||
@ -83,8 +83,13 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
|
||||
common_keep_with_next_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_border_attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
if (style_background_image_) style_background_image_->serialize(_Wostream);
|
||||
CP_XML_ATTR_OPT(L"table:align", table_align_);
|
||||
|
||||
//not from specification !!
|
||||
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
|
||||
//not from specification !!
|
||||
|
||||
if (style_background_image_) style_background_image_->serialize(_Wostream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,7 +114,8 @@ void table_format_properties::apply_from(const table_format_properties & Other)
|
||||
common_keep_with_next_attlist_.apply_from(Other.common_keep_with_next_attlist_);
|
||||
common_border_attlist_.apply_from(Other.common_border_attlist_);
|
||||
|
||||
style_background_image_ = Other.style_background_image_;
|
||||
style_background_image_ = Other.style_background_image_;
|
||||
style_use_optimal_column_width_ = Other.style_use_optimal_column_width_;
|
||||
}
|
||||
|
||||
// style:table-properties
|
||||
@ -145,9 +151,10 @@ void style_table_column_properties_attlist::serialize(std::wostream & _Wostream,
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
|
||||
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
|
||||
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
|
||||
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
|
||||
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
|
||||
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
|
||||
|
||||
common_break_attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,8 +84,8 @@ public:
|
||||
odf_types::common_border_attlist common_border_attlist_;
|
||||
|
||||
|
||||
office_element_ptr style_background_image_;
|
||||
|
||||
office_element_ptr style_background_image_;
|
||||
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "XlsxConverter.h"
|
||||
#include "PptxConverter.h"
|
||||
#include "DocxConverter.h"
|
||||
|
||||
@ -565,9 +566,9 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
|
||||
|
||||
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
|
||||
|
||||
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); ++it)
|
||||
{
|
||||
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
|
||||
docx_converter->convert(*it);
|
||||
|
||||
convert(oox_shape->oTextBoxBodyPr.GetPointer());
|
||||
|
||||
@ -664,6 +665,8 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
if (effectLst) convert(effectLst);
|
||||
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
|
||||
|
||||
//convert(oox_spPr->ExtLst.GetPointer());
|
||||
|
||||
//nullable<OOX::Drawing::CEffectContainer> EffectDag;
|
||||
|
||||
//nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst;
|
||||
@ -672,6 +675,40 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
void OoxConverter::convert(OOX::Drawing::COfficeArtExtensionList *ext_list)
|
||||
{
|
||||
if (ext_list == NULL)return;
|
||||
|
||||
for (size_t i = 0; i < ext_list->m_arrExt.size(); i++)
|
||||
{
|
||||
convert(ext_list->m_arrExt[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void OoxConverter::convert(OOX::Drawing::COfficeArtExtension *art_ext)
|
||||
{
|
||||
if (art_ext == NULL)return;
|
||||
|
||||
if (art_ext->m_oSparklineGroups.IsInit() || art_ext->m_oAltTextTable.IsInit() || !art_ext->m_arrConditionalFormatting.empty())
|
||||
{
|
||||
XlsxConverter *xlsx_converter = dynamic_cast<XlsxConverter*>(this);
|
||||
if (xlsx_converter)
|
||||
{
|
||||
xlsx_converter->convert(art_ext->m_oSparklineGroups.GetPointer());
|
||||
xlsx_converter->convert(art_ext->m_oAltTextTable.GetPointer());
|
||||
|
||||
for (size_t i = 0; i < art_ext->m_arrConditionalFormatting.size(); i++)
|
||||
{
|
||||
xlsx_converter->convert(art_ext->m_arrConditionalFormatting[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//convert(art_ext->m_oCompatExt.GetPointer());
|
||||
//convert(art_ext->m_oDataModelExt.GetPointer());
|
||||
}
|
||||
|
||||
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
|
||||
{
|
||||
if (oox_fill == NULL) return;
|
||||
@ -1165,6 +1202,10 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
//+ style section
|
||||
//+element text:section в котором параграфы
|
||||
}
|
||||
if (oox_bodyPr->rot.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
|
||||
}
|
||||
|
||||
switch(oox_bodyPr->Fit.type)
|
||||
{
|
||||
@ -1505,7 +1546,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
|
||||
}
|
||||
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
|
||||
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
|
||||
odf_writer::style_text_properties* text_properties = NULL;
|
||||
odf_writer::style_text_properties* text_properties = odf_context()->text_context()->get_text_properties();
|
||||
|
||||
if (!paragraph_properties)
|
||||
{
|
||||
|
||||
@ -70,9 +70,9 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
|
||||
}
|
||||
//m_oPreferRelative//типо можно менять размер
|
||||
|
||||
for (size_t i = 0; i < vml_shape_type->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_shape_type->m_arrItems.begin(); it != vml_shape_type->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(vml_shape_type->m_arrItems[i]);
|
||||
convert(*it);
|
||||
}
|
||||
|
||||
if (vml_shape_type->m_sAdj.IsInit())//настройка дл фигуры заданной формулами
|
||||
@ -90,9 +90,9 @@ void OoxConverter::convert(OOX::Vml::CFormulas *vml_formulas)
|
||||
{
|
||||
if (vml_formulas == NULL) return;
|
||||
|
||||
for (size_t i = 0; i < vml_formulas->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::Vml::CF*>::iterator it = vml_formulas->m_arrItems.begin(); it != vml_formulas->m_arrItems.end(); ++it)
|
||||
{
|
||||
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(vml_formulas->m_arrItems[i]);
|
||||
OOX::Vml::CF *cf = dynamic_cast<OOX::Vml::CF *>(*it);
|
||||
if (cf == NULL) continue;
|
||||
|
||||
//odf_context()->drawing_context()->add_formula(L"", cf->m_sEqn);
|
||||
@ -717,9 +717,9 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
|
||||
{
|
||||
odf_context()->start_text_context();
|
||||
{
|
||||
for (size_t i = 0; i < vml_textbox->m_oTxtbxContent->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_textbox->m_oTxtbxContent->m_arrItems.begin(); it != vml_textbox->m_oTxtbxContent->m_arrItems.end(); ++it)
|
||||
{
|
||||
docx_converter->convert(vml_textbox->m_oTxtbxContent->m_arrItems[i]);
|
||||
docx_converter->convert(*it);
|
||||
}
|
||||
odf_context()->drawing_context()->set_text( odf_context()->text_context());
|
||||
}
|
||||
@ -890,9 +890,9 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < vml_common->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_common->m_arrItems.begin(); it != vml_common->m_arrItems.end(); ++it)
|
||||
{
|
||||
convert(vml_common->m_arrItems[i]);
|
||||
convert(*it);
|
||||
}
|
||||
|
||||
if (vml_common->m_oFilled.IsInit() && vml_common->m_oFilled->GetValue() == SimpleTypes::booleanFalse)
|
||||
@ -920,27 +920,27 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
|
||||
odf_context()->drawing_context()->set_group_shift(vml_group->m_oCoordOrigin->GetX(), vml_group->m_oCoordOrigin->GetY());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < vml_group->m_arrItems.size(); i++)
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = vml_group->m_arrItems.begin(); it != vml_group->m_arrItems.end(); ++it)
|
||||
{
|
||||
if (vml_group->m_arrItems[i] == NULL) continue;
|
||||
if (*it == NULL) continue;
|
||||
|
||||
if (vml_group->m_arrItems[i]->getType() == OOX::et_v_group)
|
||||
if ((*it)->getType() == OOX::et_v_group)
|
||||
{
|
||||
OOX::Vml::CGroup * vml = dynamic_cast<OOX::Vml::CGroup*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CGroup * vml = dynamic_cast<OOX::Vml::CGroup*>(*it);
|
||||
convert(vml);
|
||||
continue;
|
||||
}
|
||||
|
||||
OOX::Vml::CVmlCommonElements * vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CVmlCommonElements * vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements*>(*it);
|
||||
if (vml_common == NULL) continue; // не элемент
|
||||
|
||||
odf_context()->drawing_context()->start_drawing();
|
||||
|
||||
switch(vml_group->m_arrItems[i]->getType())
|
||||
switch((*it)->getType())
|
||||
{
|
||||
case OOX::et_v_shape:
|
||||
{
|
||||
OOX::Vml::CShape * vml = dynamic_cast<OOX::Vml::CShape*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CShape * vml = dynamic_cast<OOX::Vml::CShape*>(*it);
|
||||
bool bSet = false;
|
||||
if (vml)
|
||||
{
|
||||
@ -973,7 +973,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
|
||||
}break;
|
||||
case OOX::et_v_shapetype:
|
||||
{
|
||||
OOX::Vml::CShapeType * vml = dynamic_cast<OOX::Vml::CShapeType*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CShapeType * vml = dynamic_cast<OOX::Vml::CShapeType*>(*it);
|
||||
SimpleTypes::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive;
|
||||
|
||||
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
|
||||
@ -982,34 +982,34 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
|
||||
}break;
|
||||
case OOX::et_v_oval:
|
||||
{
|
||||
OOX::Vml::COval * vml = dynamic_cast<OOX::Vml::COval*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::COval * vml = dynamic_cast<OOX::Vml::COval*>(*it);
|
||||
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeEllipse);
|
||||
OoxConverter::convert(vml);
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}break;
|
||||
case OOX::et_v_rect:
|
||||
{
|
||||
OOX::Vml::CRect * vml = dynamic_cast<OOX::Vml::CRect*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CRect * vml = dynamic_cast<OOX::Vml::CRect*>(*it);
|
||||
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
|
||||
OoxConverter::convert(vml);
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}break;
|
||||
case OOX::et_v_line:
|
||||
{
|
||||
OOX::Vml::CLine * vml = dynamic_cast<OOX::Vml::CLine*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CLine * vml = dynamic_cast<OOX::Vml::CLine*>(*it);
|
||||
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine);
|
||||
OoxConverter::convert(vml);
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}break;
|
||||
case OOX::et_v_curve:
|
||||
{
|
||||
OOX::Vml::CCurve * vml = dynamic_cast<OOX::Vml::CCurve*>(vml_group->m_arrItems[i]);
|
||||
OOX::Vml::CCurve * vml = dynamic_cast<OOX::Vml::CCurve*>(*it);
|
||||
odf_context()->drawing_context()->start_shape(1000);
|
||||
OoxConverter::convert(vml);
|
||||
odf_context()->drawing_context()->end_shape();
|
||||
}break;
|
||||
default:
|
||||
convert(vml_group->m_arrItems[i]);
|
||||
convert(*it);
|
||||
}
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
@ -58,6 +58,8 @@
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
|
||||
|
||||
#define PROGRESSEVENT_ID 0
|
||||
|
||||
namespace Oox2Odf
|
||||
@ -285,6 +287,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
{
|
||||
convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_extLst:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Drawing::COfficeArtExtensionList*>(oox_unknown));
|
||||
}break;
|
||||
case OOX::et_a_ext:
|
||||
{
|
||||
convert(dynamic_cast<OOX::Drawing::COfficeArtExtension*>(oox_unknown));
|
||||
}break;
|
||||
// "ненужные" элементы
|
||||
case OOX::et_w_softHyphen:
|
||||
case OOX::et_w_proofErr:
|
||||
|
||||
@ -78,6 +78,8 @@ namespace OOX
|
||||
//class CPresetTextShape;
|
||||
class CInline;
|
||||
class CAnchor;
|
||||
class COfficeArtExtensionList;
|
||||
class COfficeArtExtension;
|
||||
}
|
||||
namespace Spreadsheet
|
||||
{
|
||||
@ -395,7 +397,6 @@ public:
|
||||
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
|
||||
void convert(PPTX::Logic::Path2D *oox_path2D);
|
||||
void convert(PPTX::Logic::PathBase *oox_path);
|
||||
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
|
||||
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
|
||||
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
|
||||
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
|
||||
@ -420,7 +421,12 @@ public:
|
||||
void convert(PPTX::Logic::Run *oox_run);
|
||||
void convert(PPTX::Logic::Fld *oox_fld);
|
||||
void convert(PPTX::Logic::Br *oox_br);
|
||||
|
||||
void convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style = NULL);
|
||||
void convert_chart_text(PPTX::Logic::TxBody *oox_txBody);
|
||||
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
|
||||
void convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr);
|
||||
|
||||
void convert(PPTX::Logic::MathParaWrapper *oox_math);
|
||||
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
|
||||
void convert(PPTX::Logic::ChartRec *oox_chart);
|
||||
@ -453,7 +459,9 @@ public:
|
||||
void convert(OOX::Spreadsheet::CT_Area3DChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_AreaChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_Bar3DChart *chart);
|
||||
void convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_BarChart *chart);
|
||||
void convert_before(OOX::Spreadsheet::CT_BarChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_Line3DChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_LineChart *chart);
|
||||
void convert(OOX::Spreadsheet::CT_Pie3DChart *chart);
|
||||
@ -514,6 +522,9 @@ public:
|
||||
void convert(OOX::Vml::CGroup *vml_group);
|
||||
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
|
||||
void convert(OOX::Vml::CFormulas *vml_formulas);
|
||||
|
||||
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
|
||||
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
|
||||
};
|
||||
|
||||
} // namespace Oox2Odf
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user