Kaydet (Commit) d63c5326 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

a boolean variable is enough

Change-Id: I0594de8cc79626720f2f72062c39a6f2590dd64f
üst 09f83e1f
...@@ -258,7 +258,7 @@ public: ...@@ -258,7 +258,7 @@ public:
needs an rich text cell for this attribute. */ needs an rich text cell for this attribute. */
bool needsRichTextFormat() const; bool needsRichTextFormat() const;
void fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool bSkipPoolDefs = false ) const; void fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkipPoolDefs = false ) const;
/** Writes all font attributes to the passed property map. */ /** Writes all font attributes to the passed property map. */
void writeToPropertyMap( void writeToPropertyMap(
PropertyMap& rPropMap, PropertyMap& rPropMap,
......
...@@ -121,7 +121,7 @@ void RichStringPortion::convert( ScEditEngineDefaulter& rEE, ESelection& rSelect ...@@ -121,7 +121,7 @@ void RichStringPortion::convert( ScEditEngineDefaulter& rEE, ESelection& rSelect
const Font* pFontToUse = mxFont.get() ? mxFont.get() : lclNeedsRichTextFormat( pFont ) ? pFont : NULL; const Font* pFontToUse = mxFont.get() ? mxFont.get() : lclNeedsRichTextFormat( pFont ) ? pFont : NULL;
if ( pFontToUse ) if ( pFontToUse )
pFontToUse->fillToItemSet( aItemSet, FONT_PROPTYPE_TEXT ); pFontToUse->fillToItemSet( aItemSet, true );
// #TODO need to manually adjust nEndPos ( and nEndPara ) to cater for any paragraphs // #TODO need to manually adjust nEndPos ( and nEndPara ) to cater for any paragraphs
sal_Int32 nLastParaLoc = -1; sal_Int32 nLastParaLoc = -1;
......
...@@ -907,9 +907,8 @@ bool Font::needsRichTextFormat() const ...@@ -907,9 +907,8 @@ bool Font::needsRichTextFormat() const
return eScFamily; return eScFamily;
} }
void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool bSkipPoolDefs ) const void Font::fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkipPoolDefs ) const
{ {
bool bEdit = ( ePropType == FONT_PROPTYPE_TEXT );
namespace cssawt = ::com::sun::star::awt; namespace cssawt = ::com::sun::star::awt;
if ( maUsedFlags.mbNameUsed ) if ( maUsedFlags.mbNameUsed )
{ {
...@@ -917,32 +916,32 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool ...@@ -917,32 +916,32 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool
{ {
rtl_TextEncoding eFontEnc = maApiData.maLatinFont.mnTextEnc; rtl_TextEncoding eFontEnc = maApiData.maLatinFont.mnTextEnc;
// taken from binary importer // taken from binary importer
rtl_TextEncoding eTempTextEnc = (bEdit && (eFontEnc == getTextEncoding())) ? rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
ScfTools::GetSystemTextEncoding() : eFontEnc; ScfTools::GetSystemTextEncoding() : eFontEnc;
SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maLatinFont.mnFamily ), maApiData.maLatinFont.maName, OUString(), SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maLatinFont.mnFamily ), maApiData.maLatinFont.maName, OUString(),
PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT ); PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
ScfTools::PutItem( rItemSet, aFontItem, bEdit ? EE_CHAR_FONTINFO : ATTR_FONT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? EE_CHAR_FONTINFO : ATTR_FONT, bSkipPoolDefs );
} }
if( !maApiData.maAsianFont.maName.isEmpty() ) if( !maApiData.maAsianFont.maName.isEmpty() )
{ {
rtl_TextEncoding eFontEnc = maApiData.maAsianFont.mnTextEnc; rtl_TextEncoding eFontEnc = maApiData.maAsianFont.mnTextEnc;
// taken from binary importer // taken from binary importer
rtl_TextEncoding eTempTextEnc = (bEdit && (eFontEnc == getTextEncoding())) ? rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
ScfTools::GetSystemTextEncoding() : eFontEnc; ScfTools::GetSystemTextEncoding() : eFontEnc;
SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maAsianFont.mnFamily ), maApiData.maAsianFont.maName, OUString(), SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maAsianFont.mnFamily ), maApiData.maAsianFont.maName, OUString(),
PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT ); PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
ScfTools::PutItem( rItemSet, aFontItem, bEdit ? EE_CHAR_FONTINFO_CJK : ATTR_CJK_FONT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? EE_CHAR_FONTINFO_CJK : ATTR_CJK_FONT, bSkipPoolDefs );
} }
if( !maApiData.maCmplxFont.maName.isEmpty() ) if( !maApiData.maCmplxFont.maName.isEmpty() )
{ {
rtl_TextEncoding eFontEnc = maApiData.maCmplxFont.mnTextEnc; rtl_TextEncoding eFontEnc = maApiData.maCmplxFont.mnTextEnc;
// taken from binary importer // taken from binary importer
rtl_TextEncoding eTempTextEnc = (bEdit && (eFontEnc == getTextEncoding())) ? rtl_TextEncoding eTempTextEnc = (bEditEngineText && (eFontEnc == getTextEncoding())) ?
ScfTools::GetSystemTextEncoding() : eFontEnc; ScfTools::GetSystemTextEncoding() : eFontEnc;
SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maCmplxFont.mnFamily ), maApiData.maCmplxFont.maName, OUString(), SvxFontItem aFontItem( lcl_getFontFamily( maApiData.maCmplxFont.mnFamily ), maApiData.maCmplxFont.maName, OUString(),
PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT ); PITCH_DONTKNOW, eTempTextEnc, ATTR_FONT );
ScfTools::PutItem( rItemSet, aFontItem, bEdit ? EE_CHAR_FONTINFO_CTL : ATTR_CTL_FONT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aFontItem, bEditEngineText ? EE_CHAR_FONTINFO_CTL : ATTR_CTL_FONT, bSkipPoolDefs );
} }
} }
// font height // font height
...@@ -950,34 +949,34 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool ...@@ -950,34 +949,34 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool
{ {
sal_Int32 nHeight = maApiData.maDesc.Height; sal_Int32 nHeight = maApiData.maDesc.Height;
// do we use EXC_FONTITEM_HF ( or is it just relevant for the binary filter ) // do we use EXC_FONTITEM_HF ( or is it just relevant for the binary filter )
if( bEdit/* && (eType != EXC_FONTITEM_HF) */) // do not convert header/footer height if( bEditEngineText/* && (eType != EXC_FONTITEM_HF) */) // do not convert header/footer height
nHeight = (nHeight * 127 + 36) / EXC_POINTS_PER_INCH; // 1 in == 72 pt nHeight = (nHeight * 127 + 36) / EXC_POINTS_PER_INCH; // 1 in == 72 pt
SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT ); SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT );
ScfTools::PutItem( rItemSet, aHeightItem, bEdit ? EE_CHAR_FONTHEIGHT : ATTR_FONT_HEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? EE_CHAR_FONTHEIGHT : ATTR_FONT_HEIGHT, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aHeightItem, bEdit ? EE_CHAR_FONTHEIGHT_CJK : ATTR_CJK_FONT_HEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? EE_CHAR_FONTHEIGHT_CJK : ATTR_CJK_FONT_HEIGHT, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aHeightItem, bEdit ? EE_CHAR_FONTHEIGHT_CTL : ATTR_CTL_FONT_HEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? EE_CHAR_FONTHEIGHT_CTL : ATTR_CTL_FONT_HEIGHT, bSkipPoolDefs );
} }
// font weight // font weight
if( maUsedFlags.mbWeightUsed ) if( maUsedFlags.mbWeightUsed )
{ {
::FontWeight fWeight = VCLUnoHelper::ConvertFontWeight( maApiData.maDesc.Weight ); ::FontWeight fWeight = VCLUnoHelper::ConvertFontWeight( maApiData.maDesc.Weight );
SvxWeightItem aWeightItem( fWeight, ATTR_FONT_WEIGHT ); SvxWeightItem aWeightItem( fWeight, ATTR_FONT_WEIGHT );
ScfTools::PutItem( rItemSet, aWeightItem, bEdit ? EE_CHAR_WEIGHT : ATTR_FONT_WEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? EE_CHAR_WEIGHT : ATTR_FONT_WEIGHT, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aWeightItem, bEdit ? EE_CHAR_WEIGHT_CTL : ATTR_CTL_FONT_WEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? EE_CHAR_WEIGHT_CTL : ATTR_CTL_FONT_WEIGHT, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aWeightItem, bEdit ? EE_CHAR_WEIGHT_CJK : ATTR_CJK_FONT_WEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? EE_CHAR_WEIGHT_CJK : ATTR_CJK_FONT_WEIGHT, bSkipPoolDefs );
} }
// font posture // font posture
if( maUsedFlags.mbPostureUsed ) if( maUsedFlags.mbPostureUsed )
{ {
SvxPostureItem aPostItem( ( maApiData.maDesc.Slant == cssawt::FontSlant_ITALIC ) ? ITALIC_NORMAL : ITALIC_NONE, ATTR_FONT_POSTURE); SvxPostureItem aPostItem( ( maApiData.maDesc.Slant == cssawt::FontSlant_ITALIC ) ? ITALIC_NORMAL : ITALIC_NONE, ATTR_FONT_POSTURE);
ScfTools::PutItem( rItemSet, aPostItem, bEdit ? EE_CHAR_ITALIC : ATTR_FONT_POSTURE, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? EE_CHAR_ITALIC : ATTR_FONT_POSTURE, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aPostItem, bEdit ? EE_CHAR_ITALIC_CJK : ATTR_CJK_FONT_POSTURE, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? EE_CHAR_ITALIC_CJK : ATTR_CJK_FONT_POSTURE, bSkipPoolDefs );
ScfTools::PutItem( rItemSet, aPostItem, bEdit ? EE_CHAR_ITALIC_CTL : ATTR_CTL_FONT_POSTURE, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aPostItem, bEditEngineText ? EE_CHAR_ITALIC_CTL : ATTR_CTL_FONT_POSTURE, bSkipPoolDefs );
} }
// character color // character color
if( maUsedFlags.mbColorUsed ) if( maUsedFlags.mbColorUsed )
{ {
ScfTools::PutItem( rItemSet,SvxColorItem( maApiData.mnColor, bEdit ? EE_CHAR_COLOR : ATTR_FONT_COLOR ) , bSkipPoolDefs ); ScfTools::PutItem( rItemSet,SvxColorItem( maApiData.mnColor, bEditEngineText ? EE_CHAR_COLOR : ATTR_FONT_COLOR ) , bSkipPoolDefs );
} }
// underline style // underline style
if( maUsedFlags.mbUnderlineUsed ) if( maUsedFlags.mbUnderlineUsed )
...@@ -990,24 +989,24 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool ...@@ -990,24 +989,24 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool
else else
eScUnderl = UNDERLINE_NONE; eScUnderl = UNDERLINE_NONE;
SvxUnderlineItem aUnderlItem( eScUnderl, ATTR_FONT_UNDERLINE ); SvxUnderlineItem aUnderlItem( eScUnderl, ATTR_FONT_UNDERLINE );
ScfTools::PutItem( rItemSet, aUnderlItem, bEdit ? EE_CHAR_UNDERLINE : ATTR_FONT_UNDERLINE, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aUnderlItem, bEditEngineText ? EE_CHAR_UNDERLINE : ATTR_FONT_UNDERLINE, bSkipPoolDefs );
} }
// strike out style // strike out style
if( maUsedFlags.mbStrikeoutUsed ) if( maUsedFlags.mbStrikeoutUsed )
{ {
ScfTools::PutItem( rItemSet, SvxCrossedOutItem( maModel.mbStrikeout ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, bEdit ? EE_CHAR_STRIKEOUT : ATTR_FONT_CROSSEDOUT ), ATTR_FONT_CROSSEDOUT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, SvxCrossedOutItem( maModel.mbStrikeout ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, bEditEngineText ? EE_CHAR_STRIKEOUT : ATTR_FONT_CROSSEDOUT ), ATTR_FONT_CROSSEDOUT, bSkipPoolDefs );
} }
// outline style // outline style
if( maUsedFlags.mbOutlineUsed ) if( maUsedFlags.mbOutlineUsed )
{ {
ScfTools::PutItem( rItemSet, SvxContourItem( maApiData.mbOutline, ATTR_FONT_CONTOUR ), bEdit ? EE_CHAR_OUTLINE : ATTR_FONT_CONTOUR, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, SvxContourItem( maApiData.mbOutline, ATTR_FONT_CONTOUR ), bEditEngineText ? EE_CHAR_OUTLINE : ATTR_FONT_CONTOUR, bSkipPoolDefs );
} }
// shadow style // shadow style
if( maUsedFlags.mbShadowUsed ) if( maUsedFlags.mbShadowUsed )
{ {
ScfTools::PutItem( rItemSet, SvxShadowedItem( maApiData.mbShadow, ATTR_FONT_SHADOWED ), bEdit ? EE_CHAR_SHADOW : ATTR_FONT_SHADOWED, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, SvxShadowedItem( maApiData.mbShadow, ATTR_FONT_SHADOWED ), bEditEngineText ? EE_CHAR_SHADOW : ATTR_FONT_SHADOWED, bSkipPoolDefs );
} }
if( maUsedFlags.mbEscapementUsed ) if( maUsedFlags.mbEscapementUsed )
{ {
...@@ -1016,7 +1015,7 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool ...@@ -1016,7 +1015,7 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, FontPropertyType ePropType, bool
eScEscapem = SVX_ESCAPEMENT_SUPERSCRIPT; eScEscapem = SVX_ESCAPEMENT_SUPERSCRIPT;
else if ( maApiData.mnEscapement == API_ESCAPE_SUBSCRIPT ) else if ( maApiData.mnEscapement == API_ESCAPE_SUBSCRIPT )
eScEscapem = SVX_ESCAPEMENT_SUBSCRIPT; eScEscapem = SVX_ESCAPEMENT_SUBSCRIPT;
if( ePropType == FONT_PROPTYPE_TEXT && bEdit ) if( bEditEngineText )
{ {
// #TODO handle EscapementHeight // #TODO handle EscapementHeight
rItemSet.Put( SvxEscapementItem( eScEscapem, EE_CHAR_ESCAPEMENT ) ); rItemSet.Put( SvxEscapementItem( eScEscapem, EE_CHAR_ESCAPEMENT ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment