[Libreoffice-commits] core.git: svx/source
Noel Grandin
noel at peralex.com
Mon May 16 08:58:13 UTC 2016
svx/source/form/fmshimp.cxx | 12 ++++++------
svx/source/form/fmview.cxx | 2 +-
svx/source/inc/fmshimp.hxx | 23 +++++++++++++----------
3 files changed, 20 insertions(+), 17 deletions(-)
New commits:
commit a05281b30edc0cf9efecf90a7b6240b90f9c8267
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 13 14:12:55 2016 +0200
convert FORMS to scoped enum
Change-Id: Iaf443c6789b4497a336c2f49a1d5e3c2abe4df32
Reviewed-on: https://gerrit.libreoffice.org/24960
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index b61f9d0..67b5d99 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3638,7 +3638,7 @@ void FmXFormShell::viewActivated( FmFormView& _rCurrentView, bool _bSyncAction /
if ( pPage )
{
if ( !pPage->GetImpl().hasEverBeenActivated() )
- loadForms( pPage, FORMS_LOAD | ( _bSyncAction ? FORMS_SYNC : FORMS_ASYNC ) );
+ loadForms( pPage, LoadFormsFlags::Load | ( _bSyncAction ? LoadFormsFlags::Sync : LoadFormsFlags::Async ) );
pPage->GetImpl().setHasBeenActivated( );
}
@@ -3767,7 +3767,7 @@ IMPL_LINK_NOARG_TYPED( FmXFormShell, OnLoadForms, void*, void )
FmLoadAction aAction = m_aLoadingPages.front();
m_aLoadingPages.pop();
- loadForms( aAction.pPage, aAction.nFlags & ~FORMS_ASYNC );
+ loadForms( aAction.pPage, aAction.nFlags & ~LoadFormsFlags::Async );
}
@@ -3809,12 +3809,12 @@ namespace
}
-void FmXFormShell::loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour /* FORMS_LOAD | FORMS_SYNC */ )
+void FmXFormShell::loadForms( FmFormPage* _pPage, const LoadFormsFlags _nBehaviour /* LoadFormsFlags::Load | LoadFormsFlags::Sync */ )
{
- DBG_ASSERT( ( _nBehaviour & ( FORMS_ASYNC | FORMS_UNLOAD ) ) != ( FORMS_ASYNC | FORMS_UNLOAD ),
+ DBG_ASSERT( ( _nBehaviour & ( LoadFormsFlags::Async | LoadFormsFlags::Unload ) ) != ( LoadFormsFlags::Async | LoadFormsFlags::Unload ),
"FmXFormShell::loadForms: async loading not supported - this will heavily fail!" );
- if ( _nBehaviour & FORMS_ASYNC )
+ if ( _nBehaviour & LoadFormsFlags::Async )
{
m_aLoadingPages.push( FmLoadAction(
_pPage,
@@ -3848,7 +3848,7 @@ void FmXFormShell::loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour /
// a database form must be loaded for
try
{
- if ( 0 == ( _nBehaviour & FORMS_UNLOAD ) )
+ if ( !( _nBehaviour & LoadFormsFlags::Unload ) )
{
if ( lcl_isLoadable( xForm ) && !xForm->isLoaded() )
xForm->load();
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index ae70478..7762f8b 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -253,7 +253,7 @@ void FmFormView::ChangeDesignMode(bool bDesign)
if ( pCurPage )
{
if ( pFormShell && pFormShell->GetImpl() )
- pFormShell->GetImpl()->loadForms( pCurPage, ( bDesign ? FORMS_UNLOAD : FORMS_LOAD ) );
+ pFormShell->GetImpl()->loadForms( pCurPage, ( bDesign ? LoadFormsFlags::Unload : LoadFormsFlags::Load ) );
}
// --- 5. base class functionality
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 1965262..0c620c78 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -84,12 +84,15 @@ namespace o3tl
// flags for controlling the behaviour when calling loadForms
-#define FORMS_LOAD 0x0000 // default: simply load
-#define FORMS_SYNC 0x0000 // default: do in synchronous
-
-#define FORMS_UNLOAD 0x0001 // unload
-#define FORMS_ASYNC 0x0002 // do this async
-
+enum class LoadFormsFlags {
+ Load = 0x0000, // default: simply load
+ Sync = 0x0000, // default: do in synchronous
+ Unload = 0x0001, // unload
+ Async = 0x0002 // do this async
+};
+namespace o3tl {
+ template<> struct typed_flags<LoadFormsFlags> : is_typed_flags<LoadFormsFlags, 0x0003> {};
+}
// a class iterating through all fields of a form which are bound to a field
// sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
@@ -110,10 +113,10 @@ struct FmLoadAction
{
FmFormPage* pPage;
ImplSVEvent * nEventId;
- sal_uInt16 nFlags;
+ LoadFormsFlags nFlags;
- FmLoadAction( ) : pPage( nullptr ), nEventId( nullptr ), nFlags( 0 ) { }
- FmLoadAction( FmFormPage* _pPage, sal_uInt16 _nFlags, ImplSVEvent * _nEventId )
+ FmLoadAction( ) : pPage( nullptr ), nEventId( nullptr ), nFlags( LoadFormsFlags::Load ) { }
+ FmLoadAction( FmFormPage* _pPage, LoadFormsFlags _nFlags, ImplSVEvent * _nEventId )
:pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags )
{
}
@@ -323,7 +326,7 @@ protected:
// form handling
/// load or unload the forms on a page
- SAL_DLLPRIVATE void loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC );
+ SAL_DLLPRIVATE void loadForms( FmFormPage* _pPage, const LoadFormsFlags _nBehaviour = LoadFormsFlags::Load | LoadFormsFlags::Sync );
SAL_DLLPRIVATE void smartControlReset( const css::uno::Reference< css::container::XIndexAccess >& _rxModels );
More information about the Libreoffice-commits
mailing list