diff options
-rw-r--r-- | xmloff/dtd/office.mod | 4 | ||||
-rw-r--r-- | xmloff/dtd/style.mod | 50 | ||||
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 31 | ||||
-rw-r--r-- | xmloff/prj/d.lst | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/style/fonthdl.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/makefile.mk | 16 | ||||
-rw-r--r-- | xmloff/source/style/xmlnume.cxx | 86 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumi.cxx | 59 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 217 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.hxx | 22 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 21 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 171 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 62 |
14 files changed, 629 insertions, 138 deletions
diff --git a/xmloff/dtd/office.mod b/xmloff/dtd/office.mod index b0b75564b25a..eae8590d671d 100644 --- a/xmloff/dtd/office.mod +++ b/xmloff/dtd/office.mod @@ -1,5 +1,5 @@ <!-- - $Id: office.mod,v 1.7 2000-11-02 15:51:17 dvo Exp $ + $Id: office.mod,v 1.8 2000-11-13 08:42:12 mib Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -54,6 +54,7 @@ --> <!ELEMENT office:document ( office:meta?, + office:font-decls?, office:styles?, office:automatic-styles?, office:master-styles?, @@ -100,6 +101,7 @@ meta:user-defined*)"> <!ELEMENT office:meta %meta;> +<!ELEMENT office:font-decls (style:font-decl)*> <!ENTITY % styles "(style:style|text:list-style|number:number-style| number:currency-style|number:percentage-style|number:date-style| diff --git a/xmloff/dtd/style.mod b/xmloff/dtd/style.mod index ce6a446289b6..2e26a0ecfb43 100644 --- a/xmloff/dtd/style.mod +++ b/xmloff/dtd/style.mod @@ -1,5 +1,5 @@ <!-- - $Id: style.mod,v 1.9 2000-11-01 11:15:55 sab Exp $ + $Id: style.mod,v 1.10 2000-11-13 08:42:12 mib Exp $ The Contents of this file are made available subject to the terms of either of the following licenses @@ -53,6 +53,16 @@ --> +<!ELEMENT style:font-decl EMPTY> +<!ATTLIST style:font-decl style:name %string; #REQUIRED> +<!ATTLIST style:font-decl fo:font-family %string; #REQUIRED> +<!ATTLIST style:font-decl style:font-style-name %string; #IMPLIED> +<!ENTITY % fontFamilyGeneric "(roman|swiss|modern|decorative|script|system)"> +<!ATTLIST style:font-decl style:font-family-generic %fontFamilyGeneric; + #IMPLIED> +<!ENTITY % fontPitch "(fixed|variable)"> +<!ATTLIST style:font-decl style:font-pitch %fontPitch; #IMPLIED> +<!ATTLIST style:font-decl style:font-charset %textEncoding; #IMPLIED> <!ELEMENT style:style ( style:properties?,style:map*)> @@ -128,19 +138,47 @@ (none|single-line|double-line|thick-line|slash|X) #IMPLIED> <!ATTLIST style:properties style:text-position CDATA #IMPLIED> + +<!ATTLIST style:properties style:font-name %string; #IMPLIED> <!ATTLIST style:properties fo:font-family %string; #IMPLIED> -<!ATTLIST style:properties style:font-family-generic - (roman|swiss|modern|decorative|script|system) +<!ATTLIST style:properties style:font-family-generic %fontFamilyGeneric; #IMPLIED> <!ATTLIST style:properties style:font-style-name %string; #IMPLIED> -<!ATTLIST style:properties style:font-pitch (fixed|variable) #IMPLIED> +<!ATTLIST style:properties style:font-pitch %fontPitch; #IMPLIED> <!ATTLIST style:properties style:font-charset %textEncoding; #IMPLIED> +<!ATTLIST style:properties style:font-name-asian %string; #IMPLIED> +<!ATTLIST style:properties style:font-family-asian %string; #IMPLIED> +<!ATTLIST style:properties style:font-family-generic-asian %fontFamilyGeneric; + #IMPLIED> +<!ATTLIST style:properties style:font-style-name-asian %string; #IMPLIED> +<!ATTLIST style:properties style:font-pitch-asian %fontPitch; #IMPLIED> +<!ATTLIST style:properties style:font-charset-asian %textEncoding; #IMPLIED> +<!ATTLIST style:properties style:font-name-complex %string; #IMPLIED> +<!ATTLIST style:properties style:font-family-complex %string; #IMPLIED> +<!ATTLIST style:properties style:font-family-generic-complex %fontFamilyGeneric; + #IMPLIED> +<!ATTLIST style:properties style:font-style-name-complex %string; #IMPLIED> +<!ATTLIST style:properties style:font-pitch-complex %fontPitch; #IMPLIED> +<!ATTLIST style:properties style:font-charset-complex %textEncoding; #IMPLIED> + <!ATTLIST style:properties fo:font-size %positiveLengthOrPercentage; #IMPLIED> +<!ATTLIST style:properties fo:font-size-rel %length; #IMPLIED> +<!ATTLIST style:properties fo:font-size-asian %positiveLengthOrPercentage; #IMPLIED> +<!ATTLIST style:properties fo:font-size-rel-asian %length; #IMPLIED> +<!ATTLIST style:properties fo:font-size-complex %positiveLengthOrPercentage; #IMPLIED> +<!ATTLIST style:properties fo:font-size-rel-complex %length; #IMPLIED> <!ENTITY % normalOrLength "CDATA"> <!ATTLIST style:properties fo:letter-spacing %normalOrLength; #IMPLIED> <!ATTLIST style:properties fo:language %languageOnly; #IMPLIED> +<!ATTLIST style:properties style:language-asian %languageOnly; #IMPLIED> +<!ATTLIST style:properties style:language-complex %languageOnly; #IMPLIED> <!ATTLIST style:properties fo:country %country; #IMPLIED> -<!ATTLIST style:properties fo:font-style (normal|italic|oblique) #IMPLIED> +<!ATTLIST style:properties style:country-asian %country; #IMPLIED> +<!ATTLIST style:properties style:country-complex %country; #IMPLIED> +<!ENTITY % fontStyle "(normal|italic|oblique)"> +<!ATTLIST style:properties fo:font-style %fontStyle; #IMPLIED> +<!ATTLIST style:properties style:font-style-asian %fontStyle; #IMPLIED> +<!ATTLIST style:properties style:font-style-complex %fontStyle; #IMPLIED> <!ATTLIST style:properties fo:text-shadow CDATA #IMPLIED> <!ATTLIST style:properties style:text-underline (none|single|double|dotted|dash|long-dash|dot-dash| @@ -148,6 +186,8 @@ bold-long-dash|bold-dot-dash|bold-dot-dot-dash| bold-wave|double-wave|small-wave) #IMPLIED> <!ATTLIST style:properties fo:font-weight CDATA #IMPLIED> +<!ATTLIST style:properties fo:font-weight-asian CDATA #IMPLIED> +<!ATTLIST style:properties fo:font-weight-complex CDATA #IMPLIED> <!ATTLIST style:properties fo:score-spaces %boolean; #IMPLIED> <!ATTLIST style:properties style:letter-kerning %boolean; #IMPLIED> <!ATTLIST style:properties style:text-blinking %boolean; #IMPLIED> diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index 6ba3f106c1ef..2b7a520a1d37 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: dr $ $Date: 2000-11-08 13:44:38 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -297,6 +297,8 @@ XML_CONSTASCII_ACTION( sXML_count, "count" ); XML_CONSTASCII_ACTION( sXML_counterclockwise, "counterclockwise" ); XML_CONSTASCII_ACTION( sXML_countnums, "countnums" ); XML_CONSTASCII_ACTION( sXML_country, "country" ); +XML_CONSTASCII_ACTION( sXML_country_asian, "country-asian" ); +XML_CONSTASCII_ACTION( sXML_country_complex, "country-complex" ); XML_CONSTASCII_ACTION( sXML_covered_table_cell, "covered-table-cell" ); XML_CONSTASCII_ACTION( sXML_create_date, "create-date" ); XML_CONSTASCII_ACTION( sXML_create_date_string, "create-date-string" ); @@ -458,15 +460,38 @@ XML_CONSTASCII_ACTION( sXML_fixed, "fixed" ); XML_CONSTASCII_ACTION( sXML_float, "float"); XML_CONSTASCII_ACTION( sXML_floor, "floor" ); XML_CONSTASCII_ACTION( sXML_font_charset, "font-charset" ); +XML_CONSTASCII_ACTION( sXML_font_charset_asian, "font-charset-asian" ); +XML_CONSTASCII_ACTION( sXML_font_charset_complex, "font-charset-complex" ); +XML_CONSTASCII_ACTION( sXML_font_decls, "font-decls" ); +XML_CONSTASCII_ACTION( sXML_font_decl, "font-decl" ); XML_CONSTASCII_ACTION( sXML_font_family, "font-family" ); +XML_CONSTASCII_ACTION( sXML_font_family_asian, "font-family-asian" ); +XML_CONSTASCII_ACTION( sXML_font_family_complex, "font-family-complex" ); XML_CONSTASCII_ACTION( sXML_font_family_generic, "font-family-generic" ); +XML_CONSTASCII_ACTION( sXML_font_family_generic_asian, "font-family-generic-asian" ); +XML_CONSTASCII_ACTION( sXML_font_family_generic_complex, "font-family-generic-complex" ); +XML_CONSTASCII_ACTION( sXML_font_name, "font-name" ); +XML_CONSTASCII_ACTION( sXML_font_name_asian, "font-name-asian" ); +XML_CONSTASCII_ACTION( sXML_font_name_complex, "font-name-complex" ); XML_CONSTASCII_ACTION( sXML_font_pitch, "font-pitch" ); +XML_CONSTASCII_ACTION( sXML_font_pitch_asian, "font-pitch-asian" ); +XML_CONSTASCII_ACTION( sXML_font_pitch_complex, "font-pitch-complex" ); XML_CONSTASCII_ACTION( sXML_font_size, "font-size" ); +XML_CONSTASCII_ACTION( sXML_font_size_asian, "font-size-asian" ); +XML_CONSTASCII_ACTION( sXML_font_size_complex, "font-size-complex" ); XML_CONSTASCII_ACTION( sXML_font_size_rel, "font-size-rel" ); +XML_CONSTASCII_ACTION( sXML_font_size_rel_asian, "font-size-rel-asian" ); +XML_CONSTASCII_ACTION( sXML_font_size_rel_complex, "font-size-rel-complex" ); XML_CONSTASCII_ACTION( sXML_font_style, "font-style" ); +XML_CONSTASCII_ACTION( sXML_font_style_asian, "font-style-asian" ); +XML_CONSTASCII_ACTION( sXML_font_style_complex, "font-style-complex" ); XML_CONSTASCII_ACTION( sXML_font_style_name, "font-style-name" ); +XML_CONSTASCII_ACTION( sXML_font_style_name_asian, "font-style-name-asian-complex" ); +XML_CONSTASCII_ACTION( sXML_font_style_name_complex, "font-style-name" ); XML_CONSTASCII_ACTION( sXML_font_variant, "font-variant" ); XML_CONSTASCII_ACTION( sXML_font_weight, "font-weight" ); +XML_CONSTASCII_ACTION( sXML_font_weight_asian, "font-weight-asian" ); +XML_CONSTASCII_ACTION( sXML_font_weight_complex, "font-weight-complex" ); XML_CONSTASCII_ACTION( sXML_footer, "footer" ); XML_CONSTASCII_ACTION( sXML_footer_left, "footer-left" ); XML_CONSTASCII_ACTION( sXML_footer_style, "footer-style" ); @@ -599,6 +624,8 @@ XML_CONSTASCII_ACTION( sXML_label_range, "label-range" ); XML_CONSTASCII_ACTION( sXML_label_ranges, "label-ranges" ); XML_CONSTASCII_ACTION( sXML_landscape, "landscape" ); XML_CONSTASCII_ACTION( sXML_language, "language" ); +XML_CONSTASCII_ACTION( sXML_language_asian, "language-asian" ); +XML_CONSTASCII_ACTION( sXML_language_complex, "language-complex" ); XML_CONSTASCII_ACTION( sXML_last_column_spanned, "last-column-spanned" ); XML_CONSTASCII_ACTION( sXML_last_row_spanned, "last-row-spanned" ); XML_CONSTASCII_ACTION( sXML_leader_char, "leader-char" ); diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst index 11af4517064e..ce0111a78b44 100644 --- a/xmloff/prj/d.lst +++ b/xmloff/prj/d.lst @@ -79,4 +79,6 @@ hedabu: ..\inc\XMLTextMasterStylesContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMa hedabu: ..\inc\XMLTextMasterPageContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMasterPageContext.hxx hedabu: ..\inc\XMLTextTableContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextTableContext.hxx hedabu: ..\source\text\XMLTextShapeImportHelper.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextShapeImportHelper.hxx +hedabu: ..\inc\XMLFontAutoStylePool.hxx %_DEST%\inc%_EXT%\xmloff\XMLFontAutoStylePool.hxx +hedabu: ..\inc\XMLFontStylesContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLFontStylesContext.hxx hedabu: ..\inc\ProgressBarHelper.hxx %_DEST%\inc%_EXT%\xmloff\ProgressBarHelper.hxx diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 3943114392e8..682031edddab 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlexp.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: sab $ $Date: 2000-11-10 18:12:55 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,6 +130,9 @@ #ifndef _XMLOFF_DASHSTYLE_HXX #include <DashStyle.hxx> #endif +#ifndef _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX +#include "XMLFontAutoStylePool" +#endif #ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_ #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> @@ -293,6 +296,8 @@ void SvXMLExport::ImplExportStyles( sal_Bool bUsed ) { CheckAttrList(); + _ExportFontDecls(); + // AddAttributeASCII( XML_NAMESPACE_NONE, sXML_id, sXML_styles_id ); { // <style:styles> @@ -413,6 +418,12 @@ void SvXMLExport::_ExportMeta() aMeta.Export( GetNamespaceMap() ); } +void SvXMLExport::_ExportFontDecls() +{ + if( mxFontAutoStylePool.is() ) + mxFontAutoStylePool->exportXML(); +} + void SvXMLExport::_ExportStyles( sal_Bool bUsed ) { uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY ); @@ -631,6 +642,11 @@ SchXMLExportHelper* SvXMLExport::CreateChartExport() return new SchXMLExportHelper(*this,*GetAutoStylePool().get()); } +XMLFontAutoStylePool* SvXMLExport::CreateFontAutoStylePool() +{ + return new XMLFontAutoStylePool( *this ); +} + OUString SvXMLExport::getDataStyleName(const sal_Int32 nNumberFormat) const { OUString sTemp; diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx index 76950e08be4b..c39af312f231 100644 --- a/xmloff/source/style/fonthdl.cxx +++ b/xmloff/source/style/fonthdl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fonthdl.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-10-24 08:11:33 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -261,7 +261,7 @@ sal_Bool XMLFontFamilyPropHdl::importXML( const OUString& rStrImpValue, uno::Any sal_uInt16 eNewFamily; if( ( bRet = rUnitConverter.convertEnum( eNewFamily, rStrImpValue, aFontFamilyGenericMapping ) ) ) - rValue <<= eNewFamily; + rValue <<= (sal_Int16)eNewFamily; return bRet; } diff --git a/xmloff/source/style/makefile.mk b/xmloff/source/style/makefile.mk index 29188e88ddf7..c685fd33b83a 100644 --- a/xmloff/source/style/makefile.mk +++ b/xmloff/source/style/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.7 $ +# $Revision: 1.8 $ # -# last change: $Author: sab $ $Date: 2000-10-23 10:26:55 $ +# last change: $Author: mib $ $Date: 2000-11-13 08:42:13 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -141,13 +141,15 @@ CXXFILES = \ XMLClipPropertyHandler.cxx \ XMLConstantsPropertyHandler.cxx \ XMLElementPropertyContext.cxx \ + XMLFontAutoStylePool.cxx \ + XMLFontStylesContext.cxx \ XMLPageExport.cxx \ PageMasterPropHdl.cxx \ PageMasterPropHdlFactory.cxx \ PageMasterStyleMap.cxx \ PageMasterPropMapper.cxx \ - PageMasterExportPropMapper.cxx \ - PageMasterImportPropMapper.cxx \ + PageMasterExportPropMapper.cxx \ + PageMasterImportPropMapper.cxx \ PageMasterImportContext.cxx \ PagePropertySetContext.cxx \ PageHeaderFooterContext.cxx @@ -217,13 +219,15 @@ SLOFILES = \ $(SLO)$/XMLConstantsPropertyHandler.obj \ $(SLO)$/AttributeContainerHandler.obj \ $(SLO)$/XMLElementPropertyContext.obj \ + $(SLO)$/XMLFontAutoStylePool.obj \ + $(SLO)$/XMLFontStylesContext.obj \ $(SLO)$/XMLPageExport.obj \ $(SLO)$/PageMasterPropHdl.obj \ $(SLO)$/PageMasterPropHdlFactory.obj \ $(SLO)$/PageMasterStyleMap.obj \ $(SLO)$/PageMasterPropMapper.obj \ - $(SLO)$/PageMasterExportPropMapper.obj \ - $(SLO)$/PageMasterImportPropMapper.obj \ + $(SLO)$/PageMasterExportPropMapper.obj \ + $(SLO)$/PageMasterImportPropMapper.obj \ $(SLO)$/PageMasterImportContext.obj \ $(SLO)$/PagePropertySetContext.obj \ $(SLO)$/PageHeaderFooterContext.obj diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index a9dbec395c85..6974947de246 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlnume.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -434,39 +434,55 @@ void SvxXMLNumRuleExport::exportLevelStyle( INT32 nLevel, { if( sBulletFontName.getLength() ) { - Any aAny; - OUString sTmp; - - const SvXMLUnitConverter& rUnitConv = - GetExport().GetMM100UnitConverter(); - XMLFontFamilyNamePropHdl aFamilyNameHdl; - aAny <<= sBulletFontName; - if( aFamilyNameHdl.exportXML( sTmp, aAny, rUnitConv ) ) - GetExport().AddAttribute( XML_NAMESPACE_FO, - sXML_font_family, sTmp ); - - if( sBulletFontStyleName.getLength() ) - GetExport().AddAttribute( XML_NAMESPACE_FO, - sXML_font_style_name, - sBulletFontStyleName ); - - XMLFontFamilyPropHdl aFamilyHdl; - aAny <<= (sal_Int16)eBulletFontFamily; - if( aFamilyHdl.exportXML( sTmp, aAny, rUnitConv ) ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - sXML_font_family_generic, sTmp ); - - XMLFontPitchPropHdl aPitchHdl; - aAny <<= (sal_Int16)eBulletFontPitch; - if( aPitchHdl.exportXML( sTmp, aAny, rUnitConv ) ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - sXML_font_pitch, sTmp ); - - XMLFontEncodingPropHdl aEncHdl; - aAny <<= (sal_Int16)eBulletFontEncoding; - if( aEncHdl.exportXML( sTmp, aAny, rUnitConv ) ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - sXML_font_charset, sTmp ); + OUString sStyleName = + GetExport().GetFontAutoStylePool()->Find( + sBulletFontName, sBulletFontStyleName, + eBulletFontFamily, eBulletFontPitch, + eBulletFontEncoding ); + + if( sStyleName.getLength() ) + { + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_font_name, + sStyleName ); + } + else + { + Any aAny; + OUString sTmp; + + const SvXMLUnitConverter& rUnitConv = + GetExport().GetMM100UnitConverter(); + XMLFontFamilyNamePropHdl aFamilyNameHdl; + aAny <<= sBulletFontName; + if( aFamilyNameHdl.exportXML( sTmp, aAny, rUnitConv ) ) + GetExport().AddAttribute( XML_NAMESPACE_FO, + sXML_font_family, sTmp ); + + if( sBulletFontStyleName.getLength() ) + GetExport().AddAttribute( XML_NAMESPACE_FO, + sXML_font_style_name, + sBulletFontStyleName ); + + XMLFontFamilyPropHdl aFamilyHdl; + aAny <<= (sal_Int16)eBulletFontFamily; + if( aFamilyHdl.exportXML( sTmp, aAny, rUnitConv ) ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_font_family_generic, + sTmp ); + + XMLFontPitchPropHdl aPitchHdl; + aAny <<= (sal_Int16)eBulletFontPitch; + if( aPitchHdl.exportXML( sTmp, aAny, rUnitConv ) ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_font_pitch, sTmp ); + + XMLFontEncodingPropHdl aEncHdl; + aAny <<= (sal_Int16)eBulletFontEncoding; + if( aEncHdl.exportXML( sTmp, aAny, rUnitConv ) ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + sXML_font_charset, sTmp ); + } } } else if( NumberingType::BITMAP == eType ) diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 251b640721d7..eb3733a2af38 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlnumi.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2000-10-23 09:37:16 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -111,9 +111,15 @@ #ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include "fonthdl.hxx" #endif +#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX +#include "XMLFontStylesContext.hxx" +#endif #ifndef _XMLOFF_FAMILIES_HXX #include "families.hxx" #endif +#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX +#include "maptype.hxx" +#endif #include "xmlnumi.hxx" @@ -542,6 +548,7 @@ enum SvxXMLStyleAttributesAttrTokens XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH, XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST, XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN, + XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME, XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY, XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC, XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME, @@ -565,6 +572,8 @@ static __FAR_DATA SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] = XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST }, { XML_NAMESPACE_FO, sXML_text_align, XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN }, + { XML_NAMESPACE_STYLE, sXML_font_name, + XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME }, { XML_NAMESPACE_FO, sXML_font_family, XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY }, { XML_NAMESPACE_STYLE, sXML_font_family_generic, @@ -597,7 +606,7 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( SvXMLTokenMap aTokenMap( aStyleAttributesAttrTokenMap ); SvXMLUnitConverter aUnitConv( MAP_100TH_MM, MAP_100TH_MM); - OUString sFontFamily, sFontStyleName, sFontFamilyGeneric, + OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric, sFontPitch, sFontCharset; OUString sVerticalPos, sVerticalRel; @@ -637,6 +646,9 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( rListLevel.SetAdjust( eAdjust ); } break; + case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME: + sFontName = rValue; + break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY: sFontFamily = rValue; break; @@ -669,6 +681,47 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( } } + if( sFontName.getLength() ) + { + const XMLFontStylesContext *pFontDecls = + GetImport().GetTextImport()->GetFontDecls(); + if( pFontDecls ) + { + ::std::vector < XMLPropertyState > aProps; + if( pFontDecls->FillProperties( sFontName, aProps, 0, 1, 2, 3, 4 ) ) + { + OUString sTmp; + sal_Int16 nTmp; + ::std::vector< XMLPropertyState >::iterator i; + for( i = aProps.begin(); i != aProps.end(); i++ ) + { + switch( i->mnIndex ) + { + case 0: + i->maValue >>= sTmp; + rListLevel.SetBulletFontName( sTmp); + break; + case 1: + i->maValue >>= sTmp; + rListLevel.SetBulletFontStyleName( sTmp ); + break; + case 2: + i->maValue >>= nTmp; + rListLevel.SetBulletFontFamily( nTmp ); + break; + case 3: + i->maValue >>= nTmp; + rListLevel.SetBulletFontPitch( nTmp ); + break; + case 4: + i->maValue >>= nTmp; + rListLevel.SetBulletFontEncoding( nTmp ); + break; + } + } + } + } + } if( sFontFamily.getLength() ) { String sEmpty; diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 6936beff4a03..3f02fce13bf2 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtexppr.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,12 @@ #ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP #include <com/sun/star/text/TextContentAnchorType.hpp> #endif +#ifndef _COM_SUN_STAR_AWT_FONTFAMILY_HPP +#include <com/sun/star/awt/FontFamily.hpp> +#endif +#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP +#include <com/sun/star/awt/FontPitch.hpp> +#endif #ifndef _XMLOFF_TXTEXPPR_HXX #include "txtexppr.hxx" #endif @@ -92,6 +98,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::style; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::text; +using namespace ::com::sun::star::awt; void XMLTextExportPropertySetMapper::handleElementItem( const Reference< xml::sax::XDocumentHandler > & rHandler, @@ -196,13 +203,14 @@ void XMLTextExportPropertySetMapper::handleSpecialItem( XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper( const UniReference< XMLPropertySetMapper >& rMapper, - SvXMLExport& rExport ) : + SvXMLExport& rExp ) : SvXMLExportPropertyMapper( rMapper ), + rExport( rExp ), bDropWholeWord( sal_False ), - maTabStopExport( rExport.GetDocHandler(), rExport.GetMM100UnitConverter() ), - maDropCapExport( rExport.GetDocHandler(), rExport.GetMM100UnitConverter() ), - maTextColumnsExport( rExport ), - maBackgroundImageExport( rExport ) + maTabStopExport( rExp.GetDocHandler(), rExp.GetMM100UnitConverter() ), + maDropCapExport( rExp.GetDocHandler(), rExp.GetMM100UnitConverter() ), + maTextColumnsExport( rExp ), + maBackgroundImageExport( rExp ) { } @@ -210,14 +218,128 @@ XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper() { } +void XMLTextExportPropertySetMapper::ContextFontFilter( + XMLPropertyState *pFontNameState, + XMLPropertyState *pFontFamilyNameState, + XMLPropertyState *pFontStyleNameState, + XMLPropertyState *pFontFamilyState, + XMLPropertyState *pFontPitchState, + XMLPropertyState *pFontCharsetState ) const +{ + OUString sFamilyName; + OUString sStyleName; + sal_Int16 nFamily = FontFamily::DONTKNOW; + sal_Int16 nPitch = FontPitch::DONTKNOW; + rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW; + + OUString sTmp; + if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) ) + sFamilyName = sTmp; + if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) ) + sStyleName = sTmp; + + sal_Int16 nTmp; + if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) ) + nFamily = nTmp; + if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) ) + nPitch = nTmp; + if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) ) + eEnc = (rtl_TextEncoding)nTmp; + + OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find( + sFamilyName, sStyleName, nFamily, nPitch, eEnc ) ); + if( sName.getLength() ) + { + pFontNameState->maValue <<= sName; + if( pFontFamilyNameState ) + pFontFamilyNameState->mnIndex = -1; + if( pFontStyleNameState ) + pFontStyleNameState->mnIndex = -1; + if( pFontFamilyState ) + pFontFamilyState->mnIndex = -1; + if( pFontPitchState ) + pFontPitchState->mnIndex = -1; + if( pFontCharsetState ) + pFontCharsetState->mnIndex = -1; + } + else + { + pFontNameState->mnIndex = -1; + } +} + +void XMLTextExportPropertySetMapper::ContextFontHeightFilter( + XMLPropertyState* pCharHeightState, + XMLPropertyState* pCharPropHeightState, + XMLPropertyState* pCharDiffHeightState ) const +{ + if( pCharPropHeightState ) + { + sal_Int32 nTemp; + pCharPropHeightState->maValue >>= nTemp; + if( nTemp == 100 ) + { + pCharPropHeightState->mnIndex = -1; + pCharPropHeightState->maValue.clear(); + } + else + { + pCharHeightState->mnIndex = -1; + pCharHeightState->maValue.clear(); + } + } + if( pCharDiffHeightState ) + { + float nTemp; + pCharDiffHeightState->maValue >>= nTemp; + if( nTemp == 0. ) + { + pCharDiffHeightState->mnIndex = -1; + pCharDiffHeightState->maValue.clear(); + } + else + { + pCharHeightState->mnIndex = -1; + pCharHeightState->maValue.clear(); + } + } + +} + void XMLTextExportPropertySetMapper::ContextFilter( ::std::vector< XMLPropertyState >& rProperties, Reference< XPropertySet > rPropSet ) const { + // filter font + XMLPropertyState *pFontNameState = 0; + XMLPropertyState *pFontFamilyNameState = 0; + XMLPropertyState *pFontStyleNameState = 0; + XMLPropertyState *pFontFamilyState = 0; + XMLPropertyState *pFontPitchState = 0; + XMLPropertyState *pFontCharsetState = 0; + XMLPropertyState *pFontNameCJKState = 0; + XMLPropertyState *pFontFamilyNameCJKState = 0; + XMLPropertyState *pFontStyleNameCJKState = 0; + XMLPropertyState *pFontFamilyCJKState = 0; + XMLPropertyState *pFontPitchCJKState = 0; + XMLPropertyState *pFontCharsetCJKState = 0; + XMLPropertyState *pFontNameCTLState = 0; + XMLPropertyState *pFontFamilyNameCTLState = 0; + XMLPropertyState *pFontStyleNameCTLState = 0; + XMLPropertyState *pFontFamilyCTLState = 0; + XMLPropertyState *pFontPitchCTLState = 0; + XMLPropertyState *pFontCharsetCTLState = 0; + // filter char height point/percent XMLPropertyState* pCharHeightState = NULL; XMLPropertyState* pCharPropHeightState = NULL; XMLPropertyState* pCharDiffHeightState = NULL; + XMLPropertyState* pCharHeightCJKState = NULL; + XMLPropertyState* pCharPropHeightCJKState = NULL; + XMLPropertyState* pCharDiffHeightCJKState = NULL; + XMLPropertyState* pCharHeightCTLState = NULL; + XMLPropertyState* pCharPropHeightCTLState = NULL; + XMLPropertyState* pCharDiffHeightCTLState = NULL; // filter left margin measure/percent XMLPropertyState* pParaLeftMarginState = NULL; @@ -307,6 +429,12 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_CHARHEIGHT: pCharHeightState = propertie; break; case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break; case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break; + case CTF_CHARHEIGHT_CJK: pCharHeightCJKState = propertie; break; + case CTF_CHARHEIGHT_REL_CJK: pCharPropHeightCJKState = propertie; break; + case CTF_CHARHEIGHT_DIFF_CJK: pCharDiffHeightCJKState = propertie; break; + case CTF_CHARHEIGHT_CTL: pCharHeightCTLState = propertie; break; + case CTF_CHARHEIGHT_REL_CTL: pCharPropHeightCTLState = propertie; break; + case CTF_CHARHEIGHT_DIFF_CTL: pCharDiffHeightCTLState = propertie; break; case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break; case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break; case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break; @@ -359,40 +487,55 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break; case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break; case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break; - } - } - if( pCharHeightState && pCharPropHeightState ) - { - sal_Int32 nTemp; - pCharPropHeightState->maValue >>= nTemp; - if( nTemp == 100 ) - { - pCharPropHeightState->mnIndex = -1; - pCharPropHeightState->maValue.clear(); - } - else - { - pCharHeightState->mnIndex = -1; - pCharHeightState->maValue.clear(); - } - } - if( pCharHeightState && pCharDiffHeightState ) - { - float nTemp; - pCharDiffHeightState->maValue >>= nTemp; - if( nTemp == 0. ) - { - pCharDiffHeightState->mnIndex = -1; - pCharDiffHeightState->maValue.clear(); - } - else - { - pCharHeightState->mnIndex = -1; - pCharHeightState->maValue.clear(); + case CTF_FONTNAME: pFontNameState = propertie; break; + case CTF_FONTFAMILYNAME: pFontFamilyNameState = propertie; break; + case CTF_FONTSTYLENAME: pFontStyleNameState = propertie; break; + case CTF_FONTFAMILY: pFontFamilyState = propertie; break; + case CTF_FONTPITCH: pFontPitchState = propertie; break; + case CTF_FONTCHARSET: pFontCharsetState = propertie; break; + + case CTF_FONTNAME_CJK: pFontNameCJKState = propertie; break; + case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJKState = propertie; break; + case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJKState = propertie; break; + case CTF_FONTFAMILY_CJK: pFontFamilyCJKState = propertie; break; + case CTF_FONTPITCH_CJK: pFontPitchCJKState = propertie; break; + case CTF_FONTCHARSET_CJK: pFontCharsetCJKState = propertie; break; + + case CTF_FONTNAME_CTL: pFontNameCTLState = propertie; break; + case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTLState = propertie; break; + case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTLState = propertie; break; + case CTF_FONTFAMILY_CTL: pFontFamilyCTLState = propertie; break; + case CTF_FONTPITCH_CTL: pFontPitchCTLState = propertie; break; + case CTF_FONTCHARSET_CTL: pFontCharsetCTLState = propertie; break; } } + if( pFontNameState ) + ContextFontFilter( pFontNameState, pFontFamilyNameState, + pFontStyleNameState, pFontFamilyState, + pFontPitchState, pFontCharsetState ); + if( pFontNameCJKState ) + ContextFontFilter( pFontNameCJKState, pFontFamilyNameCJKState, + pFontStyleNameCJKState, pFontFamilyCJKState, + pFontPitchCJKState, pFontCharsetCJKState ); + if( pFontNameCTLState ) + ContextFontFilter( pFontNameCTLState, pFontFamilyNameCTLState, + pFontStyleNameCTLState, pFontFamilyCTLState, + pFontPitchCTLState, pFontCharsetCTLState ); + + if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) ) + ContextFontHeightFilter( pCharHeightState, pCharPropHeightState, + pCharDiffHeightState ); + if( pCharHeightCJKState && + (pCharPropHeightCJKState || pCharDiffHeightCJKState ) ) + ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState, + pCharDiffHeightCJKState ); + if( pCharHeightCTLState && + (pCharPropHeightCTLState || pCharDiffHeightCTLState ) ) + ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState, + pCharDiffHeightCTLState ); + if( pParaLeftMarginState && pParaLeftMarginRelState ) { sal_Int32 nTemp; diff --git a/xmloff/source/text/txtexppr.hxx b/xmloff/source/text/txtexppr.hxx index b78eece92b2f..af785dcc2e64 100644 --- a/xmloff/source/text/txtexppr.hxx +++ b/xmloff/source/text/txtexppr.hxx @@ -2,9 +2,9 @@ * * $RCSfile: txtexppr.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,9 +81,23 @@ class SvXMLExport; class XMLTextExportPropertySetMapper: public SvXMLExportPropertyMapper { + SvXMLExport& rExport; + ::rtl::OUString sDropCharStyle; sal_Bool bDropWholeWord; + void ContextFontFilter( + XMLPropertyState *pFontNameState, + XMLPropertyState *pFontFamilyNameState, + XMLPropertyState *pFontStyleNameState, + XMLPropertyState *pFontFamilyState, + XMLPropertyState *pFontPitchState, + XMLPropertyState *pFontCharsetState ) const; + void ContextFontHeightFilter( + XMLPropertyState* pCharHeightState, + XMLPropertyState* pCharPropHeightState, + XMLPropertyState* pCharDiffHeightState ) const; + protected: // SvXMLUnitConverter& mrUnitConverter; // const Reference< xml::sax::XDocumentHandler > & mrHandler; @@ -97,11 +111,13 @@ protected: ::std::vector< XMLPropertyState >& rProperties, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rPropSet ) const; + const SvXMLExport& GetExport() const { return rExport; } + public: XMLTextExportPropertySetMapper( const UniReference< XMLPropertySetMapper >& rMapper, - SvXMLExport& rExport ); + SvXMLExport& rExt ); virtual ~XMLTextExportPropertySetMapper(); virtual void handleElementItem( diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 8f31bba2d33c..1e03ab549ab6 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimp.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: mib $ $Date: 2000-11-07 13:33:08 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -170,6 +170,9 @@ #ifndef _XMLOFF_XMLINDEXTOCCONTEXT_HXX_ #include "XMLIndexTOCContext.hxx" #endif +#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX +#include "XMLFontStylesContext.hxx" +#endif using namespace ::rtl; @@ -879,6 +882,20 @@ void XMLTextImportHelper::SetAutoStyles( SvXMLStylesContext *pStyles ) xAutoStyles = pStyles; } +void XMLTextImportHelper::SetFontDecls( XMLFontStylesContext *pFontDecls ) +{ + xFontDecls = pFontDecls; + ((XMLTextImportPropertyMapper *)xParaImpPrMap.get()) + ->SetFontDecls( pFontDecls ); + ((XMLTextImportPropertyMapper *)xTextImpPrMap.get()) + ->SetFontDecls( pFontDecls ); +} + +const XMLFontStylesContext *XMLTextImportHelper::GetFontDecls() const +{ + return (XMLFontStylesContext *)&xFontDecls; +} + SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 677264d2e478..8b5ac29eb22a 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtimppr.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: sab $ $Date: 2000-10-26 10:37:03 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,9 @@ #ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HPP_ #include <com/sun/star/text/VertOrientation.hpp> #endif +#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX_ +#include "XMLFontStylesContext.hxx" +#endif #ifndef _XMLOFF_TEXTPRMAP_HXX_ #include "txtprmap.hxx" @@ -93,9 +96,77 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::table; using namespace ::com::sun::star::text; +sal_Bool XMLTextImportPropertyMapper::handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const ::rtl::OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const +{ + sal_Bool bRet = sal_False; + sal_Int32 nIndex = rProperty.mnIndex; + switch( getPropertySetMapper()->GetEntryContextId( nIndex ) ) + { + case CTF_FONTNAME: + case CTF_FONTNAME_CJK: + case CTF_FONTNAME_CTL: + if( xFontDecls.Is() ) + { + DBG_ASSERT( + ( CTF_FONTFAMILYNAME == + getPropertySetMapper()->GetEntryContextId(nIndex+1) && + CTF_FONTSTYLENAME == + getPropertySetMapper()->GetEntryContextId(nIndex+2) && + CTF_FONTFAMILY == + getPropertySetMapper()->GetEntryContextId(nIndex+3) && + CTF_FONTPITCH == + getPropertySetMapper()->GetEntryContextId(nIndex+4) && + CTF_FONTCHARSET == + getPropertySetMapper()->GetEntryContextId(nIndex+5) ) || + ( CTF_FONTFAMILYNAME_CJK == + getPropertySetMapper()->GetEntryContextId(nIndex+1) && + CTF_FONTSTYLENAME_CJK == + getPropertySetMapper()->GetEntryContextId(nIndex+2) && + CTF_FONTFAMILY_CJK == + getPropertySetMapper()->GetEntryContextId(nIndex+3) && + CTF_FONTPITCH_CJK == + getPropertySetMapper()->GetEntryContextId(nIndex+4) && + CTF_FONTCHARSET_CJK == + getPropertySetMapper()->GetEntryContextId(nIndex+5) ) || + ( CTF_FONTFAMILYNAME_CTL == + getPropertySetMapper()->GetEntryContextId(nIndex+1) && + CTF_FONTSTYLENAME_CTL == + getPropertySetMapper()->GetEntryContextId(nIndex+2) && + CTF_FONTFAMILY_CTL == + getPropertySetMapper()->GetEntryContextId(nIndex+3) && + CTF_FONTPITCH_CTL == + getPropertySetMapper()->GetEntryContextId(nIndex+4) && + CTF_FONTCHARSET_CTL == + getPropertySetMapper()->GetEntryContextId(nIndex+5) ), + "illegal property map" ); + + ((XMLFontStylesContext *)&xFontDecls)->FillProperties( + rValue, rProperties, + rProperty.mnIndex+1, rProperty.mnIndex+2, + rProperty.mnIndex+3, rProperty.mnIndex+4, + rProperty.mnIndex+5 ); + bRet = sal_False; // the property hasn't been filled + } + break; + default: + bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, + rProperties, rValue, rUnitConverter, rNamespaceMap ); + break; + } + + return bRet; +} + XMLTextImportPropertyMapper::XMLTextImportPropertyMapper( - const UniReference< XMLPropertySetMapper >& rMapper ) : - SvXMLImportPropertyMapper( rMapper ) + const UniReference< XMLPropertySetMapper >& rMapper, + XMLFontStylesContext *pFontDecls ) : + SvXMLImportPropertyMapper( rMapper ), + xFontDecls( pFontDecls ) { } @@ -103,15 +174,58 @@ XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper() { } +void XMLTextImportPropertyMapper::SetFontDecls( + XMLFontStylesContext *pFontDecls ) +{ + xFontDecls = pFontDecls; +} + +void XMLTextImportPropertyMapper::FontFinished( + XMLPropertyState *pFontFamilyNameState, + XMLPropertyState *pFontStyleNameState, + XMLPropertyState *pFontFamilyState, + XMLPropertyState *pFontPitchState, + XMLPropertyState *pFontCharsetState ) const +{ + if( pFontFamilyNameState && pFontFamilyNameState->mnIndex != -1 ) + { + OUString sName; + pFontFamilyNameState->maValue >>= sName; + if( !sName.getLength() ) + pFontFamilyNameState->mnIndex = -1; + } + if( !pFontFamilyNameState || pFontFamilyNameState->mnIndex == -1 ) + { + if( pFontStyleNameState ) + pFontStyleNameState->mnIndex = -1; + if( pFontFamilyState ) + pFontFamilyState->mnIndex = -1; + if( pFontPitchState ) + pFontPitchState->mnIndex = -1; + if( pFontCharsetState ) + pFontCharsetState->mnIndex = -1; + } +} + void XMLTextImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { - XMLPropertyState* pFontName = 0; + XMLPropertyState* pFontFamilyName = 0; XMLPropertyState* pFontStyleName = 0; XMLPropertyState* pFontFamily = 0; XMLPropertyState* pFontPitch = 0; XMLPropertyState* pFontCharSet = 0; + XMLPropertyState* pFontFamilyNameCJK = 0; + XMLPropertyState* pFontStyleNameCJK = 0; + XMLPropertyState* pFontFamilyCJK = 0; + XMLPropertyState* pFontPitchCJK = 0; + XMLPropertyState* pFontCharSetCJK = 0; + XMLPropertyState* pFontFamilyNameCTL = 0; + XMLPropertyState* pFontStyleNameCTL = 0; + XMLPropertyState* pFontFamilyCTL = 0; + XMLPropertyState* pFontPitchCTL = 0; + XMLPropertyState* pFontCharSetCTL = 0; XMLPropertyState* pAllBorderDistance = 0; XMLPropertyState* pBorderDistances[4] = { 0, 0, 0, 0 }; XMLPropertyState* pNewBorderDistances[4] = { 0, 0, 0, 0 }; @@ -130,12 +244,24 @@ void XMLTextImportPropertyMapper::finished( { switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) ) { - case CTF_FONTNAME: pFontName = property; break; + case CTF_FONTFAMILYNAME: pFontFamilyName = property; break; case CTF_FONTSTYLENAME: pFontStyleName = property; break; case CTF_FONTFAMILY: pFontFamily = property; break; case CTF_FONTPITCH: pFontPitch = property; break; case CTF_FONTCHARSET: pFontCharSet = property; break; + case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJK = property; break; + case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJK = property; break; + case CTF_FONTFAMILY_CJK: pFontFamilyCJK = property; break; + case CTF_FONTPITCH_CJK: pFontPitchCJK = property; break; + case CTF_FONTCHARSET_CJK: pFontCharSetCJK = property; break; + + case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTL = property; break; + case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTL = property; break; + case CTF_FONTFAMILY_CTL: pFontFamilyCTL = property; break; + case CTF_FONTPITCH_CTL: pFontPitchCTL = property; break; + case CTF_FONTCHARSET_CTL: pFontCharSetCTL = property; break; + case CTF_ALLBORDERDISTANCE: pAllBorderDistance = property; break; case CTF_LEFTBORDERDISTANCE: pBorderDistances[XML_LINE_LEFT] = property; break; case CTF_RIGHTBORDERDISTANCE: pBorderDistances[XML_LINE_RIGHT] = property; break; @@ -158,27 +284,18 @@ void XMLTextImportPropertyMapper::finished( } } - if( pFontName ) - { - OUString sName; - pFontName->maValue >>= sName; - if( !sName.getLength() ) - { - pFontName->mnIndex = -1; - pFontName = 0; - } - } - if( !pFontName ) - { - if( pFontStyleName ) - pFontStyleName->mnIndex = -1; - if( pFontFamily ) - pFontFamily->mnIndex = -1; - if( pFontPitch ) - pFontPitch->mnIndex = -1; - if( pFontCharSet ) - pFontCharSet->mnIndex = -1; - } + if( pFontFamilyName || pFontStyleName || pFontFamily || + pFontPitch || pFontCharSet ) + FontFinished( pFontFamilyName, pFontStyleName, pFontFamily, + pFontPitch, pFontCharSet ); + if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK || + pFontPitchCJK || pFontCharSetCJK ) + FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK, + pFontPitchCJK, pFontCharSetCJK ); + if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL || + pFontPitchCTL || pFontCharSetCTL ) + FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL, + pFontPitchCTL, pFontCharSetCTL ); for( sal_uInt16 i=0; i<4; i++ ) { diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 635a212b88ee..20aa9fc0e661 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtprmap.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: mib $ $Date: 2000-11-07 13:33:09 $ + * last change: $Author: mib $ $Date: 2000-11-13 08:42:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,11 +98,12 @@ XMLPropertyMapEntry aXMLParaPropMap[] = M_E( "CharEscapement", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ), M_E( "CharEscapementHeight", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ), // RES_CHRATR_FONT - M_E( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, 0 ), - M_E( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, 0 ), - M_E( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, 0 ), - M_E( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, 0 ), - M_E( "CharFontCharSet", STYLE, font_charset, XML_TYPE_TEXT_FONTENCODING, 0 ), + M_E( "CharFontName", STYLE, font_name, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ), + M_E( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME ), + M_E( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, CTF_FONTSTYLENAME ), + M_E( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ), + M_E( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ), + M_E( "CharFontCharSet", STYLE, font_charset, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET ), // RES_CHRATR_FONTSIZE M_E( "CharHeight", FO, font_size, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT ), M_E( "CharPropFontHeight",FO, font_size, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL ), @@ -298,11 +299,12 @@ XMLPropertyMapEntry aXMLTextPropMap[] = M_E( "CharEscapement", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ), M_E( "CharEscapementHeight", STYLE, text_position, XML_TYPE_TEXT_ESCAPEMENT_HEIGHT|MID_FLAG_MERGE_ATTRIBUTE|MID_FLAG_MULTI_PROPERTY, 0 ), // RES_CHRATR_FONT - M_E( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, 0 ), - M_E( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, 0 ), - M_E( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, 0 ), - M_E( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, 0 ), - M_E( "CharFontCharSet", STYLE, font_charset, XML_TYPE_TEXT_FONTENCODING, 0 ), + M_E( "CharFontName", STYLE, font_name, XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_FONTNAME ), + M_E( "CharFontName", FO, font_family, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME ), + M_E( "CharFontStyleName",STYLE, font_style_name, XML_TYPE_STRING, CTF_FONTSTYLENAME ), + M_E( "CharFontFamily", STYLE, font_family_generic,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY ), + M_E( "CharFontPitch", STYLE, font_pitch, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH ), + M_E( "CharFontCharSet", STYLE, font_charset, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET ), // RES_CHRATR_FONTSIZE M_E( "CharHeight", FO, font_size, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT ), M_E( "CharPropFontHeight",FO, font_size, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL ), @@ -337,6 +339,42 @@ XMLPropertyMapEntry aXMLTextPropMap[] = M_E( "CharBackColor", STYLE, text_background_color, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ), M_E( "CharBackTransparent", STYLE, text_background_color, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ), M_E( "CharBackColor", FO, text_background_color, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM_EXPORT, CTF_OLDTEXTBACKGROUND ), + // RES_CHRATR_CJK_FONT + M_E( "CharFontNameAsian", STYLE, font_name_asian, XML_TYPE_STRING, CTF_FONTNAME_CJK ), + M_E( "CharFontNameAsian", STYLE, font_family_asian, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CJK ), + M_E( "CharFontStyleNameAsian",STYLE, font_style_name_asian, XML_TYPE_STRING, CTF_FONTSTYLENAME_CJK ), + M_E( "CharFontFamilyAsian", STYLE, font_family_generic_asian,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CJK ), + M_E( "CharFontPitchAsian", STYLE, font_pitch_asian, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CJK ), + M_E( "CharFontCharSetAsian", STYLE, font_charset_asian, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CJK ), + // RES_CHRATR_CJK_FONTSIZE + M_E( "CharHeightAsian", STYLE, font_size_asian, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CJK ), + M_E( "CharPropFontHeightAsian",STYLE, font_size_asian, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CJK ), + M_E( "CharDiffFontHeightAsian",STYLE,font_size_rel_asian, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CJK ), + // RES_CHRATR_CJK_LANGUAGE + M_E( "CharLocaleAsian", STYLE, language_asian, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ), + M_E( "CharLocaleAsian", STYLE, country_asian, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ), + // RES_CHRATR_CJK_POSTURE + M_E( "CharPostureAsian", STYLE, font_style_asian, XML_TYPE_TEXT_POSTURE, 0 ), + // RES_CHRATR_CJK_WEIGHT + M_E( "CharWeightAsian", STYLE, font_weight_asian, XML_TYPE_TEXT_WEIGHT, 0 ), + // RES_CHRATR_CTL_FONT + M_E( "CharFontNameComplex", STYLE, font_name_complex, XML_TYPE_STRING, CTF_FONTNAME_CTL ), + M_E( "CharFontNameComplex", STYLE, font_family_complex, XML_TYPE_TEXT_FONTFAMILYNAME, CTF_FONTFAMILYNAME_CTL ), + M_E( "CharFontStyleNameComplex",STYLE, font_style_name_complex, XML_TYPE_STRING, CTF_FONTSTYLENAME_CTL ), + M_E( "CharFontFamilyComplex", STYLE, font_family_generic_complex,XML_TYPE_TEXT_FONTFAMILY, CTF_FONTFAMILY_CTL ), + M_E( "CharFontPitchComplex", STYLE, font_pitch_complex, XML_TYPE_TEXT_FONTPITCH, CTF_FONTPITCH_CTL ), + M_E( "CharFontCharSetComplex", STYLE, font_charset_complex, XML_TYPE_TEXT_FONTENCODING, CTF_FONTCHARSET_CTL ), + // RES_CHRATR_CTL_FONTSIZE + M_E( "CharHeightComplex", STYLE, font_size_asian, XML_TYPE_CHAR_HEIGHT|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_CTL ), + M_E( "CharPropFontHeightComplex",STYLE, font_size_asian, XML_TYPE_CHAR_HEIGHT_PROP|MID_FLAG_MULTI_PROPERTY, CTF_CHARHEIGHT_REL_CTL ), + M_E( "CharDiffFontHeightComplex",STYLE,font_size_rel_asian, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF_CTL ), + // RES_CHRATR_CTL_LANGUAGE + M_E( "CharLocaleComplex", STYLE, language_complex, XML_TYPE_CHAR_LANGUAGE|MID_FLAG_MERGE_PROPERTY, 0 ), + M_E( "CharLocaleComplex", STYLE, country_complex, XML_TYPE_CHAR_COUNTRY|MID_FLAG_MERGE_PROPERTY, 0 ), + // RES_CHRATR_CTL_POSTURE + M_E( "CharPostureComplex", STYLE, font_style_complex, XML_TYPE_TEXT_POSTURE, 0 ), + // RES_CHRATR_CTL_WEIGHT + M_E( "CharWeightComplex", STYLE, font_weight_complex, XML_TYPE_TEXT_WEIGHT, 0 ), // RES_TXTATR_INETFMT // TODO // RES_TXTATR_REFMARK |