diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-27 09:07:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-27 09:32:45 +0200 |
commit | 23a12e015b8e9ea36eace51c0d1a982313828478 (patch) | |
tree | ed98df227fe851a015b7ce0a949ca0ddf5e92f4f /sw | |
parent | 4782e774e39b57ae431e731f13763c43e6658117 (diff) |
SwXFrames::getCount: ignore TextFrames, which are TextBoxes
Change-Id: I12d2912f566a31e36f6d091d554106b927abb9c9
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docfly.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 4e833d8f66fe..bccd5dd88773 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1232,7 +1232,7 @@ public: /** Access to frames. Iterate over Flys - forr Basic-Collections. */ - sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL) const; + sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const; SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL); // Copy formats in own arrays and return them. diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index e306eb831751..c657db06711e 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -42,6 +42,7 @@ #include <pagefrm.hxx> #include <rootfrm.hxx> #include <flyfrms.hxx> +#include <textboxhelper.hxx> #include <frmtool.hxx> #include <frmfmt.hxx> #include <ndtxt.hxx> @@ -68,15 +69,24 @@ using namespace ::com::sun::star; -sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const +sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes ) const { const SwFrmFmts& rFmts = *GetSpzFrmFmts(); sal_uInt16 nSize = rFmts.size(); sal_uInt16 nCount = 0; const SwNodeIndex* pIdx; + + std::list<SwFrmFmt*> aTextBoxes; + if (bIgnoreTextBoxes) + aTextBoxes = SwTextBoxHelper::findTextBoxes(this); + for ( sal_uInt16 i = 0; i < nSize; i++) { const SwFrmFmt* pFlyFmt = rFmts[ i ]; + + if (bIgnoreTextBoxes && std::find(aTextBoxes.begin(), aTextBoxes.end(), pFlyFmt) != aTextBoxes.end()) + continue; + if( RES_FLYFRMFMT == pFlyFmt->Which() && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() ) && pIdx->GetNodes().IsDocNodes() diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 6a6fb944eca4..c73d91e4c5f6 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1188,7 +1188,8 @@ sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException, std::exception) SolarMutexGuard aGuard; if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->GetFlyCount(eType); + // Ignore TextBoxes for TextFrames. + return GetDoc()->GetFlyCount(eType, /*bIgnoreTextBoxes=*/eType == FLYCNTTYPE_FRM); } uno::Any SwXFrames::getByIndex(sal_Int32 nIndex) |