Commit 1c75f814 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

DocFormatReader - вытаскивание embedded вида xml, docx .. - смартАрты, формулы...

DocFormatReader - вытаскивание embedded вида xml, docx .. - смартАрты, формулы итд более старших версий мс офиса
parent 1e54cf26
...@@ -507,6 +507,7 @@ namespace DocFileFormat ...@@ -507,6 +507,7 @@ namespace DocFileFormat
std::wstring equation ( _T( " Equation" ) ) ; std::wstring equation ( _T( " Equation" ) ) ;
std::wstring mergeformat( _T( " MERGEFORMAT" ) ); std::wstring mergeformat( _T( " MERGEFORMAT" ) );
std::wstring quote ( _T( " QUOTE" ) ); std::wstring quote ( _T( " QUOTE" ) );
std::wstring chart ( _T( "Chart" ) );
if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() ) if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() )
{ {
...@@ -531,18 +532,13 @@ namespace DocFileFormat ...@@ -531,18 +532,13 @@ namespace DocFileFormat
this->_fldCharCounter++; this->_fldCharCounter++;
} }
else if (search( f.begin(), f.end(), quote.begin(), quote.end()) != f.end())
{
//todooo сохранить docx с формулой мс офис в doc.
//todooo формула там где то храниться !! найти
this->_skipRuns = 3;
}
else if (( search( f.begin(), f.end(), mergeformat.begin(), mergeformat.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() || (( search( f.begin(), f.end(), excel.begin(), excel.end()) != f.end() ||
search( f.begin(), f.end(), word.begin(), word.end()) != f.end()) search( f.begin(), f.end(), word.begin(), word.end()) != f.end())
&& &&
( search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end() || ( search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end() ||
search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()) )) search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()) &&
search( f.begin(), f.end(), chart.begin(), chart.end() ) == f.end()))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:fldChar" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) ); m_pXmlWriter->WriteAttribute( _T( "w:fldCharType" ), _T( "begin" ) );
...@@ -557,7 +553,8 @@ namespace DocFileFormat ...@@ -557,7 +553,8 @@ namespace DocFileFormat
this->_fldCharCounter++; this->_fldCharCounter++;
} }
else if ( search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end() else if ( search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end()
|| search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()) || search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()
|| search( f.begin(), f.end(), quote.begin(), quote.end()) != f.end())
{ {
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture); int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator); int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
...@@ -597,9 +594,18 @@ namespace DocFileFormat ...@@ -597,9 +594,18 @@ namespace DocFileFormat
int fcFieldSep = m_document->m_PieceTable->FileCharacterPositions->operator []( cpFieldSep ); int fcFieldSep = m_document->m_PieceTable->FileCharacterPositions->operator []( cpFieldSep );
list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) ); list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcFieldSep, ( fcFieldSep + 1 ) );
CharacterPropertyExceptions* chpxSep = chpxs->front(); CharacterPropertyExceptions* chpxSep = chpxs->front();
OleObject ole ( chpxSep, m_document->GetStorage() ); OleObject ole ( chpxSep, m_document->GetStorage() );
OleObjectMapping oleObjectMapping( m_pXmlWriter, m_context, &pic, _caller, oVmlMapper.GetShapeId() ); OleObjectMapping oleObjectMapping( m_pXmlWriter, m_context, &pic, _caller, oVmlMapper.GetShapeId() );
if (oVmlMapper.m_isEquation || oVmlMapper.m_isEmbedded)
{
ole.isEquation = oVmlMapper.m_isEquation;
ole.isEmbedded = oVmlMapper.m_isEmbedded;
ole.emeddedData = oVmlMapper.m_embeddedData;
}
ole.Convert( &oleObjectMapping ); ole.Convert( &oleObjectMapping );
RELEASEOBJECT( chpxs ); RELEASEOBJECT( chpxs );
} }
...@@ -703,12 +709,24 @@ namespace DocFileFormat ...@@ -703,12 +709,24 @@ namespace DocFileFormat
if (picture) if (picture)
{ {
VMLPictureMapping oVMLPicture(m_context, m_pXmlWriter, false, _caller); VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller);
oPicture.Convert (&oVMLPicture); oPicture.Convert (&oVmlMapper);
if (oVmlMapper.m_isEquation || oVmlMapper.m_isEmbedded)
{
OleObject ole ( chpx, m_document->GetStorage() );
OleObjectMapping oleObjectMapping( m_pXmlWriter, m_context, &oPicture, _caller, oVmlMapper.GetShapeId() );
ole.isEquation = oVmlMapper.m_isEquation;
ole.isEmbedded = oVmlMapper.m_isEmbedded;
ole.emeddedData = oVmlMapper.m_embeddedData;
ole.Convert( &oleObjectMapping );
}
}else }else
{ {
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, NULL, &oPicture, _caller); VMLShapeMapping oVmlMapper(m_context, m_pXmlWriter, NULL, &oPicture, _caller);
oPicture.shapeContainer->Convert(&oVmlWriter); oPicture.shapeContainer->Convert(&oVmlMapper);
} }
m_pXmlWriter->WriteNodeEnd (_T("w:pict")); m_pXmlWriter->WriteNodeEnd (_T("w:pict"));
......
...@@ -20,22 +20,28 @@ namespace DocFileFormat ...@@ -20,22 +20,28 @@ namespace DocFileFormat
OnCall = 3 OnCall = 3
}; };
wstring ObjectId; wstring ObjectId;
wstring ClassId; wstring ClassId;
// CLSID ClassId; // CLSID ClassId;
/// The the value is true, the object is a linked object /// The the value is true, the object is a linked object
bool fLinked; bool fLinked;
/// Display name of the linked object or embedded object. /// Display name of the linked object or embedded object.
wstring UserType; wstring UserType;
wstring ClipboardFormat; wstring ClipboardFormat;
wstring Link; wstring Link;
wstring Program; wstring Program;
LinkUpdateOption updateMode; LinkUpdateOption updateMode;
wstring UpdateMode; wstring UpdateMode;
OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage ): bool isEquation;
fLinked(false), updateMode(NoLink) bool isEmbedded;
{ std::string emeddedData;
OleObject( const CharacterPropertyExceptions* chpx, StructuredStorageReader* docStorage )
: fLinked(false), updateMode(NoLink)
{
isEquation = isEmbedded = false;
oleStorage = docStorage->GetStorage(); oleStorage = docStorage->GetStorage();
if ( ( chpx != NULL ) && ( docStorage != NULL ) ) if ( ( chpx != NULL ) && ( docStorage != NULL ) )
...@@ -177,9 +183,9 @@ namespace DocFileFormat ...@@ -177,9 +183,9 @@ namespace DocFileFormat
//skip the CompObjHeader //skip the CompObjHeader
reader.ReadBytes( 28, false ); reader.ReadBytes( 28, false );
this->UserType = reader.ReadLengthPrefixedAnsiString(); this->UserType = reader.ReadLengthPrefixedAnsiString();
this->ClipboardFormat = reader.ReadLengthPrefixedAnsiString(); this->ClipboardFormat = reader.ReadLengthPrefixedAnsiString();
this->Program = reader.ReadLengthPrefixedAnsiString(); this->Program = reader.ReadLengthPrefixedAnsiString();
delete pCompStream; delete pCompStream;
} }
......
...@@ -9,7 +9,8 @@ namespace DocFileFormat ...@@ -9,7 +9,8 @@ namespace DocFileFormat
class OleObjectMapping: public AbstractOpenXmlMapping, public IMapping class OleObjectMapping: public AbstractOpenXmlMapping, public IMapping
{ {
public: public:
OleObjectMapping(XmlUtils::CXmlWriter* writer, ConversionContext* context, PictureDescriptor* pict, IMapping* caller, const wstring& shapeId) : AbstractOpenXmlMapping(writer), m_context(NULL), _pict(NULL), _caller(NULL), _shapeId(shapeId) OleObjectMapping(XmlUtils::CXmlWriter* writer, ConversionContext* context, PictureDescriptor* pict, IMapping* caller, const wstring& shapeId)
: AbstractOpenXmlMapping(writer), m_context(NULL), _pict(NULL), _caller(NULL), _shapeId(shapeId)
{ {
m_context = context; m_context = context;
_pict = pict; _pict = pict;
...@@ -22,6 +23,13 @@ namespace DocFileFormat ...@@ -22,6 +23,13 @@ namespace DocFileFormat
if ( ole != NULL ) if ( ole != NULL )
{ {
if (ole->isEquation || ole->isEmbedded)
{
if (ole->isEquation) ole->ClipboardFormat = L"Equation";
if (ole->isEmbedded) ole->ClipboardFormat = L"MSWordDocx";
ole->Program = L"Word.Document";
}
m_pXmlWriter->WriteNodeBegin( _T( "o:OLEObject" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "o:OLEObject" ), TRUE );
//type //type
...@@ -48,7 +56,7 @@ namespace DocFileFormat ...@@ -48,7 +56,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() );
//ShapeId //ShapeId
m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), this->_shapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId.c_str() );
//DrawAspect //DrawAspect
m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) ); m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) );
...@@ -78,7 +86,14 @@ namespace DocFileFormat ...@@ -78,7 +86,14 @@ namespace DocFileFormat
{ {
objectExt = _T( ".ppt" ); objectExt = _T( ".ppt" );
} }
else if ( objectType == _T( "MSWordDocx" ) )//???
{
objectExt = _T( ".docx" );
}
else if ( objectType == _T( "Equation" ) )
{
objectExt = _T( ".xml" );
}
return objectExt; return objectExt;
} }
...@@ -112,25 +127,28 @@ namespace DocFileFormat ...@@ -112,25 +127,28 @@ namespace DocFileFormat
//!!!TODO: There is issue with some Office OLE Objects. Word can't open *.xls object (Excel.Chart) with set CLSID and //!!!TODO: There is issue with some Office OLE Objects. Word can't open *.xls object (Excel.Chart) with set CLSID and
//some Power Point Presentations, and Word Documents. Open Office CAN start this objects!!! //some Power Point Presentations, and Word Documents. Open Office CAN start this objects!!!
//CLSID clsid = GUID_NULL;
wstring clsid; wstring clsid;
wstring exelChart = _T( "Excel.Chart" ); wstring exelChart = _T( "Excel.Chart" );
if ( search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() ) if ( search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() )
{ {//??
clsid = ole->ClassId; clsid = ole->ClassId;
} }
OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid);
m_context->_docx->OleObjectsList.push_back( OleObjectFileStructure( OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid ) ); if (ole->isEquation || ole->isEmbedded)
{
object_descr.data = ole->emeddedData;
}
m_context->_docx->OleObjectsList.push_back(object_descr);
} }
} }
private: private:
ConversionContext* m_context; ConversionContext* m_context;
PictureDescriptor* _pict;
wstring _shapeId;
IMapping* _caller; PictureDescriptor* _pict;
std::wstring _shapeId;
IMapping* _caller;
}; };
} }
...@@ -101,12 +101,16 @@ namespace DocFileFormat ...@@ -101,12 +101,16 @@ namespace DocFileFormat
} }
} }
HRESULT OpenXmlPackage::SaveEmbeddedObject( const std::wstring& fileName, const std::string& data )
{
NSFile::CFileBinary file;
file.CreateFileW(fileName);
file.WriteFile((BYTE*)data.c_str(), data.size());
file.CloseFile();
return S_OK;
}
HRESULT OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure ) HRESULT OpenXmlPackage::SaveOLEObject( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure )
{ {
//std::ofstream fileOLE;
//fileOLE.open(fileName.c_str(), std::ios::binary|std::ios::out );
POLE::Storage *storageOut = new POLE::Storage(fileName.c_str()); POLE::Storage *storageOut = new POLE::Storage(fileName.c_str());
if (storageOut == NULL || docFile == NULL) return S_FALSE; if (storageOut == NULL || docFile == NULL) return S_FALSE;
...@@ -118,13 +122,11 @@ namespace DocFileFormat ...@@ -118,13 +122,11 @@ namespace DocFileFormat
POLE::Storage *storageInp = docFile->GetStorage()->GetStorage(); POLE::Storage *storageInp = docFile->GetStorage()->GetStorage();
//if (docFile->GetStorage()->GetStorage()->enterDirectory("ObjectPool"))
{ {
std::string id(oleObjectFileStructure.objectID.begin(),oleObjectFileStructure.objectID.end()); std::string id(oleObjectFileStructure.objectID.begin(),oleObjectFileStructure.objectID.end());
POLE::Stream* oleStorage = new POLE::Stream(storageInp, id); POLE::Stream* oleStorage = new POLE::Stream(storageInp, id);
//docFile->GetStorage()->GetStorage()->stream(id);
//if(docFile->GetStorage()->GetStorage()->enterDirectory(id))
if (oleStorage) if (oleStorage)
{ {
std::string path = "ObjectPool/" + id; std::string path = "ObjectPool/" + id;
...@@ -153,42 +155,6 @@ namespace DocFileFormat ...@@ -153,42 +155,6 @@ namespace DocFileFormat
delete stream_inp; delete stream_inp;
delete stream_out; delete stream_out;
} }
//std::streamsize sz = oleStorage->size();
//unsigned char *b = new unsigned char[sz];
//if (b)
//{
// sz = oleStorage->read(b,sz);
//
// ppstg->write(b, sz);
//std::vector<const POLE::DirEntry*> entries;
// docFile->GetStorage()->GetStorage()->listEntries(entries);
// for (long i=0; i <entries.size(); i++)
// {
// oleStorage = docFile->GetStorage()->GetStorage()->stream(entries[i]->name());
//
// std::streamsize sz = oleStorage->size();
// unsigned char *b = new unsigned char[sz];
// if (b)
// {
// POLE::Stream *new_stream = storageOut->add_stream(entries[i]->name(), sz);
// //bool res = new_stream->resize(sz);
// sz = oleStorage->read(b,sz);
// //fileOLE.write((const char*) b, sz );
// //storageOut->write(b,sz);
// sz = new_stream->write(b,sz);
// delete b;
// }
// }
// docFile->GetStorage()->GetStorage()->leaveDirectory();
//}
//docFile->GetStorage()->GetStorage()->leaveDirectory();
} }
} }
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
#include "../../Common/DocxFormat/Source/XML/xmlutils.h" #include "../../Common/DocxFormat/Source/XML/xmlutils.h"
//#include <fcntl.h>
//#include <sys/stat.h>
namespace DocFileFormat namespace DocFileFormat
{ {
struct Relationship struct Relationship
...@@ -69,27 +66,25 @@ namespace DocFileFormat ...@@ -69,27 +66,25 @@ namespace DocFileFormat
} }
std::wstring ext; std::wstring ext;
std::vector<unsigned char> data; std::vector<unsigned char> data;
Global::BlipType blipType; Global::BlipType blipType;
}; };
struct OleObjectFileStructure struct OleObjectFileStructure
{ {
wstring ext; std::wstring ext;
wstring objectID; std::wstring objectID;
wstring clsid; std::wstring clsid;
//CLSID clsid;
std::string data;
OleObjectFileStructure(){}
OleObjectFileStructure()
{
//this->clsid = GUID_NULL;
}
OleObjectFileStructure( const wstring& _ext, const wstring& _objectID, const wstring&/*REFCLSID*/ _clsid ): OleObjectFileStructure( const wstring& _ext, const wstring& _objectID, const wstring&/*REFCLSID*/ _clsid ):
ext(_ext), objectID(_objectID), clsid(_clsid) ext(_ext), objectID(_objectID), clsid(_clsid){}
{
}
}; };
class OpenXmlPackage class OpenXmlPackage
...@@ -136,7 +131,9 @@ namespace DocFileFormat ...@@ -136,7 +131,9 @@ namespace DocFileFormat
void WritePackage(); void WritePackage();
void SaveToFile( const wstring& outputDir, const wstring& fileName, const wstring& XMLContent ); void SaveToFile( const wstring& outputDir, const wstring& fileName, const wstring& XMLContent );
void SaveToFile( const wstring& outputDir, const wstring& fileName, const void* buf, unsigned int size ); void SaveToFile( const wstring& outputDir, const wstring& fileName, const void* buf, unsigned int size );
HRESULT SaveOLEObject( const wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveOLEObject ( const wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
int RegisterDocument(); int RegisterDocument();
int RegisterFontTable(); int RegisterFontTable();
......
...@@ -24,11 +24,14 @@ namespace DocFileFormat ...@@ -24,11 +24,14 @@ namespace DocFileFormat
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer) VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer)
{ {
m_ctx = ctx; m_ctx = ctx;
m_olePreview = olePreview; m_isOlePreview = olePreview;
m_imageData = NULL; m_imageData = NULL;
m_nImageId = 0; m_nImageId = 0;
m_caller = caller; m_caller = caller;
m_isBulletPicture = isBulletPicture; m_isBulletPicture = isBulletPicture;
m_isEquation = false;
m_isEmbedded = false;
m_imageData = new XMLTools::XMLElement<wchar_t>( _T( "v:imagedata" ) ); m_imageData = new XMLTools::XMLElement<wchar_t>( _T( "v:imagedata" ) );
...@@ -55,6 +58,7 @@ namespace DocFileFormat ...@@ -55,6 +58,7 @@ namespace DocFileFormat
//v:shapetype //v:shapetype
PictureFrameType type; PictureFrameType type;
type.SetType(shape->Instance); type.SetType(shape->Instance);
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture ); VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture );
type.Convert( vmlShapeTypeMapping ); type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping ); RELEASEOBJECT( vmlShapeTypeMapping );
...@@ -80,7 +84,7 @@ namespace DocFileFormat ...@@ -80,7 +84,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() );
if (m_olePreview) if (m_isOlePreview)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) ); m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) );
} }
...@@ -90,38 +94,43 @@ namespace DocFileFormat ...@@ -90,38 +94,43 @@ namespace DocFileFormat
{ {
switch ( iter->pid ) switch ( iter->pid )
{ {
//BORDERS case wzEquationXML:
{
m_isEquation = true;
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
}break;
case metroBlob:
{
//встроенная неведомая хуйня
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
}break;
//BORDERS
case borderBottomColor: case borderBottomColor:
{ {
RGBColor bottomColor( (int)iter->op, RedFirst ); RGBColor bottomColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderbottomcolor" ), ( wstring( _T( "#" ) ) + bottomColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "o:borderbottomcolor" ), ( wstring( _T( "#" ) ) + bottomColor.SixDigitHexCode ).c_str() );
} }
break; break;
case borderLeftColor: case borderLeftColor:
{ {
RGBColor leftColor( (int)iter->op, RedFirst ); RGBColor leftColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderleftcolor" ), ( wstring( _T( "#" ) ) + leftColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "o:borderleftcolor" ), ( wstring( _T( "#" ) ) + leftColor.SixDigitHexCode ).c_str() );
} }
break; break;
case borderRightColor: case borderRightColor:
{ {
RGBColor rightColor( (int)iter->op, RedFirst ); RGBColor rightColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderrightcolor" ), ( wstring( _T( "#" ) ) + rightColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "o:borderrightcolor" ), ( wstring( _T( "#" ) ) + rightColor.SixDigitHexCode ).c_str() );
} }
break; break;
case borderTopColor: case borderTopColor:
{ {
RGBColor topColor( (int)iter->op, RedFirst ); RGBColor topColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:bordertopcolor" ), ( wstring( _T( "#" ) ) + topColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "o:bordertopcolor" ), ( wstring( _T( "#" ) ) + topColor.SixDigitHexCode ).c_str() );
} }
break; break;
//CROPPING
//CROPPING
case cropFromBottom: case cropFromBottom:
{ {
//cast to signed integer //cast to signed integer
...@@ -129,7 +138,6 @@ namespace DocFileFormat ...@@ -129,7 +138,6 @@ namespace DocFileFormat
appendValueAttribute(m_imageData, _T( "cropbottom" ), ( FormatUtils::IntToWideString( cropBottom ) + wstring( _T( "f" ) ) ).c_str() ); appendValueAttribute(m_imageData, _T( "cropbottom" ), ( FormatUtils::IntToWideString( cropBottom ) + wstring( _T( "f" ) ) ).c_str() );
} }
break; break;
case cropFromLeft: case cropFromLeft:
{ {
//cast to signed integer //cast to signed integer
...@@ -137,7 +145,6 @@ namespace DocFileFormat ...@@ -137,7 +145,6 @@ namespace DocFileFormat
appendValueAttribute(m_imageData, _T( "cropleft" ), ( FormatUtils::IntToWideString( cropLeft ) + wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, _T( "cropleft" ), ( FormatUtils::IntToWideString( cropLeft ) + wstring( _T( "f" ) ) ).c_str());
} }
break; break;
case cropFromRight: case cropFromRight:
{ {
//cast to signed integer //cast to signed integer
...@@ -145,7 +152,6 @@ namespace DocFileFormat ...@@ -145,7 +152,6 @@ namespace DocFileFormat
appendValueAttribute(m_imageData, _T( "cropright" ), ( FormatUtils::IntToWideString( cropRight ) + wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, _T( "cropright" ), ( FormatUtils::IntToWideString( cropRight ) + wstring( _T( "f" ) ) ).c_str());
} }
break; break;
case cropFromTop: case cropFromTop:
{ {
//cast to signed integer //cast to signed integer
......
...@@ -36,14 +36,20 @@ namespace DocFileFormat ...@@ -36,14 +36,20 @@ namespace DocFileFormat
static std::wstring GetTargetExt (Global::BlipType nType); static std::wstring GetTargetExt (Global::BlipType nType);
static std::wstring GetContentType (Global::BlipType nType); static std::wstring GetContentType (Global::BlipType nType);
bool m_isEquation;
bool m_isEmbedded;
std::string m_embeddedData;
private: private:
ConversionContext* m_ctx; ConversionContext* m_ctx;
IMapping* m_caller; IMapping* m_caller;
int m_nImageId; int m_nImageId;
std::wstring m_ShapeId; std::wstring m_ShapeId;
bool m_olePreview;
bool m_isOlePreview;
bool m_isBulletPicture; bool m_isBulletPicture;
XMLTools::XMLElement<wchar_t>* m_imageData; XMLTools::XMLElement<wchar_t>* m_imageData;
}; };
} }
...@@ -184,7 +184,14 @@ namespace DocFileFormat ...@@ -184,7 +184,14 @@ namespace DocFileFormat
{ {
std::wstring fileName = string2std_string(pathObjects.GetPath()) + FILE_SEPARATOR_STR + _T( "oleObject" ) + FormatUtils::IntToWideString(i++) + iter->ext; std::wstring fileName = string2std_string(pathObjects.GetPath()) + FILE_SEPARATOR_STR + _T( "oleObject" ) + FormatUtils::IntToWideString(i++) + iter->ext;
SaveOLEObject( fileName, *iter ); if (!iter->data.empty())
{
SaveEmbeddedObject(fileName, iter->data);
}
else
{
SaveOLEObject( fileName, *iter );
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment