summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/source/graphicfilter/itga/itga.cxx30
-rw-r--r--filter/source/pdf/pdfexport.cxx6
-rw-r--r--libxml2/libxml2-xpath.patch31
-rw-r--r--package/source/zipapi/ZipFile.cxx9
-rw-r--r--sc/inc/document.hxx22
-rw-r--r--sc/inc/drwlayer.hxx2
-rw-r--r--sc/inc/table.hxx16
-rw-r--r--sc/source/core/data/document.cxx7
-rw-r--r--sc/source/core/data/drwlayer.cxx6
-rw-r--r--sc/source/core/data/table1.cxx38
-rw-r--r--sc/source/core/data/table2.cxx94
-rw-r--r--sc/source/core/data/table3.cxx69
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx17
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx7
-rw-r--r--sc/source/ui/view/dbfunc.cxx5
-rw-r--r--sc/source/ui/view/tabvwshe.cxx4
-rw-r--r--solenv/inc/minor.mk6
-rw-r--r--sw/source/core/doc/doc.cxx14
-rw-r--r--xpdf/xpdf-3.02.patch29
19 files changed, 337 insertions, 75 deletions
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index 5dcb5f82ccab..5f0d3af3cd7f 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -338,6 +338,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -360,6 +363,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -387,6 +393,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -407,6 +416,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -440,6 +452,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -457,6 +472,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -483,6 +501,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -500,6 +521,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -528,6 +552,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
@@ -548,6 +575,9 @@ BOOL TGAReader::ImplReadBody()
nXCount = 0;
nY += nYAdd;
nYCount++;
+
+ if( nYCount >= mpFileHeader->nImageHeight )
+ return false; // invalid picture
}
}
}
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 43f6f1faf2f1..dbc4db7e11e4 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -791,7 +791,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest );
- Sequence< PropertyValue > aRenderOptions( 5 );
+ Sequence< PropertyValue > aRenderOptions( 6 );
aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice );
aRenderOptions[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) );
@@ -803,12 +803,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
aRenderOptions[ 3 ].Value <<= sal_False;
aRenderOptions[ 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) );
aRenderOptions[ 4 ].Value <<= mbSkipEmptyPages;
- #if 0
- // #i113919# writer has to begun "PageRange" for itself changing its renderer count
- // we should unify this behavior but not for OOo 3.3
aRenderOptions[ 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
aRenderOptions[ 5 ].Value <<= aPageRange;
- #endif
if( aPageRange.getLength() || !aSelection.hasValue() )
{
diff --git a/libxml2/libxml2-xpath.patch b/libxml2/libxml2-xpath.patch
index e02982f16efe..107de91ed862 100644
--- a/libxml2/libxml2-xpath.patch
+++ b/libxml2/libxml2-xpath.patch
@@ -1,6 +1,6 @@
---- misc/libxml2-2.7.6/xpath.c
-+++ misc/build/libxml2-2.7.6/xpath.c
-@@ -8104,9 +8104,17 @@
+--- misc/libxml2-2.7.6/xpath.c 2009-09-24 17:32:00.000000000 +0200
++++ misc/build/libxml2-2.7.6/xpath.c 2011-01-03 17:21:08.788256100 +0100
+@@ -8106,9 +8106,17 @@
xmlNodePtr
xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
@@ -21,7 +21,7 @@
if (cur == NULL) return(NULL) ; /* ERROR */
if (cur->next != NULL) return(cur->next) ;
do {
-@@ -8160,8 +8168,13 @@
+@@ -8162,8 +8170,13 @@
xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
{
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
@@ -36,7 +36,7 @@
if (cur == NULL)
return (NULL);
if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
-@@ -8205,8 +8218,8 @@
+@@ -8207,8 +8220,8 @@
cur = ctxt->context->node;
if (cur == NULL)
return (NULL);
@@ -47,3 +47,24 @@
ctxt->ancestor = cur->parent;
}
if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
+@@ -11737,11 +11750,16 @@
+
+ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
+ xmlXPathObjectPtr tmp;
+- /* pop the result */
++ /* pop the result if any */
+ tmp = valuePop(ctxt);
+- xmlXPathReleaseObject(xpctxt, tmp);
+- /* then pop off contextObj, which will be freed later */
+- valuePop(ctxt);
++ if (tmp != contextObj) {
++ /*
++ * Free up the result
++ * then pop off contextObj, which will be freed later
++ */
++ xmlXPathReleaseObject(xpctxt, tmp);
++ valuePop(ctxt);
++ }
+ goto evaluation_error;
+ }
+
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index f01b7ce06f4b..dcd5669897e3 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -836,13 +836,18 @@ sal_Int32 ZipFile::recover()
aGrabber.seek( 0 );
- for( sal_Int32 nGenPos = 0; aGrabber.readBytes( aBuffer, 32000 ) && aBuffer.getLength() > 30; )
+ const sal_Int32 nToRead = 32000;
+ for( sal_Int32 nGenPos = 0; aGrabber.readBytes( aBuffer, nToRead ) && aBuffer.getLength() > 16; )
{
const sal_Int8 *pBuffer = aBuffer.getConstArray();
sal_Int32 nBufSize = aBuffer.getLength();
sal_Int32 nPos = 0;
- while( nPos < nBufSize - 16 )
+ // the buffer should contain at least one header,
+ // or if it is end of the file, at least the postheader with sizes and hash
+ while( nPos < nBufSize - 30
+ || ( aBuffer.getLength() < nToRead && nPos < nBufSize - 16 ) )
+
{
if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 )
{
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5c4685223281..7cfab10746ba 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -918,13 +918,29 @@ public:
USHORT GetErrCode( const ScAddress& ) const;
/** Shrink a range to only include data area.
+
This is not the actually used area within the
selection, but the bounds of the sheet's data area
- instead. */
+ instead.
+
+ @returns TRUE if the area passed intersected the data
+ area, FALSE if not, in which case the values
+ obtained may be out of bounds, not in order or
+ unmodified. TRUE does not mean that there
+ actually is any data within the selection.
+ */
bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
- /** Shrink a range to only include used data area. */
- bool ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+ /** Shrink a range to only include used data area.
+
+ @param o_bShrunk
+ Out parameter, TRUE if area was shrunk, FALSE if not.
+
+ @returns TRUE if there is any data, FALSE if not.
+ */
+ bool ShrinkToUsedDataArea( bool& o_bShrunk,
+ SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
+ SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const;
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 7dd9903f82a1..eed492c6e6c2 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -159,7 +159,7 @@ public:
void WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
void HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips );
- BOOL HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
+ BOOL HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes = true );
void DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
SCCOL nCol2,SCROW nRow2 );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 63cefe22626a..02fd917d2db9 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -86,6 +86,17 @@ class ScFlatBoolRowSegments;
class ScFlatBoolColSegments;
+struct ScShowRowsEntry
+{
+ SCROW mnRow1;
+ SCROW mnRow2;
+ bool mbShow;
+
+ ScShowRowsEntry( SCROW nR1, SCROW nR2, bool bS ) :
+ mnRow1(nR1), mnRow2(nR2), mbShow(bS) {}
+};
+
+
class ScTable
{
private:
@@ -417,7 +428,8 @@ public:
void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
BOOL bIncludeOld, bool bOnlyDown ) const;
- bool ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
+ bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
+ SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
@@ -657,7 +669,7 @@ public:
void DBShowRow(SCROW nRow, bool bShow);
void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
- void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
+ void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags); // if bSetFlags=false, no SetRowHidden/SetRowFiltered
void SetColFlags( SCCOL nCol, BYTE nNewFlags );
void SetRowFlags( SCROW nRow, BYTE nNewFlags );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1efe32446eef..3b78ab5b172f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -698,12 +698,15 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow
return true; // success!
}
-bool ScDocument::ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol,
+bool ScDocument::ShrinkToUsedDataArea( bool& o_bShrunk, SCTAB nTab, SCCOL& rStartCol,
SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
{
if (!ValidTab(nTab) || !pTab[nTab])
+ {
+ o_bShrunk = false;
return false;
- return pTab[nTab]->ShrinkToUsedDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
+ }
+ return pTab[nTab]->ShrinkToUsedDataArea( o_bShrunk, rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly);
}
// zusammenhaengender Bereich
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 4df709768279..b4e1cc71dc3d 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1137,7 +1137,7 @@ void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
}
-BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
+BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes )
{
DBG_ASSERT( pDoc, "ScDrawLayer::HasObjectsInRows without document" );
if ( !pDoc )
@@ -1178,7 +1178,9 @@ BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
while ( pObject && !bFound )
{
aObjRect = pObject->GetSnapRect(); //! GetLogicRect ?
- if (aTestRect.IsInside(aObjRect.TopLeft()) || aTestRect.IsInside(aObjRect.BottomLeft()))
+ // #i116164# note captions are handled separately, don't have to be included for each single row height change
+ if ( (aTestRect.IsInside(aObjRect.TopLeft()) || aTestRect.IsInside(aObjRect.BottomLeft())) &&
+ (bIncludeNotes || !IsNoteCaption(pObject)) )
bFound = TRUE;
pObject = aIter.Next();
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index baaabd3a8c8f..7abebea23686 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -740,18 +740,28 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
}
-bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
+bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const
{
- bool bRet = false;
- bool bChanged;
+ o_bShrunk = false;
+
+ PutInOrder( rStartCol, rEndCol);
+ PutInOrder( rStartRow, rEndRow);
+ if (rStartCol < 0)
+ rStartCol = 0, o_bShrunk = true;
+ if (rStartRow < 0)
+ rStartRow = 0, o_bShrunk = true;
+ if (rEndCol > MAXCOL)
+ rEndCol = MAXCOL, o_bShrunk = true;
+ if (rEndRow > MAXROW)
+ rEndRow = MAXROW, o_bShrunk = true;
+ bool bChanged;
do
{
bChanged = false;
- bool bCont = true;
- while (rEndCol > 0 && bCont && rStartCol < rEndCol)
+ while (rStartCol < rEndCol)
{
if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow))
{
@@ -759,11 +769,10 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
bChanged = true;
}
else
- bCont = false;
+ break; // while
}
- bCont = true;
- while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol)
+ while (rStartCol < rEndCol)
{
if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow))
{
@@ -771,12 +780,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
bChanged = true;
}
else
- bCont = false;
+ break; // while
}
if (!bColumnsOnly)
{
- if (rStartRow < MAXROW && rStartRow < rEndRow)
+ if (rStartRow < rEndRow)
{
bool bFound = false;
for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -789,7 +798,7 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
}
}
- if (rEndRow > 0 && rStartRow < rEndRow)
+ if (rStartRow < rEndRow)
{
bool bFound = false;
for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++)
@@ -804,9 +813,12 @@ bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow,
}
if (bChanged)
- bRet = true;
+ o_bShrunk = true;
} while( bChanged );
- return bRet;
+
+ return rStartCol != rEndCol || (bColumnsOnly ?
+ !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) :
+ (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow)));
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9bb22b68d2ad..86dd93da383b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -774,6 +774,9 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->pRowFlags->CopyFrom(*pRowFlags, nRow1, nRow2);
// Hidden flags.
+ // #i116164# Collect information first, then apply the changes,
+ // so RowHidden doesn't rebuild the tree for each row range.
+ std::vector<ScShowRowsEntry> aEntries;
for (SCROW i = nRow1; i <= nRow2; ++i)
{
SCROW nThisLastRow, nDestLastRow;
@@ -786,7 +789,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// the last row shouldn't exceed the upper bound the caller specified.
nLastRow = nRow2;
- pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
+ //pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
+ aEntries.push_back(ScShowRowsEntry(i, nLastRow, bThisHidden));
bool bThisHiddenChange = (bThisHidden != bDestHidden);
if (bThisHiddenChange && pCharts)
@@ -802,6 +806,19 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
i = nLastRow;
}
+ std::vector<ScShowRowsEntry>::const_iterator aEnd = aEntries.end();
+ std::vector<ScShowRowsEntry>::const_iterator aIter = aEntries.begin();
+ if ( aIter != aEnd )
+ {
+ pDestTab->mpHiddenRows->setInsertFromBack(true); // important for undo document
+ while (aIter != aEnd)
+ {
+ pDestTab->SetRowHidden(aIter->mnRow1, aIter->mnRow2, !aIter->mbShow);
+ ++aIter;
+ }
+ pDestTab->mpHiddenRows->setInsertFromBack(false);
+ }
+
// Filtered flags.
for (SCROW i = nRow1; i <= nRow2; ++i)
{
@@ -1135,10 +1152,16 @@ ScBaseCell* ScTable::GetCell( SCCOL nCol, SCROW nRow ) const
void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const
{
rCol = 0;
- rRow = 0;
+ rRow = MAXROW+1;
while (aCol[rCol].IsEmptyData() && rCol < MAXCOL)
++rCol;
- rRow = aCol[rCol].GetFirstDataPos();
+ SCCOL nCol = rCol;
+ while (nCol <= MAXCOL && rRow > 0)
+ {
+ if (!aCol[nCol].IsEmptyData())
+ rRow = ::std::min( rRow, aCol[nCol].GetFirstDataPos());
+ ++nCol;
+ }
}
void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
@@ -1148,11 +1171,8 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
while (aCol[rCol].IsEmptyData() && (rCol > 0))
rCol--;
SCCOL nCol = rCol;
- while ((SCsCOL)nCol >= 0)
- {
- rRow = Max(rRow, aCol[nCol].GetLastDataPos());
- nCol--;
- }
+ while (nCol >= 0 && rRow < MAXROW)
+ rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos());
}
@@ -2625,10 +2645,10 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow)
}
-void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
+void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags)
{
+ // #i116164# IncRecalcLevel/DecRecalcLevel is in ScTable::Query
SCROW nStartRow = nRow1;
- IncRecalcLevel();
InitializeNoteCaptions();
while (nStartRow <= nRow2)
{
@@ -2638,7 +2658,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
nEndRow = nRow2;
BOOL bChanged = ( bWasVis != bShow );
- if ( bChanged )
+ if ( bChanged && bSetFlags )
{
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
@@ -2651,8 +2671,13 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
}
}
- SetRowHidden(nStartRow, nEndRow, !bShow);
- SetRowFiltered(nStartRow, nEndRow, !bShow);
+ // #i116164# Directly modify the flags only if there are drawing objects within the area.
+ // Otherwise, all modifications are made together in ScTable::Query, so the tree isn't constantly rebuilt.
+ if ( bSetFlags )
+ {
+ SetRowHidden(nStartRow, nEndRow, !bShow);
+ SetRowFiltered(nStartRow, nEndRow, !bShow);
+ }
if ( bChanged )
{
@@ -2669,8 +2694,6 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
// to be done here.
if (pOutlineTable)
UpdateOutlineRow( nRow1, nRow2, bShow );
-
- DecRecalcLevel();
}
@@ -2679,6 +2702,14 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
SCROW nStartRow = nRow1;
IncRecalcLevel();
InitializeNoteCaptions();
+
+ // #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough
+ ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2, false );
+ long nOldHeight = 0;
+ if ( pDrawLayer && !bHasObjects )
+ nOldHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
+
while (nStartRow <= nRow2)
{
SCROW nEndRow = -1;
@@ -2687,9 +2718,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
nEndRow = nRow2;
BOOL bChanged = ( bWasVis != bShow );
- if ( bChanged )
+ if ( bChanged && bHasObjects )
{
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if (pDrawLayer)
{
long nHeight = static_cast<long>(mpRowHeights->getSumValue(nStartRow, nEndRow));
@@ -2700,9 +2730,14 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
}
}
- SetRowHidden(nStartRow, nEndRow, !bShow);
- if (bShow)
- SetRowFiltered(nStartRow, nEndRow, false);
+ // #i116164# Directly modify the flags only if there are drawing objects within the area.
+ // Otherwise, all rows are modified together after the loop, so the tree isn't constantly rebuilt.
+ if ( bHasObjects )
+ {
+ SetRowHidden(nStartRow, nEndRow, !bShow);
+ if (bShow)
+ SetRowFiltered(nStartRow, nEndRow, false);
+ }
if ( bChanged )
{
@@ -2715,6 +2750,25 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
nStartRow = nEndRow + 1;
}
+
+ if ( !bHasObjects )
+ {
+ // #i116164# set the flags for the whole range at once
+ SetRowHidden(nRow1, nRow2, !bShow);
+ if (bShow)
+ SetRowFiltered(nRow1, nRow2, false);
+
+ if ( pDrawLayer )
+ {
+ // if there are no objects in the range, a single HeightChanged call is enough
+ long nNewHeight = 0;
+ if ( bShow )
+ nNewHeight = static_cast<long>(GetRowHeight(nRow1, nRow2));
+ if ( nNewHeight != nOldHeight )
+ pDrawLayer->HeightChanged( nTab, nRow1, nNewHeight - nOldHeight );
+ }
+ }
+
DecRecalcLevel();
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index bd6a2c92c442..8828d8ab2449 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -59,6 +59,8 @@
#include "cellform.hxx"
#include "postit.hxx"
#include "queryparam.hxx"
+#include "segmenttree.hxx"
+#include "drwlayer.hxx"
#include <vector>
@@ -1489,6 +1491,14 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
}
+ if (aParam.bInplace)
+ IncRecalcLevel(); // #i116164# once for all entries
+
+ // #i116164# If there are no drawing objects within the area, call SetRowHidden/SetRowFiltered for all rows at the end
+ std::vector<ScShowRowsEntry> aEntries;
+ ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, aParam.nRow1 + nHeader, aParam.nRow2, false );
+
for (SCROW j=aParam.nRow1 + nHeader; j<=aParam.nRow2; j++)
{
BOOL bResult; // Filterergebnis
@@ -1544,7 +1554,11 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
else
{
if (bStarted)
- DBShowRows(nOldStart,nOldEnd, bOldResult);
+ {
+ DBShowRows(nOldStart,nOldEnd, bOldResult, bHasObjects);
+ if (!bHasObjects)
+ aEntries.push_back(ScShowRowsEntry(nOldStart, nOldEnd, bOldResult));
+ }
nOldStart = nOldEnd = j;
bOldResult = bResult;
}
@@ -1563,7 +1577,58 @@ SCSIZE ScTable::Query(ScQueryParam& rParamOrg, BOOL bKeepSub)
}
if (aParam.bInplace && bStarted)
- DBShowRows(nOldStart,nOldEnd, bOldResult);
+ {
+ DBShowRows(nOldStart,nOldEnd, bOldResult, bHasObjects);
+ if (!bHasObjects)
+ aEntries.push_back(ScShowRowsEntry(nOldStart, nOldEnd, bOldResult));
+ }
+
+ // #i116164# execute the collected SetRowHidden/SetRowFiltered calls
+ if (!bHasObjects)
+ {
+ std::vector<ScShowRowsEntry>::const_iterator aEnd = aEntries.end();
+ std::vector<ScShowRowsEntry>::const_iterator aIter = aEntries.begin();
+ if ( aIter != aEnd )
+ {
+ // do only one HeightChanged call with the final difference in heights
+ long nOldHeight = 0;
+ if ( pDrawLayer )
+ nOldHeight = static_cast<long>(GetRowHeight(aParam.nRow1 + nHeader, aParam.nRow2));
+
+ // clear the range first instead of many changes in the middle of the filled array
+ SetRowHidden(aParam.nRow1 + nHeader, aParam.nRow2, false);
+ SetRowFiltered(aParam.nRow1 + nHeader, aParam.nRow2, false);
+
+ // insert from back, in case the filter range is large
+ mpHiddenRows->setInsertFromBack(true);
+ mpFilteredRows->setInsertFromBack(true);
+
+ while (aIter != aEnd)
+ {
+ if (!aIter->mbShow)
+ {
+ SCROW nStartRow = aIter->mnRow1;
+ SCROW nEndRow = aIter->mnRow2;
+ SetRowHidden(nStartRow, nEndRow, true);
+ SetRowFiltered(nStartRow, nEndRow, true);
+ }
+ ++aIter;
+ }
+
+ mpHiddenRows->setInsertFromBack(false);
+ mpFilteredRows->setInsertFromBack(false);
+
+ if ( pDrawLayer )
+ {
+ // if there are no objects in the filtered range, a single HeightChanged call is enough
+ long nNewHeight = static_cast<long>(GetRowHeight(aParam.nRow1 + nHeader, aParam.nRow2));
+ pDrawLayer->HeightChanged( nTab, aParam.nRow1 + nHeader, nNewHeight - nOldHeight );
+ }
+ }
+ }
+
+ if (aParam.bInplace)
+ DecRecalcLevel();
delete[] pSpecial;
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 341445431cc8..a2ce08890c30 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -171,6 +171,7 @@ void ScXMLTableRowContext::EndElement()
sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet();
sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow());
uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet());
+ ScDocument* pDoc = rXMLImport.GetDocument();
if(xSheet.is())
{
sal_Int32 nFirstRow(nCurrentRow - nRepeatedRows + 1);
@@ -218,10 +219,18 @@ void ScXMLTableRowContext::EndElement()
bVisible = sal_False;
bFiltered = sal_True;
}
- if (!bVisible)
- xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISVISIBLE)), uno::makeAny(bVisible));
- if (bFiltered)
- xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISFILTERED)), uno::makeAny(bFiltered));
+
+ // #i116164# call SetRowHidden/SetRowFiltered directly, so the tree doesn't have to be rebuilt
+ // to compare with existing hidden flags.
+ if (!bVisible && pDoc)
+ pDoc->SetRowHidden((SCROW)nFirstRow, (SCROW)nCurrentRow, (SCTAB)nSheet, true);
+ if (bFiltered && pDoc)
+ pDoc->SetRowFiltered((SCROW)nFirstRow, (SCROW)nCurrentRow, (SCTAB)nSheet, true);
+
+ //if (!bVisible)
+ // xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISVISIBLE)), uno::makeAny(bVisible));
+ //if (bFiltered)
+ // xRowProperties->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_ISFILTERED)), uno::makeAny(bFiltered));
}
}
}
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 7fa31246275a..ba39316768b7 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1392,7 +1392,8 @@ static ScTokenArray* lcl_convertToTokenArray(ScDocument* pSrcDoc, ScRange& rRang
// Only loop within the data area.
SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2;
SCROW nDataRow1 = nRow1, nDataRow2 = nRow2;
- if (!pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2))
+ bool bShrunk;
+ if (!pSrcDoc->ShrinkToUsedDataArea( bShrunk, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, false))
// no data within specified range.
continue;
@@ -1708,8 +1709,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL;
SCROW nDataRow1 = 0, nDataRow2 = MAXROW;
- pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
- if (rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
+ bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
+ if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
{
// requested cell is outside the data area. Don't even bother caching
// this data, but add it to the cached range to prevent accessing the
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 1e5a6b9da4ae..f2a277b987df 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -159,7 +159,10 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection e
ScDocument* pDoc = pDocSh->GetDocument();
SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col();
SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row();
- if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly))
+ bool bShrunk;
+ pDoc->ShrinkToUsedDataArea( bShrunk, aRange.aStart.Tab(),
+ nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly);
+ if (bShrunk)
{
aRange.aStart.SetCol(nCol1);
aRange.aEnd.SetCol(nCol2);
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index c0af39226c3f..6034ac81ecba 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -97,7 +97,9 @@ String __EXPORT ScTabViewShell::GetSelectionText( BOOL bWholeWord )
SCROW nRow1, nRow2;
SCTAB nTab1, nTab2;
aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
- if (pDoc->ShrinkToUsedDataArea( nTab1, nCol1, nRow1, nCol2, nRow2, false))
+ bool bShrunk;
+ pDoc->ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false);
+ if (bShrunk)
{
aRange.aStart.SetCol( nCol1 );
aRange.aStart.SetRow( nRow1 );
diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk
index d8732bcfda16..4c8eb6cca6a9 100644
--- a/solenv/inc/minor.mk
+++ b/solenv/inc/minor.mk
@@ -1,5 +1,5 @@
RSCVERSION=330
-RSCREVISION=330m18(Build:9556)
-BUILD=9556
-LAST_MINOR=m18
+RSCREVISION=330m19(Build:9561)
+BUILD=9561
+LAST_MINOR=m19
SOURCEVERSION=OOO330
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2378cd1d68a1..54997289133e 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1336,12 +1336,14 @@ void SwDoc::CalculatePagesForPrinting(
// get PageRange value to use
OUString aPageRange;
- if (bIsPDFExport)
- {
- // ?? rOptions.getValue( C2U("Selection") );
- aPageRange = rOptions.getStringValue( "PageRange", OUString() );
- }
- else
+ // --> PL, OD #i116085# - adjusting fix for i113919
+// if (bIsPDFExport)
+// {
+// aPageRange = rOptions.getStringValue( "PageRange", OUString() );
+// }
+// else
+ if ( !bIsPDFExport )
+ // <--
{
// PageContent :
// 0 -> print all pages (default if aPageRange is empty)
diff --git a/xpdf/xpdf-3.02.patch b/xpdf/xpdf-3.02.patch
index 341ad73132a2..9477f7a31d4a 100644
--- a/xpdf/xpdf-3.02.patch
+++ b/xpdf/xpdf-3.02.patch
@@ -1870,3 +1870,32 @@
}
objStr->getObject(e->gen, num, obj);
break;
+--- misc/xpdf-3.02/fofi/FoFiType1.cc 2007-02-27 23:05:51.000000000 +0100
++++ misc/build/xpdf-3.02/fofi/FoFiType1.cc 2011-01-04 13:41:06.871136746 +0100
+@@ -224,7 +224,7 @@
+ code = code * 8 + (*p2 - '0');
+ }
+ }
+- if (code < 256) {
++ if (code < 256 && code >= 0) {
+ for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
+ if (*p == '/') {
+ ++p;
+--- misc/xpdf-3.02/xpdf/Gfx.cc 2007-02-27 23:05:52.000000000 +0100
++++ misc/build/xpdf-3.02/xpdf/Gfx.cc 2011-01-04 13:41:19.847501431 +0100
+@@ -441,6 +441,7 @@
+ void *abortCheckCbkDataA) {
+ int i;
+
++ parser = NULL;
+ xref = xrefA;
+ subPage = gFalse;
+ printCommands = globalParams->getPrintCommands();
+@@ -483,6 +484,7 @@
+ void *abortCheckCbkDataA) {
+ int i;
+
++ parser = NULL;
+ xref = xrefA;
+ subPage = gTrue;
+ printCommands = globalParams->getPrintCommands();