summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/pam.hxx2
-rw-r--r--sw/source/core/access/accpara.cxx2
-rw-r--r--sw/source/core/crsr/annotationmark.cxx5
-rw-r--r--sw/source/core/crsr/bookmrk.cxx25
-rw-r--r--sw/source/core/crsr/pam.cxx4
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx8
-rw-r--r--sw/source/core/doc/docbm.cxx6
-rw-r--r--sw/source/core/undo/SwUndoField.cxx4
-rw-r--r--sw/source/core/undo/unattr.cxx4
-rw-r--r--sw/source/core/undo/unbkmk.cxx10
-rw-r--r--sw/source/core/undo/undobj.cxx4
-rw-r--r--sw/source/core/undo/unnum.cxx4
-rw-r--r--sw/source/core/undo/untbl.cxx2
-rw-r--r--sw/source/core/unocore/unobkm.cxx4
-rw-r--r--sw/source/core/unocore/unotbl.cxx7
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx2
16 files changed, 42 insertions, 51 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 0f80752a276a..8c0a8abe6de9 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -47,7 +47,7 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
@return the document this position is in.
*/
- SwDoc * GetDoc() const;
+ SwDoc& GetDoc() const;
bool operator < (const SwPosition &) const;
bool operator > (const SwPosition &) const;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 001c32ade91b..4f60b2b9dff0 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -536,7 +536,7 @@ const SwRangeRedline* SwAccessibleParagraph::GetRedlineAtIndex()
if ( pCrSr )
{
SwPosition* pStart = pCrSr->Start();
- pRedline = pStart->GetDoc()->getIDocumentRedlineAccess().GetRedline(*pStart, nullptr);
+ pRedline = pStart->GetDoc().getIDocumentRedlineAccess().GetRedline(*pStart, nullptr);
}
return pRedline;
diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx
index 887333525390..061d88a08323 100644
--- a/sw/source/core/crsr/annotationmark.cxx
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -78,11 +78,10 @@ namespace sw::mark
const SwFormatField* AnnotationMark::GetAnnotationFormatField() const
{
- SwDoc* pDoc = GetMarkPos().GetDoc();
- assert(pDoc != nullptr);
+ SwDoc& rDoc = GetMarkPos().GetDoc();
const auto sName = GetName();
- SwFieldType* pType = pDoc->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::Postit, OUString(), false );
+ SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType( SwFieldIds::Postit, OUString(), false );
std::vector<SwFormatField*> vFields;
pType->GatherFields(vFields);
auto ppFound = std::find_if(vFields.begin(), vFields.end(), [&sName](SwFormatField* pF)
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 4e43a49bf007..c918ec28917e 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -455,16 +455,14 @@ namespace sw::mark
::sfx2::IXmlIdRegistry& Bookmark::GetRegistry()
{
- SwDoc *const pDoc( GetMarkPos().GetDoc() );
- assert(pDoc);
- return pDoc->GetXmlIdRegistry();
+ SwDoc& rDoc( GetMarkPos().GetDoc() );
+ return rDoc.GetXmlIdRegistry();
}
bool Bookmark::IsInClipboard() const
{
- SwDoc *const pDoc( GetMarkPos().GetDoc() );
- assert(pDoc);
- return pDoc->IsClipBoard();
+ SwDoc& rDoc( GetMarkPos().GetDoc() );
+ return rDoc.IsClipBoard();
}
bool Bookmark::IsInUndo() const
@@ -474,17 +472,15 @@ namespace sw::mark
bool Bookmark::IsInContent() const
{
- SwDoc *const pDoc( GetMarkPos().GetDoc() );
- assert(pDoc);
- return !pDoc->IsInHeaderFooter( GetMarkPos().nNode );
+ SwDoc& rDoc( GetMarkPos().GetDoc() );
+ return !rDoc.IsInHeaderFooter( GetMarkPos().nNode );
}
uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject()
{
- SwDoc *const pDoc( GetMarkPos().GetDoc() );
- assert(pDoc);
+ SwDoc& rDoc( GetMarkPos().GetDoc() );
const uno::Reference< rdf::XMetadatable> xMeta(
- SwXBookmark::CreateXBookmark(*pDoc, this), uno::UNO_QUERY);
+ SwXBookmark::CreateXBookmark(rDoc, this), uno::UNO_QUERY);
return xMeta;
}
@@ -626,9 +622,8 @@ namespace sw::mark
{
(*GetParameters())[OUString(ODF_FORMCHECKBOX_RESULT)] <<= checked;
// mark document as modified
- SwDoc *const pDoc( GetMarkPos().GetDoc() );
- if ( pDoc )
- pDoc->getIDocumentState().SetModified();
+ SwDoc& rDoc( GetMarkPos().GetDoc() );
+ rDoc.getIDocumentState().SetModified();
}
}
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index e73885ff6008..aae189370d0a 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -175,9 +175,9 @@ bool SwPosition::operator!=(const SwPosition &rPos) const
|| (nContent != rPos.nContent);
}
-SwDoc * SwPosition::GetDoc() const
+SwDoc& SwPosition::GetDoc() const
{
- return &nNode.GetNode().GetDoc();
+ return nNode.GetNode().GetDoc();
}
void SwPosition::dumpAsXml(xmlTextWriterPtr pWriter) const
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index fd7dd06a6cfa..4ca1c1cb894d 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -234,9 +234,9 @@ namespace sw
void CopyBookmarks(const SwPaM& rPam, SwPosition& rCpyPam)
{
const SwDoc& rSrcDoc = rPam.GetDoc();
- SwDoc* pDestDoc = rCpyPam.GetDoc();
+ SwDoc& rDestDoc = rCpyPam.GetDoc();
const IDocumentMarkAccess* const pSrcMarkAccess = rSrcDoc.getIDocumentMarkAccess();
- ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
+ ::sw::UndoGuard const undoGuard(rDestDoc.GetIDocumentUndoRedo());
const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
SwPosition const*const pCpyStt = &rCpyPam;
@@ -283,14 +283,14 @@ namespace sw
lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount);
}
- ::sw::mark::IMark* const pNewMark = pDestDoc->getIDocumentMarkAccess()->makeMark(
+ ::sw::mark::IMark* const pNewMark = rDestDoc.getIDocumentMarkAccess()->makeMark(
aTmpPam,
pMark->GetName(),
IDocumentMarkAccess::GetType(*pMark),
::sw::mark::InsertMode::CopyText);
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
- pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
+ rDestDoc.getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
// copying additional attributes for bookmarks or fieldmarks
::sw::mark::IBookmark* const pNewBookmark =
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 749c473d8c56..271ad9bcc0fc 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -812,7 +812,7 @@ namespace sw::mark
::sw::mark::IMark* const io_pMark,
const SwPaM& rPaM)
{
- assert(io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
+ assert(&io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::repositionMark(..)>"
" - Mark is not in my doc.");
MarkBase* const pMarkBase = dynamic_cast< MarkBase* >(io_pMark);
@@ -839,7 +839,7 @@ namespace sw::mark
::sw::mark::IMark* io_pMark,
const OUString& rNewName )
{
- assert(io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
+ assert(&io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::renameMark(..)>"
" - Mark is not in my doc.");
if ( io_pMark->GetName() == rNewName )
@@ -1288,7 +1288,7 @@ namespace sw::mark
void MarkManager::deleteMark(const IMark* const pMark)
{
- assert(pMark->GetMarkPos().GetDoc() == &m_rDoc &&
+ assert(&pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::deleteMark(..)>"
" - Mark is not in my doc.");
// finds the last Mark that is starting before pMark
diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx
index 3ab16ebe4ff3..353070852588 100644
--- a/sw/source/core/undo/SwUndoField.cxx
+++ b/sw/source/core/undo/SwUndoField.cxx
@@ -33,11 +33,11 @@
using namespace ::com::sun::star::uno;
SwUndoField::SwUndoField(const SwPosition & rPos )
- : SwUndo(SwUndoId::FIELD, rPos.GetDoc())
+ : SwUndo(SwUndoId::FIELD, &rPos.GetDoc())
{
m_nNodeIndex = rPos.nNode.GetIndex();
m_nOffset = rPos.nContent.GetIndex();
- m_pDoc = rPos.GetDoc();
+ m_pDoc = &rPos.GetDoc();
}
SwUndoField::~SwUndoField()
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 68fb64f903bd..3cbdebd6a989 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -538,7 +538,7 @@ SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, sal_uInt16 nFormatId )
}
SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, sal_uInt16 nFormatId )
- : SwUndo( SwUndoId::RESETATTR, rPos.GetDoc() )
+ : SwUndo( SwUndoId::RESETATTR, &rPos.GetDoc() )
, m_pHistory( new SwHistory )
, m_nFormatId( nFormatId )
{
@@ -1017,7 +1017,7 @@ void SwUndoEndNoteInfo::RedoImpl(::sw::UndoRedoContext & rContext)
}
SwUndoDontExpandFormat::SwUndoDontExpandFormat( const SwPosition& rPos )
- : SwUndo( SwUndoId::DONTEXPAND, rPos.GetDoc() )
+ : SwUndo( SwUndoId::DONTEXPAND, &rPos.GetDoc() )
, m_nNodeIndex( rPos.nNode.GetIndex() )
, m_nContentIndex( rPos.nContent.GetIndex() )
{
diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx
index 16d45a7b705c..cabcd02a5170 100644
--- a/sw/source/core/undo/unbkmk.cxx
+++ b/sw/source/core/undo/unbkmk.cxx
@@ -32,7 +32,7 @@
SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId,
const ::sw::mark::IMark& rBkmk )
- : SwUndo( nUndoId, rBkmk.GetMarkPos().GetDoc() )
+ : SwUndo( nUndoId, &rBkmk.GetMarkPos().GetDoc() )
, m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded()))
{
}
@@ -148,7 +148,7 @@ void SwUndoRenameBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
}
SwUndoInsNoTextFieldmark::SwUndoInsNoTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark)
- : SwUndo(SwUndoId::INSERT, rFieldmark.GetMarkPos().GetDoc())
+ : SwUndo(SwUndoId::INSERT, &rFieldmark.GetMarkPos().GetDoc())
, m_pHistoryNoTextFieldmark(new SwHistoryNoTextFieldmark(rFieldmark))
{
}
@@ -164,7 +164,7 @@ void SwUndoInsNoTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext)
}
SwUndoDelNoTextFieldmark::SwUndoDelNoTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark)
- : SwUndo(SwUndoId::DELETE, rFieldmark.GetMarkPos().GetDoc())
+ : SwUndo(SwUndoId::DELETE, &rFieldmark.GetMarkPos().GetDoc())
, m_pHistoryNoTextFieldmark(new SwHistoryNoTextFieldmark(rFieldmark))
{
}
@@ -182,7 +182,7 @@ void SwUndoDelNoTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext)
}
SwUndoInsTextFieldmark::SwUndoInsTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark)
- : SwUndo(SwUndoId::INSERT, rFieldmark.GetMarkPos().GetDoc())
+ : SwUndo(SwUndoId::INSERT, &rFieldmark.GetMarkPos().GetDoc())
, m_pHistoryTextFieldmark(new SwHistoryTextFieldmark(rFieldmark))
{
}
@@ -198,7 +198,7 @@ void SwUndoInsTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext)
}
SwUndoDelTextFieldmark::SwUndoDelTextFieldmark(const ::sw::mark::IFieldmark& rFieldmark)
- : SwUndo(SwUndoId::DELETE, rFieldmark.GetMarkPos().GetDoc())
+ : SwUndo(SwUndoId::DELETE, &rFieldmark.GetMarkPos().GetDoc())
, m_pHistoryTextFieldmark(new SwHistoryTextFieldmark(rFieldmark))
{
}
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 323de872c3cf..0ef36bd5f6e7 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1597,7 +1597,7 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
}
if ((nDelContentType & DelContentType::WriterfilterHack)
- && rAnchorPos.GetDoc()->IsInWriterfilterImport())
+ && rAnchorPos.GetDoc().IsInWriterfilterImport())
{ // FIXME hack for writerfilter RemoveLastParagraph() and MakeFlyAndMove(); can't test file format more specific?
return (rStart < rAnchorPos) && (rAnchorPos < rEnd);
}
@@ -1638,7 +1638,7 @@ bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
}
if ((nDelContentType & DelContentType::WriterfilterHack)
- && rAnchorPos.GetDoc()->IsInWriterfilterImport())
+ && rAnchorPos.GetDoc().IsInWriterfilterImport())
{ // FIXME hack for writerfilter RemoveLastParagraph() and MakeFlyAndMove(); can't test file format more specific?
// but it MUST NOT be done during the SetRedlineFlags at the end of ODF
// import, where the IsInXMLImport() cannot be checked because the
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 603567544bff..d7d517a5f37f 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -323,14 +323,14 @@ void SwUndoNumOrNoNum::RepeatImpl(::sw::RepeatContext & rContext)
}
SwUndoNumRuleStart::SwUndoNumRuleStart( const SwPosition& rPos, bool bFlg )
- : SwUndo( SwUndoId::SETNUMRULESTART, rPos.GetDoc() ),
+ : SwUndo( SwUndoId::SETNUMRULESTART, &rPos.GetDoc() ),
m_nIndex( rPos.nNode.GetIndex() ), m_nOldStart( USHRT_MAX ),
m_nNewStart( USHRT_MAX ), m_bSetStartValue( false ), m_bFlag( bFlg )
{
}
SwUndoNumRuleStart::SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt )
- : SwUndo(SwUndoId::SETNUMRULESTART, rPos.GetDoc())
+ : SwUndo(SwUndoId::SETNUMRULESTART, &rPos.GetDoc())
, m_nIndex(rPos.nNode.GetIndex())
, m_nOldStart(USHRT_MAX)
, m_nNewStart(nStt)
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index f5f853503174..0df50f847820 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -223,7 +223,7 @@ SwUndoInsTable::SwUndoInsTable( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt
const SwTableAutoFormat* pTAFormat,
const std::vector<sal_uInt16> *pColArr,
const OUString & rName)
- : SwUndo( SwUndoId::INSTABLE, rPos.GetDoc() ),
+ : SwUndo( SwUndoId::INSTABLE, &rPos.GetDoc() ),
m_aInsTableOptions( rInsTableOpts ),
m_nStartNode( rPos.nNode.GetIndex() ), m_nRows( nRw ), m_nColumns( nCl ), m_nAdjust( nAdj )
{
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 97550fec41da..233d14b23421 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -101,8 +101,8 @@ void SwXBookmark::Impl::registerInMark(SwXBookmark& rThis,
{
pMarkBase->SetXBookmark(xBookmark);
}
- assert(m_pDoc == nullptr || m_pDoc == pBkmk->GetMarkPos().GetDoc());
- m_pDoc = pBkmk->GetMarkPos().GetDoc();
+ assert(m_pDoc == nullptr || m_pDoc == &pBkmk->GetMarkPos().GetDoc());
+ m_pDoc = &pBkmk->GetMarkPos().GetDoc();
}
else if (m_pRegisteredBookmark)
{
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 86b0b7ca5446..f58ee3dad7e0 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1074,11 +1074,8 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
return uno::Any();
SwPosition aPos(*pTableNode);
- SwDoc* pDoc = aPos.GetDoc();
- if (!pDoc)
- return uno::Any();
-
- m_xParentText = sw::CreateParentXText(*pDoc, aPos);
+ SwDoc& rDoc = aPos.GetDoc();
+ m_xParentText = sw::CreateParentXText(rDoc, aPos);
}
return uno::makeAny(m_xParentText);
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index af79be052618..bed5a4eeb23d 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -736,7 +736,7 @@ namespace sw
SwPosition const end(*rPos.nNode.GetNode().GetTextNode(),
nIndex - 1);
sw::mark::IFieldmark *const pFieldMark(
- rPos.GetDoc()->getIDocumentMarkAccess()->getFieldmarkAt(end));
+ rPos.GetDoc().getIDocumentMarkAccess()->getFieldmarkAt(end));
SAL_WARN_IF(!pFieldMark, "sw.ww8", "expected a field mark");
if (pFieldMark && pFieldMark->GetMarkPos().nNode.GetIndex() == (*aResult)->m_aMkPos.m_nNode.GetIndex()+1
&& pFieldMark->GetMarkPos().nContent.GetIndex() < (*aResult)->m_aMkPos.m_nContent)