#86546# automatic column width now supported
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: XMLTextColumnsContext.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mib $ $Date: 2000-10-30 12:46:46 $
|
||||
* last change: $Author: dvo $ $Date: 2001-05-15 12:37:46 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -79,12 +79,17 @@ class XMLTextColumnsContext :public XMLElementPropertyContext
|
||||
const ::rtl::OUString sSeparatorLineColor;
|
||||
const ::rtl::OUString sSeparatorLineRelativeHeight;
|
||||
const ::rtl::OUString sSeparatorLineVerticalAlignment;
|
||||
const ::rtl::OUString sIsAutomatic;
|
||||
const ::rtl::OUString sAutomaticDistance;
|
||||
|
||||
|
||||
XMLTextColumnsArray_Impl *pColumns;
|
||||
XMLTextColumnSepContext_Impl *pColumnSep;
|
||||
SvXMLTokenMap *pColumnAttrTokenMap;
|
||||
SvXMLTokenMap *pColumnSepAttrTokenMap;
|
||||
sal_Int16 nCount;
|
||||
sal_Bool bAutomatic;
|
||||
sal_Int32 nAutomaticDistance;
|
||||
|
||||
public:
|
||||
TYPEINFO();
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: XMLTextColumnsExport.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mib $ $Date: 2000-10-30 12:46:46 $
|
||||
* last change: $Author: dvo $ $Date: 2001-05-15 12:37:46 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -74,6 +74,8 @@ class XMLTextColumnsExport
|
||||
const ::rtl::OUString sSeparatorLineColor;
|
||||
const ::rtl::OUString sSeparatorLineRelativeHeight;
|
||||
const ::rtl::OUString sSeparatorLineVerticalAlignment;
|
||||
const ::rtl::OUString sIsAutomatic;
|
||||
const ::rtl::OUString sAutomaticDistance;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: xmlkywd.hxx,v $
|
||||
*
|
||||
* $Revision: 1.155 $
|
||||
* $Revision: 1.156 $
|
||||
*
|
||||
* last change: $Author: bm $ $Date: 2001-05-11 13:54:44 $
|
||||
* last change: $Author: dvo $ $Date: 2001-05-15 12:37:45 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -400,6 +400,7 @@ XML_CONSTASCII_ACTION( sXML_color_inversion , "color-inversion" );
|
||||
XML_CONSTASCII_ACTION( sXML_color_mode , "color-mode" );
|
||||
XML_CONSTASCII_ACTION( sXML_column, "column" );
|
||||
XML_CONSTASCII_ACTION( sXML_column_count, "column-count" );
|
||||
XML_CONSTASCII_ACTION( sXML_column_gap, "column-gap" );
|
||||
XML_CONSTASCII_ACTION( sXML_column_name, "column-name" );
|
||||
XML_CONSTASCII_ACTION( sXML_column_sep, "column-sep" );
|
||||
XML_CONSTASCII_ACTION( sXML_column_width, "column-width" );
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: XMLTextColumnsContext.cxx,v $
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
* last change: $Author: mtg $ $Date: 2001-04-18 16:14:57 $
|
||||
* last change: $Author: dvo $ $Date: 2001-05-15 12:37:49 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -336,11 +336,15 @@ XMLTextColumnsContext::XMLTextColumnsContext(
|
||||
pColumns( 0 ),
|
||||
pColumnSep( 0 ),
|
||||
nCount( 0 ),
|
||||
bAutomatic( sal_False ),
|
||||
nAutomaticDistance( 0 ),
|
||||
sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn")),
|
||||
sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")),
|
||||
sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")),
|
||||
sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")),
|
||||
sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment"))
|
||||
sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")),
|
||||
sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")),
|
||||
sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
|
||||
{
|
||||
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
|
||||
sal_Int32 nVal;
|
||||
@@ -352,14 +356,22 @@ XMLTextColumnsContext::XMLTextColumnsContext(
|
||||
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
|
||||
&aLocalName );
|
||||
const OUString& rValue = xAttrList->getValueByIndex( i );
|
||||
if( XML_NAMESPACE_FO == nPrefix &&
|
||||
aLocalName.equalsAsciiL( sXML_column_count,
|
||||
if( XML_NAMESPACE_FO == nPrefix )
|
||||
{
|
||||
if( aLocalName.equalsAsciiL( sXML_column_count,
|
||||
sizeof(sXML_column_count)-1 ) &&
|
||||
GetImport().GetMM100UnitConverter().
|
||||
convertNumber( nVal, rValue, 0, SHRT_MAX ) )
|
||||
{
|
||||
nCount = (sal_Int16)nVal;
|
||||
}
|
||||
else if( aLocalName.equalsAsciiL( sXML_column_gap,
|
||||
sizeof(sXML_column_gap)-1 ) )
|
||||
{
|
||||
bAutomatic = GetImport().GetMM100UnitConverter().
|
||||
convertMeasure( nAutomaticDistance, rValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,8 +455,12 @@ void XMLTextColumnsContext::EndElement( )
|
||||
// zero columns = no columns -> 1 column
|
||||
xColumns->setColumnCount( 1 );
|
||||
}
|
||||
else if( pColumns && pColumns->Count() == (sal_uInt16)nCount )
|
||||
else if( !bAutomatic && pColumns &&
|
||||
pColumns->Count() == (sal_uInt16)nCount )
|
||||
{
|
||||
// if we have column descriptions, one per column, and we don't use
|
||||
// automatic width, then set the column widths
|
||||
|
||||
sal_Int32 nRelWidth = 0;
|
||||
sal_uInt16 nColumnsWithWidth = 0;
|
||||
for( sal_Int16 i=0; i < nCount; i++ )
|
||||
@@ -486,6 +502,9 @@ void XMLTextColumnsContext::EndElement( )
|
||||
}
|
||||
else
|
||||
{
|
||||
// only set column count (and let the columns be distributed
|
||||
// automatically)
|
||||
|
||||
xColumns->setColumnCount( nCount );
|
||||
}
|
||||
|
||||
@@ -520,6 +539,13 @@ void XMLTextColumnsContext::EndElement( )
|
||||
aAny <<= pColumnSep->GetVertAlign();
|
||||
xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, aAny );
|
||||
}
|
||||
|
||||
// handle 'automatic columns': column distance
|
||||
if( bAutomatic )
|
||||
{
|
||||
aAny <<= nAutomaticDistance;
|
||||
xPropSet->setPropertyValue( sAutomaticDistance, aAny );
|
||||
}
|
||||
}
|
||||
|
||||
aProp.maValue <<= xColumns;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: XMLTextColumnsExport.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: mib $ $Date: 2000-10-30 12:47:14 $
|
||||
* last change: $Author: dvo $ $Date: 2001-05-15 12:37:49 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -112,7 +112,9 @@ XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) :
|
||||
sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")),
|
||||
sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")),
|
||||
sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")),
|
||||
sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment"))
|
||||
sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment")),
|
||||
sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic")),
|
||||
sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -129,10 +131,29 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
|
||||
GetExport().GetMM100UnitConverter().convertNumber( sValue, nCount );
|
||||
GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_column_count,
|
||||
sValue.makeStringAndClear() );
|
||||
|
||||
// handle 'automatic' columns
|
||||
Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
|
||||
if( xPropSet.is() )
|
||||
{
|
||||
Any aAny = xPropSet->getPropertyValue( sIsAutomatic );
|
||||
if ( *(sal_Bool*)aAny.getValue() )
|
||||
{
|
||||
aAny = xPropSet->getPropertyValue( sAutomaticDistance );
|
||||
sal_Int32 nDistance = 0;
|
||||
aAny >>= nDistance;
|
||||
OUStringBuffer aBuffer;
|
||||
GetExport().GetMM100UnitConverter().convertMeasure(
|
||||
aBuffer, nDistance );
|
||||
GetExport().AddAttribute( XML_NAMESPACE_FO,
|
||||
sXML_column_gap,
|
||||
aBuffer.makeStringAndClear() );
|
||||
}
|
||||
}
|
||||
|
||||
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, sXML_columns,
|
||||
sal_True, sal_True );
|
||||
|
||||
Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
|
||||
if( xPropSet.is() )
|
||||
{
|
||||
Any aAny = xPropSet->getPropertyValue( sSeparatorLineIsOn );
|
||||
|
||||
Reference in New Issue
Block a user