[Libreoffice-commits] .: Branch 'libreoffice-3-4' - 7 commits - oox/inc writerfilter/source

Petr Mladek pmladek at kemper.freedesktop.org
Wed Apr 6 05:10:57 PDT 2011


 oox/inc/oox/helper/graphichelper.hxx              |    1 -
 writerfilter/source/dmapper/FormControlHelper.cxx |    2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e28d597da1048fc83813a08f9958bbdc72e7f7d8
Merge: 070ecd9... 6884ac0...
Author: Petr Mladek <pmladek at suse.cz>
Date:   Tue Apr 5 18:54:48 2011 +0200

    Merge remote-tracking branch 'origin/libreoffice-3-3' into libreoffice-3-4
    
    Conflicts:
    	oox/prj/d.lst
    	unoxml/source/xpath/nodelist.cxx
    	unoxml/source/xpath/nodelist.hxx
    	unoxml/source/xpath/xpathobject.cxx
    	writerfilter/source/dmapper/DomainMapper_Impl.cxx
    	writerfilter/source/filter/ImportFilter.cxx

commit 6884ac007a7cdcc2679dff3de982b3ef117fbafc
Author: Petr Mladek <pmladek at suse.cz>
Date:   Tue Mar 8 15:31:10 2011 +0100

    Version 3.3.2.1, tag libreoffice-3.3.2.1 (3.3.2-rc1)
commit 94d1b166d9b4214da66546eb2cc288fb6ccdfa59
Author: Petr Mladek <pmladek at suse.cz>
Date:   Mon Mar 7 22:44:35 2011 +0100

    fix build in writerfilter
    
    deliver newly needed oox\helper\graphichelper.hxx

diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index e25a8d8..e2f066c 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -26,6 +26,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls
 ..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
 ..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
 ..\inc\oox\helper\containerhelper.hxx %_DEST%\inc%_EXT%\oox\helper\containerhelper.hxx
+..\inc\oox\helper\graphichelper.hxx %_DEST%\inc%_EXT%\oox\helper\graphichelper.hxx
 ..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
 ..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
 ..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
commit 41148164fb043e7e78fdd5e27001684b278f1f7c
Author: Noel Power <noel.power at novell.com>
Date:   Wed Mar 2 11:20:45 2011 +0000

    resolves fdo#34909
    
    enable import of macros for docxm

diff --git a/oox/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx
index 1a07f23..5134ef6 100644
--- a/oox/inc/oox/helper/graphichelper.hxx
+++ b/oox/inc/oox/helper/graphichelper.hxx
@@ -65,7 +65,7 @@ namespace oox {
     resolves the graphic object from the passed URL and thus prevents it from
     being destroyed.
  */
-class GraphicHelper
+class OOX_DLLPUBLIC GraphicHelper
 {
 public:
     explicit            GraphicHelper(
diff --git a/oox/inc/oox/ole/olestorage.hxx b/oox/inc/oox/ole/olestorage.hxx
index dc97f97..97108a6 100644
--- a/oox/inc/oox/ole/olestorage.hxx
+++ b/oox/inc/oox/ole/olestorage.hxx
@@ -42,7 +42,7 @@ namespace ole {
 // ============================================================================
 
 /** Implements stream access for binary OLE storages. */
-class OleStorage : public StorageBase
+class OOX_DLLPUBLIC OleStorage : public StorageBase
 {
 public:
     explicit            OleStorage(
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 0cd6971..e25a8d8 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -40,6 +40,8 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls
 ..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx
 ..\inc\oox\export\*.hxx %_DEST%\inc%_EXT%\oox\export\*.hxx
 ..\inc\oox\ole\oleobjecthelper.hxx %_DEST%\inc%_EXT%\oox\ole\oleobjecthelper.hxx
+..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx
+..\inc\oox\ole\olestorage.hxx %_DEST%\inc%_EXT%\oox\ole\olestorage.hxx
 
 dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
 
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index b6d45c5..0566e19 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -84,7 +84,7 @@ class WRITERFILTER_DLLPUBLIC OOXMLStream
 {
 public:
     enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, FONTTABLE, NUMBERING,
-        FOOTNOTES, ENDNOTES, COMMENTS, THEME, SETTINGS };
+        FOOTNOTES, ENDNOTES, COMMENTS, THEME, SETTINGS, VBAPROJECT };
     typedef boost::shared_ptr<OOXMLStream> Pointer_t;
 
     virtual ~OOXMLStream() {}
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index 1dd9f92..c3cf539 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -42,6 +42,9 @@
 #endif
 
 #include <resourcemodel/TagLogger.hxx>
+#include <oox/ole/olestorage.hxx>
+#include <oox/ole/vbaproject.hxx>
+#include <oox/helper/graphichelper.hxx>
 using namespace ::rtl;
 using namespace ::com::sun::star;
 using ::comphelper::MediaDescriptor;
@@ -125,6 +128,23 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
         pDocument->setDrawPage(xDrawPage);
 
         pDocument->resolve(*pStream);
+        writerfilter::ooxml::OOXMLStream::Pointer_t  pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream( pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT ));
+        oox::StorageRef xVbaPrjStrg( new ::oox::ole::OleStorage( uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), pVBAProjectStream->getDocumentStream(), false ) );
+        if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
+        {
+            ::oox::ole::VbaProject aVbaProject( uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), xModel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Writer" ) ) );
+            uno::Reference< frame::XFrame > xFrame = aMediaDesc.getUnpackedValueOrDefault(  MediaDescriptor::PROP_FRAME(), uno::Reference< frame::XFrame > () );
+
+            // if no XFrame try fallback to what we can glean from the Model
+            if ( !xFrame.is() )
+            {
+                uno::Reference< frame::XController > xController =  xModel->getCurrentController();
+                xFrame =  xController.is() ? xController->getFrame() : NULL;
+            }
+
+            oox::GraphicHelper gHelper(  uno::Reference< lang::XMultiServiceFactory >( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ), xFrame, xVbaPrjStrg );
+            aVbaProject.importVbaProject( *xVbaPrjStrg, gHelper );
+        }
     }
     else
     {
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index d2c463b..fd1d7d0 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -115,11 +115,15 @@ bool OOXMLStreamImpl::lcl_getTarget(uno::Reference<embed::XRelationshipAccess>
     static rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("Target"));
     static rtl::OUString sTargetMode(RTL_CONSTASCII_USTRINGPARAM("TargetMode"));
     static rtl::OUString sExternal(RTL_CONSTASCII_USTRINGPARAM("External"));
+    static rtl::OUString sVBAProjectType(RTL_CONSTASCII_USTRINGPARAM("http://schemas.microsoft.com/office/2006/relationships/vbaProject"));
 
     rtl::OUString sStreamType;
 
     switch (nStreamType)
     {
+        case VBAPROJECT:
+            sStreamType = sVBAProjectType;
+            break;
         case DOCUMENT:
             sStreamType = sDocumentType;
             break;
commit 2ba830b380e7261626f4e59a1271a3f3ef2b7508
Author: Noel Power <noel.power at novell.com>
Date:   Wed Mar 2 20:31:07 2011 +0000

    resolves #fdo34941
    
    ensure a valid mediatype is set up for the ooxml filters so that ooo::vba::isAlienExcelDoc can give the correct result

diff --git a/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu
index ab9e409..7216db8 100644
--- a/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu
+++ b/filter/source/config/fragments/types/MS_Excel_2007_XML.xcu
@@ -2,7 +2,7 @@
     <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
     <prop oor:name="URLPattern"/>
     <prop oor:name="Extensions"><value>xlsx xlsm</value></prop>
-    <prop oor:name="MediaType"/>
+    <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop>
     <prop oor:name="Preferred"><value>false</value></prop>
     <prop oor:name="PreferredFilter"><value>Calc MS Excel 2007 XML</value></prop>
     <prop oor:name="UIName"><value xml:lang="x-default">Microsoft Excel 2007 XML</value></prop>
diff --git a/filter/source/config/fragments/types/calc_OOXML.xcu b/filter/source/config/fragments/types/calc_OOXML.xcu
index 40fd3ee..016d322 100644
--- a/filter/source/config/fragments/types/calc_OOXML.xcu
+++ b/filter/source/config/fragments/types/calc_OOXML.xcu
@@ -2,7 +2,7 @@
     <prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
     <prop oor:name="URLPattern"/>
     <prop oor:name="Extensions"><value>xlsx xlsm</value></prop>
-    <prop oor:name="MediaType"/>
+    <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop>
     <prop oor:name="Preferred"><value>false</value></prop>
     <prop oor:name="PreferredFilter"><value>Calc Office Open XML</value></prop>
     <prop oor:name="UIName"><value xml:lang="x-default">Office Open XML Spreadsheet</value></prop>
commit e8b22c5b62178de3d3aa8cf23c7583eca393c11e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 2 11:09:41 2011 +0000

    Resolves: fdo#33701 ensure node outlives path
    
    The xpath on destruction needs the xmldoc to exist, so the reference
    to the doc-owning nodelist needs to be the first reference listed
    in the class in order that its dtor is called *after* the xpath
    dtor
    
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/unoxml/source/xpath/nodelist.cxx b/unoxml/source/xpath/nodelist.cxx
index b4e3313..884cf85 100644
--- a/unoxml/source/xpath/nodelist.cxx
+++ b/unoxml/source/xpath/nodelist.cxx
@@ -31,8 +31,8 @@
 
 namespace XPath
 {
-    CNodeList::CNodeList(boost::shared_ptr<xmlXPathObject>& rxpathObj, const Reference< XNode >& contextNode)
-        : m_xContextNode(contextNode)
+    CNodeList::CNodeList(const Reference< XNode >& rContextNode, boost::shared_ptr<xmlXPathObject>& rxpathObj)
+        : m_xContextNode(rContextNode)
         , m_pNodeSet(0)
     {
         if (rxpathObj != NULL && rxpathObj->type == XPATH_NODESET)
diff --git a/unoxml/source/xpath/nodelist.hxx b/unoxml/source/xpath/nodelist.hxx
index 31b9b51..c917a7d 100644
--- a/unoxml/source/xpath/nodelist.hxx
+++ b/unoxml/source/xpath/nodelist.hxx
@@ -53,12 +53,12 @@ namespace XPath
     class CNodeList : public cppu::WeakImplHelper1< XNodeList >
     {
     private:
-        boost::shared_ptr<xmlXPathObject> m_pXPathObj;
         const Reference< XNode > m_xContextNode;
+        boost::shared_ptr<xmlXPathObject> m_pXPathObj;
         xmlNodeSetPtr m_pNodeSet;
 
     public:
-        CNodeList(boost::shared_ptr<xmlXPathObject> &rxpathObj, const Reference< XNode >& contextNode);
+        CNodeList(const Reference< XNode >& contextNode, boost::shared_ptr<xmlXPathObject> &rxpathObj);
         /**
         The number of nodes in the list.
         */
diff --git a/unoxml/source/xpath/xpathobject.cxx b/unoxml/source/xpath/xpathobject.cxx
index 67a8f59..bbb8a5b 100644
--- a/unoxml/source/xpath/xpathobject.cxx
+++ b/unoxml/source/xpath/xpathobject.cxx
@@ -86,7 +86,7 @@ namespace XPath
     */
     Reference< XNodeList > SAL_CALL CXPathObject::getNodeList() throw (RuntimeException)
     {
-        return Reference< XNodeList >(new CNodeList(m_pXPathObj, m_xContextNode));
+        return Reference< XNodeList >(new CNodeList(m_xContextNode, m_pXPathObj));
     }
     
      /**
commit d9f989748b178e12294e16e25cad75456859625c
Author: Noel Power <noel.power at novell.com>
Date:   Thu Feb 24 21:42:01 2011 +0000

    fix for fdo#34664 - prevent null pointer access when no ffdata available
    
    Signed-off-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 57b6bcc..77b09eb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3077,7 +3077,8 @@ void DomainMapper_Impl::CloseFieldCommand()
                     {
                         FFDataHandler::Pointer_t pFFDataHandler
                             (pContext->getFFDataHandler());
-
+                        if ( !pFFDataHandler )
+                            throw uno::RuntimeException();
                         xFieldProperties->setPropertyValue
                             (rPropNameSupplier.GetName(PROP_HINT),
                             uno::makeAny(pFFDataHandler->getStatusText()));
diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx
index b47186c..4318567 100644
--- a/writerfilter/source/dmapper/FormControlHelper.cxx
+++ b/writerfilter/source/dmapper/FormControlHelper.cxx
@@ -156,6 +156,8 @@ FormControlHelper::~FormControlHelper()
 bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> xTextRange,
                                        const ::rtl::OUString & rControlName)
 {
+    if ( !m_pFFData )
+        return false;
     uno::Reference<lang::XMultiServiceFactory> 
         xServiceFactory(m_pImpl->getServiceFactory());
 


More information about the Libreoffice-commits mailing list