summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-03-27 14:19:31 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-03-27 14:19:31 -0400
commit80ecd30e1c7b753f2b24147e47204c97d253d394 (patch)
tree01a72e65e5745935b6087c765ef74344daad7b61 /editeng
parente747c9df0bcbc68935b0adf0eaa166ae1a1abe05 (diff)
It's cleaner to use copy ctor for cloning.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/edtspell.cxx23
-rw-r--r--editeng/source/editeng/edtspell.hxx5
2 files changed, 12 insertions, 16 deletions
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 13dcf282abb7..bf21be8762c9 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -207,15 +207,14 @@ void EditSpellWrapper::CheckSpellTo()
//////////////////////////////////////////////////////////////////////
-WrongList::WrongList()
-{
- nInvalidStart = 0;
- nInvalidEnd = 0xFFFF;
-}
+WrongList::WrongList() : nInvalidStart(0), nInvalidEnd(0xFFFF) {}
-WrongList::~WrongList()
-{
-}
+WrongList::WrongList(const WrongList& r) :
+ maRanges(r.maRanges),
+ nInvalidStart(r.nInvalidStart),
+ nInvalidEnd(r.nInvalidEnd) {}
+
+WrongList::~WrongList() {}
void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE )
{
@@ -244,7 +243,7 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS
for (size_t i = 0, n = maRanges.size(); i < n; ++i)
{
- WrongRange & rWrong = maRanges[i]; // why does this thing derive vector?
+ WrongRange& rWrong = maRanges[i];
bool bRefIsValid = true;
if (rWrong.nEnd >= nPos)
{
@@ -477,11 +476,7 @@ void WrongList::MarkWrongsInvalid()
WrongList* WrongList::Clone() const
{
- WrongList* pNew = new WrongList;
- pNew->maRanges.reserve(maRanges.size());
- for (WrongList::const_iterator i = maRanges.begin(); i != maRanges.end(); ++i)
- pNew->maRanges.push_back(*i);
- return pNew;
+ return new WrongList(*this);
}
// #i102062#
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
index 47dc59f7e890..1b23b17bde23 100644
--- a/editeng/source/editeng/edtspell.hxx
+++ b/editeng/source/editeng/edtspell.hxx
@@ -96,8 +96,9 @@ public:
typedef std::vector<WrongRange>::iterator iterator;
typedef std::vector<WrongRange>::const_iterator const_iterator;
- WrongList();
- ~WrongList();
+ WrongList();
+ WrongList(const WrongList& r);
+ ~WrongList();
sal_Bool IsInvalid() const { return nInvalidStart != NOT_INVALID; }
void SetValid() { nInvalidStart = NOT_INVALID; nInvalidEnd = 0; }