diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-16 16:06:42 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 17:57:19 +0100 |
commit | 6695b26980f9b089c32308cd8fd51706bf8c34f1 (patch) | |
tree | f01c3cf1b82e6beb46103bd2ec5d55f1bb6a7f43 /xmloff | |
parent | 5c983682af88cba53dd02acf17d29a9f6f2ff9e5 (diff) |
Added column separator style in ODF
Diffstat (limited to 'xmloff')
-rwxr-xr-x | xmloff/inc/XMLTextColumnsContext.hxx | 1 | ||||
-rwxr-xr-x | xmloff/inc/XMLTextColumnsExport.hxx | 1 | ||||
-rwxr-xr-x | xmloff/source/text/XMLTextColumnsContext.cxx | 29 | ||||
-rwxr-xr-x | xmloff/source/text/XMLTextColumnsExport.cxx | 23 |
4 files changed, 52 insertions, 2 deletions
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx index 078a6bfffec3..c8bc74ea1c87 100755 --- a/xmloff/inc/XMLTextColumnsContext.hxx +++ b/xmloff/inc/XMLTextColumnsContext.hxx @@ -46,6 +46,7 @@ class XMLTextColumnsContext :public XMLElementPropertyContext const ::rtl::OUString sSeparatorLineVerticalAlignment; const ::rtl::OUString sIsAutomatic; const ::rtl::OUString sAutomaticDistance; + const ::rtl::OUString sSeparatorLineStyle; XMLTextColumnsArray_Impl *pColumns; diff --git a/xmloff/inc/XMLTextColumnsExport.hxx b/xmloff/inc/XMLTextColumnsExport.hxx index a40a351c6828..b108e1982b53 100755 --- a/xmloff/inc/XMLTextColumnsExport.hxx +++ b/xmloff/inc/XMLTextColumnsExport.hxx @@ -43,6 +43,7 @@ class XMLTextColumnsExport const ::rtl::OUString sSeparatorLineVerticalAlignment; const ::rtl::OUString sIsAutomatic; const ::rtl::OUString sAutomaticDistance; + const ::rtl::OUString sSeparatorLineStyle; protected: diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx index c4252e02be24..a1bfa163711a 100755 --- a/xmloff/source/text/XMLTextColumnsContext.cxx +++ b/xmloff/source/text/XMLTextColumnsContext.cxx @@ -68,6 +68,7 @@ enum SvXMLSepTokenMapAttrs XML_TOK_COLUMN_SEP_HEIGHT, XML_TOK_COLUMN_SEP_COLOR, XML_TOK_COLUMN_SEP_ALIGN, + XML_TOK_COLUMN_SEP_STYLE, XML_TOK_COLUMN_SEP_END=XML_TOK_UNKNOWN }; @@ -85,9 +86,19 @@ static SvXMLTokenMapEntry aColSepAttrTokenMap[] = { XML_NAMESPACE_STYLE, XML_COLOR, XML_TOK_COLUMN_SEP_COLOR }, { XML_NAMESPACE_STYLE, XML_HEIGHT, XML_TOK_COLUMN_SEP_HEIGHT }, { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TOK_COLUMN_SEP_ALIGN }, + { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_COLUMN_SEP_STYLE }, XML_TOKEN_MAP_END }; +SvXMLEnumMapEntry const pXML_Sep_Style_Enum[] = +{ + { XML_NONE, 0 }, + { XML_SOLID, 1 }, + { XML_DOTTED, 2 }, + { XML_DASHED, 3 }, + { XML_TOKEN_INVALID, 0 } +}; + SvXMLEnumMapEntry const pXML_Sep_Align_Enum[] = { { XML_TOP, VerticalAlignment_TOP }, @@ -181,6 +192,7 @@ class XMLTextColumnSepContext_Impl: public SvXMLImportContext sal_Int32 nWidth; sal_Int32 nColor; sal_Int8 nHeight; + sal_Int8 nStyle; VerticalAlignment eVertAlign; @@ -198,6 +210,7 @@ public: sal_Int32 GetWidth() const { return nWidth; } sal_Int32 GetColor() const { return nColor; } sal_Int8 GetHeight() const { return nHeight; } + sal_Int8 GetStyle() const { return nStyle; } VerticalAlignment GetVertAlign() const { return eVertAlign; } }; @@ -214,6 +227,7 @@ XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl( nWidth( 2 ), nColor( 0 ), nHeight( 100 ), + nStyle( 1 ), eVertAlign( VerticalAlignment_TOP ) { sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -257,6 +271,15 @@ XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl( eVertAlign = (VerticalAlignment)nAlign; } break; + case XML_TOK_COLUMN_SEP_STYLE: + { + sal_uInt16 nStyleVal; + if( GetImport().GetMM100UnitConverter(). + convertEnum( nStyleVal, rValue, + pXML_Sep_Style_Enum ) ) + nStyle = (sal_Int8)nStyleVal; + } + break; } } } @@ -287,6 +310,7 @@ XMLTextColumnsContext::XMLTextColumnsContext( , sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")) , sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")) , sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")) +, sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle")) , pColumns( 0 ) , pColumnSep( 0 ) , pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) ) @@ -478,6 +502,11 @@ void XMLTextColumnsContext::EndElement( ) xPropSet->setPropertyValue( sSeparatorLineRelativeHeight, aAny ); } + if ( pColumnSep->GetStyle() ) + { + aAny <<= pColumnSep->GetStyle(); + xPropSet->setPropertyValue( sSeparatorLineStyle, aAny ); + } aAny <<= pColumnSep->GetColor(); diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx index 2ccb6085df97..a4c58f4651d9 100755 --- a/xmloff/source/text/XMLTextColumnsExport.cxx +++ b/xmloff/source/text/XMLTextColumnsExport.cxx @@ -61,7 +61,8 @@ XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) : sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")), sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")), sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")), - sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")) + sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")), + sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle")) { } @@ -133,12 +134,30 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_HEIGHT, sValue.makeStringAndClear() ); + // style::style + aAny = xPropSet->getPropertyValue( sSeparatorLineStyle ); + sal_Int8 nStyle = 0; + aAny >>= nStyle; + + enum XMLTokenEnum eStr = XML_TOKEN_INVALID; + switch ( nStyle ) + { + case 0: eStr = XML_NONE; break; + case 1: eStr = XML_SOLID; break; + case 2: eStr = XML_DOTTED; break; + case 3: eStr = XML_DASHED; break; + default: + break; + } + if ( eStr != XML_TOKEN_INVALID ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_STYLE, eStr ); + // style:vertical-align aAny = xPropSet->getPropertyValue( sSeparatorLineVerticalAlignment ); VerticalAlignment eVertAlign; aAny >>= eVertAlign; - enum XMLTokenEnum eStr = XML_TOKEN_INVALID; + eStr = XML_TOKEN_INVALID; switch( eVertAlign ) { // case VerticalAlignment_TOP: eStr = XML_TOP; |