summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-07-12 10:07:53 +0100
committerNoel Power <noel.power@novell.com>2011-07-12 10:07:53 +0100
commit183c9723dce0296baa0a38220199a1aa0e9f52ca (patch)
treef0152bac45cd89542a02cb8decfad88f88daea54
parent22073ad218d9c4f16c9a901fe19a9b05b1931a58 (diff)
use oox filter for *all* control import
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx38
-rw-r--r--sw/source/filter/ww8/ww8par.hxx10
2 files changed, 46 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 7f5648f858..9bb3eaed8e 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -100,6 +100,16 @@
#include "escher.hxx"
#include <ndtxt.hxx>
#include "WW8FFData.hxx"
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <comphelper/processfactory.hxx>
+#include "docsh.hxx"
+#include <oox/ole/olehelper.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <fstream>
using ::editeng::SvxBorderLine;
using namespace com::sun::star;
@@ -2768,6 +2778,34 @@ sal_uInt32 SwEscherEx::QueryTextID(
return nId;
}
+uno::Reference< uno::XComponentContext >
+lcl_getUnoCtx()
+{
+ comphelper::ComponentContext aCtx( ::comphelper::getProcessServiceFactory() );
+ return aCtx.getUNOContext();
+}
+
+
+SwMSConvertControls::SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) : SvxMSConvertOCXControls( pDSh,pP ), maFormCtrlHelper( pDocSh->GetMedium()->GetInputStream(), lcl_getUnoCtx(), pDocSh->GetModel() )
+{
+}
+
+// in transitioning away old filter for ole/ocx controls, ReadOCXStream has been made pure virtual in
+// filter/source/msocximex.cxx, so.. we need an implementation here
+sal_Bool SwMSConvertControls::ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShapeRef,
+ sal_Bool bFloatingCtrl )
+{
+ uno::Reference< form::XFormComponent > xFComp;
+ sal_Bool bRes = maFormCtrlHelper.importFormControlFromObjPool( xFComp, rtl::OUString( rSrc1->GetName() ) );
+ if ( bRes && xFComp.is() )
+ {
+ com::sun::star::awt::Size aSz; // not used in import
+ bRes = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl);
+ }
+ return bRes;
+}
+
bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pObj)
{
if (!rWW8Wrt.bWrtWW8)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index fd8d7ddfea..df9736afff 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -55,6 +55,7 @@
#include <fmtornt.hxx>
#include <fmtsrnd.hxx>
#include <editeng/lrspitem.hxx>
+#include <oox/ole/olehelper.hxx>
class SwDoc;
class SwPaM;
@@ -670,8 +671,7 @@ public:
class SwMSConvertControls: public SvxMSConvertOCXControls
{
public:
- SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) :
- SvxMSConvertOCXControls( pDSh,pP ) {}
+ SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP );
virtual sal_Bool InsertFormula( WW8FormulaControl &rFormula);
virtual sal_Bool InsertControl(const com::sun::star::uno::Reference<
com::sun::star::form::XFormComponent >& rFComp,
@@ -679,6 +679,12 @@ public:
com::sun::star::uno::Reference <
com::sun::star::drawing::XShape > *pShape,sal_Bool bFloatingCtrl);
bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
+ virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape > *pShapeRef=0,
+ sal_Bool bFloatingCtrl=false );
+private:
+ ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper;
};
class SwMSDffManager : public SvxMSDffManager