summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-06 23:09:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-07 11:06:46 +0000
commitac7a11255afc531ce2ca4958277c27d6d29e7c3c (patch)
tree1300d78788caf520e2ea2bff314e5e4e4bfb8d3c /sw
parentremove various unused methods and source files (diff)
downloadcore-ac7a11255afc531ce2ca4958277c27d6d29e7c3c.tar.gz
core-ac7a11255afc531ce2ca4958277c27d6d29e7c3c.zip
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.
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx6
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx19
-rw-r--r--sw/source/filter/ww8/ww8par.hxx27
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx2
5 files changed, 8 insertions, 52 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 048a547169b9..b24985e3ebf1 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -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,
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index a1827bf41264..f466fcc8874c 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -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 );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 6524abc348d0..f8614f9b2675 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -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 );
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index a19b50ca036b..0c7001c8568a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -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
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 0447a73528e0..6b44d824c560 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -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: