Kaydet (Commit) db92adda authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: turn RTFOverwrite into a C++11 scoped enumeration

Change-Id: Ic49033c85f77be8ba415078ae5e3518ef0faae75
üst fa15d039
...@@ -738,7 +738,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap ...@@ -738,7 +738,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
RTFSprms aPathAttributes; RTFSprms aPathAttributes;
aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, RTFValue::Pointer_t(new RTFValue(*oX))); aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, RTFValue::Pointer_t(new RTFValue(*oX)));
aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, RTFValue::Pointer_t(new RTFValue(*oY))); aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, RTFValue::Pointer_t(new RTFValue(*oY)));
aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, RTFValue::Pointer_t(new RTFValue(aPathAttributes)), OVERWRITE_NO_APPEND); aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, RTFValue::Pointer_t(new RTFValue(aPathAttributes)), RTFOverwrite::NO_APPEND);
} }
} }
while (nCharIndex >= 0); while (nCharIndex >= 0);
......
...@@ -102,12 +102,12 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr ...@@ -102,12 +102,12 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr
{ {
ensureCopyBeforeWrite(); ensureCopyBeforeWrite();
bool bFound = false; bool bFound = false;
if (eOverwrite == OVERWRITE_YES || eOverwrite == OVERWRITE_NO_IGNORE) if (eOverwrite == RTFOverwrite::YES || eOverwrite == RTFOverwrite::NO_IGNORE)
{ {
for (RTFSprms::Iterator_t i = m_pSprms->begin(); i != m_pSprms->end(); ++i) for (RTFSprms::Iterator_t i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
if (i->first == nKeyword) if (i->first == nKeyword)
{ {
if (eOverwrite == OVERWRITE_YES) if (eOverwrite == RTFOverwrite::YES)
{ {
i->second = pValue; i->second = pValue;
return; return;
...@@ -119,7 +119,7 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr ...@@ -119,7 +119,7 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr
} }
} }
} }
if (eOverwrite == OVERWRITE_NO_APPEND || !bFound) if (eOverwrite == RTFOverwrite::NO_APPEND || !bFound)
m_pSprms->push_back(std::make_pair(nKeyword, pValue)); m_pSprms->push_back(std::make_pair(nKeyword, pValue));
} }
......
...@@ -45,11 +45,11 @@ inline void intrusive_ptr_release(RTFSprmsImpl* p) ...@@ -45,11 +45,11 @@ inline void intrusive_ptr_release(RTFSprmsImpl* p)
delete p; delete p;
} }
enum RTFOverwrite enum class RTFOverwrite
{ {
OVERWRITE_YES, ///< Yes, if an existing key is found, overwrite it. YES, ///< Yes, if an existing key is found, overwrite it.
OVERWRITE_NO_APPEND, ///< No, always append the value to the end of the list. NO_APPEND, ///< No, always append the value to the end of the list.
OVERWRITE_NO_IGNORE ///< No, if the key is already in the list, then ignore, otherwise append. NO_IGNORE ///< No, if the key is already in the list, then ignore, otherwise append.
}; };
/// A list of RTFSprm with a copy constructor that performs a deep copy. /// A list of RTFSprm with a copy constructor that performs a deep copy.
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
RTFSprms& operator=(const RTFSprms& rOther); RTFSprms& operator=(const RTFSprms& rOther);
RTFValue::Pointer_t find(Id nKeyword, bool bFirst = true, bool bForWrite = false); RTFValue::Pointer_t find(Id nKeyword, bool bFirst = true, bool bForWrite = false);
/// Does the same as ->push_back(), except that it can overwrite or ignore existing entries. /// Does the same as ->push_back(), except that it can overwrite or ignore existing entries.
void set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwrite = OVERWRITE_YES); void set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwrite = RTFOverwrite::YES);
bool erase(Id nKeyword); bool erase(Id nKeyword);
/// Removes elements which are already in the reference set. /// Removes elements which are already in the reference set.
/// Also insert default values to override attributes of style /// Also insert default values to override attributes of style
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment