[ooo-build-commit] patches/dev300

Radek Doulík rodo at kemper.freedesktop.org
Tue Jun 2 08:59:30 PDT 2009


 patches/dev300/apply                           |    2 
 patches/dev300/oox-pptx-export-hyperlinks.diff |  123 +++++++++++++++++++++++++
 2 files changed, 125 insertions(+)

New commits:
commit 205a35fd87809ffffb119bd50751e3bd4b032d20
Author: Radek Doulik <rodo at novell.com>
Date:   Tue Jun 2 17:51:33 2009 +0200

    ooxml export: export text hyperlinks
    
    * patches/dev300/apply:
    * patches/dev300/oox-pptx-export-hyperlinks.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index dbf2116..ba05727 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3069,3 +3069,5 @@ configmgr-validate-removedtree.diff, n#505704
 oox-pptx-import-fix-placeholder-text-style.diff, n#479834, rodo
 oox-pptx-import-fix-text-body-properties-priority.diff, n#403402, rodo
 
+[ OOXMLExport ]
+oox-pptx-export-hyperlinks.diff, n#499124, rodo
diff --git a/patches/dev300/oox-pptx-export-hyperlinks.diff b/patches/dev300/oox-pptx-export-hyperlinks.diff
new file mode 100644
index 0000000..150f377
--- /dev/null
+++ b/patches/dev300/oox-pptx-export-hyperlinks.diff
@@ -0,0 +1,123 @@
+diff -rup oox-orig/inc/oox/export/drawingml.hxx oox/inc/oox/export/drawingml.hxx
+--- oox-orig/inc/oox/export/drawingml.hxx	2009-06-02 15:32:37.000000000 +0200
++++ oox/inc/oox/export/drawingml.hxx	2009-06-02 17:03:59.000000000 +0200
+@@ -52,7 +52,7 @@ protected:
+     bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ 			      ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
+ 			      String aName, ::com::sun::star::beans::PropertyState& eState );
+-    const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
++    const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField );
+ 
+     rtl::OUString WriteImage( const rtl::OUString& rURL );
+ 
+@@ -91,7 +91,7 @@ public:
+     void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+                                   sal_Int16 nLevel );
+     void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
+-    void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
++    void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool bIsField );
+ 
+     void WritePresetShape( const char* pShape );
+     void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
+diff -rup oox-orig/source/export/drawingml.cxx oox/source/export/drawingml.cxx
+--- oox-orig/source/export/drawingml.cxx	2009-06-02 15:32:38.000000000 +0200
++++ oox/source/export/drawingml.cxx	2009-06-02 17:42:14.000000000 +0200
+@@ -614,7 +614,7 @@ void DrawingML::WriteShapeTransformation
+     WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), bFlipH, bFlipV, nRotation );
+ }
+ 
+-void DrawingML::WriteRunProperties( Reference< XTextRange > rRun )
++void DrawingML::WriteRunProperties( Reference< XTextRange > rRun, sal_Bool bIsField )
+ {
+     Reference< XPropertySet > rXPropSet( rRun, UNO_QUERY );
+     Reference< XPropertyState > rXPropState( rRun, UNO_QUERY );
+@@ -779,10 +779,33 @@ void DrawingML::WriteRunProperties( Refe
+                                FSEND );
+     }
+ 
++    if( bIsField ) {
++        Reference< XTextField > rXTextField;
++        GET( rXTextField, TextField );
++        if( rXTextField.is() )
++            rXPropSet.set( rXTextField, UNO_QUERY );
++    }
++
++    // field properties starts here
++    if( GETA( URL ) ) {
++	OUString sURL;
++
++	mAny >>= sURL;
++	if( sURL.getLength() ) {
++	    OUString sRelId = mpFB->addRelation( mpFS->getOutputStream(),
++							  US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ),
++							  sURL, US( "External" ) );
++
++	    mpFS->singleElementNS( XML_a, XML_hlinkClick,
++				   FSNS( XML_r,XML_id ), USS( sRelId ),
++				   FSEND );
++	}
++    }
++
+     mpFS->endElementNS( XML_a, XML_rPr );
+ }
+ 
+-const char* DrawingML::GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun )
++const char* DrawingML::GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField )
+ {
+     const char* sType = NULL;
+     Reference< XPropertySet > rXPropSet( rRun, UNO_QUERY );
+@@ -797,6 +820,7 @@ const char* DrawingML::GetFieldType( ::c
+         Reference< XTextField > rXTextField;
+         GET( rXTextField, TextField );
+         if( rXTextField.is() ) {
++	    bIsField = sal_True;
+             rXPropSet.set( rXTextField, UNO_QUERY );
+             if( rXPropSet.is() ) {
+                 String aFieldKind( rXTextField->getPresentation( TRUE ) );
+@@ -804,6 +828,10 @@ const char* DrawingML::GetFieldType( ::c
+                 if( aFieldKind == S( "Page" ) ) {
+                     return "slidenum";
+                 }
++		// else if( aFieldKind == S( "URL" ) ) {
++		// do not return here
++		// and make URL field text run with hyperlink property later
++		// }
+             }
+         }
+     }
+@@ -849,13 +877,13 @@ void DrawingML::GetUUID( OStringBuffer&
+ void DrawingML::WriteRun( Reference< XTextRange > rRun )
+ {
+     const char* sFieldType;
+-    bool bIsField = false;
++    sal_Bool bIsField = sal_False;
+     OUString sText = rRun->getString();
+ 
+     if( sText.getLength() < 1)
+         return;
+ 
+-    if( ( sFieldType = GetFieldType( rRun ) ) ) {
++    if( ( sFieldType = GetFieldType( rRun, bIsField ) ) ) {
+         OStringBuffer sUUID(39);
+ 
+         GetUUID( sUUID );
+@@ -863,17 +891,16 @@ void DrawingML::WriteRun( Reference< XTe
+                               XML_id, sUUID.getStr(),
+                               XML_type, sFieldType,
+                               FSEND );
+-        bIsField = true;
+     } else
+         mpFS->startElementNS( XML_a, XML_r, FSEND );
+ 
+-    WriteRunProperties( rRun );
++    WriteRunProperties( rRun, bIsField );
+ 
+     mpFS->startElementNS( XML_a, XML_t, FSEND );
+     mpFS->writeEscaped( sText );
+     mpFS->endElementNS( XML_a, XML_t );
+ 
+-    if( bIsField )
++    if( sFieldType )
+         mpFS->endElementNS( XML_a, XML_fld );
+     else
+         mpFS->endElementNS( XML_a, XML_r );


More information about the ooo-build-commit mailing list