We just want to know if this ole object is already exported or not
So it's merely the knowledge of having exported this object already that we need to know in order to elide re-exporting it. This code is still 64bit unsafe, as the nPictureId has to be a unique 32bit value for each object, so using the pointer as the key is horribly dubious, but this should be the same as the original code.
This commit is contained in:
parent
bbc6d8506d
commit
ac7a11255a
@ -2849,9 +2849,6 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
|
||||
pOLEExp = new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags );
|
||||
}
|
||||
|
||||
if ( !pOleMap)
|
||||
pOleMap = new WW8OleMaps;
|
||||
|
||||
if ( !pOCXExp && pDoc->GetDocShell() )
|
||||
pOCXExp = new SwMSConvertControls( pDoc->GetDocShell(), pCurPam );
|
||||
|
||||
@ -3266,7 +3263,7 @@ sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed,
|
||||
|
||||
MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
|
||||
: aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0),
|
||||
pBmpPal(0), pOLEExp(0), pOCXExp(0), pOleMap(0),
|
||||
pBmpPal(0), pOLEExp(0), pOCXExp(0),
|
||||
mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0),
|
||||
mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0),
|
||||
pStyles( NULL ),
|
||||
@ -3284,7 +3281,6 @@ MSWordExportBase::~MSWordExportBase()
|
||||
delete pBmpPal;
|
||||
delete pOLEExp;
|
||||
delete pOCXExp;
|
||||
delete pOleMap;
|
||||
}
|
||||
|
||||
WW8Export::WW8Export( SwWW8Writer *pWriter,
|
||||
|
@ -117,7 +117,7 @@ class WW8_WrtBookmarks;
|
||||
class WW8_WrtRedlineAuthor;
|
||||
class SvxMSExportOLEObjects;
|
||||
class SwMSConvertControls;
|
||||
class WW8OleMaps;
|
||||
typedef std::set<sal_uInt32> WW8OleSet;
|
||||
class SvStorageRef;
|
||||
struct WW8_PdAttrDesc;
|
||||
class SvxBrushItem;
|
||||
@ -461,7 +461,7 @@ public:
|
||||
boost::shared_ptr<NfKeywordTable> pKeyMap;
|
||||
SvxMSExportOLEObjects* pOLEExp;
|
||||
SwMSConvertControls* pOCXExp;
|
||||
WW8OleMaps* pOleMap;
|
||||
WW8OleSet m_aOleSet; // To remember all already exported ole objects
|
||||
ww8::WW8TableInfo::Pointer_t mpTableInfo;
|
||||
|
||||
sal_uInt16 nCharFmtStart;
|
||||
@ -968,7 +968,7 @@ public:
|
||||
|
||||
SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; }
|
||||
SwMSConvertControls& GetOCXExp() { return *pOCXExp; }
|
||||
WW8OleMaps& GetOLEMap() { return *pOleMap; }
|
||||
WW8OleSet& GetOLESet() { return m_aOleSet; }
|
||||
void ExportDopTypography(WW8DopTypography &rTypo);
|
||||
|
||||
sal_uInt16 AddRedlineAuthor( sal_uInt16 nId );
|
||||
|
@ -241,22 +241,11 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
|
||||
uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode&>(rOLENode).GetOLEObj().GetOleRef());
|
||||
if( xObj.is() )
|
||||
{
|
||||
embed::XEmbeddedObject *pObj = xObj.get();
|
||||
const embed::XEmbeddedObject *pObj = xObj.get();
|
||||
sal_uInt32 nPictureId = (sal_uInt32)(sal_uIntPtr)pObj;
|
||||
//.second is false when element already existed
|
||||
bool bIsNotDuplicate = GetOLESet().insert(nPictureId).second;
|
||||
Set_UInt32(pDataAdr, nPictureId);
|
||||
|
||||
WW8OleMap *pMap = new WW8OleMap(nPictureId);
|
||||
bool bDuplicate = false;
|
||||
WW8OleMaps &rOleMap = GetOLEMap();
|
||||
sal_uInt16 nPos;
|
||||
if ( rOleMap.Seek_Entry(pMap, &nPos) )
|
||||
{
|
||||
bDuplicate = true;
|
||||
delete pMap;
|
||||
}
|
||||
else if( 0 == rOleMap.Insert( pMap) )
|
||||
delete pMap;
|
||||
|
||||
String sStorageName( '_' );
|
||||
sStorageName += String::CreateFromInt32( nPictureId );
|
||||
SvStorageRef xOleStg = xObjStg->OpenSotStorage( sStorageName,
|
||||
@ -267,7 +256,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
|
||||
If this object storage has been written already don't
|
||||
waste time rewriting it
|
||||
*/
|
||||
if (!bDuplicate)
|
||||
if (bIsNotDuplicate)
|
||||
{
|
||||
sal_Int64 nAspect = rOLENode.GetAspect();
|
||||
svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
|
||||
|
@ -143,12 +143,7 @@ namespace com{namespace sun {namespace star{
|
||||
|
||||
struct WW8LFOInfo;
|
||||
typedef WW8LFOInfo* WW8LFOInfo_Ptr;
|
||||
// Redlining: match WinWord author ids to StarWriter author ids
|
||||
struct WW8OleMap;
|
||||
typedef WW8OleMap* WW8OleMap_Ptr;
|
||||
|
||||
SV_DECL_PTRARR_DEL(WW8LFOInfos,WW8LFOInfo_Ptr,16)
|
||||
SV_DECL_PTRARR_SORT_DEL(WW8OleMaps, WW8OleMap_Ptr,16)
|
||||
|
||||
class WW8Reader : public StgReader
|
||||
{
|
||||
@ -161,28 +156,6 @@ public:
|
||||
virtual sal_Bool ReadGlossaries( SwTextBlocks&, sal_Bool bSaveRelFiles ) const;
|
||||
};
|
||||
|
||||
struct WW8OleMap
|
||||
{
|
||||
sal_uInt32 mnWWid;
|
||||
String msStorageName;
|
||||
|
||||
WW8OleMap(sal_uInt32 nWWid)
|
||||
: mnWWid(nWWid) {}
|
||||
|
||||
WW8OleMap(sal_uInt32 nWWid, String sStorageName)
|
||||
: mnWWid(nWWid), msStorageName(sStorageName) {}
|
||||
|
||||
bool operator==(const WW8OleMap & rEntry) const
|
||||
{
|
||||
return (mnWWid == rEntry.mnWWid);
|
||||
}
|
||||
bool operator<(const WW8OleMap & rEntry) const
|
||||
{
|
||||
return (mnWWid < rEntry.mnWWid);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class SwWW8ImplReader;
|
||||
struct WW8LSTInfo;
|
||||
class WW8ListManager
|
||||
|
@ -72,8 +72,6 @@ struct OLE_MFP
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
SV_IMPL_OP_PTRARR_SORT(WW8OleMaps, WW8OleMap_Ptr)
|
||||
|
||||
static bool SwWw8ReadScaling(long& rX, long& rY, SvStorageRef& rSrc1)
|
||||
{
|
||||
// Skalierungsfaktoren holen:
|
||||
|
@ -371,11 +371,6 @@ WPXPropertyList::Iter::last()
|
||||
WPXPropertyListVector::Iter::last()
|
||||
WPXString::Iter::last()
|
||||
WPXSubDocument::WPXSubDocument()
|
||||
WW8OleMaps::Insert(WW8OleMap* const&, unsigned short&)
|
||||
WW8OleMaps::Insert(WW8OleMap* const*, unsigned short)
|
||||
WW8OleMaps::Insert(WW8OleMaps const*, unsigned short, unsigned short)
|
||||
WW8OleMaps::Remove(WW8OleMap* const&, unsigned short)
|
||||
WW8OleMaps::Remove(unsigned short, unsigned short)
|
||||
WinMtfOutput::DrawLine(Point const&, Point const&)
|
||||
WinMtfOutput::GetTextLayoutMode() const
|
||||
WinMtfOutput::SetFont(Font const&)
|
||||
|
Loading…
x
Reference in New Issue
Block a user