mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
исправление ошибки с embedded объктами Excel - msfo2009.doc
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65062 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
f34b4a657d
commit
176cc65df1
@ -471,9 +471,11 @@ namespace DocFileFormat
|
||||
int cpFieldEnd = searchNextTextMark( m_document->Text, cpFieldStart, TextMark::FieldEndMark );
|
||||
|
||||
std::wstring f( ( m_document->Text->begin() + cpFieldStart ), ( m_document->Text->begin() + cpFieldEnd + 1 ) );
|
||||
std::wstring embed( _T( " EMBED" ) );
|
||||
std::wstring link( _T( " LINK" ) );
|
||||
std::wstring form( _T( " FORM" ) );
|
||||
std::wstring embed ( _T( " EMBED" ) );
|
||||
std::wstring link ( _T( " LINK" ) );
|
||||
std::wstring form ( _T( " FORM" ) );
|
||||
std::wstring excel ( _T( " Excel" ) );
|
||||
std::wstring mergeformat ( _T( " MERGEFORMAT" ) );
|
||||
|
||||
if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() )
|
||||
{
|
||||
@ -498,7 +500,8 @@ namespace DocFileFormat
|
||||
|
||||
this->_fldCharCounter++;
|
||||
}
|
||||
else if ((search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end()) || (search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()))
|
||||
else if ((search(f.begin(), f.end(), mergeformat.begin(), mergeformat.end()) != f.end()) ||
|
||||
(search(f.begin(), f.end(), excel.begin(), excel.end()) != f.end()))
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
@ -508,7 +511,57 @@ namespace DocFileFormat
|
||||
int fcPic = m_document->m_PieceTable->FileCharacterPositions->operator []( cpPic );
|
||||
list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
CharacterPropertyExceptions* chpxPic = chpxs->front();
|
||||
PictureDescriptor pic(chpxPic, m_document->DataStream);
|
||||
//PictureDescriptor pic(chpxPic, m_document->DataStream, cpFieldEnd - cpPic );
|
||||
|
||||
RevisionData oData = RevisionData(chpxPic);
|
||||
|
||||
/// <w:rPr>
|
||||
CharacterPropertiesMapping* rPr = new CharacterPropertiesMapping(m_pXmlWriter, m_document, &oData, _lastValidPapx, false);
|
||||
if(rPr)
|
||||
{
|
||||
chpxPic->Convert(rPr);
|
||||
RELEASEOBJECT(rPr);
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin (_T( "w:object" ), TRUE);
|
||||
|
||||
//append the origin attributes
|
||||
m_pXmlWriter->WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( 0 ).c_str() );
|
||||
m_pXmlWriter->WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( 0 ).c_str() );
|
||||
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
|
||||
|
||||
VMLPictureMapping oVmlMapper (m_context, m_pXmlWriter, true, _caller);
|
||||
//pic.Convert(&oVmlMapper);
|
||||
RELEASEOBJECT(chpxs);
|
||||
|
||||
if ( cpFieldSep < cpFieldEnd )
|
||||
{
|
||||
int fcFieldSep = m_document->m_PieceTable->FileCharacterPositions->operator []( cpFieldSep );
|
||||
list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
|
||||
CharacterPropertyExceptions* chpxSep = chpxs->front();
|
||||
OleObject ole ( chpxSep, m_document->GetStorage() );
|
||||
OleObjectMapping oleObjectMapping( m_pXmlWriter, m_context, NULL, _caller, oVmlMapper.GetShapeId() );
|
||||
ole.Convert( &oleObjectMapping );
|
||||
RELEASEOBJECT( chpxs );
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeEnd( _T( "w:object" ) );
|
||||
}
|
||||
|
||||
this->_skipRuns = 5;
|
||||
}
|
||||
else if ((search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end()) || (search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()))
|
||||
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
int fcPic = m_document->m_PieceTable->FileCharacterPositions->operator []( cpPic );
|
||||
list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fcPic, fcPic + 1);
|
||||
CharacterPropertyExceptions* chpxPic = chpxs->front();
|
||||
PictureDescriptor pic(chpxPic, m_document->DataStream, cpFieldEnd - cpPic );
|
||||
|
||||
RevisionData oData = RevisionData(chpxPic);
|
||||
|
||||
@ -622,7 +675,7 @@ namespace DocFileFormat
|
||||
}
|
||||
else if ((TextMark::Picture == c) && fSpec)
|
||||
{
|
||||
PictureDescriptor oPicture (chpx, m_document->DataStream);
|
||||
PictureDescriptor oPicture (chpx, m_document->DataStream, 0x7fffffff);
|
||||
|
||||
if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer))
|
||||
{
|
||||
|
||||
@ -446,7 +446,7 @@ namespace DocFileFormat
|
||||
|
||||
if ((chpxs != NULL) && (!chpxs->empty()))
|
||||
{
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream);
|
||||
PictureDescriptor pict(chpxs->front(), m_document->DataStream, fcEnd - fc);
|
||||
|
||||
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
|
||||
{
|
||||
|
||||
@ -37,6 +37,8 @@ namespace DocFileFormat
|
||||
|
||||
bool isContainer = ( version == 0xF );
|
||||
|
||||
if (typeCode == 0x01f6) return NULL; //орг диаграмм
|
||||
|
||||
Record* pRecord = NewRecord (typeCode);
|
||||
if (pRecord)
|
||||
{
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
namespace DocFileFormat
|
||||
{
|
||||
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
|
||||
PictureDescriptor::PictureDescriptor(CharacterPropertyExceptions* chpx, POLE::Stream* stream) : dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), Name( _T( "" ) ), mfp(), dxaCropLeft(0), dyaCropTop(0),
|
||||
PictureDescriptor::PictureDescriptor(CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size) :
|
||||
dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), Name( _T( "" ) ), mfp(), dxaCropLeft(0), dyaCropTop(0),
|
||||
dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0),
|
||||
cProps(0), shapeContainer(NULL), blipStoreEntry(NULL)
|
||||
{
|
||||
@ -13,7 +14,7 @@ namespace DocFileFormat
|
||||
|
||||
if ( fc >= 0 )
|
||||
{
|
||||
parse( stream, fc );
|
||||
parse( stream, fc, size );
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,13 +32,23 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(shapeContainer);
|
||||
RELEASEOBJECT(blipStoreEntry);
|
||||
}
|
||||
void PictureDescriptor::parse(POLE::Stream* stream, int fc)
|
||||
void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz)
|
||||
{
|
||||
Clear();
|
||||
|
||||
VirtualStreamReader reader(stream, fc);
|
||||
|
||||
int lcb = reader.ReadInt32();
|
||||
|
||||
if (lcb > sz)
|
||||
{
|
||||
unsigned char* bytes = reader.ReadBytes(sz - fc - 4, false);
|
||||
if ( bytes )
|
||||
{
|
||||
RELEASEARRAYOBJECTS( bytes );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (lcb > 0)
|
||||
{
|
||||
@ -110,11 +121,11 @@ namespace DocFileFormat
|
||||
|
||||
long pos = reader.GetPosition();
|
||||
|
||||
if( pos < ( fc + lcb ) )
|
||||
if( pos < ( fc + lcb ))
|
||||
{
|
||||
Record* rec = RecordFactory::ReadRecord( &reader, 0 );
|
||||
|
||||
if( typeid(*rec) == typeid(BlipStoreEntry) )
|
||||
if ((rec) && ( typeid(*rec) == typeid(BlipStoreEntry) ))
|
||||
{
|
||||
blipStoreEntry = dynamic_cast<BlipStoreEntry*>( rec );
|
||||
}
|
||||
|
||||
@ -50,12 +50,12 @@ namespace DocFileFormat
|
||||
|
||||
public:
|
||||
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
|
||||
PictureDescriptor( CharacterPropertyExceptions* chpx, POLE::Stream* stream );
|
||||
PictureDescriptor( CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size );
|
||||
virtual ~PictureDescriptor();
|
||||
|
||||
private:
|
||||
|
||||
void parse( POLE::Stream* stream, int fc );
|
||||
void parse( POLE::Stream* stream, int fc, int sz );
|
||||
/// 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 );
|
||||
|
||||
@ -54,7 +54,7 @@ namespace DocFileFormat
|
||||
{
|
||||
PictureDescriptor* pict = static_cast<PictureDescriptor*>(visited);
|
||||
|
||||
if (pict->shapeContainer || pict->blipStoreEntry)
|
||||
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
|
||||
{
|
||||
Shape* shape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
|
||||
list<OptionEntry> options = pict->shapeContainer->ExtractOptions();
|
||||
|
||||
Reference in New Issue
Block a user