diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-28 14:13:16 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-28 21:03:07 -0500 |
commit | daf87ab18a43999b6e1a133806d8f99cd0fbc314 (patch) | |
tree | d7fa6cf6a05676eab03153d8eae38e333288d496 | |
parent | 94b7deccb683fc407a90c3bb1f580ca47debaf33 (diff) |
AddLabel to take string as its argument.
-rw-r--r-- | sc/inc/dptablecache.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptablecache.cxx | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx index 95d4d89b39a9..35ef47e765b3 100644 --- a/sc/inc/dptablecache.hxx +++ b/sc/inc/dptablecache.hxx @@ -141,7 +141,7 @@ public: ~ScDPCache(); private: - void AddLabel( ScDPItemData* pData); + void AddLabel(const rtl::OUString& rLabel); bool AddData(long nDim, ScDPItemData* pData); }; diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index 35936d901ec3..b25bdf3be862 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -316,7 +316,7 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange) for (sal_uInt16 nCol = nStartCol; nCol <= nEndCol; ++nCol) { - AddLabel(new ScDPItemData(pDoc, nCol, nStartRow, nDocTab, true)); + AddLabel(ScDPItemData(pDoc, nCol, nStartRow, nDocTab, true).GetString()); for (SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow) AddData(nCol - nStartCol, new ScDPItemData(pDoc, nCol, nRow, nDocTab, false)); } @@ -363,9 +363,9 @@ bool ScDPCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowSet, const for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol) { - String aColTitle = xMeta->getColumnLabel(nCol+1); + rtl::OUString aColTitle = xMeta->getColumnLabel(nCol+1); aColTypes[nCol] = xMeta->getColumnType(nCol+1); - AddLabel( new ScDPItemData( aColTitle) ); + AddLabel(aColTitle); } // Now get the data rows. @@ -653,9 +653,8 @@ public: } -void ScDPCache::AddLabel(ScDPItemData *pData) +void ScDPCache::AddLabel(const rtl::OUString& rLabel) { - std::auto_ptr<ScDPItemData> p(pData); OSL_ENSURE( IsValid(), " IsValid() == false " ); if ( maLabelNames.empty() ) @@ -665,7 +664,7 @@ void ScDPCache::AddLabel(ScDPItemData *pData) LabelSet aExistingNames; std::for_each(maLabelNames.begin(), maLabelNames.end(), InsertLabel(aExistingNames)); sal_Int32 nSuffix = 1; - rtl::OUString aNewName = p->GetString(); + rtl::OUString aNewName = rLabel; while (true) { if (!aExistingNames.count(aNewName)) @@ -676,7 +675,7 @@ void ScDPCache::AddLabel(ScDPItemData *pData) } // Name already exists. - rtl::OUStringBuffer aBuf(p->GetString()); + rtl::OUStringBuffer aBuf(rLabel); aBuf.append(++nSuffix); aNewName = aBuf.makeStringAndClear(); } |