Kaydet (Commit) 06d8e626 authored tarafından Armin Le Grand's avatar Armin Le Grand

Make getSdrModelFromUnoModel work with SdrModel&

Change-Id: Iea3af7db77ef778db7bbdf2c1b6b1b956fd57fec
Reviewed-on: https://gerrit.libreoffice.org/52592Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst aa02205f
......@@ -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() {};
......
......@@ -56,7 +56,7 @@ private:
protected:
// SvxUnoDrawMSFactory
virtual SdrModel* getSdrModelFromUnoModel() const override;
virtual SdrModel& getSdrModelFromUnoModel() const override;
public:
SvxUnoDrawingModel( SdrModel* pDoc ) throw();
......
......@@ -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?
......
......@@ -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)
......
......@@ -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);
......
......@@ -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 ) :
......
......@@ -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);
......
......@@ -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()
......
......@@ -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)));
}
......
......@@ -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()
......
......@@ -201,7 +201,7 @@ private:
protected:
/** abstract SdrModel provider */
virtual SdrModel* getSdrModelFromUnoModel() const override;
virtual SdrModel& getSdrModelFromUnoModel() const override;
virtual ~SwXTextDocument() override;
public:
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment