diff options
author | Caolán McNamara <cmc@openoffice.org> | 2000-10-10 15:54:06 +0000 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2000-10-10 15:54:06 +0000 |
commit | 2382ae89824f53c683c2079b89c6b435118969a0 (patch) | |
tree | 6ffc0a48828e645038f5a74b97dcc194c3204395 /sw/source | |
parent | c052335d5f252fd838af84385267dff2e530bbb2 (diff) |
MSOffice 97/2000 Controls {Im|Ex}port
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/makefile.mk | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 135 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 29 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 26 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 67 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 125 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 15 |
8 files changed, 330 insertions, 79 deletions
diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk index 596961827ea3..2502de3b1f2f 100644 --- a/sw/source/filter/ww8/makefile.mk +++ b/sw/source/filter/ww8/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ +# last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -97,7 +97,6 @@ CXXFILES = \ ww8par5.cxx \ ww8par6.cxx \ ww8glsy.cxx \ - msocximp.cxx \ ww8scan.cxx diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d69ec61a2edd..5fedd5553fec 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8esh.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: khz $ $Date: 2000-09-21 12:18:55 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,6 +135,22 @@ #include <svx/editeng.hxx> #endif +#ifndef _SVX_FMGLOB_HXX +#include <svx/fmglob.hxx> +#endif +#ifndef _SVDOUNO_HXX +#include <svx/svdouno.hxx> +#endif +#ifndef _SVX_UNOAPI_HXX_ +#include <svx/unoapi.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ +#include <com/sun/star/form/FormComponentType.hpp> +#endif + #ifndef _WRTWW8_HXX #include <wrtww8.hxx> #endif @@ -198,7 +214,9 @@ #ifndef _UNODRAW_HXX #include <unodraw.hxx> #endif - +#ifndef _WW8PAR_HXX +#include <ww8par.hxx> +#endif #ifndef _ERRHDL_HXX #include <errhdl.hxx> #endif @@ -937,6 +955,7 @@ class SwEscherEx : public EscherEx UINT32 nTxtBox ); void WriteGrfFlyFrame( const SwFrmFmt& rFmt, UINT32 nShapeId ); void WriteOLEFlyFrame( const SwFrmFmt& rFmt, UINT32 nShapeId ); + void WriteOCXControl( const SwFrmFmt& rFmt, UINT32 nShapeId ); void WriteFlyFrameAttr( const SwFrmFmt& rFmt ); void WriteGrfAttr( const SwNoTxtNode& rNd ); @@ -1039,8 +1058,11 @@ SwEscherEx::SwEscherEx( SvStream* pStrm, SwWW8Writer& rWW8Wrt ) for( USHORT n = 0; n < aSortFmts.Count(); ++n ) { const SwFrmFmt& rFmt = *(SwFrmFmt*)aSortFmts[ n ]; - if( RES_FLYFRMFMT == rFmt.Which() ) + if( RES_FLYFRMFMT == rFmt.Which()) nShapeId = WriteFlyFrm( rFmt ); + else if (rFmt.FindRealSdrObject()->GetObjInventor() == + FmFormInventor) + WriteOCXControl(rFmt,nShapeId=GetShapeID()); else { const SdrObject* pObj = rFmt.FindRealSdrObject(); @@ -1318,6 +1340,40 @@ void SwEscherEx::WriteGrfFlyFrame( const SwFrmFmt& rFmt, UINT32 nShapeId ) CloseContainer(); // ESCHER_SpContainer } + +void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, UINT32 nShapeId ) +{ + const SdrObject* pSdrObj = rFmt.FindRealSdrObject(); + if( pSdrObj) + { + OpenContainer( ESCHER_SpContainer ); + + AddShape( ESCHER_ShpInst_PictureFrame, 0xa10, nShapeId ); + + BeginCount(); + + Size aSz( pSdrObj->GetLogicRect().GetSize() ); + aSz.Width() = DrawModelToEmu( aSz.Width() ); + aSz.Height() = DrawModelToEmu( aSz.Height() ); + Rectangle aRect( Point(0,0), aSz ); + + pTxtBxs->Append( *pSdrObj, nShapeId ); + UINT32 nPicId = pTxtBxs->Count(); + nPicId *= 0x10000; + AddOpt( ESCHER_Prop_pictureId, nPicId ); + AddOpt( ESCHER_Prop_pictureActive, 0x10000 ); + + WriteFlyFrameAttr( rFmt ); + + EndCount( ESCHER_OPT, 3 ); + + AddAtom( 4, ESCHER_ClientAnchor ); GetStream() << 0L; + AddAtom( 4, ESCHER_ClientData ); GetStream() << 1L; + + CloseContainer(); // ESCHER_SpContainer + } +} + void SwEscherEx::WriteOLEFlyFrame( const SwFrmFmt& rFmt, UINT32 nShapeId ) { SwNodeIndex aIdx( *rFmt.GetCntnt().GetCntntIdx(), 1 ); @@ -1624,15 +1680,84 @@ SvStream* SwEscherEx::QueryPicStream() } +BOOL SwMSConvertControls::ExportControl(Writer &rWrt, const SdrObject *pObj) + +{ + SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; + + if (!rWW8Wrt.bWrtWW8) + return FALSE; + + SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObj); + uno::Reference< awt::XControlModel > xControlModel = + pFormObj->GetUnoControlModel(); + + //Why oh lord do we use so many different units ? + //I think I painted myself into a little bit of a + //corner by trying to use the uno interface for + //controls export + Size aTempSize=pFormObj->GetLogicRect().GetSize(); + awt::Size aSize; + aSize.Width = TWIPS_TO_MM(aTempSize.A()); + aSize.Height = TWIPS_TO_MM(aTempSize.B()); + + //Open the ObjectPool + SvStorageRef xObjPool = rWW8Wrt.GetStorage().OpenStorage( + String::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM("ObjectPool")), + STREAM_READWRITE|STREAM_SHARE_DENYALL); + //Create a destination storage for the microsoft control + String sStorageName('_'); + sStorageName += String::CreateFromInt32((UINT32)pObj); + SvStorageRef xOleStg = xObjPool->OpenStorage(sStorageName, + STREAM_READWRITE|STREAM_SHARE_DENYALL); + + if (!xOleStg.Is()) + return FALSE; + + String sName; + if (!WriteOCXStream(xOleStg,xControlModel,aSize,sName)) + return FALSE; + + BYTE aSpecOLE[] = + { + 0x03, 0x6a, 0xFF, 0xFF, 0xFF, 0xFF, // sprmCPicLocation + 0x0a, 0x08, 1, // sprmCFOLE2 + 0x55, 0x08, 1, // sprmCFSpec + 0x56, 0x08, 1 // sprmCFObj + }; + //Set the obj id into the sprmCPicLocation + BYTE *pData = aSpecOLE+2; + Set_UInt32(pData,(UINT32)pObj); + + sName.InsertAscii(" CONTROL Forms.",0); + sName.AppendAscii(".1 \\s "); + + rWW8Wrt.OutField(0,87,sName, + WRITEFIELD_START|WRITEFIELD_CMD_START|WRITEFIELD_CMD_END); + + rWW8Wrt.pChpPlc->AppendFkpEntry(rWW8Wrt.Strm().Tell(),sizeof(aSpecOLE), + aSpecOLE); + rWW8Wrt.WriteChar( 0x1 ); + rWW8Wrt.OutField( 0, 87, aEmptyStr, WRITEFIELD_END | WRITEFIELD_CLOSE ); + return TRUE; +} + + + + /************************************************************************* Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8esh.cxx,v 1.2 2000-09-21 12:18:55 khz Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8esh.cxx,v 1.3 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.2 2000/09/21 12:18:55 khz + #78753# Avoid dividing by zero. + Revision 1.1.1.1 2000/09/18 17:14:58 hr initial import diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 4f7a9ea24b4d..c8cac21fc3a5 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtw8sty.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,7 +83,12 @@ #ifndef _SVDOTEXT_HXX //autogen wg. SdrTextObj #include <svx/svdotext.hxx> #endif - +#ifndef _SVDOTEXT_HXX +#include <svx/svdotext.hxx> +#endif +#ifndef _SVX_FMGLOB_HXX +#include <svx/fmglob.hxx> +#endif #ifndef _WRTWW8_HXX #include <wrtww8.hxx> #endif @@ -149,6 +154,10 @@ #include <lineinfo.hxx> #endif +#ifndef _WW8PAR_HXX +#include <ww8par.hxx> +#endif + struct WW8_SED { @@ -1591,7 +1600,14 @@ void WW8_WrPlcSubDoc::WriteTxt( SwWW8Writer& rWrt, BYTE nTTyp, // is it an writer or sdr - textbox? const SdrObject& rObj = *(SdrObject*)aCntnt[ i ]; - if( rObj.ISA( SdrTextObj ) ) + if (rObj.GetObjInventor() == FmFormInventor) + { + BYTE nOldTyp = rWrt.nTxtTyp; + rWrt.nTxtTyp = nTTyp; + rWrt.GetOCXExp().ExportControl(rWrt,&rObj); + rWrt.nTxtTyp = nOldTyp; + } + else if( rObj.ISA( SdrTextObj ) ) rWrt.WriteSdrTextObj( rObj ); else { @@ -1845,11 +1861,14 @@ const SvULongs* WW8_WrPlcSubDoc::GetShapeIdArr() const Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8sty.cxx,v 1.1.1.1 2000-09-18 17:14:58 hr Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8sty.cxx,v 1.2 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 17:14:58 hr + initial import + Revision 1.28 2000/09/18 16:04:58 willem.vandorp OpenOffice header added. diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 81ac65a89408..03bf8af38b73 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtww8.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,9 @@ #ifndef _HINTIDS_HXX #include <hintids.hxx> #endif +#ifndef _SWDOCSH_HXX +#include <docsh.hxx> +#endif #ifndef _SV_SALBTYPE_HXX #include <vcl/salbtype.hxx> @@ -102,6 +105,9 @@ #ifndef _MSOLEEXP_HXX #include <svx/msoleexp.hxx> #endif +#ifndef _MSOCXIMEX_HXX +#include <svx/msocximex.hxx> +#endif #endif #ifndef _OFA_FLTRCFG_HXX @@ -159,6 +165,9 @@ #ifndef _WRTWW8_HXX #include <wrtww8.hxx> #endif +#ifndef _WW8PAR_HXX +#include <ww8par.hxx> +#endif #ifndef _WW8STRUC_HXX #include <ww8struc.hxx> #endif @@ -1739,6 +1748,9 @@ ULONG SwWW8Writer::StoreDoc() pOLEExp = new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags ); } + + if( !pOCXExp ) + pOCXExp = new SwMSConvertControls(pDoc->GetDocShell(),pCurPam); #endif PrepareStorage(); @@ -2019,7 +2031,7 @@ SwWW8Writer::SwWW8Writer( const String& rFltName ) pO( 0 ), pAktPageDesc( 0 ), pISet( 0 ), pUsedNumTbl( 0 ), pBmpPal( 0 ), pKeyMap( 0 ) #if SUPD>593 - , pOLEExp( 0 ) + , pOLEExp( 0 ), pOCXExp(0) #endif { bWrtWW8 = rFltName.EqualsAscii( FILTER_WW8 ); @@ -2037,6 +2049,9 @@ SwWW8Writer::~SwWW8Writer() #if SUPD>593 if( pOLEExp ) delete pOLEExp; + if( pOCXExp ) + delete pOCXExp; + #endif } @@ -2051,11 +2066,14 @@ void GetWW8Writer( const String& rFltName, WriterRef& xRet ) Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtww8.cxx,v 1.1.1.1 2000-09-18 17:14:58 hr Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtww8.cxx,v 1.2 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 17:14:58 hr + initial import + Revision 1.54 2000/09/18 16:04:58 willem.vandorp OpenOffice header added. diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 7eab24f3d5b6..1c39866dd40a 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -2,9 +2,9 @@ * * $RCSfile: wrtww8.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -156,6 +156,7 @@ class WW8_WrPcPtrs; class WW8_WrtBookmarks; class WW8_WrtRedlineAuthor; class SvxMSExportOLEObjects; +class SwMSConvertControls; struct WW8_PdAttrDesc; struct WW8_SHD; @@ -295,6 +296,7 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ); BitmapPalette* pBmpPal; void* pKeyMap; SvxMSExportOLEObjects* pOLEExp; + SwMSConvertControls* pOCXExp; ULONG nIniFlags; // Flags aus der writer.ini USHORT nCharFmtStart; @@ -392,6 +394,7 @@ public: SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; } + SwMSConvertControls& GetOCXExp() { return *pOCXExp; } static USHORT TranslateToEditEngineId( USHORT nWhich ); static USHORT TranslateFromEditEngineId( USHORT nWhich ); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 8c68d6f8809b..a7dee35d1cd3 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,14 +105,12 @@ #include <svx/msdffimp.hxx> #endif -#ifndef _MSOCXIMP_HXX -#include <msocximp.hxx> +#ifndef _MSOCXIMEX_HXX +#include <svx/msocximex.hxx> #endif - #define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s)) - class SvStringsDtor; class SwDoc; class SwPaM; @@ -398,9 +396,11 @@ class WW8FormulaControl : public OCX_Control public: WW8FormulaControl(const UniString& sN,SwWW8ImplReader &rR) : OCX_Control(sN), rRdr(rR) {} - void WW8FormulaControl::SetOthersFromDoc(com::sun::star::uno::Reference <com::sun::star::form::XFormComponent> &rFComp, + void WW8FormulaControl::SetOthersFromDoc(com::sun::star::uno::Reference < + com::sun::star::form::XFormComponent> &rFComp, com::sun::star::awt::Size &rSz, - com::sun::star::uno::Reference <com::sun::star::beans::XPropertySet> &rPropSet); + com::sun::star::uno::Reference < + com::sun::star::beans::XPropertySet> &rPropSet); UINT8 fToolTip:1; UINT8 fNoMark:1; @@ -430,9 +430,11 @@ public: WW8FormulaCheckBox(SwWW8ImplReader &rR) : WW8FormulaControl( WW8_ASCII2STR( "CheckBox" ), rR) {} - BOOL Convert(const com::sun::star::uno::Reference <com::sun::star::lang::XMultiServiceFactory> &rServiceFactory, - com::sun::star::uno::Reference <com::sun::star::form::XFormComponent> &rFComp,com::sun::star::awt::Size &rSz); - + BOOL Import(const com::sun::star::uno::Reference < + com::sun::star::lang::XMultiServiceFactory> &rServiceFactory, + com::sun::star::uno::Reference < + com::sun::star::form::XFormComponent> &rFComp, + com::sun::star::awt::Size &rSz); }; class WW8FormulaEditBox: public WW8FormulaControl @@ -441,18 +443,27 @@ public: WW8FormulaEditBox(SwWW8ImplReader &rR) : WW8FormulaControl( WW8_ASCII2STR( "TextField" ) ,rR) {} - BOOL Convert(const com::sun::star::uno::Reference <com::sun::star::lang::XMultiServiceFactory> &rServiceFactory, - com::sun::star::uno::Reference <com::sun::star::form::XFormComponent> &rFComp,com::sun::star::awt::Size &rSz); - + BOOL Import(const com::sun::star::uno::Reference < + com::sun::star::lang::XMultiServiceFactory> &rServiceFactory, + com::sun::star::uno::Reference < + com::sun::star::form::XFormComponent> &rFComp, + com::sun::star::awt::Size &rSz); }; -class SwImportControls : public SwImportOCX +class SwMSConvertControls: public SvxMSConvertOCXControls { public: - SwImportControls( SfxObjectShell *pDSh,SwPaM *pP ) : - SwImportOCX( pDSh,pP ) {} - BOOL InsertFormula( WW8FormulaControl &rFormula, - com::sun::star::uno::Reference <com::sun::star::drawing::XShape> *pShapeRef=0 ); + SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) : + SvxMSConvertOCXControls( pDSh,pP ) {} + BOOL InsertFormula( WW8FormulaControl &rFormula, + com::sun::star::uno::Reference < + com::sun::star::drawing::XShape> *pShapeRef=0 ); + BOOL InsertControl(const com::sun::star::uno::Reference< + com::sun::star::form::XFormComponent >& rFComp, + const ::com::sun::star::awt::Size& rSize, + com::sun::star::uno::Reference < + com::sun::star::drawing::XShape > *pShape,BOOL bFloatingCtrl); + BOOL SwMSConvertControls::ExportControl(Writer &rWrt,const SdrObject *pObj); }; class SwMSDffManager : public SvxMSDffManager @@ -498,7 +509,7 @@ friend class WW8FormulaControl; SwWW8FltControlStack* pRefFldStck; // for Reference Fields // BYTE* pCharBuf; // Puffer fuer nackten Text - SwImportControls *pFormImpl; // Control-Implementierung + SwMSConvertControls *pFormImpl; // Control-Implementierung SwFlyFrmFmt* pFlyFmtOfJustInsertedGraphic; WW8Fib* pWwFib; @@ -1059,11 +1070,12 @@ public: // eigentlich private, geht aber leider nur public eF_ResT Read_F_OCX( WW8FieldDesc*, String& rStr ); eF_ResT Read_F_Hyperlink( WW8FieldDesc*, String& rStr ); - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> InsertControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rFComp, - const ::com::sun::star::awt::Size& rSize, - //const ::com::sun::star::uno::Reference< ::com::sun::star::size::XSize>& rSize, - BOOL bFloatingCtrl = FALSE ); + BOOL InsertControl(const com::sun::star::uno::Reference< + com::sun::star::form::XFormComponent>& rFComp, + const ::com::sun::star::awt::Size& rSize, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape> *pShape=NULL, + BOOL bFloatingCtrl = FALSE ); void BuildInputField( USHORT eType, const String& rParam ); void DeleteFormImpl(); @@ -1099,10 +1111,13 @@ public: // eigentlich private, geht aber leider nur public Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par.hxx,v 1.1.1.1 2000-09-18 17:14:58 hr Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par.hxx,v 1.2 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 17:14:58 hr + initial import + Revision 1.95 2000/09/18 16:05:00 willem.vandorp OpenOffice header added. diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 28de294b6ee6..1cbc07a27e7b 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par3.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -253,8 +253,8 @@ #include <ww8par2.hxx> // wg. Listen-Attributen in Styles #endif -#ifndef _MSOCXIMP_HXX -#include <msocximp.hxx> +#ifndef _MSOCXIMEX_HXX +#include <svx/msocximex.hxx> #endif #ifdef __WW8_NEEDS_COPY @@ -279,13 +279,13 @@ static sal_Char sWW8_checkbox[] = "CheckBox"; -uno::Reference< drawing::XShape> SwWW8ImplReader::InsertControl( - //const uno::Reference< form::XFormComponent > & rFComp, - const uno::Reference< form::XFormComponent > & rFComp, - const awt::Size& rSize, - BOOL bFloatingCtrl ) +BOOL SwWW8ImplReader::InsertControl( + const uno::Reference< form::XFormComponent > & rFComp, + const awt::Size& rSize, + uno::Reference< drawing::XShape > *pShape, + BOOL bFloatingCtrl ) { - return pFormImpl->InsertControl( rFComp, rSize, bFloatingCtrl ); + return pFormImpl->InsertControl(rFComp, rSize, pShape,bFloatingCtrl); } @@ -304,7 +304,7 @@ void SwWW8ImplReader::BuildInputField( sal_uInt16 nType, const String& rParam ) if( !pDrawModel ) // MIB: Braucht man das? GrafikCtor(); if( !pFormImpl ) - pFormImpl = new SwImportControls(rDoc.GetDocShell(),pPaM); + pFormImpl = new SwMSConvertControls(rDoc.GetDocShell(),pPaM); const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory = pFormImpl->GetServiceFactory(); @@ -384,7 +384,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr ) if (ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_EDIT)) { if( !pFormImpl ) - pFormImpl = new SwImportControls(rDoc.GetDocShell(),pPaM); + pFormImpl = new SwMSConvertControls(rDoc.GetDocShell(),pPaM); if (pFormImpl->InsertFormula(aFormula)) return F_OK; } @@ -404,7 +404,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) WW8_CT_CHECKBOX)) { if( !pFormImpl ) - pFormImpl = new SwImportControls(rDoc.GetDocShell(),pPaM); + pFormImpl = new SwMSConvertControls(rDoc.GetDocShell(),pPaM); if (pFormImpl->InsertFormula(aFormula)) return F_OK; } @@ -1649,7 +1649,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16 nId, sal_uInt8* pData, short n // ------------------------------------------------------------------- BOOL SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula, - WW8_CP nStart, SwWw8ControlType nWhich ) + WW8_CP nStart, SwWw8ControlType nWhich ) { BOOL bRet=FALSE; /* @@ -1707,7 +1707,7 @@ BOOL SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula, return(bRet); } -BOOL SwImportControls::InsertFormula(WW8FormulaControl &rFormula, +BOOL SwMSConvertControls::InsertFormula(WW8FormulaControl &rFormula, uno::Reference <drawing::XShape> *pShapeRef) { BOOL bRet=FALSE; @@ -1723,12 +1723,8 @@ BOOL SwImportControls::InsertFormula(WW8FormulaControl &rFormula, // GetServiceFactory(); if(!rServiceFactory.is()) return(FALSE); - if (bRet = rFormula.Convert(rServiceFactory, xFComp, aSz)) - { - xShape = InsertControl( xFComp, aSz, FALSE ); - if (pShapeRef) - *pShapeRef = xShape; - } + if (bRet = rFormula.Import(rServiceFactory, xFComp, aSz)) + bRet = InsertControl( xFComp, aSz, pShapeRef,FALSE ); return bRet; } @@ -1778,10 +1774,9 @@ void WW8FormulaControl::Read(SwWw8ControlType nWhich,SvStream *pDataStream) : WW8Read_xstz( *pDataStream, 0, TRUE ); } -BOOL WW8FormulaCheckBox::Convert( - const uno::Reference <lang::XMultiServiceFactory> &rServiceFactory, - uno::Reference <form::XFormComponent> &rFComp, - com::sun::star::awt::Size &rSz ) +BOOL WW8FormulaCheckBox::Import(const uno::Reference < + lang::XMultiServiceFactory> &rServiceFactory, + uno::Reference <form::XFormComponent> &rFComp,awt::Size &rSz ) { String sServiceName = WW8_ASCII2STR( "com.sun.star.form.component.CheckBox" ); uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance( sServiceName ); @@ -1957,8 +1952,9 @@ void WW8FormulaControl::SetOthersFromDoc(uno::Reference< form::XFormComponent >& } -BOOL WW8FormulaEditBox::Convert(const uno::Reference< lang::XMultiServiceFactory >& rServiceFactory, - uno::Reference< form::XFormComponent >& rFComp, com::sun::star::awt::Size &rSz) +BOOL WW8FormulaEditBox::Import(const uno::Reference< + lang::XMultiServiceFactory >& rServiceFactory, + uno::Reference< form::XFormComponent >& rFComp, awt::Size &rSz) { rtl::OUString sServiceName = WW8_ASCII2STR( "com.sun.star.form.component.TextField" ); uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance( sServiceName ); @@ -2015,16 +2011,89 @@ BOOL WW8FormulaEditBox::Convert(const uno::Reference< lang::XMultiServiceFactory } +BOOL SwMSConvertControls::InsertControl( + const uno::Reference< form::XFormComponent > & rFComp, + const awt::Size& rSize, + uno::Reference< drawing::XShape > *pShape, + BOOL bFloatingCtrl) +{ + uno::Reference< drawing::XShape > xShape; + + const uno::Reference< container::XIndexContainer > & rFormComps = + GetFormComps(); + uno::Any aTmp( &rFComp, ::getCppuType((const uno::Reference< + form::XFormComponent >*)0) ); + rFormComps->insertByIndex( rFormComps->getCount(), aTmp ); + + const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory = + GetServiceFactory(); + if( !rServiceFactory.is() ) + return FALSE; + + uno::Reference< uno::XInterface > xCreate = rServiceFactory + ->createInstance(WW8_ASCII2STR("com.sun.star.drawing.ControlShape")); + if( !xCreate.is() ) + return FALSE; + + xShape = uno::Reference< drawing::XShape >(xCreate, uno::UNO_QUERY); + + DBG_ASSERT(xShape.is(), "XShape nicht erhalten") + xShape->setSize(rSize); + + uno::Reference< beans::XPropertySet > xShapePropSet( + xCreate, uno::UNO_QUERY ); + + //I lay a small bet that this will change to + //INT16 nTemp=TextContentAnchorType::AS_CHARACTER; + INT16 nTemp; + if (bFloatingCtrl) + nTemp= text::TextContentAnchorType_AT_PARAGRAPH; + else + nTemp= text::TextContentAnchorType_AS_CHARACTER; + + aTmp <<= nTemp; + xShapePropSet->setPropertyValue( WW8_ASCII2STR("AnchorType"), aTmp ); + + nTemp= text::VertOrientation::TOP; + aTmp <<= nTemp; + xShapePropSet->setPropertyValue( WW8_ASCII2STR("VertOrient"), aTmp ); + + uno::Reference< text::XText > xDummyTxtRef; + uno::Reference< text::XTextRange > xTxtRg = + new SwXTextRange( *pPaM, xDummyTxtRef ); + + aTmp.setValue(&xTxtRg,::getCppuType(( + uno::Reference< text::XTextRange >*)0)); + xShapePropSet->setPropertyValue( WW8_ASCII2STR("TextRange"), aTmp ); + + GetShapes()->add( xShape ); + + // Das Control-Model am Control-Shape setzen + uno::Reference< drawing::XControlShape > xControlShape( xShape, + uno::UNO_QUERY ); + uno::Reference< awt::XControlModel > xControlModel( rFComp, + uno::UNO_QUERY ); + xControlShape->setControl( xControlModel ); + + if (pShape) + *pShape = xShape; + + return TRUE; +} + /************************************************************************* Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par3.cxx,v 1.1.1.1 2000-09-18 17:14:58 hr Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par3.cxx,v 1.2 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 17:14:58 hr + initial import + Revision 1.53 2000/09/18 16:05:00 willem.vandorp OpenOffice header added. diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index b0b35bd2e9f3..afc20eb35887 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ww8par4.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:58 $ + * last change: $Author: cmc $ $Date: 2000-10-10 16:54:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -143,8 +143,8 @@ #ifndef _FLTSHELL_HXX #include <fltshell.hxx> #endif -#ifndef _MSOCXIMP_HXX -#include <msocximp.hxx> +#ifndef _MSOCXIMEX_HXX +#include <svx/msocximex.hxx> #endif #ifndef _UNODRAW_HXX #include <unodraw.hxx> @@ -424,7 +424,7 @@ SwFrmFmt* SwWW8ImplReader::ImportOle( const Graphic* pGrf, STREAM_READWRITE| STREAM_SHARE_DENYALL ); if(!pFormImpl) - pFormImpl = new SwImportControls(rDoc.GetDocShell(),pPaM); + pFormImpl = new SwMSConvertControls(rDoc.GetDocShell(),pPaM); uno::Reference< drawing::XShape > xRef; if (pFormImpl->ReadOCXStream(xSrc1,&xRef,bFloatingCtrl)) { @@ -668,11 +668,14 @@ void SwWW8ImplReader::Read_CPropRMark( USHORT nId, BYTE* pData, short nLen ) Source Code Control System - Header - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par4.cxx,v 1.1.1.1 2000-09-18 17:14:58 hr Exp $ + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/ww8par4.cxx,v 1.2 2000-10-10 16:54:06 cmc Exp $ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 17:14:58 hr + initial import + Revision 1.31 2000/09/18 16:05:01 willem.vandorp OpenOffice header added. |