Kaydet (Commit) f5d07409 authored tarafından Jürgen Schmidt's avatar Jürgen Schmidt

#125083# add new checkbox in options dialog load/save-general to enable ODF 1.2 encryption AES-256

üst 038e3ce8
...@@ -178,6 +178,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : ...@@ -178,6 +178,7 @@ SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ), aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ),
aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ), aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ),
aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ), aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ),
aODFEncryptionCB ( this, CUI_RES( BTN_ODFENCRYPTION ) ),
aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ), aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ),
aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ), aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ),
aDocTypeFT ( this, CUI_RES( FT_APP ) ), aDocTypeFT ( this, CUI_RES( FT_APP ) ),
...@@ -384,6 +385,12 @@ sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet ) ...@@ -384,6 +385,12 @@ sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet )
bModified |= sal_True; 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() ) if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() )
{ {
rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) ); rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) );
...@@ -596,6 +603,9 @@ void SfxSaveTabPage::Reset( const SfxItemSet& ) ...@@ -596,6 +603,9 @@ void SfxSaveTabPage::Reset( const SfxItemSet& )
aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT)); aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT));
// aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE)); // aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE));
// ODF encryption
aODFEncryptionCB.Check( !aSaveOpt.IsUseSHA1InODF12());
// the pretty printing // the pretty printing
aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting()); aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting());
// aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING )); // aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING ));
...@@ -620,6 +630,7 @@ void SfxSaveTabPage::Reset( const SfxItemSet& ) ...@@ -620,6 +630,7 @@ void SfxSaveTabPage::Reset( const SfxItemSet& )
aDocInfoCB.SaveValue(); aDocInfoCB.SaveValue();
aBackupCB.SaveValue(); aBackupCB.SaveValue();
aWarnAlienFormatCB.SaveValue(); aWarnAlienFormatCB.SaveValue();
aODFEncryptionCB.SaveValue();
aSizeOptimizationCB.SaveValue(); aSizeOptimizationCB.SaveValue();
aAutoSaveCB.SaveValue(); aAutoSaveCB.SaveValue();
aAutoSaveEdit.SaveValue(); aAutoSaveEdit.SaveValue();
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define BTN_WARNALIENFORMAT 22 #define BTN_WARNALIENFORMAT 22
#define FT_ODF_VERSION 23 #define FT_ODF_VERSION 23
#define LB_ODF_VERSION 24 #define LB_ODF_VERSION 24
#define BTN_ODFENCRYPTION 25
#define GB_RELATIVE 40 #define GB_RELATIVE 40
#define BTN_RELATIVE_FSYS 41 #define BTN_RELATIVE_FSYS 41
......
...@@ -66,6 +66,7 @@ private: ...@@ -66,6 +66,7 @@ private:
FixedLine aDefaultFormatFL; FixedLine aDefaultFormatFL;
FixedText aODFVersionFT; FixedText aODFVersionFT;
ListBox aODFVersionLB; ListBox aODFVersionLB;
CheckBox aODFEncryptionCB;
CheckBox aSizeOptimizationCB; CheckBox aSizeOptimizationCB;
CheckBox aWarnAlienFormatCB; CheckBox aWarnAlienFormatCB;
FixedText aDocTypeFT; FixedText aDocTypeFT;
......
...@@ -156,36 +156,43 @@ TabPage RID_SFXPAGE_SAVE ...@@ -156,36 +156,43 @@ TabPage RID_SFXPAGE_SAVE
< "1.2 Extended (recommended)"; 0x7fffffff ; > ; < "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 CheckBox BTN_NOPRETTYPRINTING
{ {
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE: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 ) ; Size = MAP_APPFONT ( 248 , 10 ) ;
Text [ en-US ] = "Size optimization for ODF format" ; Text [ en-US ] = "Size optimization for ODF format" ;
}; };
CheckBox BTN_WARNALIENFORMAT CheckBox BTN_WARNALIENFORMAT
{ {
HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE: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 ) ; Size = MAP_APPFONT ( 248 , 10 ) ;
Text [ en-US ] = "Warn when not saving in ODF or default format" ; Text [ en-US ] = "Warn when not saving in ODF or default format" ;
}; };
FixedText FT_APP FixedText FT_APP
{ {
Pos = MAP_APPFONT ( 12 , 142 ) ; Pos = MAP_APPFONT ( 12 , 153 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ; Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "D~ocument type"; Text [ en-US ] = "D~ocument type";
}; };
FixedText FT_FILTER FixedText FT_FILTER
{ {
Pos = MAP_APPFONT ( 136 , 142 ) ; Pos = MAP_APPFONT ( 136 , 153 ) ;
Size = MAP_APPFONT ( 120 , 8 ) ; Size = MAP_APPFONT ( 120 , 8 ) ;
Text [ en-US ] = "Always sa~ve as"; Text [ en-US ] = "Always sa~ve as";
}; };
ListBox LB_APP ListBox LB_APP
{ {
HelpID = "cui:ListBox:RID_SFXPAGE_SAVE: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 ) ; Size = MAP_APPFONT ( 108 , 58 ) ;
Border = TRUE; Border = TRUE;
DropDown = TRUE; DropDown = TRUE;
...@@ -202,14 +209,14 @@ TabPage RID_SFXPAGE_SAVE ...@@ -202,14 +209,14 @@ TabPage RID_SFXPAGE_SAVE
}; };
FixedImage FI_FILTER FixedImage FI_FILTER
{ {
Pos = MAP_APPFONT ( 129, 154 ) ; Pos = MAP_APPFONT ( 129, 153 ) ;
Size = MAP_APPFONT ( 6 , 6 ) ; Size = MAP_APPFONT ( 6 , 6 ) ;
Hide = TRUE; Hide = TRUE;
}; };
ListBox LB_FILTER ListBox LB_FILTER
{ {
HelpID = "cui:ListBox:RID_SFXPAGE_SAVE: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 ) ; Size = MAP_APPFONT ( 108 , 58 ) ;
Border = TRUE; Border = TRUE;
Sort = TRUE; Sort = TRUE;
...@@ -217,13 +224,13 @@ TabPage RID_SFXPAGE_SAVE ...@@ -217,13 +224,13 @@ TabPage RID_SFXPAGE_SAVE
}; };
FixedImage FI_ODF_WARNING FixedImage FI_ODF_WARNING
{ {
Pos = MAP_APPFONT ( 12, 169 ) ; Pos = MAP_APPFONT ( 12, 180 ) ;
Size = MAP_APPFONT ( 8 , 8 ) ; Size = MAP_APPFONT ( 8 , 8 ) ;
Hide = TRUE; Hide = TRUE;
}; };
FixedText FT_WARN FixedText FT_WARN
{ {
Pos = MAP_APPFONT ( 23 , 169 ) ; Pos = MAP_APPFONT ( 23 , 180 ) ;
Size = MAP_APPFONT ( 239 , 8 ) ; Size = MAP_APPFONT ( 239 , 8 ) ;
Hide = TRUE; Hide = TRUE;
Text [ en-US ] = "Not using ODF 1.2 Extended may cause information to be lost."; Text [ en-US ] = "Not using ODF 1.2 Extended may cause information to be lost.";
......
...@@ -1627,6 +1627,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) ...@@ -1627,6 +1627,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
SID_SAVEREL_INET, SID_SAVEREL_FSYS, SID_SAVEREL_INET, SID_SAVEREL_FSYS,
SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING,
SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
SID_ATTR_ODFENCRYPTION, SID_ATTR_ODFENCRYPTION,
0 ); 0 );
SFX_APP()->GetOptions(*pRet); SFX_APP()->GetOptions(*pRet);
break; break;
......
...@@ -837,6 +837,7 @@ ...@@ -837,6 +837,7 @@
#define SID_OPT_MIDDLE_MOUSE (SID_OPTIONS_START + 97) #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_HELP_STYLESHEET (SID_OPTIONS_START + 99)
#define SID_ATTR_ODFENCRYPTION (SID_OPTIONS_START + 100)
// slot IDs from SVX (svxids.hrc) --------------------------------------------- // slot IDs from SVX (svxids.hrc) ---------------------------------------------
......
...@@ -205,6 +205,16 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) ...@@ -205,6 +205,16 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
bRet = sal_False; bRet = sal_False;
} }
break; 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: case SID_ATTR_PRETTYPRINTING:
{ {
bRet = sal_True; bRet = sal_True;
...@@ -563,6 +573,16 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) ...@@ -563,6 +573,16 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
aSaveOptions.SetBackup( ( (const SfxBoolItem*)pItem )->GetValue() ); 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 // PrettyPrinting
if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), sal_True, &pItem ) ) if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), sal_True, &pItem ) )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment