summaryrefslogtreecommitdiff
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
commitf1bb18796899fe48e916b7b92ef99c394febf07e (patch)
treed52f25d8e8a34b05069af70ca5f676e3f5c73a3c
parent9b80f003bbccd42794138744d3568cf41cda7568 (diff)
swunolocking1: #i105557#: SwXTextRange:
move static methods to namespace sw. clean up the implementation a little.
-rw-r--r--sw/inc/unotextrange.hxx22
-rw-r--r--sw/source/core/access/accpara.cxx6
-rw-r--r--sw/source/core/crsr/crsrsh.cxx4
-rw-r--r--sw/source/core/unocore/unobkm.cxx6
-rw-r--r--sw/source/core/unocore/unodraw.cxx12
-rw-r--r--sw/source/core/unocore/unofield.cxx6
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx8
-rw-r--r--sw/source/core/unocore/unoframe.cxx8
-rw-r--r--sw/source/core/unocore/unoftn.cxx7
-rw-r--r--sw/source/core/unocore/unoidx.cxx6
-rw-r--r--sw/source/core/unocore/unoobj2.cxx175
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx2
-rw-r--r--sw/source/core/unocore/unoredline.cxx7
-rw-r--r--sw/source/core/unocore/unorefmk.cxx17
-rw-r--r--sw/source/core/unocore/unosect.cxx4
-rw-r--r--sw/source/core/unocore/unotbl.cxx5
-rw-r--r--sw/source/core/unocore/unotext.cxx20
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx4
-rw-r--r--sw/source/filter/xml/swxml.cxx5
-rw-r--r--sw/source/filter/xml/xmlimp.cxx6
-rw-r--r--sw/source/filter/xml/xmltbli.cxx4
-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
24 files changed, 198 insertions, 177 deletions
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index 8b34ce7f94..c3c3d362db 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -77,6 +77,13 @@ namespace sw {
void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget);
+ bool XTextRangeToSwPaM(SwUnoInternalPaM& rToFill,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::text::XTextRange > & xTextRange);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
+ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos);
+
} // namespace sw
@@ -105,10 +112,8 @@ private:
enum RangePosition
{
RANGE_IN_TEXT, // "ordinary" ::com::sun::star::text::TextRange
- RANGE_IN_FRAME, // position created with a frame that has no uno object
RANGE_IN_CELL, // position created with a cell that has no uno object
RANGE_IS_TABLE, // anchor of a table
- RANGE_INVALID // created by NewInstance
};
void SetPositions(SwPaM const& rPam);
@@ -133,17 +138,10 @@ public:
SwDoc* GetDoc();
bool GetPositions(SwPaM & rToFill) const;
- static BOOL XTextRangeToSwPaM(SwUnoInternalPaM& rToFill,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange > & xTextRange);
-
static ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange > CreateTextRangeFromPosition(
- SwDoc* pDoc,
- const SwPosition& rPos, const SwPosition* pMark);
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
- CreateParentXText(SwDoc* pDoc, const SwPosition& rPos);
+ ::com::sun::star::text::XTextRange > CreateXTextRange(
+ SwDoc & rDoc,
+ const SwPosition& rPos, const SwPosition *const pMark);
static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index c9de2c74df..eac4a4fdaf 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2105,8 +2105,10 @@ sal_Bool SwAccessibleParagraph::replaceText(
aEndPos.nContent = nEnd;
// now create XTextRange as helper and set string
- SwXTextRange::CreateTextRangeFromPosition(
- pNode->GetDoc(), aStartPos, &aEndPos)->setString(sReplacement);
+ const uno::Reference<text::XTextRange> xRange(
+ SwXTextRange::CreateXTextRange(
+ *pNode->GetDoc(), aStartPos, &aEndPos));
+ xRange->setString(sReplacement);
// delete portion data
ClearPortionData();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 674b95634d..ec0a07b306 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3372,8 +3372,8 @@ void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange,
SwPosition aEndPos( aStartPos );
aEndPos.nContent = nBegin + nLen;
- uno::Reference<text::XTextRange> xRange =
- SwXTextRange::CreateTextRangeFromPosition( rNode.GetDoc(), aStartPos, &aEndPos);
+ const uno::Reference<text::XTextRange> xRange =
+ SwXTextRange::CreateXTextRange(*rNode.GetDoc(), aStartPos, &aEndPos);
rRange = xRange;
}
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 24d1ccd7d6..561f145473 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -237,7 +237,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
m_pImpl->m_pDoc = pDoc;
SwUnoInternalPaM aPam(*m_pImpl->m_pDoc);
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
UnoActionContext aCont(m_pImpl->m_pDoc);
if (!m_pImpl->m_sMarkName.getLength())
{
@@ -294,8 +294,8 @@ SwXBookmark::getAnchor() throw (uno::RuntimeException)
{
throw uno::RuntimeException();
}
- return SwXTextRange::CreateTextRangeFromPosition(
- m_pImpl->m_pDoc,
+ return SwXTextRange::CreateXTextRange(
+ *m_pImpl->m_pDoc,
m_pImpl->m_pRegisteredBookmark->GetMarkPos(),
(m_pImpl->m_pRegisteredBookmark->IsExpanded())
? &m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos() : NULL);
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 06c1961c73..00e129efc4 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -784,7 +784,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
if( pDesc && (xRg = pDesc->GetTextRange()).is() )
{
pInternalPam = new SwUnoInternalPaM(*pDoc);
- if(SwXTextRange::XTextRangeToSwPaM(*pInternalPam, xRg))
+ if (::sw::XTextRangeToSwPaM(*pInternalPam, xRg))
{
if(FLY_AT_FLY == aAnchor.GetAnchorId() &&
!pInternalPam->GetNode()->FindFlyStartNode())
@@ -1302,7 +1302,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
new SwUnoInternalPaM( *(pFmt->GetDoc()) );
uno::Reference< text::XTextRange > xRg;
aValue >>= xRg;
- if ( SwXTextRange::XTextRangeToSwPaM(*pInternalPam, xRg) )
+ if (::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
{
if (aAnchor.GetAnchorId() == FLY_AS_CHAR)
{
@@ -1634,9 +1634,9 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName)
{
if ( aAnchor.GetCntntAnchor() )
{
- uno::Reference< text::XTextRange > xTextRange =
- SwXTextRange::CreateTextRangeFromPosition(
- pFmt->GetDoc(),
+ const uno::Reference< text::XTextRange > xTextRange
+ = SwXTextRange::CreateXTextRange(
+ *pFmt->GetDoc(),
*aAnchor.GetCntntAnchor(),
0L );
aRet.setValue(&xTextRange, ::getCppuType((uno::Reference<text::XTextRange>*)0));
@@ -2203,7 +2203,7 @@ uno::Reference< text::XTextRange > SwXShape::getAnchor(void) throw( uno::Runtim
(rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
{
const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
- aRef = SwXTextRange::CreateTextRangeFromPosition(pFmt->GetDoc(), rPos, 0);
+ aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
}
}
else
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 31f4659c22..161a71136b 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1305,7 +1305,7 @@ void SwXTextField::attachToRange(
{
SwUnoInternalPaM aPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
SwField* pFld = 0;
switch(m_nServiceId)
{
@@ -1880,8 +1880,8 @@ uno::Reference< text::XTextRange > SwXTextField::getAnchor(void) throw( uno::Ru
SwPaM aPam(rTxtNode, *pTxtFld->GetStart() + 1, rTxtNode, *pTxtFld->GetStart());
- aRef = SwXTextRange::CreateTextRangeFromPosition(m_pDoc,
- *aPam.GetPoint(), aPam.GetMark());
+ aRef = SwXTextRange::CreateXTextRange(
+ *m_pDoc, *aPam.GetPoint(), aPam.GetMark());
}
return aRef;
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index c5055394cd..d45125c2d2 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -218,7 +218,9 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
UnoActionContext aAction( mpTxtNode->GetDoc() );
- uno::Reference< text::XTextRange > xRange = SwXTextRange::CreateTextRangeFromPosition( mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ const uno::Reference< text::XTextRange > xRange =
+ SwXTextRange::CreateXTextRange(
+ *mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
if ( xPropSet.is() )
{
@@ -246,7 +248,9 @@ void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
UnoActionContext aAction( mpTxtNode->GetDoc() );
- uno::Reference< text::XTextRange > xRange = SwXTextRange::CreateTextRangeFromPosition( mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ const uno::Reference< text::XTextRange > xRange =
+ SwXTextRange::CreateXTextRange(
+ *mpTxtNode->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
if ( xPropSet.is() )
{
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5457e7d0f5..841465009f 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2056,7 +2056,7 @@ uno::Reference< text::XTextRange > SwXFrame::getAnchor(void) throw( uno::Runtim
(rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
{
const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
- aRef = SwXTextRange::CreateTextRangeFromPosition(pFmt->GetDoc(), rPos, 0);
+ aRef = SwXTextRange::CreateXTextRange(*pFmt->GetDoc(), rPos, 0);
}
}
else
@@ -2098,7 +2098,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
{
SwUnoInternalPaM aIntPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aIntPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aIntPam, xTextRange);
SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
SwPaM aPam(rNode);
@@ -2430,7 +2430,7 @@ void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
}
SwDoc* pDoc = pFmt->GetDoc();
SwUnoInternalPaM aIntPam(*pDoc);
- if(SwXTextRange::XTextRangeToSwPaM(aIntPam, xTextRange))
+ if (::sw::XTextRangeToSwPaM(aIntPam, xTextRange))
{
SfxItemSet aSet( pDoc->GetAttrPool(),
RES_ANCHOR, RES_ANCHOR );
@@ -2672,7 +2672,7 @@ uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const
uno::Reference< text::XTextCursor > aRef;
SwFrmFmt* pFmt = GetFrmFmt();
SwUnoInternalPaM aPam(*GetDoc());
- if(pFmt && SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ if (pFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
{
SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
#if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 4f07cebed1..26333dd73d 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -251,7 +251,7 @@ void SwXFootnote::attachToRange(const uno::Reference< text::XTextRange > & xText
{
SwUnoInternalPaM aPam(*pNewDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
UnoActionContext aCont(pNewDoc);
SwTxtAttr* pTxtAttr = 0;
@@ -315,7 +315,8 @@ uno::Reference< text::XTextRange > SwXFootnote::getAnchor(void) throw( uno::Run
SwPosition aMark( *aPam.Start() );
aPam.SetMark();
aPam.GetMark()->nContent++;
- aRef = SwXTextRange::CreateTextRangeFromPosition((SwDoc*)GetDoc(), *aPam.Start(), aPam.End());
+ aRef = SwXTextRange::CreateXTextRange(
+ *GetDoc(), *aPam.Start(), aPam.End());
}
else
throw uno::RuntimeException();
@@ -412,7 +413,7 @@ uno::Reference< text::XTextCursor > SwXFootnote::createTextCursorByRange(
throw uno::RuntimeException();
uno::Reference< text::XTextCursor > aRef;
SwUnoInternalPaM aPam(*GetDoc());
- if(SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ if (::sw::XTextRangeToSwPaM(aPam, aTextPosition))
{
const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
const SwNode* pFtnStartNode = &pTxtFtn->GetStartNode()->GetNode();
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 904e7dfcdb..5cfaf16fc5 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1030,7 +1030,7 @@ void SwXDocumentIndex::attachToRange(const uno::Reference< text::XTextRange > &
{
SwUnoInternalPaM aPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
const SwTOXBase* pOld = pDoc->GetCurTOX( *aPam.Start() );
if(!pOld)
@@ -1092,7 +1092,7 @@ uno::Reference< text::XTextRange > SwXDocumentIndex::getAnchor(void) throw( uno
aPaM.SetMark();
aPaM.GetPoint()->nNode = *pIdx->GetNode().EndOfSectionNode();
aPaM.Move( fnMoveBackward, fnGoCntnt );
- xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
+ xRet = SwXTextRange::CreateXTextRange(*pSectFmt->GetDoc(),
*aPaM.GetMark(), aPaM.GetPoint());
}
}
@@ -1469,7 +1469,7 @@ void SwXDocumentIndexMark::attachToRange(const uno::Reference< text::XTextRange
SwUnoInternalPaM aPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
SwTOXMark aMark (pTOXType);
if(sAltText.Len())
aMark.SetAlternativeText(sAltText);
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 71061001d6..36afe319cb 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1536,10 +1536,8 @@ SwXTextRange::getText() throw (uno::RuntimeException)
SwTable const*const pTable = SwTable::FindTable( pTblFmt );
SwTableNode const*const pTblNode = pTable->GetTableNode();
const SwPosition aPosition( *pTblNode );
- const uno::Reference< text::XTextRange > xRange =
- SwXTextRange::CreateTextRangeFromPosition(
- &m_pImpl->m_rDoc, aPosition, 0);
- m_pImpl->m_xParentText = xRange->getText();
+ m_pImpl->m_xParentText =
+ ::sw::CreateParentXText(m_pImpl->m_rDoc, aPosition);
}
}
OSL_ENSURE(m_pImpl->m_xParentText.is(), "SwXTextRange::getText: no text");
@@ -1645,10 +1643,12 @@ bool SwXTextRange::GetPositions(SwPaM& rToFill) const
return false;
}
-sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
- const uno::Reference< XTextRange > & xTextRange)
+namespace sw {
+
+bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
+ const uno::Reference< text::XTextRange > & xTextRange)
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
SwXTextRange* pRange = 0;
@@ -1658,27 +1658,26 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
SwXParagraph* pPara = 0;
if(xRangeTunnel.is())
{
- pRange = reinterpret_cast< SwXTextRange * >(
- sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
- pCursor = reinterpret_cast< OTextCursorHelper * >(
- sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
- pPortion = reinterpret_cast< SwXTextPortion * >(
- sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
- pText = reinterpret_cast< SwXText * >(
- sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXText::getUnoTunnelId()) ));
- pPara = reinterpret_cast< SwXParagraph * >(
- sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId()) ));
+ pRange = ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
+ pPortion=
+ ::sw::UnoTunnelGetImplementation<SwXTextPortion>(xRangeTunnel);
+ pText = ::sw::UnoTunnelGetImplementation<SwXText>(xRangeTunnel);
+ pPara = ::sw::UnoTunnelGetImplementation<SwXParagraph>(xRangeTunnel);
}
- //if it's a text cursor then create a temporary cursor there and re-use the pCursor variable
- uno::Reference< XTextCursor > xTextCursor;
+ // if it's a text then create a temporary cursor there and re-use
+ // the pCursor variable
if(pText)
{
- xTextCursor = pText->createCursor();
+ const uno::Reference< text::XTextCursor > xTextCursor =
+ pText->createCursor();
xTextCursor->gotoEnd(sal_True);
- uno::Reference<XUnoTunnel> xCrsrTunnel( xTextCursor, UNO_QUERY);
- pCursor = reinterpret_cast< OTextCursorHelper * >(
- sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
+ const uno::Reference<lang::XUnoTunnel> xCrsrTunnel(
+ xTextCursor, uno::UNO_QUERY);
+ pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCrsrTunnel);
}
if(pRange && pRange->GetDoc() == rToFill.GetDoc())
{
@@ -1698,8 +1697,9 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
: ((pPortion) ? pPortion->GetCursor() : 0);
if (pUnoCrsr && pDoc == rToFill.GetDoc())
{
- DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr, "was machen wir mit Ringen?" );
- bRet = sal_True;
+ DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr,
+ "what to do about rings?");
+ bRet = true;
*rToFill.GetPoint() = *pUnoCrsr->GetPoint();
if (pUnoCrsr->HasMark())
{
@@ -1714,53 +1714,65 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
return bRet;
}
-sal_Bool lcl_IsStartNodeInFormat(sal_Bool bHeader, SwStartNode* pSttNode,
- const SwFrmFmt* pFrmFmt, SwFrmFmt*& rpFormat)
+static bool
+lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode *const pSttNode,
+ SwFrmFmt const*const pFrmFmt, SwFrmFmt*& rpFormat)
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
const SfxPoolItem* pItem;
- SwFrmFmt* pHeadFootFmt;
- if(SFX_ITEM_SET == rSet.GetItemState( static_cast< USHORT >(bHeader ? RES_HEADER : RES_FOOTER), sal_True, &pItem) &&
- 0 != (pHeadFootFmt = bHeader ?
- ((SwFmtHeader*)pItem)->GetHeaderFmt() :
- ((SwFmtFooter*)pItem)->GetFooterFmt()))
- {
- const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
- const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
- const SwStartNode* pCurSttNode = rNode.FindSttNodeByType(
- bHeader ? SwHeaderStartNode : SwFooterStartNode);
- if(pCurSttNode && pCurSttNode == pSttNode)
+ if (SFX_ITEM_SET == rSet.GetItemState(
+ static_cast<USHORT>(bHeader ? RES_HEADER : RES_FOOTER),
+ sal_True, &pItem))
+ {
+ SfxPoolItem *const pItemNonConst(const_cast<SfxPoolItem *>(pItem));
+ SwFrmFmt *const pHeadFootFmt = (bHeader) ?
+ static_cast<SwFmtHeader*>(pItemNonConst)->GetHeaderFmt() :
+ static_cast<SwFmtFooter*>(pItemNonConst)->GetFooterFmt();
+ if (pHeadFootFmt)
{
- bRet = sal_True;
- rpFormat = pHeadFootFmt;
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwStartNode const*const pCurSttNode = rNode.FindSttNodeByType(
+ (bHeader) ? SwHeaderStartNode : SwFooterStartNode);
+ if (pCurSttNode && (pCurSttNode == pSttNode))
+ {
+ rpFormat = pHeadFootFmt;
+ bRet = true;
+ }
}
}
return bRet;
}
-uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(
- SwDoc* pDoc, const SwPosition& rPos, const SwPosition* pMark)
+} // namespace sw
+
+uno::Reference< text::XTextRange >
+SwXTextRange::CreateXTextRange(
+ SwDoc & rDoc, const SwPosition& rPos, const SwPosition *const pMark)
{
- uno::Reference< XText > xParentText( CreateParentXText(pDoc, rPos) );
- std::auto_ptr<SwUnoCrsr> pNewCrsr( pDoc->CreateUnoCrsr(rPos, sal_False) );
+ const uno::Reference<text::XText> xParentText(
+ ::sw::CreateParentXText(rDoc, rPos));
+ const ::std::auto_ptr<SwUnoCrsr> pNewCrsr(
+ rDoc.CreateUnoCrsr(rPos, sal_False));
if(pMark)
{
pNewCrsr->SetMark();
*pNewCrsr->GetMark() = *pMark;
}
- bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) );
- uno::Reference< XTextRange > xRet(
+ const bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) );
+ const uno::Reference< text::XTextRange > xRet(
new SwXTextRange(*pNewCrsr, xParentText,
isCell ? RANGE_IN_CELL : RANGE_IN_TEXT) );
return xRet;
-
}
-uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
- const SwPosition& rPos)
+namespace sw {
+
+uno::Reference< text::XText >
+CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
{
- uno::Reference< XText > xParentText;
+ uno::Reference< text::XText > xParentText;
SwStartNode* pSttNode = rPos.nNode.GetNode().StartOfSectionNode();
while(pSttNode && pSttNode->IsSectionNode())
{
@@ -1771,18 +1783,19 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
{
case SwTableBoxStartNode:
{
- const SwTableNode* pTblNode = pSttNode->FindTableNode();
- SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
- SwTableBox* pBox = pSttNode->GetTblBox();
+ SwTableNode const*const pTblNode = pSttNode->FindTableNode();
+ SwFrmFmt *const pTableFmt =
+ static_cast<SwFrmFmt*>(pTblNode->GetTable().GetFrmFmt());
+ SwTableBox *const pBox = pSttNode->GetTblBox();
- xParentText = pBox
+ xParentText = (pBox)
? SwXCell::CreateXCell( pTableFmt, pBox )
: new SwXCell( pTableFmt, *pSttNode );
}
break;
case SwFlyStartNode:
{
- SwFrmFmt* pFmt = pSttNode->GetFlyFmt();
+ SwFrmFmt *const pFmt = pSttNode->GetFlyFmt();
if (0 != pFmt)
{
SwXTextFrame* pFrame( static_cast<SwXTextFrame*>(
@@ -1794,18 +1807,23 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
case SwHeaderStartNode:
case SwFooterStartNode:
{
- sal_Bool bHeader = SwHeaderStartNode == eType;
- sal_uInt16 nPDescCount = pDoc->GetPageDescCnt();
+ const bool bHeader = (SwHeaderStartNode == eType);
+ const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
for(sal_uInt16 i = 0; i < nPDescCount; i++)
{
- const SwPageDesc& rDesc = const_cast<const SwDoc*>(pDoc)
- ->GetPageDesc( i );
+ const SwPageDesc& rDesc =
+ // C++ is retarded
+ const_cast<SwDoc const&>(rDoc).GetPageDesc( i );
const SwFrmFmt* pFrmFmtMaster = &rDesc.GetMaster();
const SwFrmFmt* pFrmFmtLeft = &rDesc.GetLeft();
SwFrmFmt* pHeadFootFmt = 0;
- if(!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtMaster, pHeadFootFmt))
- lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtLeft, pHeadFootFmt);
+ if (!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtMaster,
+ pHeadFootFmt))
+ {
+ lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtLeft,
+ pHeadFootFmt);
+ }
if(pHeadFootFmt)
{
@@ -1813,7 +1831,10 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
First( TYPE( SwXHeadFootText ));
xParentText = pxHdFt;
if(!pxHdFt)
- xParentText = new SwXHeadFootText(*pHeadFootFmt, bHeader);
+ {
+ xParentText =
+ new SwXHeadFootText(*pHeadFootFmt, bHeader);
+ }
break;
}
}
@@ -1821,15 +1842,16 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
break;
case SwFootnoteStartNode:
{
- sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count();
- uno::Reference< XFootnote > xRef;
- for( n = 0; n < nFtnCnt; ++n )
+ const sal_uInt16 nFtnCnt = rDoc.GetFtnIdxs().Count();
+ uno::Reference< text::XFootnote > xRef;
+ for (sal_uInt16 n = 0; n < nFtnCnt; ++n )
{
- const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ n ];
+ const SwTxtFtn* pTxtFtn = rDoc.GetFtnIdxs()[ n ];
const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
pTxtFtn = rFtn.GetTxtFtn();
#if OSL_DEBUG_LEVEL > 1
- const SwStartNode* pTmpSttNode = pTxtFtn->GetStartNode()->GetNode().
+ const SwStartNode* pTmpSttNode =
+ pTxtFtn->GetStartNode()->GetNode().
FindSttNodeByType(SwFootnoteStartNode);
(void)pTmpSttNode;
#endif
@@ -1837,11 +1859,12 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
if (pSttNode == pTxtFtn->GetStartNode()->GetNode().
FindSttNodeByType(SwFootnoteStartNode))
{
- xParentText = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->
+ xParentText =
+ static_cast<SwUnoCallBack*>(rDoc.GetUnoCallBack())->
GetFootnote(rFtn);
if (!xParentText.is())
{
- xParentText = new SwXFootnote(pDoc, rFtn);
+ xParentText = new SwXFootnote(&rDoc, rFtn);
}
break;
}
@@ -1851,9 +1874,9 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
default:
{
// then it is the body text
- uno::Reference<frame::XModel> xModel =
- pDoc->GetDocShell()->GetBaseModel();
- uno::Reference< XTextDocument > xDoc(
+ const uno::Reference<frame::XModel> xModel =
+ rDoc.GetDocShell()->GetBaseModel();
+ const uno::Reference< text::XTextDocument > xDoc(
xModel, uno::UNO_QUERY);
xParentText = xDoc->getText();
}
@@ -1862,6 +1885,8 @@ uno::Reference< XText > SwXTextRange::CreateParentXText(SwDoc* pDoc,
return xParentText;
}
+} // namespace sw
+
uno::Reference< container::XEnumeration > SAL_CALL
SwXTextRange::createContentEnumeration(const OUString& rServiceName)
throw (uno::RuntimeException)
@@ -2168,8 +2193,8 @@ void SwXTextRanges::Impl::MakeRanges()
SwPaM *pTmpCursor = pCursor;
do {
const uno::Reference< text::XTextRange > xRange(
- SwXTextRange::CreateTextRangeFromPosition(
- pTmpCursor->GetDoc(),
+ SwXTextRange::CreateXTextRange(
+ *pTmpCursor->GetDoc(),
*pTmpCursor->GetPoint(), pTmpCursor->GetMark()));
if (xRange.is())
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 683366fc6d..ee6af202af 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -263,7 +263,7 @@ SwXParagraph::CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode,
if (!xParentText.is())
{
SwPosition Pos( rTxtNode );
- xParentText.set(SwXTextRange::CreateParentXText( &rDoc, Pos ));
+ xParentText.set(::sw::CreateParentXText( rDoc, Pos ));
}
SwXParagraph *const pXPara(
new SwXParagraph(xParentText, rTxtNode, nSelStart, nSelEnd) );
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 6f7ee5ff68..04162db925 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -591,11 +591,8 @@ uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName )
pPoint = pRedline->GetPoint();
else
pPoint = pRedline->GetMark();
- SwPaM aTmp(*pPoint);
- uno::Reference<text::XText> xTmpParent;
-// uno::Reference< text::XTextRange > xRange = SwXTextRange::createTextRangeFromPaM(aTmp);
- uno::Reference<text::XTextRange>xRange =
- SwXTextRange::CreateTextRangeFromPosition( pDoc, *pPoint, 0 );
+ const uno::Reference<text::XTextRange> xRange =
+ SwXTextRange::CreateXTextRange(*pDoc, *pPoint, 0);
xRet = xRange.get();
}
break;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index fa8acbf631..c8b4927b09 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -309,7 +309,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
SwUnoInternalPaM aPam(*pDocument);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
m_pImpl->InsertRefMark(aPam, dynamic_cast<SwXTextCursor*>(pCursor));
m_pImpl->m_bIsDescriptor = sal_False;
m_pImpl->m_pDoc = pDocument;
@@ -342,8 +342,8 @@ SwXReferenceMark::getAnchor() throw (uno::RuntimeException)
rTxtNode, *pTxtMark->GetStart())
: new SwPaM( rTxtNode, *pTxtMark->GetStart()) );
- return SwXTextRange::CreateTextRangeFromPosition(
- m_pImpl->m_pDoc, *pPam->Start(), pPam->End());
+ return SwXTextRange::CreateXTextRange(
+ *m_pImpl->m_pDoc, *pPam->Start(), pPam->End());
}
}
}
@@ -820,8 +820,7 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
OSL_ENSURE(pTxtAttr, "CreateXMeta: no text attr?");
if (!pTxtAttr) { return 0; }
const SwPosition aPos(*pTxtNode, *pTxtAttr->GetStart());
- xParentText.set(
- SwXTextRange::CreateParentXText(pTxtNode->GetDoc(), aPos) );
+ xParentText.set( ::sw::CreateParentXText(*pTxtNode->GetDoc(), aPos) );
}
if (!xParentText.is()) { return 0; }
SwXMeta *const pXMeta( (RES_TXTATR_META == rMeta.GetFmtMeta()->Which())
@@ -1072,7 +1071,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
SwUnoInternalPaM aPam(*pDoc);
- SwXTextRange::XTextRangeToSwPaM(aPam, i_xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, i_xTextRange);
UnoActionContext aContext(pDoc);
@@ -1109,8 +1108,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
pMeta->Add(m_pImpl.get());
pMeta->SetXMeta(uno::Reference<rdf::XMetadatable>(this));
- m_pImpl->m_xParentText =
- SwXTextRange::CreateParentXText(pDoc, *aPam.GetPoint());
+ m_pImpl->m_xParentText = ::sw::CreateParentXText(*pDoc, *aPam.GetPoint());
m_pImpl->m_bIsDescriptor = false;
}
@@ -1153,8 +1151,7 @@ SwXMeta::getAnchor() throw (uno::RuntimeException)
const SwPosition start(*pTxtNode, nMetaStart - 1); // -1 due to CH_TXTATR
const SwPosition end(*pTxtNode, nMetaEnd);
- return SwXTextRange::CreateTextRangeFromPosition(
- pTxtNode->GetDoc(), start, &end);
+ return SwXTextRange::CreateXTextRange(*pTxtNode->GetDoc(), start, &end);
}
// XTextRange
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index c47a3aef13..d9d6bafa31 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -328,7 +328,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
SwUnoInternalPaM aPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
UnoActionContext aCont(pDoc);
pDoc->StartUndo( UNDO_INSSECTION, NULL );
@@ -488,7 +488,7 @@ SwXTextSection::getAnchor() throw (uno::RuntimeException)
const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode();
SwPaM aEnd(*pEndNode);
aEnd.Move( fnMoveBackward, fnGoCntnt );
- xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
+ xRet = SwXTextRange::CreateXTextRange(*pSectFmt->GetDoc(),
*aPaM.Start(), aEnd.Start());
}
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 049f2c5662..497f09fa8d 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1062,7 +1062,8 @@ uno::Reference< text::XTextCursor > SwXCell::createTextCursorByRange(const uno:
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< text::XTextCursor > aRef;
SwUnoInternalPaM aPam(*GetDoc());
- if((pStartNode || IsValid()) && SwXTextRange::XTextRangeToSwPaM(aPam, xTextPosition))
+ if ((pStartNode || IsValid())
+ && ::sw::XTextRangeToSwPaM(aPam, xTextPosition))
{
const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
//skip sections
@@ -2468,7 +2469,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex
{
SwUnoInternalPaM aPam(*pDoc);
//das muss jetzt sal_True liefern
- SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ ::sw::XTextRangeToSwPaM(aPam, xTextRange);
{
UnoActionContext aCont( pDoc );
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 98c81df1f4..fb4e04b236 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -382,7 +382,7 @@ void SwXText::insertControlCharacter(const uno::Reference< text::XTextRange > &
if (GetDoc())
{
SwUnoInternalPaM aPam(*GetDoc());
- if(SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange))
+ if (::sw::XTextRangeToSwPaM(aPam, xTextRange))
{
const bool bForceExpandHints(CheckForOwnMemberMeta(aPam, bAbsorb));
@@ -504,7 +504,7 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang
if(xRange.is() && xContent.is())
{
SwUnoInternalPaM aPam(*GetDoc());
- if(SwXTextRange::XTextRangeToSwPaM(aPam, xRange))
+ if (::sw::XTextRangeToSwPaM(aPam, xRange))
{
uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
SwXTextRange* pRange = 0;
@@ -1060,8 +1060,8 @@ sal_Int16 SwXText::ComparePositions(
SwUnoInternalPaM aPam2(*GetDoc());
BOOL bExcept = FALSE;
- if(SwXTextRange::XTextRangeToSwPaM(aPam1, xPos1) &&
- SwXTextRange::XTextRangeToSwPaM(aPam2, xPos2))
+ if (::sw::XTextRangeToSwPaM(aPam1, xPos1) &&
+ ::sw::XTextRangeToSwPaM(aPam2, xPos2))
{
uno::Reference<lang::XUnoTunnel> xRangeTunnel1( xPos1, uno::UNO_QUERY);
SwXTextRange* pRange1 = 0;
@@ -1582,8 +1582,8 @@ uno::Reference< text::XTextContent > SwXText::convertToTextFrame(
uno::Reference< text::XTextContent > xRet;
SwUnoInternalPaM aStartPam(*GetDoc());
std::auto_ptr < SwUnoInternalPaM > pEndPam( new SwUnoInternalPaM(*GetDoc()));
- if(SwXTextRange::XTextRangeToSwPaM(aStartPam, xStart) &&
- SwXTextRange::XTextRangeToSwPaM(*pEndPam, xEnd) )
+ if (::sw::XTextRangeToSwPaM(aStartPam, xStart) &&
+ ::sw::XTextRangeToSwPaM(*pEndPam, xEnd))
{
uno::Reference<lang::XUnoTunnel> xStartRangeTunnel( xStart, uno::UNO_QUERY);
SwXTextRange* pStartRange = reinterpret_cast< SwXTextRange * >(
@@ -1826,8 +1826,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
// !!! TODO - PaMs in tables and sections do not work here - the same applies to PaMs in frames !!!
- if(!SwXTextRange::XTextRangeToSwPaM(aStartCellPam, xStartRange) ||
- !SwXTextRange::XTextRangeToSwPaM(aEndCellPam, xEndRange) )
+ if (!::sw::XTextRangeToSwPaM(aStartCellPam, xStartRange) ||
+ !::sw::XTextRangeToSwPaM(aEndCellPam, xEndRange))
throw lang::IllegalArgumentException();
/** check the nodes between start and end
it is allowed to have pairs of StartNode/EndNodes
@@ -2361,7 +2361,7 @@ uno::Reference< text::XTextCursor > SwXBodyText::createTextCursorByRange(
throw aRuntime;
}
SwUnoInternalPaM aPam(*GetDoc());
- if(SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ if (::sw::XTextRangeToSwPaM(aPam, aTextPosition))
{
SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
@@ -2603,7 +2603,7 @@ uno::Reference< text::XTextCursor > SwXHeadFootText::createTextCursorByRange(
uno::Reference< text::XTextCursor > xRet;
SwFrmFmt* pHeadFootFmt = GetFmt();
SwUnoInternalPaM aPam(*GetDoc());
- if(pHeadFootFmt && SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ if (pHeadFootFmt && ::sw::XTextRangeToSwPaM(aPam, aTextPosition))
{
SwNode& rNode = pHeadFootFmt->GetCntnt().GetCntntIdx()->GetNode();
SwPosition aPos(rNode);
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 3cabf2e49b..b28c444f26 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -162,7 +162,7 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex(
#ifdef DBG_UTIL
sal_Bool bSuccess =
#endif
- SwXTextRange::XTextRangeToSwPaM( aPaM, rRange);
+ ::sw::XTextRangeToSwPaM(aPaM, rRange);
DBG_ASSERT(bSuccess, "illegal range");
// PaM -> Index
@@ -180,7 +180,7 @@ void XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos)
#ifdef DBG_UTIL
sal_Bool bSuccess =
#endif
- SwXTextRange::XTextRangeToSwPaM(aUnoPaM, xRange);
+ ::sw::XTextRangeToSwPaM(aUnoPaM, xRange);
DBG_ASSERT(bSuccess, "illegal range");
rPos = *aUnoPaM.GetPoint();
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 8d964ac1d8..986c76b229 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -788,9 +788,8 @@ ULONG XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const S
}
else if( bInsertMode )
{
- uno::Reference<XTextRange> xInsertTextRange =
- SwXTextRange::CreateTextRangeFromPosition( &rDoc, *rPaM.GetPoint(),
- 0 );
+ const uno::Reference<text::XTextRange> xInsertTextRange =
+ SwXTextRange::CreateXTextRange(rDoc, *rPaM.GetPoint(), 0);
OUString sTextInsertModeRange(
RTL_CONSTASCII_USTRINGPARAM("TextInsertModeRange"));
xInfoSet->setPropertyValue( sTextInsertModeRange,
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 1039515a8d..42815039db 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -713,9 +713,9 @@ void SwXMLImport::startDocument( void )
}
if( pCrsrSh )
{
- Reference<XTextRange> xInsertTextRange(
- SwXTextRange::CreateTextRangeFromPosition(
- pDoc, *pCrsrSh->GetCrsr()->GetPoint(), 0 ) );
+ const uno::Reference<text::XTextRange> xInsertTextRange(
+ SwXTextRange::CreateXTextRange(
+ *pDoc, *pCrsrSh->GetCrsr()->GetPoint(), 0 ) );
setTextInsertMode( xInsertTextRange );
xTextCursor = GetTextImport()->GetCursor();
pTxtCrsr = 0;
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index a50779bf1b..95cf0ddfda 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2926,8 +2926,8 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
SwPosition aPos( *pCNd );
aPos.nContent.Assign( pCNd, 0U );
- Reference < XTextRange > xTextRange =
- SwXTextRange::CreateTextRangeFromPosition( pDoc, aPos, 0 );
+ const uno::Reference< text::XTextRange > xTextRange =
+ SwXTextRange::CreateXTextRange( *pDoc, aPos, 0 );
Reference < XText > xText = xTextRange->getText();
Reference < XTextCursor > xTextCursor =
xText->createTextCursorByRange( xTextRange );
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
index f0e72323d2..a5d9c75b39 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 1d9b3f1f82..4b6e67a8d7 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 e314b306e9..3645be8506 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();