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 20:12:19 UTC
(openoffice) branch odf-devel updated (d222476c5a -> 7173d466a5)
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 d222476c5a test/odf-validate: add fixtures for the extension paragraph fill import
new 678493df1e xmloff: import the drawing page style fill of master pages
new facd4f78b5 xmloff: write the page fill as a drawing page style in default mode
new db08245481 xmloff: don't write draw:fill* on page layouts in default mode
new 7173d466a5 test/odf-validate: add fixtures for the page fill drawing page style
The 4 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/xmloff/inc/PageMasterImportContext.hxx | 29 +++
main/xmloff/inc/xmloff/PageMasterStyleMap.hxx | 2 +
.../xmloff/inc/xmloff/XMLTextMasterPageContext.hxx | 1 +
.../source/style/PageMasterExportPropMapper.cxx | 12 +
.../source/style/PageMasterImportContext.cxx | 172 +++++++++++++
.../source/style/PageMasterPropHdlFactory.cxx | 3 +
main/xmloff/source/style/PageMasterStyleMap.cxx | 29 +++
main/xmloff/source/style/XMLPageExport.cxx | 62 +++++
main/xmloff/source/style/xmlstyle.cxx | 12 +
.../source/text/XMLTextMasterPageContext.cxx | 26 +-
.../fixtures/page-fill-1_3/aoo-src.odt | Bin 0 -> 13741 bytes
.../fixtures/page-fill-1_3/calc-drawing-page.ods | Bin 0 -> 7479 bytes
.../fixtures/page-fill-1_3/calc-src.ods | Bin 0 -> 8471 bytes
.../fixtures/page-fill-1_3/checks-calc.json | 19 ++
.../fixtures/page-fill-1_3/checks-edge-both.json | 241 +++++++++++++++++++
.../fixtures/page-fill-1_3/checks-edge-empty.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-shared-layout.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-undefined.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-unknown-name.json | 225 +++++++++++++++++
.../page-fill-1_3/checks-foreign-strict.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/checks-foreign.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/checks.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/edge-both.odt | Bin 0 -> 25579 bytes
.../fixtures/page-fill-1_3/edge-common.odt | Bin 0 -> 25028 bytes
.../fixtures/page-fill-1_3/edge-empty.odt | Bin 0 -> 25010 bytes
.../fixtures/page-fill-1_3/edge-none.odt | Bin 0 -> 25026 bytes
.../fixtures/page-fill-1_3/edge-shared-layout.odt | Bin 0 -> 25018 bytes
.../fixtures/page-fill-1_3/edge-undefined.odt | Bin 0 -> 25028 bytes
.../fixtures/page-fill-1_3/edge-unknown-name.odt | Bin 0 -> 25026 bytes
.../fixtures/page-fill-1_3/foreign-v10.odt | Bin 0 -> 25021 bytes
.../fixtures/page-fill-1_3/foreign-v11.odt | Bin 0 -> 25567 bytes
.../fixtures/page-fill-1_3/foreign-v12.odt | Bin 0 -> 25021 bytes
.../fixtures/page-fill-1_3/foreign-v3.odt | Bin 0 -> 25566 bytes
.../fixtures/page-fill-1_3/foreign-v8.odt | Bin 0 -> 25364 bytes
test/odf-validate/fixtures/page-fill-1_3/gen.bas | 108 +++++++++
.../fixtures/page-fill-1_3/make-aoo.py | 76 ++++++
.../fixtures/page-fill-1_3/make-calc.py | 36 +++
.../fixtures/page-fill-1_3/make-foreign.py | 110 +++++++++
.../fixtures/page-fill-1_3/mkexpect.py | 87 +++++++
.../{para-fill-foreign => page-fill-1_3}/tile.png | Bin
40 files changed, 2815 insertions(+), 1 deletion(-)
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/aoo-src.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/calc-drawing-page.ods
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/calc-src.ods
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-calc.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-edge-both.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-edge-empty.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-edge-shared-layout.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-edge-undefined.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-edge-unknown-name.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-foreign-strict.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks-foreign.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/checks.json
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-both.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-common.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-empty.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-none.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-shared-layout.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-undefined.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/edge-unknown-name.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/foreign-v10.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/foreign-v11.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/foreign-v12.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/foreign-v3.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/foreign-v8.odt
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/gen.bas
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/make-aoo.py
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/make-calc.py
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/make-foreign.py
create mode 100644 test/odf-validate/fixtures/page-fill-1_3/mkexpect.py
copy test/odf-validate/fixtures/{para-fill-foreign => page-fill-1_3}/tile.png (100%)
(openoffice) 01/04: xmloff: import the drawing page style fill of master pages
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 678493df1e65ecb63649301df13f08fb045a3422
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 16:12:10 2026 -0400
xmloff: import the drawing page style fill of master pages
---
main/xmloff/inc/PageMasterImportContext.hxx | 29 ++++
main/xmloff/inc/xmloff/PageMasterStyleMap.hxx | 2 +
.../xmloff/inc/xmloff/XMLTextMasterPageContext.hxx | 1 +
.../source/style/PageMasterImportContext.cxx | 172 +++++++++++++++++++++
.../source/style/PageMasterPropHdlFactory.cxx | 3 +
main/xmloff/source/style/PageMasterStyleMap.cxx | 29 ++++
main/xmloff/source/style/xmlstyle.cxx | 12 ++
.../source/text/XMLTextMasterPageContext.cxx | 26 +++-
8 files changed, 273 insertions(+), 1 deletion(-)
diff --git a/main/xmloff/inc/PageMasterImportContext.hxx b/main/xmloff/inc/PageMasterImportContext.hxx
index 599318a105..8572416c4a 100644
--- a/main/xmloff/inc/PageMasterImportContext.hxx
+++ b/main/xmloff/inc/PageMasterImportContext.hxx
@@ -61,8 +61,37 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > & rPropSet );
+ void FillPropertySetWithoutOldPageFill(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+
//text grid enhancement
virtual void SetDefaults();
};
+class DrawingPageStyleContext : public XMLPropStyleContext
+{
+private:
+ bool mbChecked;
+ bool mbUsable;
+
+ void CheckFill();
+
+public:
+
+ TYPEINFO();
+
+ DrawingPageStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles );
+ virtual ~DrawingPageStyleContext();
+
+ bool HasFill() { CheckFill(); return mbUsable; }
+
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+};
+
#endif
diff --git a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
index 5100f8c049..948dabbbcb 100644
--- a/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
+++ b/main/xmloff/inc/xmloff/PageMasterStyleMap.hxx
@@ -47,6 +47,7 @@
#define XML_PM_TYPE_FIRSTPAGENUMBER (XML_PM_TYPES_START + 14)
#define XML_PM_TYPE_CENTER_HORIZONTAL (XML_PM_TYPES_START + 15)
#define XML_PM_TYPE_CENTER_VERTICAL (XML_PM_TYPES_START + 16)
+#define XML_PM_TYPE_BACKGROUNDSIZE (XML_PM_TYPES_START + 17)
// control flags
#define CTF_PM_FLAGMASK (XML_PM_CTF_START + 0x0F00)
@@ -190,6 +191,7 @@
#define CTF_PM_FTN_DISTANCE (XML_PM_CTF_START + 0x0066)
extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[];
+extern const XMLPropertyMapEntry aXMLPageMasterDrawingPageStyleMap[];
extern const XMLPropertyMapEntry aXMLPageMasterHeaderImportStyleMap[];
extern const XMLPropertyMapEntry aXMLPageMasterFooterImportStyleMap[];
diff --git a/main/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx b/main/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx
index 1fad8be3f8..60848f1dfb 100644
--- a/main/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx
+++ b/main/xmloff/inc/xmloff/XMLTextMasterPageContext.hxx
@@ -42,6 +42,7 @@ class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext
const ::rtl::OUString sFollowStyle;
::rtl::OUString sFollow;
::rtl::OUString sPageMasterName;
+ ::rtl::OUString sDrawingPageStyleName;
::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > xStyle;
diff --git a/main/xmloff/source/style/PageMasterImportContext.cxx b/main/xmloff/source/style/PageMasterImportContext.cxx
index af308aed0f..c7a4c717b9 100644
--- a/main/xmloff/source/style/PageMasterImportContext.cxx
+++ b/main/xmloff/source/style/PageMasterImportContext.cxx
@@ -36,6 +36,8 @@
//UUUU
#include <xmlsdtypes.hxx>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
#include <xmloff/xmlerror.hxx>
using namespace ::com::sun::star;
@@ -318,6 +320,39 @@ void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet
}
}
+void PageStyleContext::FillPropertySetWithoutOldPageFill( const uno::Reference< beans::XPropertySet > & rPropSet )
+{
+ static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
+
+ // a fill of the page layout itself already switches its old fill definitions off
+ if( doNewDrawingLayerFillStyleDefinitionsExist( s_FillStyle ) )
+ {
+ FillPropertySet( rPropSet );
+ return;
+ }
+
+ // switched off for this call only: the page layout may be shared with master pages without a drawing page fill
+ ::std::vector< XMLPropertyState >& rProperties = GetProperties();
+ ::std::vector< ::std::pair< size_t, sal_Int32 > > aSwitchedOff;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( xImpPrMap.is() )
+ {
+ const OldFillStyleDefinitionSet& rOld = getStandardSet();
+ for( size_t i = 0; i < rProperties.size(); ++i )
+ {
+ if( rProperties[i].mnIndex != -1 &&
+ rOld.find( xImpPrMap->getPropertySetMapper()->GetEntryAPIName( rProperties[i].mnIndex ) ) != rOld.end() )
+ {
+ aSwitchedOff.push_back( ::std::make_pair( i, rProperties[i].mnIndex ) );
+ rProperties[i].mnIndex = -1;
+ }
+ }
+ }
+ FillPropertySet( rPropSet );
+ for( size_t i = 0; i < aSwitchedOff.size(); ++i )
+ rProperties[aSwitchedOff[i].first].mnIndex = aSwitchedOff[i].second;
+}
+
// text grid enhancement for better CJK support
//set default page layout style
void PageStyleContext::SetDefaults( )
@@ -333,4 +368,141 @@ void PageStyleContext::SetDefaults( )
}
}
+TYPEINIT1( DrawingPageStyleContext, XMLPropStyleContext );
+
+DrawingPageStyleContext::DrawingPageStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles ) :
+ XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID ),
+ mbChecked( false ),
+ mbUsable( false )
+{
+}
+
+DrawingPageStyleContext::~DrawingPageStyleContext()
+{
+}
+
+static bool lcl_FillNameExists( SvXMLImport& rImport, const Reference< container::XNameContainer >& rTable,
+ sal_uInt16 nFamily, const rtl::OUString& rName )
+{
+ return rName.getLength() && rTable.is() && rTable->hasByName( rImport.GetStyleDisplayName( nFamily, rName ) );
+}
+
+// An incomplete fill is ignored as a whole, so the fill of the page layout stays.
+void DrawingPageStyleContext::CheckFill()
+{
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( !mbChecked && xImpPrMap.is() )
+ {
+ mbChecked = true;
+ const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
+ ::std::vector< XMLPropertyState >& rProperties = GetProperties();
+ drawing::FillStyle eStyle = drawing::FillStyle_NONE;
+ bool bColor = false;
+ rtl::OUString aGradient, aHatch, aBitmap, aTrans;
+ XMLPropertyState* pTrans = NULL;
+
+ for( ::std::vector< XMLPropertyState >::iterator a = rProperties.begin(); a != rProperties.end(); ++a )
+ {
+ if( a->mnIndex == -1 )
+ continue;
+ const rtl::OUString& rName = rMapper->GetEntryAPIName( a->mnIndex );
+ if( rName.equalsAscii( "FillStyle" ) )
+ {
+ sal_Int32 nValue = 0;
+ if( !( a->maValue >>= eStyle ) && ( a->maValue >>= nValue ) )
+ eStyle = static_cast< drawing::FillStyle >( nValue );
+ }
+ else if( rName.equalsAscii( "FillColor" ) )
+ bColor = true;
+ else if( rName.equalsAscii( "FillGradientName" ) )
+ a->maValue >>= aGradient;
+ else if( rName.equalsAscii( "FillHatchName" ) )
+ a->maValue >>= aHatch;
+ else if( rName.equalsAscii( "FillBitmapName" ) )
+ a->maValue >>= aBitmap;
+ else if( rName.equalsAscii( "FillTransparenceGradientName" ) )
+ {
+ a->maValue >>= aTrans;
+ pTrans = &(*a);
+ }
+ }
+
+ SvXMLImport& rImport = GetImport();
+ switch( eStyle )
+ {
+ case drawing::FillStyle_SOLID:
+ mbUsable = bColor;
+ break;
+ case drawing::FillStyle_GRADIENT:
+ mbUsable = lcl_FillNameExists( rImport, rImport.GetGradientHelper(), XML_STYLE_FAMILY_SD_GRADIENT_ID, aGradient );
+ break;
+ case drawing::FillStyle_HATCH:
+ mbUsable = lcl_FillNameExists( rImport, rImport.GetHatchHelper(), XML_STYLE_FAMILY_SD_HATCH_ID, aHatch );
+ break;
+ case drawing::FillStyle_BITMAP:
+ mbUsable = lcl_FillNameExists( rImport, rImport.GetBitmapHelper(), XML_STYLE_FAMILY_SD_FILL_IMAGE_ID, aBitmap );
+ break;
+ default:
+ break;
+ }
+
+ if( mbUsable && pTrans && !lcl_FillNameExists( rImport, rImport.GetTransGradientHelper(), XML_STYLE_FAMILY_SD_GRADIENT_ID, aTrans ) )
+ pTrans->mnIndex = -1;
+ }
+}
+
+void DrawingPageStyleContext::FillPropertySet( const uno::Reference< beans::XPropertySet > & rPropSet )
+{
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() );
+ if( !xImpPrMap.is() || !HasFill() )
+ return;
+ const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
+ ::std::vector< XMLPropertyState >& rProperties = GetProperties();
+
+ // as in PageStyleContext::FillPropertySet: names set in the bulk call left gradient and hatch at their defaults
+ struct _ContextID_Index_Pair aContextIDs[] =
+ {
+ { CTF_PM_FILLGRADIENTNAME, -1 },
+ { CTF_PM_FILLTRANSNAME, -1 },
+ { CTF_PM_FILLHATCHNAME, -1 },
+ { CTF_PM_FILLBITMAPNAME, -1 },
+ { -1, -1 }
+ };
+ static const sal_uInt16 aFamilies[] =
+ {
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_GRADIENT_ID,
+ XML_STYLE_FAMILY_SD_HATCH_ID,
+ XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
+ };
+
+ xImpPrMap->FillPropertySet( rProperties, rPropSet, aContextIDs );
+
+ Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo() );
+ for( sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++ )
+ {
+ if( aContextIDs[i].nIndex == -1 )
+ continue;
+ const XMLPropertyState& rState = rProperties[aContextIDs[i].nIndex];
+ const rtl::OUString& rPropertyName = rMapper->GetEntryAPIName( rState.mnIndex );
+ rtl::OUString sStyleName;
+ rState.maValue >>= sStyleName;
+ sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName );
+ try
+ {
+ if( xInfo->hasPropertyByName( rPropertyName ) )
+ rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
+ }
+ catch( lang::IllegalArgumentException& e )
+ {
+ Sequence< rtl::OUString > aSeq( 1 );
+ aSeq[0] = sStyleName;
+ GetImport().SetError( XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, aSeq, e.Message, NULL );
+ }
+ }
+}
+
//eof
diff --git a/main/xmloff/source/style/PageMasterPropHdlFactory.cxx b/main/xmloff/source/style/PageMasterPropHdlFactory.cxx
index e7e58dfb2a..e0c00dfda9 100644
--- a/main/xmloff/source/style/PageMasterPropHdlFactory.cxx
+++ b/main/xmloff/source/style/PageMasterPropHdlFactory.cxx
@@ -137,6 +137,9 @@ const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_I
case XML_PM_TYPE_CENTER_VERTICAL:
pHdl = new XMLPMPropHdl_CenterVertical();
break;
+ case XML_PM_TYPE_BACKGROUNDSIZE:
+ pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_FULL ), GetXMLToken( XML_BORDER ) );
+ break;
case XML_TYPE_TEXT_COLUMNS:
pHdl = new XMLTextColumnsPropertyHandler;
break;
diff --git a/main/xmloff/source/style/PageMasterStyleMap.cxx b/main/xmloff/source/style/PageMasterStyleMap.cxx
index aa69b897bd..1e27c61b75 100644
--- a/main/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/main/xmloff/source/style/PageMasterStyleMap.cxx
@@ -285,4 +285,33 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
{ 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 } // index 190
};
+#define DPMAP(name,prefix,token,type,context) _MAP(name,prefix,token,type|XML_TYPE_PROP_DRAWING_PAGE,context)
+
+const XMLPropertyMapEntry aXMLPageMasterDrawingPageStyleMap[] =
+{
+ DPMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ),
+ DPMAP( "BackgroundFullSize", XML_NAMESPACE_DRAW, XML_BACKGROUND_SIZE, XML_PM_TYPE_BACKGROUNDSIZE, 0 ),
+ DPMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ DPMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
+ DPMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLGRADIENTNAME ),
+ DPMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ),
+ DPMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLHATCHNAME ),
+ DPMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ),
+ DPMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLBITMAPNAME ),
+ DPMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLTRANSNAME ),
+ DPMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
+ DPMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
+ DPMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ),
+ DPMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_X ),
+ DPMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_Y ),
+
+ { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010 }
+};
+
//eof
diff --git a/main/xmloff/source/style/xmlstyle.cxx b/main/xmloff/source/style/xmlstyle.cxx
index d66b9e0524..2052614d3e 100644
--- a/main/xmloff/source/style/xmlstyle.cxx
+++ b/main/xmloff/source/style/xmlstyle.cxx
@@ -37,6 +37,8 @@
#ifndef _XMLOFF_PAGEMASTERPROPMAPPER_HXX
#include "PageMasterPropMapper.hxx"
#endif
+#include "PageMasterPropHdlFactory.hxx"
+#include <xmloff/PageMasterStyleMap.hxx>
#include <tools/debug.hxx>
#include <tools/list.hxx>
#include <svl/cntnrsrt.hxx>
@@ -585,6 +587,11 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
case XML_STYLE_FAMILY_SD_POOL_ID:
pStyle = new XMLShapeStyleContext( GetImport(), nPrefix, rLocalName,
xAttrList, *this, nFamily );
+ break;
+
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ pStyle = new DrawingPageStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this );
}
return pStyle;
@@ -737,6 +744,11 @@ UniReference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportProperty
}
xMapper = mxPageImpPropMapper;
break;
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ xMapper = new SvXMLImportPropertyMapper(
+ new XMLPageMasterPropSetMapper( aXMLPageMasterDrawingPageStyleMap, new XMLPageMasterPropHdlFactory ),
+ ((SvXMLStylesContext*)this)->GetImport() );
+ break;
}
return xMapper;
diff --git a/main/xmloff/source/text/XMLTextMasterPageContext.cxx b/main/xmloff/source/text/XMLTextMasterPageContext.cxx
index 804b764f94..16cdff2fc9 100644
--- a/main/xmloff/source/text/XMLTextMasterPageContext.cxx
+++ b/main/xmloff/source/text/XMLTextMasterPageContext.cxx
@@ -112,6 +112,10 @@ XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport,
sPageMasterName = xAttrList->getValueByIndex( i );
}
}
+ else if( XML_NAMESPACE_DRAW == nPrefix && IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sDrawingPageStyleName = xAttrList->getValueByIndex( i );
+ }
}
if( sDisplayName.getLength() )
@@ -250,15 +254,35 @@ void XMLTextMasterPageContext::Finish( sal_Bool bOverwrite )
if( xStyle.is() && (IsNew() || bOverwrite) )
{
Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ DrawingPageStyleContext* pDrawingPage = 0;
+ if( sDrawingPageStyleName.getLength() &&
+ xPropSet->getPropertySetInfo()->hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
+ {
+ const SvXMLStylesContext* pStyles = GetImport().GetAutoStyles();
+ const SvXMLStyleContext* pStyle = pStyles ? pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sDrawingPageStyleName, sal_True ) : 0;
+ pStyles = GetImport().GetStyles();
+ if( !pStyle && pStyles )
+ pStyle = pStyles->FindStyleChildContext( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
+ sDrawingPageStyleName, sal_True );
+ pDrawingPage = PTR_CAST( DrawingPageStyleContext, pStyle );
+ if( pDrawingPage && !pDrawingPage->HasFill() )
+ pDrawingPage = 0;
+ }
if( sPageMasterName.getLength() )
{
XMLPropStyleContext* pStyle =
GetImport().GetTextImport()->FindPageMaster( sPageMasterName );
- if (pStyle)
+ PageStyleContext* pPageStyle = PTR_CAST( PageStyleContext, pStyle );
+ if( pDrawingPage && pPageStyle )
+ pPageStyle->FillPropertySetWithoutOldPageFill( xPropSet );
+ else if (pStyle)
{
pStyle->FillPropertySet(xPropSet);
}
}
+ if( pDrawingPage )
+ pDrawingPage->FillPropertySet( xPropSet );
Reference < XNameContainer > xPageStyles =
GetImport().GetTextImport()->GetPageStyles();
(openoffice) 02/04: xmloff: write the page fill as a drawing page style in default 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 facd4f78b5779d60f9e756da689d049cb9713f6f
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 16:12:11 2026 -0400
xmloff: write the page fill as a drawing page style in default mode
The style sets draw:background-size to border, which is how the fill is painted.
---
main/xmloff/source/style/XMLPageExport.cxx | 62 ++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/main/xmloff/source/style/XMLPageExport.cxx b/main/xmloff/source/style/XMLPageExport.cxx
index 5cffff91a1..ff99086d7b 100644
--- a/main/xmloff/source/style/XMLPageExport.cxx
+++ b/main/xmloff/source/style/XMLPageExport.cxx
@@ -55,6 +55,53 @@ using namespace ::com::sun::star::beans;
using namespace ::xmloff::token;
+namespace
+{
+ bool lcl_HasState( const ::std::vector< XMLPropertyState >& rPropState )
+ {
+ for( ::std::vector< XMLPropertyState >::const_iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
+ if( aIter->mnIndex != -1 )
+ return true;
+ return false;
+ }
+
+ class XMLPageDrawingPageExportPropMapper : public XMLPageMasterExportPropMapper
+ {
+ public:
+ XMLPageDrawingPageExportPropMapper( SvXMLExport& rExport ) :
+ XMLPageMasterExportPropMapper( new XMLPageMasterPropSetMapper(
+ aXMLPageMasterDrawingPageStyleMap, new XMLPageMasterPropHdlFactory ), rExport )
+ {
+ }
+
+ virtual void ContextFilter( ::std::vector< XMLPropertyState >& rPropState,
+ Reference< XPropertySet > rPropSet ) const
+ {
+ XMLPageMasterExportPropMapper::ContextFilter( rPropState, rPropSet );
+ if( lcl_HasState( rPropState ) )
+ {
+ // the page fill is painted inside the page borders
+ rPropState.push_back( XMLPropertyState( getPropertySetMapper()->FindEntryIndex(
+ "BackgroundFullSize", XML_NAMESPACE_DRAW, GetXMLToken( XML_BACKGROUND_SIZE ) ), makeAny( sal_False ) ) );
+ }
+ }
+ };
+
+ ::std::vector< XMLPropertyState > lcl_FilterDrawingPageFill( SvXMLExport& rExport,
+ const Reference< XPropertySet >& rPropSet )
+ {
+ ::std::vector< XMLPropertyState > aPropStates;
+ if( rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ {
+ UniReference< SvXMLExportPropertyMapper > xMapper( new XMLPageDrawingPageExportPropMapper( rExport ) );
+ aPropStates = xMapper->Filter( rPropSet );
+ if( !lcl_HasState( aPropStates ) )
+ aPropStates.clear();
+ }
+ return aPropStates;
+ }
+}
+
//______________________________________________________________________________
sal_Bool XMLPageExport::findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const
@@ -119,6 +166,10 @@ sal_Bool XMLPageExport::exportStyle(
aEntry.sStyleName = rStyle->getName();
aNameVector.push_back( aEntry );
+ ::std::vector< XMLPropertyState > aPropStates( lcl_FilterDrawingPageFill( GetExport(), xPropSet ) );
+ if( !aPropStates.empty() )
+ GetExport().GetAutoStylePool()->Add( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, OUString(), aPropStates );
+
exportMasterPageContent( xPropSet, sal_True );
}
else
@@ -136,6 +187,13 @@ sal_Bool XMLPageExport::exportStyle(
if( findPageMasterName( sName, sPMName ) )
GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, GetExport().EncodeStyleName( sPMName ) );
+ ::std::vector< XMLPropertyState > aPropStates( lcl_FilterDrawingPageFill( GetExport(), xPropSet ) );
+ OUString sDrawingPageName;
+ if( !aPropStates.empty() )
+ sDrawingPageName = GetExport().GetAutoStylePool()->Find( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, OUString(), aPropStates );
+ if( sDrawingPageName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME, GetExport().EncodeStyleName( sDrawingPageName ) );
+
Reference<XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
if ( xInfo.is() && xInfo->hasPropertyByName(sFollowStyle) )
{
@@ -179,6 +237,8 @@ XMLPageExport::XMLPageExport( SvXMLExport& rExp ) :
rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_PAGE_MASTER, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_NAME ) ),
xPageMasterExportPropMapper, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_PAGE_MASTER_PREFIX ) ), sal_False );
+ rExport.GetAutoStylePool()->AddFamily( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME ) ),
+ new XMLPageDrawingPageExportPropMapper( rExp ), OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX ) ) );
Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(),
UNO_QUERY );
@@ -231,6 +291,8 @@ void XMLPageExport::exportAutoStyles()
, rExport.GetDocHandler(), rExport.GetMM100UnitConverter(),
rExport.GetNamespaceMap()
);
+ rExport.GetAutoStylePool()->exportXML( XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
+ rExport.GetDocHandler(), rExport.GetMM100UnitConverter(), rExport.GetNamespaceMap() );
}
void XMLPageExport::exportDefaultStyle()
(openoffice) 04/04: test/odf-validate: add fixtures for the page fill drawing page style
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 7173d466a58651dff70efd4493a3fb07078fe1c1
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 16:12:11 2026 -0400
test/odf-validate: add fixtures for the page fill drawing page style
---
.../fixtures/page-fill-1_3/aoo-src.odt | Bin 0 -> 13741 bytes
.../fixtures/page-fill-1_3/calc-drawing-page.ods | Bin 0 -> 7479 bytes
.../fixtures/page-fill-1_3/calc-src.ods | Bin 0 -> 8471 bytes
.../fixtures/page-fill-1_3/checks-calc.json | 19 ++
.../fixtures/page-fill-1_3/checks-edge-both.json | 241 +++++++++++++++++++
.../fixtures/page-fill-1_3/checks-edge-empty.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-shared-layout.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-undefined.json | 257 ++++++++++++++++++++
.../page-fill-1_3/checks-edge-unknown-name.json | 225 +++++++++++++++++
.../page-fill-1_3/checks-foreign-strict.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/checks-foreign.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/checks.json | 265 +++++++++++++++++++++
.../fixtures/page-fill-1_3/edge-both.odt | Bin 0 -> 25579 bytes
.../fixtures/page-fill-1_3/edge-common.odt | Bin 0 -> 25028 bytes
.../fixtures/page-fill-1_3/edge-empty.odt | Bin 0 -> 25010 bytes
.../fixtures/page-fill-1_3/edge-none.odt | Bin 0 -> 25026 bytes
.../fixtures/page-fill-1_3/edge-shared-layout.odt | Bin 0 -> 25018 bytes
.../fixtures/page-fill-1_3/edge-undefined.odt | Bin 0 -> 25028 bytes
.../fixtures/page-fill-1_3/edge-unknown-name.odt | Bin 0 -> 25026 bytes
.../fixtures/page-fill-1_3/foreign-v10.odt | Bin 0 -> 25021 bytes
.../fixtures/page-fill-1_3/foreign-v11.odt | Bin 0 -> 25567 bytes
.../fixtures/page-fill-1_3/foreign-v12.odt | Bin 0 -> 25021 bytes
.../fixtures/page-fill-1_3/foreign-v3.odt | Bin 0 -> 25566 bytes
.../fixtures/page-fill-1_3/foreign-v8.odt | Bin 0 -> 25364 bytes
test/odf-validate/fixtures/page-fill-1_3/gen.bas | 108 +++++++++
.../fixtures/page-fill-1_3/make-aoo.py | 76 ++++++
.../fixtures/page-fill-1_3/make-calc.py | 36 +++
.../fixtures/page-fill-1_3/make-foreign.py | 110 +++++++++
.../fixtures/page-fill-1_3/mkexpect.py | 87 +++++++
test/odf-validate/fixtures/page-fill-1_3/tile.png | Bin 0 -> 1795 bytes
30 files changed, 2468 insertions(+)
diff --git a/test/odf-validate/fixtures/page-fill-1_3/aoo-src.odt b/test/odf-validate/fixtures/page-fill-1_3/aoo-src.odt
new file mode 100644
index 0000000000..57344fd06f
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/aoo-src.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/calc-drawing-page.ods b/test/odf-validate/fixtures/page-fill-1_3/calc-drawing-page.ods
new file mode 100644
index 0000000000..03091305d0
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/calc-drawing-page.ods differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/calc-src.ods b/test/odf-validate/fixtures/page-fill-1_3/calc-src.ods
new file mode 100644
index 0000000000..95a35c1035
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/calc-src.ods differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-calc.json b/test/odf-validate/fixtures/page-fill-1_3/checks-calc.json
new file mode 100644
index 0000000000..61394f842f
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-calc.json
@@ -0,0 +1,19 @@
+[
+ {
+ "name": "calc_page_background",
+ "expr": "[(s.BackGraphicURL.endswith('tile.png'), s.BackGraphicLocation.value, s.BackColor, s.BackTransparent) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_image')]]",
+ "expect": [
+ [
+ true,
+ "TILED",
+ 6737151,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "calc_sheet_page_style",
+ "expr": "doc.Sheets.getByIndex(0).PageStyle",
+ "expect": "P_image"
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-edge-both.json b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-both.json
new file mode 100644
index 0000000000..0706765a7a
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-both.json
@@ -0,0 +1,241 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "SOLID",
+ 16711680,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "SOLID",
+ 16711680,
+ 0
+ ],
+ [
+ "P_shared2",
+ "SOLID",
+ 16711680,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "HATCH",
+ 16777164,
+ 43520,
+ true
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-edge-empty.json b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-empty.json
new file mode 100644
index 0000000000..c7c48f96dc
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-empty.json
@@ -0,0 +1,257 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 0
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "SOLID",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "GRADIENT",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_shared2",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "SOLID",
+ 16777164,
+ 8421504,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-edge-shared-layout.json b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-shared-layout.json
new file mode 100644
index 0000000000..85fad4eaef
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-shared-layout.json
@@ -0,0 +1,257 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "SOLID",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "REPEAT",
+ true,
+ "LEFT_TOP",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "SOLID",
+ 16777164,
+ 8421504,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-edge-undefined.json b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-undefined.json
new file mode 100644
index 0000000000..a60499ce95
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-undefined.json
@@ -0,0 +1,257 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "SOLID",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "GRADIENT",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_shared2",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "SOLID",
+ 16777164,
+ 8421504,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-edge-unknown-name.json b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-unknown-name.json
new file mode 100644
index 0000000000..0319a0ea78
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-edge-unknown-name.json
@@ -0,0 +1,225 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "SOLID",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "SOLID",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "SOLID",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "SOLID",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": []
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "SOLID",
+ 16777164,
+ 8421504,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-foreign-strict.json b/test/odf-validate/fixtures/page-fill-1_3/checks-foreign-strict.json
new file mode 100644
index 0000000000..1e1f9168bf
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-foreign-strict.json
@@ -0,0 +1,265 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "GRADIENT",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_shared2",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "SOLID",
+ 16777164,
+ 8421504,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks-foreign.json b/test/odf-validate/fixtures/page-fill-1_3/checks-foreign.json
new file mode 100644
index 0000000000..33b88c239d
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks-foreign.json
@@ -0,0 +1,265 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 7512015,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 7512015,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "GRADIENT",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_shared2",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "HATCH",
+ 16777164,
+ 43520,
+ true
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/checks.json b/test/odf-validate/fixtures/page-fill-1_3/checks.json
new file mode 100644
index 0000000000..50d7ef2fe6
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/checks.json
@@ -0,0 +1,265 @@
+[
+ {
+ "name": "page_fill",
+ "expr": "[(n, s.FillStyle.value, s.FillColor, s.FillTransparence) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)]]",
+ "expect": [
+ [
+ "Standard",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "First Page",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_solid",
+ "SOLID",
+ 3385941,
+ 0
+ ],
+ [
+ "P_solid_transp",
+ "SOLID",
+ 3364266,
+ 40
+ ],
+ [
+ "P_gradient",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_gradient_transp",
+ "GRADIENT",
+ 8388736,
+ 30
+ ],
+ [
+ "P_gradient_tgrad",
+ "GRADIENT",
+ 8421504,
+ 0
+ ],
+ [
+ "P_hatch",
+ "HATCH",
+ 16777164,
+ 0
+ ],
+ [
+ "P_hatch_nobg",
+ "HATCH",
+ 43520,
+ 0
+ ],
+ [
+ "P_bitmap_tile",
+ "BITMAP",
+ 13625333,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "BITMAP",
+ 13625333,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "BITMAP",
+ 13625333,
+ 0
+ ],
+ [
+ "P_none",
+ "NONE",
+ 13625333,
+ 0
+ ],
+ [
+ "P_shared",
+ "GRADIENT",
+ 8388736,
+ 0
+ ],
+ [
+ "P_shared2",
+ "GRADIENT",
+ 8388736,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "page_gradient",
+ "expr": "[(n, g.Style.value, g.StartColor, g.EndColor, g.Angle, g.Border) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'GRADIENT' for g in [s.FillGradient]]",
+ "expect": [
+ [
+ "P_gradient",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_transp",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_gradient_tgrad",
+ "LINEAR",
+ 65280,
+ 16711935,
+ 0,
+ 0
+ ],
+ [
+ "P_shared",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ],
+ [
+ "P_shared2",
+ "LINEAR",
+ 16711680,
+ 255,
+ 0,
+ 10
+ ]
+ ]
+ },
+ {
+ "name": "page_transparence_gradient",
+ "expr": "[(n, s.FillTransparenceGradientName, g.Style.value, g.StartColor, g.EndColor) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillTransparenceGradientName for g in [s.FillTransparenceGradient]]",
+ "expect": [
+ [
+ "P_gradient_tgrad",
+ "TG1",
+ "LINEAR",
+ 0,
+ 16777215
+ ]
+ ]
+ },
+ {
+ "name": "page_hatch",
+ "expr": "[(n, h.Style.value, h.Color, h.Distance, h.Angle, s.FillBackground) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_stretch','P_bitmap_once','P_none','P_shared','P_shared2') for s in [doc.StyleFamilies.getByName('PageStyles').getByName(n)] if s.FillStyle.value == 'HATCH' for h in [s.FillHatch]]",
+ "expect": [
+ [
+ "First Page",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ],
+ [
+ "P_hatch",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ true
+ ],
+ [
+ "P_hatch_nobg",
+ "SINGLE",
+ 43520,
+ 200,
+ 450,
+ false
+ ]
+ ]
+ },
+ {
+ "name": "page_bitmap",
+ "expr": "[(n, s.FillBitmapMode.value, 'GraphicObject:' in s.FillBitmapURL and 'GraphicObject:0000000' not in s.FillBitmapURL, s.FillBitmapRectanglePoint.value, s.FillBitmapPositionOffsetX, s.FillBitmapPositionOffsetY, s.FillBitmapOffsetX, s.FillBitmapOffsetY, s.FillBitmapLogicalSize, s.FillBitmapSizeX, s.FillBitmapSizeY) for n in ('Standard','First Page','P_solid','P_solid_transp','P_gradient','P_gradient_transp','P_gradient_tgrad','P_hatch','P_hatch_nobg','P_bitmap_tile','P_bitmap_str [...]
+ "expect": [
+ [
+ "P_bitmap_tile",
+ "REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_stretch",
+ "STRETCH",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ],
+ [
+ "P_bitmap_once",
+ "NO_REPEAT",
+ true,
+ "MIDDLE_MIDDLE",
+ 0,
+ 0,
+ 0,
+ 0,
+ true,
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "name": "header_fill",
+ "expr": "[(s.HeaderIsOn, s.HeaderFillStyle.value, s.HeaderFillColor, s.HeaderFillHatch.Color, s.HeaderFillBackground) for s in [doc.StyleFamilies.getByName('PageStyles').getByName('P_gradient')]]",
+ "expect": [
+ [
+ true,
+ "HATCH",
+ 16777164,
+ 43520,
+ true
+ ]
+ ]
+ },
+ {
+ "name": "page_usage",
+ "expr": "[e.nextElement().PageDescName for e in [doc.Text.createEnumeration()] for i in range(14)]",
+ "expect": [
+ "First Page",
+ "P_solid",
+ "P_solid_transp",
+ "P_gradient",
+ "P_gradient_transp",
+ "P_gradient_tgrad",
+ "P_hatch",
+ "P_hatch_nobg",
+ "P_bitmap_tile",
+ "P_bitmap_stretch",
+ "P_bitmap_once",
+ "P_none",
+ "P_shared",
+ "P_shared2"
+ ]
+ }
+]
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-both.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-both.odt
new file mode 100644
index 0000000000..b4c1a064b5
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-both.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-common.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-common.odt
new file mode 100644
index 0000000000..8711f35160
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-common.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-empty.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-empty.odt
new file mode 100644
index 0000000000..091f017559
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-empty.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-none.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-none.odt
new file mode 100644
index 0000000000..055b0c09e1
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-none.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-shared-layout.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-shared-layout.odt
new file mode 100644
index 0000000000..6414b5c6ee
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-shared-layout.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-undefined.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-undefined.odt
new file mode 100644
index 0000000000..04945acd46
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-undefined.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/edge-unknown-name.odt b/test/odf-validate/fixtures/page-fill-1_3/edge-unknown-name.odt
new file mode 100644
index 0000000000..000e11d85d
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/edge-unknown-name.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/foreign-v10.odt b/test/odf-validate/fixtures/page-fill-1_3/foreign-v10.odt
new file mode 100644
index 0000000000..c0c600eb58
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/foreign-v10.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/foreign-v11.odt b/test/odf-validate/fixtures/page-fill-1_3/foreign-v11.odt
new file mode 100644
index 0000000000..a5074a2546
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/foreign-v11.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/foreign-v12.odt b/test/odf-validate/fixtures/page-fill-1_3/foreign-v12.odt
new file mode 100644
index 0000000000..148eac641a
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/foreign-v12.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/foreign-v3.odt b/test/odf-validate/fixtures/page-fill-1_3/foreign-v3.odt
new file mode 100644
index 0000000000..4b70914c75
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/foreign-v3.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/foreign-v8.odt b/test/odf-validate/fixtures/page-fill-1_3/foreign-v8.odt
new file mode 100644
index 0000000000..56453ac338
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/foreign-v8.odt differ
diff --git a/test/odf-validate/fixtures/page-fill-1_3/gen.bas b/test/odf-validate/fixtures/page-fill-1_3/gen.bas
new file mode 100644
index 0000000000..7331967c45
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/gen.bas
@@ -0,0 +1,108 @@
+Dim gDoc As Object
+
+Function Gr(c1 As Long, c2 As Long, b As Integer)
+ Dim g As New com.sun.star.awt.Gradient
+ g.Style = com.sun.star.awt.GradientStyle.LINEAR : g.StartColor = c1 : g.EndColor = c2
+ g.Angle = 0 : g.Border = b : g.XOffset = 50 : g.YOffset = 50
+ g.StartIntensity = 100 : g.EndIntensity = 100 : g.StepCount = 0
+ Gr = g
+End Function
+
+Sub Fill(o As Object, pre As String, kind As String, png As String)
+ Dim h As New com.sun.star.drawing.Hatch
+ Select Case kind
+ Case "solid"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.SOLID)
+ o.setPropertyValue(pre + "FillColor", &H33AA55)
+ Case "solid_transp"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.SOLID)
+ o.setPropertyValue(pre + "FillColor", &H3355AA)
+ o.setPropertyValue(pre + "FillTransparence", 40)
+ Case "gradient", "shared"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.GRADIENT)
+ o.setPropertyValue(pre + "FillGradient", Gr(&HFF0000, &H0000FF, 10))
+ Case "gradient_transp"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.GRADIENT)
+ o.setPropertyValue(pre + "FillGradient", Gr(&HFF0000, &H0000FF, 10))
+ o.setPropertyValue(pre + "FillTransparence", 30)
+ Case "gradient_tgrad"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.GRADIENT)
+ o.setPropertyValue(pre + "FillGradient", Gr(65280, &HFF00FF, 0))
+ Dim tg As Object
+ tg = gDoc.createInstance("com.sun.star.drawing.TransparencyGradientTable")
+ If Not tg.hasByName("TG1") Then tg.insertByName("TG1", Gr(0, &HFFFFFF, 0))
+ o.setPropertyValue(pre + "FillTransparenceGradientName", "TG1")
+ Case "hatch", "hatch_nobg"
+ h.Style = com.sun.star.drawing.HatchStyle.SINGLE : h.Color = 43520 : h.Distance = 200 : h.Angle = 450
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.HATCH)
+ o.setPropertyValue(pre + "FillHatch", h)
+ If kind = "hatch" Then
+ o.setPropertyValue(pre + "FillColor", &HFFFFCC)
+ o.setPropertyValue(pre + "FillBackground", True)
+ Else
+ o.setPropertyValue(pre + "FillBackground", False)
+ End If
+ Case "bitmap_tile", "bitmap_stretch", "bitmap_once"
+ o.setPropertyValue(pre + "FillStyle", com.sun.star.drawing.FillStyle.BITMAP)
+ o.setPropertyValue(pre + "FillBitmapURL", png)
+ If kind = "bitmap_stretch" Then
+ o.setPropertyValue(pre + "FillBitmapMode", com.sun.star.drawing.BitmapMode.STRETCH)
+ ElseIf kind = "bitmap_once" Then
+ o.setPropertyValue(pre + "FillBitmapMode", com.sun.star.drawing.BitmapMode.NO_REPEAT)
+ Else
+ o.setPropertyValue(pre + "FillBitmapMode", com.sun.star.drawing.BitmapMode.REPEAT)
+ End If
+ End Select
+End Sub
+
+Sub Gen
+ Dim out As String, png As String
+ out = Environ("PFF_OUT") : png = Environ("PFF_PNG")
+ Dim a(0) As New com.sun.star.beans.PropertyValue
+ a(0).Name = "Hidden" : a(0).Value = True
+ Dim doc As Object
+ doc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, a())
+ gDoc = doc
+ Dim kinds
+ kinds = Split(Environ("PFF_KINDS"), ",")
+ Dim styles As Object, s As Object, i As Integer, nm As String
+ styles = doc.StyleFamilies.getByName("PageStyles")
+ For i = 0 To UBound(kinds)
+ nm = "P_" + kinds(i)
+ s = doc.createInstance("com.sun.star.style.PageStyle")
+ styles.insertByName(nm, s)
+ s = styles.getByName(nm)
+ If kinds(i) <> "none" Then Fill s, "", kinds(i), png
+ Next
+ styles.getByName("P_shared").setPropertyValue("FollowStyle", "P_shared")
+ s = doc.createInstance("com.sun.star.style.PageStyle")
+ styles.insertByName("P_shared2", s)
+ Fill styles.getByName("P_shared2"), "", "shared", png
+ s = styles.getByName("P_gradient")
+ s.HeaderIsOn = True
+ Fill s, "Header", "hatch", png
+ Fill styles.getByName("Standard"), "", "solid", png
+ Fill styles.getByName("First Page"), "", "hatch_nobg", png
+ Dim cur As Object, en As Object, p As Object
+ cur = doc.Text.createTextCursor()
+ doc.Text.insertString(cur, "first", False)
+ doc.Text.insertControlCharacter(cur, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ For i = 0 To UBound(kinds)
+ doc.Text.insertString(cur, "page P_" + kinds(i), False)
+ doc.Text.insertControlCharacter(cur, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ Next
+ doc.Text.insertString(cur, "page P_shared2", False)
+ en = doc.Text.createEnumeration()
+ p = en.nextElement()
+ p.PageDescName = "First Page"
+ For i = 0 To UBound(kinds)
+ p = en.nextElement()
+ p.PageDescName = "P_" + kinds(i)
+ Next
+ p = en.nextElement()
+ p.PageDescName = "P_shared2"
+ Dim b(0) As New com.sun.star.beans.PropertyValue
+ b(0).Name = "FilterName" : b(0).Value = "writer8"
+ doc.storeToURL(ConvertToURL(out), b())
+ doc.close(True)
+End Sub
diff --git a/test/odf-validate/fixtures/page-fill-1_3/make-aoo.py b/test/odf-validate/fixtures/page-fill-1_3/make-aoo.py
new file mode 100644
index 0000000000..e7504156db
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/make-aoo.py
@@ -0,0 +1,76 @@
+# usage: runpy.sh fixtures/page-fill-1_3/make-aoo.py <port> <out.odt> (office saving in its default mode)
+# Same page styles and fills as gen.bas, built through UNO in AOO.
+import os, 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
+from com.sun.star.drawing.BitmapMode import REPEAT, STRETCH, NO_REPEAT
+
+port, out = int(sys.argv[1]), sys.argv[2]
+png = uno.systemPathToFileUrl(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "tile.png"))
+KINDS = "solid,solid_transp,gradient,gradient_transp,gradient_tgrad,hatch,hatch_nobg,bitmap_tile,bitmap_stretch,bitmap_once,none,shared".split(",")
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/swriter", "_blank", 0, (pv("Hidden", True),))
+
+def gr(c1, c2, b):
+ g = Gradient(); g.Style = LINEAR; g.StartColor = c1; g.EndColor = c2
+ g.Angle = 0; g.Border = b; g.XOffset = 50; g.YOffset = 50
+ g.StartIntensity = 100; g.EndIntensity = 100; g.StepCount = 0
+ return g
+
+def fill(o, pre, kind):
+ sp = lambda n, v: o.setPropertyValue(pre + n, v)
+ if kind == "solid":
+ sp("FillStyle", SOLID); sp("FillColor", 0x33AA55)
+ elif kind == "solid_transp":
+ sp("FillStyle", SOLID); sp("FillColor", 0x3355AA); sp("FillTransparence", 40)
+ elif kind in ("gradient", "shared"):
+ sp("FillStyle", GRADIENT); sp("FillGradient", gr(0xFF0000, 0x0000FF, 10))
+ elif kind == "gradient_transp":
+ sp("FillStyle", GRADIENT); sp("FillGradient", gr(0xFF0000, 0x0000FF, 10)); sp("FillTransparence", 30)
+ elif kind == "gradient_tgrad":
+ sp("FillStyle", GRADIENT); sp("FillGradient", gr(0x00FF00, 0xFF00FF, 0))
+ tg = doc.createInstance("com.sun.star.drawing.TransparencyGradientTable")
+ if not tg.hasByName("TG1"):
+ tg.insertByName("TG1", gr(0x000000, 0xFFFFFF, 0))
+ sp("FillTransparenceGradientName", "TG1")
+ elif kind in ("hatch", "hatch_nobg"):
+ h = Hatch(); h.Style = SINGLE; h.Color = 0x00AA00; h.Distance = 200; h.Angle = 450
+ sp("FillStyle", HATCH); sp("FillHatch", h)
+ if kind == "hatch":
+ sp("FillColor", 0xFFFFCC); sp("FillBackground", True)
+ else:
+ sp("FillBackground", False)
+ elif kind.startswith("bitmap"):
+ sp("FillStyle", BITMAP); sp("FillBitmapURL", png)
+ sp("FillBitmapMode", {"bitmap_tile": REPEAT, "bitmap_stretch": STRETCH, "bitmap_once": NO_REPEAT}[kind])
+
+ps = doc.StyleFamilies.getByName("PageStyles")
+for k in KINDS:
+ ps.insertByName("P_" + k, doc.createInstance("com.sun.star.style.PageStyle"))
+ if k != "none":
+ fill(ps.getByName("P_" + k), "", k)
+ps.getByName("P_shared").FollowStyle = "P_shared"
+ps.insertByName("P_shared2", doc.createInstance("com.sun.star.style.PageStyle"))
+fill(ps.getByName("P_shared2"), "", "shared")
+s = ps.getByName("P_gradient"); s.HeaderIsOn = True; fill(s, "Header", "hatch")
+fill(ps.getByName("Standard"), "", "solid")
+fill(ps.getByName("First Page"), "", "hatch_nobg")
+
+text = doc.Text
+cur = text.createTextCursor()
+PB = uno.getConstantByName("com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK")
+names = ["First Page"] + ["P_" + k for k in KINDS] + ["P_shared2"]
+for i, n in enumerate(names):
+ text.insertString(cur, "page " + n, False)
+ if i < len(names) - 1:
+ text.insertControlCharacter(cur, PB, False)
+en = text.createEnumeration()
+for n in names:
+ en.nextElement().PageDescName = n
+
+doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "writer8"),))
+doc.close(True)
diff --git a/test/odf-validate/fixtures/page-fill-1_3/make-calc.py b/test/odf-validate/fixtures/page-fill-1_3/make-calc.py
new file mode 100644
index 0000000000..d6d34b2621
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/make-calc.py
@@ -0,0 +1,36 @@
+# usage: runpy.sh fixtures/page-fill-1_3/make-calc.py <port> <out-dir>
+# Writes calc-src.ods (a Calc page style with a background image and colour) and calc-drawing-page.ods, the same
+# file with a usable drawing page style named by its master page. Calc page styles have no fill properties, so the
+# drawing page style must not take the page layout's background away.
+import os, re, sys, zipfile, uno
+from unohelp import connect, desktop, pv
+
+port, outdir = int(sys.argv[1]), sys.argv[2]
+png = uno.systemPathToFileUrl(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "tile.png"))
+d = desktop(connect(port))
+doc = d.loadComponentFromURL("private:factory/scalc", "_blank", 0, (pv("Hidden", True),))
+ps = doc.StyleFamilies.getByName("PageStyles")
+ps.insertByName("P_image", doc.createInstance("com.sun.star.style.PageStyle"))
+s = ps.getByName("P_image")
+s.BackColor = 0x66CCFF
+s.BackGraphicURL = png
+s.BackGraphicLocation = uno.Enum("com.sun.star.style.GraphicLocation", "TILED")
+sheet = doc.Sheets.getByIndex(0)
+sheet.PageStyle = "P_image"
+sheet.getCellByPosition(0, 0).setString("page P_image")
+src = os.path.join(outdir, "calc-src.ods")
+doc.storeToURL(uno.systemPathToFileUrl(src), (pv("FilterName", "calc8"),))
+doc.close(True)
+
+zi = zipfile.ZipFile(src); zo = zipfile.ZipFile(os.path.join(outdir, "calc-drawing-page.ods"), "w")
+for it in zi.infolist():
+ data = zi.read(it.filename)
+ if it.filename == "styles.xml":
+ t = data.decode("utf-8")
+ m = re.search(r'<style:master-page style:name="P_5f_image"[^>]*?(/?)>', t)
+ assert m and t.count("</office:automatic-styles>") == 1
+ t = t.replace(m.group(0), m.group(0)[:-len(m.group(1)) - 1] + ' draw:style-name="Mdp9"' + m.group(1) + ">", 1)
+ t = t.replace("</office:automatic-styles>", '<style:style style:name="Mdp9" style:family="drawing-page"><style:drawing-page-properties draw:fill="solid" draw:fill-color="#ff0000"/></style:style></office:automatic-styles>', 1)
+ data = t.encode("utf-8")
+ zo.writestr(it, data, compress_type=zipfile.ZIP_STORED if it.filename == "mimetype" else zipfile.ZIP_DEFLATED)
+zo.close()
diff --git a/test/odf-validate/fixtures/page-fill-1_3/make-foreign.py b/test/odf-validate/fixtures/page-fill-1_3/make-foreign.py
new file mode 100644
index 0000000000..f7568dc808
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/make-foreign.py
@@ -0,0 +1,110 @@
+# usage: python3 -I make-foreign.py <other-suite-soffice> <scratch-dir> [edges-only]
+# Writes foreign-v<N>.odt with the other suite saving at ODF version setting N
+# (/org.openoffice.Office.Common/Save/ODF DefaultVersion; 10/11 write 1.3, 12/3 write 1.4, 8 writes 1.2 extended),
+# using gen.bas as macro Standard.Module1.Gen in a throw-away profile, then derives the edge-*.odt variants
+# by editing the XML text of foreign-v10.odt and foreign-v11.odt (edges-only: only the variants).
+import os, re, subprocess, sys, time, zipfile
+from xml.sax.saxutils import escape
+
+soffice, scratch = sys.argv[1], sys.argv[2]
+here = os.path.dirname(os.path.abspath(__file__))
+KINDS = "solid,solid_transp,gradient,gradient_transp,gradient_tgrad,hatch,hatch_nobg,bitmap_tile,bitmap_stretch,bitmap_once,none,shared"
+MODES = (10, 11, 12, 3, 8)
+XCU = """<?xml version="1.0" encoding="UTF-8"?>
+<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="DefaultVersion" oor:op="fuse"><value>%d</value></prop></item>
+<item oor:path="/org.openoffice.Office.Common/Security/Scripting"><prop oor:name="MacroSecurityLevel" oor:op="fuse"><value>0</value></prop></item>
+</oor:items>
+"""
+MODULE = ('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">\n'
+ '<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">%s</script:module>\n')
+OPTS = ["--headless", "--nofirststartwizard", "--norestore", "--nologo"]
+
+def wait_gone(prof):
+ while subprocess.run(["pgrep", "-f", prof], capture_output=True).returncode == 0:
+ time.sleep(1)
+
+def generate():
+ for mode in MODES:
+ prof = os.path.join(scratch, "profile_page_%d" % mode)
+ out = os.path.join(here, "foreign-v%d.odt" % mode)
+ env = dict(os.environ, PFF_KINDS=KINDS, PFF_OUT=out, PFF_PNG="file://" + os.path.join(here, "tile.png"))
+ ui = "-env:UserInstallation=file://" + prof
+ os.makedirs(os.path.join(prof, "user"))
+ open(os.path.join(prof, "user", "registrymodifications.xcu"), "w").write(XCU % mode)
+ subprocess.run([soffice, *OPTS, ui, "macro:///Standard.Module1.Main"], env=env, timeout=300) # creates the profile and its Standard library
+ wait_gone(prof)
+ open(os.path.join(prof, "user", "basic", "Standard", "Module1.xba"), "w").write(MODULE % escape(open(os.path.join(here, "gen.bas")).read()))
+ subprocess.run([soffice, *OPTS, ui, "macro:///Standard.Module1.Gen"], env=env, timeout=300)
+ wait_gone(prof)
+ assert os.path.getsize(out) > 0, "no output for mode %d" % mode
+ scrub(out)
+
+def scrub(path):
+ """replaces the generator string in meta.xml and the colour theme name in styles.xml by neutral ones"""
+ zi = zipfile.ZipFile(path); items = [(it, zi.read(it.filename)) for it in zi.infolist()]; zi.close()
+ zo = zipfile.ZipFile(path, "w")
+ for it, data in items:
+ if it.filename == "meta.xml":
+ data = re.sub(rb"<meta:generator>[^<]*</meta:generator>", b"<meta:generator>other suite</meta:generator>", data)
+ if it.filename == "styles.xml":
+ data = re.sub(rb'(<loext:theme-colors loext:name=")[^"]*"', rb'\1Other"', data)
+ zo.writestr(it, data, compress_type=zipfile.ZIP_STORED if it.filename == "mimetype" else zipfile.ZIP_DEFLATED)
+ zo.close()
+
+def rewrite(src, dst, fn):
+ zi = zipfile.ZipFile(os.path.join(here, src)); zo = zipfile.ZipFile(os.path.join(here, dst), "w")
+ for it in zi.infolist():
+ data = zi.read(it.filename)
+ if it.filename == "styles.xml":
+ data = fn(data.decode("utf-8")).encode("utf-8")
+ zo.writestr(it, data, compress_type=zipfile.ZIP_STORED if it.filename == "mimetype" else zipfile.ZIP_DEFLATED)
+ zo.close()
+
+def sub1(t, old, new):
+ assert t.count(old) == 1, (old, t.count(old))
+ return t.replace(old, new)
+
+def dp(t, name):
+ m = re.search(r'<style:style style:name="%s" style:family="drawing-page">.*?</style:style>' % name, t)
+ assert m, name
+ return m.group(0)
+
+def edges():
+ # unresolved names: gradient (P_gradient, P_shared, P_shared2), hatch (P_hatch), transparency gradient only (P_gradient_tgrad)
+ def unknown(t):
+ t = sub1(t, dp(t, "Mdp3"), dp(t, "Mdp3").replace('"Gradient_20_1"', '"No_20_Such"'))
+ t = sub1(t, dp(t, "Mdp6"), dp(t, "Mdp6").replace('"Red_20_90_20_Degrees_20_Crossed_20_1"', '"No_20_Such"'))
+ return sub1(t, dp(t, "Mdp5"), dp(t, "Mdp5").replace('draw:opacity-name="TG1"', 'draw:opacity-name="No_20_Such"'))
+ rewrite("foreign-v10.odt", "edge-unknown-name.odt", unknown)
+ # empty properties element (P_gradient_transp), style without properties element (P_solid_transp)
+ def empty(t):
+ t = sub1(t, dp(t, "Mdp4"), '<style:style style:name="Mdp4" style:family="drawing-page"><style:drawing-page-properties/></style:style>')
+ return sub1(t, dp(t, "Mdp2"), '<style:style style:name="Mdp2" style:family="drawing-page"/>')
+ rewrite("foreign-v10.odt", "edge-empty.odt", empty)
+ # master page naming a drawing page style that is not defined (P_hatch)
+ rewrite("foreign-v10.odt", "edge-undefined.odt", lambda t: sub1(t, 'style:page-layout-name="Mpm7" draw:style-name="Mdp6"', 'style:page-layout-name="Mpm7" draw:style-name="No_20_Such"'))
+ # draw:fill="none" next to the page layout's fo:background-color (Standard, P_solid)
+ rewrite("foreign-v10.odt", "edge-none.odt", lambda t: sub1(t, dp(t, "Mdp1"), dp(t, "Mdp1").replace('draw:fill="solid"', 'draw:fill="none"')))
+ # drawing page style among the common styles, before the hatch it names (P_hatch)
+ def common(t):
+ d = dp(t, "Mdp6")
+ return sub1(sub1(t, d, ""), "<office:styles>", "<office:styles>" + d)
+ rewrite("foreign-v10.odt", "edge-common.odt", common)
+ # both forms disagree: page layouts keep the gradient, the drawing page says solid red (P_gradient, P_shared, P_shared2);
+ # unusable drawing page next to a usable page layout fill (P_hatch_nobg, First Page)
+ def both(t):
+ t = sub1(t, dp(t, "Mdp3"), '<style:style style:name="Mdp3" style:family="drawing-page"><style:drawing-page-properties draw:fill="solid" draw:fill-color="#ff0000"/></style:style>')
+ return sub1(t, dp(t, "Mdp7"), dp(t, "Mdp7").replace('"Red_20_90_20_Degrees_20_Crossed_20_1"', '"No_20_Such"'))
+ rewrite("foreign-v11.odt", "edge-both.odt", both)
+ # page layout shared by a master page with a drawing page fill and one without (P_shared2; P_bitmap_stretch moved to the
+ # tile layout): the second keeps the page layout's own fallback
+ def shared(t):
+ t = sub1(t, 'style:display-name="P_shared2" style:page-layout-name="Mpm13" draw:style-name="Mdp3"', 'style:display-name="P_shared2" style:page-layout-name="Mpm13"')
+ return sub1(t, 'style:display-name="P_bitmap_stretch" style:page-layout-name="Mpm10" draw:style-name="Mdp9"', 'style:display-name="P_bitmap_stretch" style:page-layout-name="Mpm9"')
+ rewrite("foreign-v10.odt", "edge-shared-layout.odt", shared)
+
+if __name__ == "__main__":
+ if sys.argv[3:4] != ["edges-only"]:
+ generate()
+ edges()
diff --git a/test/odf-validate/fixtures/page-fill-1_3/mkexpect.py b/test/odf-validate/fixtures/page-fill-1_3/mkexpect.py
new file mode 100644
index 0000000000..9aa0eb7053
--- /dev/null
+++ b/test/odf-validate/fixtures/page-fill-1_3/mkexpect.py
@@ -0,0 +1,87 @@
+# usage: python3 -I mkexpect.py <capture.json> <calc-capture.json>
+# <capture.json>: roundtrip.py --capture of aoo-src.odt with checks.json, taken with libraries built before the
+# drawing page fill import existed (aoo-src.odt carries the fills in the page layout, which those libraries read).
+# <calc-capture.json>: the same for calc-src.ods with checks-calc.json; it is the expectation for calc-src.ods and for
+# calc-drawing-page.ods, whose drawing page style must not change a Calc page style.
+# Writes the check files of this directory; each expectation below is that capture plus the changes noted.
+import copy, json, os, sys
+
+here = os.path.dirname(os.path.abspath(__file__))
+cap = json.load(open(sys.argv[1]))
+checks = json.load(open(os.path.join(here, "checks.json")))
+
+def write(name, values):
+ out = copy.deepcopy(checks)
+ for c in out:
+ c["expect"] = values[c["name"]]
+ json.dump(out, open(os.path.join(here, name), "w"), indent=1)
+ open(os.path.join(here, name), "a").write("\n")
+
+def page(v, name, style, color, transp):
+ v["page_fill"] = [[name, style, color, transp] if r[0] == name else r for r in v["page_fill"]]
+
+def drop(v, key, names):
+ v[key] = [r for r in v[key] if r[0] not in names]
+
+write("checks.json", cap)
+
+calc = json.load(open(sys.argv[2]))
+calc_checks = json.load(open(os.path.join(here, "checks-calc.json")))
+for c in calc_checks:
+ c["expect"] = calc[c["name"]]
+json.dump(calc_checks, open(os.path.join(here, "checks-calc.json"), "w"), indent=1)
+open(os.path.join(here, "checks-calc.json"), "a").write("\n")
+
+# The other suite's files: pages without a fill colour of their own (bitmap, none) show the document default fill
+# colour, which comes from its draw:default-style for graphics (#729fcf), not from the page fill.
+foreign = copy.deepcopy(cap)
+for r in foreign["page_fill"]:
+ if r[1] in ("BITMAP", "NONE"):
+ r[2] = 0x729FCF
+write("checks-foreign.json", foreign)
+
+# Its 1.3 and 1.4 strict modes write the header fill as fo:background-color only, so the header hatch is not in the
+# file: the header loads as solid #ffffcc with the default hatch colour and no hatch background (header fill is
+# not part of this change).
+strict = copy.deepcopy(foreign)
+strict["header_fill"] = [[True, "SOLID", 0xFFFFCC, 0x808080, False]]
+write("checks-foreign-strict.json", strict)
+
+# Unusable drawing page fills fall back to the page layout's fo:background-color.
+v = copy.deepcopy(strict)
+for n in ("P_gradient", "P_shared", "P_shared2"):
+ page(v, n, "SOLID", 0x800080, 0)
+drop(v, "page_gradient", ("P_gradient", "P_shared", "P_shared2"))
+page(v, "P_hatch", "SOLID", 0xFFFFCC, 0)
+drop(v, "page_hatch", ("P_hatch",))
+v["page_transparence_gradient"] = []
+write("checks-edge-unknown-name.json", v)
+
+v = copy.deepcopy(strict)
+page(v, "P_gradient_transp", "SOLID", 0x800080, 0)
+drop(v, "page_gradient", ("P_gradient_transp",))
+page(v, "P_solid_transp", "SOLID", 0x3355AA, 0)
+write("checks-edge-empty.json", v)
+
+v = copy.deepcopy(strict)
+page(v, "P_hatch", "SOLID", 0xFFFFCC, 0)
+drop(v, "page_hatch", ("P_hatch",))
+write("checks-edge-undefined.json", v)
+
+# A master page without a drawing page fill keeps the fallback of a page layout it shares with one that has it:
+# P_shared2 the solid #800080, P_bitmap_stretch the tiled style:background-image of P_bitmap_tile's layout, which loads
+# as a repeated bitmap at LEFT_TOP (as that element loads when it is the only page fill, e.g. in foreign-v10.odt with
+# libraries that do not read the drawing page form).
+v = copy.deepcopy(strict)
+page(v, "P_shared2", "SOLID", 0x800080, 0)
+drop(v, "page_gradient", ("P_shared2",))
+v["page_bitmap"] = [["P_bitmap_stretch", "REPEAT", True, "LEFT_TOP", 0, 0, 0, 0, True, 0, 0] if r[0] == "P_bitmap_stretch" else r for r in v["page_bitmap"]]
+write("checks-edge-shared-layout.json", v)
+
+# A usable drawing page fill wins over the page layout's draw:fill; an unusable one leaves it.
+v = copy.deepcopy(foreign)
+for n in ("P_gradient", "P_shared", "P_shared2"):
+ page(v, n, "SOLID", 0xFF0000, 0)
+drop(v, "page_gradient", ("P_gradient", "P_shared", "P_shared2"))
+write("checks-edge-both.json", v)
+print("done")
diff --git a/test/odf-validate/fixtures/page-fill-1_3/tile.png b/test/odf-validate/fixtures/page-fill-1_3/tile.png
new file mode 100644
index 0000000000..9ac8fdd049
Binary files /dev/null and b/test/odf-validate/fixtures/page-fill-1_3/tile.png differ
(openoffice) 03/04: xmloff: don't write draw:fill* on page layouts in default 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 db0824548179b48e137705599aba6a8a0bb5828e
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Oct 23 16:12:11 2026 -0400
xmloff: don't write draw:fill* on page layouts in default mode
Header and footer fills are still written.
---
main/xmloff/source/style/PageMasterExportPropMapper.cxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/main/xmloff/source/style/PageMasterExportPropMapper.cxx b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
index d5dce1806f..dadb5195f3 100644
--- a/main/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/main/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -553,6 +553,18 @@ void XMLPageMasterExportPropMapper::ContextFilter(
lcl_RemoveState(pPMFooterGraphicUrl);
}
+ // ext output writes the page fill as the drawing page style of the master page instead
+ if( SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ {
+ for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
+ {
+ if( aIter->mnIndex != -1 &&
+ ( aPropMapper->GetEntryType( aIter->mnIndex ) & XML_TYPE_PROP_MASK ) == XML_TYPE_PROP_PAGE_LAYOUT &&
+ aPropMapper->GetEntryAPIName( aIter->mnIndex ).matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "Fill" ) ) )
+ lcl_RemoveState( &(*aIter) );
+ }
+ }
+
if( pPMGridBaseWidth && pPMStandardMode )
lcl_RemoveState(pPMStandardMode);