summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-05-07 18:18:43 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-05-23 16:30:51 +0200
commitca9a719169fa444b5d82942ae1d5600fa0114002 (patch)
treedf31f449b817c2cd5ddf9f5572fa20aa6d796a94 /xmloff/source/draw
parenta97cbe7221c0175a4a2d342e2d1a62b06af4e13a (diff)
tdf#103602 xmloff,sw: ODF 1.3 import: PageStyle with drawing-page style
Associate a style of family "drawing-page" with a style:master-page. This fixes the small part of the draw:fill attribute problem that is covered by OFFICE-3937 in ODF 1.3. This is the import part. Change-Id: I4c86fa24c36407b64ce33f0890e5da8c26c5292a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93670 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 4e98ba4ba5c17ab8ae1170662af645b9d2bfde84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94587 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/ximpstyl.cxx87
1 files changed, 51 insertions, 36 deletions
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 929fa5b37aa2..528ad043aa2e 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -19,6 +19,7 @@
#include "ximpstyl.hxx"
#include <xmloff/maptype.hxx>
+#include <xmloff/XMLDrawingPageStyleContext.hxx>
#include <xmloff/XMLShapeStyleContext.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmlprmap.hxx>
@@ -124,7 +125,7 @@ SvXMLImportContextRef SdXMLDrawingPagePropertySetContext::CreateChildContext(
return xContext;
}
-class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
+class SdXMLDrawingPageStyleContext : public XMLDrawingPageStyleContext
{
public:
@@ -133,8 +134,7 @@ public:
sal_uInt16 nPrfx,
const OUString& rLName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
- SvXMLStylesContext& rStyles,
- sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID);
+ SvXMLStylesContext& rStyles);
SvXMLImportContextRef CreateChildContext(
sal_uInt16 nPrefix,
@@ -142,20 +142,57 @@ public:
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
virtual void Finish( bool bOverwrite ) override;
+};
- // #i35918#
- virtual void FillPropertySet( const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
+static const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
+static ContextID_Index_Pair const g_ContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
+{
+ { CTF_DASHNAME , -1 },
+ { CTF_LINESTARTNAME , -1 },
+ { CTF_LINEENDNAME , -1 },
+ { CTF_FILLGRADIENTNAME, -1 },
+ { CTF_FILLTRANSNAME , -1 },
+ { CTF_FILLHATCHNAME , -1 },
+ { CTF_FILLBITMAPNAME , -1 },
+ { -1, -1 }
+};
+static sal_uInt16 const g_Families[MAX_SPECIAL_DRAW_STYLES] =
+{
+ XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ XML_STYLE_FAMILY_SD_MARKER_ID,
+ 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
};
+XMLDrawingPageStyleContext::XMLDrawingPageStyleContext(
+ SvXMLImport& rImport,
+ sal_uInt16 const nPrefix,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ SvXMLStylesContext& rStyles,
+ ContextID_Index_Pair const pContextIDs[],
+ sal_uInt16 const pFamilies[])
+ : XMLPropStyleContext(rImport, nPrefix, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID)
+ , m_pFamilies(pFamilies)
+{
+ size_t size(1); // for the -1 entry
+ for (ContextID_Index_Pair const* pTemp(pContextIDs); pTemp->nContextID != -1; ++size, ++pTemp);
+ m_pContextIDs.reset(new ContextID_Index_Pair[size]);
+ std::memcpy(m_pContextIDs.get(), pContextIDs, size * sizeof(ContextID_Index_Pair));
+}
+
SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
SvXMLImport& rImport,
sal_uInt16 nPrfx,
const OUString& rLName,
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
- SvXMLStylesContext& rStyles,
- sal_uInt16 nFamily)
-: XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
+ SvXMLStylesContext& rStyles)
+ : XMLDrawingPageStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles,
+ g_ContextIDs, g_Families)
{
}
@@ -223,49 +260,27 @@ void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite )
}
+
// #i35918#
-void SdXMLDrawingPageStyleContext::FillPropertySet(
+void XMLDrawingPageStyleContext::FillPropertySet(
const Reference< beans::XPropertySet > & rPropSet )
{
- static const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
- struct ContextID_Index_Pair aContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
- {
- { CTF_DASHNAME , -1 },
- { CTF_LINESTARTNAME , -1 },
- { CTF_LINEENDNAME , -1 },
- { CTF_FILLGRADIENTNAME, -1 },
- { CTF_FILLTRANSNAME , -1 },
- { CTF_FILLHATCHNAME , -1 },
- { CTF_FILLBITMAPNAME , -1 },
- { -1, -1 }
- };
- static const sal_uInt16 aFamilies[MAX_SPECIAL_DRAW_STYLES] =
- {
- XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
- XML_STYLE_FAMILY_SD_MARKER_ID,
- XML_STYLE_FAMILY_SD_MARKER_ID,
- 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
- };
-
rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
GetStyles()->GetImportPropertyMapper( GetFamily() );
SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" );
if( xImpPrMap.is() )
- xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
+ xImpPrMap->FillPropertySet(GetProperties(), rPropSet, m_pContextIDs.get());
Reference< beans::XPropertySetInfo > xInfo;
- for( sal_uInt16 i=0; i<MAX_SPECIAL_DRAW_STYLES; i++ )
+ for (size_t i=0; m_pContextIDs[i].nContextID != -1; ++i)
{
- sal_Int32 nIndex = aContextIDs[i].nIndex;
+ sal_Int32 nIndex = m_pContextIDs[i].nIndex;
if( nIndex != -1 )
{
struct XMLPropertyState& rState = GetProperties()[nIndex];
OUString sStyleName;
rState.maValue >>= sStyleName;
- sStyleName = GetImport().GetStyleDisplayName( aFamilies[i],
+ sStyleName = GetImport().GetStyleDisplayName( m_pFamilies[i],
sStyleName );
// get property set mapper
rtl::Reference<XMLPropertySetMapper> rPropMapper =