You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by cl...@apache.org on 2014/03/13 10:05:31 UTC

svn commit: r1577071 [1/2] - in /openoffice/branches/ooxml/main: filter/inc/filter/msfilter/ filter/source/msfilter/ oox/inc/oox/export/ oox/source/export/ sc/inc/ sc/source/filter/excel/ sc/source/filter/inc/ sc/source/filter/xcl97/

Author: clarence_guo
Date: Thu Mar 13 09:05:31 2014
New Revision: 1577071

URL: http://svn.apache.org/r1577071
Log:
commit code for ooxml export of calc conditional format and calc comment

Modified:
    openoffice/branches/ooxml/main/filter/inc/filter/msfilter/escherex.hxx
    openoffice/branches/ooxml/main/filter/source/msfilter/escherex.cxx
    openoffice/branches/ooxml/main/filter/source/msfilter/eschesdo.cxx
    openoffice/branches/ooxml/main/oox/inc/oox/export/vmlexport.hxx
    openoffice/branches/ooxml/main/oox/source/export/makefile.mk
    openoffice/branches/ooxml/main/oox/source/export/preset-definitions-to-shape-types.pl
    openoffice/branches/ooxml/main/oox/source/export/vmlexport.cxx
    openoffice/branches/ooxml/main/sc/inc/conditio.hxx
    openoffice/branches/ooxml/main/sc/source/filter/excel/xecontent.cxx
    openoffice/branches/ooxml/main/sc/source/filter/excel/xeescher.cxx
    openoffice/branches/ooxml/main/sc/source/filter/excel/xestream.cxx
    openoffice/branches/ooxml/main/sc/source/filter/excel/xestyle.cxx
    openoffice/branches/ooxml/main/sc/source/filter/inc/xcl97rec.hxx
    openoffice/branches/ooxml/main/sc/source/filter/inc/xecontent.hxx
    openoffice/branches/ooxml/main/sc/source/filter/inc/xeescher.hxx
    openoffice/branches/ooxml/main/sc/source/filter/inc/xestyle.hxx
    openoffice/branches/ooxml/main/sc/source/filter/inc/xlcontent.hxx
    openoffice/branches/ooxml/main/sc/source/filter/xcl97/xcl97rec.cxx

Modified: openoffice/branches/ooxml/main/filter/inc/filter/msfilter/escherex.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/filter/inc/filter/msfilter/escherex.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/filter/inc/filter/msfilter/escherex.hxx (original)
+++ openoffice/branches/ooxml/main/filter/inc/filter/msfilter/escherex.hxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef _SVX_ESCHEREX_HXX
 #define _SVX_ESCHEREX_HXX
 
@@ -1226,10 +1224,10 @@ class MSFILTER_DLLPUBLIC EscherPropertyC
         void        CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
 		void		CreateGradientProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & , sal_Bool bTransparentGradient = sal_False );
 		void		CreateLineProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
-		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge , sal_Bool bTransparentGradient = sal_False );
+		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge , sal_Bool bTransparentGradient = sal_False, sal_Bool bWrap = sal_True );
 		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ,  const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape );
 		void		CreateTextProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_uInt32 nText,
-						const sal_Bool bIsCustomShape = sal_False, const sal_Bool bIsTextFrame = sal_True );
+						const sal_Bool bIsCustomShape = sal_False, const sal_Bool bIsTextFrame = sal_True, const sal_Bool bHaveWrapProp = sal_True );
 
 		sal_Bool	CreateConnectorProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
 												EscherSolverContainer& rSolver, ::com::sun::star::awt::Rectangle& rGeoRect,
@@ -1239,6 +1237,8 @@ class MSFILTER_DLLPUBLIC EscherPropertyC
 					// It activ only when at least a FillStyle or LineStyle is set.
 		sal_Bool	CreateShadowProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & );
 
+		void        CreateProtectionProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & );
+
 		sal_Int32	GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, 
 							const std::vector< sal_Int32 >& rEquationOrder, sal_Bool bAdjustTrans = sal_False );
 		// creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties

Modified: openoffice/branches/ooxml/main/filter/source/msfilter/escherex.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/filter/source/msfilter/escherex.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/filter/source/msfilter/escherex.cxx (original)
+++ openoffice/branches/ooxml/main/filter/source/msfilter/escherex.cxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_filter.hxx"
 #include "eschesdo.hxx"
@@ -587,11 +585,14 @@ void	EscherPropertyContainer::CreateFill
 
 void EscherPropertyContainer::CreateFillProperties(
 	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
-	sal_Bool bEdge , sal_Bool bTransparentGradient)
+	sal_Bool bEdge , sal_Bool bTransparentGradient, sal_Bool bWrap )
 
 {
-	::com::sun::star::uno::Any aAny;
-    AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
+    ::com::sun::star::uno::Any aAny;
+    // add parameter "bWrap". For comments, wrap text prop should not
+    // be set. Or transparency can not work.
+    if(bWrap)
+        AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
     AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
 
     sal_uInt32 nFillBackColor = 0;
@@ -667,7 +668,7 @@ void EscherPropertyContainer::CreateFill
 
 void EscherPropertyContainer::CreateTextProperties(
 	const uno::Reference< beans::XPropertySet > & rXPropSet, sal_uInt32 nTextId,
-		const sal_Bool bIsCustomShape, const sal_Bool bIsTextFrame )
+		const sal_Bool bIsCustomShape, const sal_Bool bIsTextFrame, const sal_Bool bHaveWrapProp )
 {
     uno::Any aAny;
 	text::WritingMode				eWM( text::WritingMode_LR_TB );
@@ -852,12 +853,14 @@ void EscherPropertyContainer::CreateText
     AddOpt( ESCHER_Prop_dyTextTop, nTop * 360 );
     AddOpt( ESCHER_Prop_dyTextBottom, nBottom * 360 );
 
-	AddOpt( ESCHER_Prop_WrapText, eWrapMode );
-	AddOpt( ESCHER_Prop_AnchorText, eAnchor );
+    // there is no wrap prop for comment text box
+    if( bHaveWrapProp )
+        AddOpt( ESCHER_Prop_WrapText, eWrapMode );
+    AddOpt( ESCHER_Prop_AnchorText, eAnchor );
     AddOpt( ESCHER_Prop_FitTextToShape, nTextAttr );
 
-	if ( nTextId )
-		AddOpt( ESCHER_Prop_lTxid, nTextId );
+    if ( nTextId )
+        AddOpt( ESCHER_Prop_lTxid, nTextId );
 }
 
 sal_Bool EscherPropertyContainer::GetLineArrow( const sal_Bool bLineStart,
@@ -2444,6 +2447,25 @@ sal_Bool EscherPropertyContainer::Create
 	return bHasShadow;
 }
 
+void EscherPropertyContainer::CreateProtectionProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet)
+{
+    ::com::sun::star::uno::Any aAny;
+    sal_Int8 nLocked = 0;
+    //  size lock + position lock = Excel Lock
+    if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+            String( RTL_CONSTASCII_USTRINGPARAM( "MoveProtect" ) ), sal_True ) )
+    {
+        nLocked = *((sal_Int8*)aAny.getValue());
+        AddOpt(ESCHER_Prop_LockPosition, nLocked);
+    }
+    if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet,
+            String( RTL_CONSTASCII_USTRINGPARAM( "SizeProtect" ) ), sal_True ) )
+    {
+        nLocked = *((sal_Int8*)aAny.getValue());
+        AddOpt(ESCHER_Prop_LockAdjustHandles, nLocked);
+    }
+}
+
 // ---------------------------------------------------------------------------------------------
 
 sal_Int32 EscherPropertyContainer::GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, 
@@ -2613,7 +2635,7 @@ void ConvertEnhancedCustomShapeEquation(
 		}
 	}
 }
-//zhaosz_xml
+
 sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape )
 {
     sal_Bool bIsDefaultObject = sal_False;

Modified: openoffice/branches/ooxml/main/filter/source/msfilter/eschesdo.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/filter/source/msfilter/eschesdo.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/filter/source/msfilter/eschesdo.cxx (original)
+++ openoffice/branches/ooxml/main/filter/source/msfilter/eschesdo.cxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_filter.hxx"
 #include "eschesdo.hxx"
@@ -94,7 +92,6 @@ Point ImplEESdrWriter::ImplMapPoint( con
 	return OutputDevice::LogicToLogic( rPoint, maMapModeSrc, maMapModeDest );
 }
 
-
 // -------------------------------------------------------------------
 
 Size ImplEESdrWriter::ImplMapSize( const Size& rSize )

Modified: openoffice/branches/ooxml/main/oox/inc/oox/export/vmlexport.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/oox/inc/oox/export/vmlexport.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/oox/inc/oox/export/vmlexport.hxx (original)
+++ openoffice/branches/ooxml/main/oox/inc/oox/export/vmlexport.hxx Thu Mar 13 09:05:31 2014
@@ -19,11 +19,9 @@
  * 
  *************************************************************/
 
-
-
 #include <oox/dllapi.h>
 #include <sax/fshelper.hxx>
-#include <filter/msfilter/escherex.hxx> //zhaosz_xml
+#include <filter/msfilter/escherex.hxx>
 
 namespace rtl {
     class OString;
@@ -44,6 +42,11 @@ class OOX_DLLPUBLIC VMLExport : public E
 
     /// Remember the shape type.
     sal_uInt32 m_nShapeType;
+    bool m_bHasFill;
+    bool m_bHasLine;
+    sal_uInt32 m_nFillColor;
+    sal_uInt32 m_nLineWidth;
+    sal_uInt32 m_nLineColor;
     
     /// Remember the shape flags.
     sal_uInt32 m_nShapeFlags;
@@ -55,7 +58,7 @@ class OOX_DLLPUBLIC VMLExport : public E
     bool *m_pShapeTypeWritten;
 
 public:
-                        VMLExport( ::sax_fastparser::FSHelperPtr pSerializer );
+    VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, sal_uInt32 nShapeType = ESCHER_ShpInst_Nil, sal_uInt32 nShapeFlags = 0);
     virtual             ~VMLExport();
 
     ::sax_fastparser::FSHelperPtr
@@ -87,7 +90,7 @@ protected:
 
 private:
 
-    virtual void OpenContainer( sal_Int16 nEscherContainer, int nRecInstance = 0 );
+    virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
     virtual void CloseContainer();
 
     virtual sal_uInt32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 );

Modified: openoffice/branches/ooxml/main/oox/source/export/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/oox/source/export/makefile.mk?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/oox/source/export/makefile.mk (original)
+++ openoffice/branches/ooxml/main/oox/source/export/makefile.mk Thu Mar 13 09:05:31 2014
@@ -36,12 +36,19 @@ ENABLE_EXCEPTIONS=TRUE
 SLOFILES =	\
 		$(SLO)$/drawingml.obj \
 		$(SLO)$/shapes.obj \
-		$(SLO)$/vmlexport.obj 
-#		$(SLO)$/vmlexport-shape-types.obj
+		$(SLO)$/vmlexport.obj \
+		$(SLO)$/vmlexport-shape-types.obj
 
 # --- Targets -------------------------------------------------------
 
 .INCLUDE :  target.mk
 
+#$(MISC)$/vmlexport-shape-types.cxx : preset-definitions-to-shape-types.pl presetShapeDefinitions.xml presetTextWarpDefinitions.xml
+#	$(PERL) $< > $@.in_progress 2> $(MISC)$/vmlexport-shape-types.log && mv $@.in_progress $@
 $(MISC)$/vmlexport-shape-types.cxx : preset-definitions-to-shape-types.pl presetShapeDefinitions.xml presetTextWarpDefinitions.xml
-	$(PERL) $< > $@.in_progress 2> $(MISC)$/vmlexport-shape-types.log && mv $@.in_progress $@
+#    $(PERL) $< > $@.in_progress 2> $(MISC)$/vmlexport-shape-types.log && mv $@.in_progress $@
+# just remove the rederect for 2, there is a build break on Mac, not know the rootcause
+     $(PERL) $< > $@.in_progress && mv $@.in_progress $@
+
+$(SLO)$/vmlexport-shape-types.obj : $(MISC)$/vmlexport-shape-types.cxx
+

Modified: openoffice/branches/ooxml/main/oox/source/export/preset-definitions-to-shape-types.pl
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/oox/source/export/preset-definitions-to-shape-types.pl?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/oox/source/export/preset-definitions-to-shape-types.pl (original)
+++ openoffice/branches/ooxml/main/oox/source/export/preset-definitions-to-shape-types.pl Thu Mar 13 09:05:31 2014
@@ -20,8 +20,7 @@
 #  
 #**************************************************************
 
-
-
+use strict;
 use warnings;
 
 sub usage() {
@@ -50,36 +49,36 @@ sub show_call_stack
     print STDERR "--- End stack trace ---\n";
 }
 
-$src_shapes = shift;
-$src_text = shift;
+my $src_shapes = shift;
+my $src_text = shift;
 
 usage() if ( !defined( $src_shapes ) || !defined( $src_text ) ||
              $src_shapes eq "-h" || $src_shapes eq "--help" ||
              !-f $src_shapes || !-f $src_text );
 
 # Global variables
-@levels = ();
-$shape_name = "";
-$state = "";
-$path = "";
-$adjust = "";
-$max_adj_no = 0;
-@formulas = ();
-%variables = ();
-$ignore_this_shape = 0;
-$handles = "";
-$textboxrect = "";
-$last_pos_x = "";
-$last_pos_y = "";
-$no_stroke = 0;
-$no_fill = 0;
-$path_w = 1;
-$path_h = 1;
-@quadratic_bezier = ();
+my @levels = ();
+my $shape_name = "";
+my $state = "";
+my $path = "";
+my $adjust = "";
+my $max_adj_no = 0;
+my @formulas = ();
+my %variables = ();
+my $ignore_this_shape = 0;
+my $handles = "";
+my $textboxrect = "";
+my $last_pos_x = "";
+my $last_pos_y = "";
+my $no_stroke = 0;
+my $no_fill = 0;
+my $path_w = 1;
+my $path_h = 1;
+my @quadratic_bezier = ();
 
-%result_shapes = ();
+my %result_shapes = ();
 
-%shapes_ids = (
+my %shapes_ids = (
     0 => 'notPrimitive',
     1 => 'rectangle',
     2 => 'roundRectangle',
@@ -396,7 +395,7 @@ sub value( $ )
 }
 
 # Convert the DrawingML formula to a VML one
-%command_variables = (
+my %command_variables = (
     'w' => 'width',
     'h' => 'height',
     'r' => 'width',
@@ -427,7 +426,7 @@ sub insert_formula( $$ )
     my ( $name, $fmla ) = @_;
 
     my $i = 0;
-    foreach $f ( @formulas ) {
+    foreach my $f ( @formulas ) {
         if ( $f eq $fmla ) {
             if ( $name ne "" ) {
                 $variables{$name} = "@" . $i;
@@ -480,7 +479,7 @@ sub convert_formula( $$ )
 
         # parse the parameters
         ( my $values = $fmla ) =~ s/^([^ ]+) *//;
-        my $p1 = "", $p2 = "", $p3 = "";
+        my $p1 = "", my $p2 = "", my $p3 = "";
         if ( $values =~ /^([^ ]+)/ ) {
             $p1 = $1;
             $values =~ s/^([^ ]+) *//;
@@ -634,7 +633,7 @@ sub convert_formula( $$ )
 }
 
 # There's no exact equivalent of 'arcTo' in VML, we have to do some special casing...
-%convert_arcTo = (
+my %convert_arcTo = (
     '0' => {
         '90' => {
             'path' => 'qy',
@@ -770,7 +769,9 @@ sub start_element( $% )
 
     #print "element: $element\n";
     
-    if ( is_level( -1, "presetShapeDefinitons" ) || is_level( -1, "presetTextWarpDefinitions" ) ) {
+#    if ( is_level( -1, "presetShapeDefinitons" ) || is_level( -1, "presetTextWarpDefinitions" ) ) {
+    if ( @levels > 1 && ( $levels[-2] eq "presetShapeDefinitons" ||
+			  $levels[-2] eq "presetTextWarpDefinitions" ) ) {
         $shape_name = $element;
         
         $state = "";
@@ -1001,7 +1002,7 @@ sub end_element( $ )
             if ( $#formulas >= 0 )
             {
                 $out .= "<v:formulas>\n";
-                foreach $fmla ( @formulas ) {
+                foreach my $fmla ( @formulas ) {
                     $out .= "<v:f eqn=\"$fmla\"/>\n"
                 }
                 $out .= "</v:formulas>\n";
@@ -1148,10 +1149,10 @@ sub parse( $ )
         # the actual parsing
         my @starts = split( /</, $line );
         $line = "";
-        foreach $start ( @starts ) {
+        foreach my $start ( @starts ) {
             next if ( $start eq "" );
     
-            @ends = split( />/, $start );
+            my @ends = split( />/, $start );
             my $element = $ends[0];
             my $data = $ends[1];
     
@@ -1175,17 +1176,19 @@ sub parse( $ )
 }
 
 # Do the real work
-open( IN, "<$src_shapes" ) || die "Cannot open $src_shapes.";
-parse( IN );
-close( IN );
-
-open( IN, "<$src_text" ) || die "Cannot open $src_text.";
-parse( IN );
-close( IN );
+my $file;
+open( $file, "<$src_shapes" ) || die "Cannot open $src_shapes: $!";
+parse( $file );
+close( $file );
+
+open( $file, "<$src_text" ) || die "Cannot open $src_text: $!";
+parse( $file );
+close( $file );
 
+# modify "shapetype_" to "_x0000_t". In ECMA doc, latter prefix is used. Former prefix cannot be found
 if ( !defined( $result_shapes{'textBox'} ) ) {
     $result_shapes{'textBox'} =
-        "<v:shapetype id=\"shapetype___ID__\" coordsize=\"21600,21600\" " .
+        "<v:shapetype id=\"_x0000_t__ID__\" coordsize=\"21600,21600\" " .
         "o:spt=\"__ID__\" path=\"m,l,21600l21600,21600l21600,xe\">\n" .
         "<v:stroke joinstyle=\"miter\"/>\n" .
         "<v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n" .
@@ -1200,13 +1203,13 @@ print <<EOF;
 //   '$src_text'
 // which are part of the OOXML documentation
 
-#include <svx/escherex.hxx>
+#include <filter/msfilter/escherex.hxx>
 
 const char* pShapeTypes[ ESCHER_ShpInst_COUNT ] =
 {
 EOF
 
-for ( $i = 0; $i < 203; ++$i ) {
+for ( my $i = 0; $i < 203; ++$i ) {
     if ( $i < 4 ) {
         print "    /* $i - $shapes_ids{$i} - handled separately */\n    NULL,\n";
     }
@@ -1216,7 +1219,7 @@ for ( $i = 0; $i < 203; ++$i ) {
         if ( defined( $out ) ) {
             # set the id
             $out =~ s/__ID__/$i/g;
-        
+
             # escape the '"'s
             $out =~ s/"/\\"/g;
 

Modified: openoffice/branches/ooxml/main/oox/source/export/vmlexport.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/oox/source/export/vmlexport.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/oox/source/export/vmlexport.cxx (original)
+++ openoffice/branches/ooxml/main/oox/source/export/vmlexport.cxx Thu Mar 13 09:05:31 2014
@@ -58,13 +58,17 @@ public:
     virtual ~SvNullStream() {}
 };
 
-VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer )
+VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, sal_uInt32 nShapeType, sal_uInt32 nShapeFlags )
     //: EscherEx( *( new SvNullStream ), 0 ),
-    //zhaosz_xml
     : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), *( new SvNullStream ) ),
       m_pSerializer( pSerializer ),
       m_pShapeAttrList( NULL ),
-      m_nShapeType( ESCHER_ShpInst_Nil ),
+      m_nShapeType( nShapeType ),
+      m_bHasFill( true ),
+      m_bHasLine( true ),
+      m_nFillColor( -1 ),
+      m_nLineWidth( -1 ),
+      m_nLineColor( -1 ),
       m_pShapeStyle( new OStringBuffer( 200 ) ),
       m_pShapeTypeWritten( new bool[ ESCHER_ShpInst_COUNT ] )
 {
@@ -79,7 +83,7 @@ VMLExport::~VMLExport()
     delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL;
 }
 
-void VMLExport::OpenContainer( sal_Int16 nEscherContainer, int nRecInstance )
+void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
 {
     EscherEx::OpenContainer( nEscherContainer, nRecInstance );
 
@@ -90,7 +94,7 @@ void VMLExport::OpenContainer( sal_Int16
         if ( m_nShapeType != ESCHER_ShpInst_Nil )
             fprintf( stderr, "Warning!  VMLExport::OpenContainer(): opening shape inside a shape.\n" );
 #endif
-        m_nShapeType = ESCHER_ShpInst_Nil;
+        //m_nShapeType = ESCHER_ShpInst_Nil;
         m_pShapeAttrList = m_pSerializer->createAttrList();
 
         if ( m_pShapeStyle->getLength() )
@@ -540,18 +544,33 @@ void VMLExport::Commit( EscherPropertyCo
                     }
 
                     if ( rProps.GetOpt( ESCHER_Prop_fillColor, nValue ) )
+                    {
+                        m_nFillColor = nValue;
                         impl_AddColor( pAttrList, XML_color, nValue );
+                    }
+                    // add for fill transparency
+                    if (rProps.GetOpt( ESCHER_Prop_fillOpacity, nValue ))
+                    {
+                        OString sOpacity = OString::valueOf((sal_Int32)nValue) + "f";
+                        pAttrList->add( XML_opacity,  sOpacity.getStr());
+                    }
 
                     if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
                         impl_AddColor( pAttrList, XML_color2, nValue );
 
                     if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
+                    {
+                        // if fill is none, ESCHER_Prop_fNoFillHitTest will be set as 0x100000
+                        if(0x100000 == nValue) m_bHasFill = false;
                         impl_AddBool( pAttrList, XML_detectmouseclick, nValue );
+                    }
 
                     m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) );
                 }
                 bAlreadyWritten[ ESCHER_Prop_fillType ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fillColor ] = true;
+                // If new prop is added in function, please set flag as below. Or repeat record will be written into xml file.
+                bAlreadyWritten[ ESCHER_Prop_fillOpacity ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fillBackColor ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fNoFillHitTest ] = true;
                 break;
@@ -567,32 +586,41 @@ void VMLExport::Commit( EscherPropertyCo
             case ESCHER_Prop_lineEndArrowLength: // 469
             case ESCHER_Prop_lineJoinStyle: // 470
             case ESCHER_Prop_lineEndCapStyle: // 471
+            case ESCHER_Prop_fNoLineDrawDash: //511
                 {
                     sal_uInt32 nValue;
                     sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList();
 
                     if ( rProps.GetOpt( ESCHER_Prop_lineColor, nValue ) )
+                    {
+                        m_nLineColor = nValue;
                         impl_AddColor( pAttrList, XML_color, nValue );
+                    }
 
                     if ( rProps.GetOpt( ESCHER_Prop_lineWidth, nValue ) )
+                    {
+                        m_nLineWidth = nValue;
                         impl_AddInt( pAttrList, XML_weight, nValue );
+                    }
 
                     if ( rProps.GetOpt( ESCHER_Prop_lineDashing, nValue ) )
                     {
                         const char *pDashStyle = NULL;
+                        //(1)Modify lower to upper for the second word and after. Or import can not recognize it.
+                        //(2)Modify shortDot to "1 1". Or import can not recognize it.
                         switch ( nValue )
                         {
                             case ESCHER_LineSolid:             pDashStyle = "solid"; break;
                             case ESCHER_LineDashSys:           pDashStyle = "shortdash"; break;
                             case ESCHER_LineDotSys:            pDashStyle = "shortdot"; break;
-                            case ESCHER_LineDashDotSys:        pDashStyle = "shortdashdot"; break;
-                            case ESCHER_LineDashDotDotSys:     pDashStyle = "shortdashdotdot"; break;
+                            case ESCHER_LineDashDotSys:        pDashStyle = "shortDashDot"; break;
+                            case ESCHER_LineDashDotDotSys:     pDashStyle = "shortDashDotDot"; break;
                             case ESCHER_LineDotGEL:            pDashStyle = "dot"; break;
                             case ESCHER_LineDashGEL:           pDashStyle = "dash"; break;
-                            case ESCHER_LineLongDashGEL:       pDashStyle = "longdash"; break;
-                            case ESCHER_LineDashDotGEL:        pDashStyle = "dashdot"; break;
-                            case ESCHER_LineLongDashDotGEL:    pDashStyle = "longdashdot"; break;
-                            case ESCHER_LineLongDashDotDotGEL: pDashStyle = "longdashdotdot"; break;
+                            case ESCHER_LineLongDashGEL:       pDashStyle = "longDash"; break;
+                            case ESCHER_LineDashDotGEL:        pDashStyle = "dashDot"; break;
+                            case ESCHER_LineLongDashDotGEL:    pDashStyle = "longDashDot"; break;
+                            case ESCHER_LineLongDashDotDotGEL: pDashStyle = "longDashDotDot"; break;
                         }
                         if ( pDashStyle )
                             pAttrList->add( XML_dashstyle, pDashStyle );
@@ -642,6 +670,10 @@ void VMLExport::Commit( EscherPropertyCo
                             pAttrList->add( XML_endcap, pEndCap );
                     }
 
+                    if ( rProps.GetOpt( ESCHER_Prop_fNoLineDrawDash, nValue ) )
+                        if(0x90000 == nValue)
+                            m_bHasLine = false;
+
                     m_pSerializer->singleElementNS( XML_v, XML_stroke, XFastAttributeListRef( pAttrList ) );
                 }
                 bAlreadyWritten[ ESCHER_Prop_lineColor ] = true;
@@ -655,6 +687,7 @@ void VMLExport::Commit( EscherPropertyCo
                 bAlreadyWritten[ ESCHER_Prop_lineEndArrowLength ] = true;
                 bAlreadyWritten[ ESCHER_Prop_lineJoinStyle ] = true;
                 bAlreadyWritten[ ESCHER_Prop_lineEndCapStyle ] = true;
+                bAlreadyWritten[ ESCHER_Prop_fNoLineDrawDash ] = true;
                 break;
 
             case ESCHER_Prop_fHidden:
@@ -772,7 +805,6 @@ sal_Int32 VMLExport::StartShape()
     // some of the shapes have their own name ;-)
     sal_Int32 nShapeElement = -1;
     bool bReferToShapeType = false;
-/* clarence_guo temporarily comment for enable build
     switch ( m_nShapeType )
     {
         case ESCHER_ShpInst_NotPrimitive:   nShapeElement = XML_shape;     break;
@@ -808,20 +840,47 @@ sal_Int32 VMLExport::StartShape()
 
     // add style
     m_pShapeAttrList->add( XML_style, m_pShapeStyle->makeStringAndClear() );
+    
+    // For fill color of text box. This attr should be set first.
+    // It will associated with the attr "color2" which will set in commit function. The two are
+    // used to set the text box fill color.
+    if(!m_bHasFill)
+        m_pShapeAttrList->add( XML_filled, "f" );//If not fillcolor, set filled as false
+    //Even if no fill, a comment can have fill color
+    if(-1 != m_nFillColor)
+        impl_AddColor( m_pShapeAttrList, XML_fillcolor, m_nFillColor );
+    
+    if(!m_bHasLine)
+        m_pShapeAttrList->add( XML_stroked, "f" );
+    //Even if no line, a comment can have line color
+    if(-1 != m_nLineColor)
+        impl_AddColor( m_pShapeAttrList, XML_strokecolor, m_nLineColor );
+    if(-1 != m_nLineWidth)
+    {
+        //lijiany_ms_2007_comments here tranlate emu to pt. Or import cannot work for our export result.
+        //Actually import should do this according to stardard doc. We can just write the emu value to xml file.
+        double fLineWidth = (double)m_nLineWidth/12700;//from emu to pt
+        OString sLineWidth = OString::valueOf((double)fLineWidth) + "pt";//add unit
+        m_pShapeAttrList->add( XML_strokeweight, sLineWidth.getStr() );
+    }
 
     if ( nShapeElement >= 0 )
     {
         if ( bReferToShapeType )
         {
+            // modify "shapetype_" to "_x0000_t".
+            // In ECMA doc, latter prefix is used. Former prefix cannot be found. Now this functin only called by comments
             m_pShapeAttrList->add( XML_type, OStringBuffer( 20 )
-                    .append( "shapetype_" ).append( sal_Int32( m_nShapeType ) )
+                    .append( "#_x0000_t" ).append( sal_Int32( m_nShapeType ) )
                     .makeStringAndClear() );
         }
 
         // start of the shape
-        m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) );
+        // Modify this or will crash on exporting
+        // m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) );
+        m_pSerializer->startElementV( FSNS( XML_v, nShapeElement), m_pShapeAttrList );
     }
-*/
+
     return nShapeElement;
 }
 

Modified: openoffice/branches/ooxml/main/sc/inc/conditio.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/inc/conditio.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/inc/conditio.hxx (original)
+++ openoffice/branches/ooxml/main/sc/inc/conditio.hxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_CONDITIO_HXX
 #define SC_CONDITIO_HXX
 
@@ -67,66 +65,66 @@ enum ScConditionValType
 };
 
 class SC_DLLPUBLIC ScConditionEntry
-{
-										// gespeicherte Daten:
-	ScConditionMode		eOp;
-	sal_uInt16				nOptions;
-	double				nVal1;			// eingegeben oder berechnet
-	double				nVal2;
-	String				aStrVal1;		// eingegeben oder berechnet
-	String				aStrVal2;
+{						
+    // gespeicherte Daten:
+    ScConditionMode     eOp;
+    sal_uInt16          nOptions;
+    double              nVal1;          // eingegeben oder berechnet
+    double              nVal2;
+    String              aStrVal1;       // eingegeben oder berechnet
+    String              aStrVal2;
     String              aStrNmsp1;      // namespace to be used on (re)compilation, e.g. in XML import
     String              aStrNmsp2;      // namespace to be used on (re)compilation, e.g. in XML import
     formula::FormulaGrammar::Grammar eTempGrammar1;  // grammar to be used on (re)compilation, e.g. in XML import
     formula::FormulaGrammar::Grammar eTempGrammar2;  // grammar to be used on (re)compilation, e.g. in XML import
-	sal_Bool				bIsStr1;		// um auch leere Strings zu erkennen
-	sal_Bool				bIsStr2;
-	ScTokenArray*		pFormula1;		// eingegebene Formel
-	ScTokenArray*		pFormula2;
+    sal_Bool            bIsStr1;        // um auch leere Strings zu erkennen
+    sal_Bool            bIsStr2;
+    ScTokenArray*       pFormula1;      // eingegebene Formel
+    ScTokenArray*       pFormula2;
     ScAddress           aSrcPos;        // source position for formulas
-                                        // temporary data:
+    // temporary data:
     String              aSrcString;     // formula source position as text during XML import
-	ScFormulaCell*		pFCell1;
-	ScFormulaCell*		pFCell2;
-	ScDocument*			pDoc;
-	sal_Bool				bRelRef1;
-	sal_Bool				bRelRef2;
-	sal_Bool				bFirstRun;
-
-	void	MakeCells( const ScAddress& rPos );
-	void	Compile( const String& rExpr1, const String& rExpr2,
-                        const String& rExprNmsp1, const String& rExprNmsp2,
-                        formula::FormulaGrammar::Grammar eGrammar1,
-                        formula::FormulaGrammar::Grammar eGrammar2,
-                        sal_Bool bTextToReal );
-	void	Interpret( const ScAddress& rPos );
+    ScFormulaCell*      pFCell1;
+    ScFormulaCell*      pFCell2;
+    ScDocument*         pDoc;
+    sal_Bool            bRelRef1;
+    sal_Bool            bRelRef2;
+    sal_Bool            bFirstRun;
+
+    void	MakeCells( const ScAddress& rPos );
+    void	Compile( const String& rExpr1, const String& rExpr2,
+                const String& rExprNmsp1, const String& rExprNmsp2,
+                formula::FormulaGrammar::Grammar eGrammar1,
+                formula::FormulaGrammar::Grammar eGrammar2,
+                sal_Bool bTextToReal );
+    void	Interpret( const ScAddress& rPos );
 
-	sal_Bool	IsValid( double nArg ) const;
-	sal_Bool	IsValidStr( const String& rArg ) const;
+    sal_Bool	IsValid( double nArg ) const;
+    sal_Bool	IsValidStr( const String& rArg ) const;
 
 public:
-			ScConditionEntry( ScConditionMode eOper,
-								const String& rExpr1, const String& rExpr2,
-								ScDocument* pDocument, const ScAddress& rPos,
-                                const String& rExprNmsp1, const String& rExprNmsp2,
-                                formula::FormulaGrammar::Grammar eGrammar1,
-                                formula::FormulaGrammar::Grammar eGrammar2 );
-			ScConditionEntry( ScConditionMode eOper,
-								const ScTokenArray* pArr1, const ScTokenArray* pArr2,
-								ScDocument* pDocument, const ScAddress& rPos );
-			ScConditionEntry( const ScConditionEntry& r );	// flache Kopie der Formeln
-			// echte Kopie der Formeln (fuer Ref-Undo):
-			ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r );
-	virtual ~ScConditionEntry();
-
-	int				operator== ( const ScConditionEntry& r ) const;
-
-	sal_Bool			IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) const;
-
-	ScConditionMode	GetOperation() const		{ return eOp; }
-	sal_Bool			IsIgnoreBlank() const		{ return ( nOptions & SC_COND_NOBLANKS ) == 0; }
-	void			SetIgnoreBlank(sal_Bool bSet);
-	ScAddress		GetSrcPos() const			{ return aSrcPos; }
+    ScConditionEntry( ScConditionMode eOper,
+        const String& rExpr1, const String& rExpr2,
+        ScDocument* pDocument, const ScAddress& rPos,
+        const String& rExprNmsp1, const String& rExprNmsp2,
+        formula::FormulaGrammar::Grammar eGrammar1,
+        formula::FormulaGrammar::Grammar eGrammar2 );
+    ScConditionEntry( ScConditionMode eOper,
+        const ScTokenArray* pArr1, const ScTokenArray* pArr2,
+        ScDocument* pDocument, const ScAddress& rPos );
+    ScConditionEntry( const ScConditionEntry& r );	// flache Kopie der Formeln
+    // echte Kopie der Formeln (fuer Ref-Undo):
+    ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r );
+    virtual ~ScConditionEntry();
+
+    int				operator== ( const ScConditionEntry& r ) const;
+
+    sal_Bool        IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) const;
+
+    ScConditionMode GetOperation() const		{ return eOp; }
+    sal_Bool        IsIgnoreBlank() const		{ return ( nOptions & SC_COND_NOBLANKS ) == 0; }
+    void            SetIgnoreBlank(sal_Bool bSet);
+    ScAddress       GetSrcPos() const			{ return aSrcPos; }
 
     ScAddress       GetValidSrcPos() const;     // adjusted to allow textual representation of expressions
 
@@ -135,24 +133,31 @@ public:
     void            SetFormula1( const ScTokenArray& rArray );
     void            SetFormula2( const ScTokenArray& rArray );
 
-	String			GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uLong nNumFmt = 0,
-									const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
+    String          GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uLong nNumFmt = 0,
+                        const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
 
-	ScTokenArray*	CreateTokenArry( sal_uInt16 nPos ) const;
+    ScTokenArray*	CreateTokenArry( sal_uInt16 nPos ) const;
 
-	void			CompileAll();
-	void			CompileXML();
-	void			UpdateReference( UpdateRefMode eUpdateRefMode,
-								const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
-	void			UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
+    void			CompileAll();
+    void			CompileXML();
+    void			UpdateReference( UpdateRefMode eUpdateRefMode,
+                        const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+    void			UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos );
 
-	void			SourceChanged( const ScAddress& rChanged );
+    void			SourceChanged( const ScAddress& rChanged );
 
     bool            MarkUsedExternalReferences() const;
 
+    const String    GetStrVal1() const { return aStrVal1; }
+    const String    GetStrVal2() const { return aStrVal2; }
+    const double    GetDoubleVal1() const { return nVal1; }
+    const double    GetDoubleVal2() const { return nVal2; }
+    const bool      GetBoolIsStr1() const { return bIsStr1; }
+    const bool      GetBoolIsStr2() const { return bIsStr2; }
+
 protected:
-	virtual void	DataChanged( const ScRange* pModified ) const;
-	ScDocument*		GetDocument() const		{ return pDoc; }
+    virtual void	DataChanged( const ScRange* pModified ) const;
+    ScDocument*		GetDocument() const	{ return pDoc; }
 };
 
 //

Modified: openoffice/branches/ooxml/main/sc/source/filter/excel/xecontent.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/excel/xecontent.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/excel/xecontent.cxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/excel/xecontent.cxx Thu Mar 13 09:05:31 2014
@@ -580,13 +580,14 @@ void XclExpLabelranges::Save( XclExpStre
 // Conditional formatting  ====================================================
 
 /** Represents a CF record that contains one condition of a conditional format. */
-class XclExpCFImpl : protected XclExpRoot
+class XclExpCFImpl : protected XclExpRoot
 {
 public:
-    explicit            XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry );
+    explicit            XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, const ScAddress &rSrcPos = ScAddress() );
 
     /** Writes the body of the CF record. */
     void                WriteBody( XclExpStream& rStrm );
+    void                SaveXml( XclExpXmlStream &rStrm );
 
 private:
     const ScCondFormatEntry& mrFormatEntry; /// Calc conditional format entry.
@@ -607,13 +608,24 @@ private:
     bool                mbStrikeUsed;       /// true = Font strikeout used.
     bool                mbBorderUsed;       /// true = Border attribute used.
     bool                mbPattUsed;         /// true = Pattern attribute used.
+    String msVal1;
+    String msVal2;
+    String msFormula1;
+    String msFormula2;
+    bool mbIsStr1;
+    bool mbIsStr2;
+    double mnVal1;
+    double mnVal2;
+    bool mbFmla2;
+    static sal_uInt32 mnCount;
 };
 
 // ----------------------------------------------------------------------------
+sal_uInt32 XclExpCFImpl::mnCount = 0;
 
-XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry ) :
+XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry , const ScAddress &rSrcPos) :
     XclExpRoot( rRoot ),
-    mrFormatEntry( rFormatEntry ),
+    mrFormatEntry( ( ScCondFormatEntry &)rFormatEntry ),
     mnFontColorId( 0 ),
     mnType( EXC_CF_TYPE_CELL ),
     mnOperator( EXC_CF_CMP_NONE ),
@@ -624,6 +636,7 @@ XclExpCFImpl::XclExpCFImpl( const XclExp
     mbUnderlUsed( false ),
     mbItalicUsed( false ),
     mbStrikeUsed( false ),
+    mbFmla2( false ),
     mbBorderUsed( false ),
     mbPattUsed( false )
 {
@@ -680,6 +693,13 @@ XclExpCFImpl::XclExpCFImpl( const XclExp
             DBG_ERRORFILE( "XclExpCF::WriteBody - unknown condition type" );
     }
 
+    msVal1 = ( (const ScCondFormatEntry&)rFormatEntry ).GetStrVal1();
+    msVal2 = ( (const ScCondFormatEntry&)rFormatEntry ).GetStrVal2();
+    mnVal1 = ( (const ScCondFormatEntry&)rFormatEntry ).GetDoubleVal1();
+    mnVal2 = ( (const ScCondFormatEntry&)rFormatEntry ).GetDoubleVal2();
+    mbIsStr1 = ( (const ScCondFormatEntry&)rFormatEntry ).GetBoolIsStr1();
+    mbIsStr2 = ( (const ScCondFormatEntry&)rFormatEntry ).GetBoolIsStr2();
+    mnCount++;
     // *** formulas ***
 
     XclExpFormulaCompiler& rFmlaComp = GetFormulaCompiler();
@@ -687,11 +707,13 @@ XclExpCFImpl::XclExpCFImpl( const XclExp
     ::std::auto_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateTokenArry( 0 ) );
     mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr );
 
-    if( bFmla2 )
+    if( mbFmla2 )
     {
         xScTokArr.reset( mrFormatEntry.CreateTokenArry( 1 ) );
         mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr );
     }
+    msFormula1 = XclXmlUtils::ToOUString( GetDoc(), rSrcPos, mrFormatEntry.CreateTokenArry( 0 ),
+        formula::FormulaGrammar::GRAM_OOXML, GetRoot().GetUILanguage(), mxTokArr1->IsRecoverable() );
 }
 
 void XclExpCFImpl::WriteBody( XclExpStream& rStrm )
@@ -786,12 +808,70 @@ void XclExpCFImpl::WriteBody( XclExpStre
         mxTokArr2->WriteArray( rStrm );
 }
 
-// ----------------------------------------------------------------------------
+void XclExpCFImpl::SaveXml( XclExpXmlStream &rStrm )
+{
+    sax_fastparser::FSHelperPtr &rWorksheet = rStrm.GetCurrentStream();
+    sal_Int32 dxfid = XclExpXFBuffer::GetDxfIdMap()[mrFormatEntry.GetStyle()];
+
+    if ( EXC_CF_TYPE_FMLA == mnType )
+    {
+        rWorksheet->startElement( XML_cfRule,
+            XML_priority, OString::valueOf((sal_Int32) mnCount).getStr(),
+            XML_dxfId, OString::valueOf((sal_Int32)dxfid).getStr(),
+            XML_type, "expression",
+            //XML_stopIfTrue, "1",
+            FSEND );
+
+        rWorksheet->startElement( XML_formula, FSEND );
+        rWorksheet->writeEscaped( XclXmlUtils::ToOUString(msFormula1).getStr() );
+        rWorksheet->endElement( XML_formula );
+    }
+    else
+    {
+        rWorksheet->startElement( XML_cfRule,
+            XML_operator, cf_cmplist[mnOperator].value,
+            XML_priority, OString::valueOf((sal_Int32) mnCount).getStr(),
+            XML_dxfId, OString::valueOf((sal_Int32)dxfid).getStr(),
+            XML_type, cf_typelist[mnType].value,
+            FSEND );
+
+        rWorksheet->startElement( XML_formula, FSEND );
+        if ( mbIsStr1 )
+        {
+            rWorksheet->write( XclXmlUtils::ToOUString("\"") );
+            rWorksheet->write( XclXmlUtils::ToOUString(msVal1) );
+            rWorksheet->write( XclXmlUtils::ToOUString("\"") );
+        }
+        else
+        {
+            rWorksheet->write( mnVal1 );
+        }
+        rWorksheet->endElement( XML_formula );
+        if (mbFmla2)
+        {
+            rWorksheet->startElement( XML_formula, FSEND );
+            if ( mbIsStr2 )
+            {
+                rWorksheet->write( XclXmlUtils::ToOUString("\"") );
+                rWorksheet->write( XclXmlUtils::ToOUString(msVal2) );
+                rWorksheet->write( XclXmlUtils::ToOUString("\"") );
+            }
+            else
+            {
+                rWorksheet->write( mnVal2 );
+            }
+            rWorksheet->endElement( XML_formula );
+        }
+    }
+    mnCount--;
+    rWorksheet->endElement( XML_cfRule );
+}
 
-XclExpCF::XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry ) :
+// ----------------------------------------------------------------------------
+XclExpCF::XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, const ScAddress &rSrcPos ) :
     XclExpRecord( EXC_ID_CF ),
     XclExpRoot( rRoot ),
-    mxImpl( new XclExpCFImpl( rRoot, rFormatEntry ) )
+    mxImpl( new XclExpCFImpl( rRoot, rFormatEntry, rSrcPos) )
 {
 }
 
@@ -804,6 +884,11 @@ void XclExpCF::WriteBody( XclExpStream& 
     mxImpl->WriteBody( rStrm );
 }
 
+void XclExpCF::SaveXml(XclExpXmlStream &rStrm)
+{
+    mxImpl->SaveXml(rStrm);
+}
+
 // ----------------------------------------------------------------------------
 
 XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat ) :
@@ -813,11 +898,23 @@ XclExpCondfmt::XclExpCondfmt( const XclE
     ScRangeList aScRanges;
     GetDoc().FindConditionalFormat( rCondFormat.GetKey(), aScRanges, GetCurrScTab() );
     GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true );
+    ScRange *pScRange = NULL;
+    for (sal_uInt32 nPos = 0, nCount = aScRanges.Count(); nPos < nCount; ++nPos)
+    {
+        if (ScRange *tmpScRange = aScRanges.GetObject(nPos))
+        {
+            //firstly assign for pScRange  or now ScRange  less than pScRange
+            if (!pScRange  || (*tmpScRange < *pScRange))
+            {
+                pScRange = tmpScRange;
+            }
+        }
+    }
     if( !maXclRanges.empty() )
     {
         for( sal_uInt16 nIndex = 0, nCount = rCondFormat.Count(); nIndex < nCount; ++nIndex )
             if( const ScCondFormatEntry* pEntry = rCondFormat.GetEntry( nIndex ) )
-                maCFList.AppendNewRecord( new XclExpCF( GetRoot(), *pEntry ) );
+                maCFList.AppendNewRecord( new XclExpCF( GetRoot(), *pEntry, pScRange->aStart ) );
         aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 );
     }
 }
@@ -861,7 +958,16 @@ void XclExpCondfmt::SaveXml( XclExpXmlSt
             XML_sqref, XclXmlUtils::ToOString( msSeqRef ).getStr(),
             // OOXTODO: XML_pivot,
             FSEND );
-    maCFList.SaveXml( rStrm );
+    if ( !maCFList.IsEmpty())
+    {
+        //Reversed save CFRule,in list
+        //the more front CFRule, the higher the priority, the smaller the value	
+        for ( size_t i = maCFList.GetSize(); i > 0; --i )
+        {
+            maCFList.GetRecord(i-1)->SaveXml(rStrm);
+        }
+    }
+    
     // OOXTODO: XML_extLst
     rWorksheet->endElement( XML_conditionalFormatting );
 }

Modified: openoffice/branches/ooxml/main/sc/source/filter/excel/xeescher.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/excel/xeescher.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/excel/xeescher.cxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/excel/xeescher.cxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
@@ -59,6 +57,7 @@
 #include "xelink.hxx"
 #include "xename.hxx"
 #include "xestyle.hxx"
+#include "document.hxx"
 
 using namespace ::oox;
 
@@ -83,6 +82,55 @@ using ::com::sun::star::script::ScriptEv
 using ::com::sun::star::table::CellAddress;
 using ::com::sun::star::table::CellRangeAddress;
 
+#define  HMM2XL(x)        ((x)/26.5)+0.5
+
+namespace{
+    static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_Int32 nTab, Rectangle &aFrom, Rectangle &aTo )
+    {
+        bool bTo = false;
+        sal_Int32 nCol = 0, nRow = 0;
+        sal_Int32 nColOff = 0, nRowOff= 0;
+
+        while(1)
+        {
+            Rectangle r = rRoot.GetDocPtr()->GetMMRect( nCol,nRow,nCol,nRow,nTab );
+            if( !bTo )
+            {
+                if( r.Left() <= aRect.Left() )
+                {
+                    nCol++;
+                    nColOff = aRect.Left() - r.Left();
+                }
+                if( r.Top() <= aRect.Top() )
+                {
+                    nRow++;
+                    nRowOff = aRect.Top() - r.Top();
+                }
+                if( r.Left() > aRect.Left() && r.Top() > aRect.Top() )
+                {
+                    aFrom = Rectangle( nCol-1, HMM2XL( nColOff ),
+                                       nRow-1, HMM2XL( nRowOff ) );
+                    bTo=true;
+                }
+            }
+            if( bTo )
+            {
+                if( r.Right() < aRect.Right() )
+                    nCol++;
+                if( r.Bottom() < aRect.Bottom() )
+                    nRow++;
+                if( r.Right() >= aRect.Right() && r.Bottom() >= aRect.Bottom() )
+                {
+                    aTo = Rectangle( nCol, HMM2XL( aRect.Right() - r.Left() ),
+                                     nRow, HMM2XL( aRect.Bottom() - r.Top() ));
+                    break;
+                }
+            }
+        }
+        return;
+    }
+};
+
 // Escher client anchor =======================================================
 
 XclExpDffAnchorBase::XclExpDffAnchorBase( const XclExpRoot& rRoot, sal_uInt16 nFlags ) :
@@ -980,6 +1028,7 @@ void XclExpChartObj::Save( XclExpStream&
 
 XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
         const ScPostIt* pScNote, const String& rAddText ) :
+    maAuthor( pScNote ? pScNote->GetAuthor() : String::CreateFromAscii("") ),
     XclExpRecord( EXC_ID_NOTE ),
     maScPos( rScPos ),
     mnObjId( EXC_OBJ_INVALID_ID ),
@@ -988,7 +1037,12 @@ XclExpNote::XclExpNote( const XclExpRoot
     // get the main note text
     String aNoteText;
     if( pScNote )
+    {
         aNoteText = pScNote->GetText();
+        const EditTextObject *pETextObj = pScNote->GetEditTextObject();
+        if( pETextObj )
+            mpNoteFmtConts = XclExpStringHelper::CreateString(rRoot, *pETextObj);
+    }
     // append additional text
     ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 );
     maOrigNoteText = aNoteText;
@@ -1004,9 +1058,22 @@ XclExpNote::XclExpNote( const XclExpRoot
         {
             // TODO: additional text
             if( pScNote )
-                if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
+                if( SdrCaptionObj* pCaption = pScNote->GetCaption() )
                     if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
-                        mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible ) );
+                    {
+                        switch(rRoot.GetOutput())
+                        {
+                        case EXC_OUTPUT_BINARY:
+                            mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible, maScPos, maCommentFrom, maCommentTo) );
+                            break;
+                        case EXC_OUTPUT_XML_2007:
+                            lcl_GetFromTo( rRoot, pCaption->GetLogicRect(), maScPos.Tab(), maCommentFrom, maCommentTo );
+                            mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible, maScPos, maCommentFrom, maCommentTo) );
+                            break;
+                        default:
+                            break;
+                        }
+                    }
 
             SetRecSize( 9 + maAuthor.GetSize() );
         }
@@ -1090,9 +1157,8 @@ void XclExpNote::WriteXml( sal_Int32 nAu
             FSEND );
     rComments->startElement( XML_text, FSEND );
     // OOXTODO: phoneticPr, rPh, r
-    rComments->startElement( XML_t, FSEND );
-    rComments->writeEscaped( XclXmlUtils::ToOUString( maOrigNoteText ) );
-    rComments->endElement ( XML_t );
+    if( mpNoteFmtConts.get() ) // export text content and format
+        mpNoteFmtConts->WriteXml( rStrm );
     rComments->endElement( XML_text );
     rComments->endElement( XML_comment );
 }
@@ -1130,13 +1196,19 @@ void XclExpComments::SaveXml( XclExpXmlS
             FSEND );
     rComments->startElement( XML_authors, FSEND );
 
+    // OUStringLess is removed from the second parameter
+    // If it is exists, "aAuthors.find" cannot find any author name. It will return "end". SO
+    // the index will be always the set size. After being removed, all works well. Elements
+    // will be sorted ascendingly on inserting. No repeated element will be inserted. It complies
+    // the rule that no repeated authors for a sheet(Page 2872 in ECMA doc)
     typedef std::set< OUString, OUStringLess > Authors;
     Authors aAuthors;
 
     size_t nNotes = mrNotes.GetSize();
     for( size_t i = 0; i < nNotes; ++i )
     {
-        aAuthors.insert( XclXmlUtils::ToOUString( mrNotes.GetRecord( i )->GetAuthor() ) );
+        XclExpNoteList::RecordRefType xNote = mrNotes.GetRecord( i );
+        aAuthors.insert( XclXmlUtils::ToOUString( xNote->GetAuthor() ) );
     }
 
     for( Authors::const_iterator b = aAuthors.begin(), e = aAuthors.end(); b != e; ++b )
@@ -1150,12 +1222,13 @@ void XclExpComments::SaveXml( XclExpXmlS
     rComments->startElement( XML_commentList, FSEND );
 
     Authors::const_iterator aAuthorsBegin = aAuthors.begin();
-    for( size_t i = 0; i < nNotes; ++i )
+    Authors::const_iterator aAuthorsEnd = aAuthors.end();
+    for ( size_t i = 0; i < nNotes; ++i )
     {
         XclExpNoteList::RecordRefType xNote = mrNotes.GetRecord( i );
         Authors::const_iterator aAuthor = aAuthors.find(
                 XclXmlUtils::ToOUString( xNote->GetAuthor() ) );
-        sal_Int32 nAuthorId = distance( aAuthorsBegin, aAuthor );
+        sal_Int32 nAuthorId = ( aAuthor == aAuthorsEnd ? 0 : distance( aAuthorsBegin, aAuthor ) );
         xNote->WriteXml( nAuthorId, rStrm );
     }
 

Modified: openoffice/branches/ooxml/main/sc/source/filter/excel/xestream.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/excel/xestream.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/excel/xestream.cxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/excel/xestream.cxx Thu Mar 13 09:05:31 2014
@@ -783,7 +783,7 @@ static ScRange lcl_ToRange( const XclRan
 OString XclXmlUtils::ToOString( const XclRangeList& rRanges )
 {
     ScRangeList aRanges;
-    for( XclRangeList::const_iterator i = rRanges.begin(), end = rRanges.end();
+    for ( XclRangeList::const_iterator i = rRanges.begin(), end = rRanges.end();
             i != end; ++i )
     {
         aRanges.Append( lcl_ToRange( *i ) );
@@ -803,10 +803,10 @@ OUString XclXmlUtils::ToOUString( const 
 
 OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sal_Int32 nLength )
 {
-    if( nLength == -1 )
+    if ( nLength == -1 )
         nLength = rBuf.size();
 
-    return OUString( &rBuf[nStart], nLength );
+    return nLength > 0 ? OUString( &rBuf[nStart], nLength ) : OUString();
 }
 
 OUString XclXmlUtils::ToOUString( const String& s )
@@ -1093,7 +1093,7 @@ bool XclExpXmlStream::exportDocument() t
     // SfxMedium::GetOutStream() anywhere in the xlsx export filter code!
     // Instead, write via XOutputStream instance.
     SotStorageRef rStorage = static_cast<SotStorage*>(NULL);
-    //XclObjList::ResetCounters();
+    XclExpObjList::ResetCounters();
 
     XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, *pDoc, RTL_TEXTENCODING_DONTKNOW );
     aData.meOutput = EXC_OUTPUT_XML_2007;

Modified: openoffice/branches/ooxml/main/sc/source/filter/excel/xestyle.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/excel/xestyle.cxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/excel/xestyle.cxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/excel/xestyle.cxx Thu Mar 13 09:05:31 2014
@@ -1837,6 +1837,17 @@ void XclExpCellArea::FillToCF8( sal_uInt
     ::insert_value( rnPattern, aTmp.mnPattern,   10, 6 );
 }
 
+//in order to save the cellArea,the XclExpDxf need the three parameter,
+//this class have a saveXml() function,but when XclExpDxf call this function to save cellArea,
+//there are a wrong result, the bgColor and foreColor is  reversal, 
+//now I haven't find this reason,and add this function to resolve it ,but this isn't a good solution 
+void XclExpCellArea::FillToCF8( sal_uInt16& rnForeColor, sal_uInt16& rnBackColor, sal_uInt8& rnPattern ) const
+{
+    rnForeColor = mnForeColor;
+    rnBackColor = mnBackColor;
+    rnPattern = mnPattern;
+}
+
 static const char* ToPatternType( sal_uInt8 nPattern )
 {
     switch( nPattern )
@@ -2293,6 +2304,109 @@ void XclExpStyle::SaveXml( XclExpXmlStre
     rWorksheet->startElementV(XML_cellStyle,attrList);
     rWorksheet->endElement(XML_cellStyle);
 }
+XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, const String& rStyleName ) :
+    XclExpRoot(rRoot),
+    XclExpRecord( EXC_ID_STYLE, 4 ),
+    mbFontUsed( false ),
+    mbBorderUsed( false ),
+    mbPattUsed( false ),
+    maName( rStyleName )
+{
+    /*  Get formatting attributes here */
+
+    if( SfxStyleSheetBase* pStyleSheet = GetDoc().GetStyleSheetPool()->Find(rStyleName, SFX_STYLE_FAMILY_PARA ) )
+    {
+        const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
+
+        // font
+        mbFontUsed =  ScfTools::CheckItem( rItemSet, ATTR_FONT_HEIGHT,     true ) || 
+            ScfTools::CheckItem( rItemSet, ATTR_FONT_WEIGHT,     true ) ||
+            ScfTools::CheckItem( rItemSet, ATTR_FONT_COLOR,      true ) ||
+            ScfTools::CheckItem( rItemSet, ATTR_FONT_UNDERLINE,  true )||
+            ScfTools::CheckItem( rItemSet, ATTR_FONT_POSTURE,    true )||
+            ScfTools::CheckItem( rItemSet, ATTR_FONT_CROSSEDOUT, true );
+        if( mbFontUsed )
+        {
+            Font aFont;
+            ScPatternAttr::GetFont( aFont, rItemSet, SC_AUTOCOL_RAW );
+            maFontData.FillFromVclFont( aFont );
+        }
+
+        // pattern
+        mbPattUsed = ScfTools::CheckItem( rItemSet, ATTR_BACKGROUND, true );
+        if( mbPattUsed )
+            maArea.FillFromItemSet( rItemSet, GetPalette(), GetBiff());
+
+        // border
+        mbBorderUsed = ScfTools::CheckItem( rItemSet, ATTR_BORDER, true );
+        if( mbBorderUsed )
+            maBorder.FillFromItemSet( rItemSet, GetPalette(), GetBiff() );
+    }
+}
+
+void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
+{
+    rStrm.GetCurrentStream()->startElement( XML_dxf,FSEND );
+
+    // *** formatting blocks ***
+    if( mbFontUsed || mbBorderUsed || mbPattUsed )
+    {
+        if (mbFontUsed ) 
+        {
+            rStrm.GetCurrentStream()->startElement( XML_font,FSEND );
+            rStrm.WriteFontData(maFontData,  XML_rFont);
+            rStrm.GetCurrentStream()->endElement( XML_font );
+        }
+
+        // must be first save area and second save border
+        if( mbPattUsed )
+        {    
+            maArea.SetFinalColors( GetPalette() );
+            sal_uInt16 nForeColor, nBackColor;
+            sal_uInt8 nPattern;
+            maArea.FillToCF8(nBackColor, nForeColor, nPattern);
+            sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+            rStyleSheet->startElement( XML_fill,
+                FSEND );
+
+            // OOXTODO: XML_gradientFill
+
+            XclExpPalette& rPalette = rStrm.GetRoot().GetPalette();
+
+            if( nPattern == EXC_PATT_NONE || ( nForeColor == 0 && nBackColor == 0 ) )
+                rStyleSheet->singleElement( XML_patternFill,
+                XML_patternType,    ToPatternType( nPattern ),
+                FSEND );
+            else
+            {
+                rStyleSheet->startElement( XML_patternFill,
+                    XML_patternType,    ToPatternType( nPattern ),
+                    FSEND );
+                rStyleSheet->singleElement( XML_fgColor,
+                    XML_rgb,    XclXmlUtils::ToOString( rPalette.GetColor( nForeColor ) ).getStr(),
+                    FSEND );
+                rStyleSheet->singleElement( XML_bgColor,
+                    XML_rgb,    XclXmlUtils::ToOString( rPalette.GetColor( nBackColor ) ).getStr(),
+                    FSEND );
+                rStyleSheet->endElement( XML_patternFill );
+            }
+
+            rStyleSheet->endElement( XML_fill );
+            //maArea.SaveXml( rStrm);
+        } 
+
+        if( mbBorderUsed )
+        {
+            maBorder.SetFinalColors( GetPalette() );
+            maBorder.SaveXml( rStrm);
+        }
+    }
+    else
+    {
+        // no data blocks at all
+    }
+    rStrm.GetCurrentStream()->endElement( XML_dxf );
+}
 
 // ----------------------------------------------------------------------------
 
@@ -2372,6 +2486,8 @@ bool XclExpFillPred::operator()( const X
         mrFill.mnBackColorId    == rFill.mnBackColorId;
 }
 
+XclExpDxfIdMap XclExpXFBuffer::maDxfIdMap;
+
 static bool XclExpXFBuffer_mbUseMultimapBuffer = true;
 
 XclExpXFBuffer::XclExpXFBuffer( const XclExpRoot& rRoot ) 
@@ -2394,6 +2510,7 @@ void XclExpXFBuffer::Initialize()
 {
     InsertDefaultRecords();
     InsertUserStyles();
+    InsertDxf();
 }
 
 sal_uInt32 XclExpXFBuffer::Insert( const ScPatternAttr* pPattern, sal_Int16 nScript )
@@ -2644,6 +2761,12 @@ void XclExpXFBuffer::SaveXml( XclExpXmlS
             FSEND );
     maStyleList.SaveXml( rStrm );
     rStyleSheet->endElement( XML_cellStyles );
+    // save all STYLE records
+    rStyleSheet->startElement( XML_dxfs,
+        XML_count,  OString::valueOf( (sal_Int32) maDxfList.GetSize() ).getStr(),
+        FSEND );
+    maDxfList.SaveXml( rStrm );
+    rStyleSheet->endElement( XML_dxfs);
 }
 
 void XclExpXFBuffer::SaveXFXml( XclExpXmlStream& rStrm, XclExpXF& rXF )
@@ -2903,6 +3026,38 @@ void XclExpXFBuffer::InsertUserStyles()
             InsertStyleXF( *pStyleSheet );
 }
 
+//Inserts Dxf record for all conditional format. 
+void  XclExpXFBuffer::InsertDxf()
+{
+    maDxfIdMap.clear();
+    if( const ScConditionalFormatList* pCondFmtList = GetDoc().GetCondFormList() )
+    {
+        const ScConditionalFormatPtr* ppCondFmt = pCondFmtList->GetData(); 
+        if( ppCondFmt )
+        {
+            const ScConditionalFormatPtr* ppCondEnd = ppCondFmt + pCondFmtList->Count();
+            // for all conditiongformat
+            for( ; ppCondFmt < ppCondEnd; ++ppCondFmt )
+            {
+                if( *ppCondFmt )
+                {
+                    ScRangeList aScRanges;
+                    {
+                        // for all cfRule with one conditionformat
+                        for( sal_uInt16 nIndex = 0, nCount = (*ppCondFmt)->Count(); nIndex < nCount; ++nIndex )
+                            if( const ScCondFormatEntry* pEntry = (*ppCondFmt)->GetEntry( nIndex ) )
+                            {
+                                sal_uInt32  tid= maDxfIdMap.size();
+                                maDxfIdMap[pEntry->GetStyle()] = tid;
+                                maDxfList.AppendNewRecord(new XclExpDxf(GetRoot(),pEntry->GetStyle()));
+                            }
+                    }
+                }
+            }
+        }
+    }
+}
+
 sal_uInt32 XclExpXFBuffer::AppendBuiltInXF( XclExpXFRef xXF, sal_uInt8 nStyleId, sal_uInt8 nLevel )
 {
     sal_uInt32 nXFId = static_cast< sal_uInt32 >( maXFList.GetSize() );

Modified: openoffice/branches/ooxml/main/sc/source/filter/inc/xcl97rec.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/inc/xcl97rec.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/inc/xcl97rec.hxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/inc/xcl97rec.hxx Thu Mar 13 09:05:31 2014
@@ -19,14 +19,13 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_XCL97REC_HXX
 #define SC_XCL97REC_HXX
 
 #include "excrecds.hxx"
 #include "xcl97esc.hxx"
 #include "xlstyle.hxx"
+#include <svx/svdocapt.hxx>
 
 // ============================================================================
 
@@ -59,7 +58,8 @@ private:
     XclEscherEx&        mrEscherEx;
     XclExpMsoDrawing*   pMsodrawingPerSheet;
     XclExpMsoDrawing*   pSolverContainer;
-	static int          mnDrawingMLCount, mnVmlCount;
+	static sal_uInt32   mnDrawingMLCount;
+    static sal_uInt32   mnVmlCount;
 	SCTAB               mnScTab;
 };
 
@@ -138,10 +138,16 @@ public:
 
 class XclObjComment : public XclObj
 {
+    ScAddress                   maAnchorCell;
+    std::auto_ptr< SdrCaptionObj >	mpCaption;
+    bool                        mbVisible;
+    Rectangle                   maStart;
+    Rectangle                   maEnd;
 public:
                                 XclObjComment( XclExpObjectManager& rObjMgr,
-                                    const Rectangle& rRect, const EditTextObject& rEditObj, SdrObject* pCaption, bool bVisible );
-	virtual						~XclObjComment();
+                                    const Rectangle& rRect, const EditTextObject& rEditObj, SdrObject* pCaption, bool bVisible, 
+                                    const ScAddress& rAddress, Rectangle &rStart, Rectangle &rEnd );
+    virtual                     ~XclObjComment();
 
     /** c'tor process for formatted text objects above .
        @descr used to construct the MSODRAWING Escher object properties. */
@@ -149,26 +155,25 @@ public:
                                     const Rectangle& rRect, SdrObject* pCaption, bool bVisible );
 
 
-	virtual	void				Save( XclExpStream& rStrm );
+    virtual void                Save( XclExpStream& rStrm );
+    virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
 // --- class XclObjDropDown ------------------------------------------
 
 class XclObjDropDown : public XclObj
 {
 private:
-	sal_Bool						bIsFiltered;
+    sal_Bool                    bIsFiltered;
 
     virtual void                WriteSubRecs( XclExpStream& rStrm );
 
 protected:
 public:
                                 XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, sal_Bool bFilt );
-	virtual						~XclObjDropDown();
+    virtual                     ~XclObjDropDown();
 };
 
-
 // --- class XclTxo --------------------------------------------------
 
 class SdrTextObj;
@@ -182,10 +187,12 @@ public:
 
     inline void                 SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; }
     inline void                 SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; }
+    inline sal_uInt8            GetHorAlign() const { return mnHorAlign; }
+    inline sal_uInt8            GetVerAlign() const { return mnVerAlign; }
 
-	virtual	void				Save( XclExpStream& rStrm );
+    virtual void                Save( XclExpStream& rStrm );
 
-	virtual	sal_uInt16				GetNum() const;
+    virtual sal_uInt16          GetNum() const;
     virtual sal_Size            GetLen() const;
 
 private:
@@ -198,7 +205,6 @@ private:
     sal_uInt8                   mnVerAlign;     /// Vertical alignment.
 };
 
-
 // --- class XclObjOle -----------------------------------------------
 
 class XclObjOle : public XclObj
@@ -217,7 +223,6 @@ public:
 	virtual	void				Save( XclExpStream& rStrm );
 };
 
-
 // --- class XclObjAny -----------------------------------------------
 
 class XclObjAny : public XclObj
@@ -258,7 +263,6 @@ public:
     virtual sal_Size            GetLen() const;
 };
 
-
 // --- class ExcBofW8 ------------------------------------------------
 // Header Record fuer WORKBOOKS
 
@@ -268,7 +272,6 @@ public:
 								ExcBofW8();
 };
 
-
 // --- class ExcBof8 -------------------------------------------------
 // Header Record fuer WORKSHEETS
 
@@ -278,7 +281,6 @@ public:
 								ExcBof8();
 };
 
-
 // --- class ExcBundlesheet8 -----------------------------------------
 
 class ExcBundlesheet8 : public ExcBundlesheetBase
@@ -298,7 +300,6 @@ public:
     virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
 // --- class XclObproj -----------------------------------------------
 
 class XclObproj : public ExcRecord
@@ -308,7 +309,6 @@ public:
     virtual sal_Size            GetLen() const;
 };
 
-
 // ---- class XclCodename --------------------------------------------
 
 class XclCodename : public ExcRecord
@@ -323,7 +323,6 @@ public:
     virtual sal_Size            GetLen() const;
 };
 
-
 // ---- Scenarios ----------------------------------------------------
 // - ExcEScenarioCell			a cell of a scenario range
 // - ExcEScenario				all ranges of a scenario table
@@ -349,8 +348,6 @@ public:
     void                        SaveXml( XclExpXmlStream& rStrm );
 };
 
-
-
 class ExcEScenario : public ExcRecord, private List
 {
 private:
@@ -378,8 +375,6 @@ public:
     virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
-
 class ExcEScenarioManager : public ExcRecord, private List
 {
 private:
@@ -439,9 +434,6 @@ public:
     virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
-
-
 class XclIteration : public ExcRecord
 {
 private:
@@ -457,9 +449,6 @@ public:
     virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
-
-
 class XclDelta : public ExcRecord
 {
 private:
@@ -475,9 +464,6 @@ public:
     virtual void                SaveXml( XclExpXmlStream& rStrm );
 };
 
-
-
-
 class XclRefmode : public XclExpBoolRecord
 {
 public:

Modified: openoffice/branches/ooxml/main/sc/source/filter/inc/xecontent.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/inc/xecontent.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/inc/xecontent.hxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/inc/xecontent.hxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_XECONTENT_HXX
 #define SC_XECONTENT_HXX
 
@@ -168,8 +166,9 @@ class XclExpCFImpl;
 class XclExpCF : public XclExpRecord, protected XclExpRoot
 {
 public:
-    explicit            XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry );
+    explicit            XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry,const ScAddress& rSrcPos = ScAddress());
     virtual             ~XclExpCF();
+    virtual void        SaveXml(XclExpXmlStream & rStrm);
 
 private:
     /** Writes the body of the CF record. */

Modified: openoffice/branches/ooxml/main/sc/source/filter/inc/xeescher.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/inc/xeescher.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/inc/xeescher.hxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/inc/xeescher.hxx Thu Mar 13 09:05:31 2014
@@ -339,6 +339,9 @@ private:
     ScAddress           maScPos;        /// Calc cell address of the note.
     sal_uInt16          mnObjId;        /// Escher object ID (BIFF8).
     bool                mbVisible;      /// true = permanently visible.
+    Rectangle           maCommentFrom;
+    Rectangle           maCommentTo;
+    XclExpStringRef     mpNoteFmtConts; /// The note content and format
 };
 
 // ============================================================================

Modified: openoffice/branches/ooxml/main/sc/source/filter/inc/xestyle.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/inc/xestyle.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/inc/xestyle.hxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/inc/xestyle.hxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_XESTYLE_HXX
 #define SC_XESTYLE_HXX
 
@@ -34,6 +32,13 @@
 #include "xlstyle.hxx"
 #include "xeroot.hxx"
 
+#include "conditio.hxx"
+#include "xlcontent.hxx"
+#include "xladdress.hxx"
+#include "xehelper.hxx"
+#include <string>
+#include <map>
+
 /* ============================================================================
 - Buffers for style records (PALETTE, FONT, FORMAT, XF, STYLE).
 ============================================================================ */
@@ -442,6 +447,7 @@ struct XclExpCellArea : public XclCellAr
     /** Fills the data to the passed fields of a BIFF8 CF (conditional format) record. */
     void                FillToCF8( sal_uInt16& rnPattern, sal_uInt16& rnColor ) const;
 
+    void                FillToCF8( sal_uInt16& rforecolor, sal_uInt16& rbackcolor,  sal_uInt8& rpattern ) const;
     void                SaveXml( XclExpXmlStream& rStrm ) const;
 };
 
@@ -630,6 +636,32 @@ private:
 
 // ----------------------------------------------------------------------------
 
+/** Represents a dxf record for condition format.
+@descr  The calss is able to store format for all condition. */
+class XclExpDxf : public XclExpRecord, protected XclExpRoot
+{
+public:
+    explicit            XclExpDxf( const XclExpRoot& rRoot,  const String& rStyleName );
+
+    inline const String&    GetName() const
+    {
+        return maName;
+    }
+
+    virtual void        SaveXml( XclExpXmlStream& rStrm );
+
+private:
+    String              maName;         /// Name of the cell style.s
+    XclFontData         maFontData;     /// Font formatting attributes.
+    XclExpCellBorder    maBorder;       /// Border formatting attributes.
+    XclExpCellArea      maArea;         /// Pattern formatting attributes.
+
+    bool                mbFontUsed;     /// true = Any font attribute used.
+    bool                mbBorderUsed;   /// true = Border attribute used.
+    bool                mbPattUsed;     /// true = Pattern attribute used.
+};
+// ----------------------------------------------------------------------------
+
 /** Stores all XF records (cell formats and cell styles) in the document.
 
     Stores also the names of user defined cell styles (STYLE records). Supports
@@ -645,6 +677,12 @@ private:
     Then, in the streaming phase, the function GetXFIndex() returns the real
     Excel XF index for all XF identifiers.
  */
+ 
+// exprot 2007 condition format,define a dxfmap ,the key is the stylename for conditonal format
+// the value is the id for stylename,
+// the reason for add this map, in order to add a dxfid when save cfRule
+typedef ::std::map< String, sal_Int32 > XclExpDxfIdMap;
+
 class XclExpXFBuffer : public XclExpRecordBase, protected XclExpRoot
 {
 public:
@@ -700,11 +738,18 @@ public:
     /** Writes all XF records contained in this buffer. */
     virtual void        Save( XclExpStream& rStrm );
     virtual void        SaveXml( XclExpXmlStream& rStrm );
+    /**add static function,in order to  when save cfRule , easily get map */
+    inline static XclExpDxfIdMap GetDxfIdMap()
+    {
+        return maDxfIdMap;
+    }
 
 private:
     typedef XclExpRecordList< XclExpXF >    XclExpXFList;
     typedef XclExpXFList::RecordRefType     XclExpXFRef;
     typedef XclExpRecordList< XclExpStyle > XclExpStyleList;
+    //for save formats of all conditonal format
+    typedef XclExpRecordList< XclExpDxf > XclExpDxfList;
 
 private:
     // helper to update the buffer for maXFList
@@ -731,6 +776,8 @@ private:
     /** Inserts an XF and a STYLE record for all user defined style sheets. */
     void                InsertUserStyles();
 
+    /** Inserts Dxf record for all conditional format. */
+    void                InsertDxf();
     /** Inserts a built-in XF record without a STYLE record and returns the XF ID.
         @param bCreateStyleRec  true = Creates the related STYLE record. */
     sal_uInt32          AppendBuiltInXF( XclExpXFRef xXF,
@@ -773,6 +820,9 @@ private:
     XclExpBorderList    maBorders;          /// List of borders used by XF records
     XclExpFillList      maFills;            /// List of fills used by XF records
 
+    static XclExpDxfIdMap maDxfIdMap;
+    // list of all dxf records for all conditional format
+    XclExpDxfList maDxfList;
     // for optimized FindXF, buffered version of maXFList for fast access
     std::multimap< const SfxItemSet*, XclExpXF* > maXclExpXFMap;
 };

Modified: openoffice/branches/ooxml/main/sc/source/filter/inc/xlcontent.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ooxml/main/sc/source/filter/inc/xlcontent.hxx?rev=1577071&r1=1577070&r2=1577071&view=diff
==============================================================================
--- openoffice/branches/ooxml/main/sc/source/filter/inc/xlcontent.hxx (original)
+++ openoffice/branches/ooxml/main/sc/source/filter/inc/xlcontent.hxx Thu Mar 13 09:05:31 2014
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef SC_XLCONTENT_HXX
 #define SC_XLCONTENT_HXX
 
@@ -74,6 +72,32 @@ const sal_uInt8 EXC_CF_CMP_LESS         
 const sal_uInt8 EXC_CF_CMP_GREATER_EQUAL    = 0x07;
 const sal_uInt8 EXC_CF_CMP_LESS_EQUAL       = 0x08;
 
+struct XlsExpCondfmtMap
+{
+    char *value;
+    sal_uInt8  key;
+};
+
+const  XlsExpCondfmtMap cf_typelist[]=
+{
+    {"no",EXC_CF_TYPE_NONE},
+    {"cellIs",EXC_CF_TYPE_CELL},
+    {"formula",EXC_CF_TYPE_FMLA}
+};
+
+const XlsExpCondfmtMap cf_cmplist[]=
+{
+    {"no", EXC_CF_CMP_NONE},
+    {"between", EXC_CF_CMP_BETWEEN},
+    {"notBetween", EXC_CF_CMP_NOT_BETWEEN},
+    {"equal", EXC_CF_CMP_EQUAL},
+    {"notEqual", EXC_CF_CMP_NOT_EQUAL},
+    {"greaterThan", EXC_CF_CMP_GREATER},
+    {"lessThan", EXC_CF_CMP_LESS},
+    {"greaterThanOrEqual", EXC_CF_CMP_GREATER_EQUAL},
+    {"lessThanOrEqual", EXC_CF_CMP_LESS_EQUAL}
+};
+
 const sal_uInt32 EXC_CF_BORDER_LEFT         = 0x00000400;   /// Left border line modified?
 const sal_uInt32 EXC_CF_BORDER_RIGHT        = 0x00000800;   /// Right border line modified?
 const sal_uInt32 EXC_CF_BORDER_TOP          = 0x00001000;   /// Top border line modified?