dont use GetItemSurrogates for gathering SwFormatURL
which is very expensive these days Change-Id: I6dbd6d1c66cd28c4f916842cd95f000215e52bc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
70f3fea2f3
commit
68566c28b9
@@ -1431,6 +1431,9 @@ public:
|
||||
/// Iterate over all SwFormatINetFormat, if the function returns false, iteration is stopped
|
||||
SW_DLLPUBLIC void ForEachINetFormat( const std::function<bool(const SwFormatINetFormat&)>& ) const;
|
||||
|
||||
/// Iterate over all SwFormatURL, if the function returns false, iteration is stopped
|
||||
SW_DLLPUBLIC void ForEachFormatURL( const std::function<bool(const SwFormatURL&)>& ) const;
|
||||
|
||||
// Call into intransparent Basic; expect possible Return String.
|
||||
void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes()
|
||||
{ RES_FRMMACRO, new SvxMacroItem( RES_FRMMACRO ), SID_ATTR_MACROITEM, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_COL, new SwFormatCol, FN_ATTR_COLUMNS, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_KEEP, new SvxFormatKeepItem( false, RES_KEEP ), SID_ATTR_PARA_KEEP, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_URL, new SwFormatURL(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE },
|
||||
{ RES_URL, new SwFormatURL(), 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_EDIT_IN_READONLY, new SwFormatEditInReadonly, 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_LAYOUT_SPLIT, new SwFormatLayoutSplit, 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_CHAIN, new SwFormatChain, 0, SFX_ITEMINFOFLAG_NONE },
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
#include <unotextrange.hxx>
|
||||
#include <unoprnms.hxx>
|
||||
#include <unomap.hxx>
|
||||
#include <fmturl.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@@ -1312,6 +1313,18 @@ void SwDoc::ForEachINetFormat( const std::function<bool(const SwFormatINetFormat
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterate over all SwFormatURL, if the function returns false, iteration is stopped
|
||||
void SwDoc::ForEachFormatURL( const std::function<bool(const SwFormatURL&)>& rFunc ) const
|
||||
{
|
||||
for(sw::SpzFrameFormat* pSpz : *GetSpzFrameFormats())
|
||||
{
|
||||
auto pFormat = static_cast<SwFlyFrameFormat*>(pSpz);
|
||||
const SwFormatURL& rURLItem = pFormat->GetURL();
|
||||
if (!rFunc(rURLItem))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress)
|
||||
{
|
||||
const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds();
|
||||
|
||||
@@ -2247,25 +2247,24 @@ void SwHTMLWriter::CollectLinkTargets()
|
||||
return true;
|
||||
});
|
||||
|
||||
ItemSurrogates aSurrogates;
|
||||
m_pDoc->GetAttrPool().GetItemSurrogates(aSurrogates, RES_URL);
|
||||
for (const SfxPoolItem* pItem : aSurrogates)
|
||||
{
|
||||
const auto & rURL = static_cast<const SwFormatURL&>(*pItem);
|
||||
AddLinkTarget( rURL.GetURL() );
|
||||
const ImageMap *pIMap = rURL.GetMap();
|
||||
if( pIMap )
|
||||
m_pDoc->ForEachFormatURL(
|
||||
[this] (const SwFormatURL& rURL) -> bool
|
||||
{
|
||||
for( size_t i=0; i<pIMap->GetIMapObjectCount(); ++i )
|
||||
AddLinkTarget( rURL.GetURL() );
|
||||
const ImageMap *pIMap = rURL.GetMap();
|
||||
if( pIMap )
|
||||
{
|
||||
const IMapObject* pObj = pIMap->GetIMapObject( i );
|
||||
if( pObj )
|
||||
for( size_t i=0; i<pIMap->GetIMapObjectCount(); ++i )
|
||||
{
|
||||
AddLinkTarget( pObj->GetURL() );
|
||||
const IMapObject* pObj = pIMap->GetIMapObject( i );
|
||||
if( pObj )
|
||||
{
|
||||
AddLinkTarget( pObj->GetURL() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -3375,25 +3375,23 @@ void MSWordExportBase::CollectOutlineBookmarks(const SwDoc &rDoc)
|
||||
return true;
|
||||
});
|
||||
|
||||
ItemSurrogates aSurrogates;
|
||||
rDoc.GetAttrPool().GetItemSurrogates(aSurrogates, RES_URL);
|
||||
for (const SfxPoolItem* pItem : aSurrogates)
|
||||
{
|
||||
const auto & rURL = static_cast<const SwFormatURL&>(*pItem);
|
||||
|
||||
AddLinkTarget(rURL.GetURL());
|
||||
const ImageMap *pIMap = rURL.GetMap();
|
||||
if (!pIMap)
|
||||
continue;
|
||||
|
||||
for (size_t i=0; i < pIMap->GetIMapObjectCount(); ++i)
|
||||
rDoc.ForEachFormatURL(
|
||||
[this] (const SwFormatURL& rURL) -> bool
|
||||
{
|
||||
const IMapObject* pObj = pIMap->GetIMapObject(i);
|
||||
if (!pObj)
|
||||
continue;
|
||||
AddLinkTarget( pObj->GetURL() );
|
||||
}
|
||||
}
|
||||
AddLinkTarget(rURL.GetURL());
|
||||
const ImageMap *pIMap = rURL.GetMap();
|
||||
if (!pIMap)
|
||||
return true;
|
||||
|
||||
for (size_t i=0; i < pIMap->GetIMapObjectCount(); ++i)
|
||||
{
|
||||
const IMapObject* pObj = pIMap->GetIMapObject(i);
|
||||
if (!pObj)
|
||||
continue;
|
||||
AddLinkTarget( pObj->GetURL() );
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user