summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-16 16:06:42 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-19 17:57:19 +0100
commitf62695deb4cc333247b625d1864ab6262fa02eb6 (patch)
tree817a591f80680aab2ef1254f2591124edc24e16c /xmloff
parentb6e874de427a748156307d50cf6bf0ef89b0ffd1 (diff)
Added column separator style in ODF
Diffstat (limited to 'xmloff')
-rwxr-xr-xxmloff/inc/XMLTextColumnsContext.hxx1
-rwxr-xr-xxmloff/inc/XMLTextColumnsExport.hxx1
-rwxr-xr-xxmloff/source/text/XMLTextColumnsContext.cxx29
-rwxr-xr-xxmloff/source/text/XMLTextColumnsExport.cxx23
4 files changed, 52 insertions, 2 deletions
diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx
index 779f2e78aa..ce0395004a 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 abbaeeee58..ea2cef31de 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 f843cc57d1..47d076d344 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 b22af2581e..46e12a0234 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;