Kaydet (Commit) 23a12e01 authored tarafından Miklos Vajna's avatar Miklos Vajna

SwXFrames::getCount: ignore TextFrames, which are TextBoxes

Change-Id: I12d2912f566a31e36f6d091d554106b927abb9c9
üst 4782e774
......@@ -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.
......
......@@ -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()
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment