mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-22 15:57:09 +08:00
Compare commits
20 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 09941c67ac | |||
| c2605bb582 | |||
| ab2703c825 | |||
| 08ce8cb3f5 | |||
| 5efe043ab3 | |||
| f2af1ccd36 | |||
| 113d5b4ca3 | |||
| d3461dd3cb | |||
| e95a0fb765 | |||
| c5ce1e27e4 | |||
| 7ecc7fa1df | |||
| c46cd9e6e5 | |||
| e299e59d11 | |||
| 1e0f4d6fdb | |||
| 4dae8f50fa | |||
| 9cc5ed1db0 | |||
| 6d1dd9c420 | |||
| 549e3dc579 | |||
| 8440b18223 | |||
| 470eddf2b1 |
@ -393,7 +393,7 @@ namespace XMLTools
|
||||
else
|
||||
{
|
||||
std::string s(m_str.begin(), m_str.end());
|
||||
file.WriteFile((unsigned char*)s.c_str(), s.length());
|
||||
file.WriteFile((unsigned char*)s.c_str(), (DWORD)s.length());
|
||||
}
|
||||
file.CloseFile();
|
||||
return true;
|
||||
|
||||
@ -321,7 +321,7 @@ namespace DocFileFormat
|
||||
|
||||
case sprmCFtcBi :
|
||||
{//default from FontTable
|
||||
SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
|
||||
@ -373,7 +373,7 @@ namespace DocFileFormat
|
||||
case sprmOldCFtc:
|
||||
case sprmCRgFtc0:
|
||||
{ // font family
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
@ -388,7 +388,8 @@ namespace DocFileFormat
|
||||
|
||||
case sprmCRgFtc1:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( L"w:eastAsia" );
|
||||
@ -403,7 +404,8 @@ namespace DocFileFormat
|
||||
|
||||
case sprmCRgFtc2:
|
||||
{
|
||||
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
|
||||
{
|
||||
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( L"w:hAnsi" );
|
||||
|
||||
@ -88,7 +88,7 @@ namespace DocFileFormat
|
||||
int DocumentMapping::getCurrentSection(int cp)
|
||||
{
|
||||
//if cp is the last char of a section, the next section will start at cp +1
|
||||
int current = 0;
|
||||
size_t current = 0;
|
||||
|
||||
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
|
||||
{
|
||||
@ -107,7 +107,7 @@ namespace DocFileFormat
|
||||
{
|
||||
if ( !m_document->ListPlex ) return -1;
|
||||
|
||||
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
|
||||
for (size_t i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
|
||||
{
|
||||
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
|
||||
{
|
||||
@ -382,7 +382,7 @@ namespace DocFileFormat
|
||||
int DocumentMapping::writeRun (std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp)
|
||||
{
|
||||
int cp = initialCp;
|
||||
int result_cp = cp + chars->size();
|
||||
int result_cp = cp + (int)chars->size();
|
||||
|
||||
if ((_skipRuns <= 0) && (chars->size() > 0))
|
||||
{
|
||||
@ -564,7 +564,7 @@ namespace DocFileFormat
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
std::wstring f;
|
||||
if (cpFieldEnd < m_document->Text->size())
|
||||
if (cpFieldEnd < (int)m_document->Text->size())
|
||||
f = std::wstring( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
|
||||
std::wstring EMBED ( L" EMBED" );
|
||||
@ -660,11 +660,11 @@ namespace DocFileFormat
|
||||
|
||||
if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
|
||||
{
|
||||
int d = f1.find(PAGEREF);
|
||||
int d = (int)f1.find(PAGEREF);
|
||||
|
||||
_writeWebHidden = true;
|
||||
std::wstring _writeTocLink =f1.substr(d + 9);
|
||||
d = _writeTocLink.find(L" ");
|
||||
d = (int)_writeTocLink.find(L" ");
|
||||
_writeTocLink = _writeTocLink.substr(0, d);
|
||||
|
||||
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
|
||||
@ -1176,7 +1176,8 @@ namespace DocFileFormat
|
||||
TableInfo tai( papx );
|
||||
|
||||
//build the table grid
|
||||
std::vector<short>* grid = buildTableGrid( cp, nestingLevel );
|
||||
std::vector<short> grid, grid_write;
|
||||
buildTableGrid( cp, nestingLevel, grid, grid_write );
|
||||
|
||||
//find first row end
|
||||
int fcRowEnd = findRowEndFc( cp, nestingLevel );
|
||||
@ -1187,7 +1188,7 @@ namespace DocFileFormat
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
|
||||
|
||||
//Convert it
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, grid );
|
||||
TablePropertiesMapping *tpMapping = new TablePropertiesMapping( m_pXmlWriter, m_document->Styles, &grid, &grid_write );
|
||||
|
||||
row1Tapx.Convert( tpMapping );
|
||||
|
||||
@ -1200,7 +1201,7 @@ namespace DocFileFormat
|
||||
//only convert the cells with the given nesting level
|
||||
while ( tai.iTap == nestingLevel )
|
||||
{
|
||||
cp = writeTableRow( cp, grid, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
|
||||
//?fc = m_document->FindFileCharPos(cp );
|
||||
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
|
||||
papx = findValidPapx( fc );
|
||||
@ -1213,7 +1214,7 @@ namespace DocFileFormat
|
||||
//convert until the end of table is reached
|
||||
while ( tai.fInTable )
|
||||
{
|
||||
cp = writeTableRow( cp, grid, nestingLevel );
|
||||
cp = writeTableRow( cp, &grid, &grid_write, nestingLevel );
|
||||
fc = m_document->FindFileCharPos( cp );
|
||||
|
||||
papx = findValidPapx( fc );
|
||||
@ -1224,18 +1225,16 @@ namespace DocFileFormat
|
||||
//close w:tbl
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:tbl" );
|
||||
|
||||
RELEASEOBJECT( grid );
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
std::vector<short>* DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel)
|
||||
bool DocumentMapping::buildTableGrid(int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write)
|
||||
{
|
||||
ParagraphPropertyExceptions* backup = _lastValidPapx;
|
||||
|
||||
std::vector<short> boundaries;
|
||||
std::vector<short>* grid = new std::vector<short>();
|
||||
std::vector<short> boundaries_all;
|
||||
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
@ -1252,25 +1251,43 @@ namespace DocFileFormat
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
|
||||
{
|
||||
//find the tDef SPRM
|
||||
if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
|
||||
DWORD code = iter->OpCode;
|
||||
|
||||
switch(iter->OpCode)
|
||||
{
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
for (int i = 0; i < itcMac; i++)
|
||||
case sprmTDefTable:
|
||||
case sprmOldTDefTable:
|
||||
{
|
||||
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
|
||||
unsigned char itcMac = iter->Arguments[0];
|
||||
|
||||
if ( find( boundaries.begin(), boundaries.end(), boundary1 ) == boundaries.end() )
|
||||
while(boundaries.size() < itcMac + 1)
|
||||
boundaries.push_back(-0x7fff);
|
||||
|
||||
short boundary0 = -0x7fff;
|
||||
for (unsigned char i = 0; i < itcMac; i++)
|
||||
{
|
||||
boundaries.push_back( boundary1 );
|
||||
}
|
||||
short boundary1 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( i * 2 ), iter->argumentsSize );
|
||||
short boundary2 = FormatUtils::BytesToInt16( iter->Arguments, 1 + ( ( i + 1 ) * 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;
|
||||
boundaries[i+1] = boundary2;
|
||||
}
|
||||
}
|
||||
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary1 ) == boundaries_all.end() )
|
||||
{
|
||||
boundaries_all.push_back( boundary1 );
|
||||
}
|
||||
|
||||
if ( find( boundaries.begin(), boundaries.end(), boundary2 ) == boundaries.end() )
|
||||
{
|
||||
boundaries.push_back( boundary2 );
|
||||
}
|
||||
if ( find( boundaries_all.begin(), boundaries_all.end(), boundary2 ) == boundaries_all.end() )
|
||||
{
|
||||
boundaries_all.push_back( boundary2 );
|
||||
}
|
||||
boundary0 = boundary1;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1286,19 +1303,25 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//build the grid based on the boundaries
|
||||
sort( boundaries.begin(), boundaries.end() );
|
||||
sort( boundaries_all.begin(), boundaries_all.end() );
|
||||
|
||||
if ( !boundaries.empty() )
|
||||
{
|
||||
for ( unsigned int i = 0; i < ( boundaries.size() - 1 ); i++ )
|
||||
for ( size_t i = 0; i < ( boundaries.size() - 1 ); i++ )
|
||||
{
|
||||
grid->push_back( boundaries[i + 1] - boundaries[i] );
|
||||
grid_write.push_back( boundaries[i + 1] - boundaries[i] );
|
||||
}
|
||||
}
|
||||
if ( !boundaries_all.empty() )
|
||||
{
|
||||
for ( size_t i = 0; i < ( boundaries_all.size() - 1 ); i++ )
|
||||
{
|
||||
grid.push_back( boundaries_all[i + 1] - boundaries_all[i] );
|
||||
}
|
||||
}
|
||||
|
||||
_lastValidPapx = backup;
|
||||
|
||||
return grid;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Finds the FC of the next row end mark.
|
||||
@ -1418,7 +1441,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
/// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, unsigned int nestingLevel)
|
||||
int DocumentMapping::writeTableRow(int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel)
|
||||
{
|
||||
int cp = initialCp;
|
||||
int fc = m_document->FindFileCharPos( cp );
|
||||
@ -1448,7 +1471,7 @@ namespace DocFileFormat
|
||||
//Write until the first "inner trailer paragraph" is reached
|
||||
while ( !( ( m_document->Text->at( cp ) == TextMark::ParagraphEnd ) && ( tai.fInnerTtp ) ) && tai.fInTable )
|
||||
{
|
||||
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
|
||||
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
|
||||
cellIndex++;
|
||||
|
||||
//each cell has it's own PAPX
|
||||
@ -1465,7 +1488,7 @@ namespace DocFileFormat
|
||||
while ( !( ( m_document->Text->at( cp ) == TextMark::CellOrRowMark ) && ( tai.fTtp ) )
|
||||
&& tai.fInTable )
|
||||
{
|
||||
cp = writeTableCell( cp, &tapx, grid, gridIndex, cellIndex, nestingLevel );
|
||||
cp = writeTableCell( cp, &tapx, grid, grid_write, gridIndex, cellIndex, nestingLevel );
|
||||
cellIndex++;
|
||||
|
||||
//each cell has it's own PAPX
|
||||
@ -1488,18 +1511,15 @@ 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, int& gridIndex, int cellIndex, unsigned int nestingLevel )
|
||||
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" );
|
||||
|
||||
//find cell end
|
||||
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
|
||||
|
||||
//convert the properties
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
|
||||
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, grid_write, gridIndex, cellIndex );
|
||||
|
||||
if ( tapx != NULL )
|
||||
{
|
||||
@ -1510,7 +1530,7 @@ namespace DocFileFormat
|
||||
|
||||
RELEASEOBJECT( tcpMapping );
|
||||
|
||||
//write the paragraphs of the cell
|
||||
//write the paragraphs of the cell
|
||||
while ( cp < cpCellEnd )
|
||||
{
|
||||
//cp = writeParagraph(cp);
|
||||
@ -1541,7 +1561,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//end w:tc
|
||||
//end w:tc
|
||||
m_pXmlWriter->WriteNodeEnd( L"w:tc" );
|
||||
|
||||
return cp;
|
||||
|
||||
@ -108,15 +108,15 @@ namespace DocFileFormat
|
||||
// Writes the table starts at the given cp value
|
||||
int writeTable ( int initialCp, unsigned int nestingLevel );
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
|
||||
bool buildTableGrid( int initialCp, unsigned int nestingLevel, std::vector<short>& grid, std::vector<short>& grid_write );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, unsigned int nestingLevel );
|
||||
// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int writeTableRow ( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
|
||||
int writeTableRow ( int initialCp, std::vector<short>* grid, std::vector<short>* grid_write, unsigned int nestingLevel );
|
||||
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
|
||||
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, std::vector<short>* grid_write, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int findCellEndCp ( int initialCp, unsigned int nestingLevel );
|
||||
|
||||
bool writeBookmarks ( int cp );
|
||||
|
||||
@ -136,7 +136,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.x)
|
||||
{
|
||||
int index = (DWORD)point.x - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
{
|
||||
point.x = guides[index].param3;
|
||||
}
|
||||
@ -144,7 +144,7 @@ namespace DocFileFormat
|
||||
if (lMinF <= point.y)
|
||||
{
|
||||
int index = (DWORD)point.y - 0x80000000;
|
||||
if (index >= 0 && index < guides.size())
|
||||
if (index >= 0 && index < (int)guides.size())
|
||||
{
|
||||
point.y = guides[index].param3;
|
||||
}
|
||||
|
||||
@ -46,35 +46,35 @@ OleObject::OleObject( const CharacterPropertyExceptions* chpx, StructuredStorage
|
||||
|
||||
HRESULT res = S_OK;
|
||||
|
||||
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, "ObjectPool");
|
||||
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, L"ObjectPool");
|
||||
|
||||
if (ObjectPoolStorage)
|
||||
{
|
||||
ObjectId = getOleEntryName( chpx );
|
||||
|
||||
std::string sObjectId( ObjectId.begin(), ObjectId.end() );
|
||||
std::wstring sObjectId( ObjectId.begin(), ObjectId.end() );
|
||||
{
|
||||
std::string name = "ObjectPool/" + sObjectId + "/";
|
||||
processOleStream( name + "Ole" );
|
||||
std::wstring name = L"ObjectPool/" + sObjectId + L"/";
|
||||
processOleStream( name + L"Ole" );
|
||||
|
||||
if ( bLinked )
|
||||
{
|
||||
processLinkInfoStream( name + "LinkInfo" );
|
||||
processLinkInfoStream( name + L"LinkInfo" );
|
||||
}
|
||||
else
|
||||
{
|
||||
processCompObjStream( name + "CompObj" );
|
||||
processCompObjStream( name + L"CompObj" );
|
||||
}
|
||||
|
||||
processPICStream( name + "PIC" );
|
||||
processPICStream( name + L"PIC" );
|
||||
|
||||
processEquationNativeStream( name + "Equation Native" );
|
||||
processEquationNativeStream( name + L"Equation Native" );
|
||||
}
|
||||
delete ObjectPoolStorage;
|
||||
}
|
||||
}
|
||||
|
||||
void OleObject::processLinkInfoStream( const std::string& linkStream )
|
||||
void OleObject::processLinkInfoStream( const std::wstring& linkStream )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -125,7 +125,7 @@ void OleObject::processLinkInfoStream( const std::string& linkStream )
|
||||
}
|
||||
}
|
||||
|
||||
void OleObject::processEquationNativeStream( const std::string& eqStream )
|
||||
void OleObject::processEquationNativeStream( const std::wstring& eqStream )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -156,7 +156,7 @@ void OleObject::processEquationNativeStream( const std::string& eqStream )
|
||||
}
|
||||
}
|
||||
|
||||
void OleObject::processPICStream( const std::string& picStream )
|
||||
void OleObject::processPICStream( const std::wstring& picStream )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -191,7 +191,7 @@ void OleObject::processPICStream( const std::string& picStream )
|
||||
}
|
||||
}
|
||||
|
||||
void OleObject::processCompObjStream( const std::string& compStream )
|
||||
void OleObject::processCompObjStream( const std::wstring& compStream )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -206,11 +206,11 @@ void OleObject::processCompObjStream( const std::string& compStream )
|
||||
//skip the CompObjHeader
|
||||
reader.ReadBytes( 28, false );
|
||||
|
||||
int sz_obj = reader.GetSize() - reader.GetPosition();
|
||||
unsigned int sz_obj = reader.GetSize() - reader.GetPosition();
|
||||
|
||||
if (sz_obj > 4)
|
||||
{
|
||||
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
|
||||
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
|
||||
|
||||
sz_obj = reader.GetSize() - reader.GetPosition();
|
||||
if (sz_obj > 4)
|
||||
@ -218,7 +218,7 @@ void OleObject::processCompObjStream( const std::string& compStream )
|
||||
|
||||
sz_obj = reader.GetSize() - reader.GetPosition();
|
||||
if (sz_obj > 4)
|
||||
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
|
||||
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
|
||||
}
|
||||
delete pCompStream;
|
||||
}
|
||||
@ -228,7 +228,7 @@ void OleObject::processCompObjStream( const std::string& compStream )
|
||||
}
|
||||
}
|
||||
|
||||
void OleObject::processOleStream( const std::string& oleStreamName )
|
||||
void OleObject::processOleStream( const std::wstring& oleStreamName )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@ -74,11 +74,11 @@ namespace DocFileFormat
|
||||
private:
|
||||
POLE::Storage *oleStorage;
|
||||
|
||||
void processLinkInfoStream ( const std::string& linkStream );
|
||||
void processEquationNativeStream( const std::string& eqStream );
|
||||
void processPICStream ( const std::string& picStream );
|
||||
void processCompObjStream ( const std::string& compStream );
|
||||
void processOleStream ( const std::string& oleStreamName );
|
||||
void processLinkInfoStream ( const std::wstring& linkStream );
|
||||
void processEquationNativeStream( const std::wstring& eqStream );
|
||||
void processPICStream ( const std::wstring& picStream );
|
||||
void processCompObjStream ( const std::wstring& compStream );
|
||||
void processOleStream ( const std::wstring& oleStreamName );
|
||||
|
||||
std::wstring getOleEntryName ( const CharacterPropertyExceptions* chpx );
|
||||
};
|
||||
|
||||
@ -136,15 +136,17 @@ namespace DocFileFormat
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(fileName);
|
||||
file.WriteFile((BYTE*)data.c_str(), data.size());
|
||||
file.WriteFile((BYTE*)data.c_str(), (_UINT32)data.size());
|
||||
file.CloseFile();
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure )
|
||||
{
|
||||
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
|
||||
|
||||
if (storageOut == NULL || docFile == NULL) return S_FALSE;
|
||||
if (docFile == NULL) return S_FALSE;
|
||||
|
||||
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
|
||||
if (storageOut == NULL) return S_FALSE;
|
||||
|
||||
if (storageOut->open(true, true)==false)
|
||||
{
|
||||
delete storageOut;
|
||||
@ -154,20 +156,19 @@ namespace DocFileFormat
|
||||
POLE::Storage *storageInp = docFile->GetStorage()->GetStorage();
|
||||
|
||||
{
|
||||
std::string id(oleObjectFileStructure.objectID.begin(),oleObjectFileStructure.objectID.end());
|
||||
|
||||
POLE::Stream* oleStorage = new POLE::Stream(storageInp, id);
|
||||
POLE::Stream* oleStorage = new POLE::Stream(storageInp, oleObjectFileStructure.objectID);
|
||||
|
||||
if (oleStorage)
|
||||
{
|
||||
std::string path = "ObjectPool/" + id;
|
||||
std::list<std::string> entries = storageInp->entries(path);
|
||||
for (std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++)
|
||||
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++)
|
||||
{
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + "/"+ (*it));
|
||||
POLE::Stream *stream_inp = new POLE::Stream(storageInp, path + L"/"+ (*it));
|
||||
if (stream_inp == NULL)continue;
|
||||
|
||||
int size = stream_inp->size();
|
||||
POLE::uint64 size = stream_inp->size();
|
||||
|
||||
POLE::Stream *stream_out = new POLE::Stream(storageOut, *it, true, size);
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ namespace DocFileFormat
|
||||
|
||||
case sprmPFBiDi:
|
||||
{
|
||||
bool val = iter->argumentsSize > 0 ? iter->Arguments[0] : true;
|
||||
bool val = iter->argumentsSize > 0 ? (iter->Arguments[0] != 0) : true;
|
||||
appendFlagElement( _pPr, *iter, L"bidi", val);
|
||||
_isBidi = val;
|
||||
}break;
|
||||
@ -427,7 +427,7 @@ namespace DocFileFormat
|
||||
if (m_document->listTable)
|
||||
{
|
||||
m_document->listTable->appendNumbering( desc );
|
||||
short numId = m_document->listTable->listNumbering.size();
|
||||
short numId = static_cast<short>(m_document->listTable->listNumbering.size());
|
||||
appendValueElement( &numPr, L"numId", numId, true );
|
||||
}
|
||||
}break;
|
||||
@ -485,7 +485,7 @@ namespace DocFileFormat
|
||||
{
|
||||
XMLTools::XMLElement tabs( L"w:tabs" );
|
||||
|
||||
int pos = 0;
|
||||
unsigned int pos = 0;
|
||||
|
||||
//read the removed tabs
|
||||
unsigned char itbdDelMax = iter->Arguments[pos];
|
||||
|
||||
@ -41,7 +41,7 @@ namespace DocFileFormat
|
||||
{
|
||||
TC80()
|
||||
{
|
||||
horzMerge = wWidth = 0;
|
||||
wWidth = horzMerge =0;
|
||||
|
||||
textFlow = Global::lrTb;
|
||||
vertMerge = Global::fvmClear;
|
||||
@ -95,13 +95,14 @@ namespace DocFileFormat
|
||||
int pointer = 1;
|
||||
|
||||
// rgdxaCenter
|
||||
|
||||
for (int i = 0; i < numberOfColumns + 1; ++i)
|
||||
{
|
||||
rgdxaCenter.push_back(FormatUtils::BytesToInt16(bytes, pointer, size));
|
||||
int pos = FormatUtils::BytesToInt16(bytes, pointer, size);
|
||||
rgdxaCenter.push_back(pos);
|
||||
pointer += 2;
|
||||
}
|
||||
|
||||
|
||||
// rgTc80
|
||||
|
||||
for (int i = 0; i < numberOfColumns; ++i)
|
||||
|
||||
@ -81,7 +81,7 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
ByteStructure* operator [] ( unsigned int index ) const
|
||||
ByteStructure* operator [] ( size_t index ) const
|
||||
{
|
||||
if ( index < this->Data.size() )
|
||||
{
|
||||
|
||||
@ -61,18 +61,18 @@ namespace DocFileFormat
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isDirectory( const std::string& name )
|
||||
bool isDirectory( const std::wstring& name )
|
||||
{
|
||||
if (!m_pStorage) return false;
|
||||
|
||||
return m_pStorage->isDirectory(name);
|
||||
}
|
||||
|
||||
bool GetStream (const char *path, POLE::Stream** ppStream)
|
||||
bool GetStream (const std::wstring & path, POLE::Stream** ppStream)
|
||||
{
|
||||
if (( m_pStorage != NULL ) && ( path != NULL ))
|
||||
if (( m_pStorage != NULL ) && ( !path.empty() ))
|
||||
{
|
||||
*ppStream = new POLE::Stream(m_pStorage, path);
|
||||
*ppStream = new POLE::Stream(m_pStorage, path.c_str());
|
||||
}
|
||||
if ((*ppStream) && ((*ppStream)->size() > 0))
|
||||
return true;
|
||||
@ -85,15 +85,15 @@ namespace DocFileFormat
|
||||
return m_pStorage;
|
||||
}
|
||||
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true)
|
||||
void copy( int indent, std::wstring path, POLE::Storage * storageOut, bool withRoot = true)
|
||||
{
|
||||
std::list<std::string> entries, entries_sort;
|
||||
entries = m_pStorage->entries( path );
|
||||
std::list<std::wstring> entries, entries_sort;
|
||||
entries = m_pStorage->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
if( m_pStorage->isDirectory( fullname ) )
|
||||
{
|
||||
@ -105,14 +105,14 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
if( m_pStorage->isDirectory( fullname ) )
|
||||
{
|
||||
copy( indent + 1, fullname + "/", storageOut, withRoot );
|
||||
copy( indent + 1, fullname + L"/", storageOut, withRoot );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -122,17 +122,17 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
private:
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true)
|
||||
void copy_stream(std::wstring streamName, POLE::Storage * storageOut, bool withRoot = true)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(m_pStorage, streamName);
|
||||
if (!stream) return;
|
||||
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
POLE::int64 size_stream = stream->size();
|
||||
|
||||
if (withRoot == false)
|
||||
{
|
||||
int pos = streamName.find("/");
|
||||
int pos = (int)streamName.find(L"/");
|
||||
if (pos >= 0)
|
||||
streamName = streamName.substr(pos + 1);
|
||||
}
|
||||
|
||||
@ -35,13 +35,13 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* tableGrid, int gridIndex, int cellIndex) :
|
||||
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, const std::vector<short>* grid_write, int gridIndex, int cellIndex) :
|
||||
PropertiesMapping(pWriter)
|
||||
{
|
||||
_width = 0;
|
||||
|
||||
_gridIndex = gridIndex;
|
||||
_grid = tableGrid;
|
||||
_grid = grid;
|
||||
_cellIndex = cellIndex;
|
||||
|
||||
_brcTop = NULL;
|
||||
@ -75,6 +75,8 @@ namespace DocFileFormat
|
||||
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
|
||||
int nComputedCellWidth = 0;
|
||||
|
||||
_gridSpan = 1;
|
||||
|
||||
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
|
||||
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
|
||||
{
|
||||
@ -87,7 +89,7 @@ namespace DocFileFormat
|
||||
int cc = tdef.numberOfColumns;
|
||||
|
||||
_tGrid = tdef.rgdxaCenter;
|
||||
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash
|
||||
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)];
|
||||
|
||||
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
|
||||
|
||||
@ -111,13 +113,19 @@ namespace DocFileFormat
|
||||
{
|
||||
appendValueElement( _tcPr, L"noWrap", L"", true );
|
||||
}
|
||||
|
||||
nComputedCellWidth = (short)( tdef.rgdxaCenter[(size_t)(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1) + 1] -
|
||||
tdef.rgdxaCenter[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)] ); // NOTE: fix for crash
|
||||
int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
|
||||
int ind1 = ind;
|
||||
while (ind1 < tdef.rgdxaCenter.size() - 1)
|
||||
{
|
||||
int sz = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind1 ] ;
|
||||
if (sz > 1)
|
||||
break;
|
||||
ind1++;
|
||||
}
|
||||
nComputedCellWidth = tdef.rgdxaCenter[ ind1 + 1] - tdef.rgdxaCenter[ ind ] ;
|
||||
|
||||
if (!IsTableBordersDefined(tapx->grpprl))
|
||||
{ //borders
|
||||
|
||||
{
|
||||
RELEASEOBJECT(_brcTop);
|
||||
_brcTop = new BorderCode(*_tcDef.brcTop);
|
||||
|
||||
@ -134,8 +142,7 @@ namespace DocFileFormat
|
||||
break;
|
||||
|
||||
case sprmTCellPadding:
|
||||
{ //margins
|
||||
|
||||
{
|
||||
unsigned char first = iter->Arguments[0];
|
||||
unsigned char lim = iter->Arguments[1];
|
||||
unsigned char ftsMargin = iter->Arguments[3];
|
||||
@ -165,7 +172,6 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case sprmTDefTableShd80:
|
||||
{
|
||||
if (!tapx->IsSkipShading97()) // если такой операнд единственный то учитываем его, иначе скипаем его
|
||||
@ -270,24 +276,23 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
//width
|
||||
XMLTools::XMLElement tcW ( L"w:tcW" );
|
||||
XMLTools::XMLAttribute tcWType ( L"w:type", FormatUtils::MapValueToWideString( _ftsWidth, &Global::CellWidthTypeMap[0][0], 4, 5 ) );
|
||||
XMLTools::XMLAttribute tcWVal ( L"w:w", FormatUtils::IntToWideString( _width ) );
|
||||
XMLTools::XMLElement tcW ( L"w:tcW" );
|
||||
|
||||
|
||||
tcW.AppendAttribute( tcWType );
|
||||
XMLTools::XMLAttribute tcWVal ( L"w:w", FormatUtils::IntToWideString( _width > 1 ? _width : nComputedCellWidth) );
|
||||
XMLTools::XMLAttribute tcWType ( L"w:type", _width > 1 ? FormatUtils::MapValueToWideString( _ftsWidth, &Global::CellWidthTypeMap[0][0], 4, 5 ) : L"dxa" );
|
||||
|
||||
tcW.AppendAttribute( tcWType );
|
||||
tcW.AppendAttribute( tcWVal );
|
||||
_tcPr->AppendChild( tcW );
|
||||
|
||||
//grid span
|
||||
_gridSpan = 1;
|
||||
|
||||
if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
|
||||
{
|
||||
//check the number of merged cells
|
||||
int w = _grid->at( _gridIndex );
|
||||
|
||||
for ( unsigned int i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
|
||||
{
|
||||
_gridSpan++;
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ namespace DocFileFormat
|
||||
public:
|
||||
|
||||
virtual ~TableCellPropertiesMapping();
|
||||
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* tableGrid, int gridIndex, int cellIndex);
|
||||
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, const std::vector<short>* grid_write, int gridIndex, int cellIndex);
|
||||
virtual void Apply( IVisitable* visited );
|
||||
|
||||
inline int GetGridSpan() const
|
||||
@ -71,9 +71,7 @@ namespace DocFileFormat
|
||||
void apppendCellShading (unsigned char* sprmArg, int size, int cellIndex);
|
||||
bool IsTableBordersDefined (const std::list<SinglePropertyModifier>* grpprl) const;
|
||||
bool IsTableCellWidthDefined (const std::list<SinglePropertyModifier>* grpprl) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
int _gridIndex;
|
||||
int _cellIndex;
|
||||
|
||||
@ -93,7 +91,6 @@ namespace DocFileFormat
|
||||
BorderCode* _brcRight;
|
||||
BorderCode* _brcBottom;
|
||||
|
||||
/// The grind span of this cell
|
||||
int _gridSpan;
|
||||
int _gridSpan;
|
||||
};
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ namespace DocFileFormat
|
||||
cellElements.clear();
|
||||
}
|
||||
|
||||
void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int nCellIndex)
|
||||
void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, const std::vector<short>* grid_write, int& gridIndex, int nCellIndex)
|
||||
{
|
||||
if (NULL != mapping)
|
||||
{
|
||||
@ -116,14 +116,14 @@ namespace DocFileFormat
|
||||
ParagraphPropertyExceptions* papxBackup = documentMapping->_lastValidPapx;
|
||||
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
|
||||
|
||||
//start w:tc
|
||||
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
|
||||
|
||||
//find cell end
|
||||
//find cell end
|
||||
int cpCellEnd = documentMapping->findCellEndCp(cp, depth);
|
||||
|
||||
//convert the properties
|
||||
TableCellPropertiesMapping tcpMapping(documentMapping->GetXMLWriter(), grid, gridIndex, nCellIndex);
|
||||
//start w:tc
|
||||
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
|
||||
|
||||
//convert the properties
|
||||
TableCellPropertiesMapping tcpMapping(documentMapping->GetXMLWriter(), grid, grid_write, gridIndex, nCellIndex);
|
||||
|
||||
if ( tapx != NULL )
|
||||
{
|
||||
@ -140,7 +140,7 @@ namespace DocFileFormat
|
||||
(*iter)->Convert( mapping );
|
||||
}
|
||||
|
||||
//end w:tc
|
||||
//end w:tc
|
||||
documentMapping->GetXMLWriter()->WriteNodeEnd( L"w:tc" );
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ namespace DocFileFormat
|
||||
cells.clear();
|
||||
}
|
||||
|
||||
void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid)
|
||||
void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid, const std::vector<short>* grid_write)
|
||||
{
|
||||
if ( mapping != NULL )
|
||||
{
|
||||
@ -234,7 +234,7 @@ namespace DocFileFormat
|
||||
{
|
||||
for ( std::list<TableCell>::iterator iter = cells.begin(); iter != cells.end(); iter++ )
|
||||
{
|
||||
iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ );
|
||||
iter->Convert( mapping, &tapx, grid, grid_write, gridIndex, nCellIndex++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,7 +516,8 @@ namespace DocFileFormat
|
||||
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
|
||||
|
||||
//build the table grid
|
||||
std::vector<short>* grid = documentMapping->buildTableGrid( cpStart, depth );
|
||||
std::vector<short> grid, grid_write;
|
||||
documentMapping->buildTableGrid( cpStart, depth, grid, grid_write );
|
||||
|
||||
//find first row end
|
||||
int fcRowEnd = documentMapping->findRowEndFc( cpStart, depth );
|
||||
@ -529,7 +530,7 @@ namespace DocFileFormat
|
||||
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tbl" );
|
||||
|
||||
//Convert it
|
||||
TablePropertiesMapping tpMapping( documentMapping->GetXMLWriter(), documentMapping->m_document->Styles, grid );
|
||||
TablePropertiesMapping tpMapping( documentMapping->GetXMLWriter(), documentMapping->m_document->Styles, &grid, &grid_write );
|
||||
|
||||
row1Tapx.Convert( &tpMapping );
|
||||
|
||||
@ -538,13 +539,12 @@ namespace DocFileFormat
|
||||
|
||||
for ( std::list<TableRow>::iterator iter = rows.begin(); iter != rows.end(); iter++ )
|
||||
{
|
||||
iter->Convert( mapping, grid );
|
||||
iter->Convert( mapping, &grid, &grid_write );
|
||||
}
|
||||
|
||||
//close w:tbl
|
||||
documentMapping->GetXMLWriter()->WriteNodeEnd( L"w:tbl" );
|
||||
|
||||
RELEASEOBJECT( grid );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ namespace DocFileFormat
|
||||
void AddItem( const ITableCellElement& _tableCellElement );
|
||||
bool IsEmpty() const;
|
||||
void Clear();
|
||||
void Convert( IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int cellIndex );
|
||||
void Convert( IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, const std::vector<short>* grid_write, int& gridIndex, int cellIndex );
|
||||
~TableCell();
|
||||
|
||||
private:
|
||||
@ -81,7 +81,7 @@ namespace DocFileFormat
|
||||
void AddCell( const TableCell& _tableCell );
|
||||
bool IsEmpty() const;
|
||||
void Clear();
|
||||
void Convert( IMapping* mapping, const std::vector<short>* grid );
|
||||
void Convert( IMapping* mapping, const std::vector<short>* grid, const std::vector<short>* grid_write );
|
||||
~TableRow();
|
||||
|
||||
private:
|
||||
|
||||
@ -34,15 +34,13 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
TablePropertiesMapping::TablePropertiesMapping (XMLTools::CStringXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded ):
|
||||
PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(NULL),
|
||||
brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(NULL),
|
||||
TablePropertiesMapping::TablePropertiesMapping (XMLTools::CStringXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, std::vector<short>* grid_write, bool isTableStyleNeeded ):
|
||||
PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(grid), _grid_write(grid_write),
|
||||
brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(styles),
|
||||
_isTableStyleNeeded(isTableStyleNeeded)
|
||||
{
|
||||
_styles = styles;
|
||||
_tblPr = new XMLTools::XMLElement( L"w:tblPr");
|
||||
_tblBorders = new XMLTools::XMLElement( L"w:tblBorders");
|
||||
_grid = grid;
|
||||
}
|
||||
TablePropertiesMapping::~TablePropertiesMapping()
|
||||
{
|
||||
@ -74,6 +72,9 @@ namespace DocFileFormat
|
||||
short marginLeft = 0;
|
||||
short marginRight = 0;
|
||||
|
||||
BYTE itcFirst = 0;
|
||||
BYTE itcLim = 0;
|
||||
|
||||
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
|
||||
{
|
||||
switch( iter->OpCode )
|
||||
@ -120,7 +121,15 @@ namespace DocFileFormat
|
||||
_tblPr->AppendChild( tblW );
|
||||
}
|
||||
break;
|
||||
case sprmTMerge:
|
||||
{
|
||||
itcFirst = iter->Arguments[0];
|
||||
itcLim = iter->Arguments[1];
|
||||
}break;
|
||||
case sprmTSplit:
|
||||
{
|
||||
|
||||
}break;
|
||||
case sprmOldTJc:
|
||||
case sprmTJc:
|
||||
case sprmTJcRow:
|
||||
@ -144,7 +153,7 @@ namespace DocFileFormat
|
||||
|
||||
if ( _isTableStyleNeeded )
|
||||
{
|
||||
int ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
size_t ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
|
||||
|
||||
std::wstring id = ind < _styles->Styles->size() ? StyleSheetMapping::MakeStyleId( _styles->Styles->at( ind ) ) : L"";
|
||||
|
||||
@ -486,7 +495,7 @@ namespace DocFileFormat
|
||||
bWriteGridCol = true;
|
||||
else
|
||||
{
|
||||
for ( unsigned int i = 0, nSize = _grid->size(); i < nSize; i++ )
|
||||
for ( size_t i = 0, nSize = _grid_write->size(); i < nSize; i++ )
|
||||
{
|
||||
if(_grid->at(i) % DocFileFormat::gc_nZeroWidth != 0)
|
||||
{
|
||||
@ -497,10 +506,10 @@ namespace DocFileFormat
|
||||
}
|
||||
if(true == bWriteGridCol)
|
||||
{
|
||||
for ( unsigned int i = 0; i < _grid->size(); i++ )
|
||||
for ( size_t i = 0; i < _grid_write->size(); i++ )
|
||||
{
|
||||
XMLTools::XMLElement gridCol( L"w:gridCol");
|
||||
XMLTools::XMLAttribute gridColW( L"w:w", FormatUtils::IntToWideString( _grid->at( i ) ) );
|
||||
XMLTools::XMLAttribute gridColW( L"w:w", FormatUtils::IntToWideString( _grid_write->at( i ) ) );
|
||||
gridCol.AppendAttribute( gridColW );
|
||||
_tblGrid->AppendChild( gridCol );
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ namespace DocFileFormat
|
||||
class TablePropertiesMapping: public PropertiesMapping, public IMapping
|
||||
{
|
||||
public:
|
||||
TablePropertiesMapping( XMLTools::CStringXmlWriter* writer, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded = true );
|
||||
TablePropertiesMapping( XMLTools::CStringXmlWriter* writer, StyleSheet* styles, std::vector<short>* grid, std::vector<short>* grid_write, bool isTableStyleNeeded = true );
|
||||
virtual ~TablePropertiesMapping();
|
||||
void Apply( IVisitable* visited );
|
||||
|
||||
@ -83,6 +83,7 @@ namespace DocFileFormat
|
||||
|
||||
StyleSheet* _styles;
|
||||
std::vector<short>* _grid;
|
||||
std::vector<short>* _grid_write;
|
||||
|
||||
BorderCode* brcLeft;
|
||||
BorderCode* brcTop;
|
||||
|
||||
@ -62,8 +62,9 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<SinglePropertyModifier>::iterator oSpmIter = papx->grpprl->begin(); oSpmIter != papx->grpprl->end(); ++oSpmIter)
|
||||
{
|
||||
if (oSpmIter->OpCode == sprmTDefTableShd || oSpmIter->OpCode == sprmTDefTableShd2nd ||
|
||||
oSpmIter->OpCode == sprmTDefTableShd2nd || oSpmIter->OpCode == sprmTDefTableShd3rd)
|
||||
if (oSpmIter->OpCode == sprmTDefTableShd ||
|
||||
oSpmIter->OpCode == sprmTDefTableShd2nd ||
|
||||
oSpmIter->OpCode == sprmTDefTableShd3rd)
|
||||
{
|
||||
m_bSkipShading97 = TRUE;
|
||||
}
|
||||
|
||||
@ -159,13 +159,13 @@ namespace DocFileFormat
|
||||
OOX::CDocument docEmbedded(path, path);
|
||||
|
||||
bool res = false;
|
||||
for (int i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
|
||||
for (size_t i = 0 ; i < docEmbedded.m_arrItems.size(); i++)
|
||||
{
|
||||
if (docEmbedded.m_arrItems[i]->getType() == OOX::et_w_p)
|
||||
{
|
||||
OOX::Logic::CParagraph *paragraph = dynamic_cast<OOX::Logic::CParagraph *>(docEmbedded.m_arrItems[i]);
|
||||
|
||||
for (int j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
|
||||
for (size_t j = 0; (paragraph) && (j < paragraph->m_arrItems.size()); j++)
|
||||
{
|
||||
if (paragraph->m_arrItems[j]->getType() == OOX::et_m_oMath)
|
||||
{
|
||||
@ -177,7 +177,7 @@ namespace DocFileFormat
|
||||
{
|
||||
OOX::Logic::COMathPara *mathPara = dynamic_cast<OOX::Logic::COMathPara *>(paragraph->m_arrItems[j]);
|
||||
|
||||
for (int k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
|
||||
for (size_t k = 0; (mathPara) && (k < mathPara->m_arrItems.size()); k++)
|
||||
{
|
||||
if (mathPara->m_arrItems[k]->getType() == OOX::et_m_oMath)
|
||||
{
|
||||
|
||||
@ -744,7 +744,7 @@ namespace DocFileFormat
|
||||
|
||||
text = FormatUtils::XmlEncode(text);
|
||||
|
||||
if (0 <= text.find(L"\n"))
|
||||
if (std::wstring::npos != text.find(L"\n"))
|
||||
{
|
||||
m_textpath.AppendText(text);
|
||||
}
|
||||
@ -754,7 +754,7 @@ namespace DocFileFormat
|
||||
case gtextFont:
|
||||
{
|
||||
std::wstring font = NSStringExt::CConverter::GetUnicodeFromUTF16((unsigned short*)iter->opComplex.get(), (iter->op)/2);
|
||||
int i = font.size();
|
||||
size_t i = font.size();
|
||||
while (i > 0)
|
||||
{
|
||||
if (font[i-1] != 0) break;
|
||||
@ -1963,7 +1963,7 @@ namespace DocFileFormat
|
||||
{
|
||||
int index = (DWORD)val - 0x80000000;
|
||||
|
||||
if (index >= 0 && index < m_arrGuides.size())
|
||||
if (index >= 0 && index < (int)m_arrGuides.size())
|
||||
{
|
||||
new_val = m_arrGuides[index].param3;
|
||||
}
|
||||
@ -2130,7 +2130,7 @@ namespace DocFileFormat
|
||||
|
||||
void VMLShapeMapping::ApplyPrimitives(DrawingPrimitives * primitives)
|
||||
{
|
||||
int index = 0;
|
||||
size_t index = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
@ -2142,7 +2142,7 @@ namespace DocFileFormat
|
||||
|
||||
static int currentTextBoxIndex = 1;
|
||||
|
||||
int VMLShapeMapping::ApplyPrimitive(DrawingPrimitives * primitives, int index)
|
||||
size_t VMLShapeMapping::ApplyPrimitive(DrawingPrimitives * primitives, size_t index)
|
||||
{
|
||||
if (!primitives) return index++;
|
||||
if (index >= primitives->size()) return index++;
|
||||
@ -2165,7 +2165,7 @@ namespace DocFileFormat
|
||||
//todooo нарисовать кастомный шейп
|
||||
}
|
||||
else
|
||||
WritePrimitiveProps(primitive, (index==0?true:false));
|
||||
WritePrimitiveProps(primitive, (index==0 ? true : false));
|
||||
|
||||
|
||||
if (primitive->type == 0x0000)
|
||||
@ -2241,11 +2241,11 @@ namespace DocFileFormat
|
||||
{
|
||||
//strStyle += L"left:" + FormatUtils::IntToWideString( x.ToPoints()) + L"pt;";
|
||||
//strStyle += L"top:" + FormatUtils::IntToWideString( y.ToPoints()) + L"pt;";
|
||||
strStyle += L"width:" + FormatUtils::IntToWideString( w.ToPoints()) + L"pt;";
|
||||
strStyle += L"height:" + FormatUtils::IntToWideString( h.ToPoints()) + L"pt;";
|
||||
strStyle += L"width:" + FormatUtils::IntToWideString( (int)w.ToPoints()) + L"pt;";
|
||||
strStyle += L"height:" + FormatUtils::IntToWideString( (int)h.ToPoints()) + L"pt;";
|
||||
|
||||
strStyle += L"margin-left:" + FormatUtils::IntToWideString( x.ToPoints()) + L"pt;";
|
||||
strStyle += L"margin-top:" + FormatUtils::IntToWideString( y.ToPoints()) + L"pt;";
|
||||
strStyle += L"margin-left:" + FormatUtils::IntToWideString( (int)x.ToPoints()) + L"pt;";
|
||||
strStyle += L"margin-top:" + FormatUtils::IntToWideString( (int)y.ToPoints()) + L"pt;";
|
||||
|
||||
std::wstring xMargin;
|
||||
std::wstring yMargin;
|
||||
|
||||
@ -73,7 +73,7 @@ namespace DocFileFormat
|
||||
private:
|
||||
|
||||
void ApplyPrimitives (DrawingPrimitives * primitives );
|
||||
int ApplyPrimitive (DrawingPrimitives * primitives, int index);
|
||||
size_t ApplyPrimitive (DrawingPrimitives * primitives, size_t index);
|
||||
|
||||
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
if (position + count > stream->size())
|
||||
{
|
||||
if (position > stream->size()) count = 0;
|
||||
else count = stream->size() - position;
|
||||
else count = (unsigned int)(stream->size() - position);
|
||||
}
|
||||
rdBytes = new unsigned char[count];
|
||||
}
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
virtual unsigned long GetPosition() const
|
||||
{
|
||||
return this->position;
|
||||
return (unsigned long)this->position;
|
||||
}
|
||||
|
||||
virtual unsigned long GetSize() const
|
||||
@ -161,7 +161,7 @@ public:
|
||||
|
||||
if ( stream != NULL )
|
||||
{
|
||||
size = stream->size();
|
||||
size = (unsigned long)stream->size();
|
||||
}
|
||||
|
||||
return size;
|
||||
@ -246,7 +246,7 @@ public:
|
||||
/// The string must have the following structure:
|
||||
/// unsigned char 1-4: Character count (cch)
|
||||
/// unsigned char 5-cch+4: ANSI characters terminated by \0
|
||||
std::wstring ReadLengthPrefixedAnsiString(int max_size)
|
||||
std::wstring ReadLengthPrefixedAnsiString(unsigned int max_size)
|
||||
{
|
||||
std::wstring result;
|
||||
|
||||
@ -257,8 +257,8 @@ public:
|
||||
if (cch > max_size)
|
||||
{
|
||||
//error ... skip to 0
|
||||
int pos_orinal = GetPosition();
|
||||
int pos = 0;
|
||||
unsigned int pos_orinal = GetPosition();
|
||||
unsigned int pos = 0;
|
||||
|
||||
stringBytes = ReadBytes( max_size, true );
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ namespace DocFileFormat
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false)
|
||||
if (m_pStorage->GetStream (L"WordDocument", &WordDocumentStream) == false)
|
||||
{
|
||||
Clear();
|
||||
return AVS_ERROR_FILEFORMAT;
|
||||
@ -121,16 +121,16 @@ namespace DocFileFormat
|
||||
|
||||
if (FIB->m_FibBase.fWhichTblStm)
|
||||
{
|
||||
if (!m_pStorage->GetStream ("1Table", &TableStream))
|
||||
if (!m_pStorage->GetStream (L"1Table", &TableStream))
|
||||
{
|
||||
res = m_pStorage->GetStream ("0Table", &TableStream);
|
||||
res = m_pStorage->GetStream (L"0Table", &TableStream);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_pStorage->GetStream ("0Table", &TableStream))
|
||||
if (!m_pStorage->GetStream (L"0Table", &TableStream))
|
||||
{
|
||||
res = m_pStorage->GetStream ("1Table", &TableStream);
|
||||
res = m_pStorage->GetStream (L"1Table", &TableStream);
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,8 +176,8 @@ namespace DocFileFormat
|
||||
POLE::Stream * Summary = NULL;
|
||||
POLE::Stream * DocSummary = NULL;
|
||||
|
||||
m_pStorage->GetStream ("SummaryInformation", &Summary);
|
||||
m_pStorage->GetStream ("DocumentSummaryInformation", &DocSummary);
|
||||
m_pStorage->GetStream (L"SummaryInformation", &Summary);
|
||||
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
|
||||
|
||||
document_code_page = ENCODING_WINDOWS_1250;
|
||||
|
||||
@ -206,7 +206,7 @@ namespace DocFileFormat
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
m_pStorage->GetStream ("Data", &DataStream);
|
||||
m_pStorage->GetStream (L"Data", &DataStream);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -216,7 +216,7 @@ namespace DocFileFormat
|
||||
if (TableStream->size() < 1 && bOlderVersion)
|
||||
{
|
||||
RELEASEOBJECT(TableStream);
|
||||
m_pStorage->GetStream ("WordDocument", &TableStream);
|
||||
m_pStorage->GetStream (L"WordDocument", &TableStream);
|
||||
}
|
||||
|
||||
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
|
||||
@ -483,7 +483,7 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
DecryptStream( 0, "/", storageIn, storageOut, Decryptor);
|
||||
DecryptStream( 0, L"/", storageIn, storageOut, Decryptor);
|
||||
|
||||
//std::list<std::string> listStream = storageIn->entries();
|
||||
|
||||
@ -514,59 +514,60 @@ namespace DocFileFormat
|
||||
|
||||
m_pStorage->SetFile(m_sTempDecryptFileName.c_str());
|
||||
|
||||
if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false) return false;
|
||||
if (m_pStorage->GetStream (L"WordDocument", &WordDocumentStream) == false) return false;
|
||||
|
||||
if (FIB->m_FibBase.fWhichTblStm)
|
||||
{
|
||||
if (!m_pStorage->GetStream ("1Table", &TableStream)) m_pStorage->GetStream ("0Table", &TableStream);
|
||||
if (!m_pStorage->GetStream (L"1Table", &TableStream)) m_pStorage->GetStream (L"0Table", &TableStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_pStorage->GetStream ("0Table", &TableStream)) m_pStorage->GetStream ("1Table", &TableStream);
|
||||
if (!m_pStorage->GetStream (L"0Table", &TableStream)) m_pStorage->GetStream (L"1Table", &TableStream);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
void WordDocument::DecryptStream( int level, std::wstring path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
{
|
||||
std::list<std::string> entries, entries_sort;
|
||||
entries = storageIn->entries( path );
|
||||
std::list<std::wstring> entries, entries_files, entries_dir;
|
||||
entries = storageIn->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::wstring name = *it;
|
||||
std::wstring fullname = path + name;
|
||||
|
||||
if( storageIn->isDirectory( fullname ) )
|
||||
{
|
||||
entries_sort.push_back(name);
|
||||
entries_dir.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_sort.push_front(name);
|
||||
entries_files.push_front(name);
|
||||
}
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
|
||||
for( std::list<std::wstring>::iterator it = entries_dir.begin(); it != entries_dir.end(); ++it )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::wstring fullname = path + *it;
|
||||
|
||||
if( storageIn->isDirectory( fullname ) )
|
||||
{
|
||||
DecryptStream( level + 1, fullname + "/", storageIn, storageOut, Decryptor );
|
||||
}
|
||||
else
|
||||
{
|
||||
DecryptStream(fullname, storageIn, storageOut, Decryptor );
|
||||
}
|
||||
DecryptStream( level + 1, fullname + L"/", storageIn, storageOut, Decryptor );
|
||||
|
||||
}
|
||||
//if (bSortFiles)
|
||||
entries_files.sort();
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); ++it )
|
||||
{
|
||||
std::wstring fullname = path + *it;
|
||||
DecryptStream(fullname, storageIn, storageOut, Decryptor );
|
||||
}
|
||||
}
|
||||
bool WordDocument::DecryptStream(std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
bool WordDocument::DecryptStream(std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
|
||||
if (!stream) return false;
|
||||
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
POLE::uint64 size_stream = stream->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
if (!streamNew) return false;
|
||||
@ -577,7 +578,7 @@ namespace DocFileFormat
|
||||
unsigned char* data_store = NULL;
|
||||
int size_data_store = 0;
|
||||
|
||||
if ( std::wstring::npos != streamName.find("WordDocument") )
|
||||
if ( std::wstring::npos != streamName.find(L"WordDocument") )
|
||||
{
|
||||
size_data_store = 68;
|
||||
data_store = new unsigned char[size_data_store];
|
||||
@ -586,8 +587,10 @@ namespace DocFileFormat
|
||||
if (data_store)
|
||||
memcpy(data_store, data_stream, size_data_store);
|
||||
|
||||
int size_block = 0x200;
|
||||
for (int pos = 0, block = 0 ; pos < size_stream; pos += size_block, block++)
|
||||
size_t size_block = 0x200;
|
||||
unsigned long block = 0;
|
||||
|
||||
for (POLE::uint64 pos = 0; pos < size_stream; pos += size_block, block++)
|
||||
{
|
||||
if (pos + size_block > size_stream)
|
||||
size_block = size_stream - pos;
|
||||
|
||||
@ -107,8 +107,8 @@ namespace DocFileFormat
|
||||
private:
|
||||
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
|
||||
|
||||
bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
bool DecryptStream (std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
void DecryptStream (int level, std::wstring streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
|
||||
|
||||
inline OfficeArtContent* GetOfficeArt ()
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ namespace ImageHelper
|
||||
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
|
||||
if (!header) return result;
|
||||
|
||||
result == Global::msoblipDIB;
|
||||
result = Global::msoblipDIB;
|
||||
|
||||
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
|
||||
{
|
||||
@ -185,7 +185,7 @@ namespace DocFileFormat
|
||||
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
|
||||
NSDirectory::CreateDirectory( pathWord );
|
||||
|
||||
if (bMacros && docFile->GetStorage()->isDirectory("Macros"))
|
||||
if (bMacros && docFile->GetStorage()->isDirectory(L"Macros"))
|
||||
{
|
||||
std::wstring sVbaProjectFile = pathWord + FILE_SEPARATOR_STR + L"vbaProject.bin";
|
||||
|
||||
@ -193,7 +193,7 @@ namespace DocFileFormat
|
||||
|
||||
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
|
||||
{
|
||||
docFile->GetStorage()->copy(0, "Macros/", storageVbaProject, false);
|
||||
docFile->GetStorage()->copy(0, L"Macros/", storageVbaProject, false);
|
||||
|
||||
storageVbaProject->close();
|
||||
delete storageVbaProject;
|
||||
|
||||
@ -49,12 +49,9 @@
|
||||
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
|
||||
#endif
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
HRESULT convert_single(std::wstring sSrcDoc)
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
std::wstring sSrcDoc = argv[1];
|
||||
std::wstring sDstDocx;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
|
||||
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
|
||||
@ -66,6 +63,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
bool bMacros = true;
|
||||
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
|
||||
|
||||
std::wstring sDstDocx;
|
||||
if (bMacros)
|
||||
{
|
||||
sDstDocx = sSrcDoc + L"-my.docm";
|
||||
@ -86,3 +84,33 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
return hRes;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@ -1697,7 +1697,7 @@ public:
|
||||
std::vector<std::wstring> arSplit;
|
||||
boost::algorithm::split(arSplit, pComment->UserName, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
for (int i = 0; i < arSplit.size(); i++)
|
||||
for (size_t i = 0; i < arSplit.size(); i++)
|
||||
{
|
||||
sInitials += arSplit[i][0];
|
||||
}
|
||||
@ -1733,7 +1733,7 @@ public:
|
||||
|
||||
bool bFirst = true;
|
||||
int nPrevIndex = 0;
|
||||
for(size_t i = 0; i < sText.length(); i++)
|
||||
for (int i = 0; i < (int)sText.length(); i++)
|
||||
{
|
||||
wchar_t cToken = sText[i];
|
||||
if('\n' == cToken)
|
||||
|
||||
@ -557,11 +557,11 @@ namespace MathEquation
|
||||
BYTE horAlign;
|
||||
switch(eHorAlign)
|
||||
{
|
||||
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft;
|
||||
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter;
|
||||
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight;
|
||||
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter;
|
||||
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter;
|
||||
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft; break;
|
||||
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter; break;
|
||||
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight; break;
|
||||
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter; break;
|
||||
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter; break;
|
||||
}
|
||||
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::McJc, horAlign);
|
||||
|
||||
|
||||
@ -3616,7 +3616,7 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteLONG(oDDList.m_oResult->m_oVal->GetValue());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
for(int i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
|
||||
for(size_t i = 0 ; i < oDDList.m_arrListEntry.size(); ++i)
|
||||
{
|
||||
ComplexTypes::Word::String* pVal = oDDList.m_arrListEntry[i];
|
||||
if(pVal->m_sVal.IsInit())
|
||||
|
||||
@ -555,7 +555,6 @@ HEADERS += \
|
||||
../src/docx/xlsx_xf.h \
|
||||
../include/logging.h \
|
||||
../include/cpdoccore/CPColorUtils.h \
|
||||
../include/cpdoccore/CPHash.h \
|
||||
../include/cpdoccore/CPNoncopyable.h \
|
||||
../include/cpdoccore/CPOptional.h \
|
||||
../include/cpdoccore/CPScopedPtr.h \
|
||||
|
||||
@ -224,8 +224,9 @@ public:
|
||||
bool & get_use_image_replace()
|
||||
{
|
||||
bool res = false;
|
||||
if (frames_.size()>0) return frames_.back().use_image_replace;
|
||||
else return res;
|
||||
if (!frames_.empty()) return frames_.back().use_image_replace;
|
||||
else
|
||||
throw;
|
||||
}
|
||||
|
||||
std::wstring & get_text_stream_shape()
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "oox_chart_legend.h"
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
*
|
||||
*/
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "oox_chart_shape.h"
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "oox_data_labels.h"
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include "oox_layout.h"
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "oox_plot_area.h"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include "oox_title.h"
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include "xlsx_border.h"
|
||||
#include <boost/functional.hpp>
|
||||
#include <cpdoccore/CPHash.h>
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include "../odf/style_text_properties.h"
|
||||
|
||||
|
||||
@ -66,9 +66,10 @@ public:
|
||||
|
||||
struct _field_value
|
||||
{
|
||||
_field_value(const std::wstring &val, const std::wstring &type) : sVal(val), sNode(type) {}
|
||||
_field_value(const std::wstring &val, const std::wstring &type, const bool &sd) : sVal(val), sNode(type), show_details(sd) {}
|
||||
std::wstring sVal;
|
||||
std::wstring sNode;
|
||||
bool show_details;
|
||||
};
|
||||
struct _reference
|
||||
{
|
||||
@ -141,6 +142,11 @@ public:
|
||||
data_on_row = false;
|
||||
identify_categories = false;
|
||||
drill_enabled = true;
|
||||
grand_total = -1;
|
||||
firstDataRow = 0;
|
||||
firstDataCol = 0;
|
||||
bAxisRow = true;
|
||||
bAxisCol = true;
|
||||
}
|
||||
std::wstring name;
|
||||
std::wstring location_ref;
|
||||
@ -160,14 +166,21 @@ public:
|
||||
std::vector<int> col_fields;
|
||||
std::vector<int> data_fields;
|
||||
|
||||
int grand_total = -1;
|
||||
bool identify_categories = false;
|
||||
bool drill_enabled = true;
|
||||
bool ignore_empty_rows = false;
|
||||
|
||||
bool data_on_row = false;
|
||||
bool in_group = false;
|
||||
//-----------------------------------------------------------------------------
|
||||
int firstDataRow = 0;
|
||||
int firstDataCol = 0;
|
||||
bool bAxisRow = true;
|
||||
bool bAxisCol = true;
|
||||
}current_;
|
||||
|
||||
void calc_headers();
|
||||
void sort_fields();
|
||||
|
||||
void serialize_view(std::wostream & strm);
|
||||
@ -279,6 +292,109 @@ private:
|
||||
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
|
||||
{
|
||||
}
|
||||
void xlsx_pivots_context::Impl::calc_headers()
|
||||
{
|
||||
if (current_.headers.empty()) return;
|
||||
|
||||
std::map<size_t, size_t> mapRowHeader;
|
||||
std::map<size_t, size_t> mapColHeader;
|
||||
|
||||
std::map<size_t, size_t>::iterator pFind;
|
||||
|
||||
size_t min_col = 0xffffff, min_row = 0xffffff;
|
||||
for (size_t i = 0; i < current_.headers.size(); i++)//("F18","F19","F23","G21","H21")
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(current_.headers[i], col, row);
|
||||
|
||||
if (col < min_col) min_col = col;
|
||||
if (row < min_row) min_row = row;
|
||||
|
||||
pFind = mapRowHeader.find(row);
|
||||
if (pFind == mapRowHeader.end())
|
||||
{
|
||||
mapRowHeader.insert(std::make_pair(row, col));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pFind->second > col )
|
||||
pFind->second = col;
|
||||
}
|
||||
|
||||
pFind = mapColHeader.find(col);
|
||||
if (pFind == mapColHeader.end())
|
||||
{
|
||||
mapColHeader.insert(std::make_pair(col, row));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pFind->second > row )
|
||||
pFind->second = row;
|
||||
}
|
||||
}
|
||||
bool resRow = clear_header_map(mapRowHeader);
|
||||
bool resCol = clear_header_map(mapColHeader);
|
||||
|
||||
if (resRow == resCol && resCol == false)
|
||||
{
|
||||
current_.firstDataRow = current_.firstDataCol = 1;
|
||||
}
|
||||
else if (resRow == false)
|
||||
{
|
||||
current_.bAxisCol = false;
|
||||
clear_header_map2(mapRowHeader, mapColHeader);
|
||||
}
|
||||
else if (resCol == false)
|
||||
{
|
||||
current_.bAxisRow = false;
|
||||
clear_header_map2(mapColHeader, mapRowHeader);
|
||||
}
|
||||
|
||||
if (resRow || resCol)
|
||||
{
|
||||
current_.firstDataCol = mapRowHeader.empty() ? 1 : mapRowHeader.begin()->second - min_col;
|
||||
|
||||
if (mapColHeader.empty())
|
||||
{
|
||||
pFind = mapRowHeader.end(); pFind--;
|
||||
min_row = pFind->first;
|
||||
current_.firstDataRow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
min_row = mapColHeader.begin()->second;
|
||||
if (!mapRowHeader.empty() && current_.page_fields.empty())
|
||||
{
|
||||
if (min_row > mapRowHeader.begin()->first)
|
||||
min_row = mapRowHeader.begin()->first;
|
||||
}
|
||||
current_.firstDataRow = mapColHeader.begin()->second - min_row + 1;
|
||||
}
|
||||
}
|
||||
if (current_.firstDataCol < 1) current_.firstDataCol = 1;
|
||||
if (current_.firstDataRow < 1) current_.firstDataRow = 1;
|
||||
|
||||
std::vector<std::wstring> split_ref;
|
||||
boost::algorithm::split(split_ref, current_.location_ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (split_ref.size() > 0)
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(split_ref[0], col, row);
|
||||
|
||||
if (min_col != 0xffffff && min_row != 0xffffff)
|
||||
{
|
||||
col = min_col;
|
||||
row = min_row;
|
||||
}
|
||||
|
||||
split_ref[0] = oox::getColAddress(col) + oox::getRowAddress(row);
|
||||
}
|
||||
if (split_ref.size() > 1)
|
||||
{
|
||||
current_.location_ref = split_ref[0] + L":" + split_ref[1];
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::Impl::sort_fields()
|
||||
{
|
||||
size_t count_skip = 0;
|
||||
@ -304,8 +420,10 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
}
|
||||
}
|
||||
|
||||
bool bEmptyRowCache = false, bAddRepeateCol = false;
|
||||
bool bEmptyColCache = false, bAddRepeateRow = false;
|
||||
bool bAddRepeateRow = false;
|
||||
bool bAddRepeateCol = false;
|
||||
|
||||
int count_items_col = -1, count_items_row = -1;
|
||||
|
||||
int index_current = 0;
|
||||
for (size_t i = 0; i < current_.fields.size(); i++, index_current++)
|
||||
@ -349,22 +467,37 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
case 0: // column
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
{
|
||||
current_.col_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
if ( count_items_col < 0)
|
||||
{
|
||||
if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
{
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
count_items_col = current_.fields[i].caches.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count_items_col != current_.fields[i].caches.size())
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
}
|
||||
//if (current_.fields[i].data_layout)
|
||||
//{
|
||||
// bAddRepeateCol = false;
|
||||
|
||||
// if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
// current_.fields[i].used_in_referenes )
|
||||
// {
|
||||
// if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
// {
|
||||
// bAddRepeateCol = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyColCache = true;
|
||||
//if (current_.fields[i].caches.empty())
|
||||
// bEmptyColCache = true;
|
||||
|
||||
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
@ -405,23 +538,33 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
case 4: // row
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
{
|
||||
current_.row_fields.push_back(i);
|
||||
|
||||
if ( count_items_row < 0)
|
||||
{
|
||||
count_items_row = current_.fields[i].caches.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count_items_row != current_.fields[i].caches.size())
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
current_.data_on_row = true;
|
||||
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
bAddRepeateCol = false;
|
||||
|
||||
if ((current_.fields[i].name.empty() && (current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyRowCache = true;
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
@ -432,118 +575,14 @@ void xlsx_pivots_context::Impl::sort_fields()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (bAddRepeateCol || bEmptyColCache)
|
||||
if (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if (bAddRepeateRow)
|
||||
if (bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))
|
||||
current_.row_fields.push_back(-2);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
if (current_.headers.empty()) return;
|
||||
|
||||
std::map<size_t, size_t> mapRowHeader;
|
||||
std::map<size_t, size_t> mapColHeader;
|
||||
|
||||
std::map<size_t, size_t>::iterator pFind;
|
||||
|
||||
size_t min_col = 0xffffff, min_row = 0xffffff;
|
||||
for (size_t i = 0; i < current_.headers.size(); i++)//("F18","F19","F23","G21","H21")
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(current_.headers[i], col, row);
|
||||
|
||||
if (col < min_col) min_col = col;
|
||||
if (row < min_row) min_row = row;
|
||||
|
||||
pFind = mapRowHeader.find(row);
|
||||
if (pFind == mapRowHeader.end())
|
||||
{
|
||||
mapRowHeader.insert(std::make_pair(row, col));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pFind->second > col )
|
||||
pFind->second = col;
|
||||
}
|
||||
|
||||
pFind = mapColHeader.find(col);
|
||||
if (pFind == mapColHeader.end())
|
||||
{
|
||||
mapColHeader.insert(std::make_pair(col, row));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pFind->second > row )
|
||||
pFind->second = row;
|
||||
}
|
||||
}
|
||||
bool resRow = clear_header_map(mapRowHeader);
|
||||
bool resCol = clear_header_map(mapColHeader);
|
||||
|
||||
size_t firstDataRow, firstDataCol;
|
||||
|
||||
if (resRow == resCol && resCol == false)
|
||||
{
|
||||
firstDataRow = firstDataCol = 1;
|
||||
}
|
||||
else if (resRow == false)
|
||||
{
|
||||
clear_header_map2(mapRowHeader, mapColHeader);
|
||||
}
|
||||
else if (resCol == false)
|
||||
{
|
||||
clear_header_map2(mapColHeader, mapRowHeader);
|
||||
}
|
||||
|
||||
if (resRow || resCol)
|
||||
{
|
||||
firstDataCol = mapRowHeader.empty() ? 1 : mapRowHeader.begin()->second - min_col;
|
||||
|
||||
if (mapColHeader.empty())
|
||||
{
|
||||
pFind = mapRowHeader.end(); pFind--;
|
||||
min_row = pFind->first;
|
||||
firstDataRow = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
min_row = mapColHeader.begin()->second;
|
||||
if (!mapRowHeader.empty() && current_.page_fields.empty())
|
||||
{
|
||||
if (min_row > mapRowHeader.begin()->first)
|
||||
min_row = mapRowHeader.begin()->first;
|
||||
}
|
||||
firstDataRow = mapColHeader.begin()->second - min_row + 1;
|
||||
}
|
||||
}
|
||||
if (firstDataCol < 1) firstDataCol = 1;
|
||||
if (firstDataRow < 1) firstDataRow = 1;
|
||||
|
||||
std::vector<std::wstring> split_ref;
|
||||
boost::algorithm::split(split_ref, current_.location_ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
|
||||
|
||||
if (split_ref.size() > 0)
|
||||
{
|
||||
size_t row = 0, col = 0;
|
||||
oox::getCellAddressInv(split_ref[0], col, row);
|
||||
|
||||
if (min_col != 0xffffff && min_row != 0xffffff)
|
||||
{
|
||||
col = min_col;
|
||||
row = min_row;
|
||||
}
|
||||
|
||||
split_ref[0] = oox::getColAddress(col) + oox::getRowAddress(row);
|
||||
}
|
||||
std::wstring location_data;
|
||||
if (split_ref.size() > 1)
|
||||
{
|
||||
location_data += split_ref[0] + L":" + split_ref[1];
|
||||
}
|
||||
else location_data = current_.location_ref;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotTableDefinition")
|
||||
@ -580,11 +619,11 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
|
||||
CP_XML_NODE(L"location")
|
||||
{
|
||||
CP_XML_ATTR(L"ref", location_data);
|
||||
CP_XML_ATTR(L"ref", current_.location_ref);
|
||||
|
||||
CP_XML_ATTR(L"firstHeaderRow", 1 );
|
||||
CP_XML_ATTR(L"firstDataRow", firstDataRow);
|
||||
CP_XML_ATTR(L"firstDataCol", firstDataCol);
|
||||
CP_XML_ATTR(L"firstDataRow", current_.firstDataRow);
|
||||
CP_XML_ATTR(L"firstDataCol", current_.firstDataCol);
|
||||
|
||||
if (current_.page_fields.empty() == false)
|
||||
{
|
||||
@ -660,6 +699,10 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
if (current_.fields[i].caches[j].show_details == false)
|
||||
{
|
||||
CP_XML_ATTR(L"sd", 0);
|
||||
}
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
@ -898,7 +941,7 @@ void xlsx_pivots_context::Impl::serialize_type_field(CP_ATTR_NODE, _field & fiel
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
std::map<std::wstring, bool> used_field_name;
|
||||
std::map<std::wstring, bool> used_field_name, used_field_name_lower;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
@ -956,12 +999,24 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
|
||||
if (used_field_name.end() != used_field_name.find(current_.fields[i].name))
|
||||
continue;
|
||||
//---------------------------------------------------------------------------
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true)); //дублированые поля
|
||||
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true));
|
||||
std::wstring name = current_.fields[i].name; // в мс "H" и "h" одно имя (
|
||||
|
||||
std::wstring name_lower = XmlUtils::GetLower(name);
|
||||
|
||||
while (used_field_name_lower.end() != used_field_name_lower.find(name_lower))
|
||||
{
|
||||
name += L"_";
|
||||
name_lower = XmlUtils::GetLower(name);
|
||||
}
|
||||
|
||||
used_field_name_lower.insert(std::make_pair(name_lower, true));
|
||||
//---------------------------------------------------------------------------
|
||||
CP_XML_NODE(L"cacheField")
|
||||
{
|
||||
CP_XML_ATTR(L"name", current_.fields[i].name);
|
||||
CP_XML_ATTR(L"name", name);
|
||||
CP_XML_ATTR(L"numFmtId", 0);
|
||||
|
||||
if (!current_.fields[i].source_groups.empty())
|
||||
@ -1181,6 +1236,7 @@ int xlsx_pivots_context::end_table()
|
||||
std::wstringstream cache_strm;
|
||||
std::wstringstream rec_strm;
|
||||
|
||||
impl_->calc_headers();
|
||||
impl_->sort_fields();
|
||||
|
||||
impl_->serialize_view(view_strm);
|
||||
@ -1226,6 +1282,10 @@ void xlsx_pivots_context::set_drill(bool val)
|
||||
{
|
||||
impl_->current_.drill_enabled = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_grand_total(int type)
|
||||
{
|
||||
impl_->current_.grand_total = type;
|
||||
}
|
||||
void xlsx_pivots_context::start_field()
|
||||
{
|
||||
Impl::_field f;
|
||||
@ -1401,14 +1461,14 @@ void xlsx_pivots_context::set_field_ref_member_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_type = type;
|
||||
}
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value, bool show_details)
|
||||
{
|
||||
if (index < 0)
|
||||
index = impl_->current_.fields.back().caches.size();
|
||||
|
||||
while (index > impl_->current_.fields.back().caches.size())
|
||||
{
|
||||
Impl::_field_value f(L"", L"m");
|
||||
Impl::_field_value f(L"", L"m", true);
|
||||
|
||||
impl_->current_.fields.back().caches.push_back(f);
|
||||
impl_->current_.fields.back().bEmpty = true;
|
||||
@ -1469,7 +1529,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
impl_->current_.fields.back().bString = true;
|
||||
}
|
||||
}
|
||||
impl_->current_.fields.back().caches.push_back(Impl::_field_value(value, node_name));
|
||||
impl_->current_.fields.back().caches.push_back(Impl::_field_value(value, node_name, show_details));
|
||||
|
||||
if (impl_->current_.in_group)
|
||||
{
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
void set_field_function (int type);
|
||||
void set_field_user_function (std::wstring f);
|
||||
void add_field_subtotal (int function_type);
|
||||
void add_field_cache (int index, std::wstring value);
|
||||
void add_field_cache (int index, std::wstring value, bool show_details = true);
|
||||
void set_field_show_empty (bool val);
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
@ -89,6 +89,7 @@ public:
|
||||
void set_identify_categories(bool val);
|
||||
void set_ignore_empty_rows(bool val);
|
||||
void set_drill(bool val);
|
||||
void set_grand_total(int type);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
return L"";
|
||||
}
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, "CompObj");
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
{
|
||||
//skip the CompObjHeader
|
||||
|
||||
@ -87,10 +87,6 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
else if ( CP_CHECK_NAME(L"math", L"math") || CP_CHECK_NAME(L"", L"math"))
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"manifest", L"manifest")
|
||||
{
|
||||
create_element_and_read(Reader, Ns, Name, xml_content_, getContext(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,9 +62,9 @@ void table_calculation_settings::add_child_element( xml::sax * Reader, const std
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_null_date_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"null-date")
|
||||
{
|
||||
}
|
||||
//else if CP_CHECK_NAME(L"table", L"iteration")
|
||||
//{
|
||||
//}
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
|
||||
@ -108,6 +108,10 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
Context.get_pivots_context().set_view_target_range(ref);
|
||||
Context.get_pivots_context().set_view_target_table_name(sheet_name);
|
||||
}
|
||||
if (table_grand_total_)
|
||||
{
|
||||
Context.get_pivots_context().set_grand_total(table_grand_total_->get_type());
|
||||
}
|
||||
|
||||
if (table_buttons_)
|
||||
{
|
||||
@ -494,7 +498,7 @@ void table_data_pilot_member::add_attributes( const xml::attributes_wc_ptr & Att
|
||||
|
||||
void table_data_pilot_member::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""));
|
||||
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""), table_show_details_ ? table_show_details_->get() : true);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_group_member::ns = L"table";
|
||||
|
||||
@ -490,7 +490,6 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
size_t style_ = Context.get_style_manager().xfId(NULL,NULL, &cellFormatProperties, NULL, L"", set_default);
|
||||
|
||||
if (style_>=0)
|
||||
//if (set_default)
|
||||
CP_XML_ATTR(L"style", style_ );
|
||||
}
|
||||
|
||||
@ -1111,10 +1111,6 @@
|
||||
RelativePath="..\include\cpdoccore\CPColorUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cpdoccore\CPHash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cpdoccore\CPNoncopyable.h"
|
||||
>
|
||||
|
||||
@ -2463,8 +2463,6 @@ void odf_drawing_context::start_action(std::wstring value)
|
||||
event_->attlist_.presentation_action_ = L"last-page";
|
||||
else if (std::wstring::npos != value.find(L"endshow"))
|
||||
event_->attlist_.presentation_action_ = L"end";
|
||||
else if (std::wstring::npos != value.find(L"endshow"))
|
||||
event_->attlist_.presentation_action_ = L"end";
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinksldjump"))
|
||||
{
|
||||
|
||||
@ -75,11 +75,8 @@ office_element_creator * office_element_creator::get()
|
||||
{
|
||||
if (!instance_)
|
||||
{
|
||||
if (!instance_)
|
||||
{
|
||||
office_element_creator * temp = new office_element_creator();
|
||||
instance_ = temp;
|
||||
}
|
||||
office_element_creator * temp = new office_element_creator();
|
||||
instance_ = temp;
|
||||
}
|
||||
|
||||
return instance_;
|
||||
|
||||
@ -2733,10 +2733,10 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
std::wstring strColor = L"#" + oRgbColor->ToString().substr(2);//.Right(6);
|
||||
|
||||
odf_color = odf_types::color(strColor);
|
||||
delete oRgbColor;
|
||||
|
||||
result = true;
|
||||
}
|
||||
if (oRgbColor)
|
||||
delete oRgbColor;
|
||||
}
|
||||
if(theme_color && result == false)
|
||||
{
|
||||
|
||||
@ -925,9 +925,10 @@ void PptxConverter::convert(PPTX::Logic::Table *oox_table)
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::TableRow *oox_table_row)
|
||||
{
|
||||
odp_context->slide_context()->start_table_row(oox_table_row->Height.IsInit());
|
||||
if (!oox_table_row) return;
|
||||
|
||||
odp_context->slide_context()->start_table_row(oox_table_row->Height.IsInit());
|
||||
|
||||
if (oox_table_row->Height.IsInit())
|
||||
{
|
||||
odf_writer::style_table_row_properties * table_row_properties = odp_context->styles_context()->last_state()->get_table_row_properties();
|
||||
|
||||
@ -959,7 +959,7 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteTransition(CStringWriter& oWriter, CTransition& transition)
|
||||
{
|
||||
if (!transition.m_nEffectType == 0xFF) return;
|
||||
if (transition.m_nEffectType == 0xFF) return;
|
||||
|
||||
std::wstring type;
|
||||
|
||||
|
||||
@ -787,9 +787,9 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
|
||||
{
|
||||
if (m_pShapeElement->m_lPlaceholderSizePreset == 1)
|
||||
m_oWriter.WriteString(std::wstring(L" size=\"half\""));
|
||||
if (m_pShapeElement->m_lPlaceholderSizePreset == 2)
|
||||
else if (m_pShapeElement->m_lPlaceholderSizePreset == 2)
|
||||
m_oWriter.WriteString(std::wstring(L" size=\"quarter\""));
|
||||
if (m_pShapeElement->m_lPlaceholderSizePreset == 3)
|
||||
else if (m_pShapeElement->m_lPlaceholderSizePreset == 3)
|
||||
{
|
||||
if (isBodyPlaceholder(m_pShapeElement->m_lPlaceholderType))
|
||||
m_oWriter.WriteString(std::wstring(L" size=\"half\""));
|
||||
|
||||
@ -100,7 +100,7 @@ public:
|
||||
{
|
||||
delete pInfo;
|
||||
|
||||
if (pInfo->m_bEncrypt)
|
||||
if (m_oCurrentUser.m_bIsEncrypt)
|
||||
return false;
|
||||
else
|
||||
continue;
|
||||
|
||||
@ -195,7 +195,7 @@ void CPPTUserInfo::DecryptStream(POLE::Stream *pStream, int block)
|
||||
{
|
||||
int size = pStream->size() - pStream->tell();
|
||||
|
||||
POLE::Stream *pStreamTmp = new POLE::Stream(m_pStorageDecrypt, "Tmp" + std::to_string(m_arStreamDecrypt.size() + 1), true, size);
|
||||
POLE::Stream *pStreamTmp = new POLE::Stream(m_pStorageDecrypt, L"Tmp" + std::to_wstring(m_arStreamDecrypt.size() + 1), true, size);
|
||||
unsigned char* data_stream = new unsigned char[size];
|
||||
|
||||
pStream->read(data_stream, size);
|
||||
@ -2432,12 +2432,14 @@ void CPPTUserInfo::AddAudioTransition (DWORD dwSlideID, CTransition* pTransition
|
||||
if (NULL==pTransition)
|
||||
return;
|
||||
|
||||
CAudioElement* pAudio = new CAudioElement ();
|
||||
CAudioElement* pAudio = new CAudioElement ();
|
||||
if (pAudio)
|
||||
{
|
||||
pAudio->m_strAudioFileName = strFilePath;
|
||||
}
|
||||
// ??? недоделка ???
|
||||
|
||||
pAudio->Release();
|
||||
}
|
||||
|
||||
void CPPTUserInfo::CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme)
|
||||
|
||||
@ -37,17 +37,17 @@
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../Records/Drawing/ArtBlip.h"
|
||||
|
||||
#define CURRENT_USER_STREAM "Current User"
|
||||
#define CURRENT_USER_STREAM L"Current User"
|
||||
|
||||
#define DOCUMENT_STREAM "PowerPoint Document"
|
||||
#define DOCUMENT_STREAM L"PowerPoint Document"
|
||||
|
||||
#define PICTURE_STREAM "Pictures"
|
||||
#define HEADER_STREAM "Header"
|
||||
#define PICTURE_STREAM L"Pictures"
|
||||
#define HEADER_STREAM L"Header"
|
||||
|
||||
#define PP97_DUALSTORAGE "PP97_DUALSTORAGE"
|
||||
#define PP97_DUALSTORAGE L"PP97_DUALSTORAGE"
|
||||
|
||||
#define ENCRYPTED_SUMMARY_STREAM "EncryptedSummary"
|
||||
#define DOCUMENT_SUMMARY_STREAM "DocumentSummaryInformation"
|
||||
#define ENCRYPTED_SUMMARY_STREAM L"EncryptedSummary"
|
||||
#define DOCUMENT_SUMMARY_STREAM L"DocumentSummaryInformation"
|
||||
|
||||
CPPTFileReader::CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp):
|
||||
m_pStorage(pStorage),
|
||||
@ -69,7 +69,7 @@ CPPTFileReader::CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp):
|
||||
{
|
||||
RELEASEOBJECT(pStm);
|
||||
|
||||
std::string stream_name = std::string(PP97_DUALSTORAGE) + std::string("/") + std::string(CURRENT_USER_STREAM);
|
||||
std::wstring stream_name = std::wstring(PP97_DUALSTORAGE) + std::wstring(L"/") + std::wstring(CURRENT_USER_STREAM);
|
||||
pStm = new POLE::Stream( m_pStorage, stream_name);
|
||||
|
||||
if (pStm == NULL)
|
||||
@ -157,14 +157,14 @@ CFStreamPtr CPPTFileReader::GetPictureStream()
|
||||
}
|
||||
return m_pPictureStream;
|
||||
}
|
||||
CFStreamPtr CPPTFileReader::GetStreamByName(const std::string & name)
|
||||
CFStreamPtr CPPTFileReader::GetStreamByName(const std::wstring & name)
|
||||
{
|
||||
if (!m_bIsPPTFile)
|
||||
return CFStreamPtr();
|
||||
|
||||
std::string stream_name;
|
||||
std::wstring stream_name;
|
||||
|
||||
if (m_bDualStorage) stream_name = std::string(PP97_DUALSTORAGE) + std::string("/");
|
||||
if (m_bDualStorage) stream_name = std::wstring(PP97_DUALSTORAGE) + std::wstring(L"/");
|
||||
|
||||
POLE::Stream *pStream = new POLE::Stream(m_pStorage, stream_name + name);
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ protected:
|
||||
CFStreamPtr GetEncryptedSummaryStream();
|
||||
CFStreamPtr GetDocumentSummaryStream();
|
||||
|
||||
CFStreamPtr GetStreamByName(const std::string & name);
|
||||
CFStreamPtr GetStreamByName(const std::wstring & name);
|
||||
|
||||
bool ReadCurrentUser(POLE::Stream *pStm);
|
||||
void ReadEncryptedSummary();
|
||||
|
||||
@ -526,7 +526,7 @@ namespace Animations
|
||||
//{
|
||||
// if (RT_ParaBuild == header.RecType)
|
||||
// {
|
||||
// rgChildRec = new ParaBuildContainer ();
|
||||
// rgChildRec = new ParaBuildContainer ();
|
||||
// if (rgChildRec)
|
||||
// rgChildRec->ReadFromStream (header, pStream);
|
||||
// }
|
||||
@ -982,60 +982,25 @@ namespace Animations
|
||||
|
||||
switch ( VariableType )
|
||||
{
|
||||
case TL_TPID_Display :
|
||||
pRecord = new TimeDisplayType ();
|
||||
case TL_TPID_MasterPos :
|
||||
pRecord = new TimeMasterRelType ();
|
||||
case TL_TPID_SlaveType :
|
||||
pRecord = new TimeSlaveType ();
|
||||
case TL_TPID_Display: pRecord = new TimeDisplayType (); break;
|
||||
case TL_TPID_MasterPos: pRecord = new TimeMasterRelType (); break;
|
||||
case TL_TPID_SlaveType: pRecord = new TimeSlaveType (); break;
|
||||
case TL_TPID_EffectID: pRecord = new TimeEffectID (); break;
|
||||
case TL_TPID_EffectDir: pRecord = new TimeEffectDir (); break;
|
||||
case TL_TPID_EffectType: pRecord = new TimeEffectType (); break;
|
||||
case TL_TPID_AfterEffect: pRecord = new TimeAfterEffect (); break;
|
||||
case TL_TPID_SlideCount: pRecord = new TimeSlideCount (); break;
|
||||
case TL_TPID_TimeFilter: pRecord = new TimeNodeTimeFilter (); break;
|
||||
case TL_TPID_EventFilter: pRecord = new TimeEventFilter (); break;
|
||||
case TL_TPID_HideWhenStopped: pRecord = new TimeHideWhenStopped (); break;
|
||||
case TL_TPID_GroupID: pRecord = new TimeGroupID (); break;
|
||||
case TL_TPID_EffectNodeType: pRecord = new TimeEffectNodeType (); break;
|
||||
case TL_TPID_PlaceholderNode: pRecord = new TimePlaceholderNode (); break;
|
||||
case TL_TPID_MediaVolume: pRecord = new TimeMediaVolume (); break;
|
||||
case TL_TPID_MediaMute: pRecord = new TimeMediaMute (); break;
|
||||
case TL_TPID_ZoomToFullScreen: pRecord = new TimeZoomToFullScreen (); break;
|
||||
default :
|
||||
break;
|
||||
case TL_TPID_EffectID :
|
||||
pRecord = new TimeEffectID ();
|
||||
break;
|
||||
case TL_TPID_EffectDir :
|
||||
pRecord = new TimeEffectDir ();
|
||||
break;
|
||||
case TL_TPID_EffectType :
|
||||
pRecord = new TimeEffectType ();
|
||||
break;
|
||||
case TL_TPID_AfterEffect :
|
||||
pRecord = new TimeAfterEffect ();
|
||||
break;
|
||||
case TL_TPID_SlideCount :
|
||||
pRecord = new TimeSlideCount ();
|
||||
break;
|
||||
case TL_TPID_TimeFilter :
|
||||
pRecord = new TimeNodeTimeFilter ();
|
||||
break;
|
||||
case TL_TPID_EventFilter :
|
||||
pRecord = new TimeEventFilter ();
|
||||
break;
|
||||
case TL_TPID_HideWhenStopped :
|
||||
pRecord = new TimeHideWhenStopped ();
|
||||
break;
|
||||
case TL_TPID_GroupID :
|
||||
pRecord = new TimeGroupID ();
|
||||
break;
|
||||
case TL_TPID_EffectNodeType :
|
||||
pRecord = new TimeEffectNodeType ();
|
||||
break;
|
||||
case TL_TPID_PlaceholderNode :
|
||||
pRecord = new TimePlaceholderNode ();
|
||||
break;
|
||||
case TL_TPID_MediaVolume :
|
||||
pRecord = new TimeMediaVolume ();
|
||||
break;
|
||||
case TL_TPID_MediaMute :
|
||||
pRecord = new TimeMediaMute ();
|
||||
break;
|
||||
case TL_TPID_ZoomToFullScreen :
|
||||
pRecord = new TimeZoomToFullScreen ();
|
||||
break;
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
default : assert (0);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
pRecord->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -1359,7 +1324,7 @@ namespace Animations
|
||||
|
||||
if ( RT_TimePropertyList == header.RecType )
|
||||
{
|
||||
propertyList = new TimePropertyList4TimeBehavior();
|
||||
propertyList = new TimePropertyList4TimeBehavior();
|
||||
if (propertyList)
|
||||
{
|
||||
propertyList->ReadFromStream (header, pStream);
|
||||
@ -1371,7 +1336,7 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeVariantList == header.RecType )
|
||||
{
|
||||
stringList = new TimeStringListContainer();
|
||||
stringList = new TimeStringListContainer();
|
||||
if (stringList)
|
||||
{
|
||||
stringList->ReadFromStream (header, pStream);
|
||||
@ -1420,7 +1385,7 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeVariantList == ReadHeader.RecType )
|
||||
{
|
||||
haveStringList = true;
|
||||
haveStringList = true;
|
||||
stringList.ReadFromStream ( ReadHeader, pStream );
|
||||
}
|
||||
}
|
||||
@ -2394,8 +2359,8 @@ namespace Animations
|
||||
|
||||
if ( RT_TimePropertyList == nRecord )
|
||||
{
|
||||
haveTimePropertyList = true;
|
||||
timePropertyList = new TimePropertyList4TimeNodeContainer ();
|
||||
haveTimePropertyList = true;
|
||||
timePropertyList = new TimePropertyList4TimeNodeContainer ();
|
||||
timePropertyList->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
continue;
|
||||
@ -2403,8 +2368,8 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeSetBehaviorContainer == nRecord )
|
||||
{
|
||||
haveSetBehavior = true;
|
||||
timeSetBehavior = new TimeSetBehaviorContainer();
|
||||
haveSetBehavior = true;
|
||||
timeSetBehavior = new TimeSetBehaviorContainer();
|
||||
timeSetBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
continue;
|
||||
@ -2412,8 +2377,8 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeColorBehaviorContainer == nRecord )
|
||||
{
|
||||
haveColorBehavior = true;
|
||||
timeColorBehavior = new TimeColorBehaviorContainer();
|
||||
haveColorBehavior = true;
|
||||
timeColorBehavior = new TimeColorBehaviorContainer();
|
||||
timeColorBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
continue;
|
||||
@ -2421,8 +2386,8 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeClientVisualElement == nRecord )
|
||||
{
|
||||
haveClientVisualElement = true;
|
||||
clientVisualElement = new ClientVisualElementContainer ();
|
||||
haveClientVisualElement = true;
|
||||
clientVisualElement = new ClientVisualElementContainer ();
|
||||
clientVisualElement->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
continue;
|
||||
@ -2433,7 +2398,7 @@ namespace Animations
|
||||
extTimeContainer = CAnimationFactory::BuildAnimationObject (nRecord); // ExtTimeNodeContainer
|
||||
if (extTimeContainer)
|
||||
{
|
||||
haveExtTimeContainer = true;
|
||||
haveExtTimeContainer = true;
|
||||
extTimeContainer->ReadFromStream ( ReadHeader, pStream );
|
||||
continue;
|
||||
}
|
||||
@ -2547,14 +2512,14 @@ namespace Animations
|
||||
if ( ReadHeader.ReadFromStream(pStream) == false)
|
||||
break;
|
||||
|
||||
lCurLen += 8 + ReadHeader.RecLen;
|
||||
lCurLen += 8 + ReadHeader.RecLen;
|
||||
|
||||
//AnimationsClassType nRecord = (AnimationsClassType)ReadHeader.RecType;
|
||||
WORD nRecord = ReadHeader.RecType;
|
||||
|
||||
if ( RT_TimeExtTimeNodeContainer == nRecord )
|
||||
{
|
||||
ExtTimeNodeContainer* pContainer = new ExtTimeNodeContainer ();
|
||||
ExtTimeNodeContainer* pContainer = new ExtTimeNodeContainer ();
|
||||
if (pContainer)
|
||||
{
|
||||
pContainer->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -2566,11 +2531,11 @@ namespace Animations
|
||||
|
||||
if ( RT_BuildList == nRecord )
|
||||
{
|
||||
buildList = new BuildListContainer ();
|
||||
buildList = new BuildListContainer ();
|
||||
if (buildList)
|
||||
{
|
||||
buildList->ReadFromStream ( ReadHeader, pStream );
|
||||
haveBuildList = true;
|
||||
haveBuildList = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2590,11 +2555,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeSequenceData == nRecord )
|
||||
{
|
||||
timeSequenceDataAtom = new TimeSequenceDataAtom ();
|
||||
timeSequenceDataAtom = new TimeSequenceDataAtom ();
|
||||
if (timeSequenceDataAtom)
|
||||
{
|
||||
timeSequenceDataAtom->ReadFromStream ( ReadHeader, pStream );
|
||||
haveSequenceAtom = true;
|
||||
haveSequenceAtom = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2602,11 +2567,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeIterateData == nRecord )
|
||||
{
|
||||
timeIterateDataAtom = new TimeIterateDataAtom ();
|
||||
timeIterateDataAtom = new TimeIterateDataAtom ();
|
||||
if (timeIterateDataAtom)
|
||||
{
|
||||
timeIterateDataAtom->ReadFromStream ( ReadHeader, pStream );
|
||||
haveIterateDataAtom = true;
|
||||
haveIterateDataAtom = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2614,7 +2579,7 @@ namespace Animations
|
||||
|
||||
if ( RT_TimePropertyList == nRecord )
|
||||
{
|
||||
timePropertyList = new TimePropertyList4TimeNodeContainer ();
|
||||
timePropertyList = new TimePropertyList4TimeNodeContainer ();
|
||||
if (timePropertyList)
|
||||
{
|
||||
timePropertyList->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -2626,22 +2591,22 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeEffectBehaviorContainer == nRecord )
|
||||
{
|
||||
timeEffectBehavior = new TimeEffectBehaviorContainer();
|
||||
timeEffectBehavior = new TimeEffectBehaviorContainer();
|
||||
if (timeEffectBehavior)
|
||||
{
|
||||
timeEffectBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveEffectBehavior = true;
|
||||
haveEffectBehavior = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( RT_TimeColorBehaviorContainer == nRecord )
|
||||
{
|
||||
timeColorBehavior = new TimeColorBehaviorContainer();
|
||||
timeColorBehavior = new TimeColorBehaviorContainer();
|
||||
if (timeColorBehavior)
|
||||
{
|
||||
timeColorBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveColorBehavior = true;
|
||||
haveColorBehavior = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2649,11 +2614,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeMotionBehaviorContainer == nRecord )
|
||||
{
|
||||
timeMotionBehavior = new TimeMotionBehaviorContainer ();
|
||||
timeMotionBehavior = new TimeMotionBehaviorContainer ();
|
||||
if (timeMotionBehavior)
|
||||
{
|
||||
timeMotionBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveMotionBehavior = true;
|
||||
haveMotionBehavior = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2661,11 +2626,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeSetBehaviorContainer == nRecord )
|
||||
{
|
||||
timeSetBehavior = new TimeSetBehaviorContainer ();
|
||||
timeSetBehavior = new TimeSetBehaviorContainer ();
|
||||
if (timeSetBehavior)
|
||||
{
|
||||
timeSetBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveSetBehavior = true;
|
||||
haveSetBehavior = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2673,11 +2638,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeAnimateBehaviorContainer == nRecord )
|
||||
{
|
||||
timeAnimateBehavior = new TimeAnimateBehaviorContainer ();
|
||||
timeAnimateBehavior = new TimeAnimateBehaviorContainer ();
|
||||
if (timeAnimateBehavior)
|
||||
{
|
||||
timeAnimateBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveAnimateBehavior = true;
|
||||
haveAnimateBehavior = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2685,7 +2650,7 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeRotationBehaviorContainer == nRecord )
|
||||
{
|
||||
timeRotationBehavior = new TimeRotationBehaviorContainer ();
|
||||
timeRotationBehavior = new TimeRotationBehaviorContainer ();
|
||||
if (timeRotationBehavior)
|
||||
{
|
||||
timeRotationBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -2697,11 +2662,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeScaleBehaviorContainer == nRecord )
|
||||
{
|
||||
timeScaleBehavior = new TimeScaleBehaviorContainer ();
|
||||
timeScaleBehavior = new TimeScaleBehaviorContainer ();
|
||||
if (timeScaleBehavior)
|
||||
{
|
||||
timeScaleBehavior->ReadFromStream ( ReadHeader, pStream );
|
||||
haveScaleBehavior = true;
|
||||
haveScaleBehavior = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2709,8 +2674,8 @@ namespace Animations
|
||||
|
||||
if (RT_TimeClientVisualElement == nRecord)
|
||||
{
|
||||
haveClientVisualElement = true;
|
||||
clientVisualElement = new ClientVisualElementContainer ();
|
||||
haveClientVisualElement = true;
|
||||
clientVisualElement = new ClientVisualElementContainer ();
|
||||
clientVisualElement->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
continue;
|
||||
@ -2718,11 +2683,11 @@ namespace Animations
|
||||
|
||||
if ( RT_TimeSlaveContainer == nRecord )
|
||||
{
|
||||
rgSlave = new SlaveContainer ();
|
||||
rgSlave = new SlaveContainer ();
|
||||
if (rgSlave)
|
||||
{
|
||||
rgSlave->ReadFromStream ( ReadHeader, pStream );
|
||||
haveSlaveContainer = true;
|
||||
haveSlaveContainer = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -2730,7 +2695,7 @@ namespace Animations
|
||||
|
||||
if (RT_TimeModifierAtom == nRecord)
|
||||
{
|
||||
TimeModifierAtom* atom = new TimeModifierAtom ();
|
||||
TimeModifierAtom* atom = new TimeModifierAtom ();
|
||||
if (atom)
|
||||
{
|
||||
atom->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -3176,7 +3141,7 @@ namespace Animations
|
||||
SlaveContainer* pSlave = pContainer->rgSlave;
|
||||
if(pSlave->haveSetBehavior) // после анимации к объекту может быть применена дополнительная анимация
|
||||
{
|
||||
m_HaveAfterEffect = true;
|
||||
m_HaveAfterEffect = true;
|
||||
|
||||
// эффект исчезновения элемента (Appear)
|
||||
m_oAfterEffect.m_nDuration = 1.0;
|
||||
@ -3336,7 +3301,7 @@ namespace Animations
|
||||
Effects* pEffects = NULL;
|
||||
if (mSearch == m_oAnimation.end())
|
||||
{
|
||||
pEffects = new Effects ();
|
||||
pEffects = new Effects ();
|
||||
m_oAnimation.insert(std::pair<DWORD,Effects*>( oEffect.m_nRefID, pEffects));
|
||||
}else
|
||||
pEffects = mSearch->second;
|
||||
@ -3594,7 +3559,7 @@ namespace Animations
|
||||
{
|
||||
if (2 == container.clientVisualElement.m_oVisualShapeAtom.m_Type) // указывает на то что анимация применяется к тексту
|
||||
{
|
||||
m_oTopEffect.m_bIgnoreShape = true;
|
||||
m_oTopEffect.m_bIgnoreShape = true;
|
||||
m_oTopEffect.m_nTextSequence = container.clientVisualElement.m_oVisualShapeAtom.m_nData1; // номер параграфа - не нормальзован
|
||||
m_oTopEffect.m_bRemoveEmptyBlocks = true;
|
||||
|
||||
@ -3792,7 +3757,7 @@ public:
|
||||
|
||||
if (Animations::RT_TimeExtTimeNodeContainer == ReadHeader.RecType)
|
||||
{
|
||||
extTimeNodeContainer = new Animations::ExtTimeNodeContainer ();
|
||||
extTimeNodeContainer = new Animations::ExtTimeNodeContainer ();
|
||||
if (extTimeNodeContainer)
|
||||
{
|
||||
extTimeNodeContainer->ReadFromStream ( ReadHeader, pStream );
|
||||
@ -3802,7 +3767,7 @@ public:
|
||||
|
||||
if (Animations::RT_BuildList == ReadHeader.RecType)
|
||||
{
|
||||
buildListContainer = new Animations::BuildListContainer ();
|
||||
buildListContainer = new Animations::BuildListContainer ();
|
||||
if (buildListContainer)
|
||||
{
|
||||
buildListContainer->ReadFromStream ( ReadHeader, pStream );
|
||||
|
||||
@ -144,7 +144,7 @@ public:
|
||||
LONG lWidthClient = m_rcGroupClientAnchor.right - m_rcGroupClientAnchor.left;
|
||||
LONG lHeightClient = m_rcGroupClientAnchor.bottom - m_rcGroupClientAnchor.top;
|
||||
|
||||
bool bIsRecalc = ((lWidthClient > 0) && (lHeightClient > 0) && (lWidthClient > 0) && (lHeightGroup > 0));
|
||||
bool bIsRecalc = ((lWidthClient > 0) && (lHeightClient > 0) && (lWidthGroup > 0) && (lHeightGroup > 0));
|
||||
|
||||
if (bIsRecalc)
|
||||
{
|
||||
|
||||
@ -98,12 +98,12 @@ public:
|
||||
BYTE* pDataUncompress = new BYTE[decompressedSize + 64];
|
||||
if (NSZLib::Decompress(pData, compressedSize, pDataUncompress, decompressedSize))
|
||||
{
|
||||
RELEASEOBJECT(pData);
|
||||
delete []pData;
|
||||
pData = pDataUncompress;
|
||||
}
|
||||
else
|
||||
{
|
||||
RELEASEOBJECT(pData);
|
||||
delete []pData;
|
||||
}
|
||||
}
|
||||
//if (pDecryptor)
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
BYTE* pDataUncompress = new BYTE[decompressedSize];
|
||||
NSZLib::Decompress(pData, compressedSize, pDataUncompress, decompressedSize);
|
||||
|
||||
RELEASEOBJECT(pData);
|
||||
delete []pData;
|
||||
pData = pDataUncompress;
|
||||
}
|
||||
|
||||
|
||||
@ -327,12 +327,12 @@ namespace NSBinPptxRW
|
||||
{
|
||||
//CompObj Stream
|
||||
BYTE dataCompObj[] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0c,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x0c,0x00,0x00,0x00,0x4f,0x4c,0x45,0x20,0x50,0x61,0x63,0x6b,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x50,0x61,0x63,0x6b,0x61,0x67,0x65,0x00,0xf4,0x39,0xb2,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream1(&oStorage, "\001CompObj", true, arraysize(dataCompObj));
|
||||
POLE::Stream oStream1(&oStorage, L"\001CompObj", true, arraysize(dataCompObj));
|
||||
oStream1.write(dataCompObj, arraysize(dataCompObj));
|
||||
oStream1.flush();
|
||||
//ObjInfo Stream
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x0d,0x00};
|
||||
POLE::Stream oStream2(&oStorage, "\003ObjInfo", true, arraysize(dataObjInfo));
|
||||
POLE::Stream oStream2(&oStorage, L"\003ObjInfo", true, arraysize(dataObjInfo));
|
||||
oStream2.write(dataObjInfo, arraysize(dataObjInfo));
|
||||
oStream2.flush();
|
||||
//Ole10Native Stream
|
||||
@ -345,7 +345,7 @@ namespace NSBinPptxRW
|
||||
|
||||
memcpy(head, &nDataSize, sizeof(_UINT32));
|
||||
|
||||
POLE::Stream oStream(&oStorage, "\001Ole10Native", true, arraysize(head) + nDataSize);
|
||||
POLE::Stream oStream(&oStorage, L"\001Ole10Native", true, arraysize(head) + nDataSize);
|
||||
oStream.write(head, arraysize(head));
|
||||
oStream.write(aData, nDataSize);
|
||||
oStream.flush();
|
||||
|
||||
@ -130,6 +130,8 @@ namespace PPTX
|
||||
std::to_wstring((int)(dkoefX * txRect.right)) + L"," +
|
||||
std::to_wstring((int)(dkoefY * txRect.bottom));
|
||||
}
|
||||
if (lpShapeElement)
|
||||
delete lpShapeElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +259,6 @@ namespace PPTX
|
||||
else
|
||||
{
|
||||
olePic.Init(); //старый вариант описания объекта через spid в VmlDrawing
|
||||
olePic->spPr.xfrm;
|
||||
|
||||
Logic::PrstGeom* geom = new Logic::PrstGeom();
|
||||
geom->prst = L"rect";
|
||||
|
||||
@ -511,7 +511,7 @@ namespace PPTX
|
||||
POLE::Storage oStorage(sFilePath.c_str());
|
||||
if(oStorage.open(false, false))
|
||||
{
|
||||
POLE::Stream oStream(&oStorage, "Ole10Native");
|
||||
POLE::Stream oStream(&oStorage, L"Ole10Native");
|
||||
if(oStream.size() > 4)
|
||||
{
|
||||
BYTE head[] = {0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
@ -105,7 +105,7 @@ namespace PPTX
|
||||
|
||||
oValue.m_strValue += XmlUtils::CreateNode(_T("p:by"), oAttr1);
|
||||
}
|
||||
if (fromY.IsInit() || fromY.IsInit())
|
||||
if (fromX.IsInit() || fromY.IsInit())
|
||||
{
|
||||
XmlUtils::CAttribute oAttr1;
|
||||
oAttr1.Write(_T("x"), fromX);
|
||||
|
||||
@ -54,12 +54,12 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
_UINT32 name_size = name.length() + 1;
|
||||
//Ole
|
||||
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream3(storageOut, "\001Ole", true, 20);
|
||||
POLE::Stream oStream3(storageOut, L"\001Ole", true, 20);
|
||||
oStream3.write(dataOleInfo, 20);
|
||||
oStream3.flush();
|
||||
//CompObj
|
||||
BYTE dataCompObjHeader[28] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0a,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
|
||||
POLE::Stream oStream1(storageOut, "\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
POLE::Stream oStream1(storageOut, L"\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
oStream1.write(dataCompObjHeader, 28);
|
||||
|
||||
oStream1.write((BYTE*)&name_size, 4);
|
||||
@ -84,11 +84,11 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
|
||||
//ObjInfo
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x04,0x00};
|
||||
POLE::Stream oStream2(storageOut, "\003ObjInfo", true, 6);
|
||||
POLE::Stream oStream2(storageOut, L"\003ObjInfo", true, 6);
|
||||
oStream2.write(dataObjInfo, 6);
|
||||
oStream2.flush();
|
||||
//Ole10Native
|
||||
POLE::Stream streamData(storageOut, "\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
POLE::Stream streamData(storageOut, L"\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
streamData.write((BYTE*)&ole1Reader.NativeDataSize, 4);
|
||||
streamData.write(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
streamData.flush();
|
||||
|
||||
@ -33,9 +33,6 @@
|
||||
#include "CFRecord.h"
|
||||
#include "CFStream.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -39,39 +39,9 @@
|
||||
#include "../../Common/common.h"
|
||||
#include "../Auxiliary/HelpFunc.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
static std::wstring convertUtf16ToWString(const UTF16 * Data, int nLength)
|
||||
{
|
||||
UTF32 *pStrUtf32 = new UTF32 [nLength + 1];
|
||||
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength + 1));
|
||||
|
||||
// this values will be modificated
|
||||
const UTF16 *pStrUtf16_Conv = Data;
|
||||
UTF32 *pStrUtf32_Conv = pStrUtf32;
|
||||
|
||||
ConversionResult eUnicodeConversionResult =
|
||||
ConvertUTF16toUTF32 (&pStrUtf16_Conv,
|
||||
&Data[nLength]
|
||||
, &pStrUtf32_Conv
|
||||
, &pStrUtf32 [nLength]
|
||||
, strictConversion);
|
||||
|
||||
if (conversionOK != eUnicodeConversionResult)
|
||||
{
|
||||
delete [] pStrUtf32;
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
std::wstring wstr ((wchar_t *) pStrUtf32);
|
||||
|
||||
delete [] pStrUtf32;
|
||||
return wstr;
|
||||
}
|
||||
|
||||
class CFRecord
|
||||
{
|
||||
public:
|
||||
|
||||
@ -97,9 +97,9 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
|
||||
Open(file_path, mode);
|
||||
}
|
||||
|
||||
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot)
|
||||
void CompoundFile::copy_stream(std::wstring streamNameOpen, std::wstring streamNameCreate, POLE::Storage * storageOut, bool bWithRoot)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
|
||||
POLE::Stream *stream = new POLE::Stream(storage_, streamNameOpen);
|
||||
if (!stream) return;
|
||||
|
||||
stream->seek(0);
|
||||
@ -107,15 +107,16 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
|
||||
if (bWithRoot == false)
|
||||
{
|
||||
int pos = streamName.find("/");
|
||||
int pos = streamNameCreate.find(L"/");
|
||||
if (pos >= 0)
|
||||
streamName = streamName.substr(pos + 1);
|
||||
streamNameCreate = streamNameCreate.substr(pos + 1);
|
||||
}
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamNameCreate, true, size_stream);
|
||||
if (!streamNew) return;
|
||||
|
||||
unsigned char* data_stream = new unsigned char[size_stream];
|
||||
unsigned char* data_stream = new unsigned char[size_stream + 64];
|
||||
memset(data_stream, 0, size_stream + 64);
|
||||
if (data_stream)
|
||||
{
|
||||
stream->read(data_stream, size_stream);
|
||||
@ -132,59 +133,61 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot, bool bSortFiles)
|
||||
void CompoundFile::copy( int indent, std::wstring path, POLE::Storage * storageOut, bool bWithRoot, bool bSortFiles)
|
||||
{
|
||||
std::list<std::string> entries, entries_files, entries_dir;
|
||||
entries = storage_->entries( path );
|
||||
std::list<std::wstring> entries, entries_files, entries_dir;
|
||||
|
||||
entries = storage_->entries_with_prefix( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::wstring fullname = path + *it;
|
||||
|
||||
if( storage_->isDirectory( fullname ) )
|
||||
if ((it->at(0) >= 32) && (storage_->isDirectory( fullname ) ))
|
||||
{
|
||||
entries_dir.push_back(name);
|
||||
entries_dir.push_back(*it);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_files.push_front(name);
|
||||
entries_files.push_front(*it);
|
||||
}
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_dir.begin(); it != entries_dir.end(); it++ )
|
||||
for( std::list<std::wstring>::iterator it = entries_dir.begin(); it != entries_dir.end(); it++ )
|
||||
{
|
||||
std::string fullname = path + *it;
|
||||
std::wstring fullname = path + *it;
|
||||
|
||||
copy( indent + 1, fullname + "/", storageOut, bWithRoot, bSortFiles );
|
||||
copy( indent + 1, fullname + L"/", storageOut, bWithRoot, bSortFiles );
|
||||
}
|
||||
if (bSortFiles)
|
||||
{
|
||||
//if (bSortFiles)
|
||||
entries_files.sort();
|
||||
//todooo ??? со спецсимволами выше
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
|
||||
|
||||
for( std::list<std::wstring>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
|
||||
{
|
||||
std::string fullname = path + *it;
|
||||
std::wstring createName = path + *it;
|
||||
std::wstring openName;
|
||||
|
||||
if (it->at(0) < 32) openName = path + it->substr(1);
|
||||
else openName = path + *it;
|
||||
|
||||
copy_stream(fullname, storageOut, bWithRoot);
|
||||
copy_stream(openName, createName, storageOut, bWithRoot);
|
||||
}
|
||||
}
|
||||
CFStreamPtr CompoundFile::getWorkbookStream()
|
||||
{
|
||||
CFStreamPtr stream = getNamedStream("Workbook");
|
||||
CFStreamPtr stream = getNamedStream(L"Workbook");
|
||||
|
||||
if (stream == NULL)
|
||||
stream = getNamedStream("WORKBOOK"); //6447323.xls
|
||||
stream = getNamedStream(L"WORKBOOK"); //6447323.xls
|
||||
if (stream == NULL)
|
||||
stream = getNamedStream("Book");
|
||||
stream = getNamedStream(L"Book");
|
||||
if (stream == NULL)
|
||||
stream = getNamedStream("BOOK");//file(6).xls
|
||||
stream = getNamedStream(L"BOOK");//file(6).xls
|
||||
if (stream == NULL)
|
||||
stream = getNamedStream("book");
|
||||
stream = getNamedStream(L"book");
|
||||
return stream;
|
||||
}
|
||||
|
||||
CFStreamPtr CompoundFile::getNamedStream(const std::string& name)
|
||||
CFStreamPtr CompoundFile::getNamedStream(const std::wstring& name)
|
||||
{
|
||||
if(!streams[name])
|
||||
{
|
||||
@ -195,7 +198,7 @@ CFStreamPtr CompoundFile::getNamedStream(const std::string& name)
|
||||
return streams[name];
|
||||
}
|
||||
|
||||
CFStreamPtr CompoundFile::createNamedStream(const std::string& name)
|
||||
CFStreamPtr CompoundFile::createNamedStream(const std::wstring& name)
|
||||
{
|
||||
if(!streams[name])
|
||||
{
|
||||
@ -207,14 +210,14 @@ CFStreamPtr CompoundFile::createNamedStream(const std::string& name)
|
||||
}
|
||||
|
||||
|
||||
void CompoundFile::closeNamedStream(const std::string& name)
|
||||
void CompoundFile::closeNamedStream(const std::wstring& name)
|
||||
{
|
||||
streams[name].reset();
|
||||
}
|
||||
|
||||
|
||||
// Opens a stream in the storage (shall be called not more than once per stream)
|
||||
POLE::Stream* CompoundFile::openStream(const std::string & stream_name)
|
||||
POLE::Stream* CompoundFile::openStream(const std::wstring & stream_name)
|
||||
{
|
||||
if (storage_ == NULL) return NULL;
|
||||
|
||||
@ -230,7 +233,7 @@ POLE::Stream* CompoundFile::openStream(const std::string & stream_name)
|
||||
|
||||
|
||||
// Creates a new stream in the storage
|
||||
POLE::Stream* CompoundFile::createStream(const std::string & stream_name)
|
||||
POLE::Stream* CompoundFile::createStream(const std::wstring & stream_name)
|
||||
{
|
||||
if (storage_ == NULL) return NULL;
|
||||
|
||||
|
||||
@ -58,22 +58,22 @@ public:
|
||||
|
||||
bool isError();
|
||||
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot = true, bool bSortFiles = false);
|
||||
void copy( int indent, std::wstring path, POLE::Storage * storageOut, bool bWithRoot = true, bool bSortFiles = false);
|
||||
|
||||
CFStreamPtr getWorkbookStream ();
|
||||
CFStreamPtr getNamedStream (const std::string& name);
|
||||
CFStreamPtr getNamedStream (const std::wstring& name);
|
||||
|
||||
POLE::Storage *storage_;
|
||||
private:
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot = true);
|
||||
void copy_stream(std::wstring streamNameOpen, std::wstring streamNameCreate, POLE::Storage * storageOut, bool bWithRoot = true);
|
||||
|
||||
POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
|
||||
POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage
|
||||
POLE::Stream* openStream (const std::wstring & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
|
||||
POLE::Stream* createStream (const std::wstring & stream_name); // Creates a new stream in the storage
|
||||
|
||||
CFStreamPtr createNamedStream (const std::string& name);
|
||||
void closeNamedStream (const std::string& name);
|
||||
CFStreamPtr createNamedStream (const std::wstring& name);
|
||||
void closeNamedStream (const std::wstring& name);
|
||||
|
||||
std::map<std::string, CFStreamPtr> streams;
|
||||
std::map<std::wstring, CFStreamPtr> streams;
|
||||
ReadWriteMode rwMode;
|
||||
};
|
||||
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
|
||||
|
||||
@ -37,21 +37,8 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
//static inline std::wstring <rim(std::wstring &s)
|
||||
//{
|
||||
// s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(isspace))));
|
||||
// return s;
|
||||
//}
|
||||
//
|
||||
//// trim from end
|
||||
//static inline std::wstring &rtrim(std::wstring &s)
|
||||
//{
|
||||
// s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(isspace))).base(), s.end());
|
||||
// return s;
|
||||
//}
|
||||
|
||||
// trim from both ends
|
||||
static inline void/*std::wstring &*/trim(std::wstring &s)
|
||||
static inline void trim(std::wstring &s)
|
||||
{
|
||||
int new_size = s.length();
|
||||
for (int i = new_size - 1; i >=0; i--)
|
||||
@ -61,7 +48,6 @@ static inline void/*std::wstring &*/trim(std::wstring &s)
|
||||
}
|
||||
if (new_size < s.length())
|
||||
s.erase(new_size);
|
||||
//return ltrim(rtrim(s));
|
||||
}
|
||||
|
||||
AutoFilter::AutoFilter()
|
||||
@ -102,11 +88,12 @@ void AutoFilter::readFields(CFRecord& record)
|
||||
unsigned short _wTopN = wTopN;
|
||||
|
||||
if (fTopN != 1)
|
||||
{
|
||||
record >> doper1;
|
||||
if (fTopN != 1)
|
||||
record >> doper2;
|
||||
}
|
||||
|
||||
if ((doper1.vt == BIFF_BYTE(0)) && (doper1.vt == BIFF_BYTE(0)))
|
||||
if ((doper1.vt == BIFF_BYTE(0)) && (doper2.vt == BIFF_BYTE(0)))
|
||||
{
|
||||
m_bAutoFilter12 = true;
|
||||
return;
|
||||
|
||||
@ -53,7 +53,7 @@ public:
|
||||
virtual const CFRecordType::TypeId getTypeId() const = 0; // made virtual to let derived assign their own names (for example, EOF_T)
|
||||
|
||||
static const ElementType type = typeBiffRecord;
|
||||
virtual ElementType get_type() const { return type; }
|
||||
virtual ElementType get_type() { return type; }
|
||||
//-----------------------------
|
||||
virtual void readFollowingContinue(CFStreamCacheReader& reader);
|
||||
virtual const bool storeRecordAndDecideProceeding(CFRecordPtr record); // This function is overridden in BiffRecordSplit
|
||||
|
||||
@ -32,14 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
#include <Logic/Biff_structures/BorderFillInfo.h>
|
||||
#include "../Biff_structures/BiffString.h"
|
||||
#include "../Biff_structures/BorderFillInfo.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Font record in BIFF8
|
||||
class Font: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Font)
|
||||
|
||||
@ -39,12 +39,10 @@ Note::Note()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Note::~Note()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr Note::clone()
|
||||
{
|
||||
return BaseObjectPtr(new Note(*this));
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/NoteSh.h>
|
||||
#include <Logic/Biff_structures/NoteRR.h>
|
||||
#include "../Biff_structures/NoteSh.h"
|
||||
#include "../Biff_structures/NoteRR.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
// Logical representation of Note record in BIFF8
|
||||
class Note: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Note)
|
||||
@ -49,15 +47,12 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeNote;
|
||||
static const ElementType type = typeNote;
|
||||
|
||||
NoteSh note_sh;
|
||||
// NoteRR note_rr;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -89,17 +89,16 @@ public:
|
||||
|
||||
struct _
|
||||
{
|
||||
_() : bFill(false), enabled(false), fill(0), line(0), flag(0), flag2(0) {}
|
||||
bool enabled;
|
||||
bool enabled = false;
|
||||
ODRAW::OfficeArtRecordPtr anchor;
|
||||
std::vector<BaseObjectPtr> additional;
|
||||
bool bFill;
|
||||
bool bFill = false;
|
||||
ShortXLAnsiString name;
|
||||
|
||||
_UINT32 fill;
|
||||
_UINT32 line;
|
||||
_UINT16 flag;
|
||||
_UINT16 flag2;
|
||||
_UINT32 fill = 0;
|
||||
_UINT32 line = 0;
|
||||
_UINT16 flag = 0;
|
||||
_UINT16 flag2 = 0;
|
||||
}old_version;
|
||||
};
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "SheetExt.h"
|
||||
#include <Logic/Biff_structures/FrtHeader.h>
|
||||
#include "../Biff_structures/FrtHeader.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -70,31 +70,5 @@ void SheetExt::readFields(CFRecord& record)
|
||||
}
|
||||
}
|
||||
|
||||
int SheetExt::serialize(std::wostream & stream)
|
||||
{
|
||||
if (!sheetExtOptional.bEnabled) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"sheetPr")
|
||||
{
|
||||
if (!sheetExtOptional.fCondFmtCalc)
|
||||
CP_XML_ATTR(L"enableFormatConditionsCalculation", false);
|
||||
if (!sheetExtOptional.fNotPublished)
|
||||
CP_XML_ATTR(L"published" ,false);
|
||||
|
||||
if (sheetExtOptional.color.xclrType.type == XColorType::XCLRRGB)
|
||||
{
|
||||
CP_XML_NODE(L"tabColor")
|
||||
{
|
||||
CP_XML_ATTR(L"rgb", sheetExtOptional.color.rgb.strARGB);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/SheetExtOptional.h>
|
||||
#include "../Biff_structures/SheetExtOptional.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of SheetExt record in BIFF8
|
||||
class SheetExt: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(SheetExt)
|
||||
@ -48,13 +46,11 @@ public:
|
||||
~SheetExt();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeSheetExt;
|
||||
static const ElementType type = typeSheetExt;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
//-----------------------------
|
||||
_UINT32 cb;
|
||||
unsigned char icvPlain;
|
||||
|
||||
@ -56,11 +56,11 @@ BaseObjectPtr TxO::clone()
|
||||
|
||||
void TxO::readFields(CFRecord& record)
|
||||
{
|
||||
pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
|
||||
unsigned short flags;
|
||||
|
||||
if (pGlobalWorkbookInfoPtr->Version < 0x0600)
|
||||
if (global_info->Version < 0x0600)
|
||||
{
|
||||
short mnLinkSize;
|
||||
short mnButtonFlags;
|
||||
@ -154,6 +154,71 @@ void TxO::readFields(CFRecord& record)
|
||||
fSecretEdit = GETBIT(flags, 15);
|
||||
}
|
||||
|
||||
int TxO::serialize_vml (std::wostream & _stream)
|
||||
{
|
||||
std::wstring str_ = rawText.value();
|
||||
int str_size = str_.size();
|
||||
|
||||
int iFmt = 0;
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (size_t i = 0; i < TxOruns.rgTxoRuns.size(); i++)
|
||||
{
|
||||
Run *run = dynamic_cast<Run*>(TxOruns.rgTxoRuns[i].get());
|
||||
if (run == NULL) continue;
|
||||
|
||||
int end_string = str_size;
|
||||
|
||||
if ( i < TxOruns.rgTxoRuns.size() - 1)
|
||||
{
|
||||
Run *run_next = dynamic_cast<Run*>(TxOruns.rgTxoRuns[i+1].get());
|
||||
if (run_next)
|
||||
end_string = run_next->formatRun.ich;
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"div")
|
||||
{
|
||||
//style='text-align:left'
|
||||
CP_XML_NODE(L"font")
|
||||
{
|
||||
iFmt = run->formatRun.ifnt;
|
||||
Font *font = NULL;
|
||||
if ((global_info->m_arFonts) && (iFmt >=0 && iFmt < global_info->m_arFonts->size()))
|
||||
{
|
||||
font = dynamic_cast<Font *>(global_info->m_arFonts->at(iFmt).get());
|
||||
}
|
||||
if (font)
|
||||
{
|
||||
if (font->dyHeight > 0) CP_XML_ATTR(L"size", font->dyHeight);
|
||||
if (font->bls == 700) CP_XML_ATTR(L"bold", true);
|
||||
if (font->fItalic) CP_XML_ATTR(L"italic", true);
|
||||
if (!font->fontName.value().empty())
|
||||
{
|
||||
CP_XML_ATTR(L"face", font->fontName.value());
|
||||
}
|
||||
if ( font->icv < 0x7fff )
|
||||
{
|
||||
}
|
||||
else CP_XML_ATTR(L"color", L"auto");
|
||||
|
||||
}
|
||||
|
||||
if (run->formatRun.ich > str_.length())
|
||||
{
|
||||
//ошибка
|
||||
run->formatRun.ich = 0;
|
||||
}
|
||||
|
||||
std::wstring str_part = str_.substr( run->formatRun.ich, end_string - run->formatRun.ich);
|
||||
|
||||
CP_XML_STREAM() << xml::utils::replace_text_to_xml(str_part);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TxO::serialize (std::wostream & _stream)
|
||||
{
|
||||
@ -163,7 +228,7 @@ int TxO::serialize (std::wostream & _stream)
|
||||
int Fmt = 0;
|
||||
|
||||
std::wstring namespace_ = L"a:";
|
||||
oox::external_items::Type type = pGlobalWorkbookInfoPtr->xls_converter->xlsx_context->get_drawing_context().getType();
|
||||
oox::external_items::Type type = global_info->xls_converter->xlsx_context->get_drawing_context().getType();
|
||||
|
||||
if (type == oox::external_items::typeComment)
|
||||
namespace_.clear();
|
||||
@ -215,13 +280,13 @@ int TxO::serialize (std::wostream & _stream)
|
||||
}
|
||||
int TxO::serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_)
|
||||
{
|
||||
if (!pGlobalWorkbookInfoPtr) return 0;
|
||||
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
|
||||
if (!global_info) return 0;
|
||||
if (!global_info->m_arFonts) return 0;
|
||||
|
||||
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size();
|
||||
int sz = global_info->m_arFonts->size();
|
||||
if (iFmt - 1 >= sz || iFmt < 1) return 0;
|
||||
|
||||
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get());
|
||||
Font * font = dynamic_cast<Font*>(global_info->m_arFonts->at(iFmt-1).get());
|
||||
|
||||
if (!font) return 0;
|
||||
|
||||
|
||||
@ -32,17 +32,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecordContinued.h"
|
||||
#include <Logic/Biff_structures/ControlInfo.h>
|
||||
#include <Logic/Biff_structures/FontIndex.h>
|
||||
#include <Logic/Biff_structures/ObjFmla.h>
|
||||
#include <Logic/Biff_structures/TxORuns.h>
|
||||
#include <Logic/Biff_records/MsoDrawing.h>
|
||||
#include "MsoDrawing.h"
|
||||
#include "../Biff_structures/ControlInfo.h"
|
||||
#include "../Biff_structures/FontIndex.h"
|
||||
#include "../Biff_structures/ObjFmla.h"
|
||||
#include "../Biff_structures/TxORuns.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of TxO record in BIFF8
|
||||
class TxO: public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(TxO)
|
||||
@ -68,8 +66,9 @@ public:
|
||||
|
||||
int serialize (std::wostream & _stream);
|
||||
int serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_= L"a:");
|
||||
int serialize_vml (std::wostream & _stream);
|
||||
|
||||
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr;
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
|
||||
unsigned char hAlignment;
|
||||
unsigned char vAlignment;
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
bool fWrap;
|
||||
unsigned char alcV;
|
||||
bool fJustLast;
|
||||
unsigned char trot;
|
||||
unsigned short trot;
|
||||
unsigned char cIndent;
|
||||
bool fShrinkToFit;
|
||||
unsigned char iReadOrder;
|
||||
|
||||
@ -68,7 +68,7 @@ void FileMoniker::load(XLS::CFRecord& record)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
unicodePath = std::wstring(record.getCurData<wchar_t>(), cbUnicodePathBytes / 2);
|
||||
#else
|
||||
unicodePath = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), cbUnicodePathBytes / 2);
|
||||
unicodePath = convertUtf16ToWString(record.getCurData<UTF16>(), cbUnicodePathBytes / 2);
|
||||
#endif
|
||||
record.skipNunBytes(cbUnicodePathBytes);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ void ItemMoniker::load(XLS::CFRecord& record)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
delimiterUnicode = std::wstring(record.getCurData<wchar_t>(), sizeof_delimiterUnicode / 2);
|
||||
#else
|
||||
delimiterUnicode = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), sizeof_delimiterUnicode / 2);
|
||||
delimiterUnicode = convertUtf16ToWString(record.getCurData<UTF16>(), sizeof_delimiterUnicode / 2);
|
||||
#endif
|
||||
record.skipNunBytes(sizeof_delimiterUnicode);
|
||||
}
|
||||
@ -80,7 +80,7 @@ void ItemMoniker::load(XLS::CFRecord& record)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
itemUnicode = std::wstring(record.getCurData<wchar_t>(), sizeof_itemUnicode / 2);
|
||||
#else
|
||||
itemUnicode = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), sizeof_itemUnicode / 2);
|
||||
itemUnicode = convertUtf16ToWString(record.getCurData<UTF16>(), sizeof_itemUnicode / 2);
|
||||
#endif
|
||||
record.skipNunBytes(sizeof_itemUnicode);
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
NoteSh::NoteSh()
|
||||
{
|
||||
x_ = y_ = 0;
|
||||
@ -47,14 +46,12 @@ NoteSh::NoteSh()
|
||||
fColHidden = false;
|
||||
}
|
||||
|
||||
|
||||
NoteSh::NoteSh(CFRecord& record)
|
||||
{
|
||||
x_ = y_ = 0;
|
||||
load(record);
|
||||
}
|
||||
|
||||
|
||||
BiffStructurePtr NoteSh::clone()
|
||||
{
|
||||
return BiffStructurePtr(new NoteSh(*this));
|
||||
@ -92,7 +89,7 @@ void NoteSh::load(CFRecord& record)
|
||||
void NoteSh::calculate()
|
||||
{
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >=0 ?
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
ref_ = CellRef(row, col, true, true).toString();
|
||||
|
||||
@ -52,7 +52,6 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
Rw row;
|
||||
Col col;
|
||||
bool fShow;
|
||||
|
||||
@ -80,7 +80,7 @@ void OfficeArtClientAnchorSheet::calculate()
|
||||
global_info->GetDigitFontSizePixels();
|
||||
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >=0 ?
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -92,7 +92,7 @@ void OfficeArtClientAnchorSheet::calculate()
|
||||
|
||||
double Digit_Width = global_info->defaultDigitFontSize.first;
|
||||
double Digit_Height = global_info->defaultDigitFontSize.second;
|
||||
double width = 0 , column_width = 0;
|
||||
double width = 0, column_width = 0;
|
||||
|
||||
if (sheet_info.customColumnsWidth.find(colL) != sheet_info.customColumnsWidth.end())
|
||||
{
|
||||
@ -129,47 +129,68 @@ void OfficeArtClientAnchorSheet::calculate()
|
||||
}
|
||||
else
|
||||
_dyB = dyB * kfRow * sheet_info.defaultRowHeight;
|
||||
}
|
||||
void OfficeArtClientAnchorSheet::calculate_1()
|
||||
{
|
||||
global_info->GetDigitFontSizePixels();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
//for (int i = 0 ; i < colL; i++)
|
||||
//{
|
||||
// if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
|
||||
// _x += 256 * kfCol * sheet_info.customColumnsWidth[i];
|
||||
// else
|
||||
// _x += 256 * kfCol * sheet_info.defaultColumnWidth;
|
||||
//}
|
||||
//_x += _dxL;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
|
||||
double Digit_Width = global_info->defaultDigitFontSize.first;
|
||||
double Digit_Height = global_info->defaultDigitFontSize.second;
|
||||
double column_width = 0;
|
||||
|
||||
//for (int i = colL ; i < colR; i++)
|
||||
//{
|
||||
// if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
|
||||
// _cx += 256 * kfCol * sheet_info.customColumnsWidth[i];
|
||||
// else
|
||||
// _cx += 256 * kfCol * sheet_info.defaultColumnWidth;
|
||||
//}
|
||||
//_cx += _dxR;
|
||||
for (int i = 0 ; i < colL; i++)
|
||||
{
|
||||
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
|
||||
column_width += sheet_info.customColumnsWidth[i];
|
||||
else
|
||||
column_width += sheet_info.defaultColumnWidth;
|
||||
}
|
||||
_x = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
|
||||
_x = (int)(((256. * _x + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
|
||||
|
||||
_x = _x * 9525. + _dxL;
|
||||
|
||||
column_width = 0;
|
||||
for (int i = 0; i < colR; i++)
|
||||
{
|
||||
if (sheet_info.customColumnsWidth.find(i) != sheet_info.customColumnsWidth.end())
|
||||
column_width += sheet_info.customColumnsWidth[i];
|
||||
else
|
||||
column_width += sheet_info.defaultColumnWidth;
|
||||
}
|
||||
_cx = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
|
||||
_cx = (int)(((256. * _cx + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
|
||||
|
||||
_cx += _cx * 9525. + _dxR - _x;
|
||||
|
||||
for (int i = 0 ; i < rwT; i++)
|
||||
{
|
||||
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
|
||||
{
|
||||
_y += 256 * kfRow * sheet_info.customRowsHeight[i];
|
||||
}
|
||||
else
|
||||
_y += 256 * kfRow * sheet_info.defaultRowHeight;
|
||||
}
|
||||
_y += _dyT;
|
||||
|
||||
for (int i = 0 ; i < rwB; i++)
|
||||
{
|
||||
if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
|
||||
{
|
||||
_cy += 256 * kfRow * sheet_info.customRowsHeight[i];
|
||||
}
|
||||
else
|
||||
_cy += 256 * kfRow * sheet_info.defaultRowHeight;
|
||||
}
|
||||
_cy += _dyT - _y;
|
||||
|
||||
//for (int i = 0 ; i < rwT; i++)
|
||||
//{
|
||||
// if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
|
||||
// {
|
||||
// _y += 256 * kfRow * sheet_info.customRowsHeight[i];
|
||||
// }
|
||||
// else
|
||||
// _y += 256 * kfRow * sheet_info.defaultRowHeight;
|
||||
//}
|
||||
//_y += _dyT;
|
||||
|
||||
//for (int i = rwT ; i < rwB; i++)
|
||||
//{
|
||||
// if (sheet_info.customRowsHeight.find(i) != sheet_info.customRowsHeight.end())
|
||||
// {
|
||||
// _cy += 256 * kfRow * sheet_info.customRowsHeight[i];
|
||||
// }
|
||||
// else
|
||||
// _cy += 256 * kfRow * sheet_info.defaultRowHeight;
|
||||
//}
|
||||
//_cy += _dyT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ public:
|
||||
XLS::GlobalWorkbookInfoPtr global_info;
|
||||
|
||||
void calculate();
|
||||
void calculate_1();
|
||||
|
||||
_UINT32 _dxL;
|
||||
_UINT32 _dyT;
|
||||
|
||||
@ -544,7 +544,7 @@ void anyString::ReadComplexData(XLS::CFRecord& record)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
string_ = std::wstring(record.getCurData<wchar_t>(), op);
|
||||
#else
|
||||
string_ = XLS::convertUtf16ToWString(record.getCurData<UTF16>(), op);
|
||||
string_ = convertUtf16ToWString(record.getCurData<UTF16>(), op);
|
||||
#endif
|
||||
if (!string_.empty())
|
||||
{
|
||||
|
||||
@ -36,9 +36,7 @@
|
||||
namespace ODRAW
|
||||
{
|
||||
|
||||
|
||||
OfficeArtFSPGR::OfficeArtFSPGR()
|
||||
: OfficeArtRecord(0x01, FSPGR)
|
||||
OfficeArtFSPGR::OfficeArtFSPGR() : OfficeArtRecord(0x01, FSPGR)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@ namespace XLS
|
||||
class CFRecord;
|
||||
}
|
||||
|
||||
|
||||
namespace ODRAW
|
||||
{
|
||||
|
||||
|
||||
@ -53,7 +53,10 @@ void PictFmlaKey::load(CFRecord& record)
|
||||
{
|
||||
char *buf = new char[cbKey];
|
||||
memcpy(buf, record.getCurData<char>(), cbKey);
|
||||
keyBuf = std::string(buf, cbKey);
|
||||
|
||||
std::string str = std::string(buf, cbKey);
|
||||
keyBuf =std::wstring(str.begin(), str.end());
|
||||
|
||||
record.skipNunBytes(cbKey);
|
||||
delete []buf;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "ObjFmla.h"
|
||||
#include <Logic/Biff_structures/FtPioGrbit.h>
|
||||
#include "FtPioGrbit.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,8 +51,8 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
_UINT32 cbKey;
|
||||
std::string keyBuf; // ActiveX license key
|
||||
_UINT32 cbKey;
|
||||
std::wstring keyBuf; // ActiveX license key
|
||||
|
||||
ObjFmla fmlaLinkedCell;
|
||||
ObjFmla fmlaListFillRange;
|
||||
|
||||
@ -95,7 +95,6 @@ void PtgFuncVar::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool
|
||||
func_name == L"DAYSINMONTH" ||
|
||||
func_name == L"ISLEAPYEAR" ||
|
||||
func_name == L"MONTHS" ||
|
||||
func_name == L"WEEKS" ||
|
||||
func_name == L"WEEKSINYEAR" ||
|
||||
func_name == L"YEARS")
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ void RC4EncryptionHeader::load(XLS::CFRecord& record)
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.saltValue = std::string((char*)pDataRead, crypt_data_aes.saltSize);
|
||||
delete pDataRead;
|
||||
delete []pDataRead;
|
||||
}
|
||||
|
||||
pDataRead = new unsigned char[0x10];
|
||||
@ -119,7 +119,7 @@ void RC4EncryptionHeader::load(XLS::CFRecord& record)
|
||||
if (pDataRead)
|
||||
{
|
||||
crypt_data_aes.encryptedVerifierValue = std::string((char*)pDataRead, szEncryptedVerifierHash);
|
||||
delete pDataRead;
|
||||
delete []pDataRead;
|
||||
}
|
||||
|
||||
pos = record.getRdPtr();
|
||||
|
||||
@ -32,8 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include <Logic/Biff_structures/CFColor.h>
|
||||
//#include <Logic/Biff_structures/BiffString.h>
|
||||
#include "CFColor.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -67,7 +67,7 @@ public:
|
||||
bool fWrap;
|
||||
unsigned char alcV;
|
||||
bool fJustLast;
|
||||
unsigned char trot;
|
||||
unsigned short trot;
|
||||
unsigned char cIndent;
|
||||
bool fShrinkToFit;
|
||||
unsigned char iReadOrder;
|
||||
|
||||
@ -145,7 +145,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
|
||||
if (it == pGlobalWorkbookInfoPtr->mapDefineNames.end()) return 0;
|
||||
|
||||
int count_columns = info->cEntries;
|
||||
int ind = pGlobalWorkbookInfoPtr->current_sheet;
|
||||
size_t ind = pGlobalWorkbookInfoPtr->current_sheet;
|
||||
std::wstring ref;
|
||||
|
||||
if (ind < it->second.size() && ind >= 0)
|
||||
|
||||
@ -127,7 +127,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
|
||||
CFEx * cfEx = dynamic_cast<CFEx *>(m_arCFEx[i].get());
|
||||
if (cfEx)
|
||||
{
|
||||
int ind_cf = cfEx->content.icf;
|
||||
size_t ind_cf = cfEx->content.icf;
|
||||
|
||||
for (size_t j = 0 ; j < m_arCONDFMT.size(); j++)
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ int DBB::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"r")
|
||||
{
|
||||
int indexOPER = 0;
|
||||
size_t indexOPER = 0;
|
||||
size_t posBlob = 0;
|
||||
|
||||
for (size_t i = 0; i < arPivotCacheFields.size(); i++)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user