diff options
Diffstat (limited to 'sc/source/filter/xcl97')
-rw-r--r-- | sc/source/filter/xcl97/makefile.mk | 5 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97esc.cxx | 201 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 114 |
3 files changed, 219 insertions, 101 deletions
diff --git a/sc/source/filter/xcl97/makefile.mk b/sc/source/filter/xcl97/makefile.mk index 48bb754c237a..a5194358179a 100644 --- a/sc/source/filter/xcl97/makefile.mk +++ b/sc/source/filter/xcl97/makefile.mk @@ -1,14 +1,14 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.16 $ +# $Revision: 1.16.88.1 $ # # This file is part of OpenOffice.org. # @@ -57,6 +57,7 @@ SLOFILES = \ $(SLO)$/XclExpChangeTrack.obj EXCEPTIONSFILES = \ + $(SLO)$/xcl97esc.obj \ $(SLO)$/xcl97rec.obj # --- Targets ------------------------------------------------------- diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 4e603bc99611..4be890dd3903 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xcl97esc.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.26.90.3 $ * * This file is part of OpenOffice.org. * @@ -31,12 +31,21 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" #include "xcl97esc.hxx" + +#include <com/sun/star/awt/XControlModel.hpp> +#include <com/sun/star/embed/XClassifiedObject.hpp> +#include <com/sun/star/form/XFormsSupplier.hpp> +#include <com/sun/star/script/ScriptEventDescriptor.hpp> +#include <com/sun/star/script/XEventAttacherManager.hpp> + +#include <svx/svdpage.hxx> #include <svx/outlobj.hxx> #include <svx/svdotext.hxx> #include <svx/svdobj.hxx> #include <svx/svdoole2.hxx> #include <svx/unoapi.hxx> #include <svx/fmglob.hxx> +#include <svx/msocximex.hxx> #include <vcl/outdev.hxx> #include <unotools/tempfile.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -52,17 +61,26 @@ #include "xcl97rec.hxx" #include "xehelper.hxx" #include "xechart.hxx" -#include <com/sun/star/embed/XClassifiedObject.hpp> -using namespace com::sun::star; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::embed::XClassifiedObject; +using ::com::sun::star::drawing::XShape; +using ::com::sun::star::awt::XControlModel; +using ::com::sun::star::form::XFormsSupplier; +using ::com::sun::star::script::ScriptEventDescriptor; +using ::com::sun::star::script::XEventAttacherManager; // --- class XclEscherEx --------------------------------------------- -XclEscherEx::XclEscherEx( SvStream& rStrm, UINT32 nDrawings, RootData& rRoot ) +XclEscherEx::XclEscherEx( const XclExpRoot& rRoot, SvStream& rStrm, UINT32 nDrawings ) : EscherEx( rStrm, nDrawings ), - aOcxConverter( *rRoot.pER ), - rRootData( rRoot ), + XclExpRoot( rRoot ), pPicTempFile( NULL ), pPicStrm( NULL ), pCurrXclObj( NULL ), @@ -164,8 +182,6 @@ sal_Bool ImplXclEscherExIsFontwork( const SdrObject* pObj ) EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape ) { - const XclExpRoot& rRoot = *rRootData.pER; - if ( nAdditionalText ) nAdditionalText++; BOOL bInGroup = ( pCurrXclObj != NULL ); @@ -182,7 +198,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen pCurrAppData = new XclEscherHostAppData; const SdrObject* pObj = GetSdrObject( rShape ); if ( !pObj ) - pCurrXclObj = new XclObjAny( rRoot ); // just what is it?!? + pCurrXclObj = new XclObjAny( GetRoot() ); // just what is it?!? else { pCurrXclObj = NULL; @@ -191,37 +207,37 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen if( nObjType == OBJ_OLE2 ) { //! not-const because GetObjRef may load the OLE object - uno::Reference < embed::XClassifiedObject > xObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY ); + Reference < XClassifiedObject > xObj( ((SdrOle2Obj*)pObj)->GetObjRef(), UNO_QUERY ); if ( xObj.is() ) { SvGlobalName aObjClsId( xObj->getClassID() ); if ( SotExchange::IsChart( aObjClsId ) ) { // yes, it's a chart diagram - rRootData.pObjRecs->Add( new XclExpChartObj( rRoot, rShape ) ); + GetOldRoot().pObjRecs->Add( new XclExpChartObj( GetRoot(), rShape ) ); pCurrXclObj = NULL; // no metafile or whatsoever } else // metafile and OLE object - pCurrXclObj = new XclObjOle( rRoot, *pObj ); + pCurrXclObj = new XclObjOle( GetRoot(), *pObj ); } else // just a metafile - pCurrXclObj = new XclObjAny( rRoot ); + pCurrXclObj = new XclObjAny( GetRoot() ); } else if( nObjType == OBJ_UNO ) { - pCurrXclObj = aOcxConverter.CreateCtrlObj( rShape ); + pCurrXclObj = CreateCtrlObj( rShape ); if( !pCurrXclObj ) - pCurrXclObj = new XclObjAny( rRoot ); // just a metafile + pCurrXclObj = new XclObjAny( GetRoot() ); // just a metafile } else if( pObj->GetLayer() != SC_LAYER_INTERN ) { // #107540# ignore permanent note shapes // #i12190# do not ignore callouts (do not filter by object type ID) - pCurrXclObj = new XclObjAny( rRoot ); // just a metafile + pCurrXclObj = new XclObjAny( GetRoot() ); // just a metafile } } if ( pCurrXclObj ) { - if ( !rRootData.pObjRecs->Add( pCurrXclObj ) ) + if ( !GetOldRoot().pObjRecs->Add( pCurrXclObj ) ) { // maximum count reached, object got deleted pCurrXclObj = NULL; } @@ -236,7 +252,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen { /* Create a dummy anchor carrying the flags. Real coordinates are calculated later in WriteData(EscherEx&,const Rectangle&). */ - XclExpEscherAnchor* pAnchor = new XclExpEscherAnchor( rRoot ); + XclExpDffAnchor* pAnchor = new XclExpDffAnchor( GetRoot() ); pAnchor->SetFlags( *pObj ); pCurrAppData->SetClientAnchor( pAnchor ); } @@ -246,14 +262,13 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen const OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); if( pParaObj ) pCurrAppData->SetClientTextbox( - new XclEscherClientTextbox( - rRootData, *pTextObj, pCurrXclObj ) ); + new XclEscherClientTextbox( GetRoot(), *pTextObj, pCurrXclObj ) ); } } else { if ( !bInGroup ) - pCurrAppData->SetClientAnchor( new XclExpEscherAnchor( rRoot ) ); + pCurrAppData->SetClientAnchor( new XclExpDffAnchor( GetRoot() ) ); } } else if ( nAdditionalText == 3 ) @@ -283,11 +298,11 @@ void XclEscherEx::EndShape( UINT16 nShapeType, UINT32 nShapeID ) // escher data of last shape not written? -> delete it from object list if( nShapeID == 0 ) { - XclObj* pLastObj = static_cast< XclObj* >( rRootData.pObjRecs->Last() ); + XclObj* pLastObj = static_cast< XclObj* >( GetOldRoot().pObjRecs->Last() ); DBG_ASSERT( pLastObj == pCurrXclObj, "XclEscherEx::EndShape - wrong object" ); if ( pLastObj == pCurrXclObj ) { - rRootData.pObjRecs->Remove(); + GetOldRoot().pObjRecs->Remove(); DELETEZ( pCurrXclObj ); } } @@ -340,16 +355,118 @@ void XclEscherEx::EndDocument() Flush( pPicStrm ); } +#if EXC_EXP_OCX_CTRL + +XclExpOcxControlObj* XclEscherEx::CreateCtrlObj( Reference< XShape > xShape ) +{ + ::std::auto_ptr< XclExpOcxControlObj > xOcxCtrl; + + Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape ); + if( xCtrlModel.is() ) + { + // output stream + if( !mxCtlsStrm.Is() ) + mxCtlsStrm = OpenStream( EXC_STREAM_CTLS ); + if( mxCtlsStrm.Is() ) + { + String aClassName; + sal_uInt32 nStrmStart = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() ); + + // writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName + if( SvxMSConvertOCXControls::WriteOCXExcelKludgeStream( mxCtlsStrm, xCtrlModel, xShape->getSize(), aClassName ) ) + { + sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart ); + // adjust the class name to "Forms.***.1" + aClassName.InsertAscii( "Forms.", 0 ).AppendAscii( ".1" ); + xOcxCtrl.reset( new XclExpOcxControlObj( GetRoot(), xShape, aClassName, nStrmStart, nStrmSize ) ); + } + } + } + return xOcxCtrl.release(); +} + +#else + +XclExpTbxControlObj* XclEscherEx::CreateCtrlObj( Reference< XShape > xShape ) +{ + ::std::auto_ptr< XclExpTbxControlObj > xTbxCtrl( new XclExpTbxControlObj( GetRoot(), xShape ) ); + if( xTbxCtrl->GetObjType() == EXC_OBJTYPE_UNKNOWN ) + xTbxCtrl.reset(); + + if( xTbxCtrl.get() ) + { + // find attached macro + Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( xShape ); + ConvertTbxMacro( *xTbxCtrl, xCtrlModel ); + } + return xTbxCtrl.release(); +} + +void XclEscherEx::ConvertTbxMacro( XclExpTbxControlObj& rTbxCtrlObj, Reference< XControlModel > xCtrlModel ) +{ + SdrPage* pSdrPage = GetSdrPage( GetCurrScTab() ); + if( xCtrlModel.is() && GetDocShell() && pSdrPage ) try + { + Reference< XFormsSupplier > xFormsSupplier( pSdrPage->getUnoPage(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xFormsIA( xFormsSupplier->getForms(), UNO_QUERY_THROW ); + + // 1) try to find the index of the processed control in the form + + Reference< XIndexAccess > xFormIA; // needed in step 2) below + sal_Int32 nFoundIdx = -1; + + // search all existing forms in the draw page + for( sal_Int32 nFormIdx = 0, nFormCount = xFormsIA->getCount(); + (nFoundIdx < 0) && (nFormIdx < nFormCount); ++nFormIdx ) + { + // get the XIndexAccess interface of the form with index nFormIdx + if( xFormIA.set( xFormsIA->getByIndex( nFormIdx ), UNO_QUERY ) ) + { + // search all elements (controls) of the current form by index + for( sal_Int32 nCtrlIdx = 0, nCtrlCount = xFormIA->getCount(); + (nFoundIdx < 0) && (nCtrlIdx < nCtrlCount); ++nCtrlIdx ) + { + // compare implementation pointers of the control models + Reference< XControlModel > xCurrModel( xFormIA->getByIndex( nCtrlIdx ), UNO_QUERY ); + if( xCtrlModel.get() == xCurrModel.get() ) + nFoundIdx = nCtrlIdx; + } + } + } + + // 2) try to find an attached macro + + if( xFormIA.is() && (nFoundIdx >= 0) ) + { + Reference< XEventAttacherManager > xEventMgr( xFormIA, UNO_QUERY_THROW ); + // loop over all events attached to the found control + const Sequence< ScriptEventDescriptor > aEventSeq( xEventMgr->getScriptEvents( nFoundIdx ) ); + bool bFound = false; + for( sal_Int32 nEventIdx = 0, nEventCount = aEventSeq.getLength(); + !bFound && (nEventIdx < nEventCount); ++nEventIdx ) + { + // try to set the event data at the Excel control object, returns true on success + bFound = rTbxCtrlObj.SetMacroLink( aEventSeq[ nEventIdx ] ); + } + } + } + catch( Exception& ) + { + } +} + +#endif // --- class XclEscher ----------------------------------------------- -XclEscher::XclEscher( UINT32 nDrawings, RootData& rRoot ) +XclEscher::XclEscher( const XclExpRoot& rRoot, UINT32 nDrawings ) : + XclExpRoot( rRoot ) { pTempFile = new utl::TempFile; pTempFile->EnableKillingFile(); pStrm = utl::UcbStreamHelper::CreateStream( pTempFile->GetURL(), STREAM_STD_READWRITE ); pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - pEx = new XclEscherEx( *pStrm, nDrawings, rRoot ); + pEx = new XclEscherEx( rRoot, *pStrm, nDrawings ); } @@ -361,9 +478,9 @@ XclEscher::~XclEscher() } -void XclEscher::AddSdrPage( const XclExpRoot& rRoot ) +void XclEscher::AddSdrPage() { - if( SdrPage* pPage = rRoot.GetSdrPage( rRoot.GetCurrScTab() ) ) + if( SdrPage* pPage = GetSdrPage( GetCurrScTab() ) ) pEx->AddSdrPage( *pPage ); // #106213# the first dummy object may still be open DBG_ASSERT( pEx->GetGroupLevel() <= 1, "XclEscher::AddSdrPage - still groups open?" ); @@ -374,14 +491,14 @@ void XclEscher::AddSdrPage( const XclExpRoot& rRoot ) // Escher client anchor ======================================================= -XclExpEscherAnchor::XclExpEscherAnchor( const XclExpRoot& rRoot, sal_uInt16 nFlags ) : +XclExpDffAnchor::XclExpDffAnchor( const XclExpRoot& rRoot, sal_uInt16 nFlags ) : XclExpRoot( rRoot ), maAnchor( rRoot.GetCurrScTab() ), mnFlags( nFlags ) { } -XclExpEscherAnchor::XclExpEscherAnchor( const XclExpRoot& rRoot, const SdrObject& rSdrObj ) : +XclExpDffAnchor::XclExpDffAnchor( const XclExpRoot& rRoot, const SdrObject& rSdrObj ) : XclExpRoot( rRoot ), maAnchor( rRoot.GetCurrScTab() ) { @@ -389,14 +506,14 @@ XclExpEscherAnchor::XclExpEscherAnchor( const XclExpRoot& rRoot, const SdrObject maAnchor.SetRect( GetDoc(), rSdrObj.GetCurrentBoundRect(), MAP_100TH_MM ); } -void XclExpEscherAnchor::SetFlags( const SdrObject& rSdrObj ) +void XclExpDffAnchor::SetFlags( const SdrObject& rSdrObj ) { // Special case "page anchor" (X==0,Y==1) -> lock pos and size. const Point& rPos = rSdrObj.GetAnchorPos(); mnFlags = ((rPos.X() == 0) && (rPos.Y() == 1)) ? EXC_ESC_ANCHOR_LOCKED : 0; } -void XclExpEscherAnchor::WriteData( EscherEx& rEx, const Rectangle& rRect ) +void XclExpDffAnchor::WriteData( EscherEx& rEx, const Rectangle& rRect ) { // the rectangle is already in twips maAnchor.SetRect( GetDoc(), rRect, MAP_TWIP ); @@ -404,7 +521,7 @@ void XclExpEscherAnchor::WriteData( EscherEx& rEx, const Rectangle& rRect ) } -void XclExpEscherAnchor::WriteData( EscherEx& rEx ) const +void XclExpDffAnchor::WriteData( EscherEx& rEx ) const { rEx.AddAtom( 18, ESCHER_ClientAnchor ); rEx.GetStream() << mnFlags << maAnchor; @@ -413,8 +530,8 @@ void XclExpEscherAnchor::WriteData( EscherEx& rEx ) const // ---------------------------------------------------------------------------- -XclExpEscherNoteAnchor::XclExpEscherNoteAnchor( const XclExpRoot& rRoot, const Rectangle& rRect ) : - XclExpEscherAnchor( rRoot, EXC_ESC_ANCHOR_SIZELOCKED ) +XclExpDffNoteAnchor::XclExpDffNoteAnchor( const XclExpRoot& rRoot, const Rectangle& rRect ) : + XclExpDffAnchor( rRoot, EXC_ESC_ANCHOR_SIZELOCKED ) { maAnchor.SetRect( GetDoc(), rRect, MAP_100TH_MM ); } @@ -422,12 +539,12 @@ XclExpEscherNoteAnchor::XclExpEscherNoteAnchor( const XclExpRoot& rRoot, const R // ---------------------------------------------------------------------------- -XclExpEscherDropDownAnchor::XclExpEscherDropDownAnchor( const XclExpRoot& rRoot, const ScAddress& rScPos ) : - XclExpEscherAnchor( rRoot, EXC_ESC_ANCHOR_POSLOCKED ) +XclExpDffDropDownAnchor::XclExpDffDropDownAnchor( const XclExpRoot& rRoot, const ScAddress& rScPos ) : + XclExpDffAnchor( rRoot, EXC_ESC_ANCHOR_POSLOCKED ) { - GetAddressConverter().ConvertAddress( maAnchor.maXclRange.maFirst, rScPos, true ); - maAnchor.maXclRange.maLast.mnCol = maAnchor.maXclRange.maFirst.mnCol + 1; - maAnchor.maXclRange.maLast.mnRow = maAnchor.maXclRange.maFirst.mnRow + 1; + GetAddressConverter().ConvertAddress( maAnchor.maFirst, rScPos, true ); + maAnchor.maLast.mnCol = maAnchor.maFirst.mnCol + 1; + maAnchor.maLast.mnRow = maAnchor.maFirst.mnRow + 1; maAnchor.mnLX = maAnchor.mnTY = maAnchor.mnRX = maAnchor.mnBY = 0; } @@ -444,10 +561,10 @@ void XclEscherClientData::WriteData( EscherEx& rEx ) const // --- class XclEscherClientTextbox ------------------------------------- -XclEscherClientTextbox::XclEscherClientTextbox( RootData& rRoot, +XclEscherClientTextbox::XclEscherClientTextbox( const XclExpRoot& rRoot, const SdrTextObj& rObj, XclObj* pObj ) : - rRootData( rRoot ), + XclExpRoot( rRoot ), rTextObj( rObj ), pXclObj( pObj ) { @@ -456,7 +573,7 @@ XclEscherClientTextbox::XclEscherClientTextbox( RootData& rRoot, void XclEscherClientTextbox::WriteData( EscherEx& /*rEx*/ ) const { - pXclObj->SetText( *rRootData.pER, rTextObj ); + pXclObj->SetText( GetRoot(), rTextObj ); } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index bf58888d47ab..7845ef682082 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -349,26 +349,26 @@ void XclObj::SetEscherShapeType( UINT16 nType ) switch ( nType ) { case ESCHER_ShpInst_Line : - mnObjType = EXC_OBJ_CMO_LINE; + mnObjType = EXC_OBJTYPE_LINE; break; case ESCHER_ShpInst_Rectangle : case ESCHER_ShpInst_RoundRectangle : - mnObjType = EXC_OBJ_CMO_RECTANGLE; + mnObjType = EXC_OBJTYPE_RECTANGLE; break; case ESCHER_ShpInst_Ellipse : - mnObjType = EXC_OBJ_CMO_ELLIPSE; + mnObjType = EXC_OBJTYPE_OVAL; break; case ESCHER_ShpInst_Arc : - mnObjType = EXC_OBJ_CMO_ARC; + mnObjType = EXC_OBJTYPE_ARC; break; case ESCHER_ShpInst_TextBox : - mnObjType = EXC_OBJ_CMO_TEXT; + mnObjType = EXC_OBJTYPE_TEXT; break; case ESCHER_ShpInst_PictureFrame : - mnObjType = EXC_OBJ_CMO_PICTURE; + mnObjType = EXC_OBJTYPE_PICTURE; break; default: - mnObjType = EXC_OBJ_CMO_DRAWING; + mnObjType = EXC_OBJTYPE_DRAWING; } } @@ -389,14 +389,14 @@ void XclObj::SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj ) void XclObj::WriteBody( XclExpStream& rStrm ) { - DBG_ASSERT( mnObjType != EXC_OBJ_CMO_UNKNOWN, "XclObj::WriteBody - unknown type" ); + DBG_ASSERT( mnObjType != EXC_OBJTYPE_UNKNOWN, "XclObj::WriteBody - unknown type" ); // create a substream to be able to create subrecords SvMemoryStream aMemStrm; ::std::auto_ptr< XclExpStream > pXclStrm( new XclExpStream( aMemStrm, rStrm.GetRoot() ) ); // write the ftCmo subrecord - pXclStrm->StartRecord( EXC_ID_OBJ_FTCMO, 18 ); + pXclStrm->StartRecord( EXC_ID_OBJCMO, 18 ); *pXclStrm << mnObjType << nObjId << nGrbit; pXclStrm->WriteZeroBytes( 12 ); pXclStrm->EndRecord(); @@ -405,7 +405,7 @@ void XclObj::WriteBody( XclExpStream& rStrm ) WriteSubRecs( *pXclStrm ); // write the ftEnd subrecord - pXclStrm->StartRecord( EXC_ID_OBJ_FTEND, 0 ); + pXclStrm->StartRecord( EXC_ID_OBJEND, 0 ); pXclStrm->EndRecord(); // copy the data to the OBJ record @@ -449,7 +449,7 @@ void XclObj::SaveTextRecs( XclExpStream& rStrm ) XclObjComment::XclObjComment( const XclExpRoot& rRoot, const Rectangle& rRect, const EditTextObject& rEditObj, SdrObject* pCaption, bool bVisible ) : - XclObj( rRoot, EXC_OBJ_CMO_NOTE, true ) + XclObj( rRoot, EXC_OBJTYPE_NOTE, true ) { ProcessEscherObj(rRoot, rRect, pCaption, bVisible); // TXO @@ -512,7 +512,7 @@ void XclObjComment::ProcessEscherObj( const XclExpRoot& rRoot, const Rectangle& aPropOpt.AddOpt( ESCHER_Prop_fPrint, nFlags ); // bool field aPropOpt.Commit( pEx->GetStream() ); - XclExpEscherNoteAnchor( rRoot, rRect ).WriteData( *pEx); + XclExpDffNoteAnchor( rRoot, rRect ).WriteData( *pEx); pEx->AddAtom( 0, ESCHER_ClientData ); // OBJ record pMsodrawing->UpdateStopPos(); @@ -540,7 +540,7 @@ void XclObjComment::Save( XclExpStream& rStrm ) // --- class XclObjDropDown ------------------------------------------ XclObjDropDown::XclObjDropDown( const XclExpRoot& rRoot, const ScAddress& rPos, BOOL bFilt ) : - XclObj( rRoot, EXC_OBJ_CMO_COMBOBOX, true ), + XclObj( rRoot, EXC_OBJTYPE_DROPDOWN, true ), bIsFiltered( bFilt ) { SetLocked( TRUE ); @@ -559,7 +559,7 @@ XclObjDropDown::XclObjDropDown( const XclExpRoot& rRoot, const ScAddress& rPos, aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x000A0000 ); // bool field aPropOpt.Commit( pEx->GetStream() ); - XclExpEscherDropDownAnchor( rRoot, rPos ).WriteData( *pEx ); + XclExpDffDropDownAnchor( rRoot, rPos ).WriteData( *pEx ); pEx->AddAtom( 0, ESCHER_ClientData ); // OBJ record pMsodrawing->UpdateStopPos(); @@ -576,16 +576,17 @@ XclObjDropDown::~XclObjDropDown() void XclObjDropDown::WriteSubRecs( XclExpStream& rStrm ) { // ftSbs subrecord - Scroll bars (dummy) - rStrm.StartRecord( EXC_ID_OBJ_FTSBS, 20 ); + rStrm.StartRecord( EXC_ID_OBJSBS, 20 ); rStrm.WriteZeroBytes( 20 ); rStrm.EndRecord(); // ftLbsData subrecord - Listbox data - sal_uInt16 nComboStyle = EXC_OBJ_LBS_COMBO_SIMPLE; - ::set_flag( nComboStyle, EXC_OBJ_LBS_FILTERED, bIsFiltered ); - rStrm.StartRecord( EXC_ID_OBJ_FTLBSDATA, 16 ); + sal_uInt16 nDropDownFlags = 0; + ::insert_value( nDropDownFlags, EXC_OBJ_DROPDOWN_SIMPLE, 0, 2 ); + ::set_flag( nDropDownFlags, EXC_OBJ_DROPDOWN_FILTERED, bIsFiltered ); + rStrm.StartRecord( EXC_ID_OBJLBSDATA, 16 ); rStrm << (UINT32)0 << (UINT16)0 << (UINT16)0x0301 << (UINT16)0 - << nComboStyle << sal_uInt16( 20 ) << sal_uInt16( 130 ); + << nDropDownFlags << sal_uInt16( 20 ) << sal_uInt16( 130 ); rStrm.EndRecord(); } @@ -594,14 +595,14 @@ void XclObjDropDown::WriteSubRecs( XclExpStream& rStrm ) sal_uInt8 lcl_GetHorAlignFromItemSet( const SfxItemSet& rItemSet ) { - sal_uInt8 nHorAlign = EXC_TXO_HOR_LEFT; + sal_uInt8 nHorAlign = EXC_OBJ_HOR_LEFT; switch( static_cast< const SvxAdjustItem& >( rItemSet.Get( EE_PARA_JUST ) ).GetAdjust() ) { - case SVX_ADJUST_LEFT: nHorAlign = EXC_TXO_HOR_LEFT; break; - case SVX_ADJUST_CENTER: nHorAlign = EXC_TXO_HOR_CENTER; break; - case SVX_ADJUST_RIGHT: nHorAlign = EXC_TXO_HOR_RIGHT; break; - case SVX_ADJUST_BLOCK: nHorAlign = EXC_TXO_HOR_JUSTIFY; break; + case SVX_ADJUST_LEFT: nHorAlign = EXC_OBJ_HOR_LEFT; break; + case SVX_ADJUST_CENTER: nHorAlign = EXC_OBJ_HOR_CENTER; break; + case SVX_ADJUST_RIGHT: nHorAlign = EXC_OBJ_HOR_RIGHT; break; + case SVX_ADJUST_BLOCK: nHorAlign = EXC_OBJ_HOR_JUSTIFY; break; default:; } return nHorAlign; @@ -609,23 +610,23 @@ sal_uInt8 lcl_GetHorAlignFromItemSet( const SfxItemSet& rItemSet ) sal_uInt8 lcl_GetVerAlignFromItemSet( const SfxItemSet& rItemSet ) { - sal_uInt8 nVerAlign = EXC_TXO_VER_TOP; + sal_uInt8 nVerAlign = EXC_OBJ_VER_TOP; switch( static_cast< const SdrTextVertAdjustItem& >( rItemSet.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue() ) { - case SDRTEXTVERTADJUST_TOP: nVerAlign = EXC_TXO_VER_TOP; break; - case SDRTEXTVERTADJUST_CENTER: nVerAlign = EXC_TXO_VER_CENTER; break; - case SDRTEXTVERTADJUST_BOTTOM: nVerAlign = EXC_TXO_VER_BOTTOM; break; - case SDRTEXTVERTADJUST_BLOCK: nVerAlign = EXC_TXO_VER_JUSTIFY; break; + case SDRTEXTVERTADJUST_TOP: nVerAlign = EXC_OBJ_VER_TOP; break; + case SDRTEXTVERTADJUST_CENTER: nVerAlign = EXC_OBJ_VER_CENTER; break; + case SDRTEXTVERTADJUST_BOTTOM: nVerAlign = EXC_OBJ_VER_BOTTOM; break; + case SDRTEXTVERTADJUST_BLOCK: nVerAlign = EXC_OBJ_VER_JUSTIFY; break; } return nVerAlign; } XclTxo::XclTxo( const String& rString, sal_uInt16 nFontIx ) : mpString( new XclExpString( rString ) ), - mnRotation( EXC_TXO_TEXTROT_NONE ), - mnHorAlign( EXC_TXO_HOR_LEFT ), - mnVerAlign( EXC_TXO_VER_TOP ) + mnRotation( EXC_OBJ_ORIENT_NONE ), + mnHorAlign( EXC_OBJ_HOR_LEFT ), + mnVerAlign( EXC_OBJ_VER_TOP ) { if( mpString->Len() ) { @@ -637,9 +638,9 @@ XclTxo::XclTxo( const String& rString, sal_uInt16 nFontIx ) : XclTxo::XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rTextObj ) : mpString( XclExpStringHelper::CreateString( rRoot, rTextObj ) ), - mnRotation( EXC_TXO_TEXTROT_NONE ), - mnHorAlign( EXC_TXO_HOR_LEFT ), - mnVerAlign( EXC_TXO_VER_TOP ) + mnRotation( EXC_OBJ_ORIENT_NONE ), + mnHorAlign( EXC_OBJ_HOR_LEFT ), + mnVerAlign( EXC_OBJ_VER_TOP ) { // additional alignment and orientation items const SfxItemSet& rItemSet = rTextObj.GetMergedItemSet(); @@ -653,18 +654,18 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rTextObj ) : // rotation long nAngle = rTextObj.GetRotateAngle(); if( (4500 < nAngle) && (nAngle < 13500) ) - mnRotation = EXC_TXO_TEXTROT_90_CCW; + mnRotation = EXC_OBJ_ORIENT_90CCW; else if( (22500 < nAngle) && (nAngle < 31500) ) - mnRotation = EXC_TXO_TEXTROT_90_CW; + mnRotation = EXC_OBJ_ORIENT_90CW; else - mnRotation = EXC_TXO_TEXTROT_NONE; + mnRotation = EXC_OBJ_ORIENT_NONE; } XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption ) : mpString( XclExpStringHelper::CreateString( rRoot, rEditObj ) ), - mnRotation( EXC_TXO_TEXTROT_NONE ), - mnHorAlign( EXC_TXO_HOR_LEFT ), - mnVerAlign( EXC_TXO_VER_TOP ) + mnRotation( EXC_OBJ_ORIENT_NONE ), + mnHorAlign( EXC_OBJ_HOR_LEFT ), + mnVerAlign( EXC_OBJ_VER_TOP ) { if(pCaption) { @@ -693,7 +694,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje // orientation alignment const SvxWritingModeItem& rItem = static_cast< const SvxWritingModeItem& >( rItemSet.Get( SDRATTR_TEXTDIRECTION ) ); if( rItem.GetValue() == com::sun::star::text::WritingMode_TB_RL ) - mnRotation = EXC_TXO_TEXTROT_90_CW; + mnRotation = EXC_OBJ_ORIENT_90CW; } } @@ -749,7 +750,7 @@ sal_Size XclTxo::GetLen() const // --- class XclObjOle ------------------------------------------- XclObjOle::XclObjOle( const XclExpRoot& rRoot, const SdrObject& rObj ) : - XclObj( rRoot, EXC_OBJ_CMO_PICTURE ), + XclObj( rRoot, EXC_OBJTYPE_PICTURE ), rOleObj( rObj ), pRootStorage( rRoot.GetRootStorage() ) { @@ -799,26 +800,25 @@ void XclObjOle::WriteSubRecs( XclExpStream& rStrm ) SvxMSExportOLEObjects aOLEExpFilt( nFl ); aOLEExpFilt.ExportOLEObject( xObj, *xOleStg ); - // ftCf subrecord, undocumented as usual - rStrm.StartRecord( EXC_ID_OBJ_FTCF, 2 ); + // OBJCF subrecord, undocumented as usual + rStrm.StartRecord( EXC_ID_OBJCF, 2 ); rStrm << UINT16(0x0002); rStrm.EndRecord(); - // ftPioGrbit subrecord, undocumented as usual - rStrm.StartRecord( EXC_ID_OBJ_FTPIOGRBIT, 2 ); - sal_uInt16 nPioGrbit = 0x0001; - if ( ((SdrOle2Obj&)rOleObj).GetAspect() == embed::Aspects::MSOLE_ICON ) - ::set_flag( nPioGrbit, EXC_OBJ_PIO_SYMBOL ); - rStrm << nPioGrbit; + // OBJFLAGS subrecord, undocumented as usual + rStrm.StartRecord( EXC_ID_OBJFLAGS, 2 ); + sal_uInt16 nFlags = EXC_OBJ_PIC_MANUALSIZE; + ::set_flag( nFlags, EXC_OBJ_PIC_SYMBOL, ((SdrOle2Obj&)rOleObj).GetAspect() == embed::Aspects::MSOLE_ICON ); + rStrm << nFlags; rStrm.EndRecord(); - // ftPictFmla subrecord, undocumented as usual + // OBJPICTFMLA subrecord, undocumented as usual XclExpString aName( xOleStg->GetUserName() ); UINT16 nPadLen = (UINT16)(aName.GetSize() & 0x01); UINT16 nFmlaLen = static_cast< sal_uInt16 >( 12 + aName.GetSize() + nPadLen ); UINT16 nSubRecLen = nFmlaLen + 6; - rStrm.StartRecord( EXC_ID_OBJ_FTPICTFMLA, nSubRecLen ); + rStrm.StartRecord( EXC_ID_OBJPICTFMLA, nSubRecLen ); rStrm << nFmlaLen << sal_uInt16( 5 ) << sal_uInt32( 0 ) << sal_uInt8( 2 ) << sal_uInt32( 0 ) << sal_uInt8( 3 ) @@ -842,7 +842,7 @@ void XclObjOle::Save( XclExpStream& rStrm ) // --- class XclObjAny ------------------------------------------- XclObjAny::XclObjAny( const XclExpRoot& rRoot ) : - XclObj( rRoot, EXC_OBJ_CMO_UNKNOWN ) + XclObj( rRoot, EXC_OBJTYPE_UNKNOWN ) { } @@ -852,14 +852,14 @@ XclObjAny::~XclObjAny() void XclObjAny::WriteSubRecs( XclExpStream& rStrm ) { - if( mnObjType == EXC_OBJ_CMO_GROUP ) + if( mnObjType == EXC_OBJTYPE_GROUP ) // ftGmo subrecord - rStrm << EXC_ID_OBJ_FTGMO << UINT16(2) << UINT16(0); + rStrm << EXC_ID_OBJGMO << UINT16(2) << UINT16(0); } void XclObjAny::Save( XclExpStream& rStrm ) { - if( mnObjType == EXC_OBJ_CMO_GROUP ) + if( mnObjType == EXC_OBJTYPE_GROUP ) // old size + ftGmo AddRecSize( 6 ); |