summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-08 14:47:23 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-09 10:51:56 +0200
commit06d8e6264487e3084b583e5158d9b89f8480b3eb (patch)
treef26bdc003f656b8d5c944b3bc361da33816adb22
parentaa02205fc46ed53a0af18517c3cd4064d514f85f (diff)
Make getSdrModelFromUnoModel work with SdrModel&
Change-Id: Iea3af7db77ef778db7bbdf2c1b6b1b956fd57fec Reviewed-on: https://gerrit.libreoffice.org/52592 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
-rw-r--r--include/svx/unomod.hxx6
-rw-r--r--include/svx/unomodel.hxx2
-rw-r--r--reportdesign/inc/ReportDefinition.hxx2
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx5
-rw-r--r--sc/inc/docuno.hxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx4
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx5
-rw-r--r--svx/source/form/fmdmod.cxx5
-rw-r--r--svx/source/unodraw/unomod.cxx5
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
12 files changed, 25 insertions, 19 deletions
diff --git a/include/svx/unomod.hxx b/include/svx/unomod.hxx
index 04571c9071b2..f8ecfd6fc965 100644
--- a/include/svx/unomod.hxx
+++ b/include/svx/unomod.hxx
@@ -34,7 +34,11 @@ class SVX_DLLPUBLIC SvxUnoDrawMSFactory : public css::lang::XMultiServiceFactory
{
protected:
/** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const = 0; //TTTT make reference return
+ // Every App has a DrwingLayer as internal Tooling, thus ist is
+ // not too hard to asl a UnoModel to hand back a DrawingLayer Model in the
+ // form of an SdrModel. Thus, returning a reference and make usages
+ // safer and easier is justified.
+ virtual SdrModel& getSdrModelFromUnoModel() const = 0; //TTTT make reference return
public:
SvxUnoDrawMSFactory() throw() {};
diff --git a/include/svx/unomodel.hxx b/include/svx/unomodel.hxx
index e637e4486d2a..5d5e15a5bee8 100644
--- a/include/svx/unomodel.hxx
+++ b/include/svx/unomodel.hxx
@@ -56,7 +56,7 @@ private:
protected:
// SvxUnoDrawMSFactory
- virtual SdrModel* getSdrModelFromUnoModel() const override;
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
public:
SvxUnoDrawingModel( SdrModel* pDoc ) throw();
diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index 79c58c998600..bdcaeb8f2552 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -188,7 +188,7 @@ namespace reportdesign
protected:
/** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const override;
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
public:
//TTTT Needed? Or same as above?
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 11064f21d36e..82de0192902e 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -2020,9 +2020,10 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R
return pReportModel;
}
-SdrModel* OReportDefinition::getSdrModelFromUnoModel() const
+SdrModel& OReportDefinition::getSdrModelFromUnoModel() const
{
- return m_pImpl->m_pReportModel.get();
+ OSL_ENSURE(m_pImpl->m_pReportModel.get(), "No SdrModel in ReportDesign, should not happen");
+ return *m_pImpl->m_pReportModel.get();
}
uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 8c7382cd1050..bb99b2e07f59 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -125,7 +125,7 @@ protected:
const SfxItemPropertySet& GetPropertySet() const { return aPropSet; }
/** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const override;
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
public:
ScModelObj(ScDocShell* pDocSh);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ee46cd116c43..c0fcc48264e1 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -373,7 +373,7 @@ void ScModelObj::CreateAndSet(ScDocShell* pDocSh)
pDocSh->SetBaseModel( new ScModelObj(pDocSh) );
}
-SdrModel* ScModelObj::getSdrModelFromUnoModel() const
+SdrModel& ScModelObj::getSdrModelFromUnoModel() const
{
ScDocument& rDoc(pDocShell->GetDocument());
@@ -382,7 +382,7 @@ SdrModel* ScModelObj::getSdrModelFromUnoModel() const
rDoc.InitDrawLayer();
}
- return rDoc.GetDrawLayer();
+ return *rDoc.GetDrawLayer(); // TTTT should be reference
}
ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 381b22be955f..0baaa22eda96 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -130,7 +130,7 @@ private:
protected:
/** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const override;
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
public:
SdXImpressDocument(::sd::DrawDocShell* pShell, bool bClipBoard);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b6ee7d5d1122..dc53abb989b5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2714,9 +2714,10 @@ void SdXImpressDocument::initializeDocument()
}
}
-SdrModel* SdXImpressDocument::getSdrModelFromUnoModel() const
+SdrModel& SdXImpressDocument::getSdrModelFromUnoModel() const
{
- return GetDoc();
+ OSL_ENSURE(GetDoc(), "No SdrModel in draw/Impress, should not happen");
+ return *GetDoc(); // TTTT should be reference
}
void SAL_CALL SdXImpressDocument::dispose()
diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx
index ac197b2ff419..509d4c4ed5dc 100644
--- a/svx/source/form/fmdmod.cxx
+++ b/svx/source/form/fmdmod.cxx
@@ -39,9 +39,8 @@ using namespace ::svxform;
}
else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
{
- SdrModel* pTargetModel = getSdrModelFromUnoModel();
- OSL_ENSURE(pTargetModel, "Got no SdrModel for SdrShape construction (!)");
- SdrObject* pObj = new FmFormObj(*pTargetModel);
+ SdrModel& rTargetModel(getSdrModelFromUnoModel());
+ SdrObject* pObj = new FmFormObj(rTargetModel);
xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
}
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index dd1d1317f7a6..83f621ab6e8e 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -246,9 +246,10 @@ uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence
return aSeq;
}
-SdrModel* SvxUnoDrawingModel::getSdrModelFromUnoModel() const
+SdrModel& SvxUnoDrawingModel::getSdrModelFromUnoModel() const
{
- return mpDoc;
+ OSL_ENSURE(mpDoc, "No SdrModel in UnoDrawingModel, should not happen");
+ return *mpDoc;
}
SvxUnoDrawingModel::SvxUnoDrawingModel(SdrModel* pDoc) throw()
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index eb0964f922c6..3d1577d52d0f 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -201,7 +201,7 @@ private:
protected:
/** abstract SdrModel provider */
- virtual SdrModel* getSdrModelFromUnoModel() const override;
+ virtual SdrModel& getSdrModelFromUnoModel() const override;
virtual ~SwXTextDocument() override;
public:
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 3aa9a3cfa688..0b39cd08a47d 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -450,10 +450,10 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell)
{
}
-SdrModel* SwXTextDocument::getSdrModelFromUnoModel() const
+SdrModel& SwXTextDocument::getSdrModelFromUnoModel() const
{
OSL_ENSURE(pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel(), "No SdrModel in SwDoc, should not happen");
- return pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+ return *pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
}
SwXTextDocument::~SwXTextDocument()