diff options
-rw-r--r-- | sw/inc/doc.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 27 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 34 |
5 files changed, 46 insertions, 33 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index e15ba644a546..80f29accb3dd 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -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 ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 123a893df3e4..a1d5908458b9 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -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 }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index a52d1efd8f49..4214849e88a7 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -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(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index a2ea1f86a35a..4269e675e895 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -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: */ diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b2cfddd9c58d..2d476ead766b 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -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 |