[Libreoffice-commits] core.git: basctl/source include/svtools sc/source sd/source svtools/source
Noel Grandin
noel at peralex.com
Mon Apr 28 04:38:08 PDT 2014
basctl/source/basicide/bastypes.cxx | 2 +-
basctl/source/inc/bastypes.hxx | 2 +-
include/svtools/tabbar.hxx | 17 +++++++++--------
sc/source/ui/inc/tabcont.hxx | 4 ++--
sc/source/ui/view/tabcont.cxx | 10 +++++-----
sd/source/ui/dlg/LayerTabBar.cxx | 6 +++---
sd/source/ui/inc/LayerTabBar.hxx | 4 ++--
sd/source/ui/inc/TabControl.hxx | 6 +++---
sd/source/ui/view/tabcontr.cxx | 12 ++++++------
svtools/source/control/tabbar.cxx | 16 ++++++++--------
10 files changed, 40 insertions(+), 39 deletions(-)
New commits:
commit 883481fd200510f5ae62e7ab7cd18f7d925c2c47
Author: Noel Grandin <noel at peralex.com>
Date: Fri Apr 25 12:49:17 2014 +0200
Improve TabBar return types
DeactivatePage() goes from returning long to returning bool.
StartRenaming goes from returning long to returning bool.
AllowRenaming goes from returning long to returning a
constant from a new enum.
Change-Id: Ib87e8d7ceb4e23846547257b358ca4dfd41eb6ca
Reviewed-on: https://gerrit.libreoffice.org/9161
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 784de87..7da4f17 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -543,7 +543,7 @@ void TabBar::Command( const CommandEvent& rCEvt )
}
}
-long TabBar::AllowRenaming()
+TabBarAllowRenamingReturnCode TabBar::AllowRenaming()
{
bool const bValid = IsValidSbxName(GetEditText());
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index fbdf3d9..0d0db7e 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -122,7 +122,7 @@ protected:
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
- virtual long AllowRenaming() SAL_OVERRIDE;
+ virtual TabBarAllowRenamingReturnCode AllowRenaming() SAL_OVERRIDE;
virtual void EndRenaming() SAL_OVERRIDE;
public:
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 0c7751a..4ca74ce 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -313,12 +313,13 @@ typedef sal_uInt16 TabBarPageBits;
#define TPB_SPECIAL ((TabBarPageBits)0x0001)
-// - TabBar-Types -
+// - TabBar-Types - used in TabBar::AllowRenaming
-
-#define TABBAR_RENAMING_YES ((long)sal_True)
-#define TABBAR_RENAMING_NO ((long)sal_False)
-#define TABBAR_RENAMING_CANCEL ((long)2)
+enum TabBarAllowRenamingReturnCode {
+ TABBAR_RENAMING_NO,
+ TABBAR_RENAMING_YES,
+ TABBAR_RENAMING_CANCEL
+};
// - TabBar -
@@ -425,9 +426,9 @@ public:
virtual void DoubleClick();
virtual void Split();
virtual void ActivatePage();
- virtual long DeactivatePage();
- virtual long StartRenaming();
- virtual long AllowRenaming();
+ virtual bool DeactivatePage();
+ virtual bool StartRenaming();
+ virtual TabBarAllowRenamingReturnCode AllowRenaming();
virtual void EndRenaming();
virtual void Mirror();
diff --git a/sc/source/ui/inc/tabcont.hxx b/sc/source/ui/inc/tabcont.hxx
index d04e026..644a2f9 100644
--- a/sc/source/ui/inc/tabcont.hxx
+++ b/sc/source/ui/inc/tabcont.hxx
@@ -58,8 +58,8 @@ protected:
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
- virtual long StartRenaming() SAL_OVERRIDE;
- virtual long AllowRenaming() SAL_OVERRIDE;
+ virtual bool StartRenaming() SAL_OVERRIDE;
+ virtual TabBarAllowRenamingReturnCode AllowRenaming() SAL_OVERRIDE;
virtual void EndRenaming() SAL_OVERRIDE;
virtual void Mirror() SAL_OVERRIDE;
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index b029844..c6c41c0 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -579,20 +579,20 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt )
return 0;
}
-long ScTabControl::StartRenaming()
+bool ScTabControl::StartRenaming()
{
if ( pViewData->GetDocument()->IsDocEditable() )
- return TABBAR_RENAMING_YES;
+ return true;
else
- return TABBAR_RENAMING_NO;
+ return false;
}
-long ScTabControl::AllowRenaming()
+TabBarAllowRenamingReturnCode ScTabControl::AllowRenaming()
{
ScTabViewShell* pViewSh = pViewData->GetViewShell();
OSL_ENSURE( pViewSh, "pViewData->GetViewShell()" );
- long nRet = TABBAR_RENAMING_CANCEL;
+ TabBarAllowRenamingReturnCode nRet = TABBAR_RENAMING_CANCEL;
sal_uInt16 nId = GetEditPageId();
if ( nId )
{
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index c6c9b0b..fa14066 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -174,7 +174,7 @@ void LayerTabBar::Command(const CommandEvent& rCEvt)
}
}
-long LayerTabBar::StartRenaming()
+bool LayerTabBar::StartRenaming()
{
bool bOK = true;
OUString aLayerName = GetPageText( GetEditPageId() );
@@ -204,7 +204,7 @@ long LayerTabBar::StartRenaming()
return bOK ? 1 : 0;
}
-long LayerTabBar::AllowRenaming()
+TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
{
bool bOK = true;
@@ -242,7 +242,7 @@ long LayerTabBar::AllowRenaming()
}
}
- return bOK ? 1 : 0;
+ return bOK ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
}
void LayerTabBar::EndRenaming()
diff --git a/sd/source/ui/inc/LayerTabBar.hxx b/sd/source/ui/inc/LayerTabBar.hxx
index 83453a7..6f42de1 100644
--- a/sd/source/ui/inc/LayerTabBar.hxx
+++ b/sd/source/ui/inc/LayerTabBar.hxx
@@ -66,8 +66,8 @@ protected:
virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
- virtual long StartRenaming() SAL_OVERRIDE;
- virtual long AllowRenaming() SAL_OVERRIDE;
+ virtual bool StartRenaming() SAL_OVERRIDE;
+ virtual TabBarAllowRenamingReturnCode AllowRenaming() SAL_OVERRIDE;
virtual void EndRenaming() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/TabControl.hxx b/sd/source/ui/inc/TabControl.hxx
index cbc273b..2ec16b9 100644
--- a/sd/source/ui/inc/TabControl.hxx
+++ b/sd/source/ui/inc/TabControl.hxx
@@ -65,12 +65,12 @@ protected:
virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
- virtual long StartRenaming() SAL_OVERRIDE;
- virtual long AllowRenaming() SAL_OVERRIDE;
+ virtual bool StartRenaming() SAL_OVERRIDE;
+ virtual TabBarAllowRenamingReturnCode AllowRenaming() SAL_OVERRIDE;
virtual void EndRenaming() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
- virtual long DeactivatePage() SAL_OVERRIDE;
+ virtual bool DeactivatePage() SAL_OVERRIDE;
// DragSourceHelper
virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx
index 97c76b6..827739a 100644
--- a/sd/source/ui/view/tabcontr.cxx
+++ b/sd/source/ui/view/tabcontr.cxx
@@ -307,7 +307,7 @@ void TabControl::Command(const CommandEvent& rCEvt)
}
}
-long TabControl::StartRenaming()
+bool TabControl::StartRenaming()
{
bool bOK = false;
@@ -321,10 +321,10 @@ long TabControl::StartRenaming()
pView->SdrEndTextEdit();
}
- return bOK ? 1 : 0;
+ return bOK;
}
-long TabControl::AllowRenaming()
+TabBarAllowRenamingReturnCode TabControl::AllowRenaming()
{
bool bOK = true;
@@ -344,7 +344,7 @@ long TabControl::AllowRenaming()
bOK = false;
}
}
- return bOK ? 1 : 0;
+ return bOK ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
}
void TabControl::EndRenaming()
@@ -363,9 +363,9 @@ void TabControl::ActivatePage()
}
}
-long TabControl::DeactivatePage()
+bool TabControl::DeactivatePage()
{
- return pDrViewSh->IsSwitchPageAllowed() ? 1 : 0;
+ return pDrViewSh->IsSwitchPageAllowed();
}
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index b3727f3..5c118cb 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1807,32 +1807,32 @@ Rectangle TabBar::ImplGetInsertTabRect(ImplTabBarItem* pItem) const
-long TabBar::DeactivatePage()
+bool TabBar::DeactivatePage()
{
if ( maDeactivatePageHdl.IsSet() )
return maDeactivatePageHdl.Call( this );
else
- return sal_True;
+ return true;
}
-long TabBar::StartRenaming()
+bool TabBar::StartRenaming()
{
if ( maStartRenamingHdl.IsSet() )
return maStartRenamingHdl.Call( this );
else
- return sal_True;
+ return true;
}
-long TabBar::AllowRenaming()
+TabBarAllowRenamingReturnCode TabBar::AllowRenaming()
{
if ( maAllowRenamingHdl.IsSet() )
- return maAllowRenamingHdl.Call( this );
+ return (TabBarAllowRenamingReturnCode) maAllowRenamingHdl.Call( this );
else
- return sal_True;
+ return TABBAR_RENAMING_YES;
}
@@ -2407,7 +2407,7 @@ void TabBar::EndEditMode( bool bCancel )
mpEdit->SetPostEvent();
if ( !bCancel )
{
- long nAllowRenaming = AllowRenaming();
+ TabBarAllowRenamingReturnCode nAllowRenaming = AllowRenaming();
if ( nAllowRenaming == TABBAR_RENAMING_YES )
SetPageText( mnEditId, maEditText );
else if ( nAllowRenaming == TABBAR_RENAMING_NO )
More information about the Libreoffice-commits
mailing list