stoc/source/invocation_adapterfactory/iafactory.cxx | 8 stoc/source/invocation_adapterfactory/invocadapt.component | 2 stoc/source/proxy_factory/proxyfac.component | 2 stoc/source/proxy_factory/proxyfac.cxx | 18 - sw/source/filter/ww8/docxattributeoutput.cxx | 46 +-- sw/source/filter/ww8/docxexport.cxx | 178 ++++++------- sw/source/filter/ww8/docxexport.hxx | 10 sw/source/filter/ww8/docxexportfilter.cxx | 2 sw/source/filter/ww8/rtfattributeoutput.cxx | 10 sw/source/filter/ww8/rtfexport.cxx | 59 ++-- sw/source/filter/ww8/rtfexport.hxx | 4 sw/source/filter/ww8/rtfexportfilter.cxx | 2 sw/source/filter/ww8/wrtw8esh.cxx | 36 +- sw/source/filter/ww8/wrtw8nds.cxx | 54 +-- sw/source/filter/ww8/wrtw8num.cxx | 10 sw/source/filter/ww8/wrtw8sty.cxx | 38 +- sw/source/filter/ww8/wrtww8.cxx | 157 +++++------ sw/source/filter/ww8/wrtww8.hxx | 6 sw/source/filter/ww8/wrtww8gr.cxx | 10 sw/source/filter/ww8/ww8atr.cxx | 70 ++--- 20 files changed, 350 insertions(+), 372 deletions(-)
New commits: commit ad64650bda81ba59ebd27acaf67dc0b444ac0573 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Oct 2 14:18:49 2020 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Oct 2 20:40:53 2020 +0200 Use the new single-instance="true" attribute in stoc Change-Id: Icc0d2555bb90a5e0bf6ea828d14fb9e836dd7981 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103845 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 65322c3a6234..126af1f82851 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -23,7 +23,6 @@ #include <osl/mutex.hxx> #include <o3tl/sorted_vector.hxx> #include <sal/log.hxx> -#include <rtl/ref.hxx> #include <uno/dispatcher.h> #include <uno/data.h> @@ -33,7 +32,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> - +#include <cppuhelper/weak.hxx> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/script/XInvocationAdapterFactory2.hpp> @@ -876,10 +875,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* stoc_invocation_adapter_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<stoc_invadp::FactoryImpl> g_Instance(new stoc_invadp::FactoryImpl(context)); - - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new stoc_invadp::FactoryImpl(context))); } diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component index 9dbf20e48bad..ec1723e22a9b 100644 --- a/stoc/source/invocation_adapterfactory/invocadapt.component +++ b/stoc/source/invocation_adapterfactory/invocadapt.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory" - constructor="stoc_invocation_adapter_get_implementation"> + constructor="stoc_invocation_adapter_get_implementation" single-instance="true"> <service name="com.sun.star.script.InvocationAdapterFactory"/> </implementation> </component> diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component index eee87014ca98..b069f88dff81 100644 --- a/stoc/source/proxy_factory/proxyfac.component +++ b/stoc/source/proxy_factory/proxyfac.component @@ -20,7 +20,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.reflection.ProxyFactory" - constructor="stoc_FactoryImpl_get_implementation"> + constructor="stoc_FactoryImpl_get_implementation" single-instance="true"> <service name="com.sun.star.reflection.ProxyFactory"/> </implementation> </component> diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index cecb6d917b39..b1c5597d0311 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -20,7 +20,6 @@ #include <osl/diagnose.h> #include <osl/interlck.h> -#include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <uno/dispatcher.hxx> #include <uno/data.h> @@ -31,6 +30,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> #include <cppuhelper/weakagg.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/reflection/XProxyFactory.hpp> @@ -401,21 +401,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* stoc_FactoryImpl_get_implementation( css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - Reference< XInterface > xRet; - static osl::Mutex s_mutex; - // note: don't use ::osl::Mutex::getGlobalMutex() here, it deadlocks - // with getImplHelperInitMutex() - ::osl::MutexGuard guard(s_mutex); - static WeakReference < XInterface > rwInstance; - xRet = rwInstance; - - if (! xRet.is()) - { - xRet = static_cast< ::cppu::OWeakObject * >(new FactoryImpl); - rwInstance = xRet; - } - xRet->acquire(); - return xRet.get(); + return cppu::acquire(static_cast< ::cppu::OWeakObject * >(new FactoryImpl)); } commit 7c70a59cd02a5b6111a9c39c74c8b6cd1585c4c2 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 2 11:35:04 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 2 20:40:44 2020 +0200 MSWordExportBase never passed a null SwDoc* and drop redundant nullptr checks Change-Id: I42b86461ad276089454b35a51651c5aa1e1280ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103850 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 88b92ab460dd..451e4752aaa9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -331,9 +331,9 @@ static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutpu { const auto& rExport = rDocxAttributeOutput.GetExport(); // iterate though all SpzFrameFormats and check whether they are anchored to the current text node - for( sal_uInt16 nCnt = rExport.m_pDoc->GetSpzFrameFormats()->size(); nCnt; ) + for( sal_uInt16 nCnt = rExport.m_rDoc.GetSpzFrameFormats()->size(); nCnt; ) { - const SwFrameFormat* pFrameFormat = (*rExport.m_pDoc->GetSpzFrameFormats())[ --nCnt ]; + const SwFrameFormat* pFrameFormat = (*rExport.m_rDoc.GetSpzFrameFormats())[ --nCnt ]; const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); const SwPosition* pPosition = rAnchor.GetContentAnchor(); @@ -2800,8 +2800,8 @@ bool DocxAttributeOutput::FootnoteEndnoteRefTag() // output the character style for MS Word's benefit const SwEndNoteInfo& rInfo = m_footnoteEndnoteRefTag == XML_footnoteRef ? - m_rExport.m_pDoc->GetFootnoteInfo() : m_rExport.m_pDoc->GetEndNoteInfo(); - const SwCharFormat* pCharFormat = rInfo.GetCharFormat( *m_rExport.m_pDoc ); + m_rExport.m_rDoc.GetFootnoteInfo() : m_rExport.m_rDoc.GetEndNoteInfo(); + const SwCharFormat* pCharFormat = rInfo.GetCharFormat( m_rExport.m_rDoc ); if ( pCharFormat ) { const OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat))); @@ -4151,7 +4151,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t // tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level tables are handled the same as nested tables; // if no compatibilityMode is defined (which now should only happen on a new export to .docx), // LO uses a higher compatibility than 2010's 14. - sal_Int32 nMode = lcl_getWordCompatibilityMode( *m_rExport.m_pDoc ); + sal_Int32 nMode = lcl_getWordCompatibilityMode( m_rExport.m_rDoc ); const SwFrameFormat* pFrameFormat = pTableTextNodeInfoInner->getTableBox()->GetFrameFormat(); if ((0 < nMode && nMode <= 14) && m_tableReference->m_nTableDepth == 0) @@ -4306,7 +4306,7 @@ void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t const SwTableLine * pTabLine = pTabBox->GetUpper(); // search next Redline - const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable(); + const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable(); for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.GetSize(); ++nCurRedlinePos ) { SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos); @@ -4350,7 +4350,7 @@ void DocxAttributeOutput::TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_ const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); // search next Redline - const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable(); + const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable(); for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.GetSize(); ++nCurRedlinePos ) { SwExtraRedline* pExtraRedline = aExtraRedlineTable.GetRedline(nCurRedlinePos); @@ -4548,7 +4548,7 @@ DocxStringTokenMap const aExceptionTokens[] = { void DocxAttributeOutput::LatentStyles() { // Do we have latent styles available? - uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW); uno::Sequence<beans::PropertyValue> aInteropGrabBag; xPropertySet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag; uno::Sequence<beans::PropertyValue> aLatentStyles; @@ -4781,7 +4781,7 @@ void DocxAttributeOutput::DocDefaults( ) StartStyleProperties(false, 0); for (int i = int(RES_CHRATR_BEGIN); i < int(RES_CHRATR_END); ++i) - OutputDefaultItem(m_rExport.m_pDoc->GetDefault(i)); + OutputDefaultItem(m_rExport.m_rDoc.GetDefault(i)); EndStyleProperties(false); @@ -4793,7 +4793,7 @@ void DocxAttributeOutput::DocDefaults( ) StartStyleProperties(true, 0); for (int i = int(RES_PARATR_BEGIN); i < int(RES_PARATR_END); ++i) - OutputDefaultItem(m_rExport.m_pDoc->GetDefault(i)); + OutputDefaultItem(m_rExport.m_rDoc.GetDefault(i)); EndStyleProperties(true); @@ -5505,7 +5505,7 @@ bool DocxAttributeOutput::ExportAsActiveXControl(const SdrObject* pObject) const if (!xControlModel.is()) return false; - uno::Reference< css::frame::XModel > xModel( m_rExport.m_pDoc->GetDocShell() ? m_rExport.m_pDoc->GetDocShell()->GetModel() : nullptr ); + uno::Reference< css::frame::XModel > xModel( m_rExport.m_rDoc.GetDocShell() ? m_rExport.m_rDoc.GetDocShell()->GetModel() : nullptr ); if (!xModel.is()) return false; @@ -5554,7 +5554,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S OSL_ASSERT(pFlyFrameFormat); // get interoperability information about embedded objects - uno::Reference< beans::XPropertySet > xPropSet( m_rExport.m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rExport.m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Sequence< beans::PropertyValue > aGrabBag, aObjectsInteropList,aObjectInteropAttributes; xPropSet->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= aGrabBag; auto pProp = std::find_if(aGrabBag.begin(), aGrabBag.end(), @@ -6135,7 +6135,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj) // Write paragraph properties. StartParagraphProperties(); aAttrIter.OutParaAttr(false); - SfxItemSet aParagraphMarkerProperties(m_rExport.m_pDoc->GetAttrPool()); + SfxItemSet aParagraphMarkerProperties(m_rExport.m_rDoc.GetAttrPool()); EndParagraphProperties(aParagraphMarkerProperties, nullptr, nullptr, nullptr); do { @@ -6521,7 +6521,7 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, bool bBreakAfter, const WW // document: the last section is written explicitly in // DocxExport::WriteMainText(), don't duplicate that here. SwNodeIndex aCurrentNode(m_rExport.m_pCurPam->GetNode()); - SwNodeIndex aLastNode(m_rExport.m_pDoc->GetNodes().GetEndOfContent(), -1); + SwNodeIndex aLastNode(m_rExport.m_rDoc.GetNodes().GetEndOfContent(), -1); bool bEmit = aCurrentNode != aLastNode; if (!bEmit) @@ -6981,7 +6981,7 @@ void DocxAttributeOutput::FontPitchType( FontPitch ePitch ) const void DocxAttributeOutput::EmbedFont( const OUString& name, FontFamily family, FontPitch pitch ) { - if( !m_rExport.m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) + if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); @@ -8122,10 +8122,10 @@ void DocxAttributeOutput::WriteAnnotationMarks_Impl( std::vector< OUString >& rS void DocxAttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote ) { const SwEndNoteInfo& rInfo = rFootnote.IsEndNote()? - m_rExport.m_pDoc->GetEndNoteInfo(): m_rExport.m_pDoc->GetFootnoteInfo(); + m_rExport.m_rDoc.GetEndNoteInfo(): m_rExport.m_rDoc.GetFootnoteInfo(); // footnote/endnote run properties - const SwCharFormat* pCharFormat = rInfo.GetAnchorCharFormat( *m_rExport.m_pDoc ); + const SwCharFormat* pCharFormat = rInfo.GetAnchorCharFormat( m_rExport.m_rDoc ); OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat))); @@ -8134,7 +8134,7 @@ void DocxAttributeOutput::TextFootnote_Impl( const SwFormatFootnote& rFootnote ) // remember the footnote/endnote to // 1) write the footnoteReference/endnoteReference in EndRunProperties() // 2) be able to dump them all to footnotes.xml/endnotes.xml - if ( !rFootnote.IsEndNote() && m_rExport.m_pDoc->GetFootnoteInfo().m_ePos != FTNPOS_CHAPTER ) + if ( !rFootnote.IsEndNote() && m_rExport.m_rDoc.GetFootnoteInfo().m_ePos != FTNPOS_CHAPTER ) m_pFootnotesList->add( rFootnote ); else m_pEndnotesList->add( rFootnote ); @@ -8210,7 +8210,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes ) SwTwips nHeight(0); if (bFootnotes) { - const SwPageFootnoteInfo& rFootnoteInfo = m_rExport.m_pDoc->GetPageDesc(0).GetFootnoteInfo(); + const SwPageFootnoteInfo& rFootnoteInfo = m_rExport.m_rDoc.GetPageDesc(0).GetFootnoteInfo(); // Request separator only if both width and thickness are non-zero. bSeparator = rFootnoteInfo.GetLineStyle() != SvxBorderLineStyle::NONE && rFootnoteInfo.GetLineWidth() > 0 @@ -8338,9 +8338,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr void DocxAttributeOutput::SectFootnoteEndnotePr() { if( HasFootnotes()) - WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.m_pDoc->GetFootnoteInfo(), 0 ); + WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.m_rDoc.GetFootnoteInfo(), 0 ); if( HasEndnotes()) - WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.m_pDoc->GetEndNoteInfo(), 0 ); + WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.m_rDoc.GetEndNoteInfo(), 0 ); } void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti ) @@ -8519,7 +8519,7 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) // In DOCX, w:pos specifies the position of the current custom tab stop with respect to the current page margins. // But in ODT, zero position could be page margins or paragraph indent according to used settings. long tabsOffset = 0; - if (m_rExport.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) + if (m_rExport.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) tabsOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft(); // clear unused inherited tabs - otherwise the style will add them back in @@ -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_pDoc, 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/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index f1870277a7fd..7115e4e2d664 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -218,7 +218,7 @@ void DocxExport::ExportGrfBullet(const SwTextNode&) OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget ) { - OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + OUString sId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), rType, rTarget, true ); return sId.toUtf8(); @@ -376,15 +376,15 @@ void DocxExport::DoFormText(const SwInputField* pField) OString DocxExport::OutputChart( uno::Reference< frame::XModel > const & xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr const & m_pSerializer ) { OUString aFileName = "charts/chart" + OUString::number(nCount) + ".xml"; - OUString sId = m_pFilter->addRelation( m_pSerializer->getOutputStream(), + OUString sId = m_rFilter.addRelation( m_pSerializer->getOutputStream(), oox::getRelationship(Relationship::CHART), aFileName ); aFileName = "word/charts/chart" + OUString::number(nCount) + ".xml"; ::sax_fastparser::FSHelperPtr pChartFS = - m_pFilter->openFragmentStreamWithSerializer( aFileName, + m_rFilter.openFragmentStreamWithSerializer( aFileName, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml" ); - oox::drawingml::ChartExport aChartExport(XML_w, pChartFS, xModel, m_pFilter, oox::drawingml::DOCUMENT_DOCX); + oox::drawingml::ChartExport aChartExport(XML_w, pChartFS, xModel, &m_rFilter, oox::drawingml::DOCUMENT_DOCX); css::uno::Reference<css::util::XModifiable> xModifiable(xModel, css::uno::UNO_QUERY); const bool bOldModified = xModifiable && xModifiable->isModified(); aChartExport.ExportContent(); @@ -433,7 +433,7 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID) return OString(); } - OUString const sId = m_pFilter->addRelation( GetFS()->getOutputStream(), + OUString const sId = m_rFilter.addRelation( GetFS()->getOutputStream(), sRelationType, sFileName ); if (pProgID) { @@ -453,12 +453,12 @@ std::pair<OString, OString> DocxExport::WriteActiveXObject(const uno::Reference< OString sGUID; OString sName; - uno::Reference<io::XStream> xOutStorage(m_pFilter->openFragmentStream(sBinaryFileName, "application/vnd.ms-office.activeX"), uno::UNO_QUERY); + uno::Reference<io::XStream> xOutStorage(m_rFilter.openFragmentStream(sBinaryFileName, "application/vnd.ms-office.activeX"), uno::UNO_QUERY); if(xOutStorage.is()) { - oox::ole::OleStorage aOleStorage(m_pFilter->getComponentContext(), xOutStorage, false); + oox::ole::OleStorage aOleStorage(m_rFilter.getComponentContext(), xOutStorage, false); uno::Reference<io::XOutputStream> xOutputStream(aOleStorage.openOutputStream("contents"), uno::UNO_SET_THROW); - uno::Reference< css::frame::XModel > xModel( m_pDoc->GetDocShell() ? m_pDoc->GetDocShell()->GetModel() : nullptr ); + uno::Reference< css::frame::XModel > xModel( m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetModel() : nullptr ); oox::ole::OleFormCtrlExportHelper exportHelper(comphelper::getProcessComponentContext(), xModel, rxControlModel); if ( !exportHelper.isValid() ) return std::make_pair<OString, OString>(OString(), OString()); @@ -470,20 +470,20 @@ std::pair<OString, OString> DocxExport::WriteActiveXObject(const uno::Reference< // Write out ActiveX fragment const OUString sXMLFileName = "word/activeX/activeX" + OUString::number( m_nActiveXControls ) + ".xml"; - ::sax_fastparser::FSHelperPtr pActiveXFS = m_pFilter->openFragmentStreamWithSerializer(sXMLFileName, "application/vnd.ms-office.activeX+xml" ); + ::sax_fastparser::FSHelperPtr pActiveXFS = m_rFilter.openFragmentStreamWithSerializer(sXMLFileName, "application/vnd.ms-office.activeX+xml" ); - const OUString sBinaryId = m_pFilter->addRelation( pActiveXFS->getOutputStream(), + const OUString sBinaryId = m_rFilter.addRelation( pActiveXFS->getOutputStream(), oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY), sBinaryFileName.copy(sBinaryFileName.lastIndexOf("/") + 1) ); pActiveXFS->singleElementNS(XML_ax, XML_ocx, - FSNS(XML_xmlns, XML_ax), m_pFilter->getNamespaceURL(OOX_NS(ax)), - FSNS(XML_xmlns, XML_r), m_pFilter->getNamespaceURL(OOX_NS(officeRel)), + FSNS(XML_xmlns, XML_ax), m_rFilter.getNamespaceURL(OOX_NS(ax)), + FSNS(XML_xmlns, XML_r), m_rFilter.getNamespaceURL(OOX_NS(officeRel)), FSNS(XML_ax, XML_classid), "{" + sGUID + "}", FSNS(XML_ax, XML_persistence), "persistStorage", FSNS(XML_r, XML_id), sBinaryId); - OString sXMLId = OUStringToOString(m_pFilter->addRelation(m_pDocumentFS->getOutputStream(), + OString sXMLId = OUStringToOString(m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CONTROL), sXMLFileName.copy(sBinaryFileName.indexOf("/") + 1)), RTL_TEXTENCODING_UTF8); @@ -499,7 +499,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape> const & xShape) nNamespace = XML_wpg; else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape")) nNamespace = XML_pic; - oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, m_pFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput.get()); + oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, &m_rFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput.get()); aExport.WriteShape(xShape); } @@ -646,12 +646,12 @@ void DocxExport::InitStyles() m_pStyles.reset(new MSWordStyles( *this, /*bListStyles =*/ true )); // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::STYLES), "styles.xml" ); ::sax_fastparser::FSHelperPtr pStylesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/styles.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/styles.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ); // switch the serializer to redirect the output to word/styles.xml @@ -669,12 +669,12 @@ void DocxExport::WriteFootnotesEndnotes() if ( m_pAttrOutput->HasFootnotes() ) { // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FOOTNOTES), "footnotes.xml" ); ::sax_fastparser::FSHelperPtr pFootnotesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/footnotes.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/footnotes.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ); // switch the serializer to redirect the output to word/footnotes.xml @@ -697,12 +697,12 @@ void DocxExport::WriteFootnotesEndnotes() return; // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::ENDNOTES), "endnotes.xml" ); ::sax_fastparser::FSHelperPtr pEndnotesFS = - m_pFilter->openFragmentStreamWithSerializer( "word/endnotes.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/endnotes.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ); // switch the serializer to redirect the output to word/endnotes.xml @@ -726,12 +726,12 @@ void DocxExport::WritePostitFields() if ( !m_pAttrOutput->HasPostitFields() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::COMMENTS), "comments.xml" ); ::sax_fastparser::FSHelperPtr pPostitFS = - m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml", + m_rFilter.openFragmentStreamWithSerializer( "word/comments.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ); pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces()); @@ -746,11 +746,11 @@ void DocxExport::WriteNumbering() if ( !m_pUsedNumTable ) return; // no numbering is used - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::NUMBERING), "numbering.xml" ); - ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openFragmentStreamWithSerializer( "word/numbering.xml", + ::sax_fastparser::FSHelperPtr pNumberingFS = m_rFilter.openFragmentStreamWithSerializer( "word/numbering.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ); // switch the serializer to redirect the output to word/numbering.xml @@ -758,12 +758,12 @@ void DocxExport::WriteNumbering() m_pDrawingML->SetFS( pNumberingFS ); pNumberingFS->startElementNS( XML_w, XML_numbering, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)), - FSNS( XML_xmlns, XML_o ), m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), - FSNS( XML_xmlns, XML_r ), m_pFilter->getNamespaceURL(OOX_NS(officeRel)), - FSNS( XML_xmlns, XML_v ), m_pFilter->getNamespaceURL(OOX_NS(vml)), - FSNS( XML_xmlns, XML_mc ), m_pFilter->getNamespaceURL(OOX_NS(mce)), - FSNS( XML_xmlns, XML_w14 ), m_pFilter->getNamespaceURL(OOX_NS(w14)), + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)), + FSNS( XML_xmlns, XML_o ), m_rFilter.getNamespaceURL(OOX_NS(vmlOffice)), + FSNS( XML_xmlns, XML_r ), m_rFilter.getNamespaceURL(OOX_NS(officeRel)), + FSNS( XML_xmlns, XML_v ), m_rFilter.getNamespaceURL(OOX_NS(vml)), + FSNS( XML_xmlns, XML_mc ), m_rFilter.getNamespaceURL(OOX_NS(mce)), + FSNS( XML_xmlns, XML_w14 ), m_rFilter.getNamespaceURL(OOX_NS(w14)), FSNS( XML_mc, XML_Ignorable ), "w14" ); BulletDefinitions(); @@ -788,11 +788,11 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const { OUString aName( "header" + OUString::number( ++m_nHeaders ) + ".xml" ); - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + aRelId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::HEADER), aName ); - pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName, + pFS = m_rFilter.openFragmentStreamWithSerializer( "word/" + aName, "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ); pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces()); @@ -801,11 +801,11 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const { OUString aName( "footer" + OUString::number( ++m_nFooters ) + ".xml" ); - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + aRelId = m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FOOTER), aName ); - pFS = m_pFilter->openFragmentStreamWithSerializer( "word/" + aName, + pFS = m_rFilter.openFragmentStreamWithSerializer( "word/" + aName, "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ); pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces()); @@ -857,17 +857,17 @@ void DocxExport::WriteHeaderFooter( const SwFormat* pFormat, bool bHeader, const void DocxExport::WriteFonts() { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::FONTTABLE), "fontTable.xml" ); - ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/fontTable.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ); pFS->startElementNS( XML_w, XML_fonts, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)), - FSNS( XML_xmlns, XML_r ), m_pFilter->getNamespaceURL(OOX_NS(officeRel)) ); + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)), + FSNS( XML_xmlns, XML_r ), m_rFilter.getNamespaceURL(OOX_NS(officeRel)) ); // switch the serializer to redirect the output to word/styles.xml m_pAttrOutput->SetSerializer( pFS ); @@ -884,7 +884,7 @@ void DocxExport::WriteFonts() void DocxExport::WriteProperties( ) { // Write the core properties - SwDocShell* pDocShell( m_pDoc->GetDocShell( ) ); + SwDocShell* pDocShell( m_rDoc.GetDocShell( ) ); uno::Reference<document::XDocumentProperties> xDocProps; bool bSecurityOptOpenReadOnly = false; if ( pDocShell ) @@ -895,12 +895,12 @@ void DocxExport::WriteProperties( ) bSecurityOptOpenReadOnly = pDocShell->IsSecurityOptOpenReadOnly(); } - m_pFilter->exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly ); + m_rFilter.exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly ); } void DocxExport::WriteDocVars(const sax_fastparser::FSHelperPtr& pFS) { - SwDocShell* pDocShell = m_pDoc->GetDocShell(); + SwDocShell* pDocShell = m_rDoc.GetDocShell(); if (!pDocShell) { return; @@ -971,20 +971,20 @@ WriteCompat(SwDoc const& rDoc, ::sax_fastparser::FSHelperPtr const& rpFS, void DocxExport::WriteSettings() { - SwViewShell *pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell *pViewShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if( !pViewShell && !m_aSettings.hasData() && !m_pAttrOutput->HasFootnotes() && !m_pAttrOutput->HasEndnotes()) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::SETTINGS), "settings.xml" ); - ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + ::sax_fastparser::FSHelperPtr pFS = m_rFilter.openFragmentStreamWithSerializer( "word/settings.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ); pFS->startElementNS( XML_w, XML_settings, - FSNS( XML_xmlns, XML_w ), m_pFilter->getNamespaceURL(OOX_NS(doc)) ); + FSNS( XML_xmlns, XML_w ), m_rFilter.getNamespaceURL(OOX_NS(doc)) ); // View if (pViewShell && pViewShell->GetViewOptions()->getBrowseMode()) @@ -1040,11 +1040,11 @@ void DocxExport::WriteSettings() pFS->singleElementNS(XML_w, XML_mirrorMargins); // Embed Fonts - if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) + if( m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts); // Embed System Fonts - if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS )) + if( m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS )) pFS->singleElementNS(XML_w, XML_embedSystemFonts); // Default Tab Stop @@ -1053,7 +1053,7 @@ void DocxExport::WriteSettings() OString::number(m_aSettings.defaultTabStop) ); // export current mail merge database and table names - SwDBData aData = m_pDoc->GetDBData(); + SwDBData aData = m_rDoc.GetDBData(); if ( !aData.sDataSource.isEmpty() && aData.nCommandType == css::sdb::CommandType::TABLE && !aData.sCommand.isEmpty() ) { OUString sDataSource = @@ -1077,7 +1077,7 @@ void DocxExport::WriteSettings() pFS->singleElementNS(XML_w, XML_autoHyphenation, FSNS(XML_w, XML_val), "true"); // Hyphenation details set depending on default style - SwTextFormatColl* pColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); + SwTextFormatColl* pColl = m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false); const SfxPoolItem* pItem; if (pColl && SfxItemState::SET == pColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem)) { @@ -1091,14 +1091,14 @@ void DocxExport::WriteSettings() // Has Footnotes if( m_pAttrOutput->HasFootnotes()) - DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_footnotePr, m_pDoc->GetFootnoteInfo(), XML_footnote ); + DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_footnotePr, m_rDoc.GetFootnoteInfo(), XML_footnote ); // Has Endnotes if( m_pAttrOutput->HasEndnotes()) - DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_endnotePr, m_pDoc->GetEndNoteInfo(), XML_endnote ); + DocxAttributeOutput::WriteFootnoteEndnotePr( pFS, XML_endnotePr, m_rDoc.GetEndNoteInfo(), XML_endnote ); // Has themeFontLang information - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); bool bUseGrabBagProtection = false; bool bWriterWantsToProtect = false; @@ -1107,7 +1107,7 @@ void DocxExport::WriteSettings() bool bHasDummyRedlineProtectionKey = false; bool bReadOnlyStatusUnchanged = true; uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - if ( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) || + if ( m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) || m_pSections->DocumentIsProtected() ) { bWriterWantsToProtect = bWriterWantsToProtectForm = true; @@ -1170,7 +1170,7 @@ void DocxExport::WriteSettings() { pFS->startElementNS(XML_w, XML_compat); - WriteCompat(*m_pDoc, pFS, nTargetCompatibilityMode); + WriteCompat(m_rDoc, pFS, nTargetCompatibilityMode); uno::Sequence< beans::PropertyValue > aCompatSettingsSequence; rProp.Value >>= aCompatSettingsSequence; @@ -1258,7 +1258,7 @@ void DocxExport::WriteSettings() else if ( nToken == XML_edit && sValue == "readOnly" ) { // Ignore the case where read-only was not enforced, but now is. That is handled by _MarkAsFinal - bReadOnlyStatusUnchanged = m_pDoc->GetDocShell()->IsSecurityOptOpenReadOnly(); + bReadOnlyStatusUnchanged = m_rDoc.GetDocShell()->IsSecurityOptOpenReadOnly(); } else if ( nToken == XML_enforcement ) bEnforced = sValue.toBoolean(); @@ -1301,7 +1301,7 @@ void DocxExport::WriteSettings() { pFS->startElementNS(XML_w, XML_compat); - WriteCompat(*m_pDoc, pFS, nTargetCompatibilityMode); + WriteCompat(m_rDoc, pFS, nTargetCompatibilityMode); pFS->singleElementNS( XML_w, XML_compatSetting, FSNS( XML_w, XML_name ), "compatibilityMode", @@ -1341,7 +1341,7 @@ void DocxExport::WriteSettings() void DocxExport::WriteTheme() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1360,7 +1360,7 @@ void DocxExport::WriteTheme() if ( !themeDom.is() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::THEME), "theme/theme1.xml" ); @@ -1374,7 +1374,7 @@ void DocxExport::WriteTheme() void DocxExport::WriteGlossary() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1407,7 +1407,7 @@ void DocxExport::WriteGlossary() if ( !glossaryDocDom.is() ) return; - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::GLOSSARYDOCUMENT), "glossary/document.xml" ); @@ -1433,7 +1433,7 @@ void DocxExport::WriteGlossary() PropertySet aProps(xOutputStream); aProps.setAnyProperty( PROP_RelId, uno::makeAny( gId.toInt32() )); - m_pFilter->addRelation( xOutputStream, gType, gTarget); + m_rFilter.addRelation( xOutputStream, gType, gTarget); uno::Reference< xml::sax::XSAXSerializable > gserializer( xDom, uno::UNO_QUERY ); writer->setOutputStream(GetFilter().openFragmentStream( "word/glossary/" + gTarget, contentType ) ); gserializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ), @@ -1443,7 +1443,7 @@ void DocxExport::WriteGlossary() void DocxExport::WriteCustomXml() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); static constexpr OUStringLiteral aName = u"" UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1470,7 +1470,7 @@ void DocxExport::WriteCustomXml() uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j]; if (customXmlDom.is()) { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + m_rFilter.addRelation( m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::CUSTOMXML), "../customXml/item"+OUString::number((j+1))+".xml" ); @@ -1492,7 +1492,7 @@ void DocxExport::WriteCustomXml() uno::Sequence< beans::StringPair >() ); // Adding itemprops's relationship entry to item.xml.rels file - m_pFilter->addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml", + m_rFilter.addRelation( GetFilter().openFragmentStream( "customXml/item"+OUString::number((j+1))+".xml", "application/xml" ) , oox::getRelationship(Relationship::CUSTOMXMLPROPS), "itemProps"+OUString::number((j+1))+".xml" ); @@ -1502,7 +1502,7 @@ void DocxExport::WriteCustomXml() void DocxExport::WriteVBA() { - uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); + uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY); if (!xStorageBasedDocument.is()) return; @@ -1529,7 +1529,7 @@ void DocxExport::WriteVBA() pOut->WriteStream(*pIn); // Write the relationship. - m_pFilter->addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); + m_rFilter.addRelation(m_pDocumentFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), "vbaProject.bin"); } OUString aDataName("_MS_VBA_Macros_XML"); @@ -1556,12 +1556,12 @@ void DocxExport::WriteVBA() if (!xProjectStream.is()) return; - m_pFilter->addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); + m_rFilter.addRelation(xProjectStream, oox::getRelationship(Relationship::WORDVBADATA), "vbaData.xml"); } void DocxExport::WriteEmbeddings() { - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; @@ -1630,7 +1630,7 @@ void DocxExport::WriteEmbeddings() bool DocxExport::isMirroredMargin() { bool bMirroredMargins = false; - if ( UseOnPage::Mirror == (UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) ) + if ( UseOnPage::Mirror == (UseOnPage::Mirror & m_rDoc.GetPageDesc(0).ReadUseOn()) ) { bMirroredMargins = true; } @@ -1644,7 +1644,7 @@ void DocxExport::WriteMainText() if ( getenv("SW_DEBUG_DOM") ) { - m_pDoc->dumpAsXml(); + m_rDoc.dumpAsXml(); } // reset the incrementing linked-textboxes chain ID before re-saving. @@ -1664,7 +1664,7 @@ void DocxExport::WriteMainText() // body m_pDocumentFS->startElementNS(XML_w, XML_body); - m_pCurPam->GetPoint()->nNode = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + m_pCurPam->GetPoint()->nNode = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); // the text WriteText(); @@ -1686,17 +1686,17 @@ void DocxExport::WriteMainText() XFastAttributeListRef DocxExport::MainXmlNamespaces() { FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); - pAttr->add( FSNS( XML_xmlns, XML_o ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlOffice)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_r ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_v ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vml)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(doc)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w10 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(vmlWord)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wp ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(dmlWordDr)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wps ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wps)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wpg ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wpg)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_mc ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_wp14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(wp14)), RTL_TEXTENCODING_UTF8).getStr() ); - pAttr->add( FSNS( XML_xmlns, XML_w14 ), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(w14)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_o ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vmlOffice)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_r ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_v ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vml)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(doc)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w10 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(vmlWord)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wp ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(dmlWordDr)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wps ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wps)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wpg ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wpg)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_mc ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(mce)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_wp14 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(wp14)), RTL_TEXTENCODING_UTF8).getStr() ); + pAttr->add( FSNS( XML_xmlns, XML_w14 ), OUStringToOString(m_rFilter.getNamespaceURL(OOX_NS(w14)), RTL_TEXTENCODING_UTF8).getStr() ); pAttr->add( FSNS( XML_mc, XML_Ignorable ), "w14 wp14" ); return XFastAttributeListRef( pAttr ); } @@ -1763,11 +1763,11 @@ void DocxExport::SetFS( ::sax_fastparser::FSHelperPtr const & pFS ) mpFS = pFS; } -DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, +DocxExport::DocxExport(DocxExportFilter& rFilter, SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, - SwPaM* pOriginalPam, bool bDocm, bool bTemplate) - : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ), - m_pFilter( pFilter ), + SwPaM& rOriginalPam, bool bDocm, bool bTemplate) + : MSWordExportBase(rDocument, pCurrentPam, &rOriginalPam), + m_rFilter( rFilter ), m_nHeaders( 0 ), m_nFooters( 0 ), m_nOLEObjects( 0 ), @@ -1780,7 +1780,7 @@ DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, WriteProperties( ); // relations for the document - m_pFilter->addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT), + m_rFilter.addRelation( oox::getRelationship(Relationship::OFFICEDOCUMENT), "word/document.xml" ); // Set media type depending of document type @@ -1810,12 +1810,12 @@ DocxExport::DocxExport(DocxExportFilter* pFilter, SwDoc* pDocument, // the actual document - m_pDocumentFS = m_pFilter->openFragmentStreamWithSerializer( "word/document.xml", aMediaType ); + m_pDocumentFS = m_rFilter.openFragmentStreamWithSerializer( "word/document.xml", aMediaType ); SetFS(m_pDocumentFS); // the DrawingML access - m_pDrawingML.reset(new oox::drawingml::DrawingML(m_pDocumentFS, m_pFilter, oox::drawingml::DOCUMENT_DOCX)); + m_pDrawingML.reset(new oox::drawingml::DrawingML(m_pDocumentFS, &m_rFilter, oox::drawingml::DOCUMENT_DOCX)); // the attribute output for the document m_pAttrOutput.reset(new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML.get() )); diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 74336b72d454..5091b8f64979 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -66,7 +66,7 @@ struct DocxSettingsData class DocxExport : public MSWordExportBase { /// Pointer to the filter that owns us. - DocxExportFilter *m_pFilter; + DocxExportFilter& m_rFilter; /// Fast serializer for the document output. ::sax_fastparser::FSHelperPtr m_pDocumentFS; @@ -117,8 +117,8 @@ class DocxExport : public MSWordExportBase public: - DocxExportFilter& GetFilter() { return *m_pFilter; }; - const DocxExportFilter& GetFilter() const { return *m_pFilter; }; + DocxExportFilter& GetFilter() { return m_rFilter; }; + const DocxExportFilter& GetFilter() const { return m_rFilter; }; const ww8::Frame* GetFloatingTableFrame() const { return m_pFloatingTableFrame; } @@ -273,8 +273,8 @@ public: void WriteMainText(); /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, - std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam, + DocxExport( DocxExportFilter& rFilter, SwDoc& rDocument, + std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM& rOriginalPam, bool bDocm, bool bTemplate); /// Destructor. diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index ad44c9190931..b914cc1815ce 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -82,7 +82,7 @@ bool DocxExportFilter::exportDocument() // export the document // (in a separate block so that it's destructed before the commit) { - DocxExport aExport(this, pDoc, pCurPam, &aPam, bDocm, isExportTemplate()); + DocxExport aExport(*this, *pDoc, pCurPam, aPam, bDocm, isExportTemplate()); aExport.ExportDocument( true ); // FIXME support exporting selection only } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9f6068bdf057..c91acb378f6d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -272,7 +272,7 @@ void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTex { bool bLastPara = false; if (m_rExport.m_nTextTyp == TXT_FTN || m_rExport.m_nTextTyp == TXT_EDN - || m_rExport.m_pDoc->IsClipBoard()) + || m_rExport.m_rDoc.IsClipBoard()) { // We're ending a paragraph that is the last paragraph of a footnote or endnote, or of clipboard. bLastPara @@ -1364,8 +1364,8 @@ void RtfAttributeOutput::SectionType(sal_uInt8 nBreakCode) void RtfAttributeOutput::SectFootnoteEndnotePr() { - WriteFootnoteEndnotePr(true, m_rExport.m_pDoc->GetFootnoteInfo()); - WriteFootnoteEndnotePr(false, m_rExport.m_pDoc->GetEndNoteInfo()); + WriteFootnoteEndnotePr(true, m_rExport.m_rDoc.GetFootnoteInfo()); + WriteFootnoteEndnotePr(false, m_rExport.m_rDoc.GetEndNoteInfo()); } void RtfAttributeOutput::WriteFootnoteEndnotePr(bool bFootnote, const SwEndNoteInfo& rInfo) @@ -2849,7 +2849,7 @@ void RtfAttributeOutput::TextFootnote_Impl(const SwFormatFootnote& rFootnote) m_aRun->append(' '); WriteTextFootnoteNumStr(rFootnote); m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FOOTNOTE); - if (rFootnote.IsEndNote() || m_rExport.m_pDoc->GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER) + if (rFootnote.IsEndNote() || m_rExport.m_rDoc.GetFootnoteInfo().m_ePos == FTNPOS_CHAPTER) m_aRun->append(OOO_STRING_SVTOOLS_RTF_FTNALT); m_aRun->append(' '); WriteTextFootnoteNumStr(rFootnote); @@ -2932,7 +2932,7 @@ void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) { long nOffset = 0; // Tabs are absolute by default. - if (m_rExport.m_pDoc->getIDocumentSettingAccess().get( + if (m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::TABS_RELATIVE_TO_INDENT)) nOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 8c3577ed7794..bc07a5c4d0ac 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -203,9 +203,9 @@ static bool IsExportNumRule(const SwNumRule& rRule) void RtfExport::BuildNumbering() { - const SwNumRuleTable& rListTable = m_pDoc->GetNumRuleTable(); + const SwNumRuleTable& rListTable = m_rDoc.GetNumRuleTable(); - SwNumRule* pOutlineRule = m_pDoc->GetOutlineNumRule(); + SwNumRule* pOutlineRule = m_rDoc.GetOutlineNumRule(); if (IsExportNumRule(*pOutlineRule)) GetNumberingId(*pOutlineRule); @@ -254,7 +254,7 @@ void RtfExport::WriteNumbering() void RtfExport::WriteRevTab() { - int nRevAuthors = m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + int nRevAuthors = m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); if (nRevAuthors < 1) return; @@ -262,7 +262,7 @@ void RtfExport::WriteRevTab() // RTF always seems to use Unknown as the default first entry GetRedline("Unknown"); - for (SwRangeRedline* pRedl : m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()) + for (SwRangeRedline* pRedl : m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor())); } @@ -403,7 +403,7 @@ void RtfExport::WriteStyles() void RtfExport::WriteFootnoteSettings() { - const SwPageFootnoteInfo& rFootnoteInfo = m_pDoc->GetPageDesc(0).GetFootnoteInfo(); + const SwPageFootnoteInfo& rFootnoteInfo = m_rDoc.GetPageDesc(0).GetFootnoteInfo(); // Request a separator only in case the width is larger than zero. bool bSeparator = double(rFootnoteInfo.GetWidth()) > 0; @@ -454,7 +454,7 @@ void RtfExport::WriteMainText() else { m_pCurPam->GetPoint()->nNode - = m_pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + = m_rDoc.GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); } WriteText(); @@ -472,7 +472,7 @@ void RtfExport::WriteInfo() .WriteChar('}'); Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_INFO); - SwDocShell* pDocShell(m_pDoc->GetDocShell()); + SwDocShell* pDocShell(m_rDoc.GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { @@ -538,7 +538,7 @@ void RtfExport::WriteUserProps() Strm().WriteChar('{').WriteCharPtr( OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_USERPROPS); - SwDocShell* pDocShell(m_pDoc->GetDocShell()); + SwDocShell* pDocShell(m_rDoc.GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; if (pDocShell) { @@ -549,7 +549,7 @@ void RtfExport::WriteUserProps() else { // Clipboard document, read metadata from the meta field manager. - sw::MetaFieldManager& rManager = m_pDoc->GetMetaFieldManager(); + sw::MetaFieldManager& rManager = m_rDoc.GetMetaFieldManager(); xDocProps.set(rManager.getDocumentProperties()); } @@ -632,7 +632,7 @@ void RtfExport::WriteUserProps() void RtfExport::WritePageDescTable() { // Write page descriptions (page styles) - std::size_t nSize = m_pDoc->GetPageDescCnt(); + std::size_t nSize = m_rDoc.GetPageDescCnt(); if (!nSize) return; @@ -644,7 +644,7 @@ void RtfExport::WritePageDescTable() .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCTBL); for (std::size_t n = 0; n < nSize; ++n) { - const SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(n); + const SwPageDesc& rPageDesc = m_rDoc.GetPageDesc(n); Strm() .WriteCharPtr(SAL_NEWLINE_STRING) @@ -658,7 +658,7 @@ void RtfExport::WritePageDescTable() // search for the next page description std::size_t i = nSize; while (i) - if (rPageDesc.GetFollow() == &m_pDoc->GetPageDesc(--i)) + if (rPageDesc.GetFollow() == &m_rDoc.GetPageDesc(--i)) break; Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCNXT); OutULong(i).WriteChar(' '); @@ -684,7 +684,7 @@ ErrCode RtfExport::ExportDocument_Impl() .WriteChar('1') .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_DEFF); - OutULong(m_aFontHelper.GetId(m_pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT))); + OutULong(m_aFontHelper.GetId(m_rDoc.GetAttrPool().GetDefaultItem(RES_CHRATR_FONT))); // If this not exist, MS don't understand our ansi characters (0x80-0xff). Strm().WriteCharPtr("\\adeflang1025"); @@ -714,7 +714,7 @@ ErrCode RtfExport::ExportDocument_Impl() OutULong(1); // Zoom - SwViewShell* pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell* pViewShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SvxZoomType::PERCENT) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_VIEWSCALE); @@ -724,7 +724,7 @@ ErrCode RtfExport::ExportDocument_Impl() if (RedlineFlags::On & m_nOrigRedlineFlags) Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS); // Mirror margins? - if ((UseOnPage::Mirror & m_pDoc->GetPageDesc(0).ReadUseOn()) == UseOnPage::Mirror) + if ((UseOnPage::Mirror & m_rDoc.GetPageDesc(0).ReadUseOn()) == UseOnPage::Mirror) Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_MARGMIRROR); // Init sections m_pSections = new MSWordSections(*this); @@ -736,7 +736,7 @@ ErrCode RtfExport::ExportDocument_Impl() // enable it on a per-section basis. OTOH don't always enable it as it // breaks moving of drawings - so write it only in case there is really a // protected section in the document. - for (auto const& pSectionFormat : m_pDoc->GetSections()) + for (auto const& pSectionFormat : m_rDoc.GetSections()) { if (!pSectionFormat->IsInUndo() && pSectionFormat->GetProtect().IsContentProtected()) { @@ -749,13 +749,13 @@ ErrCode RtfExport::ExportDocument_Impl() Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMSHADE); // size and empty margins of the page - if (m_pDoc->GetPageDescCnt()) + if (m_rDoc.GetPageDescCnt()) { // Seeking the first SwFormatPageDesc. If no set, the default is valid const SwFormatPageDesc* pSttPgDsc = nullptr; { const SwNode& rSttNd - = *m_pDoc->GetNodes()[m_pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2]; + = *m_rDoc.GetNodes()[m_rDoc.GetNodes().GetEndOfExtras().GetIndex() + 2]; const SfxItemSet* pSet = nullptr; if (rSttNd.IsContentNode()) @@ -772,7 +772,7 @@ ErrCode RtfExport::ExportDocument_Impl() pSttPgDsc = &pSet->Get(RES_PAGEDESC); if (!pSttPgDsc->GetPageDesc()) pSttPgDsc = nullptr; - else if (m_pDoc->FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) + else if (m_rDoc.FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) { Strm() .WriteChar('{') @@ -782,8 +782,7 @@ ErrCode RtfExport::ExportDocument_Impl() } } } - const SwPageDesc& rPageDesc - = pSttPgDsc ? *pSttPgDsc->GetPageDesc() : m_pDoc->GetPageDesc(0); + const SwPageDesc& rPageDesc = pSttPgDsc ? *pSttPgDsc->GetPageDesc() : m_rDoc.GetPageDesc(0); const SwFrameFormat& rFormatPage = rPageDesc.GetMaster(); { @@ -838,7 +837,7 @@ ErrCode RtfExport::ExportDocument_Impl() } // line numbering - const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo(); + const SwLineNumberInfo& rLnNumInfo = m_rDoc.GetLineNumberInfo(); if (rLnNumInfo.IsPaintLineNumbers()) { sal_uLong nLnNumRestartNo = 0; @@ -850,7 +849,7 @@ ErrCode RtfExport::ExportDocument_Impl() { // write the footnotes and endnotes-out Info - const SwFootnoteInfo& rFootnoteInfo = m_pDoc->GetFootnoteInfo(); + const SwFootnoteInfo& rFootnoteInfo = m_rDoc.GetFootnoteInfo(); const char* pOut = FTNPOS_CHAPTER == rFootnoteInfo.m_ePos ? OOO_STRING_SVTOOLS_RTF_ENDDOC : OOO_STRING_SVTOOLS_RTF_FTNBJ; @@ -896,7 +895,7 @@ ErrCode RtfExport::ExportDocument_Impl() } Strm().WriteCharPtr(pOut); - const SwEndNoteInfo& rEndNoteInfo = m_pDoc->GetEndNoteInfo(); + const SwEndNoteInfo& rEndNoteInfo = m_rDoc.GetEndNoteInfo(); Strm() .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_AENDDOC) @@ -930,7 +929,7 @@ ErrCode RtfExport::ExportDocument_Impl() Strm().WriteCharPtr(pOut); } - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX)) // RTF default is true, so write compat flag if this should be false. Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_HTMAUTSP); @@ -1021,10 +1020,10 @@ void RtfExport::AppendSection(const SwPageDesc* pPageDesc, const SwSectionFormat AttrOutput().SectionBreak(msword::PageBreak, false, m_pSections->CurrentSectionInfo()); } -RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, - std::shared_ptr<SwUnoCursor>& pCurrentPam, SwPaM* pOriginalPam, +RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc& rDocument, + std::shared_ptr<SwUnoCursor>& pCurrentPam, SwPaM& rOriginalPam, Writer* pWriter, bool bOutOutlineOnly) - : MSWordExportBase(pDocument, pCurrentPam, pOriginalPam) + : MSWordExportBase(rDocument, pCurrentPam, &rOriginalPam) , m_pFilter(pFilter) , m_pWriter(pWriter) , m_pSections(nullptr) @@ -1169,7 +1168,7 @@ void RtfExport::OutColorTable() { // Build the table from rPool since the colors provided to // RtfAttributeOutput callbacks are too late. - const SfxItemPool& rPool = m_pDoc->GetAttrPool(); + const SfxItemPool& rPool = m_rDoc.GetAttrPool(); // MSO Word uses a default color table with 16 colors (which is used e.g. for highlighting) InsColor(COL_BLACK); @@ -1460,7 +1459,7 @@ ErrCode SwRTFWriter::WriteStream() std::shared_ptr<SwUnoCursor> pCurPam(m_pDoc->CreateUnoCursor(*m_pCurrentPam->End(), false)); pCurPam->SetMark(); *pCurPam->GetPoint() = *m_pCurrentPam->Start(); - RtfExport aExport(nullptr, m_pDoc, pCurPam, m_pCurrentPam.get(), this, m_bOutOutlineOnly); + RtfExport aExport(nullptr, *m_pDoc, pCurPam, *m_pCurrentPam, this, m_bOutOutlineOnly); aExport.ExportDocument(true); return ERRCODE_NONE; } diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 0c0d35d1a97f..3b4f3b4b79d5 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -148,8 +148,8 @@ protected: public: /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument, std::shared_ptr<SwUnoCursor>& pCurrentPam, - SwPaM* pOriginalPam, Writer* pWriter, bool bOutOutlineOnly = false); + RtfExport(RtfExportFilter* pFilter, SwDoc& rDocument, std::shared_ptr<SwUnoCursor>& pCurrentPam, + SwPaM& rOriginalPam, Writer* pWriter, bool bOutOutlineOnly = false); RtfExport(const RtfExport&) = delete; diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index f8c28d9f9bc6..8ae2b1c50fc7 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -77,7 +77,7 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence<beans::PropertyValue>& aDes // export the document // (in a separate block so that it's destructed before the commit) { - RtfExport aExport(this, pDoc, pCurPam, &aPam, nullptr); + RtfExport aExport(this, *pDoc, pCurPam, aPam, nullptr); aExport.ExportDocument(true); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fa8be14f70cc..426a0d094e13 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -582,7 +582,7 @@ void WW8Export::MiserableRTLFrameFormatHack(SwTwips &rLeft, SwTwips &rRight, const ww8::Frame &rFrameFormat) { //Require nasty bidi swap - if (SvxFrameDirection::Horizontal_RL_TB != m_pDoc->GetTextDirection(rFrameFormat.GetPosition())) + if (SvxFrameDirection::Horizontal_RL_TB != m_rDoc.GetTextDirection(rFrameFormat.GetPosition())) return; SwTwips nWidth = rRight - rLeft; @@ -828,8 +828,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const OSL_ENSURE(false, "Unsupported surround type for export"); break; } - if (pObj && (pObj->GetLayer() == rWrt.m_pDoc->getIDocumentDrawModelAccess().GetHellId() || - pObj->GetLayer() == rWrt.m_pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId())) + if (pObj && (pObj->GetLayer() == rWrt.m_rDoc.getIDocumentDrawModelAccess().GetHellId() || + pObj->GetLayer() == rWrt.m_rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId())) { nFlags |= 0x4000; } @@ -956,10 +956,10 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrameFormat& rFormat ) const { // no Layout for this format, then recalc the ordnum SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(&rFormat); - nOrdNum = std::distance(m_pDoc->GetSpzFrameFormats()->begin(), - m_pDoc->GetSpzFrameFormats()->find( pFormat ) ); + nOrdNum = std::distance(m_rDoc.GetSpzFrameFormats()->begin(), + m_rDoc.GetSpzFrameFormats()->find( pFormat ) ); - const SwDrawModel* pModel = m_pDoc->getIDocumentDrawModelAccess().GetDrawModel(); + const SwDrawModel* pModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pModel ) nOrdNum += pModel->GetPage( 0 )->GetObjCount(); } @@ -1142,7 +1142,7 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos ) m_rExport.m_pOutFormatNode = nullptr; const SfxItemPool* pSrcPool = pEditPool; - const SfxItemPool& rDstPool = m_rExport.m_pDoc->GetAttrPool(); + const SfxItemPool& rDstPool = m_rExport.m_rDoc.GetAttrPool(); nTmpSwPos = nSwPos; // Did we already produce a <w:sz> element? @@ -1212,7 +1212,7 @@ bool MSWord_SdrAttrIter::IsTextAttr(sal_Int32 nSwPos) const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const { nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool, - m_rExport.m_pDoc->GetAttrPool(), nWhich); + m_rExport.m_rDoc.GetAttrPool(), nWhich); if (nWhich) { for (const auto& rTextAtr : aTextAtrArr) @@ -1233,7 +1233,7 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const if (!pRet) { SfxItemSet aSet(pEditObj->GetParaAttribs(nPara)); - nWhich = GetSetWhichFromSwDocWhich(aSet, *m_rExport.m_pDoc, nWhich); + nWhich = GetSetWhichFromSwDocWhich(aSet, m_rExport.m_rDoc, nWhich); OSL_ENSURE(nWhich, "Impossible, catastrophic failure imminent"); pRet = &aSet.Get(nWhich); } @@ -1245,7 +1245,7 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const //set any items which are not already set, but differ from "Normal". void MSWord_SdrAttrIter::SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemSet& rSet) { - SwTextFormatColl* pC = m_rExport.m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool + SwTextFormatColl* pC = m_rExport.m_rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool (RES_POOLCOLL_STANDARD, false); SfxWhichIter aWhichIter(rSet); @@ -1253,7 +1253,7 @@ void MSWord_SdrAttrIter::SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemS { if (SfxItemState::SET != rSet.GetItemState(nEEWhich, false)) { - sal_uInt16 nSwWhich = sw::hack::TransformWhichBetweenPools(m_rExport.m_pDoc->GetAttrPool(), + sal_uInt16 nSwWhich = sw::hack::TransformWhichBetweenPools(m_rExport.m_rDoc.GetAttrPool(), *pEditPool, nEEWhich); if (!nSwWhich) continue; @@ -1286,7 +1286,7 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>* const SfxPoolItem* pItem = aIter.GetCurItem(); const SfxItemPool* pSrcPool = pEditPool, - * pDstPool = &m_rExport.m_pDoc->GetAttrPool(); + * pDstPool = &m_rExport.m_rDoc.GetAttrPool(); do { @@ -1454,7 +1454,7 @@ void WinwordAnchoring::WriteData( EscherEx& rEx ) const void WW8Export::CreateEscher() { - SfxItemState eBackSet = m_pDoc->GetPageDesc(0).GetMaster(). + SfxItemState eBackSet = m_rDoc.GetPageDesc(0).GetMaster(). GetItemState(RES_BACKGROUND); if (m_pHFSdrObjs->size() || m_pSdrObjs->size() || SfxItemState::SET == eBackSet) { @@ -2137,7 +2137,7 @@ sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, MSO_SPT eS void SwBasicEscherEx::Init() { MapUnit eMap = MapUnit::MapTwip; - if (SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel()) + if (SwDrawModel *pModel = rWrt.m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()) { // PPT works only with units of 576DPI // WW however is using twips, i.e 1440DPI. @@ -2153,7 +2153,7 @@ void SwBasicEscherEx::Init() mnEmuMul = aFact.GetNumerator(); mnEmuDiv = aFact.GetDenominator(); - SetHellLayerId(rWrt.m_pDoc->getIDocumentDrawModelAccess().GetHellId()); + SetHellLayerId(rWrt.m_rDoc.getIDocumentDrawModelAccess().GetHellId()); } sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) @@ -2179,7 +2179,7 @@ sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) SdrLayerID SwBasicEscherEx::GetInvisibleHellId() const { - return rWrt.m_pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId(); + return rWrt.m_rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId(); } void SwBasicEscherEx::WritePictures() @@ -2298,7 +2298,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) nSecondShapeId ); EscherPropertyContainer aPropOpt; - const SwFrameFormat &rFormat = rWrt.m_pDoc->GetPageDesc(0).GetMaster(); + const SwFrameFormat &rFormat = rWrt.m_rDoc.GetPageDesc(0).GetMaster(); const SfxPoolItem* pItem = nullptr; SfxItemState eState = rFormat.GetItemState(RES_BACKGROUND, true, &pItem); @@ -2927,7 +2927,7 @@ void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShap OpenContainer( ESCHER_SpContainer ); - SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel(); + SwDrawModel *pModel = rWrt.m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); OutputDevice *pDevice = Application::GetDefaultDevice(); OSL_ENSURE(pModel && pDevice, "no model or device"); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 2b5b66fab0cf..6b61fd14e519 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -192,7 +192,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : { SwPosition aPos(rTextNd); - mbParaIsRTL = SvxFrameDirection::Horizontal_RL_TB == rWr.m_pDoc->GetTextDirection(aPos); + mbParaIsRTL = SvxFrameDirection::Horizontal_RL_TB == rWr.m_rDoc.GetTextDirection(aPos); maCharRunIter = maCharRuns.begin(); IterToCurrent(); @@ -218,10 +218,10 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : maFlyIter = maFlyFrames.begin(); - if ( !m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) + if ( !m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { SwPosition aPosition( rNd, SwIndex( const_cast<SwTextNode*>(&rNd) ) ); - pCurRedline = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos ); + pCurRedline = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos ); } nCurrentSwPos = SearchNext(1); @@ -279,16 +279,16 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) } } - if ( nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() ) + if ( nCurRedlinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ) { // nCurRedlinePos point to the next redline SwRedlineTable::size_type nRedLinePos = nCurRedlinePos; if( pCurRedline ) ++nRedLinePos; - for ( ; nRedLinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedLinePos ) + for ( ; nRedLinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nRedLinePos ) { - const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedLinePos ]; + const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedLinePos ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() @@ -1410,9 +1410,9 @@ bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) cons { // search next Redline for( SwRedlineTable::size_type nPos = nCurRedlinePos; - nPos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nPos ) + nPos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nPos ) { - const SwRangeRedline *pRange = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[nPos]; + const SwRangeRedline *pRange = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[nPos]; const SwPosition* pEnd = pRange->End(); const SwPosition* pStart = pRange->Start(); bool bBreak = true; @@ -1467,7 +1467,7 @@ const SwRedlineData* SwWW8AttrIter::GetParagraphLevelRedline( ) pCurRedline = nullptr; // ToDo : this is not the most ideal ... should start maybe from 'nCurRedlinePos' - for(SwRangeRedline* pRedl : m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()) + for(SwRangeRedline* pRedl : m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()) { const SwPosition* pCheckedStt = pRedl->Start(); @@ -1512,10 +1512,10 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos ) assert(!pCurRedline); // search next Redline - for( ; nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + for( ; nCurRedlinePos < m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nCurRedlinePos ) { - const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ]; + const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() @@ -1563,7 +1563,7 @@ SvxFrameDirection MSWordExportBase::GetCurrentPageDirection() const { const SwFrameFormat &rFormat = m_pCurrentPageDesc ? m_pCurrentPageDesc->GetMaster() - : m_pDoc->GetPageDesc( 0 ).GetMaster(); + : m_rDoc.GetPageDesc( 0 ).GetMaster(); return rFormat.GetFrameDir().GetValue(); } @@ -1583,7 +1583,7 @@ SvxFrameDirection MSWordExportBase::GetDefaultFrameDirection( ) const { const SwContentNode *pNd = static_cast<const SwContentNode *>(m_pOutFormatNode); SwPosition aPos( *pNd ); - nDir = m_pDoc->GetTextDirection( aPos ); + nDir = m_rDoc.GetTextDirection( aPos ); } else if ( dynamic_cast< const SwTextFormatColl *>( m_pOutFormatNode ) != nullptr ) { @@ -1643,7 +1643,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const { const SwFrameFormat &rFormat = m_pCurrentPageDesc ? m_pCurrentPageDesc->GetMaster() - : m_pDoc->GetPageDesc(0).GetMaster(); + : m_rDoc.GetPageDesc(0).GetMaster(); const SfxPoolItem* pItem = nullptr; //If not set, or "no fill", get real bg @@ -1653,7 +1653,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const if (SfxItemState::SET != eState || !pRet || (!pRet->GetGraphic() && pRet->GetColor() == COL_TRANSPARENT)) { - pRet = &(DefaultItemGet<SvxBrushItem>(*m_pDoc,RES_BACKGROUND)); + pRet = &(DefaultItemGet<SvxBrushItem>(m_rDoc,RES_BACKGROUND)); } return pRet; } @@ -1773,10 +1773,10 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nCurrentPos, static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTextNode* pTextNode ) { SwRedlineTable::size_type nPos = 0; - SwRedlineTable::size_type nMax = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + SwRedlineTable::size_type nMax = rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); while( nPos < nMax ) { - const SwRangeRedline* pRedl = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; + const SwRangeRedline* pRedl = rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; const SwPosition* pStt = pRedl->Start(); const SwPosition* pEnd = pStt == pRedl->GetPoint() ? pRedl->GetMark() @@ -1890,7 +1890,7 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, sal_Int32 nCurr bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector& rArr ) { - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); sal_uLong nNd = rNd.GetIndex( ); const sal_Int32 nMarks = pMarkAccess->getAllMarksCount(); @@ -1938,7 +1938,7 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt, bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector& rArr ) { - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); sal_uLong nNd = rAttrs.GetNode().GetIndex(); const sal_Int32 nMarks = pMarkAccess->getAnnotationMarksCount(); @@ -2397,7 +2397,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) || ch == CH_TXT_ATR_FORMELEMENT) ? 1 : 0; - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); if ( ch == CH_TXT_ATR_FIELDSTART ) { SwPosition aPosition( rNode, SwIndex( &rNode, nCurrentPos ) ); @@ -2547,7 +2547,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { // Allow MSO to emulate LO footnote text starting at left margin - only meaningful with hanging indent sal_Int32 nFirstLineIndent=0; - SfxItemSet aSet( m_pDoc->GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} ); + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>{} ); const SwTextNode* pTextNode( rNode.GetTextNode() ); if ( pTextNode && pTextNode->GetAttr(aSet) ) { @@ -2784,13 +2784,13 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() ); SvxULSpaceItem aUL( *static_cast<const SvxULSpaceItem*>(pItem) ); // #i25901#- consider compatibility option - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES)) { if( !(ND_HAS_PREV_LAYNODE & nPrvNxtNd )) aUL.SetUpper( 0 ); } // #i25901# - consider compatibility option - if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS)) + if (!m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS)) { if( !(ND_HAS_NEXT_LAYNODE & nPrvNxtNd )) aUL.SetLower( 0 ); @@ -3077,7 +3077,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // Exception: if there is a character style hint at the end of the // paragraph only, then still go with 2), as RES_TXTATR_CHARFMT is always // set as a hint. - SfxItemSet aParagraphMarkerProperties(m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{}); + SfxItemSet aParagraphMarkerProperties(m_rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{}); bool bCharFormatOnly = true; SwFormatAutoFormat const& rListAutoFormat(static_cast<SwFormatAutoFormat const&>(rNode.GetAttr(RES_PARATR_LIST_AUTOFMT))); @@ -3359,7 +3359,7 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const ww8::Frame& rFormat, const P { //Test to see if this textbox contains only a single graphic/ole SwTextNode* pParTextNode = rAnch.GetContentAnchor()->nNode.GetNode().GetTextNode(); - if ( pParTextNode && !m_rWW8Export.m_pDoc->GetNodes()[ nStt ]->IsNoTextNode() ) + if ( pParTextNode && !m_rWW8Export.m_rDoc.GetNodes()[ nStt ]->IsNoTextNode() ) bDone = true; } if( !bDone ) @@ -3385,7 +3385,7 @@ void WW8AttributeOutput::OutputFlyFrame_Impl( const ww8::Frame& rFormat, const P if ( m_rWW8Export.IsInTable() && (RndStdIds::FLY_AT_PAGE != rAnch.GetAnchorId()) && - !m_rWW8Export.m_pDoc->GetNodes()[ nStt ]->IsNoTextNode() + !m_rWW8Export.m_rDoc.GetNodes()[ nStt ]->IsNoTextNode() ) { // note: set Flag bOutTable again, @@ -3564,7 +3564,7 @@ WW8Ruby::WW8Ruby(const SwTextNode& rNode, const SwFormatRuby& rRuby, const MSWor /*Get defaults if no formatting on ruby text*/ const SfxItemPool* pPool = rNode.GetSwAttrSet().GetPool(); - pPool = pPool ? pPool : &rExport.m_pDoc->GetAttrPool(); + pPool = pPool ? pPool : &rExport.m_rDoc.GetAttrPool(); const auto& rFont diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 3c133772a68d..76fad21db51e 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -44,7 +44,7 @@ SwNumRule* MSWordExportBase::DuplicateNumRuleImpl(const SwNumRule *pRule) { const OUString sPrefix("WW8TempExport" + OUString::number( m_nUniqueList++ )); SwNumRule* pMyNumRule = - new SwNumRule( m_pDoc->GetUniqueNumRuleName( &sPrefix ), + new SwNumRule( m_rDoc.GetUniqueNumRuleName( &sPrefix ), SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); m_pUsedNumTable->push_back( pMyNumRule ); @@ -113,7 +113,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) if ( !m_pUsedNumTable ) { m_pUsedNumTable.reset(new SwNumRuleTable); - m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_pDoc->GetNumRuleTable().begin(), m_pDoc->GetNumRuleTable().end() ); + m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_rDoc.GetNumRuleTable().begin(), m_rDoc.GetNumRuleTable().end() ); // Check, if the outline rule is already inserted into <pUsedNumTable>. // If yes, do not insert it again. bool bOutlineRuleAdded( false ); @@ -124,7 +124,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) { m_pUsedNumTable->erase( m_pUsedNumTable->begin() + n ); } - else if ( &rRule == m_pDoc->GetOutlineNumRule() ) + else if ( &rRule == m_rDoc.GetOutlineNumRule() ) { bOutlineRuleAdded = true; } @@ -133,7 +133,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule ) if ( !bOutlineRuleAdded ) { // still need to paste the OutlineRule - SwNumRule* pR = m_pDoc->GetOutlineNumRule(); + SwNumRule* pR = m_rDoc.GetOutlineNumRule(); m_pUsedNumTable->push_back( pR ); } } @@ -545,7 +545,7 @@ void MSWordExportBase::NumberingLevel( const SfxItemSet* pOutSet = nullptr; // cbGrpprlChpx - SfxItemSet aSet( m_pDoc->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, + SfxItemSet aSet( m_rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END>{} ); if (rFormat.GetCharFormat() || bWriteBullet) { diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index f3f8e3db3912..3917f7ff2fa6 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -144,16 +144,16 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles ) { // if exist any Foot-/End-Notes then get from the EndNoteInfo struct // the CharFormats. They will create it! - if ( !m_rExport.m_pDoc->GetFootnoteIdxs().empty() ) + if ( !m_rExport.m_rDoc.GetFootnoteIdxs().empty() ) { - m_rExport.m_pDoc->GetEndNoteInfo().GetAnchorCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetEndNoteInfo().GetCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetFootnoteInfo().GetAnchorCharFormat( *m_rExport.m_pDoc ); - m_rExport.m_pDoc->GetFootnoteInfo().GetCharFormat( *m_rExport.m_pDoc ); + m_rExport.m_rDoc.GetEndNoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetEndNoteInfo().GetCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetFootnoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); + m_rExport.m_rDoc.GetFootnoteInfo().GetCharFormat( m_rExport.m_rDoc ); } - sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_pDoc->GetCharFormats()->size() - 1 + - m_rExport.m_pDoc->GetTextFormatColls()->size() - 1 + - (bListStyles ? m_rExport.m_pDoc->GetNumRuleTable().size() - 1 : 0); + sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + + m_rExport.m_rDoc.GetTextFormatColls()->size() - 1 + + (bListStyles ? m_rExport.m_rDoc.GetNumRuleTable().size() - 1 : 0); // somewhat generous ( free for up to 15 ) m_pFormatA.reset( new SwFormat*[ nAlloc ] ); @@ -281,7 +281,7 @@ void MSWordStyles::BuildStylesTable() { m_nUsedSlots = WW8_RESERVED_SLOTS; // reserved slots for standard, headingX, and others - const SwCharFormats& rArr = *m_rExport.m_pDoc->GetCharFormats(); // first CharFormat + const SwCharFormats& rArr = *m_rExport.m_rDoc.GetCharFormats(); // first CharFormat // the default character style ( 0 ) will not be outputted ! for( size_t n = 1; n < rArr.size(); n++ ) { @@ -289,7 +289,7 @@ void MSWordStyles::BuildStylesTable() m_pFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; } - const SwTextFormatColls& rArr2 = *m_rExport.m_pDoc->GetTextFormatColls(); // then TextFormatColls + const SwTextFormatColls& rArr2 = *m_rExport.m_rDoc.GetTextFormatColls(); // then TextFormatColls // the default character style ( 0 ) will not be outputted ! for( size_t n = 1; n < rArr2.size(); n++ ) { @@ -307,7 +307,7 @@ void MSWordStyles::BuildStylesTable() if (!m_bListStyles) return; - const SwNumRuleTable& rNumRuleTable = m_rExport.m_pDoc->GetNumRuleTable(); + const SwNumRuleTable& rNumRuleTable = m_rExport.m_rDoc.GetNumRuleTable(); for (size_t i = 0; i < rNumRuleTable.size(); ++i) { const SwNumRule* pNumRule = rNumRuleTable[i]; @@ -466,7 +466,7 @@ void MSWordStyles::SetStyleDefaults( const SwFormat& rFormat, bool bPap ) const SfxItemPool& rPool = *rFormat.GetAttrSet().GetPool(); for( n = nStt; n < nEnd; ++n ) aFlags[ n - RES_CHRATR_BEGIN ] = nullptr != rPool.GetPoolDefaultItem( n ) - || SfxItemState::SET == m_rExport.m_pDoc->GetDfltTextFormatColl()->GetItemState( n, false ); + || SfxItemState::SET == m_rExport.m_rDoc.GetDfltTextFormatColl()->GetItemState( n, false ); // static defaults, that differs between WinWord and SO if( bPap ) @@ -981,7 +981,7 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) : mbDocumentIsProtected( false ) { const SwSectionFormat *pFormat = nullptr; - rExport.m_pCurrentPageDesc = &rExport.m_pDoc->GetPageDesc( 0 ); + rExport.m_pCurrentPageDesc = &rExport.m_rDoc.GetPageDesc( 0 ); const SfxPoolItem* pI; const SwNode* pNd = rExport.m_pCurPam->GetContentNode(); @@ -1139,7 +1139,7 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFormatPageDesc& rPD, void WW8_WrPlcSepx::WriteFootnoteEndText( WW8Export& rWrt, sal_uLong nCpStt ) { sal_uInt8 nInfoFlags = 0; - const SwFootnoteInfo& rInfo = rWrt.m_pDoc->GetFootnoteInfo(); + const SwFootnoteInfo& rInfo = rWrt.m_rDoc.GetFootnoteInfo(); if( !rInfo.m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02; if( !rInfo.m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04; @@ -1189,7 +1189,7 @@ void WW8_WrPlcSepx::WriteFootnoteEndText( WW8Export& rWrt, sal_uLong nCpStt ) // Endnote Info rDop.rncEdn = 0; // rncEdn: Don't Restart - const SwEndNoteInfo& rEndInfo = rWrt.m_pDoc->GetEndNoteInfo(); + const SwEndNoteInfo& rEndInfo = rWrt.m_rDoc.GetEndNoteInfo(); rDop.nfcEdnRef = WW8Export::GetNumId( rEndInfo.m_aFormat.GetNumberingType() ); rDop.nEdn = rEndInfo.m_nFootnoteOffset + 1; rDop.epc = rWrt.m_bEndAtTextEnd ? 3 : 0; @@ -1329,8 +1329,8 @@ void WW8AttributeOutput::StartSection() void WW8AttributeOutput::SectFootnoteEndnotePr() { - const SwFootnoteInfo& rInfo = m_rWW8Export.m_pDoc->GetFootnoteInfo(); - const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_pDoc->GetEndNoteInfo(); + const SwFootnoteInfo& rInfo = m_rWW8Export.m_rDoc.GetFootnoteInfo(); + const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_rDoc.GetEndNoteInfo(); m_rWW8Export.InsUInt16( NS_sprm::SRncFtn::val ); switch( rInfo.m_eNum ) { @@ -1597,7 +1597,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt const SwPageDesc* pPd = rSepInfo.pPageDesc; if ( rSepInfo.pSectionFormat && !pPd ) - pPd = &m_pDoc->GetPageDesc( 0 ); + pPd = &m_rDoc.GetPageDesc( 0 ); m_pCurrentPageDesc = pPd; @@ -1615,7 +1615,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt AttrOutput().SectionFormProtection( rSepInfo.IsProtected() ); // line numbers - const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo(); + const SwLineNumberInfo& rLnNumInfo = m_rDoc.GetLineNumberInfo(); if ( rLnNumInfo.IsPaintLineNumbers() ) AttrOutput().SectionLineNumbering( rSepInfo.nLnNumRestartNo, rLnNumInfo ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 8c2ac92789e9..90152ceca99c 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -453,19 +453,19 @@ static void WriteDop( WW8Export& rWrt ) WW8Dop& rDop = *rWrt.pDop; // i#78951#, store the value of unknown compatibility options - rDop.SetCompatibilityOptions( rWrt.m_pDoc->getIDocumentSettingAccess().Getn32DummyCompatibilityOptions1()); - rDop.SetCompatibilityOptions2( rWrt.m_pDoc->getIDocumentSettingAccess().Getn32DummyCompatibilityOptions2()); + rDop.SetCompatibilityOptions( rWrt.m_rDoc.getIDocumentSettingAccess().Getn32DummyCompatibilityOptions1()); + rDop.SetCompatibilityOptions2( rWrt.m_rDoc.getIDocumentSettingAccess().Getn32DummyCompatibilityOptions2()); - rDop.fNoLeading = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); - rDop.fUsePrinterMetrics = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE); + rDop.fNoLeading = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); + rDop.fUsePrinterMetrics = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE); // write default TabStop const SvxTabStopItem& rTabStop = - DefaultItemGet<SvxTabStopItem>(*rWrt.m_pDoc, RES_PARATR_TABSTOP); + DefaultItemGet<SvxTabStopItem>(rWrt.m_rDoc, RES_PARATR_TABSTOP); rDop.dxaTab = static_cast<sal_uInt16>(rTabStop[0].GetTabPos()); // Zoom factor and type - SwViewShell *pViewShell(rWrt.m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()); + SwViewShell *pViewShell(rWrt.m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()); if (pViewShell) { switch ( pViewShell->GetViewOptions()->GetZoomType() ) @@ -483,14 +483,14 @@ static void WriteDop( WW8Export& rWrt ) // for the DocStat fields) rDop.fWCFootnoteEdn = true; // because they are included in StarWriter - const SwDocStat& rDStat = rWrt.m_pDoc->getIDocumentStatistics().GetDocStat(); + const SwDocStat& rDStat = rWrt.m_rDoc.getIDocumentStatistics().GetDocStat(); rDop.cWords = rDStat.nWord; rDop.cCh = rDStat.nChar; rDop.cPg = static_cast< sal_Int16 >(rDStat.nPage); rDop.cParas = rDStat.nPara; rDop.cLines = rDStat.nPara; - SwDocShell *pDocShell(rWrt.m_pDoc->GetDocShell()); + SwDocShell *pDocShell(rWrt.m_rDoc.GetDocShell()); OSL_ENSURE(pDocShell, "no SwDocShell"); uno::Reference<document::XDocumentProperties> xDocProps; uno::Reference<beans::XPropertySet> xProps; @@ -502,7 +502,7 @@ static void WriteDop( WW8Export& rWrt ) } if ((rWrt.pSepx && rWrt.pSepx->DocumentIsProtected()) || - rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM ) || + rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM ) || rDop.lKeyProtDoc != 0) { rDop.fProtEnabled = true; @@ -543,9 +543,9 @@ static void WriteDop( WW8Export& rWrt ) rDop.cParasFootnoteEdn = rDStat.nPara; rDop.cLinesFootnoteEdn = rDStat.nPara; - rDop.fDontUseHTMLAutoSpacing = rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX); + rDop.fDontUseHTMLAutoSpacing = rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX); - rDop.fExpShRtn = !rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); // #i56856# + rDop.fExpShRtn = !rWrt.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK); // #i56856# rDop.Write( *rWrt.pTableStrm, *rWrt.pFib ); } @@ -671,7 +671,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) for (rTypo.m_reserved1=8;rTypo.m_reserved1>0;rTypo.m_reserved1-=2) { - pForbidden = m_pDoc->getIDocumentSettingAccess().getForbiddenCharacters(rTypo.GetConvertedLang(), + pForbidden = m_rDoc.getIDocumentSettingAccess().getForbiddenCharacters(rTypo.GetConvertedLang(), false); if (nullptr != pForbidden) { @@ -741,7 +741,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); rTypo.m_fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); - rTypo.m_iJustification = sal_uInt16(m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType()); + rTypo.m_iJustification = sal_uInt16(m_rDoc.getIDocumentSettingAccess().getCharacterCompressionType()); } // It can only be found something with this method, if it is used within @@ -754,7 +754,7 @@ const SfxPoolItem* MSWordExportBase::HasItem( sal_uInt16 nWhich ) const // if write an EditEngine text, then the WhichIds are greater than // our own Ids. So the Id have to translate from our into the // EditEngine Range - nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); + nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, m_rDoc, nWhich); if (nWhich && SfxItemState::SET != m_pISet->GetItemState(nWhich, true, &pItem)) pItem = nullptr; } @@ -776,7 +776,7 @@ const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const // if write an EditEngine text, then the WhichIds are greater than // our own Ids. So the Id have to translate from our into the // EditEngine Range - nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, *m_pDoc, nWhich); + nWhich = sw::hack::GetSetWhichFromSwDocWhich(*m_pISet, m_rDoc, nWhich); OSL_ENSURE(nWhich != 0, "All broken, Impossible"); return m_pISet->Get(nWhich); } ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits