Kaydet (Commit) 2ea92be9 authored tarafından Noel Grandin's avatar Noel Grandin

convert SC_CONVERT constants to scoped enum

Change-Id: Ic81052e86ea6c2ea41357bde83ffd4df73afcb01
Reviewed-on: https://gerrit.libreoffice.org/18768Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 015eb39d
...@@ -22,24 +22,26 @@ ...@@ -22,24 +22,26 @@
#include <sal/types.h> #include <sal/types.h>
enum class ScContentId;
// CfgItem for navigator-state // CfgItem for navigator-state
class ScNavipiCfg class ScNavipiCfg
{ {
private: private:
sal_uInt16 nListMode; sal_uInt16 nListMode;
sal_uInt16 nDragMode; sal_uInt16 nDragMode;
sal_uInt16 nRootType; ScContentId nRootType;
public: public:
ScNavipiCfg(); ScNavipiCfg();
void SetListMode(sal_uInt16 nNew); void SetListMode(sal_uInt16 nNew);
sal_uInt16 GetListMode() const { return nListMode; } sal_uInt16 GetListMode() const { return nListMode; }
void SetDragMode(sal_uInt16 nNew); void SetDragMode(sal_uInt16 nNew);
sal_uInt16 GetDragMode() const { return nDragMode; } sal_uInt16 GetDragMode() const { return nDragMode; }
void SetRootType(sal_uInt16 nNew); void SetRootType(ScContentId nNew);
sal_uInt16 GetRootType() const { return nRootType; } ScContentId GetRootType() const { return nRootType; }
}; };
#endif #endif
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "navicfg.hxx" #include "navicfg.hxx"
#include "content.hxx"
//TODO: #define CFGPATH_NAVIPI "Office.Calc/Navigator" //TODO: #define CFGPATH_NAVIPI "Office.Calc/Navigator"
...@@ -25,7 +26,7 @@ ScNavipiCfg::ScNavipiCfg() : ...@@ -25,7 +26,7 @@ ScNavipiCfg::ScNavipiCfg() :
//TODO: ConfigItem( OUString( CFGPATH_NAVIPI ) ), //TODO: ConfigItem( OUString( CFGPATH_NAVIPI ) ),
nListMode(0), nListMode(0),
nDragMode(0), nDragMode(0),
nRootType(0) nRootType(ScContentId::ROOT)
{ {
} }
...@@ -47,7 +48,7 @@ void ScNavipiCfg::SetDragMode(sal_uInt16 nNew) ...@@ -47,7 +48,7 @@ void ScNavipiCfg::SetDragMode(sal_uInt16 nNew)
} }
} }
void ScNavipiCfg::SetRootType(sal_uInt16 nNew) void ScNavipiCfg::SetRootType(ScContentId nNew)
{ {
if ( nRootType != nNew ) if ( nRootType != nNew )
{ {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "global.hxx" #include "global.hxx"
#include "address.hxx" #include "address.hxx"
#include <tools/solar.h> #include <tools/solar.h>
#include <o3tl/enumarray.hxx>
class ScNavigatorDlg; class ScNavigatorDlg;
class ScDocument; class ScDocument;
...@@ -31,44 +32,39 @@ class ScDocShell; ...@@ -31,44 +32,39 @@ class ScDocShell;
class ScAreaLink; class ScAreaLink;
class SdrPage; class SdrPage;
#define SC_CONTENT_ROOT 0 enum class ScContentId {
#define SC_CONTENT_TABLE 1 ROOT, TABLE, RANGENAME, DBAREA,
#define SC_CONTENT_RANGENAME 2 GRAPHIC, OLEOBJECT, NOTE, AREALINK,
#define SC_CONTENT_DBAREA 3 DRAWING, LAST = DRAWING
#define SC_CONTENT_GRAPHIC 4 };
#define SC_CONTENT_OLEOBJECT 5
#define SC_CONTENT_NOTE 6
#define SC_CONTENT_AREALINK 7
#define SC_CONTENT_DRAWING 8
#define SC_CONTENT_COUNT 9
const sal_uLong SC_CONTENT_NOCHILD = ~0UL; const sal_uLong SC_CONTENT_NOCHILD = ~0UL;
class ScContentTree : public SvTreeListBox class ScContentTree : public SvTreeListBox
{ {
VclPtr<ScNavigatorDlg> pParentWindow; VclPtr<ScNavigatorDlg> pParentWindow;
ImageList aEntryImages; ImageList aEntryImages;
SvTreeListEntry* pRootNodes[SC_CONTENT_COUNT]; o3tl::enumarray<ScContentId, SvTreeListEntry*> pRootNodes;
sal_uInt16 nRootType; // set as Root ScContentId nRootType; // set as Root
OUString aManualDoc; // Switched in Navigator (Title) OUString aManualDoc; // Switched in Navigator (Title)
bool bHiddenDoc; // Hidden active? bool bHiddenDoc; // Hidden active?
OUString aHiddenName; // URL to load OUString aHiddenName; // URL to load
OUString aHiddenTitle; // for display OUString aHiddenTitle; // for display
ScDocument* pHiddenDocument; // temporary ScDocument* pHiddenDocument; // temporary
bool bisInNavigatoeDlg; bool bisInNavigatoeDlg;
OUString sKeyString; OUString sKeyString;
sal_uInt16 pPosList[SC_CONTENT_COUNT]; // for the sequence o3tl::enumarray<ScContentId, sal_uInt16> pPosList; // for the sequence
static bool bIsInDrag; // static, if the Navigator is deleted in ExecuteDrag static bool bIsInDrag; // static, if the Navigator is deleted in ExecuteDrag
ScDocShell* GetManualOrCurrent(); ScDocShell* GetManualOrCurrent();
void InitRoot(sal_uInt16 nType); void InitRoot(ScContentId nType);
void ClearType(sal_uInt16 nType); void ClearType(ScContentId nType);
void ClearAll(); void ClearAll();
void InsertContent( sal_uInt16 nType, const OUString& rValue ); void InsertContent( ScContentId nType, const OUString& rValue );
void GetDrawNames( sal_uInt16 nType ); void GetDrawNames( ScContentId nType );
void GetTableNames(); void GetTableNames();
void GetAreaNames(); void GetAreaNames();
...@@ -79,9 +75,9 @@ class ScContentTree : public SvTreeListBox ...@@ -79,9 +75,9 @@ class ScContentTree : public SvTreeListBox
void GetDrawingNames(); void GetDrawingNames();
void GetNoteStrings(); void GetNoteStrings();
static bool IsPartOfType( sal_uInt16 nContentType, sal_uInt16 nObjIdentifier ); static bool IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier );
bool DrawNamesChanged( sal_uInt16 nType ); bool DrawNamesChanged( ScContentId nType );
bool NoteStringsChanged(); bool NoteStringsChanged();
ScAddress GetNotePos( sal_uLong nIndex ); ScAddress GetNotePos( sal_uLong nIndex );
...@@ -91,7 +87,7 @@ class ScContentTree : public SvTreeListBox ...@@ -91,7 +87,7 @@ class ScContentTree : public SvTreeListBox
@param rnRootIndex Root index of specified entry is returned. @param rnRootIndex Root index of specified entry is returned.
@param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root). @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root).
@param pEntry The entry to examine. */ @param pEntry The entry to examine. */
void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvTreeListEntry* pEntry ) const; void GetEntryIndexes( ScContentId& rnRootIndex, sal_uLong& rnChildIndex, SvTreeListEntry* pEntry ) const;
/** Returns the child index of the specified listbox entry. /** Returns the child index of the specified listbox entry.
@param pEntry The entry to examine or NULL for the selected entry. @param pEntry The entry to examine or NULL for the selected entry.
...@@ -130,18 +126,18 @@ public: ...@@ -130,18 +126,18 @@ public:
OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; OUString GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE; OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
void ObjectFresh( sal_uInt16 nType, SvTreeListEntry* pEntry = NULL); void ObjectFresh( ScContentId nType, SvTreeListEntry* pEntry = NULL);
bool SetNavigatorDlgFlag(bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;}; bool SetNavigatorDlgFlag(bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
void InitWindowBits( bool bButtons ); void InitWindowBits( bool bButtons );
void Refresh( sal_uInt16 nType = 0 ); void Refresh( ScContentId nType = ScContentId::ROOT );
void ToggleRoot(); void ToggleRoot();
void SetRootType( sal_uInt16 nNew ); void SetRootType( ScContentId nNew );
sal_uInt16 GetRootType() const { return nRootType; } ScContentId GetRootType() const { return nRootType; }
void ActiveDocChanged(); void ActiveDocChanged();
void ResetManualDoc(); void ResetManualDoc();
......
...@@ -23,27 +23,29 @@ ...@@ -23,27 +23,29 @@
#include <tools/solar.h> #include <tools/solar.h>
#include <vector> #include <vector>
#include <o3tl/enumarray.hxx>
#include <content.hxx>
/** Contains settings of the navigator listbox. This includes the expand state /** Contains settings of the navigator listbox. This includes the expand state
of each listbox entry and the index of the selected entry and sub entry. */ of each listbox entry and the index of the selected entry and sub entry. */
class ScNavigatorSettings class ScNavigatorSettings
{ {
private: private:
::std::vector< bool > maExpandedVec; /// Array of Booleans for expand state. o3tl::enumarray<ScContentId,bool> maExpandedVec; /// Array of Booleans for expand state.
sal_uInt16 mnRootSelected; /// Index of selected root entry. ScContentId mnRootSelected; /// Index of selected root entry.
sal_uLong mnChildSelected; /// Index of selected child entry. sal_uLong mnChildSelected; /// Index of selected child entry.
public: public:
ScNavigatorSettings(); ScNavigatorSettings();
inline void SetExpanded( sal_uInt16 nIndex, bool bExpand ) { maExpandedVec[ nIndex ] = bExpand; } inline void SetExpanded( ScContentId nIndex, bool bExpand ) { maExpandedVec[ nIndex ] = bExpand; }
inline bool IsExpanded( sal_uInt16 nIndex ) const { return maExpandedVec[ nIndex ]; } inline bool IsExpanded( ScContentId nIndex ) const { return maExpandedVec[ nIndex ]; }
inline void SetRootSelected( sal_uInt16 nIndex ) { mnRootSelected = nIndex; } inline void SetRootSelected( ScContentId nIndex ) { mnRootSelected = nIndex; }
inline sal_uInt16 GetRootSelected() const { return mnRootSelected; } inline ScContentId GetRootSelected() const { return mnRootSelected; }
inline void SetChildSelected( sal_uLong nIndex ) { mnChildSelected = nIndex; } inline void SetChildSelected( sal_uLong nIndex ) { mnChildSelected = nIndex; }
inline sal_uLong GetChildSelected() const { return mnChildSelected; } inline sal_uLong GetChildSelected() const { return mnChildSelected; }
}; };
#endif // INCLUDED_SC_SOURCE_UI_INC_NAVSETT_HXX #endif // INCLUDED_SC_SOURCE_UI_INC_NAVSETT_HXX
......
This diff is collapsed.
...@@ -422,7 +422,7 @@ void CommandToolBox::UpdateButtons() ...@@ -422,7 +422,7 @@ void CommandToolBox::UpdateButtons()
else else
{ {
EnableItem( IID_CHANGEROOT ); EnableItem( IID_CHANGEROOT );
bool bRootSet = rDlg.aLbEntries->GetRootType() != SC_CONTENT_ROOT; bool bRootSet = rDlg.aLbEntries->GetRootType() != ScContentId::ROOT;
CheckItem( IID_CHANGEROOT, bRootSet ); CheckItem( IID_CHANGEROOT, bRootSet );
} }
...@@ -464,8 +464,7 @@ void CommandToolBox::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -464,8 +464,7 @@ void CommandToolBox::DataChanged( const DataChangedEvent& rDCEvt )
// class ScNavigatorSettings // class ScNavigatorSettings
ScNavigatorSettings::ScNavigatorSettings() : ScNavigatorSettings::ScNavigatorSettings() :
maExpandedVec( SC_CONTENT_COUNT, false ), mnRootSelected( ScContentId::ROOT ),
mnRootSelected( SC_CONTENT_ROOT ),
mnChildSelected( SC_CONTENT_NOCHILD ) mnChildSelected( SC_CONTENT_NOCHILD )
{ {
} }
...@@ -638,8 +637,8 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl ...@@ -638,8 +637,8 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, vcl
DragDropMode::ENABLE_TOP ); DragDropMode::ENABLE_TOP );
// was a category chosen as root? // was a category chosen as root?
sal_uInt16 nLastRoot = rCfg.GetRootType(); ScContentId nLastRoot = rCfg.GetRootType();
if ( nLastRoot ) if ( nLastRoot != ScContentId::ROOT )
aLbEntries->SetRootType( nLastRoot ); aLbEntries->SetRootType( nLastRoot );
aLbEntries->Refresh(); aLbEntries->Refresh();
...@@ -839,25 +838,25 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -839,25 +838,25 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
switch ( nHintId ) switch ( nHintId )
{ {
case SC_HINT_TABLES_CHANGED: case SC_HINT_TABLES_CHANGED:
aLbEntries->Refresh( SC_CONTENT_TABLE ); aLbEntries->Refresh( ScContentId::TABLE );
break; break;
case SC_HINT_DBAREAS_CHANGED: case SC_HINT_DBAREAS_CHANGED:
aLbEntries->Refresh( SC_CONTENT_DBAREA ); aLbEntries->Refresh( ScContentId::DBAREA );
break; break;
case SC_HINT_AREAS_CHANGED: case SC_HINT_AREAS_CHANGED:
aLbEntries->Refresh( SC_CONTENT_RANGENAME ); aLbEntries->Refresh( ScContentId::RANGENAME );
break; break;
case SC_HINT_DRAW_CHANGED: case SC_HINT_DRAW_CHANGED:
aLbEntries->Refresh( SC_CONTENT_GRAPHIC ); aLbEntries->Refresh( ScContentId::GRAPHIC );
aLbEntries->Refresh( SC_CONTENT_OLEOBJECT ); aLbEntries->Refresh( ScContentId::OLEOBJECT );
aLbEntries->Refresh( SC_CONTENT_DRAWING ); aLbEntries->Refresh( ScContentId::DRAWING );
break; break;
case SC_HINT_AREALINKS_CHANGED: case SC_HINT_AREALINKS_CHANGED:
aLbEntries->Refresh( SC_CONTENT_AREALINK ); aLbEntries->Refresh( ScContentId::AREALINK );
break; break;
// SFX_HINT_DOCCHANGED not only at document change // SFX_HINT_DOCCHANGED not only at document change
...@@ -871,9 +870,9 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -871,9 +870,9 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
aContentIdle.Start(); // Do not search notes immediately aContentIdle.Start(); // Do not search notes immediately
break; break;
case FID_KILLEDITVIEW: case FID_KILLEDITVIEW:
aLbEntries->ObjectFresh( SC_CONTENT_OLEOBJECT ); aLbEntries->ObjectFresh( ScContentId::OLEOBJECT );
aLbEntries->ObjectFresh( SC_CONTENT_DRAWING ); aLbEntries->ObjectFresh( ScContentId::DRAWING );
aLbEntries->ObjectFresh( SC_CONTENT_GRAPHIC ); aLbEntries->ObjectFresh( ScContentId::GRAPHIC );
break; break;
default: default:
break; break;
...@@ -896,7 +895,7 @@ IMPL_LINK_TYPED( ScNavigatorDlg, TimeHdl, Idle*, pIdle, void ) ...@@ -896,7 +895,7 @@ IMPL_LINK_TYPED( ScNavigatorDlg, TimeHdl, Idle*, pIdle, void )
if ( pIdle != &aContentIdle ) if ( pIdle != &aContentIdle )
return; return;
aLbEntries->Refresh( SC_CONTENT_NOTE ); aLbEntries->Refresh( ScContentId::NOTE );
} }
void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew) void ScNavigatorDlg::SetDropMode(sal_uInt16 nNew)
......
...@@ -211,23 +211,23 @@ void SAL_CALL ScLinkTargetTypeObj::setPropertyValue(const OUString& /* aProperty ...@@ -211,23 +211,23 @@ void SAL_CALL ScLinkTargetTypeObj::setPropertyValue(const OUString& /* aProperty
void ScLinkTargetTypeObj::SetLinkTargetBitmap( uno::Any& rRet, sal_uInt16 nType ) void ScLinkTargetTypeObj::SetLinkTargetBitmap( uno::Any& rRet, sal_uInt16 nType )
{ {
sal_uInt16 nImgId = 0; ScContentId nImgId = ScContentId::ROOT;
switch ( nType ) switch ( nType )
{ {
case SC_LINKTARGETTYPE_SHEET: case SC_LINKTARGETTYPE_SHEET:
nImgId = SC_CONTENT_TABLE; nImgId = ScContentId::TABLE;
break; break;
case SC_LINKTARGETTYPE_RANGENAME: case SC_LINKTARGETTYPE_RANGENAME:
nImgId = SC_CONTENT_RANGENAME; nImgId = ScContentId::RANGENAME;
break; break;
case SC_LINKTARGETTYPE_DBAREA: case SC_LINKTARGETTYPE_DBAREA:
nImgId = SC_CONTENT_DBAREA; nImgId = ScContentId::DBAREA;
break; break;
} }
if (nImgId) if (nImgId != ScContentId::ROOT)
{ {
ImageList aEntryImages( ScResId( RID_IMAGELIST_NAVCONT ) ); ImageList aEntryImages( ScResId( RID_IMAGELIST_NAVCONT ) );
const Image& rImage = aEntryImages.GetImage( nImgId ); const Image& rImage = aEntryImages.GetImage( (sal_uInt16)nImgId );
rRet <<= uno::Reference< awt::XBitmap > (VCLUnoHelper::CreateBitmap( rImage.GetBitmapEx() )); rRet <<= uno::Reference< awt::XBitmap > (VCLUnoHelper::CreateBitmap( rImage.GetBitmapEx() ));
} }
} }
......
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