summaryrefslogtreecommitdiff
path: root/sw/source/core/draw/dcontact.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/draw/dcontact.cxx')
-rw-r--r--sw/source/core/draw/dcontact.cxx60
1 files changed, 27 insertions, 33 deletions
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 86bae3e109aa..fcc98d3aa246 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -657,41 +657,12 @@ SwDrawContact::~SwDrawContact()
}
}
-void SwDrawContact::GetTextObjectsFromFormat( std::list<SdrTextObj*>& rTextObjects, SwDoc* pDoc )
+void SwDrawContact::GetTextObjectsFromFormat(std::list<SdrTextObj*>& o_rTextObjects, SwDoc* pDoc)
{
- for( sal_Int32 n=0; n<(sal_Int32)pDoc->GetSpzFrameFormats()->size(); n++ )
+ for(auto& rpFly : *pDoc->GetSpzFrameFormats())
{
- const SwFrameFormat* pFly = (*pDoc->GetSpzFrameFormats())[n];
- if( dynamic_cast<const SwDrawFrameFormat*>( pFly ) != nullptr )
- {
- SwDrawContact* pContact = SwIterator<SwDrawContact,SwFrameFormat>(*pFly).First();
- if( pContact )
- {
- SdrObject* pSdrO = pContact->GetMaster();
- if ( pSdrO )
- {
- if ( dynamic_cast<const SdrObjGroup*>(pSdrO) != nullptr )
- {
- SdrObjListIter aListIter( *pSdrO, SdrIterMode::DeepNoGroups );
- //iterate inside of a grouped object
- while( aListIter.IsMore() )
- {
- SdrObject* pSdrOElement = aListIter.Next();
- if( pSdrOElement && dynamic_cast<const SdrTextObj*>(pSdrOElement) != nullptr &&
- static_cast<SdrTextObj*>( pSdrOElement)->HasText() )
- {
- rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrOElement ));
- }
- }
- }
- else if( dynamic_cast<const SdrTextObj*>(pSdrO) != nullptr &&
- static_cast<SdrTextObj*>( pSdrO )->HasText() )
- {
- rTextObjects.push_back(static_cast<SdrTextObj*>( pSdrO ));
- }
- }
- }
- }
+ if(dynamic_cast<const SwDrawFrameFormat*>(rpFly))
+ rpFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects));
}
}
@@ -1596,6 +1567,29 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
MoveObjToVisibleLayer(GetMaster());
}
}
+ else if (auto pCollectTextObjectsHint = dynamic_cast<const sw::CollectTextObjectsHint*>(&rHint))
+ {
+ auto pSdrO = GetMaster();
+ if(!pSdrO)
+ return;
+ if(dynamic_cast<const SdrObjGroup*>(pSdrO))
+ {
+ SdrObjListIter aListIter(*pSdrO, SdrIterMode::DeepNoGroups);
+ //iterate inside of a grouped object
+ while(aListIter.IsMore())
+ {
+ SdrObject* pSdrOElement = aListIter.Next();
+ auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrOElement));
+ if(pTextObj && pTextObj->HasText())
+ pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
+ }
+ }
+ else if(auto pTextObj = const_cast<SdrTextObj*>(dynamic_cast<const SdrTextObj*>(pSdrO)))
+ {
+ if(pTextObj->HasText())
+ pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
+ }
+ }
}
// #i26791#