summaryrefslogtreecommitdiff
path: root/xmloff
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
parent4ad754507dffc402e4909fe04d6b76e46e97444f (diff)
#88107# added StarMath/StarBats conversion for certain style attributes
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlimppr.cxx67
-rw-r--r--xmloff/source/text/txtprmap.cxx28
-rw-r--r--xmloff/source/text/txtstyli.cxx73
3 files changed, 133 insertions, 35 deletions
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index e9841e6880b1..ba503d7f36d3 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimppr.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: dvo $ $Date: 2001-06-11 10:39:10 $
+ * last change: $Author: dvo $ $Date: 2001-06-25 17:22:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -357,8 +357,7 @@ sal_Bool SvXMLImportPropertyMapper::_FillPropertySet(
const Reference<XPropertySet> & rPropSet,
const Reference<XPropertySetInfo> & rPropSetInfo,
const UniReference<XMLPropertySetMapper> & rPropMapper,
- sal_Int16 nSearchForContextId,
- sal_Int32* pFoundAtIndex )
+ struct _ContextID_Index_Pair* pSpecialContextIds )
{
DBG_ASSERT( rPropSet.is(), "need an XPropertySet" );
DBG_ASSERT( rPropSetInfo.is(), "need an XPropertySetInfo" );
@@ -380,9 +379,9 @@ sal_Bool SvXMLImportPropertyMapper::_FillPropertySet(
const OUString& rPropName = rPropMapper->GetEntryAPIName( nIdx );
const sal_Int32 nPropFlags = rPropMapper->GetEntryFlags( nIdx );
- if ( ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) &&
- ( 0 == ( nPropFlags & ~MID_FLAG_NO_PROPERTY ) ) ) ||
- rPropSetInfo->hasPropertyByName( rPropName ) )
+ if ( ( 0 == ( nPropFlags & MID_FLAG_NO_PROPERTY ) ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) ||
+ rPropSetInfo->hasPropertyByName( rPropName ) ) )
{
// try setting the property
try
@@ -401,14 +400,25 @@ sal_Bool SvXMLImportPropertyMapper::_FillPropertySet(
#endif
}
}
- else
+
+ // handle no-property and special items
+ if( ( pSpecialContextIds != NULL ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_NO_PROPERTY_IMPORT ) ) ||
+ ( 0 != ( nPropFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) ) ) )
{
- // maybe it's out search context id?
- if( (pFoundAtIndex != NULL) &&
- (nSearchForContextId != -1) &&
- (nSearchForContextId == rPropMapper->GetEntryContextId(nIdx)))
+ // maybe it's one of our special context ids?
+ sal_Int16 nContextId = rPropMapper->GetEntryContextId(nIdx);
+
+ for ( sal_Int32 n = 0;
+ pSpecialContextIds[n].nContextID != -1;
+ n++ )
{
- *pFoundAtIndex = i;
+ // found: set index in pSpecialContextIds array
+ if ( pSpecialContextIds[n].nContextID == nContextId )
+ {
+ pSpecialContextIds[n].nIndex = i;
+ break; // early out
+ }
}
}
}
@@ -435,8 +445,7 @@ sal_Bool SvXMLImportPropertyMapper::_FillMultiPropertySet(
const Reference<XMultiPropertySet> & rMultiPropSet,
const Reference<XPropertySetInfo> & rPropSetInfo,
const UniReference<XMLPropertySetMapper> & rPropMapper,
- sal_Int16 nSearchForContextId,
- sal_Int32* pFoundAtIndex )
+ struct _ContextID_Index_Pair* pSpecialContextIds )
{
DBG_ASSERT( rMultiPropSet.is(), "Need multi property set. ");
DBG_ASSERT( rPropSetInfo.is(), "Need property set info." );
@@ -461,22 +470,32 @@ sal_Bool SvXMLImportPropertyMapper::_FillMultiPropertySet(
const OUString& rPropName = rPropMapper->GetEntryAPIName( nIdx );
const sal_Int32 nPropFlags = rPropMapper->GetEntryFlags( nIdx );
- if ( ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) &&
- ( 0 == ( nPropFlags & ~MID_FLAG_NO_PROPERTY ) ) ) ||
- rPropSetInfo->hasPropertyByName( rPropName ) )
+ if ( ( 0 == ( nPropFlags & MID_FLAG_NO_PROPERTY ) ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_MUST_EXIST ) ) ||
+ rPropSetInfo->hasPropertyByName( rPropName ) ) )
{
// save property into property pair structure
PropertyPair aPair( &rPropName, &rProp.maValue );
aPropertyPairs.push_back( aPair );
}
- else
+
+ // handle no-property and special items
+ if( ( pSpecialContextIds != NULL ) &&
+ ( ( 0 != ( nPropFlags & MID_FLAG_NO_PROPERTY_IMPORT ) ) ||
+ ( 0 != ( nPropFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) ) ) )
{
- // maybe it's out search context id?
- if( (pFoundAtIndex != NULL) &&
- (nSearchForContextId != -1) &&
- (nSearchForContextId == rPropMapper->GetEntryContextId(nIdx)))
+ // maybe it's one of our special context ids?
+ sal_Int16 nContextId = rPropMapper->GetEntryContextId(nIdx);
+ for ( sal_Int32 n = 0;
+ pSpecialContextIds[n].nContextID != -1;
+ n++ )
{
- *pFoundAtIndex = i;
+ // found: set index in pSpecialContextIds array
+ if ( pSpecialContextIds[n].nContextID == nContextId )
+ {
+ pSpecialContextIds[n].nIndex = i;
+ break; // early out
+ }
}
}
}
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
}
}