[Libreoffice-commits] core.git: sw/inc sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 4 18:43:20 UTC 2020
sw/inc/numrule.hxx | 2
sw/source/core/doc/DocumentContentOperationsManager.cxx | 2
sw/source/core/doc/docfmt.cxx | 2
sw/source/core/doc/number.cxx | 6 -
sw/source/core/doc/swserv.cxx | 12 +--
sw/source/core/inc/mvsave.hxx | 4 -
sw/source/filter/ascii/parasc.cxx | 52 ++++++++--------
sw/source/filter/ww8/docxattributeoutput.cxx | 2
sw/source/filter/ww8/docxtablestyleexport.cxx | 14 ++--
sw/source/filter/ww8/docxtablestyleexport.hxx | 2
10 files changed, 49 insertions(+), 49 deletions(-)
New commits:
commit 6539ff3f4123a961a949c8d6a5fae8880c3d7081
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Oct 4 17:18:02 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 4 20:42:37 2020 +0200
DocxTableStyleExport never passed a null SwDoc*
ditto:
SwASCIIParser ctor
SwNumRule::CopyNumRule
SwDataChanged ctor
Change-Id: I0f731ef2856eb70bd5fff5372ee7bc769e1f8bd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103922
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index ae6405424518..4da44bbd8ced 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -214,7 +214,7 @@ public:
/** A kind of copy-constructor to make sure the num formats are
attached to the correctCharFormats of a document!!
(Copies the NumFormats and returns itself). */
- SwNumRule& CopyNumRule( SwDoc*, const SwNumRule& );
+ SwNumRule& CopyNumRule( SwDoc&, const SwNumRule& );
/** Tests whether the CharFormats are from the given doc
and copies them if appropriate. */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index cf697077133f..fe748212d497 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3120,7 +3120,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b
{
// BUG 26675: Send DataChanged before deleting, so that we notice which objects are in scope.
// After that they can be before/after the position.
- SwDataChanged aTmp( &m_rDoc, rPos );
+ SwDataChanged aTmp( m_rDoc, rPos );
}
SwUndoSplitNode* pUndo = nullptr;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index dbafd42f1856..008f0beea2b2 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1581,7 +1581,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
const SwNumRule& rR = *rArr[ n ];
SwNumRule* pNew = FindNumRulePtr( rR.GetName());
if( pNew )
- pNew->CopyNumRule( this, rR );
+ pNew->CopyNumRule(*this, rR);
else
{
if( !rR.IsAutoRule() )
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index a75c2478320d..4de390353fdf 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -853,17 +853,17 @@ OUString SwNumRule::MakeParagraphStyleListString() const
A kind of copy constructor, so that the num formats are attached to the
right CharFormats of a Document.
Copies the NumFormats and returns itself. */
-SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule )
+SwNumRule& SwNumRule::CopyNumRule( SwDoc& rDoc, const SwNumRule& rNumRule )
{
for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
{
Set( n, rNumRule.maFormats[ n ].get() );
if( maFormats[ n ] && maFormats[ n ]->GetCharFormat() &&
- !pDoc->GetCharFormats()->IsAlive(maFormats[n]->GetCharFormat()))
+ !rDoc.GetCharFormats()->IsAlive(maFormats[n]->GetCharFormat()))
{
// If we copy across different Documents, then copy the
// corresponding CharFormat into the new Document.
- maFormats[n]->SetCharFormat( pDoc->CopyCharFormat( *maFormats[n]->
+ maFormats[n]->SetCharFormat( rDoc.CopyCharFormat( *maFormats[n]->
GetCharFormat() ) );
}
}
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 100e8b6a3f2c..cc2d3fe5dbf5 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -275,13 +275,13 @@ void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark)
}
SwDataChanged::SwDataChanged( const SwPaM& rPam )
- : m_pPam( &rPam ), m_pPos( nullptr ), m_pDoc( &rPam.GetDoc() )
+ : m_pPam( &rPam ), m_pPos( nullptr ), m_rDoc( rPam.GetDoc() )
{
m_nContent = rPam.GetPoint()->nContent.GetIndex();
}
-SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos )
- : m_pPam( nullptr ), m_pPos( &rPos ), m_pDoc( pDc )
+SwDataChanged::SwDataChanged( SwDoc& rDc, const SwPosition& rPos )
+ : m_pPam( nullptr ), m_pPos( &rPos ), m_rDoc( rDc )
{
m_nContent = rPos.nContent.GetIndex();
}
@@ -289,10 +289,10 @@ SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos )
SwDataChanged::~SwDataChanged()
{
// JP 09.04.96: Only if the Layout is available (thus during input)
- if( !m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() )
+ if( !m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() )
return;
- const ::sfx2::SvLinkSources& rServers = m_pDoc->getIDocumentLinksAdministration().GetLinkManager().GetServers();
+ const ::sfx2::SvLinkSources& rServers = m_rDoc.getIDocumentLinksAdministration().GetLinkManager().GetServers();
::sfx2::SvLinkSources aTemp(rServers);
for( const auto& rpLinkSrc : aTemp )
@@ -312,7 +312,7 @@ SwDataChanged::~SwDataChanged()
if( !refObj->HasDataLinks() )
{
// Then remove from the list
- m_pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( rpLinkSrc );
+ m_rDoc.getIDocumentLinksAdministration().GetLinkManager().RemoveServer( rpLinkSrc );
}
}
}
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index 0b962383bdb5..6aeefcd950d3 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -130,12 +130,12 @@ class SwDataChanged
{
const SwPaM* m_pPam;
const SwPosition* m_pPos;
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
sal_Int32 m_nContent;
public:
SwDataChanged( const SwPaM& rPam );
- SwDataChanged( SwDoc* pDoc, const SwPosition& rPos );
+ SwDataChanged( SwDoc& rDoc, const SwPosition& rPos );
~SwDataChanged();
sal_Int32 GetContent() const { return m_nContent; }
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index bc97ffd3b6b4..a82104dbf594 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -48,7 +48,7 @@ namespace {
class SwASCIIParser
{
- SwDoc* pDoc;
+ SwDoc& rDoc;
std::unique_ptr<SwPaM> pPam;
SvStream& rInput;
std::unique_ptr<char[]> pArr;
@@ -65,7 +65,7 @@ class SwASCIIParser
SwASCIIParser& operator=(const SwASCIIParser&) = delete;
public:
- SwASCIIParser( SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
+ SwASCIIParser( SwDoc& rD, const SwPaM& rCursor, SvStream& rIn,
bool bReadNewDoc, const SwAsciiOptions& rOpts );
ErrCode CallParser();
@@ -74,7 +74,7 @@ public:
}
// Call for the general reader interface
-ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & )
+ErrCode AsciiReader::Read( SwDoc& rDoc, const OUString&, SwPaM &rPam, const OUString & )
{
if( !m_pStream )
{
@@ -82,25 +82,25 @@ ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUSt
return ERR_SWG_READ_ERROR;
}
- std::unique_ptr<SwASCIIParser> pParser(new SwASCIIParser( &rDoc, rPam, *m_pStream,
+ std::unique_ptr<SwASCIIParser> xParser(new SwASCIIParser( rDoc, rPam, *m_pStream,
!m_bInsertMode, m_aOption.GetASCIIOpts() ));
- ErrCode nRet = pParser->CallParser();
+ ErrCode nRet = xParser->CallParser();
- pParser.reset();
+ xParser.reset();
// after Read reset the options
m_aOption.ResetASCIIOpts();
return nRet;
}
-SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
+SwASCIIParser::SwASCIIParser(SwDoc& rD, const SwPaM& rCursor, SvStream& rIn,
bool bReadNewDoc, const SwAsciiOptions& rOpts)
- : pDoc(pD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(SvtScriptType::NONE)
+ : rDoc(rD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(SvtScriptType::NONE)
, bNewDoc(bReadNewDoc)
{
pPam.reset( new SwPaM( *rCursor.GetPoint() ) );
pArr.reset( new char [ ASC_BUFFLEN + 2 ] );
- pItemSet = std::make_unique<SfxItemSet>( pDoc->GetAttrPool(),
+ pItemSet = std::make_unique<SfxItemSet>( rDoc.GetAttrPool(),
svl::Items<RES_CHRATR_FONT, RES_CHRATR_LANGUAGE,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_LANGUAGE,
RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_LANGUAGE>{} );
@@ -119,8 +119,8 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
return;
vcl::Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
- if( pDoc->getIDocumentDeviceAccess().getPrinter( false ) )
- aTextFont = pDoc->getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
+ if( rDoc.getIDocumentDeviceAccess().getPrinter( false ) )
+ aTextFont = rDoc.getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
SvxFontItem aFont( aTextFont.GetFamilyType(), aTextFont.GetFamilyName(),
OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
pItemSet->Put( aFont );
@@ -138,7 +138,7 @@ ErrCode SwASCIIParser::CallParser()
rInput.Seek(STREAM_SEEK_TO_BEGIN);
rInput.ResetError();
- ::StartProgress( STR_STATSTR_W4WREAD, 0, nFileSize, pDoc->GetDocShell() );
+ ::StartProgress( STR_STATSTR_W4WREAD, 0, nFileSize, rDoc.GetDocShell() );
std::unique_ptr<SwPaM> pInsPam;
sal_Int32 nSttContent = 0;
@@ -153,11 +153,11 @@ ErrCode SwASCIIParser::CallParser()
if (bNewDoc)
{
- pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_HTML_PRE, false);
+ pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_HTML_PRE, false);
if (!pColl)
- pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD,false);
+ pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD,false);
if (pColl)
- pDoc->SetTextFormatColl(*pPam, pColl);
+ rDoc.SetTextFormatColl(*pPam, pColl);
}
ErrCode nError = ReadChars();
@@ -216,7 +216,7 @@ ErrCode SwASCIIParser::CallParser()
}
}
if (pItemSet->Count())
- pDoc->SetDefault(*pItemSet);
+ rDoc.SetDefault(*pItemSet);
}
else if( pInsPam )
{
@@ -228,7 +228,7 @@ ErrCode SwASCIIParser::CallParser()
// !!!!!
OSL_ENSURE( false, "Have to change - hard attr. to para. style" );
- pDoc->getIDocumentContentOperations().InsertItemSet( *pInsPam, *pItemSet );
+ rDoc.getIDocumentContentOperations().InsertItemSet( *pInsPam, *pItemSet );
}
}
pItemSet.reset();
@@ -236,7 +236,7 @@ ErrCode SwASCIIParser::CallParser()
pInsPam.reset();
- ::EndProgress( pDoc->GetDocShell() );
+ ::EndProgress( rDoc.GetDocShell() );
return nError;
}
@@ -366,7 +366,7 @@ ErrCode SwASCIIParser::ReadChars()
*pEnd = 0;
nReadCnt += lGCount;
- ::SetProgressState( nReadCnt, pDoc->GetDocShell() );
+ ::SetProgressState( nReadCnt, rDoc.GetDocShell() );
if( cLastCR )
{
@@ -377,7 +377,7 @@ ErrCode SwASCIIParser::ReadChars()
// We skip the last one at the end
if( !rInput.eof() || !(pEnd == pStt ||
( !*pEnd && pEnd == pStt+1 ) ) )
- pDoc->getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
}
}
@@ -429,8 +429,8 @@ ErrCode SwASCIIParser::ReadChars()
{
InsertText( OUString( pLastStt ));
}
- pDoc->getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
- pDoc->getIDocumentContentOperations().InsertPoolItem(
+ rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ rDoc.getIDocumentContentOperations().InsertPoolItem(
*pPam, SvxFormatBreakItem( SvxBreak::PageBefore, RES_BREAK ) );
pLastStt = pStt;
nLineLen = 0;
@@ -462,7 +462,7 @@ ErrCode SwASCIIParser::ReadChars()
sal_Unicode c = *pStt;
*pStt = 0;
InsertText( OUString( pLastStt ));
- pDoc->getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
pLastStt = pStt;
nLineLen = 0;
*pStt = c;
@@ -475,9 +475,9 @@ ErrCode SwASCIIParser::ReadChars()
// We found a CR/LF, thus save the text
InsertText( OUString( pLastStt ));
if(bNewDoc)
- pDoc->getIDocumentContentOperations().AppendTextNode( *pPam->GetPoint() );
+ rDoc.getIDocumentContentOperations().AppendTextNode( *pPam->GetPoint() );
else
- pDoc->getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
+ rDoc.getIDocumentContentOperations().SplitNode( *pPam->GetPoint(), false );
pLastStt = pStt;
nLineLen = 0;
}
@@ -493,7 +493,7 @@ ErrCode SwASCIIParser::ReadChars()
void SwASCIIParser::InsertText( const OUString& rStr )
{
- pDoc->getIDocumentContentOperations().InsertString( *pPam, rStr );
+ rDoc.getIDocumentContentOperations().InsertString( *pPam, rStr );
if( pItemSet && g_pBreakIt && nScript != ( SvtScriptType::LATIN |
SvtScriptType::ASIAN |
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 451e4752aaa9..59656cce9d3e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9839,7 +9839,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr
m_nextFontId( 1 ),
m_tableReference(new TableReference()),
m_bIgnoreNextFill(false),
- m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(&rExport.m_rDoc, pSerializer)),
+ m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(rExport.m_rDoc, pSerializer)),
m_bParaBeforeAutoSpacing(false),
m_bParaAfterAutoSpacing(false),
m_nParaBeforeSpacing(0),
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 13633c349241..495a1bddc942 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -28,12 +28,12 @@ using namespace oox;
struct DocxTableStyleExport::Impl
{
private:
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
sax_fastparser::FSHelperPtr m_pSerializer;
public:
- Impl(SwDoc* pDoc)
- : m_pDoc(pDoc)
+ Impl(SwDoc& rDoc)
+ : m_rDoc(rDoc)
{
}
@@ -46,7 +46,7 @@ public:
const sax_fastparser::FSHelperPtr& getSerializer() const { return m_pSerializer; }
- SwDoc* getDoc() const { return m_pDoc; }
+ SwDoc& getDoc() const { return m_rDoc; }
/// Handles a boolean value.
void handleBoolean(const OUString& aValue, sal_Int32 nToken);
@@ -126,7 +126,7 @@ void DocxTableStyleExport::TableStyles(sal_Int32 nCountStylesToWrite)
{
// Do we have table styles from InteropGrabBag available?
uno::Reference<beans::XPropertySet> xPropertySet(
- m_pImpl->getDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
+ m_pImpl->getDoc().GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> aInteropGrabBag;
xPropertySet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag;
uno::Sequence<beans::PropertyValue> aTableStyles;
@@ -738,9 +738,9 @@ void DocxTableStyleExport::SetSerializer(const sax_fastparser::FSHelperPtr& pSer
m_pImpl->setSerializer(pSerializer);
}
-DocxTableStyleExport::DocxTableStyleExport(SwDoc* pDoc,
+DocxTableStyleExport::DocxTableStyleExport(SwDoc& rDoc,
const sax_fastparser::FSHelperPtr& pSerializer)
- : m_pImpl(std::make_unique<Impl>(pDoc))
+ : m_pImpl(std::make_unique<Impl>(rDoc))
{
m_pImpl->setSerializer(pSerializer);
}
diff --git a/sw/source/filter/ww8/docxtablestyleexport.hxx b/sw/source/filter/ww8/docxtablestyleexport.hxx
index fad19f4b4fd9..a7f327a098a9 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.hxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.hxx
@@ -33,7 +33,7 @@ public:
void CnfStyle(const css::uno::Sequence<css::beans::PropertyValue>& rAttributeList);
void SetSerializer(const sax_fastparser::FSHelperPtr& pSerializer);
- DocxTableStyleExport(SwDoc* pDoc, const sax_fastparser::FSHelperPtr& pSerializer);
+ DocxTableStyleExport(SwDoc& rDoc, const sax_fastparser::FSHelperPtr& pSerializer);
~DocxTableStyleExport();
};
More information about the Libreoffice-commits
mailing list