diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-12 14:05:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-05-12 14:05:58 +0200 |
commit | 75bcafb4957980c005a793b3f319990854fa8f51 (patch) | |
tree | f573452706b63701615c99751381ac06a299ff96 /xmloff/source/forms | |
parent | 6d12687bc111271aac1e3a01bb3ba872e4eba2d9 (diff) |
convert CCA flags to scoped enum
Change-Id: Ic52872ac60845e92cc3774c693fdd7918efefe89
Diffstat (limited to 'xmloff/source/forms')
-rw-r--r-- | xmloff/source/forms/elementexport.cxx | 224 | ||||
-rw-r--r-- | xmloff/source/forms/elementexport.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 28 | ||||
-rw-r--r-- | xmloff/source/forms/formattributes.cxx | 58 | ||||
-rw-r--r-- | xmloff/source/forms/formattributes.hxx | 65 | ||||
-rw-r--r-- | xmloff/source/forms/layerimport.cxx | 48 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.hxx | 6 |
8 files changed, 222 insertions, 215 deletions
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index b799182bd3c8..2aa81cfed7e4 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -210,8 +210,8 @@ namespace xmloff // now write this AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME), - OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::ServiceName), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ServiceName), sToWriteServiceName); } @@ -234,7 +234,7 @@ namespace xmloff ,m_sReferringControls(_rReferringControls) ,m_nClassId(FormComponentType::CONTROL) ,m_eType( UNKNOWN ) - ,m_nIncludeCommon(0) + ,m_nIncludeCommon(CCAFlags::NONE) ,m_nIncludeDatabase(0) ,m_nIncludeSpecial(0) ,m_nIncludeEvents(0) @@ -252,26 +252,26 @@ namespace xmloff void OControlExport::exportOuterAttributes() { // the control id - if (CCA_NAME & m_nIncludeCommon) + if (CCAFlags::Name & m_nIncludeCommon) { exportStringPropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_NAME), - OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Name), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Name), PROPERTY_NAME ); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_NAME; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::Name; #endif } // the service name - if (m_nIncludeCommon & CCA_SERVICE_NAME) + if (m_nIncludeCommon & CCAFlags::ServiceName) { exportServiceNameAttribute(); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::ServiceName; #endif } } @@ -279,14 +279,14 @@ namespace xmloff void OControlExport::exportInnerAttributes() { // the control id - if (CCA_CONTROL_ID & m_nIncludeCommon) + if (CCAFlags::ControlId & m_nIncludeCommon) { OSL_ENSURE(!m_sControlId.isEmpty(), "OControlExport::exportInnerAttributes: have no control id for the control!"); m_rContext.getGlobalContext().AddAttributeIdLegacy( XML_NAMESPACE_FORM, m_sControlId); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::ControlId; #endif } @@ -412,8 +412,8 @@ namespace xmloff { m_rContext.getGlobalContext().ClearAttrList(); AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL), - OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Label), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label), *pListItems); SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", true, true); } @@ -538,9 +538,9 @@ namespace xmloff // some string properties { // the attribute ids of all properties which are expected to be of type string - static const sal_Int32 nStringPropertyAttributeIds[] = + static const CCAFlags nStringPropertyAttributeIds[] = { - CCA_LABEL, CCA_TITLE + CCAFlags::Label, CCAFlags::Title }; // the names of all properties which are expected to be of type string static const char * aStringPropertyNames[] = @@ -568,9 +568,9 @@ namespace xmloff // some boolean properties { - static const sal_Int32 nBooleanPropertyAttributeIds[] = + static const CCAFlags nBooleanPropertyAttributeIds[] = { // attribute flags - CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE + CCAFlags::CurrentSelected, CCAFlags::Disabled, CCAFlags::Dropdown, CCAFlags::Printable, CCAFlags::ReadOnly, CCAFlags::Selected, CCAFlags::TabStop, CCAFlags::EnableVisible }; static const char * pBooleanPropertyNames[] = { // property names @@ -608,9 +608,9 @@ namespace xmloff // some integer properties { // now the common handling - static sal_Int32 nIntegerPropertyAttributeIds[] = + static CCAFlags nIntegerPropertyAttributeIds[] = { // attribute flags - CCA_SIZE, CCA_TAB_INDEX + CCAFlags::Size, CCAFlags::TabIndex }; static const char * pIntegerPropertyNames[] = { // property names @@ -621,7 +621,7 @@ namespace xmloff 5, 0 }; - if ( m_nIncludeCommon & CCA_MAX_LENGTH ) + if ( m_nIncludeCommon & CCAFlags::MaxLength ) exportedProperty(PROPERTY_MAXTEXTLENGTH); #if OSL_DEBUG_LEVEL > 0 @@ -649,46 +649,46 @@ namespace xmloff // some enum properties { - if (m_nIncludeCommon & CCA_BUTTON_TYPE) + if (m_nIncludeCommon & CCAFlags::ButtonType) { exportEnumPropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_BUTTON_TYPE), - OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::ButtonType), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE, OEnumMapper::getEnumMap(OEnumMapper::epButtonType), FormButtonType_PUSH); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_BUTTON_TYPE; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::ButtonType; #endif } - if ( m_nIncludeCommon & CCA_ORIENTATION ) + if ( m_nIncludeCommon & CCAFlags::Orientation ) { exportEnumPropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace( CCA_ORIENTATION ), - OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ), + OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::Orientation ), + OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), PROPERTY_ORIENTATION, OEnumMapper::getEnumMap( OEnumMapper::epOrientation ), ScrollBarOrientation::HORIZONTAL ); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_ORIENTATION; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::Orientation; #endif } - if ( m_nIncludeCommon & CCA_VISUAL_EFFECT ) + if ( m_nIncludeCommon & CCAFlags::VisualEffect ) { exportEnumPropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace( CCA_VISUAL_EFFECT ), - OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ), + OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::VisualEffect ), + OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT, OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ), VisualEffect::LOOK3D ); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_VISUAL_EFFECT; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::VisualEffect; #endif } } @@ -696,17 +696,17 @@ namespace xmloff // some properties which require a special handling // the target frame - if (m_nIncludeCommon & CCA_TARGET_FRAME) + if (m_nIncludeCommon & CCAFlags::TargetFrame) { exportTargetFrameAttribute(); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_FRAME; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::TargetFrame; #endif } // max text length - if ( m_nIncludeCommon & CCA_MAX_LENGTH ) + if ( m_nIncludeCommon & CCAFlags::MaxLength ) { // normally, the respective property would be "MaxTextLen" // However, if the model has a property "PersistenceMaxTextLength", then we prefer this @@ -718,8 +718,8 @@ namespace xmloff // export it exportInt16PropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace( CCA_MAX_LENGTH ), - OAttributeMetaData::getCommonControlAttributeName( CCA_MAX_LENGTH ), + OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::MaxLength ), + OAttributeMetaData::getCommonControlAttributeName( CCAFlags::MaxLength ), sTextLenPropertyName, 0 ); @@ -730,47 +730,47 @@ namespace xmloff #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_MAX_LENGTH; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::MaxLength; #endif } - if (m_nIncludeCommon & CCA_TARGET_LOCATION) + if (m_nIncludeCommon & CCAFlags::TargetLocation) { exportTargetLocationAttribute(false); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::TargetLocation; #endif } // OJ #99721# - if (m_nIncludeCommon & CCA_IMAGE_DATA) + if (m_nIncludeCommon & CCAFlags::ImageData) { exportImageDataAttribute(); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_IMAGE_DATA; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::ImageData; #endif } // the for attribute // the target frame - if (m_nIncludeCommon & CCA_FOR) + if (m_nIncludeCommon & CCAFlags::For) { if (!m_sReferringControls.isEmpty()) { // there is at least one control referring to the one we're handling currently AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_FOR), - OAttributeMetaData::getCommonControlAttributeName(CCA_FOR), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::For), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::For), m_sReferringControls); } #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~CCA_FOR; + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags::For; #endif } - if ((CCA_CURRENT_VALUE | CCA_VALUE) & m_nIncludeCommon) + if ((CCAFlags::CurrentValue | CCAFlags::Value) & m_nIncludeCommon) { const sal_Char* pCurrentValuePropertyName = nullptr; const sal_Char* pValuePropertyName = nullptr; @@ -778,13 +778,13 @@ namespace xmloff // get the property names getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName); - static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE); - static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE); - static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_VALUE); - static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE); + static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue); + static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value); + static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentValue); + static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Value); // add the attributes if necessary and possible - if (pCurrentValuePropertyName && (CCA_CURRENT_VALUE & m_nIncludeCommon)) + if (pCurrentValuePropertyName && (CCAFlags::CurrentValue & m_nIncludeCommon)) { // don't export the current-value if this value originates from a data binding // #i26944# @@ -798,24 +798,24 @@ namespace xmloff ); } - if (pValuePropertyName && (CCA_VALUE & m_nIncludeCommon)) + if (pValuePropertyName && (CCAFlags::Value & m_nIncludeCommon)) exportGenericPropertyAttribute( nValueAttributeNamespaceKey, pValueAttributeName, pValuePropertyName); - OSL_ENSURE((nullptr == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)), + OSL_ENSURE((nullptr == pValuePropertyName) == (CCAFlags::NONE == (CCAFlags::Value & m_nIncludeCommon)), "OControlExport::exportCommonControlAttributes: no property found for the value attribute!"); - OSL_ENSURE((nullptr == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)), + OSL_ENSURE((nullptr == pCurrentValuePropertyName ) == (CCAFlags::NONE == (CCAFlags::CurrentValue & m_nIncludeCommon)), "OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!"); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking - m_nIncludeCommon = m_nIncludeCommon & ~(CCA_CURRENT_VALUE | CCA_VALUE); + m_nIncludeCommon = m_nIncludeCommon & ~CCAFlags(CCAFlags::CurrentValue | CCAFlags::Value); #endif } - OSL_ENSURE(0 == m_nIncludeCommon, + OSL_ENSURE(CCAFlags::NONE == m_nIncludeCommon, "OControlExport::exportCommonControlAttributes: forgot some flags!"); // in the dbg_util version, we should have removed every bit we handled from the mask, so it should // be 0 now ... @@ -1315,8 +1315,8 @@ namespace xmloff { // there is an item at this position AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL), - OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Label), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label), *pItems); ++pItems; } @@ -1324,8 +1324,8 @@ namespace xmloff { // there is an value at this position AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE), - OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Value), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value), *pValues); ++pValues; } @@ -1334,8 +1334,8 @@ namespace xmloff if (aSelection.end() != aSelectedPos) { // the item at this position is selected AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED), - OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentSelected), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected), sTrue ); aSelection.erase(aSelectedPos); @@ -1345,8 +1345,8 @@ namespace xmloff if (aDefaultSelection.end() != aDefaultSelectedPos) { // the item at this position is selected as default AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED), - OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Selected), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected), sTrue ); aDefaultSelection.erase(aDefaultSelectedPos); @@ -1380,8 +1380,8 @@ namespace xmloff if (aSelection.end() != aSelection.find(i)) { // the (not existent) item at this position is selected AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED), - OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::CurrentSelected), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected), sTrue ); } @@ -1389,8 +1389,8 @@ namespace xmloff if (aDefaultSelection.end() != aDefaultSelection.find(i)) { // the (not existent) item at this position is selected as default AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED), - OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Selected), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected), sTrue ); } @@ -1440,7 +1440,7 @@ namespace xmloff void OControlExport::examine() { - OSL_ENSURE( ( m_nIncludeCommon == 0 ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == 0 ) + OSL_ENSURE( ( m_nIncludeCommon == CCAFlags::NONE ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == 0 ) && ( m_nIncludeEvents == 0 ) && ( m_nIncludeBindings == 0), "OControlExport::examine: called me twice? Not initialized?" ); @@ -1517,14 +1517,14 @@ namespace xmloff // attributes which are common to all the types: // common attributes m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | - CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | + CCAFlags::Printable | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title; if ( ( m_nClassId != FormComponentType::DATEFIELD ) && ( m_nClassId != FormComponentType::TIMEFIELD ) ) // date and time field values are handled differently nowadays - m_nIncludeCommon |= CCA_VALUE; + m_nIncludeCommon |= CCAFlags::Value; // database attributes m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED; @@ -1540,11 +1540,11 @@ namespace xmloff // all controls but the file control fields have a readonly property if ( m_nClassId != FormComponentType::FILECONTROL ) - m_nIncludeCommon |= CCA_READONLY; + m_nIncludeCommon |= CCAFlags::ReadOnly; // a text field has a max text len if ( m_nClassId == FormComponentType::TEXTFIELD ) - m_nIncludeCommon |= CCA_MAX_LENGTH; + m_nIncludeCommon |= CCAFlags::MaxLength; // max and min values and validation: if (FORMATTED_TEXT == m_eType) @@ -1563,7 +1563,7 @@ namespace xmloff && ( TIME != m_eType ) ) { - m_nIncludeCommon |= CCA_CURRENT_VALUE; + m_nIncludeCommon |= CCAFlags::CurrentValue; } } break; @@ -1571,17 +1571,17 @@ namespace xmloff case FormComponentType::FILECONTROL: m_eType = FILE; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | CCA_DISABLED | - CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | - CCA_VALUE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::CurrentValue | CCAFlags::Disabled | + CCAFlags::Printable | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title | + CCAFlags::Value; m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT; break; case FormComponentType::FIXEDTEXT: m_eType = FIXED_TEXT; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | - CCA_PRINTABLE | CCA_TITLE | CCA_FOR; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Label | + CCAFlags::Printable | CCAFlags::Title | CCAFlags::For; m_nIncludeSpecial = SCA_MULTI_LINE; m_nIncludeEvents = EA_CONTROL_EVENTS; break; @@ -1589,9 +1589,9 @@ namespace xmloff case FormComponentType::COMBOBOX: m_eType = COMBOBOX; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | - CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE | - CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::CurrentValue | + CCAFlags::Disabled | CCAFlags::Dropdown | CCAFlags::MaxLength | CCAFlags::Printable | CCAFlags::ReadOnly | CCAFlags::Size | + CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title | CCAFlags::Value; m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION; m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE; m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT; @@ -1600,8 +1600,8 @@ namespace xmloff case FormComponentType::LISTBOX: m_eType = LISTBOX; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN | - CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Dropdown | + CCAFlags::Printable | CCAFlags::Size | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title; m_nIncludeSpecial = SCA_MULTIPLE; m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE_TYPE; m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK; @@ -1623,7 +1623,7 @@ namespace xmloff case FormComponentType::COMMANDBUTTON: m_eType = BUTTON; - m_nIncludeCommon |= CCA_TAB_STOP | CCA_LABEL; + m_nIncludeCommon |= CCAFlags::TabStop | CCAFlags::Label; m_nIncludeSpecial = SCA_DEFAULT_BUTTON | SCA_TOGGLE | SCA_FOCUS_ON_CLICK | SCA_IMAGE_POSITION | SCA_REPEAT_DELAY; SAL_FALLTHROUGH; case FormComponentType::IMAGEBUTTON: @@ -1633,9 +1633,9 @@ namespace xmloff m_eType = IMAGE; } m_nIncludeCommon |= - CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED | - CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME | - CCA_TARGET_LOCATION | CCA_TITLE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::ButtonType | CCAFlags::Disabled | + CCAFlags::ImageData | CCAFlags::Printable | CCAFlags::TabIndex | CCAFlags::TargetFrame | + CCAFlags::TargetLocation | CCAFlags::Title; m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CLICK | EA_ON_DBLCLICK; break; @@ -1645,12 +1645,12 @@ namespace xmloff SAL_FALLTHROUGH; case FormComponentType::RADIOBUTTON: m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | CCA_PRINTABLE | - CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE | CCA_VISUAL_EFFECT; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Label | CCAFlags::Printable | + CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title | CCAFlags::Value | CCAFlags::VisualEffect; if (CHECKBOX != m_eType) { // not coming from the previous case m_eType = RADIO; - m_nIncludeCommon |= CCA_CURRENT_SELECTED | CCA_SELECTED; + m_nIncludeCommon |= CCAFlags::CurrentSelected | CCAFlags::Selected; } if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) ) m_nIncludeSpecial |= SCA_IMAGE_POSITION; @@ -1663,16 +1663,16 @@ namespace xmloff case FormComponentType::GROUPBOX: m_eType = FRAME; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | - CCA_PRINTABLE | CCA_TITLE | CCA_FOR; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Label | + CCAFlags::Printable | CCAFlags::Title | CCAFlags::For; m_nIncludeEvents = EA_CONTROL_EVENTS; break; case FormComponentType::IMAGECONTROL: m_eType = IMAGE_FRAME; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA | - CCA_PRINTABLE | CCA_READONLY | CCA_TITLE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::ImageData | + CCAFlags::Printable | CCAFlags::ReadOnly | CCAFlags::Title; m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED; m_nIncludeEvents = EA_CONTROL_EVENTS; break; @@ -1680,14 +1680,14 @@ namespace xmloff case FormComponentType::HIDDENCONTROL: m_eType = HIDDEN; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_VALUE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Value; break; case FormComponentType::GRIDCONTROL: m_eType = GRID; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE | - CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Printable | + CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title; m_nIncludeEvents = EA_CONTROL_EVENTS; break; @@ -1695,8 +1695,8 @@ namespace xmloff case FormComponentType::SPINBUTTON: m_eType = VALUERANGE; m_nIncludeCommon = - CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE | - CCA_TITLE | CCA_CURRENT_VALUE | CCA_VALUE | CCA_ORIENTATION; + CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Printable | + CCAFlags::Title | CCAFlags::CurrentValue | CCAFlags::Value | CCAFlags::Orientation; m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY; if ( m_nClassId == FormComponentType::SCROLLBAR ) @@ -1716,7 +1716,7 @@ namespace xmloff case FormComponentType::CONTROL: m_eType = GENERIC_CONTROL; // unknown control type - m_nIncludeCommon = CCA_NAME | CCA_SERVICE_NAME; + m_nIncludeCommon = CCAFlags::Name | CCAFlags::ServiceName; // at least a name should be there, 'cause without a name the control could never have been // inserted into its parent container // In addition, the service name is absolutely necessary to create the control upon reading. @@ -1726,7 +1726,7 @@ namespace xmloff } // in general, all control types need to export the control id - m_nIncludeCommon |= CCA_CONTROL_ID; + m_nIncludeCommon |= CCAFlags::ControlId; // is it a control bound to a calc cell? if ( FormCellBindingHelper::livesInSpreadsheetDocument( m_xProps ) ) @@ -1987,8 +1987,8 @@ namespace xmloff m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sColumnServiceName ); // add the attribute - AddAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME) - , OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME) + AddAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::ServiceName) + , OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ServiceName) , sColumnServiceName); // flag the property as "handled" exportedProperty(PROPERTY_COLUMNSERVICENAME); @@ -2006,8 +2006,8 @@ namespace xmloff // the attribute "label" exportStringPropertyAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL), - OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::Label), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label), PROPERTY_LABEL); // the style attribute @@ -2027,12 +2027,12 @@ namespace xmloff OControlExport::examine(); // grid columns miss some properties of the controls they're representing - m_nIncludeCommon &= ~(CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL); + m_nIncludeCommon &= ~CCAFlags(CCAFlags::For | CCAFlags::Printable | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Label); m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE); if (FormComponentType::DATEFIELD != m_nClassId) // except date fields, no column has the DropDown property - m_nIncludeCommon &= ~CCA_DROPDOWN; + m_nIncludeCommon &= ~CCAFlags::Dropdown; } //= OFormExport @@ -2060,8 +2060,8 @@ namespace xmloff m_xProps->getPropertyValue( PROPERTY_URL ) >>= sPropValue; if ( !sPropValue.isEmpty() ) AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_LOCATION), - OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION), + OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::TargetLocation), + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetLocation), sPropValue); if ( m_rContext.getGlobalContext().GetAttrList().getLength() ) { diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx index 9f956e3558f0..07552b574375 100644 --- a/xmloff/source/forms/elementexport.hxx +++ b/xmloff/source/forms/elementexport.hxx @@ -94,7 +94,7 @@ namespace xmloff OUString m_sReferringControls; // list of referring controls (i.e. their id's) sal_Int16 m_nClassId; // class id of the control we're representing ElementType m_eType; // (XML) type of the control we're representing - sal_Int32 m_nIncludeCommon; // common control attributes to include + CCAFlags m_nIncludeCommon; // common control attributes to include sal_Int32 m_nIncludeDatabase; // common database attributes to include sal_Int32 m_nIncludeSpecial; // special attributes to include sal_Int32 m_nIncludeEvents; // events to include diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 85b0b97eeb4b..a43359aac1ec 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -752,8 +752,8 @@ namespace xmloff if ( OElementImport::tryGenericAttribute( _nNamespaceKey, _rLocalName, _rValue ) ) return true; - static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE); - static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE); + static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value); + static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue); static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE); static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE); static const sal_Char* pRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY ); @@ -1193,7 +1193,7 @@ namespace xmloff bool OReferredControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) { - static const char * s_sReferenceAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_FOR); + static const char * s_sReferenceAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::For); if (_rLocalName.equalsAscii(s_sReferenceAttributeName)) { m_sReferringControls = _rValue; @@ -1240,8 +1240,8 @@ namespace xmloff { // need special handling for the State & CurrentState properties: // they're stored as booleans, but expected to be int16 properties - static const sal_Char* pCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED); - static const sal_Char* pSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED); + static const sal_Char* pCurrentSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected); + static const sal_Char* pSelectedAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected); if ( _rLocalName.equalsAscii( pCurrentSelectedAttributeName ) || _rLocalName.equalsAscii( pSelectedAttributeName ) ) @@ -1274,8 +1274,8 @@ namespace xmloff bool OURLReferenceImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue) { - static const sal_Char* s_pTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCA_TARGET_LOCATION ); - static const sal_Char* s_pImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCA_IMAGE_DATA ); + static const sal_Char* s_pTargetLocationAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCAFlags::TargetLocation ); + static const sal_Char* s_pImageDataAttributeName = OAttributeMetaData::getCommonControlAttributeName( CCAFlags::ImageData ); // need to make the URL absolute if // * it's the image-data attribute @@ -1319,7 +1319,7 @@ namespace xmloff OURLReferenceImport::StartElement(_rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); } //= OValueRangeImport @@ -1786,9 +1786,9 @@ namespace xmloff // the current-selected and selected const OUString sSelectedAttribute = rMap.GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED))); + GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected))); const OUString sDefaultSelectedAttribute = rMap.GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED))); + GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected))); // propagate the selected flag bool bSelected(false); @@ -1818,7 +1818,7 @@ namespace xmloff void OComboItemImport::StartElement(const Reference< XAttributeList >& _rxAttrList) { const OUString sLabelAttributeName = GetImport().GetNamespaceMap().GetQNameByKey( - GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL))); + GetPrefix(), OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label))); m_xListBoxImport->implPushBackLabel(_rxAttrList->getValueByName(sLabelAttributeName)); SvXMLImportContext::StartElement(_rxAttrList); @@ -1935,7 +1935,7 @@ namespace xmloff OFormImport_Base::StartElement(_rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); } void OFormImport::EndElement() @@ -2050,8 +2050,8 @@ namespace xmloff OUString sAttrName = _xAttrList->getNameByIndex( i ); sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName, &sLocalName ); - if ( ( nPrefix == OAttributeMetaData::getCommonControlAttributeNamespace( CCA_TARGET_LOCATION ) ) - && ( sLocalName.equalsAscii( OAttributeMetaData::getCommonControlAttributeName( CCA_TARGET_LOCATION ) ) ) + if ( ( nPrefix == OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::TargetLocation ) ) + && ( sLocalName.equalsAscii( OAttributeMetaData::getCommonControlAttributeName( CCAFlags::TargetLocation ) ) ) ) { OUString sValue = _xAttrList->getValueByIndex( i ); diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx index 14b22232b151..22e226f671ea 100644 --- a/xmloff/source/forms/formattributes.cxx +++ b/xmloff/source/forms/formattributes.cxx @@ -35,47 +35,47 @@ namespace xmloff using namespace ::com::sun::star::beans; //= OAttributeMetaData - const sal_Char* OAttributeMetaData::getCommonControlAttributeName(sal_Int32 _nId) + const sal_Char* OAttributeMetaData::getCommonControlAttributeName(CCAFlags _nId) { switch (_nId) { - case CCA_NAME: return "name"; - case CCA_SERVICE_NAME: return "control-implementation"; - case CCA_BUTTON_TYPE: return "button-type"; -// disabled(AddAttributeIdLegacy) case CCA_CONTROL_ID: return "id"; - case CCA_CURRENT_SELECTED: return "current-selected"; - case CCA_CURRENT_VALUE: return "current-value"; - case CCA_DISABLED: return "disabled"; - case CCA_ENABLEVISIBLE: return "visible"; - case CCA_DROPDOWN: return "dropdown"; - case CCA_FOR: return "for"; - case CCA_IMAGE_DATA: return "image-data"; - case CCA_LABEL: return "label"; - case CCA_MAX_LENGTH: return "max-length"; - case CCA_PRINTABLE: return "printable"; - case CCA_READONLY: return "readonly"; - case CCA_SELECTED: return "selected"; - case CCA_SIZE: return "size"; - case CCA_TAB_INDEX: return "tab-index"; - case CCA_TARGET_FRAME: return "target-frame"; - case CCA_TARGET_LOCATION: return "href"; // the only special thing here: TargetLocation is represented by an xlink:href attribute - case CCA_TAB_STOP: return "tab-stop"; - case CCA_TITLE: return "title"; - case CCA_VALUE: return "value"; - case CCA_ORIENTATION: return "orientation"; - case CCA_VISUAL_EFFECT: return "visual-effect"; + case CCAFlags::Name: return "name"; + case CCAFlags::ServiceName: return "control-implementation"; + case CCAFlags::ButtonType: return "button-type"; +// disabled(AddAttributeIdLegacy) case CCAFlags::ControlId: return "id"; + case CCAFlags::CurrentSelected: return "current-selected"; + case CCAFlags::CurrentValue: return "current-value"; + case CCAFlags::Disabled: return "disabled"; + case CCAFlags::EnableVisible: return "visible"; + case CCAFlags::Dropdown: return "dropdown"; + case CCAFlags::For: return "for"; + case CCAFlags::ImageData: return "image-data"; + case CCAFlags::Label: return "label"; + case CCAFlags::MaxLength: return "max-length"; + case CCAFlags::Printable: return "printable"; + case CCAFlags::ReadOnly: return "readonly"; + case CCAFlags::Selected: return "selected"; + case CCAFlags::Size: return "size"; + case CCAFlags::TabIndex: return "tab-index"; + case CCAFlags::TargetFrame: return "target-frame"; + case CCAFlags::TargetLocation: return "href"; // the only special thing here: TargetLocation is represented by an xlink:href attribute + case CCAFlags::TabStop: return "tab-stop"; + case CCAFlags::Title: return "title"; + case CCAFlags::Value: return "value"; + case CCAFlags::Orientation: return "orientation"; + case CCAFlags::VisualEffect: return "visual-effect"; default: OSL_FAIL("OAttributeMetaData::getCommonControlAttributeName: invalid id (maybe you or-ed two flags?)!"); } return ""; } - sal_uInt16 OAttributeMetaData::getCommonControlAttributeNamespace(sal_Int32 _nId) + sal_uInt16 OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags _nId) { - if (CCA_TARGET_LOCATION == _nId) + if (CCAFlags::TargetLocation == _nId) return XML_NAMESPACE_XLINK; - if (CCA_TARGET_FRAME == _nId) + if (CCAFlags::TargetFrame == _nId) return XML_NAMESPACE_OFFICE; return XML_NAMESPACE_FORM; diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx index 3d3877ec40bf..f89d25e37fa0 100644 --- a/xmloff/source/forms/formattributes.hxx +++ b/xmloff/source/forms/formattributes.hxx @@ -28,39 +28,46 @@ #include <sal/types.h> #include <salhelper/simplereferenceobject.hxx> #include <xmloff/xmlnmspe.hxx> +#include <o3tl/typed_flags_set.hxx> struct SvXMLEnumMapEntry; + // flags for common control attributes +enum class CCAFlags { + NONE = 0x00000000, + Name = 0x00000001, + ServiceName = 0x00000002, + ButtonType = 0x00000004, + ControlId = 0x00000008, + CurrentSelected = 0x00000010, + CurrentValue = 0x00000020, + Disabled = 0x00000040, + Dropdown = 0x00000080, + For = 0x00000100, + ImageData = 0x00000200, + Label = 0x00000400, + MaxLength = 0x00000800, + Printable = 0x00001000, + ReadOnly = 0x00002000, + Selected = 0x00004000, + Size = 0x00008000, + TabIndex = 0x00010000, + TargetFrame = 0x00020000, + TargetLocation = 0x00040000, + TabStop = 0x00080000, + Title = 0x00100000, + Value = 0x00200000, + Orientation = 0x00400000, + VisualEffect = 0x00800000, + EnableVisible = 0x01000000, +}; +namespace o3tl { + template<> struct typed_flags<CCAFlags> : is_typed_flags<CCAFlags, 0x01ffffff> {}; +} + namespace xmloff { - // flags for common control attributes - #define CCA_NAME 0x00000001 - #define CCA_SERVICE_NAME 0x00000002 - #define CCA_BUTTON_TYPE 0x00000004 - #define CCA_CONTROL_ID 0x00000008 - #define CCA_CURRENT_SELECTED 0x00000010 - #define CCA_CURRENT_VALUE 0x00000020 - #define CCA_DISABLED 0x00000040 - #define CCA_DROPDOWN 0x00000080 - #define CCA_FOR 0x00000100 - #define CCA_IMAGE_DATA 0x00000200 - #define CCA_LABEL 0x00000400 - #define CCA_MAX_LENGTH 0x00000800 - #define CCA_PRINTABLE 0x00001000 - #define CCA_READONLY 0x00002000 - #define CCA_SELECTED 0x00004000 - #define CCA_SIZE 0x00008000 - #define CCA_TAB_INDEX 0x00010000 - #define CCA_TARGET_FRAME 0x00020000 - #define CCA_TARGET_LOCATION 0x00040000 - #define CCA_TAB_STOP 0x00080000 - #define CCA_TITLE 0x00100000 - #define CCA_VALUE 0x00200000 - #define CCA_ORIENTATION 0x00400000 - #define CCA_VISUAL_EFFECT 0x00800000 - #define CCA_ENABLEVISIBLE 0x01000000 - // flags for database control attributes #define DA_BOUND_COLUMN 0x00000001 #define DA_CONVERT_EMPTY 0x00000002 @@ -152,13 +159,13 @@ namespace xmloff @param _nId the id of the attribute. Has to be one of the CCA_* constants. */ - static const sal_Char* getCommonControlAttributeName(sal_Int32 _nId); + static const sal_Char* getCommonControlAttributeName(CCAFlags _nId); /** calculates the xml namespace key to use for a common control attribute @param _nId the id of the attribute. Has to be one of the CCA_* constants. */ - static sal_uInt16 getCommonControlAttributeNamespace(sal_Int32 _nId); + static sal_uInt16 getCommonControlAttributeNamespace(CCAFlags _nId); /** retrieves the name of an attribute of a form xml representation @param _eAttrib diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx index 87ccd96e9077..ad9d8e86179f 100644 --- a/xmloff/source/forms/layerimport.cxx +++ b/xmloff/source/forms/layerimport.cxx @@ -76,19 +76,19 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter) // build the attribute2property map // string properties which are exported as attributes m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), PROPERTY_NAME); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Name), PROPERTY_NAME); m_aAttributeMetaData.addStringProperty( OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME); m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_IMAGE_DATA), PROPERTY_IMAGEURL); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ImageData), PROPERTY_IMAGEURL); m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Label), PROPERTY_LABEL); m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION), PROPERTY_TARGETURL); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetLocation), PROPERTY_TARGETURL); m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_TITLE), PROPERTY_TITLE); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Title), PROPERTY_TITLE); m_aAttributeMetaData.addStringProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME), PROPERTY_TARGETFRAME, "_blank"); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); m_aAttributeMetaData.addStringProperty( OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD), PROPERTY_DATAFIELD); m_aAttributeMetaData.addStringProperty( @@ -102,34 +102,34 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter) // properties not added because they're already present in another form OSL_ENSURE( - OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION)).equalsAscii( + OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetLocation)).equalsAscii( OAttributeMetaData::getFormAttributeName(faAction)), "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (1)!"); // if this fails, we would have to add a translation from faAction->PROPERTY_TARGETURL - // We did not because we already have one CCA_TARGET_LOCATION->PROPERTY_TARGETURL, - // and CCA_TARGET_LOCATION and faAction should be represented by the same attribute + // We did not because we already have one CCAFlags::TargetLocation->PROPERTY_TARGETURL, + // and CCAFlags::TargetLocation and faAction should be represented by the same attribute OSL_ENSURE( - OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCA_NAME)).equalsAscii( + OUString::createFromAscii(OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Name)).equalsAscii( OAttributeMetaData::getFormAttributeName(faName)), "OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl: invalid attribute names (2)!"); - // the same for faName, CCA_NAME and PROPERTY_NAME + // the same for faName, CCAFlags::Name and PROPERTY_NAME // boolean properties which are exported as attributes m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED), PROPERTY_STATE, false); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentSelected), PROPERTY_STATE, false); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_DISABLED), PROPERTY_ENABLED, false, true); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Disabled), PROPERTY_ENABLED, false, true); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_DROPDOWN), PROPERTY_DROPDOWN, false); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Dropdown), PROPERTY_DROPDOWN, false); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_PRINTABLE), PROPERTY_PRINTABLE, true); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Printable), PROPERTY_PRINTABLE, true); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_READONLY), PROPERTY_READONLY, false); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ReadOnly), PROPERTY_READONLY, false); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED), PROPERTY_DEFAULT_STATE, false); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Selected), PROPERTY_DEFAULT_STATE, false); m_aAttributeMetaData.addBooleanProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_TAB_STOP), PROPERTY_TABSTOP, true); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TabStop), PROPERTY_TABSTOP, true); m_aAttributeMetaData.addBooleanProperty( OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY), PROPERTY_EMPTY_IS_NULL, false); m_aAttributeMetaData.addBooleanProperty( @@ -165,11 +165,11 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter) // the int16 attributes m_aAttributeMetaData.addInt16Property( - OAttributeMetaData::getCommonControlAttributeName(CCA_MAX_LENGTH), PROPERTY_MAXTEXTLENGTH, 0); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::MaxLength), PROPERTY_MAXTEXTLENGTH, 0); m_aAttributeMetaData.addInt16Property( - OAttributeMetaData::getCommonControlAttributeName(CCA_SIZE), PROPERTY_LINECOUNT, 5); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Size), PROPERTY_LINECOUNT, 5); m_aAttributeMetaData.addInt16Property( - OAttributeMetaData::getCommonControlAttributeName(CCA_TAB_INDEX), PROPERTY_TABINDEX, 0); + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TabIndex), PROPERTY_TABINDEX, 0); m_aAttributeMetaData.addInt16Property( OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN), PROPERTY_BOUNDCOLUMN, 0); @@ -179,15 +179,15 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter) // the enum attributes m_aAttributeMetaData.addEnumProperty( - OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ), PROPERTY_VISUAL_EFFECT, + OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT, VisualEffect::LOOK3D, OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ), &::cppu::UnoType<sal_Int16>::get() ); m_aAttributeMetaData.addEnumProperty( - OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ), PROPERTY_ORIENTATION, + OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), PROPERTY_ORIENTATION, ScrollBarOrientation::HORIZONTAL, OEnumMapper::getEnumMap( OEnumMapper::epOrientation ), &::cppu::UnoType<sal_Int32>::get() ); m_aAttributeMetaData.addEnumProperty( - OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE), PROPERTY_BUTTONTYPE, + OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE, FormButtonType_PUSH, OEnumMapper::getEnumMap(OEnumMapper::epButtonType), &::cppu::UnoType<FormButtonType>::get()); m_aAttributeMetaData.addEnumProperty( diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index e1b450b506a9..b5db7bb6ad7c 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -392,15 +392,15 @@ namespace xmloff OUString sTargetFrame = comphelper::getString(m_xProps->getPropertyValue(PROPERTY_TARGETFRAME)); if( sTargetFrame != "_blank" ) { // an empty string and "_blank" have the same meaning and don't have to be written - AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_FRAME) - ,OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_FRAME) + AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::TargetFrame) + ,OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetFrame) ,sTargetFrame); } exportedProperty(PROPERTY_TARGETFRAME); } - void OPropertyExport::exportRelativeTargetLocation(const OUString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType) + void OPropertyExport::exportRelativeTargetLocation(const OUString& _sPropertyName,CCAFlags _nProperty,bool _bAddType) { DBG_CHECK_PROPERTY( _sPropertyName, OUString ); diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index 982c638f8d9b..d81e58614fef 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -65,7 +65,7 @@ namespace xmloff StringSet m_aRemainingProps; // see examinePersistence - void exportRelativeTargetLocation(const OUString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType); + void exportRelativeTargetLocation(const OUString& _sPropertyName, CCAFlags _nProperty,bool _bAddType); protected: IFormsExportContext& m_rContext; @@ -238,7 +238,7 @@ namespace xmloff <p>If _bAddType is set, an additional xlink:type="simple" attribute is also added.</p> */ - inline void exportTargetLocationAttribute(bool _bAddType) { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCA_TARGET_LOCATION,_bAddType); } + inline void exportTargetLocationAttribute(bool _bAddType) { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCAFlags::TargetLocation,_bAddType); } /** add the form:image attribute to the export context. @@ -246,7 +246,7 @@ namespace xmloff <p>The property needs a special handling because the URL's need to be made relative</p> */ - inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA,false); } + inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCAFlags::ImageData,false); } /** flag the style properties as 'already exported' |