LibreOffice Module sw (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sw::hack::DrawingOLEAdaptor Class Reference

Make inserting an OLE object into a Writer document easy. More...

#include <writerhelper.hxx>

Collaboration diagram for sw::hack::DrawingOLEAdaptor:
[legend]

Public Member Functions

 DrawingOLEAdaptor (SdrOle2Obj &rObj, SfxObjectShell &rPers)
 Take ownership of a SdrOle2Objs OLE object. More...
 
 ~DrawingOLEAdaptor ()
 Destructor will destroy the owned OLE object if not transferred. More...
 
bool TransferToDoc (OUString &rName)
 Transfer ownership of the OLE object to a document's SvPersist. More...
 

Private Member Functions

DrawingOLEAdaptoroperator= (const DrawingOLEAdaptor &)=delete
 
 DrawingOLEAdaptor (const DrawingOLEAdaptor &rDoc)=delete
 

Private Attributes

css::uno::Reference< css::embed::XEmbeddedObject > mxIPRef
 
SfxObjectShellmrPers
 
const GraphicmpGraphic
 

Detailed Description

Make inserting an OLE object into a Writer document easy.

The rest of Office uses SdrOle2Obj for their OLE objects, Writer doesn't, which makes things a bit difficult as this is the type of object that the escher import code shared by the MSOffice filters produces when it imports an OLE object.

This utility class takes ownership of the OLE object away from a SdrOle2Obj and can massage it into the condition best suited to insertion into Writer.

If the object was not transferred into Writer then it is deleted during destruction.

Definition at line 574 of file writerhelper.hxx.

Constructor & Destructor Documentation

◆ DrawingOLEAdaptor() [1/2]

sw::hack::DrawingOLEAdaptor::DrawingOLEAdaptor ( SdrOle2Obj rObj,
SfxObjectShell rPers 
)

Take ownership of a SdrOle2Objs OLE object.

Parameters
rObjThe SdrOle2Obj whose OLE object we want to take control of
rPersThe SvPersist of a SwDoc (SwDoc::GetPersist()) into which we may want to move the object, or remove it from if unwanted.

Definition at line 279 of file writerhelper.cxx.

References SdrOle2Obj::AbandonObject().

◆ ~DrawingOLEAdaptor()

sw::hack::DrawingOLEAdaptor::~DrawingOLEAdaptor ( )

Destructor will destroy the owned OLE object if not transferred.

Definition at line 312 of file writerhelper.cxx.

References SfxObjectShell::GetEmbeddedObjectContainer(), comphelper::EmbeddedObjectContainer::HasEmbeddedObject(), mrPers, and mxIPRef.

◆ DrawingOLEAdaptor() [2/2]

sw::hack::DrawingOLEAdaptor::DrawingOLEAdaptor ( const DrawingOLEAdaptor rDoc)
privatedelete

Member Function Documentation

◆ operator=()

DrawingOLEAdaptor & sw::hack::DrawingOLEAdaptor::operator= ( const DrawingOLEAdaptor )
privatedelete

◆ TransferToDoc()

bool sw::hack::DrawingOLEAdaptor::TransferToDoc ( OUString &  rName)

Transfer ownership of the OLE object to a document's SvPersist.

TransferToDoc moves the object into the persist under the name passed in. This name is then suitable to be used as an argument to SwDoc::InsertOLE.

The object is no longer owned by the adaptor after this call, subsequent calls are an error and return false.

Parameters
rNameThe name to store the object under in the document.
Returns
On success true is returned, otherwise false. On success rName is then suitable for user with SwDoc::InsertOLE

Definition at line 287 of file writerhelper.cxx.

References SfxObjectShell::GetEmbeddedObjectContainer(), SfxObjectShell::GetModel(), comphelper::EmbeddedObjectContainer::InsertEmbeddedObject(), mpGraphic, mrPers, mxIPRef, and svt::EmbeddedObjectRef::SetGraphicToContainer().

Referenced by SwWW8ImplReader::InsertOle().

Member Data Documentation

◆ mpGraphic

const Graphic* sw::hack::DrawingOLEAdaptor::mpGraphic
private

Definition at line 579 of file writerhelper.hxx.

Referenced by TransferToDoc().

◆ mrPers

SfxObjectShell& sw::hack::DrawingOLEAdaptor::mrPers
private

Definition at line 578 of file writerhelper.hxx.

Referenced by TransferToDoc(), and ~DrawingOLEAdaptor().

◆ mxIPRef

css::uno::Reference< css::embed::XEmbeddedObject > sw::hack::DrawingOLEAdaptor::mxIPRef
private

Definition at line 577 of file writerhelper.hxx.

Referenced by TransferToDoc(), and ~DrawingOLEAdaptor().


The documentation for this class was generated from the following files: