This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch odf-devel in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 445cd3acaf696af5d21604187b3ceca8f3868445 Author: Jim Jagielski <[email protected]> AuthorDate: Wed Oct 28 08:16:58 2026 -0400 xmloff: connection-resource order, zero table sizes and script events without a script --- main/xmloff/source/forms/elementexport.cxx | 19 ++++++++++--------- main/xmloff/source/script/XMLScriptExportHandler.cxx | 11 ++++++++++- main/xmloff/source/table/XMLTableExport.cxx | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/main/xmloff/source/forms/elementexport.cxx b/main/xmloff/source/forms/elementexport.cxx index f213b0db04..ca1fcee79d 100644 --- a/main/xmloff/source/forms/elementexport.cxx +++ b/main/xmloff/source/forms/elementexport.cxx @@ -2083,6 +2083,16 @@ namespace xmloff //--------------------------------------------------------------------- void OFormExport::exportSubTags() { + // let the base class export the remaining properties and the events + OElementExport::exportSubTags(); + // loop through all children + Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY); + OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic�ous!"); + + if (xCollection.is()) + m_rContext.exportCollectionElements(xCollection); + + // the schema wants connection-resource after the controls if ( m_bCreateConnectionResourceElement && m_xProps.is() ) { m_rContext.getGlobalContext().ClearAttrList(); @@ -2100,15 +2110,6 @@ namespace xmloff SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, xmloff::token::XML_CONNECTION_RESOURCE, sal_True, sal_True); } } - - // let the base class export the remaining properties and the events - OElementExport::exportSubTags(); - // loop through all children - Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY); - OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic�ous!"); - - if (xCollection.is()) - m_rContext.exportCollectionElements(xCollection); } //--------------------------------------------------------------------- diff --git a/main/xmloff/source/script/XMLScriptExportHandler.cxx b/main/xmloff/source/script/XMLScriptExportHandler.cxx index 3feaf2c6e6..74cc71853b 100644 --- a/main/xmloff/source/script/XMLScriptExportHandler.cxx +++ b/main/xmloff/source/script/XMLScriptExportHandler.cxx @@ -57,13 +57,22 @@ void XMLScriptExportHandler::Export( Sequence<PropertyValue> & rValues, sal_Bool bUseWhitespace) { + // without the property the listener would lack the required xlink:href and xlink:type + sal_Bool bHasScript = sal_False; + sal_Int32 nCount = rValues.getLength(); + for(sal_Int32 i = 0; i < nCount; i++) + { + if (sURL.equals(rValues[i].Name)) + bHasScript = sal_True; + } + if (!bHasScript) + return; rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_LANGUAGE, rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) ); rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, rEventQName); - sal_Int32 nCount = rValues.getLength(); for(sal_Int32 i = 0; i < nCount; i++) { if (sURL.equals(rValues[i].Name)) diff --git a/main/xmloff/source/table/XMLTableExport.cxx b/main/xmloff/source/table/XMLTableExport.cxx index d12ef03da2..6c84942b6c 100644 --- a/main/xmloff/source/table/XMLTableExport.cxx +++ b/main/xmloff/source/table/XMLTableExport.cxx @@ -199,6 +199,18 @@ XMLTableExport::~XMLTableExport () // -------------------------------------------------------------------- +// a 0 width or height is not a positiveLength +static void drop_zero_measure( std::vector< XMLPropertyState >& rStates, const UniReference< XMLPropertySetMapper >& xMapper, const sal_Char* pApiName ) +{ + for( std::vector< XMLPropertyState >::iterator aIter( rStates.begin() ); aIter != rStates.end(); ++aIter ) + { + sal_Int32 nValue = 0; + if( aIter->mnIndex != -1 && ( aIter->maValue >>= nValue ) && nValue == 0 && + xMapper->GetEntryAPIName( aIter->mnIndex ).equalsAscii( pApiName ) ) + aIter->mnIndex = -1; + } +} + static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) { if( !xPropStates.empty() ) @@ -233,6 +245,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) { Reference< XPropertySet > xPropSet( xIndexAccessCols->getByIndex(nColumn) , UNO_QUERY_THROW ); std::vector< XMLPropertyState > xPropStates( mxColumnExportPropertySetMapper->Filter( xPropSet ) ); + drop_zero_measure( xPropStates, mxColumnExportPropertySetMapper->getPropertySetMapper(), "Width" ); if( has_states( xPropStates ) ) { @@ -256,6 +269,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) { Reference< XPropertySet > xPropSet( xIndexAccessRows->getByIndex(nRow) , UNO_QUERY_THROW ); std::vector< XMLPropertyState > xRowPropStates( mxRowExportPropertySetMapper->Filter( xPropSet ) ); + drop_zero_measure( xRowPropStates, mxRowExportPropertySetMapper->getPropertySetMapper(), "Height" ); if( has_states( xRowPropStates ) ) {
