diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-01 21:47:57 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-09 12:54:55 +0200 |
commit | e4891cefd3dc221692ac2f23fd97d25e71d071f1 (patch) | |
tree | ea78dfc85cadba54d3efa7aa6666754161277feb /sw | |
parent | 642088c5eb811e6ca70c4f19d825e074d8268866 (diff) |
make FillFrames a member
Change-Id: I1582705ce3ae9cc7bbe33789a1626e8d7d3853cf
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 12eb6a7cd887..804e5f1f0d61 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1610,6 +1610,7 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration m_vFrames.erase(iter, m_vFrames.end()); } } + void FillFrame(); bool CreateNextObject(); uno::Reference< text::XTextContent > m_xNextObject; FrameClientList_t m_vFrames; @@ -1617,23 +1618,6 @@ struct SwXParaFrameEnumerationImpl SAL_FINAL : public SwXParaFrameEnumeration }; -// Search for a FLYCNT text attribute at the cursor point and fill the frame -// into the array -static void -lcl_FillFrame(SwUnoCrsr& rUnoCrsr, FrameClientList_t & rFrames) -{ - // search for objects at the cursor - anchored at/as char - SwTextAttr const*const pTextAttr = (rUnoCrsr.GetNode().IsTextNode()) - ? rUnoCrsr.GetNode().GetTextNode()->GetTextAttrForCharAt( - rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT) - : 0; - if (pTextAttr) - { - const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt(); - SwFrameFormat * const pFrameFormat = rFlyCnt.GetFrameFormat(); - rFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); - } -} SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat) { return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); } @@ -1676,18 +1660,33 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); } } - - lcl_FillFrame(*GetCursor(), m_vFrames); + FillFrame(); } } +// Search for a FLYCNT text attribute at the cursor point and fill the frame +// into the array +void SwXParaFrameEnumerationImpl::FillFrame() +{ + if(!m_pUnoCursor->GetNode().IsTextNode()) + return; + // search for objects at the cursor - anchored at/as char + const auto pTextAttr = m_pUnoCursor->GetNode().GetTextNode()->GetTextAttrForCharAt( + m_pUnoCursor->GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT); + if(!pTextAttr) + return; + const SwFormatFlyCnt& rFlyCnt = pTextAttr->GetFlyCnt(); + SwFrameFormat* const pFrameFormat = rFlyCnt.GetFrameFormat(); + m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); +} + bool SwXParaFrameEnumerationImpl::CreateNextObject() { if (!m_vFrames.size()) return false; SwFrameFormat* const pFormat = static_cast<SwFrameFormat*>(const_cast<SwModify*>( - m_vFrames.front()->GetRegisteredIn())); + m_vFrames.front()->GetRegisteredIn())); m_vFrames.pop_front(); // the format should be valid here, otherwise the client // would have been removed by PurgeFrameClients @@ -1695,11 +1694,9 @@ bool SwXParaFrameEnumerationImpl::CreateNextObject() SwDrawContact* const pContact = SwIterator<SwDrawContact,SwFormat>( *pFormat ).First(); if (pContact) { - SdrObject * const pSdr = pContact->GetMaster(); + SdrObject* const pSdr = pContact->GetMaster(); if (pSdr) - { m_xNextObject.set(pSdr->getUnoShape(), uno::UNO_QUERY); - } } else { |