diff options
author | Michael Stahl <mst@openoffice.org> | 2010-01-22 19:07:50 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-01-22 19:07:50 +0100 |
commit | e832b802d33f63a8ae62df1ce053d978cbd1b908 (patch) | |
tree | 89ccb68892a33fb3e12bea72946b76c6e5aa60bd /sw | |
parent | a609fbf16e0df2cbe9fcbd8dd6ddd603e8e26d26 (diff) |
swunolocking1: fix regression:
SwXParagraphEnumeration constructor really needs the start node as a
parameter because determining it from the cursor cannot work in nested tables.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unoparagraph.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 45 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 6 |
4 files changed, 29 insertions, 36 deletions
diff --git a/sw/inc/unoparagraph.hxx b/sw/inc/unoparagraph.hxx index add936e9c7..8743737c33 100644 --- a/sw/inc/unoparagraph.hxx +++ b/sw/inc/unoparagraph.hxx @@ -55,7 +55,9 @@ struct SwPosition; class SwPaM; class SwUnoCrsr; +class SwStartNode; class SwTxtNode; +class SwTable; class SwXText; @@ -339,7 +341,9 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > const & xParent, ::std::auto_ptr<SwUnoCrsr> pCursor, - const CursorType eType); + const CursorType eType, + SwStartNode const*const pStartNode = 0, + SwTable const*const pTable = 0); // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index a0903cf049..1cb0d4f660 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -3157,8 +3157,14 @@ SwXTextCursor::createEnumeration() throw (uno::RuntimeException) } const CursorType eSetType = (CURSOR_TBLTEXT == m_pImpl->m_eType) ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION; + SwTableNode const*const pStartNode( (CURSOR_TBLTEXT == m_pImpl->m_eType) + ? rUnoCursor.GetPoint()->nNode.GetNode().FindTableNode() + : 0); + SwTable const*const pTable( + (pStartNode) ? & pStartNode->GetTable() : 0 ); const uno::Reference< container::XEnumeration > xRet = - new SwXParagraphEnumeration(pParentText, pNewCrsr, eSetType); + new SwXParagraphEnumeration( + pParentText, pNewCrsr, eSetType, pStartNode, pTable); return xRet; } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index d1f24c7544..cef43782d4 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -468,34 +468,6 @@ void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam, * SwXParagraphEnumeration ******************************************************************/ -static SwStartNode * -lcl_InitStartNode(const CursorType eType, SwUnoCrsr *const pCursor) -{ - switch (eType) - { - case CURSOR_TBLTEXT: // table cell: pCursor points at first paragraph - return pCursor->Start()->nNode.GetNode().StartOfSectionNode(); - case CURSOR_SELECTION_IN_TABLE: // table - return pCursor->Start()->nNode.GetNode().FindTableNode(); - default: - return 0; - } -} - -static SwTable const* -lcl_InitTable(const CursorType eType, SwStartNode const*const pStartNode) -{ - switch (eType) - { - case CURSOR_TBLTEXT: // table cell - return & pStartNode->FindTableNode()->GetTable(); - case CURSOR_SELECTION_IN_TABLE: // table - return & static_cast<SwTableNode const*>(pStartNode)->GetTable(); - default: - return 0; - } -} - class SwXParagraphEnumeration::Impl : public SwClient { @@ -517,16 +489,17 @@ public: Impl( uno::Reference< text::XText > const& xParent, ::std::auto_ptr<SwUnoCrsr> pCursor, - const CursorType eType) + const CursorType eType, + SwStartNode const*const pStartNode, SwTable const*const pTable) : SwClient( pCursor.release() ) , m_xParentText( xParent ) , m_eCursorType( eType ) // remember table and start node for later travelling // (used in export of tables in tables) - , m_pOwnStartNode( lcl_InitStartNode(eType, GetCursor()) ) + , m_pOwnStartNode( pStartNode ) // for import of tables in tables we have to remember the actual // table and start node of the current position in the enumeration. - , m_pOwnTable( lcl_InitTable(eType, m_pOwnStartNode) ) + , m_pOwnTable( pTable ) , m_nEndIndex( GetCursor()->End()->nNode.GetIndex() ) , m_nFirstParaStart( -1 ) , m_nLastParaEnd( -1 ) @@ -534,6 +507,10 @@ public: { OSL_ENSURE(m_xParentText.is(), "SwXParagraphEnumeration: no parent?"); OSL_ENSURE(GetRegisteredIn(), "SwXParagraphEnumeration: no cursor?"); + OSL_ENSURE( !((CURSOR_SELECTION_IN_TABLE == eType) || + (CURSOR_TBLTEXT == eType)) + || (m_pOwnTable && m_pOwnStartNode), + "SwXParagraphEnumeration: table type but no start node or table?"); if ((CURSOR_SELECTION == m_eCursorType) || (CURSOR_SELECTION_IN_TABLE == m_eCursorType)) @@ -576,8 +553,10 @@ void SwXParagraphEnumeration::Impl::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew) SwXParagraphEnumeration::SwXParagraphEnumeration( uno::Reference< text::XText > const& xParent, ::std::auto_ptr<SwUnoCrsr> pCursor, - const CursorType eType) - : m_pImpl( new SwXParagraphEnumeration::Impl(xParent, pCursor, eType) ) + const CursorType eType, + SwStartNode const*const pStartNode, SwTable const*const pTable) + : m_pImpl( new SwXParagraphEnumeration::Impl(xParent, pCursor, eType, + pStartNode, pTable) ) { } /*-- 10.12.98 11:52:12--------------------------------------------------- diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index d94cce8a73..a6e9b8cd10 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1227,8 +1227,12 @@ uno::Reference< container::XEnumeration > SwXCell::createEnumeration(void) thro GetDoc()->CreateUnoCrsr(aPos, sal_False)); pUnoCursor->Move(fnMoveForward, fnGoNode); + // remember table and start node for later travelling + // (used in export of tables in tables) + SwTable const*const pTable( & pSttNd->FindTableNode()->GetTable() ); SwXParagraphEnumeration *const pEnum = - new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_TBLTEXT); + new SwXParagraphEnumeration(this, pUnoCursor, CURSOR_TBLTEXT, + pSttNd, pTable); aRef = pEnum; // // no Cursor in protected sections |