[Libreoffice-commits] .: sw/source

Noel Power noelp at kemper.freedesktop.org
Tue Jul 12 02:46:38 PDT 2011


 sw/source/filter/ww8/wrtw8esh.cxx |   38 ++++++++++++++++++++++++++++++++++++++
 sw/source/filter/ww8/ww8par.hxx   |   10 ++++++++--
 2 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit 183c9723dce0296baa0a38220199a1aa0e9f52ca
Author: Noel Power <noel.power at novell.com>
Date:   Tue Jul 12 10:07:53 2011 +0100

    use oox filter for *all* control import

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 7f5648f..9bb3eae 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 fd8d7dd..df9736a 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


More information about the Libreoffice-commits mailing list