summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2010-08-13 11:29:46 +0200
committerDaniel Rentz <dr@openoffice.org>2010-08-13 11:29:46 +0200
commit44d428feaf032f34ede97f82752c7e1e360946fb (patch)
tree6b01ed78c8b22d27005490909b9dc3069115a647 /sc
parent6fd7d647906c721d69f062e41221cffb6bddb402 (diff)
parent73f30fce2f949736692149cb29a9bbc1c0a059d5 (diff)
mib18: rebase to OOO330m4
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/inc/table.hxx48
-rw-r--r--sc/source/core/data/documen3.cxx87
-rw-r--r--sc/source/core/data/document.cxx67
-rw-r--r--sc/source/core/data/dpobject.cxx24
-rw-r--r--sc/source/core/data/fillinfo.cxx20
-rw-r--r--sc/source/core/data/markdata.cxx62
-rw-r--r--sc/source/core/data/table2.cxx106
-rw-r--r--sc/source/core/data/table5.cxx68
-rw-r--r--sc/source/core/tool/compiler.cxx37
-rw-r--r--sc/source/core/tool/interpr1.cxx81
-rw-r--r--sc/source/filter/excel/xiescher.cxx6
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx27
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.hxx1
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx32
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx7
-rw-r--r--sc/source/filter/xml/xmlstyle.cxx18
-rw-r--r--sc/source/filter/xml/xmlstyle.hxx2
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx19
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx44
-rw-r--r--sc/source/ui/dbgui/textimportoptions.src30
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx12
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx9
-rw-r--r--sc/source/ui/inc/dpcontrol.hxx4
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc1
-rw-r--r--sc/source/ui/inc/tabbgcolordlg.hxx2
-rw-r--r--sc/source/ui/inc/viewdata.hxx18
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx21
-rw-r--r--sc/source/ui/src/optdlg.src6
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/unoobj/confuno.cxx13
-rw-r--r--sc/source/ui/view/gridwin2.cxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx33
-rw-r--r--sc/source/ui/view/output.cxx14
-rw-r--r--sc/source/ui/view/output2.cxx34
-rw-r--r--sc/source/ui/view/viewdata.cxx161
-rw-r--r--sc/uiconfig/scalc/toolbar/findbar.xml8
37 files changed, 774 insertions, 353 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 983ceb4ace08..5c4685223281 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1283,6 +1283,7 @@ public:
SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const;
SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
+ SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const;
SC_DLLPUBLIC ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
SCROW GetRowForHeight( SCTAB nTab, ULONG nHeight ) const;
ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 78e5875b6879..63cefe22626a 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -628,12 +628,12 @@ public:
// nPPT fuer Test auf Veraenderung
void SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual );
- USHORT GetColWidth( SCCOL nCol );
- SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true );
- ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow );
- ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale );
- ULONG GetColOffset( SCCOL nCol );
- ULONG GetRowOffset( SCROW nRow );
+ USHORT GetColWidth( SCCOL nCol ) const;
+ SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
+ ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
+ ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
+ ULONG GetColOffset( SCCOL nCol ) const;
+ ULONG GetRowOffset( SCROW nRow ) const;
/**
* Get the last row such that the height of row 0 to the end row is as
@@ -643,7 +643,7 @@ public:
*
* @return SCROW last row of the range within specified height.
*/
- SCROW GetRowForHeight(ULONG nHeight);
+ SCROW GetRowForHeight(ULONG nHeight) const;
USHORT GetOriginalWidth( SCCOL nCol ) const;
USHORT GetOriginalHeight( SCROW nRow ) const;
@@ -683,6 +683,8 @@ public:
void UpdatePageBreaks( const ScRange* pUserArea );
void RemoveManualBreaks();
BOOL HasManualBreaks() const;
+ void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
+ void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
@@ -711,33 +713,33 @@ public:
::com::sun::star::uno::Sequence<
::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
- bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
- bool RowHidden(SCROW nRow, SCROW& rLastRow);
- bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow);
- bool ColHidden(SCCOL nCol, SCCOL& rLastCol);
- bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
+ bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+ bool RowHidden(SCROW nRow, SCROW& rLastRow) const;
+ bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
+ bool ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
+ bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
void SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
- SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow);
- SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow);
- SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow);
- sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow);
+ SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
+ SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
+ SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
+ sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
- SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol);
+ SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
- bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
- bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
- bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow);
+ bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
+ bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
+ bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
- SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
- SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
- SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow);
+ SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
+ SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
+ SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
void SyncColRowFlags();
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 529eac2632a2..8fea4b8af2b9 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1566,6 +1566,54 @@ void ScDocument::ResetEmbedded()
aEmbedRange = ScRange();
}
+
+/** Similar to ScViewData::AddPixelsWhile(), but add height twips and only
+ while result is less than nStopTwips.
+ @return TRUE if advanced at least one row.
+ */
+bool lcl_AddTwipsWhile( long & rTwips, long nStopTwips, SCROW & rPosY, SCROW nEndRow, const ScTable * pTable )
+{
+ SCROW nRow = rPosY;
+ bool bAdded = false;
+ bool bStop = false;
+ while (rTwips < nStopTwips && nRow <= nEndRow && !bStop)
+ {
+ SCROW nHeightEndRow;
+ USHORT nHeight = pTable->GetRowHeight( nRow, NULL, &nHeightEndRow);
+ if (nHeightEndRow > nEndRow)
+ nHeightEndRow = nEndRow;
+ if (!nHeight)
+ nRow = nHeightEndRow + 1;
+ else
+ {
+ SCROW nRows = nHeightEndRow - nRow + 1;
+ sal_Int64 nAdd = static_cast<sal_Int64>(nHeight) * nRows;
+ if (nAdd + rTwips >= nStopTwips)
+ {
+ sal_Int64 nDiff = nAdd + rTwips - nStopTwips;
+ nRows -= static_cast<SCROW>(nDiff / nHeight);
+ nAdd = nHeight * nRows;
+ // We're looking for a value that satisfies loop condition.
+ if (nAdd + rTwips >= nStopTwips)
+ {
+ --nRows;
+ nAdd -= nHeight;
+ }
+ bStop = true;
+ }
+ rTwips += static_cast<long>(nAdd);
+ nRow += nRows;
+ }
+ }
+ if (nRow > rPosY)
+ {
+ --nRow;
+ bAdded = true;
+ }
+ rPosY = nRow;
+ return bAdded;
+}
+
ScRange ScDocument::GetRange( SCTAB nTab, const Rectangle& rMMRect )
{
ScTable* pTable = pTab[nTab];
@@ -1622,43 +1670,16 @@ ScRange ScDocument::GetRange( SCTAB nTab, const Rectangle& rMMRect )
nTwips = (long) (aPosRect.Top() / HMM_PER_TWIPS);
SCROW nY1 = 0;
- bEnd = FALSE;
- for (SCROW i = nY1; i <= MAXROW && !bEnd; ++i)
- {
- if (pTable->RowHidden(i))
- continue;
-
- nY1 = i;
- nAdd = static_cast<long>(pTable->GetRowHeight(i));
- if (nSize+nAdd <= nTwips+1 && nY1<MAXROW)
- {
- nSize += nAdd;
- ++nY1;
- }
- else
- bEnd = TRUE;
- }
- if (!bEnd)
- nY1 = MAXROW; // all hidden down to the bottom
+ // Was if(nSize+nAdd<=nTwips+1) inside loop => if(nSize+nAdd<nTwips+2)
+ if (lcl_AddTwipsWhile( nSize, nTwips+2, nY1, MAXROW, pTable) && nY1 < MAXROW)
+ ++nY1; // original loop ended on last matched +1 unless that was MAXROW
nTwips = (long) (aPosRect.Bottom() / HMM_PER_TWIPS);
SCROW nY2 = nY1;
- bEnd = FALSE;
- for (SCROW i = nY2; i <= MAXROW && !bEnd; ++i)
- {
- nY2 = i;
- nAdd = static_cast<long>(pTable->GetRowHeight(i));
- if (nSize+nAdd < nTwips && nY2<MAXROW)
- {
- nSize += nAdd;
- ++nY2;
- }
- else
- bEnd = TRUE;
- }
- if (!bEnd)
- nY2 = MAXROW; // all hidden down to the bottom
+ // Was if(nSize+nAdd<nTwips) inside loop => if(nSize+nAdd<nTwips)
+ if (lcl_AddTwipsWhile( nSize, nTwips, nY2, MAXROW, pTable) && nY2 < MAXROW)
+ ++nY2; // original loop ended on last matched +1 unless that was MAXROW
return ScRange( nX1,nY1,nTab, nX2,nY2,nTab );
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 37057b10ca5f..1efe32446eef 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3061,6 +3061,19 @@ void ScDocument::CalcAfterLoad()
bCalcingAfterLoad = FALSE;
SetDetectiveDirty(FALSE); // noch keine wirklichen Aenderungen
+
+ // #i112436# If formula cells are already dirty, they don't broadcast further changes.
+ // So the source ranges of charts must be interpreted even if they are not visible,
+ // similar to ScMyShapeResizer::CreateChartListener for loading own files (i104899).
+ if (pChartListenerCollection)
+ {
+ sal_uInt16 nChartCount = pChartListenerCollection->GetCount();
+ for ( sal_uInt16 nIndex = 0; nIndex < nChartCount; nIndex++ )
+ {
+ ScChartListener* pChartListener = static_cast<ScChartListener*>(pChartListenerCollection->At(nIndex));
+ InterpretDirtyCells(*pChartListener->GetRangeList());
+ }
+ }
}
@@ -3161,7 +3174,16 @@ USHORT ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero ) co
{
if ( ValidTab(nTab) && pTab[nTab] )
return pTab[nTab]->GetRowHeight( nRow, NULL, NULL, bHiddenAsZero );
- DBG_ERROR("Falsche Tabellennummer");
+ DBG_ERROR("Wrong sheet number");
+ return 0;
+}
+
+
+USHORT ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero ) const
+{
+ if ( ValidTab(nTab) && pTab[nTab] )
+ return pTab[nTab]->GetRowHeight( nRow, pStartRow, pEndRow, bHiddenAsZero );
+ DBG_ERROR("Wrong sheet number");
return 0;
}
@@ -3684,24 +3706,35 @@ SCCOL ScDocument::GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const
SCROW ScDocument::GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize) const
{
- if ( ValidTab(nTab) && pTab[nTab] && pTab[nTab]->GetRowFlagsArray() && pTab[nTab]->mpRowHeights )
- {
- BYTE nStartFlags = pTab[nTab]->GetRowFlags(nStart);
- USHORT nStartHeight = pTab[nTab]->GetOriginalHeight(nStart);
- for (SCROW nRow = nStart + 1; nRow <= MAXROW; nRow++)
+ const ScBitMaskCompressedArray< SCROW, BYTE> * pRowFlagsArray;
+ if ( ValidTab(nTab) && pTab[nTab] && ((pRowFlagsArray = pTab[nTab]->GetRowFlagsArray()) != NULL) &&
+ pTab[nTab]->mpRowHeights && pTab[nTab]->mpHiddenRows )
+ {
+ size_t nIndex; // ignored
+ SCROW nFlagsEndRow;
+ SCROW nHiddenEndRow;
+ SCROW nHeightEndRow;
+ BYTE nFlags;
+ bool bHidden;
+ USHORT nHeight;
+ BYTE nStartFlags = nFlags = pRowFlagsArray->GetValue( nStart, nIndex, nFlagsEndRow);
+ bool bStartHidden = bHidden = pTab[nTab]->RowHidden( nStart, NULL, &nHiddenEndRow);
+ USHORT nStartHeight = nHeight = pTab[nTab]->GetRowHeight( nStart, NULL, &nHeightEndRow, false);
+ SCROW nRow;
+ while ((nRow = std::min( nHiddenEndRow, std::min( nFlagsEndRow, nHeightEndRow)) + 1) <= MAXROW)
{
- size_t nIndex; // ignored
- SCROW nFlagsEndRow;
- SCROW nHeightEndRow;
- BYTE nFlags = pTab[nTab]->GetRowFlagsArray()->GetValue( nRow, nIndex, nFlagsEndRow );
- USHORT nHeight = pTab[nTab]->GetRowHeight(nRow, NULL, &nHeightEndRow);
- if (((nStartFlags & CR_MANUALBREAK) != (nFlags & CR_MANUALBREAK)) ||
- ((nStartFlags & CR_MANUALSIZE) != (nFlags & CR_MANUALSIZE)) ||
- (bCareManualSize && (nStartFlags & CR_MANUALSIZE) && (nStartHeight != nHeight)) ||
- (!bCareManualSize && ((nStartHeight != nHeight))))
+ if (nFlagsEndRow < nRow)
+ nFlags = pRowFlagsArray->GetValue( nRow, nIndex, nFlagsEndRow);
+ if (nHiddenEndRow < nRow)
+ bHidden = pTab[nTab]->RowHidden( nRow, NULL, &nHiddenEndRow);
+ if (nHeightEndRow < nRow)
+ nHeight = pTab[nTab]->GetRowHeight( nRow, NULL, &nHeightEndRow, false);
+ if ( ((nStartFlags & CR_MANUALBREAK) != (nFlags & CR_MANUALBREAK)) ||
+ ((nStartFlags & CR_MANUALSIZE) != (nFlags & CR_MANUALSIZE)) ||
+ (bStartHidden != bHidden) ||
+ (bCareManualSize && (nStartFlags & CR_MANUALSIZE) && (nStartHeight != nHeight)) ||
+ (!bCareManualSize && ((nStartHeight != nHeight))))
return nRow;
-
- nRow = std::min( nFlagsEndRow, nHeightEndRow );
}
return MAXROW+1;
}
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 7ca41d47f79d..e994339f4a9a 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
@@ -2293,6 +2294,9 @@ uno::Sequence<rtl::OUString> ScDPObject::GetRegisteredSources()
return aSeq;
}
+// use getContext from addincol.cxx
+uno::Reference<uno::XComponentContext> getContext(uno::Reference<lang::XMultiServiceFactory> xMSF);
+
// static
uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPServiceDesc& rDesc )
{
@@ -2317,12 +2321,26 @@ uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPS
if ( xIntFac.is() )
{
uno::Reference<lang::XServiceInfo> xInfo( xIntFac, uno::UNO_QUERY );
- uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
- if ( xFac.is() && xInfo.is() && xInfo->getImplementationName() == aImplName )
+ if ( xInfo.is() && xInfo->getImplementationName() == aImplName )
{
try
{
- uno::Reference<uno::XInterface> xInterface = xFac->createInstance();
+ // #i113160# try XSingleComponentFactory in addition to (old) XSingleServiceFactory,
+ // passing the context to the component (see ScUnoAddInCollection::Initialize)
+
+ uno::Reference<uno::XInterface> xInterface;
+ uno::Reference<uno::XComponentContext> xCtx = getContext(xManager);
+ uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
+ if (xCtx.is() && xCFac.is())
+ xInterface = xCFac->createInstanceWithContext(xCtx);
+
+ if (!xInterface.is())
+ {
+ uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
+ if ( xFac.is() )
+ xInterface = xFac->createInstance();
+ }
+
uno::Reference<lang::XInitialization> xInit( xInterface, uno::UNO_QUERY );
if (xInit.is())
{
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 8418cb3c3a25..99da4979a1b6 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -219,6 +219,8 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
nArrY=0;
SCROW nYExtra = nY2+1;
+ USHORT nDocHeight = ScGlobal::nStdRowHeight;
+ SCROW nDocHeightEndRow = -1;
for (nSignedY=((SCsROW)nY1)-1; nSignedY<=(SCsROW)nYExtra; nSignedY++)
{
if (nSignedY >= 0)
@@ -226,11 +228,13 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
else
nY = MAXROW+1; // ungueltig
- USHORT nDocHeight;
- if (ValidRow(nY))
- nDocHeight = GetRowHeight( nY, nTab );
- else
- nDocHeight = ScGlobal::nStdRowHeight;
+ if (nY > nDocHeightEndRow)
+ {
+ if (ValidRow(nY))
+ nDocHeight = GetRowHeight( nY, nTab, NULL, &nDocHeightEndRow );
+ else
+ nDocHeight = ScGlobal::nStdRowHeight;
+ }
if ( nArrY==0 || nDocHeight || nY > MAXROW )
{
@@ -384,11 +388,15 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
nArrY = 1;
SCSIZE nUIndex;
+ bool bHiddenRow = true;
+ SCROW nHiddenEndRow = -1;
(void) pThisCol->Search( nY1, nUIndex );
while ( nUIndex < pThisCol->nCount &&
(nThisRow=pThisCol->pItems[nUIndex].nRow) <= nY2 )
{
- if ( !RowHidden( nThisRow,nTab ) )
+ if (nThisRow > nHiddenEndRow)
+ bHiddenRow = RowHidden( nThisRow, nTab, nHiddenEndRow);
+ if ( !bHiddenRow )
{
while ( pRowInfo[nArrY].nRowNo < nThisRow )
++nArrY;
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index baf3f4cf3f95..4401ac19d199 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -429,18 +429,28 @@ SCCOLROW ScMarkData::GetMarkColumnRanges( SCCOLROW* pRanges )
if (!bMultiMarked)
return 0;
- DBG_ASSERT(pMultiSel, "bMultiMarked, aber pMultiSel == 0");
+ DBG_ASSERT(pMultiSel, "bMultiMarked, but pMultiSel == 0");
+
+ const SCCOLROW nMultiStart = aMultiRange.aStart.Col();
+ const SCCOLROW nMultiEnd = aMultiRange.aEnd.Col();
+ if (nMultiStart == 0 && nMultiEnd == MAXCOL)
+ {
+ // One or more entire rows.
+ pRanges[0] = 0;
+ pRanges[1] = MAXCOL;
+ return 1;
+ }
SCCOLROW nRangeCnt = 0;
- SCCOLROW nStart = 0;
- while (nStart<=MAXCOL)
+ SCCOLROW nStart = nMultiStart;
+ while (nStart <= nMultiEnd)
{
- while (nStart<MAXCOL && !pMultiSel[nStart].HasMarks())
+ while (nStart < nMultiEnd && !pMultiSel[nStart].HasMarks())
++nStart;
if (pMultiSel[nStart].HasMarks())
{
SCCOLROW nEnd = nStart;
- while (nEnd<MAXCOL && pMultiSel[nEnd].HasMarks())
+ while (nEnd < nMultiEnd && pMultiSel[nEnd].HasMarks())
++nEnd;
if (!pMultiSel[nEnd].HasMarks())
--nEnd;
@@ -450,7 +460,7 @@ SCCOLROW ScMarkData::GetMarkColumnRanges( SCCOLROW* pRanges )
nStart = nEnd+1;
}
else
- nStart = MAXCOL+1;
+ nStart = nMultiEnd+1;
}
return nRangeCnt;
@@ -464,37 +474,51 @@ SCCOLROW ScMarkData::GetMarkRowRanges( SCCOLROW* pRanges )
if (!bMultiMarked)
return 0;
- DBG_ASSERT(pMultiSel, "bMultiMarked, aber pMultiSel == 0");
+ DBG_ASSERT(pMultiSel, "bMultiMarked, but pMultiSel == 0");
- // Welche Zeilen sind markiert?
+ // Which rows are marked?
- BOOL* bRowMarked = new BOOL[MAXROW+1];
+ // Optimized to not loop over MAXCOL*MAXROW as worst case, i.e. Ctrl+A
+
+ const SCCOLROW nMultiStart = aMultiRange.aStart.Row();
+ const SCCOLROW nMultiEnd = aMultiRange.aEnd.Row();
+
+ BOOL* bRowMarked = new BOOL[MAXROWCOUNT];
+ memset( bRowMarked, 0, sizeof(BOOL) * MAXROWCOUNT);
SCROW nRow;
SCCOL nCol;
- for (nRow=0; nRow<=MAXROW; nRow++)
- bRowMarked[nRow] = FALSE;
- SCROW nTop, nBottom;
- for (nCol=0; nCol<=MAXCOL; nCol++)
+ SCROW nTop = -1, nBottom = -1;
+ for (nCol = aMultiRange.aStart.Col(); nCol <= aMultiRange.aEnd.Col(); ++nCol)
{
ScMarkArrayIter aMarkIter( &pMultiSel[nCol] );
while (aMarkIter.Next( nTop, nBottom ))
for (nRow=nTop; nRow<=nBottom; nRow++)
bRowMarked[nRow] = TRUE;
+ if (nTop == nMultiStart && nBottom == nMultiEnd)
+ break; // for, all relevant rows marked
+ }
+
+ if (nTop == nMultiStart && nBottom == nMultiEnd)
+ {
+ pRanges[0] = nTop;
+ pRanges[1] = nBottom;
+ delete[] bRowMarked;
+ return 1;
}
- // zu Bereichen zusammenfassen
+ // Combine to ranges of rows.
SCCOLROW nRangeCnt = 0;
- SCCOLROW nStart = 0;
- while (nStart<=MAXROW)
+ SCCOLROW nStart = nMultiStart;
+ while (nStart <= nMultiEnd)
{
- while (nStart<MAXROW && !bRowMarked[nStart])
+ while (nStart < nMultiEnd && !bRowMarked[nStart])
++nStart;
if (bRowMarked[nStart])
{
SCCOLROW nEnd = nStart;
- while (nEnd<MAXROW && bRowMarked[nEnd])
+ while (nEnd < nMultiEnd && bRowMarked[nEnd])
++nEnd;
if (!bRowMarked[nEnd])
--nEnd;
@@ -504,7 +528,7 @@ SCCOLROW ScMarkData::GetMarkRowRanges( SCCOLROW* pRanges )
nStart = nEnd+1;
}
else
- nStart = MAXROW+1;
+ nStart = nMultiEnd+1;
}
delete[] bRowMarked;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9bd5b031fde5..d54e16b8cbd7 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -155,6 +155,22 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
mpFilteredRows->insertSegment(nStartRow, nSize, true);
mpHiddenRows->insertSegment(nStartRow, nSize, true);
+
+ if (!maRowManualBreaks.empty())
+ {
+ std::set<SCROW>::reverse_iterator rit = maRowManualBreaks.rbegin();
+ while (rit != maRowManualBreaks.rend())
+ {
+ SCROW nRow = *rit;
+ if (nRow < nStartRow)
+ break; // while
+ else
+ {
+ maRowManualBreaks.erase( (++rit).base());
+ maRowManualBreaks.insert( static_cast<SCROW>( nRow + nSize));
+ }
+ }
+ }
}
for (SCCOL j=nStartCol; j<=nEndCol; j++)
@@ -185,6 +201,18 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
mpFilteredRows->removeSegment(nStartRow, nStartRow+nSize);
mpHiddenRows->removeSegment(nStartRow, nStartRow+nSize);
+
+ if (!maRowManualBreaks.empty())
+ {
+ std::set<SCROW>::iterator it = maRowManualBreaks.upper_bound( static_cast<SCROW>( nStartRow + nSize - 1));
+ maRowManualBreaks.erase( maRowManualBreaks.lower_bound( nStartRow), it);
+ while (it != maRowManualBreaks.end())
+ {
+ SCROW nRow = *it;
+ maRowManualBreaks.erase( it++);
+ maRowManualBreaks.insert( static_cast<SCROW>( nRow - nSize));
+ }
+ }
}
{ // scope for bulk broadcast
@@ -233,6 +261,22 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
mpHiddenCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true);
mpFilteredCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true);
+
+ if (!maColManualBreaks.empty())
+ {
+ std::set<SCCOL>::reverse_iterator rit = maColManualBreaks.rbegin();
+ while (rit != maColManualBreaks.rend())
+ {
+ SCCOL nCol = *rit;
+ if (nCol < nStartCol)
+ break; // while
+ else
+ {
+ maColManualBreaks.erase( (++rit).base());
+ maColManualBreaks.insert( static_cast<SCCOL>( nCol + nSize));
+ }
+ }
+ }
}
@@ -291,6 +335,18 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
SCCOL nRmSize = nStartCol + static_cast<SCCOL>(nSize);
mpHiddenCols->removeSegment(nStartCol, nRmSize);
mpFilteredCols->removeSegment(nStartCol, nRmSize);
+
+ if (!maColManualBreaks.empty())
+ {
+ std::set<SCCOL>::iterator it = maColManualBreaks.upper_bound( static_cast<SCCOL>( nStartCol + nSize - 1));
+ maColManualBreaks.erase( maColManualBreaks.lower_bound( nStartCol), it);
+ while (it != maColManualBreaks.end())
+ {
+ SCCOL nCol = *it;
+ maColManualBreaks.erase( it++);
+ maColManualBreaks.insert( static_cast<SCCOL>( nCol - nSize));
+ }
+ }
}
@@ -688,6 +744,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->IncRecalcLevel();
if (bWidth)
+ {
for (SCCOL i=nCol1; i<=nCol2; i++)
{
bool bThisHidden = ColHidden(i);
@@ -703,6 +760,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bChange)
bFlagChange = true;
}
+ pDestTab->SetColManualBreaks( maColManualBreaks);
+ }
if (bHeight)
{
@@ -754,6 +813,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pDestTab->SetRowFiltered(i, nLastRow, bFiltered);
i = nLastRow;
}
+ pDestTab->SetRowManualBreaks( maRowManualBreaks);
}
pDestTab->DecRecalcLevel();
}
@@ -791,11 +851,17 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bWidth||bHeight)
{
if (bWidth)
+ {
for (SCCOL i=nCol1; i<=nCol2; i++)
pDestTab->pColWidth[i] = pColWidth[i];
+ pDestTab->SetColManualBreaks( maColManualBreaks);
+ }
if (bHeight)
+ {
pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0);
- DecRecalcLevel();
+ pDestTab->SetRowManualBreaks( maRowManualBreaks);
+ }
+ DecRecalcLevel();
}
}
}
@@ -2241,7 +2307,7 @@ void ScTable::SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual )
}
-USHORT ScTable::GetColWidth( SCCOL nCol )
+USHORT ScTable::GetColWidth( SCCOL nCol ) const
{
DBG_ASSERT(VALIDCOL(nCol),"Falsche Spaltennummer");
@@ -2315,34 +2381,50 @@ USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
}
-USHORT ScTable::GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero )
+USHORT ScTable::GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero ) const
{
- DBG_ASSERT(VALIDROW(nRow),"Falsche Zeilennummer");
+ DBG_ASSERT(VALIDROW(nRow),"Invalid row number");
if (VALIDROW(nRow) && mpRowHeights)
{
- if (bHiddenAsZero && RowHidden(nRow))
+ if (bHiddenAsZero && RowHidden( nRow, pStartRow, pEndRow))
return 0;
else
{
ScFlatUInt16RowSegments::RangeData aData;
if (!mpRowHeights->getRangeData(nRow, aData))
+ {
+ if (pStartRow)
+ *pStartRow = nRow;
+ if (pEndRow)
+ *pEndRow = nRow;
// TODO: What should we return in case the search fails?
return 0;
+ }
+ // If bHiddenAsZero, pStartRow and pEndRow were initialized to
+ // boundaries of a non-hidden segment. Assume that the previous and
+ // next segment are hidden then and limit the current height
+ // segment.
if (pStartRow)
- *pStartRow = aData.mnRow1;
+ *pStartRow = (bHiddenAsZero ? std::max( *pStartRow, aData.mnRow1) : aData.mnRow1);
if (pEndRow)
- *pEndRow = aData.mnRow2;
+ *pEndRow = (bHiddenAsZero ? std::min( *pEndRow, aData.mnRow2) : aData.mnRow2);
return aData.mnValue;
}
}
else
+ {
+ if (pStartRow)
+ *pStartRow = nRow;
+ if (pEndRow)
+ *pEndRow = nRow;
return (USHORT) ScGlobal::nStdRowHeight;
+ }
}
-ULONG ScTable::GetRowHeight( SCROW nStartRow, SCROW nEndRow )
+ULONG ScTable::GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const
{
DBG_ASSERT(VALIDROW(nStartRow) && VALIDROW(nEndRow),"Falsche Zeilennummer");
@@ -2368,7 +2450,7 @@ ULONG ScTable::GetRowHeight( SCROW nStartRow, SCROW nEndRow )
}
-ULONG ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale )
+ULONG ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const
{
DBG_ASSERT(VALIDROW(nStartRow) && VALIDROW(nEndRow),"Falsche Zeilennummer");
@@ -3036,7 +3118,7 @@ void ScTable::SetDrawPageSize(bool bResetStreamValid, bool bUpdateNoteCaptionPos
}
-ULONG ScTable::GetRowOffset( SCROW nRow )
+ULONG ScTable::GetRowOffset( SCROW nRow ) const
{
ULONG n = 0;
if ( mpHiddenRows && mpRowHeights )
@@ -3059,7 +3141,7 @@ ULONG ScTable::GetRowOffset( SCROW nRow )
return n;
}
-SCROW ScTable::GetRowForHeight(ULONG nHeight)
+SCROW ScTable::GetRowForHeight(ULONG nHeight) const
{
sal_uInt32 nSum = 0;
@@ -3086,7 +3168,7 @@ SCROW ScTable::GetRowForHeight(ULONG nHeight)
}
-ULONG ScTable::GetColOffset( SCCOL nCol )
+ULONG ScTable::GetColOffset( SCCOL nCol ) const
{
ULONG n = 0;
if ( pColWidth )
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 2635b5821e4f..7c13756aab38 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -326,6 +326,22 @@ BOOL ScTable::HasManualBreaks() const
return !maRowManualBreaks.empty() || !maColManualBreaks.empty();
}
+void ScTable::SetRowManualBreaks( const ::std::set<SCROW>& rBreaks )
+{
+ maRowManualBreaks = rBreaks;
+ InvalidatePageBreaks();
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
+}
+
+void ScTable::SetColManualBreaks( const ::std::set<SCCOL>& rBreaks )
+{
+ maColManualBreaks = rBreaks;
+ InvalidatePageBreaks();
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
+}
+
void ScTable::GetAllRowBreaks(set<SCROW>& rBreaks, bool bPage, bool bManual) const
{
if (bPage)
@@ -355,7 +371,7 @@ bool ScTable::HasRowPageBreak(SCROW nRow) const
if (!ValidRow(nRow))
return false;
- return maRowPageBreaks.count(nRow) > 0;
+ return maRowPageBreaks.find(nRow) != maRowPageBreaks.end();
}
bool ScTable::HasColPageBreak(SCCOL nCol) const
@@ -363,7 +379,7 @@ bool ScTable::HasColPageBreak(SCCOL nCol) const
if (!ValidCol(nCol))
return false;
- return maColPageBreaks.count(nCol) > 0;
+ return maColPageBreaks.find(nCol) != maColPageBreaks.end();
}
bool ScTable::HasRowManualBreak(SCROW nRow) const
@@ -371,7 +387,7 @@ bool ScTable::HasRowManualBreak(SCROW nRow) const
if (!ValidRow(nRow))
return false;
- return maRowManualBreaks.count(nRow) > 0;
+ return maRowManualBreaks.find(nRow) != maRowManualBreaks.end();
}
bool ScTable::HasColManualBreak(SCCOL nCol) const
@@ -379,7 +395,7 @@ bool ScTable::HasColManualBreak(SCCOL nCol) const
if (!ValidCol(nCol))
return false;
- return (maColManualBreaks.count(nCol) > 0);
+ return maColManualBreaks.find(nCol) != maColManualBreaks.end();
}
SCROW ScTable::GetNextManualBreak(SCROW nRow) const
@@ -483,15 +499,27 @@ Sequence<TablePageBreakData> ScTable::GetRowBreakData() const
return aSeq;
}
-bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
{
if (!ValidRow(nRow))
+ {
+ if (pFirstRow)
+ *pFirstRow = nRow;
+ if (pLastRow)
+ *pLastRow = nRow;
return true;
+ }
ScFlatBoolRowSegments::RangeData aData;
if (!mpHiddenRows->getRangeData(nRow, aData))
+ {
// search failed.
+ if (pFirstRow)
+ *pFirstRow = nRow;
+ if (pLastRow)
+ *pLastRow = nRow;
return true;
+ }
if (pFirstRow)
*pFirstRow = aData.mnRow1;
@@ -502,7 +530,7 @@ bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
}
-bool ScTable::RowHidden(SCROW nRow, SCROW& rLastRow)
+bool ScTable::RowHidden(SCROW nRow, SCROW& rLastRow) const
{
rLastRow = nRow;
if (!ValidRow(nRow))
@@ -517,7 +545,7 @@ bool ScTable::RowHidden(SCROW nRow, SCROW& rLastRow)
return aData.mbValue;
}
-bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow)
+bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nStartRow;
while (nRow <= nEndRow)
@@ -532,7 +560,7 @@ bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow)
return false;
}
-bool ScTable::ColHidden(SCCOL nCol, SCCOL& rLastCol)
+bool ScTable::ColHidden(SCCOL nCol, SCCOL& rLastCol) const
{
rLastCol = nCol;
if (!ValidCol(nCol))
@@ -546,7 +574,7 @@ bool ScTable::ColHidden(SCCOL nCol, SCCOL& rLastCol)
return aData.mbValue;
}
-bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
{
if (!ValidCol(nCol))
return true;
@@ -627,7 +655,7 @@ void ScTable::CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow,
}
}
-SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nStartRow;
ScFlatBoolRowSegments::RangeData aData;
@@ -650,7 +678,7 @@ SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow)
return ::std::numeric_limits<SCROW>::max();
}
-SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nEndRow;
ScFlatBoolRowSegments::RangeData aData;
@@ -673,7 +701,7 @@ SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow)
return ::std::numeric_limits<SCROW>::max();
}
-SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nCount = 0;
SCROW nRow = nStartRow;
@@ -694,7 +722,7 @@ SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow)
return nCount;
}
-sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow)
+sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const
{
sal_uInt32 nHeight = 0;
SCROW nRow = nStartRow;
@@ -717,7 +745,7 @@ sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow)
return nHeight;
}
-SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol)
+SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol) const
{
if (bCol)
{
@@ -741,7 +769,7 @@ SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol)
return ::std::numeric_limits<SCCOLROW>::max();
}
-bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
+bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
{
if (!ValidRow(nRow))
return false;
@@ -759,7 +787,7 @@ bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow)
return aData.mbValue;
}
-bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol)
+bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
{
if (!ValidCol(nCol))
return false;
@@ -777,7 +805,7 @@ bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol)
return aData.mbValue;
}
-bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow)
+bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nStartRow;
while (nRow <= nEndRow)
@@ -837,7 +865,7 @@ void ScTable::SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered)
mpFilteredCols->setFalse(nStartCol, nEndCol);
}
-SCROW ScTable::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nStartRow;
ScFlatBoolRowSegments::RangeData aData;
@@ -860,7 +888,7 @@ SCROW ScTable::FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
return ::std::numeric_limits<SCROW>::max();
}
-SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nRow = nEndRow;
ScFlatBoolRowSegments::RangeData aData;
@@ -883,7 +911,7 @@ SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow)
return ::std::numeric_limits<SCROW>::max();
}
-SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow)
+SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const
{
SCROW nCount = 0;
SCROW nRow = nStartRow;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c28d295275ae..828c9ae64c7d 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -121,24 +121,6 @@ enum ScanState
ssStop
};
-// ODFF names that are not written in the current mapping but to be recognized.
-// New names will be written in a future relase, then exchange (!) with the
-// names in formula/source/core/resource/core_resource.src to be able to still
-// read the old names as well.
-struct FunctionName
-{
- const sal_Char* pName;
- OpCode eOp;
-};
-static const FunctionName aOdffAliases[] = {
- // Renamed old names:
- // XXX none yet.
- // Renamed new names:
- { "BINOM.DIST.RANGE", ocB }, // B -> BINOM.DIST.RANGE
- { "LEGACY.TDIST", ocTDist } // TDIST -> LEGACY.TDIST
-};
-static const size_t nOdffAliases = sizeof(aOdffAliases) / sizeof(aOdffAliases[0]);
-
static const sal_Char* pInternal[ 1 ] = { "TTT" };
using namespace ::com::sun::star::i18n;
@@ -2524,6 +2506,25 @@ BOOL ScCompiler::IsOpCode( const String& rName, bool bInArray )
}
else if (mxSymbols->isODFF())
{
+ // ODFF names that are not written in the current mapping but to be
+ // recognized. New names will be written in a future relase, then
+ // exchange (!) with the names in
+ // formula/source/core/resource/core_resource.src to be able to still
+ // read the old names as well.
+ struct FunctionName
+ {
+ const sal_Char* pName;
+ OpCode eOp;
+ };
+ static const FunctionName aOdffAliases[] = {
+ // Renamed old names:
+ // XXX none yet.
+ // Renamed new names:
+ { "BINOM.DIST.RANGE", ocB }, // B -> BINOM.DIST.RANGE
+ { "LEGACY.TDIST", ocTDist }, // TDIST -> LEGACY.TDIST
+ { "ORG.OPENOFFICE.EASTERSUNDAY", ocEasterSunday } // EASTERSUNDAY -> ORG.OPENOFFICE.EASTERSUNDAY
+ };
+ static const size_t nOdffAliases = sizeof(aOdffAliases) / sizeof(aOdffAliases[0]);
for (size_t i=0; i<nOdffAliases; ++i)
{
if (rName.EqualsIgnoreCaseAscii( aOdffAliases[i].pName))
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 30aa0b8aa13e..35c63f52a92b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7097,22 +7097,75 @@ void ScInterpreter::ScText()
if ( MustHaveParamCount( GetByte(), 2 ) )
{
String sFormatString = GetString();
- double fVal = GetDouble();
String aStr;
- Color* pColor = NULL;
- LanguageType eCellLang;
- const ScPatternAttr* pPattern = pDok->GetPattern(
- aPos.Col(), aPos.Row(), aPos.Tab() );
- if ( pPattern )
- eCellLang = ((const SvxLanguageItem&)
- pPattern->GetItem( ATTR_LANGUAGE_FORMAT )).GetValue();
- else
- eCellLang = ScGlobal::eLnge;
- if ( !pFormatter->GetPreviewStringGuess( sFormatString, fVal, aStr,
- &pColor, eCellLang ) )
- PushIllegalArgument();
+ bool bString = false;
+ double fVal = 0.0;
+ switch (GetStackType())
+ {
+ case svError:
+ PopError();
+ break;
+ case svDouble:
+ fVal = PopDouble();
+ break;
+ case svString:
+ aStr = PopString();
+ bString = true;
+ break;
+ default:
+ {
+ FormulaTokenRef xTok( PopToken());
+ if (!nGlobalError)
+ {
+ PushTempToken( xTok);
+ // Temporarily override the ConvertStringToValue()
+ // error for GetCellValue() / GetCellValueOrZero()
+ USHORT nSErr = mnStringNoValueError;
+ mnStringNoValueError = errNotNumericString;
+ fVal = GetDouble();
+ mnStringNoValueError = nSErr;
+ if (nGlobalError == errNotNumericString)
+ {
+ // Not numeric.
+ nGlobalError = 0;
+ PushTempToken( xTok);
+ aStr = GetString();
+ bString = true;
+ }
+ }
+ }
+ }
+ if (nGlobalError)
+ PushError( nGlobalError);
else
- PushString(aStr);
+ {
+ String aResult;
+ Color* pColor = NULL;
+ LanguageType eCellLang;
+ const ScPatternAttr* pPattern = pDok->GetPattern(
+ aPos.Col(), aPos.Row(), aPos.Tab() );
+ if ( pPattern )
+ eCellLang = ((const SvxLanguageItem&)
+ pPattern->GetItem( ATTR_LANGUAGE_FORMAT )).GetValue();
+ else
+ eCellLang = ScGlobal::eLnge;
+ if (bString)
+ {
+ if (!pFormatter->GetPreviewString( sFormatString, aStr,
+ aResult, &pColor, eCellLang))
+ PushIllegalArgument();
+ else
+ PushString( aResult);
+ }
+ else
+ {
+ if (!pFormatter->GetPreviewStringGuess( sFormatString, fVal,
+ aResult, &pColor, eCellLang))
+ PushIllegalArgument();
+ else
+ PushString( aResult);
+ }
+ }
}
}
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index dc87bba4c050..8d09cae60941 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -98,7 +98,6 @@
#include "convuno.hxx"
#include "postit.hxx"
#include "globstr.hrc"
-#include "chartlis.hxx"
#include "fprogressbar.hxx"
#include "xltracer.hxx"
@@ -4056,9 +4055,8 @@ void XclImpObjectManager::ConvertObjects()
for( XclImpSheetDrawingMap::iterator aIt = maSheetDrawings.begin(), aEnd = maSheetDrawings.end(); aIt != aEnd; ++aIt )
aIt->second->ConvertObjects( aDffConv );
- ScChartListenerCollection* pChartListeners = GetDoc().GetChartListenerCollection();
- if( pChartListeners && (pChartListeners->GetCount() > 0) )
- pChartListeners->SetDirty();
+ // #i112436# don't call ScChartListenerCollection::SetDirty here,
+ // instead use InterpretDirtyCells in ScDocument::CalcAfterLoad.
}
String XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index f8bafa32f205..66f3ea613a3a 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -1234,10 +1234,31 @@ void ScRowStyles::AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nFie
const sal_Int32 nStringIndex)
{
DBG_ASSERT(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
- DBG_ASSERT(aTables[nTable].size() >= static_cast<sal_uInt32>(nField), "wrong field");
- if (aTables[nTable].size() == static_cast<sal_uInt32>(nField))
+ DBG_ASSERT(aTables[nTable].size() >= static_cast<size_t>(nField), "wrong field");
+ if (aTables[nTable].size() == static_cast<size_t>(nField))
aTables[nTable].push_back(nStringIndex);
- aTables[nTable][nField] = nStringIndex;
+ else
+ aTables[nTable][nField] = nStringIndex;
+}
+
+void ScRowStyles::AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nStartField,
+ const sal_Int32 nStringIndex, const sal_Int32 nEndField)
+{
+ DBG_ASSERT( nStartField <= nEndField, "bad field range");
+ DBG_ASSERT(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
+ DBG_ASSERT(aTables[nTable].size() >= static_cast<size_t>(nStartField), "wrong field");
+ ScMysalInt32Vec& rTable = aTables[nTable];
+ size_t nSize = rTable.size();
+ if (nSize == static_cast<size_t>(nStartField))
+ rTable.insert( rTable.end(), static_cast<size_t>(nEndField - nStartField + 1), nStringIndex);
+ else
+ {
+ size_t nField = static_cast<size_t>(nStartField);
+ for ( ; nField < nSize && nField <= static_cast<size_t>(nEndField); ++nField)
+ rTable[nField] = nStringIndex;
+ if (nField <= static_cast<size_t>(nEndField))
+ rTable.insert( rTable.end(), static_cast<size_t>(nEndField - nField + 1), nStringIndex);
+ }
}
rtl::OUString* ScRowStyles::GetStyleName(const sal_Int32 nTable, const sal_Int32 nField)
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index 34672aeef96e..79b19b7ce9ab 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -286,6 +286,7 @@ public:
virtual void AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields);
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField);
void AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nField, const sal_Int32 nStringIndex);
+ void AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nStartField, const sal_Int32 nStringIndex, const sal_Int32 nEndField);
virtual rtl::OUString* GetStyleName(const sal_Int32 nTable, const sal_Int32 nField);
};
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 8e78f64b2090..ae5a7bcebe66 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -487,21 +487,31 @@ void ScXMLTableRowCellContext::DoMerge(const com::sun::star::table::CellAddress&
uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
if ( xCellRange.is() )
{
- table::CellRangeAddress aCellAddress;
- if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
+ // Stored merge range may actually be of a larger extend than what
+ // we support, in which case getCellRangeByPosition() throws
+ // IndexOutOfBoundsException. Do nothing then.
+ try
{
- //unmerge
+ table::CellRangeAddress aCellAddress;
+ if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
+ {
+ //unmerge
+ uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
+ aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY);
+ if (xMergeable.is())
+ xMergeable->merge(sal_False);
+ }
+
+ //merge
uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
- aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY);
+ aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY);
if (xMergeable.is())
- xMergeable->merge(sal_False);
+ xMergeable->merge(sal_True);
+ }
+ catch ( lang::IndexOutOfBoundsException & )
+ {
+ DBG_ERRORFILE("ScXMLTableRowCellContext::DoMerge: range to be merged larger than what we support");
}
-
- //merge
- uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
- aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY);
- if (xMergeable.is())
- xMergeable->merge(sal_True);
}
}
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index a913cb7ac861..ca5403e3b18d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2576,14 +2576,13 @@ void ScXMLExport::_ExportAutoStyles()
}
sal_Int32 nOld(nRow);
nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<SCROW>(nRow), false);
- for (sal_Int32 i = nOld + 1; i < nRow; ++i)
- pRowStyles->AddFieldStyleName(nTable, i, nIndex);
+ if (nRow > nOld + 1)
+ pRowStyles->AddFieldStyleName(nTable, nOld + 1, nIndex, nRow - 1);
}
if (aCellAddress.EndRow > nRows)
{
sal_Int32 nIndex(pRowStyles->GetStyleNameIndex(nTable, nRows));
- for (sal_Int32 i = nRows + 1; i <= aCellAddress.EndRow; ++i)
- pRowStyles->AddFieldStyleName(nTable, i, nIndex);
+ pRowStyles->AddFieldStyleName(nTable, nRows + 1, nIndex, aCellAddress.EndRow);
}
}
}
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index 4127f5246428..d061ea24b194 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -81,9 +81,11 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
- MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ),
+ MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ), // #i102690# for old files
+ MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ),
MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
- MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ),
+ MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ), // #i102690# for old files
+ MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ),
MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
@@ -490,6 +492,18 @@ void ScXMLCellExportPropertyMapper::ContextFilter(
pParaMarginBottomRel->maValue.clear();
}
+ // #i102690# old diagonal line attribute names without "s" are only read, not written
+ if (pDiagonalTLBRWidthState)
+ {
+ pDiagonalTLBRWidthState->mnIndex = -1;
+ pDiagonalTLBRWidthState->maValue.clear();
+ }
+ if (pDiagonalBLTRWidthState)
+ {
+ pDiagonalBLTRWidthState->mnIndex = -1;
+ pDiagonalBLTRWidthState->maValue.clear();
+ }
+
SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
}
diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx
index 07e7138afc71..f8abf5e6443d 100644
--- a/sc/source/filter/xml/xmlstyle.hxx
+++ b/sc/source/filter/xml/xmlstyle.hxx
@@ -90,6 +90,8 @@ extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[];
#define CTF_SC_DIAGONALTLBRWIDTH (XML_SC_CTF_START + 26)
#define CTF_SC_DIAGONALBLTR (XML_SC_CTF_START + 27)
#define CTF_SC_DIAGONALBLTRWIDTH (XML_SC_CTF_START + 28)
+#define CTF_SC_DIAGONALTLBRWIDTHS (XML_SC_CTF_START + 29)
+#define CTF_SC_DIAGONALBLTRWIDTHS (XML_SC_CTF_START + 30)
#define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50)
#define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51)
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 9a04e284bf45..3866bba63239 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -105,6 +105,7 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
XMLPropertyState* pAllBorderWidthProperty = NULL;
XMLPropertyState* pBorderWidths[4] = { NULL, NULL, NULL, NULL };
XMLPropertyState* pDiagBorders[2] = { 0 };
+ XMLPropertyState* pOldDiagBorderWidths[2] = { 0 }; // old attribute names without "s"
XMLPropertyState* pDiagBorderWidths[2] = { 0 };
::std::vector< XMLPropertyState >::iterator endproperty(rProperties.end());
@@ -134,8 +135,10 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
case CTF_SC_BOTTOMBORDERWIDTH : pBorderWidths[XML_LINE_BOTTOM] = &*property; break;
case CTF_SC_DIAGONALTLBR : pDiagBorders[XML_LINE_TLBR] = &*property; break;
case CTF_SC_DIAGONALBLTR : pDiagBorders[XML_LINE_BLTR] = &*property; break;
- case CTF_SC_DIAGONALTLBRWIDTH : pDiagBorderWidths[XML_LINE_TLBR] = &*property; break;
- case CTF_SC_DIAGONALBLTRWIDTH : pDiagBorderWidths[XML_LINE_BLTR] = &*property; break;
+ case CTF_SC_DIAGONALTLBRWIDTH : pOldDiagBorderWidths[XML_LINE_TLBR] = &*property; break;
+ case CTF_SC_DIAGONALTLBRWIDTHS : pDiagBorderWidths[XML_LINE_TLBR] = &*property; break;
+ case CTF_SC_DIAGONALBLTRWIDTH : pOldDiagBorderWidths[XML_LINE_BLTR] = &*property; break;
+ case CTF_SC_DIAGONALBLTRWIDTHS : pDiagBorderWidths[XML_LINE_BLTR] = &*property; break;
}
}
}
@@ -179,17 +182,23 @@ void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
}
for( i = 0; i < 2; ++i )
{
- if( pDiagBorders[i] && pDiagBorderWidths[i] )
+ if( pDiagBorders[i] && ( pDiagBorderWidths[i] || pOldDiagBorderWidths[i] ) )
{
table::BorderLine aBorderLine;
pDiagBorders[i]->maValue >>= aBorderLine;
table::BorderLine aBorderLineWidth;
- pDiagBorderWidths[i]->maValue >>= aBorderLineWidth;
+ if (pDiagBorderWidths[i])
+ pDiagBorderWidths[i]->maValue >>= aBorderLineWidth; // prefer new attribute
+ else
+ pOldDiagBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
pDiagBorders[i]->maValue <<= aBorderLine;
- pDiagBorderWidths[i]->mnIndex = -1;
+ if (pDiagBorderWidths[i])
+ pDiagBorderWidths[i]->mnIndex = -1;
+ if (pOldDiagBorderWidths[i])
+ pOldDiagBorderWidths[i]->mnIndex = -1; // reset mnIndex for old and new attribute if both are present
}
}
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 6e7cfed9d95c..82c276d98f2c 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -33,12 +33,16 @@
#include "dpcontrol.hxx"
#include "dpcontrol.hrc"
-#include "vcl/outdev.hxx"
-#include "vcl/settings.hxx"
-#include "vcl/wintypes.hxx"
-#include "vcl/decoview.hxx"
+#include <vcl/outdev.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/wintypes.hxx>
+#include <vcl/decoview.hxx>
#include "strload.hxx"
#include "global.hxx"
+#include "scitems.hxx"
+#include "document.hxx"
+#include "docpool.hxx"
+#include "patattr.hxx"
#include "AccessibleFilterMenu.hxx"
#include "AccessibleFilterTopWindow.hxx"
@@ -55,7 +59,8 @@ using ::std::vector;
using ::std::hash_map;
using ::std::auto_ptr;
-ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX, const Fraction* pZoomY) :
+ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX, const Fraction* pZoomY, ScDocument* pDoc) :
+ mpDoc(pDoc),
mpOutDev(pOutDev),
mpStyle(pStyle),
mbBaseButton(true),
@@ -135,17 +140,28 @@ void ScDPFieldButton::draw()
Point(maPos.X()+maSize.Width()-1, maPos.Y()+maSize.Height()-1));
// Field name.
- Font aTextFont( mpStyle->GetLabelFont() );
- double fFontHeight = 12.0;
- fFontHeight *= static_cast<double>(maZoomY.GetNumerator()) / static_cast<double>(maZoomY.GetDenominator());
- aTextFont.SetHeight(static_cast<long>(fFontHeight));
+ // Get the font and size the same way as in scenario selection (lcl_DrawOneFrame in gridwin4.cxx)
+ Font aTextFont( mpStyle->GetAppFont() );
+ if ( mpDoc )
+ {
+ // use ScPatternAttr::GetFont only for font size
+ Font aAttrFont;
+ static_cast<const ScPatternAttr&>(mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).
+ GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY );
+ aTextFont.SetSize( aAttrFont.GetSize() );
+ }
mpOutDev->SetFont(aTextFont);
+ mpOutDev->SetTextColor(mpStyle->GetButtonTextColor());
Point aTextPos = maPos;
- long nTHeight = static_cast<long>(fFontHeight);
+ long nTHeight = mpOutDev->GetTextHeight();
aTextPos.setX(maPos.getX() + nMargin);
aTextPos.setY(maPos.getY() + (maSize.Height()-nTHeight)/2);
+
+ mpOutDev->Push(PUSH_CLIPREGION);
+ mpOutDev->IntersectClipRegion(aRect);
mpOutDev->DrawText(aTextPos, maText);
+ mpOutDev->Pop();
}
if (mbPopupButton)
@@ -959,7 +975,7 @@ ScDPFieldPopupWindow::ScDPFieldPopupWindow(Window* pParent, ScDocument* pDoc) :
mnCurTabStop(0),
mpExtendedData(NULL),
mpOKAction(NULL),
- maWndSize(160, 330),
+ maWndSize(240, 330),
mePrevToggleAllState(STATE_DONTKNOW)
{
maTabStopCtrls.reserve(7);
@@ -1032,7 +1048,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy
const sal_uInt16 nMenuHeight = 60;
const sal_uInt16 nSingleItemBtnAreaHeight = 32; // height of the middle area below the list box where the single-action buttons are.
const sal_uInt16 nBottomBtnAreaHeight = 50; // height of the bottom area where the OK and Cancel buttons are.
- const sal_uInt16 nBtnWidth = 60;
+ const sal_uInt16 nBtnWidth = 90;
const sal_uInt16 nLabelHeight = static_cast< sal_uInt16 >( getLabelFont().GetHeight() );
const sal_uInt16 nBtnHeight = nLabelHeight*2;
const sal_uInt16 nBottomMargin = 10;
@@ -1089,7 +1105,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy
{
long h = 26;
rPos = Point(nListBoxMargin, nSingleBtnAreaY);
- rPos.X() += 75;
+ rPos.X() += 150;
rPos.Y() += (nSingleItemBtnAreaHeight - h)/2;
rSize = Size(h, h);
}
@@ -1098,7 +1114,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy
{
long h = 26;
rPos = Point(nListBoxMargin, nSingleBtnAreaY);
- rPos.X() += 75 + h + 10;
+ rPos.X() += 150 + h + 10;
rPos.Y() += (nSingleItemBtnAreaHeight - h)/2;
rSize = Size(h, h);
}
diff --git a/sc/source/ui/dbgui/textimportoptions.src b/sc/source/ui/dbgui/textimportoptions.src
index fff3c4b40749..69e2d69b3142 100644
--- a/sc/source/ui/dbgui/textimportoptions.src
+++ b/sc/source/ui/dbgui/textimportoptions.src
@@ -33,34 +33,34 @@
ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
{
Text [ en-US ] = "Import Options" ;
- Size = MAP_APPFONT ( 190 , 101 ) ;
+ Size = MAP_APPFONT ( 230 , 101 ) ;
Moveable = TRUE ;
Closeable = TRUE ;
OutputSize = TRUE ;
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 135, 6 ) ;
+ Pos = MAP_APPFONT ( 175, 6 ) ;
Size = MAP_APPFONT ( 50, 14 ) ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 135, 23 ) ;
+ Pos = MAP_APPFONT ( 175, 23 ) ;
Size = MAP_APPFONT ( 50, 14 ) ;
};
HelpButton BTN_HELP
{
- Pos = MAP_APPFONT ( 135, 43 ) ;
+ Pos = MAP_APPFONT ( 175, 43 ) ;
Size = MAP_APPFONT ( 50, 14 ) ;
};
FixedLine FL_CHOOSE_LANG
{
Pos = MAP_APPFONT( 6, 3 ) ;
- Size = MAP_APPFONT( 125, 14 ) ;
+ Size = MAP_APPFONT( 165, 14 ) ;
Text [ en-US ] = "Select the language to use for import" ;
};
@@ -68,7 +68,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
RadioButton RB_AUTOMATIC
{
Pos = MAP_APPFONT( 12, 20 ) ;
- Size = MAP_APPFONT( 50, 10 ) ;
+ Size = MAP_APPFONT( 159, 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Automatic" ;
@@ -77,7 +77,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
RadioButton RB_CUSTOM
{
Pos = MAP_APPFONT( 12, 34 ) ;
- Size = MAP_APPFONT( 50, 10 ) ;
+ Size = MAP_APPFONT( 159, 10 ) ;
TabStop = TRUE ;
Text [ en-US ] = "Custom" ;
@@ -86,7 +86,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
ListBox LB_CUSTOM_LANG
{
Pos = MAP_APPFONT( 20, 50 ) ;
- Size = MAP_APPFONT( 100, 55 ) ;
+ Size = MAP_APPFONT( 140, 120 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
Sort = TRUE ;
@@ -94,19 +94,17 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
FixedLine FL_OPTION
{
- Pos = MAP_APPFONT( 6, 70 );
- Size = MAP_APPFONT( 125, 14 );
-
- Text [ en-US ] = "Options" ;
+ Pos = MAP_APPFONT( 6, 70 );
+ Size = MAP_APPFONT( 165, 14 );
+ Text [ en-US ] = "Options" ;
};
CheckBox BTN_CONVERT_DATE
{
Pos = MAP_APPFONT( 12, 86 );
- Size = MAP_APPFONT( 125, 10 );
- TabStop = TRUE ;
-
- Text [ en-US ] = "Detect special numbers (such as dates)." ;
+ Size = MAP_APPFONT( 159, 10 );
+ TabStop = TRUE ;
+ Text [ en-US ] = "Detect special numbers (such as dates)." ;
};
};
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 0569e95605b1..7fa31246275a 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2024,7 +2024,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
if (!isFileLoadable(aFile))
return NULL;
- String aOptions;
+ String aOptions( pFileData->maFilterOptions );
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter);
@@ -2040,9 +2040,6 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
setRelativeFileName(nFileId, aStr);
}
- // Update the filter data now that we are loading it again.
- setFilterData(nFileId, rFilter, aOptions);
-
SfxItemSet* pSet = new SfxAllItemSet(SFX_APP()->GetPool());
if (aOptions.Len())
pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions));
@@ -2077,6 +2074,13 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
pNewShell->DoLoad(pMedium.release());
+
+ // with UseInteractionHandler, options may be set by dialog during DoLoad
+ String aNew = ScDocumentLoader::GetOptions(*pNewShell->GetMedium());
+ if (aNew.Len() && aNew != aOptions)
+ aOptions = aNew;
+ setFilterData(nFileId, rFilter, aOptions); // update the filter data, including the new options
+
return aRef;
}
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index bfbeba2d1302..a5159d8a8043 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -486,11 +486,16 @@ void __EXPORT ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
rSet.GetItemState( SID_THESAURUS ) != SFX_ITEM_UNKNOWN )
{
SdrView * pView = pViewData->GetScDrawView();
- EditView & rEditView = pView->GetTextEditOutlinerView()->GetEditView();
+ OutlinerView* pOutView = pView->GetTextEditOutlinerView();
String aStatusVal;
LanguageType nLang = LANGUAGE_NONE;
- bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
+ bool bIsLookUpWord = false;
+ if ( pOutView )
+ {
+ EditView& rEditView = pOutView->GetEditView();
+ bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
+ }
rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
// disable thesaurus main menu and context menu entry if there is nothing to look up
diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx
index 15f0c9174cc8..45badf0c88fd 100644
--- a/sc/source/ui/inc/dpcontrol.hxx
+++ b/sc/source/ui/inc/dpcontrol.hxx
@@ -64,7 +64,8 @@ class ScAccessibleFilterMenu;
class ScDPFieldButton
{
public:
- ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX = NULL, const Fraction* pZoomY = NULL);
+ ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX = NULL, const Fraction* pZoomY = NULL,
+ ScDocument* pDoc = NULL);
~ScDPFieldButton();
void setText(const ::rtl::OUString& rText);
@@ -86,6 +87,7 @@ private:
::rtl::OUString maText;
Fraction maZoomX;
Fraction maZoomY;
+ ScDocument* mpDoc;
OutputDevice* mpOutDev;
const StyleSettings* mpStyle;
bool mbBaseButton;
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index becd05165a4e..00b1658849d6 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -185,5 +185,4 @@
// Tab Bg Color
#define TAB_BG_COLOR_CT_BORDER 1
#define TAB_BG_COLOR_SET_BGDCOLOR 2
-#define TAB_BG_COLOR_GB_BGDCOLOR 3
diff --git a/sc/source/ui/inc/tabbgcolordlg.hxx b/sc/source/ui/inc/tabbgcolordlg.hxx
index 241fc806022d..338609ae0e4d 100644
--- a/sc/source/ui/inc/tabbgcolordlg.hxx
+++ b/sc/source/ui/inc/tabbgcolordlg.hxx
@@ -32,7 +32,6 @@
#define SC_TABBGCOLORDLG_HXX
#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/imagebtn.hxx>
#include <svtools/valueset.hxx>
@@ -63,7 +62,6 @@ private:
Control aBorderWin;
ScTabBgColorValueSet aTabBgColorSet;
- FixedLine aTabBgColorBox;
OKButton aBtnOk;
CancelButton aBtnCancel;
HelpButton aBtnHelp;
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 106d196a8175..fb9c674a4488 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -482,6 +482,24 @@ public:
BOOL IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
static inline long ToPixel( USHORT nTwips, double nFactor );
+
+ /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
+ heights converted with nPPTY to rScrY, optimized for row height
+ segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
+ may be > nEndPixels!
+ */
+ static void AddPixelsWhile( long & rScrY, long nEndPixels,
+ SCROW & rPosY, SCROW nEndRow, double nPPTY,
+ const ScDocument * pDoc, SCTAB nTabNo );
+
+ /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
+ heights converted with nPPTY to rScrY, optimized for row height
+ segments. Upon return rPosY is the last row evaluated >= nStartRow,
+ rScrY may be > nEndPixels!
+ */
+ static void AddPixelsWhileBackward( long & rScrY, long nEndPixels,
+ SCROW & rPosY, SCROW nStartRow, double nPPTY,
+ const ScDocument * pDoc, SCTAB nTabNo );
};
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index fdc4c9fd34bf..463c06d76712 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -39,14 +39,15 @@
#include "scresid.hxx"
#include "miscdlgs.hrc"
-#include "tools/debug.hxx"
-#include "tools/color.hxx"
-#include "sfx2/objsh.hxx"
-#include "svx/xtable.hxx"
-#include "svx/drawitem.hxx"
-#include "unotools/pathoptions.hxx"
-#include "tools/resid.hxx"
-#include "editeng/editrids.hrc"
+#include <tools/debug.hxx>
+#include <tools/color.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/xtable.hxx>
+#include <svx/drawitem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <tools/resid.hxx>
+#include <editeng/editrids.hrc>
+#include <editeng/eerdll.hxx>
#include <boost/scoped_ptr.hpp>
@@ -62,7 +63,6 @@ ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent,
ModalDialog ( pParent, ScResId( RID_SCDLG_TAB_BG_COLOR ) ),
aBorderWin ( this, ScResId( TAB_BG_COLOR_CT_BORDER ) ),
aTabBgColorSet ( &aBorderWin, ScResId( TAB_BG_COLOR_SET_BGDCOLOR ), this ),
- aTabBgColorBox ( this, ScResId( TAB_BG_COLOR_GB_BGDCOLOR ) ),
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
aBtnHelp ( this, ScResId( BTN_HELP ) ),
@@ -75,7 +75,6 @@ ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent,
this->SetText( rTitle );
this->SetStyle(GetStyle() | WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL | WB_SYSTEMWINDOW | WB_STANDALONE | WB_HIDE);
- aTabBgColorBox.SetText(rTitle);
FillColorValueSets_Impl();
aTabBgColorSet.SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) );
aBtnOk.SetClickHdl( HDL(TabBgColorOKHdl_Impl) );
@@ -120,7 +119,7 @@ void ScTabBgColorDlg::FillColorValueSets_Impl()
long nCount = pColorTable->Count();
XColorEntry* pEntry = NULL;
Color aColWhite( COL_WHITE );
- String aStrWhite( ScResId( RID_SVXITEMS_COLOR_WHITE ) );
+ String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) );
WinBits nBits = ( aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS);
aTabBgColorSet.SetText( aTabBgColorNoColorText );
aTabBgColorSet.SetStyle( nBits );
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index ea7cabf7716d..4c64e312bc2d 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -152,13 +152,13 @@ TabPage RID_SCPAGE_CALC
CheckBox BTN_GENERAL_PREC
{
Pos = MAP_APPFONT ( 12 , 147 ) ;
- Size = MAP_APPFONT ( 136 , 10 ) ;
+ Size = MAP_APPFONT ( 148 , 10 ) ;
Text [ en-US ] = "Limit decimals for general number format" ;
};
FixedText FT_PREC
{
- Pos = MAP_APPFONT ( 150 , 148 ) ;
- Size = MAP_APPFONT ( 72 , 8 ) ;
+ Pos = MAP_APPFONT ( 138 , 148 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
Text [ en-US ] = "~Decimal places" ;
Right = TRUE ;
};
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index c284045c5b11..3fb2c74a9954 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -592,7 +592,7 @@ ScUndoDeleteMulti::ScUndoDeleteMulti( ScDocShell* pNewDocShell,
__EXPORT ScUndoDeleteMulti::~ScUndoDeleteMulti()
{
- delete pRanges;
+ delete [] pRanges;
}
String __EXPORT ScUndoDeleteMulti::GetComment() const
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 75e415b8f018..a680185a1d1c 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -193,11 +193,14 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
if (pPrinter)
{
String aString(sPrinterName);
- SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString );
- if (pNewPrinter->IsKnown())
- pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
- else
- delete pNewPrinter;
+ if (pPrinter->GetName() != aString)
+ {
+ SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString );
+ if (pNewPrinter->IsKnown())
+ pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
+ else
+ delete pNewPrinter;
+ }
}
else
throw uno::RuntimeException();
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index f8b5c25c4a70..a64814d952ef 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -144,7 +144,7 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent&
Size aScrSize(nSizeX-1, nSizeY-1);
// Check if the mouse cursor is clicking on the popup arrow box.
- mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY()));
+ mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc));
mpFilterButton->setBoundingBox(aScrPos, aScrSize);
Point aPopupPos;
Size aPopupSize;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index d8024e439173..ba73fbf00269 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -401,17 +401,13 @@ void __EXPORT ScGridWindow::Paint( const Rectangle& rRect )
nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
}
- long nScrY = ScViewData::ToPixel( pDoc->GetRowHeight( nY1, nTab ), nPPTY );
- while ( nScrY <= aPixRect.Top() && nY1 < MAXROW )
- {
- ++nY1;
- nScrY += ScViewData::ToPixel( pDoc->GetRowHeight( nY1, nTab ), nPPTY );
- }
+ long nScrY = 0;
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab);
SCROW nY2 = nY1;
- while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
+ if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW)
{
++nY2;
- nScrY += ScViewData::ToPixel( pDoc->GetRowHeight( nY2, nTab ), nPPTY );
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
}
Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen
@@ -750,6 +746,15 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( !bLogicText )
aOutputData.DrawStrings(FALSE); // in pixel MapMode
+ // edit cells and printer-metrics text must be before the buttons
+ // (DataPilot buttons contain labels in UI font)
+
+ pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich));
+ if ( bLogicText )
+ aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set
+ aOutputData.DrawEdit(TRUE);
+ pContentDev->SetMapMode(MAP_PIXEL);
+
// Autofilter- und Pivot-Buttons
DrawButtons( nX1, nY1, nX2, nY2, aTabInfo, pContentDev ); // Pixel
@@ -759,14 +764,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( rOpts.GetOption( VOPT_NOTES ) )
aOutputData.DrawNoteMarks();
- // Edit-Zellen
-
- pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich));
- if ( bLogicText )
- aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set
- aOutputData.DrawEdit(TRUE);
-
- pContentDev->SetMapMode(MAP_PIXEL);
if ( !bGridFirst && ( bGrid || bPage ) )
{
aOutputData.DrawGrid( bGrid, bPage );
@@ -1208,14 +1205,14 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
{
aComboButton.SetOutputDevice( pContentDev );
- ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY());
+ ScDocument* pDoc = pViewData->GetDocument();
+ ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc);
SCCOL nCol;
SCROW nRow;
SCSIZE nArrY;
SCSIZE nQuery;
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
ScDBData* pDBData = NULL;
ScQueryParam* pQueryParam = NULL;
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 961572fc0185..7b27ddf3f8cc 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -489,6 +489,8 @@ void ScOutputData::DrawGrid( BOOL bGrid, BOOL bPage )
// Horizontale Linien
//
+ bool bHiddenRow = true;
+ SCROW nHiddenEndRow = -1;
nPosY = nScrY;
for (nArrY=1; nArrY+1<nArrCount; nArrY++)
{
@@ -503,9 +505,17 @@ void ScOutputData::DrawGrid( BOOL bGrid, BOOL bPage )
{
for (SCROW i = nYplus1; i <= MAXROW; ++i)
{
+ if (i > nHiddenEndRow)
+ bHiddenRow = pDoc->RowHidden(i, nTab, nHiddenEndRow);
+ /* TODO: optimize the row break thing for large hidden
+ * segments where HasRowBreak() has to be called
+ * nevertheless for each row, as a row break is drawn also
+ * for hidden rows, above them. This needed to be done only
+ * once per hidden segment, maybe giving manual breaks
+ * priority. Something like GetNextRowBreak() and
+ * GetNextManualRowBreak(). */
nBreak = pDoc->HasRowBreak(i, nTab);
- bool bHidden = pDoc->RowHidden(i, nTab);
- if (nBreak || !bHidden)
+ if (!bHiddenRow || nBreak)
break;
}
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index b0b040f9b5e0..6d40d304fb13 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -171,12 +171,11 @@ public:
private:
void SetHashText();
- long GetMaxDigitWidth();
+ long GetMaxDigitWidth(); // in logic units
long GetSignWidth();
long GetDotWidth();
long GetExpWidth();
void TextChanged();
- long ConvertWidthLogicToPixel( long nWidth ) const;
};
//==================================================================
@@ -518,6 +517,10 @@ void ScDrawStringsVars::SetHashText()
void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
{
+ // #i113045# do the single-character width calculations in logic units
+ if (bPixelToLogic)
+ nWidth = pOutput->pRefDevice->PixelToLogic(Size(nWidth,0)).Width();
+
if (!pCell)
return;
@@ -565,6 +568,12 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
else if (c == sal_Unicode('E'))
++nExpCount;
}
+
+ // #i112250# A small value might be formatted as "0" when only counting the digits,
+ // but fit into the column when considering the smaller width of the decimal separator.
+ if (aString.EqualsAscii("0") && fVal != 0.0)
+ nDecimalCount = 1;
+
if (nDecimalCount)
nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
if (nSignCount)
@@ -582,10 +591,6 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
}
long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
-
- if (bPixelToLogic)
- nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth);
-
if (nActualTextWidth > nWidth)
{
// Even after the decimal adjustment the text doesn't fit. Give up.
@@ -594,6 +599,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
}
TextChanged();
+ pLastCell = NULL; // #i113022# equal cell and format in another column may give different string
}
void ScDrawStringsVars::SetAutoText( const String& rAutoText )
@@ -638,9 +644,6 @@ long ScDrawStringsVars::GetMaxDigitWidth()
long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit));
nMaxDigitWidth = ::std::max(nMaxDigitWidth, n);
}
-
- if (bPixelToLogic)
- nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth);
return nMaxDigitWidth;
}
@@ -650,8 +653,6 @@ long ScDrawStringsVars::GetSignWidth()
return nSignWidth;
nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-'));
- if (bPixelToLogic)
- nSignWidth = ConvertWidthLogicToPixel(nSignWidth);
return nSignWidth;
}
@@ -662,8 +663,6 @@ long ScDrawStringsVars::GetDotWidth()
const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
- if (bPixelToLogic)
- nDotWidth = ConvertWidthLogicToPixel(nDotWidth);
return nDotWidth;
}
@@ -673,8 +672,6 @@ long ScDrawStringsVars::GetExpWidth()
return nExpWidth;
nExpWidth = pOutput->pFmtDevice->GetTextWidth(String('E'));
- if (bPixelToLogic)
- nExpWidth = ConvertWidthLogicToPixel(nExpWidth);
return nExpWidth;
}
@@ -704,13 +701,6 @@ void ScDrawStringsVars::TextChanged()
aTextSize = pRefDevice->LogicToPixel( aTextSize );
}
-long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const
-{
- Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight());
- aSize = pOutput->pRefDevice->LogicToPixel(aSize);
- return aSize.Width();
-}
-
BOOL ScDrawStringsVars::HasEditCharacters() const
{
static const sal_Unicode pChars[] =
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c034836d4d4a..7b35328f68bb 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1696,50 +1696,32 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, USHO
if (pView)
((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY);
- SCROW nY;
- USHORT nScrPosY = 0;
-
if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (USHORT) aScrSize.Height();
- if (nDir==1)
- nY = nPosY; // vorwaerts
- else
- nY = nPosY-1; // rueckwaerts
-
- BOOL bOut = FALSE;
- for ( ; nScrPosY<=nScrSizeY && !bOut; nY+=nDir )
- {
- SCsROW nRowNo = nY;
- if ( nRowNo < 0 || nRowNo > MAXROW )
- bOut = TRUE;
- else
- {
- USHORT nTSize = pDoc->GetRowHeight( nRowNo, nTabNo );
- if (nTSize)
- {
- long nSizeYPix = ToPixel( nTSize, nPPTY );
- nScrPosY = sal::static_int_cast<USHORT>( nScrPosY + (USHORT) nSizeYPix );
- }
- else if ( nDir == 1 && nRowNo < MAXROW )
- {
- // skip multiple hidden rows (forward only for now)
- SCROW nNext = pDoc->FirstVisibleRow(nRowNo + 1, MAXROW, nTabNo);
- if ( nNext > MAXROW )
- {
- // same behavior as without the optimization: set bOut with nY=MAXROW+1
- nY = MAXROW+1;
- bOut = TRUE;
- }
- else
- nY = nNext - 1; // +=nDir advances to next visible row
- }
- }
- }
+ SCROW nY;
if (nDir==1)
+ {
+ // forward
+ nY = nPosY;
+ long nScrPosY = 0;
+ AddPixelsWhile( nScrPosY, nScrSizeY, nY, MAXROW, nPPTY, pDoc, nTabNo);
+ // Original loop ended on last evaluated +1 or if that was MAXROW even
+ // on MAXROW+2.
+ nY += (nY == MAXROW ? 2 : 1);
nY -= nPosY;
+ }
else
+ {
+ // backward
+ nY = nPosY-1;
+ long nScrPosY = 0;
+ AddPixelsWhileBackward( nScrPosY, nScrSizeY, nY, 0, nPPTY, pDoc, nTabNo);
+ // Original loop ended on last evaluated -1 or if that was 0 even on
+ // -2.
+ nY -= (nY == 0 ? 2 : 1);
nY = (nPosY-1)-nY;
+ }
if (nY>0) --nY;
return nY;
@@ -1855,16 +1837,10 @@ BOOL ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
}
if (nClickY > 0)
- {
- while ( rPosY<=MAXROW && nClickY >= nScrY )
- {
- nScrY += ToPixel( pDoc->GetRowHeight( rPosY, nTabNo ), nPPTY );
- ++rPosY;
- }
- --rPosY;
- }
+ AddPixelsWhile( nScrY, nClickY, rPosY, MAXROW, nPPTY, pDoc, nTabNo );
else
{
+ /* TODO: could need some "SubPixelsWhileBackward" method */
while ( rPosY>0 && nClickY < nScrY )
{
--rPosY;
@@ -1984,20 +1960,24 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
SCROW nOldPosY = pThisTab->nPosY[eWhich];
long nTPosY = pThisTab->nTPosY[eWhich];
long nPixPosY = pThisTab->nPixPosY[eWhich];
- SCROW i;
+ SCROW i, nHeightEndRow;
if ( nNewPosY > nOldPosY )
for ( i=nOldPosY; i<nNewPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i,nTabNo );
- nTPosY -= nThis;
- nPixPosY -= ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY);
+ long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
+ SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) - i;
+ i = nHeightEndRow;
+ nTPosY -= nThis * nRows;
+ nPixPosY -= ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY) * nRows;
}
else
for ( i=nNewPosY; i<nOldPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i,nTabNo );
- nTPosY += nThis;
- nPixPosY += ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY);
+ long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
+ SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) - i;
+ i = nHeightEndRow;
+ nTPosY += nThis * nRows;
+ nPixPosY += ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY) * nRows;
}
pThisTab->nPosY[eWhich] = nNewPosY;
@@ -3118,5 +3098,82 @@ ScAddress ScViewData::GetCurPos() const
}
+// static
+void ScViewData::AddPixelsWhile( long & rScrY, long nEndPixels, SCROW & rPosY,
+ SCROW nEndRow, double nPPTY, const ScDocument * pDoc, SCTAB nTabNo )
+{
+ SCROW nRow = rPosY;
+ while (rScrY <= nEndPixels && nRow <= nEndRow)
+ {
+ SCROW nHeightEndRow;
+ USHORT nHeight = pDoc->GetRowHeight( nRow, nTabNo, NULL, &nHeightEndRow);
+ if (nHeightEndRow > nEndRow)
+ nHeightEndRow = nEndRow;
+ if (!nHeight)
+ nRow = nHeightEndRow + 1;
+ else
+ {
+ SCROW nRows = nHeightEndRow - nRow + 1;
+ sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
+ sal_Int64 nAdd = nPixel * nRows;
+ if (nAdd + rScrY > nEndPixels)
+ {
+ sal_Int64 nDiff = rScrY + nAdd - nEndPixels;
+ nRows -= static_cast<SCROW>(nDiff / nPixel);
+ nAdd = nPixel * nRows;
+ // We're looking for a value that satisfies loop condition.
+ if (nAdd + rScrY <= nEndPixels)
+ {
+ ++nRows;
+ nAdd += nPixel;
+ }
+ }
+ rScrY += static_cast<long>(nAdd);
+ nRow += nRows;
+ }
+ }
+ if (nRow > rPosY)
+ --nRow;
+ rPosY = nRow;
+}
+// static
+void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
+ SCROW & rPosY, SCROW nStartRow, double nPPTY, const ScDocument * pDoc,
+ SCTAB nTabNo )
+{
+ SCROW nRow = rPosY;
+ while (rScrY <= nEndPixels && nRow >= nStartRow)
+ {
+ SCROW nHeightStartRow;
+ USHORT nHeight = pDoc->GetRowHeight( nRow, nTabNo, &nHeightStartRow, NULL);
+ if (nHeightStartRow < nStartRow)
+ nHeightStartRow = nStartRow;
+ if (!nHeight)
+ nRow = nHeightStartRow - 1;
+ else
+ {
+ SCROW nRows = nRow - nHeightStartRow + 1;
+ sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
+ sal_Int64 nAdd = nPixel * nRows;
+ if (nAdd + rScrY > nEndPixels)
+ {
+ sal_Int64 nDiff = nAdd + rScrY - nEndPixels;
+ nRows -= static_cast<SCROW>(nDiff / nPixel);
+ nAdd = nPixel * nRows;
+ // We're looking for a value that satisfies loop condition.
+ if (nAdd + rScrY <= nEndPixels)
+ {
+ ++nRows;
+ nAdd += nPixel;
+ }
+ }
+ rScrY += static_cast<long>(nAdd);
+ nRow -= nRows;
+ }
+ }
+ if (nRow < rPosY)
+ ++nRow;
+ rPosY = nRow;
+}
diff --git a/sc/uiconfig/scalc/toolbar/findbar.xml b/sc/uiconfig/scalc/toolbar/findbar.xml
index 9ef9d8a1a78f..0338d3156195 100644
--- a/sc/uiconfig/scalc/toolbar/findbar.xml
+++ b/sc/uiconfig/scalc/toolbar/findbar.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
- <toolbar:toolbaritem xlink:href=".uno:FindText" toolbar:helpid="helpid:100105" />
- <toolbar:toolbaritem xlink:href=".uno:DownSearch" toolbar:helpid="helpid:100105" />
- <toolbar:toolbaritem xlink:href=".uno:UpSearch" toolbar:helpid="helpid:100105" />
- <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:text="Find &amp; Replace" toolbar:visible="false" toolbar:helpid="helpid:100105"/>
+ <toolbar:toolbaritem xlink:href=".uno:FindText"/>
+ <toolbar:toolbaritem xlink:href=".uno:DownSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:UpSearch"/>
+ <toolbar:toolbaritem xlink:href=".uno:SearchDialog" toolbar:visible="false"/>
</toolbar:toolbar>