summaryrefslogtreecommitdiff
path: root/sc/source/ui/miscdlgs/protectiondlg.cxx
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-07-01 08:58:41 +0000
committerRelease Engineers <releng@openoffice.org>2009-07-01 08:58:41 +0000
commit43bafd9dd74489bac28edb5bbdb8a7d0b2442cc5 (patch)
tree79b0b96d1002e5c06d1c8a00d7f2d8fc721521e2 /sc/source/ui/miscdlgs/protectiondlg.cxx
parent6c06d29d13dedc08dd7cfbf74c8b8768b6297250 (diff)
CWS-TOOLING: integrate CWS scsheetprotection02
2009-06-18 16:48:14 +0200 kohei r273124 : #i102906# Fix a crasher when loading an xls document with unsupported encrytpion. 2009-06-15 14:02:00 +0200 dr r272982 : #i10000# compiler warnings 2009-04-13 23:06:21 +0200 kohei r270740 : Renamed SetData() to SetDataFromDocument(), in order to resolve name clash with the method of the same name in class Window. This caused a compiler warning on Solaris Intel. 2009-04-13 04:09:59 +0200 kohei r270729 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@270723 (milestone: DEV300:m46) 2009-02-23 16:13:45 +0100 kohei r268361 : added tabprotection.obj to the exception file list. Apparently the older versions of boost::shared_ptr rely on C++ exceptions for its implementation. 2009-02-18 19:59:05 +0100 kohei r268253 : Switched to using ::boost::shared_ptr to wrap a pimpl class, because using ::std::auto_ptr in this header breaks the build on win32. The MSVC implementation of ::std::auto_ptr has some weird quirks... 2009-02-17 21:47:13 +0100 kohei r268192 : fixed linkage issue due to library split. 2009-02-17 04:50:34 +0100 kohei r267842 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@267171 (milestone: DEV300:m41) 2009-02-17 02:36:10 +0100 kohei r267841 : reverted the last commit, to re-surrect the removed src files. 2009-02-03 22:02:34 +0100 kohei r267342 : removed the src files to prevent them from being entered into the translation process. The dialogs that need the strings are not yet enabled in the code, so their removal will not cause any harm. 2009-01-14 12:24:29 +0100 dr r266280 : #i10000# wntmsci12 compiler warnings #4 2009-01-14 09:35:46 +0100 dr r266267 : #i10000# wntmsci12 compiler warnings #3 2009-01-13 15:42:07 +0100 dr r266231 : #i10000# wntmsci12 compiler warnings #2 2009-01-13 13:18:28 +0100 dr r266216 : #i10000# wntmsci12 compiler warnings 2009-01-07 03:59:11 +0100 kohei r265943 : remove the fscking compiler warnings. 2009-01-06 15:55:32 +0100 kohei r265925 : removed compiler warnings that caused the buildbot build to fail.... 2009-01-05 23:24:59 +0100 kohei r265888 : Undoing my own local build fix to work around the libmoz... issue. 2008-12-30 21:39:58 +0100 kohei r265833 : Duh! Sheet protection was supposed to be disabled. :-/ 2008-12-23 20:25:55 +0100 kohei r265792 : recovered the code block that was accidentally removed during cws rebase. 2008-12-23 19:03:19 +0100 kohei r265791 : fixed breakage in ods export filter due to rebase to m38. 2008-12-23 16:41:49 +0100 kohei r265787 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@265758 (milestone: DEV300:m38) 2008-12-23 05:37:47 +0100 kohei r265768 : deliberately forget document and sheet passwords when importing from or exporting to excel, to emulate the current behavior. 2008-12-23 05:12:59 +0100 kohei r265767 : removed commented-out unused method ScDocument::SetAutoFilterFlags(). 2008-12-23 05:05:19 +0100 kohei r265766 : removed one duplicate method and made associated changes with the removal, and a little more code cleanup. 2008-12-23 04:24:58 +0100 kohei r265765 : a typo in in-line comment 2008-12-23 04:23:08 +0100 kohei r265764 : remove fprintf statement that blatantly prints out document encryption password to stdout. not a good practice. 2008-12-23 04:14:21 +0100 kohei r265763 : we actually don't want to clear all options, because if we do, then we would no longer be able to select any cells on a protected sheet. 2008-12-23 04:07:10 +0100 kohei r265762 : * minor code cleanup (indentation inconsistencies & use of tab) * fixed unprotecting a sheet with password to make it work again. 2008-12-23 03:22:50 +0100 kohei r265761 : reverted all the new functionalities to the existing ones, while keeping the new code in as much as I could. 2008-12-22 23:11:08 +0100 kohei r265760 : in xls export filter, renamed two unknown records into records of known name. 2008-12-22 22:34:50 +0100 kohei r265759 : temporarily disable password capability on file export for MS Excel 97. 2008-12-22 17:01:21 +0100 kohei r265754 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@264807 (milestone: DEV300:m37) 2008-11-26 03:12:58 +0100 kohei r264335 : recovered a method that was actually used. 2008-11-25 21:51:10 +0100 kohei r264334 : CWS-TOOLING: rebase CWS scsheetprotection02 to trunk@264325 (milestone: DEV300:m36) 2008-10-08 19:57:35 +0200 kohei r262094 : changed description string to make it less technical. 2008-10-01 05:56:58 +0200 kohei r261986 : migrated from the cvs-based cws. 2008-10-01 05:55:19 +0200 kohei r261985 : migrated from the cvs-based cws. 2008-10-01 05:55:00 +0200 kohei r261984 : migrated from the cvs-based cws.
Diffstat (limited to 'sc/source/ui/miscdlgs/protectiondlg.cxx')
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx164
1 files changed, 164 insertions, 0 deletions
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
new file mode 100644
index 000000000000..a5116ef61d66
--- /dev/null
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: protectiondlg.cxx,v $
+ * $Revision: 1.1.2.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "protectiondlg.hxx"
+#include "protectiondlg.hrc"
+#include "scresid.hxx"
+#include "tabprotection.hxx"
+
+#include <vcl/msgbox.hxx>
+
+
+// The order must match that of the list box.
+static const ScTableProtection::Option aOptions[] = {
+ ScTableProtection::SELECT_LOCKED_CELLS,
+ ScTableProtection::SELECT_UNLOCKED_CELLS,
+};
+static const USHORT nOptionCount = sizeof(aOptions)/sizeof(aOptions[0]);
+
+
+ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) :
+ ModalDialog(pParent, ScResId(RID_SCDLG_TABPROTECTION)),
+
+ maBtnProtect (this, ScResId(BTN_PROTECT)),
+ maPassword1Text (this, ScResId(FT_PASSWORD1)),
+ maPassword1Edit (this, ScResId(ED_PASSWORD1)),
+ maPassword2Text (this, ScResId(FT_PASSWORD2)),
+ maPassword2Edit (this, ScResId(ED_PASSWORD2)),
+ maOptionsLine (this, ScResId(FL_OPTIONS)),
+ maOptionsText (this, ScResId(FT_OPTIONS)),
+ maOptionsListBox(this, ScResId(CLB_OPTIONS)),
+
+ maBtnOk (this, ScResId(BTN_OK)),
+ maBtnCancel (this, ScResId(BTN_CANCEL)),
+ maBtnHelp (this, ScResId(BTN_HELP)),
+
+ maSelectLockedCells(ScResId(ST_SELECT_LOCKED_CELLS)),
+ maSelectUnlockedCells(ScResId(ST_SELECT_UNLOCKED_CELLS))
+{
+ Init();
+ FreeResource();
+}
+
+ScTableProtectionDlg::~ScTableProtectionDlg()
+{
+}
+
+short ScTableProtectionDlg::Execute()
+{
+ return ModalDialog::Execute();
+}
+
+void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData)
+{
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ maOptionsListBox.CheckEntryPos(i, rData.isOptionEnabled(aOptions[i]));
+}
+
+void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
+{
+ rData.setProtected(maBtnProtect.IsChecked());
+
+ // We assume that the two password texts match.
+ rData.setPassword(maPassword1Edit.GetText());
+
+ for (USHORT i = 0; i < nOptionCount; ++i)
+ rData.setOption(aOptions[i], maOptionsListBox.IsChecked(i));
+}
+
+void ScTableProtectionDlg::Init()
+{
+ Link aLink = LINK( this, ScTableProtectionDlg, CheckBoxHdl );
+ maBtnProtect.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, OKHdl );
+ maBtnOk.SetClickHdl(aLink);
+
+ aLink = LINK( this, ScTableProtectionDlg, PasswordModifyHdl );
+ maPassword1Edit.SetModifyHdl(aLink);
+ maPassword2Edit.SetModifyHdl(aLink);
+
+ maOptionsListBox.SetUpdateMode(false);
+ maOptionsListBox.Clear();
+
+ maOptionsListBox.InsertEntry(maSelectLockedCells);
+ maOptionsListBox.InsertEntry(maSelectUnlockedCells);
+
+ maOptionsListBox.CheckEntryPos(0, true);
+ maOptionsListBox.CheckEntryPos(1, true);
+
+ maOptionsListBox.SetUpdateMode(true);
+
+ // Set the default state of the dialog.
+ maBtnProtect.Check(true);
+ maPassword1Edit.GrabFocus();
+}
+
+void ScTableProtectionDlg::EnableOptionalWidgets(bool bEnable)
+{
+ maPassword1Text.Enable(bEnable);
+ maPassword1Edit.Enable(bEnable);
+ maPassword2Text.Enable(bEnable);
+ maPassword2Edit.Enable(bEnable);
+ maOptionsLine.Enable(bEnable);
+ maOptionsText.Enable(bEnable);
+
+ maOptionsListBox.Enable(bEnable);
+ maOptionsListBox.Invalidate();
+}
+
+IMPL_LINK( ScTableProtectionDlg, CheckBoxHdl, CheckBox*, pBtn )
+{
+ if (pBtn == &maBtnProtect)
+ {
+ bool bChecked = maBtnProtect.IsChecked();
+ EnableOptionalWidgets(bChecked);
+ maBtnOk.Enable(bChecked);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, OKHdl, OKButton*, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+IMPL_LINK( ScTableProtectionDlg, PasswordModifyHdl, Edit*, EMPTYARG )
+{
+ String aPass1 = maPassword1Edit.GetText();
+ String aPass2 = maPassword2Edit.GetText();
+ maBtnOk.Enable(aPass1.Equals(aPass2));
+ return 0;
+}