From ef947839c9e6e5e86e11f7a7cbf13470010ca48f Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 15 Aug 2013 11:04:59 +0200 Subject: fdo#59524 Enable encryption for docx, pptx and standard OOXML formats Change-Id: Id00fde15188be3fb7209d8f14f2f2f07ebd211b0 --- .../config/fragments/filters/MS_Word_2007_XML.xcu | 2 +- filter/source/config/fragments/filters/OOXML_Text.xcu | 2 +- filter/source/config/fragments/filters/calc_OOXML.xcu | 2 +- .../filters/impress_MS_PowerPoint_2007_XML.xcu | 2 +- .../impress_MS_PowerPoint_2007_XML_AutoPlay.xcu | 2 +- .../source/config/fragments/filters/impress_OOXML.xcu | 2 +- .../fragments/filters/impress_OOXML_AutoPlay.xcu | 2 +- sfx2/source/dialog/filedlghelper.cxx | 18 +++++++++++++++++- 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu index 7c0b36ad5e93..6ad137f3408a 100644 --- a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu +++ b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER + IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.Writer.WriterFilter OXML diff --git a/filter/source/config/fragments/filters/OOXML_Text.xcu b/filter/source/config/fragments/filters/OOXML_Text.xcu index e53e1dddabc2..f1065e967e8e 100644 --- a/filter/source/config/fragments/filters/OOXML_Text.xcu +++ b/filter/source/config/fragments/filters/OOXML_Text.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER + IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.Writer.WriterFilter diff --git a/filter/source/config/fragments/filters/calc_OOXML.xcu b/filter/source/config/fragments/filters/calc_OOXML.xcu index f9ae1236e8e9..ce4bc40e21fe 100644 --- a/filter/source/config/fragments/filters/calc_OOXML.xcu +++ b/filter/source/config/fragments/filters/calc_OOXML.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.oox.xls.ExcelFilter OOXML diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu index 0e6d5a7b1fcf..14c3ca82a0f3 100644 --- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu +++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.oox.ppt.PowerPointImport diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_AutoPlay.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_AutoPlay.xcu index de5136960202..112e25425e1a 100644 --- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_AutoPlay.xcu +++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_AutoPlay.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED STARTPRESENTATION + IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED STARTPRESENTATION ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.oox.ppt.PowerPointImport diff --git a/filter/source/config/fragments/filters/impress_OOXML.xcu b/filter/source/config/fragments/filters/impress_OOXML.xcu index 5784ae1f88b6..d2e136649b96 100644 --- a/filter/source/config/fragments/filters/impress_OOXML.xcu +++ b/filter/source/config/fragments/filters/impress_OOXML.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED + IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.oox.ppt.PowerPointImport OOXML diff --git a/filter/source/config/fragments/filters/impress_OOXML_AutoPlay.xcu b/filter/source/config/fragments/filters/impress_OOXML_AutoPlay.xcu index 79fcb8e20450..44451a9d7752 100644 --- a/filter/source/config/fragments/filters/impress_OOXML_AutoPlay.xcu +++ b/filter/source/config/fragments/filters/impress_OOXML_AutoPlay.xcu @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED STARTPRESENTATION + IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED STARTPRESENTATION ENCRYPTION PASSWORDTOMODIFY com.sun.star.comp.oox.ppt.PowerPointImport diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index b9132ebef151..60de2670b61f 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -122,6 +122,21 @@ using namespace ::cppu; namespace sfx2 { +namespace +{ + bool lclSupportsOOXMLEncryption(OUString aFilterName) + { + return aFilterName == "Calc MS Excel 2007 XML" + || aFilterName == "MS Word 2007 XML" + || aFilterName == "Impress MS PowerPoint 2007 XML" + || aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay" + || aFilterName == "Calc Office Open XML" + || aFilterName == "Impress Office Open XML" + || aFilterName == "Impress Office Open XML AutoPlay" + || aFilterName == "Office Open XML Text"; + } +} + const OUString* GetLastFilterConfigId( FileDialogHelper::Context _eContext ) { static const OUString aSD_EXPORT_IDENTIFIER( "SdExportLastFilter" ); @@ -2719,7 +2734,8 @@ ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItem // TODO/LATER: The filters should show the password dialog themself in future if ( bMSType ) { - if ( pCurrentFilter->GetFilterName() == "Calc MS Excel 2007 XML" ) + // Check if filter supports OOXML encryption + if ( lclSupportsOOXMLEncryption( pCurrentFilter->GetFilterName() ) ) { ::comphelper::SequenceAsHashMap aHashData; aHashData[ OUString( "Password" ) ] <<= pPasswordRequest->getPassword(); -- cgit v1.2.3