diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-28 13:18:02 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-28 22:14:27 +0100 |
commit | 5fc964fa337ebfb331997d894556f847d17fa2bc (patch) | |
tree | bb1f63391aaba9bb2b68ab5726792bf952c6f9f7 /sw | |
parent | 4392cd43de2df7f7dd67106b24d184b52f0bd316 (diff) |
simplify
Change-Id: I3f874a89174cd66687b50d66b5ab35ab90ee66ef
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index e6b30fdea1ea..448dc1b9015c 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1014,31 +1014,23 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursor(void) throw( uno::Ru return static_cast<text::XWordCursor*>(pXCursor); } -uno::Reference< text::XTextCursor > SwXCell::createTextCursorByRange(const uno::Reference< text::XTextRange > & xTextPosition) - throw( uno::RuntimeException, std::exception ) +uno::Reference<text::XTextCursor> SwXCell::createTextCursorByRange(const uno::Reference< text::XTextRange > & xTextPosition) + throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - uno::Reference< text::XTextCursor > aRef; SwUnoInternalPaM aPam(*GetDoc()); - if ((pStartNode || IsValid()) - && ::sw::XTextRangeToSwPaM(aPam, xTextPosition)) - { - const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd(); - // skip sections - SwStartNode* p1 = aPam.GetNode().StartOfSectionNode(); - while(p1->IsSectionNode()) - p1 = p1->StartOfSectionNode(); - - if( p1 == pSttNd ) - { - aRef = static_cast<text::XWordCursor*>( - new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, - *aPam.GetPoint(), aPam.GetMark())); - } - } - else + if((!pStartNode && !IsValid()) || !::sw::XTextRangeToSwPaM(aPam, xTextPosition)) throw uno::RuntimeException(); - return aRef; + const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd(); + // skip sections + SwStartNode* p1 = aPam.GetNode().StartOfSectionNode(); + while(p1->IsSectionNode()) + p1 = p1->StartOfSectionNode(); + if( p1 != pSttNd ) + return nullptr; + return static_cast<text::XWordCursor*>( + new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, + *aPam.GetPoint(), aPam.GetMark())); } uno::Reference< beans::XPropertySetInfo > SwXCell::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception ) |