Compare commits

..

1 Commits

Author SHA1 Message Date
94548131a1 v5.1.5 2018-07-17 17:08:49 +03:00
1580 changed files with 64386 additions and 105856 deletions

View File

@ -641,12 +641,14 @@ namespace DocFileFormat
else
{
std::string sCodePage;
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
for (int i = 0; i < UNICODE_CONVERTER_ENCODINGS_COUNT; ++i)
{
sCodePage = pFind->second;
if (code_page == NSUnicodeConverter::Encodings[i].WindowsCodePage)
{
sCodePage = NSUnicodeConverter::Encodings[i].Name;
break;
}
}
if (sCodePage.empty())
sCodePage = "CP1250"/* + std::to_string(code_page)*/;

View File

@ -41,7 +41,7 @@ namespace DocFileFormat
public:
AnnotationOwnerList(FileInformationBlock* fib, POLE::Stream* tableStream) : std::vector<std::wstring>()
{
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_nWordVersion);
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners, fib->m_bOlderVersion);
if (fib->m_FibWord97.fcGrpXstAtnOwners > reader.GetSize()) return;

View File

@ -40,7 +40,7 @@ namespace DocFileFormat
//read the user initials (LPXCharBuffer9)
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{
short cch = reader->ReadByte();

View File

@ -41,9 +41,9 @@ namespace DocFileFormat
static const int STRUCTURE_SIZE = 30;
static const int STRUCTURE_SIZE_OLD = 20;
static const int GetSize(int nWordVersion)
static const int GetSize(bool bOldVersion)
{
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
return bOldVersion ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
inline std::wstring GetUserInitials() const

View File

@ -118,78 +118,70 @@ namespace DocFileFormat
public:
/// Creates a new BorderCode with default values
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
BorderCode(): cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
}
/// Parses the unsigned char for a BRC
BorderCode( unsigned char* bytes, int size ):
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorNameIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
cv(0), dptLineWidth(0), brcType(0), ico( Global::ColorIdentifier[0] ), dptSpace(0), fShadow(false), fFrame(false), fNil(false)
{
if ( FormatUtils::ArraySum( bytes, size ) == ( size * 255 ) )
{
fNil = true;
this->fNil = true;
}
else if ( size == 8 )
{
//it's a border code of Word 2000/2003
cv = FormatUtils::BytesToInt32( bytes, 0, size );
ico = std::wstring( Global::ColorIdentifier[0] );
this->cv = FormatUtils::BytesToInt32( bytes, 0, size );
this->ico = std::wstring( Global::ColorIdentifier[0] );
dptLineWidth = bytes[4];
brcType = bytes[5];
this->dptLineWidth = bytes[4];
this->brcType = bytes[5];
short val = FormatUtils::BytesToInt16( bytes, 6, size );
dptSpace = val & 0x001F;
this->dptSpace = val & 0x001F;
//not sure if this is correct, the values from the spec are definitly wrong:
fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
this->fShadow = FormatUtils::BitmaskToBool( val, 0x20 );
this->fFrame = FormatUtils::BitmaskToBool( val, 0x40 );
}
else if ( size == 4 )
{
//it's a border code of Word 97
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
dptLineWidth = (unsigned char)( val & 0x00FF );
brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
this->dptLineWidth = (unsigned char)( val & 0x00FF );
this->brcType = (unsigned char)( ( val & 0xFF00 ) >> 8 );
val = FormatUtils::BytesToUInt16( bytes, 2, size );
ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorNameIdentifier[0][0], 17, 12 );
dptSpace = ( val & 0x1F00 ) >> 8;
this->ico = FormatUtils::MapValueToWideString( ( val & 0x00FF ), &Global::ColorIdentifier[0][0], 17, 12 );
this->dptSpace = ( val & 0x1F00 ) >> 8;
}
else if (size == 2)
else
{
unsigned short val = FormatUtils::BytesToUInt16( bytes, 0, size );
dptLineWidth = GETBITS(val, 0, 2);
brcType = GETBITS(val, 3, 4);
fShadow = GETBIT(val, 5);
ico = FormatUtils::MapValueToWideString(GETBITS(val, 6, 10), &Global::ColorNameIdentifier[0][0], 17, 12 );
dptSpace = GETBITS(val, 11, 15);
//throw new ByteParseException("Cannot parse the struct BRC, the length of the struct doesn't match");
}
}
BorderCode( const BorderCode& bc )
{
if ( this != &bc )
{
cv = bc.cv;
dptLineWidth = bc.dptLineWidth;
brcType = bc.brcType;
ico = bc.ico;
dptSpace = bc.dptSpace;
fShadow = bc.fShadow;
fFrame = bc.fFrame;
fNil = bc.fNil;
this->cv = bc.cv;
this->dptLineWidth = bc.dptLineWidth;
this->brcType = bc.brcType;
this->ico = bc.ico;
this->dptSpace = bc.dptSpace;
this->fShadow = bc.fShadow;
this->fFrame = bc.fFrame;
this->fNil = bc.fNil;
}
}
bool operator == ( const BorderCode& bc )
{
if ( ( cv == bc.cv ) && ( dptLineWidth == bc.dptLineWidth ) && ( brcType == bc.brcType ) &&
( ico == bc.ico ) && ( dptSpace == bc.dptSpace ) && ( fShadow == bc.fShadow ) &&
( fFrame == bc.fFrame ) && ( fNil == bc.fNil ) )
if ( ( this->cv == bc.cv ) && ( this->dptLineWidth == bc.dptLineWidth ) && ( this->brcType == bc.brcType ) &&
( this->ico == bc.ico ) && ( this->dptSpace == bc.dptSpace ) && ( this->fShadow == bc.fShadow ) &&
( this->fFrame == bc.fFrame ) && ( this->fNil == bc.fNil ) )
{
return true;
}

View File

@ -129,360 +129,357 @@ namespace DocFileFormat
parent->AppendChild( *webHidden );
RELEASEOBJECT( webHidden );
}
if ((sprms) && (!sprms->empty()))
std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
{
std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
int nProperty = 0; //for unknown test
switch ( (int)( iter->OpCode ) )
{
int nProperty = 0; //for unknown test
switch ( (int)( iter->OpCode ) )
case sprmOldCIstd :
case sprmCIstd : // style id
{
case sprmOldCIstd :
case sprmCIstd : // style id
if (_isRunStyleNeeded && !_webHidden)
{
if (_isRunStyleNeeded && !_webHidden)
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < _doc->Styles->Styles->size())
{
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < _doc->Styles->Styles->size())
{
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
}
}
}break;
case sprmCFBiDi :
appendFlagElement( parent, *iter, L"rtl", true );
_isRTL = true;
break;
case sprmOldCFBold :
case sprmCFBold :
appendFlagElement( parent, *iter, L"b", true );
break;
case sprmCFBoldBi :
appendFlagElement( parent, *iter, L"bCs", true );
break;
case sprmOldCFCaps :
case sprmCFCaps :
appendFlagElement( parent, *iter, L"caps", true );
break;
case sprmCFComplexScripts :
appendFlagElement( parent, *iter, L"cs", true );
break;
case sprmCFDStrike :
appendFlagElement( parent, *iter, L"dstrike", true );
break;
case sprmCFEmboss :
appendFlagElement( parent, *iter, L"emboss", true );
break;
case sprmCFImprint :
appendFlagElement( parent, *iter, L"imprint", true );
break;
case sprmOldCFItalic :
case sprmCFItalic :
appendFlagElement( parent, *iter, L"i", true );
break;
case sprmCFItalicBi:
appendFlagElement( parent, *iter, L"iCs", true );
break;
case 0x0875:
appendFlagElement( parent, *iter, L"noProof", true );
break;
case sprmOldCFOutline:
case sprmCFOutline:
appendFlagElement( parent, *iter, L"outline", true );
break;
case sprmOldCFShadow:
case sprmCFShadow:
appendFlagElement( parent, *iter, L"shadow", true );
break;
case sprmOldCFSmallCaps:
case sprmCFSmallCaps:
appendFlagElement( parent, *iter, L"smallCaps", true );
break;
case sprmCFSpecVanish:
appendFlagElement( parent, *iter, L"specVanish", true );
break;
case sprmOldCFStrike:
case sprmCFStrike:
appendFlagElement( parent, *iter, L"strike", true );
break;
case sprmOldCFVanish:
case sprmCFVanish:
appendFlagElement( parent, *iter, L"vanish", true );
break;
case 0x0811:
appendFlagElement( parent, *iter, L"webHidden", true );
break;
case sprmOldCIss:
case sprmCIss:
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:
case sprmCRgLid0:
{ //latin
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmOldCLid:
case sprmCRgLid1_80:
case sprmCRgLid1:
{ //east asia
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCLidBi:
{
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCBrc80:
case sprmCBrc:
{ //borders
XMLTools::XMLElement bdr( L"w:bdr" );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bdr );
parent->AppendChild( bdr );
}break;
case sprmCShd80:
case sprmCShd:
{ //shading
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( parent, desc );
}break;
case sprmOldCIco:
case sprmCIco:
case sprmCIcoBi:
{//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
}break;
case sprmCCv:
{
std::wstringstream sstream;
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
colorVal->SetValue(sstream.str());
}break;
case sprmCOldHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
}break;
case sprmCHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorNameIdentifier[0][0], 17, 12 ), true );
}break;
case sprmOldCDxaSpace:
case sprmCDxaSpace:
{
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCFtcBi :
{//default from FontTable
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 ) );
if (ffn)
m_sDefaultFont = ffn->xszFtn;
}
}break;
case sprmCHpsBi :
{
appendValueElement( parent, L"szCs",
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}
break;
// Font Size in points (2~3276) default 20-half-points
case sprmOldCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
true );
}break;
case sprmCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
}break;
case sprmCMajority :
{ //for complex props
}break;
case sprmOldCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmOldCHpsKern:
case sprmCHpsKern:
{
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii );
}
}break;
case sprmCRgFtc1:
{
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" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia );
appendValueElement( parent, L"rStyle", StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
}
}
break;
}break;
case sprmCRgFtc2:
case sprmCFBiDi :
appendFlagElement( parent, *iter, L"rtl", true );
_isRTL = true;
break;
case sprmOldCFBold :
case sprmCFBold :
appendFlagElement( parent, *iter, L"b", true );
break;
case sprmCFBoldBi :
appendFlagElement( parent, *iter, L"bCs", true );
break;
case sprmOldCFCaps :
case sprmCFCaps :
appendFlagElement( parent, *iter, L"caps", true );
break;
case sprmCFComplexScripts :
appendFlagElement( parent, *iter, L"cs", true );
break;
case sprmCFDStrike :
appendFlagElement( parent, *iter, L"dstrike", true );
break;
case sprmCFEmboss :
appendFlagElement( parent, *iter, L"emboss", true );
break;
case sprmCFImprint :
appendFlagElement( parent, *iter, L"imprint", true );
break;
case sprmOldCFItalic :
case sprmCFItalic :
appendFlagElement( parent, *iter, L"i", true );
break;
case sprmCFItalicBi:
appendFlagElement( parent, *iter, L"iCs", true );
break;
case 0x0875:
appendFlagElement( parent, *iter, L"noProof", true );
break;
case sprmOldCFOutline:
case sprmCFOutline:
appendFlagElement( parent, *iter, L"outline", true );
break;
case sprmOldCFShadow:
case sprmCFShadow:
appendFlagElement( parent, *iter, L"shadow", true );
break;
case sprmOldCFSmallCaps:
case sprmCFSmallCaps:
appendFlagElement( parent, *iter, L"smallCaps", true );
break;
case sprmCFSpecVanish:
appendFlagElement( parent, *iter, L"specVanish", true );
break;
case sprmOldCFStrike:
case sprmCFStrike:
appendFlagElement( parent, *iter, L"strike", true );
break;
case sprmOldCFVanish:
case sprmCFVanish:
appendFlagElement( parent, *iter, L"vanish", true );
break;
case 0x0811:
appendFlagElement( parent, *iter, L"webHidden", true );
break;
case sprmOldCIss:
case sprmCIss:
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:
case sprmCRgLid0:
{ //latin
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmOldCLid:
case sprmCRgLid1_80:
case sprmCRgLid1:
{ //east asia
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCLidBi:
{
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Complex );
langid.Convert( langIDMapping );
RELEASEOBJECT( langIDMapping );
}break;
case sprmCBrc80:
case sprmCBrc:
{ //borders
XMLTools::XMLElement bdr( L"w:bdr" );
BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bdr );
parent->AppendChild( bdr );
}break;
case sprmCShd80:
case sprmCShd:
{ //shading
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( parent, desc );
}break;
case sprmOldCIco:
case sprmCIco:
case sprmCIcoBi:
{//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
}break;
case sprmCCv:
{
std::wstringstream sstream;
sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2];
colorVal->SetValue(sstream.str());
}break;
case sprmCOldHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break;
case sprmCHighlight:
{
appendValueElement( parent, L"highlight", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break;
case sprmOldCDxaSpace:
case sprmCDxaSpace:
{
appendValueElement( parent, L"spacing", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCFtcBi :
{//default from FontTable
size_t nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
if( nIndex < _doc->FontTable->Data.size() )
{
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" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi );
}
}break;
case sprmOldCKul:
case sprmCKul:
{ //Underlining
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
if (ffn)
m_sDefaultFont = ffn->xszFtn;
}
break;
}break;
case sprmCCharScale:
{ //char width
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCSfxText:
{ //animation
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
}break;
case sprmCIdctHint:
{
switch(iter->Arguments[0])
{
case 0: break; // default
case 1: break; // eastAsia
case 2: break; // cs
case 0xFF: break; //No ST_Hint equivalent
}
}break;
case sprmCPbiIBullet:
{
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
if (nIndex >=0)
{
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
if (it != _doc->PictureBulletsCPsMap.end())
{
//добавить
}
}
}break;
case sprmCPbiGrf:
{
//used picture bullet
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}break;
case sprmCRsidProp:
case sprmCRsidText:
break;
default:
if (iter->argumentsSize == 2)
{
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
}
break;
case sprmCHpsBi :
{
appendValueElement( parent, L"szCs",
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}
break;
// Font Size in points (2~3276) default 20-half-points
case sprmOldCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
true );
}break;
case sprmCHps :
{
appendValueElement (parent, L"sz",
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
}break;
case sprmCMajority :
{ //for complex props
}break;
case sprmOldCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, L"position", nVertPos, true);
}break;
case sprmOldCHpsKern:
case sprmCHpsKern:
{
appendValueElement( parent, L"kern", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
size_t nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() )
{
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( L"w:ascii" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii );
}
}break;
case sprmCRgFtc1:
{
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" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia );
}
}
break;
case sprmCRgFtc2:
{
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" );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi );
}
}break;
case sprmOldCKul:
case sprmCKul:
{ //Underlining
appendValueElement( parent, L"u", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
}
break;
case sprmCCharScale:
{ //char width
appendValueElement( parent, L"w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break;
case sprmCSfxText:
{ //animation
appendValueElement( parent, L"effect", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
}break;
case sprmCIdctHint:
{
switch(iter->Arguments[0])
{
case 0: break; // default
case 1: break; // eastAsia
case 2: break; // cs
case 0xFF: break; //No ST_Hint equivalent
}
}break;
case sprmCPbiIBullet:
{
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
if (nIndex >=0)
{
std::map<int, int>::iterator it = _doc->PictureBulletsCPsMap.find(nIndex);
if (it != _doc->PictureBulletsCPsMap.end())
{
//добавить
}
}
}break;
case sprmCPbiGrf:
{
//used picture bullet
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}break;
case sprmCRsidProp:
case sprmCRsidText:
break;
default:
if (iter->argumentsSize == 2)
{
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
}
break;
}
}

View File

@ -35,188 +35,19 @@
namespace DocFileFormat
{
class CharacterPropertyExceptions: public PropertyExceptions
{
public:
/// Creates a CHPX wich doesn't modify anything.
/// The grpprl list is empty
CharacterPropertyExceptions(): PropertyExceptions()
{
}
class CharacterPropertyExceptions: public PropertyExceptions
{
public:
/// Creates a CHPX wich doesn't modify anything.
/// The grpprl list is empty
CharacterPropertyExceptions(): PropertyExceptions()
{
}
/// Parses the bytes to retrieve a CHPX
CharacterPropertyExceptions( unsigned char* bytes, int size, int nWordVersion) :
PropertyExceptions( bytes, size, nWordVersion )
{
if (nWordVersion > 1)
{
RELEASEOBJECT( grpprl );
grpprl = new std::list<SinglePropertyModifier>();
MemoryStream oStream(bytes, size);
int pos = 0;
if (nWordVersion == 3)
{
if (pos + 2 > size) return;
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
unsigned char val;
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
bool fsIco = GETBIT(fChar, 10);
bool fsFtc = GETBIT(fChar, 11);
bool fsHps = GETBIT(fChar, 12);
bool fsKul = GETBIT(fChar, 13);
bool fsPos = GETBIT(fChar, 14);
bool fsSpace = GETBIT(fChar, 15);
if (pos + 2 > size) return;
int fff = oStream.ReadUInt16(); pos += 2;//?????
if (pos + 2 > size) return;
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
if (pos + 1 > size) return;
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
if (hps > 0)
{
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
}
if (pos + 1 > size) return;
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
if (pos + 2 > size) return;
unsigned short fText = oStream.ReadUInt16(); pos += 2;
unsigned short qpsSpace = GETBITS(fText, 0, 5);
unsigned char wSpare2 = GETBITS(fText, 6, 7);
unsigned char ico = GETBITS(fText, 8, 11);
unsigned char kul = GETBITS(fText, 12, 14);
bool fSysVanish = GETBIT(fChar, 15);
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
//sizeof(CHP) == 12 == 0xC
if (pos + 4 > size) return;
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
if (pos + 1 > size) return;
unsigned char fnPic = oStream.ReadByte(); pos += 1;
if (pos + 2 > size) return;
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
}
else if (nWordVersion == 2)
{
if (pos + 2 > size) return;
unsigned short fChar = oStream.ReadUInt16(); pos += 2;
unsigned char val;
val = GETBIT(fChar, 0); grpprl->push_back(SinglePropertyModifier(sprmOldCFBold, 1, &val));
val = GETBIT(fChar, 1); grpprl->push_back(SinglePropertyModifier(sprmOldCFItalic, 1, &val));
val = GETBIT(fChar, 2); grpprl->push_back(SinglePropertyModifier(sprmOldCIbstRMark, 1, &val));
val = GETBIT(fChar, 3); grpprl->push_back(SinglePropertyModifier(sprmOldCFOutline, 1, &val));
val = GETBIT(fChar, 4); grpprl->push_back(SinglePropertyModifier(sprmOldCFFldVanish, 1, &val));
val = GETBIT(fChar, 5); grpprl->push_back(SinglePropertyModifier(sprmOldCFSmallCaps, 1, &val));
val = GETBIT(fChar, 6); grpprl->push_back(SinglePropertyModifier(sprmOldCFCaps, 1, &val));
val = GETBIT(fChar, 7); grpprl->push_back(SinglePropertyModifier(sprmOldCFVanish, 1, &val));
val = GETBIT(fChar, 8); grpprl->push_back(SinglePropertyModifier(sprmOldCFRMark, 1, &val));
val = GETBIT(fChar, 9); grpprl->push_back(SinglePropertyModifier(sprmOldCFSpec, 1, &val));
val = GETBIT(fChar, 10); grpprl->push_back(SinglePropertyModifier(sprmOldCFStrike, 1, &val));
val = GETBIT(fChar, 11); grpprl->push_back(SinglePropertyModifier(sprmOldCFObj, 1, &val));
val = GETBIT(fChar, 12); grpprl->push_back(SinglePropertyModifier(sprmCFBoldBi, 1, &val));
val = GETBIT(fChar, 13); grpprl->push_back(SinglePropertyModifier(sprmCFItalicBi, 1, &val));
val = GETBIT(fChar, 14); grpprl->push_back(SinglePropertyModifier(sprmCFBiDi, 1, &val));
val = GETBIT(fChar, 15); grpprl->push_back(SinglePropertyModifier(sprmCFDiacColor, 1, &val));
if (pos + 2 > size) return;
unsigned short fChar2 = oStream.ReadUInt16(); pos += 2;
bool fsIco = GETBIT(fChar2, 0);
bool fsFtc = GETBIT(fChar2, 1);
bool fsHps = GETBIT(fChar2, 2);
bool fsKul = GETBIT(fChar2, 3);
bool fsPos = GETBIT(fChar2, 4);
bool fsSpace = GETBIT(fChar2, 5);
bool fsLid = GETBIT(fChar2, 6);
bool fsIcoBi = GETBIT(fChar2, 7);
bool fsFtcBi = GETBIT(fChar2, 8);
bool fsHpsBi = GETBIT(fChar2, 9);
bool fsLidBi = GETBIT(fChar2, 10);
if (pos + 2 > size) return;
unsigned short ftc = oStream.ReadUInt16(); pos += 2; // Font Code
grpprl->push_back(SinglePropertyModifier(sprmOldCFtc, 2, (unsigned char*)&ftc));
if (pos + 1 > size) return;
unsigned char hps = oStream.ReadByte(); pos += 1; // Font size in half points
if (hps > 0)
{
grpprl->push_back(SinglePropertyModifier(sprmOldCHps, 1, &hps));
}
if (pos + 1 > size) return;
unsigned char hpsPos = oStream.ReadByte(); pos += 1; // Sub/Superscript ( signed number, 0 = normal )
grpprl->push_back(SinglePropertyModifier(sprmOldCHpsPos, 1, &hpsPos));
if (pos + 2 > size) return;
unsigned short fText = oStream.ReadUInt16(); pos += 2;
unsigned short qpsSpace = GETBITS(fText, 0, 5);
unsigned char wSpare2 = GETBITS(fText, 6, 7);
unsigned char ico = GETBITS(fText, 8, 11);
unsigned char kul = GETBITS(fText, 12, 14);
bool fSysVanish = GETBIT(fChar, 15);
grpprl->push_back(SinglePropertyModifier(sprmOldCKul, 1, &kul));
grpprl->push_back(SinglePropertyModifier(sprmOldCIco, 1, &ico));
//if (pos + 1 > size) return;
//unsigned char icoBi = oStream.ReadUInt16(); pos += 1;//wSpare3
if (pos + 2 > size) return;
unsigned short lid = oStream.ReadUInt16(); pos += 2;
grpprl->push_back(SinglePropertyModifier(sprmOldCLid, 2, (BYTE*)&lid));
if (pos + 2 > size) return;
unsigned short ftcBi = oStream.ReadUInt16(); pos += 2;
grpprl->push_back(SinglePropertyModifier(sprmCFtcBi, 4, (BYTE*)&ftcBi));
//if (pos + 2 > size) return;
//unsigned short hpsBi = oStream.ReadUInt16(); pos += 2;
//grpprl->push_back(SinglePropertyModifier(sprmCHpsBi, 4, (BYTE*)&hpsBi));
//if (pos + 2 > size) return;
//unsigned short lidBi = oStream.ReadUInt16(); pos += 2;
//grpprl->push_back(SinglePropertyModifier(sprmCLidBi, 2, (BYTE*)&lidBi));
if (pos + 4 > size) return;
unsigned int fcPic = oStream.ReadUInt16(); pos += 4; //pos = 8
grpprl->push_back(SinglePropertyModifier(sprmOldCPicLocation, 4, (BYTE*)&fcPic));
if (pos + 1 > size) return;
unsigned char fnPic = oStream.ReadByte(); pos += 1;
if (pos + 2 > size) return;
unsigned short hpsLargeChp = oStream.ReadUInt16(); pos += 2;// ??? type
}
}
}
};
/// Parses the bytes to retrieve a CHPX
CharacterPropertyExceptions( unsigned char* bytes, int size, bool oldVersion) :
PropertyExceptions( bytes, size, oldVersion )
{
}
};
}

View File

@ -99,7 +99,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx(fc);
TableInfo tai(papx, m_document->nWordVersion);
TableInfo tai(papx);
if ( tai.fInTable )
{
@ -111,7 +111,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph(cp, 0x7fffffff);
cp = writeParagraph(cp);
}
}

View File

@ -59,30 +59,29 @@ namespace DocFileFormat
short wdy;
public:
DateAndTime()
{
setDefaultValues();
}
DateAndTime( unsigned int val )
{
DateAndTime((unsigned char*)&val, 4);
}
DateAndTime( unsigned char* bytes, int size )
{
if ( size == 4 )
{
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
}
else
{
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
/// Creates a new DateAndTime with default values
DateAndTime()
{
setDefaultValues();
}
/// Parses the unsigned char sto retrieve a DateAndTime
DateAndTime( unsigned char* bytes, int size )
{
if ( size == 4 )
{
this->mint = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 0, 6 );
this->hr = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 6, 5 );
this->dom = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 11, 5 );
this->mon = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 16, 4 );
this->yr = (short)( 1900 + FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 20, 9 ) );
this->wdy = (short)FormatUtils::GetIntFromBits( FormatUtils::BytesToInt32( bytes, 0, size ), 29, 3 );
}
else
{
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
#if defined(_WIN32) || defined(_WIN64)
SYSTEMTIME ToSYSTEMTIME()
{

View File

@ -89,11 +89,6 @@ namespace DocFileFormat
//if cp is the last char of a section, the next section will start at cp +1
size_t current = 0;
if (m_document->SectionPlex->CharacterPositions.empty())
{
return cp;
}
for (std::vector<int>::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter)
{
if (cp < *iter)
@ -145,7 +140,7 @@ namespace DocFileFormat
// Writes a Paragraph that starts at the given cp and
// ends at the next paragraph end mark or section end mark
int DocumentMapping::writeParagraph(int cp, int cpEnd)
int DocumentMapping::writeParagraph(int cp)
{
//search the paragraph end
int cpParaEnd = cp;
@ -175,7 +170,7 @@ namespace DocFileFormat
{
cpParaEnd++;
return writeParagraph(cp, (std::min)(cpEnd, cpParaEnd), false);
return writeParagraph(cp, cpParaEnd, false);
}
}
@ -191,8 +186,8 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos(cp);
int fcEnd = m_document->FindFileCharPos(cpEnd);
if (fc < 0 || fcEnd < 0 || fc == fcEnd)
return -1;
if (fc < 0 || fcEnd < 0)
return 0;
ParagraphPropertyExceptions* papx = findValidPapx(fc);
@ -538,7 +533,8 @@ namespace DocFileFormat
}
else if (TextMark::PageBreakOrSectionMark == code)
{
if (_isSectionPageBreak == 0)
//write page break, section breaks are written by writeParagraph() method
if (/*!isSectionEnd(c)*/_isSectionPageBreak == 0)
{
writeTextElement(text, textType);
@ -575,21 +571,20 @@ namespace DocFileFormat
std::vector<std::wstring> arField;
boost::algorithm::split(arField, sFieldString, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
std::wstring EMBED ( L"EMBED" );
std::wstring embed ( L"embed" );
std::wstring LINK ( L"LINK" );
std::wstring FORM ( L"FORM" );
std::wstring Excel ( L"Excel" );
std::wstring Word ( L"Word" );
std::wstring opendocument(L"opendocument" );
std::wstring Equation ( L"Equation" );
std::wstring MERGEFORMAT( L"MERGEFORMAT" );
std::wstring QUOTE ( L"QUOTE" );
std::wstring EMBED ( L" EMBED" );
std::wstring LINK ( L" LINK" );
std::wstring FORM ( L" FORM" );
std::wstring Excel ( L" Excel" );
std::wstring Word ( L" Word" );
std::wstring opendocument(L" opendocument" );
std::wstring Equation ( L" Equation" );
std::wstring MERGEFORMAT( L" MERGEFORMAT" );
std::wstring QUOTE ( L" QUOTE" );
std::wstring chart ( L"Chart" );
std::wstring PBrush ( L"PBrush" );
std::wstring TOC ( L"TOC" );
std::wstring HYPERLINK ( L"HYPERLINK" );
std::wstring PAGEREF ( L"PAGEREF" );
std::wstring PBrush ( L" PBrush" );
std::wstring TOC ( L" TOC" );
std::wstring HYPERLINK ( L" HYPERLINK" );
std::wstring PAGEREF ( L" PAGEREF" );
std::wstring PAGE ( L"PAGE" );
if (arField.empty() == false)
@ -598,8 +593,7 @@ namespace DocFileFormat
f = sFieldString;
bool bChart = search( f.begin(), f.end(), chart.begin(), chart.end()) != f.end();
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end() ||
search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end();
bool bEMBED = search( f.begin(), f.end(), EMBED.begin(), EMBED.end()) != f.end();
bool bLINK = search( f.begin(), f.end(), LINK.begin(), LINK.end()) != f.end();
bool bOpendocument = search( f.begin(), f.end(), opendocument.begin(), opendocument.end()) != f.end();
bool bFORM = search( f.begin(), f.end(), FORM.begin(), FORM.end()) != f.end();
@ -693,6 +687,13 @@ namespace DocFileFormat
}
else
{
//while ( cpFieldSep2 < cpFieldEnd)
//{
// cpFieldSep2 = searchNextTextMark(m_document->Text, cpFieldSep1 + 1, TextMark::FieldSeparator);
// std::wstring f1( ( m_document->Text->begin() + cpFieldSep1 ), ( m_document->Text->begin() + cpFieldSep2 + 1 ) );
// toc.push_back(f1);
//
// if (search( f1.begin(), f1.end(), PAGEREF.begin(), PAGEREF.end()) != f1.end())
for (size_t i = 1; i < arField.size(); i++)
{
std::wstring f1 = arField[1];
@ -766,9 +767,9 @@ namespace DocFileFormat
if (!m_shapeIdOwner.empty()) //4571833.doc
oVmlMapper.m_shapeId = m_shapeIdOwner;
if (m_document->nWordVersion > 0)
{
OleObject ole ( chpxObj, m_document);
if (m_document->bOlderVersion)
{
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
oleWriter.WriteNodeBegin (L"w:object", true);
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
@ -784,7 +785,7 @@ namespace DocFileFormat
}
else
{
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
oleWriter.WriteNodeBegin (L"w:object", true);
oleWriter.WriteAttribute( L"w:dxaOrig", FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
@ -802,7 +803,7 @@ namespace DocFileFormat
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
CharacterPropertyExceptions* chpxSep = chpxs->front();
OleObject ole ( chpxSep, m_document);
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
if (oVmlMapper.m_isEmbedded)
@ -913,7 +914,7 @@ namespace DocFileFormat
if (pSpa)
{
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->nWordVersion);
PictureDescriptor pictDiscr(chpx, m_document->WordDocumentStream, 0x7fffffff, m_document->bOlderVersion);
ShapeContainer* pShape = m_document->GetOfficeArt()->GetShapeContainer(pSpa->GetShapeID());
if (pShape)
@ -935,9 +936,9 @@ namespace DocFileFormat
}
}
}
else if (TextMark::Picture == code && fSpec)
else if ((TextMark::Picture == code) && fSpec )
{
PictureDescriptor oPicture (chpx, m_document->nWordVersion > 0 ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->nWordVersion);
PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
bool isInline = _isTextBoxContent;
@ -973,7 +974,7 @@ namespace DocFileFormat
if (oVmlMapper.m_isEmbedded)
{
OleObject ole ( chpx, m_document);
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
ole.isEquation = oVmlMapper.m_isEquation;
@ -1221,8 +1222,7 @@ namespace DocFileFormat
int fc2 = m_document->FindFileCharPos( cp );
int fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
//build the table grid
std::vector<short> grid;
@ -1231,7 +1231,7 @@ namespace DocFileFormat
//find first row end
int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
//start table
m_pXmlWriter->WriteNodeBegin( L"w:tbl" );
@ -1254,7 +1254,7 @@ namespace DocFileFormat
//?fc = m_document->FindFileCharPos(cp );
fc = m_document->m_PieceTable->FileCharacterPositions->operator []( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
}
}
else
@ -1267,7 +1267,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
}
}
@ -1288,80 +1288,60 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
int fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
ParagraphPropertyExceptions* papx_prev = NULL;
short max_boundary = -1;
bool fEndNestingLevel = false;
unsigned int iTap_current = 1;
short count_column = 0;
while ( tai.fInTable )
{
iTap_current = 1;
short current_count_column = 0;
//check all SPRMs of this TAPX
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
DWORD code = iter->OpCode;
switch(iter->OpCode)
{
case sprmPFInnerTableCell:
case sprmPFInnerTtp:
case sprmTDefTable:
case sprmOldTDefTable:
{
fEndNestingLevel = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
//SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
//int itcMac = tdef.numberOfColumns;
case sprmPItap:
{
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
}break;
}
}
if (nestingLevel == iTap_current)
{
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
DWORD code = iter->OpCode;
unsigned char itcMac = iter->Arguments[0];
switch(iter->OpCode)
{
case sprmTDefTable:
case sprmOldTDefTable:
short boundary1, boundary2;
for (unsigned char i = 0; i < itcMac; i++)
{
unsigned char itcMac = iter->Arguments[0];
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
short boundary1, boundary2;
for (unsigned char i = 0; i < itcMac; i++)
{
boundary1 = FormatUtils::BytesToInt16( iter->Arguments + 1, i * 2 , iter->argumentsSize );
boundary2 = FormatUtils::BytesToInt16( iter->Arguments + 1, ( i + 1 ) * 2, iter->argumentsSize );
AddBoundary(boundary1, boundary2, boundaries);
}
if (max_boundary < boundary2)
max_boundary = boundary2;
AddBoundary(boundary1, boundary2, boundaries);
}
if (max_boundary < boundary2)
max_boundary = boundary2;
AddBoundary(boundary2, max_boundary, boundaries);
}break;
}
AddBoundary(boundary2, max_boundary, boundaries);
}break;
}
}
if (nestingLevel > 1 && fEndNestingLevel && !boundaries.empty())
break;
if (current_count_column > count_column)
count_column = current_count_column;
//get the next papx
papx = findValidPapx( fcRowEnd );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
if (papx_prev && papx_prev == papx )
break;//file(12).doc
papx_prev = papx;
}
if ( !boundaries.empty() )
@ -1378,7 +1358,7 @@ namespace DocFileFormat
void DocumentMapping::AddBoundary(short boundary1, short boundary2, std::map<short, short> &boundaries)
{
if (boundary2 - boundary1 < 3)
if (boundary2 - boundary1 < 10)
return;
std::map<short, short>::iterator pFind = boundaries.find(boundary1);
@ -1417,7 +1397,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( nestingLevel > 1 )
{
@ -1433,7 +1413,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
cp++;
}
@ -1456,7 +1436,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
cp++;
}
}
@ -1475,7 +1455,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( nestingLevel > 1 )
{
@ -1495,7 +1475,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
cp++;
}
@ -1518,7 +1498,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
cp++;
}
}
@ -1533,14 +1513,14 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
//start w:tr
m_pXmlWriter->WriteNodeBegin( L"w:tr" );
//convert the properties
int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->nWordVersion);
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) );
@ -1564,7 +1544,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos(cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
}
}
else
@ -1581,7 +1561,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cp );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
}
}
@ -1602,8 +1582,10 @@ namespace DocFileFormat
int cp = initialCp;
int cpCellEnd = findCellEndCp( initialCp, nestingLevel );
XMLTools::CStringXmlWriter writerTcPr;
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( &writerTcPr, grid, gridIndex, cellIndex, nestingLevel );
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
TableCellPropertiesMapping* tcpMapping = new TableCellPropertiesMapping( m_pXmlWriter, grid, gridIndex, cellIndex );
if ( tapx != NULL )
{
@ -1612,19 +1594,8 @@ namespace DocFileFormat
gridIndex = gridIndex + tcpMapping->GetGridSpan();
bool bCoverCell = tcpMapping->IsCoverCell();
RELEASEOBJECT( tcpMapping );
if (bCoverCell)
{
return cpCellEnd;
}
//start w:tc
m_pXmlWriter->WriteNodeBegin( L"w:tc" );
m_pXmlWriter->WriteString(writerTcPr.GetXmlString());
//write the paragraphs of the cell
while ( cp < cpCellEnd )
{
@ -1632,7 +1603,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( cp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
//cp = writeParagraph(cp);
@ -1652,7 +1623,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
}
@ -1671,7 +1642,7 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos( initialCp );
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
while ( !tai.fInnerTableCell )
{
@ -1680,7 +1651,7 @@ namespace DocFileFormat
fc = m_document->FindFileCharPos( cpCellEnd );
papx = findValidPapx( fc );
tai = TableInfo( papx, m_document->nWordVersion );
tai = TableInfo( papx );
}
cpCellEnd++;
@ -1801,8 +1772,13 @@ namespace DocFileFormat
// Checks if the CHPX is special
bool DocumentMapping::isSpecial(CharacterPropertyExceptions* chpx)
{
if (!chpx) return false;
if (!chpx->grpprl) return false;
/*
for (list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
{
short value = FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize);
int c = 0;
}
*/
for (std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); ++iter)
{
@ -1872,11 +1848,6 @@ namespace DocFileFormat
{
SectionPropertyExceptions* ret = NULL;
if (!m_document->AllSepx)
{
return ret;
}
try
{
ret = m_document->AllSepx->operator [](cp);

View File

@ -87,7 +87,7 @@ namespace DocFileFormat
bool isSectionEnd ( int cp );
// Writes a Paragraph that starts at the given cp and
// ends at the next paragraph end mark or section end mark
int writeParagraph( int cp, int cpEnd );
int writeParagraph( int cp );
// Writes a Paragraph that starts at the given cpStart and
// ends at the given cpEnd
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );

View File

@ -48,89 +48,22 @@ namespace DocFileFormat
{
Initialize();
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_nWordVersion);
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcDop, fib->m_bOlderVersion);
//setDefaultCompatibilityOptions( fib->m_FibBase.nFib );
unsigned int size = fib->m_FibWord97.lcbDop;
unsigned char* bytes = NULL;
unsigned int size = fib->m_FibWord97.lcbDop;
unsigned char* bytes = tStream.ReadBytes( size, true );
try
{
if (fib->m_nWordVersion == 2)
{
unsigned char* Temp = tStream.ReadBytes(size, true);
tStream.Seek(fib->m_FibWord97.fcDop, 0);
delete []Temp;
unsigned char flags1 = tStream.ReadByte();
fFacingPages = GETBIT(flags1, 0);
fWindowControl = GETBIT(flags1, 1);
Fpc = GETBITS(flags1, 5, 6);
bool fWide = GETBIT(flags1, 7);
grpfIhdt = tStream.ReadByte();
unsigned short flags2 = tStream.ReadUInt16();
rncFtn = GETBIT(flags2, 0);
nFtn = GETBITS(flags2, 1, 15);
unsigned char irmBar = tStream.ReadByte();
unsigned char flags3 = tStream.ReadByte();
unsigned char irmProps = GETBITS(flags3, 0, 6);
fRevMarking = GETBIT(flags3, 7);
unsigned short flags4 = tStream.ReadUInt16();
fBackup = GETBIT(flags4, 0);
fExactWords = GETBIT(flags4, 1);
fPagHidden = GETBIT(flags4, 2);
fPagResults = GETBIT(flags4, 3);
fLockAtn = GETBIT(flags4, 4);
fMirrorMargins = GETBIT(flags4, 5);
bool fKeepFileFormat = GETBIT(flags4, 6);
fDflttrueType = GETBIT(flags4, 7);
fPagSuppressTopSpacing = GETBIT(flags4, 8);
fMaybeRTLTables = GETBIT(flags4, 9);
bool fSpares = tStream.ReadUInt16();
dxaTab = tStream.ReadUInt16();
wSpare = tStream.ReadUInt16();//ftcDefaultBi
dxaHotZ = tStream.ReadUInt16();
wSpare2 = tStream.ReadUInt16();
wSpare3 = tStream.ReadUInt16();
dttmCreated = DateAndTime( tStream.ReadUInt32() );
dttmRevised = DateAndTime( tStream.ReadUInt32() );
dttmLastPrint = DateAndTime( tStream.ReadUInt32() );
nRevision = tStream.ReadUInt16();
tmEdited = tStream.ReadUInt32();
cWords = tStream.ReadUInt32();
cCh = tStream.ReadUInt32();
cPg = tStream.ReadUInt16();
unsigned short rgwSpareDocSum[2];
rgwSpareDocSum[0] = tStream.ReadUInt16();
rgwSpareDocSum[1] = tStream.ReadUInt16();
}
else if ( size > 0 )
if ( size > 0 )
{
bytes = tStream.ReadBytes( size, true );
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
fFacingPages = FormatUtils::GetBitFromBytes( bytes, 2, 0 );
fWindowControl = FormatUtils::GetBitFromBytes( bytes, 2, 1 );
fPMHMainDoc = FormatUtils::GetBitFromBytes( bytes, 2, 2 );
grfSuppression = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 3, 2 );
Fpc = (short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
grpfIhdt = FormatUtils::BytesToUChar( bytes, 1, size );
Fpc = (short)(short)FormatUtils::GetUIntFromBytesBits( bytes, 2, 5, 2 );
rncFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 0, 2 );
nFtn = (short)FormatUtils::GetUIntFromBytesBits( ( bytes + 2 ), 2, 2, 14 );
@ -612,7 +545,6 @@ namespace DocFileFormat
fSwapBordersFacingPgs = false;
dxaTab = 0;
wSpare = 0;
wSpare3 = 0;
dxaHotZ = 0;
cConsecHypLim = 0;
wSpare2 = 0;

View File

@ -177,8 +177,7 @@ namespace DocFileFormat
unsigned short cConsecHypLim;
// Reserved
unsigned short wSpare2;
unsigned short wSpare3;
// Date and time document was created
// Date and time document was created
DateAndTime dttmCreated;
// Date and time document was last revised
DateAndTime dttmRevised;

View File

@ -37,9 +37,9 @@ namespace DocFileFormat
{
EncryptionHeader::EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream ) : bStandard(false), bXOR(false), bAES(false)
{
VirtualStreamReader tStream( tableStream, 0, fib->m_nWordVersion);
VirtualStreamReader tStream( tableStream, 0, fib->m_bOlderVersion);
if (fib->m_FibBase.fObfuscation || fib->m_nWordVersion > 0)
if (fib->m_FibBase.fObfuscation || fib->m_bOlderVersion)
{
bXOR = true;

View File

@ -79,7 +79,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( tai.fInTable )
{
@ -91,7 +91,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -69,22 +69,14 @@ namespace DocFileFormat
newObject->prq = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x03 );
newObject->fTrueType = FormatUtils::BitmaskToBool ( ffid, 0x04 );
newObject->ff = (unsigned char) FormatUtils::BitmaskToInt ( ffid, 0x70 );
newObject->wWeight = reader->ReadInt16();
newObject->chs = reader->ReadByte();
//int sz_fonts = 150; //.. нужно генерить уникальное todooo
int szAlt = 0;
if (reader->nWordVersion == 2)
{
newObject->wWeight = reader->ReadByte();
}
else
{
newObject->wWeight = reader->ReadInt16();
newObject->chs = reader->ReadByte();
szAlt = reader->ReadByte();
}
int szAlt = reader->ReadByte();
if (reader->nWordVersion == 0)
if (!reader->olderVersion)
{
//read the 10 bytes panose
newObject->panoseSize = 10;
@ -105,7 +97,7 @@ namespace DocFileFormat
unsigned char *bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszFtn), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250 );
}
@ -139,7 +131,7 @@ namespace DocFileFormat
bytes = reader->ReadBytes( (int)( strEnd - strStart ), true );
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(newObject->xszAlt), bytes, (int)( strEnd - strStart ), ENCODING_WINDOWS_1250);
}
@ -159,7 +151,7 @@ namespace DocFileFormat
{
long strStart = reader->GetPosition();
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{//ansi string only
while ( reader->ReadByte() != 0 )
{

View File

@ -71,7 +71,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( tai.fInTable )
{
@ -89,7 +89,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
}

View File

@ -81,7 +81,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( tai.fInTable )
{
@ -93,7 +93,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
cp++;

View File

@ -98,7 +98,7 @@ void FormFieldData::_FFData::read(VirtualStreamReader *reader)
xstzEntryMcr = readXstz(reader);
xstzExitMcr = readXstz(reader);
}
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion )
FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion_ )
{
binary_data_size = 0;
@ -139,7 +139,7 @@ FormFieldData::FormFieldData( int type, const CharacterPropertyExceptions* chpx,
if (fc >= 0 && bNilPICFAndBinData)
{
VirtualStreamReader reader(stream, fc, nWordVersion);
VirtualStreamReader reader(stream, fc, bOlderVersion_);
int sz_stream = reader.GetSize();

View File

@ -108,7 +108,7 @@ namespace DocFileFormat
//STTB hsttbDropList;
void read(VirtualStreamReader* reader);
};
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, int nWordVersion );
FormFieldData( int type, const CharacterPropertyExceptions* chpx, POLE::Stream* stream, bool bOlderVersion );
virtual ~FormFieldData() {}
private:
friend class FormFieldDataMapping;

View File

@ -52,8 +52,8 @@ namespace DocFileFormat
/*========================================================================================================*/
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion ):
FormattedDiskPage(), rgb(NULL), grpchpxSize(0), grpchpx(NULL)
FormattedDiskPageCHPX::FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion ):
FormattedDiskPage(), rgb(NULL), grpchpxSize(NULL), grpchpx(NULL)
{
Type = Character;
WordStream = wordStream;
@ -80,6 +80,7 @@ namespace DocFileFormat
j += 4;
}
//create arrays
grpchpxSize = crun;
rgb = new unsigned char[crun];
grpchpx = new CharacterPropertyExceptions*[grpchpxSize];
@ -103,10 +104,11 @@ namespace DocFileFormat
//read the bytes of chpx
chpx = new unsigned char[cb];
//Array.Copy(bytes, (wordOffset * 2) + 1, chpx, 0, chpx.Length);
memcpy( chpx, ( bytes + (wordOffset * 2) + 1 ), cb );
//parse CHPX and fill grpchpx
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, nWordVersion);
grpchpx[i] = new CharacterPropertyExceptions( chpx, cb, oldVersion);
RELEASEARRAYOBJECTS( chpx );
}
@ -137,7 +139,7 @@ namespace DocFileFormat
}
//there are n offsets and n-1 fkp's in the bin table
if (fib->m_nWordVersion > 0)
if (fib->m_bOlderVersion)
{
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBteChpx - 8 ) / 6 ) + 1;
@ -160,7 +162,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
}
}
else
@ -176,7 +178,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_nWordVersion ) );
CHPXlist->push_back( new FormattedDiskPageCHPX( wordStream, offset, fib->m_bOlderVersion ) );
}
}

View File

@ -50,7 +50,7 @@ namespace DocFileFormat
public:
virtual ~FormattedDiskPageCHPX();
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, int nWordVersion );
FormattedDiskPageCHPX( POLE::Stream* wordStream, int offset, bool oldVersion );
/// Parses the 0Table (or 1Table) for FKP _entries containing CHPX
static std::list<FormattedDiskPageCHPX*>* GetAllCHPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream );
};

View File

@ -52,53 +52,59 @@ namespace DocFileFormat
/*========================================================================================================*/
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex):
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex):
FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL)
{
Type = Paragraph;
WordStream = wordStream;
{
Type = Paragraph;
WordStream = wordStream;
//read the 512 bytes (FKP)
unsigned char* bytes = NULL;
bytes = new unsigned char[512];
//read the 512 bytes (FKP)
unsigned char* bytes = NULL;
bytes = new unsigned char[512];
WordStream->seek( offset);
WordStream->read( bytes, 512);
WordStream->seek( offset);
WordStream->read( bytes, 512);
//get the count
crun = bytes[511];
//get the count
crun = bytes[511];
//create and fill the array with the adresses
rgfcSize = crun + 1;
rgfc = new int[rgfcSize];
//create and fill the array with the adresses
rgfcSize = crun + 1;
rgfc = new int[rgfcSize];
int j = 0;
int j = 0;
for ( unsigned int i = 0; i < rgfcSize; i++ )
{
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
j += 4;
}
rgbx = new BX[crun];
grppapxSize = crun;
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
for ( unsigned int i = 0; i < rgfcSize; i++ )
{
rgfc[i] = FormatUtils::BytesToInt32( bytes, j, 512 );
j += 4;
}
for ( unsigned int i = 0; i < grppapxSize; i++ )
{
grppapx[i] = NULL;
}
//create arrays
rgbx = new BX[crun];
grppapxSize = crun;
grppapx = new ParagraphPropertyExceptions*[grppapxSize];
j = 4 * ( crun + 1 );
for ( unsigned int i = 0; i < grppapxSize; i++ )
{
grppapx[i] = NULL;
}
unsigned char phe[12];
j = 4 * ( crun + 1 );
//read the 12 for PHE
unsigned char* phe = NULL;
phe = new unsigned char[12];
unsigned char* papx = NULL;
for ( unsigned char i = 0; i < crun; i++ )
for ( int i = 0; i < crun; i++ )
{
BX bx;
bx.wordOffset = bytes[j];
j++;
if (fComplex || nWordVersion == 0)
if (fComplex || !oldVersion)
{
memcpy( phe, ( bytes + j), 12 );
@ -107,13 +113,6 @@ namespace DocFileFormat
j += 12;
}
else if (nWordVersion == 2)
{
memcpy( phe, ( bytes + bx.wordOffset * 2 + j + 1), 6);
//fill the rgbx array
bx.phe = ParagraphHeight( phe, 6, false );
}
else
{
memcpy( phe, ( bytes + j), 6);
@ -127,27 +126,29 @@ namespace DocFileFormat
if ( bx.wordOffset != 0 )
{
//read first unsigned char of PAPX
//PAPX is stored in a FKP; so the first unsigned char is a count of words
unsigned char padbyte = 0;
unsigned char cw = bytes[bx.wordOffset * 2];
//if that unsigned char is zero, it's a pad unsigned char, and the word count is the following unsigned char
if ( cw == 0 )
{
padbyte = 1;
cw = bytes[bx.wordOffset * 2 + 1];
}
if ( cw != 0 )
{
int sz = cw * 2;
//read the bytes for papx
unsigned char* papx = new unsigned char[sz];
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), sz );
papx = new unsigned char[cw * 2];
memcpy( papx, ( bytes + (bx.wordOffset * 2) + padbyte + 1 ), ( cw * 2 ) );
//parse PAPX and fill grppapx
grppapx[i] = new ParagraphPropertyExceptions( papx, sz, dataStream, nWordVersion );
grppapx[i] = new ParagraphPropertyExceptions( papx, ( cw * 2 ), dataStream, oldVersion );
RELEASEARRAYOBJECTS( papx );
}
}
else
{
@ -156,6 +157,7 @@ namespace DocFileFormat
}
}
RELEASEARRAYOBJECTS( phe );
RELEASEARRAYOBJECTS( bytes );
}
@ -177,7 +179,7 @@ namespace DocFileFormat
//there are n offsets and n-1 fkp's in the bin table
if (fib->m_nWordVersion > 0 && fib->m_FibBase.fComplex == false)
if (fib->m_bOlderVersion && fib->m_FibBase.fComplex == false)
{
int n = ( ( (int)fib->m_FibWord97.lcbPlcfBtePapx - 8 ) / 6 ) + 1;
@ -200,7 +202,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
}
//if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last)
@ -224,7 +226,7 @@ namespace DocFileFormat
int offset = fkpnr * 512;
//parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_nWordVersion, fib->m_FibBase.fComplex) );
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
}
}

View File

@ -63,7 +63,7 @@ namespace DocFileFormat
public:
virtual ~FormattedDiskPagePAPX();
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, int nWordVersion, bool fComplex);
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex);
/// Parses the 0Table (or 1Table) for FKP _entries containing PAPX
static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream);
/// Returns a list of all PAPX FCs between they given boundaries.

View File

@ -38,30 +38,10 @@ namespace Global
static const wchar_t ColorIdentifier[17][12] =
{
L"auto",
L"000000",//L"black",
L"0000FF",//L"blue",
L"00FFFF",//L"cyan",
L"00FF00",// L"green",
L"FF00FF",//L"magenta",
L"FF0000",//L"red",
L"FFFF00",//L"yellow",
L"FFFFFF",//L"white",
L"darkBlue",
L"darkCyan",
L"darkGreen",
L"darkMagenta",
L"darkRed",
L"darkYellow",
L"darkGray",
L"lightGray"
};
static const wchar_t ColorNameIdentifier[17][12] =
{
L"auto",
L"black",
L"blue",
L"cyan",
L"green",
L"green",
L"magenta",
L"red",
L"yellow",
@ -75,6 +55,7 @@ namespace Global
L"darkGray",
L"lightGray"
};
static const wchar_t UnderlineCode[56][16] =
{
L"none",

View File

@ -38,83 +38,110 @@ namespace DocFileFormat
{
HeaderAndFooterTable::HeaderAndFooterTable (FileInformationBlock* fib, POLE::Stream* pTableStream)
{
m_nCurrentIndex = 0;
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_nWordVersion);
VirtualStreamReader tableReader (pTableStream, fib->m_FibWord97.fcPlcfHdd, fib->m_bOlderVersion);
if (fib->m_FibWord97.fcPlcfHdd > tableReader.GetSize()) return;
unsigned int tableSize = fib->m_FibWord97.lcbPlcfHdd / 4;//in bytes
if ( tableSize < 1 || fib->m_RgLw97.ccpHdr <1 )
return;
int* table = new int[tableSize];
for (unsigned int i = 0; i < tableSize; ++i)
if ( ( tableSize > 0 ) && ( fib->m_RgLw97.ccpHdr > 0 ) )
{
table[i] = tableReader.ReadInt32();
}
int* table = new int[tableSize];
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
int count = 0;
int pos = (fib->m_FibBase.fComplex || fib->m_nWordVersion == 0) ? 6 : 0;
//the first 6 _entries are about footnote and endnote formatting -Word97 so skip these
std::vector<std::vector<CharacterRange*>*> arHeadersFooters;
if (fib->m_nWordVersion == 2)
{
count = ( tableSize - 1);
}
else
{
count = ( tableSize - pos - 1) / 6;
arHeadersFooters.push_back(&m_arEvenHeaders);
arHeadersFooters.push_back(&m_arOddHeaders);
arHeadersFooters.push_back(&m_arEvenFooters);
arHeadersFooters.push_back(&m_arOddFooters);
arHeadersFooters.push_back(&m_arFirstHeaders);
arHeadersFooters.push_back(&m_arFirstFooters);
}
for (int i = 0; i < count; ++i)
{
//Even Header
if (fib->m_nWordVersion == 2)
for (unsigned int i = 0; i < tableSize; ++i)
{
table[i] = tableReader.ReadInt32();
}
int initialPos = fib->m_RgLw97.ccpText + fib->m_RgLw97.ccpFtn;
//the first 6 _entries are about footnote and endnote formatting
//so skip these _entries
int pos = (fib->m_FibBase.fComplex || !fib->m_bOlderVersion) ? 6 : 0;
int count = ( tableSize - pos - 2) / 6;
for (int i = 0; i < count; ++i)
{
//Even Header
if ( table[pos] == table[pos + 1] )
{
m_arCommonHeadersFooters.push_back( NULL );
m_arEvenHeaders.push_back( NULL );
}
else
{
m_arCommonHeadersFooters.push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
m_arEvenHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Odd Header
if ( table[pos] == table[pos + 1] )
{
m_arOddHeaders.push_back( NULL );
}
else
{
m_arOddHeaders.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Even Footer
if ( table[pos] == table[pos + 1] )
{
m_arEvenFooters.push_back( NULL );
}
else
{
m_arEvenFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//Odd Footer
if ( table[pos] == table[pos + 1] )
{
m_arOddFooters.push_back( NULL );
}
else
{
m_arOddFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
//First Page Header
if ( table[pos] == table[pos + 1] )
{
m_arFirstHeaders.push_back (NULL);
}
else
{
m_arFirstHeaders.push_back (new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ));
}
pos++;
if (pos >= tableSize)
break;
//First Page Footers
if ( table[pos] == table[pos + 1] )
{
m_arFirstFooters.push_back( NULL );
}
else
{
m_arFirstFooters.push_back( new CharacterRange( ( initialPos + table[pos] ), ( table[pos + 1] - table[pos] ) ) );
}
pos++;
}
else
{
for (size_t j = 0; j < 6; j++)
{
if ( table[pos] == table[pos + 1] )
{
arHeadersFooters[j]->push_back( NULL );
}
else
{
arHeadersFooters[j]->push_back( new CharacterRange( initialPos + table[pos], table[pos + 1] - table[pos]) );
}
pos++;
if (pos >= tableSize) break;
}
}
if (pos >= tableSize) break;
RELEASEARRAYOBJECTS(table);
}
RELEASEARRAYOBJECTS(table);
}
HeaderAndFooterTable::~HeaderAndFooterTable()
@ -125,7 +152,5 @@ namespace DocFileFormat
for_each (m_arFirstHeaders.begin(), m_arFirstHeaders.end(), DeleteDynamicObject());
for_each (m_arOddFooters.begin(), m_arOddFooters.end(), DeleteDynamicObject());
for_each (m_arOddHeaders.begin(), m_arOddHeaders.end(), DeleteDynamicObject());
for_each (m_arCommonHeadersFooters.begin(), m_arCommonHeadersFooters.end(), DeleteDynamicObject());
}
}

View File

@ -34,12 +34,10 @@
#include "CharacterRange.h"
#include "FileInformationBlock.h"
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex)\
{\
#define GET_CHARS_RANGE(NAME) inline CharacterRange* Get##NAME(int nIndex) {\
if (m_ar##NAME.empty()) return NULL; \
if (nIndex < (int)m_ar##NAME.size()) return m_ar##NAME[nIndex];\
return NULL; \
}\
return NULL; } \
namespace DocFileFormat
{
@ -56,17 +54,8 @@ namespace DocFileFormat
GET_CHARS_RANGE (EvenFooters);
GET_CHARS_RANGE (OddFooters);
inline CharacterRange* GetNextHeaderFooter()
{
if (m_nCurrentIndex < m_arCommonHeadersFooters.size())
return m_arCommonHeadersFooters[m_nCurrentIndex++];
return NULL;
}
private:
size_t m_nCurrentIndex;
std::vector<CharacterRange*> m_arCommonHeadersFooters;
std::vector<CharacterRange*> m_arFirstHeaders;
std::vector<CharacterRange*> m_arEvenHeaders;
std::vector<CharacterRange*> m_arOddHeaders;

View File

@ -71,7 +71,7 @@ namespace DocFileFormat
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( tai.fInTable )
{
@ -84,7 +84,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
}

View File

@ -152,53 +152,37 @@ namespace DocFileFormat
}
OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
{
if (length < 212)
int pos = 0;
for (int i = 0 ; i < 9; i++)
{
//int sz = FormatUtils::BytesToUChar(data, 0, length);
int pos = 0;
for (int i = 0 ; i < 9; i++)
{
lvl[i].Parse(data + pos, 1);
pos += 1;
}
lvl[i].Parse(data + pos, length - pos);
pos += 16;
}
else
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
short strLen = length - pos;
while (strLen > 0)
{
int pos = 0;
for (int i = 0 ; i < 9; i++)
{
lvl[i].Parse(data + pos, length - pos);
pos += 16;
}
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
short strLen = length - pos;
while (strLen > 0)
{
if (data[strLen + 20 - 1] != 0)
break;
strLen--;
}
if (strLen > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
}
if (data[strLen + 20 - 1] != 0)
break;
strLen--;
}
if (strLen > 0)
{
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &(xst), data + 20, ( strLen ), ENCODING_WINDOWS_1250);
}
}
ByteStructure* OutlineListDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
{
int sz = GetSize(reader->nWordVersion);
unsigned char *data = reader->ReadBytes(sz, true);
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, sz);
unsigned char *data = reader->ReadBytes(212, true);
OutlineListDescriptor *newObject = new OutlineListDescriptor(data, 212);
delete []data;

View File

@ -143,13 +143,8 @@ namespace DocFileFormat
std::wstring xst; //64 chars ansi
public:
static const int STRUCTURE_SIZE = 212;
static const int STRUCTURE_SIZE_OLD = 10;
public:
static const int GetSize(int nWordVersion)
{
return (nWordVersion == 2) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ~OutlineListDescriptor();

View File

@ -49,7 +49,7 @@ namespace DocFileFormat
{
if ( fib->m_FibWord97.lcbPlfLfo > 0 )
{
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_nWordVersion);
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLfo, fib->m_bOlderVersion);
if (fib->m_FibWord97.fcPlfLfo > reader.GetSize()) return;

View File

@ -77,7 +77,7 @@ namespace DocFileFormat
//this papx has no istd, so use PX to parse it
unsigned char *bytes = reader->ReadBytes( cbGrpprlPapx, true );
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->nWordVersion);
PropertyExceptions* px = new PropertyExceptions( bytes, cbGrpprlPapx, reader->olderVersion);
grpprlPapx = new ParagraphPropertyExceptions( *(px->grpprl) );
RELEASEOBJECT( px );
@ -85,7 +85,7 @@ namespace DocFileFormat
//read the group of chpx sprms
bytes = reader->ReadBytes( cbGrpprlChpx, true );
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->nWordVersion );
grpprlChpx = new CharacterPropertyExceptions( bytes, cbGrpprlChpx, reader->olderVersion );
RELEASEARRAYOBJECTS( bytes );
//read the number text
@ -116,10 +116,6 @@ namespace DocFileFormat
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
{
if (length < 16)
{
return;
}
bEnabled = true;
nfc = FormatUtils::BytesToUChar(data, 0, length);

View File

@ -45,7 +45,7 @@ namespace DocFileFormat
{
if ( fib->m_FibWord97.lcbPlfLst > 0 )
{
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_nWordVersion);
VirtualStreamReader reader( tableStream, fib->m_FibWord97.fcPlfLst, fib->m_bOlderVersion);
if (fib->m_FibWord97.fcPlfLst > reader.GetSize()) return;

View File

@ -110,7 +110,7 @@ namespace DocFileFormat
int countText = m_document->FIB->m_RgLw97.ccpText;
int countTextRel = m_document->FIB->m_RgLw97.ccpText - 1;
while (cp < countText && cp >= 0)
while (cp < countText)
{
fc = m_document->FindFileCharPos(cp);
@ -120,7 +120,7 @@ namespace DocFileFormat
if (papx)
{
TableInfo tai(papx, m_document->nWordVersion);
TableInfo tai(papx);
if (tai.fInTable)
{
int cpStart = cp;
@ -135,7 +135,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph(cp, countTextRel);
cp = writeParagraph(cp);
}
}
else

View File

@ -124,7 +124,7 @@ public:
if (m_Data)
{
rdByte = (m_Position < m_Size) ? m_Data[m_Position] : 0;
rdByte = m_Data[m_Position];
m_Position += sizeof(rdByte);
}

View File

@ -338,9 +338,9 @@ namespace DocFileFormat
}
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, int nWordVersion)
std::wstring NumberingMapping::GetNumberFormatWideString(int nfc, bool bOlderVersion)
{
if (nWordVersion > 0 && nfc > 5)
if (bOlderVersion && nfc > 5)
{
if (nfc == 0xff) return std::wstring( L"bullet");
else return std::wstring( L"none");
@ -633,7 +633,7 @@ namespace DocFileFormat
if ((chpxs != NULL) && (!chpxs->empty()))
{
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->nWordVersion);
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc, m_document->FIB->m_bOlderVersion);
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
{

View File

@ -65,7 +65,7 @@ namespace DocFileFormat
static int FindIndexbyId(const std::list<ListData*>& listData, int id);
/// Converts the number format code of the binary format.
static std::wstring GetNumberFormatWideString(int nfc, int nWordVersion = 0);
static std::wstring GetNumberFormatWideString(int nfc, bool bOlderVersion = false);
virtual ~NumberingMapping();

View File

@ -60,7 +60,7 @@ namespace DocFileFormat
OfficeArtContent (const FileInformationBlock* pFIB, POLE::Stream* pStream): m_pDrawingGroupData(NULL), m_pBackgroud(NULL)
{
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_nWordVersion);
VirtualStreamReader oStearmReader(pStream, 0 , pFIB->m_bOlderVersion);
if (pFIB->m_FibWord97.fcDggInfo > oStearmReader.GetSize()) return;

View File

@ -67,6 +67,7 @@ public:
BYTE compression;
BYTE filter;
public:
CMetaHeader()
{
cbSize = cbSave = 0;
@ -77,6 +78,48 @@ public:
}
//void ToEMFHeader(Gdiplus::ENHMETAHEADER3* pHeader)
//{
// if (NULL == pHeader)
// return;
// pHeader->iType = 0x00000001;
// pHeader->nSize = 88;
// pHeader->rclBounds.left = rcBounds.left;
// pHeader->rclBounds.top = rcBounds.top;
// pHeader->rclBounds.right = rcBounds.right;
// pHeader->rclBounds.bottom = rcBounds.bottom;
// // нужно перевести в мм
// pHeader->rclFrame.left = rcBounds.left;
// pHeader->rclFrame.top = rcBounds.top;
// pHeader->rclFrame.right = rcBounds.right;
// pHeader->rclFrame.bottom = rcBounds.bottom;
// pHeader->dSignature = 0x464D4520;
// pHeader->nVersion = 0x00010000;
// pHeader->nBytes = cbSize;
// pHeader->nRecords = 1;
// pHeader->nHandles = 0;
// pHeader->sReserved = 0;
// pHeader->nDescription = 0;
// pHeader->offDescription = 0;
// pHeader->nPalEntries = 0;
// pHeader->szlDevice.cx = 200;
// pHeader->szlDevice.cy = 200;
// // нужно перевести в мм
// pHeader->szlMillimeters.cx = 100;
// pHeader->szlMillimeters.cy = 100;
//}
void ToWMFHeader(WmfPlaceableFileHeader* pHeader)
{
if (NULL == pHeader)

View File

@ -32,111 +32,97 @@
#pragma once
#include "OleObject.h"
#include "WordDocument.h"
namespace DocFileFormat
{
OleObject::OleObject( const CharacterPropertyExceptions* chpx, WordDocument* document)
: bLinked(false), updateMode(NoLink), isEquation(false), isEmbedded (false), oleStorage(NULL)
OleObject::OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage, bool bOlderVersion_ )
: bLinked(false), updateMode(NoLink), bOlderVersion(bOlderVersion_), isEquation(false), isEmbedded (false)
{
if (!document) return;
if (!docStorage) return;
if (!chpx) return;
nWordVersion = document->nWordVersion;
ObjectId = getOleEntryName( chpx );
StructuredStorageReader* docStorage = document->GetStorage();
oleStorage = docStorage->GetStorage();
if (!oleStorage) return;
std::wstring sObjectId( ObjectId.begin(), ObjectId.end() );
std::wstring name = L"ObjectPool/" + sObjectId + L"/";
HRESULT res = S_OK;
bool bOle = processOleStream( name + L"Ole" );
bool bCompObj = bLinked ? processLinkInfoStream( name + L"LinkInfo" ):
processCompObjStream( name + L"CompObj" );
if (bOle || bCompObj)
{
processPICStream( name + L"PIC" );
processMETAStream( name + L"META" );
processEquationNativeStream( name + L"Equation Native" );
}
else if (nWordVersion > 0)
{
int fc = pictureDesciptor.GetFcPic( chpx );
POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, L"ObjectPool");
if ( fc >= 0 )
{
POLE::Stream* pOleStream = document->GetDocumentStream();
pictureDesciptor.parse( pOleStream, fc, 0xffffff, nWordVersion);
if (ObjectPoolStorage)
{
ObjectId = getOleEntryName( chpx );
VirtualStreamReader reader(pOleStream, pOleStream->tell(), nWordVersion);
std::wstring sObjectId( ObjectId.begin(), ObjectId.end() );
{
std::wstring name = L"ObjectPool/" + sObjectId + L"/";
processOleStream( name + L"Ole" );
int pos = reader.GetPosition();
short a1 = reader.ReadInt16();
short a2 = reader.ReadInt16();
short a3 = reader.ReadInt16();
int lcb = reader.ReadInt32();
//short a4 = reader.ReadInt16();
//short a5 = reader.ReadInt16();
//short a6 = reader.ReadInt16();
//short a7 = reader.ReadInt16();
int lcb1 = reader.ReadInt32();
ClipboardFormat = Program = reader.ReadLengthPrefixedAnsiString(0xffff);
short a10 = reader.ReadInt16();
short a11 = reader.ReadInt16();
short a12 = reader.ReadInt16();
short a14 = reader.ReadInt16();
//int lcb = 5000;//reader.ReadInt32();
int szHeader = reader.GetPosition() - pos;
int szData = reader.ReadInt32();
if (szData > lcb)
if ( bLinked )
{
szData = szData >> 16;
processLinkInfoStream( name + L"LinkInfo" );
}
unsigned char* bytes = reader.ReadBytes( szData, true );
if (bytes)
else
{
emeddedData = std::string((char*)bytes, szData);
delete []bytes;
processCompObjStream( name + L"CompObj" );
}
processPICStream( name + L"PIC" );
processEquationNativeStream( name + L"Equation Native" );
}
delete ObjectPoolStorage;
}
}
bool OleObject::processLinkInfoStream( const std::wstring& linkStream )
void OleObject::processLinkInfoStream( const std::wstring& linkStream )
{
try
{
POLE::Stream* pLinkStream = NULL;
HRESULT res = S_OK;
POLE::Stream* pLinkStream = NULL;
HRESULT res = S_OK;
pLinkStream = new POLE::Stream(oleStorage, linkStream);
pLinkStream = //oleStorage->stream(linkStream);
new POLE::Stream(oleStorage, linkStream);
if ( pLinkStream )
{
VirtualStreamReader reader( pLinkStream, 0, false);
processLinkInfoStream(reader);
if ( pLinkStream )
{
VirtualStreamReader reader( pLinkStream, 0, false);
delete pLinkStream;
return true;
}
//there are two versions of the Link string, one contains ANSI characters, the other contains
//unicode characters.
//Both strings seem not to be standardized:
//The length prefix is a character count EXCLUDING the terminating zero
//Read the ANSI version
short cch = reader.ReadInt16();
unsigned char* str = reader.ReadBytes( cch, true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, cch, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the ANSI string
//even if the characters are ANSI chars, the terminating zero has 2 bytes
reader.ReadBytes( 2, false );
//skip the next 4 bytes (flags?)
reader.ReadBytes( 4, false );
//Read the Unicode version
this->Link.clear();
cch = reader.ReadInt16();
str = reader.ReadBytes( ( cch * 2 ), true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, ( cch * 2 ), ENCODING_UTF16 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the Unicode string
reader.ReadBytes( 2, false );
delete pLinkStream;
}
}
catch (...)
{
}
return false;
}
void OleObject::processEquationNativeStream( const std::wstring& eqStream )
@ -169,32 +155,7 @@ void OleObject::processEquationNativeStream( const std::wstring& eqStream )
{
}
}
void OleObject::processMETAStream( const std::wstring& metaStream )
{
try
{
HRESULT res = S_OK;
POLE::Stream* pMETAStream = new POLE::Stream(oleStorage, metaStream);
if ( pMETAStream )
{
pictureDesciptor.Type = wmf;
VirtualStreamReader reader( pMETAStream, 0, false);
pictureDesciptor.mfp.mm = reader.ReadUInt16();
pictureDesciptor.mfp.xExt = reader.ReadUInt16();
pictureDesciptor.mfp.yExt = reader.ReadUInt16();
pictureDesciptor.mfp.hMf = reader.ReadUInt16();
pictureDesciptor.embeddedDataSize = reader.GetSize() - 8;
pictureDesciptor.embeddedData = reader.ReadBytes( pictureDesciptor.embeddedDataSize, true );
}
}
catch (...)
{
}
}
void OleObject::processPICStream( const std::wstring& picStream )
{
try
@ -209,54 +170,20 @@ void OleObject::processPICStream( const std::wstring& picStream )
int sz = reader.GetSize();
int cbHeader = reader.ReadUInt32();
int cbHeader = reader.ReadUInt32();
unsigned char* bytes = NULL;
pictureDesciptor.mfp.mm = reader.ReadInt16();
pictureDesciptor.mfp.xExt = reader.ReadInt16();
pictureDesciptor.mfp.yExt = reader.ReadInt16();
pictureDesciptor.mfp.hMf = reader.ReadInt16();
reader.ReadBytes(4, false);
int x = reader.ReadUInt32();
int y = reader.ReadUInt32();
pictureDesciptor.dxaGoal = reader.ReadUInt32();
pictureDesciptor.dyaGoal = reader.ReadUInt32();
int x = reader.ReadUInt32();
int y = reader.ReadUInt32();
pictureDesciptor.dyaGoal = reader.ReadUInt32();
pictureDesciptor.dxaGoal = reader.ReadUInt32();
unsigned char* data = reader.ReadBytes(16, true);
delete []data;
reader.ReadBytes(20, false);
pictureDesciptor.mx = reader.ReadUInt32();
pictureDesciptor.my = reader.ReadUInt32();
pictureDesciptor.dxaCropLeft = reader.ReadInt32();
pictureDesciptor.dyaCropTop = reader.ReadInt32();
pictureDesciptor.dxaCropRight = reader.ReadInt32();
pictureDesciptor.dyaCropBottom = reader.ReadInt32();
// borders
int bytesCount = (nWordVersion > 0) ? 2 : 4;
bytes = reader.ReadBytes( bytesCount, true );
pictureDesciptor.brcTop = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true );
pictureDesciptor.brcLeft = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true );
pictureDesciptor.brcBottom = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true );
pictureDesciptor.brcRight = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes );
int etc = sz - reader.GetPosition();
unsigned char* data2 = reader.ReadBytes(etc, true);
delete []data2;
}
}
catch (...)
@ -264,7 +191,7 @@ void OleObject::processPICStream( const std::wstring& picStream )
}
}
bool OleObject::processCompObjStream( const std::wstring& compStream )
void OleObject::processCompObjStream( const std::wstring& compStream )
{
try
{
@ -272,23 +199,36 @@ bool OleObject::processCompObjStream( const std::wstring& compStream )
POLE::Stream* pCompStream = new POLE::Stream(oleStorage, compStream);
if ( (pCompStream) && (!pCompStream->fail()) )
if ( pCompStream )
{
VirtualStreamReader reader( pCompStream, 0, false);
processCompObjStream(reader);
//skip the CompObjHeader
reader.ReadBytes( 28, false );
unsigned int sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
{
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
ClipboardFormat = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
}
delete pCompStream;
return true;
}
}
catch (...)
{
}
return false;
}
bool OleObject::processOleStream( const std::wstring& oleStreamName )
void OleObject::processOleStream( const std::wstring& oleStreamName )
{
try
{
@ -297,87 +237,46 @@ bool OleObject::processOleStream( const std::wstring& oleStreamName )
pOleStream = new POLE::Stream(oleStorage, oleStreamName);
if ( (pOleStream) && (!pOleStream->fail()))
if ( pOleStream )
{
VirtualStreamReader reader( pOleStream, 0, false );
processOleStream(reader);
VirtualStreamReader reader( pOleStream, 0, false );
delete pOleStream;
//skip version
reader.ReadBytes( 4, false );
return true;
//read the embedded/linked flag
int flag = reader.ReadInt32();
bLinked = FormatUtils::BitmaskToBool( flag, 0x1 );
//Link update option
this->updateMode = (LinkUpdateOption)reader.ReadInt32();
switch ( this->updateMode )
{
case NoLink:
{
this->UpdateMode = L"NoLink";
}
break;
case Always:
{
this->UpdateMode = L"Always";
}
break;
case OnCall:
{
this->UpdateMode = L"OnCall";
}
break;
}
delete pOleStream;
}
}
catch (...)
{
}
return false;
}
void OleObject::processOleStream( VirtualStreamReader& reader )
{
//skip version
reader.ReadBytes( 4, false );
//read the embedded/linked flag
int flag = reader.ReadInt32();
bLinked = FormatUtils::BitmaskToBool( flag, 0x1 );
//Link update option
this->updateMode = (LinkUpdateOption)reader.ReadInt32();
switch ( this->updateMode )
{
case NoLink: UpdateMode = L"NoLink"; break;
case Always: UpdateMode = L"Always"; break;
case OnCall: UpdateMode = L"OnCall"; break;
}
}
void OleObject::processLinkInfoStream( VirtualStreamReader& reader )
{
short cch = reader.ReadInt16();
unsigned char* str = reader.ReadBytes( cch, true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, cch, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the ANSI string
//even if the characters are ANSI chars, the terminating zero has 2 bytes
reader.ReadBytes( 2, false );
//skip the next 4 bytes (flags?)
reader.ReadBytes( 4, false );
//Read the Unicode version
this->Link.clear();
cch = reader.ReadInt16();
str = reader.ReadBytes( ( cch * 2 ), true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &this->Link, str, ( cch * 2 ), ENCODING_UTF16 );
RELEASEARRAYOBJECTS( str );
//skip the terminating zero of the Unicode string
reader.ReadBytes( 2, false );
}
void OleObject::processCompObjStream( VirtualStreamReader& reader )
{
//skip the CompObjHeader
reader.ReadBytes( 28, false );
unsigned int sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
{
UserType = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
ClipboardFormat = reader.ReadLengthPrefixedAnsiString(sz_obj);
sz_obj = reader.GetSize() - reader.GetPosition();
if (sz_obj > 4)
Program = reader.ReadLengthPrefixedAnsiString(sz_obj);
}
}
std::wstring OleObject::getOleEntryName( const CharacterPropertyExceptions* chpx )

View File

@ -32,11 +32,11 @@
#pragma once
#include "IVisitable.h"
#include "StructuredStorageReader.h"
#include "PictureDescriptor.h"
namespace DocFileFormat
{
class WordDocument;
class OleObject: public IVisitable
{
friend class OleObjectMapping;
@ -48,7 +48,7 @@ namespace DocFileFormat
Always = 1,
OnCall = 3
};
int nWordVersion;
bool bOlderVersion;
bool bLinked; // The the value is true, the object is a linked object
std::wstring ObjectId;
@ -68,22 +68,17 @@ namespace DocFileFormat
PictureDescriptor pictureDesciptor;
OleObject( const CharacterPropertyExceptions* chpx, WordDocument* document);
OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage, bool bOlderVersion_ );
virtual ~OleObject() {}
private:
POLE::Storage *oleStorage;
bool processLinkInfoStream ( const std::wstring& linkStream );
void processLinkInfoStream ( const std::wstring& linkStream );
void processEquationNativeStream( const std::wstring& eqStream );
void processPICStream ( const std::wstring& picStream );
void processMETAStream ( const std::wstring& metaStream );
bool processCompObjStream ( const std::wstring& compStream );
bool processOleStream ( const std::wstring& oleStreamName );
void processOleStream ( VirtualStreamReader& reader );
void processLinkInfoStream ( VirtualStreamReader& reader );
void processCompObjStream ( VirtualStreamReader& reader );
void processCompObjStream ( const std::wstring& compStream );
void processOleStream ( const std::wstring& oleStreamName );
std::wstring getOleEntryName ( const CharacterPropertyExceptions* chpx );
};

View File

@ -156,31 +156,26 @@ namespace DocFileFormat
private:
inline void copyEmbeddedObject( const OleObject* ole )
{
if ( ole == NULL ) return;
std::wstring clsid;
std::wstring exelChart = L"Excel.Chart";
if ( std::search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() )
if ( ole != NULL )
{
clsid = ole->ClassId;
}
OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid);
std::wstring clsid;
std::wstring exelChart = L"Excel.Chart";
if (ole->nWordVersion == 2)
{
object_descr.clsid = ole->ClipboardFormat;
object_descr.bNativeOnly = true;
}
if (ole->isEquation || ole->isEmbedded || ole->nWordVersion == 2)
{
object_descr.data = ole->emeddedData;
}
if ( std::search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() )
{
clsid = ole->ClassId;
}
OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid);
m_context->_docx->OleObjectsList.push_back(object_descr);
if (ole->isEquation || ole->isEmbedded)
{
object_descr.data = ole->emeddedData;
}
m_context->_docx->OleObjectsList.push_back(object_descr);
}
}
private:
ConversionContext* m_context;
PictureDescriptor* _pict;

View File

@ -135,101 +135,35 @@ namespace DocFileFormat
}
}
bool OpenXmlPackage::SaveEmbeddedObject( const std::wstring& fileName, const OleObjectFileStructure& object )
HRESULT OpenXmlPackage::SaveEmbeddedObject( const std::wstring& fileName, const std::string& data )
{
if (object.bNativeOnly)
{
POLE::Storage * storageOut = new POLE::Storage(fileName.c_str());
if ( (storageOut) && (storageOut->open(true, true)))
{
_UINT32 zero = 0, str_size = 0;
//Ole
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
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
,0x30,0x08,0x02
//,0x0a,0x00,0x03
,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
POLE::Stream oStream1(storageOut, L"\001CompObj", true, 28 + (object.clsid.length() + 5) +
(object.clsid.length() + 5) +
(object.clsid.length() + 5) + 4 * 4);
oStream1.write(dataCompObjHeader, 28);
str_size = object.clsid.length() + 1;
oStream1.write((BYTE*)&str_size, 4);
oStream1.write((BYTE*)object.clsid.c_str(), object.clsid.length());
oStream1.write((BYTE*)&zero, 1);
str_size = object.clsid.length() + 1;
oStream1.write((BYTE*)&str_size, 4);
oStream1.write((BYTE*)object.clsid.c_str(), object.clsid.length());
oStream1.write((BYTE*)&zero, 1);
str_size = object.clsid.length() + 1;
oStream1.write((BYTE*)&str_size, 4);
oStream1.write((BYTE*)object.clsid.c_str(), object.clsid.length());
oStream1.write((BYTE*)&zero, 1);
_UINT32 nUnicodeMarker = 0x71B239F4;
oStream1.write((BYTE*)&nUnicodeMarker, 4);
oStream1.write((BYTE*)&zero, 4); // UnicodeUserType
oStream1.write((BYTE*)&zero, 4); // UnicodeClipboardFormat
oStream1.write((BYTE*)&zero, 4); //
oStream1.flush();
//ObjInfo
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x01,0x00};//{0x00,0x00,0x03,0x00,0x0D,0x00};
POLE::Stream oStream2(storageOut, L"\003ObjInfo", true, 6);
oStream2.write(dataObjInfo, 6);
oStream2.flush();
//Ole10Native
size_t nativeDataSize = object.data.length();
POLE::Stream streamData(storageOut, L"\001Ole10Native", true, nativeDataSize + 4);
streamData.write((BYTE*)&nativeDataSize, 4);
streamData.write((BYTE*)object.data.c_str(), nativeDataSize);
streamData.flush();
storageOut->close();
delete storageOut;
}
}
else
{
NSFile::CFileBinary file;
file.CreateFileW(fileName);
file.WriteFile((BYTE*)object.data.c_str(), (_UINT32)object.data.size());
file.CloseFile();
}
return true;
NSFile::CFileBinary file;
file.CreateFileW(fileName);
file.WriteFile((BYTE*)data.c_str(), (_UINT32)data.size());
file.CloseFile();
return S_OK;
}
bool OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& object )
HRESULT OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure )
{
if (docFile == NULL) return false;
if (docFile == NULL) return S_FALSE;
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL) return false;
if (storageOut == NULL) return S_FALSE;
if (storageOut->open(true, true)==false)
{
delete storageOut;
return false;
return S_FALSE;
}
POLE::Storage *storageInp = docFile->GetStorage()->GetStorage();
{
POLE::Stream* oleStorage = new POLE::Stream(storageInp, object.objectID);
POLE::Stream* oleStorage = new POLE::Stream(storageInp, oleObjectFileStructure.objectID);
if (oleStorage)
{
std::wstring path = L"ObjectPool/" + object.objectID;
std::wstring path = L"ObjectPool/" + oleObjectFileStructure.objectID;
std::list<std::wstring> entries = storageInp->entries_with_prefix(path);
for (std::list<std::wstring>::iterator it = entries.begin(); it != entries.end(); ++it)
@ -267,7 +201,7 @@ namespace DocFileFormat
storageOut->close();
delete storageOut;
return true;
return S_OK;
}
void OpenXmlPackage::RegisterDocPr()
{

View File

@ -102,16 +102,17 @@ namespace DocFileFormat
struct OleObjectFileStructure
{
bool bNativeOnly = false;
std::wstring ext;
std::wstring objectID;
std::wstring clsid;
std::string data;
OleObjectFileStructure(){}
OleObjectFileStructure( const std::wstring& _ext, const std::wstring& _objectID, const std::wstring&/*REFCLSID*/ _clsid ):
ext(_ext), objectID(_objectID), clsid(_clsid){}
ext(_ext), objectID(_objectID), clsid(_clsid){}
};
@ -161,8 +162,8 @@ namespace DocFileFormat
void SaveToFile( const std::wstring& outputDir, const std::wstring& fileName, const std::wstring& XMLContent );
void SaveToFile( const std::wstring& outputDir, const std::wstring& fileName, const void* buf, unsigned int size );
bool SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
bool SaveEmbeddedObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveOLEObject ( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
void RegisterDocPr();
void RegisterDocument();

View File

@ -52,40 +52,38 @@ namespace DocFileFormat
//so used another bit setting
if ( size == 12 )
{
unsigned short nFlag = FormatUtils::BytesToInt16( bytes, 0, size );
if ( fTtpMode )
{
fSpare = FormatUtils::BitmaskToBool( nFlag, 0x0001 );
fUnk = FormatUtils::BitmaskToBool( nFlag, 0x0002 );
dcpTtpNext = nFlag;
fSpare = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
dcpTtpNext = FormatUtils::BytesToInt16( bytes, 0, size );
dxaCol = FormatUtils::BytesToInt32( bytes, 4, size );
dymTableHeight = FormatUtils::BytesToInt32( bytes, 8, size );
}
else
{
fVolatile = FormatUtils::BitmaskToBool( nFlag, 0x0001 );
fUnk = FormatUtils::BitmaskToBool( nFlag, 0x0002 );
fDiffLines = FormatUtils::BitmaskToBool( nFlag, 0x0004 );
clMac = nFlag& 0x00FF;
fVolatile = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
fDiffLines = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0004 );
clMac = FormatUtils::BytesToUInt16( bytes, 0, size ) & 0x00FF;
dxaCol = FormatUtils::BytesToInt32( bytes, 4, size );
dymLine = FormatUtils::BytesToInt32( bytes, 8, size );
dymHeight = dymLine;
dymHeight = FormatUtils::BytesToInt32( bytes, 8, size );
}
}
else if (size == 6)
{
unsigned short nFlag = FormatUtils::BytesToInt16( bytes, 0, size );
fVolatile = FormatUtils::BitmaskToBool( nFlag, 0x0001 );
fUnk = FormatUtils::BitmaskToBool( nFlag, 0x0002 );
fDiffLines = FormatUtils::BitmaskToBool( nFlag, 0x0004 );
clMac = nFlag & 0x000F;
fVolatile = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
fDiffLines = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0004 );
clMac = FormatUtils::BytesToUChar( bytes, 0, size ) & 0x000F;
dxaCol = FormatUtils::BytesToInt16( bytes, 2, size );
dymLine = FormatUtils::BytesToInt16( bytes, 4, size );
dymHeight = dymLine;
dymHeight = FormatUtils::BytesToInt16( bytes, 4, size );
}
}
/*========================================================================================================*/

View File

@ -492,7 +492,7 @@ namespace DocFileFormat
pos++;
for( int i = 0; i < itbdDelMax; i++ )
for( int i=0; i < itbdDelMax; i++ )
{
XMLTools::XMLElement tab( L"w:tab" );

View File

@ -34,233 +34,51 @@
namespace DocFileFormat
{
ParagraphPropertyExceptions::ParagraphPropertyExceptions( unsigned char* bytes, int size, POLE::Stream* dataStream, int nWordVersion):
PropertyExceptions( ( bytes + 2 ), ( size - 2 ), nWordVersion)
{
if (size < 1) return;
ParagraphPropertyExceptions::ParagraphPropertyExceptions( unsigned char* bytes, int size, POLE::Stream* dataStream, bool oldVersion):
PropertyExceptions( ( bytes + 2 ), ( size - 2 ), oldVersion)
{
if ( size != 0 )
{
istd = FormatUtils::BytesToUInt16( bytes, 0, size );
}
if (nWordVersion > 1)
{
istd = bytes[0];
VirtualStreamReader *reader = NULL;
ReadExceptions(bytes + 7, size - 7, nWordVersion);
//There is a SPRM that points to an offset in the data stream,
//where a list of SPRM is saved.
for ( std::list<SinglePropertyModifier>::iterator iter = grpprl->begin(); iter != grpprl->end(); iter++ )
{
SinglePropertyModifier sprm( *iter );
if( ( sprm.OpCode == sprmPHugePapx ) || ( (int)sprm.OpCode == 0x6646 ) )
{
unsigned int fc = FormatUtils::BytesToUInt32( sprm.Arguments, 0, sprm.argumentsSize );
reader = new VirtualStreamReader( dataStream, (int)fc, oldVersion);
//parse the size of the external grpprl
unsigned char* sizebytes = reader->ReadBytes( 2, true );
unsigned int grpprlsize = FormatUtils::BytesToUInt16( sizebytes, 0, 2 );
RELEASEARRAYOBJECTS( sizebytes );
// RELEASEOBJECT( grpprl );
// grpprl = new std::list<SinglePropertyModifier>();
//
// MemoryStream oStream(bytes, size);
// int pos = 1;
// if (pos + 1 > size) return;
// unsigned char jc = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPJc, 1, (BYTE*)&jc));
// if (pos + 1 > size) return;
// unsigned char fSideBySide = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPFSideBySide, 1, (BYTE*)&fSideBySide));
//parse the external grpprl
unsigned char* grpprlBytes = reader->ReadBytes( grpprlsize, true );
// if (pos + 1 > size) return;
// unsigned char fKeep = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPFKeep, 1, (BYTE*)&fKeep));
PropertyExceptions externalPx( grpprlBytes, grpprlsize, oldVersion );
// if (pos + 1 > size) return;
// unsigned char fKeepFollow = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPFKeepFollow, 1, (BYTE*)&fKeepFollow));
// if (pos + 1 > size) return;
// unsigned char fPageBreakBefore = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 1, (BYTE*)&fPageBreakBefore));
//
// if (pos + 1 > size) return;
// unsigned char flag = oStream.ReadByte(); pos += 1;
// unsigned char pcVert = GETBITS(flag, 4, 5);
// unsigned char pcHorz = GETBITS(flag, 6, 7);
// //grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 1, &fPageBreakBefore));
// //grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 1, &fPageBreakBefore));
// if (pos + 1 > size) return;
// unsigned char brcp = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcp, 1, (BYTE*)&brcp));
//
// if (pos + 1 > size) return;
// unsigned char brcl = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcl, 1, (BYTE*)&brcl));
// if (pos + 1 > size) return;
// unsigned char nfcSeqNumb = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 1, (BYTE*)&nfcSeqNumb));
//
// if (pos + 1 > size) return;
// unsigned char nnSeqNumb = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPNLvlAnm, 1, (BYTE*)&nnSeqNumb));
//
// if (pos + 2 > size) return;
// unsigned short dxaRight = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDxaRight, 2, (BYTE*)&dxaRight));
//
// if (pos + 2 > size) return;
// unsigned short dxaLeft = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDxaLeft, 2, (BYTE*)&dxaLeft));
//
// if (pos + 2 > size) return;
// unsigned short dxaLeft1 = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDxaLeft1, 2, (BYTE*)&dxaLeft1));
//
// if (pos + 2 > size) return;
// unsigned short dyaLine = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDyaLine, 2, (BYTE*)&dyaLine));
//
// if (pos + 2 > size) return;
// unsigned short dyaBefore = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDyaBefore, 2, (BYTE*)&dyaBefore));
//
// if (pos + 2 > size) return;
// unsigned short dyaAfter = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDyaAfter, 2, (BYTE*)&dyaAfter));
////phe - 6
// if (pos + 6 > size) return;
//
// //oStream.ReadUInt16();
// //oStream.ReadUInt16();
// //oStream.ReadUInt16();
// if (pos + 1 > size) return;
// unsigned char fInTable = oStream.ReadUInt16(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPFInTable, 1, (BYTE*)&fInTable));
//
// if (pos + 1 > size) return;
// unsigned char fTtp = oStream.ReadUInt16(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPTtp, 1, (BYTE*)&fTtp));
//
// if (pos + 2 > size) return;
// unsigned short ptap = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 2, (BYTE*)&ptap));
// if (pos + 2 > size) return;
// unsigned short dxaAbs = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDxaAbs, 2, (BYTE*)&dxaAbs));
//
// if (pos + 2 > size) return;
// unsigned short dyaAbs = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDyaAbs, 2, (BYTE*)&dyaAbs));
// if (pos + 2 > size) return;
// unsigned short dxaWidth = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPDxaWidth, 2, (BYTE*)&dxaWidth));
//
// if (pos + 2 > size) return;
// unsigned short brcTop = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcTop10, 2, (BYTE*)&brcTop));
//
// if (pos + 2 > size) return;
// unsigned short brcLeft = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcLeft10, 2, (BYTE*)&brcLeft));
//
// if (pos + 2 > size) return;
// unsigned short brcBottom = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcBottom10, 2, (BYTE*)&brcBottom));
//
// if (pos + 2 > size) return;
// unsigned short brcRight = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcRight10, 2, (BYTE*)&brcRight));
// if (pos + 2 > size) return;
// unsigned short brcBetween = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcBetween10, 2, (BYTE*)&brcBetween));
//
// if (pos + 2 > size) return;
// unsigned short brcBar = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPBrcBar10, 2, (BYTE*)&brcBar));
//
// if (pos + 2 > size) return;
// unsigned short dxaFromText = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPPageBreakBefore, 2, (BYTE*)&dxaFromText));
//
// if (pos + 2 > size) return;
// unsigned short dyaFromText = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPFromText10, 2, (BYTE*)&dyaFromText));
//
// if (pos + 1 > size) return;
// unsigned char wr = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmOldPWr, 1, &wr));
//
// if (pos + 1 > size) return;
// unsigned char zz = oStream.ReadByte(); pos += 1;
//
// if (pos + 1 > size) return;
// unsigned char fTransparent = oStream.ReadByte(); pos += 1;
//
// if (pos + 1 > size) return;
// unsigned char fBiDi = oStream.ReadByte(); pos += 1;
// grpprl->push_back(SinglePropertyModifier(sprmPFBiDi, 1, &fBiDi));
//
// if (pos + 1 > size) return;
// unsigned char bSpare = oStream.ReadByte(); pos += 1;
//
// if (pos + 2 > size) return;
// unsigned short dyaHeight = oStream.ReadUInt16(); pos += 2;
// unsigned char fMinHeight = GETBIT(dyaHeight, 15);
// dyaHeight = GETBITS(dyaHeight, 0, 14);
// grpprl->push_back(SinglePropertyModifier(sprmOldTDyaRowHeight, 2, (BYTE*)&dyaHeight));
// //grpprl->push_back(SinglePropertyModifier(sprmOldTDyaRowHeight, 1, &fMinHeight));
//
// if (pos + 2 > size) return;
// unsigned short shd = oStream.ReadUInt16(); pos += 2;
// grpprl->push_back(SinglePropertyModifier(sprmOldPShd, 2, (BYTE*)&shd));
// if (pos + 2 > size) return;
// unsigned short itbdMac = oStream.ReadUInt16(); pos += 2;
// if (itbdMac > 0)
// {
// short *tabs = new short[itbdMac + 1];
// for (unsigned short i = 0; i < itbdMac; i++)
// {
// tabs[i + 1] = oStream.ReadUInt16(); pos += 2;
// }
// grpprl->push_back(SinglePropertyModifier(sprmPChgTabs, 2 * (itbdMac + 1), (BYTE*)tabs));
// delete []tabs;
// }
}
else
{
istd = FormatUtils::BytesToUInt16( bytes, 0, size );
VirtualStreamReader *reader = NULL;
//There is a SPRM that points to an offset in the data stream,
//where a list of SPRM is saved.
for ( std::list<SinglePropertyModifier>::iterator iter = grpprl->begin(); iter != grpprl->end(); iter++ )
{
SinglePropertyModifier sprm( *iter );
if( ( sprm.OpCode == sprmPHugePapx ) || ( (int)sprm.OpCode == 0x6646 ) )
{
unsigned int fc = FormatUtils::BytesToUInt32( sprm.Arguments, 0, sprm.argumentsSize );
reader = new VirtualStreamReader( dataStream, (int)fc, nWordVersion);
//parse the size of the external grpprl
unsigned char* sizebytes = reader->ReadBytes( 2, true );
unsigned int grpprlsize = FormatUtils::BytesToUInt16( sizebytes, 0, 2 );
RELEASEARRAYOBJECTS( sizebytes );
//parse the external grpprl
unsigned char* grpprlBytes = reader->ReadBytes( grpprlsize, true );
PropertyExceptions externalPx( grpprlBytes, grpprlsize, nWordVersion );
//assign the external grpprl
RELEASEOBJECT( grpprl );
grpprl = new std::list<SinglePropertyModifier>( *(externalPx.grpprl) );
//remove the sprmPHugePapx
grpprl->remove( sprm );
RELEASEARRAYOBJECTS( grpprlBytes );
RELEASEOBJECT( reader )
break;
}
}
//assign the external grpprl
RELEASEOBJECT( grpprl );
grpprl = new std::list<SinglePropertyModifier>( *(externalPx.grpprl) );
//remove the sprmPHugePapx
grpprl->remove( sprm );
RELEASEARRAYOBJECTS( grpprlBytes );
RELEASEOBJECT( reader )
break;
}
}
}
}

View File

@ -59,6 +59,6 @@ namespace DocFileFormat
}
/// Parses the bytes to retrieve a PAPX
ParagraphPropertyExceptions( unsigned char* bytes, int size, POLE::Stream* dataStream, int nWordVersion);
ParagraphPropertyExceptions( unsigned char* bytes, int size, POLE::Stream* dataStream, bool oldVersion);
};
}

View File

@ -44,7 +44,7 @@
namespace DocFileFormat
{
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
PictureDescriptor::PictureDescriptor(CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, int nWordVersion)
PictureDescriptor::PictureDescriptor(CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, bool oldVersion)
:
dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), mfp(), dxaCropLeft(0), dyaCropTop(0),
dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0),
@ -55,7 +55,7 @@ namespace DocFileFormat
if ( fc >= 0 )
{
parse( stream, fc, size, nWordVersion);
parse( stream, fc, size, oldVersion);
}
}
PictureDescriptor::PictureDescriptor()
@ -82,11 +82,11 @@ namespace DocFileFormat
RELEASEARRAYOBJECTS(embeddedData);
RELEASEARRAYOBJECTS(embeddedDataHeader);
}
void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz, int nWordVersion)
void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz, bool oldVersion)
{
Clear();
VirtualStreamReader reader(stream, fc, nWordVersion);
VirtualStreamReader reader(stream, fc, oldVersion);
int sz_stream = reader.GetSize();
@ -136,7 +136,7 @@ namespace DocFileFormat
int brcl = reader.ReadInt16();
// borders
int bytesCount = (nWordVersion > 0) ? 2 : 4;
int bytesCount = oldVersion ? 2 : 4;
bytes = reader.ReadBytes( bytesCount, true );
brcTop = new BorderCode( bytes, bytesCount );
@ -158,7 +158,7 @@ namespace DocFileFormat
dyaOrigin = reader.ReadInt16();
int pos_end = reader.GetPosition();
if (nWordVersion > 0)
if (oldVersion)
{
int flag = brcl;

View File

@ -83,16 +83,16 @@ namespace DocFileFormat
public:
// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
PictureDescriptor ( );
PictureDescriptor ( CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, int nWordVersion);
PictureDescriptor ( CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, bool oldVersion);
virtual ~PictureDescriptor();
void parse( POLE::Stream* stream, int fc, int sz, int nWordVersion);
void parse( POLE::Stream* stream, int fc, int sz, bool oldVersion);
private:
// Returns the fcPic into the "data" stream, where the PIC begins.
// Returns -1 if the CHPX has no fcPic.
static int GetFcPic( const CharacterPropertyExceptions* chpx );
private:
void Clear();

View File

@ -43,18 +43,18 @@ namespace DocFileFormat
friend class TextboxMapping;
protected:
int CP_LENGTH;
static const int CP_LENGTH = 4;
std::vector<int> CharacterPositions;
std::vector<ByteStructure*> Elements;
bool m_bIsValid;
public:
Plex(int structureLength, POLE::Stream* stream, unsigned int fc, unsigned int lcb, int nWordVersion)
: m_bIsValid(false), CP_LENGTH(/*nWordVersion == 2 ? 2 :*/ 4)
Plex(int structureLength, POLE::Stream* stream, unsigned int fc, unsigned int lcb, bool oldVersion)
: m_bIsValid(false)
{
if ((lcb > 0) && (NULL != stream))
{
VirtualStreamReader reader(stream, (ULONG)fc, nWordVersion);
VirtualStreamReader reader(stream, (ULONG)fc, oldVersion);
if (fc > reader.GetSize()) return;

View File

@ -34,8 +34,8 @@
namespace DocFileFormat
{
std::map<unsigned char, std::wstring> PropertiesMapping::brcTypeMap;
NSCriticalSection::CRITICAL_SECTION_SMART PropertiesMapping::brcTypeMapLock;
std::map<unsigned char, std::wstring> PropertiesMapping::brcTypeMap;
OfficeCriticalSection PropertiesMapping::brcTypeMapLock;
void PropertiesMapping::init()
{

View File

@ -39,7 +39,8 @@
#include "ShadingDescriptor.h"
#include "SinglePropertyModifier.h"
#include "../../DesktopEditor/graphics/TemporaryCS.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h" //for linux make inside
namespace DocFileFormat
{
@ -74,7 +75,7 @@ namespace DocFileFormat
XMLTools::CStringXmlWriter* m_pXmlWriter;
static std::map<unsigned char, std::wstring> brcTypeMap;
static NSCriticalSection::CRITICAL_SECTION_SMART brcTypeMapLock;
static std::map<unsigned char, std::wstring> brcTypeMap;
static OfficeCriticalSection brcTypeMapLock;
};
}

View File

@ -38,31 +38,22 @@ namespace DocFileFormat
{
PropertyExceptions::~PropertyExceptions()
{
RELEASEOBJECT( grpprl );
RELEASEOBJECT( this->grpprl );
}
PropertyExceptions::PropertyExceptions() : grpprl(NULL)
PropertyExceptions::PropertyExceptions(): grpprl(NULL)
{
grpprl = new std::list<SinglePropertyModifier>();
this->grpprl = new std::list<SinglePropertyModifier>();
}
PropertyExceptions::PropertyExceptions( const std::list<SinglePropertyModifier>& _grpprl ) : grpprl(NULL)
PropertyExceptions::PropertyExceptions( const std::list<SinglePropertyModifier>& grpprl )
{
grpprl = new std::list<SinglePropertyModifier>( _grpprl );
this->grpprl = new std::list<SinglePropertyModifier>( grpprl );
}
PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, int nWordVersion ) : grpprl(NULL)
PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool oldVersion ) : grpprl(NULL)
{
if (nWordVersion >= 2)//word 2.0 or 1.0
return;
ReadExceptions(bytes, size, nWordVersion);
}
void PropertyExceptions::ReadExceptions(unsigned char* bytes, int size, int nWordVersion)
{
RELEASEOBJECT( grpprl );
grpprl = new std::list<SinglePropertyModifier>();
this->grpprl = new std::list<SinglePropertyModifier>();
if ( ( bytes == NULL ) || ( size == 0 ) ) return;
@ -71,28 +62,24 @@ namespace DocFileFormat
int sprmStart = 0;
bool goOn = true;
int opCodeSize = (nWordVersion > 0) ? 1 : 2;
int opCodeSize = (oldVersion ? 1 : 2);
while ( goOn )
{
if ( ( sprmStart + opCodeSize ) <= size )
if ( ( sprmStart + opCodeSize ) < size )
{
unsigned short code = (nWordVersion > 0) ? FormatUtils::BytesToUChar ( bytes, sprmStart, size ) :
FormatUtils::BytesToUInt16 ( bytes, sprmStart, size ) ;
unsigned short code = oldVersion ? FormatUtils::BytesToUChar ( bytes, sprmStart, size ) :
FormatUtils::BytesToUInt16 ( bytes, sprmStart, size ) ;
OperationCode opCode = (OperationCode)(nWordVersion == 2 ? OpCode93To95[code] : code);
if (nWordVersion > 0 && opCode == 0)
if (oldVersion && code == 0)
{
sprmStart++;
continue;
}
//if (nWordVersion == 2)
// bytes[sprmStart]= (unsigned char)opCode;
}
OperationCode opCode = (OperationCode)code;
short opSize = -1;
if (nWordVersion > 0)
if (oldVersion)
{
opSize = (short)SinglePropertyModifier::GetOldOperandSize( (unsigned char)opCode );
}
@ -155,32 +142,25 @@ namespace DocFileFormat
}
}
if (opSize < 0)
{
break;
}
//length is 2byte for the opCode, lenByte for the length, opSize for the length of the operand
int sprmBytesSize = opCodeSize + lenByte + opSize;
unsigned char* sprmBytes = NULL;
sprmBytes = new unsigned char[sprmBytesSize];
//if ( size >= ( sprmStart + sprmBytesSize ) )
if ( size >= ( sprmStart + sprmBytesSize ) )
{
int sz = (std::min)(sprmBytesSize, size - sprmStart);
memcpy( sprmBytes, ( bytes + sprmStart ), sprmBytesSize );
memcpy( sprmBytes, ( bytes + sprmStart ), sz );
SinglePropertyModifier sprm( sprmBytes, sz, nWordVersion);
SinglePropertyModifier sprm( sprmBytes, sprmBytesSize, oldVersion );
grpprl->push_back( sprm );
sprmStart += sz;
sprmStart += sprmBytesSize;
}
else
{
goOn = false;
}
//else
//{
// goOn = false;
//}
RELEASEARRAYOBJECTS( sprmBytes );
}

View File

@ -33,7 +33,6 @@
#include "IVisitable.h"
#include "SinglePropertyModifier.h"
#include "MemoryStream.h"
#include <list>
@ -49,8 +48,6 @@ namespace DocFileFormat
virtual ~PropertyExceptions();
PropertyExceptions();
PropertyExceptions( const std::list<SinglePropertyModifier>& grpprl );
PropertyExceptions( unsigned char* bytes, int size, int nWordVersion );
void ReadExceptions( unsigned char* bytes, int size, int nWordVersion );
PropertyExceptions( unsigned char* bytes, int size, bool oldVersion );
};
}

View File

@ -48,13 +48,8 @@ namespace DocFileFormat
RevisionData::RevisionData( CharacterPropertyExceptions* chpx ) : Dttm(), Isbt(0), Type(NoRevision), Changes(NULL), RsidDel(0), RsidProp(0), Rsid(0)
{
if (!chpx) return;
if (!chpx->grpprl)
return;
bool collectRevisionData = true;
Changes = new std::list<SinglePropertyModifier>();
this->Changes = new std::list<SinglePropertyModifier>();
for ( std::list<SinglePropertyModifier>::iterator iter = chpx->grpprl->begin(); iter != chpx->grpprl->end(); iter++ )
{

View File

@ -41,22 +41,19 @@ namespace DocFileFormat
friend class WordDocument;
private:
static const int SED_LENGTH = 12;
short fn;
short fnMpr;
int fcMpr;
/// A signed integer that specifies the position in the WordDocument Stream where a Sepx structure is located.
int fcSepx;
static const int STRUCTURE_SIZE = 12;
static const int STRUCTURE_SIZE_OLD = 6;
public:
static const int GetSize(int nWordVersion)
{
return (nWordVersion == 2) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
SectionDescriptor() : fn(0), fnMpr(0), fcMpr(0), fcSepx(0)
{
}
static const int STRUCTURE_SIZE = 12;
SectionDescriptor()
{
}
virtual ~SectionDescriptor()
{
@ -66,20 +63,10 @@ namespace DocFileFormat
{
SectionDescriptor *newObject = new SectionDescriptor();
if (reader->nWordVersion == 2)
{
newObject->fn = reader->ReadInt16();
newObject->fcSepx = reader->ReadInt32();
//newObject->fnMpr = reader->ReadInt16();
//newObject->fcMpr = reader->ReadInt16();
}
else
{
newObject->fn = reader->ReadInt16();
newObject->fcSepx = reader->ReadInt32();
newObject->fnMpr = reader->ReadInt16();
newObject->fcMpr = reader->ReadInt32();
}
newObject->fn = reader->ReadInt16();
newObject->fcSepx = reader->ReadInt32();
newObject->fnMpr = reader->ReadInt16();
newObject->fcMpr = reader->ReadInt32();
return static_cast<ByteStructure*>( newObject );
}

View File

@ -98,11 +98,11 @@ namespace DocFileFormat
XMLTools::XMLElement endnotePr (L"w:endnotePr");
XMLTools::XMLElement pgNumType (L"w:pgNumType");
HeaderAndFooterTable* pTable = _ctx->_doc->headerAndFooterTable;
HeaderAndFooterTable* pTable = _ctx->_doc->headerAndFooterTable;
if (pTable)
{
unsigned char fHF = _ctx->_doc->nWordVersion == 0 ? 255 : 0; //all headers & footers
unsigned char fHF = 255; //all headers & footers
for (std::list<SinglePropertyModifier>::iterator iter = sepx->grpprl->begin(); iter != sepx->grpprl->end(); ++iter)
{
switch (iter->OpCode)
@ -132,29 +132,17 @@ namespace DocFileFormat
}break;
}
}
if (_ctx->_doc->nWordVersion == 2)
{
if (GETBIT(fHF, 0)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"headerReference"), std::wstring(L"even"));
if (GETBIT(fHF, 1)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"headerReference"), std::wstring(L"default"));
if (GETBIT(fHF, 2)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"footerReference"), std::wstring(L"even"));
if (GETBIT(fHF, 3)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"footerReference"), std::wstring(L"default"));
if (GETBIT(fHF, 4)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"headerReference"), std::wstring(L"first"));
if (GETBIT(fHF, 5)) WriteSectionStory (pTable->GetNextHeaderFooter(), std::wstring(L"footerReference"), std::wstring(L"first"));
}
else
{
// Header
// Header
if (FormatUtils::GetBitFromInt(fHF, 0)) WriteSectionStory (pTable->GetEvenHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"even"));
if (FormatUtils::GetBitFromInt(fHF, 1)) WriteSectionStory (pTable->GetOddHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"default"));
if (FormatUtils::GetBitFromInt(fHF, 4)) WriteSectionStory (pTable->GetFirstHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"first"));
if (FormatUtils::GetBitFromInt(fHF, 0)) WriteSectionStory (pTable->GetEvenHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"even"));
if (FormatUtils::GetBitFromInt(fHF, 1)) WriteSectionStory (pTable->GetOddHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"default"));
if (FormatUtils::GetBitFromInt(fHF, 4)) WriteSectionStory (pTable->GetFirstHeaders (m_nSelectProperties), std::wstring(L"headerReference"), std::wstring(L"first"));
// Footer
// Footer
if (FormatUtils::GetBitFromInt(fHF, 2)) WriteSectionStory (pTable->GetEvenFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"even"));
if (FormatUtils::GetBitFromInt(fHF, 3)) WriteSectionStory (pTable->GetOddFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"default"));
if (FormatUtils::GetBitFromInt(fHF, 5)) WriteSectionStory (pTable->GetFirstFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"first"));
}
if (FormatUtils::GetBitFromInt(fHF, 2)) WriteSectionStory (pTable->GetEvenFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"even"));
if (FormatUtils::GetBitFromInt(fHF, 3)) WriteSectionStory (pTable->GetOddFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"default"));
if (FormatUtils::GetBitFromInt(fHF, 5)) WriteSectionStory (pTable->GetFirstFooters (m_nSelectProperties), std::wstring(L"footerReference"), std::wstring(L"first"));
}
//MUST be ignored if the section does not have page number restart enabled.([MS-DOC] — v20101113. стр 152)
@ -228,10 +216,7 @@ namespace DocFileFormat
case sprmOldSBOrientation:
case sprmSBOrientation:
//orientation
if (_ctx->_doc->nWordVersion == 2)
appendValueAttribute( &pgSz, L"w:orient", FormatUtils::MapValueToWideString( iter->Arguments[0] + 1, &PageOrientationMap[0][0], 3, 10 ) );
else
appendValueAttribute( &pgSz, L"w:orient", FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ) );
appendValueAttribute( &pgSz, L"w:orient", FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ) );
break;
//paper source

View File

@ -39,13 +39,9 @@ namespace DocFileFormat
{
public:
/// Parses the bytes to retrieve a SectionPropertyExceptions
SectionPropertyExceptions( unsigned char* bytes, int size, int nWordVersion ):
PropertyExceptions( bytes, size, nWordVersion ), isBidi(false)
SectionPropertyExceptions( unsigned char* bytes, int size, bool oldVersion ):
PropertyExceptions( bytes, size, oldVersion ), isBidi(false)
{
if (nWordVersion >= 2)
{
ReadExceptions(bytes, size, nWordVersion);
}
for ( std::list<SinglePropertyModifier>::iterator iter = grpprl->begin(); iter != grpprl->end(); iter++ )
{
SinglePropertyModifier sprm( *iter );

View File

@ -56,7 +56,7 @@ namespace DocFileFormat
//zoom
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved > 0 ? dop->wScaleSaved : 100 ) );
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved ) );
if ( dop->zkSaved != 0 )
{

View File

@ -36,27 +36,21 @@
namespace DocFileFormat
{
SinglePropertyModifier::SinglePropertyModifier(OperationCode opCode, int argumentsSize, unsigned char* arguments) :
Arguments(NULL), OpCode(opCode), fSpec(false), Type(PAP), argumentsSize(argumentsSize), nWordVersion (2)
SinglePropertyModifier::SinglePropertyModifier( bool oldVersion_) :
Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0), oldVersion (oldVersion_)
{
Arguments = new unsigned char[argumentsSize];
memcpy(Arguments, arguments, argumentsSize);
}
SinglePropertyModifier::SinglePropertyModifier(unsigned char* bytes, int size, int nWordVersion_) :
Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0), nWordVersion (nWordVersion_)
SinglePropertyModifier::SinglePropertyModifier(unsigned char* bytes, int size, bool oldVersion_) :
Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0), oldVersion (oldVersion_)
{
unsigned char opSize = 0;
unsigned char opCodeSize = 0;
if (nWordVersion > 0)
if (oldVersion)
{
opCodeSize = 1;
//first 1 byte are the operation code ...
unsigned char code = FormatUtils::BytesToUChar( bytes, 0, size );
OpCode = (OperationCode)(nWordVersion == 2 ? OpCode93To95[code] : code);
OpCode = (OperationCode)FormatUtils::BytesToUChar( bytes, 0, size );
if (OpCode == 0 && size == 4)
{
//так записывается rgb цвет (
@ -138,12 +132,9 @@ namespace DocFileFormat
}
else
{
argumentsSize = (std::min)(size - opCodeSize, (int)opSize);
if (argumentsSize > 0)
{
Arguments = new unsigned char[argumentsSize];
memcpy( Arguments, ( bytes + opCodeSize ), argumentsSize );
}
argumentsSize = opSize;
Arguments = new unsigned char[argumentsSize];
memcpy( Arguments, ( bytes + opCodeSize ), argumentsSize );
}
}
@ -151,13 +142,13 @@ namespace DocFileFormat
{
if ( spm.Arguments != NULL )
{
argumentsSize = spm.argumentsSize;
argumentsSize = spm.argumentsSize;
Arguments = new unsigned char[argumentsSize];
memcpy( Arguments, spm.Arguments, argumentsSize );
fSpec = spm.fSpec;
OpCode = spm.OpCode;
OpCode = spm.OpCode;
Type = spm.Type;
nWordVersion = spm.nWordVersion;
oldVersion = spm.oldVersion;
}
}
@ -189,7 +180,7 @@ namespace DocFileFormat
fSpec = spm.fSpec;
Type = spm.Type;
argumentsSize = spm.argumentsSize;
nWordVersion = spm.nWordVersion;
oldVersion = spm.oldVersion;
Arguments = new unsigned char[argumentsSize];

View File

@ -45,16 +45,10 @@ namespace DocFileFormat
TAP = 5
} SprmType;
static const int OpCode93To95[] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 65, 66, 67, 0, 82, 83, 0, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 0, 0x085C, 0x085D, 0x4A5E, 0x485F, 0x4A60, 0x4A61, 0x085A, 0, 0, 0, 0, 0, 0, 0, 119, 120, 121, 122, 123, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x322A, 0, 0x3228, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 182, 183, 184, 0x560B, 0, 0, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 208,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
class SinglePropertyModifier
{
public:
int nWordVersion;
bool oldVersion;
/// The operation code identifies the property of the
/// PAP/CHP/PIC/SEP/TAP which sould be modified
OperationCode OpCode;
@ -67,11 +61,10 @@ namespace DocFileFormat
/// The Arguments size
unsigned int argumentsSize;
SinglePropertyModifier( int nWordVersion);
SinglePropertyModifier(bool oldVersion);
/// parses the unsigned char to retrieve a SPRM
SinglePropertyModifier( unsigned char* bytes, int size, int nWordVersion );
SinglePropertyModifier( unsigned char* bytes, int size, bool oldVersion );
SinglePropertyModifier( const SinglePropertyModifier& spm);
SinglePropertyModifier( OperationCode opCode, int argumentsSize, unsigned char* arguments);
bool operator == ( const SinglePropertyModifier& spm ) const;
bool operator != ( const SinglePropertyModifier& spm ) const;

View File

@ -69,7 +69,7 @@ namespace DocFileFormat
short cb_primitive = reader->ReadInt16();
if ((cb_primitive < 1) || (pos + cb_primitive > length))
if (pos + cb_primitive > length)
{
reader->Seek(reader->GetPosition() - 4, 0);
break;
@ -100,7 +100,7 @@ namespace DocFileFormat
Spa* pSpa = new Spa();
if (!pSpa) return NULL;
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{
int fc = reader->ReadInt32();
pSpa->cTxbx = reader->ReadUInt16();

View File

@ -54,9 +54,9 @@ namespace DocFileFormat
static const int STRUCTURE_SIZE = 26;
static const int STRUCTURE_SIZE_OLD = 6;
static const int GetSize(int nWordVersion)
static const int GetSize(bool bOldVersion)
{
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
return bOldVersion ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
Spa();

View File

@ -71,12 +71,12 @@ namespace DocFileFormat
parse( reader, (unsigned int)reader->GetPosition() );
}
StringTable( POLE::Stream* tableStream, unsigned int fc, unsigned int lcb, int nWordVersion ) :
StringTable( POLE::Stream* tableStream, unsigned int fc, unsigned int lcb, bool older ) :
code_page(1250), fExtend(false), cbData(0), cbExtra(0)
{
if ( lcb > 0 )
{
VirtualStreamReader reader( tableStream, fc, nWordVersion);
VirtualStreamReader reader( tableStream, fc, older);
parse( &reader, fc, lcb ) ;
}
@ -123,37 +123,25 @@ namespace DocFileFormat
//read cData
long cDataStart = reader->GetPosition();
unsigned short cb = 0, elem_sz = 0;
//if (reader->nWordVersion == 2)
//{
// unsigned char * bytes = reader->ReadBytes(lcb, true);
// reader->Seek( (int)fc, 0/*STREAM_SEEK_SET*/ );
// delete []bytes;
//}
unsigned short c = reader->ReadUInt16();
if (reader->nWordVersion > 0)
if ( c != 0xFFFF )
{
cb = reader->ReadUInt16();
this->cbData = cb; // all size
}
else if (reader->nWordVersion == 0)
{
cb = reader->ReadUInt16();
if ( cb != 0xFFFF )
{
count_elements = cb;
}
if (reader->olderVersion)
this->cbData = (int)c; // all size
else
{
//cData is a 4byte signed Integer, so we need to seek back
reader->Seek( (int)( fc + cDataStart ), 0/*STREAM_SEEK_SET*/ );
this->cbData = reader->ReadInt32();
}
count_elements = c;
}
else
{
//cData is a 4byte signed Integer, so we need to seek back
reader->Seek( (int)( fc + cDataStart ), 0/*STREAM_SEEK_SET*/ );
this->cbData = reader->ReadInt32();
}
//read cbExtra
if (reader->nWordVersion == 0)
if (reader->olderVersion == false)
{
this->cbExtra = reader->ReadUInt16();
}

View File

@ -54,164 +54,43 @@ namespace DocFileFormat
/// Parses the streams to retrieve a StyleSheet.
StyleSheet::StyleSheet (FileInformationBlock* fib, POLE::Stream* tableStream, POLE::Stream* dataStream) : stshi(NULL), Styles(NULL)
{
VirtualStreamReader tableReader( tableStream, fib->m_FibWord97.fcStshf, fib->m_nWordVersion);
VirtualStreamReader tableReader( tableStream, fib->m_FibWord97.fcStshf, fib->m_bOlderVersion);
short cbStshi = fib->m_FibWord97.lcbStshf;
//unsigned char* test = tableReader.ReadBytes( cbStshi, true );
//read size of the STSHI
int stshiLengthBytesSize = 2;
unsigned char* stshiLengthBytes = tableReader.ReadBytes( stshiLengthBytesSize, true );
short cbStshi = FormatUtils::BytesToInt16( stshiLengthBytes, 0, stshiLengthBytesSize );
RELEASEARRAYOBJECTS( stshiLengthBytes );
//read the bytes of the STSHI
tableReader.Seek( ( fib->m_FibWord97.fcStshf + 2 ), 0/*STREAM_SEEK_SET*/ );
unsigned char* stshi = tableReader.ReadBytes( cbStshi, true );
//parses STSHI
this->stshi = new StyleSheetInformation( stshi, cbStshi );
RELEASEARRAYOBJECTS( stshi );
//create list of STDs
Styles = new std::vector<StyleSheetDescription*>();
if (fib->m_nWordVersion < 2)
for ( int i = 0; i < this->stshi->cstd; i++ )
{
//read size of the STSHI
int stshiLengthBytesSize = 2;
unsigned char* stshiLengthBytes = tableReader.ReadBytes( stshiLengthBytesSize, true );
short cbStshi = FormatUtils::BytesToInt16( stshiLengthBytes, 0, stshiLengthBytesSize );
RELEASEARRAYOBJECTS( stshiLengthBytes );
//read the bytes of the STSHI
tableReader.Seek( ( fib->m_FibWord97.fcStshf + 2 ), 0/*STREAM_SEEK_SET*/ );
unsigned char* stshi = tableReader.ReadBytes( cbStshi, true );
//get the cbStd
unsigned short cbStd = tableReader.ReadUInt16();
//parses STSHI
this->stshi = new StyleSheetInformation( stshi, cbStshi );
RELEASEARRAYOBJECTS( stshi );
for ( int i = 0; i < this->stshi->cstd; i++ )
if ( cbStd != 0 )
{
//get the cbStd
unsigned short cbStd = tableReader.ReadUInt16();
//read the STD bytes
unsigned char* std = tableReader.ReadBytes( cbStd, true );
if ( cbStd != 0 )
{
//read the STD bytes
unsigned char* std = tableReader.ReadBytes( cbStd, true );
//parse the STD bytes
Styles->push_back( new StyleSheetDescription( std, cbStd, (int)this->stshi->cbSTDBaseInFile, dataStream, fib->m_bOlderVersion) );
//parse the STD bytes
Styles->push_back( new StyleSheetDescription( std, cbStd, (int)this->stshi->cbSTDBaseInFile, dataStream, fib->m_nWordVersion) );
RELEASEARRAYOBJECTS( std );
}
else
{
Styles->push_back( NULL );
}
RELEASEARRAYOBJECTS( std );
}
}
else
{
unsigned short i, sz = 0;
tableReader.ReadUInt16();
unsigned short sz_names = tableReader.ReadUInt16();
sz = 2;
while(sz < sz_names)
else
{
unsigned short sz_name = tableReader.ReadByte(); sz++;
StyleSheetDescription* std = new StyleSheetDescription();
if (sz_name != 0 && sz_name < 0xde)
{
//user style
unsigned char *bytes = tableReader.ReadBytes( sz_name, true );
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &std->xstzName, bytes, sz_name, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS( bytes );
}
// ms style
else if (sz_name == 0)
{
//defpr
}
else
{
int ind = 255 - sz_name;
std::wstring names [] = {L"Normal", L"Heading1", L"Heading2", L"Heading3", L"Heading4", L"Heading5", L"Heading6", L"Heading7",
L"Heading8", L"Heading9", L"FootnoteText", L"FootnoteReference", L"Header", L"Footer", L"IndexHeading", L"LineNumber"};
_StyleIdentifier sti[] = {Normal, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Heading7, Heading8, Heading9,
FootnoteText, FootnoteReference, Header, Footer, IndexHeading, LineNumber};
std->sti = sti[ind];
std->xstzName = names[ind];
}
// 0 Normal standard PAP(standard PAP has all fields cleared to 0), standard CHP ( chp.hps = 20, all other fields set to 0).
//
// 255 Normal indent pap.dxaLeft = 720.
///* Heading levels */
// 254 heading 1 pap.dyaBefore = 240 (12 points), chp.fBold = negation of Normal style's chp.fBold, chp.kul = 1 (single underline), chp.hps = 24, chp.ftc = 2 .
// 253 heading 2 pap.dyaBefore = 120 (6 points), chp.fBold = negation of Normal style's chp.fBold, chp.hps = 24, chp.ftc = 2
// 252 heading 3 pap.dxaLeft = 360, chp.fBold = negation of Normal style's chp.fBold, chp.hps = 24;
// 251 heading 4 pap.dxaLeft = 360, chp.kul = 1 (single underline), chp.hps = 24;
// 250 heading 5 pap.dxaLeft = 720, chp.fBold = negation of Normal style's chp.fBold, chp.hps = 20;
// 249 heading 6 pap.dxaLeft = 720, chp.kul = 1 (single underline), chp.hps = 20;
// 248 heading 7 pap.dxaLeft = 720, chp.fItalic = negation of Normal style's chp.fItalic, chp.hps = 20;
// 247 heading 8 pap.dxaLeft = 720, chp.fItalic = negation of Normal style's chp.fItalic, chp.hps = 20;
// 246 heading 9 pap.dxaLeft = 720, chp.fItalic = negation of Normal style's chp.fItalic, chp.hps = 20;
// 245 footnote text chp.hps = 20
// 244 footnote reference chp.hps = 16; hpsPos = 6
// 243 header When running a U.S. system file:
// pap.itbdMac = 2, pap.rgdxaTab[0] = 3 * 1440, pap.rgtbd[0].jc = 1, pap.rgtbd[0].tlc = 0, pap.rgdxaTab[1] = 6* 1440, pap.rgtbd[1].jc = 1, pap.rgtbd[1].tlc = 0;
// When running an International metric system:
// pap.itbdMac = 2, pap.rgdxaTab[0] =3969, pap.rgtbd[0].jc = 1, pap.rgtbd[0].tlc = 0, pap.rgdxaTab[1] = 8504, pap.rgtbd[1].jc = 1, pap.rgtbd[1].tlc = 0;
// 242 footer When running a U.S. system file:
// pap.itbdMac = 2, pap.rgdxaTab[0] = 3 * 1440, pap.rgtbd[0].jc = 1, pap.rgtbd[0].tlc = 0, pap.rgdxaTab[1] = 6* 1440, pap.rgtbd[1].jc = 1, pap.rgtbd[1].tlc = 0;
// When running an International metric system:
// pap.itbdMac = 2, pap.rgdxaTab[0] =3969, pap.rgtbd[0].jc = 1, pap.rgtbd[0].tlc = 0, pap.rgdxaTab[1] = 8504, pap.rgtbd[1].jc = 1, pap.rgtbd[1].tlc = 0;
// 241 index heading same as properties for Normal style (stc == 0)
// 240 line number same as properties for Normal style (stc == 0)
Styles->push_back(std);
sz += sz_name < 0xde ? sz_name : 0;
}
unsigned short sz_chpxs = tableReader.ReadUInt16();
i = 0;
sz = 2;
while(sz < sz_chpxs)
{
unsigned short sz_chpx = tableReader.ReadByte();
sz++;
if (Styles->size() <= i)
{
StyleSheetDescription* std = new StyleSheetDescription();
Styles->push_back(std);
}
if (sz_chpx != 0 && sz_chpx != 255)
{
unsigned char *bytes = tableReader.ReadBytes( sz_chpx, true );
Styles->at(i)->chpx = new CharacterPropertyExceptions( bytes, sz_chpx , fib->m_nWordVersion);
RELEASEARRAYOBJECTS( bytes );
sz += sz_chpx;
}
i++;
}
unsigned short sz_papxs = tableReader.ReadUInt16();
i = 0;
sz = 2;
while(sz < sz_papxs)
{
unsigned short sz_papx = tableReader.ReadByte();
sz++;
if ( sz_papx != 255)
{
unsigned char *bytes = tableReader.ReadBytes( sz_papx, true );
Styles->at(i)->papx = new ParagraphPropertyExceptions( bytes, sz_papx, tableStream, fib->m_nWordVersion );
RELEASEARRAYOBJECTS( bytes );
sz += sz_papx;
}
i++;
}
unsigned short sz_Estcps = tableReader.ReadUInt16();
i = 0;
sz = 2;
while(sz < sz_Estcps)
{
Styles->at(i++)->istdBase = tableReader.ReadByte();
sz += 1;
Styles->push_back( NULL );
}
}
}

View File

@ -35,20 +35,7 @@
namespace DocFileFormat
{
/// Creates an empty STD object
StyleSheetDescription::StyleSheetDescription(): papx(NULL), chpx(NULL), tapx(NULL), sti(User),
fAutoRedef(false),
fHidden(false),
f97LidsSet(false),
fCopyLang(false),
fPersonalCompose(false),
fPersonalReply(false),
fPersonal(false),
fNoHtmlExport(false),
fSemiHidden(false),
fLocked(false),
fInternalUse(false),
stk(paragraph_style),
istdBase(0xffffff), cupx (0), istdNext(0xffffff), bchUpe(0)
StyleSheetDescription::StyleSheetDescription() : papx(NULL), chpx(NULL), tapx(NULL)
{
}
@ -61,8 +48,8 @@ namespace DocFileFormat
}
/// Parses the bytes to retrieve a StyleSheetDescription
StyleSheetDescription::StyleSheetDescription (unsigned char* bytes, int size, int cbStdBase, POLE::Stream* dataStream, int nWordVersion) :
papx(NULL), chpx(NULL), tapx(NULL), sti(User),
StyleSheetDescription::StyleSheetDescription (unsigned char* bytes, int size, int cbStdBase, POLE::Stream* dataStream, bool oldVersion) :
papx(NULL), chpx(NULL), tapx(NULL),
fAutoRedef(false),
fHidden(false),
f97LidsSet(false),
@ -73,9 +60,8 @@ namespace DocFileFormat
fNoHtmlExport(false),
fSemiHidden(false),
fLocked(false),
fInternalUse(false),
stk(paragraph_style),
istdBase(0xffffff), cupx (0), istdNext(0xffffff), bchUpe(0)
fInternalUse(false)
{
//parsing the base (fix part)
@ -146,7 +132,7 @@ namespace DocFileFormat
unsigned char characterCount = bytes[cbStdBase];
int upxOffset = 0;
if (nWordVersion > 0)
if (oldVersion)
{
name = new unsigned char[characterCount];//characters are zero-terminated, so 1 char has 2 bytes:
memcpy( name, ( bytes + cbStdBase + 1 ), ( characterCount ) );
@ -191,21 +177,21 @@ namespace DocFileFormat
{
//todooo не реализовано
//RELEASEOBJECT( tapx );
//tapx = new TablePropertyExceptions( upxBytes, cbUPX, dataStream, nWordVersion);
//tapx = new TablePropertyExceptions( upxBytes, cbUPX, dataStream, oldVersion);
}
break;
case 1:
{
RELEASEOBJECT( papx );
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, nWordVersion);
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, oldVersion);
}
break;
case 2:
{
RELEASEOBJECT( chpx );
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX , nWordVersion);
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX , oldVersion);
}
break;
}
@ -218,14 +204,14 @@ namespace DocFileFormat
case 0:
{
RELEASEOBJECT( papx );
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, nWordVersion );
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, oldVersion );
}
break;
case 1:
{
RELEASEOBJECT( chpx );
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX, nWordVersion);
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX, oldVersion);
}
break;
}
@ -238,7 +224,7 @@ namespace DocFileFormat
case 0:
{
RELEASEOBJECT( papx );
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, nWordVersion );
papx = new ParagraphPropertyExceptions( upxBytes, cbUPX, dataStream, oldVersion );
}
break;
}
@ -251,7 +237,7 @@ namespace DocFileFormat
case 0:
{
RELEASEOBJECT( chpx );
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX, nWordVersion);
chpx = new CharacterPropertyExceptions( upxBytes, cbUPX, oldVersion);
}
break;
}

View File

@ -385,7 +385,7 @@ namespace DocFileFormat
friend class StyleSheetMapping;
friend class CharacterPropertiesMapping;
public:
private:
/// The name of the style
std::wstring xstzName;
/// Invariant style identifier
@ -450,10 +450,11 @@ namespace DocFileFormat
/// If the style doesn't modify table properties, tapx is null.
TablePropertyExceptions* tapx;
public:
/// Creates an empty STD object
StyleSheetDescription();
virtual ~StyleSheetDescription();
/// Parses the bytes to retrieve a StyleSheetDescription
StyleSheetDescription( unsigned char* bytes, int size, int cbStdBase, POLE::Stream* dataStream, int nWordVersion);
StyleSheetDescription( unsigned char* bytes, int size, int cbStdBase, POLE::Stream* dataStream, bool older);
};
}

View File

@ -35,8 +35,7 @@
namespace DocFileFormat
{
/// Parses the bytes to retrieve a StyleSheetInformation
StyleSheetInformation::StyleSheetInformation (unsigned char* bytes, int size) :
cstd(0), cbSTDBaseInFile(0), fStdStylenamesWritten(false), stiMaxWhenSaved(0), istdMaxFixedWhenSaved(0), nVerBuiltInNamesWhenSaved(0), cbLSD(0)
StyleSheetInformation::StyleSheetInformation (unsigned char* bytes, int size)
{
if ((0 != size) || (NULL != bytes))
{

View File

@ -35,8 +35,8 @@
namespace DocFileFormat
{
std::map<std::wstring, std::wstring> StyleSheetMapping::m_mapStyleId;
NSCriticalSection::CRITICAL_SECTION_SMART StyleSheetMapping::m_mapStyleIdLock;
std::map<std::wstring, std::wstring> StyleSheetMapping::m_mapStyleId;
OfficeCriticalSection StyleSheetMapping::m_mapStyleIdLock;
StyleSheetMapping::StyleSheetMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
{
@ -234,44 +234,41 @@ namespace DocFileFormat
void StyleSheetMapping::writeRunDefaults( StyleSheet* sheet )
{
if ((sheet->stshi) && (!sheet->stshi->rgftcStandardChpStsh.empty()))
{
m_pXmlWriter->WriteNodeBegin( L"w:rPrDefault" );
m_pXmlWriter->WriteNodeBegin( L"w:rPr" );
m_pXmlWriter->WriteNodeBegin( L"w:rPrDefault" );
m_pXmlWriter->WriteNodeBegin( L"w:rPr" );
//write default fonts
m_pXmlWriter->WriteNodeBegin( L"w:rFonts", TRUE );
//write default fonts
m_pXmlWriter->WriteNodeBegin( L"w:rFonts", TRUE );
FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) );
if (ffnAscii)
m_pXmlWriter->WriteAttribute( L"w:ascii", FormatUtils::XmlEncode(ffnAscii->xszFtn, true));
FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) );
if (ffnAscii)
m_pXmlWriter->WriteAttribute( L"w:ascii", FormatUtils::XmlEncode(ffnAscii->xszFtn, true));
FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) );
if (ffnAsia)
m_pXmlWriter->WriteAttribute( L"w:eastAsia", FormatUtils::XmlEncode(ffnAsia->xszFtn, true));
FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) );
if (ffnAsia)
m_pXmlWriter->WriteAttribute( L"w:eastAsia", FormatUtils::XmlEncode(ffnAsia->xszFtn, true));
FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) );
if (ffnAnsi)
m_pXmlWriter->WriteAttribute( L"w:hAnsi", FormatUtils::XmlEncode(ffnAnsi->xszFtn, true));
FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) );
if (ffnAnsi)
m_pXmlWriter->WriteAttribute( L"w:hAnsi", FormatUtils::XmlEncode(ffnAnsi->xszFtn, true));
FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) );
if (ffnComplex)
m_pXmlWriter->WriteAttribute( L"w:cs", FormatUtils::XmlEncode(ffnComplex->xszFtn, true));
FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) );
if (ffnComplex)
m_pXmlWriter->WriteAttribute( L"w:cs", FormatUtils::XmlEncode(ffnComplex->xszFtn, true));
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( L"w:rFonts" );
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( L"w:rFonts" );
LanguageId langid(this->m_document->FIB->m_FibBase.lid);
std::wstring langcode = LanguageIdMapping::getLanguageCode( &langid );
LanguageId langid(this->m_document->FIB->m_FibBase.lid);
std::wstring langcode = LanguageIdMapping::getLanguageCode( &langid );
m_pXmlWriter->WriteNodeBegin( L"w:lang", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", langcode);
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( L"w:lang" );
m_pXmlWriter->WriteNodeBegin( L"w:lang", TRUE );
m_pXmlWriter->WriteAttribute( L"w:val", langcode);
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( L"w:lang" );
m_pXmlWriter->WriteNodeEnd( L"w:rPr" );
m_pXmlWriter->WriteNodeEnd( L"w:rPrDefault" );
}
m_pXmlWriter->WriteNodeEnd( L"w:rPr" );
m_pXmlWriter->WriteNodeEnd( L"w:rPrDefault" );
}
/*========================================================================================================*/

View File

@ -55,7 +55,7 @@ namespace DocFileFormat
/// Generates a style id for custom style names or returns the build-in identifier for build-in styles.
static std::wstring MakeStyleId( StyleSheetDescription* std );
static std::map<std::wstring, std::wstring> m_mapStyleId;
static NSCriticalSection::CRITICAL_SECTION_SMART m_mapStyleIdLock;
static OfficeCriticalSection m_mapStyleIdLock;
virtual ~StyleSheetMapping();
private:
@ -67,4 +67,4 @@ namespace DocFileFormat
/// Writes the "NormalTable" default style
void writeNormalTableStyle();
};
}
}

View File

@ -35,11 +35,9 @@
namespace DocFileFormat
{
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter,
const std::vector<short>* grid, int gridIndex, int cellIndex, unsigned int depth) :
TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, int gridIndex, int cellIndex) :
PropertiesMapping(pWriter)
{
_depth = depth;
_width = 0;
_gridIndex = gridIndex;
@ -77,25 +75,9 @@ namespace DocFileFormat
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
int nComputedCellWidth = 0;
_gridSpan = 0;
_bCoverCell = false;
_gridSpan = 1;
unsigned int iTap_current = 1;
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
{
DWORD code = iter->OpCode;
switch(iter->OpCode)
{
case sprmPItap:
{
iTap_current = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
}break;
}
}
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
{
switch (iter->OpCode)
@ -131,39 +113,16 @@ namespace DocFileFormat
{
appendValueElement( _tcPr, L"noWrap", L"", true );
}
//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++;
//}
if (tdef.rgTc80[_cellIndex].horzMerge == 1)
int ind = (std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1);
int ind1 = ind;
while (ind1 < tdef.rgdxaCenter.size() - 1)
{
for (size_t i = _cellIndex; i < tdef.rgTc80.size(); i++)
{
if (tdef.rgTc80[i].horzMerge < 1)
break;
nComputedCellWidth += tdef.rgdxaCenter[ i + 1] - tdef.rgdxaCenter[ i ] ;
_gridSpan++;
}
}
else if (tdef.rgTc80[_cellIndex].horzMerge == 2)
{//skip cover cell
_gridSpan = 1;
nComputedCellWidth = 0;
_bCoverCell = true;
}
else
{
_gridSpan = 1;
nComputedCellWidth += tdef.rgdxaCenter[ _cellIndex + 1] - tdef.rgdxaCenter[ _cellIndex ] ;
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))
{
@ -325,32 +284,30 @@ namespace DocFileFormat
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 ) :
(nComputedCellWidth > 0 ? L"dxa" : L"auto"));
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 );
//if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
//{
// //check the number of merged cells
// int w = _grid->at( _gridIndex );
// for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
// {
// _gridSpan++;
// w += _grid->at( i );
// if ( w >= nComputedCellWidth )
// {
// break;
// }
// }
if (_gridSpan > 1)
if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
{
//check the number of merged cells
int w = _grid->at( _gridIndex );
for ( size_t i = _gridIndex + 1; i < _grid->size(); i++ )
{
_gridSpan++;
w += _grid->at( i );
if ( w >= nComputedCellWidth )
{
break;
}
}
appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ), true );
}

View File

@ -58,7 +58,7 @@ namespace DocFileFormat
public:
virtual ~TableCellPropertiesMapping();
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, int gridIndex, int cellIndex, unsigned int depth);
TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector<short>* grid, int gridIndex, int cellIndex);
virtual void Apply( IVisitable* visited );
inline int GetGridSpan() const
@ -66,11 +66,6 @@ namespace DocFileFormat
return _gridSpan;
}
inline bool IsCoverCell() const
{
return _bCoverCell;
}
private:
void apppendCellShading (unsigned char* sprmArg, int size, int cellIndex);
@ -84,20 +79,18 @@ namespace DocFileFormat
XMLTools::XMLElement* _tcMar;
XMLTools::XMLElement* _tcBorders;
const std::vector<short>* _grid;
std::vector<short> _tGrid;
const std::vector<short>* _grid;
std::vector<short> _tGrid;
short _width;
Global::CellWidthType _ftsWidth;
TC80 _tcDef;
unsigned int _depth;
short _width;
Global::CellWidthType _ftsWidth;
TC80 _tcDef;
BorderCode* _brcTop;
BorderCode* _brcLeft;
BorderCode* _brcRight;
BorderCode* _brcBottom;
int _gridSpan;
bool _bCoverCell;
int _gridSpan;
};
}

View File

@ -44,7 +44,7 @@ namespace DocFileFormat
bool fInnerTableCell;
unsigned int iTap;
TableInfo( ParagraphPropertyExceptions* papx, int nWordVersion):
TableInfo( ParagraphPropertyExceptions* papx ):
fInTable(false), fTtp(false), fInnerTtp(false), fInnerTableCell(false), iTap(0)
{
if ( papx != NULL )

View File

@ -118,10 +118,12 @@ namespace DocFileFormat
//find cell end
int cpCellEnd = documentMapping->findCellEndCp(cp, depth);
//start w:tc
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
//convert the properties
XMLTools::CStringXmlWriter writerTcPr;
TableCellPropertiesMapping tcpMapping(&writerTcPr, grid, gridIndex, nCellIndex, depth);
TableCellPropertiesMapping tcpMapping(documentMapping->GetXMLWriter(), grid, gridIndex, nCellIndex);
if ( tapx != NULL )
{
@ -129,15 +131,6 @@ namespace DocFileFormat
}
gridIndex += tcpMapping.GetGridSpan();
if (tcpMapping.IsCoverCell())
{
return;
}
//start w:tc
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tc" );
documentMapping->GetXMLWriter()->WriteString(writerTcPr.GetXmlString());
documentMapping->_lastValidPapx = papxBackup;
documentMapping->_lastValidSepx = sepxBackup;
@ -222,7 +215,7 @@ namespace DocFileFormat
int fcRowEnd = documentMapping->findRowEndFc(cp, depth);
TablePropertyExceptions tapx ( documentMapping->findValidPapx( fcRowEnd ),
documentMapping->m_document->DataStream,
documentMapping->m_document->nWordVersion);
documentMapping->m_document->FIB->m_bOlderVersion);
std::list<CharacterPropertyExceptions*>* chpxs = documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
@ -300,7 +293,7 @@ namespace DocFileFormat
documentMapping = static_cast<DocumentMapping*>(mapping);
}
documentMapping->writeParagraph( cpStart, 0x7fffffff );
documentMapping->writeParagraph( cpStart );
}
}
@ -322,7 +315,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx(fc);
TableInfo tai( papx, documentMapping->m_document->nWordVersion );
TableInfo tai( papx );
return ( ( tai.fInTable ) && ( ( ( documentMapping->m_document->Text->at( _cp ) == 0x0007 ) && ( tai.iTap <= 1 ) &&
@ -342,7 +335,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx, documentMapping->m_document->nWordVersion );
TableInfo tai( papx );
return ( ( tai.fInTable ) && ( ( ( documentMapping->m_document->Text->at( _cp ) == 0x0007 ) && ( tai.iTap <= 1 ) &&
( tai.fTtp ) ) ||
@ -362,7 +355,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx, documentMapping->m_document->nWordVersion );
TableInfo tai( papx );
return ( ( tai.fInTable ) && ( documentMapping->m_document->Text->at( _cp ) == 0x000D ) &&
( !IsCellMarker( _cp ) ) && ( !IsRowMarker( _cp ) ) );
@ -385,7 +378,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx, documentMapping->m_document->nWordVersion );
TableInfo tai( papx );
TableRow tableRow ( documentMapping, _cp );
TableCell tableCell ( documentMapping, _cp );
@ -397,7 +390,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx( fc );
tai = TableInfo( papx, documentMapping->m_document->nWordVersion );
tai = TableInfo( papx );
if ( tai.iTap > _depth )
{
@ -412,7 +405,7 @@ namespace DocFileFormat
papx = documentMapping->findValidPapx( fc );
tai = TableInfo( papx, documentMapping->m_document->nWordVersion );
tai = TableInfo( papx );
paragraphBeginCP = _cp;
}
@ -531,7 +524,7 @@ namespace DocFileFormat
TablePropertyExceptions row1Tapx( documentMapping->findValidPapx( fcRowEnd ),
documentMapping->m_document->DataStream ,
documentMapping->m_document->nWordVersion);
documentMapping->m_document->FIB->m_bOlderVersion);
//start table
documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tbl" );

View File

@ -75,8 +75,6 @@ namespace DocFileFormat
BYTE itcFirst = 0;
BYTE itcLim = 0;
bool bTableW = false;
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
{
switch( iter->OpCode )
@ -107,8 +105,8 @@ namespace DocFileFormat
break;
case sprmTTableWidth:
{
//preferred table width
{ //preferred table width
unsigned char fts = iter->Arguments[0];
short width = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
@ -121,8 +119,6 @@ namespace DocFileFormat
tblW.AppendAttribute( w );
_tblPr->AppendChild( tblW );
bTableW = true;
}
break;
case sprmTMerge:
@ -390,20 +386,8 @@ namespace DocFileFormat
break;
}
}
if (false == bTableW)
{
XMLTools::XMLElement tblW( L"w:tblW");
XMLTools::XMLAttribute w( L"w:w", L"0");
XMLTools::XMLAttribute type( L"w:type", L"auto" );
tblW.AppendAttribute( type );
tblW.AppendAttribute( w );
_tblPr->AppendChild( tblW );
}
//indent
//indent
if ( tblIndent != 0 )
{
XMLTools::XMLElement tblInd( L"w:tblInd");
@ -417,7 +401,7 @@ namespace DocFileFormat
_tblPr->AppendChild( tblInd );
}
//append floating props
//append floating props
if ( tblpPr.GetAttributeCount() > 0 )
{
_tblPr->AppendChild( tblpPr );

View File

@ -41,8 +41,8 @@ namespace DocFileFormat
{
public:
/// Parses the bytes to retrieve a TAPX
TablePropertyExceptions(unsigned char* bytes, int size, int nWordVersion) :
PropertyExceptions(bytes, size, nWordVersion), m_bSkipShading97 (FALSE)
TablePropertyExceptions(unsigned char* bytes, int size, bool oldVersion) :
PropertyExceptions(bytes, size, oldVersion), m_bSkipShading97 (FALSE)
{
//not yet implemented
}
@ -53,10 +53,10 @@ namespace DocFileFormat
}
/// Extracts the TAPX SPRMs out of a PAPX
TablePropertyExceptions (ParagraphPropertyExceptions* papx, POLE::Stream* dataStream, int nWordVersion) :
TablePropertyExceptions (ParagraphPropertyExceptions* papx, POLE::Stream* dataStream, bool oldVersion) :
PropertyExceptions()
{
VirtualStreamReader oBinReader(dataStream, 0, nWordVersion);
VirtualStreamReader oBinReader(dataStream, 0, oldVersion);
m_bSkipShading97 = FALSE;
@ -87,7 +87,7 @@ namespace DocFileFormat
unsigned char* grpprlBytes = oBinReader.ReadBytes(grpprlSize, true);
//parse the grpprl
PropertyExceptions externalPx(grpprlBytes, grpprlSize, nWordVersion);
PropertyExceptions externalPx(grpprlBytes, grpprlSize, oldVersion);
for (std::list<SinglePropertyModifier>::iterator oIter = externalPx.grpprl->begin(); oIter != externalPx.grpprl->end(); ++oIter)
{

View File

@ -160,7 +160,7 @@ namespace DocFileFormat
break;
papx_prev = papx;
TableInfo tai( papx, m_document->nWordVersion );
TableInfo tai( papx );
if ( tai.fInTable )
{
@ -173,7 +173,7 @@ namespace DocFileFormat
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp, 0x7fffffff );
cp = writeParagraph( cp );
}
}
_isTextBoxContent = false;

View File

@ -414,7 +414,6 @@ namespace DocFileFormat
}
strStyle += L"width:" + strWidth + L"pt;" + L"height:" + strHeight + L"pt;";
m_pXmlWriter->WriteAttribute( L"style", strStyle);
if (m_isOlePreview)
@ -426,21 +425,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( L"o:bullet", L"1" );
}
{//borders color
if (pict->brcTop)
m_pXmlWriter->WriteAttribute( L"o:bordertopcolor",
pict->brcTop->ico.empty() ? FormatUtils::IntToFormattedWideString(pict->brcTop->cv, L"#%06x") : pict->brcTop->ico);
if (pict->brcLeft)
m_pXmlWriter->WriteAttribute( L"o:borderleftcolor",
pict->brcTop->ico.empty() ? FormatUtils::IntToFormattedWideString(pict->brcLeft->cv, L"#%06x") : pict->brcLeft->ico);
if (pict->brcBottom)
m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor",
pict->brcTop->ico.empty() ? FormatUtils::IntToFormattedWideString(pict->brcBottom->cv, L"#%06x") : pict->brcBottom->ico);
if (pict->brcRight)
m_pXmlWriter->WriteAttribute( L"o:borderrightcolor",
pict->brcTop->ico.empty() ? FormatUtils::IntToFormattedWideString(pict->brcRight->cv, L"#%06x") : pict->brcRight->ico);
}
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
if (CopyPicture(pict))
@ -455,7 +439,7 @@ namespace DocFileFormat
writePictureBorder( L"bordertop", pict->brcTop );
writePictureBorder( L"borderleft", pict->brcLeft );
writePictureBorder( L"borderbottom", pict->brcBottom );
writePictureBorder( L"borderright", pict->brcRight );
writePictureBorder( L"borderright", pict->brcRight );
}
m_pXmlWriter->WriteNodeEnd( L"v:shape" );
@ -492,16 +476,12 @@ namespace DocFileFormat
WmfPlaceableFileHeader oWmfHeader = {};
oMetaHeader.ToWMFHeader(&oWmfHeader);
int lLenHeader = 22 + (pict->embeddedDataHeader ? 114 : 0);
int lLenHeader = 114 + 22;
unsigned char *newData = new unsigned char[pict->embeddedDataSize + lLenHeader];
memcpy(newData, (unsigned char *)(&oWmfHeader), 22);
if (pict->embeddedDataHeader)
{
memcpy(newData + 22, pict->embeddedDataHeader, 114 );
}
memcpy(newData + 22, pict->embeddedDataHeader, 114 );
memcpy(newData + lLenHeader, pict->embeddedData, pict->embeddedDataSize);

View File

@ -1312,7 +1312,7 @@ namespace DocFileFormat
//write the blip
if (oBlip)
{
VirtualStreamReader reader(m_context->_doc->WordDocumentStream, oBlip->foDelay, m_context->_doc->nWordVersion);
VirtualStreamReader reader(m_context->_doc->WordDocumentStream, oBlip->foDelay, m_context->_doc->FIB->m_bOlderVersion);
switch (oBlip->btWin32)
{

View File

@ -40,6 +40,7 @@
#include "VMLShapeTypeMapping.h"
#include "TwipsValue.h"
#include "EmuValue.h"
#include "MemoryStream.h"
#include "RGBColor.h"
#include "FixedPointNumber.h"

View File

@ -39,8 +39,8 @@
class VirtualStreamReader : public IBinaryReader
{
public:
VirtualStreamReader (POLE::Stream* _stream, ULONG _position , int _nWordVersion) :
nWordVersion(_nWordVersion), stream(_stream), position(_position)
VirtualStreamReader (POLE::Stream* _stream, ULONG _position , bool _olderVersion) :
olderVersion(_olderVersion), stream(_stream), position(_position)
{
if ( stream == NULL )return;
@ -192,8 +192,7 @@ public:
unsigned char* xstz = NULL;
unsigned char* cch = NULL;
if (nWordVersion > 0)
if (olderVersion)
{
int cchSize = 1;
cch = ReadBytes( cchSize, true );
@ -286,7 +285,7 @@ public:
return result;
}
int nWordVersion;
bool olderVersion;
private:
POLE::uint64 position;

View File

@ -59,7 +59,7 @@ namespace DocFileFormat
bytes = reader->ReadBytes( length, true );
//It's a real string table
if (reader->nWordVersion > 0)
if (reader->olderVersion)
{
FormatUtils::GetSTLCollectionFromBytes<WideString>( newObject, bytes, length, ENCODING_WINDOWS_1250 );
}

View File

@ -97,11 +97,10 @@ namespace DocFileFormat
m_pStorage = NULL;
officeArtContent = NULL;
nWordVersion = 0;
bOlderVersion = false;
bDocumentCodePage = false;
nDocumentCodePage = ENCODING_WINDOWS_1250;
nFontsCodePage = ENCODING_WINDOWS_1250;
}
WordDocument::~WordDocument()
@ -117,7 +116,7 @@ namespace DocFileFormat
namespace DocFileFormat
{
int WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
long WordDocument::LoadDocument(const std::wstring & fileName, const std::wstring & password)
{
m_sFileName = fileName;
m_sPassword = password;
@ -132,11 +131,8 @@ namespace DocFileFormat
if (m_pStorage->SetFile (m_sFileName.c_str()) == false)
{
if (false == LoadDocumentFlat())
{
Clear();
return AVS_ERROR_FILEFORMAT;
}
Clear();
return AVS_ERROR_FILEFORMAT;
}
//-----------------------------------------------------------------------------------------------------------------
if (m_pStorage->GetStream (L"WordDocument", &WordDocumentStream) == false)
@ -145,30 +141,20 @@ namespace DocFileFormat
return AVS_ERROR_FILEFORMAT;
}
//-------------------------------------------------------------------------------------------------------------------
FIB = new FileInformationBlock(VirtualStreamReader(WordDocumentStream, 0, false ));
FIB = new FileInformationBlock(VirtualStreamReader(WordDocumentStream,0, false ));
if (FIB->m_FibBase.nFib)
{
if (FIB->m_FibBase.nFib <= Fib1995)
{
nWordVersion = FIB->m_nWordVersion = 1;
if (FIB->m_FibBase.nFib <= Fib1989)
{
nWordVersion = FIB->m_nWordVersion = 2;
}
bOlderVersion = FIB->m_bOlderVersion = true;
}
}
else
{
if (FIB->m_FibNew.nFibNew <= Fib1995 && FIB->m_FibNew.nFibNew > 0)
{
nWordVersion = FIB->m_nWordVersion = 1;
if (FIB->m_FibNew.nFibNew <= Fib1989)
{
nWordVersion = FIB->m_nWordVersion = 2;
}
bOlderVersion = FIB->m_bOlderVersion = true;
}
}
bool res = false;
@ -235,7 +221,7 @@ namespace DocFileFormat
if (DecryptOfficeFile(&Decryptor) == false) return AVS_ERROR_DRM;
}
FIB->reset(VirtualStreamReader(WordDocumentStream, (nWordVersion > 0) ? 36 : 68, false));
FIB->reset(VirtualStreamReader(WordDocumentStream, bOlderVersion ? 36 : 68, false));
}
//------------------------------------------------------------------------------------------------------------------
@ -269,7 +255,7 @@ namespace DocFileFormat
bDocumentCodePage = true;
}
}
if (nWordVersion == 0)
if (!bOlderVersion)
{
nDocumentCodePage = ENCODING_UTF16;
bDocumentCodePage = true;
@ -286,20 +272,20 @@ namespace DocFileFormat
DataStream = NULL;
}
if (TableStream->size() < 1 && nWordVersion > 0)
if (TableStream->size() < 1 && bOlderVersion)
{
RELEASEOBJECT(TableStream);
m_pStorage->GetStream (L"WordDocument", &TableStream);
}
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, nWordVersion);
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, nWordVersion);
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, nWordVersion);
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, nWordVersion);
AssocNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAssoc, FIB->m_FibWord97.lcbSttbfAssoc, nWordVersion);
BookmarkAnnotNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAtnBkmk, FIB->m_FibWord97.lcbSttbfAtnBkmk, nWordVersion);
Captions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfCaption, FIB->m_FibWord97.lcbSttbfCaption, nWordVersion);
AutoCaptions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAutoCaption, FIB->m_FibWord97.lcbSttbfAutoCaption, nWordVersion);
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, bOlderVersion);
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, bOlderVersion);
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, bOlderVersion);
AssocNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAssoc, FIB->m_FibWord97.lcbSttbfAssoc, bOlderVersion);
BookmarkAnnotNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAtnBkmk, FIB->m_FibWord97.lcbSttbfAtnBkmk, bOlderVersion);
Captions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfCaption, FIB->m_FibWord97.lcbSttbfCaption, bOlderVersion);
AutoCaptions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAutoCaption, FIB->m_FibWord97.lcbSttbfAutoCaption, bOlderVersion);
if (m_pCallFunc)
{
@ -318,46 +304,46 @@ namespace DocFileFormat
// Read all needed PLCFs
if (FIB->m_RgLw97.ccpFtn > 0)
{
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, nWordVersion);
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, nWordVersion);
IndividualFootnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndTxt, FIB->m_FibWord97.lcbPlcffndTxt, bOlderVersion);
FootnoteReferenceCharactersPlex = new Plex<FootnoteDescriptor>(FootnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcffndRef, FIB->m_FibWord97.lcbPlcffndRef, bOlderVersion);
}
if (nWordVersion > 0 && FIB->m_FibWord97.lcbPlcPad > 0)
if (FIB->m_FibWord97.lcbPlcPad > 0)
{
OutlineListDescriptorPlex = new Plex<OutlineListDescriptor>(OutlineListDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcPad, FIB->m_FibWord97.lcbPlcPad, nWordVersion);
OutlineListDescriptorPlex = new Plex<OutlineListDescriptor>(OutlineListDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcPad, FIB->m_FibWord97.lcbPlcPad, bOlderVersion);
}
if (FIB->m_RgLw97.ccpEdn > 0)
{
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, nWordVersion);
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, nWordVersion);
IndividualEndnotesPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendTxt, FIB->m_FibWord97.lcbPlcfendTxt, bOlderVersion);
EndnoteReferenceCharactersPlex = new Plex<EndnoteDescriptor>(EndnoteDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfendRef, FIB->m_FibWord97.lcbPlcfendRef, bOlderVersion);
}
if (FIB->m_RgLw97.ccpHdr > 0)
{
HeaderStoriesPlex = new Plex<EmptyStructure>( EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfHdd, FIB->m_FibWord97.lcbPlcfHdd, nWordVersion);
HeaderStoriesPlex = new Plex<EmptyStructure>( EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfHdd, FIB->m_FibWord97.lcbPlcfHdd, bOlderVersion);
}
if (FIB->m_RgLw97.ccpAtn > 0)
{
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, nWordVersion);
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, nWordVersion);
AnnotationsReferencePlex = new Plex<AnnotationReferenceDescriptor>(AnnotationReferenceDescriptor::GetSize(bOlderVersion), TableStream, FIB->m_FibWord97.fcPlcfandRef, FIB->m_FibWord97.lcbPlcfandRef, bOlderVersion);
IndividualCommentsPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfandTxt, FIB->m_FibWord97.lcbPlcfandTxt, bOlderVersion);
}
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, nWordVersion);
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, nWordVersion);
OfficeDrawingPlex = new Plex<Spa> (Spa::GetSize(bOlderVersion), TableStream, FIB->m_FibWord97.fcPlcSpaMom, FIB->m_FibWord97.lcbPlcSpaMom, bOlderVersion);
OfficeDrawingPlexHeader = new Plex<Spa> (Spa::GetSize(bOlderVersion), TableStream, FIB->m_FibWord97.fcPlcSpaHdr, FIB->m_FibWord97.lcbPlcSpaHdr, bOlderVersion);
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, bOlderVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, bOlderVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, bOlderVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, bOlderVersion);
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, nWordVersion);
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, nWordVersion);
TextboxBreakPlex = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxBkd, FIB->m_FibWord97.lcbPlcfTxbxBkd, bOlderVersion);
TextboxBreakPlexHeader = new Plex<Tbkd> (Tbkd::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfTxbxHdrBkd, FIB->m_FibWord97.lcbPlcfTxbxHdrBkd, bOlderVersion);
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, nWordVersion);
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, nWordVersion);
AnnotStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkf, FIB->m_FibWord97.lcbPlcfAtnBkf, bOlderVersion);
AnnotEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfAtnBkl, FIB->m_FibWord97.lcbPlcfAtnBkl, bOlderVersion);
for (size_t i = 0; i < BookmarkStartPlex->Elements.size(); ++i)
@ -373,19 +359,15 @@ namespace DocFileFormat
BookmarkFirst* pBookmark = static_cast<BookmarkFirst*>(AnnotStartPlex->Elements[i]);
if (pBookmark)
{
short end = pBookmark->GetIndex();
if (i < AnnotStartPlex->CharacterPositions.size() && end < AnnotEndPlex->CharacterPositions.size())
{
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[end]));
}
AnnotStartEndCPs.push_back(std::make_pair(AnnotStartPlex->CharacterPositions[i], AnnotEndPlex->CharacterPositions[pBookmark->GetIndex()]));
}
}
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, bOlderVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, bOlderVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, bOlderVersion);
if (m_pCallFunc)
{
@ -430,12 +412,11 @@ namespace DocFileFormat
return AVS_ERROR_FILEFORMAT;
}
}
if (FontTable)
if (!bDocumentCodePage && FontTable)
{
std::unordered_map<int, int> fonts_charsets;
bool bFontsCodePage = false;
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin(); !bFontsCodePage && iter != FontTable->Data.end(); iter++ )
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin();!bDocumentCodePage && iter != FontTable->Data.end(); iter++ )
{
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
if (!font) continue;
@ -448,8 +429,8 @@ namespace DocFileFormat
{
if (aCodePages[i][0] == font->chs && font->chs != 0)
{
nFontsCodePage = aCodePages[i][1];
bFontsCodePage = true;
nDocumentCodePage = aCodePages[i][1];
bDocumentCodePage = true;
break;
}
}
@ -464,26 +445,19 @@ namespace DocFileFormat
m_PieceTable = new PieceTable (FIB, TableStream, WordDocumentStream );
Text = m_PieceTable->GetAllEncodingText (WordDocumentStream);
}
if (FIB->m_FibWord97.lcbClx < 1 || ((Text) && (Text->empty())))
else
{
int cb = FIB->m_FibBase.fcMac - FIB->m_FibBase.fcMin;
if (cb > 0)
{
FIB->m_FibBase.fComplex = false;
unsigned char *bytes = new unsigned char[cb];
unsigned char *bytes = new unsigned char[cb];
WordDocumentStream->seek (FIB->m_FibBase.fcMin);
WordDocumentStream->read (bytes, cb);
WordDocumentStream->seek (FIB->m_FibBase.fcMin);
WordDocumentStream->read (bytes, cb);
RELEASEOBJECT(Text);
Text = new std::vector<wchar_t>();
Text = new std::vector<wchar_t>();
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, nDocumentCodePage);
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t>>(Text, bytes, cb, nFontsCodePage != ENCODING_WINDOWS_1250 ? nFontsCodePage : nDocumentCodePage);
RELEASEARRAYOBJECTS(bytes);
}
RELEASEARRAYOBJECTS(bytes);
}
if (BookmarkNames)
@ -547,13 +521,13 @@ namespace DocFileFormat
int cp = SectionPlex->CharacterPositions[i + 1];
//Get the SEPX
VirtualStreamReader wordReader( WordDocumentStream, sed->fcSepx, nWordVersion);
VirtualStreamReader wordReader( WordDocumentStream, sed->fcSepx, bOlderVersion);
//!!!TODO: cbSepx is the size in bytes of the rest properties part!!!
short cbSepx = nWordVersion == 2 ? wordReader.ReadByte() : wordReader.ReadInt16();
unsigned char* bytes = wordReader.ReadBytes( ( cbSepx /*- 2*/ ), true );
short cbSepx = wordReader.ReadInt16();
unsigned char* bytes = wordReader.ReadBytes( ( cbSepx /*- 2*/ ), true );
AllSepx->insert( std::pair<int, SectionPropertyExceptions*>( cp, new SectionPropertyExceptions( bytes, ( cbSepx /*- 2*/ ), nWordVersion ) ) );
AllSepx->insert( std::pair<int, SectionPropertyExceptions*>( cp, new SectionPropertyExceptions( bytes, ( cbSepx /*- 2*/ ), bOlderVersion ) ) );
RELEASEARRAYOBJECTS( bytes );
}
@ -575,70 +549,6 @@ namespace DocFileFormat
return 0;
}
bool WordDocument::LoadDocumentFlat()
{
NSFile::CFileBinary file;
if (false == file.OpenFile(m_sFileName)) return false;
DWORD sz_read = 0;
unsigned short wIdent = 0;
file.ReadFile((BYTE*)&wIdent, 2, sz_read);
if ( wIdent != 0xA5EC && wIdent != 0xA5DC && wIdent != 0xA5DB)
{
file.CloseFile();
return false;
}
file.SeekFile(0);
if (m_sTempFolder.empty())
{
m_sTempFolder = NSFile::CFileBinary::GetTempPath();
}
m_sTempDecryptFileName = m_sTempFolder + FILE_SEPARATOR_STR + L"~tempFile.doc";
POLE::Storage *storageOut = new POLE::Storage(m_sTempDecryptFileName.c_str());
if (!storageOut)
{
file.CloseFile();
return false;
}
if (!storageOut->open(true, true))
{
file.CloseFile();
delete storageOut;
return false;
}
DWORD size_stream = file.GetFileSize();
POLE::Stream *streamNew = new POLE::Stream(storageOut, L"WordDocument", true, size_stream);
if (!streamNew) return false;
unsigned char* data_stream = new unsigned char[size_stream];
file.ReadFile(data_stream, size_stream, size_stream);
streamNew->write(data_stream, size_stream);
RELEASEARRAYOBJECTS(data_stream);
streamNew->flush();
delete streamNew;
storageOut->close();
delete storageOut;
file.CloseFile();
//reset streams
RELEASEOBJECT(WordDocumentStream);
m_pStorage->SetFile(m_sTempDecryptFileName.c_str());
return true;
}
bool WordDocument::DecryptOfficeFile(CRYPT::Decryptor* Decryptor)
{
if (m_sTempFolder.empty())
@ -700,7 +610,6 @@ namespace DocFileFormat
}
return true;
}
void WordDocument::DecryptStream( int level, std::wstring path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{
std::list<std::wstring> entries, entries_files, entries_dir;
@ -773,7 +682,7 @@ namespace DocFileFormat
if ( std::wstring::npos != streamName_open.find(L"WordDocument") )
{
size_data_store = (nWordVersion > 0) ? 36 : 68;
size_data_store = bOlderVersion ? 36 : 68;
data_store = new unsigned char[size_data_store];
}
@ -783,7 +692,7 @@ namespace DocFileFormat
size_t size_block = 0x200;
unsigned long block = 0;
for (POLE::uint64 pos = /*(nWordVersion > 0) ? size_data_store :*/ 0; pos < size_stream; pos += size_block, block++)
for (POLE::uint64 pos = /*bOlderVersion ? size_data_store :*/ 0; pos < size_stream; pos += size_block, block++)
{
if (pos + size_block > size_stream)
size_block = size_stream - pos;
@ -813,7 +722,7 @@ namespace DocFileFormat
void WordDocument::Clear()
{
nWordVersion = 0;
bOlderVersion = false;
if (AllPapxFkps)
{

View File

@ -94,24 +94,17 @@ namespace DocFileFormat
WordDocument (const ProgressCallback* pCallFunc, const std::wstring & tempFolder );
virtual ~WordDocument();
int LoadDocument(const std::wstring & fileName, const std::wstring & password);
long LoadDocument (const std::wstring & fileName, const std::wstring & password);
int nWordVersion;
bool bOlderVersion;
int nDocumentCodePage;
bool bDocumentCodePage;
int nFontsCodePage;
inline StructuredStorageReader* GetStorage() const
{
return m_pStorage;
}
inline POLE::Stream* GetDocumentStream() const
{
return WordDocumentStream;
}
private:
bool LoadDocumentFlat();
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
bool DecryptStream (std::wstring streamName_open, POLE::Storage * storageIn, std::wstring streamName_create, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor, bool bDecrypt);

View File

@ -304,7 +304,7 @@ namespace DocFileFormat
if (!iter->data.empty())
{
SaveEmbeddedObject(fileName, *iter);
SaveEmbeddedObject(fileName, iter->data);
}
else
{

View File

@ -21,7 +21,13 @@ include($$PWD/../../../Common/3dParty/boost/boost.pri)
DEFINES += UNICODE \
_UNICODE \
DONT_WRITE_EMBEDDED_FONTS
_USE_LIBXML2_READER_ \
LIBXML_READER_ENABLED \
DONT_WRITE_EMBEDDED_FONTS \
INCLUDEPATH += \
../../../DesktopEditor/freetype-2.5.2/include \
../../../DesktopEditor/xml/libxml2/include
core_mac {
#QMAKE_MAC_SDK = macosx10.11

View File

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

View File

@ -7,14 +7,66 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocForma
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\OfficeUtils\win32\OfficeUtilsLib.vcproj", "{F8274B05-168E-4D6E-B843-AA7510725363}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig", "..\..\DesktopEditor\cximage\jbig\jbig_vs2005.vcproj", "{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "..\..\DesktopEditor\cximage\jpeg\Jpeg_vs2005.vcproj", "{818753F2-DBB9-4D3B-898A-A604309BE470}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpsd", "..\..\DesktopEditor\cximage\libpsd\libpsd_vs2005.vcproj", "{9A037A69-D1DF-4505-AB2A-6CB3641C476E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mng", "..\..\DesktopEditor\cximage\mng\mng_vs2005.vcproj", "{40A69F40-063E-43FD-8543-455495D8733E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "png", "..\..\DesktopEditor\cximage\png\png_vs2005.vcproj", "{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdcr", "..\..\DesktopEditor\cximage\raw\libdcr_vs2005.vcproj", "{DF861D33-9BC1-418C-82B1-581F590FE169}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiff", "..\..\DesktopEditor\cximage\tiff\Tiff_vs2005.vcproj", "{0588563C-F05C-428C-B21A-DD74756628B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "..\..\DesktopEditor\raster\JBig2\win32\jbig2.vcproj", "{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
EndProjectSection
EndProject
@ -26,6 +78,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "..\..\Common\3d
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg2d", "..\..\DesktopEditor\agg-2.4\agg_vs2005.vcproj", "{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "font_engine", "..\..\DesktopEditor\fontengine\font_engine_vs2005.vcproj", "{C739151F-5384-41DF-A1A6-F089E2C1AD56}"
ProjectSection(ProjectDependencies) = postProject
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\DesktopEditor\freetype-2.5.2\builds\windows\vc2005\freetype.vcproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\DesktopEditor\xml\build\vs2005\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -42,6 +105,110 @@ Global
{C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|Win32.Build.0 = Release|Win32
{C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|x64.ActiveCfg = Release|x64
{C5371405-338F-4B70-83BD-2A5CDF64F383}.Release|x64.Build.0 = Release|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.ActiveCfg = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.Build.0 = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|x64.ActiveCfg = Debug|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|x64.Build.0 = Debug|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|Win32.ActiveCfg = Release|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|Win32.Build.0 = Release|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|x64.ActiveCfg = Release|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|x64.Build.0 = Release|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|Win32.ActiveCfg = Debug|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|Win32.Build.0 = Debug|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|x64.ActiveCfg = Debug|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|x64.Build.0 = Debug|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|Win32.ActiveCfg = Release|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|Win32.Build.0 = Release|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|x64.ActiveCfg = Release|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|x64.Build.0 = Release|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|Win32.ActiveCfg = Debug|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|Win32.Build.0 = Debug|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|x64.ActiveCfg = Debug|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|x64.Build.0 = Debug|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|Win32.ActiveCfg = Release|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|Win32.Build.0 = Release|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|x64.ActiveCfg = Release|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|x64.Build.0 = Release|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|Win32.ActiveCfg = Debug|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|Win32.Build.0 = Debug|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|x64.ActiveCfg = Debug|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|x64.Build.0 = Debug|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|Win32.ActiveCfg = Release|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|Win32.Build.0 = Release|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|x64.ActiveCfg = Release|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|x64.Build.0 = Release|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|Win32.ActiveCfg = Debug|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|Win32.Build.0 = Debug|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|x64.ActiveCfg = Debug|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|x64.Build.0 = Debug|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|Win32.ActiveCfg = Release|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|Win32.Build.0 = Release|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|x64.ActiveCfg = Release|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|x64.Build.0 = Release|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|Win32.ActiveCfg = Debug|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|Win32.Build.0 = Debug|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|x64.ActiveCfg = Debug|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|x64.Build.0 = Debug|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|Win32.ActiveCfg = Release|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|Win32.Build.0 = Release|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|x64.ActiveCfg = Release|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|x64.Build.0 = Release|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|Win32.ActiveCfg = Debug|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|Win32.Build.0 = Debug|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|x64.ActiveCfg = Debug|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|x64.Build.0 = Debug|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|Win32.ActiveCfg = Release|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|Win32.Build.0 = Release|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|x64.ActiveCfg = Release|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|x64.Build.0 = Release|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|Win32.ActiveCfg = Debug|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|Win32.Build.0 = Debug|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|x64.ActiveCfg = Debug|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|x64.Build.0 = Debug|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|Win32.ActiveCfg = Release|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|Win32.Build.0 = Release|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|x64.ActiveCfg = Release|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|x64.Build.0 = Release|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|Win32.ActiveCfg = Debug|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|Win32.Build.0 = Debug|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|x64.ActiveCfg = Debug|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|x64.Build.0 = Debug|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Release|Win32.ActiveCfg = Release|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Release|Win32.Build.0 = Release|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Release|x64.ActiveCfg = Release|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Release|x64.Build.0 = Release|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|Win32.ActiveCfg = Debug|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|Win32.Build.0 = Debug|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|x64.ActiveCfg = Debug|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|x64.Build.0 = Debug|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|Win32.ActiveCfg = Release|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|Win32.Build.0 = Release|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|x64.ActiveCfg = Release|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|x64.Build.0 = Release|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|Win32.ActiveCfg = Debug|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|Win32.Build.0 = Debug|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|x64.ActiveCfg = Debug|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|x64.Build.0 = Debug|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|Win32.ActiveCfg = Release|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|Win32.Build.0 = Release|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|x64.ActiveCfg = Release|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|x64.Build.0 = Release|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|Win32.ActiveCfg = Debug|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|Win32.Build.0 = Debug|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|x64.ActiveCfg = Debug|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|x64.Build.0 = Debug|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|Win32.ActiveCfg = Release|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|Win32.Build.0 = Release|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|x64.ActiveCfg = Release|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|x64.Build.0 = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.ActiveCfg = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.Build.0 = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.ActiveCfg = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.Build.0 = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.ActiveCfg = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.Build.0 = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.ActiveCfg = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.Build.0 = Release|x64
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Debug|Win32.ActiveCfg = Debug|Win32
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Debug|Win32.Build.0 = Debug|Win32
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Debug|x64.ActiveCfg = Debug|x64
@ -88,6 +255,38 @@ Global
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.ActiveCfg = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.Build.0 = Release|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|Win32.ActiveCfg = Debug|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|Win32.Build.0 = Debug|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|x64.ActiveCfg = Debug|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|x64.Build.0 = Debug|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|Win32.ActiveCfg = Release|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|Win32.Build.0 = Release|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|x64.ActiveCfg = Release|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|x64.Build.0 = Release|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|x64.ActiveCfg = Debug|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|x64.Build.0 = Debug|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|x64.ActiveCfg = Release|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|x64.Build.0 = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|Win32.ActiveCfg = Debug|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|Win32.Build.0 = Debug|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|x64.ActiveCfg = Debug|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|x64.Build.0 = Debug|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|Win32.ActiveCfg = Release|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|Win32.Build.0 = Release|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|x64.ActiveCfg = Release|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -31,8 +31,6 @@
*/
#include <iostream>
#include "../../Common/OfficeFileFormatChecker.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
@ -46,28 +44,11 @@
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#if defined(_DEBUG)
#pragma comment(lib, "../../build/lib/win_32/DEBUG/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/kernel.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/UnicodeConverter.lib")
#else
#pragma comment(lib, "../../build/lib/win_32/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/kernel.lib")
#pragma comment(lib, "../../build/lib/win_32/UnicodeConverter.lib")
#endif
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT convert_single(std::wstring srcFileName)
{
COfficeFileFormatChecker checker;
if (false == checker.isOfficeFile(srcFileName)) return S_FALSE;
if (AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC != checker.nFileType &&
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT != checker.nFileType) return S_FALSE;
HRESULT hr = S_OK;
std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
@ -93,7 +74,7 @@ HRESULT convert_single(std::wstring srcFileName)
if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, true);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, -1);
}
NSDirectory::DeleteDirectory(dstTempPath);

View File

@ -48,7 +48,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
@ -341,10 +341,6 @@
<Filter
Name="Common"
>
<File
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
@ -389,10 +385,6 @@
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
>
@ -450,10 +442,30 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\FileDownloader\FileDownloader_win.cpp"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -39,7 +39,7 @@ namespace Writers
{
class DocumentWriter : public ContentWriter
{
NSStringUtils::CStringBuilder m_oWriter;
XmlUtils::CStringWriter m_oWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
std::wstring m_sDir;

View File

@ -40,9 +40,9 @@ namespace Writers
class ContentWriter
{
public:
NSStringUtils::CStringBuilder m_oBackground;
NSStringUtils::CStringBuilder m_oContent;
NSStringUtils::CStringBuilder m_oSecPr;
XmlUtils::CStringWriter m_oBackground;
XmlUtils::CStringWriter m_oContent;
XmlUtils::CStringWriter m_oSecPr;
};
class HdrFtrItem
{

View File

@ -38,7 +38,7 @@ namespace Writers
{
class MediaWriter
{
NSStringUtils::CStringBuilder m_oWriter;
XmlUtils::CStringWriter m_oWriter;
std::wstring m_sDir;
std::wstring m_sMediaDir;
public:
@ -69,7 +69,7 @@ namespace Writers
{
rewind(pFile);
BYTE* pData = new BYTE[size];
_UINT32 dwSizeRead = (_UINT32)fread((void*)pData, 1, size, pFile);
DWORD dwSizeRead = (DWORD)fread((void*)pData, 1, size, pFile);
if(dwSizeRead > 0)
{
std::wstring sNewImagePath = AddImageGetNewPath();

View File

@ -41,11 +41,11 @@ namespace Writers
class NumberingWriter
{
NSStringUtils::CStringBuilder m_oWriter;
XmlUtils::CStringWriter m_oWriter;
std::wstring m_sDir;
public:
NSStringUtils::CStringBuilder m_oANum;
NSStringUtils::CStringBuilder m_oNumList;
XmlUtils::CStringWriter m_oANum;
XmlUtils::CStringWriter m_oNumList;
NumberingWriter( std::wstring sDir) : m_sDir(sDir)
{

View File

@ -516,7 +516,7 @@ public:
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty();
}
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
void Write(XmlUtils::CStringWriter* pCStringWriter)
{
pCStringWriter->WriteString(L"<w:rPr>");
if(bRStyle)
@ -780,22 +780,14 @@ public:
std::wstring Name;
std::wstring Id;
BYTE byteType;
bool Default;
bool Custom;
std::wstring Aliases;
bool bDefault;
std::wstring BasedOn;
std::wstring NextId;
std::wstring Link;
bool qFormat;
long uiPriority;
bool hidden;
bool semiHidden;
bool unhideWhenUsed;
bool autoRedefine;
bool locked;
bool personal;
bool personalCompose;
bool personalReply;
std::wstring TextPr;
std::wstring ParaPr;
std::wstring TablePr;
@ -803,38 +795,24 @@ public:
std::wstring CellPr;
std::vector<std::wstring> TblStylePr;
bool bDefault;
bool bCustom;
bool bqFormat;
bool buiPriority;
bool bhidden;
bool bsemiHidden;
bool bunhideWhenUsed;
bool bautoRedefine;
bool blocked;
bool bpersonal;
bool bpersonalCompose;
bool bpersonalReply;
public:
docStyle()
{
byteType = styletype_Paragraph;
bDefault = false;
bCustom = false;
bqFormat = false;
buiPriority = false;
bhidden = false;
bsemiHidden = false;
bunhideWhenUsed = false;
bautoRedefine = false;
blocked = false;
bpersonal = false;
bpersonalCompose = false;
bpersonalReply = false;
}
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
void Write(XmlUtils::CStringWriter* pCStringWriter)
{
std::wstring sType;
switch(byteType)
@ -848,35 +826,10 @@ public:
{
std::wstring sStyle = L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + Id + L"\"";
if(bDefault)
{
if(Default)
sStyle += L" w:default=\"1\"";
else
sStyle += L" w:default=\"0\"";
}
if(bCustom)
{
if(Custom)
sStyle += L" w:customStyle=\"1\"";
else
sStyle += L" w:customStyle=\"0\"";
}
sStyle += L" w:default=\"1\"";
sStyle += L">";
pCStringWriter->WriteString(sStyle);
if(!Aliases.empty())
{
pCStringWriter->WriteString(L"<w:aliases w:val=\"");
pCStringWriter->WriteEncodeXmlString(Aliases);
pCStringWriter->WriteString(L"\"/>");
}
if(bautoRedefine)
{
if(autoRedefine)
pCStringWriter->WriteString(L"<w:autoRedefine/>");
else
pCStringWriter->WriteString(L"<w:autoRedefine val=\"false\"/>");
}
if(!Name.empty())
{
pCStringWriter->WriteString(L"<w:name w:val=\"" + Name + L"\"/>");
@ -889,40 +842,6 @@ public:
{
pCStringWriter->WriteString(L"<w:next w:val=\"" + NextId + L"\"/>");
}
if(bpersonal)
{
if(personal)
pCStringWriter->WriteString(L"<w:personal/>");
else
pCStringWriter->WriteString(L"<w:personal val=\"false\"/>");
}
if(bpersonalCompose)
{
if(personalCompose)
pCStringWriter->WriteString(L"<w:personalCompose/>");
else
pCStringWriter->WriteString(L"<w:personalCompose val=\"false\"/>");
}
if(bpersonalReply)
{
if(personalReply)
pCStringWriter->WriteString(L"<w:personalReply/>");
else
pCStringWriter->WriteString(L"<w:personalReply val=\"false\"/>");
}
if(!Link.empty())
{
pCStringWriter->WriteString(L"<w:link w:val=\"");
pCStringWriter->WriteEncodeXmlString(Link);
pCStringWriter->WriteString(L"\"/>");
}
if(blocked)
{
if(locked)
pCStringWriter->WriteString(L"<w:locked/>");
else
pCStringWriter->WriteString(L"<w:locked val=\"false\"/>");
}
if(bqFormat)
{
if(qFormat)
@ -990,7 +909,7 @@ public:
class tblStylePr
{
public:
NSStringUtils::CStringBuilder Writer;
XmlUtils::CStringWriter Writer;
BYTE Type;
bool bType;
public:
@ -1050,7 +969,7 @@ public:
bHeight = false;
bPaddings = false;
}
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
void Write(XmlUtils::CStringWriter* pCStringWriter)
{
if(bType)
{
@ -1111,7 +1030,7 @@ public:
// tblPr()
// {
// }
// void Write(NSStringUtils::CStringBuilder* pCStringWriter)
// void Write(CStringWriter* pCStringWriter)
// {
// }
//};
@ -1131,7 +1050,7 @@ public:
bW = false;
bWDocx = false;
}
void Write(NSStringUtils::CStringBuilder& pCStringWriter, const std::wstring& sName)
void Write(XmlUtils::CStringWriter& pCStringWriter, const std::wstring& sName)
{
pCStringWriter.WriteString(Write(sName));
}
@ -1185,7 +1104,7 @@ public:
bValue = false;
bThemeColor = false;
}
void Write(std::wstring sName, NSStringUtils::CStringBuilder* pCStringWriter, bool bCell)
void Write(std::wstring sName, XmlUtils::CStringWriter* pCStringWriter, bool bCell)
{
if(bValue)
{
@ -1276,7 +1195,7 @@ public:
{
return !(bLeft || bTop || bRight || bBottom || bInsideV || bInsideH || bBetween);
}
void Write(NSStringUtils::CStringBuilder* pCStringWriter, bool bCell)
void Write(XmlUtils::CStringWriter* pCStringWriter, bool bCell)
{
if(bLeft)
oLeft.Write(L"w:left", pCStringWriter, bCell);
@ -1311,24 +1230,16 @@ public:
class docLvl
{
public:
long ILvl;
long Format;
BYTE Jc;
std::vector<docLvlText*> Text;
long Restart;
long Start;
BYTE Suff;
NSStringUtils::CStringBuilder ParaPr;
NSStringUtils::CStringBuilder TextPr;
XmlUtils::CStringWriter ParaPr;
XmlUtils::CStringWriter TextPr;
std::wstring PStyle;
bool Tentative;
unsigned long Tplc;
bool IsLgl;
bool Legacy;
long LegacyIndent;
unsigned long LegacySpace;
bool bILvl;
bool bFormat;
bool bJc;
bool bText;
@ -1338,17 +1249,8 @@ public:
bool bParaPr;
bool bTextPr;
bool bPStyle;
bool bTentative;
bool bTplc;
bool bIsLgl;
bool bLvlLegacy;
bool bLegacy;
bool bLegacyIndent;
bool bLegacySpace;
docLvl()
{
bILvl = false;
bFormat = false;
bJc = false;
bText = false;
@ -1358,13 +1260,6 @@ public:
bParaPr = false;
bTextPr = false;
bPStyle = false;
bTentative = false;
bTplc = false;
bIsLgl = false;
bLvlLegacy = false;
bLegacy = false;
bLegacyIndent = false;
bLegacySpace = false;
}
~docLvl()
{
@ -1373,27 +1268,9 @@ public:
delete Text[i];
}
}
void Write(NSStringUtils::CStringBuilder& oWriter)
void Write(XmlUtils::CStringWriter& oWriter, int index)
{
oWriter.WriteString(L"<w:lvl");
if(bILvl)
{
oWriter.WriteString(L" w:ilvl=\"" + std::to_wstring(ILvl) + L"\"");
}
if(bTentative)
{
if(Tentative)
oWriter.WriteString(L" w:tentative=\"1\"");
else
oWriter.WriteString(L" w:tentative=\"0\"");
}
if(bTplc)
{
oWriter.WriteString(L" w:tplc=\"");
oWriter.WriteString(XmlUtils::IntToString(Tplc, L"%08X"));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L">");
oWriter.WriteString(L"<w:lvl w:ilvl=\"" + std::to_wstring(index) + L"\">");
if(bStart)
{
oWriter.WriteString(L"<w:start w:val=\"" + std::to_wstring(Start) + L"\"/>");
@ -1417,7 +1294,7 @@ public:
oWriter.WriteString(L"<w:numFmt w:val=\"" + sFormat + L"\"/>");
}
}
if(bRestart)
if(bRestart && 0 == Restart)
{
oWriter.WriteString(L"<w:lvlRestart w:val=\"" + std::to_wstring(Restart) + L"\"/>");
}
@ -1426,13 +1303,6 @@ public:
std::wstring sStyleName = XmlUtils::EncodeXmlString(PStyle);
oWriter.WriteString(L"<w:pStyle w:val=\"" + sStyleName + L"\"/>");
}
if(bIsLgl)
{
if(IsLgl)
oWriter.WriteString(L"<w:isLgl/>");
else
oWriter.WriteString(L"<w:isLgl w:val=\"false\"/>");
}
if(bSuff)
{
std::wstring sSuff;
@ -1471,30 +1341,6 @@ public:
oWriter.WriteString(sTextXml);
}
if(bLvlLegacy)
{
oWriter.WriteString(L"<w:legacy");
if(bLegacy)
{
if(Legacy)
oWriter.WriteString(L" w:legacy=\"1\"");
else
oWriter.WriteString(L" w:legacy=\"0\"");
}
if(bLegacyIndent)
{
oWriter.WriteString(L" w:legacyIndent=\"");
oWriter.WriteString(std::to_wstring(LegacyIndent));
oWriter.WriteString(L"\"");
}
if(bLegacySpace)
{
oWriter.WriteString(L" w:legacySpace=\"");
oWriter.WriteString(std::to_wstring(LegacySpace));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L"/>");
}
if(bJc)
{
std::wstring sJc;
@ -1521,48 +1367,6 @@ public:
oWriter.WriteString(L"</w:lvl>");
}
};
class docLvlOverride
{
public:
long ILvl;
long StartOverride;
docLvl* Lvl;
bool bILvl;
bool bStartOverride;
docLvlOverride()
{
bILvl = false;
bStartOverride = false;
Lvl = NULL;
}
~docLvlOverride()
{
RELEASEOBJECT(Lvl);
}
void Write(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(L"<w:lvlOverride");
if (bILvl)
{
oWriter.WriteString(L" w:ilvl=\"");
oWriter.WriteString(std::to_wstring(ILvl));
oWriter.WriteString(L"\"");
}
oWriter.WriteString(L">");
if (bStartOverride)
{
oWriter.WriteString(L"<w:startOverride w:val=\"");
oWriter.WriteString(std::to_wstring(StartOverride));
oWriter.WriteString(L"\"/>");
}
if(NULL != Lvl)
{
Lvl->Write(oWriter);
}
oWriter.WriteString(L"</w:lvlOverride>");
}
};
class docANum
{
public:
@ -1583,7 +1387,7 @@ public:
delete Lvls[i];
}
}
void Write(NSStringUtils::CStringBuilder& oWriterANum)
void Write(XmlUtils::CStringWriter& oWriterANum)
{
if(bId)
{
@ -1600,7 +1404,7 @@ public:
}
for(int i = 0, length = (int)Lvls.size(); i < length; ++i)
{
Lvls[i]->Write(oWriterANum);
Lvls[i]->Write(oWriterANum, i);
}
oWriterANum.WriteString(L"</w:abstractNum>");
}
@ -1611,7 +1415,6 @@ class docNum
public:
long AId;
long Id;
std::vector<docLvlOverride*> LvlOverrides;
bool bAId;
bool bId;
@ -1620,21 +1423,12 @@ public:
bAId = false;
bId = false;
}
~docNum()
{
for(size_t i = 0; i < LvlOverrides.size(); ++i){
RELEASEOBJECT(LvlOverrides[i]);
}
}
void Write(NSStringUtils::CStringBuilder& oWriterNumList)
void Write(XmlUtils::CStringWriter& oWriterNumList)
{
if(bAId && bId)
{
oWriterNumList.WriteString(L"<w:num w:numId=\"" + std::to_wstring(Id) + L"\"><w:abstractNumId w:val=\"" + std::to_wstring(AId) + L"\"/>");
for(size_t i = 0; i < LvlOverrides.size(); ++i){
LvlOverrides[i]->Write(oWriterNumList);
}
oWriterNumList.WriteString(L"</w:num>");
oWriterNumList.WriteString(L"<w:num w:numId=\"" + std::to_wstring(Id) + L"\"><w:abstractNumId w:val=\"" +
std::to_wstring(AId) + L"\"/></w:num>");
}
}
};
@ -1650,7 +1444,7 @@ public:
sName = name;
bGridAfter = false;
}
void Write(NSStringUtils::CStringBuilder& writer)
void Write(XmlUtils::CStringWriter& writer)
{
if(bGridAfter && nGridAfter > 0)
{
@ -1667,7 +1461,7 @@ public:
std::wstring href;
std::wstring anchor;
std::wstring tooltip;
NSStringUtils::CStringBuilder writer;
XmlUtils::CStringWriter writer;
static WriteHyperlink* Parse(std::wstring fld)
{
WriteHyperlink* res = NULL;
@ -1746,7 +1540,7 @@ public:
}
return res;
}
void Write(NSStringUtils::CStringBuilder& wr)
void Write(XmlUtils::CStringWriter& wr)
{
if(false == rId.empty())
{
@ -1792,6 +1586,7 @@ public:
};
class CComment{
private:
typedef std::wstring (*funcArg)(CComment* pComment);
IdCounter& m_oParaIdCounter;
IdCounter& m_oFormatIdCounter;
public:
@ -1852,13 +1647,13 @@ public:
}
return sRes;
}
std::wstring writeTemplates(bool isExt)
std::wstring writeTemplates(funcArg fReadFunction)
{
std::wstring sRes;
sRes += isExt ? writeContentExt(this) : writeContent(this);
sRes += (fReadFunction(this));
for(size_t i = 0; i < replies.size(); ++i)
sRes += isExt ? writeContentExt(replies[i]) : writeContent(replies[i]);
sRes += (fReadFunction(replies[i]));
return sRes;
}
static std::wstring writeRef(CComment* pComment, const std::wstring& sBefore, const std::wstring& sRef, const std::wstring& sAfter)
@ -1942,22 +1737,25 @@ public:
sRes += L"\"";
}
sRes += L">";
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
if(false == pComment->Text.empty())
{
wchar_t cToken = sText[i];
if('\n' == cToken)
std::wstring sText = pComment->Text;
XmlUtils::replace_all(sText, L"\r", L"");
bool bFirst = true;
int nPrevIndex = 0;
for (int i = 0; i < (int)sText.length(); i++)
{
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
wchar_t cToken = sText[i];
if('\n' == cToken)
{
bFirst = writeContentWritePart(pComment, sText, nPrevIndex, i, bFirst, sRes);
nPrevIndex = i + 1;
}
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
}
writeContentWritePart(pComment, sText, nPrevIndex, (int)sText.length(), bFirst, sRes);
sRes += L"</w:comment>";
return sRes;
}
@ -2047,7 +1845,7 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += it->second->writeTemplates(false);
sRes += (it->second->writeTemplates(CComment::writeContent));
}
return sRes;
}
@ -2056,7 +1854,7 @@ public:
std::wstring sRes;
for (boost::unordered_map<int, CComment*>::const_iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sRes += it->second->writeTemplates(true);
sRes += (it->second->writeTemplates(CComment::writeContentExt));
}
return sRes;
}
@ -2652,7 +2450,7 @@ public: CFramePr()
{
return !(bDropCap || bH || bHAnchor || bHRule || bHSpace || bLines || bVAnchor || bVSpace || bW || bWrap || bX || bXAlign || bY || bYAlign);
}
void Write(NSStringUtils::CStringBuilder& oStringWriter)
void Write(XmlUtils::CStringWriter& oStringWriter)
{
oStringWriter.WriteString(L"<w:framePr");
if(bDropCap)
@ -2790,7 +2588,7 @@ public:
std::wstring sDocLocation;
std::wstring sTgtFrame;
NSStringUtils::CStringBuilder writer;
XmlUtils::CStringWriter writer;
bool bHistory;
public:
@ -2798,7 +2596,7 @@ public:
{
bHistory = false;
}
void Write(NSStringUtils::CStringBuilder& wr)
void Write(XmlUtils::CStringWriter& wr)
{
if(false == rId.empty())
{
@ -2829,12 +2627,12 @@ public:
class CFldSimple{
public:
std::wstring sInstr;
NSStringUtils::CStringBuilder writer;
XmlUtils::CStringWriter writer;
public:
CFldSimple()
{
}
void Write(NSStringUtils::CStringBuilder& wr)
void Write(XmlUtils::CStringWriter& wr)
{
if(false == sInstr.empty())
{
@ -2859,14 +2657,14 @@ public:
long* vMergeOrigin;
rPr* RPr;
NSStringUtils::CStringBuilder* PPr;
XmlUtils::CStringWriter* PPr;
SectPr* sectPr;
CWiterTblPr* tblPr;
NSStringUtils::CStringBuilder* tblGridChange;
NSStringUtils::CStringBuilder* trPr;
NSStringUtils::CStringBuilder* tcPr;
NSStringUtils::CStringBuilder* content;
NSStringUtils::CStringBuilder* contentRun;
XmlUtils::CStringWriter* tblGridChange;
XmlUtils::CStringWriter* trPr;
XmlUtils::CStringWriter* tcPr;
XmlUtils::CStringWriter* content;
XmlUtils::CStringWriter* contentRun;
TrackRevision()
{
Id = NULL;
@ -2903,11 +2701,11 @@ public:
}
std::wstring ToString(std::wstring sName)
{
NSStringUtils::CStringBuilder writer;
XmlUtils::CStringWriter writer;
Write(&writer, sName);
return writer.GetData();
}
void Write(NSStringUtils::CStringBuilder* pCStringWriter, std::wstring sName)
void Write(XmlUtils::CStringWriter* pCStringWriter, std::wstring sName)
{
if(IsNoEmpty())
{

View File

@ -47,9 +47,7 @@ Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReade
}
int Binary_HdrFtrTableReader::Read()
{
int res = c_oSerConstants::ReadOk;
READ_TABLE_DEF(res, this->ReadHdrFtrContent, NULL);
return res;
return ReadTable(&Binary_HdrFtrTableReader::ReadHdrFtrContent, this);
}
int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* poResult)
{
@ -57,7 +55,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* po
if ( c_oSerHdrFtrTypes::Header == type || c_oSerHdrFtrTypes::Footer == type )
{
nCurType = type;
READ1_DEF(length, res, this->ReadHdrFtrFEO, poResult);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrFEO, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
@ -69,7 +67,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrFEO(BYTE type, long length, void* poResu
if ( c_oSerHdrFtrTypes::HdrFtr_First == type || c_oSerHdrFtrTypes::HdrFtr_Even == type || c_oSerHdrFtrTypes::HdrFtr_Odd == type )
{
nCurHeaderType = type;
READ1_DEF(length, res, this->ReadHdrFtrItem, poResult);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItem, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
@ -101,7 +99,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
}
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
READ1_DEF(length, res, this->ReadHdrFtrItemContent, &oBinary_DocumentTableReader);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word" +
FILE_SEPARATOR_STR + L"_rels"+
@ -120,4 +118,4 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ namespace Writers
class SettingWriter
{
std::wstring m_sDir;
NSStringUtils::CStringBuilder m_oSettingWriter;
XmlUtils::CStringWriter m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
SettingWriter(std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)

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