Kaydet (Commit) d668a44c authored tarafından Daniel Vogelheim's avatar Daniel Vogelheim

#86546# automatic column width now supported

üst 6f2226f7
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLTextColumnsContext.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -79,12 +79,17 @@ class XMLTextColumnsContext :public XMLElementPropertyContext ...@@ -79,12 +79,17 @@ class XMLTextColumnsContext :public XMLElementPropertyContext
const ::rtl::OUString sSeparatorLineColor; const ::rtl::OUString sSeparatorLineColor;
const ::rtl::OUString sSeparatorLineRelativeHeight; const ::rtl::OUString sSeparatorLineRelativeHeight;
const ::rtl::OUString sSeparatorLineVerticalAlignment; const ::rtl::OUString sSeparatorLineVerticalAlignment;
const ::rtl::OUString sIsAutomatic;
const ::rtl::OUString sAutomaticDistance;
XMLTextColumnsArray_Impl *pColumns; XMLTextColumnsArray_Impl *pColumns;
XMLTextColumnSepContext_Impl *pColumnSep; XMLTextColumnSepContext_Impl *pColumnSep;
SvXMLTokenMap *pColumnAttrTokenMap; SvXMLTokenMap *pColumnAttrTokenMap;
SvXMLTokenMap *pColumnSepAttrTokenMap; SvXMLTokenMap *pColumnSepAttrTokenMap;
sal_Int16 nCount; sal_Int16 nCount;
sal_Bool bAutomatic;
sal_Int32 nAutomaticDistance;
public: public:
TYPEINFO(); TYPEINFO();
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLTextColumnsExport.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -74,6 +74,8 @@ class XMLTextColumnsExport ...@@ -74,6 +74,8 @@ class XMLTextColumnsExport
const ::rtl::OUString sSeparatorLineColor; const ::rtl::OUString sSeparatorLineColor;
const ::rtl::OUString sSeparatorLineRelativeHeight; const ::rtl::OUString sSeparatorLineRelativeHeight;
const ::rtl::OUString sSeparatorLineVerticalAlignment; const ::rtl::OUString sSeparatorLineVerticalAlignment;
const ::rtl::OUString sIsAutomatic;
const ::rtl::OUString sAutomaticDistance;
protected: protected:
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlkywd.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -400,6 +400,7 @@ XML_CONSTASCII_ACTION( sXML_color_inversion , "color-inversion" ); ...@@ -400,6 +400,7 @@ XML_CONSTASCII_ACTION( sXML_color_inversion , "color-inversion" );
XML_CONSTASCII_ACTION( sXML_color_mode , "color-mode" ); XML_CONSTASCII_ACTION( sXML_color_mode , "color-mode" );
XML_CONSTASCII_ACTION( sXML_column, "column" ); XML_CONSTASCII_ACTION( sXML_column, "column" );
XML_CONSTASCII_ACTION( sXML_column_count, "column-count" ); 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_name, "column-name" );
XML_CONSTASCII_ACTION( sXML_column_sep, "column-sep" ); XML_CONSTASCII_ACTION( sXML_column_sep, "column-sep" );
XML_CONSTASCII_ACTION( sXML_column_width, "column-width" ); XML_CONSTASCII_ACTION( sXML_column_width, "column-width" );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLTextColumnsContext.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -336,11 +336,15 @@ XMLTextColumnsContext::XMLTextColumnsContext( ...@@ -336,11 +336,15 @@ XMLTextColumnsContext::XMLTextColumnsContext(
pColumns( 0 ), pColumns( 0 ),
pColumnSep( 0 ), pColumnSep( 0 ),
nCount( 0 ), nCount( 0 ),
bAutomatic( sal_False ),
nAutomaticDistance( 0 ),
sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn")), sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn")),
sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")), sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")),
sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")), sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")),
sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")), 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_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
sal_Int32 nVal; sal_Int32 nVal;
...@@ -352,14 +356,22 @@ XMLTextColumnsContext::XMLTextColumnsContext( ...@@ -352,14 +356,22 @@ XMLTextColumnsContext::XMLTextColumnsContext(
GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
&aLocalName ); &aLocalName );
const OUString& rValue = xAttrList->getValueByIndex( i ); const OUString& rValue = xAttrList->getValueByIndex( i );
if( XML_NAMESPACE_FO == nPrefix && if( XML_NAMESPACE_FO == nPrefix )
aLocalName.equalsAsciiL( sXML_column_count, {
if( aLocalName.equalsAsciiL( sXML_column_count,
sizeof(sXML_column_count)-1 ) && sizeof(sXML_column_count)-1 ) &&
GetImport().GetMM100UnitConverter(). GetImport().GetMM100UnitConverter().
convertNumber( nVal, rValue, 0, SHRT_MAX ) ) convertNumber( nVal, rValue, 0, SHRT_MAX ) )
{ {
nCount = (sal_Int16)nVal; 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( ) ...@@ -443,8 +455,12 @@ void XMLTextColumnsContext::EndElement( )
// zero columns = no columns -> 1 column // zero columns = no columns -> 1 column
xColumns->setColumnCount( 1 ); 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_Int32 nRelWidth = 0;
sal_uInt16 nColumnsWithWidth = 0; sal_uInt16 nColumnsWithWidth = 0;
for( sal_Int16 i=0; i < nCount; i++ ) for( sal_Int16 i=0; i < nCount; i++ )
...@@ -486,6 +502,9 @@ void XMLTextColumnsContext::EndElement( ) ...@@ -486,6 +502,9 @@ void XMLTextColumnsContext::EndElement( )
} }
else else
{ {
// only set column count (and let the columns be distributed
// automatically)
xColumns->setColumnCount( nCount ); xColumns->setColumnCount( nCount );
} }
...@@ -520,6 +539,13 @@ void XMLTextColumnsContext::EndElement( ) ...@@ -520,6 +539,13 @@ void XMLTextColumnsContext::EndElement( )
aAny <<= pColumnSep->GetVertAlign(); aAny <<= pColumnSep->GetVertAlign();
xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, aAny ); xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, aAny );
} }
// handle 'automatic columns': column distance
if( bAutomatic )
{
aAny <<= nAutomaticDistance;
xPropSet->setPropertyValue( sAutomaticDistance, aAny );
}
} }
aProp.maValue <<= xColumns; aProp.maValue <<= xColumns;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: XMLTextColumnsExport.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -112,7 +112,9 @@ XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) : ...@@ -112,7 +112,9 @@ XMLTextColumnsExport::XMLTextColumnsExport( SvXMLExport& rExp ) :
sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")), sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth")),
sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")), sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor")),
sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight")), 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 ) ...@@ -129,10 +131,29 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
GetExport().GetMM100UnitConverter().convertNumber( sValue, nCount ); GetExport().GetMM100UnitConverter().convertNumber( sValue, nCount );
GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_column_count, GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_column_count,
sValue.makeStringAndClear() ); 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, SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, sXML_columns,
sal_True, sal_True ); sal_True, sal_True );
Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
if( xPropSet.is() ) if( xPropSet.is() )
{ {
Any aAny = xPropSet->getPropertyValue( sSeparatorLineIsOn ); Any aAny = xPropSet->getPropertyValue( sSeparatorLineIsOn );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment