[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - 3 commits - include/xmloff package/source sw/qa sw/source xmloff/inc xmloff/source xmlsecurity/qa
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 22 12:33:42 UTC 2020
include/xmloff/PageMasterStyleMap.hxx | 1
include/xmloff/XMLDrawingPageStyleContext.hxx | 44 ++
include/xmloff/XMLTextMasterPageContext.hxx | 6
include/xmloff/prstylei.hxx | 4
include/xmloff/txtimp.hxx | 2
package/source/manifest/ManifestImport.cxx | 306 ++++++++--------
package/source/manifest/ManifestImport.hxx | 71 ---
sw/qa/extras/odfexport/data/sw_hatch.odt |binary
sw/qa/extras/odfexport/odfexport.cxx | 11
sw/source/filter/xml/xmlfmt.cxx | 11
xmloff/inc/PageMasterImportContext.hxx | 4
xmloff/inc/PageMasterPropHdlFactory.hxx | 7
xmloff/inc/PageMasterPropMapper.hxx | 7
xmloff/source/draw/ximpstyl.cxx | 87 ++--
xmloff/source/style/PageMasterImportContext.cxx | 40 +-
xmloff/source/style/PageMasterPropHdlFactory.cxx | 2
xmloff/source/style/PageMasterPropMapper.cxx | 4
xmloff/source/style/PageMasterStyleMap.cxx | 30 +
xmloff/source/style/XMLPageExport.cxx | 4
xmloff/source/style/prstylei.cxx | 3
xmloff/source/style/xmlstyle.cxx | 2
xmloff/source/text/XMLTextMasterPageContext.cxx | 28 +
xmloff/source/text/txtimp.cxx | 24 +
xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt |binary
24 files changed, 416 insertions(+), 282 deletions(-)
New commits:
commit 9fc50174545bbb9968b47ca200da2816f45e72a1
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu May 7 18:18:43 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Jul 22 14:16:00 2020 +0200
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.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93670
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 4e98ba4ba5c17ab8ae1170662af645b9d2bfde84)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94587
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit ca9a719169fa444b5d82942ae1d5600fa0114002)
Change-Id: I4c86fa24c36407b64ce33f0890e5da8c26c5292a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99156
Tested-by: Michael Stahl <michael.stahl at cib.de>
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/include/xmloff/PageMasterStyleMap.hxx b/include/xmloff/PageMasterStyleMap.hxx
index 2b6a1b373768..93ec45b52362 100644
--- a/include/xmloff/PageMasterStyleMap.hxx
+++ b/include/xmloff/PageMasterStyleMap.hxx
@@ -187,6 +187,7 @@
#define CTF_PM_FTN_LINE_STYLE (XML_PM_CTF_START + 0x0067)
extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[];
+extern const XMLPropertyMapEntry g_XMLPageMasterDrawingPageStyleMap[];
extern const XMLPropertyMapEntry aXMLPageMasterHeaderImportStyleMap[];
extern const XMLPropertyMapEntry aXMLPageMasterFooterImportStyleMap[];
diff --git a/include/xmloff/XMLDrawingPageStyleContext.hxx b/include/xmloff/XMLDrawingPageStyleContext.hxx
new file mode 100644
index 000000000000..d0593b408976
--- /dev/null
+++ b/include/xmloff/XMLDrawingPageStyleContext.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlimppr.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/dllapi.h>
+
+class XMLOFF_DLLPUBLIC XMLDrawingPageStyleContext : public XMLPropStyleContext
+{
+public:
+ XMLDrawingPageStyleContext(SvXMLImport& rImport, sal_uInt16 nPrefix, OUString const& rLocalName,
+ css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrList,
+ SvXMLStylesContext& rStyles,
+ ContextID_Index_Pair const pContextIDs[],
+ sal_uInt16 const pFamilies[]);
+
+ virtual void
+ FillPropertySet(css::uno::Reference<css::beans::XPropertySet> const& rPropSet) override;
+
+private:
+ std::unique_ptr<ContextID_Index_Pair[]> m_pContextIDs;
+ sal_uInt16 const* const m_pFamilies;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLTextMasterPageContext.hxx b/include/xmloff/XMLTextMasterPageContext.hxx
index eab02ed18899..4580de105bf2 100644
--- a/include/xmloff/XMLTextMasterPageContext.hxx
+++ b/include/xmloff/XMLTextMasterPageContext.hxx
@@ -35,6 +35,7 @@ class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext
const OUString sFollowStyle;
OUString sFollow;
OUString sPageMasterName;
+ OUString m_sDrawingPageStyle;
css::uno::Reference < css::style::XStyle > xStyle;
@@ -75,6 +76,11 @@ public:
virtual void Finish( bool bOverwrite ) override;
};
+struct ContextID_Index_Pair;
+
+XMLOFF_DLLPUBLIC extern ContextID_Index_Pair const g_MasterPageContextIDs[];
+XMLOFF_DLLPUBLIC extern sal_uInt16 const g_MasterPageFamilies[];
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
index 1fbda3c11f77..50d41c6a4183 100644
--- a/include/xmloff/prstylei.hxx
+++ b/include/xmloff/prstylei.hxx
@@ -49,13 +49,15 @@ private:
XMLPropStyleContext(XMLPropStyleContext &) = delete;
void operator =(XMLPropStyleContext &) = delete;
-protected:
+public:
// Helper to check if the local maProperties contains the given
// FillStyle tag and if the FillStyle there is different from FillStyle_NONE
bool doNewDrawingLayerFillStyleDefinitionsExist(
const ::rtl::OUString& rFillStyleTag) const;
+protected:
+
// Helper which will deactivate all old fill definitions (identified by
// the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
// is done setting theindex to -1. It returns true when actually old fill
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 287413ba7f5c..0073f92f21da 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -505,6 +505,7 @@ public:
const OUString& rName ) const;
XMLPropStyleContext* FindPageMaster(
const OUString& rName ) const;
+ XMLPropStyleContext* FindDrawingPage(OUString const& rName) const;
const css::uno::Reference< css::container::XNameContainer> & GetParaStyles() const;
@@ -547,6 +548,7 @@ public:
static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&);
static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&);
static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&);
+ static SvXMLImportPropertyMapper* CreateDrawingPageExtPropMapper(SvXMLImport&);
SvI18NMap& GetRenameMap();
diff --git a/sw/qa/extras/odfexport/data/sw_hatch.odt b/sw/qa/extras/odfexport/data/sw_hatch.odt
new file mode 100644
index 000000000000..45e36c6ecc00
Binary files /dev/null and b/sw/qa/extras/odfexport/data/sw_hatch.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 9245c3c16716..fa43734d8f7d 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -56,6 +56,7 @@ public:
{
std::vector<const char*> aBlacklist = {
// These are known problems, they should be fixed one by one.
+ "sw_hatch.odt",
"fdo86963.odt",
"shape-relsize.odt",
"fdo60769.odt",
@@ -1493,6 +1494,16 @@ DECLARE_ODFEXPORT_TEST(testOdtBorderTypes, "border_types.odt")
} while (xParaEnum->hasMoreElements());
}
+DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage, "sw_hatch.odt")
+{
+ uno::Reference<container::XNameAccess> xStyles(getStyles("PageStyles"));
+ uno::Reference<beans::XPropertySet> xStyle(xStyles->getByName("Standard"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_HATCH, getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Blue -45 Degrees"), getProperty<OUString>(xStyle, "FillHatchName"));
+ CPPUNIT_ASSERT(!getProperty<sal_Bool>(xStyle, "FillBackground"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence"));
+}
+
DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt")
{
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index ec75d3b00951..5d9e6ab3bdfd 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -45,6 +45,8 @@
#include <xmloff/XMLTextMasterStylesContext.hxx>
#include <xmloff/XMLTextShapeStyleContext.hxx>
#include <xmloff/XMLGraphicsDefaultStyle.hxx>
+#include <xmloff/XMLDrawingPageStyleContext.hxx>
+#include <xmloff/XMLTextMasterPageContext.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "xmlimp.hxx"
#include "xmltbli.hxx"
@@ -754,6 +756,10 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext(
pStyle = new XMLTextShapeStyleContext( GetImport(), nPrefix,
rLocalName, xAttrList, *this, nFamily );
break;
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ pStyle = new XMLDrawingPageStyleContext(GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, g_MasterPageContextIDs, g_MasterPageFamilies);
+ break;
default:
pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily,
nPrefix,
@@ -853,6 +859,11 @@ rtl::Reference < SvXMLImportPropertyMapper > SwXMLStylesContext_Impl::GetImportP
else if( nFamily == XML_STYLE_FAMILY_TABLE_CELL )
xMapper = XMLTextImportHelper::CreateTableCellExtPropMapper(
const_cast<SwXMLStylesContext_Impl*>( this )->GetImport() );
+ else if (nFamily == XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID)
+ {
+ xMapper = XMLTextImportHelper::CreateDrawingPageExtPropMapper(
+ const_cast<SwXMLStylesContext_Impl*>(this)->GetImport());
+ }
else
xMapper = SvXMLStylesContext::GetImportPropertyMapper( nFamily );
return xMapper;
diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx
index ad0e483f7254..5235adb13844 100644
--- a/xmloff/inc/PageMasterImportContext.hxx
+++ b/xmloff/inc/PageMasterImportContext.hxx
@@ -50,8 +50,12 @@ public:
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
+ // don't call this
virtual void FillPropertySet(
const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
+ void FillPropertySet_PageStyle(
+ const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
+ XMLPropStyleContext * pDrawingPageStyle);
//text grid enhancement
virtual void SetDefaults() override;
diff --git a/xmloff/source/style/PageMasterPropHdlFactory.hxx b/xmloff/inc/PageMasterPropHdlFactory.hxx
similarity index 83%
rename from xmloff/source/style/PageMasterPropHdlFactory.hxx
rename to xmloff/inc/PageMasterPropHdlFactory.hxx
index b5852e7b9101..e8a4f8c83801 100644
--- a/xmloff/source/style/PageMasterPropHdlFactory.hxx
+++ b/xmloff/inc/PageMasterPropHdlFactory.hxx
@@ -25,11 +25,10 @@
class XMLPageMasterPropHdlFactory : public XMLPropertyHandlerFactory
{
public:
- XMLPageMasterPropHdlFactory();
- virtual ~XMLPageMasterPropHdlFactory() override;
+ XMLPageMasterPropHdlFactory();
+ virtual ~XMLPageMasterPropHdlFactory() override;
- virtual const XMLPropertyHandler*
- GetPropertyHandler( sal_Int32 nType ) const override;
+ virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 nType) const override;
};
#endif
diff --git a/xmloff/source/style/PageMasterPropMapper.hxx b/xmloff/inc/PageMasterPropMapper.hxx
similarity index 81%
rename from xmloff/source/style/PageMasterPropMapper.hxx
rename to xmloff/inc/PageMasterPropMapper.hxx
index bd1c9ab25f7b..fc054b2f167a 100644
--- a/xmloff/source/style/PageMasterPropMapper.hxx
+++ b/xmloff/inc/PageMasterPropMapper.hxx
@@ -26,10 +26,9 @@ class XMLPageMasterPropSetMapper : public XMLPropertySetMapper
{
public:
explicit XMLPageMasterPropSetMapper();
- XMLPageMasterPropSetMapper(
- const XMLPropertyMapEntry* pEntries,
- const rtl::Reference< XMLPropertyHandlerFactory >& rFactory );
- virtual ~XMLPageMasterPropSetMapper() override;
+ XMLPageMasterPropSetMapper(const XMLPropertyMapEntry* pEntries,
+ const rtl::Reference<XMLPropertyHandlerFactory>& rFactory);
+ virtual ~XMLPageMasterPropSetMapper() override;
};
#endif
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index fee2f44bd3fe..aed91ca6e61f 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -18,6 +18,7 @@
*/
#include "ximpstyl.hxx"
+#include <xmloff/XMLDrawingPageStyleContext.hxx>
#include <xmloff/XMLShapeStyleContext.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
@@ -122,7 +123,7 @@ SvXMLImportContextRef SdXMLDrawingPagePropertySetContext::CreateChildContext(
return xContext;
}
-class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
+class SdXMLDrawingPageStyleContext : public XMLDrawingPageStyleContext
{
public:
@@ -131,8 +132,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,
@@ -140,20 +140,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)
{
}
@@ -222,49 +259,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 =
diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx
index aa81fd62e8c6..7b2ecf0ce67e 100644
--- a/xmloff/source/style/PageMasterImportContext.cxx
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -33,6 +33,7 @@
#include <xmlsdtypes.hxx>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <xmloff/xmlerror.hxx>
+#include <xmloff/XMLTextMasterPageContext.hxx>
using namespace ::com::sun::star;
using namespace ::xmloff::token;
@@ -157,7 +158,14 @@ SvXMLImportContextRef PageStyleContext::CreateChildContext(
return XMLPropStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
}
-void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > & rPropSet)
+void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > &)
+{
+ assert(false); // dont call this virtual, call function below
+}
+
+void PageStyleContext::FillPropertySet_PageStyle(
+ const uno::Reference<beans::XPropertySet> & rPropSet,
+ XMLPropStyleContext *const pDrawingPageStyle)
{
// need to filter out old fill definitions when the new ones are used. The new
// ones are used when a FillStyle is defined
@@ -167,7 +175,9 @@ void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet
static ::rtl::OUString s_HeaderFillStyle("HeaderFillStyle");
static ::rtl::OUString s_FooterFillStyle("FooterFillStyle");
- if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
+ // note: the function must only check by property name, not any id/flag!
+ if (doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)
+ || (pDrawingPageStyle && pDrawingPageStyle->doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)))
{
deactivateOldFillStyleDefinitions(getStandardSet());
}
@@ -295,6 +305,12 @@ void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet
OSL_ENSURE(xImpPrMap.is(), "Got no SvXMLImportPropertyMapper (!)");
}
+ // pDrawingPageStyle overrides this
+ if (pDrawingPageStyle)
+ {
+ pDrawingPageStyle->FillPropertySet(rPropSet);
+ }
+
// old code, replaced by above stuff
// XMLPropStyleContext::FillPropertySet(rPropSet);
@@ -307,6 +323,24 @@ void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet
}
}
+extern ContextID_Index_Pair const g_MasterPageContextIDs[] =
+{
+ { CTF_PM_FILLGRADIENTNAME, -1 },
+ { CTF_PM_FILLTRANSNAME, -1 },
+ { CTF_PM_FILLHATCHNAME, -1 },
+ { CTF_PM_FILLBITMAPNAME, -1 },
+
+ {-1, -1}
+};
+
+extern sal_uInt16 const g_MasterPageFamilies[] =
+{
+ 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
+};
+
// text grid enhancement for better CJK support
//set default page layout style
void PageStyleContext::SetDefaults( )
@@ -317,7 +351,7 @@ void PageStyleContext::SetDefaults( )
Reference < XInterface > xInt = xFactory->createInstance( "com.sun.star.text.Defaults" );
Reference < beans::XPropertySet > xProperties ( xInt, UNO_QUERY );
if ( xProperties.is() )
- FillPropertySet ( xProperties );
+ FillPropertySet_PageStyle(xProperties, nullptr);
}
}
diff --git a/xmloff/source/style/PageMasterPropHdlFactory.cxx b/xmloff/source/style/PageMasterPropHdlFactory.cxx
index 6d0c5aa8098f..86c4cedab57c 100644
--- a/xmloff/source/style/PageMasterPropHdlFactory.cxx
+++ b/xmloff/source/style/PageMasterPropHdlFactory.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "PageMasterPropHdlFactory.hxx"
+#include <PageMasterPropHdlFactory.hxx>
#include <enummaps.hxx>
#include <xmloff/xmltypes.hxx>
#include <xmloff/xmltoken.hxx>
diff --git a/xmloff/source/style/PageMasterPropMapper.cxx b/xmloff/source/style/PageMasterPropMapper.cxx
index d0c0715e25bf..62e44d631055 100644
--- a/xmloff/source/style/PageMasterPropMapper.cxx
+++ b/xmloff/source/style/PageMasterPropMapper.cxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "PageMasterPropMapper.hxx"
+#include <PageMasterPropMapper.hxx>
#include <xmloff/PageMasterStyleMap.hxx>
-#include "PageMasterPropHdlFactory.hxx"
+#include <PageMasterPropHdlFactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 50b90fe35e7b..4e0cb0c9a9b3 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -26,6 +26,7 @@ using namespace ::xmloff::token;
#define MAP(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, false }
#define MAP_IMPORT(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, true }
+#define DPMAP_IMPORT(name,prefix,token,type,context) MAP_IMPORT(name, prefix, token, type|XML_TYPE_PROP_DRAWING_PAGE, context, SvtSaveOptions::ODFVER_010)
#define PLMAP(name,prefix,token,type,context) \
MAP(name,prefix,token,type|XML_TYPE_PROP_PAGE_LAYOUT,context, SvtSaveOptions::ODFVER_010)
#define PLMAP_12(name,prefix,token,type,context) \
@@ -124,6 +125,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
// Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of
// CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the
// 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER
+ // note: these are duplicated below, in g_XMLPageMasterDrawingPageStyleMap
PLMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ),
PLMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ),
PLMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ),
@@ -270,4 +272,32 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
{ nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false } // index 190
};
+XMLPropertyMapEntry const g_XMLPageMasterDrawingPageStyleMap[] =
+{
+ // ODF 1.3 OFFICE-3937 style of family "drawing-page" referenced from style:master-page
+ // duplication of relevant part of aXMLPageMasterStyleMap but as DP type
+ DPMAP_IMPORT("FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0),
+ DPMAP_IMPORT("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0),
+ DPMAP_IMPORT("FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0),
+ DPMAP_IMPORT("FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLGRADIENTNAME),
+ DPMAP_IMPORT("FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0),
+ DPMAP_IMPORT("FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLHATCHNAME),
+ DPMAP_IMPORT("FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0),
+ DPMAP_IMPORT("FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLBITMAPNAME),
+ DPMAP_IMPORT("FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0), /* exists in SW, too */
+ DPMAP_IMPORT("FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLTRANSNAME),
+ DPMAP_IMPORT("FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0),
+ DPMAP_IMPORT("FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0),
+ DPMAP_IMPORT("FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0),
+ DPMAP_IMPORT("FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0),
+ DPMAP_IMPORT("FillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FILLBITMAPMODE),
+ DPMAP_IMPORT("FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0),
+ DPMAP_IMPORT("FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0),
+ DPMAP_IMPORT("FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0),
+ DPMAP_IMPORT("FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_X),
+ DPMAP_IMPORT("FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_Y),
+
+ { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false }
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx
index dd599528bb6b..2529de2b8117 100644
--- a/xmloff/source/style/XMLPageExport.cxx
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -29,9 +29,9 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <xmloff/families.hxx>
#include <xmloff/xmlexp.hxx>
-#include "PageMasterPropHdlFactory.hxx"
+#include <PageMasterPropHdlFactory.hxx>
#include <xmloff/PageMasterStyleMap.hxx>
-#include "PageMasterPropMapper.hxx"
+#include <PageMasterPropMapper.hxx>
#include "PageMasterExportPropMapper.hxx"
using namespace ::com::sun::star;
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index d48f940b59dc..712da7fb075e 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -534,7 +534,8 @@ bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
{
if(maProperties.size() && rFillStyleTag.getLength())
{
- const rtl::Reference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
+ // no & to avoid non-obvious UAF due to the 2nd temp Reference
+ const rtl::Reference<XMLPropertySetMapper> rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper();
if(rMapper.is())
{
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 752c5bbf0701..ee53f1cbe275 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/style/XAutoStylesSupplier.hpp>
#include <com/sun/star/style/XAutoStyleFamily.hpp>
-#include "PageMasterPropMapper.hxx"
+#include <PageMasterPropMapper.hxx>
#include <o3tl/make_unique.hxx>
#include <svl/itemset.hxx>
#include <xmloff/nmspmap.hxx>
diff --git a/xmloff/source/text/XMLTextMasterPageContext.cxx b/xmloff/source/text/XMLTextMasterPageContext.cxx
index 7ade7edd7a38..f482874519f9 100644
--- a/xmloff/source/text/XMLTextMasterPageContext.cxx
+++ b/xmloff/source/text/XMLTextMasterPageContext.cxx
@@ -28,6 +28,7 @@
#include <xmloff/xmltoken.hxx>
#include <xmloff/XMLTextMasterPageContext.hxx>
#include <XMLTextHeaderFooterContext.hxx>
+#include <PageMasterImportContext.hxx>
#include <xmloff/xmlimp.hxx>
#include <PageMasterImportContext.hxx>
@@ -101,6 +102,11 @@ XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport,
sPageMasterName = xAttrList->getValueByIndex( i );
}
}
+ else if (XML_NAMESPACE_DRAW == nPrefix
+ && IsXMLToken(aLocalName, XML_STYLE_NAME))
+ {
+ m_sDrawingPageStyle = xAttrList->getValueByIndex(i);
+ }
}
if( !sDisplayName.isEmpty() )
@@ -254,14 +260,24 @@ void XMLTextMasterPageContext::Finish( bool bOverwrite )
if( xStyle.is() && (IsNew() || bOverwrite) )
{
Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ XMLPropStyleContext * pDrawingPageStyle(nullptr);
+ if (!m_sDrawingPageStyle.isEmpty())
+ {
+ pDrawingPageStyle = GetImport().GetTextImport()->FindDrawingPage(m_sDrawingPageStyle);
+ }
+ PageStyleContext * pPageLayout(nullptr);
if( !sPageMasterName.isEmpty() )
{
- XMLPropStyleContext* pStyle =
- GetImport().GetTextImport()->FindPageMaster( sPageMasterName );
- if (pStyle)
- {
- pStyle->FillPropertySet(xPropSet);
- }
+ pPageLayout = static_cast<PageStyleContext *>(GetImport().GetTextImport()->FindPageMaster(sPageMasterName));
+ }
+ if (pPageLayout)
+ {
+ pPageLayout->FillPropertySet_PageStyle(xPropSet, pDrawingPageStyle);
+ }
+ else if (pDrawingPageStyle)
+ {
+ // don't need to care about old background attributes in this case
+ pDrawingPageStyle->FillPropertySet(xPropSet);
}
Reference < XNameContainer > xPageStyles =
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 7dadde85e2a2..c74194a4a7e5 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -57,6 +57,9 @@
#include "XMLCalculationSettingsContext.hxx"
#include <XMLNumberStylesImport.hxx>
+#include <xmloff/PageMasterStyleMap.hxx>
+#include <PageMasterPropHdlFactory.hxx>
+#include <PageMasterPropMapper.hxx>
// XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)
#include <com/sun/star/beans/XPropertyState.hpp>
#include <txtlists.hxx>
@@ -1093,6 +1096,15 @@ SvXMLImportPropertyMapper*
return new XMLTextImportPropertyMapper( pPropMapper, rImport );
}
+SvXMLImportPropertyMapper*
+XMLTextImportHelper::CreateDrawingPageExtPropMapper(SvXMLImport& rImport)
+{
+ rtl::Reference<XMLPropertyHandlerFactory> const pFactory(new XMLPageMasterPropHdlFactory);
+ XMLPropertySetMapper *const pPropMapper(
+ new XMLPropertySetMapper(g_XMLPageMasterDrawingPageStyleMap, pFactory, false));
+ return new SvXMLImportPropertyMapper(pPropMapper, rImport);
+}
+
void XMLTextImportHelper::SetCursor( const Reference < XTextCursor > & rCursor )
{
m_xImpl->m_xCursor.set(rCursor);
@@ -2531,6 +2543,18 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
return pStyle;
}
+XMLPropStyleContext * XMLTextImportHelper::FindDrawingPage(OUString const& rName) const
+{
+ if (!m_xImpl->m_xAutoStyles.is())
+ {
+ return nullptr;
+ }
+ SvXMLStyleContext const* pStyle(
+ static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->FindStyleChildContext(
+ XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, rName, true));
+ assert(pStyle == nullptr || dynamic_cast<XMLPropStyleContext const*>(pStyle) != nullptr);
+ return const_cast<XMLPropStyleContext*>(static_cast<XMLPropStyleContext const*>(pStyle));
+}
void XMLTextImportHelper::PushListContext()
{
commit b65d956ecec1fc1acc2e037f426f3485d7b8fa0e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri May 15 15:12:23 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Jul 22 14:15:54 2020 +0200
package: OFFICE-3940 ODF 1.3 import of OpenPGP encryption
This was supposed to be implemented by commit
a7bf6488ebb544e1efaed0a1e53073df9cc2064d
"ODF1.3: import new OpenPGP encryption markup"
but it turns out that the ODF 1.3 cs01 schema differs from the
implementation:
in ODF 1.3 cs01 we have
<manifest:encrypted-key>
<manifest:encryption-method .../>
<manifest:keyinfo>
<manifest:PGPData>
</manifest:PGPData>
</manifest:keyinfo>
<manifest:CipherData>
</manifest:CipherData>
</manifest:encrypted-key>
whereas the implementation expects
<manifest:keyinfo>
<manifest:encrypted-key>
<manifest:encryption-method .../>
<manifest:PGPData>
</manifest:PGPData>
<manifest:CipherData>
</manifest:CipherData>
</manifest:encrypted-key>
</manifest:keyinfo>
Ideally the inner manifest:keyinfo should be manifest:KeyInfo but
not sure if that really matters.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94309
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 4f1b0f7d5235140611305b784b58f95fc5b8bd81)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94586
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit a3ef13b495d5898488ae52981bdaf8cf34db791c)
Change-Id: I407321c857e7b3ed9f4d04568ca2ea116764b3da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99155
Tested-by: Michael Stahl <michael.stahl at cib.de>
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 9982aae75209..425f3fe3f097 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -354,8 +354,8 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
doFileEntry(aConvertedAttribs);
else if (aConvertedName == gsManifestKeyInfoElement) //loext:keyinfo
doKeyInfoEntry(aConvertedAttribs);
- else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
- doKeyInfoEntry(aConvertedAttribs);
+ else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key
+ doEncryptedKey(aConvertedAttribs);
else
aStack.back().m_bValid = false;
break;
@@ -370,8 +370,12 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
doEncryptionData(aConvertedAttribs);
else if (aConvertedName == gsEncryptedKeyElement) //loext:encrypted-key
doEncryptedKey(aConvertedAttribs);
- else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key
- doEncryptedKey(aConvertedAttribs);
+ else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method
+ doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
+ else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
+ ;
+ else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData
+ ;
else
aStack.back().m_bValid = false;
break;
@@ -390,16 +394,15 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
doStartKeyAlg(aConvertedAttribs);
else if (aConvertedName == gsEncryptionMethodElement) //loext:encryption-method
doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute);
- else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method
- doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
else if (aConvertedName == gsKeyInfoElement) //loext:KeyInfo
doEncryptedKeyInfo(aConvertedAttribs);
else if (aConvertedName == gsCipherDataElement) //loext:CipherData
doEncryptedCipherData(aConvertedAttribs);
- else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData
- doEncryptedCipherData(aConvertedAttribs);
else if (aConvertedName == gsPgpDataElement13) //manifest:PGPData
doEncryptedPgpData(aConvertedAttribs);
+ else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
+ // ciphervalue action happens on endElement
+ aCurrentCharacters = "";
else
aStack.back().m_bValid = false;
break;
@@ -415,9 +418,6 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
else if (aConvertedName == gsCipherValueElement) //loext:CipherValue
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
- // ciphervalue action happens on endElement
- aCurrentCharacters = "";
else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
// ciphervalue action happens on endElement
aCurrentCharacters = "";
@@ -495,11 +495,16 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
// end element handling for elements with cdata
switch (nLevel) {
+ case 4: {
+ if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
+ doEncryptedCipherValue();
+ else
+ aStack.back().m_bValid = false;
+ break;
+ }
case 5: {
if (aConvertedName == gsCipherValueElement) //loext:CipherValue
doEncryptedCipherValue();
- else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
- doEncryptedCipherValue();
else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
doEncryptedKeyId();
else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
diff --git a/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt b/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt
index 6bcc43503267..e738c2f6df89 100644
Binary files a/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt and b/xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt differ
commit 85e074b4f8c99e1ca585ea1d398fdc16542eb9af
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 16 16:57:15 2018 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Jul 22 14:15:48 2020 +0200
new loplugin:conststringfield [Only ManifestImport.[ch]xx]
Look for const string fields which can be static, and
mostly convert them to OUStringLiteral
And add a getLength() method to OUStringLiteral to make
the transition easier.
Remove dead code in XclExpRoot::GenerateDefaultEncryptionData,
default password is never empty.
Reviewed-on: https://gerrit.libreoffice.org/59204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
(cherry picked from commit 60bc26354763fa3461db49a3e827da552484150d)
Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99154
Tested-by: Michael Stahl <michael.stahl at cib.de>
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index cd0034a2e1df..9982aae75209 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -33,83 +33,84 @@ using namespace com::sun::star::beans;
using namespace com::sun::star;
using namespace std;
+
+static const OUStringLiteral gsFileEntryElement ( ELEMENT_FILE_ENTRY );
+static const OUStringLiteral gsEncryptionDataElement( ELEMENT_ENCRYPTION_DATA );
+static const OUStringLiteral gsAlgorithmElement ( ELEMENT_ALGORITHM );
+static const OUStringLiteral gsStartKeyAlgElement ( ELEMENT_START_KEY_GENERATION );
+static const OUStringLiteral gsKeyDerivationElement( ELEMENT_KEY_DERIVATION );
+
+static const OUStringLiteral gsMediaTypeAttribute ( ATTRIBUTE_MEDIA_TYPE );
+static const OUStringLiteral gsVersionAttribute ( ATTRIBUTE_VERSION );
+static const OUStringLiteral gsFullPathAttribute ( ATTRIBUTE_FULL_PATH );
+static const OUStringLiteral gsSizeAttribute ( ATTRIBUTE_SIZE );
+static const OUStringLiteral gsSaltAttribute ( ATTRIBUTE_SALT );
+static const OUStringLiteral gsInitialisationVectorAttribute ( ATTRIBUTE_INITIALISATION_VECTOR );
+static const OUStringLiteral gsIterationCountAttribute ( ATTRIBUTE_ITERATION_COUNT );
+static const OUStringLiteral gsKeySizeAttribute ( ATTRIBUTE_KEY_SIZE );
+static const OUStringLiteral gsAlgorithmNameAttribute ( ATTRIBUTE_ALGORITHM_NAME );
+static const OUStringLiteral gsStartKeyAlgNameAttribute ( ATTRIBUTE_START_KEY_GENERATION_NAME );
+static const OUStringLiteral gsKeyDerivationNameAttribute ( ATTRIBUTE_KEY_DERIVATION_NAME );
+static const OUStringLiteral gsChecksumAttribute ( ATTRIBUTE_CHECKSUM );
+static const OUStringLiteral gsChecksumTypeAttribute ( ATTRIBUTE_CHECKSUM_TYPE );
+
+static const OUStringLiteral gsKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO );
+static const OUStringLiteral gsManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO );
+static const OUStringLiteral gsEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY );
+static const OUStringLiteral gsEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD );
+static const OUStringLiteral gsPgpDataElement ( ELEMENT_PGPDATA );
+static const OUStringLiteral gsPgpKeyIDElement ( ELEMENT_PGPKEYID );
+static const OUStringLiteral gsPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET );
+static const OUStringLiteral gsAlgorithmAttribute ( ATTRIBUTE_ALGORITHM );
+static const OUStringLiteral gsCipherDataElement ( ELEMENT_CIPHERDATA );
+static const OUStringLiteral gsCipherValueElement ( ELEMENT_CIPHERVALUE );
+
+static const OUStringLiteral gsManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO );
+static const OUStringLiteral gsEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 );
+static const OUStringLiteral gsEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 );
+static const OUStringLiteral gsPgpDataElement13 ( ELEMENT_PGPDATA13 );
+static const OUStringLiteral gsPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 );
+static const OUStringLiteral gsPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 );
+static const OUStringLiteral gsAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 );
+static const OUStringLiteral gsCipherDataElement13 ( ELEMENT_CIPHERDATA13 );
+static const OUStringLiteral gsCipherValueElement13 ( ELEMENT_CIPHERVALUE13 );
+
+static const OUStringLiteral gsFullPathProperty ( "FullPath" );
+static const OUStringLiteral gsMediaTypeProperty ( "MediaType" );
+static const OUStringLiteral gsVersionProperty ( "Version" );
+static const OUStringLiteral gsIterationCountProperty ( "IterationCount" );
+static const OUStringLiteral gsDerivedKeySizeProperty ( "DerivedKeySize" );
+static const OUStringLiteral gsSaltProperty ( "Salt" );
+static const OUStringLiteral gsInitialisationVectorProperty ( "InitialisationVector" );
+static const OUStringLiteral gsSizeProperty ( "Size" );
+static const OUStringLiteral gsDigestProperty ( "Digest" );
+static const OUStringLiteral gsEncryptionAlgProperty ( "EncryptionAlgorithm" );
+static const OUStringLiteral gsStartKeyAlgProperty ( "StartKeyAlgorithm" );
+static const OUStringLiteral gsDigestAlgProperty ( "DigestAlgorithm" );
+
+static const OUStringLiteral gsSHA256_URL_ODF12 ( SHA256_URL_ODF12 );
+static const OUStringLiteral gsSHA256_URL ( SHA256_URL );
+static const OUStringLiteral gsSHA1_Name ( SHA1_NAME );
+static const OUStringLiteral gsSHA1_URL ( SHA1_URL );
+
+static const OUStringLiteral gsSHA256_1k_URL ( SHA256_1K_URL );
+static const OUStringLiteral gsSHA1_1k_Name ( SHA1_1K_NAME );
+static const OUStringLiteral gsSHA1_1k_URL ( SHA1_1K_URL );
+
+static const OUStringLiteral gsBlowfish_Name ( BLOWFISH_NAME );
+static const OUStringLiteral gsBlowfish_URL ( BLOWFISH_URL );
+static const OUStringLiteral gsAES128_URL ( AES128_URL );
+static const OUStringLiteral gsAES192_URL ( AES192_URL );
+static const OUStringLiteral gsAES256_URL ( AES256_URL );
+
+static const OUStringLiteral gsPBKDF2_Name ( PBKDF2_NAME );
+static const OUStringLiteral gsPBKDF2_URL ( PBKDF2_URL );
+
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
: bIgnoreEncryptData ( false )
, bPgpEncryption ( false )
, nDerivedKeySize( 0 )
, rManVector ( rNewManVector )
-
- , sFileEntryElement ( ELEMENT_FILE_ENTRY )
- , sEncryptionDataElement( ELEMENT_ENCRYPTION_DATA )
- , sAlgorithmElement ( ELEMENT_ALGORITHM )
- , sStartKeyAlgElement ( ELEMENT_START_KEY_GENERATION )
- , sKeyDerivationElement( ELEMENT_KEY_DERIVATION )
-
- , sMediaTypeAttribute ( ATTRIBUTE_MEDIA_TYPE )
- , sVersionAttribute ( ATTRIBUTE_VERSION )
- , sFullPathAttribute ( ATTRIBUTE_FULL_PATH )
- , sSizeAttribute ( ATTRIBUTE_SIZE )
- , sSaltAttribute ( ATTRIBUTE_SALT )
- , sInitialisationVectorAttribute ( ATTRIBUTE_INITIALISATION_VECTOR )
- , sIterationCountAttribute ( ATTRIBUTE_ITERATION_COUNT )
- , sKeySizeAttribute ( ATTRIBUTE_KEY_SIZE )
- , sAlgorithmNameAttribute ( ATTRIBUTE_ALGORITHM_NAME )
- , sStartKeyAlgNameAttribute ( ATTRIBUTE_START_KEY_GENERATION_NAME )
- , sKeyDerivationNameAttribute ( ATTRIBUTE_KEY_DERIVATION_NAME )
- , sChecksumAttribute ( ATTRIBUTE_CHECKSUM )
- , sChecksumTypeAttribute ( ATTRIBUTE_CHECKSUM_TYPE )
-
- , sKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO )
- , sManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO )
- , sEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY )
- , sEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD )
- , sPgpDataElement ( ELEMENT_PGPDATA )
- , sPgpKeyIDElement ( ELEMENT_PGPKEYID )
- , sPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET )
- , sAlgorithmAttribute ( ATTRIBUTE_ALGORITHM )
- , sCipherDataElement ( ELEMENT_CIPHERDATA )
- , sCipherValueElement ( ELEMENT_CIPHERVALUE )
-
- , sManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO )
- , sEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 )
- , sEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 )
- , sPgpDataElement13 ( ELEMENT_PGPDATA13 )
- , sPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 )
- , sPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 )
- , sAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 )
- , sCipherDataElement13 ( ELEMENT_CIPHERDATA13 )
- , sCipherValueElement13 ( ELEMENT_CIPHERVALUE13 )
-
- , sFullPathProperty ( "FullPath" )
- , sMediaTypeProperty ( "MediaType" )
- , sVersionProperty ( "Version" )
- , sIterationCountProperty ( "IterationCount" )
- , sDerivedKeySizeProperty ( "DerivedKeySize" )
- , sSaltProperty ( "Salt" )
- , sInitialisationVectorProperty ( "InitialisationVector" )
- , sSizeProperty ( "Size" )
- , sDigestProperty ( "Digest" )
- , sEncryptionAlgProperty ( "EncryptionAlgorithm" )
- , sStartKeyAlgProperty ( "StartKeyAlgorithm" )
- , sDigestAlgProperty ( "DigestAlgorithm" )
-
- , sSHA256_URL_ODF12 ( SHA256_URL_ODF12 )
- , sSHA256_URL ( SHA256_URL )
- , sSHA1_Name ( SHA1_NAME )
- , sSHA1_URL ( SHA1_URL )
-
- , sSHA256_1k_URL ( SHA256_1K_URL )
- , sSHA1_1k_Name ( SHA1_1K_NAME )
- , sSHA1_1k_URL ( SHA1_1K_URL )
-
- , sBlowfish_Name ( BLOWFISH_NAME )
- , sBlowfish_URL ( BLOWFISH_URL )
- , sAES128_URL ( AES128_URL )
- , sAES192_URL ( AES192_URL )
- , sAES256_URL ( AES256_URL )
-
- , sPBKDF2_Name ( PBKDF2_NAME )
- , sPBKDF2_URL ( PBKDF2_URL )
{
aStack.reserve( 10 );
}
@@ -130,21 +131,21 @@ void ManifestImport::doFileEntry(StringHashMap &rConvertedAttribs)
{
aSequence.resize(PKG_SIZE_ENCR_MNFST);
- aSequence[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[sFullPathAttribute];
- aSequence[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[sMediaTypeAttribute];
+ aSequence[PKG_MNFST_FULLPATH].Name = gsFullPathProperty;
+ aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[gsFullPathAttribute];
+ aSequence[PKG_MNFST_MEDIATYPE].Name = gsMediaTypeProperty;
+ aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[gsMediaTypeAttribute];
- OUString sVersion = rConvertedAttribs[sVersionAttribute];
+ OUString sVersion = rConvertedAttribs[gsVersionAttribute];
if ( sVersion.getLength() ) {
- aSequence[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aSequence[PKG_MNFST_VERSION].Name = gsVersionProperty;
aSequence[PKG_MNFST_VERSION].Value <<= sVersion;
}
- OUString sSize = rConvertedAttribs[sSizeAttribute];
+ OUString sSize = rConvertedAttribs[gsSizeAttribute];
if ( sSize.getLength() ) {
sal_Int64 nSize = sSize.toInt64();
- aSequence[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
+ aSequence[PKG_MNFST_UCOMPSIZE].Name = gsSizeProperty;
aSequence[PKG_MNFST_UCOMPSIZE].Value <<= nSize;
}
}
@@ -229,22 +230,22 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
// If this element exists, then this stream is encrypted and we need
// to import the initialisation vector, salt and iteration count used
nDerivedKeySize = 0;
- OUString aString = rConvertedAttribs[sChecksumTypeAttribute];
+ OUString aString = rConvertedAttribs[gsChecksumTypeAttribute];
if ( !bIgnoreEncryptData ) {
- if ( aString == sSHA1_1k_Name || aString == sSHA1_1k_URL ) {
- aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ if ( aString == gsSHA1_1k_Name || aString == gsSHA1_1k_URL ) {
+ aSequence[PKG_MNFST_DIGESTALG].Name = gsDigestAlgProperty;
aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA1_1K;
- } else if ( aString == sSHA256_1k_URL ) {
- aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ } else if ( aString == gsSHA256_1k_URL ) {
+ aSequence[PKG_MNFST_DIGESTALG].Name = gsDigestAlgProperty;
aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA256_1K;
} else
bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData ) {
- aString = rConvertedAttribs[sChecksumAttribute];
+ aString = rConvertedAttribs[gsChecksumAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aSequence[PKG_MNFST_DIGEST].Name = gsDigestProperty;
aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer;
}
}
@@ -253,22 +254,22 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
{
if ( !bIgnoreEncryptData ) {
- OUString aString = rConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString == sBlowfish_Name || aString == sBlowfish_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ OUString aString = rConvertedAttribs[gsAlgorithmNameAttribute];
+ if ( aString == gsBlowfish_Name || aString == gsBlowfish_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
- } else if ( aString == sAES256_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES256_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
nDerivedKeySize = 32;
- } else if ( aString == sAES192_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES192_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
nDerivedKeySize = 24;
- } else if ( aString == sAES128_URL ) {
- aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ } else if ( aString == gsAES128_URL ) {
+ aSequence[PKG_MNFST_ENCALG].Name = gsEncryptionAlgProperty;
aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
nDerivedKeySize = 16;
@@ -276,10 +277,10 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
bIgnoreEncryptData = true;
if ( !bIgnoreEncryptData ) {
- aString = rConvertedAttribs[sInitialisationVectorAttribute];
+ aString = rConvertedAttribs[gsInitialisationVectorAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
+ aSequence[PKG_MNFST_INIVECTOR].Name = gsInitialisationVectorProperty;
aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer;
}
}
@@ -288,19 +289,19 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
{
if ( !bIgnoreEncryptData ) {
- OUString aString = rConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString == sPBKDF2_Name || aString == sPBKDF2_URL ) {
- aString = rConvertedAttribs[sSaltAttribute];
+ OUString aString = rConvertedAttribs[gsKeyDerivationNameAttribute];
+ if ( aString == gsPBKDF2_Name || aString == gsPBKDF2_URL ) {
+ aString = rConvertedAttribs[gsSaltAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::comphelper::Base64::decode(aDecodeBuffer, aString);
- aSequence[PKG_MNFST_SALT].Name = sSaltProperty;
+ aSequence[PKG_MNFST_SALT].Name = gsSaltProperty;
aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer;
- aString = rConvertedAttribs[sIterationCountAttribute];
- aSequence[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
+ aString = rConvertedAttribs[gsIterationCountAttribute];
+ aSequence[PKG_MNFST_ITERATION].Name = gsIterationCountProperty;
aSequence[PKG_MNFST_ITERATION].Value <<= aString.toInt32();
- aString = rConvertedAttribs[sKeySizeAttribute];
+ aString = rConvertedAttribs[gsKeySizeAttribute];
if ( aString.getLength() ) {
sal_Int32 nKey = aString.toInt32();
OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
@@ -310,7 +311,7 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
else if ( nDerivedKeySize != 16 )
OSL_ENSURE( false, "Default derived key length differs from the expected one!" );
- aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aSequence[PKG_MNFST_DERKEYSIZE].Name = gsDerivedKeySizeProperty;
aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize;
} else if ( bPgpEncryption ) {
if ( aString != "PGP" )
@@ -322,12 +323,12 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
void ManifestImport::doStartKeyAlg(StringHashMap &rConvertedAttribs)
{
- OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute];
- if (aString == sSHA256_URL || aString == sSHA256_URL_ODF12) {
- aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ OUString aString = rConvertedAttribs[gsStartKeyAlgNameAttribute];
+ if (aString == gsSHA256_URL || aString == gsSHA256_URL_ODF12) {
+ aSequence[PKG_MNFST_STARTALG].Name = gsStartKeyAlgProperty;
aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256;
- } else if ( aString == sSHA1_Name || aString == sSHA1_URL ) {
- aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ } else if ( aString == gsSHA1_Name || aString == gsSHA1_URL ) {
+ aSequence[PKG_MNFST_STARTALG].Name = gsStartKeyAlgProperty;
aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA1;
} else
bIgnoreEncryptData = true;
@@ -349,11 +350,11 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
break;
}
case 2: {
- if (aConvertedName == sFileEntryElement) //manifest:file-entry
+ if (aConvertedName == gsFileEntryElement) //manifest:file-entry
doFileEntry(aConvertedAttribs);
- else if (aConvertedName == sManifestKeyInfoElement) //loext:keyinfo
+ else if (aConvertedName == gsManifestKeyInfoElement) //loext:keyinfo
doKeyInfoEntry(aConvertedAttribs);
- else if (aConvertedName == sManifestKeyInfoElement13) //manifest:keyinfo
+ else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo
doKeyInfoEntry(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -365,11 +366,11 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sEncryptionDataElement) //manifest:encryption-data
+ else if (aConvertedName == gsEncryptionDataElement) //manifest:encryption-data
doEncryptionData(aConvertedAttribs);
- else if (aConvertedName == sEncryptedKeyElement) //loext:encrypted-key
+ else if (aConvertedName == gsEncryptedKeyElement) //loext:encrypted-key
doEncryptedKey(aConvertedAttribs);
- else if (aConvertedName == sEncryptedKeyElement13) //manifest:encrypted-key
+ else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key
doEncryptedKey(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -381,23 +382,23 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sAlgorithmElement) //manifest:algorithm,
+ else if (aConvertedName == gsAlgorithmElement) //manifest:algorithm,
doAlgorithm(aConvertedAttribs);
- else if (aConvertedName == sKeyDerivationElement) //manifest:key-derivation,
+ else if (aConvertedName == gsKeyDerivationElement) //manifest:key-derivation,
doKeyDerivation(aConvertedAttribs);
- else if (aConvertedName == sStartKeyAlgElement) //manifest:start-key-generation
+ else if (aConvertedName == gsStartKeyAlgElement) //manifest:start-key-generation
doStartKeyAlg(aConvertedAttribs);
- else if (aConvertedName == sEncryptionMethodElement) //loext:encryption-method
- doEncryptionMethod(aConvertedAttribs, sAlgorithmAttribute);
- else if (aConvertedName == sEncryptionMethodElement13) //manifest:encryption-method
- doEncryptionMethod(aConvertedAttribs, sAlgorithmAttribute13);
- else if (aConvertedName == sKeyInfoElement) //loext:KeyInfo
+ else if (aConvertedName == gsEncryptionMethodElement) //loext:encryption-method
+ doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute);
+ else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method
+ doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13);
+ else if (aConvertedName == gsKeyInfoElement) //loext:KeyInfo
doEncryptedKeyInfo(aConvertedAttribs);
- else if (aConvertedName == sCipherDataElement) //loext:CipherData
+ else if (aConvertedName == gsCipherDataElement) //loext:CipherData
doEncryptedCipherData(aConvertedAttribs);
- else if (aConvertedName == sCipherDataElement13) //manifest:CipherData
+ else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData
doEncryptedCipherData(aConvertedAttribs);
- else if (aConvertedName == sPgpDataElement13) //manifest:PGPData
+ else if (aConvertedName == gsPgpDataElement13) //manifest:PGPData
doEncryptedPgpData(aConvertedAttribs);
else
aStack.back().m_bValid = false;
@@ -409,18 +410,18 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sPgpDataElement) //loext:PGPData
+ else if (aConvertedName == gsPgpDataElement) //loext:PGPData
doEncryptedPgpData(aConvertedAttribs);
- else if (aConvertedName == sCipherValueElement) //loext:CipherValue
+ else if (aConvertedName == gsCipherValueElement) //loext:CipherValue
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sCipherValueElement13) //manifest:CipherValue
+ else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPgpKeyIDElement13) //manifest:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPGPKeyPacketElement13) //manifest:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
// ciphervalue action happens on endElement
aCurrentCharacters = "";
else
@@ -433,10 +434,10 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if (!aIter->m_bValid)
aStack.back().m_bValid = false;
- else if (aConvertedName == sPgpKeyIDElement) //loext:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement) //loext:PGPKeyID
// ciphervalue action happens on endElement
aCurrentCharacters = "";
- else if (aConvertedName == sPGPKeyPacketElement) //loext:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement) //loext:PGPKeyPacket
// ciphervalue action happens on endElement
aCurrentCharacters = "";
else
@@ -465,7 +466,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
OUString aConvertedName = ConvertName( aName );
if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName == aConvertedName ) {
- if ( aConvertedName == sFileEntryElement && aStack.back().m_bValid ) {
+ if ( aConvertedName == gsFileEntryElement && aStack.back().m_bValid ) {
// root folder gets KeyInfo entry if any, for PGP encryption
if (!bIgnoreEncryptData && !aKeys.empty() && aSequence[PKG_MNFST_FULLPATH].Value.get<OUString>() == "/" )
{
@@ -481,8 +482,8 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
aSequence.clear();
}
- else if ( (aConvertedName == sEncryptedKeyElement
- || aConvertedName == sEncryptedKeyElement13)
+ else if ( (aConvertedName == gsEncryptedKeyElement
+ || aConvertedName == gsEncryptedKeyElement13)
&& aStack.back().m_bValid ) {
if ( !bIgnoreEncryptData )
{
@@ -495,22 +496,22 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
// end element handling for elements with cdata
switch (nLevel) {
case 5: {
- if (aConvertedName == sCipherValueElement) //loext:CipherValue
+ if (aConvertedName == gsCipherValueElement) //loext:CipherValue
doEncryptedCipherValue();
- else if (aConvertedName == sCipherValueElement13) //manifest:CipherValue
+ else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue
doEncryptedCipherValue();
- else if (aConvertedName == sPgpKeyIDElement13) //manifest:PGPKeyID
+ else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID
doEncryptedKeyId();
- else if (aConvertedName == sPGPKeyPacketElement13) //manifest:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement13) //manifest:PGPKeyPacket
doEncryptedKeyPacket();
else
aStack.back().m_bValid = false;
break;
}
case 6: {
- if (aConvertedName == sPgpKeyIDElement) //loext:PGPKeyID
+ if (aConvertedName == gsPgpKeyIDElement) //loext:PGPKeyID
doEncryptedKeyId();
- else if (aConvertedName == sPGPKeyPacketElement) //loext:PGPKeyPacket
+ else if (aConvertedName == gsPGPKeyPacketElement) //loext:PGPKeyPacket
doEncryptedKeyPacket();
else
aStack.back().m_bValid = false;
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 6661dc70b4e6..19d426b14f25 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -61,77 +61,6 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum
sal_Int32 nDerivedKeySize;
::std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rManVector;
- const OUString sFileEntryElement;
- const OUString sEncryptionDataElement;
- const OUString sAlgorithmElement;
- const OUString sStartKeyAlgElement;
- const OUString sKeyDerivationElement;
-
- const OUString sMediaTypeAttribute;
- const OUString sVersionAttribute;
- const OUString sFullPathAttribute;
- const OUString sSizeAttribute;
- const OUString sSaltAttribute;
- const OUString sInitialisationVectorAttribute;
- const OUString sIterationCountAttribute;
- const OUString sKeySizeAttribute;
- const OUString sAlgorithmNameAttribute;
- const OUString sStartKeyAlgNameAttribute;
- const OUString sKeyDerivationNameAttribute;
- const OUString sChecksumAttribute;
- const OUString sChecksumTypeAttribute;
-
- const OUString sKeyInfoElement;
- const OUString sManifestKeyInfoElement;
- const OUString sEncryptedKeyElement;
- const OUString sEncryptionMethodElement;
- const OUString sPgpDataElement;
- const OUString sPgpKeyIDElement;
- const OUString sPGPKeyPacketElement;
- const OUString sAlgorithmAttribute;
- const OUString sCipherDataElement;
- const OUString sCipherValueElement;
-
- const OUString sManifestKeyInfoElement13;
- const OUString sEncryptedKeyElement13;
- const OUString sEncryptionMethodElement13;
- const OUString sPgpDataElement13;
- const OUString sPgpKeyIDElement13;
- const OUString sPGPKeyPacketElement13;
- const OUString sAlgorithmAttribute13;
- const OUString sCipherDataElement13;
- const OUString sCipherValueElement13;
-
- const OUString sFullPathProperty;
- const OUString sMediaTypeProperty;
- const OUString sVersionProperty;
- const OUString sIterationCountProperty;
- const OUString sDerivedKeySizeProperty;
- const OUString sSaltProperty;
- const OUString sInitialisationVectorProperty;
- const OUString sSizeProperty;
- const OUString sDigestProperty;
- const OUString sEncryptionAlgProperty;
- const OUString sStartKeyAlgProperty;
- const OUString sDigestAlgProperty;
-
- const OUString sSHA256_URL_ODF12;
- const OUString sSHA256_URL;
- const OUString sSHA1_Name;
- const OUString sSHA1_URL;
-
- const OUString sSHA256_1k_URL;
- const OUString sSHA1_1k_Name;
- const OUString sSHA1_1k_URL;
-
- const OUString sBlowfish_Name;
- const OUString sBlowfish_URL;
- const OUString sAES128_URL;
- const OUString sAES192_URL;
- const OUString sAES256_URL;
-
- const OUString sPBKDF2_Name;
- const OUString sPBKDF2_URL;
OUString PushNameAndNamespaces( const OUString& aName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs,
More information about the Libreoffice-commits
mailing list