incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1363614 - /incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx
Date Fri, 20 Jul 2012 01:39:52 GMT
Author: leidb
Date: Fri Jul 20 01:39:51 2012
New Revision: 1363614

URL: http://svn.apache.org/viewvc?rev=1363614&view=rev
Log:
#119581# fix import issue for 'checkin' 'checkout' 'showsample' macro button in writer 

Reported by: Lou Qingle
Patch by: Lei De Bin
Review by: Li Jian Yuan

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx?rev=1363614&r1=1363613&r2=1363614&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par5.cxx Fri Jul 20 01:39:51 2012
@@ -2153,6 +2153,32 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( W
     rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
     return FLD_OK;
 }
+//helper function
+//For MS MacroButton field, the symbol in plain text is always "(" (0x28),
+//which should be mapped according to the macro type
+bool ConvertMacroSymbol( const String& rName, String& rReference )
+{
+	bool bConverted = false;
+	if( rReference.EqualsAscii( "(" ) )
+	{
+		bConverted = true;
+		sal_Unicode cSymbol;
+		if( rName.EqualsAscii( "CheckIt" ) )
+			cSymbol = 0xF06F;
+		else if( rName.EqualsAscii( "UncheckIt" ) )
+			cSymbol = 0xF0FE;
+		else if( rName.EqualsAscii( "ShowExample" ) )
+			cSymbol = 0xF02A;
+		//else if... : todo
+		else
+			bConverted = false;
+
+		if( bConverted )
+			rReference = cSymbol;
+	}
+	return bConverted;
+}
+//end
 
 // "MACROSCHALTFL"ACHE"
 eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, String& rStr)
@@ -2195,22 +2221,53 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( W
     if( !aName.Len() )
         return FLD_TAGIGN;  // makes no sense without Makro-Name
 
+	//try converting macro symbol according to macro name
+	bool bApplyWingdings = ConvertMacroSymbol( aName, aVText );
     aName.InsertAscii( "StarOffice.Standard.Modul1.", 0 );
 
     SwMacroField aFld( (SwMacroFieldType*)
                     rDoc.GetSysFldType( RES_MACROFLD ), aName, aVText );
-    rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
-
-
-    WW8_CP nOldCp = pPlcxMan->Where();
-    WW8_CP nCp = nOldCp + nOffset;
 
-    SwPaM aPaM(*pPaM);
-    aPaM.SetMark();
-    aPaM.Move(fnMoveBackward);
-    aPaM.Exchange();
+	if( !bApplyWingdings )
+	{
 
-    mpPostProcessAttrsInfo = new WW8PostProcessAttrsInfo(nCp, nCp, aPaM);
+		rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
+		WW8_CP nOldCp = pPlcxMan->Where();
+		WW8_CP nCp = nOldCp + nOffset;
+
+		SwPaM aPaM(*pPaM);
+		aPaM.SetMark();
+		aPaM.Move(fnMoveBackward);
+		aPaM.Exchange();
+
+		mpPostProcessAttrsInfo = new WW8PostProcessAttrsInfo(nCp, nCp, aPaM);
+	}
+	else
+	{
+		//set Wingdings font
+		sal_uInt16 i = 0;
+		for ( ; i < pFonts->GetMax(); i++ )
+		{
+			FontFamily eFamily;
+			String aFontName;
+			FontPitch ePitch;
+			CharSet eSrcCharSet;
+			if( GetFontParams( i, eFamily, aFontName, ePitch, eSrcCharSet ) 
+				&& aFontName.EqualsAscii("Wingdings") )
+			{
+				break;
+			}
+		}
+
+		if ( i < pFonts->GetMax() )
+		{
+
+			SetNewFontAttr( i, true, RES_CHRATR_FONT );
+			rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
+			pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT );
+			ResetCharSetVars();
+		}
+	}
 
     return FLD_OK;
 }



Mime
View raw message