You've already forked lazarus-ccr
spready: Minor improvements of worksheet protection. Add information on required packages to readme.txt.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5816 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,2 +1,7 @@
|
||||
spready is a relatively complex demonstration of the fpspreadsheet library
|
||||
and its visual controls.
|
||||
|
||||
Requirements:
|
||||
- fpspreadsheet trunk version (packages laz_fpspreadsheet,
|
||||
laz_fpspreadsheet_visual and laz_fpspreadsheet_crypto)
|
||||
- dcpcrypt (needed for laz_fpspreadsheet_crypto)
|
@ -1901,7 +1901,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object AcWorksheetProtection: TAction
|
||||
Category = 'Worksheet'
|
||||
Caption = 'Protect worksheet...'
|
||||
Caption = 'Worksheet protection...'
|
||||
ImageIndex = 73
|
||||
OnExecute = AcWorksheetProtectionExecute
|
||||
OnUpdate = AcWorksheetProtectionUpdate
|
||||
|
@ -883,13 +883,9 @@ procedure TMainForm.AcWorksheetProtectionExecute(Sender: TObject);
|
||||
var
|
||||
F: TWorksheetProtectionForm;
|
||||
begin
|
||||
if WorkbookSource.Worksheet.IsProtected then
|
||||
WorkbookSource.Worksheet.Protect(false)
|
||||
else
|
||||
begin
|
||||
F := TWorksheetProtectionForm.Create(nil);
|
||||
try
|
||||
F.IsProtected := WorkbookSource.Worksheet.IsProtected;
|
||||
F.IsProtected := not WorkbookSource.Worksheet.IsProtected;
|
||||
F.Protection := WorkbookSource.Worksheet.Protection;
|
||||
if F.ShowModal = mrOK then
|
||||
begin
|
||||
@ -899,7 +895,6 @@ begin
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.AcWorksheetProtectionUpdate(Sender: TObject);
|
||||
|
@ -37,7 +37,6 @@ object WorksheetProtectionForm: TWorksheetProtectionForm
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Protect worksheet and locked cells'
|
||||
OnChange = CbProtectChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object LblProtectionItems: TLabel
|
||||
|
@ -20,7 +20,6 @@ type
|
||||
CbSelectUnlockedCells: TCheckBox;
|
||||
LblProtectionItems: TLabel;
|
||||
ItemsPanel: TPanel;
|
||||
procedure CbProtectChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
function GetProtected: Boolean;
|
||||
@ -40,16 +39,6 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
procedure TWorksheetProtectionForm.CbProtectChange(Sender: TObject);
|
||||
var
|
||||
unlocked: Boolean;
|
||||
begin
|
||||
unlocked := not IsProtected;
|
||||
LblProtectionItems.Enabled := unlocked;
|
||||
CbSelectLockedCells.Enabled := unlocked;
|
||||
CbSelectUnlockedCells.Enabled := unlocked;
|
||||
end;
|
||||
|
||||
procedure TWorksheetProtectionForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Constraints.MinHeight := ItemsPanel.Height + CbProtect.Height +
|
||||
@ -64,12 +53,14 @@ end;
|
||||
function TWorksheetProtectionForm.GetProtections: TsWorksheetProtections;
|
||||
begin
|
||||
Result := DEFAULT_SHEET_PROTECTION;
|
||||
// NOTE: There's negative logic - if an option is checked it is ALLOWED, but
|
||||
// the set of protections contains the items which are FORBIDDEN.
|
||||
if CbSelectLockedCells.Checked then
|
||||
Include(Result, spSelectLockedCells) else
|
||||
Exclude(Result, spSelectLockedCells);
|
||||
Exclude(Result, spSelectLockedCells) else
|
||||
Include(Result, spSelectLockedCells);
|
||||
if CbSelectUnlockedCells.Checked then
|
||||
Include(Result, spSelectUnlockedCells) else
|
||||
Exclude(Result, spSelectUnlockedCells);
|
||||
Exclude(Result, spSelectUnlockedCells) else
|
||||
Include(Result, spSelectUnlockedCells);
|
||||
end;
|
||||
|
||||
procedure TWorksheetProtectionForm.SetProtected(AValue: Boolean);
|
||||
@ -79,8 +70,8 @@ end;
|
||||
|
||||
procedure TWorksheetProtectionForm.SetProtections(AValue: TsWorksheetProtections);
|
||||
begin
|
||||
CbSelectLockedCells.Checked := spSelectLockedCells in AValue;
|
||||
CbSelectUnlockedCells.Checked := spSelectUnlockedCells in AValue;
|
||||
CbSelectLockedCells.Checked := not (spSelectLockedCells in AValue);
|
||||
CbSelectUnlockedCells.Checked := not (spSelectUnlockedCells in AValue);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user