[Libreoffice-commits] .: sc/source

Noel Power noelp at kemper.freedesktop.org
Thu Jun 7 06:07:12 PDT 2012


 sc/source/filter/oox/worksheetfragment.cxx |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 0f86f678ff98115d32a381134985a1bd0d8c931e
Author: Noel Power <noel.power at novell.com>
Date:   Thu Jun 7 14:00:03 2012 +0100

    attempt to use mce::FallBack for control/oleObject import
    
    commit commit afbb2d8f7d72292532a9ea54fa2e6757b6d548c2 broke the existing mce::FallBack processing.
    
    Change-Id: I05296f6aad3841a8dd40aa345207c0114e0c7701

diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 8616305..3743b0b 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -330,12 +330,26 @@ ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const
                 case XLS_TOKEN( evenFooter ):       return this;    // collect h/f contents in onCharacters()
             }
         break;
-
+        // Only process an oleObject or control if outside a mc:AlternateContent
+        // element OR if within a mc:Fallback. I suppose ideally we
+        // should process the stuff within 'mc:Choice'
+	case XLS_TOKEN( controls ):
         case XLS_TOKEN( oleObjects ):
-            if( nElement == XLS_TOKEN( oleObject ) && aMceState.empty() ) importOleObject( rAttribs );
-        break;
-        case XLS_TOKEN( controls ):
-            if( nElement == XLS_TOKEN( control ) && aMceState.empty() ) importControl( rAttribs );
+            if ( getCurrentElement() == XLS_TOKEN( controls ) )
+            {
+                if( aMceState.empty() || ( !aMceState.empty() && aMceState.back() == MCE_STARTED ) )
+                {
+                    if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs );
+                    else
+                        importControl( rAttribs );
+                }
+                else if ( !aMceState.empty() && aMceState.back() == MCE_FOUND_CHOICE )
+                {
+                    // reset the handling within 'Choice'
+                    // this will force attempted handling in Fallback
+                    aMceState.back() = MCE_STARTED;
+                }
+            }
         break;
     }
     return 0;


More information about the Libreoffice-commits mailing list