summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2011-04-13 18:46:02 +0200
committerKurt Zenker <kz@openoffice.org>2011-04-13 18:46:02 +0200
commit7d0262d4a7c913a781bf48143b2088a8963091b8 (patch)
tree8af49cb86881d3702d8d9dfb923594a335fe34c4
parent298d53ede450f86f80b12bc4318d45a40bbcdee5 (diff)
parent4c7ed6dc817f01fafdac8cd5419f361e1cb229d3 (diff)
CWS-TOOLING: integrate CWS dr80_OOO340
-rw-r--r--sc/inc/unonames.hxx2
-rw-r--r--sc/source/core/data/document.cxx1
-rw-r--r--sc/source/core/data/drwlayer.cxx27
-rw-r--r--sc/source/core/data/table1.cxx4
-rw-r--r--sc/source/core/tool/address.cxx10
-rw-r--r--sc/source/filter/excel/colrowst.cxx5
-rw-r--r--sc/source/filter/excel/xechart.cxx2
-rw-r--r--sc/source/ui/docshell/olinefun.cxx68
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx4
11 files changed, 105 insertions, 30 deletions
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index a9c08c2884fd..2b97ede1ba55 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -175,6 +175,8 @@
#define SC_UNONAME_AUTOPRINT "AutomaticPrintArea"
#define SC_UNONAME_TABCOLOR "TabColor"
+#define SC_UNONAME_VISFLAG "VisibleFlag"
+
// LinkTarget
#define SC_UNO_LINKDISPBIT "LinkDisplayBitmap"
#define SC_UNO_LINKDISPNAME "LinkDisplayName"
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 68cbef5e8e94..aff31a956cae 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5308,6 +5308,7 @@ ScRowBreakIterator* ScDocument::GetRowBreakIterator(SCTAB nTab) const
void ScDocument::EnableUndo( bool bVal )
{
GetUndoManager()->EnableUndo(bVal);
+ if( pDrawLayer ) pDrawLayer->EnableUndo(bVal);
mbUndoEnabled = bVal;
}
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index c3f8edbbc265..80cac5616f33 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -283,6 +283,10 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) :
if ( pHitOutlinerPool )
pHitOutlinerPool->SetPoolDefaultItem(SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT )); // 12Pt
+ // initial undo mode as in Calc document
+ if( pDoc )
+ EnableUndo( pDoc->IsUndoEnabled() );
+
// URL-Buttons haben keinen Handler mehr, machen alles selber
if( !nInst++ )
@@ -1119,6 +1123,15 @@ void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
if (!bAdjustEnabled)
return;
+ SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
+ DBG_ASSERT(pPage,"Page not found");
+ if (!pPage)
+ return;
+
+ // for an empty page, there's no need to calculate the row heights
+ if (!pPage->GetObjCount())
+ return;
+
Rectangle aRect;
Point aTopLeft;
@@ -1148,6 +1161,15 @@ sal_Bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndR
if ( !pDoc )
return sal_False;
+ SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
+ DBG_ASSERT(pPage,"Page not found");
+ if (!pPage)
+ return sal_False;
+
+ // for an empty page, there's no need to calculate the row heights
+ if (!pPage->GetObjCount())
+ return sal_False;
+
Rectangle aTestRect;
aTestRect.Top() += pDoc->GetRowHeight( 0, nStartRow-1, nTab);
@@ -1170,11 +1192,6 @@ sal_Bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndR
if ( bNegativePage )
MirrorRectRTL( aTestRect );
- SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
- DBG_ASSERT(pPage,"Page nicht gefunden");
- if (!pPage)
- return sal_False;
-
sal_Bool bFound = sal_False;
Rectangle aObjRect;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index be7cab80508b..31b9c0fb9ed6 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -337,6 +337,8 @@ sal_Bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n
}
}
+ IncRecalcLevel(); // #i116460# avoid problems with Excel files
+
SCROW nRngStart = 0;
SCROW nRngEnd = 0;
sal_uInt16 nLast = 0;
@@ -391,6 +393,8 @@ sal_Bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n
if (nLast)
bChanged |= SetRowHeightRange( nRngStart, nRngEnd, nLast, nPPTX, nPPTY );
+ DecRecalcLevel(); // #i116460# avoid problems with Excel files
+
delete[] pHeight;
if ( pProgress != pOuterProgress )
delete pProgress;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index e24a4ff4158e..aff7a6ab21aa 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -377,14 +377,13 @@ const sal_Unicode* ScRange::Parse_XL_Header(
}
++p;
- // 1-based, sequence starts with an empty element.
- if (pExternalLinks && pExternalLinks->getLength() > 1)
+ if (pExternalLinks && pExternalLinks->hasElements())
{
// A numeric "document name" is an index into the sequence.
if (CharClass::isAsciiNumeric( rExternDocName))
{
sal_Int32 i = rExternDocName.ToInt32();
- if (i <= 0 || i >= pExternalLinks->getLength())
+ if (i < 0 || i >= pExternalLinks->getLength())
return start;
const sheet::ExternalLinkInfo & rInfo = (*pExternalLinks)[i];
switch (rInfo.Type)
@@ -400,6 +399,11 @@ const sal_Unicode* ScRange::Parse_XL_Header(
rExternDocName = aStr;
}
break;
+ case sheet::ExternalLinkType::SELF :
+ return start; // ???
+ case sheet::ExternalLinkType::SPECIAL :
+ // silently return nothing (do not assert), caller has to handle this
+ return NULL;
default:
DBG_ERROR2( "ScRange::Parse_XL_Header: unhandled ExternalLinkType %d for index %d",
rInfo.Type, i);
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index 575093f48d2a..b469ea5de49c 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -278,6 +278,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
{
ScDocument& rDoc = GetDoc();
+ rDoc.IncSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows
// hide the columns
for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol )
@@ -304,7 +305,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
if( ::get_flag( maRowFlags[ nScRow ], EXC_COLROW_HIDDEN ) )
{
// hide the row
- rDoc.ShowRow( nScRow, nScTab, sal_False );
+ rDoc.SetRowHidden(nScRow, nScRow, nScTab, true); // #i116460# SetRowHidden instead of ShowRow
// #i38093# rows hidden by filter need extra flag
if( (nFirstFilterScRow <= nScRow) && (nScRow <= nLastFilterScRow) )
rDoc.SetRowFiltered(nScRow, nScRow, nScTab, true);
@@ -314,5 +315,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
// #i47438# if default row format is hidden, hide remaining rows
if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) )
rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, sal_False );
+
+ rDoc.DecSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 6aab83a050f7..1a171466f53a 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -212,7 +212,7 @@ sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit )
return EXC_CHDATERANGE_DAYS;
}
-bool lclConvertTimeInterval( sal_uInt16 rnValue, sal_uInt16& rnTimeUnit, const Any& rAny )
+bool lclConvertTimeInterval( sal_uInt16& rnValue, sal_uInt16& rnTimeUnit, const Any& rAny )
{
cssc::TimeInterval aInterval;
bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny );
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 5e2503f94e15..f358fc4a29ab 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -392,6 +392,8 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1
bColumns, nLevel ) );
}
+ pDoc->IncSizeRecalcLevel( nTab );
+
ScSubOutlineIterator aIter( pArray ); // alle Eintraege
ScOutlineEntry* pEntry;
while ((pEntry=aIter.GetNext()) != NULL)
@@ -420,11 +422,19 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1
if ( bColumns )
pDoc->ShowCol( static_cast<SCCOL>(i), nTab, bShow );
else
- if ( !bShow || !pDoc->RowFiltered( i,nTab ) )
- pDoc->ShowRow( i, nTab, bShow );
+ {
+ // show several rows together, don't show filtered rows
+ SCROW nFilterEnd = i;
+ bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ nFilterEnd = std::min( nThisEnd, nFilterEnd );
+ if ( !bShow || !bFiltered )
+ pDoc->ShowRows( i, nFilterEnd, nTab, bShow );
+ i = nFilterEnd;
+ }
}
}
+ pDoc->DecSizeRecalcLevel( nTab );
pDoc->UpdatePageBreaks( nTab );
if (bPaint)
@@ -478,6 +488,8 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b
pUndoDoc, pUndoTab, sal_True ) );
}
+ pDoc->IncSizeRecalcLevel( nTab );
+
// Spalten
nMin=MAXCOL;
@@ -518,9 +530,17 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b
}
}
for ( i=nMin; i<=nMax; i++ )
- if ( !pDoc->RowFiltered( i,nTab ) ) // weggefilterte nicht einblenden
- pDoc->ShowRow( i, nTab, sal_True );
+ {
+ // show several rows together, don't show filtered rows
+ SCROW nFilterEnd = i;
+ bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ nFilterEnd = std::min( nMax, nFilterEnd );
+ if ( !bFiltered )
+ pDoc->ShowRows( i, nFilterEnd, nTab, sal_True );
+ i = nFilterEnd;
+ }
+ pDoc->DecSizeRecalcLevel( nTab );
pDoc->UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
@@ -590,6 +610,8 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b
pUndoDoc, pUndoTab, sal_False ) );
}
+ pDoc->IncSizeRecalcLevel( nTab );
+
// Spalten
nCount = pColArray->GetCount(nColLevel);
@@ -616,6 +638,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b
HideOutline( nTab, sal_False, nRowLevel, i, sal_False, sal_False, bApi );
}
+ pDoc->DecSizeRecalcLevel( nTab );
pDoc->UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
@@ -671,6 +694,8 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
//! HideCursor();
+ pDoc->IncSizeRecalcLevel( nTab );
+
pEntry->SetHidden(sal_False);
SCCOLROW i;
for ( i = nStart; i <= nEnd; i++ )
@@ -678,8 +703,15 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
if ( bColumns )
pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_True );
else
- if ( !pDoc->RowFiltered( i,nTab ) ) // weggefilterte nicht einblenden
- pDoc->ShowRow( i, nTab, sal_True );
+ {
+ // show several rows together, don't show filtered rows
+ SCROW nFilterEnd = i;
+ bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ nFilterEnd = std::min( nEnd, nFilterEnd );
+ if ( !bFiltered )
+ pDoc->ShowRows( i, nFilterEnd, nTab, sal_True );
+ i = nFilterEnd;
+ }
}
ScSubOutlineIterator aIter( pArray, nLevel, nEntry );
@@ -689,18 +721,17 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
{
SCCOLROW nSubStart = pEntry->GetStart();
SCCOLROW nSubEnd = pEntry->GetEnd();
- for ( i = nSubStart; i <= nSubEnd; i++ )
- {
- if ( bColumns )
+ if ( bColumns )
+ for ( i = nSubStart; i <= nSubEnd; i++ )
pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_False );
- else
- pDoc->ShowRow( i, nTab, sal_False );
- }
+ else
+ pDoc->ShowRows( nSubStart, nSubEnd, nTab, sal_False );
}
}
pArray->SetVisibleBelow( nLevel, nEntry, sal_True, sal_True );
+ pDoc->DecSizeRecalcLevel( nTab );
pDoc->InvalidatePageBreaks(nTab);
pDoc->UpdatePageBreaks( nTab );
@@ -755,18 +786,19 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1
//! HideCursor();
+ pDoc->IncSizeRecalcLevel( nTab );
+
pEntry->SetHidden(sal_True);
SCCOLROW i;
- for ( i = nStart; i <= nEnd; i++ )
- {
- if ( bColumns )
+ if ( bColumns )
+ for ( i = nStart; i <= nEnd; i++ )
pDoc->ShowCol( static_cast<SCCOL>(i), nTab, sal_False );
- else
- pDoc->ShowRow( i, nTab, sal_False );
- }
+ else
+ pDoc->ShowRows( nStart, nEnd, nTab, sal_False );
pArray->SetVisibleBelow( nLevel, nEntry, sal_False );
+ pDoc->DecSizeRecalcLevel( nTab );
pDoc->InvalidatePageBreaks(nTab);
pDoc->UpdatePageBreaks( nTab );
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index f5a94df0bfba..8165d92888e4 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1098,6 +1098,11 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ /* #164410# Use double allocation, which will speed up import filters
+ using XCellRangeData::setDataArray() significantly. */
+ bool bDoubleAlloc = ScColumn::bDoubleAlloc;
+ ScColumn::bDoubleAlloc = true;
+
sal_Bool bError = sal_False;
SCROW nDocRow = nStartRow;
for (long nRow=0; nRow<nRows; nRow++)
@@ -1173,6 +1178,7 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
++nDocRow;
}
+ ScColumn::bDoubleAlloc = bDoubleAlloc;
sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index daed78e09e82..0d39e944b194 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3309,6 +3309,12 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
aFunc.SetWidthOrHeight( sal_False, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
// SC_SIZE_DIRECT with size 0: hide
}
+ else if ( aNameString.EqualsAscii( SC_UNONAME_VISFLAG ) )
+ {
+ // #i116460# Shortcut to only set the flag, without drawing layer update etc.
+ // Should only be used from import filters.
+ pDoc->SetRowHidden(nStartRow, nEndRow, nTab, !ScUnoHelpFunctions::GetBoolFromAny( aValue ));
+ }
else if ( aNameString.EqualsAscii( SC_UNONAME_CELLFILT ) )
{
//! undo etc.
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index fa278e527d91..d7d0ae733ab7 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -281,8 +281,8 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException )
sal_Int32 nCursorX = pTabView->GetCurX();
sal_Int32 nCursorY = pTabView->GetCurY();
- uno::Reference< XHelperInterface > xParent( excel::getUnoSheetModuleObj( xRange ), uno::UNO_QUERY_THROW );
- return new ScVbaRange( xParent, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
+ // #i117392# excel::getUnoSheetModuleObj() may return null in documents without global VBA mode enabled
+ return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) );
}
uno::Any SAL_CALL