embeddedobj/source/inc/oleembobj.hxx | 3 embeddedobj/source/msole/oleembed.cxx | 7 embeddedobj/source/msole/olemisc.cxx | 9 forms/source/component/EventThread.cxx | 18 - forms/source/component/EventThread.hxx | 8 forms/source/component/clickableimage.cxx | 11 forms/source/component/clickableimage.hxx | 9 svx/source/svdraw/svdoole2.cxx | 27 - sw/inc/docfac.hxx | 3 sw/inc/docufld.hxx | 4 sw/inc/shellio.hxx | 3 sw/source/core/fields/docufld.cxx | 19 - sw/source/core/unocore/unofield.cxx | 32 -- sw/source/filter/basflt/docfact.cxx | 13 sw/source/filter/basflt/shellio.cxx | 198 ++++++------- sw/source/filter/html/css1atr.cxx | 16 - sw/source/filter/html/htmlatr.cxx | 4 sw/source/filter/html/htmlbas.cxx | 6 sw/source/filter/html/htmlcss1.cxx | 4 sw/source/filter/html/htmlctxt.cxx | 4 sw/source/filter/html/htmldrawreader.cxx | 10 sw/source/filter/html/htmlfld.cxx | 18 - sw/source/filter/html/htmlform.cxx | 16 - sw/source/filter/html/htmlftn.cxx | 10 sw/source/filter/html/htmlgrin.cxx | 34 +- sw/source/filter/html/htmlnumreader.cxx | 18 - sw/source/filter/html/htmlplug.cxx | 32 +- sw/source/filter/html/htmlsect.cxx | 44 +-- sw/source/filter/html/htmltab.cxx | 42 +- sw/source/filter/html/swhtml.cxx | 249 ++++++++--------- sw/source/filter/html/swhtml.hxx | 3 sw/source/filter/html/wrthtml.cxx | 43 +- sw/source/filter/html/wrthtml.hxx | 3 xmlscript/source/xml_helper/xml_impctx.cxx | 9 xmlscript/source/xmldlg_imexp/imp_share.hxx | 9 xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 306 ++++++++++----------- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 83 ++--- 37 files changed, 631 insertions(+), 696 deletions(-)
New commits: commit d3ff66999d924e832f8219c65ced0526f1a67f82 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 12:39:12 2017 +0200 use rtl::Reference in OClickableImageBaseModel instead of storing both a raw pointer and an uno::Reference Change-Id: I92dc79edef9046acc137a878d35dde935bb17674 diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index 54f0963..9bedc97 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -448,7 +448,6 @@ namespace frm ,OPropertyChangeListener(m_aMutex) ,m_xGraphicObject() ,m_pMedium(nullptr) - ,m_pProducer( nullptr ) ,m_bDispatchUrlInternal(false) ,m_bDownloading(false) ,m_bProdStarted(false) @@ -463,7 +462,6 @@ namespace frm ,OPropertyChangeListener( m_aMutex ) ,m_xGraphicObject( _pOriginal->m_xGraphicObject ) ,m_pMedium( nullptr ) - ,m_pProducer( nullptr ) ,m_bDispatchUrlInternal(false) ,m_bDownloading( false ) ,m_bProdStarted( false ) @@ -493,12 +491,10 @@ namespace frm void OClickableImageBaseModel::implConstruct() { - m_pProducer = new ImageProducer; - m_pProducer->SetDoneHdl( LINK( this, OClickableImageBaseModel, OnImageImportDone ) ); + m_xProducer = new ImageProducer; + m_xProducer->SetDoneHdl( LINK( this, OClickableImageBaseModel, OnImageImportDone ) ); osl_atomic_increment( &m_refCount ); { - m_xProducer = m_pProducer; - if ( m_xAggregateSet.is() ) { OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet ); @@ -578,8 +574,7 @@ namespace frm m_pMedium = nullptr; } - m_xProducer = nullptr; - m_pProducer = nullptr; + m_xProducer.clear(); } diff --git a/forms/source/component/clickableimage.hxx b/forms/source/component/clickableimage.hxx index 3408b6a..5250f6b 100644 --- a/forms/source/component/clickableimage.hxx +++ b/forms/source/component/clickableimage.hxx @@ -64,11 +64,10 @@ namespace frm OUString m_sTargetFrame; // TargetFrame to open // ImageProducer stuff - css::uno::Reference< css::awt::XImageProducer> m_xProducer; // Store the image in a graphic object to make it accessible via graphic cache using graphic ID. css::uno::Reference< css::graphic::XGraphicObject > m_xGraphicObject; SfxMedium* m_pMedium; // Download medium - ImageProducer* m_pProducer; + rtl::Reference<ImageProducer> m_xProducer; bool m_bDispatchUrlInternal; // property: is not allowed to set : 1 bool m_bDownloading : 1; // Is a download in progress? bool m_bProdStarted : 1; @@ -79,7 +78,7 @@ namespace frm DECL_LINK( DownloadDoneLink, void*, void ); - inline ImageProducer* GetImageProducer() { return m_pProducer; } + inline ImageProducer* GetImageProducer() { return m_xProducer.get(); } void StartProduction(); void SetURL(const OUString& rURL); @@ -108,7 +107,7 @@ namespace frm virtual void SAL_CALL disposing() override; // css::form::XImageProducerSupplier - virtual css::uno::Reference< css::awt::XImageProducer> SAL_CALL getImageProducer() throw (css::uno::RuntimeException, std::exception) override { return m_xProducer; } + virtual css::uno::Reference< css::awt::XImageProducer> SAL_CALL getImageProducer() throw (css::uno::RuntimeException, std::exception) override { return m_xProducer.get(); } // OPropertySetHelper virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue, sal_Int32 nHandle ) const override; @@ -143,7 +142,7 @@ namespace frm public: struct GuardAccess { friend class ImageModelMethodGuard; private: GuardAccess() { } }; ::osl::Mutex& getMutex( GuardAccess ) { return m_aMutex; } - ImageProducer* getImageProducer( GuardAccess ) { return m_pProducer; } + ImageProducer* getImageProducer( GuardAccess ) { return m_xProducer.get(); } protected: using OControlModel::getMutex; commit afb60a273f9ed9f1ff17f25f62ef9dd15a4a7c3a Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 12:35:35 2017 +0200 use rtl::Reference in OComponentEventThread instead of storing both a raw pointer and an uno::Reference Change-Id: I8cd4d04ffb9f40a48d48ade2b171a9a9942cf87f diff --git a/forms/source/component/EventThread.cxx b/forms/source/component/EventThread.cxx index e1011b1..f255dbb 100644 --- a/forms/source/component/EventThread.cxx +++ b/forms/source/component/EventThread.cxx @@ -32,17 +32,11 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::lang; OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImpl ) : - m_pCompImpl( pCompImpl ) + m_xComp( pCompImpl ) { osl_atomic_increment(&m_refCount); - // Hold a reference of the Control - { - css::uno::Reference<css::uno::XInterface> xIFace(static_cast<XWeak*>(pCompImpl)); - m_xComp.set(xIFace, css::uno::UNO_QUERY); - } - // and add us at the Control { Reference<XEventListener> xEvtLstnr = static_cast<XEventListener*>(this); @@ -88,7 +82,7 @@ void OComponentEventThread::impl_clearEventQueue() void OComponentEventThread::disposing( const EventObject& evt ) throw ( css::uno::RuntimeException, std::exception) { - if( evt.Source == m_xComp ) + if( evt.Source == static_cast<XWeak*>(m_xComp.get()) ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -101,8 +95,7 @@ void OComponentEventThread::disposing( const EventObject& evt ) throw ( css::uno // Free the Control and set pCompImpl to 0, // so that the thread knows, that it should terminate. - m_xComp = nullptr; - m_pCompImpl = nullptr; + m_xComp.clear(); // Wake up the thread and terminate m_aCond.set(); @@ -158,8 +151,7 @@ void OComponentEventThread::run() while( m_aEvents.size() > 0 ) { // Get the Control and hold on to it so that it cannot be deleted during actionPerformed - Reference<XComponent> xComp = m_xComp; - ::cppu::OComponentHelper *pCompImpl = m_pCompImpl; + rtl::Reference<::cppu::OComponentHelper> xComp = m_xComp; ThreadEvents::iterator firstEvent( m_aEvents.begin() ); std::unique_ptr<EventObject> pEvt(*firstEvent); @@ -183,7 +175,7 @@ void OComponentEventThread::run() xControlAdapter->queryAdapted(), css::uno::UNO_QUERY); if( xComp.is() ) - processEvent( pCompImpl, pEvt.get(), xControl, bFlag ); + processEvent( xComp.get(), pEvt.get(), xControl, bFlag ); } } diff --git a/forms/source/component/EventThread.hxx b/forms/source/component/EventThread.hxx index e8472f5..e83b3bb 100644 --- a/forms/source/component/EventThread.hxx +++ b/forms/source/component/EventThread.hxx @@ -29,11 +29,12 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/awt/XControl.hpp> #include <osl/thread.hxx> - - #include <osl/conditn.hxx> #include <cppuhelper/component.hxx> #include <comphelper/uno3.hxx> +#include <rtl/ref.hxx> + + using namespace comphelper; @@ -57,8 +58,7 @@ class OComponentEventThread ThreadObjects m_aControls; // Control for Submit ThreadBools m_aFlags; // Flags for Submit/Reset - ::cppu::OComponentHelper* m_pCompImpl; // Implementation of the Control - css::uno::Reference< css::lang::XComponent> m_xComp; // css::lang::XComponent of the Control + rtl::Reference<::cppu::OComponentHelper> m_xComp; // Implementation of the Control protected: commit 6944b82d6d892e9921af659a4eabec5976511392 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 12:27:03 2017 +0200 use rtl::Reference in SdrOle2ObjImpl instead of manual acquire/release Change-Id: I7110073e9ada8c034295133468c38754e9b55b69 diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 6e66091..3b924ab 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -84,6 +84,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <editeng/outlobj.hxx> #include <svx/svdpage.hxx> +#include <rtl/ref.hxx> using namespace ::com::sun::star; @@ -643,7 +644,7 @@ public: SdrEmbedObjectLink* mpObjectLink; OUString maLinkURL; - SvxUnoShapeModifyListener* mpModifyListener; + rtl::Reference<SvxUnoShapeModifyListener> mxModifyListener; explicit SdrOle2ObjImpl( bool bFrame ) : mpGraphic(nullptr), @@ -656,8 +657,7 @@ public: mbIsChart(false), mbLoadingOLEObjectFailed(false), mbConnected(false), - mpObjectLink(nullptr), - mpModifyListener(nullptr) + mpObjectLink(nullptr) { mxObjRef.Lock(); } @@ -674,8 +674,7 @@ public: mbIsChart(false), mbLoadingOLEObjectFailed(false), mbConnected(false), - mpObjectLink(nullptr), - mpModifyListener(nullptr) + mpObjectLink(nullptr) { mxObjRef.Lock(); } @@ -685,10 +684,9 @@ public: delete mpGraphic; delete mpGraphicObject; - if (mpModifyListener) + if (mxModifyListener.is()) { - mpModifyListener->invalidate(); - mpModifyListener->release(); + mxModifyListener->invalidate(); } } }; @@ -1099,16 +1097,15 @@ void SdrOle2Obj::AddListeners_Impl() if( mpImpl->mxObjRef.is() && mpImpl->mxObjRef->getCurrentState() != embed::EmbedStates::LOADED ) { // register modify listener - if (!mpImpl->mpModifyListener) + if (!mpImpl->mxModifyListener.is()) { - mpImpl->mpModifyListener = new SvxUnoShapeModifyListener(this); - mpImpl->mpModifyListener->acquire(); + mpImpl->mxModifyListener = new SvxUnoShapeModifyListener(this); } uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); - if (xBC.is() && mpImpl->mpModifyListener) + if (xBC.is()) { - uno::Reference<util::XModifyListener> xListener(mpImpl->mpModifyListener); + uno::Reference<util::XModifyListener> xListener(mpImpl->mxModifyListener.get()); xBC->addModifyListener( xListener ); } } @@ -1139,9 +1136,9 @@ void SdrOle2Obj::RemoveListeners_Impl() if ( nState != embed::EmbedStates::LOADED ) { uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY ); - if (xBC.is() && mpImpl->mpModifyListener) + if (xBC.is() && mpImpl->mxModifyListener.is()) { - uno::Reference<util::XModifyListener> xListener(mpImpl->mpModifyListener); + uno::Reference<util::XModifyListener> xListener(mpImpl->mxModifyListener.get()); xBC->removeModifyListener( xListener ); } } commit a024b6dfff0c773e8cfbefa7f6a9d3579ce8e759 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 12:15:43 2017 +0200 use rtl::Reference in SwXTextField instead of manual acquire/release Change-Id: I15d151036f17641a7ac992feb4045b9e31df4dec diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 2ac98b6..b23aedd 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1130,9 +1130,9 @@ public: uno::WeakReference<uno::XInterface> m_wThis; ::comphelper::OInterfaceContainerHelper2 m_EventListeners; - SwFormatField const* m_pFormatField; - SwDoc * m_pDoc; - SwTextAPIObject * m_pTextObject; + SwFormatField const* m_pFormatField; + SwDoc * m_pDoc; + rtl::Reference<SwTextAPIObject> m_xTextObject; bool m_bIsDescriptor; // required to access field master of not yet inserted fields @@ -1148,7 +1148,6 @@ public: , m_EventListeners(m_Mutex) , m_pFormatField(pFormat) , m_pDoc(pDoc) - , m_pTextObject(nullptr) , m_bIsDescriptor(pFormat == nullptr) , m_bCallUpdate(false) , m_nServiceId((pFormat) @@ -1159,10 +1158,9 @@ public: virtual ~Impl() override { - if (m_pTextObject) + if (m_xTextObject.is()) { - m_pTextObject->DisposeEditSource(); - m_pTextObject->release(); + m_xTextObject->DisposeEditSource(); } } @@ -1362,10 +1360,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) m_pImpl->m_pProps->sPar3, // author's initials m_pImpl->m_pProps->sPar4, // name aDateTime ); - if ( m_pImpl->m_pTextObject ) + if ( m_pImpl->m_xTextObject.is() ) { - pPostItField->SetTextObject( m_pImpl->m_pTextObject->CreateText() ); - pPostItField->SetPar2(m_pImpl->m_pTextObject->GetText()); + pPostItField->SetTextObject( m_pImpl->m_xTextObject->CreateText() ); + pPostItField->SetPar2(m_pImpl->m_xTextObject->GetText()); } pField = pPostItField; } @@ -2095,11 +2093,10 @@ void SAL_CALL SwXTextField::dispose() throw (uno::RuntimeException, std::excepti SwTextField::DeleteTextField(*(m_pImpl->m_pFormatField->GetTextField())); } - if (m_pImpl->m_pTextObject) + if (m_pImpl->m_xTextObject.is()) { - m_pImpl->m_pTextObject->DisposeEditSource(); - m_pImpl->m_pTextObject->release(); - m_pImpl->m_pTextObject = nullptr; + m_pImpl->m_xTextObject->DisposeEditSource(); + m_pImpl->m_xTextObject.clear(); } } @@ -2406,15 +2403,14 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, { case FIELD_PROP_TEXT: { - if (!m_pImpl->m_pTextObject) + if (!m_pImpl->m_xTextObject.is()) { SwTextAPIEditSource* pObj = new SwTextAPIEditSource(m_pImpl->m_pDoc); - m_pImpl->m_pTextObject = new SwTextAPIObject( pObj ); - m_pImpl->m_pTextObject->acquire(); + m_pImpl->m_xTextObject = new SwTextAPIObject( pObj ); } - uno::Reference<text::XText> xText(m_pImpl->m_pTextObject); + uno::Reference<text::XText> xText(m_pImpl->m_xTextObject.get()); aRet <<= xText; break; } commit f7ee0054cf9da35f210d9043a68339415aba2284 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 11:54:53 2017 +0200 use rtl::Reference in SwPostItField instead of manual acquire/release Change-Id: Id14ac4731e513ae37f922db5d1e497aee10b3b35 diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index b3685bc..7b91dff 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -21,7 +21,7 @@ #include <tools/date.hxx> #include <tools/datetime.hxx> - +#include <rtl/ref.hxx> #include <svl/macitem.hxx> #include "fldbas.hxx" @@ -443,7 +443,7 @@ class SW_DLLPUBLIC SwPostItField : public SwField OUString sName; ///< Name of the comment. DateTime aDateTime; OutlinerParaObject* mpText; - SwTextAPIObject* m_pTextObject; + rtl::Reference<SwTextAPIObject> m_xTextObject; public: SwPostItField( SwPostItFieldType*, diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index e820553..e9ab623 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1648,16 +1648,14 @@ SwPostItField::SwPostItField( SwPostItFieldType* pT, , sName( rName ) , aDateTime( rDateTime ) , mpText( nullptr ) - , m_pTextObject( nullptr ) { } SwPostItField::~SwPostItField() { - if ( m_pTextObject != nullptr ) + if ( m_xTextObject.is() ) { - m_pTextObject->DisposeEditSource(); - m_pTextObject->release(); + m_xTextObject->DisposeEditSource(); } delete mpText; @@ -1680,7 +1678,7 @@ SwField* SwPostItField::Copy() const if (mpText) pRet->SetTextObject( new OutlinerParaObject(*mpText) ); - // Note: member <m_pTextObject> not copied. + // Note: member <m_xTextObject> not copied. return pRet; } @@ -1747,21 +1745,20 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const break; case FIELD_PROP_TEXT: { - if ( !m_pTextObject ) + if ( !m_xTextObject.is() ) { SwPostItFieldType* pGetType = static_cast<SwPostItFieldType*>(GetTyp()); SwDoc* pDoc = pGetType->GetDoc(); SwTextAPIEditSource* pObj = new SwTextAPIEditSource( pDoc ); - const_cast <SwPostItField*> (this)->m_pTextObject = new SwTextAPIObject( pObj ); - m_pTextObject->acquire(); + const_cast <SwPostItField*> (this)->m_xTextObject = new SwTextAPIObject( pObj ); } if ( mpText ) - m_pTextObject->SetText( *mpText ); + m_xTextObject->SetText( *mpText ); else - m_pTextObject->SetString( sText ); + m_xTextObject->SetString( sText ); - uno::Reference < text::XText > xText( m_pTextObject ); + uno::Reference < text::XText > xText( m_xTextObject.get() ); rAny <<= xText; break; } commit a754294ac7a902fe96fbbd6b8b6824a360d6b248 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 11:29:32 2017 +0200 use rtl::Reference in SwDocFac instead of manual acquire/release Change-Id: I40b4f6d2893fe0d4113032f638bce1793fc47cd7 diff --git a/sw/inc/docfac.hxx b/sw/inc/docfac.hxx index cf073a9..8cf4a73 100644 --- a/sw/inc/docfac.hxx +++ b/sw/inc/docfac.hxx @@ -20,13 +20,14 @@ #define INCLUDED_SW_INC_DOCFAC_HXX #include <tools/solar.h> +#include <rtl/ref.hxx> class SwDoc; class SW_DLLPUBLIC SwDocFac { protected: - SwDoc* pDoc; + rtl::Reference<SwDoc> mxDoc; public: SwDocFac( SwDoc *pDoc = nullptr ); diff --git a/sw/source/filter/basflt/docfact.cxx b/sw/source/filter/basflt/docfact.cxx index c8c87c0..a7269de 100644 --- a/sw/source/filter/basflt/docfact.cxx +++ b/sw/source/filter/basflt/docfact.cxx @@ -25,28 +25,23 @@ SwDocFac::SwDocFac( SwDoc *pDc ) - : pDoc( pDc ) + : mxDoc( pDc ) { - if( pDoc ) - pDoc->acquire(); } SwDocFac::~SwDocFac() { - if( pDoc && !pDoc->release() ) - delete pDoc; } SwDoc *SwDocFac::GetDoc() { - if( !pDoc ) + if( !mxDoc.is() ) { - pDoc = new SwDoc; - pDoc->acquire(); + mxDoc = new SwDoc; } - return pDoc; + return mxDoc.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 0522a8c..de743ce 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -88,11 +88,11 @@ sal_uLong SwReader::Read( const Reader& rOptions ) GetDoc(); // while reading, do not call OLE-Modified - Link<bool,void> aOLELink( pDoc->GetOle2Link() ); - pDoc->SetOle2Link( Link<bool,void>() ); + Link<bool,void> aOLELink( mxDoc->GetOle2Link() ); + mxDoc->SetOle2Link( Link<bool,void>() ); - pDoc->SetInReading( true ); - pDoc->SetInXMLImport( dynamic_cast< XMLReader* >(po) != nullptr ); + mxDoc->SetInReading( true ); + mxDoc->SetInXMLImport( dynamic_cast< XMLReader* >(po) != nullptr ); SwPaM *pPam; if( pCursor ) @@ -100,13 +100,13 @@ sal_uLong SwReader::Read( const Reader& rOptions ) else { // if the Reader was not called by a Shell, create a PaM ourselves - SwNodeIndex nNode( pDoc->GetNodes().GetEndOfContent(), -1 ); + SwNodeIndex nNode( mxDoc->GetNodes().GetEndOfContent(), -1 ); pPam = new SwPaM( nNode ); // For Web documents the default template was set already by InitNew, // unless the filter is not HTML, // or a SetTemplateName was called in ConvertFrom. - if( !pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) || ReadHTML != po || !po->mxTemplate.is() ) - po->SetTemplate( *pDoc ); + if( !mxDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) || ReadHTML != po || !po->mxTemplate.is() ) + po->SetTemplate( *mxDoc ); } // Pams are connected like rings; stop when we return to the 1st element @@ -114,7 +114,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) SwUndoInsDoc* pUndo = nullptr; bool bReadPageDescs = false; - bool const bDocUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + bool const bDocUndo = mxDoc->GetIDocumentUndoRedo().DoesUndo(); bool bSaveUndo = bDocUndo && pCursor; if( bSaveUndo ) { @@ -123,19 +123,19 @@ sal_uLong SwReader::Read( const Reader& rOptions ) if( bReadPageDescs ) { bSaveUndo = false; - pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + mxDoc->GetIDocumentUndoRedo().DelAllUndoObj(); } else { - pDoc->GetIDocumentUndoRedo().ClearRedo(); - pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSDOKUMENT, nullptr ); + mxDoc->GetIDocumentUndoRedo().ClearRedo(); + mxDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSDOKUMENT, nullptr ); } } - pDoc->GetIDocumentUndoRedo().DoUndo(false); + mxDoc->GetIDocumentUndoRedo().DoUndo(false); - SwNodeIndex aSplitIdx( pDoc->GetNodes() ); + SwNodeIndex aSplitIdx( mxDoc->GetNodes() ); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); + RedlineFlags eOld = mxDoc->getIDocumentRedlineAccess().GetRedlineFlags(); RedlineFlags ePostReadRedlineFlags( RedlineFlags::Ignore ); // Array of FlyFormats @@ -148,7 +148,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) if( bSaveUndo ) pUndo = new SwUndoInsDoc( *pPam ); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); SwPaM* pUndoPam = nullptr; if( bDocUndo || pCursor ) @@ -161,8 +161,8 @@ sal_uLong SwReader::Read( const Reader& rOptions ) // store for now all Fly's if( pCursor ) { - std::copy(pDoc->GetSpzFrameFormats()->begin(), - pDoc->GetSpzFrameFormats()->end(), std::back_inserter(aFlyFrameArr)); + std::copy(mxDoc->GetSpzFrameFormats()->begin(), + mxDoc->GetSpzFrameFormats()->end(), std::back_inserter(aFlyFrameArr)); } const sal_Int32 nSttContent = pPam->GetPoint()->nContent.GetIndex(); @@ -172,21 +172,21 @@ sal_uLong SwReader::Read( const Reader& rOptions ) sal_Int32 nEndContent = pCNd ? pCNd->Len() - nSttContent : 0; SwNodeIndex aEndPos( pPam->GetPoint()->nNode, 1 ); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); - nError = po->Read( *pDoc, sBaseURL, *pPam, aFileName ); + nError = po->Read( *mxDoc, sBaseURL, *pPam, aFileName ); // an ODF document may contain redline mode in settings.xml; save it! - ePostReadRedlineFlags = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); + ePostReadRedlineFlags = mxDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); if( !IsError( nError )) // set the End position already { --aEndPos; pCNd = aEndPos.GetNode().GetContentNode(); if( !pCNd && nullptr == ( pCNd = SwNodes::GoPrevious( &aEndPos ) )) - pCNd = pDoc->GetNodes().GoNext( &aEndPos ); + pCNd = mxDoc->GetNodes().GoNext( &aEndPos ); pPam->GetPoint()->nNode = aEndPos; const sal_Int32 nLen = pCNd->Len(); @@ -202,7 +202,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) SwTableBox* pBox = pTableBoxStart->GetTableBox(); if ( pBox ) { - pDoc->ChkBoxNumFormat( *pBox, true ); + mxDoc->ChkBoxNumFormat( *pBox, true ); } } } @@ -222,9 +222,9 @@ sal_uLong SwReader::Read( const Reader& rOptions ) rNd.FindFooterStartNode(); // search all new Fly's, and store them as individual Undo Objects - for( SwFrameFormats::size_type n = 0; n < pDoc->GetSpzFrameFormats()->size(); ++n ) + for( SwFrameFormats::size_type n = 0; n < mxDoc->GetSpzFrameFormats()->size(); ++n ) { - SwFrameFormat* pFrameFormat = (*pDoc->GetSpzFrameFormats())[ n ]; + SwFrameFormat* pFrameFormat = (*mxDoc->GetSpzFrameFormats())[ n ]; const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor(); if( !aFlyFrameArr.Contains( pFrameFormat) ) { @@ -245,7 +245,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) *pFrameAnchor, *pUndoPam->GetPoint(), *pUndoPam->GetMark(), - pDoc) + mxDoc.get()) ) ) ) @@ -257,20 +257,20 @@ sal_uLong SwReader::Read( const Reader& rOptions ) { // DrawObjects are not allowed in Headers/Footers! pFrameFormat->DelFrames(); - pDoc->DelFrameFormat( pFrameFormat ); + mxDoc->DelFrameFormat( pFrameFormat ); --n; } else { if( bSaveUndo ) { - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); // UGLY: temp. enable undo - pDoc->GetIDocumentUndoRedo().DoUndo(true); - pDoc->GetIDocumentUndoRedo().AppendUndo( + mxDoc->GetIDocumentUndoRedo().DoUndo(true); + mxDoc->GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFormat( pFrameFormat,0,0 ) ); - pDoc->GetIDocumentUndoRedo().DoUndo(false); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->GetIDocumentUndoRedo().DoUndo(false); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); } if( pFrameFormat->HasWriterListeners() ) { @@ -286,7 +286,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) } else if( pCursor ) { - pDoc->SetContainsAtPageObjWithContentAnchor( true ); + mxDoc->SetContainsAtPageObjWithContentAnchor( true ); } } else @@ -298,22 +298,22 @@ sal_uLong SwReader::Read( const Reader& rOptions ) if( !aFlyFrameArr.empty() ) aFlyFrameArr.clear(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); - if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) - pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pUndoPam ), true); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + if( mxDoc->getIDocumentRedlineAccess().IsRedlineOn() ) + mxDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( nsRedlineType_t::REDLINE_INSERT, *pUndoPam ), true); else - pDoc->getIDocumentRedlineAccess().SplitRedline( *pUndoPam ); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->getIDocumentRedlineAccess().SplitRedline( *pUndoPam ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); } if( bSaveUndo ) { - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); pUndo->SetInsertRange( *pUndoPam, false ); // UGLY: temp. enable undo - pDoc->GetIDocumentUndoRedo().DoUndo(true); - pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); - pDoc->GetIDocumentUndoRedo().DoUndo(false); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->GetIDocumentUndoRedo().DoUndo(true); + mxDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); + mxDoc->GetIDocumentUndoRedo().DoUndo(false); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); } delete pUndoPam; @@ -338,25 +338,25 @@ sal_uLong SwReader::Read( const Reader& rOptions ) } } - pDoc->SetInReading( false ); - pDoc->SetInXMLImport( false ); + mxDoc->SetInReading( false ); + mxDoc->SetInXMLImport( false ); - pDoc->InvalidateNumRules(); - pDoc->UpdateNumRule(); - pDoc->ChkCondColls(); - pDoc->SetAllUniqueFlyNames(); - pDoc->getIDocumentState().SetLoaded(); + mxDoc->InvalidateNumRules(); + mxDoc->UpdateNumRule(); + mxDoc->ChkCondColls(); + mxDoc->SetAllUniqueFlyNames(); + mxDoc->getIDocumentState().SetLoaded(); // Clear unassigned cell styles, because they aren't needed anymore. - pDoc->GetCellStyles().clear(); + mxDoc->GetCellStyles().clear(); - pDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo); + mxDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo); if (!bReadPageDescs) { if( bSaveUndo ) { - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); - pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSDOKUMENT, nullptr ); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + mxDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSDOKUMENT, nullptr ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); } } @@ -368,26 +368,26 @@ sal_uLong SwReader::Read( const Reader& rOptions ) // #i42634# Moved common code of SwReader::Read() and // SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks(): // ATM still with Update - pDoc->getIDocumentLinksAdministration().UpdateLinks(); + mxDoc->getIDocumentLinksAdministration().UpdateLinks(); // not insert: set the redline mode read from settings.xml eOld = ePostReadRedlineFlags & ~RedlineFlags::Ignore; - pDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 0); + mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 0); } - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); - pDoc->SetOle2Link( aOLELink ); + mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + mxDoc->SetOle2Link( aOLELink ); if( pCursor ) // das Doc ist jetzt modifiziert - pDoc->getIDocumentState().SetModified(); + mxDoc->getIDocumentState().SetModified(); // #i38810# - If links have been updated, the document // have to be modified. During update of links the OLE link at the document // isn't set. Thus, the document's modified state has to be set again after - // the OLE link is restored - see above <pDoc->SetOle2Link( aOLELink )>. - if ( pDoc->getIDocumentLinksAdministration().LinksUpdated() ) + // the OLE link is restored - see above <mxDoc->SetOle2Link( aOLELink )>. + if ( mxDoc->getIDocumentLinksAdministration().LinksUpdated() ) { - pDoc->getIDocumentState().SetModified(); + mxDoc->getIDocumentState().SetModified(); } po->SetReadUTF8( false ); commit 071c74dfe24940b4222ed9576e2357d012b86617 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jan 19 10:16:06 2017 +0200 use rtl::Reference in SwHTMLParser instead of manual acquire/release Change-Id: Ifdc04a9659d91d62da5715b24108927d1faf9c3e diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 424f0d3..c12203d 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -93,7 +93,7 @@ void SwHTMLParser::EndScript() if( bInsSrcIntoField && !m_bIgnoreHTMLComments ) { SwScriptFieldType *pType = - static_cast<SwScriptFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); + static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); SwScriptField aField( pType, m_aScriptType, !m_aScriptURL.isEmpty() ? m_aScriptURL : m_aScriptSource, @@ -101,7 +101,7 @@ void SwHTMLParser::EndScript() InsertAttr( SwFormatField( aField ), false ); } - SwDocShell *pDocSh = m_pDoc->GetDocShell(); + SwDocShell *pDocSh = m_xDoc->GetDocShell(); if( !m_aScriptSource.isEmpty() && pDocSh && bInsIntoBasic && IsNewDoc() ) { @@ -240,7 +240,7 @@ void SwHTMLParser::InsertBasicDocEvent( const OUString& aEvent, const OUString& if( rName.isEmpty() ) return; - SwDocShell *pDocSh = m_pDoc->GetDocShell(); + SwDocShell *pDocSh = m_xDoc->GetDocShell(); OSL_ENSURE( pDocSh, "Wo ist die DocShell?" ); if( !pDocSh ) return; diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index c5d9585..bc3dece 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -1711,8 +1711,8 @@ bool SwHTMLParser::FileDownload( const OUString& rURL, } // wurde abgebrochen? - if( ( m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->IsAbortingImport() ) - || 1 == m_pDoc->getReferenceCount() ) + if( ( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() ) + || 1 == m_xDoc->getReferenceCount() ) { // wurde der Import vom SFX abgebrochen? eState = SVPAR_ERROR; diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index afdf468..11ae0fe 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -423,7 +423,7 @@ bool SwHTMLParser::DoPositioning( SfxItemSet &rItemSet, // - es wurde eine Breite angegeben (in beiden Faellen noetig) if( SwCSS1Parser::MayBePositioned( rPropInfo ) ) { - SfxItemSet aFrameItemSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameItemSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs(aFrameItemSet ); @@ -462,7 +462,7 @@ bool SwHTMLParser::CreateContainer( const OUString& rClass, SwCSS1Parser::MayBePositioned( rPropInfo ) ) { // Container-Klasse - SfxItemSet *pFrameItemSet = pContext->GetFrameItemSet( m_pDoc ); + SfxItemSet *pFrameItemSet = pContext->GetFrameItemSet( m_xDoc.get() ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs( *pFrameItemSet ); diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index 7a25f7a..a98ebf1 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -80,9 +80,9 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj, // always on top of text. // but in invisible layer. <ConnectToLayout> will move the object // to the visible layer. - pNewDrawObj->SetLayer( m_pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() ); + pNewDrawObj->SetLayer( m_xDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() ); - SfxItemSet aFrameSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs( aFrameSet ); @@ -198,7 +198,7 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj, } aFrameSet.Put( aAnchor ); - m_pDoc->getIDocumentContentOperations().InsertDrawObj( *m_pPam, *pNewDrawObj, aFrameSet ); + m_xDoc->getIDocumentContentOperations().InsertDrawObj( *m_pPam, *pNewDrawObj, aFrameSet ); } static void PutEEPoolItem( SfxItemSet &rEEItemSet, @@ -356,7 +356,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) // Ein DrawTextobj anlegen // #i52858# - method name changed - SwDrawModel* pModel = m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); + SwDrawModel* pModel = m_xDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SdrPage* pPg = pModel->GetPage( 0 ); m_pMarquee = SdrObjFactory::MakeNewObject( SdrInventor::Default, OBJ_TEXT, pPg, pModel ); @@ -444,7 +444,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) // Styles parsen (funktioniert hier nur fuer Attribute, die auch // am Zeichen-Objekt gesetzt werden koennen) - SfxItemSet aStyleItemSet( m_pDoc->GetAttrPool(), + SfxItemSet aStyleItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) && diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 15e3d4b..089a307 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -264,7 +264,7 @@ void SwHTMLParser::NewField() { SvtUserOptions aOpt; const OUString& rUser = aOpt.GetFullName(); - SwDocShell *pDocShell(m_pDoc->GetDocShell()); + SwDocShell *pDocShell(m_xDoc->GetDocShell()); OSL_ENSURE(pDocShell, "no SwDocShell"); if (pDocShell) { uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -284,7 +284,7 @@ void SwHTMLParser::NewField() if( RES_DATEFLD==nType || RES_TIMEFLD==nType ) nWhich = RES_DATETIMEFLD; - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( nWhich ); + SwFieldType* pType = m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( nWhich ); SwField *pNewField = nullptr; bool bInsOnEndTag = false; @@ -347,7 +347,7 @@ void SwHTMLParser::NewField() if( !aValue.isEmpty() ) nSub |= FIXEDFLD; - SvNumberFormatter *pFormatter = m_pDoc->GetNumberFormatter(); + SvNumberFormatter *pFormatter = m_xDoc->GetNumberFormatter(); if( pFormatOption ) { const OUString& rFormat = pFormatOption->GetString(); @@ -378,12 +378,12 @@ void SwHTMLParser::NewField() { sal_uInt16 nSub = 0; - SvNumberFormatter *pFormatter = m_pDoc->GetNumberFormatter(); + SvNumberFormatter *pFormatter = m_xDoc->GetNumberFormatter(); sal_uInt32 nNumFormat; LanguageType eLang; double dValue = GetTableDataOptionsValNum( nNumFormat, eLang, aNumValue, aNumFormat, - *m_pDoc->GetNumberFormatter() ); + *m_xDoc->GetNumberFormatter() ); short nFormatType = pFormatter->GetType( nNumFormat ); switch( nFormatType ) { @@ -456,7 +456,7 @@ void SwHTMLParser::NewField() LanguageType eLang; dValue = GetTableDataOptionsValNum( nNumFormat, eLang, aNumValue, aNumFormat, - *m_pDoc->GetNumberFormatter() ); + *m_xDoc->GetNumberFormatter() ); bFixed &= bHasNumValue; } else @@ -524,7 +524,7 @@ void SwHTMLParser::NewField() } else { - m_pDoc->getIDocumentContentOperations().InsertPoolItem(*m_pPam, SwFormatField(*pNewField)); + m_xDoc->getIDocumentContentOperations().InsertPoolItem(*m_pPam, SwFormatField(*pNewField)); delete pNewField; } m_bInField = true; @@ -562,7 +562,7 @@ void SwHTMLParser::EndField() break; } - m_pDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatField(*m_pField) ); + m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatField(*m_pField) ); delete m_pField; m_pField = nullptr; } @@ -636,7 +636,7 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const sal_Char *pTag } SwPostItField aPostItField( - static_cast<SwPostItFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_POSTITFLD )), + static_cast<SwPostItFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_POSTITFLD )), aEmptyOUStr, aComment, aEmptyOUStr, aEmptyOUStr, DateTime( DateTime::SYSTEM ) ); InsertAttr( SwFormatField( aPostItField ), false ); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 9160240..f5d425b 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -641,13 +641,13 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha // das auch vom SwXShape implementiert wird. uno::Reference< beans::XPropertySet > xPropSet( rShape, UNO_QUERY ); - SwViewShell *pVSh = m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell *pVSh = m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); if( !pVSh && !m_nEventId ) { // If there is no view shell by now and the doc shell is an internal // one, no view shell will be created. That for, we have to do that of // our own. This happens if a linked section is inserted or refreshed. - SwDocShell *pDocSh = m_pDoc->GetDocShell(); + SwDocShell *pDocSh = m_xDoc->GetDocShell(); if( pDocSh ) { if ( pDocSh->GetMedium() ) @@ -659,9 +659,9 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha m_pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, 0 ); CallStartAction(); - pVSh = m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); + pVSh = m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); // this ridiculous hack also enables Undo, so turn it off again - m_pDoc->GetIDocumentUndoRedo().DoUndo(false); + m_xDoc->GetIDocumentUndoRedo().DoUndo(false); } } @@ -1236,7 +1236,7 @@ void SwHTMLParser::NewForm( bool bAppend ) } if( !m_pFormImpl ) - m_pFormImpl = new SwHTMLForm_Impl( m_pDoc->GetDocShell() ); + m_pFormImpl = new SwHTMLForm_Impl( m_xDoc->GetDocShell() ); OUString aAction( m_sBaseURL ); OUString sName, sTarget; @@ -1784,7 +1784,7 @@ void SwHTMLParser::InsertInput() } } - SfxItemSet aCSS1ItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aCSS1ItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { @@ -2047,7 +2047,7 @@ void SwHTMLParser::NewTextArea() Size aTextSz( nCols, nRows ); - SfxItemSet aCSS1ItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aCSS1ItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { @@ -2315,7 +2315,7 @@ void SwHTMLParser::NewSelect() bMinHeight = false; } - SfxItemSet aCSS1ItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aCSS1ItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index f6a8d02..ce51c08 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -123,14 +123,14 @@ sal_Int32 lcl_html_getEndNoteInfo( SwEndNoteInfo& rInfo, void SwHTMLParser::FillEndNoteInfo( const OUString& rContent ) { - SwEndNoteInfo aInfo( m_pDoc->GetEndNoteInfo() ); + SwEndNoteInfo aInfo( m_xDoc->GetEndNoteInfo() ); lcl_html_getEndNoteInfo( aInfo, rContent, true ); - m_pDoc->SetEndNoteInfo( aInfo ); + m_xDoc->SetEndNoteInfo( aInfo ); } void SwHTMLParser::FillFootNoteInfo( const OUString& rContent ) { - SwFootnoteInfo aInfo( m_pDoc->GetFootnoteInfo() ); + SwFootnoteInfo aInfo( m_xDoc->GetFootnoteInfo() ); sal_Int32 nStrPos = lcl_html_getEndNoteInfo( aInfo, rContent, false ); @@ -177,7 +177,7 @@ void SwHTMLParser::FillFootNoteInfo( const OUString& rContent ) } } - m_pDoc->SetFootnoteInfo( aInfo ); + m_xDoc->SetFootnoteInfo( aInfo ); } void SwHTMLParser::InsertFootEndNote( const OUString& rName, bool bEndNote, @@ -204,7 +204,7 @@ void SwHTMLParser::FinishFootEndNote() if( m_pFootEndNoteImpl->bFixed ) aFootnote.SetNumStr( m_pFootEndNoteImpl->sContent ); - m_pDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, aFootnote ); + m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, aFootnote ); SwTextFootnote * const pTextFootnote = static_cast<SwTextFootnote *>( m_pPam->GetNode().GetTextNode()->GetTextAttrForCharAt( m_pPam->GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_FTN ) ); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 72078ba..c470b69 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -110,7 +110,7 @@ ImageMap *SwHTMLParser::FindImageMap( const OUString& rName ) const void SwHTMLParser::ConnectImageMaps() { - SwNodes& rNds = m_pDoc->GetNodes(); + SwNodes& rNds = m_xDoc->GetNodes(); // auf den Start-Node der 1. Section sal_uLong nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + 1; sal_uLong nEndIdx = rNds.GetEndOfAutotext().GetIndex(); @@ -291,7 +291,7 @@ void SwHTMLParser::RegisterFlyFrame( SwFrameFormat *pFlyFormat ) void SwHTMLParser::GetDefaultScriptType( ScriptType& rType, OUString& rTypeStr ) const { - SwDocShell *pDocSh = m_pDoc->GetDocShell(); + SwDocShell *pDocSh = m_xDoc->GetDocShell(); SvKeyValueIterator* pHeaderAttrs = pDocSh ? pDocSh->GetHeaderAttributes() : nullptr; rType = GetScriptType( pHeaderAttrs ); @@ -489,12 +489,12 @@ IMAGE_SETEVENT: nHeight = aPixelSize.Height(); } - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo ); - SfxItemSet aFrameSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs( aFrameSet ); @@ -516,7 +516,7 @@ IMAGE_SETEVENT: static_cast<const SwFormatINetFormat&>(m_aAttrTab.pINetFormat->GetItem()).GetValue(); m_pCSS1Parser->SetATagStyles(); - sal_uInt16 nPoolId = static_cast< sal_uInt16 >(m_pDoc->IsVisitedURL( rURL ) + sal_uInt16 nPoolId = static_cast< sal_uInt16 >(m_xDoc->IsVisitedURL( rURL ) ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL); const SwCharFormat *pCharFormat = m_pCSS1Parser->GetCharFormatFromPool( nPoolId ); @@ -527,7 +527,7 @@ IMAGE_SETEVENT: { const SvxColorItem& rColorItem = m_aAttrTab.pFontColor ? static_cast<const SvxColorItem &>(m_aAttrTab.pFontColor->GetItem()) : - static_cast<const SvxColorItem &>(m_pDoc->GetDefault(RES_CHRATR_COLOR)); + static_cast<const SvxColorItem &>(m_xDoc->GetDefault(RES_CHRATR_COLOR)); aHBorderLine.SetColor( rColorItem.GetValue() ); aVBorderLine.SetColor( aHBorderLine.GetColor() ); } @@ -723,9 +723,9 @@ IMAGE_SETEVENT: aFrameSet.Put( aFrameSize ); // passing empty sGrfNm here, means we don't want the graphic to be linked - SwFrameFormat *pFlyFormat = m_pDoc->getIDocumentContentOperations().Insert( *m_pPam, sGrfNm, aEmptyOUStr, &aGraphic, + SwFrameFormat *pFlyFormat = m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, sGrfNm, aEmptyOUStr, &aGraphic, &aFrameSet, nullptr, nullptr ); - SwGrfNode *pGrfNd = m_pDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() + SwGrfNode *pGrfNd = m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetGrfNode(); if( !sHTMLGrfName.isEmpty() ) @@ -827,7 +827,7 @@ IMAGE_SETEVENT: void SwHTMLParser::InsertBodyOptions() { - m_pDoc->SetTextFormatColl( *m_pPam, + m_xDoc->SetTextFormatColl( *m_pPam, m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_TEXT ) ); OUString aBackGround, aId, aStyle, aLang, aDir; @@ -971,7 +971,7 @@ void SwHTMLParser::InsertBodyOptions() if( !aStyle.isEmpty() || !aDir.isEmpty() ) { - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; OUString aDummy; ParseStyleOptions( aStyle, aDummy, aDummy, aItemSet, aPropInfo, nullptr, &aDir ); @@ -1046,7 +1046,7 @@ void SwHTMLParser::InsertBodyOptions() { SvxLanguageItem aLanguage( eLang, nWhich ); aLanguage.SetWhich( nWhich ); - m_pDoc->SetDefault( aLanguage ); + m_xDoc->SetDefault( aLanguage ); } } } @@ -1209,7 +1209,7 @@ ANCHOR_SETEVENT: // Styles parsen if( HasStyleOptions( aStyle, aId, aStrippedClass, &aLang, &aDir ) ) { - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) ) @@ -1310,7 +1310,7 @@ bool SwHTMLParser::HasCurrentParaBookmarks( bool bIgnoreStack ) const if( !bHasMarks ) { // second step: when we didn't find a bookmark, check if there is one set already - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess(); for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin(); ppMark != pMarkAccess->getAllMarksEnd(); ++ppMark) @@ -1345,7 +1345,7 @@ void SwHTMLParser::StripTrailingPara() { sal_uLong nNodeIdx = m_pPam->GetPoint()->nNode.GetIndex(); - const SwFrameFormats& rFrameFormatTable = *m_pDoc->GetSpzFrameFormats(); + const SwFrameFormats& rFrameFormatTable = *m_xDoc->GetSpzFrameFormats(); for( auto pFormat : rFrameFormatTable ) { @@ -1368,7 +1368,7 @@ void SwHTMLParser::StripTrailingPara() { // es wurden Felder in den Node eingefuegt, die muessen // wir jetzt verschieben - SwTextNode *pPrvNd = m_pDoc->GetNodes()[nNodeIdx-1]->GetTextNode(); + SwTextNode *pPrvNd = m_xDoc->GetNodes()[nNodeIdx-1]->GetTextNode(); if( pPrvNd ) { SwIndex aSrc( pCNd, 0 ); @@ -1377,7 +1377,7 @@ void SwHTMLParser::StripTrailingPara() } // jetz muessen wir noch eventuell vorhandene Bookmarks verschieben - IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = m_xDoc->getIDocumentMarkAccess(); for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin(); ppMark != pMarkAccess->getAllMarksEnd(); ++ppMark) @@ -1410,7 +1410,7 @@ void SwHTMLParser::StripTrailingPara() m_pPam->GetPoint()->nContent.Assign( nullptr, 0 ); m_pPam->SetMark(); m_pPam->DeleteMark(); - m_pDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode ); + m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode ); m_pPam->Move( fnMoveBackward, GoInNode ); } else if( pCNd && pCNd->IsTextNode() && m_pTable ) diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx index 5140ac2..1b2eb29 100644 --- a/sw/source/filter/html/htmlnumreader.cxx +++ b/sw/source/filter/html/htmlnumreader.cxx @@ -71,8 +71,8 @@ void SwHTMLParser::NewNumBulList( int nToken ) // ggf. ein Regelwerk anlegen if( !rInfo.GetNumRule() ) { - sal_uInt16 nPos = m_pDoc->MakeNumRule( m_pDoc->GetUniqueNumRuleName() ); - rInfo.SetNumRule( m_pDoc->GetNumRuleTable()[nPos] ); + sal_uInt16 nPos = m_xDoc->MakeNumRule( m_xDoc->GetUniqueNumRuleName() ); + rInfo.SetNumRule( m_xDoc->GetNumRuleTable()[nPos] ); } // das Format anpassen, falls es fuer den Level noch nicht @@ -261,7 +261,7 @@ void SwHTMLParser::NewNumBulList( int nToken ) // Styles parsen if( HasStyleOptions( aStyle, aId, aClass, &aLang, &aDir ) ) { - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) ) @@ -305,7 +305,7 @@ void SwHTMLParser::NewNumBulList( int nToken ) if( bChangeNumFormat ) { rInfo.GetNumRule()->Set( nLevel, aNumFormat ); - m_pDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); + m_xDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); bChangeNumFormat = false; } @@ -318,7 +318,7 @@ void SwHTMLParser::NewNumBulList( int nToken ) if( bChangeNumFormat ) { rInfo.GetNumRule()->Set( nLevel, aNumFormat ); - m_pDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); + m_xDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); } PushContext( pCntxt ); @@ -394,7 +394,7 @@ void SwHTMLParser::EndNumBulList( int nToken ) } } if( bChanged ) - m_pDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); + m_xDoc->ChgNumRuleFormats( *rInfo.GetNumRule() ); // Beim letzen Append wurde das NumRule-Item und das // NodeNum-Objekt mit kopiert. Beides muessen wir noch @@ -480,7 +480,7 @@ void SwHTMLParser::NewNumBulListItem( int nToken ) } else { - aNumRuleName = m_pDoc->GetUniqueNumRuleName(); + aNumRuleName = m_xDoc->GetUniqueNumRuleName(); SwNumRule aNumRule( aNumRuleName, SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); SwNumFormat aNumFormat( aNumRule.Get( 0 ) ); @@ -495,7 +495,7 @@ void SwHTMLParser::NewNumBulListItem( int nToken ) aNumFormat.SetFirstLineOffset( HTML_NUMBUL_INDENT ); aNumRule.Set( 0, aNumFormat ); - m_pDoc->MakeNumRule( aNumRuleName, &aNumRule ); + m_xDoc->MakeNumRule( aNumRuleName, &aNumRule ); OSL_ENSURE( !m_nOpenParaToken, "Jetzt geht ein offenes Absatz-Element verloren" ); @@ -531,7 +531,7 @@ void SwHTMLParser::NewNumBulListItem( int nToken ) // Styles parsen if( HasStyleOptions( aStyle, aId, aClass, &aLang, &aDir ) ) { - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo, &aLang, &aDir ) ) diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index ef67ba0..cfd6ec6 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -373,7 +373,7 @@ void SwHTMLParser::InsertEmbed() aCmdLst.Append( rOption.GetTokenString(), rOption.GetString() ); } - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo ); @@ -430,7 +430,7 @@ void SwHTMLParser::InsertEmbed() } } - SfxItemSet aFrameSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs( aFrameSet ); @@ -458,7 +458,7 @@ void SwHTMLParser::InsertEmbed() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_pDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); + m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); // Namen am FrameFormat setzen if( !aName.isEmpty() ) @@ -466,7 +466,7 @@ void SwHTMLParser::InsertEmbed() // den alternativen Text setzen SwNoTextNode *pNoTextNd = - m_pDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() + m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetNoTextNode(); pNoTextNd->SetTitle( aAlt ); @@ -494,7 +494,7 @@ void SwHTMLParser::NewObject() bDeclare = false; // Eine neue Command-List anlegen delete m_pAppletImpl; - m_pAppletImpl = new SwApplet_Impl( m_pDoc->GetAttrPool() ); + m_pAppletImpl = new SwApplet_Impl( m_xDoc->GetAttrPool() ); const HTMLOptions& rHTMLOptions = GetOptions(); for (size_t i = rHTMLOptions.size(); i; ) @@ -598,7 +598,7 @@ void SwHTMLParser::NewObject() m_pAppletImpl->SetAltText( aStandBy ); - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo ); @@ -629,13 +629,13 @@ void SwHTMLParser::EndObject() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_pDoc->getIDocumentContentOperations().Insert( *m_pPam, + m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ), &m_pAppletImpl->GetItemSet() ); // den alternativen Namen setzen SwNoTextNode *pNoTextNd = - m_pDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() + m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetNoTextNode(); pNoTextNd->SetTitle( m_pAppletImpl->GetAltText() ); @@ -662,7 +662,7 @@ void SwHTMLParser::InsertApplet() // Eine neue Command-List anlegen delete m_pAppletImpl; - m_pAppletImpl = new SwApplet_Impl( m_pDoc->GetAttrPool() ); + m_pAppletImpl = new SwApplet_Impl( m_xDoc->GetAttrPool() ); const HTMLOptions& rHTMLOptions = GetOptions(); for (size_t i = rHTMLOptions.size(); i; ) @@ -731,7 +731,7 @@ void SwHTMLParser::InsertApplet() m_pAppletImpl->CreateApplet( aCode, aName, bMayScript, aCodeBase, m_sBaseURL );//, aAlt ); m_pAppletImpl->SetAltText( aAlt ); - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo ); @@ -761,13 +761,13 @@ void SwHTMLParser::EndApplet() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_pDoc->getIDocumentContentOperations().Insert( *m_pPam, + m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ), &m_pAppletImpl->GetItemSet()); // den alternativen Namen setzen SwNoTextNode *pNoTextNd = - m_pDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() + m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetNoTextNode(); pNoTextNd->SetTitle( m_pAppletImpl->GetAltText() ); @@ -910,13 +910,13 @@ void SwHTMLParser::InsertFloatingFrame() { } - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) ParseStyleOptions( aStyle, aId, aClass, aItemSet, aPropInfo ); // den Itemset holen - SfxItemSet aFrameSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs( aFrameSet ); @@ -932,11 +932,11 @@ void SwHTMLParser::InsertFloatingFrame() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_pDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); + m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); // den alternativen Namen setzen SwNoTextNode *pNoTextNd = - m_pDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() + m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetNoTextNode(); pNoTextNd->SetTitle( aAlt ); diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index cbcfce1..04dbd80 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -115,7 +115,7 @@ void SwHTMLParser::NewDivision( int nToken ) HTMLAttrContext *pCntxt = new HTMLAttrContext( static_cast< sal_uInt16 >(nToken) ); bool bStyleParsed = false, bPositioned = false; - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass, &aLang, &aDir ) ) { @@ -176,14 +176,14 @@ void SwHTMLParser::NewDivision( int nToken ) if( bNew ) { - pCNd = m_pDoc->GetNodes()[rContentStIdx.GetIndex()+1] + pCNd = m_xDoc->GetNodes()[rContentStIdx.GetIndex()+1] ->GetContentNode(); } else { // Einen neuen Node zu Beginn der Section anlegen SwNodeIndex aSttIdx( rContentStIdx, 1 ); - pCNd = m_pDoc->GetNodes().MakeTextNode( aSttIdx, + pCNd = m_xDoc->GetNodes().MakeTextNode( aSttIdx, m_pCSS1Parser->GetTextCollFromPool(RES_POOLCOLL_TEXT)); // Den bisherigen Inhalt der Section loeschen @@ -194,14 +194,14 @@ void SwHTMLParser::NewDivision( int nToken ) static_cast<const SwStartNode *>( &rContentStIdx.GetNode() ); aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex() - 1; - m_pDoc->getIDocumentContentOperations().DelFullPara( aDelPam ); + m_xDoc->getIDocumentContentOperations().DelFullPara( aDelPam ); // Die Seitenvorlage aktualisieren - for( size_t i=0; i < m_pDoc->GetPageDescCnt(); i++ ) + for( size_t i=0; i < m_xDoc->GetPageDescCnt(); i++ ) { - if( RES_POOLPAGE_HTML == m_pDoc->GetPageDesc(i).GetPoolFormatId() ) + if( RES_POOLPAGE_HTML == m_xDoc->GetPageDesc(i).GetPoolFormatId() ) { - m_pDoc->ChgPageDesc( i, *pPageDesc ); + m_xDoc->ChgPageDesc( i, *pPageDesc ); break; } } @@ -225,7 +225,7 @@ void SwHTMLParser::NewDivision( int nToken ) if( pStartNdIdx ) { SwContentNode *pCNd = - m_pDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode(); + m_xDoc->GetNodes()[pStartNdIdx->GetIndex()+1]->GetContentNode(); SwNodeIndex aTmpSwNodeIndex = SwNodeIndex(*pCNd); SwPosition aNewPos( aTmpSwNodeIndex, SwIndex( pCNd, 0 ) ); SaveDocContext( pCntxt, HtmlContextFlags::MultiColMask, &aNewPos ); @@ -258,7 +258,7 @@ void SwHTMLParser::NewDivision( int nToken ) SetAttr( true, true, pPostIts ); // Namen der Section eindeutig machen - const OUString aName( m_pDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : nullptr ) ); + const OUString aName( m_xDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : nullptr ) ); if( !aHRef.isEmpty() ) { @@ -308,7 +308,7 @@ void SwHTMLParser::NewDivision( int nToken ) aSection.SetProtectFlag(true); } - SfxItemSet aFrameItemSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameItemSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs(aFrameItemSet ); @@ -327,7 +327,7 @@ void SwHTMLParser::NewDivision( int nToken ) aItemSet.ClearItem( RES_FRAMEDIR ); } - m_pDoc->InsertSwSection( *m_pPam, aSection, nullptr, &aFrameItemSet, false ); + m_xDoc->InsertSwSection( *m_pPam, aSection, nullptr, &aFrameItemSet, false ); // ggfs. einen Bereich anspringen if( JUMPTO_REGION == m_eJumpTo && aName == m_sJmpMark ) @@ -432,7 +432,7 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader, } sal_uInt16 nSpace = 0; - SwTextNode *pTextNode = m_pDoc->GetNodes()[nPrvNxtIdx]->GetTextNode(); + SwTextNode *pTextNode = m_xDoc->GetNodes()[nPrvNxtIdx]->GetTextNode(); if( pTextNode ) { const SvxULSpaceItem& rULSpace = @@ -464,7 +464,7 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader, nPrvNxtIdx = rContentStIdx.GetIndex() + 1; } - pTextNode = m_pDoc->GetNodes()[nPrvNxtIdx] + pTextNode = m_xDoc->GetNodes()[nPrvNxtIdx] ->GetTextNode(); if( pTextNode ) { @@ -500,7 +500,7 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader, bool SwHTMLParser::EndSection( bool bLFStripped ) { - SwEndNode *pEndNd = m_pDoc->GetNodes()[m_pPam->GetPoint()->nNode.GetIndex()+1] + SwEndNode *pEndNd = m_xDoc->GetNodes()[m_pPam->GetPoint()->nNode.GetIndex()+1] ->GetEndNode(); if( pEndNd && pEndNd->StartOfSectionNode()->IsSectionNode() ) { @@ -590,7 +590,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) // Parse style sheets, but don't position anything by now. bool bStyleParsed = false; - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; if( HasStyleOptions( aStyle, aId, aClass, &aLang, &aDir ) ) bStyleParsed = ParseStyleOptions( aStyle, aId, aClass, @@ -613,7 +613,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) bool bPositioned = false; if( bInCntnr || SwCSS1Parser::MayBePositioned( aPropInfo, true ) ) { - SfxItemSet aFrameItemSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameItemSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs(aFrameItemSet ); @@ -682,10 +682,10 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) SetAttr( true, true, pPostIts ); // Make section name unique. - OUString aName( m_pDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : nullptr ) ); + OUString aName( m_xDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : nullptr ) ); SwSectionData aSection( CONTENT_SECTION, aName ); - SfxItemSet aFrameItemSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameItemSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !IsNewDoc() ) Reader::ResetFrameFormatAttrs(aFrameItemSet ); @@ -715,7 +715,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss ) aFrameItemSet.Put( *pItem ); aItemSet.ClearItem( RES_FRAMEDIR ); } - m_pDoc->InsertSwSection( *m_pPam, aSection, nullptr, &aFrameItemSet, false ); + m_xDoc->InsertSwSection( *m_pPam, aSection, nullptr, &aFrameItemSet, false ); // Jump to section, if this is requested. if( JUMPTO_REGION == m_eJumpTo && aName == m_sJmpMark ) @@ -765,7 +765,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, static_cast<const SwFormatAnchor&>(rItemSet.Get( RES_ANCHOR )).GetAnchorId(); // Den Rahmen anlegen - SwFlyFrameFormat* pFlyFormat = m_pDoc->MakeFlySection( eAnchorId, m_pPam->GetPoint(), + SwFlyFrameFormat* pFlyFormat = m_xDoc->MakeFlySection( eAnchorId, m_pPam->GetPoint(), &rItemSet ); // Ggf. den Namen setzen if( !rName.isEmpty() ) @@ -775,7 +775,7 @@ void SwHTMLParser::InsertFlyFrame( const SfxItemSet& rItemSet, const SwFormatContent& rFlyContent = pFlyFormat->GetContent(); const SwNodeIndex& rFlyCntIdx = *rFlyContent.GetContentIdx(); - SwContentNode *pCNd = m_pDoc->GetNodes()[rFlyCntIdx.GetIndex()+1] + SwContentNode *pCNd = m_xDoc->GetNodes()[rFlyCntIdx.GetIndex()+1] ->GetContentNode(); SwPosition aNewPos( SwNodeIndex( rFlyCntIdx, 1 ), SwIndex( pCNd, 0 ) ); @@ -788,7 +788,7 @@ void SwHTMLParser::MovePageDescAttrs( SwNode *pSrcNd, bool bFormatBreak ) { SwContentNode* pDestContentNd = - m_pDoc->GetNodes()[nDestIdx]->GetContentNode(); + m_xDoc->GetNodes()[nDestIdx]->GetContentNode(); OSL_ENSURE( pDestContentNd, "Wieso ist das Ziel kein Content-Node?" ); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 3b3faa0..712e741 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2763,13 +2763,13 @@ const SwStartNode *SwHTMLParser::InsertTableSection else pNd = pPrevStNd->EndOfSectionNode(); SwNodeIndex nIdx( *pNd, 1 ); - pStNd = m_pDoc->GetNodes().MakeTextSection( nIdx, SwTableBoxStartNode, + pStNd = m_xDoc->GetNodes().MakeTextSection( nIdx, SwTableBoxStartNode, pColl ); m_pTable->IncBoxCount(); } //Added defaults to CJK and CTL - SwContentNode *pCNd = m_pDoc->GetNodes()[pStNd->GetIndex()+1] ->GetContentNode(); + SwContentNode *pCNd = m_xDoc->GetNodes()[pStNd->GetIndex()+1] ->GetContentNode(); SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE ); pCNd->SetAttr( aFontHeight ); SvxFontHeightItem aFontHeightCJK( 40, 100, RES_CHRATR_CJK_FONTSIZE ); @@ -2815,7 +2815,7 @@ const SwStartNode *SwHTMLParser::InsertTableSection( sal_uInt16 nPoolId ) } while( pOutTable && pTableNd->GetTable().GetHTMLTableLayout() ); } SwNodeIndex aIdx( *pTableNd->EndOfSectionNode() ); - pStNd = m_pDoc->GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode, + pStNd = m_xDoc->GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode, pColl ); m_pPam->GetPoint()->nNode = pStNd->GetIndex() + 1; @@ -2831,8 +2831,8 @@ SwStartNode *SwHTMLParser::InsertTempTableCaptionSection() { SwTextFormatColl *pColl = m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_TEXT ); SwNodeIndex& rIdx = m_pPam->GetPoint()->nNode; - rIdx = m_pDoc->GetNodes().GetEndOfExtras(); - SwStartNode *pStNd = m_pDoc->GetNodes().MakeTextSection( rIdx, + rIdx = m_xDoc->GetNodes().GetEndOfExtras(); + SwStartNode *pStNd = m_xDoc->GetNodes().MakeTextSection( rIdx, SwNormalStartNode, pColl ); rIdx = pStNd->GetIndex() + 1; @@ -2894,7 +2894,7 @@ SvxBrushItem* SwHTMLParser::CreateBrushItem( const Color *pColor, if( !rStyle.isEmpty() || !rId.isEmpty() || !rClass.isEmpty() ) { - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), RES_BACKGROUND, + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), RES_BACKGROUND, RES_BACKGROUND ); SvxCSS1PropertyInfo aPropInfo; @@ -3173,7 +3173,7 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable, LanguageType eLang; m_nValue = SfxHTMLParser::GetTableDataOptionsValNum( m_nNumFormat, eLang, aValue, aNumFormat, - *rParser.m_pDoc->GetNumberFormatter() ); + *rParser.m_xDoc->GetNumberFormatter() ); } // einen neuen Kontext anlegen, aber das drawing::Alignment-Attribut @@ -3197,7 +3197,7 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable, if( SwHTMLParser::HasStyleOptions( m_aStyle, m_aId, m_aClass, &m_aLang, &m_aDir ) ) { - SfxItemSet aItemSet( rParser.m_pDoc->GetAttrPool(), + SfxItemSet aItemSet( rParser.m_xDoc->GetAttrPool(), rParser.m_pCSS1Parser->GetWhichMap() ); SvxCSS1PropertyInfo aPropInfo; @@ -3429,7 +3429,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, 0 }; - SfxItemSet aItemSet( m_pDoc->GetAttrPool(), aWhichIds ); + SfxItemSet aItemSet( m_xDoc->GetAttrPool(), aWhichIds ); SvxCSS1PropertyInfo aPropInfo; bool bStyleParsed = ParseStyleOptions( pCurTable->GetStyle(), @@ -3507,7 +3507,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, if( !m_pPam->GetPoint()->nContent.GetIndex() ) { //Set default to CJK and CTL - m_pDoc->SetTextFormatColl( *m_pPam, + m_xDoc->SetTextFormatColl( *m_pPam, m_pCSS1Parser->GetTextCollFromPool(RES_POOLCOLL_STANDARD) ); SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE ); @@ -3610,7 +3610,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, { // Die Tabelle soll in einen Rahmen geschaufelt werden. - SfxItemSet aFrameSet( m_pDoc->GetAttrPool(), + SfxItemSet aFrameSet( m_xDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if( !pCurTable->IsNewDoc() ) Reader::ResetFrameFormatAttrs( aFrameSet ); @@ -3652,14 +3652,14 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, RndStdIds eAnchorId = static_cast<const SwFormatAnchor&>(aFrameSet. Get( RES_ANCHOR )). GetAnchorId(); - SwFrameFormat *pFrameFormat = m_pDoc->MakeFlySection( + SwFrameFormat *pFrameFormat = m_xDoc->MakeFlySection( eAnchorId, m_pPam->GetPoint(), &aFrameSet ); pTCntxt->SetFrameFormat( pFrameFormat ); const SwFormatContent& rFlyContent = pFrameFormat->GetContent(); m_pPam->GetPoint()->nNode = *rFlyContent.GetContentIdx(); SwContentNode *pCNd = - m_pDoc->GetNodes().GoNext( &(m_pPam->GetPoint()->nNode) ); + m_xDoc->GetNodes().GoNext( &(m_pPam->GetPoint()->nNode) ); m_pPam->GetPoint()->nContent.Assign( pCNd, 0 ); } @@ -3670,7 +3670,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, // gesetzt) OSL_ENSURE( !m_pPam->GetPoint()->nContent.GetIndex(), "Der Absatz hinter der Tabelle ist nicht leer!" ); - const SwTable* pSwTable = m_pDoc->InsertTable( + const SwTable* pSwTable = m_xDoc->InsertTable( SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), *m_pPam->GetPoint(), 1, 1, text::HoriOrientation::LEFT ); @@ -3678,7 +3678,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, { SwNodeIndex aDstIdx( m_pPam->GetPoint()->nNode ); m_pPam->Move( fnMoveBackward ); - m_pDoc->GetNodes().Delete( aDstIdx ); + m_xDoc->GetNodes().Delete( aDstIdx ); } else { @@ -4025,7 +4025,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, ? RES_POOLCOLL_TABLE_HDLN : RES_POOLCOLL_TABLE )); const SwEndNode *pEndNd = pStNd->EndOfSectionNode(); - SwContentNode *pCNd = m_pDoc->GetNodes()[pEndNd->GetIndex()-1] ->GetContentNode(); + SwContentNode *pCNd = m_xDoc->GetNodes()[pEndNd->GetIndex()-1] ->GetContentNode(); //Added defaults to CJK and CTL SvxFontHeightItem aFontHeight( 40, 100, RES_CHRATR_FONTSIZE ); pCNd->SetAttr( aFontHeight ); @@ -4040,7 +4040,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, if( pSaveStruct->IsInSection() ) { - pSaveStruct->CheckNoBreak( *m_pPam->GetPoint(), m_pDoc ); + pSaveStruct->CheckNoBreak( *m_pPam->GetPoint(), m_xDoc.get() ); // Alle noch offenen Kontexte beenden. Wir nehmen hier // AttrMin, weil nContxtStMin evtl. veraendert wurde. @@ -5290,7 +5290,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, pNd = pTableStNd->EndOfSectionNode(); SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); - m_pDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx, + m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx, SwMoveFlags::DEFAULT ); // Wenn die Caption vor der Tabelle eingefuegt wurde muss @@ -5308,13 +5308,13 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, // Die Section wird jetzt nicht mehr gebraucht. m_pPam->SetMark(); m_pPam->DeleteMark(); - m_pDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) ); + m_xDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) ); m_pTable->SetCaption( nullptr, false ); } // SwTable aufbereiten sal_uInt16 nBrowseWidth = (sal_uInt16)GetCurrentBrowseWidth(); - pSaveStruct->MakeTable( nBrowseWidth, *m_pPam->GetPoint(), m_pDoc ); + pSaveStruct->MakeTable( nBrowseWidth, *m_pPam->GetPoint(), m_xDoc.get() ); } GetNumInfo().Set( pTCntxt->GetNumInfo() ); @@ -5358,7 +5358,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, { m_pPam->SetMark(); m_pPam->DeleteMark(); - m_pDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) ); + m_xDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) ); pCurTable->SetCaption( nullptr, false ); } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6c927f4..b990071 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -247,7 +247,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_pCSS1Parser( nullptr ), m_pNumRuleInfo( new SwHTMLNumRuleInfo ), m_pPendStack( nullptr ), - m_pDoc( pD ), + m_xDoc( pD ), m_pActionViewShell( nullptr ), m_pSttNdIdx( nullptr ), m_pTable(nullptr), @@ -324,23 +324,23 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, //CJK has different defaults, so a different object should be used for this //RES_CHARTR_CJK_FONTSIZE is a valid value SvxFontHeightItem aFontHeight(m_aFontHeights[2], 100, RES_CHRATR_FONTSIZE); - m_pDoc->SetDefault( aFontHeight ); + m_xDoc->SetDefault( aFontHeight ); SvxFontHeightItem aFontHeightCJK(m_aFontHeights[2], 100, RES_CHRATR_CJK_FONTSIZE); - m_pDoc->SetDefault( aFontHeightCJK ); + m_xDoc->SetDefault( aFontHeightCJK ); SvxFontHeightItem aFontHeightCTL(m_aFontHeights[2], 100, RES_CHRATR_CTL_FONTSIZE); - m_pDoc->SetDefault( aFontHeightCTL ); + m_xDoc->SetDefault( aFontHeightCTL ); // #i18732# - adjust default of option 'FollowTextFlow' // TODO: not sure what the appropriate default for HTML should be? - m_pDoc->SetDefault( SwFormatFollowTextFlow(true) ); + m_xDoc->SetDefault( SwFormatFollowTextFlow(true) ); } // Waehrend des Imports in den HTML-Modus schalten, damit die // richrigen Vorlagen angelegt werden - m_bOldIsHTMLMode = m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); - m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true); + m_bOldIsHTMLMode = m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); + m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, true); - m_pCSS1Parser = new SwCSS1Parser( m_pDoc, m_aFontHeights, m_sBaseURL, IsNewDoc() ); + m_pCSS1Parser = new SwCSS1Parser( m_xDoc.get(), m_aFontHeights, m_sBaseURL, IsNewDoc() ); m_pCSS1Parser->SetIgnoreFontFamily( rHtmlOptions.IsIgnoreFontFamily() ); if( bReadUTF8 ) @@ -349,7 +349,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, } else { - SwDocShell *pDocSh = m_pDoc->GetDocShell(); + SwDocShell *pDocSh = m_xDoc->GetDocShell(); SvKeyValueIterator *pHeaderAttrs = pDocSh->GetHeaderAttributes(); if( pHeaderAttrs ) @@ -358,7 +358,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_pCSS1Parser->SetDfltEncoding( osl_getThreadTextEncoding() ); // Timer nur bei ganz normalen Dokumenten aufsetzen! - SwDocShell* pDocSh = m_pDoc->GetDocShell(); + SwDocShell* pDocSh = m_xDoc->GetDocShell(); if( pDocSh ) { m_bViewCreated = true; // nicht, synchron laden @@ -414,27 +414,27 @@ SwHTMLParser::~SwHTMLParser() #ifdef DBG_UTIL OSL_ENSURE( !m_nContinue, "DTOR im Continue!" ); #endif - bool bAsync = m_pDoc->IsInLoadAsynchron(); - m_pDoc->SetInLoadAsynchron( false ); - m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, m_bOldIsHTMLMode); + bool bAsync = m_xDoc->IsInLoadAsynchron(); + m_xDoc->SetInLoadAsynchron( false ); + m_xDoc->getIDocumentSettingAccess().set(DocumentSettingId::HTML_MODE, m_bOldIsHTMLMode); - if( m_pDoc->GetDocShell() && m_nEventId ) + if( m_xDoc->GetDocShell() && m_nEventId ) Application::RemoveUserEvent( m_nEventId ); // das DocumentDetected kann ggfs. die DocShells loeschen, darum nochmals // abfragen - if( m_pDoc->GetDocShell() ) + if( m_xDoc->GetDocShell() ) { // Gelinkte Bereiche updaten - sal_uInt16 nLinkMode = m_pDoc->getIDocumentSettingAccess().getLinkUpdateMode( true ); + sal_uInt16 nLinkMode = m_xDoc->getIDocumentSettingAccess().getLinkUpdateMode( true ); if( nLinkMode != NEVER && bAsync && - SfxObjectCreateMode::INTERNAL!=m_pDoc->GetDocShell()->GetCreateMode() ) - m_pDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( nLinkMode == MANUAL ); + SfxObjectCreateMode::INTERNAL!=m_xDoc->GetDocShell()->GetCreateMode() ) + m_xDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( nLinkMode == MANUAL ); - if ( m_pDoc->GetDocShell()->IsLoading() ) + if ( m_xDoc->GetDocShell()->IsLoading() ) { // #i59688# - m_pDoc->GetDocShell()->LoadingFinished(); + m_xDoc->GetDocShell()->LoadingFinished(); } } @@ -467,20 +467,15 @@ SwHTMLParser::~SwHTMLParser() delete pTmp; } - if( !m_pDoc->release() ) - { - // keiner will mehr das Doc haben, also weg damit - delete m_pDoc; - m_pDoc = nullptr; - } + m_xDoc.clear(); if ( m_pTempViewFrame ) { m_pTempViewFrame->DoClose(); // the temporary view frame is hidden, so the hidden flag might need to be removed - if ( m_bRemoveHidden && m_pDoc && m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->GetMedium() ) - m_pDoc->GetDocShell()->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN ); + if ( m_bRemoveHidden && m_xDoc.is() && m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->GetMedium() ) + m_xDoc->GetDocShell()->GetMedium()->GetItemSet()->ClearItem( SID_HIDDEN ); } } @@ -490,8 +485,8 @@ IMPL_LINK_NOARG( SwHTMLParser, AsyncCallback, void*, void ) // #i47907# - If the document has already been destructed, // the parser should be aware of this: - if( ( m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->IsAbortingImport() ) - || 1 == m_pDoc->getReferenceCount() ) + if( ( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() ) + || 1 == m_xDoc->getReferenceCount() ) { // wurde der Import vom SFX abgebrochen? eState = SVPAR_ERROR; @@ -503,15 +498,15 @@ IMPL_LINK_NOARG( SwHTMLParser, AsyncCallback, void*, void ) SvParserState SwHTMLParser::CallParser() { // einen temporaeren Index anlegen, auf Pos 0 so wird er nicht bewegt! - m_pSttNdIdx = new SwNodeIndex( m_pDoc->GetNodes() ); + m_pSttNdIdx = new SwNodeIndex( m_xDoc->GetNodes() ); if( !IsNewDoc() ) // in ein Dokument einfuegen ? { const SwPosition* pPos = m_pPam->GetPoint(); - m_pDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); + m_xDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); *m_pSttNdIdx = pPos->nNode.GetIndex()-1; - m_pDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); + m_xDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); SwPaM aInsertionRangePam( *pPos ); @@ -521,9 +516,9 @@ SvParserState SwHTMLParser::CallParser() aInsertionRangePam.SetMark(); *aInsertionRangePam.GetPoint() = *m_pPam->GetPoint(); aInsertionRangePam.Move( fnMoveBackward ); - m_pDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam ); + m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam ); - m_pDoc->SetTextFormatColl( *m_pPam, + m_xDoc->SetTextFormatColl( *m_pPam, m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_STANDARD )); } @@ -546,12 +541,12 @@ SvParserState SwHTMLParser::CallParser() rInput.Seek(STREAM_SEEK_TO_END); rInput.ResetError(); ::StartProgress( STR_STATSTR_W4WREAD, 0, rInput.Tell(), - m_pDoc->GetDocShell() ); + m_xDoc->GetDocShell() ); rInput.Seek(STREAM_SEEK_TO_BEGIN); rInput.ResetError(); } - m_pDoc->GetPageDesc( 0 ).Add( this ); + m_xDoc->GetPageDesc( 0 ).Add( this ); SvParserState eRet = HTMLParser::CallParser(); return eRet; @@ -569,7 +564,7 @@ void SwHTMLParser::Continue( int nToken ) // aufgeraeumt wird. OSL_ENSURE( SVPAR_ERROR!=eState, "SwHTMLParser::Continue: bereits ein Fehler gesetzt" ); - if( m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->IsAbortingImport() ) + if( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() ) eState = SVPAR_ERROR; // Die SwViewShell vom Dokument holen, merken und als aktuelle setzen. @@ -583,7 +578,7 @@ void SwHTMLParser::Continue( int nToken ) // gelesen und ein SaveState(0) gerufen. eState = SVPAR_PENDING; m_bViewCreated = true; - m_pDoc->SetInLoadAsynchron( true ); + m_xDoc->SetInLoadAsynchron( true ); #ifdef DBG_UTIL m_nContinue--; @@ -593,22 +588,22 @@ void SwHTMLParser::Continue( int nToken ) } m_bSetModEnabled = false; - if( m_pDoc->GetDocShell() ) + if( m_xDoc->GetDocShell() ) { - m_bSetModEnabled = m_pDoc->GetDocShell()->IsEnableSetModified(); + m_bSetModEnabled = m_xDoc->GetDocShell()->IsEnableSetModified(); if( m_bSetModEnabled ) { - m_pDoc->GetDocShell()->EnableSetModified( false ); + m_xDoc->GetDocShell()->EnableSetModified( false ); } } // waehrend des einlesens kein OLE-Modified rufen - Link<bool,void> aOLELink( m_pDoc->GetOle2Link() ); - m_pDoc->SetOle2Link( Link<bool,void>() ); + Link<bool,void> aOLELink( m_xDoc->GetOle2Link() ); + m_xDoc->SetOle2Link( Link<bool,void>() ); - bool bModified = m_pDoc->getIDocumentState().IsModified(); - bool const bWasUndo = m_pDoc->GetIDocumentUndoRedo().DoesUndo(); - m_pDoc->GetIDocumentUndoRedo().DoUndo(false); + bool bModified = m_xDoc->getIDocumentState().IsModified(); + bool const bWasUndo = m_xDoc->GetIDocumentUndoRedo().DoesUndo(); + m_xDoc->GetIDocumentUndoRedo().DoUndo(false); // Wenn der Import abgebrochen wird, kein Continue mehr rufen. // Falls ein Pending-Stack existiert aber durch einen Aufruf @@ -629,7 +624,7 @@ void SwHTMLParser::Continue( int nToken ) } // Laufbalken wieder abschalten - EndProgress( m_pDoc->GetDocShell() ); + EndProgress( m_xDoc->GetDocShell() ); bool bLFStripped = false; if( SVPAR_PENDING != GetStatus() ) @@ -639,7 +634,7 @@ void SwHTMLParser::Continue( int nToken ) if( !m_aScriptSource.isEmpty() ) { SwScriptFieldType *pType = - static_cast<SwScriptFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); + static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); SwScriptField aField( pType, m_aScriptType, m_aScriptSource, false ); @@ -750,7 +745,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) if( IsNewDoc() ) { - const SwNode *pPrev = m_pDoc->GetNodes()[nNodeIdx -1]; + const SwNode *pPrev = m_xDoc->GetNodes()[nNodeIdx -1]; if( !m_pPam->GetPoint()->nContent.GetIndex() && ( pPrev->IsContentNode() || (pPrev->IsEndNode() && @@ -774,11 +769,11 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) } m_pPam->GetBound().nContent.Assign( nullptr, 0 ); m_pPam->GetBound(false).nContent.Assign( nullptr, 0 ); - m_pDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode ); + m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode ); } } } - else if( nullptr != ( pAktNd = m_pDoc->GetNodes()[ nNodeIdx ]->GetTextNode()) && !bHasFlysOrMarks ) + else if( nullptr != ( pAktNd = m_xDoc->GetNodes()[ nNodeIdx ]->GetTextNode()) && !bHasFlysOrMarks ) { if( pAktNd->CanJoinNext( &pPos->nNode )) { @@ -791,7 +786,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) { pPos->nContent.Assign( nullptr, 0 ); m_pPam->SetMark(); m_pPam->DeleteMark(); - m_pDoc->GetNodes().Delete( pPos->nNode ); + m_xDoc->GetNodes().Delete( pPos->nNode ); m_pPam->Move( fnMoveBackward ); } } @@ -833,7 +828,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) // adjust AutoLoad in DocumentProperties if( IsNewDoc() ) { - SwDocShell *pDocShell(m_pDoc->GetDocShell()); + SwDocShell *pDocShell(m_xDoc->GetDocShell()); OSL_ENSURE(pDocShell, "no SwDocShell"); if (pDocShell) { uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -851,7 +846,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) if( m_bUpdateDocStat ) { - m_pDoc->getIDocumentStatistics().UpdateDocStat( false, true ); + m_xDoc->getIDocumentStatistics().UpdateDocStat( false, true ); } } @@ -863,12 +858,12 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) // sollte der Parser der Letzte sein, der das Doc haelt, dann braucht // man hier auch nichts mehr tun, Doc wird gleich zerstoert! - if( 1 < m_pDoc->getReferenceCount() ) + if( 1 < m_xDoc->getReferenceCount() ) { if( bWasUndo ) { - m_pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); - m_pDoc->GetIDocumentUndoRedo().DoUndo(true); + m_xDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + m_xDoc->GetIDocumentUndoRedo().DoUndo(true); } else if( !pInitVSh ) { @@ -879,16 +874,16 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) SwViewShell *pTmpVSh = CheckActionViewShell(); if( pTmpVSh ) { - m_pDoc->GetIDocumentUndoRedo().DoUndo(true); + m_xDoc->GetIDocumentUndoRedo().DoUndo(true); } } - m_pDoc->SetOle2Link( aOLELink ); + m_xDoc->SetOle2Link( aOLELink ); if( !bModified ) - m_pDoc->getIDocumentState().ResetModified(); - if( m_bSetModEnabled && m_pDoc->GetDocShell() ) + m_xDoc->getIDocumentState().ResetModified(); + if( m_bSetModEnabled && m_xDoc->GetDocShell() ) { - m_pDoc->GetDocShell()->EnableSetModified(); + m_xDoc->GetDocShell()->EnableSetModified(); m_bSetModEnabled = false; // this is unnecessary here } } @@ -930,7 +925,7 @@ void SwHTMLParser::DocumentDetected() CallEndAction( true ); - m_pDoc->GetIDocumentUndoRedo().DoUndo(false); + m_xDoc->GetIDocumentUndoRedo().DoUndo(false); // Durch das DocumentDetected wurde im allgemeinen eine // SwViewShell angelegt. Es kann aber auch sein, dass sie // erst spaeter angelegt wird, naemlich dann, wenn die UI @@ -942,15 +937,15 @@ void SwHTMLParser::DocumentDetected() // is called for every token that is recognised in CallParser void SwHTMLParser::NextToken( int nToken ) { - if( ( m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->IsAbortingImport() ) - || 1 == m_pDoc->getReferenceCount() ) + if( ( m_xDoc->GetDocShell() && m_xDoc->GetDocShell()->IsAbortingImport() ) + || 1 == m_xDoc->getReferenceCount() ) { // Was the import cancelled by SFX? If a pending stack ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits