You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2026/10/23 12:51:52 UTC
(openoffice) branch odf-devel updated (405b633a16 -> 22f5c9e469)
This is an automated email from the ASF dual-hosted git repository.
jimjag pushed a change to branch odf-devel
in repository https://gitbox.apache.org/repos/asf/openoffice.git
from 405b633a16 test/odf-validate: add fixtures for the DDE link and empty chart table fixes
new ef0a8aeea9 xmloff: don't write draw:fill* in paragraph styles in ODF 1.2 mode
new e86e06dbff xmloff: don't write draw:fill* on page layouts, headers and footers in ODF 1.2 mode
new 83b30299d0 xmloff: write style:background-image for header and footer graphics
new be94c9a190 xmloff: write style:layout-grid-snap-to in ODF 1.2 mode
new 58c72c10be sw: don't write style:keep-together on table rows in ODF 1.2 mode
new 22f5c9e469 test/odf-validate: add fixtures for the ODF 1.2 mode fill, grid-snap and row-split fixes
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
main/sw/source/filter/xml/xmlexpit.cxx | 1 +
main/xmloff/inc/xmloff/PageMasterStyleMap.hxx | 9 +-
main/xmloff/inc/xmloff/xmltoken.hxx | 1 +
main/xmloff/source/core/xmltoken.cxx | 1 +
.../source/style/PageMasterExportPropMapper.cxx | 26 ++++++
main/xmloff/source/style/PageMasterStyleMap.cxx | 15 ++++
main/xmloff/source/text/txtprmap.cxx | 6 ++
test/odf-validate/fixtures/fill-others/calc.json | 14 +++
test/odf-validate/fixtures/fill-others/draw.json | 10 +++
.../odf-validate/fixtures/fill-others/impress.json | 10 +++
test/odf-validate/fixtures/fill-others/make.py | 98 +++++++++++++++++++++
.../fixtures/fill-others/others-calc.ods | Bin 0 -> 9160 bytes
.../fixtures/fill-others/others-draw.odg | Bin 0 -> 9758 bytes
.../fixtures/fill-others/others-impress.odp | Bin 0 -> 14795 bytes
.../fixtures/fill-others/others-writer.odt | Bin 0 -> 9604 bytes
test/odf-validate/fixtures/fill-others/writer.json | 18 ++++
test/odf-validate/fixtures/grid-snap/checks.json | 6 ++
test/odf-validate/fixtures/grid-snap/grid-snap.odt | Bin 0 -> 8918 bytes
test/odf-validate/fixtures/grid-snap/make.py | 35 ++++++++
test/odf-validate/fixtures/page-fill/bitmap.json | 6 ++
test/odf-validate/fixtures/page-fill/checks.json | 14 +++
test/odf-validate/fixtures/page-fill/make.py | 60 +++++++++++++
test/odf-validate/fixtures/page-fill/page-fill.odt | Bin 0 -> 9916 bytes
test/odf-validate/fixtures/para-fill/bitmap.json | 10 +++
test/odf-validate/fixtures/para-fill/checks.json | 14 +++
test/odf-validate/fixtures/para-fill/make.py | 65 ++++++++++++++
test/odf-validate/fixtures/para-fill/para-fill.odt | Bin 0 -> 12883 bytes
test/odf-validate/fixtures/row-split/checks.json | 11 +++
test/odf-validate/fixtures/row-split/make.py | 17 ++++
test/odf-validate/fixtures/row-split/row-split.odt | Bin 0 -> 8704 bytes
30 files changed, 443 insertions(+), 4 deletions(-)
create mode 100644 test/odf-validate/fixtures/fill-others/calc.json
create mode 100644 test/odf-validate/fixtures/fill-others/draw.json
create mode 100644 test/odf-validate/fixtures/fill-others/impress.json
create mode 100644 test/odf-validate/fixtures/fill-others/make.py
create mode 100644 test/odf-validate/fixtures/fill-others/others-calc.ods
create mode 100644 test/odf-validate/fixtures/fill-others/others-draw.odg
create mode 100644 test/odf-validate/fixtures/fill-others/others-impress.odp
create mode 100644 test/odf-validate/fixtures/fill-others/others-writer.odt
create mode 100644 test/odf-validate/fixtures/fill-others/writer.json
create mode 100644 test/odf-validate/fixtures/grid-snap/checks.json
create mode 100644 test/odf-validate/fixtures/grid-snap/grid-snap.odt
create mode 100644 test/odf-validate/fixtures/grid-snap/make.py
create mode 100644 test/odf-validate/fixtures/page-fill/bitmap.json
create mode 100644 test/odf-validate/fixtures/page-fill/checks.json
create mode 100644 test/odf-validate/fixtures/page-fill/make.py
create mode 100644 test/odf-validate/fixtures/page-fill/page-fill.odt
create mode 100644 test/odf-validate/fixtures/para-fill/bitmap.json
create mode 100644 test/odf-validate/fixtures/para-fill/checks.json
create mode 100644 test/odf-validate/fixtures/para-fill/make.py
create mode 100644 test/odf-validate/fixtures/para-fill/para-fill.odt
create mode 100644 test/odf-validate/fixtures/row-split/checks.json
create mode 100644 test/odf-validate/fixtures/row-split/make.py
create mode 100644 test/odf-validate/fixtures/row-split/row-split.odt
(openoffice) 04/06: xmloff: write style:layout-grid-snap-to in ODF 1.2 mode
Posted by ji...@apache.org.
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 <ji...@gmail.com>
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 ),
(openoffice) 05/06: sw: don't write style:keep-together on table rows in ODF 1.2 mode
Posted by ji...@apache.org.
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 58c72c10be0859614e56f8de68556383b83c935c
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 08:51:37 2026 -0400
sw: don't write style:keep-together on table rows in ODF 1.2 mode
The UOF export transforms (odf2uof_text.xsl and uof2/odf2uof.xsl) read only style:keep-together, so UOF export in this mode loses the table-row can't-split flag. Checked by reading the XSLTs; UOF export was not run.
---
main/sw/source/filter/xml/xmlexpit.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/main/sw/source/filter/xml/xmlexpit.cxx b/main/sw/source/filter/xml/xmlexpit.cxx
index 37142b86a5..5c4986b674 100644
--- a/main/sw/source/filter/xml/xmlexpit.cxx
+++ b/main/sw/source/filter/xml/xmlexpit.cxx
@@ -137,6 +137,7 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& rExport,
if( rEntry.nNameSpace == XML_NAMESPACE_STYLE )
{
if( (rExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) == 0 ||
+ rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_012 ||
!QueryXMLValue(rItem, aValue,
static_cast< sal_uInt16 >( rEntry.nMemberId & MID_SW_FLAG_MASK ),
rUnitConverter ) )
(openoffice) 06/06: test/odf-validate: add fixtures for the ODF 1.2 mode fill, grid-snap and row-split fixes
Posted by ji...@apache.org.
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 22f5c9e469ffa3f8f450077c87eeb24dc27733d3
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 08:51:38 2026 -0400
test/odf-validate: add fixtures for the ODF 1.2 mode fill, grid-snap and row-split fixes
---
test/odf-validate/fixtures/fill-others/calc.json | 14 +++
test/odf-validate/fixtures/fill-others/draw.json | 10 +++
.../odf-validate/fixtures/fill-others/impress.json | 10 +++
test/odf-validate/fixtures/fill-others/make.py | 98 +++++++++++++++++++++
.../fixtures/fill-others/others-calc.ods | Bin 0 -> 9160 bytes
.../fixtures/fill-others/others-draw.odg | Bin 0 -> 9758 bytes
.../fixtures/fill-others/others-impress.odp | Bin 0 -> 14795 bytes
.../fixtures/fill-others/others-writer.odt | Bin 0 -> 9604 bytes
test/odf-validate/fixtures/fill-others/writer.json | 18 ++++
test/odf-validate/fixtures/grid-snap/checks.json | 6 ++
test/odf-validate/fixtures/grid-snap/grid-snap.odt | Bin 0 -> 8918 bytes
test/odf-validate/fixtures/grid-snap/make.py | 35 ++++++++
test/odf-validate/fixtures/page-fill/bitmap.json | 6 ++
test/odf-validate/fixtures/page-fill/checks.json | 14 +++
test/odf-validate/fixtures/page-fill/make.py | 60 +++++++++++++
test/odf-validate/fixtures/page-fill/page-fill.odt | Bin 0 -> 9916 bytes
test/odf-validate/fixtures/para-fill/bitmap.json | 10 +++
test/odf-validate/fixtures/para-fill/checks.json | 14 +++
test/odf-validate/fixtures/para-fill/make.py | 65 ++++++++++++++
test/odf-validate/fixtures/para-fill/para-fill.odt | Bin 0 -> 12883 bytes
test/odf-validate/fixtures/row-split/checks.json | 11 +++
test/odf-validate/fixtures/row-split/make.py | 17 ++++
test/odf-validate/fixtures/row-split/row-split.odt | Bin 0 -> 8704 bytes
23 files changed, 388 insertions(+)
diff --git a/test/odf-validate/fixtures/fill-others/calc.json b/test/odf-validate/fixtures/fill-others/calc.json
new file mode 100644
index 0000000000..add9a3ccd9
--- /dev/null
+++ b/test/odf-validate/fixtures/fill-others/calc.json
@@ -0,0 +1,14 @@
+[
+ {
+ "name": "cell",
+ "expr": "[(c.String, c.CellBackColor, c.IsCellBackgroundTransparent) for c in [doc.Sheets.getByIndex(0).getCellByPosition(0,0), doc.Sheets.getByIndex(0).getCellByPosition(2,2)]]"
+ },
+ {
+ "name": "page_style",
+ "expr": "[(s.BackColor, s.IsBackgroundTransparent) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('Default')]]"
+ },
+ {
+ "name": "shapes",
+ "expr": "[(s.String, s.FillStyle.value, s.FillColor, s.FillGradient.StartColor, s.FillGradient.EndColor, s.FillTransparence) for i in range(doc.Sheets.getByIndex(0).DrawPage.Count) for s in [doc.Sheets.getByIndex(0).DrawPage.getByIndex(i)]]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/fill-others/draw.json b/test/odf-validate/fixtures/fill-others/draw.json
new file mode 100644
index 0000000000..e27850cfe8
--- /dev/null
+++ b/test/odf-validate/fixtures/fill-others/draw.json
@@ -0,0 +1,10 @@
+[
+ {
+ "name": "shapes",
+ "expr": "[(s.String, s.FillStyle.value, s.FillColor, s.FillGradient.StartColor, s.FillGradient.EndColor, s.FillTransparence) for i in range(doc.DrawPages.getByIndex(0).Count) for s in [doc.DrawPages.getByIndex(0).getByIndex(i)]]"
+ },
+ {
+ "name": "background",
+ "expr": "[(b.FillStyle.value, b.FillColor, b.FillGradient.StartColor, b.FillGradient.EndColor) for b in [doc.DrawPages.getByIndex(0).Background]] if doc.DrawPages.getByIndex(0).Background is not None else None"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/fill-others/impress.json b/test/odf-validate/fixtures/fill-others/impress.json
new file mode 100644
index 0000000000..e27850cfe8
--- /dev/null
+++ b/test/odf-validate/fixtures/fill-others/impress.json
@@ -0,0 +1,10 @@
+[
+ {
+ "name": "shapes",
+ "expr": "[(s.String, s.FillStyle.value, s.FillColor, s.FillGradient.StartColor, s.FillGradient.EndColor, s.FillTransparence) for i in range(doc.DrawPages.getByIndex(0).Count) for s in [doc.DrawPages.getByIndex(0).getByIndex(i)]]"
+ },
+ {
+ "name": "background",
+ "expr": "[(b.FillStyle.value, b.FillColor, b.FillGradient.StartColor, b.FillGradient.EndColor) for b in [doc.DrawPages.getByIndex(0).Background]] if doc.DrawPages.getByIndex(0).Background is not None else None"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/fill-others/make.py b/test/odf-validate/fixtures/fill-others/make.py
new file mode 100644
index 0000000000..cd8a6075ac
--- /dev/null
+++ b/test/odf-validate/fixtures/fill-others/make.py
@@ -0,0 +1,98 @@
+# usage: runpy.sh fixtures/fill-others/make.py <port> <outdir> (office saving ODF 1.2 Extended)
+# Other consumers of fills: Writer frame/table/section, Calc cell/page/shape, Draw shape/page, Impress shape/slide.
+import sys, os, uno
+from unohelp import connect, desktop, pv
+from com.sun.star.awt import Gradient, Rectangle
+from com.sun.star.awt.GradientStyle import LINEAR
+from com.sun.star.drawing.FillStyle import SOLID, GRADIENT
+from com.sun.star.awt import Size, Point
+
+port, outdir = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+
+def grad():
+ g = Gradient(); g.Style = LINEAR; g.StartColor = 0xFF0000; g.EndColor = 0x0000FF
+ g.Angle = 0; g.Border = 0; g.XOffset = 50; g.YOffset = 50
+ g.StartIntensity = 100; g.EndIntensity = 100; g.StepCount = 0
+ return g
+
+def new(kind):
+ return d.loadComponentFromURL("private:factory/" + kind, "_blank", 0, (pv("Hidden", True),))
+
+def save(doc, name, flt):
+ doc.storeToURL(uno.systemPathToFileUrl(os.path.join(outdir, name)), (pv("FilterName", flt),))
+ doc.close(True)
+
+def shape(doc, page, x, y, kind, text, fillkind):
+ s = doc.createInstance(kind)
+ page.add(s)
+ s.Position = Point(x, y); s.Size = Size(4000, 2000)
+ s.String = text
+ if fillkind == "solid":
+ s.FillStyle = SOLID; s.FillColor = 0x33AA55
+ else:
+ s.FillStyle = GRADIENT; s.FillGradient = grad()
+ return s
+
+# Writer: frame, table cell, section, with solid and gradient fills
+doc = new("swriter")
+text = doc.Text
+cur = text.createTextCursor()
+for i, fk in enumerate(("solid", "gradient")):
+ fr = doc.createInstance("com.sun.star.text.TextFrame")
+ fr.Width = 4000; fr.Height = 1500
+ text.insertTextContent(cur, fr, False)
+ fr.Text.String = "frame " + fk
+ if fk == "solid":
+ fr.FillStyle = SOLID; fr.FillColor = 0x33AA55
+ else:
+ fr.FillStyle = GRADIENT; fr.FillGradient = grad()
+tbl = doc.createInstance("com.sun.star.text.TextTable")
+tbl.initialize(2, 2)
+text.insertTextContent(text.End, tbl, False)
+tbl.getCellByName("A1").BackColor = 0xFFCC00
+tbl.getCellByName("B1").BackColor = 0xFFAACC
+tbl.BackColor = 0xCCFFCC
+sec = doc.createInstance("com.sun.star.text.TextSection")
+text.insertTextContent(text.End, sec, False)
+sec.BackColor = 0xCCCCFF
+save(doc, "others-writer.odt", "writer8")
+
+# Calc: cell back colour, page style back colour, shape with gradient and with text
+doc = new("scalc")
+sh = doc.Sheets.getByIndex(0)
+sh.getCellByPosition(0, 0).String = "cell"
+sh.getCellByPosition(0, 0).CellBackColor = 0xFFCC00
+sh.getCellByPosition(1, 0).String = "grad"
+pst = doc.StyleFamilies.getByName("PageStyles").getByName("Default")
+pst.BackColor = 0xDDEEFF
+dp = sh.DrawPage
+shape(doc, dp, 1000, 3000, "com.sun.star.drawing.RectangleShape", "calc shape", "gradient")
+save(doc, "others-calc.ods", "calc8")
+
+# Draw: shapes (solid and gradient), page background
+doc = new("sdraw")
+page = doc.DrawPages.getByIndex(0)
+shape(doc, page, 1000, 1000, "com.sun.star.drawing.RectangleShape", "draw solid", "solid")
+shape(doc, page, 6000, 1000, "com.sun.star.drawing.EllipseShape", "draw grad", "gradient")
+try:
+ page.Background = None
+ bg = doc.createInstance("com.sun.star.drawing.Background")
+ bg.FillStyle = GRADIENT; bg.FillGradient = grad()
+ page.Background = bg
+except Exception as e:
+ print("draw background:", repr(e))
+save(doc, "others-draw.odg", "draw8")
+
+# Impress: shapes with text, slide background
+doc = new("simpress")
+page = doc.DrawPages.getByIndex(0)
+shape(doc, page, 1000, 1000, "com.sun.star.drawing.RectangleShape", "impress solid", "solid")
+shape(doc, page, 6000, 1000, "com.sun.star.drawing.RectangleShape", "impress grad", "gradient")
+try:
+ bg = doc.createInstance("com.sun.star.drawing.Background")
+ bg.FillStyle = SOLID; bg.FillColor = 0xCCEEFF
+ page.Background = bg
+except Exception as e:
+ print("impress background:", repr(e))
+save(doc, "others-impress.odp", "impress8")
diff --git a/test/odf-validate/fixtures/fill-others/others-calc.ods b/test/odf-validate/fixtures/fill-others/others-calc.ods
new file mode 100644
index 0000000000..b445eb388d
Binary files /dev/null and b/test/odf-validate/fixtures/fill-others/others-calc.ods differ
diff --git a/test/odf-validate/fixtures/fill-others/others-draw.odg b/test/odf-validate/fixtures/fill-others/others-draw.odg
new file mode 100644
index 0000000000..9d4705b967
Binary files /dev/null and b/test/odf-validate/fixtures/fill-others/others-draw.odg differ
diff --git a/test/odf-validate/fixtures/fill-others/others-impress.odp b/test/odf-validate/fixtures/fill-others/others-impress.odp
new file mode 100644
index 0000000000..468b1e09a7
Binary files /dev/null and b/test/odf-validate/fixtures/fill-others/others-impress.odp differ
diff --git a/test/odf-validate/fixtures/fill-others/others-writer.odt b/test/odf-validate/fixtures/fill-others/others-writer.odt
new file mode 100644
index 0000000000..d25e0ad310
Binary files /dev/null and b/test/odf-validate/fixtures/fill-others/others-writer.odt differ
diff --git a/test/odf-validate/fixtures/fill-others/writer.json b/test/odf-validate/fixtures/fill-others/writer.json
new file mode 100644
index 0000000000..b769f610e2
--- /dev/null
+++ b/test/odf-validate/fixtures/fill-others/writer.json
@@ -0,0 +1,18 @@
+[
+ {
+ "name": "frames",
+ "expr": "[(f.Text.String, f.FillStyle.value, f.FillColor, f.FillGradient.StartColor, f.FillGradient.EndColor, f.BackColor, f.BackTransparent) for n in doc.TextFrames.ElementNames for f in [doc.TextFrames.getByName(n)]]"
+ },
+ {
+ "name": "table",
+ "expr": "[(c, t.getCellByName(c).BackColor, t.getCellByName(c).BackTransparent) for t in [doc.TextTables.getByIndex(0)] for c in ('A1','B1','A2')] + [doc.TextTables.getByIndex(0).BackColor]"
+ },
+ {
+ "name": "section",
+ "expr": "[(s.BackColor, s.BackTransparent) for s in [doc.TextSections.getByIndex(0)]]"
+ },
+ {
+ "name": "paras",
+ "expr": "[(p.String, p.ParaBackColor, p.ParaBackTransparent) for e in [doc.Text.createEnumeration()] for p in iter(lambda: e.nextElement() if e.hasMoreElements() else None, None) if p.supportsService('com.sun.star.text.Paragraph')]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/grid-snap/checks.json b/test/odf-validate/fixtures/grid-snap/checks.json
new file mode 100644
index 0000000000..a69da6680b
--- /dev/null
+++ b/test/odf-validate/fixtures/grid-snap/checks.json
@@ -0,0 +1,6 @@
+[
+ {
+ "name": "page_grid",
+ "expr": "[(n, ps.GridMode, ps.StandardPageMode, ps.GridBaseWidth, ps.GridSnapToChars) for n in ('G_snap_on','G_snap_off','G_lines_off') for ps in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]"
+ }
+]
diff --git a/test/odf-validate/fixtures/grid-snap/grid-snap.odt b/test/odf-validate/fixtures/grid-snap/grid-snap.odt
new file mode 100644
index 0000000000..358c1d1924
Binary files /dev/null and b/test/odf-validate/fixtures/grid-snap/grid-snap.odt differ
diff --git a/test/odf-validate/fixtures/grid-snap/make.py b/test/odf-validate/fixtures/grid-snap/make.py
new file mode 100644
index 0000000000..73f6d339de
--- /dev/null
+++ b/test/odf-validate/fixtures/grid-snap/make.py
@@ -0,0 +1,35 @@
+# usage: runpy.sh fixtures/grid-snap/make.py <port> <out.odt> (office saving ODF 1.2 Extended)
+import sys, uno
+from unohelp import connect, desktop, pv
+
+port, out = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, (pv("Hidden", True),))
+ps = doc.StyleFamilies.getByName("PageStyles")
+specs = [("G_snap_on", True, 2), ("G_snap_off", False, 2), ("G_lines_off", False, 1)]
+for name, snap, mode in specs:
+ s = doc.createInstance("com.sun.star.style.PageStyle")
+ ps.insertByName(name, s)
+ s.GridMode = mode; s.StandardPageMode = True; s.GridSnapToChars = snap
+text = doc.Text
+cur = text.createTextCursor()
+PB = uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK")
+for name, *_ in specs:
+ text.insertString(cur, "grid " + name, False)
+ text.insertControlCharacter(cur, PB, False)
+en = text.createEnumeration()
+for name, *_ in specs:
+ en.nextElement().PageDescName = name
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
+
+# base-width suppresses standard-mode on export and the importer does not infer it, so add it by hand
+import zipfile, shutil
+tmp = out + ".tmp"
+with zipfile.ZipFile(out) as zi, zipfile.ZipFile(tmp, "w") as zo:
+ for it in zi.infolist():
+ data = zi.read(it.filename)
+ if it.filename == "styles.xml":
+ data = data.replace(b"style:layout-grid-base-width=", b'style:layout-grid-standard-mode="true" style:layout-grid-base-width=')
+ zo.writestr(it, data, compress_type=it.compress_type)
+shutil.move(tmp, out)
diff --git a/test/odf-validate/fixtures/page-fill/bitmap.json b/test/odf-validate/fixtures/page-fill/bitmap.json
new file mode 100644
index 0000000000..a7ef3362d8
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill/bitmap.json
@@ -0,0 +1,6 @@
+[
+ {
+ "name": "page_bitmap",
+ "expr": "[(pre or 'page', ('GraphicObject:0000' not in u and 'GraphicObject:' in u), g.getPropertyValue(pre+'FillStyle').value) for g in [doc.StyleFamilies.getByName('PageStyles').getByName('P_bitmap')] for pre in ('', 'Header', 'Footer') for u in [g.getPropertyValue(pre+'BackGraphicURL')]]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/page-fill/checks.json b/test/odf-validate/fixtures/page-fill/checks.json
new file mode 100644
index 0000000000..f82b9e3c41
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill/checks.json
@@ -0,0 +1,14 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.BackColor, s.BackTransparent, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('P_solid','P_transp','P_grad','P_bitmap') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]"
+ },
+ {
+ "name": "hf_fill",
+ "expr": "[(n, s.HeaderBackColor, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillTransparence, s.FooterBackColor, s.FooterFillStyle.value, s.FooterFillColor, s.FooterFillTransparence) for n in ('P_solid','P_transp','P_grad','P_bitmap') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]"
+ },
+ {
+ "name": "page_desc_names",
+ "expr": "[(p.String, p.PageDescName) for e in [doc.Text.createEnumeration()] for p in iter(lambda: e.nextElement() if e.hasMoreElements() else None, None)]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/page-fill/make.py b/test/odf-validate/fixtures/page-fill/make.py
new file mode 100644
index 0000000000..97f7607562
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill/make.py
@@ -0,0 +1,60 @@
+# usage: runpy.sh fixtures/page-fill/make.py <port> <out.odt> <png> (office saving ODF 1.2 Extended)
+import sys, uno
+from unohelp import connect, desktop, pv
+from com.sun.star.awt import Gradient
+from com.sun.star.awt.GradientStyle import LINEAR
+from com.sun.star.drawing import Hatch
+from com.sun.star.drawing.HatchStyle import SINGLE
+from com.sun.star.drawing.FillStyle import SOLID, GRADIENT, HATCH, BITMAP
+
+port, out, png = int(sys.argv[1]), sys.argv[2], uno.systemPathToFileUrl(sys.argv[3])
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, (pv("Hidden", True),))
+
+def grad():
+ g = Gradient(); g.Style = LINEAR; g.StartColor = 0xFF0000; g.EndColor = 0x0000FF
+ g.Angle = 0; g.Border = 0; g.XOffset = 50; g.YOffset = 50
+ g.StartIntensity = 100; g.EndIntensity = 100; g.StepCount = 0
+ return g
+
+def hatch():
+ h = Hatch(); h.Style = SINGLE; h.Color = 0x00AA00; h.Distance = 200; h.Angle = 450
+ return h
+
+def fill(o, pre, kind, color=0xFFCC00):
+ if kind == "solid":
+ setattr(o, pre + "FillStyle", SOLID); setattr(o, pre + "FillColor", color)
+ elif kind == "solid_transp":
+ setattr(o, pre + "FillStyle", SOLID); setattr(o, pre + "FillColor", color); setattr(o, pre + "FillTransparence", 40)
+ elif kind == "gradient":
+ setattr(o, pre + "FillStyle", GRADIENT); setattr(o, pre + "FillGradient", grad())
+ elif kind == "hatch":
+ setattr(o, pre + "FillStyle", HATCH); setattr(o, pre + "FillHatch", hatch())
+ setattr(o, pre + "FillColor", 0xFFFFCC); setattr(o, pre + "FillBackground", True)
+ elif kind == "bitmap":
+ setattr(o, pre + "FillStyle", BITMAP); setattr(o, pre + "FillBitmapURL", png)
+
+ps = doc.StyleFamilies.getByName("PageStyles")
+specs = [("P_solid", "solid", "solid", "solid"), ("P_transp", "solid_transp", "solid_transp", "solid_transp"),
+ ("P_grad", "gradient", "gradient", "hatch"), ("P_bitmap", "bitmap", "bitmap", "bitmap")]
+for name, pg, hd, ft in specs:
+ s = doc.createInstance("com.sun.star.style.PageStyle")
+ ps.insertByName(name, s)
+ s.HeaderIsOn = True; s.FooterIsOn = True
+ fill(s, "", pg, 0x66CCFF); fill(s, "Header", hd, 0xCCFF66); fill(s, "Footer", ft, 0xFF66CC)
+
+text = doc.Text
+cur = text.createTextCursor()
+PB = uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK")
+paras = []
+for name, *_ in specs:
+ text.insertString(cur, "page " + name, False)
+ text.insertControlCharacter(cur, PB, False)
+ paras.append(name)
+en = text.createEnumeration()
+for name in paras:
+ p = en.nextElement()
+ p.PageDescName = name
+
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/page-fill/page-fill.odt b/test/odf-validate/fixtures/page-fill/page-fill.odt
new file mode 100644
index 0000000000..ea02a346e1
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill/page-fill.odt differ
diff --git a/test/odf-validate/fixtures/para-fill/bitmap.json b/test/odf-validate/fixtures/para-fill/bitmap.json
new file mode 100644
index 0000000000..d3aec5af16
--- /dev/null
+++ b/test/odf-validate/fixtures/para-fill/bitmap.json
@@ -0,0 +1,10 @@
+[
+ {
+ "name": "para_bitmap",
+ "expr": "[(p.String, ('GraphicObject:0000' not in u and 'GraphicObject:' in u), p.FillStyle.value) for e in [doc.Text.createEnumeration()] for p in iter(lambda: e.nextElement() if e.hasMoreElements() else None, None) if p.String.endswith('bitmap') for u in [p.ParaBackGraphicURL]]"
+ },
+ {
+ "name": "parastyle_bitmap",
+ "expr": "[(('GraphicObject:0000' not in u and 'GraphicObject:' in u), s.FillStyle.value) for s in [doc.StyleFamilies.getByName('ParagraphStyles').getByName('S_bitmap')] for u in [s.ParaBackGraphicURL]]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/para-fill/checks.json b/test/odf-validate/fixtures/para-fill/checks.json
new file mode 100644
index 0000000000..ab620fc15c
--- /dev/null
+++ b/test/odf-validate/fixtures/para-fill/checks.json
@@ -0,0 +1,14 @@
+[
+ {
+ "name": "paragraphs",
+ "expr": "[(p.String, p.ParaBackColor, p.ParaBackTransparent, p.FillStyle.value, p.FillColor, p.FillTransparence) for e in [doc.Text.createEnumeration()] for p in iter(lambda: e.nextElement() if e.hasMoreElements() else None, None)]"
+ },
+ {
+ "name": "para_styles",
+ "expr": "[(n, p.ParaBackColor, p.ParaBackTransparent, p.FillStyle.value, p.FillColor, p.FillTransparence) for n in doc.StyleFamilies.getByName('ParagraphStyles').ElementNames if n.startswith('S_') for p in [doc.StyleFamilies.getByName('ParagraphStyles').getByName(n)]]"
+ },
+ {
+ "name": "styled_para_style_names",
+ "expr": "[(p.String, p.ParaStyleName) for e in [doc.Text.createEnumeration()] for p in iter(lambda: e.nextElement() if e.hasMoreElements() else None, None)]"
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/para-fill/make.py b/test/odf-validate/fixtures/para-fill/make.py
new file mode 100644
index 0000000000..1215a1e9fa
--- /dev/null
+++ b/test/odf-validate/fixtures/para-fill/make.py
@@ -0,0 +1,65 @@
+# usage: runpy.sh fixtures/para-fill/make.py <port> <out.odt> (run against an office saving ODF 1.2 Extended)
+import sys, uno
+from unohelp import connect, desktop, pv
+from com.sun.star.awt import Gradient
+from com.sun.star.awt.GradientStyle import LINEAR
+from com.sun.star.drawing import Hatch
+from com.sun.star.drawing.HatchStyle import SINGLE
+from com.sun.star.drawing.FillStyle import SOLID, GRADIENT, HATCH, BITMAP
+
+port, out = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, (pv("Hidden", True),))
+text = doc.Text
+png = uno.systemPathToFileUrl(sys.argv[3]) if len(sys.argv) > 3 else None
+
+def grad():
+ g = Gradient(); g.Style = LINEAR; g.StartColor = 0xFF0000; g.EndColor = 0x0000FF
+ g.Angle = 0; g.Border = 0; g.XOffset = 50; g.YOffset = 50
+ g.StartIntensity = 100; g.EndIntensity = 100; g.StepCount = 0
+ return g
+
+def hatch():
+ h = Hatch(); h.Style = SINGLE; h.Color = 0x00AA00; h.Distance = 200; h.Angle = 450
+ return h
+
+def fill(o, kind):
+ if kind == "solid":
+ o.ParaBackColor = 0xFFCC00; o.ParaBackTransparent = False
+ elif kind == "solid_fill":
+ o.FillStyle = SOLID; o.FillColor = 0x33AA55
+ elif kind == "solid_transp":
+ o.FillStyle = SOLID; o.FillColor = 0x3355AA; o.FillTransparence = 40
+ elif kind == "gradient":
+ o.FillStyle = GRADIENT; o.FillGradient = grad()
+ elif kind == "hatch":
+ o.FillStyle = HATCH; o.FillHatch = hatch(); o.FillColor = 0xFFFFCC; o.FillBackground = True
+ elif kind == "bitmap":
+ o.FillStyle = BITMAP; o.FillBitmapURL = png
+
+kinds = ["solid", "solid_fill", "solid_transp", "gradient", "hatch"] + (["bitmap"] if png else [])
+styles = doc.StyleFamilies.getByName("ParagraphStyles")
+for k in kinds:
+ s = doc.createInstance("com.sun.star.style.ParagraphStyle")
+ s.ParentStyle = "Standard"
+ styles.insertByName("S_" + k, s)
+ fill(s, k)
+
+PB = uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK")
+cur = text.createTextCursor()
+labels = []
+for k in kinds:
+ for kind in ("direct", "styled"):
+ text.insertString(cur, kind + " " + k, False)
+ text.insertControlCharacter(cur, PB, False)
+ labels.append((kind, k))
+paras = doc.Text.createEnumeration()
+for kind, k in labels:
+ p = paras.nextElement()
+ if kind == "direct":
+ fill(p, k)
+ else:
+ p.ParaStyleName = "S_" + k
+
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/para-fill/para-fill.odt b/test/odf-validate/fixtures/para-fill/para-fill.odt
new file mode 100644
index 0000000000..26e501dc57
Binary files /dev/null and b/test/odf-validate/fixtures/para-fill/para-fill.odt differ
diff --git a/test/odf-validate/fixtures/row-split/checks.json b/test/odf-validate/fixtures/row-split/checks.json
new file mode 100644
index 0000000000..d907ae03f3
--- /dev/null
+++ b/test/odf-validate/fixtures/row-split/checks.json
@@ -0,0 +1,11 @@
+[
+ {
+ "name": "row_split",
+ "expr": "[doc.TextTables.getByIndex(0).Rows.getByIndex(i).IsSplitAllowed for i in range(doc.TextTables.getByIndex(0).Rows.Count)]",
+ "expect": [
+ true,
+ false,
+ true
+ ]
+ }
+]
\ No newline at end of file
diff --git a/test/odf-validate/fixtures/row-split/make.py b/test/odf-validate/fixtures/row-split/make.py
new file mode 100644
index 0000000000..87d1558b44
--- /dev/null
+++ b/test/odf-validate/fixtures/row-split/make.py
@@ -0,0 +1,17 @@
+# usage: runpy.sh fixtures/row-split/make.py <port> <out.odt> (office saving ODF 1.2 Extended)
+import sys, uno
+from unohelp import connect, desktop, pv
+
+port, out = int(sys.argv[1]), sys.argv[2]
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, (pv("Hidden", True),))
+tbl = doc.createInstance("com.sun.star.text.TextTable")
+tbl.initialize(3, 2)
+doc.Text.insertTextContent(doc.Text.End, tbl, False)
+rows = tbl.Rows
+rows.getByIndex(0).IsSplitAllowed = True
+rows.getByIndex(1).IsSplitAllowed = False
+rows.getByIndex(2).IsSplitAllowed = True
+rows.getByIndex(2).Height = 1000
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/row-split/row-split.odt b/test/odf-validate/fixtures/row-split/row-split.odt
new file mode 100644
index 0000000000..ea214ccf97
Binary files /dev/null and b/test/odf-validate/fixtures/row-split/row-split.odt differ
(openoffice) 02/06: xmloff: don't write draw:fill* on page layouts, headers and footers in ODF 1.2 mode
Posted by ji...@apache.org.
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 e86e06dbff88be35809da04293e8a9f647be4748
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 08:51:36 2026 -0400
xmloff: don't write draw:fill* on page layouts, headers and footers in ODF 1.2 mode
1.0 and 1.1 saves drop them as well.
---
main/xmloff/source/style/PageMasterStyleMap.cxx | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/main/xmloff/source/style/PageMasterStyleMap.cxx b/main/xmloff/source/style/PageMasterStyleMap.cxx
index 2aa7440ad4..6760878e0f 100644
--- a/main/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/main/xmloff/source/style/PageMasterStyleMap.cxx
@@ -37,6 +37,10 @@ using namespace ::xmloff::token;
//UUUU
#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context)
+// AOO extension, not ODF 1.2: strict export keeps only fo:background-color and style:background-image
+#define _MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_LATEST }
+#define PLMAP_EXT(name,prefix,token,type,context) _MAP_EXT(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
+#define HFMAP_EXT(name,prefix,token,type,context) _MAP_EXT(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)
//______________________________________________________________________________
@@ -125,6 +129,8 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
// Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of
// CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the
// 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER
+#undef PLMAP
+#define PLMAP PLMAP_EXT
PLMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ),
PLMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
PLMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
@@ -145,6 +151,8 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
PLMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_X ),
PLMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_Y ),
+#undef PLMAP
+#define PLMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context)
// Index 85: footnote
PLMAP( "FootnoteHeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FTN_HEIGTH ),
@@ -190,6 +198,8 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
//UUUUIndex 121: Header DrawingLayer FillAttributes
// Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
// Names have to begin with 'Header', all 5th entries need to be ORed with the CTF_PM_HEADERFLAG
+#undef HFMAP
+#define HFMAP HFMAP_EXT
HFMAP( "HeaderFillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, CTF_PM_HEADERFLAG ),
HFMAP( "HeaderFillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_HEADERFLAG ),
HFMAP( "HeaderFillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_HEADERFLAG ),
@@ -210,6 +220,8 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
HFMAP( "HeaderFillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, CTF_PM_HEADERFLAG ),
HFMAP( "HeaderFillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERREPEAT_OFFSET_X ),
HFMAP( "HeaderFillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERREPEAT_OFFSET_Y ),
+#undef HFMAP
+#define HFMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_HEADER_FOOTER,context)
//////////////////////////////////////////////////////////////////////////
//UUUUIndex 141: Section for 'footer-style' own section, all members *have* to use CTF_PM_FOOTERFLAG in the context entry (the 5th one)
@@ -246,6 +258,8 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
//UUUUIndex 170: Footer DrawingLayer FillAttributes
// Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry
// Names have to begin with 'Footer', all 5th entries need to be ORed with the CTF_PM_FOOTERFLAG
+#undef HFMAP
+#define HFMAP HFMAP_EXT
HFMAP( "FooterFillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, CTF_PM_FOOTERFLAG ),
HFMAP( "FooterFillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_FOOTERFLAG ),
HFMAP( "FooterFillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_FOOTERFLAG ),
(openoffice) 01/06: xmloff: don't write draw:fill* in paragraph styles in ODF 1.2 mode
Posted by ji...@apache.org.
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 ef0a8aeea9ce5fa8ec7002c4ce0affe00859693d
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 08:51:36 2026 -0400
xmloff: don't write draw:fill* in paragraph styles in ODF 1.2 mode
---
main/xmloff/source/text/txtprmap.cxx | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/main/xmloff/source/text/txtprmap.cxx b/main/xmloff/source/text/txtprmap.cxx
index 2b427b6394..729c83071f 100644
--- a/main/xmloff/source/text/txtprmap.cxx
+++ b/main/xmloff/source/text/txtprmap.cxx
@@ -82,6 +82,7 @@ using namespace ::xmloff::token;
//UUUU
#define _MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context)
+#define GMAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC), context, SvtSaveOptions::ODFVER_LATEST }
XMLPropertyMapEntry aXMLParaPropMap[] =
{
@@ -91,6 +92,9 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
//UUUU fill attributes for paragraph backgrounds
// #125045# moved to the front to be able to exclude these in lcl_txtprmap_getMap
// for TEXT_PROP_MAP_SHAPE_PARA to not have these double for Shapes (which already have these)
+// not ODF 1.2: strict export keeps only fo:background-color and style:background-image
+#undef GMAP
+#define GMAP GMAP_EXT
GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ),
GMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
GMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
@@ -111,6 +115,8 @@ XMLPropertyMapEntry aXMLParaPropMap[] =
GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ),
GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ),
+#undef GMAP
+#define GMAP(name,prefix,token,type,context) _MAP(name,prefix,token,static_cast<sal_Int32>(type|XML_TYPE_PROP_GRAPHIC),context)
// RES_LR_SPACE
// !!! DO NOT REORDER THE MARGINS !!!
(openoffice) 03/06: xmloff: write style:background-image for header and footer graphics
Posted by ji...@apache.org.
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 83b30299d0c5bcf2e9139b7425af17bbcac79b2c
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 08:51:37 2026 -0400
xmloff: write style:background-image for header and footer graphics
The header/footer graphic ids collided with the repeat-offset ids, so the URL was dropped. 1.0, 1.1 and 1.2 saves now write the element; ODF 1.2 Extended output is unchanged.
---
main/xmloff/inc/xmloff/PageMasterStyleMap.hxx | 8 ++++----
main/xmloff/source/style/PageMasterExportPropMapper.cxx | 13 +++++++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 8b94aa0df3..26808181fb 100644
--- a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -128,8 +128,8 @@
#define CTF_PM_HEADERMINHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0032))
#define CTF_PM_HEADERDYNAMIC (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0033))
#define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034))
-#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035))
-#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036))
+#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0041))
+#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0042))
#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL)
#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP)
#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM)
@@ -164,8 +164,8 @@
#define CTF_PM_FOOTERMINHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0032))
#define CTF_PM_FOOTERDYNAMIC (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0033))
#define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034))
-#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035))
-#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036))
+#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0041))
+#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0042))
#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL)
#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP)
#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM)
diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
index 571b8bbd07..476014f427 100644
--- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -337,6 +337,8 @@ void XMLPageMasterExportPropMapper::ContextFilter(
XMLPropertyState* pPMStandardMode = NULL;
XMLPropertyState* pPMGridBaseWidth = NULL;
XMLPropertyState* pPMGridSnapToChars = NULL;
+ XMLPropertyState* pPMHeaderGraphicUrl = NULL;
+ XMLPropertyState* pPMFooterGraphicUrl = NULL;
XMLPropertyState* pPrint = NULL;
@@ -405,6 +407,8 @@ 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 CTF_PM_HEADERGRAPHICURL: pPMHeaderGraphicUrl = pProp; break;
+ case CTF_PM_FOOTERGRAPHICURL: pPMFooterGraphicUrl = pProp; break;
//UUUU
case CTF_PM_REPEAT_OFFSET_X:
@@ -527,6 +531,15 @@ void XMLPageMasterExportPropMapper::ContextFilter(
lcl_RemoveState(pPMGridSnapToChars);
}
+ // ext output stays as before (the ids once collided with the repeat offsets, so none was written)
+ if( SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012 )
+ {
+ if( pPMHeaderGraphicUrl )
+ lcl_RemoveState(pPMHeaderGraphicUrl);
+ if( pPMFooterGraphicUrl )
+ lcl_RemoveState(pPMFooterGraphicUrl);
+ }
+
if( pPMGridBaseWidth && pPMStandardMode )
lcl_RemoveState(pPMStandardMode);