convert BrowseMode to o3tl::typed_flags

Change-Id: Id76339f73b3d4acd4908fd66c4c745c5b2b57c2f
This commit is contained in:
Noel Grandin 2017-02-16 15:36:46 +02:00
parent 14fb8f7960
commit 210db2bf9e
7 changed files with 36 additions and 31 deletions

View File

@ -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;
}

View File

@ -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 );
}

View File

@ -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 |

View File

@ -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,

View File

@ -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();

View File

@ -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;

View File

@ -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 );