This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch Pilot-Pirx-aes in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit a4d8ebdd5da8dc4f02881a84a168deeb9abb4b89 Author: Juergen Schmidt <[email protected]> AuthorDate: Thu Jun 12 12:46:11 2014 +0000 #125083# add new checkbox in options dialog load/save-general to enable ODF 1.2 encryption AES-256 git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1602143 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commit 972a6c9694b285646b61c6b1a5902c240ee1a6b0) --- main/cui/source/options/optsave.cxx | 11 ++++++++++ main/cui/source/options/optsave.hrc | 1 + main/cui/source/options/optsave.hxx | 1 + main/cui/source/options/optsave.src | 25 ++++++++++++++-------- main/cui/source/options/treeopt.cxx | 1 + main/helpcontent2/helpers/help_hid.lst | 1 + .../source/text/shared/optionen/01010200.xhp | 4 ++++ main/sfx2/inc/sfx2/sfxsids.hrc | 3 ++- main/sfx2/source/appl/appcfg.cxx | 20 +++++++++++++++++ 9 files changed, 57 insertions(+), 10 deletions(-) diff --git a/main/cui/source/options/optsave.cxx b/main/cui/source/options/optsave.cxx index d1212e6b70..4da9721fe2 100644 --- a/main/cui/source/options/optsave.cxx +++ b/main/cui/source/options/optsave.cxx @@ -178,6 +178,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ), aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ), aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ), + aODFEncryptionCB ( this, CUI_RES( BTN_ODFENCRYPTION ) ), aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ), aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ), aDocTypeFT ( this, CUI_RES( FT_APP ) ), @@ -384,6 +385,12 @@ sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet ) bModified |= sal_True; } + if ( aODFEncryptionCB.IsChecked() != aODFEncryptionCB.GetSavedValue() ) + { + rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_ODFENCRYPTION ), aODFEncryptionCB.IsChecked() ) ); + bModified |= sal_True; + } + if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() ) { rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) ); @@ -596,6 +603,9 @@ void SfxSaveTabPage::Reset( const SfxItemSet& ) aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT)); // aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE)); + // ODF encryption + aODFEncryptionCB.Check( !aSaveOpt.IsUseSHA1InODF12()); + // the pretty printing aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting()); // aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING )); @@ -620,6 +630,7 @@ void SfxSaveTabPage::Reset( const SfxItemSet& ) aDocInfoCB.SaveValue(); aBackupCB.SaveValue(); aWarnAlienFormatCB.SaveValue(); + aODFEncryptionCB.SaveValue(); aSizeOptimizationCB.SaveValue(); aAutoSaveCB.SaveValue(); aAutoSaveEdit.SaveValue(); diff --git a/main/cui/source/options/optsave.hrc b/main/cui/source/options/optsave.hrc index 19a95d4d0a..9f69de6045 100644 --- a/main/cui/source/options/optsave.hrc +++ b/main/cui/source/options/optsave.hrc @@ -40,6 +40,7 @@ #define BTN_WARNALIENFORMAT 22 #define FT_ODF_VERSION 23 #define LB_ODF_VERSION 24 +#define BTN_ODFENCRYPTION 25 #define GB_RELATIVE 40 #define BTN_RELATIVE_FSYS 41 diff --git a/main/cui/source/options/optsave.hxx b/main/cui/source/options/optsave.hxx index f4d821fe8d..6ee3081fcd 100644 --- a/main/cui/source/options/optsave.hxx +++ b/main/cui/source/options/optsave.hxx @@ -66,6 +66,7 @@ private: FixedLine aDefaultFormatFL; FixedText aODFVersionFT; ListBox aODFVersionLB; + CheckBox aODFEncryptionCB; CheckBox aSizeOptimizationCB; CheckBox aWarnAlienFormatCB; FixedText aDocTypeFT; diff --git a/main/cui/source/options/optsave.src b/main/cui/source/options/optsave.src index 7c3779b335..69b3fd65b8 100644 --- a/main/cui/source/options/optsave.src +++ b/main/cui/source/options/optsave.src @@ -156,36 +156,43 @@ TabPage RID_SFXPAGE_SAVE < "1.2 Extended (recommended)"; 0x7fffffff ; > ; }; }; + CheckBox BTN_ODFENCRYPTION + { + HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_ODFENCRYPTION"; + Pos = MAP_APPFONT ( 12 , 120 ) ; + Size = MAP_APPFONT ( 248 , 10 ) ; + Text [ en-US ] = "Enable AES-256 encryption (ODF 1.2)" ; + }; CheckBox BTN_NOPRETTYPRINTING { HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_NOPRETTYPRINTING"; - Pos = MAP_APPFONT ( 12 , 120 ) ; + Pos = MAP_APPFONT ( 12 , 131 ) ; Size = MAP_APPFONT ( 248 , 10 ) ; Text [ en-US ] = "Size optimization for ODF format" ; }; CheckBox BTN_WARNALIENFORMAT { HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_WARNALIENFORMAT"; - Pos = MAP_APPFONT ( 12 , 131 ) ; + Pos = MAP_APPFONT ( 12 , 142 ) ; Size = MAP_APPFONT ( 248 , 10 ) ; Text [ en-US ] = "Warn when not saving in ODF or default format" ; }; FixedText FT_APP { - Pos = MAP_APPFONT ( 12 , 142 ) ; + Pos = MAP_APPFONT ( 12 , 153 ) ; Size = MAP_APPFONT ( 120 , 8 ) ; Text [ en-US ] = "D~ocument type"; }; FixedText FT_FILTER { - Pos = MAP_APPFONT ( 136 , 142 ) ; + Pos = MAP_APPFONT ( 136 , 153 ) ; Size = MAP_APPFONT ( 120 , 8 ) ; Text [ en-US ] = "Always sa~ve as"; }; ListBox LB_APP { HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_APP"; - Pos = MAP_APPFONT ( 12 , 153 ) ; + Pos = MAP_APPFONT ( 12 , 164 ) ; Size = MAP_APPFONT ( 108 , 58 ) ; Border = TRUE; DropDown = TRUE; @@ -202,14 +209,14 @@ TabPage RID_SFXPAGE_SAVE }; FixedImage FI_FILTER { - Pos = MAP_APPFONT ( 129, 154 ) ; + Pos = MAP_APPFONT ( 129, 153 ) ; Size = MAP_APPFONT ( 6 , 6 ) ; Hide = TRUE; }; ListBox LB_FILTER { HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_FILTER"; - Pos = MAP_APPFONT ( 136 , 153 ) ; + Pos = MAP_APPFONT ( 136 , 164 ) ; Size = MAP_APPFONT ( 108 , 58 ) ; Border = TRUE; Sort = TRUE; @@ -217,13 +224,13 @@ TabPage RID_SFXPAGE_SAVE }; FixedImage FI_ODF_WARNING { - Pos = MAP_APPFONT ( 12, 169 ) ; + Pos = MAP_APPFONT ( 12, 180 ) ; Size = MAP_APPFONT ( 8 , 8 ) ; Hide = TRUE; }; FixedText FT_WARN { - Pos = MAP_APPFONT ( 23 , 169 ) ; + Pos = MAP_APPFONT ( 23 , 180 ) ; Size = MAP_APPFONT ( 239 , 8 ) ; Hide = TRUE; Text [ en-US ] = "Not using ODF 1.2 Extended may cause infomation to be lost."; diff --git a/main/cui/source/options/treeopt.cxx b/main/cui/source/options/treeopt.cxx index 57c540f0a0..e34638196d 100644 --- a/main/cui/source/options/treeopt.cxx +++ b/main/cui/source/options/treeopt.cxx @@ -1627,6 +1627,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) SID_SAVEREL_INET, SID_SAVEREL_FSYS, SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT, + SID_ATTR_ODFENCRYPTION, SID_ATTR_ODFENCRYPTION, 0 ); SFX_APP()->GetOptions(*pRet); break; diff --git a/main/helpcontent2/helpers/help_hid.lst b/main/helpcontent2/helpers/help_hid.lst index 4d09904247..e96ab2abbe 100644 --- a/main/helpcontent2/helpers/help_hid.lst +++ b/main/helpcontent2/helpers/help_hid.lst @@ -8141,6 +8141,7 @@ svx_CheckBox_RID_SFXPAGE_GENERAL_CB_USEDATA,733496360, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_AUTOSAVE,733479952, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_BACKUP,733479951, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_DOCINFO,733479950, +svx_CheckBox_RID_SFXPAGE_SAVE_BTN_ODFENCRYPTION,733479953, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_NOPRETTYPRINTING,733479956, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_RELATIVE_FSYS,733479977, svx_CheckBox_RID_SFXPAGE_SAVE_BTN_RELATIVE_INET,733479978, diff --git a/main/helpcontent2/source/text/shared/optionen/01010200.xhp b/main/helpcontent2/source/text/shared/optionen/01010200.xhp index 3385c6fada..2d4af7a744 100644 --- a/main/helpcontent2/source/text/shared/optionen/01010200.xhp +++ b/main/helpcontent2/source/text/shared/optionen/01010200.xhp @@ -148,6 +148,10 @@ <paragraph xml-lang="en-US" id="par_id8892483" role="paragraph" l10n="NEW">When you save a document, you can select whether to save the document in the format ODF 1.2, ODF 1.2 (Extended), or in the prior format ODF 1.0/1.1.</paragraph> <paragraph xml-lang="en-US" id="par_id0915200911205367" role="note" l10n="NEW">Currently, the ODF 1.2 (Extended) format enables files of Draw and Impress to contain comments. Those comments can be inserted by <item type="menuitem">Insert - Comment</item> in the latest software version. The comments get lost when loading files into prior software versions that were saved by the latest software version.</paragraph> <paragraph xml-lang="en-US" id="par_id7198400" role="paragraph" l10n="CHG"><ahelp hid=".">Some companies or organizations may require ODF documents in the ODF 1.0/1.1 format. You can select that format to save in the listbox. This older format cannot store all new features, so the new format ODF 1.2 (Extended) is recommended where possible.</ahelp></paragraph> +<bookmark xml-lang="en-US" branch="hid/cui:CheckBox:RID_SFXPAGE_SAVE:BTN_ODFENCRYPTION" id="bm_id3165414" localize="false"/> +<paragraph xml-lang="en-US" id="hd_id3164920" role="heading" level="3" l10n="NEW" + oldref="77">File encryption algorithm for ODF 1.2 format</paragraph> + <paragraph xml-lang="en-US" id="par_id3160488" role="paragraph" l10n="U" oldref="78"><ahelp hid="SVX_CHECKBOX_RID_SFXPAGE_SAVE_BTN_ODFENCRYPTION">Change the default file encryption from blowfish to AES-256 when ODF 1.2 is used.</ahelp> The default file encryption algorithm is blowfish but when ODF 1.2 is used the user can change the default to AES-256. Older encrypted documents can still be loaded but new encrypted documents can't be opened with older office versions. The AES-256 a [...] <bookmark xml-lang="en-US" branch="hid/cui:CheckBox:RID_SFXPAGE_SAVE:BTN_NOPRETTYPRINTING" id="bm_id3155414" localize="false"/> <paragraph xml-lang="en-US" id="hd_id3154920" role="heading" level="3" l10n="CHG" oldref="77">Size optimization for ODF format</paragraph> diff --git a/main/sfx2/inc/sfx2/sfxsids.hrc b/main/sfx2/inc/sfx2/sfxsids.hrc index 442cfd63ed..447c95303e 100644 --- a/main/sfx2/inc/sfx2/sfxsids.hrc +++ b/main/sfx2/inc/sfx2/sfxsids.hrc @@ -835,8 +835,9 @@ #define SID_OPT_FONT_ANTIALIASING_MINPIXELS (SID_OPTIONS_START + 96) //middle mouse button #define SID_OPT_MIDDLE_MOUSE (SID_OPTIONS_START + 97) -#define SID_ATTR_PRETTYPRINTING (SID_OPTIONS_START + 98) +#define SID_ATTR_PRETTYPRINTING (SID_OPTIONS_START + 98) #define SID_HELP_STYLESHEET (SID_OPTIONS_START + 99) +#define SID_ATTR_ODFENCRYPTION (SID_OPTIONS_START + 100) // slot IDs from SVX (svxids.hrc) --------------------------------------------- diff --git a/main/sfx2/source/appl/appcfg.cxx b/main/sfx2/source/appl/appcfg.cxx index 8ad0c77ab9..c704bca6be 100644 --- a/main/sfx2/source/appl/appcfg.cxx +++ b/main/sfx2/source/appl/appcfg.cxx @@ -205,6 +205,16 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) bRet = sal_False; } break; + case SID_ATTR_ODFENCRYPTION: + { + bRet = sal_True; + if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_USESHA1INODF12) && + !aSaveOptions.IsReadOnly(SvtSaveOptions::E_USEBLOWFISHINODF12)) + if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_ODFENCRYPTION ), + !(aSaveOptions.IsUseSHA1InODF12() && aSaveOptions.IsUseBlowfishInODF12())))) + bRet = sal_False; + } + break; case SID_ATTR_PRETTYPRINTING: { bRet = sal_True; @@ -563,6 +573,16 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aSaveOptions.SetBackup( ( (const SfxBoolItem*)pItem )->GetValue() ); } + // ODF Encryption + if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_ODFENCRYPTION ), sal_True, &pItem ) ) + { + DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); + sal_Bool bItemValue = static_cast< const SfxBoolItem*>(pItem)->GetValue(); + + aSaveOptions.SetUseSHA1InODF12( !bItemValue ); + aSaveOptions.SetUseBlowfishInODF12( !bItemValue ); + } + // PrettyPrinting if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), sal_True, &pItem ) ) {
