summaryrefslogtreecommitdiff
path: root/xmloff/source/style/PageMasterImportContext.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/style/PageMasterImportContext.cxx')
-rw-r--r--xmloff/source/style/PageMasterImportContext.cxx69
1 files changed, 43 insertions, 26 deletions
diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx
index 685d82b9091a..2a50ae855719 100644
--- a/xmloff/source/style/PageMasterImportContext.cxx
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -201,24 +201,24 @@ void PageStyleContext::FillPropertySet_PageStyle(
// properties that need special handling because they need the used name to be translated first
struct ContextID_Index_Pair aContextIDs[] =
{
- { CTF_PM_FILLGRADIENTNAME, -1 },
- { CTF_PM_FILLTRANSNAME, -1 },
- { CTF_PM_FILLHATCHNAME, -1 },
- { CTF_PM_FILLBITMAPNAME, -1 },
+ { CTF_PM_FILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
+ { CTF_PM_FILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
+ { CTF_PM_FILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
+ { CTF_PM_FILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
// also need to special handling for header entries
- { CTF_PM_HEADERFILLGRADIENTNAME, -1 },
- { CTF_PM_HEADERFILLTRANSNAME, -1 },
- { CTF_PM_HEADERFILLHATCHNAME, -1 },
- { CTF_PM_HEADERFILLBITMAPNAME, -1 },
+ { CTF_PM_HEADERFILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
+ { CTF_PM_HEADERFILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
+ { CTF_PM_HEADERFILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
+ { CTF_PM_HEADERFILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
// also need to special handling for footer entries
- { CTF_PM_FOOTERFILLGRADIENTNAME, -1 },
- { CTF_PM_FOOTERFILLTRANSNAME, -1 },
- { CTF_PM_FOOTERFILLHATCHNAME, -1 },
- { CTF_PM_FOOTERFILLBITMAPNAME, -1 },
+ { CTF_PM_FOOTERFILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
+ { CTF_PM_FOOTERFILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
+ { CTF_PM_FOOTERFILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
+ { CTF_PM_FOOTERFILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
- {-1, -1}
+ {-1, -1, drawing::FillStyle::FillStyle_GRADIENT}
};
// the style families associated with the same index modulo 4
@@ -235,7 +235,19 @@ void PageStyleContext::FillPropertySet_PageStyle(
// get property set mapper
const rtl::Reference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper();
- Reference< XPropertySetInfo > xInfo;
+ Reference<XPropertySetInfo> const xInfo(xPropSet->getPropertySetInfo());
+
+ // don't look at the attributes, look at the property, could
+ // theoretically be inherited and we don't want to delete erroneously
+ drawing::FillStyle fillStyle{drawing::FillStyle_NONE};
+ drawing::FillStyle fillStyleHeader{drawing::FillStyle_NONE};
+ drawing::FillStyle fillStyleFooter{drawing::FillStyle_NONE};
+ if (xInfo->hasPropertyByName("FillStyle")) // SwXTextDefaults lacks it?
+ {
+ xPropSet->getPropertyValue("FillStyle") >>= fillStyle;
+ xPropSet->getPropertyValue("HeaderFillStyle") >>= fillStyleHeader;
+ xPropSet->getPropertyValue("FooterFillStyle") >>= fillStyleFooter;
+ }
// handle special attributes which have MID_FLAG_NO_PROPERTY_IMPORT set
for(sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++)
@@ -244,27 +256,37 @@ void PageStyleContext::FillPropertySet_PageStyle(
if(nIndex != -1)
{
+ drawing::FillStyle const* pFillStyle(nullptr);
switch(aContextIDs[i].nContextID)
{
case CTF_PM_FILLGRADIENTNAME:
case CTF_PM_FILLTRANSNAME:
case CTF_PM_FILLHATCHNAME:
case CTF_PM_FILLBITMAPNAME:
-
+ pFillStyle = &fillStyle;
+ [[fallthrough]];
case CTF_PM_HEADERFILLGRADIENTNAME:
case CTF_PM_HEADERFILLTRANSNAME:
case CTF_PM_HEADERFILLHATCHNAME:
case CTF_PM_HEADERFILLBITMAPNAME:
-
+ if (!pFillStyle) { pFillStyle = &fillStyleHeader; }
+ [[fallthrough]];
case CTF_PM_FOOTERFILLGRADIENTNAME:
case CTF_PM_FOOTERFILLTRANSNAME:
case CTF_PM_FOOTERFILLHATCHNAME:
case CTF_PM_FOOTERFILLBITMAPNAME:
{
+ if (!pFillStyle) { pFillStyle = &fillStyleFooter; }
struct XMLPropertyState& rState = GetProperties()[nIndex];
OUString sStyleName;
rState.maValue >>= sStyleName;
+ if (aContextIDs[i].nExpectedFillStyle != drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE
+ && aContextIDs[i].nExpectedFillStyle != *pFillStyle)
+ {
+ SAL_INFO("xmloff.style", "PageStyleContext: dropping fill named item: " << sStyleName);
+ break; // ignore it, it's not used
+ }
// translate the used name from ODF intern to the name used in the Model
sStyleName = GetImport().GetStyleDisplayName(aFamilies[i%4], sStyleName);
@@ -273,11 +295,6 @@ void PageStyleContext::FillPropertySet_PageStyle(
// set property
const OUString& rPropertyName = rMapper->GetEntryAPIName(rState.mnIndex);
- if(!xInfo.is())
- {
- xInfo = xPropSet->getPropertySetInfo();
- }
-
if(xInfo->hasPropertyByName(rPropertyName))
{
xPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
@@ -385,12 +402,12 @@ void PageStyleContext::FillPropertySet_PageStyle(
extern ContextID_Index_Pair const g_MasterPageContextIDs[] =
{
- { CTF_PM_FILLGRADIENTNAME, -1 },
- { CTF_PM_FILLTRANSNAME, -1 },
- { CTF_PM_FILLHATCHNAME, -1 },
- { CTF_PM_FILLBITMAPNAME, -1 },
+ { CTF_PM_FILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
+ { CTF_PM_FILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
+ { CTF_PM_FILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
+ { CTF_PM_FILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
- {-1, -1}
+ {-1, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE}
};
extern XmlStyleFamily const g_MasterPageFamilies[] =