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 be94c9a1900a5c9cd79d87927af991fc9ac3fe10 Author: Jim Jagielski <[email protected]> AuthorDate: Fri Oct 23 08:51:37 2026 -0400 xmloff: write style:layout-grid-snap-to in ODF 1.2 mode The UOF export transforms (odf2uof_text.xsl and uof2/odf2uof.xsl) read only the old attribute name, so UOF export in this mode loses the character-grid type. Checked by reading the XSLTs; UOF export was not run. --- main/xmloff/inc/xmloff/PageMasterStyleMap.hxx | 1 + main/xmloff/inc/xmloff/xmltoken.hxx | 1 + main/xmloff/source/core/xmltoken.cxx | 1 + main/xmloff/source/style/PageMasterExportPropMapper.cxx | 13 +++++++++++++ main/xmloff/source/style/PageMasterStyleMap.cxx | 1 + 5 files changed, 17 insertions(+) diff --git a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx index 26808181fb..5100f8c049 100644 --- a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx +++ b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx @@ -108,6 +108,7 @@ #define CTF_PM_STANDARD_MODE (XML_PM_CTF_START + 0x0055) #define CTP_PM_GRID_BASE_WIDTH (XML_PM_CTF_START + 0x0056) #define CTP_PM_GRID_SNAP_TO_CHARS (XML_PM_CTF_START + 0x0057) +#define CTP_PM_GRID_SNAP_TO (XML_PM_CTF_START + 0x0058) // header #define CTF_PM_HEADERBORDERALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERALL) #define CTF_PM_HEADERBORDERTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERTOP) diff --git a/main/xmloff/inc/xmloff/xmltoken.hxx b/main/xmloff/inc/xmloff/xmltoken.hxx index 02fae063f6..7612941ba5 100644 --- a/main/xmloff/inc/xmloff/xmltoken.hxx +++ b/main/xmloff/inc/xmloff/xmltoken.hxx @@ -3139,6 +3139,7 @@ namespace xmloff { namespace token { XML_ASTERISK, XML_HORIZONTAL_BAR, XML_VERTICAL_BAR, + XML_LAYOUT_GRID_SNAP_TO, XML_TOKEN_END }; diff --git a/main/xmloff/source/core/xmltoken.cxx b/main/xmloff/source/core/xmltoken.cxx index eb679c8ee1..e8d1e8ed69 100644 --- a/main/xmloff/source/core/xmltoken.cxx +++ b/main/xmloff/source/core/xmltoken.cxx @@ -3139,6 +3139,7 @@ namespace xmloff { namespace token { TOKEN( "asterisk", XML_ASTERISK ), TOKEN( "horizontal-bar", XML_HORIZONTAL_BAR ), TOKEN( "vertical-bar", XML_VERTICAL_BAR ), + TOKEN( "layout-grid-snap-to", XML_LAYOUT_GRID_SNAP_TO ), #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx b/main/xmloff/source/style/PageMasterExportPropMapper.cxx index 476014f427..80e1c19bd3 100644 --- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -337,6 +337,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( XMLPropertyState* pPMStandardMode = NULL; XMLPropertyState* pPMGridBaseWidth = NULL; XMLPropertyState* pPMGridSnapToChars = NULL; + XMLPropertyState* pPMGridSnapTo = NULL; XMLPropertyState* pPMHeaderGraphicUrl = NULL; XMLPropertyState* pPMFooterGraphicUrl = NULL; @@ -407,6 +408,7 @@ void XMLPageMasterExportPropMapper::ContextFilter( case CTF_PM_STANDARD_MODE: pPMStandardMode = pProp; break; case CTP_PM_GRID_BASE_WIDTH: pPMGridBaseWidth = pProp; break; case CTP_PM_GRID_SNAP_TO_CHARS: pPMGridSnapToChars = pProp; break; + case CTP_PM_GRID_SNAP_TO: pPMGridSnapTo = pProp; break; case CTF_PM_HEADERGRAPHICURL: pPMHeaderGraphicUrl = pProp; break; case CTF_PM_FOOTERGRAPHICURL: pPMFooterGraphicUrl = pProp; break; @@ -529,6 +531,17 @@ void XMLPageMasterExportPropMapper::ContextFilter( lcl_RemoveState(pPMGridBaseWidth); if( pPMGridSnapToChars ) lcl_RemoveState(pPMGridSnapToChars); + if( pPMGridSnapTo ) + lcl_RemoveState(pPMGridSnapTo); + } + + // ODF 1.2 calls it style:layout-grid-snap-to; strict mode writes only that name + if( pPMGridSnapToChars && pPMGridSnapTo ) + { + if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 ) + lcl_RemoveState( pPMGridSnapToChars ); + else + lcl_RemoveState( pPMGridSnapTo ); } // ext output stays as before (the ids once collided with the repeat offsets, so none was written) diff --git a/main/xmloff/source/style/PageMasterStyleMap.cxx b/main/xmloff/source/style/PageMasterStyleMap.cxx index 6760878e0f..aa69b897bd 100644 --- a/main/xmloff/source/style/PageMasterStyleMap.cxx +++ b/main/xmloff/source/style/PageMasterStyleMap.cxx @@ -117,6 +117,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = //text grid enhancement for better CJK support PLMAP( "GridBaseWidth", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_WIDTH, XML_TYPE_MEASURE, CTP_PM_GRID_BASE_WIDTH ), PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO_CHARS, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO_CHARS ), + PLMAP( "GridSnapToChars", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_SNAP_TO, XML_TYPE_BOOL, CTP_PM_GRID_SNAP_TO ), //export as a default attribute PLMAP( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ),
