diff options
Diffstat (limited to 'sw/source/core/unocore/unoobj2.cxx')
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 5e35fa3e43c2..2b1827560566 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -166,11 +166,11 @@ struct FrameClientSortListLess namespace { - void lcl_CollectFrameAtNodeWithLayout(SwDoc* pDoc, const SwContentFrm* pCFrm, + void lcl_CollectFrameAtNodeWithLayout(SwDoc* pDoc, const SwContentFrame* pCFrame, FrameClientSortList_t& rFrames, const sal_uInt16 nAnchorType) { - auto pObjs = pCFrm->GetDrawObjs(); + auto pObjs = pCFrame->GetDrawObjs(); if(!pObjs) return; const auto aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc); @@ -206,13 +206,13 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx, const auto nChkType = static_cast< sal_uInt16 >((bAtCharAnchoredObjs) ? FLY_AT_CHAR : FLY_AT_PARA); - const SwContentFrm* pCFrm; + const SwContentFrame* pCFrame; const SwContentNode* pCNd; if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && nullptr != (pCNd = rIdx.GetNode().GetContentNode()) && - nullptr != (pCFrm = pCNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())) ) + nullptr != (pCFrame = pCNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())) ) { - lcl_CollectFrameAtNodeWithLayout(pDoc, pCFrm, rFrames, nChkType); + lcl_CollectFrameAtNodeWithLayout(pDoc, pCFrame, rFrames, nChkType); } else { @@ -244,10 +244,10 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx, UnoActionContext::UnoActionContext(SwDoc *const pDoc) : m_pDoc(pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); - if (pRootFrm) + SwRootFrame *const pRootFrame = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + if (pRootFrame) { - pRootFrm->StartAllAction(); + pRootFrame->StartAllAction(); } } @@ -256,10 +256,10 @@ UnoActionContext::~UnoActionContext() // Doc may already have been removed here if (m_pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); - if (pRootFrm) + SwRootFrame *const pRootFrame = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + if (pRootFrame) { - pRootFrm->EndAllAction(); + pRootFrame->EndAllAction(); } } } @@ -267,10 +267,10 @@ UnoActionContext::~UnoActionContext() static void lcl_RemoveImpl(SwDoc *const pDoc) { assert(pDoc); - SwRootFrm *const pRootFrm = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); - if (pRootFrm) + SwRootFrame *const pRootFrame = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + if (pRootFrame) { - pRootFrm->UnoRemoveAllActions(); + pRootFrame->UnoRemoveAllActions(); } } @@ -280,7 +280,7 @@ UnoActionRemoveContext::UnoActionRemoveContext(SwDoc *const pDoc) lcl_RemoveImpl(m_pDoc); } -static SwDoc * lcl_IsNewStyleTable(SwUnoTableCrsr const& rCursor) +static SwDoc * lcl_IsNewStyleTable(SwUnoTableCursor const& rCursor) { SwTableNode *const pTableNode = rCursor.GetNode().FindTableNode(); return (pTableNode && !pTableNode->GetTable().IsNewModel()) @@ -288,11 +288,11 @@ static SwDoc * lcl_IsNewStyleTable(SwUnoTableCrsr const& rCursor) : nullptr; } -UnoActionRemoveContext::UnoActionRemoveContext(SwUnoTableCrsr const& rCursor) +UnoActionRemoveContext::UnoActionRemoveContext(SwUnoTableCursor const& rCursor) : m_pDoc(lcl_IsNewStyleTable(rCursor)) { // this insanity is only necessary for old-style tables - // because SwRootFrm::MakeTableCrsrs() creates the table cursor for these + // because SwRootFrame::MakeTableCursors() creates the table cursor for these if (m_pDoc) { lcl_RemoveImpl(m_pDoc); @@ -303,10 +303,10 @@ UnoActionRemoveContext::~UnoActionRemoveContext() { if (m_pDoc) { - SwRootFrm *const pRootFrm = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); - if (pRootFrm) + SwRootFrame *const pRootFrame = m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + if (pRootFrame) { - pRootFrm->UnoRestoreAllActions(); + pRootFrame->UnoRestoreAllActions(); } } } @@ -330,7 +330,7 @@ void ClientModify(SwClient* pClient, const SfxPoolItem *pOld, const SfxPoolItem } } -void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam, +void SwUnoCursorHelper::SetCursorAttr(SwPaM & rPam, const SfxItemSet& rSet, const SetAttrMode nAttrMode, const bool bTableMode) { @@ -372,7 +372,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam, // #i63870# // split third parameter <bCurrentAttrOnly> into new parameters <bOnlyTextAttr> // and <bGetFromChrFormat> to get better control about resulting <SfxItemSet> -void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam, +void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam, SfxItemSet & rSet, const bool bOnlyTextAttr, const bool bGetFromChrFormat) { static const sal_uLong nMaxLookup = 1000; @@ -450,11 +450,11 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration sal_Int32 m_nLastParaEnd; bool m_bFirstParagraph; uno::Reference< text::XTextContent > m_xNextPara; - sw::UnoCursorPointer m_pCrsr; + sw::UnoCursorPointer m_pCursor; SwXParagraphEnumerationImpl( uno::Reference< text::XText > const& xParent, - ::std::shared_ptr<SwUnoCrsr> pCursor, + ::std::shared_ptr<SwUnoCursor> pCursor, const CursorType eType, SwStartNode const*const pStartNode, SwTable const*const pTable) : m_xParentText( xParent ) @@ -469,7 +469,7 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration , m_nFirstParaStart( -1 ) , m_nLastParaEnd( -1 ) , m_bFirstParagraph( true ) - , m_pCrsr(pCursor) + , m_pCursor(pCursor) { OSL_ENSURE(m_xParentText.is(), "SwXParagraphEnumeration: no parent?"); OSL_ENSURE( !((CURSOR_SELECTION_IN_TABLE == eType) || @@ -480,7 +480,7 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration if ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType)) { - SwUnoCrsr & rCursor = GetCursor(); + SwUnoCursor & rCursor = GetCursor(); rCursor.Normalize(); m_nFirstParaStart = rCursor.GetPoint()->nContent.GetIndex(); m_nLastParaEnd = rCursor.GetMark()->nContent.GetIndex(); @@ -489,7 +489,7 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration } virtual ~SwXParagraphEnumerationImpl() - { m_pCrsr.reset(nullptr); } + { m_pCursor.reset(nullptr); } virtual void SAL_CALL release() throw () override { SolarMutexGuard g; @@ -508,15 +508,15 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException, std::exception) override; virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override; - SwUnoCrsr& GetCursor() - { return *m_pCrsr; } + SwUnoCursor& GetCursor() + { return *m_pCursor; } uno::Reference< text::XTextContent > NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); }; SwXParagraphEnumeration* SwXParagraphEnumeration::Create( uno::Reference< text::XText > const& xParent, - ::std::shared_ptr<SwUnoCrsr> pCursor, + ::std::shared_ptr<SwUnoCursor> pCursor, const CursorType eType, SwStartNode const*const pStartNode, SwTable const*const pTable) @@ -531,7 +531,7 @@ SwXParagraphEnumerationImpl::hasMoreElements() throw (uno::RuntimeException, std return m_bFirstParagraph || m_xNextPara.is(); } -//!! compare to SwShellTableCrsr::FillRects() in viscrs.cxx +//!! compare to SwShellTableCursor::FillRects() in viscrs.cxx static SwTableNode * lcl_FindTopLevelTable( SwTableNode *const pTableNode, SwTable const*const pOwnTable) @@ -550,17 +550,17 @@ lcl_FindTopLevelTable( static bool lcl_CursorIsInSection( - SwUnoCrsr const*const pUnoCrsr, SwStartNode const*const pOwnStartNode) + SwUnoCursor const*const pUnoCursor, SwStartNode const*const pOwnStartNode) { // returns true if the cursor is in the section (or in a sub section!) // represented by pOwnStartNode bool bRes = true; - if (pUnoCrsr && pOwnStartNode) + if (pUnoCursor && pOwnStartNode) { const SwEndNode * pOwnEndNode = pOwnStartNode->EndOfSectionNode(); - bRes = pOwnStartNode->GetIndex() <= pUnoCrsr->Start()->nNode.GetIndex() && - pUnoCrsr->End()->nNode.GetIndex() <= pOwnEndNode->GetIndex(); + bRes = pOwnStartNode->GetIndex() <= pUnoCursor->Start()->nNode.GetIndex() && + pUnoCursor->End()->nNode.GetIndex() <= pOwnEndNode->GetIndex(); } return bRes; } @@ -568,36 +568,36 @@ lcl_CursorIsInSection( uno::Reference< text::XTextContent > SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - SwUnoCrsr& rUnoCrsr = GetCursor(); + SwUnoCursor& rUnoCursor = GetCursor(); // check for exceeding selections if (!m_bFirstParagraph && ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType))) { - SwPosition* pStart = rUnoCrsr.Start(); - auto aNewCrsr(rUnoCrsr.GetDoc()->CreateUnoCrsr(*pStart)); + SwPosition* pStart = rUnoCursor.Start(); + auto aNewCursor(rUnoCursor.GetDoc()->CreateUnoCursor(*pStart)); // one may also go into tables here if ((CURSOR_TBLTEXT != m_eCursorType) && (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) { - aNewCrsr->SetRemainInSection( false ); + aNewCursor->SetRemainInSection( false ); } // os 2005-01-14: This part is only necessary to detect movements out // of a selection; if there is no selection we don't have to care - SwTableNode *const pTableNode = aNewCrsr->GetNode().FindTableNode(); + SwTableNode *const pTableNode = aNewCursor->GetNode().FindTableNode(); if (((CURSOR_TBLTEXT != m_eCursorType) && (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) && pTableNode) { - aNewCrsr->GetPoint()->nNode = pTableNode->EndOfSectionIndex(); - aNewCrsr->Move(fnMoveForward, fnGoNode); + aNewCursor->GetPoint()->nNode = pTableNode->EndOfSectionIndex(); + aNewCursor->Move(fnMoveForward, fnGoNode); } else { - aNewCrsr->MovePara(fnParaNext, fnParaStart); + aNewCursor->MovePara(fnParaNext, fnParaStart); } - if (m_nEndIndex < aNewCrsr->Start()->nNode.GetIndex()) + if (m_nEndIndex < aNewCursor->Start()->nNode.GetIndex()) { return nullptr; } @@ -606,15 +606,15 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE bool bInTable = false; if (!m_bFirstParagraph) { - rUnoCrsr.SetRemainInSection( false ); + rUnoCursor.SetRemainInSection( false ); // what to do if already in a table? - SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCursor.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) { // this is a foreign table: go to end - rUnoCrsr.GetPoint()->nNode = pTableNode->EndOfSectionIndex(); - if (!rUnoCrsr.Move(fnMoveForward, fnGoNode)) + rUnoCursor.GetPoint()->nNode = pTableNode->EndOfSectionIndex(); + if (!rUnoCursor.Move(fnMoveForward, fnGoNode)) { return nullptr; } @@ -625,19 +625,19 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE uno::Reference< text::XTextContent > xRef; // the cursor must remain in the current section or a subsection // before AND after the movement... - if (lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode ) && + if (lcl_CursorIsInSection( &rUnoCursor, m_pOwnStartNode ) && (m_bFirstParagraph || bInTable || - (rUnoCrsr.MovePara(fnParaNext, fnParaStart) && - lcl_CursorIsInSection( &rUnoCrsr, m_pOwnStartNode )))) + (rUnoCursor.MovePara(fnParaNext, fnParaStart) && + lcl_CursorIsInSection( &rUnoCursor, m_pOwnStartNode )))) { - SwPosition* pStart = rUnoCrsr.Start(); + SwPosition* pStart = rUnoCursor.Start(); const sal_Int32 nFirstContent = (m_bFirstParagraph) ? m_nFirstParaStart : -1; const sal_Int32 nLastContent = (m_nEndIndex == pStart->nNode.GetIndex()) ? m_nLastParaEnd : -1; // position in a table, or in a simple paragraph? - SwTableNode * pTableNode = rUnoCrsr.GetNode().FindTableNode(); + SwTableNode * pTableNode = rUnoCursor.GetNode().FindTableNode(); pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable ); if (/*CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && */ pTableNode && (&pTableNode->GetTable() != m_pOwnTable)) @@ -650,7 +650,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl() throw (container::NoSuchElementE else { text::XText *const pText = m_xParentText.get(); - xRef = SwXParagraph::CreateXParagraph(*rUnoCrsr.GetDoc(), + xRef = SwXParagraph::CreateXParagraph(*rUnoCursor.GetDoc(), pStart->nNode.GetNode().GetTextNode(), static_cast<SwXText*>(pText), nFirstContent, nLastContent); } @@ -1039,10 +1039,10 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, { xTextCursor.set( pText->CreateCursor() ); xTextCursor->gotoEnd(sal_True); - const uno::Reference<lang::XUnoTunnel> xCrsrTunnel( + const uno::Reference<lang::XUnoTunnel> xCursorTunnel( xTextCursor, uno::UNO_QUERY); pCursor = - ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCrsrTunnel); + ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCursorTunnel); } if(pRange && &pRange->GetDoc() == rToFill.GetDoc()) { @@ -1058,18 +1058,18 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, { SwDoc* const pDoc = (pCursor) ? pCursor->GetDoc() : ((pPortion) ? pPortion->GetCursor().GetDoc() : nullptr); - const SwPaM* const pUnoCrsr = (pCursor) ? pCursor->GetPaM() + const SwPaM* const pUnoCursor = (pCursor) ? pCursor->GetPaM() : ((pPortion) ? &pPortion->GetCursor() : nullptr); - if (pUnoCrsr && pDoc == rToFill.GetDoc()) + if (pUnoCursor && pDoc == rToFill.GetDoc()) { - OSL_ENSURE(!pUnoCrsr->IsMultiSelection(), + OSL_ENSURE(!pUnoCursor->IsMultiSelection(), "what to do about rings?"); bRet = true; - *rToFill.GetPoint() = *pUnoCrsr->GetPoint(); - if (pUnoCrsr->HasMark()) + *rToFill.GetPoint() = *pUnoCursor->GetPoint(); + if (pUnoCursor->HasMark()) { rToFill.SetMark(); - *rToFill.GetMark() = *pUnoCrsr->GetMark(); + *rToFill.GetMark() = *pUnoCursor->GetMark(); } else rToFill.DeleteMark(); @@ -1118,15 +1118,15 @@ SwXTextRange::CreateXTextRange( { const uno::Reference<text::XText> xParentText( ::sw::CreateParentXText(rDoc, rPos)); - const auto pNewCrsr(rDoc.CreateUnoCrsr(rPos)); + const auto pNewCursor(rDoc.CreateUnoCursor(rPos)); if(pMark) { - pNewCrsr->SetMark(); - *pNewCrsr->GetMark() = *pMark; + pNewCursor->SetMark(); + *pNewCursor->GetMark() = *pMark; } const bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) ); const uno::Reference< text::XTextRange > xRet( - new SwXTextRange(*pNewCrsr, xParentText, + new SwXTextRange(*pNewCursor, xParentText, isCell ? RANGE_IN_CELL : RANGE_IN_TEXT) ); return xRet; } @@ -1252,13 +1252,13 @@ throw (uno::RuntimeException, std::exception) throw uno::RuntimeException(); } const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); - const auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos)); - if (!GetPositions(*pNewCrsr)) + const auto pNewCursor(m_pImpl->m_rDoc.CreateUnoCursor(aPos)); + if (!GetPositions(*pNewCursor)) { throw uno::RuntimeException(); } - return SwXParaFrameEnumeration::Create(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE); + return SwXParaFrameEnumeration::Create(*pNewCursor, PARAFRAME_PORTION_TEXTRANGE); } uno::Reference< container::XEnumeration > SAL_CALL @@ -1271,8 +1271,8 @@ SwXTextRange::createEnumeration() throw (uno::RuntimeException, std::exception) throw uno::RuntimeException(); } const SwPosition aPos(GetDoc().GetNodes().GetEndOfContent()); - auto pNewCrsr(m_pImpl->m_rDoc.CreateUnoCrsr(aPos)); - if (!GetPositions(*pNewCrsr)) + auto pNewCursor(m_pImpl->m_rDoc.CreateUnoCursor(aPos)); + if (!GetPositions(*pNewCursor)) { throw uno::RuntimeException(); } @@ -1283,7 +1283,7 @@ SwXTextRange::createEnumeration() throw (uno::RuntimeException, std::exception) const CursorType eSetType = (RANGE_IN_CELL == m_pImpl->m_eRangePosition) ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION; - return SwXParagraphEnumeration::Create(m_pImpl->m_xParentText, pNewCrsr, eSetType); + return SwXParagraphEnumeration::Create(m_pImpl->m_xParentText, pNewCursor, eSetType); } uno::Type SAL_CALL SwXTextRange::getElementType() throw (uno::RuntimeException, std::exception) @@ -1497,7 +1497,7 @@ struct SwXTextRangesImpl final : public SwXTextRanges { if (pPaM) { - m_pUnoCursor.reset(pPaM->GetDoc()->CreateUnoCrsr(*pPaM->GetPoint())); + m_pUnoCursor.reset(pPaM->GetDoc()->CreateUnoCursor(*pPaM->GetPoint())); ::sw::DeepCopyPaM(*pPaM, *GetCursor()); } MakeRanges(); @@ -1507,7 +1507,7 @@ struct SwXTextRangesImpl final : public SwXTextRanges SolarMutexGuard g; OWeakObject::release(); } - virtual SwUnoCrsr* GetCursor() override + virtual SwUnoCursor* GetCursor() override { return &(*m_pUnoCursor); }; void MakeRanges(); ::std::vector< uno::Reference< text::XTextRange > > m_Ranges; @@ -1615,7 +1615,7 @@ struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration SolarMutexGuard g; OWeakObject::release(); } - SwUnoCrsr& GetCursor() + SwUnoCursor& GetCursor() { return *m_pUnoCursor; } void PurgeFrameClients() { @@ -1647,7 +1647,7 @@ SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, cons SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat) - : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCrsr(*rPaM.GetPoint())) + : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCursor(*rPaM.GetPoint())) { if (rPaM.HasMark()) { @@ -1672,9 +1672,9 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl( if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode) { //get all frames that are bound at paragraph or at character - for(const auto& pFlyFrm : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true)) + for(const auto& pFlyFrame : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true)) { - const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrm->GetFormat()); + const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrame->GetFormat()); m_vFrames.push_back(std::shared_ptr<sw::FrameClient>(new sw::FrameClient(pFrameFormat))); } } |