diff options
author | Michael Brauer <mib@openoffice.org> | 2000-10-24 06:41:59 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2000-10-24 06:41:59 +0000 |
commit | 22f613b3ed1e85199abfaf58247268ac48ae4756 (patch) | |
tree | 463c48100af0879dcc3cc40c958f6931ce8ffe19 /xmloff | |
parent | 549d16549e2062314de3c41b4f61d4ab029b1429 (diff) |
stylefont-height-rel
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmlkywd.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/chrhghdl.cxx | 46 | ||||
-rw-r--r-- | xmloff/source/style/chrhghdl.hxx | 13 | ||||
-rw-r--r-- | xmloff/source/style/prhdlfac.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 23 |
5 files changed, 82 insertions, 12 deletions
diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index af7d752d08a0..4ec1df0435de 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: dr $ $Date: 2000-10-23 09:51:44 $ + * last change: $Author: mib $ $Date: 2000-10-24 07:39:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -451,6 +451,7 @@ XML_CONSTASCII_ACTION( sXML_font_family, "font-family" ); XML_CONSTASCII_ACTION( sXML_font_family_generic, "font-family-generic" ); XML_CONSTASCII_ACTION( sXML_font_pitch, "font-pitch" ); XML_CONSTASCII_ACTION( sXML_font_size, "font-size" ); +XML_CONSTASCII_ACTION( sXML_font_size_rel, "font-size-rel" ); XML_CONSTASCII_ACTION( sXML_font_style, "font-style" ); XML_CONSTASCII_ACTION( sXML_font_style_name, "font-style-name" ); XML_CONSTASCII_ACTION( sXML_font_variant, "font-variant" ); diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx index c8c75d054140..d495b590f5b4 100644 --- a/xmloff/source/style/chrhghdl.cxx +++ b/xmloff/source/style/chrhghdl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: chrhghdl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $ + * last change: $Author: mib $ $Date: 2000-10-24 07:40:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -150,7 +150,7 @@ sal_Bool XMLCharHeightPropHdl::importXML( const OUString& rStrImpValue, uno::Any { if( rUnitConverter.convertPercent( nPrc, rStrImpValue ) ) { - rValue <<= nPrc; + rValue <<= (sal_Int16)nPrc; return sal_True; } } @@ -162,7 +162,7 @@ sal_Bool XMLCharHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any { OUStringBuffer aOut( rStrExpValue ); - sal_Int32 nValue; + sal_Int16 nValue; if( rValue >>= nValue ) { rUnitConverter.convertPercent( aOut, nValue ); @@ -171,3 +171,41 @@ sal_Bool XMLCharHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any rStrExpValue = aOut.makeStringAndClear(); return rStrExpValue.getLength() != 0; } + +/////////////////////////////////////////////////////////////////////////////// +// +// class XMLEscapementPropHdl +// + +XMLCharHeightDiffHdl::~XMLCharHeightDiffHdl() +{ + // nothing to do +} + +sal_Bool XMLCharHeightDiffHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const +{ + sal_Int32 nRel = 0; + + if( SvXMLUnitConverter::convertMeasure( nRel, rStrImpValue, MAP_POINT ) ) + { + rValue <<= (float)nRel; + return sal_True; + } + + return sal_False; +} + +sal_Bool XMLCharHeightDiffHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const +{ + OUStringBuffer aOut; + + float nRel = 0; + if( (rValue >>= nRel) && (nRel != 0) ) + { + SvXMLUnitConverter::convertMeasure( aOut, nRel, MAP_POINT, MAP_POINT ); + rStrExpValue = aOut.makeStringAndClear(); + } + + return rStrExpValue.getLength() != 0; +} + diff --git a/xmloff/source/style/chrhghdl.hxx b/xmloff/source/style/chrhghdl.hxx index 203ad88d00e3..c6f058ea1687 100644 --- a/xmloff/source/style/chrhghdl.hxx +++ b/xmloff/source/style/chrhghdl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: chrhghdl.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $ + * last change: $Author: mib $ $Date: 2000-10-24 07:40:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,5 +87,14 @@ public: virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; }; +class XMLCharHeightDiffHdl : public XMLPropertyHandler +{ +public: + virtual ~XMLCharHeightDiffHdl(); + + virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; +}; + #endif // _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx index f264a1cbc5c4..ea89b00d345d 100644 --- a/xmloff/source/style/prhdlfac.cxx +++ b/xmloff/source/style/prhdlfac.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prhdlfac.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dr $ $Date: 2000-10-23 09:54:37 $ + * last change: $Author: mib $ $Date: 2000-10-24 07:40:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -325,6 +325,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 case XML_TYPE_CHAR_HEIGHT_PROP: pPropHdl = new XMLCharHeightPropHdl; break; + case XML_TYPE_CHAR_HEIGHT_DIFF: + pPropHdl = new XMLCharHeightDiffHdl; + break; case XML_TYPE_CHAR_LANGUAGE: pPropHdl = new XMLCharLanguageHdl; break; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 924ed935b80a..3bc05e67e8f7 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtprmap.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: mib $ $Date: 2000-10-23 12:06:21 $ + * last change: $Author: mib $ $Date: 2000-10-24 07:41:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,6 +123,7 @@ XMLPropertyMapEntry aXMLParaPropMap[] = // 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 ), + M_E( "CharDiffFontHeight",STYLE,font_size_rel, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF ), // RES_CHRATR_KERNING M_E( "CharKerning", FO, letter_spacing, XML_TYPE_TEXT_KERNING, 0 ), // RES_CHRATR_LANGUAGE @@ -322,6 +323,7 @@ XMLPropertyMapEntry aXMLTextPropMap[] = // 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 ), + M_E( "CharDiffFontHeight",STYLE,font_size_rel, XML_TYPE_CHAR_HEIGHT_DIFF, CTF_CHARHEIGHT_DIFF ), // RES_CHRATR_KERNING M_E( "CharKerning", FO, letter_spacing, XML_TYPE_TEXT_KERNING, 0 ), // RES_CHRATR_LANGUAGE @@ -511,6 +513,7 @@ void XMLTextPropertySetMapper::ContextFilter( // filter char height point/percent XMLPropertyState* pCharHeightState = NULL; XMLPropertyState* pCharPropHeightState = NULL; + XMLPropertyState* pCharDiffHeightState = NULL; // filter left margin measure/percent XMLPropertyState* pParaLeftMarginState = NULL; @@ -599,6 +602,7 @@ void XMLTextPropertySetMapper::ContextFilter( { case CTF_CHARHEIGHT: pCharHeightState = propertie; break; case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break; + case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break; case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break; case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break; case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break; @@ -669,6 +673,21 @@ void XMLTextPropertySetMapper::ContextFilter( 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(); + } + } if( pParaLeftMarginState && pParaLeftMarginRelState ) { |