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