You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/09/25 07:48:43 UTC
svn commit: r1389715 - in /incubator/ooo/trunk/main: forms/source/component/
forms/source/inc/ sc/source/filter/excel/ sc/source/filter/inc/
sc/source/filter/xcl97/ svx/source/unodraw/
Author: lijiany
Date: Tue Sep 25 05:48:42 2012
New Revision: 1389715
URL: http://svn.apache.org/viewvc?rev=1389715&view=rev
Log:
#121045#:After save a xls file contain marco in AOO, macor can't run in MS excel.
Reported by: binguo
Reviewed by: sunying
Patched by: Jianyuan Li
Modified:
incubator/ooo/trunk/main/forms/source/component/FormComponent.cxx
incubator/ooo/trunk/main/forms/source/inc/FormComponent.hxx
incubator/ooo/trunk/main/forms/source/inc/frm_strings.hxx
incubator/ooo/trunk/main/forms/source/inc/property.hrc
incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx
incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
incubator/ooo/trunk/main/sc/source/filter/inc/xcl97esc.hxx
incubator/ooo/trunk/main/sc/source/filter/inc/xeescher.hxx
incubator/ooo/trunk/main/sc/source/filter/xcl97/xcl97esc.cxx
incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx
Modified: incubator/ooo/trunk/main/forms/source/component/FormComponent.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/forms/source/component/FormComponent.cxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/forms/source/component/FormComponent.cxx (original)
+++ incubator/ooo/trunk/main/forms/source/component/FormComponent.cxx Tue Sep 25 05:48:42 2012
@@ -595,6 +595,8 @@ OControlModel::OControlModel(
,m_nTabIndex(FRM_DEFAULT_TABINDEX)
,m_nClassId(FormComponentType::CONTROL)
,m_bNativeLook( sal_False )
+ ,m_nControlTypeinMSO(0) // 0 : default value is create from AOO
+ ,m_nObjIDinMSO(INVALID_OBJ_ID_IN_MSO)
// form controls are usually embedded into documents, not dialogs, and in documents
// the native look is ugly ....
// #i37342# / 2004-11-19 / frank.schoenheit@sun.com
@@ -649,6 +651,8 @@ OControlModel::OControlModel( const OCon
m_nTabIndex = _pOriginal->m_nTabIndex;
m_nClassId = _pOriginal->m_nClassId;
m_bNativeLook = _pOriginal->m_bNativeLook;
+ m_nControlTypeinMSO = _pOriginal->m_nControlTypeinMSO;
+ m_nObjIDinMSO = _pOriginal->m_nObjIDinMSO;
if ( _bCloneAggregate )
{
@@ -985,7 +989,13 @@ Any OControlModel::getPropertyDefaultByH
case PROPERTY_ID_NATIVE_LOOK:
aReturn <<= (sal_Bool)sal_True;
break;
-
+ //added for exporting OCX control
+ case PROPERTY_ID_CONTROL_TYPE_IN_MSO:
+ aReturn <<= (sal_Int16)0;
+ break;
+ case PROPERTY_ID_OBJ_ID_IN_MSO:
+ aReturn <<= (sal_uInt16)INVALID_OBJ_ID_IN_MSO;
+ break;
default:
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
m_aPropertyBagHelper.getDynamicPropertyDefaultByHandle( _nHandle, aReturn );
@@ -1015,6 +1025,13 @@ void OControlModel::getFastPropertyValue
case PROPERTY_ID_NATIVE_LOOK:
_rValue <<= (sal_Bool)m_bNativeLook;
break;
+ //added for exporting OCX control
+ case PROPERTY_ID_CONTROL_TYPE_IN_MSO:
+ _rValue <<= (sal_Int16)m_nControlTypeinMSO;
+ break;
+ case PROPERTY_ID_OBJ_ID_IN_MSO:
+ _rValue <<= (sal_uInt16)m_nObjIDinMSO;
+ break;
default:
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
m_aPropertyBagHelper.getDynamicFastPropertyValue( _nHandle, _rValue );
@@ -1044,6 +1061,13 @@ sal_Bool OControlModel::convertFastPrope
case PROPERTY_ID_NATIVE_LOOK:
bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bNativeLook);
break;
+ //added for exporting OCX control
+ case PROPERTY_ID_CONTROL_TYPE_IN_MSO:
+ bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_nControlTypeinMSO);
+ break;
+ case PROPERTY_ID_OBJ_ID_IN_MSO:
+ bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_nObjIDinMSO);
+ break;
default:
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
bModified = m_aPropertyBagHelper.convertDynamicFastPropertyValue( _nHandle, _rValue, _rConvertedValue, _rOldValue );
@@ -1078,6 +1102,13 @@ void OControlModel::setFastPropertyValue
case PROPERTY_ID_NATIVE_LOOK:
OSL_VERIFY( _rValue >>= m_bNativeLook );
break;
+ //added for exporting OCX control
+ case PROPERTY_ID_CONTROL_TYPE_IN_MSO:
+ OSL_VERIFY( _rValue >>= m_nControlTypeinMSO );
+ break;
+ case PROPERTY_ID_OBJ_ID_IN_MSO:
+ OSL_VERIFY( _rValue >>= m_nObjIDinMSO );
+ break;
default:
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
m_aPropertyBagHelper.setDynamicFastPropertyValue( _nHandle, _rValue );
@@ -1090,11 +1121,14 @@ void OControlModel::setFastPropertyValue
//------------------------------------------------------------------------------
void OControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const
{
- BEGIN_DESCRIBE_BASE_PROPERTIES( 4 )
+ //BEGIN_DESCRIBE_BASE_PROPERTIES( 4 )
+ BEGIN_DESCRIBE_BASE_PROPERTIES( 6 )
DECL_PROP2 (CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP1 (NAME, ::rtl::OUString, BOUND);
DECL_BOOL_PROP2 (NATIVE_LOOK, BOUND, TRANSIENT);
DECL_PROP1 (TAG, ::rtl::OUString, BOUND);
+ DECL_PROP1 (CONTROL_TYPE_IN_MSO,sal_Int16, BOUND);
+ DECL_PROP1 (OBJ_ID_IN_MSO,sal_uInt16, BOUND);
END_DESCRIBE_PROPERTIES()
}
Modified: incubator/ooo/trunk/main/forms/source/inc/FormComponent.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/forms/source/inc/FormComponent.hxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/forms/source/inc/FormComponent.hxx (original)
+++ incubator/ooo/trunk/main/forms/source/inc/FormComponent.hxx Tue Sep 25 05:48:42 2012
@@ -335,6 +335,8 @@ protected:
//= OControlModel
//= model of a form layer control
//==================================================================
+//added for exporting OCX control
+#define INVALID_OBJ_ID_IN_MSO 0xFFFF
typedef ::cppu::ImplHelper7 < ::com::sun::star::form::XFormComponent
, ::com::sun::star::io::XPersistObject
@@ -371,6 +373,9 @@ protected:
sal_Int16 m_nTabIndex; // index within the taborder
sal_Int16 m_nClassId; // type of the control
sal_Bool m_bNativeLook; // should the control use the native platform look?
+ //added for exporting OCX control
+ sal_Int16 m_nControlTypeinMSO; //keep the MS office control type for exporting to MS binarary file
+ sal_uInt16 m_nObjIDinMSO; //keep the OCX control obj id for exporting to MS binarary file
// </properties>
Modified: incubator/ooo/trunk/main/forms/source/inc/frm_strings.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/forms/source/inc/frm_strings.hxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/forms/source/inc/frm_strings.hxx (original)
+++ incubator/ooo/trunk/main/forms/source/inc/frm_strings.hxx Tue Sep 25 05:48:42 2012
@@ -321,6 +321,9 @@ namespace frm
FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_FOCUS, "ControlBorderColorOnFocus" );
FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_MOUSE, "ControlBorderColorOnHover" );
FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_INVALID,"ControlBorderColorOnInvalid" );
+ //added for exporting OCX control
+ FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_TYPE_IN_MSO, "ControlTypeinMSO" );
+ FORMS_CONSTASCII_STRING( PROPERTY_OBJ_ID_IN_MSO, "ObjIDinMSO" );
//--------------------------------------------------------------------------
//- URLs
Modified: incubator/ooo/trunk/main/forms/source/inc/property.hrc
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/forms/source/inc/property.hrc?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/forms/source/inc/property.hrc (original)
+++ incubator/ooo/trunk/main/forms/source/inc/property.hrc Tue Sep 25 05:48:42 2012
@@ -299,6 +299,8 @@ namespace frm
#define PROPERTY_ID_XSD_TYPE_CLASS ( PROPERTY_ID_START + 258 )
#define PROPERTY_ID_LINEEND_FORMAT ( PROPERTY_ID_START + 259 ) // css.awt.LineEndFormat
+#define PROPERTY_ID_CONTROL_TYPE_IN_MSO ( PROPERTY_ID_START + 260 )
+#define PROPERTY_ID_OBJ_ID_IN_MSO ( PROPERTY_ID_START + 261 )
// start ID fuer aggregierte Properties
#define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000)
Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xeescher.cxx Tue Sep 25 05:48:42 2012
@@ -373,7 +373,8 @@ void XclExpControlHelper::WriteFormulaSu
// ----------------------------------------------------------------------------
-#if EXC_EXP_OCX_CTRL
+//delete for exporting OCX
+//#if EXC_EXP_OCX_CTRL
XclExpOcxControlObj::XclExpOcxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape,
const Rectangle* pChildAnchor, const String& rClassName, sal_uInt32 nStrmStart, sal_uInt32 nStrmSize ) :
@@ -395,7 +396,7 @@ XclExpOcxControlObj::XclExpOcxControlObj
mrEscherEx.OpenContainer( ESCHER_SpContainer );
mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE );
Rectangle aDummyRect;
- EscherPropertyContainer aPropOpt( mrEscherEx, mrEscherEx.QueryPicStream(), aDummyRect );
+ EscherPropertyContainer aPropOpt( mrEscherEx.GetGraphicProvider(), mrEscherEx.QueryPictureStream(), aDummyRect );
aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 );
aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 ); // bool field
@@ -478,7 +479,7 @@ void XclExpOcxControlObj::WriteSubRecs(
rStrm.EndRecord();
}
-#else
+//#else
XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN, true ),
@@ -917,7 +918,7 @@ void XclExpTbxControlObj::WriteSbs( XclE
rStrm.EndRecord();
}
-#endif
+//#endif
// ----------------------------------------------------------------------------
Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx Tue Sep 25 05:48:42 2012
@@ -46,6 +46,7 @@
#include <com/sun/star/form/binding/XListEntrySource.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <rtl/logfile.hxx>
#include <sfx2/objsh.hxx>
@@ -111,6 +112,8 @@ using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Any;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -450,6 +453,73 @@ SdrObject* XclImpDrawObjBase::CreateSdrO
xSdrObj.reset( DoCreateSdrObj( rDffConv, rAnchorRect ) );
if( xSdrObj.is() )
xSdrObj->SetModel( rDffConv.GetModel() );
+ //added for exporting OCX control
+ /* mnObjType value set should be as below table:
+ 0x0000 Group 0x0001 Line
+ 0x0002 Rectangle 0x0003 Oval
+ 0x0004 Arc 0x0005 Chart
+ 0x0006 Text 0x0009 Polygon
+ +-----------------------------------------------------+
+ OCX ==>| 0x0008 Picture |
+ +-----------------------------------------------------+
+ | 0x0007 Button |
+ | 0x000B Checkbox 0x000C Radio button |
+ | 0x000D Edit box 0x000E Label |
+ TBX ==> | 0x000F Dialog box 0x0010 Spin control |
+ | 0x0011 Scrollbar 0x0012 List |
+ | 0x0013 Group box 0x0014 Dropdown list |
+ +-----------------------------------------------------+
+ 0x0019 Note 0x001E OfficeArt object
+ */
+ if( xSdrObj.is() && xSdrObj->IsUnoObj() &&
+ ( (mnObjType < 25 && mnObjType > 10) || mnObjType == 7 || mnObjType == 8 ) )
+ {
+ SdrUnoObj* pSdrUnoObj = dynamic_cast< SdrUnoObj* >( xSdrObj.get() );
+ if( pSdrUnoObj != NULL )
+ {
+ Reference< XControlModel > xCtrlModel = pSdrUnoObj->GetUnoControlModel();
+ Reference< XPropertySet > xPropSet(xCtrlModel,UNO_QUERY);
+ const static rtl::OUString sPropertyName = rtl::OUString::createFromAscii("ControlTypeinMSO");
+
+ enum ControlType { eCreateFromAOO = 0, eCreateFromMSTBXControl, eCreateFromMSOCXControl };
+
+ if( mnObjType == 7 || (mnObjType < 25 && mnObjType > 10) )//TBX
+ {
+ //Need summary type for export. Detail type(checkbox, button ...) has been contained by mnObjType
+ const sal_Int16 nTBXControlType = eCreateFromMSTBXControl ;
+ Any aAny;
+ aAny <<= nTBXControlType;
+ try{
+ xPropSet->setPropertyValue(sPropertyName, aAny);
+ }catch(...)
+ {
+ OSL_TRACE("XclImpDrawObjBase::CreateSdrObject, this control can't be set the property ControlTypeinMSO!");
+ }
+ }
+ if( mnObjType == 8 )//OCX
+ {
+ //Need summary type for export
+ const static rtl::OUString sObjIdPropertyName = rtl::OUString::createFromAscii("ObjIDinMSO");
+ const XclImpPictureObj* const pObj = dynamic_cast< const XclImpPictureObj* const >(this);
+ if( pObj != NULL && pObj->IsOcxControl() )
+ {
+ const sal_Int16 nOCXControlType = eCreateFromMSOCXControl;
+ Any aAny;
+ try{
+ aAny <<= nOCXControlType;
+ xPropSet->setPropertyValue(sPropertyName, aAny);
+ //Detail type(checkbox, button ...)
+ aAny<<= mnObjId;
+ xPropSet->setPropertyValue(sObjIdPropertyName, aAny);
+ }catch(...)
+ {
+ OSL_TRACE("XclImpDrawObjBase::CreateSdrObject, this control can't be set the property ObjIDinMSO!");
+ }
+ }
+ }
+
+ }
+ }
}
return xSdrObj.release();
}
Modified: incubator/ooo/trunk/main/sc/source/filter/inc/xcl97esc.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/inc/xcl97esc.hxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/inc/xcl97esc.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/inc/xcl97esc.hxx Tue Sep 25 05:48:42 2012
@@ -32,7 +32,7 @@
#include "xeroot.hxx"
// 0 = Export TBX form controls, 1 = Export OCX form controls.
-#define EXC_EXP_OCX_CTRL 0
+//#define EXC_EXP_OCX_CTRL 0
namespace utl { class TempFile; }
@@ -61,11 +61,12 @@ class XclExpDffAnchorBase;
class XclEscherHostAppData;
class XclEscherClientData;
class XclEscherClientTextbox;
-#if EXC_EXP_OCX_CTRL
+//delete for exporting OCX
+//#if EXC_EXP_OCX_CTRL
class XclExpOcxControlObj;
-#else
+//#else
class XclExpTbxControlObj;
-#endif
+//#endif
class XclEscherEx : public EscherEx, protected XclExpRoot
{
@@ -104,29 +105,30 @@ public:
/// Flush and merge PicStream into EscherStream
void EndDocument();
-
-#if EXC_EXP_OCX_CTRL
+//delete for exporting OCX
+//#if EXC_EXP_OCX_CTRL
/** Creates an OCX form control OBJ record from the passed form control.
@descr Writes the form control data to the 'Ctls' stream. */
- XclExpOcxControlObj* CreateCtrlObj(
+ XclExpOcxControlObj* CreateOCXCtrlObj(
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
const Rectangle* pChildAnchor );
-
-private:
- SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
-#else
/** Creates a TBX form control OBJ record from the passed form control. */
- XclExpTbxControlObj* CreateCtrlObj(
+ XclExpTbxControlObj* CreateTBXCtrlObj(
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
const Rectangle* pChildAnchor );
+
+private:
+ SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
+//#else
+
private:
/** Tries to get the name of a Basic macro from a control. */
void ConvertTbxMacro(
XclExpTbxControlObj& rTbxCtrlObj,
::com::sun::star::uno::Reference<
::com::sun::star::awt::XControlModel > xCtrlModel );
-#endif
+//#endif
void DeleteCurrAppData();
Modified: incubator/ooo/trunk/main/sc/source/filter/inc/xeescher.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/inc/xeescher.hxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/inc/xeescher.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/inc/xeescher.hxx Tue Sep 25 05:48:42 2012
@@ -205,7 +205,8 @@ private:
// ----------------------------------------------------------------------------
-#if EXC_EXP_OCX_CTRL
+//delete for exporting OCX
+//#if EXC_EXP_OCX_CTRL
/** Represents an OBJ record for an OCX form control. */
class XclExpOcxControlObj : public XclObj, public XclExpControlHelper
@@ -227,7 +228,7 @@ private:
sal_uInt32 mnStrmSize; /// Size in 'Ctls' stream.
};
-#else
+//#else
/** Represents an OBJ record for an TBX form control. */
class XclExpTbxControlObj : public XclObj, public XclExpControlHelper
@@ -271,7 +272,7 @@ private:
bool mbScrollHor; /// Scrollbar: true = horizontal.
};
-#endif
+//#endif
// ----------------------------------------------------------------------------
Modified: incubator/ooo/trunk/main/sc/source/filter/xcl97/xcl97esc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/xcl97/xcl97esc.cxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/xcl97/xcl97esc.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/xcl97/xcl97esc.cxx Tue Sep 25 05:48:42 2012
@@ -29,6 +29,8 @@
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/form/XForm.hpp>
#include <svx/svdpage.hxx>
#include <editeng/outlobj.hxx>
@@ -67,6 +69,10 @@ using ::com::sun::star::container::XInde
using ::com::sun::star::embed::XClassifiedObject;
using ::com::sun::star::drawing::XShape;
using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::form::XForm;
+using ::com::sun::star::form::XFormComponent;
using ::com::sun::star::form::XFormsSupplier;
using ::com::sun::star::script::ScriptEventDescriptor;
using ::com::sun::star::script::XEventAttacherManager;
@@ -207,6 +213,8 @@ EscherExHostAppData* XclEscherEx::StartS
aStack.Push( pCurrAppData );
pCurrAppData = new XclEscherHostAppData;
SdrObject* pObj = GetSdrObjectFromXShape( rxShape );
+ //added for exporting OCX control
+ sal_Int16 nMsCtlType = 0;
if ( !pObj )
pCurrXclObj = new XclObjAny( mrObjMgr ); // just what is it?!?
else
@@ -240,13 +248,21 @@ EscherExHostAppData* XclEscherEx::StartS
}
else if( nObjType == OBJ_UNO )
{
-#if EXC_EXP_OCX_CTRL
- // no ActiveX controls in embedded drawings (chart shapes)
- if( mbIsRootDff )
- pCurrXclObj = CreateCtrlObj( rxShape, pChildAnchor );
-#else
- pCurrXclObj = CreateCtrlObj( rxShape, pChildAnchor );
-#endif
+ //added for exporting OCX control
+ Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY );
+ Any aAny;
+ try{
+ aAny = xPropSet->getPropertyValue(rtl::OUString::createFromAscii("ControlTypeinMSO"));
+ }catch(...)
+ {
+ OSL_TRACE("XclEscherEx::StartShape, this control can't get the property ControlTypeinMSO!");
+ }
+ aAny >>= nMsCtlType;
+
+ if( nMsCtlType == 2 ) //OCX Form Control
+ pCurrXclObj = CreateOCXCtrlObj( rxShape, pChildAnchor );
+ else //TBX Form Control
+ pCurrXclObj = CreateTBXCtrlObj( rxShape, pChildAnchor );
if( !pCurrXclObj )
pCurrXclObj = new XclObjAny( mrObjMgr ); // just a metafile
}
@@ -304,6 +320,28 @@ EscherExHostAppData* XclEscherEx::StartS
}
}
}
+ //add for exporting OCX control
+ //for OCX control import from MS office file,we need keep the id value as MS office file.
+ //GetOldRoot().pObjRecs->Add( pCurrXclObj ) statement has generated the id value as aoo obj id rule;
+ //but we trick it here.
+ sal_uInt16 nObjType = pObj->GetObjIdentifier();
+ if( nObjType == OBJ_UNO && pCurrXclObj )
+ {
+ Reference< XPropertySet > xPropSet( rxShape, UNO_QUERY );
+ Any aAny;
+ try{
+ aAny = xPropSet->getPropertyValue(rtl::OUString::createFromAscii("ObjIDinMSO"));
+ }catch(...)
+ {
+ OSL_TRACE("XclEscherEx::StartShape, this control can't get the property ObjIDinMSO!");
+ }
+ sal_uInt16 nObjIDinMSO = 0xFFFF;
+ aAny >>= nObjIDinMSO;
+ if( nObjIDinMSO != 0xFFFF && nMsCtlType == 2) //OCX
+ {
+ pCurrXclObj->SetId(nObjIDinMSO);
+ }
+ }
if ( !pCurrXclObj )
pCurrAppData->SetDontWriteShape( sal_True );
return pCurrAppData;
@@ -367,9 +405,10 @@ void XclEscherEx::EndDocument()
mpOutStrm->Seek( 0 );
}
-#if EXC_EXP_OCX_CTRL
+//delete for exporting OCX
+//#if EXC_EXP_OCX_CTRL
-XclExpOcxControlObj* XclEscherEx::CreateCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor )
+XclExpOcxControlObj* XclEscherEx::CreateOCXCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor )
{
::std::auto_ptr< XclExpOcxControlObj > xOcxCtrl;
@@ -397,9 +436,9 @@ XclExpOcxControlObj* XclEscherEx::Create
return xOcxCtrl.release();
}
-#else
+//#else
-XclExpTbxControlObj* XclEscherEx::CreateCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor )
+XclExpTbxControlObj* XclEscherEx::CreateTBXCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor )
{
::std::auto_ptr< XclExpTbxControlObj > xTbxCtrl( new XclExpTbxControlObj( mrObjMgr, xShape, pChildAnchor ) );
if( xTbxCtrl->GetObjType() == EXC_OBJTYPE_UNKNOWN )
@@ -467,7 +506,7 @@ void XclEscherEx::ConvertTbxMacro( XclEx
}
}
-#endif
+//#endif
void XclEscherEx::DeleteCurrAppData()
{
Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx?rev=1389715&r1=1389714&r2=1389715&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx Tue Sep 25 05:48:42 2012
@@ -710,6 +710,9 @@ SvxShapeControlPropertyMapping[] =
{ MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
{ MAP_CHAR_LEN("ImageScaleMode"), MAP_CHAR_LEN("ScaleMode") },
{ MAP_CHAR_LEN("ControlWritingMode"), MAP_CHAR_LEN("WritingMode") },
+ //added for exporting OCX control
+ { MAP_CHAR_LEN("ControlTypeinMSO"), MAP_CHAR_LEN("ControlTypeinMSO") },
+ { MAP_CHAR_LEN("ObjIDinMSO"), MAP_CHAR_LEN("ObjIDinMSO") },
{ NULL,0, NULL, 0 }
};