[Libreoffice-commits] core.git: sw/source
Lei De Bin
leidb at apache.org
Sun Apr 14 15:25:25 PDT 2013
sw/source/filter/ww8/ww8par5.cxx | 73 ++++++++++++++++++++++++++++++++++-----
1 file changed, 65 insertions(+), 8 deletions(-)
New commits:
commit e12cd3855781f92e233b582812bff95c89fd9ef9
Author: Lei De Bin <leidb at apache.org>
Date: Fri Jul 20 00:39:51 2012 +0000
Resolve: #i119581# fix import issue for various .doc macro button imports
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(cherry picked from commit 7a3114b8e6960153900759a81a6edf1f74b3981c)
Change-Id: Iec6c2945a587c0451b8a404eb449c53237eeb7dc
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e746d6e..b1e9219 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2236,6 +2236,32 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr )
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)
@@ -2278,22 +2304,53 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, String& rStr)
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 );
+ if( !bApplyWingdings )
+ {
+
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
+ WW8_CP nOldCp = pPlcxMan->Where();
+ WW8_CP nCp = nOldCp + nOffset;
- 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;
+ }
+ }
- SwPaM aPaM(*pPaM);
- aPaM.SetMark();
- aPaM.Move(fnMoveBackward);
- aPaM.Exchange();
+ if ( i < pFonts->GetMax() )
+ {
- mpPostProcessAttrsInfo = new WW8PostProcessAttrsInfo(nCp, nCp, aPaM);
+ SetNewFontAttr( i, true, RES_CHRATR_FONT );
+ rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 );
+ pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT );
+ ResetCharSetVars();
+ }
+ }
return FLD_OK;
}
More information about the Libreoffice-commits
mailing list