diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-22 16:39:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-04 06:38:03 +0000 |
commit | 5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb (patch) | |
tree | db860b2365f8cb0e2fab4772e80e4e38d4d89b37 /extensions | |
parent | starmath: Simplify code parsing nospace (diff) | |
download | core-5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb.tar.gz core-5676ced82539d9e40bde6196d2aa3b2e4c7b3fdb.zip |
make UNO enums scoped for internal LO code
this modifies codemaker so that, for an UNO enum, we generate code
that effectively looks like:
#ifdef LIBO_INTERNAL_ONLY && HAVE_CX11_CONSTEXPR
enum class XXX {
ONE = 1
};
constexpr auto ONE = XXX_ONE;
#else
...the old normal way..
#endif
which means that for LO internal code, the enums are scoped.
The "constexpr auto" trick acts like an alias so we don't have to
use scoped naming everywhere.
Change-Id: I3054ecb230e8666ce98b4a9cb87b384df5f64fb4
Reviewed-on: https://gerrit.libreoffice.org/34546
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 10 | ||||
-rw-r--r-- | extensions/source/propctrlr/pushbuttonnavigation.cxx | 25 | ||||
-rw-r--r-- | extensions/source/propctrlr/pushbuttonnavigation.hxx | 3 |
3 files changed, 20 insertions, 18 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 0593d8839492..6db571daa953 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2549,15 +2549,16 @@ namespace pcr // Auslesen des ListSourceTypes Any aListSourceType( m_xComponent->getPropertyValue( PROPERTY_LISTSOURCETYPE ) ); - sal_Int32 nListSourceType = ListSourceType_VALUELIST; + sal_Int32 nListSourceType = (sal_Int32)ListSourceType_VALUELIST; ::cppu::enum2int( nListSourceType, aListSourceType ); + ListSourceType eListSourceType = (ListSourceType)nListSourceType; _out_rDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_LISTSOURCE ); _out_rDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_LISTSOURCE ) ); // Enums setzen - switch( nListSourceType ) + switch( eListSourceType ) { case ListSourceType_VALUELIST: _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::StringListField, false ); @@ -2570,7 +2571,7 @@ namespace pcr std::vector< OUString > aListEntries; if ( impl_ensureRowsetConnection_nothrow() ) { - if ( nListSourceType == ListSourceType_QUERY ) + if ( eListSourceType == ListSourceType_QUERY ) impl_fillQueryNames_throw( aListEntries ); else impl_fillTableNames_throw( aListEntries ); @@ -2583,6 +2584,7 @@ namespace pcr impl_ensureRowsetConnection_nothrow(); _out_rDescriptor.HasPrimaryButton = m_xRowSetConnection.is(); break; + default: break; } } @@ -3115,7 +3117,7 @@ namespace pcr bool ValueListCommandUI::getEscapeProcessing() const { - enum ListSourceType eType( ListSourceType_SQL ); + ListSourceType eType = ListSourceType_SQL; OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType ); OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ), "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" ); diff --git a/extensions/source/propctrlr/pushbuttonnavigation.cxx b/extensions/source/propctrlr/pushbuttonnavigation.cxx index e4c75605fdfb..d0424d1df37c 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.cxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.cxx @@ -18,7 +18,6 @@ */ #include "pushbuttonnavigation.hxx" -#include <com/sun/star/form/FormButtonType.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include "formstrings.hxx" #include <comphelper/extract.hxx> @@ -97,14 +96,14 @@ namespace pcr } - sal_Int32 PushButtonNavigation::implGetCurrentButtonType() const + FormButtonType PushButtonNavigation::implGetCurrentButtonType() const { - sal_Int32 nButtonType = FormButtonType_PUSH; + sal_Int32 nButtonType = (sal_Int32)FormButtonType_PUSH; if ( !m_xControlModel.is() ) - return nButtonType; + return (FormButtonType)nButtonType; OSL_VERIFY( ::cppu::enum2int( nButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); - if ( nButtonType == FormButtonType_URL ) + if ( nButtonType == (sal_Int32)FormButtonType_URL ) { // there's a chance that this is a "virtual" button type // (which are realized by special URLs) @@ -116,7 +115,7 @@ namespace pcr // it actually *is* a virtual button type nButtonType = s_nFirstVirtualButtonType + nNavigationURLIndex; } - return nButtonType; + return (FormButtonType)nButtonType; } @@ -145,7 +144,7 @@ namespace pcr try { - sal_Int32 nButtonType = FormButtonType_PUSH; + sal_Int32 nButtonType = (sal_Int32)FormButtonType_PUSH; OSL_VERIFY( ::cppu::enum2int( nButtonType, _rValue ) ); OUString sTargetURL; @@ -155,7 +154,7 @@ namespace pcr const sal_Char* pURL = lcl_getNavigationURL( nButtonType - s_nFirstVirtualButtonType ); sTargetURL = OUString::createFromAscii( pURL ); - nButtonType = FormButtonType_URL; + nButtonType = (sal_Int32)FormButtonType_URL; } m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, makeAny( static_cast< FormButtonType >( nButtonType ) ) ); @@ -182,10 +181,10 @@ namespace pcr eState = xStateAccess->getPropertyState( PROPERTY_BUTTONTYPE ); if ( eState == PropertyState_DIRECT_VALUE ) { - sal_Int32 nRealButtonType = FormButtonType_PUSH; + sal_Int32 nRealButtonType = (sal_Int32)FormButtonType_PUSH; OSL_VERIFY( ::cppu::enum2int( nRealButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); // perhaps it's one of the virtual button types? - if ( FormButtonType_URL == nRealButtonType ) + if ( (sal_Int32)FormButtonType_URL == nRealButtonType ) { // yes, it is -> rely on the state of the URL property eState = xStateAccess->getPropertyState( PROPERTY_TARGET_URL ); @@ -213,8 +212,8 @@ namespace pcr aReturn = m_xControlModel->getPropertyValue( PROPERTY_TARGET_URL ); if ( m_bIsPushButton ) { - sal_Int32 nCurrentButtonType = implGetCurrentButtonType(); - bool bIsVirtualButtonType = nCurrentButtonType >= s_nFirstVirtualButtonType; + FormButtonType nCurrentButtonType = implGetCurrentButtonType(); + bool bIsVirtualButtonType = nCurrentButtonType >= (FormButtonType)s_nFirstVirtualButtonType; if ( bIsVirtualButtonType ) { // pretend (to the user) that there's no URL set - since @@ -271,7 +270,7 @@ namespace pcr bool PushButtonNavigation::currentButtonTypeIsOpenURL() const { - sal_Int32 nButtonType( FormButtonType_PUSH ); + FormButtonType nButtonType( FormButtonType_PUSH ); try { nButtonType = implGetCurrentButtonType(); diff --git a/extensions/source/propctrlr/pushbuttonnavigation.hxx b/extensions/source/propctrlr/pushbuttonnavigation.hxx index 6a8ee54248bd..2ee906b0c406 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.hxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/form/FormButtonType.hpp> namespace pcr @@ -89,7 +90,7 @@ namespace pcr bool hasNonEmptyCurrentTargetURL() const; private: - sal_Int32 implGetCurrentButtonType() const; + css::form::FormButtonType implGetCurrentButtonType() const; }; |