summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-08-05 09:09:00 +0200
committerDavid Tardon <dtardon@redhat.com>2013-08-05 09:09:00 +0200
commit95d1b05430d0d6384c6910fa9dfdd3c703201d34 (patch)
tree766d60efe7ffb62793be78de5266808fbb7d6aeb /sc/source/core/data
parent3b35ad42ed8bea8cab32e2131c81b03c8347cb67 (diff)
fix build with debug STL
Failed with: /usr/include/c++/4.8.1/debug/safe_iterator.h:510:error: attempt to compare iterators from different sequences. Objects involved in the operation: ... The problem is that miPos in _copied_ object points ot maAttrs in the original object, not in the copy (and std::for_each takes a copy of the functor). This could be solved by defining copy constructor and operator=, but given the limited usage of the class, it is simpler to let copies share the state. Change-Id: Icf3f02ecd2fe4ce6dd77f3cde226d32beb4d4b3f
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/documentimport.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index bfda2f5a0f2f..1c368b404d45 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -294,11 +294,21 @@ namespace {
class CellTextAttrInitializer
{
- sc::CellTextAttrStoreType maAttrs;
- sc::CellTextAttrStoreType::iterator miPos;
- sal_uInt16 mnScriptNumeric;
+ struct Impl
+ {
+ sc::CellTextAttrStoreType maAttrs;
+ sc::CellTextAttrStoreType::iterator miPos;
+ sal_uInt16 mnScriptNumeric;
+
+ Impl(const sal_uInt32 nMaxRowCount, const sal_uInt16 nScriptNumeric)
+ : maAttrs(nMaxRowCount), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric)
+ {}
+ };
+
+ boost::shared_ptr<Impl> mpImpl;
+
public:
- CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : maAttrs(MAXROWCOUNT), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric) {}
+ CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric)) {}
void operator() (const sc::CellStoreType::value_type& node)
{
@@ -308,14 +318,14 @@ public:
// Fill with default values for non-empty cell segments.
sc::CellTextAttr aDefault;
if (node.type == sc::element_type_numeric)
- aDefault.mnScriptType = mnScriptNumeric;
+ aDefault.mnScriptType = mpImpl->mnScriptNumeric;
std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
- miPos = maAttrs.set(miPos, node.position, aDefaults.begin(), aDefaults.end());
+ mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end());
}
void swap(sc::CellTextAttrStoreType& rAttrs)
{
- maAttrs.swap(rAttrs);
+ mpImpl->maAttrs.swap(rAttrs);
}
};