summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-16 15:36:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-17 07:57:52 +0200
commit210db2bf9e199f0a58fbd7a629edda63903fabac (patch)
tree78cf2b078cf62c346e7a03d51dd3de21ff30b5f2 /basctl
parent14fb8f7960249271fd73123c056057ce49980667 (diff)
convert BrowseMode to o3tl::typed_flags
Change-Id: Id76339f73b3d4acd4908fd66c4c745c5b2b57c2f
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/bastype2.cxx16
-rw-r--r--basctl/source/basicide/bastype3.cxx2
-rw-r--r--basctl/source/basicide/macrodlg.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx4
-rw-r--r--basctl/source/basicide/moduldlg.cxx16
-rw-r--r--basctl/source/basicide/moduldlg.hxx2
-rw-r--r--basctl/source/inc/bastype2.hxx25
7 files changed, 36 insertions, 31 deletions
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 926cdaf53776..9b3455969329 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -163,7 +163,7 @@ TreeListBox::TreeListBox (vcl::Window* pParent, WinBits nStyle)
{
SetNodeDefaultImages();
SetSelectionMode( SelectionMode::Single );
- nMode = 0xFF; // everything
+ nMode = BrowseMode::All; // everything
}
VCL_BUILDER_FACTORY_CONSTRUCTOR(TreeListBox, WB_TABSTOP)
@@ -256,7 +256,7 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons
// create tree list box entry
sal_uInt16 nId;
- if ( ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ) )
+ if ( ( nMode & BrowseMode::Dialogs ) && !( nMode & BrowseMode::Modules ) )
nId = bLoaded ? RID_BMP_DLGLIB : RID_BMP_DLGLIBNOTLOADED;
else
nId = bLoaded ? RID_BMP_MODLIB : RID_BMP_MODLIBNOTLOADED;
@@ -282,7 +282,7 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons
void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName )
{
// modules
- if ( nMode & BROWSEMODE_MODULES )
+ if ( nMode & BrowseMode::Modules )
{
Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) );
@@ -313,7 +313,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
}
// methods
- if ( nMode & BROWSEMODE_SUBS )
+ if ( nMode & BrowseMode::Subs )
{
Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName );
sal_Int32 nCount = aNames.getLength();
@@ -345,7 +345,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
}
// dialogs
- if ( nMode & BROWSEMODE_DIALOGS )
+ if ( nMode & BrowseMode::Dialogs )
{
Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) );
@@ -469,7 +469,7 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo
}
// methods
- if ( nMode & BROWSEMODE_SUBS )
+ if ( nMode & BrowseMode::Subs )
{
Sequence< OUString > aNames = GetMethodNames( rDocument, rLibName, aModName );
sal_Int32 nCount = aNames.getLength();
@@ -716,9 +716,9 @@ void TreeListBox::SetEntryBitmaps( SvTreeListEntry * pEntry, const Image& rImage
LibraryType TreeListBox::GetLibraryType() const
{
LibraryType eType = LibraryType::All;
- if ( ( nMode & BROWSEMODE_MODULES ) && !( nMode & BROWSEMODE_DIALOGS ) )
+ if ( ( nMode & BrowseMode::Modules ) && !( nMode & BrowseMode::Dialogs ) )
eType = LibraryType::Module;
- else if ( !( nMode & BROWSEMODE_MODULES ) && ( nMode & BROWSEMODE_DIALOGS ) )
+ else if ( !( nMode & BrowseMode::Modules ) && ( nMode & BrowseMode::Dialogs ) )
eType = LibraryType::Dialog;
return eType;
}
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index ddb7defa8fd6..49e2281dcd9a 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -105,7 +105,7 @@ void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry )
ImpCreateLibSubEntries( pEntry, aDocument, aOULibName );
// exchange image
- const bool bDlgMode = (nMode & BROWSEMODE_DIALOGS) && !(nMode & BROWSEMODE_MODULES);
+ const bool bDlgMode = (nMode & BrowseMode::Dialogs) && !(nMode & BrowseMode::Modules);
Image aImage(BitmapEx(IDEResId(bDlgMode ? RID_BMP_DLGLIB : RID_BMP_MODLIB)));
SetEntryBitmaps( pEntry, aImage );
}
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index e31f618d2d6d..80c820ee9838 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -97,7 +97,7 @@ MacroChooser::MacroChooser( vcl::Window* pParnt, const Reference< frame::XFrame
m_pMacroBox->SetDoubleClickHdl( LINK( this, MacroChooser, MacroDoubleClickHdl ) );
m_pMacroBox->SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) );
- m_pBasicBox->SetMode( BROWSEMODE_MODULES );
+ m_pBasicBox->SetMode( BrowseMode::Modules );
m_pBasicBox->SetStyle( WB_TABSTOP | WB_BORDER |
WB_HASLINES | WB_HASLINESATROOT |
WB_HASBUTTONS | WB_HASBUTTONSATROOT |
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 38f326d28fb5..30f51a98254c 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1525,8 +1525,8 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
pEntry = pBasicBox->GetParent( pEntry );
}
- sal_uInt16 nMode = pBasicBox->GetMode();
- bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
+ BrowseMode nMode = pBasicBox->GetMode();
+ bool bDlgMode = ( nMode & BrowseMode::Dialogs ) && !( nMode & BrowseMode::Modules );
const sal_uInt16 nId = bDlgMode ? RID_BMP_DLGLIB : RID_BMP_MODLIB;
SvTreeListEntry* pNewLibEntry = pBasicBox->AddEntry(
aLibName,
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 1d46f11b4ba4..0cce2abeacd5 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -506,14 +506,14 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl, void )
VclPtr<TabPage> pNewTabPage;
if (sPageName == "modules")
{
- VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES);
+ VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BrowseMode::Modules);
pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
}
else if (sPageName == "dialogs")
{
- VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS );
+ VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BrowseMode::Dialogs );
pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
@@ -537,7 +537,7 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl, void )
// ObjectPage
-ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nMode)
+ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, BrowseMode nMode)
: TabPage(pParent, rName, "modules/BasicIDE/ui/" +
OStringToOUString(rName, RTL_TEXTENCODING_UTF8).toAsciiLowerCase() +
".ui")
@@ -557,12 +557,12 @@ ObjectPage::ObjectPage(vcl::Window *pParent, const OString &rName, sal_uInt16 nM
m_pDelButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
m_pBasicBox->SetSelectHdl( LINK( this, ObjectPage, BasicBoxHighlightHdl ) );
- if( nMode & BROWSEMODE_MODULES )
+ if( nMode & BrowseMode::Modules )
{
m_pNewModButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
m_pNewDlgButton->Hide();
}
- else if ( nMode & BROWSEMODE_DIALOGS )
+ else if ( nMode & BrowseMode::Dialogs )
{
m_pNewDlgButton->SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
m_pNewModButton->Hide();
@@ -620,12 +620,12 @@ void ObjectPage::CheckButtons()
OUString aLibName( aDesc.GetLibName() );
OUString aLibSubName( aDesc.GetLibSubName() );
bool bVBAEnabled = aDocument.isInVBAMode();
- sal_uInt16 nMode = m_pBasicBox->GetMode();
+ BrowseMode nMode = m_pBasicBox->GetMode();
sal_uInt16 nDepth = pCurEntry ? m_pBasicBox->GetModel()->GetDepth( pCurEntry ) : 0;
if ( nDepth >= 2 )
{
- if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
+ if( bVBAEnabled && ( nMode & BrowseMode::Modules ) && ( nDepth == 2 ) )
m_pEditButton->Disable();
else
m_pEditButton->Enable();
@@ -660,7 +660,7 @@ void ObjectPage::CheckButtons()
// enable/disable delete button
if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
{
- if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName == IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) )
+ if( bVBAEnabled && ( nMode & BrowseMode::Modules ) && ( ( nDepth == 2 ) || aLibSubName == IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) )
m_pDelButton->Disable();
else
m_pDelButton->Enable();
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index 500dc04db821..39bd7d8659e2 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -199,7 +199,7 @@ protected:
virtual void DeactivatePage() override;
public:
- ObjectPage(vcl::Window* pParent, const OString& rName, sal_uInt16 nMode);
+ ObjectPage(vcl::Window* pParent, const OString& rName, BrowseMode nMode);
virtual ~ObjectPage() override;
virtual void dispose() override;
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
index 60a8bd51715d..a64801835fcc 100644
--- a/basctl/source/inc/bastype2.hxx
+++ b/basctl/source/inc/bastype2.hxx
@@ -30,11 +30,23 @@
#include <basic/sbstar.hxx>
#include <sbxitem.hxx>
#include "basobj.hxx"
+#include <o3tl/typed_flags_set.hxx>
class SbModule;
class SvTreeListEntry;
class SbxVariable;
+enum class BrowseMode
+{
+ Modules = 0x01,
+ Subs = 0x02,
+ Dialogs = 0x04,
+ All = Modules | Subs | Dialogs,
+};
+namespace o3tl {
+ template<> struct typed_flags<BrowseMode> : is_typed_flags<BrowseMode, 0x7> {};
+}
+
namespace basctl
{
@@ -52,13 +64,6 @@ enum EntryType
OBJ_TYPE_CLASS_MODULES
};
-enum
-{
- BROWSEMODE_MODULES = 0x01,
- BROWSEMODE_SUBS = 0x02,
- BROWSEMODE_DIALOGS = 0x04,
-};
-
class Entry
{
private:
@@ -172,7 +177,7 @@ public:
class TreeListBox : public SvTreeListBox, public DocumentEventListener
{
private:
- sal_uInt16 nMode;
+ BrowseMode nMode;
DocumentEventNotifier m_aNotifier;
void SetEntryBitmaps( SvTreeListEntry * pEntry, const Image& rImage );
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
@@ -213,8 +218,8 @@ public:
bool IsEntryProtected( SvTreeListEntry* pEntry );
- void SetMode( sal_uInt16 nM ) { nMode = nM; }
- sal_uInt16 GetMode() const { return nMode; }
+ void SetMode( BrowseMode nM ) { nMode = nM; }
+ BrowseMode GetMode() const { return nMode; }
SbModule* FindModule( SvTreeListEntry* pEntry );
SbxVariable* FindVariable( SvTreeListEntry* pEntry );