summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-11 13:18:56 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-12 06:57:49 +0000
commit6bc3c2bdc5279314881b7e950d76d4d813470d11 (patch)
tree06ac4c7dc6a14b988b4dab83ad6c7a340b5774ad /fpicker
parent1342818790083ec1324f76c4eb1813827a4f5b72 (diff)
Convert SFX_EXTRA to scoped enum
Change-Id: I57fa684d91d10a132c718152ca646edd1c7bd189 Reviewed-on: https://gerrit.libreoffice.org/24882 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx26
-rw-r--r--fpicker/source/office/OfficeFilePicker.hxx4
-rw-r--r--fpicker/source/office/fpdialogbase.hxx24
-rw-r--r--fpicker/source/office/iodlg.cxx22
-rw-r--r--fpicker/source/office/iodlg.hxx4
5 files changed, 43 insertions, 37 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index 8f531d0c01d5..8dea1cbf5a38 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -226,11 +226,11 @@ IMPL_LINK_TYPED( SvtFilePicker, DialogClosedHdl, Dialog&, rDlg, void )
// SvtFilePicker
-WinBits SvtFilePicker::getWinBits( WinBits& rExtraBits )
+WinBits SvtFilePicker::getWinBits( PickerExtraBits& rExtraBits )
{
// set the winbits for creating the filedialog
WinBits nBits = 0L;
- rExtraBits = 0L;
+ rExtraBits = PickerExtraBits::NONE;
// set the standard bits according to the service name
if ( m_nServiceType == TemplateDescription::FILEOPEN_SIMPLE )
@@ -244,48 +244,48 @@ WinBits SvtFilePicker::getWinBits( WinBits& rExtraBits )
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION )
{
nBits = WB_SAVEAS;
- rExtraBits = SFX_EXTRA_AUTOEXTENSION;
+ rExtraBits = PickerExtraBits::AutoExtension;
}
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD )
{
nBits = WB_SAVEAS | SFXWB_PASSWORD;
- rExtraBits = SFX_EXTRA_AUTOEXTENSION;
+ rExtraBits = PickerExtraBits::AutoExtension;
}
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS )
{
nBits = WB_SAVEAS | SFXWB_PASSWORD;
- rExtraBits = SFX_EXTRA_AUTOEXTENSION | SFX_EXTRA_FILTEROPTIONS;
+ rExtraBits = PickerExtraBits::AutoExtension | PickerExtraBits::FilterOptions;
}
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE )
{
nBits = WB_SAVEAS;
- rExtraBits = SFX_EXTRA_AUTOEXTENSION | SFX_EXTRA_TEMPLATES;
+ rExtraBits = PickerExtraBits::AutoExtension | PickerExtraBits::Templates;
}
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION )
{
nBits = WB_SAVEAS;
- rExtraBits = SFX_EXTRA_AUTOEXTENSION | SFX_EXTRA_SELECTION;
+ rExtraBits = PickerExtraBits::AutoExtension | PickerExtraBits::Selection;
}
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE )
{
nBits = WB_OPEN;
- rExtraBits = SFX_EXTRA_INSERTASLINK | SFX_EXTRA_SHOWPREVIEW | SFX_EXTRA_IMAGE_TEMPLATE;
+ rExtraBits = PickerExtraBits::InsertAsLink | PickerExtraBits::ShowPreview | PickerExtraBits::ImageTemplate;
}
else if ( m_nServiceType == TemplateDescription::FILEOPEN_PLAY )
{
nBits = WB_OPEN;
- rExtraBits = SFX_EXTRA_PLAYBUTTON;
+ rExtraBits = PickerExtraBits::PlayButton;
}
else if ( m_nServiceType == TemplateDescription::FILEOPEN_READONLY_VERSION )
{
nBits = WB_OPEN | SFXWB_READONLY;
- rExtraBits = SFX_EXTRA_SHOWVERSIONS;
+ rExtraBits = PickerExtraBits::ShowVersions;
}
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW )
{
nBits = WB_OPEN;
- rExtraBits = SFX_EXTRA_INSERTASLINK | SFX_EXTRA_SHOWPREVIEW;
+ rExtraBits = PickerExtraBits::InsertAsLink | PickerExtraBits::ShowPreview;
}
if ( m_bMultiSelection && ( ( nBits & WB_OPEN ) == WB_OPEN ) )
nBits |= SFXWB_MULTISELECTION;
@@ -448,7 +448,7 @@ sal_Int16 SvtFilePicker::implExecutePicker( )
VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
{
- WinBits nExtraBits;
+ PickerExtraBits nExtraBits;
WinBits nBits = getWinBits( nExtraBits );
VclPtrInstance<SvtFileDialog> dialog( _pParent, nBits, nExtraBits );
@@ -1146,7 +1146,7 @@ SvtRemoteFilePicker::SvtRemoteFilePicker()
VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent )
{
- WinBits nExtraBits;
+ PickerExtraBits nExtraBits;
WinBits nBits = getWinBits( nExtraBits );
VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits); // TODO: extrabits
diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx
index d049ffa01454..9b4abbfc8143 100644
--- a/fpicker/source/office/OfficeFilePicker.hxx
+++ b/fpicker/source/office/OfficeFilePicker.hxx
@@ -37,9 +37,9 @@
#include <list>
class Dialog;
-
struct FilterEntry;
struct ElementEntry_Impl;
+enum class PickerExtraBits;
typedef ::std::list< FilterEntry > FilterList; // can be maintained more effectively
typedef ::std::list < ElementEntry_Impl > ElementList;
@@ -212,7 +212,7 @@ protected:
) override;
protected:
- WinBits getWinBits( WinBits& rExtraBits );
+ WinBits getWinBits( PickerExtraBits& rExtraBits );
virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) override;
bool FilterNameExists( const OUString& rTitle );
diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx
index 69091ae46536..9f88847d410d 100644
--- a/fpicker/source/office/fpdialogbase.hxx
+++ b/fpicker/source/office/fpdialogbase.hxx
@@ -42,15 +42,21 @@ class SvtFileDialogFilter_Impl;
#define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG )
#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection
-#define SFX_EXTRA_AUTOEXTENSION 0x00000001L
-#define SFX_EXTRA_FILTEROPTIONS 0x00000002L
-#define SFX_EXTRA_SHOWVERSIONS 0x00000004L
-#define SFX_EXTRA_INSERTASLINK 0x00000008L
-#define SFX_EXTRA_SHOWPREVIEW 0x00000010L
-#define SFX_EXTRA_TEMPLATES 0x00000020L
-#define SFX_EXTRA_PLAYBUTTON 0x00000040L
-#define SFX_EXTRA_SELECTION 0x00000080L
-#define SFX_EXTRA_IMAGE_TEMPLATE 0x00000100L
+enum class PickerExtraBits {
+ NONE = 0x0000,
+ AutoExtension = 0x0001,
+ FilterOptions = 0x0002,
+ ShowVersions = 0x0004,
+ InsertAsLink = 0x0008,
+ ShowPreview = 0x0010,
+ Templates = 0x0020,
+ PlayButton = 0x0040,
+ Selection = 0x0080,
+ ImageTemplate = 0x0100
+};
+namespace o3tl {
+ template<> struct typed_flags<PickerExtraBits> : is_typed_flags<PickerExtraBits, 0x01ff> {};
+}
#define FILEDIALOG_FILTER_ALL "*.*"
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 38415f3f261c..abc43719bb0a 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -296,7 +296,7 @@ SvtFileDialog::SvtFileDialog
(
vcl::Window* _pParent,
WinBits nBits,
- WinBits nExtraBits
+ PickerExtraBits nExtraBits
) :
SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" )
@@ -332,7 +332,7 @@ SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits )
,_pFileView( nullptr )
,_pFileNotifier( nullptr )
,_pImp( new SvtExpFileDlg_Impl( nBits ) )
- ,_nExtraBits( 0L )
+ ,_nExtraBits( PickerExtraBits::NONE )
,_bIsInExecute( false )
,m_bHasFilename( false )
{
@@ -2484,7 +2484,7 @@ void SvtFileDialog::enableControl( sal_Int16 _nControlId, bool _bEnable )
void SvtFileDialog::AddControls_Impl( )
{
// create the "insert as link" checkbox, if needed
- if ( _nExtraBits & SFX_EXTRA_INSERTASLINK )
+ if ( _nExtraBits & PickerExtraBits::InsertAsLink )
{
_pCbLinkBox ->SetText( SvtResId( STR_SVT_FILEPICKER_INSERT_AS_LINK ) );
_pCbLinkBox ->SetHelpId( HID_FILEDLG_LINK_CB );
@@ -2493,7 +2493,7 @@ void SvtFileDialog::AddControls_Impl( )
}
// create the "show preview" checkbox ( and the preview window, too ), if needed
- if ( _nExtraBits & SFX_EXTRA_SHOWPREVIEW )
+ if ( _nExtraBits & PickerExtraBits::ShowPreview )
{
_pImp->_aIniKey = "ImportGraphicDialog";
// because the "<All Formats> (*.bmp,*...)" entry is to wide,
@@ -2517,7 +2517,7 @@ void SvtFileDialog::AddControls_Impl( )
_pPrevBmp->SetAccessibleName(SVT_RESSTR(STR_PREVIEW));
}
- if ( _nExtraBits & SFX_EXTRA_AUTOEXTENSION )
+ if ( _nExtraBits & PickerExtraBits::AutoExtension )
{
_pImp->_pCbAutoExtension->SetText( SvtResId( STR_SVT_FILEPICKER_AUTO_EXTENSION ) );
_pImp->_pCbAutoExtension->Check();
@@ -2525,21 +2525,21 @@ void SvtFileDialog::AddControls_Impl( )
_pImp->_pCbAutoExtension->Show();
}
- if ( _nExtraBits & SFX_EXTRA_FILTEROPTIONS )
+ if ( _nExtraBits & PickerExtraBits::FilterOptions )
{
_pImp->_pCbOptions->SetText( SvtResId( STR_SVT_FILEPICKER_FILTER_OPTIONS ) );
_pImp->_pCbOptions->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
_pImp->_pCbOptions->Show();
}
- if ( _nExtraBits & SFX_EXTRA_SELECTION )
+ if ( _nExtraBits & PickerExtraBits::Selection )
{
_pCbSelection->SetText( SvtResId( STR_SVT_FILEPICKER_SELECTION ) );
_pCbSelection->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
_pCbSelection->Show();
}
- if ( _nExtraBits & SFX_EXTRA_PLAYBUTTON )
+ if ( _nExtraBits & PickerExtraBits::PlayButton )
{
_pPbPlay->SetText( SvtResId( STR_SVT_FILEPICKER_PLAY ) );
_pPbPlay->SetHelpId( HID_FILESAVE_DOPLAY );
@@ -2547,7 +2547,7 @@ void SvtFileDialog::AddControls_Impl( )
_pPbPlay->Show();
}
- if ( _nExtraBits & SFX_EXTRA_SHOWVERSIONS )
+ if ( _nExtraBits & PickerExtraBits::ShowVersions )
{
_pImp->_pFtFileVersion->SetText( SvtResId( STR_SVT_FILEPICKER_VERSION ) );
_pImp->_pFtFileVersion->Show();
@@ -2555,7 +2555,7 @@ void SvtFileDialog::AddControls_Impl( )
_pImp->_pLbFileVersion->SetHelpId( HID_FILEOPEN_VERSION );
_pImp->_pLbFileVersion->Show();
}
- else if ( _nExtraBits & SFX_EXTRA_TEMPLATES )
+ else if ( _nExtraBits & PickerExtraBits::Templates )
{
_pImp->_pFtTemplates->SetText( SvtResId( STR_SVT_FILEPICKER_TEMPLATES ) );
_pImp->_pFtTemplates->Show();
@@ -2566,7 +2566,7 @@ void SvtFileDialog::AddControls_Impl( )
// is set in the "Templates mode". This was hidden in the previous implementation.
// Shouldn't this be a more meaningfull help id.
}
- else if ( _nExtraBits & SFX_EXTRA_IMAGE_TEMPLATE )
+ else if ( _nExtraBits & PickerExtraBits::ImageTemplate )
{
_pImp->_pFtImageTemplates->SetText( SvtResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) );
_pImp->_pFtImageTemplates->Show();
diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx
index a83da18df277..6b0b9353c9b4 100644
--- a/fpicker/source/office/iodlg.hxx
+++ b/fpicker/source/office/iodlg.hxx
@@ -66,7 +66,7 @@ private:
VclPtr<Splitter> _pSplitter;
::svt::IFilePickerListener* _pFileNotifier;
SvtExpFileDlg_Impl* _pImp;
- WinBits _nExtraBits;
+ PickerExtraBits _nExtraBits;
bool _bIsInExecute : 1;
ImageList m_aImages;
@@ -159,7 +159,7 @@ protected:
short PrepareExecute();
public:
- SvtFileDialog( vcl::Window* _pParent, WinBits nBits, WinBits nExtraBits );
+ SvtFileDialog( vcl::Window* _pParent, WinBits nBits, PickerExtraBits nExtraBits );
SvtFileDialog( vcl::Window* _pParent, WinBits nBits );
virtual ~SvtFileDialog();
virtual void dispose() override;