Kaydet (Commit) 064a0152 authored tarafından Noel Grandin's avatar Noel Grandin

use std::vector in OListAndComboImport

Change-Id: Ie0c0e68512e92879774c754c89354e2c83cd149b
Reviewed-on: https://gerrit.libreoffice.org/38300Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 697173f6
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <comphelper/extract.hxx> #include <comphelper/extract.hxx>
#include <comphelper/types.hxx> #include <comphelper/types.hxx>
#include <comphelper/sequence.hxx>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
...@@ -82,14 +83,6 @@ namespace xmloff ...@@ -82,14 +83,6 @@ namespace xmloff
} }
}; };
template <class ELEMENT>
void pushBackSequenceElement(Sequence< ELEMENT >& _rContainer, const ELEMENT& _rElement)
{
sal_Int32 nLen = _rContainer.getLength();
_rContainer.realloc(nLen + 1);
_rContainer[nLen] = _rElement;
}
//= OElementNameMap //= OElementNameMap
OElementNameMap::MapString2Element OElementNameMap::s_sElementTranslations; OElementNameMap::MapString2Element OElementNameMap::s_sElementTranslations;
...@@ -1583,12 +1576,12 @@ namespace xmloff ...@@ -1583,12 +1576,12 @@ namespace xmloff
// the string item list // the string item list
PropertyValue aItemList; PropertyValue aItemList;
aItemList.Name = PROPERTY_STRING_ITEM_LIST; aItemList.Name = PROPERTY_STRING_ITEM_LIST;
aItemList.Value <<= m_aListSource; aItemList.Value <<= comphelper::containerToSequence(m_aListSource);
implPushBackPropertyValue(aItemList); implPushBackPropertyValue(aItemList);
if (OControlElement::LISTBOX == m_eElementType) if (OControlElement::LISTBOX == m_eElementType)
{ {
OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems), OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
"OListAndComboImport::EndElement: inconsistence between labels and values!"); "OListAndComboImport::EndElement: inconsistence between labels and values!");
if ( !m_bEncounteredLSAttrib ) if ( !m_bEncounteredLSAttrib )
...@@ -1596,20 +1589,20 @@ namespace xmloff ...@@ -1596,20 +1589,20 @@ namespace xmloff
// the value sequence // the value sequence
PropertyValue aValueList; PropertyValue aValueList;
aValueList.Name = PROPERTY_LISTSOURCE; aValueList.Name = PROPERTY_LISTSOURCE;
aValueList.Value <<= m_aValueList; aValueList.Value <<= comphelper::containerToSequence(m_aValueList);
implPushBackPropertyValue(aValueList); implPushBackPropertyValue(aValueList);
} }
// the select sequence // the select sequence
PropertyValue aSelected; PropertyValue aSelected;
aSelected.Name = PROPERTY_SELECT_SEQ; aSelected.Name = PROPERTY_SELECT_SEQ;
aSelected.Value <<= m_aSelectedSeq; aSelected.Value <<= comphelper::containerToSequence(m_aSelectedSeq);
implPushBackPropertyValue(aSelected); implPushBackPropertyValue(aSelected);
// the default select sequence // the default select sequence
PropertyValue aDefaultSelected; PropertyValue aDefaultSelected;
aDefaultSelected.Name = PROPERTY_DEFAULT_SELECT_SEQ; aDefaultSelected.Name = PROPERTY_DEFAULT_SELECT_SEQ;
aDefaultSelected.Value <<= m_aDefaultSelectedSeq; aDefaultSelected.Value <<= comphelper::containerToSequence(m_aDefaultSelectedSeq);
implPushBackPropertyValue(aDefaultSelected); implPushBackPropertyValue(aDefaultSelected);
} }
...@@ -1688,7 +1681,7 @@ namespace xmloff ...@@ -1688,7 +1681,7 @@ namespace xmloff
{ {
OSL_ENSURE(!m_nEmptyListItems, "OListAndComboImport::implPushBackValue: label list is already done!"); OSL_ENSURE(!m_nEmptyListItems, "OListAndComboImport::implPushBackValue: label list is already done!");
if (!m_nEmptyListItems) if (!m_nEmptyListItems)
pushBackSequenceElement(m_aListSource, _rLabel); m_aListSource.push_back(_rLabel);
} }
void OListAndComboImport::implPushBackValue(const OUString& _rValue) void OListAndComboImport::implPushBackValue(const OUString& _rValue)
...@@ -1702,7 +1695,7 @@ namespace xmloff ...@@ -1702,7 +1695,7 @@ namespace xmloff
// the first element of the sequence // the first element of the sequence
// All other values in the file are invalid // All other values in the file are invalid
pushBackSequenceElement( m_aValueList, _rValue ); m_aValueList.push_back( _rValue );
} }
} }
...@@ -1718,20 +1711,20 @@ namespace xmloff ...@@ -1718,20 +1711,20 @@ namespace xmloff
void OListAndComboImport::implSelectCurrentItem() void OListAndComboImport::implSelectCurrentItem()
{ {
OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems), OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
"OListAndComboImport::implSelectCurrentItem: inconsistence between labels and values!"); "OListAndComboImport::implSelectCurrentItem: inconsistence between labels and values!");
sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.getLength() - 1 + m_nEmptyListItems); sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.size() - 1 + m_nEmptyListItems);
pushBackSequenceElement(m_aSelectedSeq, nItemNumber); m_aSelectedSeq.push_back(nItemNumber);
} }
void OListAndComboImport::implDefaultSelectCurrentItem() void OListAndComboImport::implDefaultSelectCurrentItem()
{ {
OSL_ENSURE((m_aListSource.getLength() + m_nEmptyListItems) == (m_aValueList.getLength() + m_nEmptyValueItems), OSL_ENSURE((m_aListSource.size() + m_nEmptyListItems) == (m_aValueList.size() + m_nEmptyValueItems),
"OListAndComboImport::implDefaultSelectCurrentItem: inconsistence between labels and values!"); "OListAndComboImport::implDefaultSelectCurrentItem: inconsistence between labels and values!");
sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.getLength() - 1 + m_nEmptyListItems); sal_Int16 nItemNumber = (sal_Int16)(m_aListSource.size() - 1 + m_nEmptyListItems);
pushBackSequenceElement(m_aDefaultSelectedSeq, nItemNumber); m_aDefaultSelectedSeq.push_back(nItemNumber);
} }
//= OListOptionImport //= OListOptionImport
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <sal/config.h> #include <sal/config.h>
#include <map>
#include "propertyimport.hxx" #include "propertyimport.hxx"
#include "controlelement.hxx" #include "controlelement.hxx"
#include "valueproperties.hxx" #include "valueproperties.hxx"
...@@ -37,6 +35,9 @@ ...@@ -37,6 +35,9 @@
#include <com/sun/star/form/XGridColumnFactory.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <map>
#include <vector>
class XMLTextStyleContext; class XMLTextStyleContext;
namespace xmloff namespace xmloff
{ {
...@@ -460,23 +461,23 @@ namespace xmloff ...@@ -460,23 +461,23 @@ namespace xmloff
friend class OComboItemImport; friend class OComboItemImport;
protected: protected:
css::uno::Sequence< OUString > std::vector<OUString >
m_aListSource; m_aListSource;
css::uno::Sequence< OUString > std::vector< OUString >
m_aValueList; m_aValueList;
css::uno::Sequence< sal_Int16 > std::vector< sal_Int16 >
m_aSelectedSeq; m_aSelectedSeq;
css::uno::Sequence< sal_Int16 > std::vector< sal_Int16 >
m_aDefaultSelectedSeq; m_aDefaultSelectedSeq;
OUString m_sCellListSource; /// the cell range which acts as list source for the control OUString m_sCellListSource; /// the cell range which acts as list source for the control
sal_Int32 m_nEmptyListItems; /// number of empty list items encountered during reading sal_Int32 m_nEmptyListItems; /// number of empty list items encountered during reading
sal_Int32 m_nEmptyValueItems; /// number of empty value items encountered during reading sal_Int32 m_nEmptyValueItems; /// number of empty value items encountered during reading
bool m_bEncounteredLSAttrib; bool m_bEncounteredLSAttrib;
bool m_bLinkWithIndexes; /** <TRUE/> if and only if we should use a cell value binding bool m_bLinkWithIndexes; /** <TRUE/> if and only if we should use a cell value binding
which exchanges the selection index (instead of the selection text which exchanges the selection index (instead of the selection text
*/ */
......
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