summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 17:13:53 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 17:13:53 +0100
commit5d6da5c1f774b02973085816bb0717d8a2c891a3 (patch)
treedf43436ef08efd1842910a749095d940e2e0b004 /sw/source/ui
parent1f8d8b1e17487074cf77595ab9d9569858e6f04e (diff)
swunolocking1: #i105557#: SwXTextRange:
move static methods to namespace sw. clean up the implementation a little.
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/dialog/SwSpellDialogChildWindow.cxx9
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx18
-rw-r--r--sw/source/ui/uno/unotxvw.cxx14
3 files changed, 19 insertions, 22 deletions
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
index 85838652d370..0332dfa7058b 100644
--- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
@@ -258,8 +258,10 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence (void)
//mark the start position only if not at start of doc
if(!pWrtShell->IsStartOfDoc())
{
- m_pSpellState->m_xStartRange = SwXTextRange::CreateTextRangeFromPosition(
- pWrtShell->GetDoc(), *pCrsr->Start(), pCrsr->End());
+ m_pSpellState->m_xStartRange =
+ SwXTextRange::CreateXTextRange(
+ *pWrtShell->GetDoc(),
+ *pCrsr->Start(), pCrsr->End());
}
pWrtShell->SpellStart( DOCPOS_START, DOCPOS_END, DOCPOS_CURR, FALSE );
}
@@ -390,7 +392,8 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence (void)
if(RET_YES == nRet)
{
SwUnoInternalPaM aPam(*pWrtShell->GetDoc());
- if(SwXTextRange::XTextRangeToSwPaM(aPam, m_pSpellState->m_xStartRange))
+ if (::sw::XTextRangeToSwPaM(aPam,
+ m_pSpellState->m_xStartRange))
{
pWrtShell->SetSelection(aPam);
pWrtShell->SpellStart(DOCPOS_START, DOCPOS_CURR, DOCPOS_START);
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 22d683a0f29d..3bb65ea4e900 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -991,11 +991,10 @@ Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSear
Reference< XInterface > xRet;
if(nResult)
{
- Reference< XTextRange > xTempRange = SwXTextRange::CreateTextRangeFromPosition(
- pDocShell->GetDoc(),
- *pResultCrsr->GetPoint(),
- pResultCrsr->GetMark());
- xRet = *new SwXTextCursor(xTempRange->getText(), pResultCrsr);
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
+ xRet = *new SwXTextCursor(xParent, pResultCrsr);
delete pResultCrsr;
}
return xRet;
@@ -1019,12 +1018,11 @@ Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface >
Reference< XInterface > xRet;
if(nResult)
{
- Reference< XTextRange > xTempRange = SwXTextRange::CreateTextRangeFromPosition(
- pDocShell->GetDoc(),
- *pResultCrsr->GetPoint(),
- pResultCrsr->GetMark());
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
- xRet = *new SwXTextCursor(xTempRange->getText(), pResultCrsr);
+ xRet = *new SwXTextCursor(xParent, pResultCrsr);
delete pResultCrsr;
}
return xRet;
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index 9e637ca58260..6d001b95f378 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -334,7 +334,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg
else if(!pFrame && !pCell && xPos.is())
{
SwUnoInternalPaM aPam(*pDoc);
- if(SwXTextRange::XTextRangeToSwPaM(aPam, xPos))
+ if (::sw::XTextRangeToSwPaM(aPam, xPos))
{
pPam = lcl_createPamCopy(aPam);
}
@@ -1362,7 +1362,7 @@ void SwXTextViewCursor::gotoRange(
throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
- if(!SwXTextRange::XTextRangeToSwPaM( rDestPam, xRange))
+ if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
throw IllegalArgumentException();
ShellModes eSelMode = m_pView->GetShellMode();
@@ -1699,9 +1699,7 @@ uno::Reference< text::XText > SwXTextViewCursor::getText(void) throw( uno::Runt
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- uno::Reference< text::XTextRange > xRg = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->Start(), 0);
- xRet = xRg->getText();
+ xRet = ::sw::CreateParentXText(*pDoc, *pShellCrsr->Start());
}
else
throw uno::RuntimeException();
@@ -1722,8 +1720,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getStart(void) throw( uno
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->Start(), 0);
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->Start(), 0);
}
else
throw uno::RuntimeException();
@@ -1744,8 +1741,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd(void) throw( uno::
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCrsr = rSh.GetCrsr();
SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
- xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc,
- *pShellCrsr->End(), 0);
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->End(), 0);
}
else
throw uno::RuntimeException();