Use boost::scoped_ptr for this.

Change-Id: I5acdb7e55cb3dfeff880f1f361fed4a8cc4acd3c
Store cell text attribute pointers during initialization.

This will be used later when re-ordering rows.

Change-Id: I47504b49be11174b0002b1af1cbce9b8b7f2531c
Have CellValues handle text attribute values as well.

To ensure that the cell and cell text attribute storage stay in sync at all
times.

Change-Id: I5ea3fb7601f42f22af30f4f2d96d9d5e481e0853
Avoid using SwapRow() when sorting.

Instead, build a data table prior to sorting, swap rows in this data table
as we sort, then transfer the results back to the document in one step.  This
significantly speeds up the sort performance.

Formula cells are yet to be handled. I'll work on that next.

Change-Id: I59bde1a243dc8940411d1a33eef147671b060cd0
I don't need this anymore.

Change-Id: I03c52705979dd239ee90fde2406800c1a9c2809a
Copy formula cells as well.

Change-Id: I5f7e5747336c7104004083e4d23f621a00d4b494
Correctly set the positions of sorted formula cells.

Change-Id: I21cc7aa2cc521203f4da6f754a2ad7b4e985dd67
Retrieve and store broadcasters into data table.

Change-Id: I107ccbbc61a5e8024f21a7a30fae9fea00c90bde
Handle sorting of broadcasters correctly.

Change-Id: Iab46c26606880f0fa7c7067d8514b8be3629fe0f
Use the mdds storage types directly rather than using CellValues.

Change-Id: I415b3cddc4b764668564affd573ae9cc00601278
Use correct index to access row arrays, to prevent out-of-range access.

Change-Id: Ia74c0f07c7f1021de92f77fdb93b2279a3b8462c
Use push_back() for mtv to remove the slow O(n^2) algorithm.

This makes the sorting fly.  Still slow in AdjustRowHeight() which gets
called after the sort().  Will have to look at that later.

This change requires a newer version of mdds (not yet released).

Change-Id: I50c6ec9bb562af85c3b77201e2cd31b30dd719e9
Add empty block at the top to keep row and element positions in sync.

Otherwise formula cells would mis-behave during grouping.  Also, the
range-based release() was renamed to release_range() to avoid unwanted
function overloading due to implicit type conversion.

Change-Id: I3dc1421f89926f161963eede9a2c8eb477d7e5be
Move cell notes too when sorting.

Change-Id: Ibb330aa6f515d756c5578296fd9c83aa235a59fd
We have m_pDoc available here in the test...

Change-Id: Ib541cb9f99b3f1094e33d7b333fdbeeeccadce26
Annotate the test code a bit to make it easier to follow.

Also, during unit test, the function separator is set to ';', not ','.

Change-Id: I3ba948c54bee3c05715928f6f2f2945621fbacad
Make sure to ignore trailing empty rows in all places.

Otherwise it'd throw an exception.

All unit tests pass now.

Change-Id: I1dc49afcdf3e6604de4c0bc2440106c5ce0da090
Handle cell formats correctly during sort.

Unfortunately sorting becomes noticeably slower when cell format is
enabled.  Perhaps a future project.

Change-Id: Ieb02b207b62df343d1f667a8075874b7688ee9a7
Handle reordering of row hidden and filtered flags during sort.

Only when the "keep query" flag is set.

Change-Id: Ia799f62ec53a08cfd92e93c546965002c030b324
Update script types of all cells in sort range ahead of time.

To ensure that there is no SC_SCRIPTTYPE_UNKNOWN in the sort range,
the presence of which would slow down during AdjustRowHeight().

This only adds a tiny overhead (0.3 second) and cuts the duration of
AdjustRowHeight() from 15 seconds to 5 seconds.

Change-Id: I145e901225ef1136f53c6f682ffed3902099859c