Kaydet (Commit) ed51d060 authored tarafından Olivier Hallot's avatar Olivier Hallot Kaydeden (comit) Caolán McNamara

Widget for Calc protect cell tab page

* Translated some German comments to English (thanks to David E. Jourdain)
* Moved tab page .ui from sc/ to cui/
* Need to address text alignment on the right

Change-Id: I332c263bce7c8f743c60bbe79e23641e9f037474
Reviewed-on: https://gerrit.libreoffice.org/2075Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 07c99eff
...@@ -13,6 +13,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\ ...@@ -13,6 +13,7 @@ $(eval $(call gb_UI_add_uifiles,cui,\
cui/uiconfig/ui/backgroundpage \ cui/uiconfig/ui/backgroundpage \
cui/uiconfig/ui/borderpage \ cui/uiconfig/ui/borderpage \
cui/uiconfig/ui/charnamepage \ cui/uiconfig/ui/charnamepage \
cui/uiconfig/ui/cellprotectionpage \
cui/uiconfig/ui/colorpage \ cui/uiconfig/ui/colorpage \
cui/uiconfig/ui/gradientpage \ cui/uiconfig/ui/gradientpage \
cui/uiconfig/ui/colorconfigwin \ cui/uiconfig/ui/colorconfigwin \
......
This diff is collapsed.
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#undef SC_DLLIMPLEMENTATION #undef SC_DLLIMPLEMENTATION
#include "global.hxx" #include "global.hxx"
#include "document.hxx" #include "document.hxx"
#include "attrib.hxx" #include "attrib.hxx"
...@@ -47,30 +46,27 @@ static sal_uInt16 pProtectionRanges[] = ...@@ -47,30 +46,27 @@ static sal_uInt16 pProtectionRanges[] =
ScTabPageProtection::ScTabPageProtection( Window* pParent, ScTabPageProtection::ScTabPageProtection( Window* pParent,
const SfxItemSet& rCoreAttrs ) const SfxItemSet& rCoreAttrs )
: SfxTabPage ( pParent, : SfxTabPage ( pParent,
ScResId( RID_SCPAGE_PROTECTION ), "ProtectionPage",
rCoreAttrs ), "cui/ui/cellprotectionpage.ui",
// rCoreAttrs )
aFlProtect ( this, ScResId( FL_PROTECTION ) ),
aBtnHideCell ( this, ScResId( BTN_HIDE_ALL ) ), {
aBtnProtect ( this, ScResId( BTN_PROTECTED ) ), get(m_pBtnHideCell,"checkHideAll");
aBtnHideFormula ( this, ScResId( BTN_HIDE_FORMULAR ) ), get(m_pBtnProtect,"checkProtected");
aTxtHint ( this, ScResId( FT_HINT ) ), get(m_pBtnHideFormula,"checkHideFormula");
aFlPrint ( this, ScResId( FL_PRINT ) ), get(m_pBtnHidePrint,"checkHidePrinting");
aBtnHidePrint ( this, ScResId( BTN_HIDE_PRINT ) ),
aTxtHint2 ( this, ScResId( FT_HINT2 ) ) // This Page need ExchangeSupport
{
// diese Page braucht ExchangeSupport
SetExchangeSupport(); SetExchangeSupport();
// States werden in Reset gesetzt // States will be set in Reset
bTriEnabled = bDontCare = bProtect = bHideForm = bHideCell = bHidePrint = false; bTriEnabled = bDontCare = bProtect = bHideForm = bHideCell = bHidePrint = false;
aBtnProtect.SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_pBtnProtect->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) );
aBtnHideCell.SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_pBtnHideCell->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) );
aBtnHideFormula.SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_pBtnHideFormula->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) );
aBtnHidePrint.SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_pBtnHidePrint->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) );
FreeResource();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -88,8 +84,7 @@ sal_uInt16* ScTabPageProtection::GetRanges() ...@@ -88,8 +84,7 @@ sal_uInt16* ScTabPageProtection::GetRanges()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
SfxTabPage* ScTabPageProtection::Create( Window* pParent, SfxTabPage* ScTabPageProtection::Create( Window* pParent, const SfxItemSet& rAttrSet )
const SfxItemSet& rAttrSet )
{ {
return ( new ScTabPageProtection( pParent, rAttrSet ) ); return ( new ScTabPageProtection( pParent, rAttrSet ) );
} }
...@@ -98,25 +93,26 @@ SfxTabPage* ScTabPageProtection::Create( Window* pParent, ...@@ -98,25 +93,26 @@ SfxTabPage* ScTabPageProtection::Create( Window* pParent,
void ScTabPageProtection::Reset( const SfxItemSet& rCoreAttrs ) void ScTabPageProtection::Reset( const SfxItemSet& rCoreAttrs )
{ {
// Variablen initialisieren // Initialize variables
sal_uInt16 nWhich = GetWhich( SID_SCATTR_PROTECTION ); sal_uInt16 nWhich = GetWhich( SID_SCATTR_PROTECTION );
const ScProtectionAttr* pProtAttr = NULL; const ScProtectionAttr* pProtAttr = NULL;
SfxItemState eItemState = rCoreAttrs.GetItemState( nWhich, false, SfxItemState eItemState = rCoreAttrs.GetItemState( nWhich, false,
(const SfxPoolItem**)&pProtAttr ); (const SfxPoolItem**)&pProtAttr );
// handelt es sich um ein Default-Item? // Is this a Default-Item?
if ( eItemState == SFX_ITEM_DEFAULT ) if ( eItemState == SFX_ITEM_DEFAULT )
pProtAttr = (const ScProtectionAttr*)&(rCoreAttrs.Get(nWhich)); pProtAttr = (const ScProtectionAttr*)&(rCoreAttrs.Get(nWhich));
// bei SFX_ITEM_DONTCARE auf 0 lassen // At SFX_ITEM_DONTCARE let to 0
bTriEnabled = ( pProtAttr == NULL ); // TriState, wenn DontCare bTriEnabled = ( pProtAttr == NULL ); // TriState, when DontCare
bDontCare = bTriEnabled; bDontCare = bTriEnabled;
if (bTriEnabled) if (bTriEnabled)
{ {
// Defaults, die erscheinen wenn ein TriState weggeklickt wird: // Defaults wich appear when a TriState will be clicked away:
// (weil alles zusammen ein Attribut ist, kann auch nur alles zusammen // (because everything combined is an attribute, and also only
// auf DontCare stehen - #38543#) // everything combined as DontCare can be available - #38543#)
bProtect = sal_True; bProtect = sal_True;
bHideForm = bHideCell = bHidePrint = false; bHideForm = bHideCell = bHidePrint = false;
} }
...@@ -128,12 +124,12 @@ void ScTabPageProtection::Reset( const SfxItemSet& rCoreAttrs ) ...@@ -128,12 +124,12 @@ void ScTabPageProtection::Reset( const SfxItemSet& rCoreAttrs )
bHidePrint = pProtAttr->GetHidePrint(); bHidePrint = pProtAttr->GetHidePrint();
} }
// Controls initialisieren // Start Controls
aBtnProtect .EnableTriState( bTriEnabled ); m_pBtnProtect->EnableTriState( bTriEnabled );
aBtnHideCell .EnableTriState( bTriEnabled ); m_pBtnHideCell->EnableTriState( bTriEnabled );
aBtnHideFormula .EnableTriState( bTriEnabled ); m_pBtnHideFormula->EnableTriState( bTriEnabled );
aBtnHidePrint .EnableTriState( bTriEnabled ); m_pBtnHidePrint->EnableTriState( bTriEnabled );
UpdateButtons(); UpdateButtons();
} }
...@@ -157,7 +153,7 @@ sal_Bool ScTabPageProtection::FillItemSet( SfxItemSet& rCoreAttrs ) ...@@ -157,7 +153,7 @@ sal_Bool ScTabPageProtection::FillItemSet( SfxItemSet& rCoreAttrs )
aProtAttr.SetHidePrint( bHidePrint ); aProtAttr.SetHidePrint( bHidePrint );
if ( bTriEnabled ) if ( bTriEnabled )
bAttrsChanged = sal_True; // DontCare -> richtiger Wert bAttrsChanged = sal_True; // DontCare -> properly value
else else
bAttrsChanged = !pOldItem || !( aProtAttr == *(const ScProtectionAttr*)pOldItem ); bAttrsChanged = !pOldItem || !( aProtAttr == *(const ScProtectionAttr*)pOldItem );
} }
...@@ -184,23 +180,23 @@ int ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP ) ...@@ -184,23 +180,23 @@ int ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP )
//------------------------------------------------------------------------ //------------------------------------------------------------------------
IMPL_LINK( ScTabPageProtection, ButtonClickHdl, TriStateBox*, pBox ) IMPL_LINK( ScTabPageProtection, ButtonClickHdl, CheckBox*, pBox )
{ {
TriState eState = pBox->GetState(); TriState eState = pBox->GetState();
if ( eState == STATE_DONTKNOW ) if ( eState == STATE_DONTKNOW )
bDontCare = sal_True; // alles zusammen auf DontCare bDontCare = sal_True; // everything combined at DontCare
else else
{ {
bDontCare = false; // DontCare ueberall aus bDontCare = false; // DontCare from everywhere
sal_Bool bOn = ( eState == STATE_CHECK ); // ausgewaehlter Wert sal_Bool bOn = ( eState == STATE_CHECK ); // from a selected value
if ( pBox == &aBtnProtect ) if ( pBox == m_pBtnProtect )
bProtect = bOn; bProtect = bOn;
else if ( pBox == &aBtnHideCell ) else if ( pBox == m_pBtnHideCell )
bHideCell = bOn; bHideCell = bOn;
else if ( pBox == &aBtnHideFormula ) else if ( pBox == m_pBtnHideFormula )
bHideForm = bOn; bHideForm = bOn;
else if ( pBox == &aBtnHidePrint ) else if ( pBox == m_pBtnHidePrint )
bHidePrint = bOn; bHidePrint = bOn;
else else
{ {
...@@ -208,7 +204,7 @@ IMPL_LINK( ScTabPageProtection, ButtonClickHdl, TriStateBox*, pBox ) ...@@ -208,7 +204,7 @@ IMPL_LINK( ScTabPageProtection, ButtonClickHdl, TriStateBox*, pBox )
} }
} }
UpdateButtons(); // TriState und Enable-Logik UpdateButtons(); // TriState and Logic-Enable
return 0; return 0;
} }
...@@ -219,23 +215,23 @@ void ScTabPageProtection::UpdateButtons() ...@@ -219,23 +215,23 @@ void ScTabPageProtection::UpdateButtons()
{ {
if ( bDontCare ) if ( bDontCare )
{ {
aBtnProtect.SetState( STATE_DONTKNOW ); m_pBtnProtect->SetState( STATE_DONTKNOW );
aBtnHideCell.SetState( STATE_DONTKNOW ); m_pBtnHideCell->SetState( STATE_DONTKNOW );
aBtnHideFormula.SetState( STATE_DONTKNOW ); m_pBtnHideFormula->SetState( STATE_DONTKNOW );
aBtnHidePrint.SetState( STATE_DONTKNOW ); m_pBtnHidePrint->SetState( STATE_DONTKNOW );
} }
else else
{ {
aBtnProtect.SetState( bProtect ? STATE_CHECK : STATE_NOCHECK ); m_pBtnProtect->SetState( bProtect ? STATE_CHECK : STATE_NOCHECK );
aBtnHideCell.SetState( bHideCell ? STATE_CHECK : STATE_NOCHECK ); m_pBtnHideCell->SetState( bHideCell ? STATE_CHECK : STATE_NOCHECK );
aBtnHideFormula.SetState( bHideForm ? STATE_CHECK : STATE_NOCHECK ); m_pBtnHideFormula->SetState( bHideForm ? STATE_CHECK : STATE_NOCHECK );
aBtnHidePrint.SetState( bHidePrint ? STATE_CHECK : STATE_NOCHECK ); m_pBtnHidePrint->SetState( bHidePrint ? STATE_CHECK : STATE_NOCHECK );
} }
sal_Bool bEnable = ( aBtnHideCell.GetState() != STATE_CHECK ); sal_Bool bEnable = ( m_pBtnHideCell->GetState() != STATE_CHECK );
{ {
aBtnProtect.Enable( bEnable ); m_pBtnProtect->Enable( bEnable );
aBtnHideFormula.Enable( bEnable ); m_pBtnHideFormula->Enable( bEnable );
} }
} }
......
...@@ -26,15 +26,3 @@ ...@@ -26,15 +26,3 @@
#define TP_PROTECTION 6 #define TP_PROTECTION 6
#define TP_FONTEFF 7 #define TP_FONTEFF 7
#define TP_ASIAN 8 #define TP_ASIAN 8
//================================================
// Protected cell TabPage:
#define BTN_PROTECTED 1
#define BTN_HIDE_FORMULAR 2
#define BTN_HIDE_ALL 3
#define FT_HINT 4
#define FL_PROTECTION 5
#define BTN_HIDE_PRINT 6
#define FT_HINT2 7
#define FL_PRINT 8
...@@ -45,17 +45,11 @@ private: ...@@ -45,17 +45,11 @@ private:
~ScTabPageProtection(); ~ScTabPageProtection();
private: private:
FixedLine aFlProtect; CheckBox* m_pBtnHideCell;
TriStateBox aBtnHideCell; CheckBox* m_pBtnProtect;
TriStateBox aBtnProtect; CheckBox* m_pBtnHideFormula;
TriStateBox aBtnHideFormula; CheckBox* m_pBtnHidePrint;
FixedInfo aTxtHint; // current status:
FixedLine aFlPrint;
TriStateBox aBtnHidePrint;
FixedInfo aTxtHint2;
// current status:
sal_Bool bTriEnabled; // if before - DontCare sal_Bool bTriEnabled; // if before - DontCare
sal_Bool bDontCare; // all in TriState sal_Bool bDontCare; // all in TriState
sal_Bool bProtect; // secure individual settings for TriState sal_Bool bProtect; // secure individual settings for TriState
...@@ -64,7 +58,7 @@ private: ...@@ -64,7 +58,7 @@ private:
sal_Bool bHidePrint; sal_Bool bHidePrint;
// Handler: // Handler:
DECL_LINK( ButtonClickHdl, TriStateBox* pBox ); DECL_LINK( ButtonClickHdl, CheckBox* pBox );
void UpdateButtons(); void UpdateButtons();
}; };
......
...@@ -87,73 +87,3 @@ TabDialog RID_SCDLG_ATTR ...@@ -87,73 +87,3 @@ TabDialog RID_SCDLG_ATTR
}; };
}; };
}; };
//================================================
// Zellschutz-TabPage:
TabPage RID_SCPAGE_PROTECTION
{
Hide = TRUE ;
SVLook = TRUE ;
HelpId = HID_SCPAGE_PROTECTION ;
Pos = MAP_APPFONT ( 0 , 0 ) ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
TriStateBox BTN_PROTECTED
{
HelpID = "sc:TriStateBox:RID_SCPAGE_PROTECTION:BTN_PROTECTED";
Pos = MAP_APPFONT ( 22 , 28 ) ;
Size = MAP_APPFONT ( 90 , 10 ) ;
Text [ en-US ] = "~Protected" ;
TabStop = TRUE ;
};
TriStateBox BTN_HIDE_FORMULAR
{
HelpID = "sc:TriStateBox:RID_SCPAGE_PROTECTION:BTN_HIDE_FORMULAR";
Pos = MAP_APPFONT ( 22 , 42 ) ;
Size = MAP_APPFONT ( 90 , 10 ) ;
Text [ en-US ] = "Hide ~formula" ;
TabStop = TRUE ;
};
TriStateBox BTN_HIDE_ALL
{
HelpID = "sc:TriStateBox:RID_SCPAGE_PROTECTION:BTN_HIDE_ALL";
Pos = MAP_APPFONT ( 12 , 14 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text [ en-US ] = "Hide ~all" ;
TabStop = TRUE ;
};
FixedText FT_HINT
{
Pos = MAP_APPFONT ( 114 , 14 ) ;
Size = MAP_APPFONT ( 137 , 56 ) ;
WordBreak = TRUE ;
Text [ en-US ] = "Cell protection is only effective after the current sheet has been protected. \n\nSelect 'Protect Document' from the 'Tools' menu, and specify 'Sheet'." ;
};
FixedLine FL_PROTECTION
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Protection" ;
};
TriStateBox BTN_HIDE_PRINT
{
HelpID = "sc:TriStateBox:RID_SCPAGE_PROTECTION:BTN_HIDE_PRINT";
Pos = MAP_APPFONT ( 12 , 87 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text [ en-US ] = "Hide ~when printing" ;
TabStop = TRUE ;
};
FixedText FT_HINT2
{
Pos = MAP_APPFONT ( 114 , 87 ) ;
Size = MAP_APPFONT ( 137 , 24 ) ;
WordBreak = TRUE ;
Text [ en-US ] = "The cells selected will be omitted when printing." ;
};
FixedLine FL_PRINT
{
Pos = MAP_APPFONT ( 6 , 76 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "Print" ;
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment