summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-23 11:11:33 +0200
committerNoel Grandin <noel@peralex.com>2015-07-24 09:52:08 +0200
commit3e65f5fe662bf66cab65a163b45c55c27aa24c44 (patch)
tree8cab7d84f37538acfeda820c0e3507fae8225803
parentf1cf05d81d80c87b9942daff5d60dc0ebdd474b5 (diff)
convert GA_ constants to enum class
Change-Id: I51a197ed530c0a0e432620af23070c90a89a9ac3
-rw-r--r--svx/source/form/fmshimp.cxx44
-rw-r--r--svx/source/inc/fmshimp.hxx23
2 files changed, 35 insertions, 32 deletions
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index dd639bdb96cb..5d0d4b5775d4 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1333,7 +1333,7 @@ void FmXFormShell::checkControlConversionSlotsForCurrentSelection( Menu& rMenu )
}
-void FmXFormShell::LoopGrids(sal_Int16 nWhat)
+void FmXFormShell::LoopGrids(LoopGridsSync nSync, LoopGridsFlags nFlags)
{
if ( impl_checkDisposed() )
return;
@@ -1357,15 +1357,15 @@ void FmXFormShell::LoopGrids(sal_Int16 nWhat)
if (!::comphelper::hasProperty(FM_PROP_CURSORCOLOR, xModelSet) || !::comphelper::hasProperty(FM_PROP_ALWAYSSHOWCURSOR, xModelSet) || !::comphelper::hasProperty(FM_PROP_DISPLAYSYNCHRON, xModelSet))
continue;
- switch (nWhat & GA_SYNC_MASK)
+ switch (nSync)
{
- case GA_DISABLE_SYNC:
- {
- sal_Bool bB(sal_False);
- xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,cppu::UnoType<bool>::get()));
- }
- break;
- case GA_FORCE_SYNC:
+ case LoopGridsSync::DISABLE_SYNC:
+ {
+ sal_Bool bB(sal_False);
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,cppu::UnoType<bool>::get()));
+ }
+ break;
+ case LoopGridsSync::FORCE_SYNC:
{
Any aOldVal( xModelSet->getPropertyValue(FM_PROP_DISPLAYSYNCHRON) );
sal_Bool bB(sal_True);
@@ -1373,15 +1373,15 @@ void FmXFormShell::LoopGrids(sal_Int16 nWhat)
xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, aOldVal);
}
break;
- case GA_ENABLE_SYNC:
- {
- sal_Bool bB(sal_True);
- xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,cppu::UnoType<bool>::get()));
- }
- break;
+ case LoopGridsSync::ENABLE_SYNC:
+ {
+ sal_Bool bB(sal_True);
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,cppu::UnoType<bool>::get()));
+ }
+ break;
}
- if (nWhat & GA_DISABLE_ROCTRLR)
+ if (nFlags & LoopGridsFlags::DISABLE_ROCTRLR)
{
sal_Bool bB(sal_False);
xModelSet->setPropertyValue(FM_PROP_ALWAYSSHOWCURSOR, Any(&bB,cppu::UnoType<bool>::get()));
@@ -1391,12 +1391,6 @@ void FmXFormShell::LoopGrids(sal_Int16 nWhat)
else
xModelSet->setPropertyValue(FM_PROP_CURSORCOLOR, Any()); // this should be the default
}
- else if (nWhat & GA_ENABLE_ROCTRLR)
- {
- sal_Bool bB(sal_True);
- xModelSet->setPropertyValue(FM_PROP_ALWAYSSHOWCURSOR, Any(&bB,cppu::UnoType<bool>::get()));
- xModelSet->setPropertyValue(FM_PROP_CURSORCOLOR, makeAny(sal_Int32(COL_LIGHTRED)));
- }
}
}
}
@@ -1568,7 +1562,7 @@ void FmXFormShell::ExecuteSearch()
}
// um eventuelle GridControls, die ich kenne, kuemmern
- LoopGrids(GA_DISABLE_SYNC /*| GA_ENABLE_ROCTRLR*/);
+ LoopGrids(LoopGridsSync::DISABLE_SYNC);
// jetzt bin ich reif fuer den Dialog
// wenn die potentiellen Deadlocks, die durch die Benutzung des Solar-Mutex in MTs VCLX...-Klasen entstehen, irgendwann mal
@@ -1589,7 +1583,7 @@ void FmXFormShell::ExecuteSearch()
}
// GridControls wieder restaurieren
- LoopGrids(GA_ENABLE_SYNC | GA_DISABLE_ROCTRLR);
+ LoopGrids(LoopGridsSync::ENABLE_SYNC, LoopGridsFlags::DISABLE_ROCTRLR);
m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView());
// da ich in OnFoundData (fals ich dort war) Controls markiert habe
@@ -2231,7 +2225,7 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
OSL_FAIL("Can position on bookmark!");
}
- LoopGrids(GA_FORCE_SYNC);
+ LoopGrids(LoopGridsSync::FORCE_SYNC);
// und zum Feld (dazu habe ich vor dem Start des Suchens die XVclComponent-Interfaces eingesammelt)
SAL_WARN_IF(static_cast<size_t>(pfriWhere->nFieldPos) >=
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 12d302bb7819..0d521ba3b213 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -57,6 +57,7 @@
#include <unotools/configitem.hxx>
#include "formcontrolling.hxx"
#include "fmdocumentclassification.hxx"
+#include <o3tl/typed_flags_set.hxx>
#include <queue>
#include <set>
@@ -69,12 +70,20 @@ typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::X
// catch database exceptions if they occur
#define DO_SAFE(statement) try { statement; } catch( const Exception& ) { OSL_FAIL("unhandled exception (I tried to move a cursor (or something like that).)"); }
-#define GA_DISABLE_SYNC 1
-#define GA_FORCE_SYNC 2
-#define GA_ENABLE_SYNC 3
-#define GA_SYNC_MASK 3
-#define GA_DISABLE_ROCTRLR 4
-#define GA_ENABLE_ROCTRLR 8
+enum class LoopGridsSync {
+ DISABLE_SYNC = 1,
+ FORCE_SYNC = 2,
+ ENABLE_SYNC = 3
+};
+enum class LoopGridsFlags
+{
+ NONE = 0,
+ DISABLE_ROCTRLR = 4
+};
+namespace o3tl
+{
+ template<> struct typed_flags<LoopGridsFlags> : is_typed_flags<LoopGridsFlags, 0x04> {};
+}
// flags for controlling the behaviour when calling loadForms
@@ -463,7 +472,7 @@ private:
DECL_DLLPRIVATE_LINK(OnFirstTimeActivation, void*);
DECL_DLLPRIVATE_LINK(OnFormsCreated, FmFormPage*);
- SAL_DLLPRIVATE void LoopGrids(sal_Int16 nWhat);
+ SAL_DLLPRIVATE void LoopGrids(LoopGridsSync nSync, LoopGridsFlags nWhat = LoopGridsFlags::NONE);
// Invalidierung von Slots
SAL_DLLPRIVATE void InvalidateSlot( sal_Int16 nId, bool bWithId );