summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-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/core/data/validat.cxx5
-rw-r--r--sc/source/core/tool/chartpos.cxx24
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rwxr-xr-xsc/source/core/tool/interpr4.cxx8
-rw-r--r--sc/source/filter/excel/xechart.cxx201
-rw-r--r--[-rwxr-xr-x]sc/source/filter/excel/xichart.cxx143
-rwxr-xr-xsc/source/filter/excel/xlchart.cxx21
-rw-r--r--sc/source/filter/excel/xlroot.cxx6
-rw-r--r--sc/source/filter/inc/xechart.hxx17
-rw-r--r--sc/source/filter/inc/xichart.hxx5
-rwxr-xr-xsc/source/filter/inc/xlchart.hxx35
-rw-r--r--sc/source/filter/inc/xlroot.hxx2
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx17
-rw-r--r--sc/source/ui/app/scmod.cxx11
-rw-r--r--sc/source/ui/docshell/docfunc.cxx9
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx15
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx7
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sc/source/ui/inc/docsh.hxx5
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/undobase.hxx5
-rw-r--r--sc/source/ui/undo/undobase.cxx16
-rw-r--r--sc/source/ui/undo/undoblk.cxx5
-rw-r--r--sc/source/ui/undo/undoblk2.cxx20
-rw-r--r--sc/source/ui/undo/undoblk3.cxx29
-rw-r--r--sc/source/ui/undo/undotab.cxx5
-rw-r--r--sc/source/ui/undo/undoutil.cxx5
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx5
-rw-r--r--sc/source/ui/view/auditsh.cxx2
-rw-r--r--sc/source/ui/view/dbfunc.cxx5
-rw-r--r--[-rwxr-xr-x]sc/source/ui/view/dbfunc3.cxx2
-rw-r--r--sc/source/ui/view/drawview.cxx2
-rw-r--r--sc/source/ui/view/editsh.cxx2
-rw-r--r--sc/source/ui/view/formatsh.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/pgbrksh.cxx2
-rw-r--r--sc/source/ui/view/pivotsh.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx4
-rw-r--r--sc/source/ui/view/tabvwsha.cxx87
-rw-r--r--sc/source/ui/view/tabvwshb.cxx95
-rw-r--r--sc/source/ui/view/tabvwshe.cxx4
-rw-r--r--sc/source/ui/view/tabvwshf.cxx2
-rw-r--r--sc/source/ui/view/viewfun3.cxx4
54 files changed, 808 insertions, 298 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 8fe7425bf759..a840572b97dd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -919,13 +919,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;
SC_DLLPUBLIC 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 3711b1b68603..e77056b9446a 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 151478324ef7..439c8d9635a5 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -742,18 +742,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))
{
@@ -761,11 +771,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))
{
@@ -773,12 +782,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++)
@@ -791,7 +800,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++)
@@ -806,9 +815,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..9eaaf6c070e7 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/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 2239b1d0f773..a68867f29e01 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -288,8 +288,6 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput,
BOOL bDone = FALSE;
BOOL bRet = FALSE; // Standard: kein Abbruch
- SfxApplication* pSfxApp = SFX_APP();
- pSfxApp->EnterBasicCall(); // Dok-Basic anlegen etc.
// Wenn das Dok waehrend eines Basic-Calls geladen wurde,
// ist das Sbx-Objekt evtl. nicht angelegt (?)
@@ -368,7 +366,7 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput,
if ( pCell )
pDocument->LockTable( rPos.Tab() );
SbxVariableRef refRes = new SbxVariable;
- ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, NULL, refPar, refRes );
+ ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes );
if ( pCell )
pDocument->UnlockTable( rPos.Tab() );
@@ -380,7 +378,6 @@ BOOL ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput,
bRet = TRUE;
bDone = TRUE;
}
- pSfxApp->LeaveBasicCall();
if ( !bDone && !pCell ) // Makro nicht gefunden (nur bei Eingabe)
{
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index 58ee1b06f7f7..53c3ae266f89 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -36,6 +36,22 @@
#include "document.hxx"
#include "rechead.hxx"
+namespace
+{
+ bool lcl_hasValueDataButNoDates( ScDocument* pDocument, SCCOL nCol, SCROW nRow, SCTAB nTab )
+ {
+ bool bReturn = false;
+ if (pDocument->HasValueData( nCol, nRow, nTab ))
+ {
+ //treat dates like text #i25706#
+ sal_uInt32 nNumberFormat = pDocument->GetNumberFormat( ScAddress( nCol, nRow, nTab ) );
+ short nType = pDocument->GetFormatTable()->GetType(nNumberFormat);
+ bool bIsDate = (nType & NUMBERFORMAT_DATE);
+ bReturn = !bIsDate;
+ }
+ return bReturn;
+ }
+}
ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartColP, SCROW nStartRowP, SCCOL nEndColP, SCROW nEndRowP) :
@@ -290,12 +306,12 @@ void ScChartPositioner::CheckColRowHeaders()
{
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
}
@@ -315,7 +331,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nCol1 <= nCol2 )
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (pDocument->HasValueData( nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
bRowStrings = FALSE;
}
}
@@ -324,7 +340,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nRow1 <= nRow2 )
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (pDocument->HasValueData( iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
bColStrings = FALSE;
}
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 828c9ae64c7d..1015e94180f3 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2925,7 +2925,6 @@ BOOL ScCompiler::IsMacro( const String& rName )
SfxObjectShell* pDocSh = pDoc->GetDocumentShell();
SfxApplication* pSfxApp = SFX_APP();
- pSfxApp->EnterBasicCall(); // initialize document's BASIC
if( pDocSh )//XXX
pObj = pDocSh->GetBasic();
@@ -2942,7 +2941,6 @@ BOOL ScCompiler::IsMacro( const String& rName )
SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD );
if( !pMeth )
{
- pSfxApp->LeaveBasicCall();
return FALSE;
}
// It really should be a BASIC function!
@@ -2950,14 +2948,12 @@ BOOL ScCompiler::IsMacro( const String& rName )
|| ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY )
|| !pMeth->ISA(SbMethod) )
{
- pSfxApp->LeaveBasicCall();
return FALSE;
}
ScRawToken aToken;
aToken.SetExternal( aName.GetBuffer() );
aToken.eOp = ocMacro;
pRawToken = aToken.Clone();
- pSfxApp->LeaveBasicCall();
return TRUE;
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 47cde7186067..899e2cd17e25 100755
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2707,9 +2707,6 @@ void ScInterpreter::ScMacro()
// keine Sicherheitsabfrage mehr vorneweg (nur CheckMacroWarn), das passiert im CallBasic
- SfxApplication* pSfxApp = SFX_APP();
- pSfxApp->EnterBasicCall(); // Dok-Basic anlegen etc.
-
// Wenn das Dok waehrend eines Basic-Calls geladen wurde,
// ist das Sbx-Objekt evtl. nicht angelegt (?)
// pDocSh->GetSbxObject();
@@ -2722,7 +2719,6 @@ void ScInterpreter::ScMacro()
if( !pVar || pVar->GetType() == SbxVOID || !pVar->ISA(SbMethod) )
{
PushError( errNoMacro );
- pSfxApp->LeaveBasicCall();
return;
}
@@ -2841,7 +2837,7 @@ void ScInterpreter::ScMacro()
pDok->LockTable( aPos.Tab() );
SbxVariableRef refRes = new SbxVariable;
pDok->IncMacroInterpretLevel();
- ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, NULL, refPar, refRes );
+ ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes );
pDok->DecMacroInterpretLevel();
pDok->UnlockTable( aPos.Tab() );
@@ -2914,8 +2910,6 @@ void ScInterpreter::ScMacro()
else
PushString( refRes->GetString() );
}
-
- pSfxApp->LeaveBasicCall();
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index b6b136da4b1e..0d04255f0141 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -39,6 +39,9 @@
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
+#include <com/sun/star/chart/XAxisSupplier.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -169,6 +172,56 @@ bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogSc
return bIsAuto;
}
+sal_uInt16 lclGetTimeValue( const XclExpRoot& rRoot, double fSerialDate, sal_uInt16 nTimeUnit )
+{
+ DateTime aDateTime = rRoot.GetDateTimeFromDouble( fSerialDate );
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS:
+ return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
+ case EXC_CHDATERANGE_MONTHS:
+ return ::limit_cast< sal_uInt16, sal_uInt16 >( 12 * (aDateTime.GetYear() - rRoot.GetBaseYear()) + aDateTime.GetMonth() - 1, 0, SAL_MAX_INT16 );
+ case EXC_CHDATERANGE_YEARS:
+ return ::limit_cast< sal_uInt16, sal_uInt16 >( aDateTime.GetYear() - rRoot.GetBaseYear(), 0, SAL_MAX_INT16 );
+ default:
+ OSL_ENSURE( false, "lclGetTimeValue - unexpected time unit" );
+ }
+ return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 );
+}
+
+bool lclConvertTimeValue( const XclExpRoot& rRoot, sal_uInt16& rnValue, const Any& rAny, sal_uInt16 nTimeUnit )
+{
+ double fSerialDate = 0;
+ bool bAuto = lclIsAutoAnyOrGetValue( fSerialDate, rAny );
+ if( !bAuto )
+ rnValue = lclGetTimeValue( rRoot, fSerialDate, nTimeUnit );
+ return bAuto;
+}
+
+sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit )
+{
+ switch( nApiTimeUnit )
+ {
+ case cssc::TimeUnit::DAY: return EXC_CHDATERANGE_DAYS;
+ case cssc::TimeUnit::MONTH: return EXC_CHDATERANGE_MONTHS;
+ case cssc::TimeUnit::YEAR: return EXC_CHDATERANGE_YEARS;
+ default: OSL_ENSURE( false, "lclGetTimeUnit - unexpected time unit" );
+ }
+ return EXC_CHDATERANGE_DAYS;
+}
+
+bool lclConvertTimeInterval( sal_uInt16 rnValue, sal_uInt16& rnTimeUnit, const Any& rAny )
+{
+ cssc::TimeInterval aInterval;
+ bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny );
+ if( !bAuto )
+ {
+ rnValue = ::limit_cast< sal_uInt16, sal_Int32 >( aInterval.Number, 1, SAL_MAX_UINT16 );
+ rnTimeUnit = lclGetTimeUnit( aInterval.TimeUnit );
+ }
+ return bAuto;
+}
+
} // namespace
// Common =====================================================================
@@ -1269,7 +1322,7 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet,
sal_uInt16 nLabelPos = EXC_CHTEXT_POS_AUTO;
if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) )
{
- using namespace ::com::sun::star::chart::DataLabelPlacement;
+ using namespace cssc::DataLabelPlacement;
if( nPlacement == rTypeInfo.mnDefaultLabelPos )
{
nLabelPos = EXC_CHTEXT_POS_DEFAULT;
@@ -1489,7 +1542,7 @@ void XclExpCh3dDataFormat::Convert( const ScfPropertySet& rPropSet )
sal_Int32 nApiType(0);
if( rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) )
{
- using namespace ::com::sun::star::chart2::DataPointGeometry3D;
+ using namespace cssc2::DataPointGeometry3D;
switch( nApiType )
{
case CUBOID:
@@ -2246,7 +2299,7 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet )
used by this property (in the RelativePosition.Anchor member)
it cannot be used to calculate the position easily. For this,
the Chart1 API will be used instead. */
- Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
+ Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW );
// coordinates in CHLEGEND record written but not used by Excel
mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE, EXC_CHFRAMEPOS_PARENT ) );
@@ -2348,9 +2401,9 @@ void XclExpChTypeGroup::ConvertType(
// spline - TODO: get from single series (#i66858#)
ScfPropertySet aTypeProp( xChartType );
- ::com::sun::star::chart2::CurveStyle eCurveStyle;
+ cssc2::CurveStyle eCurveStyle;
bool bSpline = aTypeProp.GetProperty( eCurveStyle, EXC_CHPROP_CURVESTYLE ) &&
- (eCurveStyle != ::com::sun::star::chart2::CurveStyle_LINES);
+ (eCurveStyle != cssc2::CurveStyle_LINES);
// extended type info
maTypeInfo.Set( maType.GetTypeInfo(), b3dChart, bSpline );
@@ -2546,16 +2599,53 @@ XclExpChLabelRange::XclExpChLabelRange( const XclExpChRoot& rRoot ) :
{
}
-void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrient )
+void XclExpChLabelRange::Convert( const ScaleData& rScaleData, const ScfPropertySet& rChart1Axis, bool bMirrorOrient )
{
+ /* Base time unit (using the property 'ExplicitTimeIncrement' from the old
+ chart API allows to detect axis type (date axis, if property exists),
+ and to receive the base time unit currently used in case the base time
+ unit is set to 'automatic'. */
+ cssc::TimeIncrement aTimeIncrement;
+ if( rChart1Axis.GetProperty( aTimeIncrement, EXC_CHPROP_EXPTIMEINCREMENT ) )
+ {
+ // property exists -> this is a date axis currently
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS );
+
+ // automatic base time unit, if the UNO Any 'rScaleData.TimeIncrement.TimeResolution' does not contain a valid value...
+ bool bAutoBase = !rScaleData.TimeIncrement.TimeResolution.has< cssc::TimeIncrement >();
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE, bAutoBase );
+
+ // ...but get the current base time unit from the property of the old chart API
+ sal_Int32 nApiTimeUnit = 0;
+ bool bValidBaseUnit = aTimeIncrement.TimeResolution >>= nApiTimeUnit;
+ DBG_ASSERT( bValidBaseUnit, "XclExpChLabelRange::Convert - cannot ghet base time unit" );
+ maDateData.mnBaseUnit = bValidBaseUnit ? lclGetTimeUnit( nApiTimeUnit ) : EXC_CHDATERANGE_DAYS;
+
+ /* Min/max values depend on base time unit, they specify the number of
+ days, months, or years starting from null date. */
+ bool bAutoMin = lclConvertTimeValue( GetRoot(), maDateData.mnMinDate, rScaleData.Minimum, maDateData.mnBaseUnit );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN, bAutoMin );
+ bool bAutoMax = lclConvertTimeValue( GetRoot(), maDateData.mnMaxDate, rScaleData.Maximum, maDateData.mnBaseUnit );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX, bAutoMax );
+ }
+
+ // automatic axis type detection
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE, rScaleData.AutoDateAxis );
+
+ // increment
+ bool bAutoMajor = lclConvertTimeInterval( maDateData.mnMajorStep, maDateData.mnMajorUnit, rScaleData.TimeIncrement.MajorTimeInterval );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR, bAutoMajor );
+ bool bAutoMinor = lclConvertTimeInterval( maDateData.mnMinorStep, maDateData.mnMinorUnit, rScaleData.TimeIncrement.MinorTimeInterval );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR, bAutoMinor );
+
// origin
double fOrigin = 0.0;
if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) )
- maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
+ maLabelData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 );
// reverse order
- if( (rScaleData.Orientation == ::com::sun::star::chart2::AxisOrientation_REVERSE) != bMirrorOrient )
- ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE );
+ if( (rScaleData.Orientation == cssc2::AxisOrientation_REVERSE) != bMirrorOrient )
+ ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE );
}
void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
@@ -2564,19 +2654,55 @@ void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet )
rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION );
double fCrossingPos = 1.0;
rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE );
+
+ bool bDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS );
switch( eAxisPos )
{
- case cssc::ChartAxisPosition_ZERO: maData.mnCross = 1; break;
- case cssc::ChartAxisPosition_START: maData.mnCross = 1; break;
- case cssc::ChartAxisPosition_END: ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); break;
- case cssc::ChartAxisPosition_VALUE: maData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 ); break;
- default: maData.mnCross = 1;
+ case cssc::ChartAxisPosition_ZERO:
+ case cssc::ChartAxisPosition_START:
+ maLabelData.mnCross = 1;
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ break;
+ case cssc::ChartAxisPosition_END:
+ ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_MAXCROSS );
+ break;
+ case cssc::ChartAxisPosition_VALUE:
+ maLabelData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 );
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS, false );
+ if( bDateAxis )
+ maDateData.mnCross = lclGetTimeValue( GetRoot(), fCrossingPos, maDateData.mnBaseUnit );
+ break;
+ default:
+ maLabelData.mnCross = 1;
+ ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ }
+}
+
+void XclExpChLabelRange::Save( XclExpStream& rStrm )
+{
+ // the CHLABELRANGE record
+ XclExpRecord::Save( rStrm );
+
+ // the CHDATERANGE record with date axis settings (BIFF8 only)
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 );
+ rStrm << maDateData.mnMinDate
+ << maDateData.mnMaxDate
+ << maDateData.mnMajorStep
+ << maDateData.mnMajorUnit
+ << maDateData.mnMinorStep
+ << maDateData.mnMinorUnit
+ << maDateData.mnBaseUnit
+ << maDateData.mnCross
+ << maDateData.mnFlags;
+ rStrm.EndRecord();
}
}
void XclExpChLabelRange::WriteBody( XclExpStream& rStrm )
{
- rStrm << maData.mnCross << maData.mnLabelFreq << maData.mnTickFreq << maData.mnFlags;
+ rStrm << maLabelData.mnCross << maLabelData.mnLabelFreq << maLabelData.mnTickFreq << maLabelData.mnFlags;
}
// ----------------------------------------------------------------------------
@@ -2661,7 +2787,7 @@ namespace {
sal_uInt8 lclGetXclTickPos( sal_Int32 nApiTickmarks )
{
- using namespace ::com::sun::star::chart2::TickmarkStyle;
+ using namespace cssc2::TickmarkStyle;
sal_uInt8 nXclTickPos = 0;
::set_flag( nXclTickPos, EXC_CHTICK_INSIDE, ::get_flag( nApiTickmarks, INNER ) );
::set_flag( nXclTickPos, EXC_CHTICK_OUTSIDE, ::get_flag( nApiTickmarks, OUTER ) );
@@ -2764,6 +2890,30 @@ Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > xCoordSystem,
return xAxis;
}
+Reference< cssc::XAxis > lclGetApiChart1Axis( Reference< XChartDocument > xChartDoc,
+ sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx )
+{
+ Reference< cssc::XAxis > xChart1Axis;
+ try
+ {
+ Reference< cssc::XChartDocument > xChart1Doc( xChartDoc, UNO_QUERY_THROW );
+ Reference< cssc::XAxisSupplier > xChart1AxisSupp( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
+ switch( nApiAxesSetIdx )
+ {
+ case EXC_CHART_AXESSET_PRIMARY:
+ xChart1Axis = xChart1AxisSupp->getAxis( nApiAxisDim );
+ break;
+ case EXC_CHART_AXESSET_SECONDARY:
+ xChart1Axis = xChart1AxisSupp->getSecondaryAxis( nApiAxisDim );
+ break;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return xChart1Axis;
+}
+
} // namespace
XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) :
@@ -2786,7 +2936,8 @@ void XclExpChAxis::SetRotation( sal_uInt16 nRotation )
mxTick->SetRotation( nRotation );
}
-void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis, const XclChExtTypeInfo& rTypeInfo )
+void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis,
+ Reference< cssc::XAxis > xChart1Axis, const XclChExtTypeInfo& rTypeInfo )
{
ScfPropertySet aAxisProp( xAxis );
bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z);
@@ -2806,8 +2957,11 @@ void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossi
mxLabelRange.reset( new XclExpChLabelRange( GetChRoot() ) );
mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg );
if( xAxis.is() )
+ {
+ ScfPropertySet aChart1AxisProp( xChart1Axis );
// #i71684# radar charts have reversed rotation direction
- mxLabelRange->Convert( xAxis->getScaleData(), (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
+ mxLabelRange->Convert( xAxis->getScaleData(), aChart1AxisProp, (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) );
+ }
// get position of crossing axis on this axis from passed axis object
if( aCrossingProp.Is() )
mxLabelRange->ConvertAxisPosition( aCrossingProp );
@@ -2935,7 +3089,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
bool b3dChart = xCoordSystem.is() && (xCoordSystem->getDimension() == 3);
// percent charts
- namespace ApiAxisType = ::com::sun::star::chart2::AxisType;
+ namespace ApiAxisType = cssc2::AxisType;
Reference< XAxis > xApiYAxis = lclGetApiAxis( xCoordSystem, EXC_CHART_AXIS_Y, nApiAxesSetIdx );
bool bPercent = xApiYAxis.is() && (xApiYAxis->getScaleData().AxisType == ApiAxisType::PERCENT);
@@ -3042,8 +3196,8 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16
// inner and outer plot area position and size
try
{
- Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
- Reference< ::com::sun::star::chart::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
+ Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW );
+ Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW );
// set manual flag in chart data
if( !xPositioning->isAutomaticDiagramPositioning() )
GetChartData().SetManualPlotArea();
@@ -3110,7 +3264,8 @@ void XclExpChAxesSet::ConvertAxis(
sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex();
Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx );
Reference< XAxis > xCrossingAxis = lclGetApiAxis( xCoordSystem, nCrossingAxisDim, nApiAxesSetIdx );
- rxChAxis->Convert( xAxis, xCrossingAxis, rTypeInfo );
+ Reference< cssc::XAxis > xChart1Axis = lclGetApiChart1Axis( GetChartDocument(), nApiAxisDim, nApiAxesSetIdx );
+ rxChAxis->Convert( xAxis, xCrossingAxis, xChart1Axis, rTypeInfo );
// create and convert axis title
Reference< XTitled > xTitled( xAxis, UNO_QUERY );
@@ -3173,7 +3328,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
sal_Int32 nMissingValues = 0;
if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) )
{
- using namespace ::com::sun::star::chart::MissingValueTreatment;
+ using namespace cssc::MissingValueTreatment;
switch( nMissingValues )
{
case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break;
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 7cbd74a836d2..8a5084be8bfc 100755..100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -43,6 +43,8 @@
#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/TimeInterval.hpp>
+#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -147,13 +149,12 @@ XclImpStream& operator>>( XclImpStream& rStrm, XclChRectangle& rRect )
return rStrm >> rRect.mnX >> rRect.mnY >> rRect.mnWidth >> rRect.mnHeight;
}
-template< typename Type >
-void lclSetValueOrClearAny( Any& rAny, const Type& rValue, bool bClear )
+inline void lclSetValueOrClearAny( Any& rAny, double fValue, bool bClear )
{
if( bClear )
rAny.clear();
else
- rAny <<= rValue;
+ rAny <<= fValue;
}
void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bClear )
@@ -163,6 +164,50 @@ void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bC
lclSetValueOrClearAny( rAny, fValue, bClear );
}
+double lclGetSerialDay( const XclImpRoot& rRoot, sal_uInt16 nValue, sal_uInt16 nTimeUnit )
+{
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS:
+ return nValue;
+ case EXC_CHDATERANGE_MONTHS:
+ return rRoot.GetDoubleFromDateTime( Date( 1, static_cast< sal_uInt16 >( 1 + nValue % 12 ), static_cast< USHORT >( rRoot.GetBaseYear() + nValue / 12 ) ) );
+ case EXC_CHDATERANGE_YEARS:
+ return rRoot.GetDoubleFromDateTime( Date( 1, 1, static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue ) ) );
+ default:
+ OSL_ENSURE( false, "lclGetSerialDay - unexpected time unit" );
+ }
+ return nValue;
+}
+
+void lclConvertTimeValue( const XclImpRoot& rRoot, Any& rAny, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit )
+{
+ if( bAuto )
+ rAny.clear();
+ else
+ rAny <<= lclGetSerialDay( rRoot, nValue, nTimeUnit );
+}
+
+sal_Int32 lclGetApiTimeUnit( sal_uInt16 nTimeUnit )
+{
+ switch( nTimeUnit )
+ {
+ case EXC_CHDATERANGE_DAYS: return cssc::TimeUnit::DAY;
+ case EXC_CHDATERANGE_MONTHS: return cssc::TimeUnit::MONTH;
+ case EXC_CHDATERANGE_YEARS: return cssc::TimeUnit::YEAR;
+ default: OSL_ENSURE( false, "lclGetApiTimeUnit - unexpected time unit" );
+ }
+ return cssc::TimeUnit::DAY;
+}
+
+void lclConvertTimeInterval( Any& rInterval, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit )
+{
+ if( bAuto || (nValue == 0) )
+ rInterval.clear();
+ else
+ rInterval <<= cssc::TimeInterval( nValue, lclGetApiTimeUnit( nTimeUnit ) );
+}
+
} // namespace
// Common =====================================================================
@@ -2828,20 +2873,60 @@ XclImpChLabelRange::XclImpChLabelRange( const XclImpChRoot& rRoot ) :
void XclImpChLabelRange::ReadChLabelRange( XclImpStream& rStrm )
{
- rStrm >> maData.mnCross >> maData.mnLabelFreq >> maData.mnTickFreq >> maData.mnFlags;
+ rStrm >> maLabelData.mnCross >> maLabelData.mnLabelFreq >> maLabelData.mnTickFreq >> maLabelData.mnFlags;
+}
+
+void XclImpChLabelRange::ReadChDateRange( XclImpStream& rStrm )
+{
+ rStrm >> maDateData.mnMinDate
+ >> maDateData.mnMaxDate
+ >> maDateData.mnMajorStep
+ >> maDateData.mnMajorUnit
+ >> maDateData.mnMinorStep
+ >> maDateData.mnMinorUnit
+ >> maDateData.mnBaseUnit
+ >> maDateData.mnCross
+ >> maDateData.mnFlags;
}
void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const
{
- // do not overlap text unless all labels are visible
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maData.mnLabelFreq == 1 );
- // do not break text into several lines unless all labels are visible
- rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maData.mnLabelFreq == 1 );
- // do not stagger labels in two lines
- rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE );
+ // automatic axis type detection
+ rScaleData.AutoDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE );
+
+ // the flag EXC_CHDATERANGE_DATEAXIS specifies whether this is a date axis
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) )
+ {
+ /* Chart2 requires axis type CATEGORY for automatic category/date axis
+ (even if it is a date axis currently). */
+ rScaleData.AxisType = rScaleData.AutoDateAxis ? cssc2::AxisType::CATEGORY : cssc2::AxisType::DATE;
+ rScaleData.Scaling.set( ScfApiHelper::CreateInstance( SERVICE_CHART2_LINEARSCALING ), UNO_QUERY );
+ /* Min/max values depend on base time unit, they specify the number of
+ days, months, or years starting from null date. */
+ lclConvertTimeValue( GetRoot(), rScaleData.Minimum, maDateData.mnMinDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN ), maDateData.mnBaseUnit );
+ lclConvertTimeValue( GetRoot(), rScaleData.Maximum, maDateData.mnMaxDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX ), maDateData.mnBaseUnit );
+ // increment
+ cssc::TimeIncrement& rTimeIncrement = rScaleData.TimeIncrement;
+ lclConvertTimeInterval( rTimeIncrement.MajorTimeInterval, maDateData.mnMajorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR ), maDateData.mnMajorUnit );
+ lclConvertTimeInterval( rTimeIncrement.MinorTimeInterval, maDateData.mnMinorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR ), maDateData.mnMinorUnit );
+ // base unit
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE ) )
+ rTimeIncrement.TimeResolution.clear();
+ else
+ rTimeIncrement.TimeResolution <<= lclGetApiTimeUnit( maDateData.mnBaseUnit );
+ }
+ else
+ {
+ // do not overlap text unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maLabelData.mnLabelFreq == 1 );
+ // do not break text into several lines unless all labels are visible
+ rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maLabelData.mnLabelFreq == 1 );
+ // do not stagger labels in two lines
+ rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE );
+ }
// reverse order
- bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient;
+ bool bReverse = ::get_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient;
rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL;
//! TODO #i58731# show n-th category
@@ -2853,13 +2938,29 @@ void XclImpChLabelRange::ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3d
does not move the Y axis in 3D charts, regardless of actual settings.
But: the Y axis has to be moved to "end", if the X axis is mirrored,
to keep it at the left end of the chart. */
- bool bMaxCross = ::get_flag( maData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS );
+ bool bMaxCross = ::get_flag( maLabelData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS );
cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE;
rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos );
- // crossing position
- double fCrossingPos = b3dChart ? 1.0 : maData.mnCross;
- rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ // crossing position (depending on axis type text/date)
+ if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) )
+ {
+ bool bAutoCross = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS );
+ /* Crossing position value depends on base time unit, it specifies the
+ number of days, months, or years from null date. Note that Excel
+ 2007/2010 write broken BIFF8 files, they always stores the number
+ of days cregardless of the base time unit (and they are reading it
+ the same way, thus wrongly displaying files written by Excel
+ 97-2003). This filter sticks to the correct behaviour of Excel
+ 97-2003. */
+ double fCrossingPos = bAutoCross ? 1.0 : lclGetSerialDay( GetRoot(), maDateData.mnCross, maDateData.mnBaseUnit );
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ }
+ else
+ {
+ double fCrossingPos = b3dChart ? 1.0 : maLabelData.mnCross;
+ rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos );
+ }
}
// ----------------------------------------------------------------------------
@@ -2900,6 +3001,7 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements;
rSubIncrementSeq.realloc( 1 );
Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount;
+ rIntervalCount.clear();
if( bLogScale )
{
if( !bAutoMinor )
@@ -2907,14 +3009,12 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co
}
else
{
- sal_Int32 nCount = 0;
if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) )
{
double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5;
- if( fCount < 1001.0 )
- nCount = static_cast< sal_Int32 >( fCount );
+ if( (1.0 <= fCount) && (fCount < 1001.0) )
+ rIntervalCount <<= static_cast< sal_Int32 >( fCount );
}
- lclSetValueOrClearAny( rIntervalCount, nCount, nCount == 0 );
}
// reverse order
@@ -3035,6 +3135,11 @@ void XclImpChAxis::ReadSubRecord( XclImpStream& rStrm )
mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) );
mxLabelRange->ReadChLabelRange( rStrm );
break;
+ case EXC_ID_CHDATERANGE:
+ if( !mxLabelRange )
+ mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) );
+ mxLabelRange->ReadChDateRange( rStrm );
+ break;
case EXC_ID_CHVALUERANGE:
mxValueRange.reset( new XclImpChValueRange( GetChRoot() ) );
mxValueRange->ReadChValueRange( rStrm );
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index 10a0657c7899..5f89b7933449 100755
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -329,6 +329,24 @@ XclChLabelRange::XclChLabelRange() :
// ----------------------------------------------------------------------------
+XclChDateRange::XclChDateRange() :
+ mnMinDate( 0 ),
+ mnMaxDate( 0 ),
+ mnMajorStep( 0 ),
+ mnMajorUnit( EXC_CHDATERANGE_DAYS ),
+ mnMinorStep( 0 ),
+ mnMinorUnit( EXC_CHDATERANGE_DAYS ),
+ mnBaseUnit( EXC_CHDATERANGE_DAYS ),
+ mnCross( 0 ),
+ mnFlags( EXC_CHDATERANGE_AUTOMIN | EXC_CHDATERANGE_AUTOMAX |
+ EXC_CHDATERANGE_AUTOMAJOR | EXC_CHDATERANGE_AUTOMINOR |
+ EXC_CHDATERANGE_AUTOBASE | EXC_CHDATERANGE_AUTOCROSS |
+ EXC_CHDATERANGE_AUTODATE )
+{
+}
+
+// ----------------------------------------------------------------------------
+
XclChValueRange::XclChValueRange() :
mfMin( 0.0 ),
mfMax( 0.0 ),
@@ -336,7 +354,8 @@ XclChValueRange::XclChValueRange() :
mfMinorStep( 0.0 ),
mfCross( 0.0 ),
mnFlags( EXC_CHVALUERANGE_AUTOMIN | EXC_CHVALUERANGE_AUTOMAX |
- EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR | EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 )
+ EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR |
+ EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 )
{
}
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index c6d6c5b9246a..d8dbcabfe4df 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -326,6 +326,12 @@ DateTime XclRoot::GetNullDate() const
return *GetFormatter().GetNullDate();
}
+sal_uInt16 XclRoot::GetBaseYear() const
+{
+ // return 1904 for 1904-01-01, and 1900 for 1899-12-30
+ return (GetNullDate().GetYear() == 1904) ? 1904 : 1900;
+}
+
double XclRoot::GetDoubleFromDateTime( const DateTime& rDateTime ) const
{
double fValue = rDateTime - GetNullDate();
diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx
index 5bb75e029210..5178d6d99968 100644
--- a/sc/source/filter/inc/xechart.hxx
+++ b/sc/source/filter/inc/xechart.hxx
@@ -47,6 +47,10 @@ namespace com { namespace sun { namespace star {
{
class XModel;
}
+ namespace chart
+ {
+ class XAxis;
+ }
namespace chart2
{
struct ScaleData;
@@ -1011,18 +1015,21 @@ public:
explicit XclExpChLabelRange( const XclExpChRoot& rRoot );
/** Converts category axis scaling settings. */
- void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData, bool bMirrorOrient );
+ void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData,
+ const ScfPropertySet& rChart1Axis, bool bMirrorOrient );
/** Converts position settings of a crossing axis at this axis. */
void ConvertAxisPosition( const ScfPropertySet& rPropSet );
/** Sets flag for tickmark position between categories or on categories. */
inline void SetTicksBetweenCateg( bool bTicksBetween )
- { ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
+ { ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
private:
+ virtual void Save( XclExpStream& rStrm );
virtual void WriteBody( XclExpStream& rStrm );
private:
- XclChLabelRange maData; /// Contents of the CHLABELRANGE record.
+ XclChLabelRange maLabelData; /// Contents of the CHLABELRANGE record.
+ XclChDateRange maDateData; /// Contents of the CHDATERANGE record.
};
typedef ScfRef< XclExpChLabelRange > XclExpChLabelRangeRef;
@@ -1085,6 +1092,7 @@ class XclExpChAxis : public XclExpChGroupBase, public XclExpChFontBase
public:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > XAxisRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxis > XChart1AxisRef;
public:
explicit XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType );
@@ -1095,7 +1103,8 @@ public:
virtual void SetRotation( sal_uInt16 nRotation );
/** Converts formatting and scaling settings from the passed axis. */
- void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis, const XclChExtTypeInfo& rTypeInfo );
+ void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis,
+ XChart1AxisRef xChart1Axis, const XclChExtTypeInfo& rTypeInfo );
/** Converts and writes 3D wall/floor properties from the passed diagram. */
void ConvertWall( XDiagramRef xDiagram );
diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx
index d8289b3b671b..0fbde9db0905 100644
--- a/sc/source/filter/inc/xichart.hxx
+++ b/sc/source/filter/inc/xichart.hxx
@@ -1134,13 +1134,16 @@ public:
explicit XclImpChLabelRange( const XclImpChRoot& rRoot );
/** Reads the CHLABELRANGE record (category axis scaling properties). */
void ReadChLabelRange( XclImpStream& rStrm );
+ /** Reads the CHDATERANGE record (date axis scaling properties). */
+ void ReadChDateRange( XclImpStream& rStrm );
/** Converts category axis scaling settings. */
void Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const;
/** Converts position settings of this axis at a crossing axis. */
void ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3dChart ) const;
private:
- XclChLabelRange maData; /// Contents of the CHLABELRANGE record.
+ XclChLabelRange maLabelData; /// Contents of the CHLABELRANGE record.
+ XclChDateRange maDateData; /// Contents of the CHDATERANGE record.
};
typedef ScfRef< XclImpChLabelRange > XclImpChLabelRangeRef;
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index 13eda8619cc0..68186a238847 100755
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -101,6 +101,7 @@ class XclRoot;
#define EXC_CHPROP_ERRORBARX CREATE_OUSTRING( "ErrorBarX" )
#define EXC_CHPROP_ERRORBARY CREATE_OUSTRING( "ErrorBarY" )
#define EXC_CHPROP_EXPANSION CREATE_OUSTRING( "Expansion" )
+#define EXC_CHPROP_EXPTIMEINCREMENT CREATE_OUSTRING( "ExplicitTimeIncrement" )
#define EXC_CHPROP_FILLBITMAPMODE CREATE_OUSTRING( "FillBitmapMode" )
#define EXC_CHPROP_FILLSTYLE CREATE_OUSTRING( "FillStyle" )
#define EXC_CHPROP_GAPWIDTHSEQ CREATE_OUSTRING( "GapwidthSequence" )
@@ -721,6 +722,23 @@ const sal_uInt8 EXC_CH3DDATAFORMAT_TRUNC = 2; /// Shart top, trunc
const sal_uInt16 EXC_ID_CHPIEEXT = 0x1061;
+// (0x1062) CHDATERANGE -------------------------------------------------------
+
+const sal_uInt16 EXC_ID_CHDATERANGE = 0x1062;
+
+const sal_uInt16 EXC_CHDATERANGE_AUTOMIN = 0x0001;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMAX = 0x0002;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMAJOR = 0x0004;
+const sal_uInt16 EXC_CHDATERANGE_AUTOMINOR = 0x0008;
+const sal_uInt16 EXC_CHDATERANGE_DATEAXIS = 0x0010;
+const sal_uInt16 EXC_CHDATERANGE_AUTOBASE = 0x0020;
+const sal_uInt16 EXC_CHDATERANGE_AUTOCROSS = 0x0040; /// Other axis crosses at own maximum.
+const sal_uInt16 EXC_CHDATERANGE_AUTODATE = 0x0080; /// Recognize date/text automatically.
+
+const sal_uInt16 EXC_CHDATERANGE_DAYS = 0;
+const sal_uInt16 EXC_CHDATERANGE_MONTHS = 1;
+const sal_uInt16 EXC_CHDATERANGE_YEARS = 2;
+
// (0x1066) CHESCHERFORMAT ----------------------------------------------------
const sal_uInt16 EXC_ID_CHESCHERFORMAT = 0x1066;
@@ -1054,6 +1072,23 @@ struct XclChLabelRange
// ----------------------------------------------------------------------------
+struct XclChDateRange
+{
+ sal_uInt16 mnMinDate; /// Minimum value on axis.
+ sal_uInt16 mnMaxDate; /// Maximum value on axis.
+ sal_uInt16 mnMajorStep; /// Distance for major grid lines.
+ sal_uInt16 mnMajorUnit; /// Time unit for major step.
+ sal_uInt16 mnMinorStep; /// Distance for minor grid lines.
+ sal_uInt16 mnMinorUnit; /// Time unit for minor step.
+ sal_uInt16 mnBaseUnit; /// Time unit for axis values.
+ sal_uInt16 mnCross; /// Crossing position of other axis.
+ sal_uInt16 mnFlags; /// Additional flags.
+
+ explicit XclChDateRange();
+};
+
+// ----------------------------------------------------------------------------
+
struct XclChValueRange
{
double mfMin; /// Minimum value on axis.
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 44ded449cd76..af42efcdb426 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -239,6 +239,8 @@ public:
SvNumberFormatter& GetFormatter() const;
/** Returns the null date of the current number formatter. */
DateTime GetNullDate() const;
+ /** Returns the base year depending on the current null date (1900 or 1904). */
+ sal_uInt16 GetBaseYear() const;
/** Converts a date/time value to a floating-point value. */
double GetDoubleFromDateTime( const DateTime& rDateTime ) const;
/** Converts a floating-point value to a date/time value. */
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/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index f7a02e1577f7..56cfb98afc9c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -58,7 +58,6 @@
#include <vcl/status.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
-#include <sfx2/macrconf.hxx>
#include <sfx2/printer.hxx>
#include <editeng/langitem.hxx>
#include <svtools/colorcfg.hxx>
@@ -391,20 +390,14 @@ void ScModule::Execute( SfxRequest& rReq )
{
String aMacroName =
String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Template.Samples.ShowStyles"));
- SfxApplication* pApp = SFX_APP();
- pApp->EnterBasicCall();
- pApp->GetMacroConfig()->Call( NULL, aMacroName, pApp->GetBasicManager() );
- pApp->LeaveBasicCall();
+ SfxApplication::CallAppBasic( aMacroName );
}
break;
case SID_EURO_CONVERTER:
{
String aMacroName =
String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Euro.ConvertRun.Main"));
- SfxApplication* pApp = SFX_APP();
- pApp->EnterBasicCall();
- pApp->GetMacroConfig()->Call( NULL, aMacroName, pApp->GetBasicManager() );
- pApp->LeaveBasicCall();
+ SfxApplication::CallAppBasic( aMacroName );
}
break;
case SID_AUTOSPELL_CHECK:
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 50d95fbd677d..5e4a9c97808a 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1137,7 +1137,7 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
if (aTester.IsEditable())
{
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
- SfxUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
+ ::svl::IUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
ScNoteData aOldData;
ScPostIt* pOldNote = rDoc.ReleaseNote( rPos );
@@ -1741,8 +1741,7 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
rDocShell.GetUndoManager()->LeaveListAction();
- SfxUndoManager* pMgr = rDocShell.GetUndoManager();
- pMgr->RemoveLastUndoAction();
+ rDocShell.GetUndoManager()->RemoveLastUndoAction();
delete pRefUndoDoc;
delete pUndoData;
@@ -2618,7 +2617,6 @@ script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule )
void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sSource )
{
- SFX_APP()->EnterBasicCall();
SfxObjectShell& rDocSh = *rDoc.GetDocumentShell();
uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
@@ -2662,12 +2660,10 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String
}
}
- SFX_APP()->LeaveBasicCall();
}
void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
{
- SFX_APP()->EnterBasicCall();
uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
@@ -2689,7 +2685,6 @@ void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
xVBAModuleInfo->removeModuleInfo( sModuleName );
}
- SFX_APP()->LeaveBasicCall();
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 901363785cc9..5d9af06a7d65 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2581,7 +2581,7 @@ __EXPORT ScDocShell::~ScDocShell()
//------------------------------------------------------------------
-SfxUndoManager* __EXPORT ScDocShell::GetUndoManager()
+::svl::IUndoManager* __EXPORT ScDocShell::GetUndoManager()
{
return aDocument.GetUndoManager();
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 5de8b17b0598..dee4c3060578 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -108,6 +108,7 @@ using namespace ::com::sun::star;
#include "chgviset.hxx"
#include "reffact.hxx"
#include "chartlis.hxx"
+#include "chartpos.hxx"
#include "waitoff.hxx"
#include "tablink.hxx" // ScDocumentLoader statics
#include "drwlayer.hxx"
@@ -377,19 +378,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
BOOL bOk = TRUE;
if ( !bAddRange && ( !bColInit || !bRowInit ) )
{
- // Spalten/Zeilenkoepfe testen wie in chartarr
+ ScChartPositioner aChartPositioner( &aDocument, nTab, nCol1,nRow1, nCol2,nRow2 );
if (!bColInit)
- {
- for (SCCOL i=nCol1; i<=nCol2 && bColHeaders; i++)
- if (aDocument.HasValueData( i, nRow1, nTab ))
- bColHeaders = FALSE;
- }
+ bColHeaders = aChartPositioner.HasColHeaders();
if (!bRowInit)
- {
- for (SCROW i=nRow1; i<=nRow2 && bRowHeaders; i++)
- if (aDocument.HasValueData( nCol1, i, nTab ))
- bRowHeaders = FALSE;
- }
+ bRowHeaders = aChartPositioner.HasRowHeaders();
//CHINA001 ScColRowLabelDlg aDlg( pParent, bRowHeaders, bColHeaders );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
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/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 7da571fc05a7..fc3ceadd3a92 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -68,7 +68,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) :
pViewData( pData )
{
SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() );
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index a5159d8a8043..df1c82b17c40 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -127,7 +127,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) :
SetPool( pViewData->GetScDrawView()->GetDefaultAttr().GetPool() );
// UndoManager wird beim Umschalten in den Edit-Modus umgesetzt...
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 534e68705fa8..1800dc53a744 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -85,7 +85,7 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
}
ScDocShell* pDocShell = rViewData.GetDocShell();
- SfxUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0;
+ ::svl::IUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0;
bool bNewNote = false;
if( pNote && pUndoMgr )
{
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index fe94db107be0..132652891959 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -187,7 +187,8 @@ public:
virtual void Activate();
virtual void Deactivate();
- virtual SfxUndoManager* GetUndoManager();
+ virtual ::svl::IUndoManager*
+ GetUndoManager();
virtual void FillClass( SvGlobalName * pClassName,
sal_uInt32 * pFormat,
@@ -325,6 +326,8 @@ public:
void PostPaintGridAll();
void PostPaintExtras();
+ bool IsPaintLocked() const { return pPaintLockData != NULL; }
+
void PostDataChanged();
void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index c3316092d044..69832218f172 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -346,7 +346,7 @@ public:
BOOL IsDrawTextShell() const;
BOOL IsAuditShell() const;
- void SetDrawTextUndo( SfxUndoManager* pUndoMgr );
+ void SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
void FillFieldData( ScHeaderFieldData& rData );
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 6f2bb3572832..ea7885b2859b 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -31,6 +31,7 @@
#include <svl/undo.hxx>
#include "global.hxx"
#include "address.hxx"
+#include "docsh.hxx"
class ScDocument;
class ScDocShell;
@@ -53,6 +54,10 @@ protected:
ScDocShell* pDocShell;
SfxUndoAction* pDetectiveUndo;
+ bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
+
+ bool SetViewMarkData( const ScMarkData& rMarkData );
+
void BeginUndo();
void EndUndo();
void BeginRedo();
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index fffb76ebd061..793b416fbee4 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -66,6 +66,19 @@ __EXPORT ScSimpleUndo::~ScSimpleUndo()
delete pDetectiveUndo;
}
+bool ScSimpleUndo::SetViewMarkData( const ScMarkData& rMarkData )
+{
+ if ( IsPaintLocked() )
+ return false;
+
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+ if ( !pViewShell )
+ return false;
+
+ pViewShell->SetMarkData( rMarkData );
+ return true;
+}
+
BOOL __EXPORT ScSimpleUndo::Merge( SfxUndoAction *pNextAction )
{
// Zu jeder Undo-Action kann eine SdrUndoGroup fuer das Aktualisieren
@@ -253,6 +266,9 @@ BOOL ScBlockUndo::AdjustHeight()
void ScBlockUndo::ShowBlock()
{
+ if ( IsPaintLocked() )
+ return;
+
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 3fb2c74a9954..556cd3c82d93 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1600,10 +1600,8 @@ String __EXPORT ScUndoSelectionStyle::GetComment() const
void ScUndoSelectionStyle::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
ScRange aWorkRange( aRange );
if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) ) // zusammengefasste Zellen?
@@ -1635,6 +1633,7 @@ void ScUndoSelectionStyle::DoChange( const BOOL bUndo )
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aWorkRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 2ab03eb71923..a7ddfaf6f23f 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -113,18 +113,13 @@ void __EXPORT ScUndoWidthOrHeight::Undo()
BeginUndo();
ScDocument* pDoc = pDocShell->GetDocument();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCCOLROW nPaintStart = nStart > 0 ? nStart-1 : static_cast<SCCOLROW>(0);
if (eMode==SC_SIZE_OPTIMAL)
{
- if (pViewShell)
- {
- pViewShell->SetMarkData( aMarkData );
-
+ if ( SetViewMarkData( aMarkData ) )
nPaintStart = 0; // paint all, because of changed selection
- }
}
//! outlines from all tables?
@@ -155,6 +150,7 @@ void __EXPORT ScUndoWidthOrHeight::Undo()
DoSdrUndoAction( pDrawUndo, pDoc );
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
pViewShell->UpdateScrollBars();
@@ -171,19 +167,14 @@ void __EXPORT ScUndoWidthOrHeight::Redo()
{
BeginRedo();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-
BOOL bPaintAll = FALSE;
if (eMode==SC_SIZE_OPTIMAL)
{
- if (pViewShell)
- {
- pViewShell->SetMarkData( aMarkData );
-
+ if ( SetViewMarkData( aMarkData ) )
bPaintAll = TRUE; // paint all, because of changed selection
- }
}
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
@@ -192,7 +183,8 @@ void __EXPORT ScUndoWidthOrHeight::Redo()
}
// SetWidthOrHeight aendert aktuelle Tabelle !
- pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
+ if ( pViewShell )
+ pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
// paint grid if selection was changed directly at the MarkData
if (bPaintAll)
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 506afeac138e..6a9c7e12af23 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -147,10 +147,8 @@ void ScUndoDeleteContents::SetChangeTrack()
void ScUndoDeleteContents::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
USHORT nExtFlags = 0;
@@ -195,6 +193,7 @@ void ScUndoDeleteContents::DoChange( const BOOL bUndo )
SetChangeTrack();
}
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustRowHeight(
aRange.aStart.Row(), aRange.aEnd.Row() ) ) )
/*A*/ pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
@@ -341,10 +340,8 @@ void ScUndoFillTable::SetChangeTrack()
void ScUndoFillTable::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
if (bUndo) // nur Undo
{
@@ -379,6 +376,7 @@ void ScUndoFillTable::DoChange( const BOOL bUndo )
// CellContentChanged kommt mit der Markierung
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
@@ -485,10 +483,8 @@ String __EXPORT ScUndoSelectionAttr::GetComment() const
void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
ScRange aEffRange( aRange );
if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // zusammengefasste Zellen?
@@ -515,6 +511,7 @@ void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
}
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aEffRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
@@ -1165,8 +1162,7 @@ void __EXPORT ScUndoReplace::Undo()
DBG_ASSERT(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL,
"ScUndoReplace:: Falscher Modus");
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
//! markierte Tabellen
//! Bereich merken ?
@@ -1243,7 +1239,7 @@ void __EXPORT ScUndoReplace::Redo()
{
if (pViewShell)
{
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
pViewShell->SearchAndReplace( pSearchItem, FALSE, TRUE );
}
@@ -1466,9 +1462,7 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo
ScDocument* pDoc = pDocShell->GetDocument();
ShowTable( rCursorPos.Tab() );
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
SCTAB nTabCount = pDoc->GetTableCount();
// Undo/Redo-doc has only selected tables
@@ -1575,9 +1569,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
ShowTable(aRange);
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
ScRange aCopyRange = aRange;
SCTAB nTabCount = pDoc->GetTableCount();
@@ -1586,6 +1578,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
pDocShell->PostPaint( aRange, PAINT_GRID);
pDocShell->PostDataChanged();
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->CellContentChanged();
}
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index d9acc34bf28c..c6cce0bee4bd 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -891,9 +891,7 @@ void ScUndoMakeScenario::Undo()
void ScUndoMakeScenario::Redo()
{
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if (pViewShell)
- pViewShell->SetMarkData( aMarkData );
+ SetViewMarkData( aMarkData );
RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
@@ -905,6 +903,7 @@ void ScUndoMakeScenario::Redo()
bDrawIsInUndo = FALSE;
pDocShell->SetInUndo( FALSE );
+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetTabNo( nDestTab, TRUE );
diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx
index 168975cdda3a..9cd32381c8a5 100644
--- a/sc/source/ui/undo/undoutil.cxx
+++ b/sc/source/ui/undo/undoutil.cxx
@@ -43,10 +43,13 @@
#include "globstr.hrc"
#include "global.hxx"
-void ScUndoUtil::MarkSimpleBlock( ScDocShell* /* pDocShell */,
+void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ )
{
+ if ( pDocShell->IsPaintLocked() )
+ return;
+
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 30d4bd4d39a0..290b34a949ca 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -481,7 +481,6 @@ void SAL_CALL
ScVbaApplication::wait( double time ) throw (uno::RuntimeException)
{
StarBASIC* pBasic = SFX_APP()->GetBasic();
- SFX_APP()->EnterBasicCall();
SbxArrayRef aArgs = new SbxArray;
SbxVariableRef aRef = new SbxVariable;
aRef->PutDouble( time );
@@ -495,8 +494,6 @@ ScVbaApplication::wait( double time ) throw (uno::RuntimeException)
// forces a broadcast
SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth));
}
- SFX_APP()->LeaveBasicCall();
-
}
uno::Any SAL_CALL
@@ -1164,7 +1161,6 @@ uno::Any SAL_CALL
ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeException )
{
StarBASIC* pBasic = SFX_APP()->GetBasic();
- SFX_APP()->EnterBasicCall();
SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FuncCaller") ), SbxCLASS_METHOD );
uno::Any aRet;
if ( pMeth )
@@ -1175,7 +1171,6 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetString(), RTL_TEXTENCODING_UTF8 ).getStr() );
aRet = sbxToUnoValue( pNew );
}
- SFX_APP()->LeaveBasicCall();
return aRet;
}
diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx
index 2c80c154759d..ea081b6f2fa6 100644
--- a/sc/source/ui/view/auditsh.cxx
+++ b/sc/source/ui/view/auditsh.cxx
@@ -68,7 +68,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) :
nFunction( SID_FILL_ADD_PRED )
{
SetPool( &pViewData->GetViewShell()->GetPool() );
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
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/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index dbdeae1ae0b1..1ac653f88b70 100755..100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -2187,7 +2187,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet
pInsDoc->GetCellArea( nNewTab, nEndCol, nEndRow );
pInsDoc->SetClipArea( ScRange( 0, 0, nNewTab, nEndCol, nEndRow, nNewTab ) );
- SfxUndoManager* pMgr = GetViewData()->GetDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = GetViewData()->GetDocShell()->GetUndoManager();
String aUndo = ScGlobal::GetRscString( STR_UNDO_DOOUTLINE );
pMgr->EnterListAction( aUndo, aUndo );
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 3307398b5ef8..1d748246a1d6 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -763,7 +763,7 @@ void ScDrawView::DeleteMarked()
(void)pCaptObj; // prevent 'unused variable' compiler warning in pro builds
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : 0;
- SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0;
+ ::svl::IUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0;
bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled();
// remove the cell note from document, we are its owner now
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 848a0a3c7636..269017804c3c 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -1174,7 +1174,7 @@ void ScEditShell::GetUndoState(SfxItemSet &rSet)
EditView* pTopView = pHdl->GetTopView();
if (pTopView)
{
- SfxUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager();
+ ::svl::IUndoManager& rTopMgr = pTopView->GetEditEngine()->GetUndoManager();
if ( rTopMgr.GetUndoActionCount() == 0 )
rSet.DisableItem( SID_UNDO );
if ( rTopMgr.GetRedoActionCount() == 0 )
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3ff7222178f3..377ebed987f2 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -161,7 +161,7 @@ ScFormatShell::ScFormatShell(ScViewData* pData) :
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
SetPool( &pTabViewShell->GetPool() );
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0f07b8772254..d7f0be025574 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1884,7 +1884,7 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
if (nMouseStatus == SC_GM_WATERUNDO) // Undo im Giesskannenmodus
{
- SfxUndoManager* pMgr = pViewData->GetDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetDocShell()->GetUndoManager();
if ( pMgr->GetUndoActionCount() && pMgr->GetUndoActionId() == STR_UNDO_APPLYCELLSTYLE )
pMgr->Undo();
else
diff --git a/sc/source/ui/view/pgbrksh.cxx b/sc/source/ui/view/pgbrksh.cxx
index 0e792b2bb279..d5e3450f3e5a 100644
--- a/sc/source/ui/view/pgbrksh.cxx
+++ b/sc/source/ui/view/pgbrksh.cxx
@@ -67,7 +67,7 @@ ScPageBreakShell::ScPageBreakShell( ScTabViewShell* pViewSh ) :
{
SetPool( &pViewSh->GetPool() );
ScViewData* pViewData = pViewSh->GetViewData();
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx
index a65f86ffed2c..b7f2e2234438 100644
--- a/sc/source/ui/view/pivotsh.cxx
+++ b/sc/source/ui/view/pivotsh.cxx
@@ -76,7 +76,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) :
{
SetPool( &pViewSh->GetPool() );
ScViewData* pViewData = pViewSh->GetViewData();
- SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
if ( !pViewData->GetDocument()->IsUndoEnabled() )
{
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 4596880b7fb6..f23ed39b34c5 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1116,7 +1116,7 @@ BOOL ScTabViewShell::IsAuditShell() const
return ( pAuditingShell && ( GetMySubShell() == pAuditingShell ) );
}
-void ScTabViewShell::SetDrawTextUndo( SfxUndoManager* pNewUndoMgr )
+void ScTabViewShell::SetDrawTextUndo( ::svl::IUndoManager* pNewUndoMgr )
{
// Default: Undo-Manager der DocShell
if (!pNewUndoMgr)
@@ -1640,7 +1640,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
MakeDrawView( nForceDesignMode );
ViewOptionsHasChanged(FALSE); // legt auch evtl. DrawView an
- SfxUndoManager* pMgr = pDocSh->GetUndoManager();
+ ::svl::IUndoManager* pMgr = pDocSh->GetUndoManager();
SetUndoManager( pMgr );
pFormShell->SetUndoManager( pMgr );
if ( !pDoc->IsUndoEnabled() )
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 7734f3e24ff8..9700fe3dca3f 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -34,7 +34,6 @@
#define _ZFORLIST_DECLARE_TABLE
#include "scitems.hxx"
-#include <svl/slstitm.hxx>
#include <svl/stritem.hxx>
#include <svl/whiter.hxx>
#include <svl/zformat.hxx>
@@ -738,92 +737,6 @@ void __EXPORT ScTabViewShell::GetSaveState( SfxItemSet& rSet )
//------------------------------------------------------------------
-void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
-{
- SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0);
- SfxUndoManager* pUndoManager = pSh->GetUndoManager();
-
- const SfxItemSet* pReqArgs = rReq.GetArgs();
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
-
- USHORT nSlot = rReq.GetSlot();
- switch ( nSlot )
- {
- case SID_UNDO:
- case SID_REDO:
- if ( pUndoManager )
- {
- BOOL bIsUndo = ( nSlot == SID_UNDO );
-
- USHORT nCount = 1;
- const SfxPoolItem* pItem;
- if ( pReqArgs && pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET )
- nCount = ((const SfxUInt16Item*)pItem)->GetValue();
-
- // lock paint for more than one cell undo action (not for editing within a cell)
- BOOL bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() );
- if ( bLockPaint )
- pDocSh->LockPaint();
-
- for (USHORT i=0; i<nCount; i++)
- {
- if ( bIsUndo )
- pUndoManager->Undo(0);
- else
- pUndoManager->Redo(0);
- }
-
- if ( bLockPaint )
- pDocSh->UnlockPaint();
-
- GetViewFrame()->GetBindings().InvalidateAll(sal_False);
- }
- break;
-// default:
-// GetViewFrame()->ExecuteSlot( rReq );
- }
-}
-
-void ScTabViewShell::GetUndoState(SfxItemSet &rSet)
-{
- SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0);
- SfxUndoManager* pUndoManager = pSh->GetUndoManager();
-
- SfxWhichIter aIter(rSet);
- USHORT nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- switch (nWhich)
- {
- case SID_GETUNDOSTRINGS:
- case SID_GETREDOSTRINGS:
- {
- SfxStringListItem aStrLst( nWhich );
- if ( pUndoManager )
- {
- List* pList = aStrLst.GetList();
- BOOL bIsUndo = ( nWhich == SID_GETUNDOSTRINGS );
- USHORT nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount();
- for (USHORT i=0; i<nCount; i++)
- pList->Insert( new String( bIsUndo ? pUndoManager->GetUndoActionComment(i) :
- pUndoManager->GetRedoActionComment(i) ),
- LIST_APPEND );
- }
- rSet.Put( aStrLst );
- }
- break;
- default:
- // get state from sfx view frame
- GetViewFrame()->GetSlotState( nWhich, NULL, &rSet );
- }
-
- nWhich = aIter.NextWhich();
- }
-}
-
-
-//------------------------------------------------------------------
-
void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq )
{
ScViewOptions aViewOptions = GetViewData()->GetOptions();
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index c6d9b004b9ba..b13707a8378b 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -61,9 +61,11 @@
#include <sfx2/viewfrm.hxx>
#include <svtools/soerr.hxx>
#include <svl/rectitem.hxx>
+#include <svl/slstitm.hxx>
#include <svl/whiter.hxx>
#include <unotools/moduleoptions.hxx>
#include <sot/exchange.hxx>
+#include <tools/diagnose_ex.h>
#include "tabvwsh.hxx"
#include "globstr.hrc"
@@ -487,5 +489,98 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
}
+//------------------------------------------------------------------
+
+void ScTabViewShell::ExecuteUndo(SfxRequest& rReq)
+{
+ SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0);
+ ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager();
+
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+
+ USHORT nSlot = rReq.GetSlot();
+ switch ( nSlot )
+ {
+ case SID_UNDO:
+ case SID_REDO:
+ if ( pUndoManager )
+ {
+ BOOL bIsUndo = ( nSlot == SID_UNDO );
+
+ USHORT nCount = 1;
+ const SfxPoolItem* pItem;
+ if ( pReqArgs && pReqArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET )
+ nCount = ((const SfxUInt16Item*)pItem)->GetValue();
+
+ // lock paint for more than one cell undo action (not for editing within a cell)
+ BOOL bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() );
+ if ( bLockPaint )
+ pDocSh->LockPaint();
+
+ try
+ {
+ for (USHORT i=0; i<nCount; i++)
+ {
+ if ( bIsUndo )
+ pUndoManager->Undo();
+ else
+ pUndoManager->Redo();
+ }
+ }
+ catch ( const uno::Exception& )
+ {
+ // no need to handle. By definition, the UndoManager handled this by clearing the
+ // Undo/Redo stacks
+ }
+
+ if ( bLockPaint )
+ pDocSh->UnlockPaint();
+
+ GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+ }
+ break;
+// default:
+// GetViewFrame()->ExecuteSlot( rReq );
+ }
+}
+
+void ScTabViewShell::GetUndoState(SfxItemSet &rSet)
+{
+ SfxShell* pSh = GetViewData()->GetDispatcher().GetShell(0);
+ ::svl::IUndoManager* pUndoManager = pSh->GetUndoManager();
+
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ switch (nWhich)
+ {
+ case SID_GETUNDOSTRINGS:
+ case SID_GETREDOSTRINGS:
+ {
+ SfxStringListItem aStrLst( nWhich );
+ if ( pUndoManager )
+ {
+ List* pList = aStrLst.GetList();
+ BOOL bIsUndo = ( nWhich == SID_GETUNDOSTRINGS );
+ size_t nCount = bIsUndo ? pUndoManager->GetUndoActionCount() : pUndoManager->GetRedoActionCount();
+ for (size_t i=0; i<nCount; i++)
+ pList->Insert( new String( bIsUndo ? pUndoManager->GetUndoActionComment(i) :
+ pUndoManager->GetRedoActionComment(i) ),
+ LIST_APPEND );
+ }
+ rSet.Put( aStrLst );
+ }
+ break;
+ default:
+ // get state from sfx view frame
+ GetViewFrame()->GetSlotState( nWhich, NULL, &rSet );
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
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/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 37c1b0ab1e84..b192182a26aa 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -675,7 +675,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
// handle several sheets
- SfxUndoManager* pUndoManager = pDocSh->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager = pDocSh->GetUndoManager();
String aUndo = ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
pUndoManager->EnterListAction( aUndo, aUndo );
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index f7a126c2dac8..0dc77a19121c 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1009,7 +1009,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
ScDocument* pDoc = GetViewData()->GetDocument();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScMarkData& rMark = GetViewData()->GetMarkData();
- SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
+ ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager();
const BOOL bRecord(pDoc->IsUndoEnabled());
ScDocShellModificator aModificator( *pDocSh );
@@ -1635,7 +1635,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if (pDoc->IsUndoEnabled())
{
- SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
+ ::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager();
String aUndo = ScGlobal::GetRscString(
pClipDoc->IsCutMode() ? STR_UNDO_CUT : STR_UNDO_COPY);
pUndoMgr->EnterListAction(aUndo, aUndo);