summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/column2.cxx10
-rw-r--r--sc/source/core/data/column3.cxx4
-rw-r--r--sc/source/core/data/conditio.cxx3
-rw-r--r--sc/source/core/data/dpcache.cxx21
-rw-r--r--sc/source/core/data/dpcachetable.cxx204
-rw-r--r--sc/source/core/data/dpgroup.cxx6
-rw-r--r--sc/source/core/data/dptabdat.cxx6
-rw-r--r--sc/source/core/data/table2.cxx18
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/core/tool/dbdata.cxx4
-rw-r--r--sc/source/core/tool/rangelst.cxx28
-rw-r--r--sc/source/filter/excel/xetable.cxx12
-rw-r--r--sc/source/filter/excel/xiescher.cxx2
-rw-r--r--sc/source/filter/inc/lotattr.hxx2
-rw-r--r--sc/source/filter/inc/xetable.hxx3
-rw-r--r--sc/source/filter/oox/addressconverter.cxx2
-rw-r--r--sc/source/filter/oox/commentsbuffer.cxx3
-rw-r--r--sc/source/filter/oox/extlstcontext.cxx10
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx17
-rw-r--r--sc/source/filter/oox/unitconverter.cxx5
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx15
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx15
-rw-r--r--sc/source/filter/xml/xmlstyli.hxx1
-rw-r--r--sc/source/ui/app/scmod.cxx3
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx39
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx5
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx12
-rw-r--r--sc/source/ui/inc/tpsort.hxx8
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx2
-rw-r--r--sc/source/ui/view/cellsh1.cxx2
30 files changed, 293 insertions, 173 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c28249a6d827..03f7b5421ac9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1131,7 +1131,8 @@ bool ScColumn::IsEmptyVisData() const
SCSIZE i;
for (i=0; i<maItems.size() && !bVisData; i++)
{
- bVisData = true;
+ if(!maItems[i].pCell->IsBlank())
+ bVisData = true;
}
return !bVisData;
}
@@ -1165,8 +1166,11 @@ SCROW ScColumn::GetLastVisDataPos() const
for (i=maItems.size(); i>0 && !bFound; )
{
--i;
- bFound = true;
- nRet = maItems[i].nRow;
+ if(!maItems[i].pCell->IsBlank())
+ {
+ bFound = true;
+ nRet = maItems[i].nRow;
+ }
}
}
return nRet;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 48d77dc6f5fc..475299da6293 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1501,6 +1501,10 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTy
}
break;
+ // skip broadcaster cells
+ case CELLTYPE_NOTE:
+ continue;
+
default:
;
}
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 9561d64d1e62..ea6657addea2 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -66,7 +66,6 @@ bool ScFormatEntry::operator==( const ScFormatEntry& r ) const
{
case condformat::CONDITION:
return static_cast<const ScCondFormatEntry&>(*this) == static_cast<const ScCondFormatEntry&>(r);
- break;
default:
// TODO: implement also this case
// actually return false for these cases is not that bad
@@ -74,8 +73,6 @@ bool ScFormatEntry::operator==( const ScFormatEntry& r ) const
// to think about the range
return false;
}
-
- return true;
}
bool lcl_HasRelRef( ScDocument* pDoc, ScTokenArray* pFormula, sal_uInt16 nRecursion = 0 )
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index f1e45318cb7e..c754fba1549d 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -73,6 +73,7 @@ ScDPCache::ScDPCache(ScDocument* pDoc) :
mpDoc( pDoc ),
mnColumnCount ( 0 ),
maEmptyRows(0, MAXROW, true),
+ mnDataSize(-1),
mbDisposing(false)
{
}
@@ -751,7 +752,21 @@ public:
void ScDPCache::PostInit()
{
+ OSL_ENSURE(!maFields.empty(), "Cache not initialized!");
+
maEmptyRows.build_tree();
+ typedef mdds::flat_segment_tree<SCROW, bool>::const_reverse_iterator itr_type;
+ itr_type it = maEmptyRows.rbegin(), itEnd = maEmptyRows.rend();
+ OSL_ENSURE(it != itEnd, "corrupt flat_segment_tree instance!");
+ mnDataSize = maFields[0].maData.size();
+ ++it; // Skip the first position.
+ OSL_ENSURE(it != itEnd, "buggy version of flat_segment_tree is used.");
+ if (it->second)
+ {
+ SCROW nLastNonEmpty = it->first - 1;
+ if (nLastNonEmpty+1 < mnDataSize)
+ mnDataSize = nLastNonEmpty+1;
+ }
}
void ScDPCache::Clear()
@@ -850,6 +865,12 @@ SCROW ScDPCache::GetRowCount() const
return maFields[0].maData.size();
}
+SCROW ScDPCache::GetDataSize() const
+{
+ OSL_ENSURE(mnDataSize <= GetRowCount(), "Data size should never be larger than the row count.");
+ return mnDataSize >= 0 ? mnDataSize : 0;
+}
+
const ScDPCache::ItemsType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index dc7a63a8b637..14f4e8e2e48e 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -64,17 +64,6 @@ using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::sheet::DataPilotFieldFilter;
-bool ScDPCacheTable::RowFlag::isActive() const
-{
- return mbShowByFilter && mbShowByPage;
-}
-
-ScDPCacheTable::RowFlag::RowFlag() :
- mbShowByFilter(true),
- mbShowByPage(true)
-{
-}
-
ScDPCacheTable::SingleFilter::SingleFilter(const ScDPItemData& rItem) :
maItem(rItem) {}
@@ -125,7 +114,7 @@ ScDPCacheTable::Criterion::Criterion() :
// ----------------------------------------------------------------------------
ScDPCacheTable::ScDPCacheTable(const ScDPCache* pCache) :
- mpCache(pCache)
+ maShowByFilter(0, MAXROW+1, false), maShowByPage(0, MAXROW+1, true), mpCache(pCache)
{
}
@@ -146,124 +135,145 @@ sal_Int32 ScDPCacheTable::getColSize() const
void ScDPCacheTable::fillTable(
const ScQueryParam& rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty)
{
- const SCROW nRowCount = getRowSize();
- const SCCOL nColCount = (SCCOL) getColSize();
- if ( nRowCount <= 0 || nColCount <= 0)
+ SCROW nRowCount = getRowSize();
+ SCROW nDataSize = mpCache->GetDataSize();
+ SCCOL nColCount = getColSize();
+ if (nRowCount <= 0 || nColCount <= 0)
return;
- maRowFlags.clear();
- maRowFlags.reserve(nRowCount);
+ maShowByFilter.clear();
+ maShowByPage.clear();
- // Initialize field entries container.
- maFieldEntries.clear();
- maFieldEntries.reserve(nColCount);
-
- // Data rows
- for (SCCOL nCol = 0; nCol < nColCount; ++nCol)
+ // Process the non-empty data rows.
+ for (SCROW nRow = 0; nRow < nDataSize; ++nRow)
{
- maFieldEntries.push_back( vector<SCROW>() );
- SCROW nMemCount = getCache()->GetDimMemberCount( nCol );
- if ( nMemCount )
- {
- std::vector<SCROW> aAdded( nMemCount, -1 );
-
- for (SCROW nRow = 0; nRow < nRowCount; ++nRow )
- {
- SCROW nIndex = getCache()->GetItemDataId( nCol, nRow, bRepeatIfEmpty );
- SCROW nOrder = getOrder( nCol, nIndex );
-
- if ( nCol == 0 )
- {
- maRowFlags.push_back(RowFlag());
- maRowFlags.back().mbShowByFilter = false;
- }
-
- if (!getCache()->ValidQuery(nRow, rQuery))
- continue;
-
- if ( bIgnoreEmptyRows && getCache()->IsRowEmpty( nRow ) )
- continue;
+ if (!getCache()->ValidQuery(nRow, rQuery))
+ continue;
- if ( nCol == 0 )
- maRowFlags.back().mbShowByFilter = true;
+ if (bIgnoreEmptyRows && getCache()->IsRowEmpty(nRow))
+ continue;
- aAdded[nOrder] = nIndex;
- }
- for ( SCROW nRow = 0; nRow < nMemCount; nRow++ )
- {
- if ( aAdded[nRow] != -1 )
- maFieldEntries.back().push_back( aAdded[nRow] );
- }
- }
+ maShowByFilter.insert_back(nRow, nRow+1, true);
}
-}
-void ScDPCacheTable::fillTable()
-{
- const SCROW nRowCount = getRowSize();
- const SCCOL nColCount = (SCCOL) getColSize();
- if ( nRowCount <= 0 || nColCount <= 0)
- return;
-
- maRowFlags.clear();
- maRowFlags.reserve(nRowCount);
+ // Process the trailing empty rows.
+ if (!bIgnoreEmptyRows)
+ maShowByFilter.insert_back(nDataSize, nRowCount, true);
+ maShowByFilter.build_tree();
// Initialize field entries container.
maFieldEntries.clear();
maFieldEntries.reserve(nColCount);
- // Data rows
+ // Build unique field entries.
for (SCCOL nCol = 0; nCol < nColCount; ++nCol)
{
maFieldEntries.push_back( vector<SCROW>() );
SCROW nMemCount = getCache()->GetDimMemberCount( nCol );
- if ( nMemCount )
- {
- std::vector< SCROW > pAdded( nMemCount, -1 );
+ if (!nMemCount)
+ continue;
- for (SCROW nRow = 0; nRow < nRowCount; ++nRow )
+ std::vector<SCROW> aAdded(nMemCount, -1);
+ bool bShow = false;
+ SCROW nEndSegment = -1;
+ for (SCROW nRow = 0; nRow < nRowCount; ++nRow)
+ {
+ if (nRow > nEndSegment)
{
- SCROW nIndex = getCache()->GetItemDataId( nCol, nRow, false );
- SCROW nOrder = getOrder( nCol, nIndex );
-
- if ( nCol == 0 )
+ if (!maShowByFilter.search_tree(nRow, bShow, NULL, &nEndSegment))
{
- maRowFlags.push_back(RowFlag());
- maRowFlags.back().mbShowByFilter = true;
+ OSL_FAIL("Tree search failed!");
+ continue;
}
-
- pAdded[nOrder] = nIndex;
+ --nEndSegment; // End position is not inclusive. Move back one.
}
- for ( SCROW nRow = 0; nRow < nMemCount; nRow++ )
+
+ if (!bShow)
{
- if ( pAdded[nRow] != -1 )
- maFieldEntries.back().push_back( pAdded[nRow] );
+ nRow = nEndSegment;
+ continue;
}
+
+ SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, bRepeatIfEmpty);
+ SCROW nOrder = getOrder(nCol, nIndex);
+ aAdded[nOrder] = nIndex;
+ }
+ for (SCROW nRow = 0; nRow < nMemCount; ++nRow)
+ {
+ if (aAdded[nRow] != -1)
+ maFieldEntries.back().push_back(aAdded[nRow]);
}
}
}
-bool ScDPCacheTable::isRowActive(sal_Int32 nRow) const
+void ScDPCacheTable::fillTable()
{
- if (nRow < 0 || static_cast<size_t>(nRow) >= maRowFlags.size())
- // row index out of bound
- return false;
+ SCROW nRowCount = getRowSize();
+ SCCOL nColCount = getColSize();
+ if (nRowCount <= 0 || nColCount <= 0)
+ return;
+
+ maShowByFilter.clear();
+ maShowByPage.clear();
+ maShowByFilter.insert_front(0, nRowCount, true);
+
+ // Initialize field entries container.
+ maFieldEntries.clear();
+ maFieldEntries.reserve(nColCount);
+
+ // Data rows
+ for (SCCOL nCol = 0; nCol < nColCount; ++nCol)
+ {
+ maFieldEntries.push_back( vector<SCROW>() );
+ SCROW nMemCount = getCache()->GetDimMemberCount( nCol );
+ if (!nMemCount)
+ continue;
+
+ std::vector<SCROW> aAdded(nMemCount, -1);
+
+ for (SCROW nRow = 0; nRow < nRowCount; ++nRow)
+ {
+ SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false);
+ SCROW nOrder = getOrder(nCol, nIndex);
+ aAdded[nOrder] = nIndex;
+ }
+ for (SCROW nRow = 0; nRow < nMemCount; ++nRow)
+ {
+ if (aAdded[nRow] != -1)
+ maFieldEntries.back().push_back(aAdded[nRow]);
+ }
+ }
+}
+
+bool ScDPCacheTable::isRowActive(sal_Int32 nRow, sal_Int32* pLastRow) const
+{
+ bool bFilter = false, bPage = true;
+ SCROW nLastRowFilter = MAXROW, nLastRowPage = MAXROW;
+ maShowByFilter.search_tree(nRow, bFilter, NULL, &nLastRowFilter);
+ maShowByPage.search_tree(nRow, bPage, NULL, &nLastRowPage);
+ if (pLastRow)
+ {
+ // Return the last row of current segment.
+ *pLastRow = nLastRowFilter < nLastRowPage ? nLastRowFilter : nLastRowPage;
+ *pLastRow -= 1; // End position is not inclusive. Move back one.
+ }
- return maRowFlags[nRow].isActive();
+ return bFilter && bPage;
}
void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims)
{
- sal_Int32 nRowSize = getRowSize();
- if (nRowSize != static_cast<sal_Int32>(maRowFlags.size()))
+ SCROW nRowSize = getRowSize();
+
+ maShowByPage.clear();
+ for (SCROW nRow = 0; nRow < nRowSize; ++nRow)
{
- // sizes of the two tables differ!
- return;
+ bool bShow = isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims);
+ maShowByPage.insert_back(nRow, nRow+1, bShow);
}
- for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow)
- maRowFlags[nRow].mbShowByPage = isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims);
+ maShowByPage.build_tree();
}
const ScDPItemData* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
@@ -333,12 +343,15 @@ void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S
}
tableData.push_back(headerRow);
-
for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow)
{
- if (!maRowFlags[nRow].isActive())
+ sal_Int32 nLastRow;
+ if (!isRowActive(nRow, &nLastRow))
+ {
// This row is filtered out.
+ nRow = nLastRow;
continue;
+ }
if (!isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims))
continue;
@@ -378,7 +391,8 @@ SCROW ScDPCacheTable::getOrder(long nDim, SCROW nIndex) const
void ScDPCacheTable::clear()
{
maFieldEntries.clear();
- maRowFlags.clear();
+ maShowByFilter.clear();
+ maShowByPage.clear();
}
bool ScDPCacheTable::empty() const
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index 91e9ccee3c8d..ea04b7c32fd8 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -767,8 +767,12 @@ void ScDPGroupTableData::CalcResults(CalcInfo& rInfo, bool bAutoShow)
sal_Int32 nRowSize = rCacheTable.getRowSize();
for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow)
{
- if (!rCacheTable.isRowActive(nRow))
+ sal_Int32 nLastRow;
+ if (!rCacheTable.isRowActive(nRow, &nLastRow))
+ {
+ nRow = nLastRow;
continue;
+ }
CalcRowData aData;
FillRowDataFromCacheTable(nRow, rCacheTable, rInfo, aData);
diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index a2566bec5d2e..060090876b97 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -226,8 +226,12 @@ void ScDPTableData::CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable,
sal_Int32 nRowSize = rCacheTable.getRowSize();
for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow)
{
- if (!rCacheTable.isRowActive(nRow))
+ sal_Int32 nLastRow;
+ if (!rCacheTable.isRowActive(nRow, &nLastRow))
+ {
+ nRow = nLastRow;
continue;
+ }
CalcRowData aData;
FillRowDataFromCacheTable(nRow, rCacheTable, rInfo, aData);
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 4230cbd764a5..cd193c142009 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -267,8 +267,13 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
if (nRow >= nStartRow)
{
- aNotes.insert(nCol, nRow - nSize, pPostIt);
- maNotes.ReleaseNote(nCol, nRow);
+ if(nRow - nStartRow > static_cast<SCROW>(nSize))
+ {
+ aNotes.insert(nCol, nRow - nSize, pPostIt);
+ maNotes.ReleaseNote(nCol, nRow);
+ }
+ else
+ maNotes.erase(nCol, nRow);
}
}
@@ -486,8 +491,13 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
if (nCol >= nStartCol)
{
- aNotes.insert(nCol - nSize, nRow, pPostIt);
- maNotes.ReleaseNote(nCol, nRow);
+ if(nCol - nStartCol > static_cast<SCCOL>(nSize))
+ {
+ aNotes.insert(nCol - nSize, nRow, pPostIt);
+ maNotes.ReleaseNote(nCol, nRow);
+ }
+ else
+ maNotes.erase(nCol, nRow);
}
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 15087c551f72..7be749ed91e9 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -386,10 +386,14 @@ short ScTable::CompareCell( sal_uInt16 nSort,
if (pCell1)
{
eType1 = pCell1->GetCellType();
+ if (eType1 == CELLTYPE_NOTE)
+ pCell1 = NULL;
}
if (pCell2)
{
eType2 = pCell2->GetCellType();
+ if (eType2 == CELLTYPE_NOTE)
+ pCell2 = NULL;
}
if (pCell1)
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index bb5475cb725d..a6e6364e126b 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -455,7 +455,9 @@ bool ScDBData::HasQueryParam() const
bool ScDBData::HasSortParam() const
{
- return mpSortParam && mpSortParam->maKeyState[0].bDoSort;
+ return mpSortParam &&
+ !mpSortParam->maKeyState.empty() &&
+ mpSortParam->maKeyState[0].bDoSort;
}
bool ScDBData::HasSubTotalParam() const
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 8214c507e958..e99e47fc1779 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -438,6 +438,9 @@ bool ScRangeList::UpdateReference(
}
}
+ if(maRanges.empty())
+ return true;
+
vector<ScRange*>::iterator itr = maRanges.begin(), itrEnd = maRanges.end();
for (; itr != itrEnd; ++itr)
{
@@ -460,6 +463,16 @@ bool ScRangeList::UpdateReference(
pR->aEnd.Set( theCol2, theRow2, theTab2 );
}
}
+
+ if(eUpdateRefMode == URM_INSDEL)
+ {
+ if(nDx < 0 || nDy < 0)
+ {
+ size_t n = maRanges.size();
+ Join(*maRanges[n-1], true);
+ }
+ }
+
return bChanged;
}
@@ -1135,6 +1148,21 @@ void ScRangeList::push_back(ScRange* p)
maRanges.push_back(p);
}
+ScAddress ScRangeList::GetTopLeftCorner() const
+{
+ if(empty())
+ return ScAddress();
+
+ ScAddress aAddr = maRanges[0]->aStart;
+ for(size_t i = 1, n = size(); i < n; ++i)
+ {
+ if(maRanges[i]->aStart < aAddr)
+ aAddr = maRanges[i]->aStart;
+ }
+
+ return aAddr;
+}
+
// === ScRangePairList ========================================================
ScRangePairList::~ScRangePairList()
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index d611077744fb..08a32d65c4c4 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1483,6 +1483,7 @@ XclExpColinfo::XclExpColinfo( const XclExpRoot& rRoot,
XclExpRecord( EXC_ID_COLINFO, 12 ),
XclExpRoot( rRoot ),
mnWidth( 0 ),
+ mnScWidth( 0 ),
mnFlags( 0 ),
mnFirstXclCol( static_cast< sal_uInt16 >( nScCol ) ),
mnLastXclCol( static_cast< sal_uInt16 >( nScCol ) )
@@ -1497,7 +1498,7 @@ XclExpColinfo::XclExpColinfo( const XclExpRoot& rRoot,
// column width
sal_uInt16 nScWidth = rDoc.GetColWidth( nScCol, nScTab );
mnWidth = XclTools::GetXclColumnWidth( nScWidth, GetCharWidth() );
-
+ mnScWidth = sc::TwipsToHMM( nScWidth );
// column flags
::set_flag( mnFlags, EXC_COLINFO_HIDDEN, rDoc.ColHidden(nScCol, nScTab) );
@@ -1563,7 +1564,7 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm )
// OOXTODO: XML_outlineLevel,
// OOXTODO: XML_phonetic,
XML_style, lcl_GetStyleId( rStrm, maXFId.mnXFIndex ).getStr(),
- XML_width, OString::valueOf( (double) (mnWidth / 255.0) ).getStr(),
+ XML_width, OString::valueOf( (double) (mnScWidth / (double)sc::TwipsToHMM( GetCharWidth() )) ).getStr(),
FSEND );
}
@@ -2446,6 +2447,13 @@ void XclExpCellTable::Save( XclExpStream& rStrm )
void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm )
{
+ // DEFAULT row height
+ XclExpDefaultRowData& rDefData = mxDefrowheight->GetDefaultData();
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+ rWorksheet->startElement( XML_sheetFormatPr,
+ XML_defaultRowHeight, OString::valueOf( (double) rDefData.mnHeight / 20.0 ).getStr(), FSEND );
+ rWorksheet->endElement( XML_sheetFormatPr );
+
maColInfoBfr.SaveXml( rStrm );
maRowBfr.SaveXml( rStrm );
}
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 900d2e6f86d2..894016791a2f 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3210,7 +3210,7 @@ String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
rtl::OUString sOleName;
String sCodeName = GetExtDocOptions().GetCodeName( nTab );
- if ( mxOleCtrlNameOverride->hasByName( sCodeName ) )
+ if (mxOleCtrlNameOverride.is() && mxOleCtrlNameOverride->hasByName(sCodeName))
{
Reference< XIndexContainer > xIdToOleName;
mxOleCtrlNameOverride->getByName( sCodeName ) >>= xIdToOleName;
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 844da072c129..cc8971aba307 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -42,7 +42,7 @@ class ScPatternAttr;
class SvxColorItem;
class Color;
class LotAttrTable;
-class LOTUS_ROOT;
+struct LOTUS_ROOT;
namespace editeng { class SvxBorderLine; }
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 33b7b2c2fa77..d9ce5eac0e21 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -783,6 +783,7 @@ private:
private:
XclExpXFId maXFId; /// The XF identifier for column default format.
sal_uInt16 mnWidth; /// Excel width of the column.
+ sal_uInt16 mnScWidth; /// Calc width of the column.
sal_uInt16 mnFlags; /// Additional column flags.
sal_uInt16 mnFirstXclCol; /// Index to first column.
sal_uInt16 mnLastXclCol; /// Index to last column.
@@ -851,7 +852,7 @@ public:
/** Sets the passed default data as current record contents. */
void SetDefaultData( const XclExpDefaultRowData& rDefData );
-
+ XclExpDefaultRowData& GetDefaultData() { return maDefData; }
private:
/** Writes the contents of the record. */
virtual void WriteBody( XclExpStream& rStrm );
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index 52e74ebbcecc..1da39663255f 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -57,7 +57,7 @@ using ::rtl::OUStringToOString;
namespace {
//! TODO: this limit may change, is there a way to obtain it via API?
-const sal_Int16 API_MAXTAB = 255;
+const sal_Int16 API_MAXTAB = MAXTAB;
const sal_Int32 OOX_MAXCOL = static_cast< sal_Int32 >( (1 << 14) - 1 );
const sal_Int32 OOX_MAXROW = static_cast< sal_Int32 >( (1 << 20) - 1 );
diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx
index 3bbf751f2f84..39d57a0b4988 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -195,8 +195,7 @@ void Comment::finalizeImport()
// position and formatting
pNoteShape->convertFormatting( xAnnoShape );
// visibility
- const ::oox::vml::ClientData* pClientData = pNoteShape->getClientData();
- xAnno->setIsVisible( pClientData && pClientData->mbVisible );
+ bVisible = pNoteShape->getTypeModel().mbVisible;
}
}
break;
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 64351285316f..d5cc534079ac 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -170,7 +170,13 @@ ContextHandlerRef ExtGlobalContext::onCreateContext( sal_Int32 nElement, const A
if(nElement == XLS_EXT_TOKEN( cfRule ))
{
rtl::OUString aId = rAttribs.getString( XML_id, rtl::OUString() );
- void* pInfo = getExtLst().find( aId )->second;
+
+ // an ext entrie does not need to have an existing corresponding entry
+ ExtLst::const_iterator aExt = getExtLst().find( aId );
+ if(aExt == getExtLst().end())
+ return NULL;
+
+ void* pInfo = aExt->second;
if (!pInfo)
{
return NULL;
@@ -180,8 +186,6 @@ ContextHandlerRef ExtGlobalContext::onCreateContext( sal_Int32 nElement, const A
else
return this;
}
-
- return 0;
}
void ExtGlobalContext::onStartElement( const AttributeList& rAttribs )
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index a82e19551792..f2b89a89ed04 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -112,23 +112,23 @@ void FormulaBuffer::finalizeImport()
applyCellFormulas( cellIt->second );
}
+ ArrayFormulaDataMap::iterator itArray = cellArrayFormulas.find( nTab );
+ if ( itArray != cellArrayFormulas.end() )
+ {
+ applyArrayFormulas( itArray->second );
+ }
+
FormulaValueMap::iterator itValues = cellFormulaValues.find( nTab );
if ( itValues != cellFormulaValues.end() )
{
std::vector< ValueAddressPair > & rVector = itValues->second;
applyCellFormulaValues( rVector );
}
-
- ArrayFormulaDataMap::iterator itArray = cellArrayFormulas.find( nTab );
-
- if ( itArray != cellArrayFormulas.end() )
- {
- applyArrayFormulas( itArray->second );
- }
}
rDoc.SetAutoNameCache( NULL );
xFormulaBar->setPosition( 1.0 );
}
+
void FormulaBuffer::applyCellFormula( ScDocument& rDoc, const ApiTokenSequence& rTokens, const ::com::sun::star::table::CellAddress& rAddress )
{
ScTokenArray aTokenArray;
@@ -158,7 +158,8 @@ void FormulaBuffer::applyCellFormulaValues( const std::vector< ValueAddressPair
ScAddress aCellPos;
ScUnoConversion::FillScAddress( aCellPos, it->first );
ScBaseCell* pBaseCell = rDoc.GetCell( aCellPos );
- if ( pBaseCell->GetCellType() == CELLTYPE_FORMULA )
+ SAL_WARN_IF( !pBaseCell, "sc", "why is the formula not imported? bug?");
+ if ( pBaseCell && pBaseCell->GetCellType() == CELLTYPE_FORMULA )
{
ScFormulaCell* pCell = static_cast< ScFormulaCell* >( pBaseCell );
pCell->SetHybridDouble( it->second );
diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx
index e2feb875882e..2d0431b21be1 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -149,18 +149,17 @@ void UnitConverter::finalizeImport()
{
// XDevice expects pixels in font descriptor, but font contains twips
FontDescriptor aDesc = pDefFont->getFontDescriptor();
- aDesc.Height = static_cast< sal_Int16 >( scaleValue( aDesc.Height, UNIT_TWIP, UNIT_REFDEVX ) + 0.5 );
Reference< XFont > xFont = xDevice->getFont( aDesc );
if( xFont.is() )
{
// get maximum width of all digits
sal_Int32 nDigitWidth = 0;
for( sal_Unicode cChar = '0'; cChar <= '9'; ++cChar )
- nDigitWidth = ::std::max( nDigitWidth, scaleToMm100( xFont->getCharWidth( cChar ), UNIT_REFDEVX ) );
+ nDigitWidth = ::std::max( nDigitWidth, scaleToMm100( xFont->getCharWidth( cChar ), UNIT_TWIP ) );
if( nDigitWidth > 0 )
maCoeffs[ UNIT_DIGIT ] = nDigitWidth;
// get width of space character
- sal_Int32 nSpaceWidth = scaleToMm100( xFont->getCharWidth( ' ' ), UNIT_REFDEVX );
+ sal_Int32 nSpaceWidth = scaleToMm100( xFont->getCharWidth( ' ' ), UNIT_TWIP );
if( nSpaceWidth > 0 )
maCoeffs[ UNIT_SPACE ] = nSpaceWidth;
}
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index f1f8a4053afe..500a332d78d7 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -566,7 +566,20 @@ VmlCommentExporter::VmlCommentExporter( sax_fastparser::FSHelperPtr p, ScAddress
void VmlCommentExporter::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect )
{
lcl_FillProps( rProps, mpCaption, mbVisible );
- rProps.AddOpt( ESCHER_Prop_fHidden, 1 ); // bool field
+ rProps.AddOpt( ESCHER_Prop_fHidden, mbVisible ); // bool field
+
+ // shadow property value for comment ( set in lcl_FillProps [*] ) has been
+ // overwritten by new value ( 0x20000 ) in the generic part of the export
+ // ( see EscherPropertyContainer::CreateShadowProperties )
+ // Safer option here is to just force the needed value here for oox vml
+ // export alone ( and avoid potential problems with binary export )
+ // #TODO investigate value of ESCHER_Prop_fshadowObscured generally
+ // in binary export ( if indeed this value is good for binary export )
+ // we can change the heuristics and/or initialisation path and get
+ // rid of line below.
+ // [*] lcl_FillProps seems to be called twice when exporting to xlsx
+ // once from XclObjComment::ProcessEscherObj #TODO look into that also
+ rProps.AddOpt( ESCHER_Prop_fshadowObscured, 0x00030003 ); // force value for comments
VMLExport::Commit( rProps, rRect );
}
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 7388d86e283f..59d1fe43749e 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -392,12 +392,15 @@ XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
nNumberFormat(-1),
nLastSheet(-1),
bParentSet(false),
- mpCondFormat(NULL)
+ mpCondFormat(NULL),
+ mbDeleteCondFormat(true)
{
}
XMLTableStyleContext::~XMLTableStyleContext()
{
+ if(mbDeleteCondFormat)
+ delete mpCondFormat;
}
SvXMLImportContext *XMLTableStyleContext::CreateChildContext(
@@ -444,11 +447,6 @@ void XMLTableStyleContext::ApplyCondFormat( uno::Sequence<table::CellRangeAddres
{
if(itr->EqualEntries(*mpCondFormat))
{
- // we don't need the new cond format entry now
- // the found one is the same and we just need to add the range to it
- delete mpCondFormat;
- mpCondFormat = NULL;
-
ScRangeList& rRangeList = itr->GetRangeList();
sal_uInt32 nCondId = itr->GetKey();
size_t n = rRange.size();
@@ -464,12 +462,13 @@ void XMLTableStyleContext::ApplyCondFormat( uno::Sequence<table::CellRangeAddres
aMarkData.MarkFromRangeList(rRange, true);
pDoc->ApplySelectionPattern( aPattern , aMarkData);
- break;
+ return;
}
}
- if(mpCondFormat)
+ if(mpCondFormat && mbDeleteCondFormat)
{
+ mbDeleteCondFormat = false;
sal_uLong nIndex = pDoc->AddCondFormat(mpCondFormat, nTab );
mpCondFormat->SetKey(nIndex);
mpCondFormat->AddRange(rRange);
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index d674fe3625c9..2498b3cc8618 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -101,6 +101,7 @@ class XMLTableStyleContext : public XMLPropStyleContext
SCTAB nLastSheet;
bool bParentSet;
ScConditionalFormat* mpCondFormat;
+ bool mbDeleteCondFormat;
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 845e551ac7f1..2635cb8e628c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2051,7 +2051,10 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId )
// TP_USERLISTS
if ( pUL )
+ {
aULItem.SetUserList( *pUL );
+ pRet->Put(aULItem);
+ }
// TP_COMPATIBILITY
pRet->Put( SfxUInt16Item( SID_SC_OPT_KEY_BINDING_COMPAT,
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 5c6d0f2586e1..6b877de44cfe 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -494,30 +494,25 @@ void ScCondFrmtEntry::HideColorScaleElements()
void ScCondFrmtEntry::SetHeight()
{
- if(mbActive)
+ long nPad = LogicToPixel(Size(42,2), MapMode(MAP_APPFONT)).getHeight();
+
+ // Calculate maximum height we need from visible widgets
+ sal_uInt16 nChildren = GetChildCount();
+
+ long nMaxHeight = 0;
+ for(sal_uInt16 i = 0; i < nChildren; i++)
{
- Size aSize = GetSizePixel();
- switch (meType)
- {
- case CONDITION:
- case FORMULA:
- aSize.Height() = 120;
- break;
- case COLORSCALE:
- aSize.Height() = 200;
- break;
- case DATABAR:
- aSize.Height() = 200;
- break;
- default:
- break;
- }
- SetSizePixel(aSize);
+ Window *pChild = GetChild(i);
+ if(!pChild || !pChild->IsVisible())
+ continue;
+ Point aPos = pChild->GetPosPixel();
+ Size aSize = pChild->GetSizePixel();
+ nMaxHeight = std::max(aPos.Y() + aSize.Height(), nMaxHeight);
}
- else
+ Size aSize = GetSizePixel();
+ if(nMaxHeight > 0)
{
- Size aSize = GetSizePixel();
- aSize.Height() = 40;
+ aSize.Height() = nMaxHeight + nPad;
SetSizePixel(aSize);
}
}
@@ -984,6 +979,8 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum
{
maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, pFormat->GetEntry(nIndex), maPos ));
}
+ if (nCount > 0)
+ maEntries.begin()->Select();
}
RecalcAll();
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index aee8b6f26dd4..03fbeb3a4aa5 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -77,7 +77,7 @@ String ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& r
String aStr;
aRange.Format(aStr, SCA_VALID, mpDoc, mpDoc->GetAddressConvention());
aStr += '\t';
- aStr += ScCondFormatHelper::GetExpression(rFormat, mrPos);
+ aStr += ScCondFormatHelper::GetExpression(rFormat, aRange.GetTopLeftCorner());
return aStr;
}
@@ -209,7 +209,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
if(!pFormat)
return 0;
- ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), maPos);
+ ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
+ pFormat->GetRange().GetTopLeftCorner());
if(pDlg->Execute() == RET_OK)
{
sal_Int32 nKey = pFormat->GetKey();
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 303d6c6b8efb..7ebbb474da79 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -275,9 +275,11 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
// -----------------------------------------------------------------------
-// for data exchange without dialogue detour: (still TODO!)
-void ScTabPageSortFields::ActivatePage()
+// for data exchange without dialogue detour:
+void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
{
+ // Refresh local copy with shared data
+ aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData();
if ( pDlg )
{
if ( bHasHeader != pDlg->GetHeaders()
@@ -744,9 +746,11 @@ sal_Bool ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet )
// -----------------------------------------------------------------------
-// for data exchange without dialogue detour: (still TODO!)
-void ScTabPageSortOptions::ActivatePage()
+// for data exchange without dialogue detour:
+void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet )
{
+ // Refresh local copy with shared data
+ aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData();
if ( pDlg )
{
if ( aBtnHeader.IsChecked() != pDlg->GetHeaders() )
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 14fce4efb4d1..7167e2ebebc3 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -69,11 +69,9 @@ public:
virtual void Reset ( const SfxItemSet& rArgSet );
protected:
-// for data exchange (TODO: should be changed!)
-// virtual void ActivatePage ( const SfxItemSet& rSet );
+ virtual void ActivatePage ( const SfxItemSet& rSet );
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
- virtual void ActivatePage ();
virtual int DeactivatePage ( SfxItemSet* pSet = 0);
private:
@@ -132,11 +130,9 @@ public:
virtual void Reset ( const SfxItemSet& rArgSet );
protected:
-// for data exchange (TODO: should be changed!)
-// virtual void ActivatePage ( const SfxItemSet& rSet );
+ virtual void ActivatePage ( const SfxItemSet& rSet );
using SfxTabPage::ActivatePage;
using SfxTabPage::DeactivatePage;
- virtual void ActivatePage ();
virtual int DeactivatePage ( SfxItemSet* pSet = 0);
private:
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index 3eee0085bb0e..ba6fc9a7b926 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -96,6 +96,7 @@ ScTpUserLists::ScTpUserLists( Window* pParent,
{
SetExchangeSupport();
Init();
+ Reset(rCoreAttrs);
FreeResource();
}
@@ -153,6 +154,7 @@ void ScTpUserLists::Init()
aFtCopyFrom.Disable();
aEdCopyFrom.Disable();
}
+
}
// -----------------------------------------------------------------------
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 14ed86bb29a7..c53294563ba4 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2075,7 +2075,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
else
{
- pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aPos, RID_SCDLG_CONDFORMAT );
+ pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), RID_SCDLG_CONDFORMAT );
}
if(pDlg->Execute() == RET_OK)