summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-09 15:14:44 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-10 16:17:10 +0200
commite292ef25c6a4ab4766db6a871d402c52f2b9fd71 (patch)
tree8dd026e69bc82dfbe5009a838cd745ff3b2f49d5
parent64a5d65f4c6226d8e98d2f33bf86f748d4ac9280 (diff)
Make NotifyDocumentEvent use SdDrawDocument& instead of ptr
Change-Id: I00f83da44d2f07fe570f9ce6c0f506e4204a5ef9 Reviewed-on: https://gerrit.libreoffice.org/52633 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
-rw-r--r--sc/source/ui/view/viewfun7.cxx2
-rw-r--r--sd/inc/notifydocumentevent.hxx4
-rw-r--r--sd/source/core/annotations/Annotation.cxx7
-rw-r--r--sd/source/core/sdpage2.cxx8
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx8
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx21
7 files changed, 28 insertions, 24 deletions
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index cfbd4bed996f..36e9df26a0bd 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -194,8 +194,6 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
else
{
bPasteIsMove = false; // no internal move happened
- // TTTT hide all non-direct SdrView constr to disable construct
- // in-between classes in one of the next steps (!)
SdrView aView(*pModel); // #i71529# never create a base class of SdrView directly!
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
diff --git a/sd/inc/notifydocumentevent.hxx b/sd/inc/notifydocumentevent.hxx
index c16f16c13e5b..db838fd4de55 100644
--- a/sd/inc/notifydocumentevent.hxx
+++ b/sd/inc/notifydocumentevent.hxx
@@ -24,9 +24,9 @@
class SdDrawDocument;
-void NotifyDocumentEvent( SdDrawDocument const * pDocument, const OUString& rEventName );
+void NotifyDocumentEvent( SdDrawDocument& rDocument, const OUString& rEventName );
-void NotifyDocumentEvent( SdDrawDocument const * pDocument, const OUString& rEventName, const css::uno::Reference< css::uno::XInterface >& xSource );
+void NotifyDocumentEvent( SdDrawDocument& rDocument, const OUString& rEventName, const css::uno::Reference< css::uno::XInterface >& xSource );
#endif
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 38c6db785f46..6ac1ac4c2815 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -349,7 +349,7 @@ void SAL_CALL Annotation::setDateTime(const util::DateTime & the_value)
void Annotation::createChangeUndo()
{
- SdrModel* pModel = GetModel();
+ SdrModel* pModel = GetModel(); // TTTT should use reference
if( pModel && pModel->IsUndoEnabled() )
pModel->AddUndo( new UndoAnnotation( *this ) );
@@ -357,7 +357,10 @@ void Annotation::createChangeUndo()
{
pModel->SetChanged();
Reference< XInterface > xSource( static_cast<uno::XWeak*>( this ) );
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationChanged" , xSource );
+ NotifyDocumentEvent(
+ static_cast< SdDrawDocument& >( *pModel ),
+ "OnAnnotationChanged" ,
+ xSource );
}
}
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 3b6e42fd7b95..bb46eb4bc148 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -578,9 +578,8 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn
SetChanged();
getSdrModelFromSdrPage().SetChanged();
- // TTTT NotifyDocumentEvent should be reference
NotifyDocumentEvent(
- static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()),
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()),
"OnAnnotationInserted",
Reference<XInterface>(xAnnotation, UNO_QUERY));
}
@@ -599,7 +598,10 @@ void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
maAnnotations.erase( iter );
getSdrModelFromSdrPage().SetChanged();
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( &getSdrModelFromSdrPage() ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
+ NotifyDocumentEvent(
+ static_cast< SdDrawDocument& >( getSdrModelFromSdrPage() ),
+ "OnAnnotationRemoved",
+ Reference<XInterface>( xAnnotation, UNO_QUERY ) );
}
void SdPage::dumpAsXml(xmlTextWriterPtr pWriter) const
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 0baaa22eda96..04b708bfcc22 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -137,7 +137,7 @@ public:
SdXImpressDocument(SdDrawDocument* pDoc, bool bClipBoard);
virtual ~SdXImpressDocument() throw() override;
- static rtl::Reference< SdXImpressDocument > GetModel( SdDrawDocument const * pDoc );
+ static rtl::Reference< SdXImpressDocument > GetModel( SdDrawDocument& rDoc );
// intern
bool operator==( const SdXImpressDocument& rModel ) const { return mpDoc == rModel.mpDoc; }
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index d30256f48a10..aade2af55ce0 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -557,7 +557,9 @@ void SAL_CALL SlideshowImpl::disposing()
RemoteServer::presentationStopped();
#endif
if( mxShow.is() && mpDoc )
- NotifyDocumentEvent( mpDoc, "OnEndPresentation" );
+ NotifyDocumentEvent(
+ *mpDoc,
+ "OnEndPresentation" );
if( mbAutoSaveWasOn )
setAutoSaveState( true );
@@ -1077,7 +1079,9 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp
mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
mxListenerProxy->addAsSlideShowListener();
- NotifyDocumentEvent( mpDoc, "OnStartPresentation");
+ NotifyDocumentEvent(
+ *mpDoc,
+ "OnStartPresentation");
displaySlideIndex( mpSlideController->getStartSlideIndex() );
return true;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index dc53abb989b5..3e848923d05c 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -3468,26 +3468,23 @@ uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames()
return aSeq;
}
-rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument const * pDocument )
+rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument& rDocument )
{
rtl::Reference< SdXImpressDocument > xRet;
- if( pDocument )
+ ::sd::DrawDocShell* pDocShell(rDocument.GetDocSh());
+ if( pDocShell )
{
- ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh();
- if( pDocShell )
- {
- uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
+ uno::Reference<frame::XModel> xModel(pDocShell->GetModel());
- xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
- }
+ xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) );
}
return xRet;
}
-void NotifyDocumentEvent( SdDrawDocument const * pDocument, const OUString& rEventName )
+void NotifyDocumentEvent( SdDrawDocument& rDocument, const OUString& rEventName )
{
- rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( rDocument ) );
if( xModel.is() )
{
@@ -3497,9 +3494,9 @@ void NotifyDocumentEvent( SdDrawDocument const * pDocument, const OUString& rEve
}
}
-void NotifyDocumentEvent( SdDrawDocument const * pDocument, const OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
+void NotifyDocumentEvent( SdDrawDocument& rDocument, const OUString& rEventName, const uno::Reference< uno::XInterface >& xSource )
{
- rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) );
+ rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( rDocument ) );
if( xModel.is() )
{