29#include <com/sun/star/frame/XModel.hpp>
30#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31#include <osl/diagnose.h>
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/beans/XPropertySetInfo.hpp>
36#include <com/sun/star/drawing/FillStyle.hpp>
37#include <com/sun/star/drawing/BitmapMode.hpp>
50 const OUString& rValue )
67 m_bIsFillStyleAlreadyConverted(false)
77 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
93 sal_Int32 nStartIndex (-1);
94 sal_Int32 nEndIndex (-1);
98 while ( nIndex < rMapper->GetEntryCount() && !bEnd)
118 GetProperties(), xImpPrMap, nStartIndex, nEndIndex, bHeader);
129 sal_Int32 nEndIndex (-1);
132 sal_Int16 nContextID;
133 while ( nIndex < rMapper->GetEntryCount() && !bEnd)
135 nContextID = rMapper->GetEntryContextId(
nIndex );
149 xImpPrMap, 0, nEndIndex,
Page);
162 const uno::Reference<beans::XPropertySet> & xPropSet,
169 static constexpr OUStringLiteral s_FillStyle(
u"FillStyle");
170 static constexpr OUStringLiteral s_HeaderFillStyle(
u"HeaderFillStyle");
171 static constexpr OUStringLiteral s_FooterFillStyle(
u"FooterFillStyle");
220 {-1, -1, drawing::FillStyle::FillStyle_GRADIENT}
233 xImpPrMap->FillPropertySet(
GetProperties(), xPropSet, aContextIDs);
237 Reference<XPropertySetInfo>
const xInfo(xPropSet->getPropertySetInfo());
244 if (xInfo->hasPropertyByName(
"FillStyle"))
246 xPropSet->getPropertyValue(
"FillStyle") >>= fillStyle;
247 xPropSet->getPropertyValue(
"HeaderFillStyle") >>= fillStyleHeader;
248 xPropSet->getPropertyValue(
"FooterFillStyle") >>= fillStyleFooter;
265 pFillStyle = &fillStyle;
271 if (!pFillStyle) { pFillStyle = &fillStyleHeader; }
278 if (!pFillStyle) { pFillStyle = &fillStyleFooter; }
283 if (aContextIDs[
i].nExpectedFillStyle != drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE
284 && aContextIDs[
i].nExpectedFillStyle != *pFillStyle)
286 SAL_INFO(
"xmloff.style",
"PageStyleContext: dropping fill named item: " << sStyleName);
290 sStyleName =
GetImport().GetStyleDisplayName(aFamilies[
i%4], sStyleName);
295 const OUString& rPropertyName = rMapper->GetEntryAPIName(rState.
mnIndex);
297 if(xInfo->hasPropertyByName(rPropertyName))
299 xPropSet->setPropertyValue(rPropertyName,
Any(sStyleName));
302 catch(css::lang::IllegalArgumentException& e)
304 Sequence<OUString>
aSeq { sStyleName };
307 aSeq,e.Message,
nullptr);
317 OSL_ENSURE(xImpPrMap.is(),
"Got no SvXMLImportPropertyMapper (!)");
321 if (pDrawingPageStyle)
327 && (
GetImport().isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_7x)
329 ||
GetImport().getGeneratorVersion() == SvXMLImport::AOO_4x))
331 bool isFullSize(
true);
333 xPropSet->getPropertyValue(
"FillStyle") >>= fillStyle;
334 if (
GetImport().isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_63x)
336 ||
GetImport().getGeneratorVersion() == SvXMLImport::AOO_4x)
339 if (fillStyle != drawing::FillStyle_NONE)
353 case drawing::FillStyle_NONE:
355 case drawing::FillStyle_SOLID:
356 case drawing::FillStyle_GRADIENT:
357 case drawing::FillStyle_HATCH:
360 case drawing::FillStyle_BITMAP:
362 drawing::BitmapMode bitmapMode{};
363 xPropSet->getPropertyValue(
"FillBitmapMode") >>= bitmapMode;
366 case drawing::BitmapMode_REPEAT:
369 case drawing::BitmapMode_STRETCH:
370 case drawing::BitmapMode_NO_REPEAT:
385 SAL_INFO(
"xmloff.style",
"FillPropertySet_PageStyle: Heuristically resetting BackgroundFullSize");
386 xPropSet->setPropertyValue(
"BackgroundFullSize",
uno::Any(isFullSize));
398 xPropSet->setPropertyValue(
"PageStyleLayout", aPageUsage);
409 {-1, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE}
424 Reference < XMultiServiceFactory >
xFactory (
GetImport().GetModel(), UNO_QUERY);
427 Reference < XInterface > xInt =
xFactory->createInstance(
"com.sun.star.text.Defaults" );
428 Reference < beans::XPropertySet > xProperties ( xInt, UNO_QUERY );
429 if ( xProperties.is() )
XmlStyleFamily const g_MasterPageFamilies[]
ContextID_Index_Pair const g_MasterPageContextIDs[]
#define CTF_PM_FILLTRANSNAME
#define CTF_PM_HEADERFILLHATCHNAME
#define CTF_PM_FILLHATCHNAME
#define CTF_PM_HEADERFLAG
#define CTF_PM_FOOTERFILLHATCHNAME
#define CTF_PM_HEADERFILLGRADIENTNAME
#define CTF_PM_FILLBITMAPNAME
#define CTF_PM_HEADERFILLTRANSNAME
#define CTF_PM_FOOTERFILLTRANSNAME
#define CTF_PM_FOOTERFILLBITMAPNAME
#define CTF_PM_HEADERFILLBITMAPNAME
#define CTF_PM_FOOTERFILLGRADIENTNAME
#define CTF_PM_FILLGRADIENTNAME
#define CTF_PM_FOOTERFLAG
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
void FillPropertySet_PageStyle(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, XMLPropStyleContext *pDrawingPageStyle)
virtual void SetDefaults() override
virtual ~PageStyleContext() override
bool m_bIsFillStyleAlreadyConverted
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
PageStyleContext(SvXMLImport &rImport, SvXMLStylesContext &rStyles, bool bDefaultStyle)
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
SvXMLImport & GetImport()
XmlStyleFamily GetFamily() const
bool IsDefaultStyle() const
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Imports the given value according to the XML-data-type corresponding to the derived class.
bool doNewDrawingLayerFillStyleDefinitionsExist(std::u16string_view rFillStyleTag) const
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
::std::vector< XMLPropertyState > & GetProperties()
void deactivateOldFillStyleDefinitions(const OldFillStyleDefinitionSet &rHashSetOfTags)
static const OldFillStyleDefinitionSet & getHeaderSet()
static const OldFillStyleDefinitionSet & getStandardSet()
static const OldFillStyleDefinitionSet & getFooterSet()
SvXMLStylesContext * GetStyles()
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
Reference< XSingleServiceFactory > xFactory
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
enum SAL_DLLPUBLIC_RTTI FillStyle
Handling of tokens in XML:
@ XML_PAGE_LAYOUT_PROPERTIES
This struct is used as an optional parameter to the static _FillPropertySet() methods.
Smart struct to transport an Any with an index to the appropriate property-name.
#define XMLERROR_STYLE_PROP_VALUE
#define XMLERROR_FLAG_WARNING
#define XML_ELEMENT(prefix, name)
#define XML_TYPE_PROP_PAGE_LAYOUT