summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-11-24 14:32:41 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-11-24 14:34:26 -0500
commit8f46c5581845413ee415abc7ac5bd092979396e5 (patch)
tree01ea958723bcd399948a22804c6efbf600761b73
parent507d282947b75684e9eac8a47d42ff97f585f650 (diff)
Remove the preprocessor guard for sheet protection options.
This feature is now universally enabled, removing the unnecessary guard.
-rw-r--r--sc/inc/tabprotection.hxx2
-rw-r--r--sc/source/filter/excel/excdoc.cxx4
-rw-r--r--sc/source/filter/excel/xicontent.cxx4
-rw-r--r--sc/source/ui/docshell/docsh.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx81
5 files changed, 0 insertions, 95 deletions
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
index 692952e6e..54ace318b 100644
--- a/sc/inc/tabprotection.hxx
+++ b/sc/inc/tabprotection.hxx
@@ -35,8 +35,6 @@
#include "global.hxx"
#include <boost/shared_ptr.hpp>
-#define ENABLE_SHEET_PROTECTION 1
-
class ScDocument;
class ScTableProtectionImpl;
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index bd6d824f2..fa4c35305 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -132,9 +132,7 @@ static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& s
{
aRecList.AppendNewRecord( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
aRecList.AppendNewRecord( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
-#if ENABLE_SHEET_PROTECTION
aRecList.AppendNewRecord( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
-#endif
}
aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() ); // XML_workbookProtection
@@ -474,9 +472,7 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
Add( new XclExpProtection(true) );
Add( new XclExpBoolRecord(0x00DD, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
Add( new XclExpBoolRecord(0x0063, pTabProtect->isOptionEnabled(ScTableProtection::OBJECTS)) );
-#if ENABLE_SHEET_PROTECTION
Add( new XclExpPassHash(pTabProtect->getPasswordHash(PASSHASH_XL)) );
-#endif
}
// local link table: EXTERNCOUNT, EXTERNSHEET
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 2f012adc6..a76af135c 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -1167,7 +1167,6 @@ void XclImpDocProtectBuffer::Apply() const
auto_ptr<ScDocProtection> pProtect(new ScDocProtection);
pProtect->setProtected(true);
-#if ENABLE_SHEET_PROTECTION
if (mnPassHash)
{
// 16-bit password pash.
@@ -1176,7 +1175,6 @@ void XclImpDocProtectBuffer::Apply() const
aPass[1] = mnPassHash & 0xFF;
pProtect->setPasswordHash(aPass, PASSHASH_XL);
}
-#endif
// document protection options
pProtect->setOption(ScDocProtection::STRUCTURE, mbDocProtect);
@@ -1272,7 +1270,6 @@ void XclImpSheetProtectBuffer::Apply() const
auto_ptr<ScTableProtection> pProtect(new ScTableProtection);
pProtect->setProtected(true);
-#if ENABLE_SHEET_PROTECTION
// 16-bit hash password
const sal_uInt16 nHash = itr->second.mnPasswordHash;
if (nHash)
@@ -1282,7 +1279,6 @@ void XclImpSheetProtectBuffer::Apply() const
aPass[1] = nHash & 0xFF;
pProtect->setPasswordHash(aPass, PASSHASH_XL);
}
-#endif
// sheet protection options
const sal_uInt16 nOptions = itr->second.mnOptions;
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 18019b6ee..effef615f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1577,7 +1577,6 @@ BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
-#if ENABLE_SHEET_PROTECTION
ScTabViewShell* pViewShell = GetBestViewShell();
bool bNeedsRehash = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_SHA1);
if (bNeedsRehash)
@@ -1590,7 +1589,6 @@ BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
// password re-type cancelled. Don't save the document.
return false;
}
-#endif
ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
@@ -2125,13 +2123,11 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
}
}
-#if ENABLE_SHEET_PROTECTION
if( bDoSave )
{
bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen( aDocument, PASSHASH_XL );
bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg( PASSHASH_XL );
}
-#endif
}
if( bDoSave )
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index d12aa430f..09d89f10c 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -1065,8 +1065,6 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
SCTAB nTab = GetViewData()->GetTabNo();
bool bOldProtection = pDoc->IsTabProtected(nTab);
-#if ENABLE_SHEET_PROTECTION
-
if( pReqArgs )
{
const SfxPoolItem* pItem;
@@ -1134,85 +1132,6 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
}
}
-#else
- auto_ptr<SfxPasswordDialog> pDlg;
- String aPassword;
- BOOL bCancel = FALSE;
- bool bNewProtection = ! bOldProtection;
-
- if( pReqArgs )
- {
- const SfxPoolItem* pItem;
- if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
- bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
- if( bNewProtection == bOldProtection )
- {
- rReq.Ignore();
- break;
- }
- }
-
- if ( bOldProtection)
- {
- // Unprotect a protected sheet.
-
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
- if (pProtect && pProtect->isProtectedWithPass())
- {
- String aText( ScResId(SCSTR_PASSWORDOPT) );
- pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
- pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
-
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
- }
-
- if (!pReqArgs)
- {
- rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
- rReq.Done();
- }
- }
- else
- {
- String aText( ScResId(SCSTR_PASSWORDOPT) );
-
- pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
- pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
- pDlg->SetMinLen( 0 );
- pDlg->SetHelpId( FID_PROTECT_TABLE );
- pDlg->SetEditHelpId( HID_PASSWD_TABLE );
- pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
-
- if (pDlg->Execute() == RET_OK)
- aPassword = pDlg->GetPassword();
- else
- bCancel = TRUE;
- }
-
- if( !bCancel )
- {
- if ( bOldProtection )
- Unprotect( nTab, aPassword );
- else
- {
- pScMod->InputEnterHandler();
-
- Protect( nTab, aPassword );
- }
-
- if( !pReqArgs )
- {
- rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
- rReq.Done();
- }
- }
-#endif
TabChanged();
UpdateInputHandler(true); // damit sofort wieder eingegeben werden kann
SelectionChanged();