[Libreoffice-commits] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Nov 24 11:34:35 PST 2010


 sc/inc/tabprotection.hxx             |    2 
 sc/source/filter/excel/excdoc.cxx    |    4 -
 sc/source/filter/excel/xicontent.cxx |    4 -
 sc/source/ui/docshell/docsh.cxx      |    4 -
 sc/source/ui/view/tabvwsh3.cxx       |   81 -----------------------------------
 5 files changed, 95 deletions(-)

New commits:
commit 8f46c5581845413ee415abc7ac5bd092979396e5
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Nov 24 14:32:41 2010 -0500

    Remove the preprocessor guard for sheet protection options.
    
    This feature is now universally enabled, removing the unnecessary
    guard.

diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
index 692952e..54ace31 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 bd6d824..fa4c353 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 2f012ad..a76af13 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 18019b6..effef61 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 d12aa43..09d89f1 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();


More information about the Libreoffice-commits mailing list