diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/AllLangResTarget_sc.mk | 1 | ||||
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/protectiondlg.hrc | 38 | ||||
-rw-r--r-- | sc/source/ui/inc/protectiondlg.hxx | 23 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/protectiondlg.cxx | 89 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/protectiondlg.src | 125 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/protectsheetdlg.ui | 108 |
7 files changed, 114 insertions, 271 deletions
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index c25cc425baa8..2a3adcc47538 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -82,7 +82,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/miscdlgs/retypepassdlg.src \ sc/source/ui/miscdlgs/highred.src \ sc/source/ui/miscdlgs/conflictsdlg.src \ - sc/source/ui/miscdlgs/protectiondlg.src \ sc/source/ui/miscdlgs/acredlin.src \ sc/source/ui/formdlg/formdlgs.src \ sc/source/ui/formdlg/dwfunctr.src \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 89ad3020772d..48a8da0915bc 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -72,6 +72,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/insertsheet \ sc/uiconfig/scalc/ui/managenamesdialog \ sc/uiconfig/scalc/ui/printeroptions \ + sc/uiconfig/scalc/ui/protectsheetdlg \ sc/uiconfig/scalc/ui/sheetprintpage \ sc/uiconfig/scalc/ui/selectrange \ sc/uiconfig/scalc/ui/selectsource \ diff --git a/sc/source/ui/inc/protectiondlg.hrc b/sc/source/ui/inc/protectiondlg.hrc deleted file mode 100644 index 5c806de81111..000000000000 --- a/sc/source/ui/inc/protectiondlg.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sc.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 2 -#define BTN_HELP 3 - -#define BTN_PROTECT 4 -#define FT_PASSWORD1 5 -#define ED_PASSWORD1 6 -#define FT_PASSWORD2 7 -#define ED_PASSWORD2 8 -#define FL_OPTIONS 9 -#define FT_OPTIONS 10 -#define CLB_OPTIONS 11 - -#define ST_SELECT_PROTECTED_CELLS 50 -#define ST_SELECT_UNPROTECTED_CELLS 51 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/protectiondlg.hxx b/sc/source/ui/inc/protectiondlg.hxx index 2eb6abdb2e46..ad1afb983828 100644 --- a/sc/source/ui/inc/protectiondlg.hxx +++ b/sc/source/ui/inc/protectiondlg.hxx @@ -24,6 +24,7 @@ #include <vcl/button.hxx> #include <vcl/fixed.hxx> #include <vcl/edit.hxx> +#include <vcl/layout.hxx> #include <svx/checklbx.hxx> class Window; @@ -48,23 +49,19 @@ private: void EnableOptionalWidgets(bool bEnable = true); - CheckBox maBtnProtect; + CheckBox* m_pBtnProtect; - FixedText maPassword1Text; - Edit maPassword1Edit; - FixedText maPassword2Text; - Edit maPassword2Edit; + VclContainer* m_pPasswords; + VclContainer* m_pOptions; + Edit* m_pPassword1Edit; + Edit* m_pPassword2Edit; - FixedLine maOptionsLine; - FixedText maOptionsText; - SvxCheckListBox maOptionsListBox; + SvxCheckListBox* m_pOptionsListBox; - OKButton maBtnOk; - CancelButton maBtnCancel; - HelpButton maBtnHelp; + OKButton* m_pBtnOk; - String maSelectLockedCells; - String maSelectUnlockedCells; + OUString m_aSelectLockedCells; + OUString m_aSelectUnlockedCells; DECL_LINK( OKHdl, void* ); DECL_LINK( CheckBoxHdl, CheckBox* ); diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx index a5d2c15010f1..8e8245509ec2 100644 --- a/sc/source/ui/miscdlgs/protectiondlg.cxx +++ b/sc/source/ui/miscdlgs/protectiondlg.cxx @@ -19,7 +19,6 @@ #include "protectiondlg.hxx" -#include "protectiondlg.hrc" #include "scresid.hxx" #include "tabprotection.hxx" @@ -35,27 +34,21 @@ static const ScTableProtection::Option aOptions[] = { static const sal_uInt16 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)), +ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) + : ModalDialog( pParent, "ProtectSheetDialog", "modules/scalc/ui/protectsheetdlg.ui" ) +{ + get(m_pPasswords, "passwords"); + get(m_pOptions, "options"); + get(m_pBtnProtect, "protect"); + get(m_pOptionsListBox, "checklist"); + get(m_pPassword1Edit, "password1"); + get(m_pPassword2Edit, "password2"); + get(m_pBtnOk, "ok"); - maBtnOk (this, ScResId(BTN_OK)), - maBtnCancel (this, ScResId(BTN_CANCEL)), - maBtnHelp (this, ScResId(BTN_HELP)), + m_aSelectLockedCells = get<FixedText>("protected")->GetText(); + m_aSelectUnlockedCells = get<FixedText>("unprotected")->GetText(); - maSelectLockedCells(ScResId(ST_SELECT_PROTECTED_CELLS)), - maSelectUnlockedCells(ScResId(ST_SELECT_UNPROTECTED_CELLS)) -{ Init(); - FreeResource(); } ScTableProtectionDlg::~ScTableProtectionDlg() @@ -70,68 +63,62 @@ short ScTableProtectionDlg::Execute() void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData) { for (sal_uInt16 i = 0; i < nOptionCount; ++i) - maOptionsListBox.CheckEntryPos(i, rData.isOptionEnabled(aOptions[i])); + m_pOptionsListBox->CheckEntryPos(i, rData.isOptionEnabled(aOptions[i])); } void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const { - rData.setProtected(maBtnProtect.IsChecked()); + rData.setProtected(m_pBtnProtect->IsChecked()); // We assume that the two password texts match. - rData.setPassword(maPassword1Edit.GetText()); + rData.setPassword(m_pPassword1Edit->GetText()); for (sal_uInt16 i = 0; i < nOptionCount; ++i) - rData.setOption(aOptions[i], maOptionsListBox.IsChecked(i)); + rData.setOption(aOptions[i], m_pOptionsListBox->IsChecked(i)); } void ScTableProtectionDlg::Init() { Link aLink = LINK( this, ScTableProtectionDlg, CheckBoxHdl ); - maBtnProtect.SetClickHdl(aLink); + m_pBtnProtect->SetClickHdl(aLink); aLink = LINK( this, ScTableProtectionDlg, OKHdl ); - maBtnOk.SetClickHdl(aLink); + m_pBtnOk->SetClickHdl(aLink); aLink = LINK( this, ScTableProtectionDlg, PasswordModifyHdl ); - maPassword1Edit.SetModifyHdl(aLink); - maPassword2Edit.SetModifyHdl(aLink); + m_pPassword1Edit->SetModifyHdl(aLink); + m_pPassword2Edit->SetModifyHdl(aLink); - maOptionsListBox.SetUpdateMode(false); - maOptionsListBox.Clear(); + m_pOptionsListBox->SetUpdateMode(false); + m_pOptionsListBox->Clear(); - maOptionsListBox.InsertEntry(maSelectLockedCells); - maOptionsListBox.InsertEntry(maSelectUnlockedCells); + m_pOptionsListBox->InsertEntry(m_aSelectLockedCells); + m_pOptionsListBox->InsertEntry(m_aSelectUnlockedCells); - maOptionsListBox.CheckEntryPos(0, true); - maOptionsListBox.CheckEntryPos(1, true); + m_pOptionsListBox->CheckEntryPos(0, true); + m_pOptionsListBox->CheckEntryPos(1, true); - maOptionsListBox.SetUpdateMode(true); + m_pOptionsListBox->SetUpdateMode(true); // Set the default state of the dialog. - maBtnProtect.Check(true); - maPassword1Edit.GrabFocus(); + m_pBtnProtect->Check(true); + m_pPassword1Edit->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(); + m_pPasswords->Enable(bEnable); + m_pOptions->Enable(bEnable); + m_pOptionsListBox->Invalidate(); } IMPL_LINK( ScTableProtectionDlg, CheckBoxHdl, CheckBox*, pBtn ) { - if (pBtn == &maBtnProtect) + if (pBtn == m_pBtnProtect) { - bool bChecked = maBtnProtect.IsChecked(); + bool bChecked = m_pBtnProtect->IsChecked(); EnableOptionalWidgets(bChecked); - maBtnOk.Enable(bChecked); + m_pBtnOk->Enable(bChecked); } return 0; @@ -145,9 +132,9 @@ IMPL_LINK_NOARG(ScTableProtectionDlg, OKHdl) IMPL_LINK_NOARG(ScTableProtectionDlg, PasswordModifyHdl) { - String aPass1 = maPassword1Edit.GetText(); - String aPass2 = maPassword2Edit.GetText(); - maBtnOk.Enable(aPass1.Equals(aPass2)); + OUString aPass1 = m_pPassword1Edit->GetText(); + OUString aPass2 = m_pPassword2Edit->GetText(); + m_pBtnOk->Enable(aPass1 == aPass2); return 0; } diff --git a/sc/source/ui/miscdlgs/protectiondlg.src b/sc/source/ui/miscdlgs/protectiondlg.src deleted file mode 100644 index 29662ef1eb9c..000000000000 --- a/sc/source/ui/miscdlgs/protectiondlg.src +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "protectiondlg.hrc" - -ModalDialog RID_SCDLG_TABPROTECTION -{ - HelpID = "sc:ModalDialog:RID_SCDLG_TABPROTECTION"; - Text [ en-US ] = "Protect Sheet" ; - Size = MAP_APPFONT ( 250 , 135 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - - CheckBox BTN_PROTECT - { - HelpID = "sc:CheckBox:RID_SCDLG_TABPROTECTION:BTN_PROTECT"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 180 , 10 ); - - Text [ en-US ] = "P~rotect this sheet and the contents of protected cells" ; - }; - - FixedText FT_PASSWORD1 - { - Pos = MAP_APPFONT ( 11, 23 ); - Size = MAP_APPFONT ( 42, 10 ); - - Text [ en-US ] = "~Password" ; - }; - - Edit ED_PASSWORD1 - { - HelpID = "sc:Edit:RID_SCDLG_TABPROTECTION:ED_PASSWORD1"; - Border = TRUE; - PassWord = TRUE; - Pos = MAP_APPFONT ( 56, 22 ); - Size = MAP_APPFONT ( 75, 12 ); - }; - - FixedText FT_PASSWORD2 - { - Pos = MAP_APPFONT ( 11, 40 ); - Size = MAP_APPFONT ( 42, 10 ); - - Text [ en-US ] = "~Confirm" ; - }; - - Edit ED_PASSWORD2 - { - HelpID = "sc:Edit:RID_SCDLG_TABPROTECTION:ED_PASSWORD2"; - Border = TRUE; - PassWord = TRUE; - Pos = MAP_APPFONT ( 56, 39 ); - Size = MAP_APPFONT ( 75, 12 ); - }; - - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( 6, 60 ); - Size = MAP_APPFONT ( 180, 8 ); - - Text [ en-US ] = "Options"; - }; - - FixedText FT_OPTIONS - { - Pos = MAP_APPFONT ( 11, 74 ); - Size = MAP_APPFONT ( 140, 8 ); - - Text [ en-US ] = "Allow all users of this sheet to:"; - }; - - Control CLB_OPTIONS - { - Pos = MAP_APPFONT ( 11, 85 ); - Size = MAP_APPFONT ( 140, 40 ); - Border = TRUE ; - TabStop = TRUE ; - }; - - String ST_SELECT_PROTECTED_CELLS - { - Text [ en-US ] = "Select protected cells"; - }; - - String ST_SELECT_UNPROTECTED_CELLS - { - Text [ en-US ] = "Select unprotected cells"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/protectsheetdlg.ui b/sc/uiconfig/scalc/ui/protectsheetdlg.ui index be6f5f97788e..dc1b443f5158 100644 --- a/sc/uiconfig/scalc/ui/protectsheetdlg.ui +++ b/sc/uiconfig/scalc/ui/protectsheetdlg.ui @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkDialog" id="protectsheet"> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="ProtectSheetDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes">Protect Sheet</property> @@ -20,6 +21,8 @@ <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -69,16 +72,19 @@ <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="orientation">vertical</property> - <property name="spacing">10</property> + <property name="spacing">12</property> <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkCheckButton" id="checkbutton1"> + <object class="GtkCheckButton" id="protect"> <property name="label" translatable="yes">P_rotect this sheet and the contents of protected cells</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -94,11 +100,12 @@ </packing> </child> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkGrid" id="passwords"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="row_spacing">6</property> - <property name="column_spacing">20</property> + <property name="column_spacing">12</property> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> @@ -106,6 +113,7 @@ <property name="xalign">0</property> <property name="label" translatable="yes">_Password</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">password1</property> </object> <packing> <property name="left_attach">0</property> @@ -121,6 +129,7 @@ <property name="xalign">0</property> <property name="label" translatable="yes">_Confirm</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">password2</property> </object> <packing> <property name="left_attach">0</property> @@ -130,10 +139,13 @@ </packing> </child> <child> - <object class="GtkEntry" id="entry1"> + <object class="GtkEntry" id="password1"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="visibility">False</property> <property name="invisible_char">•</property> + <property name="width_chars">24</property> </object> <packing> <property name="left_attach">1</property> @@ -143,10 +155,13 @@ </packing> </child> <child> - <object class="GtkEntry" id="entry2"> + <object class="GtkEntry" id="password2"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="visibility">False</property> <property name="invisible_char">•</property> + <property name="width_chars">24</property> </object> <packing> <property name="left_attach">1</property> @@ -170,21 +185,27 @@ </packing> </child> <child> - <object class="GtkFrame" id="frame1"> + <object class="GtkFrame" id="options"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="top_padding">6</property> <property name="left_padding">12</property> <child> <object class="GtkBox" id="box3"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> @@ -193,6 +214,7 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Allow all users of this sheet to:</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> @@ -201,52 +223,52 @@ </packing> </child> <child> - <object class="GtkViewport" id="viewport1"> + <object class="svxlo-SvxCheckListBox" id="checklist:border"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">4</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="can_focus">False</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel" id="protected"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Select protected cells</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> - <object class="GtkBox" id="box4"> + <object class="GtkLabel" id="unprotected"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkCheckButton" id="checkbutton2"> - <property name="label" translatable="yes">Select protected cells</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="checkbutton3"> - <property name="label" translatable="yes">Select unprotected cells</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="label" translatable="yes">Select unprotected cells</property> </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">4</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> </object> |