convert FLT constants to o3tl::typed_flags
and remove the unused ALLFILESFILTER value Change-Id: I4d7484ed2d9a5efacac652c6557f14caadd89d34
This commit is contained in:
@@ -761,7 +761,7 @@ IMPL_LINK_NOARG( SvtFileDialog, NewFolderHdl_Impl, Button*, void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter )
|
void SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter )
|
||||||
{
|
{
|
||||||
// delete the old user filter and create a new one
|
// delete the old user filter and create a new one
|
||||||
DELETEZ( pImpl->_pUserFilter );
|
DELETEZ( pImpl->_pUserFilter );
|
||||||
@@ -781,26 +781,17 @@ bool SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter )
|
|||||||
SetDefaultExt( pImpl->GetCurFilter( )->GetExtension() );
|
SetDefaultExt( pImpl->GetCurFilter( )->GetExtension() );
|
||||||
else
|
else
|
||||||
EraseDefaultExt();
|
EraseDefaultExt();
|
||||||
|
|
||||||
// outta here
|
|
||||||
return bIsAllFiles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define FLT_NONEMPTY 0x0001
|
AdjustFilterFlags SvtFileDialog::adjustFilter( const OUString& _rFilter )
|
||||||
#define FLT_CHANGED 0x0002
|
|
||||||
#define FLT_USERFILTER 0x0004
|
|
||||||
#define FLT_ALLFILESFILTER 0x0008
|
|
||||||
|
|
||||||
|
|
||||||
sal_uInt16 SvtFileDialog::adjustFilter( const OUString& _rFilter )
|
|
||||||
{
|
{
|
||||||
sal_uInt16 nReturn = 0;
|
AdjustFilterFlags nReturn = AdjustFilterFlags::NONE;
|
||||||
|
|
||||||
const bool bNonEmpty = !_rFilter.isEmpty();
|
const bool bNonEmpty = !_rFilter.isEmpty();
|
||||||
if ( bNonEmpty )
|
if ( bNonEmpty )
|
||||||
{
|
{
|
||||||
nReturn |= FLT_NONEMPTY;
|
nReturn |= AdjustFilterFlags::NonEmpty;
|
||||||
|
|
||||||
bool bFilterChanged = true;
|
bool bFilterChanged = true;
|
||||||
|
|
||||||
@@ -812,17 +803,13 @@ sal_uInt16 SvtFileDialog::adjustFilter( const OUString& _rFilter )
|
|||||||
pFilter = FindFilter_Impl( _rFilter, true, bFilterChanged );
|
pFilter = FindFilter_Impl( _rFilter, true, bFilterChanged );
|
||||||
|
|
||||||
if ( bFilterChanged )
|
if ( bFilterChanged )
|
||||||
nReturn |= FLT_CHANGED;
|
nReturn |= AdjustFilterFlags::Changed;
|
||||||
|
|
||||||
if ( !pFilter )
|
if ( !pFilter )
|
||||||
{
|
{
|
||||||
nReturn |= FLT_USERFILTER;
|
nReturn |= AdjustFilterFlags::UserFilter;
|
||||||
// no filter found : use it as user defined filter
|
// no filter found : use it as user defined filter
|
||||||
if ( createNewUserFilter( _rFilter ) )
|
createNewUserFilter( _rFilter );
|
||||||
{ // it's the "all files" filter
|
|
||||||
nReturn |= FLT_ALLFILESFILTER;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -946,8 +933,8 @@ void SvtFileDialog::OpenHdl_Impl(void* pVoid)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// if a filter was retrieved, there were wildcards !
|
// if a filter was retrieved, there were wildcards !
|
||||||
sal_uInt16 nNewFilterFlags = adjustFilter( aFilter );
|
AdjustFilterFlags nNewFilterFlags = adjustFilter( aFilter );
|
||||||
if ( nNewFilterFlags & FLT_CHANGED )
|
if ( nNewFilterFlags & AdjustFilterFlags::Changed )
|
||||||
{
|
{
|
||||||
// cut off all text before wildcard in edit and select wildcard
|
// cut off all text before wildcard in edit and select wildcard
|
||||||
pImpl->_pEdFileName->SetText( aFilter );
|
pImpl->_pEdFileName->SetText( aFilter );
|
||||||
@@ -1048,14 +1035,14 @@ void SvtFileDialog::OpenHdl_Impl(void* pVoid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( nNewFilterFlags & FLT_CHANGED )
|
if ( nNewFilterFlags & AdjustFilterFlags::Changed )
|
||||||
ExecuteFilter();
|
ExecuteFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !( nNewFilterFlags & FLT_NONEMPTY ) )
|
else if ( !( nNewFilterFlags & AdjustFilterFlags::NonEmpty ) )
|
||||||
{
|
{
|
||||||
// if applicable save URL
|
// if applicable save URL
|
||||||
_aPath = aFileName;
|
_aPath = aFileName;
|
||||||
@@ -1063,7 +1050,7 @@ void SvtFileDialog::OpenHdl_Impl(void* pVoid)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if applicable filter again
|
// if applicable filter again
|
||||||
if ( nNewFilterFlags & FLT_CHANGED )
|
if ( nNewFilterFlags & AdjustFilterFlags::Changed )
|
||||||
ExecuteFilter();
|
ExecuteFilter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1946,8 +1933,8 @@ short SvtFileDialog::PrepareExecute()
|
|||||||
if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) )
|
if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sal_uInt16 nNewFilterFlags = adjustFilter( aFilter );
|
AdjustFilterFlags nNewFilterFlags = adjustFilter( aFilter );
|
||||||
if ( nNewFilterFlags & ( FLT_NONEMPTY | FLT_USERFILTER ) )
|
if ( nNewFilterFlags & ( AdjustFilterFlags::NonEmpty | AdjustFilterFlags::UserFilter ) )
|
||||||
{
|
{
|
||||||
pImpl->_pEdFileName->SetText( aFilter );
|
pImpl->_pEdFileName->SetText( aFilter );
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include <comphelper/configuration.hxx>
|
#include <comphelper/configuration.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
#include "fpdialogbase.hxx"
|
#include "fpdialogbase.hxx"
|
||||||
|
#include <o3tl/typed_flags_set.hxx>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@@ -51,6 +52,17 @@ class SvtURLBox;
|
|||||||
class SvtExpFileDlg_Impl;
|
class SvtExpFileDlg_Impl;
|
||||||
class CustomContainer;
|
class CustomContainer;
|
||||||
|
|
||||||
|
enum class AdjustFilterFlags {
|
||||||
|
NONE = 0x0000,
|
||||||
|
NonEmpty = 0x0001,
|
||||||
|
Changed = 0x0002,
|
||||||
|
UserFilter = 0x0004,
|
||||||
|
};
|
||||||
|
namespace o3tl {
|
||||||
|
template<> struct typed_flags<AdjustFilterFlags> : is_typed_flags<AdjustFilterFlags, 0x0007> {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class SvtFileDialog : public SvtFileDialog_Base
|
class SvtFileDialog : public SvtFileDialog_Base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -238,11 +250,10 @@ private:
|
|||||||
|
|
||||||
/** updates _pUserFilter with a new filter
|
/** updates _pUserFilter with a new filter
|
||||||
<p>No checks for necessity are made.</p>
|
<p>No checks for necessity are made.</p>
|
||||||
@return <TRUE/> if the new filter is "*.*"
|
|
||||||
*/
|
*/
|
||||||
bool createNewUserFilter( const OUString& _rNewFilter );
|
void createNewUserFilter( const OUString& _rNewFilter );
|
||||||
|
|
||||||
sal_uInt16 adjustFilter( const OUString& _rFilter );
|
AdjustFilterFlags adjustFilter( const OUString& _rFilter );
|
||||||
|
|
||||||
// IFilePickerController, needed by OControlAccess
|
// IFilePickerController, needed by OControlAccess
|
||||||
virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const override;
|
virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const override;
|
||||||
|
Reference in New Issue
Block a user