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 722 of file writerhelper.hxx.

Constructor & Destructor Documentation

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 291 of file writerhelper.cxx.

References SdrOle2Obj::AbandonObject().

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

Destructor will destroy the owned OLE object if not transferred.

Definition at line 324 of file writerhelper.cxx.

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

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

Member Function Documentation

DrawingOLEAdaptor& sw::hack::DrawingOLEAdaptor::operator= ( const DrawingOLEAdaptor )
privatedelete
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 299 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

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

Definition at line 727 of file writerhelper.hxx.

Referenced by TransferToDoc().

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

Definition at line 726 of file writerhelper.hxx.

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

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

Definition at line 725 of file writerhelper.hxx.

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


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