summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authorDaniel Vogelheim <dvo@openoffice.org>2001-06-25 16:22:38 +0000
committerDaniel Vogelheim <dvo@openoffice.org>2001-06-25 16:22:38 +0000
commitaee542589cf493bef4fde0fbb1d4f6986030da07 (patch)
tree6306e30e23c6a5744e860afccb46a7f697863b5f /xmloff/source/text
parent4ad754507dffc402e4909fe04d6b76e46e97444f (diff)
#88107# added StarMath/StarBats conversion for certain style attributes
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/txtprmap.cxx28
-rw-r--r--xmloff/source/text/txtstyli.cxx73
2 files changed, 90 insertions, 11 deletions
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index 24e16ea837f4..d47f55a60066 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtprmap.cxx,v $
*
- * $Revision: 1.51 $
+ * $Revision: 1.52 $
*
- * last change: $Author: mib $ $Date: 2001-06-20 12:01:47 $
+ * last change: $Author: dvo $ $Date: 2001-06-25 17:22:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,7 +113,11 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
M_E( "CharEscapementHeight", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
// RES_CHRATR_FONT
M_ED( "CharFontName", STYLE, font_name, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME ),
+#else
M_ED( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME ),
+#endif
M_ED( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, CTF_FONTSTYLENAME ),
M_ED( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ),
M_ED( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ),
@@ -155,7 +159,11 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
M_E( "CharBackColor", FO, text_background_color, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
// RES_CHRATR_CJK_FONT
M_ED( "CharFontNameAsian", STYLE, font_name_asian, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontNameAsian", STYLE, font_family_asian, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CJK ),
+#else
M_ED( "CharFontNameAsian", STYLE, font_family_asian, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CJK ),
+#endif
M_ED( "CharFontStyleNameAsian",STYLE, font_style_name_asian, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ),
M_ED( "CharFontFamilyAsian", STYLE, font_family_generic_asian,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ),
M_ED( "CharFontPitchAsian", STYLE, font_pitch_asian, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ),
@@ -173,7 +181,11 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
M_E( "CharWeightAsian", STYLE, font_weight_asian, XML_TYPE_TEXT_WEIGHT, 0 ),
// RES_CHRATR_CTL_FONT
M_ED( "CharFontNameComplex", STYLE, font_name_complex, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CTL ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontNameComplex", STYLE, font_family_complex, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CTL ),
+#else
M_ED( "CharFontNameComplex", STYLE, font_family_complex, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CTL ),
+#endif
M_ED( "CharFontStyleNameComplex",STYLE, font_style_name_complex, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ),
M_ED( "CharFontFamilyComplex", STYLE, font_family_generic_complex,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ),
M_ED( "CharFontPitchComplex", STYLE, font_pitch_complex, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ),
@@ -369,7 +381,11 @@ XMLPropertyMapEntry aXMLTextPropMap[] =
M_E( "CharEscapementHeight", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ),
// RES_CHRATR_FONT
M_ED( "CharFontName", STYLE, font_name, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME ),
+#else
M_ED( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME ),
+#endif
M_ED( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, CTF_FONTSTYLENAME ),
M_ED( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ),
M_ED( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ),
@@ -412,7 +428,11 @@ XMLPropertyMapEntry aXMLTextPropMap[] =
M_E( "CharBackColor", FO, text_background_color, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ),
// RES_CHRATR_CJK_FONT
M_ED( "CharFontNameAsian", STYLE, font_name_asian, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CJK ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontNameAsian", STYLE, font_family_asian, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CJK ),
+#else
M_ED( "CharFontNameAsian", STYLE, font_family_asian, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CJK ),
+#endif
M_ED( "CharFontStyleNameAsian",STYLE, font_style_name_asian, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ),
M_ED( "CharFontFamilyAsian", STYLE, font_family_generic_asian,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ),
M_ED( "CharFontPitchAsian", STYLE, font_pitch_asian, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ),
@@ -430,7 +450,11 @@ XMLPropertyMapEntry aXMLTextPropMap[] =
M_E( "CharWeightAsian", STYLE, font_weight_asian, XML_TYPE_TEXT_WEIGHT, 0 ),
// RES_CHRATR_CTL_FONT
M_ED( "CharFontNameComplex", STYLE, font_name_complex, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME_CTL ),
+#ifdef CONV_STAR_FONTS
+ M_ED( "CharFontNameComplex", STYLE, font_family_complex, XML_TYPE_TEXT_FONTFAMILYNAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTFAMILYNAME_CTL ),
+#else
M_ED( "CharFontNameComplex", STYLE, font_family_complex, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CTL ),
+#endif
M_ED( "CharFontStyleNameComplex",STYLE, font_style_name_complex, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ),
M_ED( "CharFontFamilyComplex", STYLE, font_family_generic_complex,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ),
M_ED( "CharFontPitchComplex", STYLE, font_pitch_complex, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ),
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 8db9d608f807..0dc12195b3a7 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtstyli.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dvo $ $Date: 2001-06-15 10:37:08 $
+ * last change: $Author: dvo $ $Date: 2001-06-25 17:22:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -364,7 +364,6 @@ void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
}
}
-
void XMLTextStyleContext::FillPropertySet(
const Reference<XPropertySet > & rPropSet )
{
@@ -392,7 +391,16 @@ void XMLTextStyleContext::FillPropertySet(
// intelligent solution.
- sal_Int32 nCombinedCharactersIndex = -1;
+ struct _ContextID_Index_Pair aContextIDs[] =
+ {
+ { CTF_COMBINED_CHARACTERS_FIELD, -1 },
+#ifdef CONV_STAR_FONTS
+ { CTF_FONTFAMILYNAME, -1 },
+ { CTF_FONTFAMILYNAME_CJK, -1 },
+ { CTF_FONTFAMILYNAME_CTL, -1 },
+#endif
+ { -1, -1 }
+ };
// get property set info
Reference< XPropertySetInfo > xInfo = rPropSet->getPropertySetInfo();
@@ -404,23 +412,70 @@ void XMLTextStyleContext::FillPropertySet(
// Try XMultiPropertySet. If that fails, try the regular route.
sal_Bool bSet = SvXMLImportPropertyMapper::_FillMultiPropertySet(
GetProperties(), xMultiPropSet, xInfo, rPropMapper,
- CTF_COMBINED_CHARACTERS_FIELD, &nCombinedCharactersIndex );
+ aContextIDs );
if ( !bSet )
SvXMLImportPropertyMapper::_FillPropertySet(
GetProperties(), rPropSet, xInfo, rPropMapper,
- CTF_COMBINED_CHARACTERS_FIELD, &nCombinedCharactersIndex );
+ aContextIDs );
}
else
SvXMLImportPropertyMapper::_FillPropertySet(
GetProperties(), rPropSet, xInfo, rPropMapper,
- CTF_COMBINED_CHARACTERS_FIELD, &nCombinedCharactersIndex );
+ aContextIDs );
// have we found a combined characters
- if ( nCombinedCharactersIndex != -1 )
+ sal_Int32 nIndex = aContextIDs[0].nIndex;
+ if ( nIndex != -1 )
{
- Any& rAny = GetProperties()[nCombinedCharactersIndex].maValue;
+ Any& rAny = GetProperties()[nIndex].maValue;
sal_Bool bVal = *(sal_Bool*)rAny.getValue();
bHasCombinedCharactersLetter = bVal;
}
+
+#ifdef CONV_STAR_FONTS
+ // check for StarBats and StarMath fonts
+
+ // iterate over aContextIDs entries 1..3
+ for ( sal_Int32 i = 1; i < 4; i++ )
+ {
+ nIndex = aContextIDs[i].nIndex;
+ if ( nIndex != -1 )
+ {
+ // Found!
+ struct XMLPropertyState& rState = GetProperties()[nIndex];
+ Any rAny = rState.maValue;
+ sal_Int32 nMapperIndex = rState.mnIndex;
+
+ // Now check for font name in rState and set corrected value,
+ // if necessary.
+ OUString sFontName;
+ rAny >>= sFontName;
+ if ( sFontName.getLength() > 0 )
+ {
+ if ( sFontName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("StarBats" ) ) ||
+ sFontName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("StarMath" ) ) )
+ {
+ // construct new value
+ sFontName = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("StarSymbol") );
+ Any aAny( rAny );
+ aAny <<= sFontName;
+
+ // set property
+ OUString rPropertyName(
+ rPropMapper->GetEntryAPIName(nMapperIndex) );
+ if ( xInfo->hasPropertyByName( rPropertyName ) )
+ {
+ rPropSet->setPropertyValue( rPropertyName, aAny );
+ }
+ }
+ // else: "normal" style name -> no correction is necessary
+ }
+ // else: no style name found -> illegal value -> ignore
+ }
+ }
+#endif
}
}