21 #include <com/sun/star/awt/XControlModel.hpp>
22 #include <com/sun/star/embed/XClassifiedObject.hpp>
23 #include <com/sun/star/embed/XEmbeddedObject.hpp>
24 #include <com/sun/star/form/XFormsSupplier.hpp>
25 #include <com/sun/star/script/XEventAttacherManager.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
53 using ::com::sun::star::uno::Any;
54 using ::com::sun::star::uno::Exception;
55 using ::com::sun::star::uno::Reference;
56 using ::com::sun::star::uno::Sequence;
57 using ::com::sun::star::uno::UNO_QUERY;
58 using ::com::sun::star::uno::UNO_QUERY_THROW;
59 using ::com::sun::star::container::XIndexAccess;
60 using ::com::sun::star::embed::XClassifiedObject;
61 using ::com::sun::star::drawing::XShape;
62 using ::com::sun::star::awt::XControlModel;
63 using ::com::sun::star::beans::XPropertySet;
64 using ::com::sun::star::uno::Any;
65 using ::com::sun::star::form::XFormsSupplier;
66 using ::com::sun::star::io::XOutputStream;
67 using ::com::sun::star::script::ScriptEventDescriptor;
68 using ::com::sun::star::script::XEventAttacherManager;
83 mxPicStrm->SetEndian( SvStreamEndian::LITTLE );
92 pCurrXclObj( nullptr ),
94 pAdditionalText( nullptr ),
97 mbIsRootDff( pParent == nullptr )
104 OSL_ENSURE(
aStack.empty(),
"~XclEscherEx: stack not empty" );
166 bool lcl_IsFontwork(
const SdrObject* pObj )
168 bool bIsFontwork =
false;
171 const OUString aTextPath =
"TextPath";
175 *pAny >>= bIsFontwork;
199 sal_Int16 nMsCtlType = 0;
213 Reference < XClassifiedObject > xObj( static_cast<SdrOle2Obj*>(pObj)->GetObjRef() );
238 aAny = xPropSet->getPropertyValue(
"ControlTypeinMSO");
243 SAL_WARN(
"sc",
"XclEscherEx::StartShape, this control can't get the property ControlTypeinMSO!");
245 if( nMsCtlType == 2 )
320 aAny = xPropSet->getPropertyValue(
"ObjIDinMSO");
324 SAL_WARN(
"sc",
"XclEscherEx::StartShape, this control can't get the property ObjIDinMSO!");
326 sal_uInt16 nObjIDinMSO = 0xFFFF;
327 aAny >>= nObjIDinMSO;
328 if( nObjIDinMSO != 0xFFFF && nMsCtlType == 2)
351 OSL_ENSURE( pLastObj.get() ==
pCurrXclObj,
"XclEscherEx::EndShape - wrong object" );
396 Flush( static_cast< XclEscherExGlobal& >( *mxGlobal ).GetPictureStream() );
404 ::std::unique_ptr< XclExpOcxControlObj > xOcxCtrl;
407 if( xCtrlModel.is() )
415 sal_uInt32 nStrmStart =
static_cast< sal_uInt32
>(
mxCtlsStrm->Tell() );
422 sal_uInt32 nStrmSize =
static_cast< sal_uInt32
>(
mxCtlsStrm->Tell() - nStrmStart );
424 aClassName =
"Forms." + aClassName +
".1";
450 if( !(xCtrlModel.is() &&
GetDocShell() && pSdrPage) )
455 Reference< XFormsSupplier > xFormsSupplier( pSdrPage->
getUnoPage(), UNO_QUERY_THROW );
456 Reference< XIndexAccess > xFormsIA( xFormsSupplier->getForms(), UNO_QUERY_THROW );
460 Reference< XIndexAccess > xFormIA;
461 sal_Int32 nFoundIdx = -1;
464 for( sal_Int32 nFormIdx = 0, nFormCount = xFormsIA->getCount();
465 (nFoundIdx < 0) && (nFormIdx < nFormCount); ++nFormIdx )
468 if( xFormIA.set( xFormsIA->getByIndex( nFormIdx ), UNO_QUERY ) )
471 for( sal_Int32 nCtrlIdx = 0, nCtrlCount = xFormIA->getCount();
472 (nFoundIdx < 0) && (nCtrlIdx < nCtrlCount); ++nCtrlIdx )
475 Reference< XControlModel > xCurrModel( xFormIA->getByIndex( nCtrlIdx ), UNO_QUERY );
476 if( xCtrlModel.get() == xCurrModel.get() )
477 nFoundIdx = nCtrlIdx;
484 if( xFormIA.is() && (nFoundIdx >= 0) )
486 Reference< XEventAttacherManager > xEventMgr( xFormIA, UNO_QUERY_THROW );
488 const Sequence< ScriptEventDescriptor > aEventSeq( xEventMgr->getScriptEvents( nFoundIdx ) );
489 for(
const auto& rEvent : aEventSeq )
553 sHyperLink = pInfo->GetHlink();
554 sMacro = pInfo->GetMacro();
556 if ( !sHyperLink.isEmpty() )
562 aUrlField.
SetURL( sHyperLink );
566 if ( !sHyperLink.isEmpty() || !sMacro.isEmpty() )
void InsertPersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
static void PopulateShapeInteractionInfo(const XclExpObjectManager &rObjMgr, const css::uno::Reference< css::drawing::XShape > &xShape, EscherExHostAppData &rHostAppData)
std::unique_ptr< XclEscherClientData > pTheClientData
bool IsOwnEscher() const
If set to true, this object has created its own escher data.
::std::unique_ptr< SvStream > mxPicStrm
const sal_uInt16 EXC_OBJTYPE_UNKNOWN
This class is used to export Excel record streams.
std::stack< std::pair< XclObj *, std::unique_ptr< XclEscherHostAppData > > > aStack
XclExpDffAnchorBase * CreateDffAnchor(const SdrObject &rSdrObj) const
Creates a new DFF client anchor object and calculates the anchor position of the passed object...
void SetEscherShapeTypeGroup()
sal_uLong GetStreamPos() const
const SdrTextObj & rTextObj
std::unique_ptr< XclObj > RemoveLastObj()
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
void SetText(const XclExpRoot &rRoot, const SdrTextObj &rObj)
actually writes ESCHER_ClientTextbox
Provides export of hyperlink data.
sal_uInt64 Seek(sal_uInt64 nPos)
std::shared_ptr< T > make_shared(Args &&...args)
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
virtual SdrObjKind GetObjIdentifier() const
void SetSdrObject(const SdrObject &rSdrObj)
Sets the anchor position and flags according to the passed SdrObject.
bool SetMacroLink(const css::script::ScriptEventDescriptor &rEvent)
Sets the name of a macro attached to this control.
static sal_uInt16 IsChart(const SvGlobalName &rName)
void SetFlags(const SdrObject &rSdrObj)
Sets the flags according to the passed SdrObject.
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rxShape, const tools::Rectangle *pChildAnchor) override
void SetEscherShapeType(sal_uInt16 nType)
XclEscherEx(const XclExpRoot &rRoot, XclExpObjectManager &rObjMgr, SvStream &rStrm, const XclEscherEx *pParent=nullptr)
Access to global data from other classes.
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
void Flush(SvStream *pPicStreamMergeBSE=nullptr)
XclEscherClientTextbox * pAdditionalText
Represents an OBJ record for an OCX form control.
sal_uInt32 GetDffFragmentSize(sal_uInt32 nFragmentKey)
Returns the size of the specified DFF stream fragment.
XclEscherExGlobal(const XclExpRoot &rRoot)
std::unique_ptr< XclExpTbxControlObj > CreateTBXCtrlObj(css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor)
The 'Ctls' stream.
void UpdateDffFragmentEnd()
Called after some data has been written to the DFF stream, to update the end position of the DFF frag...
std::unique_ptr< XclEscherHostAppData > pCurrAppData
sal_uInt16 nAdditionalText
sal_uInt32 GetPersistOffset(sal_uInt32 nKey)
void SetBaseURI(const OUString &rBaseURI)
virtual ~XclEscherEx() override
SVXCORE_DLLPUBLIC SdrObject * GetSdrObjectFromXShape(const css::uno::Reference< css::drawing::XShape > &xShape)
Base class for DFF client anchor atoms used in spreadsheets.
void ReplacePersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
XclExpObjectManager & mrObjMgr
static bool WriteOCXExcelKludgeStream(const css::uno::Reference< css::frame::XModel > &rxModel, const css::uno::Reference< css::io::XOutputStream > &xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size &rSize, OUString &rName)
std::unique_ptr< XclExpOcxControlObj > CreateOCXCtrlObj(css::uno::Reference< css::drawing::XShape > const &xShape, const tools::Rectangle *pChildAnchor)
Creates an OCX form control OBJ record from the passed form control.
void EndDocument()
Flush and merge PicStream into EscherStream.
Represents an OBJ record for a TBX form control.
virtual void EndShape(sal_uInt16 nShapeType, sal_uInt32 nShapeID) override
void ConvertTbxMacro(XclExpTbxControlObj &rTbxCtrlObj, css::uno::Reference< css::awt::XControlModel > const &xCtrlModel)
Tries to get the name of a Basic macro from a control.
void SetXclObj(XclObj *p)
ONLY for the AdditionalText mimic.
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
void WriteEmbeddedData(XclExpStream &rStrm)
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
virtual EscherExHostAppData * EnterAdditionalTextGroup() override
sal_uInt32 GetDffFragmentPos(sal_uInt32 nFragmentKey)
Returns the position of the specified DFF stream fragment.
void SetId(sal_uInt16 nId)
virtual void WriteData(EscherEx &rEx) const override
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
virtual OutlinerParaObject * GetOutlinerParaObject() const override
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
XclEscherClientTextbox(const XclExpRoot &rRoot, const SdrTextObj &rObj, XclObj *pObj)
virtual XclExpDffAnchorBase * CreateDffAnchor() const
Creates a new DFF client anchor object.
virtual void WriteData(EscherEx &rEx) const override
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
static XclExpShapeObj * CreateShapeObj(XclExpObjectManager &rObjMgr, const css::uno::Reference< css::drawing::XShape > &xShape, ScDocument *pDoc)
bool HasPendingDffData()
Returns true, if there is more data left in the DFF stream than owned by the last MSODRAWING record...
void SetInteractionInfo(InteractionInfo *p)
static bool IsNoteCaption(SdrObject *pObj)
Returns true, if the passed object is the caption of a cell note.
#define SAL_WARN(area, stream)
Reference< XModel > xModel
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
tools::SvRef< SotStorageStream > mxCtlsStrm
void SetURL(const OUString &rURL)
tools::SvRef< SotStorageStream > OpenStream(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName) const
Tries to open a new stream in the specified storage for reading or writing.
virtual SvStream * ImplQueryPictureStream() override
Override to create a new temporary file and return its stream.
SfxMedium & GetMedium() const
Returns the medium to import from.
sal_uInt16 AddObj(std::unique_ptr< XclObj > pObjRec)
SdrPage * GetSdrPage(SCTAB nScTab) const
Returns the drawing layer page of the passed sheet, if present.
sal_uInt32 InitNextDffFragment()
Called by MSODRAWING record constructors to initialize the DFF stream fragment they will own...
::std::unique_ptr< ::utl::TempFile > mxPicTempFile
#define ESCHER_ClientData
static css::uno::Reference< css::awt::XControlModel > GetControlModel(css::uno::Reference< css::drawing::XShape > const &xShape)
Returns the API control model from the passed API shape object.