summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-12-11 08:36:38 +0000
committerRüdiger Timm <rt@openoffice.org>2008-12-11 08:36:38 +0000
commita190965485508c4493ee33228dae68e12cd858f9 (patch)
treeb76399df5762f152857b7e0a7ba21069073c0430 /sc
parent37d9508882a6783c66adebf9fde0645a3d055b02 (diff)
CWS-TOOLING: integrate CWS calc47
2008-12-10 20:38:34 +0100 oc r265231 : #i97115# 2008-12-09 14:19:59 +0100 oc r265084 : #i96939# 2008-12-09 11:55:29 +0100 oc r265073 : #i97061# 2008-12-09 11:37:05 +0100 oc r265067 : #i97061# 2008-12-09 11:31:49 +0100 oc r265066 : #i97061# 2008-12-09 11:30:30 +0100 oc r265065 : #i97061# 2008-12-04 17:13:43 +0100 er r264859 : DBG_ERROR needs semicolon 2008-12-04 02:34:13 +0100 er r264811 : unxsols4 needs to be compiled with exceptions when using STL 2008-12-04 02:24:30 +0100 er r264810 : WaE unxsols4: ScZoomSliderWnd::Update hides the function Window::Update() 2008-12-04 01:40:22 +0100 er r264809 : DBG_ASSERT needs semicolon 2008-12-03 11:00:55 +0100 er r264753 : CWS-TOOLING: rebase CWS calc47 to trunk@264325 (milestone: DEV300:m36) 2008-10-31 12:30:09 +0100 nn r262863 : #i90362# call CheckNeedsRepaint in UpdateFormulas 2008-10-29 14:49:48 +0100 nn r262802 : #i88521# initialization order (gcc warning) 2008-10-29 12:31:38 +0100 nn r262782 : #i88521# toolbar entry for scaling factor in page preview (patch from maoyg) 2008-10-29 12:31:00 +0100 nn r262781 : #i88521# toolbar entry for scaling factor in page preview (patch from maoyg) 2008-10-29 12:28:45 +0100 nn r262780 : #i88521# toolbar entry for scaling factor in page preview (patch from maoyg) 2008-10-28 17:01:37 +0100 nn r262756 : resolve gcc warnings 2008-10-28 13:46:07 +0100 nn r262742 : #i9709# always use system encoding for DDE (patch from rail) 2008-10-28 13:45:44 +0100 nn r262741 : #i9709# always use system encoding for DDE (patch from rail) 2008-10-27 20:55:51 +0100 nn r262689 : #i44349# refresh auto filter flags in ScUndoDragDrop::Redo (patch from gaozm) 2008-10-27 20:40:06 +0100 nn r262688 : #i4517# rename sheet with double click (patch from kohei) 2008-10-27 20:28:55 +0100 nn r262687 : #i20491# ensure stable sorting (patch from maoyg) 2008-10-27 20:13:19 +0100 nn r262686 : #i22758# direct sort (toolbar buttons): detect headers (patch from maoyg) 2008-10-27 19:42:51 +0100 nn r262685 : #i7277# default for sorting is cursor column (patch from maoyg) 2008-10-27 19:18:57 +0100 nn r262684 : #i7088# insert/delete columns/rows across selected sheets (patch from maoyg) 2008-10-27 18:59:43 +0100 nn r262683 : #i86856# show formula syntax in tip help (patch from maoyg) 2008-10-27 18:30:45 +0100 nn r262682 : #i89145# scroll wheel handling in page preview (patch from maoyg) 2008-10-27 18:03:10 +0100 nn r262681 : #i85226# take care of subtotal formulas in ScUndoQuery::Undo (patch from gaozm) 2008-10-27 17:41:16 +0100 nn r262680 : #i88437# add zoom slider in status bar also for Calc (patch from maoyg) 2008-10-27 15:53:52 +0100 nn r262678 : #i88467# undo for page margins/column widths in page preview (patch from maoyg)
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/sc.hrc1
-rw-r--r--sc/sdi/prevwsh.sdi4
-rw-r--r--sc/sdi/scalc.sdi24
-rw-r--r--sc/sdi/tabvwsh.sdi1
-rw-r--r--sc/source/core/data/table3.cxx9
-rw-r--r--sc/source/core/tool/ddelink.cxx6
-rw-r--r--sc/source/ui/app/inputhdl.cxx575
-rw-r--r--sc/source/ui/app/scdll.cxx4
-rw-r--r--sc/source/ui/app/scmod.cxx19
-rw-r--r--sc/source/ui/app/typemap.cxx1
-rw-r--r--sc/source/ui/cctrl/makefile.mk9
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx558
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx10
-rw-r--r--sc/source/ui/docshell/docfunc.cxx523
-rw-r--r--sc/source/ui/docshell/docsh3.cxx8
-rw-r--r--sc/source/ui/inc/docfunc.hxx6
-rw-r--r--sc/source/ui/inc/inputhdl.hxx5
-rw-r--r--sc/source/ui/inc/prevwsh.hxx1
-rw-r--r--sc/source/ui/inc/tbzoomsliderctrl.hxx95
-rw-r--r--sc/source/ui/inc/undoblk.hxx14
-rw-r--r--sc/source/ui/undo/undoblk.cxx230
-rw-r--r--sc/source/ui/undo/undodat.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx4
-rw-r--r--sc/source/ui/unoobj/docuno.cxx8
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx1
-rw-r--r--sc/source/ui/view/cellsh2.cxx16
-rw-r--r--sc/source/ui/view/gridwin.cxx10
-rw-r--r--sc/source/ui/view/preview.cxx157
-rw-r--r--sc/source/ui/view/prevwsh.cxx354
-rw-r--r--sc/source/ui/view/tabcont.cxx5
-rw-r--r--sc/source/ui/view/tabview.cxx5
-rw-r--r--sc/source/ui/view/tabview3.cxx1
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx30
-rw-r--r--sc/source/ui/view/tabvwsha.cxx20
-rw-r--r--sc/source/ui/view/viewfunc.cxx6
-rw-r--r--sc/uiconfig/scalc/statusbar/statusbar.xml5
-rw-r--r--sc/uiconfig/scalc/toolbar/previewbar.xml4
37 files changed, 2221 insertions, 512 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index a1c4fc575167..7e78911dd994 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -919,6 +919,7 @@
#define SID_PREVIEW_ZOOMOUT (SID_PREVIEW_START+6)
#define SID_PREVIEW_CLOSE (SID_PREVIEW_START+7)
#define SID_PREVIEW_MARGIN (SID_PREVIEW_START+8)
+#define SID_PREVIEW_SCALINGFACTOR (SID_PREVIEW_START+9)
#define SID_PREVIEW_END (SID_PREVIEW_START+20)
//aus sfx: #define SID_KEYFUNC_START (SID_PREVIEW_END+5)
diff --git a/sc/sdi/prevwsh.sdi b/sc/sdi/prevwsh.sdi
index be4f8de9daa5..484fd5fa8f22 100644
--- a/sc/sdi/prevwsh.sdi
+++ b/sc/sdi/prevwsh.sdi
@@ -41,7 +41,9 @@ interface TablePrintPreview : View
SID_PREVIEW_PREVIOUS [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PREVIEW_FIRST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PREVIEW_LAST [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
- SID_PREVIEW_MARGIN [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+ SID_PREVIEW_MARGIN [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+ SID_PREVIEW_SCALINGFACTOR [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
+ SID_ATTR_ZOOMSLIDER [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SfxVoidItem GoUpBlock SID_CURSORPAGEUP
(
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index a1c8a94a35ad..73b52bf11f3b 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -7625,6 +7625,30 @@ SfxVoidItem Margins SID_PREVIEW_MARGIN
]
//--------------------------------------------------------------------------
+SvxZoomSliderItem ScalingFactor SID_PREVIEW_SCALINGFACTOR
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
SfxVoidItem SelectTables SID_SELECT_TABLES
(SfxIntegerListItem Tables SID_SELECT_TABLES)
[
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 341508ba5b92..3c0cd7c75b4d 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -170,6 +170,7 @@ interface TableEditView : View
// hat zwar ein SW im Namen, wird aber im Calc auch gebraucht
SID_CREATE_SW_DRAWVIEW [ ExecMethod = Execute; ]
SID_ATTR_ZOOM [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_ATTR_ZOOMSLIDER [ ExecMethod = Execute; StateMethod = GetState; ]
FID_INSERT_FILE [ ExecMethod = Execute; StateMethod = GetState; ]
// Save / SaveAs ueberladen, um die Eingabe abzuschliessen
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 3b3aa9c59aeb..8cd0a911831b 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -365,6 +365,15 @@ short ScTable::Compare( ScSortInfoArray* pArray, SCCOLROW nIndex1, SCCOLROW nInd
pInfo1->pCell, static_cast<SCCOL>(pInfo1->nOrg), aSortParam.nField[nSort],
pInfo2->pCell, static_cast<SCCOL>(pInfo2->nOrg), aSortParam.nField[nSort] );
} while ( nRes == 0 && ++nSort < pArray->GetUsedSorts() );
+ if( nRes == 0 )
+ {
+ ScSortInfo* pInfo1 = pArray->Get( 0, nIndex1 );
+ ScSortInfo* pInfo2 = pArray->Get( 0, nIndex2 );
+ if( pInfo1->nOrg < pInfo2->nOrg )
+ nRes = -1;
+ else if( pInfo1->nOrg > pInfo2->nOrg )
+ nRes = 1;
+ }
return nRes;
}
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 7a8850fb2c76..cab3322401a8 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -51,11 +51,7 @@
TYPEINIT2(ScDdeLink,::sfx2::SvBaseLink,SfxBroadcaster);
-#ifdef PM2
-#define DDE_TXT_ENCODING RTL_TEXTENCODING_IBM_850
-#else
-#define DDE_TXT_ENCODING RTL_TEXTENCODING_MS_1252
-#endif
+#define DDE_TXT_ENCODING gsl_getSystemTextEncoding()
BOOL ScDdeLink::bIsInUpdate = FALSE;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2a870f5227b5..4f35841b70f6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -311,6 +311,98 @@ void lcl_RemoveLineEnd(String& rStr)
rStr.SetChar( nPos, ' ' );
}
+xub_StrLen lcl_MatchParenthesis( const String& rStr, xub_StrLen nPos )
+{
+ int nDir;
+ sal_Unicode c1, c2 = 0;
+ c1 = rStr.GetChar( nPos );
+ switch ( c1 )
+ {
+ case '(' :
+ c2 = ')';
+ nDir = 1;
+ break;
+ case ')' :
+ c2 = '(';
+ nDir = -1;
+ break;
+ case '<' :
+ c2 = '>';
+ nDir = 1;
+ break;
+ case '>' :
+ c2 = '<';
+ nDir = -1;
+ break;
+ case '{' :
+ c2 = '}';
+ nDir = 1;
+ break;
+ case '}' :
+ c2 = '{';
+ nDir = -1;
+ break;
+ case '[' :
+ c2 = ']';
+ nDir = 1;
+ break;
+ case ']' :
+ c2 = '[';
+ nDir = -1;
+ break;
+ default:
+ nDir = 0;
+ }
+ if ( !nDir )
+ return STRING_NOTFOUND;
+ xub_StrLen nLen = rStr.Len();
+ const sal_Unicode* p0 = rStr.GetBuffer();
+ register const sal_Unicode* p;
+ const sal_Unicode* p1;
+ USHORT nQuotes = 0;
+ if ( nPos < nLen / 2 )
+ {
+ p = p0;
+ p1 = p0 + nPos;
+ }
+ else
+ {
+ p = p0 + nPos;
+ p1 = p0 + nLen;
+ }
+ while ( p < p1 )
+ {
+ if ( *p++ == '\"' )
+ nQuotes++;
+ }
+ // Odd number of quotes that we find ourselves in a string
+ BOOL bLookInString = ((nQuotes % 2) != 0);
+ BOOL bInString = bLookInString;
+ p = p0 + nPos;
+ p1 = (nDir < 0 ? p0 : p0 + nLen) ;
+ USHORT nLevel = 1;
+ while ( p != p1 && nLevel )
+ {
+ p += nDir;
+ if ( *p == '\"' )
+ {
+ bInString = !bInString;
+ if ( bLookInString && !bInString )
+ p = p1; //That's it then
+ }
+ else if ( bInString == bLookInString )
+ {
+ if ( *p == c1 )
+ nLevel++;
+ else if ( *p == c2 )
+ nLevel--;
+ }
+ }
+ if ( nLevel )
+ return STRING_NOTFOUND;
+ return (xub_StrLen) (p - p0);
+}
+
//==================================================================
ScInputHandler::ScInputHandler()
@@ -320,7 +412,9 @@ ScInputHandler::ScInputHandler()
pTopView( NULL ),
pColumnData( NULL ),
pFormulaData( NULL ),
+ pFormulaDataPara( NULL ),
nTipVisible( 0 ),
+ nTipVisibleSec( 0 ),
nAutoPos( SCPOS_INVALID ),
bUseTab( FALSE ),
bTextValid( TRUE ),
@@ -379,6 +473,7 @@ __EXPORT ScInputHandler::~ScInputHandler()
delete pDelayTimer;
delete pColumnData;
delete pFormulaData;
+ delete pFormulaDataPara;
}
void ScInputHandler::SetRefScale( const Fraction& rX, const Fraction& rY )
@@ -535,16 +630,21 @@ void ScInputHandler::GetFormulaData()
else
pFormulaData = new TypedStrCollection;
+ if( pFormulaDataPara )
+ pFormulaDataPara->FreeAll();
+ else
+ pFormulaDataPara = new TypedStrCollection;
+
// MRU-Funktionen aus dem Funktions-Autopiloten
// wie in ScPosWnd::FillFunctions (inputwin.cxx)
const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
USHORT nMRUCount = rOpt.GetLRUFuncListCount();
const USHORT* pMRUList = rOpt.GetLRUFuncList();
+ const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
+ ULONG nListCount = pFuncList->GetCount();
if (pMRUList)
{
- const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
- ULONG nListCount = pFuncList->GetCount();
for (USHORT i=0; i<nMRUCount; i++)
{
USHORT nId = pMRUList[i];
@@ -563,8 +663,20 @@ void ScInputHandler::GetFormulaData()
}
}
}
-
+ for(ULONG i=0;i<nListCount;i++)
+ {
+ const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
+ if ( pDesc->pFuncName )
+ {
+ pDesc->InitArgumentInfo();
+ String aEntry = pDesc->GetSignature();
+ TypedStrData* pData = new TypedStrData( aEntry, 0.0, SC_STRTYPE_FUNCTIONS );
+ if (!pFormulaDataPara->Insert(pData))
+ delete pData;
+ }
+ }
pDoc->GetFormulaEntries( *pFormulaData );
+ pDoc->GetFormulaEntries( *pFormulaDataPara );
}
}
@@ -577,6 +689,189 @@ void ScInputHandler::HideTip()
}
aManualTip.Erase();
}
+void ScInputHandler::HideTipBelow()
+{
+ if ( nTipVisibleSec )
+ {
+ Help::HideTip( nTipVisibleSec );
+ nTipVisibleSec = 0;
+ }
+ aManualTip.Erase();
+}
+
+void ScInputHandler::ShowTipCursor()
+{
+ HideTip();
+ HideTipBelow();
+ EditView* pActiveView = pTopView ? pTopView : pTableView;
+
+ if ( bFormulaMode && pActiveView && pFormulaDataPara && pEngine->GetParagraphCount() == 1 )
+ {
+ String aFormula = pEngine->GetText( (USHORT) 0 );
+ ESelection aSel = pActiveView->GetSelection();
+ aSel.Adjust();
+ xub_StrLen nLeftParentPos = 0;
+ if( aSel.nEndPos )
+ {
+ if ( aFormula.Len() < aSel.nEndPos )
+ return;
+ xub_StrLen nPos = aSel.nEndPos;
+ String aSelText = aFormula.Copy( 0, nPos );
+ xub_StrLen nNextFStart = 0;
+ xub_StrLen nNextFEnd = 0;
+ xub_StrLen nArgPos = 0;
+ const ScFuncDesc* ppFDesc;
+ String** pppArgs;
+ USHORT nArgs;
+ BOOL bFound = FALSE;
+
+ while( !bFound )
+ {
+ aSelText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) );
+ nLeftParentPos = lcl_MatchParenthesis( aSelText, aSelText.Len()-1 );
+ if( nLeftParentPos != STRING_NOTFOUND )
+ {
+ sal_Unicode c = aSelText.GetChar( nLeftParentPos-1 );
+ if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
+ continue;
+ nNextFStart = ScFormulaUtil::GetFunctionStart( aSelText, nLeftParentPos, TRUE);
+ if( ScFormulaUtil::GetNextFunc( aSelText, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &pppArgs ) )
+ {
+ if( ppFDesc->pFuncName )
+ {
+ nArgPos = ScFormulaUtil::GetArgStart( aSelText, nNextFStart, 0 );
+ nArgs = ppFDesc->nArgCount;
+
+ USHORT nActive = 0;
+ USHORT nCount = 0;
+ USHORT nCountSemicolon = 0;
+ USHORT nCountDot = 0;
+ USHORT nStartPosition = 0;
+ USHORT nEndPosition = 0;
+ BOOL bFlag = FALSE;
+ String aNew;
+ USHORT nParAutoPos = SCPOS_INVALID;
+ if( pFormulaDataPara->FindText( *(ppFDesc->pFuncName), aNew, nParAutoPos, FALSE ) )
+ {
+ for( USHORT i=0; i < nArgs; i++ )
+ {
+ xub_StrLen nLength=(pppArgs[i])->Len();
+ if( nArgPos <= aSelText.Len()-1 )
+ {
+ nActive = i+1;
+ bFlag = TRUE;
+ }
+ nArgPos+=nLength+1;
+ }
+ if( bFlag )
+ {
+ nCountSemicolon = aNew.GetTokenCount(';')-1;
+ nCountDot = aNew.GetTokenCount('.')-1;
+
+ if( !nCountSemicolon )
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ }
+ }
+ else if( !nCountDot )
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ else if( cNext == ';' )
+ {
+ nCount ++;
+ nEndPosition = i;
+ if( nCount == nActive )
+ {
+ break;
+ }
+ nStartPosition = nEndPosition+1;
+ }
+ }
+ }
+ else
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ else if( cNext == ';' )
+ {
+ nCount ++;
+ nEndPosition = i;
+ if( nCount == nActive )
+ {
+ break;
+ }
+ nStartPosition = nEndPosition+1;
+ }
+ else if( cNext == '.' )
+ {
+ continue;
+ }
+ }
+ }
+
+ if( nStartPosition )
+ {
+ aNew.Insert( 0x25BA, nStartPosition );
+ ShowTipBelow( aNew );
+ bFound = TRUE;
+ }
+ }
+ else
+ {
+ ShowTipBelow( aNew );
+ bFound = TRUE;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ USHORT nPosition = 0;
+ String aText = pEngine->GetWord( 0, aSel.nEndPos-1 );
+ if( aText.GetChar( aSel.nEndPos-1 ) == '=' )
+ {
+ break;
+ }
+ String aNew;
+ USHORT nParAutoPos = SCPOS_INVALID;
+ nPosition = aText.Len()+1;
+ if( pFormulaDataPara->FindText( aText, aNew, nParAutoPos, FALSE ) )
+ {
+ if( aFormula.GetChar( nPosition ) =='(' )
+ {
+ ShowTipBelow( aNew );
+ bFound = TRUE;
+ }
+ else
+ break;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+}
void ScInputHandler::ShowTip( const String& rText )
{
@@ -599,6 +894,29 @@ void ScInputHandler::ShowTip( const String& rText )
}
}
+void ScInputHandler::ShowTipBelow( const String& rText )
+{
+ HideTipBelow();
+
+ EditView* pActiveView = pTopView ? pTopView : pTableView;
+ if ( pActiveView )
+ {
+ Point aPos;
+ Window* pWin = pActiveView->GetWindow();
+ Cursor* pCur = pActiveView->GetCursor();
+ if ( pCur )
+ {
+ Point aLogicPos = pCur->GetPos();
+ aLogicPos.Y() += pCur->GetHeight();
+ aPos = pWin->LogicToPixel( aLogicPos );
+ }
+ aPos = pWin->OutputToScreenPixel( aPos );
+ Rectangle aRect( aPos, aPos );
+ USHORT nAlign = QUICKHELP_LEFT | QUICKHELP_TOP;
+ nTipVisibleSec = Help::ShowTip(pWin, aRect, rText, nAlign);
+ }
+}
+
void ScInputHandler::UseFormulaData()
{
EditView* pActiveView = pTopView ? pTopView : pTableView;
@@ -619,19 +937,147 @@ void ScInputHandler::UseFormulaData()
// steht der Cursor am Ende eines Wortes?
- if ( aSel.nEndPos > 0 && (
- aSel.nEndPos == aTotal.Len() ||
- pEngine->GetWordDelimiters().Search( aTotal.GetChar(aSel.nEndPos) ) != STRING_NOTFOUND ) )
+ if ( aSel.nEndPos > 0 )
{
+ xub_StrLen nPos = aSel.nEndPos;
+ String aFormula = aTotal.Copy( 0, nPos );;
+ xub_StrLen nLeftParentPos = 0;
+ xub_StrLen nNextFStart = 0;
+ xub_StrLen nNextFEnd = 0;
+ xub_StrLen nArgPos = 0;
+ const ScFuncDesc* ppFDesc;
+ String** pppArgs;
+ USHORT nArgs;
+ BOOL bFound = FALSE;
+
String aText = pEngine->GetWord( 0, aSel.nEndPos-1 );
- if (aText.Len())
+ if ( aText.Len() )
{
String aNew;
- nAutoPos = SCPOS_INVALID; // nix
+ nAutoPos = SCPOS_INVALID;
if ( pFormulaData->FindText( aText, aNew, nAutoPos, FALSE ) )
{
- ShowTip( aNew ); // als QuickHelp anzeigen
- aAutoSearch = aText; // zum Weitersuchen - nAutoPos ist gesetzt
+ ShowTip( aNew );
+ aAutoSearch = aText;
+ }
+ }
+
+ while( !bFound )
+ {
+ aFormula.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) );
+ nLeftParentPos = lcl_MatchParenthesis( aFormula, aFormula.Len()-1 );
+ if( nLeftParentPos == STRING_NOTFOUND )
+ break;
+
+ sal_Unicode c = aFormula.GetChar( nLeftParentPos-1 );
+ if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
+ continue;
+ nNextFStart = ScFormulaUtil::GetFunctionStart( aFormula, nLeftParentPos, TRUE);
+ if( ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &pppArgs ) )
+ {
+ if( ppFDesc->pFuncName )
+ {
+ nArgPos = ScFormulaUtil::GetArgStart( aFormula, nNextFStart, 0 );
+ nArgs = ppFDesc->nArgCount;
+
+ USHORT nActive = 0;
+ USHORT nCount = 0;
+ USHORT nCountSemicolon = 0;
+ USHORT nCountDot = 0;
+ USHORT nStartPosition = 0;
+ USHORT nEndPosition = 0;
+ BOOL bFlag = FALSE;
+ String aNew;
+ USHORT nParAutoPos = SCPOS_INVALID;
+ if( pFormulaDataPara->FindText( *(ppFDesc->pFuncName), aNew, nParAutoPos, FALSE ) )
+ {
+ for( USHORT i=0; i < nArgs; i++ )
+ {
+ xub_StrLen nLength=(pppArgs[i])->Len();
+ if( nArgPos <= aFormula.Len()-1 )
+ {
+ nActive = i+1;
+ bFlag = TRUE;
+ }
+ nArgPos+=nLength+1;
+ }
+ if( bFlag )
+ {
+ nCountSemicolon = aNew.GetTokenCount(';')-1;
+ nCountDot = aNew.GetTokenCount('.')-1;
+
+ if( !nCountSemicolon )
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ }
+ }
+ else if( !nCountDot )
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ else if( cNext == ';' )
+ {
+ nCount ++;
+ nEndPosition = i;
+ if( nCount == nActive )
+ {
+ break;
+ }
+ nStartPosition = nEndPosition+1;
+ }
+ }
+ }
+ else
+ {
+ for( USHORT i = 0; i < aNew.Len(); i++ )
+ {
+ sal_Unicode cNext = aNew.GetChar( i );
+ if( cNext == '(' )
+ {
+ nStartPosition = i+1;
+ }
+ else if( cNext == ';' )
+ {
+ nCount ++;
+ nEndPosition = i;
+ if( nCount == nActive )
+ {
+ break;
+ }
+ nStartPosition = nEndPosition+1;
+ }
+ else if( cNext == '.' )
+ {
+ continue;
+ }
+ }
+ }
+
+ if( nStartPosition )
+ {
+ aNew.Insert( 0x25BA, nStartPosition );
+ ShowTipBelow( aNew );
+ bFound = TRUE;
+ }
+ }
+ else
+ {
+ ShowTipBelow( aNew );
+ bFound = TRUE;
+ }
+ }
+ }
}
}
}
@@ -712,6 +1158,7 @@ void ScInputHandler::PasteFunctionData()
lcl_CompleteFunction( pTopView, aInsert, bParInserted );
lcl_CompleteFunction( pTableView, aInsert, bParInserted );
DataChanged();
+ ShowTipCursor();
if (bParInserted)
AutoParAdded();
@@ -1097,98 +1544,6 @@ void ScInputHandler::NextAutoEntry( BOOL bBack )
// Klammern hervorheben
//
-xub_StrLen lcl_MatchParenthesis( const String& rStr, xub_StrLen nPos )
-{
- int nDir;
- sal_Unicode c1, c2 = 0;
- c1 = rStr.GetChar( nPos );
- switch ( c1 )
- {
- case '(' :
- c2 = ')';
- nDir = 1;
- break;
- case ')' :
- c2 = '(';
- nDir = -1;
- break;
- case '<' :
- c2 = '>';
- nDir = 1;
- break;
- case '>' :
- c2 = '<';
- nDir = -1;
- break;
- case '{' :
- c2 = '}';
- nDir = 1;
- break;
- case '}' :
- c2 = '{';
- nDir = -1;
- break;
- case '[' :
- c2 = ']';
- nDir = 1;
- break;
- case ']' :
- c2 = '[';
- nDir = -1;
- break;
- default:
- nDir = 0;
- }
- if ( !nDir )
- return STRING_NOTFOUND;
- xub_StrLen nLen = rStr.Len();
- const sal_Unicode* p0 = rStr.GetBuffer();
- register const sal_Unicode* p;
- const sal_Unicode* p1;
- USHORT nQuotes = 0;
- if ( nPos < nLen / 2 )
- {
- p = p0;
- p1 = p0 + nPos;
- }
- else
- {
- p = p0 + nPos;
- p1 = p0 + nLen;
- }
- while ( p < p1 )
- {
- if ( *p++ == '\"' )
- nQuotes++;
- }
- // ungerade Anzahl Quotes: wir befinden uns in einem String
- BOOL bLookInString = ((nQuotes % 2) != 0);
- BOOL bInString = bLookInString;
- p = p0 + nPos;
- p1 = (nDir < 0 ? p0 : p0 + nLen) ;
- USHORT nLevel = 1;
- while ( p != p1 && nLevel )
- {
- p += nDir;
- if ( *p == '\"' )
- {
- bInString = !bInString;
- if ( bLookInString && !bInString )
- p = p1; // das war's dann
- }
- else if ( bInString == bLookInString )
- {
- if ( *p == c1 )
- nLevel++;
- else if ( *p == c2 )
- nLevel--;
- }
- }
- if ( nLevel )
- return STRING_NOTFOUND;
- return (xub_StrLen) (p - p0);
-}
-
void ScInputHandler::UpdateParenthesis()
{
// Klammern suchen
@@ -2663,6 +3018,11 @@ BOOL ScInputHandler::KeyInput( const KeyEvent& rKEvt, BOOL bStartEdit /* = FALSE
HideTip();
bUsed = TRUE;
}
+ else if( nTipVisibleSec )
+ {
+ HideTipBelow();
+ bUsed = TRUE;
+ }
else if (eMode != SC_INPUT_NONE)
{
CancelHandler();
@@ -2689,6 +3049,7 @@ BOOL ScInputHandler::KeyInput( const KeyEvent& rKEvt, BOOL bStartEdit /* = FALSE
( eMode != SC_INPUT_NONE && ( bCursorKey || bInsKey ) ) ) )
{
HideTip();
+ HideTipBelow();
if (bSelIsRef)
{
@@ -2783,7 +3144,7 @@ BOOL ScInputHandler::KeyInput( const KeyEvent& rKEvt, BOOL bStartEdit /* = FALSE
// when the selection is changed manually or an opening parenthesis
// is typed, stop overwriting parentheses
- if ( bUsed && ( nChar == '(' || bCursorKey ) )
+ if ( bUsed && nChar == '(' )
ResetAutoPar();
if ( KEY_INSERT == nCode )
@@ -2792,6 +3153,10 @@ BOOL ScInputHandler::KeyInput( const KeyEvent& rKEvt, BOOL bStartEdit /* = FALSE
if (pViewFrm)
pViewFrm->GetBindings().Invalidate( SID_ATTR_INSERT );
}
+ if( bUsed && bFormulaMode && ( bCursorKey || bInsKey || nCode == KEY_DELETE || nCode == KEY_BACKSPACE ) )
+ {
+ ShowTipCursor();
+ }
}
DataChanged(); // ruft auch UpdateParenthesis()
@@ -2837,6 +3202,7 @@ BOOL ScInputHandler::InputCommand( const CommandEvent& rCEvt, BOOL bForce )
}
HideTip();
+ HideTipBelow();
if ( bSelIsRef )
{
@@ -3097,6 +3463,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
}
HideTip();
+ HideTipBelow();
bInOwnChange = FALSE;
}
@@ -3155,7 +3522,7 @@ IMPL_LINK( ScInputHandler, DelayTimer, Timer*, pTimer )
void ScInputHandler::InputSelection( EditView* pView )
{
SyncViews( pView );
-
+ ShowTipCursor();
UpdateParenthesis(); // Selektion geaendert -> Klammer-Hervorhebung neu
// when the selection is changed manually, stop overwriting parentheses
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index e817f2345551..8bae4f1762d4 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -108,6 +108,8 @@
#include <svx/verttexttbxctrl.hxx>
#include <svx/formatpaintbrushctrl.hxx>
#include "tbinsert.hxx"
+#include "tbzoomsliderctrl.hxx"
+#include <svx/zoomsliderctrl.hxx>
#include <svx/xmlsecctrl.hxx>
// Child-Windows
@@ -215,6 +217,7 @@ void ScDLL::Init()
ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSERT, pMod);
ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSOBJ, pMod);
+ ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
// Svx-Toolbox-Controller
SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod);
@@ -267,6 +270,7 @@ void ScDLL::Init()
SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
SvxSelectionModeControl ::RegisterControl(SID_STATUS_SELMODE, pMod);
SvxZoomStatusBarControl ::RegisterControl(SID_ATTR_ZOOM, pMod);
+ SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod);
SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod);
XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod );
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 09477881f9a9..7de6580f22c0 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -70,6 +70,7 @@
#include <svx/zoomctrl.hxx>
#include <svx/modctrl.hxx>
#include <svx/pszctrl.hxx>
+#include <svx/zoomsliderctrl.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/inethist.hxx>
#include <vcl/waitobj.hxx>
@@ -389,12 +390,6 @@ void ScModule::FillStatusBar(StatusBar& rStatusBar)
SIB_LEFT|SIB_AUTOSIZE );
rStatusBar.SetHelpId( SID_STATUS_PAGESTYLE, SID_STATUS_PAGESTYLE );
- // Ma"sstab
- rStatusBar.InsertItem( SID_ATTR_ZOOM,
- SvxZoomStatusBarControl::GetDefItemWidth(rStatusBar),
- SIB_CENTER );
- rStatusBar.SetHelpId( SID_ATTR_ZOOM, SID_ATTR_ZOOM );
-
// Einfuege-/Ueberschreibmodus
rStatusBar.InsertItem( SID_ATTR_INSERT,
SvxInsertStatusBarControl::GetDefItemWidth(rStatusBar),
@@ -423,6 +418,18 @@ void ScModule::FillStatusBar(StatusBar& rStatusBar)
SvxPosSizeStatusBarControl::GetDefItemWidth(rStatusBar),
SIB_AUTOSIZE|SIB_LEFT|SIB_USERDRAW);
rStatusBar.SetHelpId( SID_ATTR_SIZE, SID_ATTR_SIZE );
+
+ // Ma"sstab
+ rStatusBar.InsertItem( SID_ATTR_ZOOM,
+ SvxZoomStatusBarControl::GetDefItemWidth(rStatusBar),
+ SIB_CENTER );
+ rStatusBar.SetHelpId( SID_ATTR_ZOOM, SID_ATTR_ZOOM );
+
+ // ZoomSlider
+ rStatusBar.InsertItem( SID_ATTR_ZOOMSLIDER,
+ TEXT_WIDTH( String().Fill( 15, 'X' ) ),
+ SIB_CENTER );
+ rStatusBar.SetHelpId( SID_ATTR_ZOOMSLIDER, SID_ATTR_ZOOMSLIDER );
}
#undef TEXT_WIDTH
diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx
index 42bf1ec6f47e..eedfab338844 100644
--- a/sc/source/ui/app/typemap.cxx
+++ b/sc/source/ui/app/typemap.cxx
@@ -120,6 +120,7 @@
#include <svtools/ilstitem.hxx>
#include <svtools/globalnameitem.hxx>
#include <svx/chrtitem.hxx>
+#include <svx/zoomslideritem.hxx>
// #i25616#
#include <svx/sdshitm.hxx>
diff --git a/sc/source/ui/cctrl/makefile.mk b/sc/source/ui/cctrl/makefile.mk
index 1921077f8571..e7b96afd7b9a 100644
--- a/sc/source/ui/cctrl/makefile.mk
+++ b/sc/source/ui/cctrl/makefile.mk
@@ -44,17 +44,22 @@ LIBTARGET=NO
# --- Files --------------------------------------------------------
+EXCEPTIONSFILES= \
+ $(SLO)$/tbzoomsliderctrl.obj
+
SLOFILES = \
$(SLO)$/popmenu.obj \
$(SLO)$/tbinsert.obj \
$(SLO)$/cbuttonw.obj \
- $(SLO)$/editfield.obj
+ $(SLO)$/editfield.obj \
+ $(EXCEPTIONSFILES)
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES= \
$(SLO)$/popmenu.obj \
$(SLO)$/tbinsert.obj \
- $(SLO)$/cbuttonw.obj
+ $(SLO)$/cbuttonw.obj \
+ $(SLO)$/tbzoomsliderctrl.obj
# --- Tagets -------------------------------------------------------
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
new file mode 100644
index 000000000000..437c63113253
--- /dev/null
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -0,0 +1,558 @@
+/*************************************************************************
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: tbzoomsliderctrl.cxx,v $
+*
+* $Revision: 1.1 $
+*
+* last change: $Author: maoyg $ $Date: 2008/04/25 10:08:08 $
+*
+* The Contents of this file are made available subject to
+* the terms of GNU Lesser General Public License Version 2.1.
+*
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2005 by Sun Microsystems, Inc.
+* 901 San Antonio Road, Palo Alto, CA 94303, USA
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+* MA 02111-1307 USA
+*
+************************************************************************/
+#include "precompiled_sc.hxx"
+#ifndef _SC_ZOOMSLIDERTBCONTRL_HXX
+#include "tbzoomsliderctrl.hxx"
+#endif
+#ifndef _SV_IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#ifndef _SV_TOOLBOX_HXX
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <vcl/gradient.hxx>
+#endif
+#include <svtools/itemset.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <set>
+#include "docsh.hxx"
+#include "stlpool.hxx"
+#include "scitems.hxx"
+#include "printfun.hxx"
+
+//========================================================================
+// class ScZoomSliderControl ---------------------------------------
+//========================================================================
+
+// -----------------------------------------------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( ScZoomSliderControl, SvxZoomSliderItem );
+
+// -----------------------------------------------------------------------
+
+ScZoomSliderControl::ScZoomSliderControl(
+ USHORT nSlotId,
+ USHORT nId,
+ ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT ScZoomSliderControl::~ScZoomSliderControl()
+{
+
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderControl::StateChanged( USHORT /*nSID*/, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ USHORT nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ ScZoomSliderWnd* pBox = (ScZoomSliderWnd*)(rTbx.GetItemWindow( nId ));
+ DBG_ASSERT( pBox ,"Control not found!" );
+
+ if ( SFX_ITEM_AVAILABLE != eState || pState->ISA( SfxVoidItem ) )
+ {
+ SvxZoomSliderItem aZoomSliderItem( 100 );
+ pBox->Disable();
+ pBox->UpdateFromItem( &aZoomSliderItem );
+ }
+ else
+ {
+ pBox->Enable();
+ DBG_ASSERT( pState->ISA( SvxZoomSliderItem ), "invalid item type" );
+ const SvxZoomSliderItem* pZoomSliderItem = dynamic_cast< const SvxZoomSliderItem* >( pState );
+
+ DBG_ASSERT( pZoomSliderItem, "Sc::ScZoomSliderControl::StateChanged(), wrong item type!" );
+ if( pZoomSliderItem )
+ pBox->UpdateFromItem( pZoomSliderItem );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Window* ScZoomSliderControl::CreateItemWindow( Window *pParent )
+{
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ ScDocShell* pDocShell = (ScDocShell*)pViewFrame->GetObjectShell();
+ SCTAB nTab = ScDocShell::GetCurTab();
+ ScDocument* pDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
+ USHORT nCurrentZoom = 0;
+ if ( pStyleSheet )
+ {
+ SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
+ nCurrentZoom = ((const SfxUInt16Item&)rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue();
+ }
+ ScZoomSliderWnd* pSlider = new ScZoomSliderWnd( pParent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(),
+ ::com::sun::star::uno::UNO_QUERY ), m_xFrame, nCurrentZoom ? nCurrentZoom : 100 );
+ return pSlider;
+}
+
+// -----------------------------------------------------------------------
+
+struct ScZoomSliderWnd::ScZoomSliderWnd_Impl
+{
+ USHORT mnCurrentZoom;
+ USHORT mnMinZoom;
+ USHORT mnMaxZoom;
+ USHORT mnSliderCenter;
+ std::vector< long > maSnappingPointOffsets;
+ std::vector< USHORT > maSnappingPointZooms;
+ Image maSliderButton;
+ Image maIncreaseButton;
+ Image maDecreaseButton;
+ bool mbValuesSet;
+ bool mbOmitPaint;
+
+ ScZoomSliderWnd_Impl( USHORT nCurrentZoom ) :
+ mnCurrentZoom( nCurrentZoom ),
+ mnMinZoom( 10 ),
+ mnMaxZoom( 400 ),
+ mnSliderCenter( 100 ),
+ maSnappingPointOffsets(),
+ maSnappingPointZooms(),
+ maSliderButton(),
+ maIncreaseButton(),
+ maDecreaseButton(),
+ mbValuesSet( true ),
+ mbOmitPaint( false )
+ {
+
+ }
+};
+
+// -----------------------------------------------------------------------
+
+const long nButtonWidth = 10;
+const long nButtonHeight = 10;
+const long nIncDecWidth = 11;
+const long nIncDecHeight = 11;
+const long nSliderHeight = 2; //
+const long nSliderWidth = 4; //
+const long nSnappingHeight = 4;
+const long nSliderXOffset = 20;
+const long nSnappingEpsilon = 5; // snapping epsilon in pixels
+const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points
+
+
+// -----------------------------------------------------------------------
+
+USHORT ScZoomSliderWnd::Offset2Zoom( long nOffset ) const
+{
+ Size aSliderWindowSize = GetOutputSizePixel();
+ const long nControlWidth = aSliderWindowSize.Width();
+ USHORT nRet = 0;
+
+ if( nOffset < nSliderXOffset )
+ return mpImpl->mnMinZoom;
+ if( nOffset > nControlWidth - nSliderXOffset )
+ return mpImpl->mnMaxZoom;
+
+ // check for snapping points:
+ USHORT nCount = 0;
+ std::vector< long >::iterator aSnappingPointIter;
+ for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
+ aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
+ ++aSnappingPointIter )
+ {
+ const long nCurrent = *aSnappingPointIter;
+ if ( Abs(nCurrent - nOffset) < nSnappingEpsilon )
+ {
+ nOffset = nCurrent;
+ nRet = mpImpl->maSnappingPointZooms[ nCount ];
+ break;
+ }
+ ++nCount;
+ }
+
+ if( 0 == nRet )
+ {
+ if( nOffset < nControlWidth / 2 )
+ {
+ // first half of slider
+ const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+ const long nZoomPerSliderPixel = (1000 * nFirstHalfRange) / nHalfSliderWidth;
+ const long nOffsetToSliderLeft = nOffset - nSliderXOffset;
+ nRet = mpImpl->mnMinZoom + USHORT( nOffsetToSliderLeft * nZoomPerSliderPixel / 1000 );
+ }
+ else
+ {
+ // second half of slider
+ const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+ const long nZoomPerSliderPixel = 1000 * nSecondHalfRange / nHalfSliderWidth;
+ const long nOffsetToSliderCenter = nOffset - nControlWidth/2;
+ nRet = mpImpl->mnSliderCenter + USHORT( nOffsetToSliderCenter * nZoomPerSliderPixel / 1000 );
+ }
+ }
+
+ if( nRet < mpImpl->mnMinZoom )
+ return mpImpl->mnMinZoom;
+
+ else if( nRet > mpImpl->mnMaxZoom )
+ return mpImpl->mnMaxZoom;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+long ScZoomSliderWnd::Zoom2Offset( USHORT nCurrentZoom ) const
+{
+ Size aSliderWindowSize = GetOutputSizePixel();
+ const long nControlWidth = aSliderWindowSize.Width();
+ long nRect = nSliderXOffset;
+
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+ if( nCurrentZoom <= mpImpl->mnSliderCenter )
+ {
+ nCurrentZoom = nCurrentZoom - mpImpl->mnMinZoom;
+ const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
+ const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nFirstHalfRange;
+ const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
+ nRect += nOffset;
+ }
+ else
+ {
+ nCurrentZoom = nCurrentZoom - mpImpl->mnSliderCenter;
+ const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
+ const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nSecondHalfRange;
+ const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
+ nRect += nHalfSliderWidth + nOffset;
+ }
+ return nRect;
+}
+
+// -----------------------------------------------------------------------
+
+
+ScZoomSliderWnd::ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , USHORT nCurrentZoom ):
+ Window( pParent ),
+ mpImpl( new ScZoomSliderWnd_Impl( nCurrentZoom ) ),
+ aLogicalSize( 115, 40 ),
+ m_xDispatchProvider( rDispatchProvider ),
+ m_xFrame( _xFrame )
+{
+ BOOL bIsDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark();
+ mpImpl->maSliderButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERBUTTON_HC : RID_SVXBMP_SLIDERBUTTON ) );
+ mpImpl->maIncreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERINCREASE_HC : RID_SVXBMP_SLIDERINCREASE ) );
+ mpImpl->maDecreaseButton = Image( SVX_RES( bIsDark ? RID_SVXBMP_SLIDERDECREASE_HC : RID_SVXBMP_SLIDERDECREASE ) );
+ Size aSliderSize = LogicToPixel( Size( aLogicalSize), MapMode( MAP_10TH_MM ) );
+ SetSizePixel( Size( aSliderSize.Width() * nSliderWidth-1, aSliderSize.Height() + nSliderHeight ) );
+}
+
+// -----------------------------------------------------------------------
+
+ScZoomSliderWnd::~ScZoomSliderWnd()
+{
+ delete mpImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderWnd::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !mpImpl->mbValuesSet )
+ return ;
+ Size aSliderWindowSize = GetOutputSizePixel();
+
+ const Point aPoint = rMEvt.GetPosPixel();
+
+ const long nButtonLeftOffset = ( nSliderXOffset - nIncDecWidth )/2;
+ const long nButtonRightOffset = ( nSliderXOffset + nIncDecWidth )/2;
+
+ const long nOldZoom = mpImpl->mnCurrentZoom;
+
+ // click to - button
+ if ( aPoint.X() >= nButtonLeftOffset && aPoint.X() <= nButtonRightOffset )
+ {
+ mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5;
+ }
+ // click to + button
+ else if ( aPoint.X() >= aSliderWindowSize.Width() - nSliderXOffset + nButtonLeftOffset &&
+ aPoint.X() <= aSliderWindowSize.Width() - nSliderXOffset + nButtonRightOffset )
+ {
+ mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5;
+ }
+ else if( aPoint.X() >= nSliderXOffset && aPoint.X() <= aSliderWindowSize.Width() - nSliderXOffset )
+ {
+ mpImpl->mnCurrentZoom = Offset2Zoom( aPoint.X() );
+ }
+
+ if( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom )
+ mpImpl->mnCurrentZoom = mpImpl->mnMinZoom;
+ else if( mpImpl->mnCurrentZoom > mpImpl->mnMaxZoom )
+ mpImpl->mnCurrentZoom = mpImpl->mnMaxZoom;
+
+ if( nOldZoom == mpImpl->mnCurrentZoom )
+ return ;
+
+ Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+
+ Paint( aRect );
+ mpImpl->mbOmitPaint = true;
+
+ SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
+
+ ::com::sun::star::uno::Any a;
+ aZoomSliderItem.QueryValue( a );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScalingFactor" ));
+ aArgs[0].Value = a;
+
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:ScalingFactor"), aArgs );
+
+ mpImpl->mbOmitPaint = false;
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderWnd::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !mpImpl->mbValuesSet )
+ return ;
+
+ Size aSliderWindowSize = GetOutputSizePixel();
+ const long nControlWidth = aSliderWindowSize.Width();
+ const short nButtons = rMEvt.GetButtons();
+
+ // check mouse move with button pressed
+ if ( 1 == nButtons )
+ {
+ const Point aPoint = rMEvt.GetPosPixel();
+
+ if ( aPoint.X() >= nSliderXOffset && aPoint.X() <= nControlWidth - nSliderXOffset )
+ {
+ mpImpl->mnCurrentZoom = Offset2Zoom( aPoint.X() );
+
+ Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+ Paint( aRect );
+
+ mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
+
+ // commit state change
+ SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
+
+ ::com::sun::star::uno::Any a;
+ aZoomSliderItem.QueryValue( a );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScalingFactor" ));
+ aArgs[0].Value = a;
+
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:ScalingFactor"), aArgs );
+
+ mpImpl->mbOmitPaint = false;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem )
+{
+ if( pZoomSliderItem )
+ {
+ mpImpl->mnCurrentZoom = pZoomSliderItem->GetValue();
+ mpImpl->mnMinZoom = pZoomSliderItem->GetMinZoom();
+ mpImpl->mnMaxZoom = pZoomSliderItem->GetMaxZoom();
+
+ DBG_ASSERT( mpImpl->mnMinZoom <= mpImpl->mnCurrentZoom &&
+ mpImpl->mnMinZoom < mpImpl->mnSliderCenter &&
+ mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom &&
+ mpImpl->mnMaxZoom > mpImpl->mnSliderCenter,
+ "Looks like the zoom slider item is corrupted" );
+ const com::sun::star::uno::Sequence < sal_Int32 > rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
+ mpImpl->maSnappingPointOffsets.clear();
+ mpImpl->maSnappingPointZooms.clear();
+
+ // get all snapping points:
+ std::set< USHORT > aTmpSnappingPoints;
+ for ( USHORT j = 0; j < rSnappingPoints.getLength(); ++j )
+ {
+ const sal_Int32 nSnappingPoint = rSnappingPoints[j];
+ aTmpSnappingPoints.insert( (USHORT)nSnappingPoint );
+ }
+
+ // remove snapping points that are to close to each other:
+ std::set< USHORT >::iterator aSnappingPointIter;
+ long nLastOffset = 0;
+
+ for ( aSnappingPointIter = aTmpSnappingPoints.begin(); aSnappingPointIter != aTmpSnappingPoints.end(); ++aSnappingPointIter )
+ {
+ const USHORT nCurrent = *aSnappingPointIter;
+ const long nCurrentOffset = Zoom2Offset( nCurrent );
+
+ if ( nCurrentOffset - nLastOffset >= nSnappingPointsMinDist )
+ {
+ mpImpl->maSnappingPointOffsets.push_back( nCurrentOffset );
+ mpImpl->maSnappingPointZooms.push_back( nCurrent );
+ nLastOffset = nCurrentOffset;
+ }
+ }
+ }
+
+ Size aSliderWindowSize = GetOutputSizePixel();
+ Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+
+ if ( !mpImpl->mbOmitPaint )
+ Paint(aRect);
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderWnd::Paint( const Rectangle& rRect )
+{
+ DoPaint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ )
+{
+ if( mpImpl->mbOmitPaint )
+ return;
+
+ Size aSliderWindowSize = GetOutputSizePixel();
+ Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+
+ VirtualDevice* pVDev = new VirtualDevice( *this );
+ pVDev->SetOutputSizePixel( aSliderWindowSize );
+
+ Rectangle aSlider = aRect;
+
+ aSlider.Top() += ( aSliderWindowSize.Height() - nSliderHeight )/2 - 1;
+ aSlider.Bottom() = aSlider.Top() + nSliderHeight;
+ aSlider.Left() += nSliderXOffset;
+ aSlider.Right() -= nSliderXOffset;
+
+ Rectangle aFirstLine( aSlider );
+ aFirstLine.Bottom() = aFirstLine.Top();
+
+ Rectangle aSecondLine( aSlider );
+ aSecondLine.Top() = aSecondLine.Bottom();
+
+ Rectangle aLeft( aSlider );
+ aLeft.Right() = aLeft.Left();
+
+ Rectangle aRight( aSlider );
+ aRight.Left() = aRight.Right();
+
+ // draw VirtualDevice's background color
+ Color aStartColor,aEndColor;
+ aStartColor = GetSettings().GetStyleSettings().GetFaceColor();
+ aEndColor = GetSettings().GetStyleSettings().GetFaceColor();
+ if( aEndColor.IsDark() )
+ aStartColor = aEndColor;
+
+ Gradient g;
+ g.SetAngle( 0 );
+ g.SetStyle( GRADIENT_LINEAR );
+
+ g.SetStartColor( aStartColor );
+ g.SetEndColor( aEndColor );
+ pVDev->DrawGradient( aRect, g );
+
+ // draw slider
+ pVDev->SetLineColor( Color ( COL_WHITE ) );
+ pVDev->DrawRect( aSecondLine );
+ pVDev->DrawRect( aRight );
+
+ pVDev->SetLineColor( Color( COL_GRAY ) );
+ pVDev->DrawRect( aFirstLine );
+ pVDev->DrawRect( aLeft );
+
+ // draw snapping points:
+ std::vector< long >::iterator aSnappingPointIter;
+ for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
+ aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
+ ++aSnappingPointIter )
+ {
+ pVDev->SetLineColor( Color( COL_GRAY ) );
+ Rectangle aSnapping( aRect );
+ aSnapping.Bottom() = aSlider.Top();
+ aSnapping.Top() = aSnapping.Bottom() - nSnappingHeight;
+ aSnapping.Left() += *aSnappingPointIter;
+ aSnapping.Right() = aSnapping.Left();
+ pVDev->DrawRect( aSnapping );
+
+ aSnapping.Top() += nSnappingHeight + nSliderHeight;
+ aSnapping.Bottom() += nSnappingHeight + nSliderHeight;
+ pVDev->DrawRect( aSnapping );
+ }
+
+ // draw slider button
+ Point aImagePoint = aRect.TopLeft();
+ aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom );
+ aImagePoint.X() -= nButtonWidth/2;
+ aImagePoint.Y() += ( aSliderWindowSize.Height() - nButtonHeight)/2;
+ pVDev->DrawImage( aImagePoint, mpImpl->maSliderButton );
+
+ // draw decrease button
+ aImagePoint = aRect.TopLeft();
+ aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2;
+ aImagePoint.Y() += ( aSliderWindowSize.Height() - nIncDecHeight)/2;
+ pVDev->DrawImage( aImagePoint, mpImpl->maDecreaseButton );
+
+ // draw increase button
+ aImagePoint.X() = aRect.TopLeft().X() + aSliderWindowSize.Width() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2;
+ pVDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton );
+
+ DrawOutDev( Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev );
+
+ delete pVDev;
+
+}
+
+// -----------------------------------------------------------------------
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 0d6091326a56..32bd15c4e706 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -237,7 +237,15 @@ void __EXPORT ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
}
else
{
- aLbSort1.SelectEntryPos( 1 );
+ SCCOL nCol = pViewData->GetCurX();
+
+ if( nCol < rSortData.nCol1 )
+ nCol = rSortData.nCol1;
+ else if( nCol > rSortData.nCol2 )
+ nCol = rSortData.nCol2;
+
+ USHORT nSort1Pos = nCol - rSortData.nCol1+1;
+ aLbSort1.SelectEntryPos( nSort1Pos );
aLbSort2.SelectEntryPos( 0 );
aLbSort3.SelectEntryPos( 0 );
aBtnUp1.Check();
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 79a09424bd8a..4208014ee491 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1211,7 +1211,7 @@ BOOL ScDocFunc::ApplyStyle( const ScMarkData& rMark, const String& rStyleName,
//------------------------------------------------------------------------
-BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
+BOOL ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, InsCellCmd eCmd,
BOOL bRecord, BOOL bApi, BOOL bPartOfPaste )
{
ScDocShellModificator aModificator( rDocShell );
@@ -1229,7 +1229,6 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
return FALSE;
}
- SCTAB nTab = nStartTab;
ScDocument* pDoc = rDocShell.GetDocument();
SCTAB nTabCount = pDoc->GetTableCount();
SCCOL nPaintStartX = nStartCol;
@@ -1238,16 +1237,35 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
SCROW nPaintEndY = nEndRow;
USHORT nPaintFlags = PAINT_GRID;
BOOL bSuccess;
+ SCTAB i;
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
- // zugehoerige Szenarien auch anpassen
- if ( !pDoc->IsScenario(nEndTab) )
- while ( nEndTab+1 < nTabCount && pDoc->IsScenario(nEndTab+1) )
- ++nEndTab;
+ ScMarkData aMark;
+ if (pTabMark)
+ aMark = *pTabMark;
+ else
+ {
+ SCTAB nCount = 0;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( !pDoc->IsScenario(i) )
+ {
+ nCount++;
+ if( nCount == nEndTab+1 )
+ {
+ aMark.SelectTable( i, TRUE );
+ break;
+ }
+ }
+ }
+ }
- // Test zusammengefasste
+ SCTAB nSelCount = aMark.GetSelectCount();
+
+ // zugehoerige Szenarien auch anpassen
+ // Test zusammengefasste
SCCOL nMergeTestStartX = nStartCol;
SCROW nMergeTestStartY = nStartRow;
@@ -1274,7 +1292,7 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
SCCOL nEditTestEndX = (eCmd==INS_INSCOLS) ? MAXCOL : nMergeTestEndX;
SCROW nEditTestEndY = (eCmd==INS_INSROWS) ? MAXROW : nMergeTestEndY;
- ScEditableTester aTester( pDoc, nTab, nMergeTestStartX,nMergeTestStartY, nEditTestEndX,nEditTestEndY );
+ ScEditableTester aTester( pDoc, nMergeTestStartX, nMergeTestStartY, nEditTestEndX, nEditTestEndY, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1282,42 +1300,46 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
return FALSE;
}
- if (pDoc->HasAttrib( nMergeTestStartX,nMergeTestStartY,nTab,
- nMergeTestEndX,nMergeTestEndY,nTab,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ for( i=0; i<nTabCount; i++ )
{
- if (eCmd==INS_CELLSRIGHT)
- bNeedRefresh = TRUE;
+ if( aMark.GetTableSelect(i) )
+ {
+ if (pDoc->HasAttrib( nMergeTestStartX,nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i,
+ HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ {
+ if (eCmd==INS_CELLSRIGHT)
+ bNeedRefresh = TRUE;
- SCCOL nMergeStartX = nMergeTestStartX;
- SCROW nMergeStartY = nMergeTestStartY;
- SCCOL nMergeEndX = nMergeTestEndX;
- SCROW nMergeEndY = nMergeTestEndY;
+ SCCOL nMergeStartX = nMergeTestStartX;
+ SCROW nMergeStartY = nMergeTestStartY;
+ SCCOL nMergeEndX = nMergeTestEndX;
+ SCROW nMergeEndY = nMergeTestEndY;
- pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
- pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
- if ( nMergeStartX != nMergeTestStartX || nMergeStartY != nMergeTestStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
+ pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
+ pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
+ if ( nMergeStartX != nMergeTestStartX || nMergeStartY != nMergeTestStartY ||
+ nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
+ bCanDo = FALSE;
- //! ? nur Start testen ?
+ //! ? nur Start testen ?
- if (!bCanDo)
- if ( eCmd==INS_INSCOLS || eCmd==INS_INSROWS )
- if ( nMergeStartX == nMergeTestStartX && nMergeStartY == nMergeTestStartY )
- {
- bCanDo = TRUE;
-// bNeedRefresh = TRUE;
- }
- }
+ if (!bCanDo)
+ if ( eCmd==INS_INSCOLS || eCmd==INS_INSROWS )
+ if ( nMergeStartX == nMergeTestStartX && nMergeStartY == nMergeTestStartY )
+ {
+ bCanDo = TRUE;
+ }
+ }
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht in zusammengefasste Bereiche einfuegen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
- return FALSE;
+ if (!bCanDo)
+ {
+ //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
+ // "Kann nicht in zusammengefasste Bereiche einfuegen"
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
+ return FALSE;
+ }
+ }
}
//
@@ -1343,26 +1365,66 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
switch (eCmd)
{
case INS_CELLSDOWN:
- bSuccess = pDoc->InsertRow( nStartCol,nStartTab, nEndCol,nEndTab,
- nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ bSuccess = TRUE;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ bSuccess &= pDoc->InsertRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ }
+ }
nPaintEndY = MAXROW;
break;
case INS_INSROWS:
- bSuccess = pDoc->InsertRow( 0,nStartTab, MAXCOL,nEndTab,
- nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ bSuccess = TRUE;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ bSuccess &= pDoc->InsertRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ }
+ }
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case INS_CELLSRIGHT:
- bSuccess = pDoc->InsertCol( nStartRow,nStartTab, nEndRow,nEndTab,
- nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ bSuccess = TRUE;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ bSuccess &= pDoc->InsertCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ }
+ }
nPaintEndX = MAXCOL;
break;
case INS_INSCOLS:
- bSuccess = pDoc->InsertCol( 0,nStartTab, MAXROW,nEndTab,
- nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ bSuccess = TRUE;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ bSuccess &= pDoc->InsertCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ }
+ }
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -1376,47 +1438,66 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
if ( bSuccess )
{
+ SCTAB* pTabs = NULL;
+ SCTAB* pScenarios = NULL;
+ SCTAB nUndoPos = 0;
if ( bRecord )
{
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertCells( &rDocShell, ScRange(
- nStartCol,nStartRow,nStartTab,
- nEndCol,nEndRow,nEndTab ),
- eCmd, pRefUndoDoc, pUndoData, bPartOfPaste ) );
+ pTabs = new SCTAB[nSelCount];
+ pScenarios = new SCTAB[nSelCount];
+ nUndoPos = 0;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+
+ SCTAB nCount = 0;
+ for( SCTAB j=i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nCount ++;
+
+ pScenarios[nUndoPos] = nCount;
+ pTabs[nUndoPos] = i;
+ nUndoPos ++;
+ }
+ }
+ rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
+ &rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),
+ nUndoPos, pTabs, pScenarios, eCmd, pRefUndoDoc, pUndoData, bPartOfPaste ) );
}
- if (bNeedRefresh)
- pDoc->ExtendMerge( nMergeTestStartX,nMergeTestStartY,
- nMergeTestEndX,nMergeTestEndY, nTab, TRUE );
- else
- pDoc->RefreshAutoFilter( nMergeTestStartX,nMergeTestStartY,
- nMergeTestEndX,nMergeTestEndY, nTab);
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ if (bNeedRefresh)
+ pDoc->ExtendMerge( nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY, i, TRUE );
+ else
+ pDoc->RefreshAutoFilter( nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY, i );
- if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
- pDoc->UpdatePageBreaks( nTab );
+ if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
+ pDoc->UpdatePageBreaks( i );
- USHORT nExtFlags = 0;
- rDocShell.UpdatePaintExt( nExtFlags, nPaintStartX,nPaintStartY,nTab, nPaintEndX,nPaintEndY,nTab );
+ USHORT nExtFlags = 0;
+ rDocShell.UpdatePaintExt( nExtFlags, nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i );
- // ganze Zeilen einfuegen: nur neue Zeilen anpassen
- BOOL bAdjusted = ( eCmd == INS_INSROWS ) ?
- AdjustRowHeight(ScRange(0,nStartRow,nStartTab, MAXCOL,nEndRow,nEndTab)) :
- AdjustRowHeight(ScRange(0,nPaintStartY,nStartTab, MAXCOL,nPaintEndY,nEndTab));
- if (bAdjusted)
- {
- // paint only what is not done by AdjustRowHeight
- if (nPaintFlags & PAINT_TOP)
- rDocShell.PostPaint( nPaintStartX, nPaintStartY, nStartTab,
- nPaintEndX, nPaintEndY, nEndTab, PAINT_TOP );
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ BOOL bAdjusted = ( eCmd == INS_INSROWS ) ? AdjustRowHeight(ScRange(0, nStartRow, i, MAXCOL, nEndRow, i+nScenarioCount )) :
+ AdjustRowHeight(ScRange(0, nPaintStartY, i, MAXCOL, nPaintEndY, i+nScenarioCount ));
+ if (bAdjusted)
+ {
+ // paint only what is not done by AdjustRowHeight
+ if (nPaintFlags & PAINT_TOP)
+ rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, PAINT_TOP );
+ }
+ else
+ rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, nPaintFlags, nExtFlags );
+ }
}
- else
- rDocShell.PostPaint( nPaintStartX, nPaintStartY, nStartTab,
- nPaintEndX, nPaintEndY, nEndTab,
- nPaintFlags, nExtFlags);
aModificator.SetDocumentModified();
-
-//! pDocSh->UpdateOle(GetViewData()); // muss an der View bleiben
-//! CellContentChanged(); // muss an der View bleiben
}
else
{
@@ -1428,7 +1509,8 @@ BOOL ScDocFunc::InsertCells( const ScRange& rRange, InsCellCmd eCmd,
return bSuccess;
}
-BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecord, BOOL bApi )
+BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, DelCellCmd eCmd,
+ BOOL bRecord, BOOL bApi )
{
ScDocShellModificator aModificator( rDocShell );
@@ -1445,7 +1527,6 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
return FALSE;
}
- SCTAB nTab = nStartTab;
ScDocument* pDoc = rDocShell.GetDocument();
SCTAB nTabCount = pDoc->GetTableCount();
SCCOL nPaintStartX = nStartCol;
@@ -1453,14 +1534,32 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
SCCOL nPaintEndX = nEndCol;
SCROW nPaintEndY = nEndRow;
USHORT nPaintFlags = PAINT_GRID;
+ SCTAB i;
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = FALSE;
- // zugehoerige Szenarien auch anpassen
- if ( !pDoc->IsScenario(nEndTab) )
- while ( nEndTab+1 < nTabCount && pDoc->IsScenario(nEndTab+1) )
- ++nEndTab;
+ ScMarkData aMark;
+ if (pTabMark)
+ aMark = *pTabMark;
+ else
+ {
+ SCTAB nCount = 0;
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( !pDoc->IsScenario(i) )
+ {
+ nCount++;
+ if( nCount == nEndTab+1 )
+ {
+ aMark.SelectTable( i, TRUE );
+ break;
+ }
+ }
+ }
+ }
+
+ SCTAB nSelCount = aMark.GetSelectCount();
SCCOL nUndoStartX = nStartCol;
SCROW nUndoStartY = nStartRow;
@@ -1481,10 +1580,12 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
// Test Zellschutz
SCCOL nEditTestEndX = nUndoEndX;
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT ) nEditTestEndX = MAXCOL;
+ if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT )
+ nEditTestEndX = MAXCOL;
SCROW nEditTestEndY = nUndoEndY;
- if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP ) nEditTestEndY = MAXROW;
- ScEditableTester aTester( pDoc, nTab, nUndoStartX,nUndoStartY,nEditTestEndX,nEditTestEndY );
+ if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
+ nEditTestEndY = MAXROW;
+ ScEditableTester aTester( pDoc, nUndoStartX, nUndoStartY, nEditTestEndX, nEditTestEndY, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1499,41 +1600,47 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
BOOL bCanDo = TRUE;
BOOL bNeedRefresh = FALSE;
- if (pDoc->HasAttrib( nUndoStartX,nUndoStartY,nTab, nMergeTestEndX,nMergeTestEndY,nTab,
- HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ for( i=0; i<nTabCount; i++ )
{
- if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_CELLSUP )
- bNeedRefresh = TRUE;
+ if( aMark.GetTableSelect(i) )
+ {
+ if (pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i,
+ HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ {
+ if ( eCmd==DEL_CELLSLEFT || eCmd==DEL_CELLSUP )
+ bNeedRefresh = TRUE;
- SCCOL nMergeStartX = nUndoStartX;
- SCROW nMergeStartY = nUndoStartY;
- SCCOL nMergeEndX = nMergeTestEndX;
- SCROW nMergeEndY = nMergeTestEndY;
+ SCCOL nMergeStartX = nUndoStartX;
+ SCROW nMergeStartY = nUndoStartY;
+ SCCOL nMergeEndX = nMergeTestEndX;
+ SCROW nMergeEndY = nMergeTestEndY;
- pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
- pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, nTab );
- if ( nMergeStartX != nUndoStartX || nMergeStartY != nUndoStartY ||
- nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
- bCanDo = FALSE;
+ pDoc->ExtendMerge( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
+ pDoc->ExtendOverlapped( nMergeStartX, nMergeStartY, nMergeEndX, nMergeEndY, i );
+ if ( nMergeStartX != nUndoStartX || nMergeStartY != nUndoStartY ||
+ nMergeEndX != nMergeTestEndX || nMergeEndY != nMergeTestEndY )
+ bCanDo = FALSE;
- // ganze Zeilen/Spalten: Testen, ob Merge komplett geloescht werden kann
+ // ganze Zeilen/Spalten: Testen, ob Merge komplett geloescht werden kann
- if (!bCanDo)
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_DELROWS )
- if ( nMergeStartX == nUndoStartX && nMergeStartY == nUndoStartY )
- {
- bCanDo = TRUE;
- bNeedRefresh = TRUE;
- }
- }
+ if (!bCanDo)
+ if ( eCmd==DEL_DELCOLS || eCmd==DEL_DELROWS )
+ if ( nMergeStartX == nUndoStartX && nMergeStartY == nUndoStartY )
+ {
+ bCanDo = TRUE;
+ bNeedRefresh = TRUE;
+ }
+ }
- if (!bCanDo)
- {
- //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
- // "Kann nicht aus zusammengefassten Bereichen loeschen"
- if (!bApi)
- rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
- return FALSE;
+ if (!bCanDo)
+ {
+ //! auf Verschieben (Drag&Drop) zurueckfuehren !!!
+ // "Kann nicht aus zusammengefassten Bereichen loeschen"
+ if (!bApi)
+ rDocShell.ErrorMessage(STR_MSSG_DELETECELLS_0);
+ return FALSE;
+ }
+ }
}
//
@@ -1551,10 +1658,21 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
// so it's no longer necessary to copy more than the deleted range into pUndoDoc.
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab,
- (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
- pDoc->CopyToDocument( nUndoStartX, nUndoStartY, nStartTab, nUndoEndX, nUndoEndY, nEndTab,
- IDF_ALL, FALSE, pUndoDoc );
+ pUndoDoc->InitUndo( pDoc, 0, nTabCount-1, (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ pDoc->CopyToDocument( nUndoStartX, nUndoStartY, i, nUndoEndX, nUndoEndY, i+nScenarioCount,
+ IDF_ALL, FALSE, pUndoDoc );
+ }
+ }
+
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, FALSE, FALSE );
@@ -1564,32 +1682,76 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
}
USHORT nExtFlags = 0;
- rDocShell.UpdatePaintExt( nExtFlags, nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ rDocShell.UpdatePaintExt( nExtFlags, nStartCol, nStartRow, i, nEndCol, nEndRow, i );
+ }
BOOL bUndoOutline = FALSE;
switch (eCmd)
{
case DEL_CELLSUP:
- pDoc->DeleteRow( nStartCol, nStartTab, nEndCol, nEndTab,
- nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ pDoc->DeleteRow( nStartCol, i, nEndCol, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc );
+ }
+ }
nPaintEndY = MAXROW;
break;
case DEL_DELROWS:
- pDoc->DeleteRow( 0, nStartTab, MAXCOL, nEndTab,
- nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ pDoc->DeleteRow( 0, i, MAXCOL, i+nScenarioCount, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline );
+ }
+ }
nPaintStartX = 0;
nPaintEndX = MAXCOL;
nPaintEndY = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case DEL_CELLSLEFT:
- pDoc->DeleteCol( nStartRow, nStartTab, nEndRow, nEndTab,
- nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ pDoc->DeleteCol( nStartRow, i, nEndRow, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc );
+ }
+ }
nPaintEndX = MAXCOL;
break;
case DEL_DELCOLS:
- pDoc->DeleteCol( 0, nStartTab, MAXROW, nEndTab,
- nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline );
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ pDoc->DeleteCol( 0, i, MAXROW, i+nScenarioCount, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline );
+ }
+ }
nPaintStartY = 0;
nPaintEndY = MAXROW;
nPaintEndX = MAXCOL;
@@ -1604,9 +1766,8 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
if ( bRecord )
{
- for (SCTAB i=nStartTab; i<=nEndTab; i++)
- pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY,i,
- IDF_ALL);
+ for ( i=nStartTab; i<=nTabCount; i++)
+ pRefUndoDoc->DeleteAreaTab(nUndoStartX,nUndoStartY,nUndoEndX,nUndoEndY, i, IDF_ALL);
// alle Tabellen anlegen, damit Formeln kopiert werden koennen:
pUndoDoc->AddUndoTab( 0, nTabCount-1, FALSE, FALSE );
@@ -1614,11 +1775,27 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
// kopieren mit bColRowFlags=FALSE (#54194#)
pRefUndoDoc->CopyToDocument(0,0,0,MAXCOL,MAXROW,MAXTAB,IDF_FORMULA,FALSE,pUndoDoc,NULL,FALSE);
delete pRefUndoDoc;
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoDeleteCells( &rDocShell, ScRange(
- nStartCol,nStartRow,nStartTab,
- nEndCol,nEndRow,nEndTab ),
- eCmd, pUndoDoc, pUndoData ) );
+
+ SCTAB* pTabs = new SCTAB[nSelCount];
+ SCTAB* pScenarios = new SCTAB[nSelCount];
+ SCTAB nUndoPos = 0;
+
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nCount = 0;
+ for( SCTAB j=i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nCount ++;
+
+ pScenarios[nUndoPos] = nCount;
+ pTabs[nUndoPos] = i;
+ nUndoPos ++;
+ }
+ }
+ rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDeleteCells(
+ &rDocShell, ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ),nUndoPos, pTabs, pScenarios,
+ eCmd, pUndoDoc, pUndoData ) );
}
if (bNeedRefresh)
@@ -1626,47 +1803,59 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecor
// #i51445# old merge flag attributes must be deleted also for single cells,
// not only for whole columns/rows
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT ) nMergeTestEndX = MAXCOL;
- if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP ) nMergeTestEndY = MAXROW;
+ if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT )
+ nMergeTestEndX = MAXCOL;
+ if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
+ nMergeTestEndY = MAXROW;
ScPatternAttr aPattern( pDoc->GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- ScMarkData aMark; // only contains the sheets
- for (SCTAB i=nStartTab; i<=nEndTab; i++)
- aMark.SelectTable( i, TRUE );
- pDoc->ApplyPatternArea( nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY,
- aMark, aPattern );
+ pDoc->ApplyPatternArea( nUndoStartX, nUndoStartY, nMergeTestEndX, nMergeTestEndY, aMark, aPattern );
- ScRange aMergedRange( nUndoStartX, nUndoStartY, nStartTab, nMergeTestEndX, nMergeTestEndY, nEndTab );
- pDoc->ExtendMerge( aMergedRange, TRUE );
- }
+ for( i=0; i<nTabCount; i++ )
+ {
+ if( aMark.GetTableSelect( i ) )
+ {
+ SCTAB nScenarioCount = 0;
- if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS )
- pDoc->UpdatePageBreaks( nTab );
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
- rDocShell.UpdatePaintExt( nExtFlags, nPaintStartX,nPaintStartY,nTab, nPaintEndX,nPaintEndY,nTab );
+ ScRange aMergedRange( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i+nScenarioCount );
+ pDoc->ExtendMerge( aMergedRange, TRUE );
+ }
+ }
+ }
- // ganze Zeilen loeschen: nichts anpassen
- if ( eCmd == DEL_DELROWS ||
- !AdjustRowHeight(ScRange(0,nPaintStartY,nStartTab, MAXCOL,nPaintEndY,nEndTab)) )
- rDocShell.PostPaint( nPaintStartX, nPaintStartY, nStartTab,
- nPaintEndX, nPaintEndY, nEndTab,
- nPaintFlags, nExtFlags );
- else
+ for( i=0; i<nTabCount; i++ )
{
- // paint only what is not done by AdjustRowHeight
- if (nExtFlags & SC_PF_LINES)
- lcl_PaintAbove( rDocShell, ScRange( nPaintStartX, nPaintStartY, nStartTab,
- nPaintEndX, nPaintEndY, nEndTab) );
- if (nPaintFlags & PAINT_TOP)
- rDocShell.PostPaint( nPaintStartX, nPaintStartY, nStartTab,
- nPaintEndX, nPaintEndY, nEndTab, PAINT_TOP );
+ if( aMark.GetTableSelect( i ) )
+ {
+ if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS )
+ pDoc->UpdatePageBreaks( i );
+
+ rDocShell.UpdatePaintExt( nExtFlags, nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i );
+
+ SCTAB nScenarioCount = 0;
+
+ for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ nScenarioCount ++;
+
+ // ganze Zeilen loeschen: nichts anpassen
+ if ( eCmd == DEL_DELROWS || !AdjustRowHeight(ScRange( 0, nPaintStartY, i, MAXCOL, nPaintEndY, i+nScenarioCount )) )
+ rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, nPaintFlags, nExtFlags );
+ else
+ {
+ // paint only what is not done by AdjustRowHeight
+ if (nExtFlags & SC_PF_LINES)
+ lcl_PaintAbove( rDocShell, ScRange( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount) );
+ if (nPaintFlags & PAINT_TOP)
+ rDocShell.PostPaint( nPaintStartX, nPaintStartY, i, nPaintEndX, nPaintEndY, i+nScenarioCount, PAINT_TOP );
+ }
+ }
}
aModificator.SetDocumentModified();
-//! pDocSh->UpdateOle(GetViewData()); // muss an der View bleiben
-//! CellContentChanged(); // muss an der View bleiben
-
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
return TRUE;
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index b0094688903d..4b1c26f0e20b 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1065,10 +1065,10 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
}
break;
case SC_CAT_INSERT_ROWS:
- GetDocFunc().InsertCells( aSourceRange, INS_INSROWS, TRUE, FALSE );
+ GetDocFunc().InsertCells( aSourceRange, NULL, INS_INSROWS, TRUE, FALSE );
break;
case SC_CAT_INSERT_COLS:
- GetDocFunc().InsertCells( aSourceRange, INS_INSCOLS, TRUE, FALSE );
+ GetDocFunc().InsertCells( aSourceRange, NULL, INS_INSCOLS, TRUE, FALSE );
break;
case SC_CAT_DELETE_TABS :
GetDocFunc().DeleteTable( aSourceRange.aStart.Tab(), TRUE, FALSE );
@@ -1079,7 +1079,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
if ( pDel->IsTopDelete() )
{
aSourceRange = pDel->GetOverAllRange().MakeRange();
- GetDocFunc().DeleteCells( aSourceRange, DEL_DELROWS, TRUE, FALSE );
+ GetDocFunc().DeleteCells( aSourceRange, NULL, DEL_DELROWS, TRUE, FALSE );
}
}
break;
@@ -1089,7 +1089,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
if ( pDel->IsTopDelete() && !pDel->IsTabDeleteCol() )
{ // deleted Table enthaelt deleted Cols, die nicht
aSourceRange = pDel->GetOverAllRange().MakeRange();
- GetDocFunc().DeleteCells( aSourceRange, DEL_DELCOLS, TRUE, FALSE );
+ GetDocFunc().DeleteCells( aSourceRange, NULL, DEL_DELCOLS, TRUE, FALSE );
}
}
break;
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 3550fa157b24..b45a3d6825de 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -103,9 +103,11 @@ public:
BOOL ApplyStyle( const ScMarkData& rMark, const String& rStyleName,
BOOL bRecord, BOOL bApi );
- BOOL InsertCells( const ScRange& rRange, InsCellCmd eCmd, BOOL bRecord, BOOL bApi,
+ BOOL InsertCells( const ScRange& rRange,const ScMarkData* pTabMark,
+ InsCellCmd eCmd, BOOL bRecord, BOOL bApi,
BOOL bPartOfPaste = FALSE );
- BOOL DeleteCells( const ScRange& rRange, DelCellCmd eCmd, BOOL bRecord, BOOL bApi );
+ BOOL DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
+ DelCellCmd eCmd, BOOL bRecord, BOOL bApi );
BOOL MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
BOOL bCut, BOOL bRecord, BOOL bPaint, BOOL bApi );
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index f02d8be298e1..c71d389e62fe 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -69,7 +69,9 @@ private:
TypedStrCollection* pColumnData;
TypedStrCollection* pFormulaData;
+ TypedStrCollection* pFormulaDataPara;
ULONG nTipVisible;
+ ULONG nTipVisibleSec;
String aManualTip;
String aAutoSearch;
USHORT nAutoPos;
@@ -191,7 +193,10 @@ public:
void ResetDelayTimer(); //BugId 54702
void HideTip();
+ void HideTipBelow();
+ void ShowTipCursor();
void ShowTip( const String& rText ); // am Cursor
+ void ShowTipBelow( const String& rText );
void SetRefScale( const Fraction& rX, const Fraction& rY );
void UpdateRefDevice();
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index b24992fc2ef5..6b98d2c51754 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -62,6 +62,7 @@ class ScPreviewShell: public SfxViewShell
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSourceData; // ViewData
BYTE nSourceDesignMode; // form design mode from TabView
SvxZoomType eZoom;
+ long nMaxVertPos;
SfxBroadcaster* pAccessibilityBroadcaster;
diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx
new file mode 100644
index 000000000000..0132ec844233
--- /dev/null
+++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: tbzoomsliderctrl.hxx,v $
+*
+* $Revision: 1.1 $
+*
+* last change: $Author: maoyg $ $Date: 2008/04/25 10:08:08 $
+*
+* The Contents of this file are made available subject to
+* the terms of GNU Lesser General Public License Version 2.1.
+*
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2005 by Sun Microsystems, Inc.
+* 901 San Antonio Road, Palo Alto, CA 94303, USA
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+* MA 02111-1307 USA
+*
+************************************************************************/
+#ifndef _SC_ZOOMSLIDERTBCONTRL_HXX
+#define _SC_ZOOMSLIDERTBCONTRL_HXX
+
+#ifndef _WINDOW_HXX //autogen
+#include <vcl/window.hxx>
+#endif
+#ifndef _SFXPOOLITEM_HXX //autogen
+#include <svtools/poolitem.hxx>
+#endif
+#ifndef _SFXTBXCTRL_HXX //autogen
+#include <sfx2/tbxctrl.hxx>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+#include <com/sun/star/frame/XFrame.hpp>
+#endif
+#include <svx/zoomslideritem.hxx>
+
+
+//class ScZoomSliderControl define
+class ScZoomSliderControl: public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ ScZoomSliderControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~ScZoomSliderControl();
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+//========================================================================
+// class ScZoomSliderWnd define---------------------------------------
+//========================================================================
+class ScZoomSliderWnd: public Window
+{
+private:
+ struct ScZoomSliderWnd_Impl;
+ ScZoomSliderWnd_Impl* mpImpl;
+ Size aLogicalSize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+
+ USHORT Offset2Zoom( long nOffset ) const;
+ long Zoom2Offset( USHORT nZoom ) const;
+ void DoPaint( const Rectangle& rRect );
+
+public:
+ ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , USHORT nCurrentZoom );
+ ~ScZoomSliderWnd();
+ void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
+
+protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+};
+#endif
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index e697878f1ee9..4da2e7c2b45e 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -54,8 +54,8 @@ class ScUndoInsertCells: public ScMoveUndo
public:
TYPEINFO();
ScUndoInsertCells( ScDocShell* pNewDocShell,
- const ScRange& rRange, InsCellCmd eNewCmd,
- ScDocument* pUndoDocument, ScRefUndoData* pRefData,
+ const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
+ InsCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData,
BOOL bNewPartOfPaste );
virtual ~ScUndoInsertCells();
@@ -70,6 +70,9 @@ public:
private:
ScRange aEffRange;
+ SCTAB nCount;
+ SCTAB* pTabs;
+ SCTAB* pScenarios;
ULONG nEndChangeAction;
InsCellCmd eCmd;
BOOL bPartOfPaste;
@@ -85,8 +88,8 @@ class ScUndoDeleteCells: public ScMoveUndo
public:
TYPEINFO();
ScUndoDeleteCells( ScDocShell* pNewDocShell,
- const ScRange& rRange, DelCellCmd eNewCmd,
- ScDocument* pUndoDocument, ScRefUndoData* pRefData );
+ const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
+ DelCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData );
virtual ~ScUndoDeleteCells();
virtual void Undo();
@@ -98,6 +101,9 @@ public:
private:
ScRange aEffRange;
+ SCTAB nCount;
+ SCTAB* pTabs;
+ SCTAB* pScenarios;
ULONG nStartChangeAction;
ULONG nEndChangeAction;
DelCellCmd eCmd;
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 7013fc99bd3a..fd5e13ee805d 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -103,11 +103,14 @@ TYPEINIT1(ScUndoBorder, ScBlockUndo);
//
ScUndoInsertCells::ScUndoInsertCells( ScDocShell* pNewDocShell,
- const ScRange& rRange, InsCellCmd eNewCmd,
- ScDocument* pUndoDocument, ScRefUndoData* pRefData,
+ const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
+ InsCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData,
BOOL bNewPartOfPaste ) :
ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFLAST ),
aEffRange( rRange ),
+ nCount( nNewCount ),
+ pTabs( pNewTabs ),
+ pScenarios( pNewScenarios ),
eCmd( eNewCmd ),
bPartOfPaste( bNewPartOfPaste ),
pPasteUndo( NULL )
@@ -130,6 +133,8 @@ ScUndoInsertCells::ScUndoInsertCells( ScDocShell* pNewDocShell,
__EXPORT ScUndoInsertCells::~ScUndoInsertCells()
{
delete pPasteUndo;
+ delete []pTabs;
+ delete []pScenarios;
}
String __EXPORT ScUndoInsertCells::GetComment() const
@@ -177,6 +182,7 @@ void ScUndoInsertCells::SetChangeTrack()
void ScUndoInsertCells::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
+ SCTAB i;
if ( bUndo )
{
@@ -193,17 +199,27 @@ void ScUndoInsertCells::DoChange( const BOOL bUndo )
{
case INS_INSROWS:
case INS_CELLSDOWN:
- if (bUndo)
- pDoc->DeleteRow( aEffRange );
- else
- pDoc->InsertRow( aEffRange );
+ for( i=0; i<nCount; i++ )
+ {
+ if (bUndo)
+ pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
+ else
+ pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
+ }
break;
case INS_INSCOLS:
case INS_CELLSRIGHT:
- if (bUndo)
- pDoc->DeleteCol( aEffRange );
- else
- pDoc->InsertCol( aEffRange );
+ for( i=0; i<nCount; i++ )
+ {
+ if (bUndo)
+ pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
+ else
+ pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
+ }
break;
default:
{
@@ -214,8 +230,16 @@ void ScUndoInsertCells::DoChange( const BOOL bUndo )
ScRange aWorkRange( aEffRange );
if ( eCmd == INS_CELLSRIGHT ) // only "shift right" requires refresh of the moved area
aWorkRange.aEnd.SetCol(MAXCOL);
- if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) )
- pDoc->ExtendMerge( aWorkRange, TRUE );
+ for( i=0; i<nCount; i++ )
+ {
+ if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
+ {
+ SCCOL nEndCol = aWorkRange.aEnd.Col();
+ SCROW nEndRow = aWorkRange.aEnd.Row();
+ pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], TRUE );
+ }
+ }
//? Undo fuer herausgeschobene Attribute ?
@@ -228,25 +252,29 @@ void ScUndoInsertCells::DoChange( const BOOL bUndo )
aWorkRange.aEnd.SetRow(MAXROW);
break;
case INS_CELLSDOWN:
- aWorkRange.aEnd.SetRow(MAXROW); // bis ganz nach unten
-/*A*/ if ( (pViewShell) && pViewShell->AdjustRowHeight(
- aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), FALSE ) )
+ for( i=0; i<nCount; i++ )
{
- aWorkRange.aStart.SetCol(0);
- aWorkRange.aEnd.SetCol(MAXCOL);
- nPaint |= PAINT_LEFT;
+ aWorkRange.aEnd.SetRow(MAXROW);
+ if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ))
+ {
+ aWorkRange.aStart.SetCol(0);
+ aWorkRange.aEnd.SetCol(MAXCOL);
+ nPaint |= PAINT_LEFT;
+ }
}
break;
case INS_INSCOLS:
nPaint |= PAINT_TOP; // obere Leiste
case INS_CELLSRIGHT:
- aWorkRange.aEnd.SetCol(MAXCOL); // bis ganz nach rechts
-/*A*/ if ( (pViewShell) && pViewShell->AdjustRowHeight(
- aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), FALSE ) )
- { // AdjustDraw zeichnet PAINT_TOP nicht,
- aWorkRange.aStart.SetCol(0); // daher so geloest
- aWorkRange.aEnd.SetRow(MAXROW);
- nPaint |= PAINT_LEFT;
+ for( i=0; i<nCount; i++ )
+ {
+ aWorkRange.aEnd.SetCol(MAXCOL); // bis ganz nach rechts
+ if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i]) )
+ { // AdjustDraw zeichnet PAINT_TOP nicht,
+ aWorkRange.aStart.SetCol(0); // daher so geloest
+ aWorkRange.aEnd.SetRow(MAXROW);
+ nPaint |= PAINT_LEFT;
+ }
}
break;
default:
@@ -254,12 +282,15 @@ void ScUndoInsertCells::DoChange( const BOOL bUndo )
// added to avoid warnings
}
}
- pDocShell->PostPaint( aWorkRange, nPaint );
+
+ for( i=0; i<nCount; i++ )
+ {
+ pDocShell->PostPaint( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i]+pScenarios[i], nPaint );
+ }
pDocShell->PostDataChanged();
if (pViewShell)
pViewShell->CellContentChanged();
-
- ShowTable( aEffRange.aStart.Tab() );
}
void __EXPORT ScUndoInsertCells::Undo()
@@ -314,10 +345,13 @@ BOOL __EXPORT ScUndoInsertCells::CanRepeat(SfxRepeatTarget& rTarget) const
//
ScUndoDeleteCells::ScUndoDeleteCells( ScDocShell* pNewDocShell,
- const ScRange& rRange, DelCellCmd eNewCmd,
- ScDocument* pUndoDocument, ScRefUndoData* pRefData ) :
+ const ScRange& rRange, SCTAB nNewCount, SCTAB* pNewTabs, SCTAB* pNewScenarios,
+ DelCellCmd eNewCmd, ScDocument* pUndoDocument, ScRefUndoData* pRefData ) :
ScMoveUndo( pNewDocShell, pUndoDocument, pRefData, SC_UNDO_REFLAST ),
aEffRange( rRange ),
+ nCount( nNewCount ),
+ pTabs( pNewTabs ),
+ pScenarios( pNewScenarios ),
eCmd( eNewCmd )
{
if (eCmd == DEL_DELROWS) // gaze Zeilen?
@@ -337,6 +371,8 @@ ScUndoDeleteCells::ScUndoDeleteCells( ScDocShell* pNewDocShell,
__EXPORT ScUndoDeleteCells::~ScUndoDeleteCells()
{
+ delete []pTabs;
+ delete []pScenarios;
}
String __EXPORT ScUndoDeleteCells::GetComment() const
@@ -357,6 +393,7 @@ void ScUndoDeleteCells::SetChangeTrack()
void ScUndoDeleteCells::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
+ SCTAB i;
if ( bUndo )
{
@@ -367,28 +404,32 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
else
SetChangeTrack();
- // are there merged cells?
- ScRange aWorkRange( aEffRange );
- if ( eCmd == DEL_CELLSLEFT ) // only "shift left" requires refresh of the moved area
- aWorkRange.aEnd.SetCol(MAXCOL);
- BOOL bMergeBefore = pDoc->HasAttrib( aWorkRange, HASATTR_MERGED );
-
// Ausfuehren
switch (eCmd)
{
case DEL_DELROWS:
case DEL_CELLSUP:
- if (bUndo)
- pDoc->InsertRow( aEffRange );
- else
- pDoc->DeleteRow( aEffRange );
+ for( i=0; i<nCount; i++ )
+ {
+ if (bUndo)
+ pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
+ else
+ pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
+ }
break;
case DEL_DELCOLS:
case DEL_CELLSLEFT:
- if (bUndo)
- pDoc->InsertCol( aEffRange );
- else
- pDoc->DeleteCol( aEffRange );
+ for( i=0; i<nCount; i++ )
+ {
+ if (bUndo)
+ pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
+ else
+ pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
+ }
break;
default:
{
@@ -397,35 +438,47 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
}
// bei Undo Referenzen wiederherstellen
- if (bUndo)
- pRefUndoDoc->CopyToDocument( aEffRange, IDF_ALL, FALSE, pDoc );
+ for( i=0; i<nCount && bUndo; i++ )
+ {
+ pRefUndoDoc->CopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ IDF_ALL, FALSE, pDoc );
+ }
-//? Datenbank muss vor ExtendMerge sein ?????
+ ScRange aWorkRange( aEffRange );
+ if ( eCmd == DEL_CELLSLEFT ) // only "shift left" requires refresh of the moved area
+ aWorkRange.aEnd.SetCol(MAXCOL);
- if ( bMergeBefore || pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) )
+ for( i=0; i<nCount; i++ )
{
- // #i51445# old merge flag attributes must be deleted also for single cells,
- // not only for whole columns/rows
-
- if ( !bUndo )
+ if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
{
- if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT ) aWorkRange.aEnd.SetCol(MAXCOL);
- if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP ) aWorkRange.aEnd.SetRow(MAXROW);
- ScMarkData aMarkData;
- aMarkData.SelectOneTable( aWorkRange.aStart.Tab() );
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
- aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(),
- aMarkData, aPattern );
- }
+ // #i51445# old merge flag attributes must be deleted also for single cells,
+ // not only for whole columns/rows
- pDoc->ExtendMerge( aWorkRange, TRUE );
+ if ( !bUndo )
+ {
+ if ( eCmd==DEL_DELCOLS || eCmd==DEL_CELLSLEFT )
+ aWorkRange.aEnd.SetCol(MAXCOL);
+ if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
+ aWorkRange.aEnd.SetRow(MAXROW);
+ ScMarkData aMarkData;
+ aMarkData.SelectOneTable( aWorkRange.aStart.Tab() );
+ ScPatternAttr aPattern( pDoc->GetPool() );
+ aPattern.GetItemSet().Put( ScMergeFlagAttr() );
+ pDoc->ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(),
+ aMarkData, aPattern );
+ }
+
+ SCCOL nEndCol = aWorkRange.aEnd.Col();
+ SCROW nEndRow = aWorkRange.aEnd.Row();
+ pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], TRUE );
+ }
}
// Zeichnen
USHORT nPaint = PAINT_GRID;
- ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
switch (eCmd)
{
case DEL_DELROWS:
@@ -433,39 +486,46 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
aWorkRange.aEnd.SetRow(MAXROW);
break;
case DEL_CELLSUP:
- aWorkRange.aEnd.SetRow(MAXROW);
-/*A*/ if ( (pViewShell) && pViewShell->AdjustRowHeight(
- aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), FALSE ) )
+ for( i=0; i<nCount; i++ )
{
- aWorkRange.aStart.SetCol(0);
- aWorkRange.aEnd.SetCol(MAXCOL);
- nPaint |= PAINT_LEFT;
+ aWorkRange.aEnd.SetRow(MAXROW);
+ if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ))
+ {
+ aWorkRange.aStart.SetCol(0);
+ aWorkRange.aEnd.SetCol(MAXCOL);
+ nPaint |= PAINT_LEFT;
+ }
}
break;
case DEL_DELCOLS:
nPaint |= PAINT_TOP; // obere Leiste
case DEL_CELLSLEFT:
- aWorkRange.aEnd.SetCol(MAXCOL); // bis ganz nach rechts
-/*A*/ if ( (pViewShell) && pViewShell->AdjustRowHeight(
- aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), FALSE ) )
+ for( i=0; i<nCount; i++ )
{
- aWorkRange.aStart.SetCol(0);
- aWorkRange.aEnd.SetRow(MAXROW);
- nPaint |= PAINT_LEFT;
+ aWorkRange.aEnd.SetCol(MAXCOL); // bis ganz nach rechts
+ if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ) )
+ {
+ aWorkRange.aStart.SetCol(0);
+ aWorkRange.aEnd.SetRow(MAXROW);
+ nPaint |= PAINT_LEFT;
+ }
}
+ break;
default:
{
// added to avoid warnings
}
}
- pDocShell->PostPaint( aWorkRange, nPaint, SC_PF_LINES ); //! auf Lines testen
+ for( i=0; i<nCount; i++ )
+ {
+ pDocShell->PostPaint( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i]+pScenarios[i], nPaint, SC_PF_LINES );
+ }
// Markierung erst nach EndUndo
pDocShell->PostDataChanged();
// CellContentChanged kommt mit der Markierung
-
- ShowTable( aEffRange.aStart.Tab() );
}
void __EXPORT ScUndoDeleteCells::Undo()
@@ -479,7 +539,12 @@ void __EXPORT ScUndoDeleteCells::Undo()
// Markierung erst nach EndUndo
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
- pViewShell->MarkRange( aEffRange );
+ {
+ for( SCTAB i=0; i<nCount; i++ )
+ {
+ pViewShell->MarkRange( ScRange(aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i]) );
+ }
+ }
}
void __EXPORT ScUndoDeleteCells::Redo()
@@ -1245,6 +1310,11 @@ void __EXPORT ScUndoDragDrop::Redo()
BOOL bIncludeFiltered = bCut;
pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc, TRUE, FALSE, bIncludeFiltered );
+ if (bCut)
+ for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
+ pDoc->RefreshAutoFilter( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
+ aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), nTab );
+
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
pDocShell->GetDocFunc().UnmergeCells( aDestRange, FALSE, TRUE );
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index ab7350984a86..513cdaa0dd10 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1034,6 +1034,10 @@ void __EXPORT ScUndoQuery::Undo()
if (!bCopy)
pDoc->UpdatePageBreaks( nTab );
+ ScRange aDirtyRange( 0 , aQueryParam.nRow1, nTab,
+ MAXCOL, aQueryParam.nRow2, nTab );
+ pDoc->SetDirty( aDirtyRange );
+
DoSdrUndoAction( pDrawUndo, pDoc );
SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index a1ba92c8e1c7..29ab226d7d53 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7275,7 +7275,7 @@ void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRang
ScRange aScRange;
ScUnoConversion::FillScRange( aScRange, rRangeAddress );
ScDocFunc aFunc(*pDocSh);
- aFunc.InsertCells( aScRange, eCmd, TRUE, TRUE );
+ aFunc.InsertCells( aScRange, NULL, eCmd, TRUE, TRUE );
}
}
}
@@ -7307,7 +7307,7 @@ void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRang
ScRange aScRange;
ScUnoConversion::FillScRange( aScRange, rRangeAddress );
ScDocFunc aFunc(*pDocSh);
- aFunc.DeleteCells( aScRange, eCmd, TRUE, TRUE );
+ aFunc.DeleteCells( aScRange, NULL, eCmd, TRUE, TRUE );
}
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 800f571c526b..85fe13c8b71e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2359,7 +2359,7 @@ void SAL_CALL ScTableColumnsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 n
ScDocFunc aFunc(*pDocShell);
ScRange aRange( (SCCOL)(nStartCol+nPosition), 0, nTab,
(SCCOL)(nStartCol+nPosition+nCount-1), MAXROW, nTab );
- bDone = aFunc.InsertCells( aRange, INS_INSCOLS, TRUE, TRUE );
+ bDone = aFunc.InsertCells( aRange, NULL, INS_INSCOLS, TRUE, TRUE );
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -2376,7 +2376,7 @@ void SAL_CALL ScTableColumnsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCou
ScDocFunc aFunc(*pDocShell);
ScRange aRange( (SCCOL)(nStartCol+nIndex), 0, nTab,
(SCCOL)(nStartCol+nIndex+nCount-1), MAXROW, nTab );
- bDone = aFunc.DeleteCells( aRange, DEL_DELCOLS, TRUE, TRUE );
+ bDone = aFunc.DeleteCells( aRange, NULL, DEL_DELCOLS, TRUE, TRUE );
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -2624,7 +2624,7 @@ void SAL_CALL ScTableRowsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCou
ScDocFunc aFunc(*pDocShell);
ScRange aRange( 0, (SCROW)(nStartRow+nPosition), nTab,
MAXCOL, (SCROW)(nStartRow+nPosition+nCount-1), nTab );
- bDone = aFunc.InsertCells( aRange, INS_INSROWS, TRUE, TRUE );
+ bDone = aFunc.InsertCells( aRange, NULL, INS_INSROWS, TRUE, TRUE );
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
@@ -2641,7 +2641,7 @@ void SAL_CALL ScTableRowsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount
ScDocFunc aFunc(*pDocShell);
ScRange aRange( 0, (SCROW)(nStartRow+nIndex), nTab,
MAXCOL, (SCROW)(nStartRow+nIndex+nCount-1), nTab );
- bDone = aFunc.DeleteCells( aRange, DEL_DELROWS, TRUE, TRUE );
+ bDone = aFunc.DeleteCells( aRange, NULL, DEL_DELROWS, TRUE, TRUE );
}
if (!bDone)
throw uno::RuntimeException(); // no other exceptions specified
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 969c0d0bd20f..b79e2ab0e54a 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1440,6 +1440,7 @@ void ScTabViewObj::SetZoom(INT16 nZoom)
pViewSh->PaintTop();
pViewSh->PaintLeft();
pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
}
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index b870fdfe64ee..c61466267ead 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -335,15 +335,27 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
SfxItemSet aArgSet( GetPool(), SCITEM_SORTDATA, SCITEM_SORTDATA );
ScSortParam aSortParam;
ScDBData* pDBData = pTabViewShell->GetDBData();
+ SCCOL nCol = GetViewData()->GetCurX();
+ SCCOL nTab = GetViewData()->GetTabNo();
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ BOOL bHasHeader = FALSE;
pDBData->GetSortParam( aSortParam );
- aSortParam.bHasHeader = FALSE;
+
+ bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
+
+ if( nCol < aSortParam.nCol1 )
+ nCol = aSortParam.nCol1;
+ else if( nCol > aSortParam.nCol2 )
+ nCol = aSortParam.nCol2;
+
+ aSortParam.bHasHeader = bHasHeader;
aSortParam.bByRow = TRUE;
aSortParam.bCaseSens = FALSE;
aSortParam.bIncludePattern = FALSE;
aSortParam.bInplace = TRUE;
aSortParam.bDoSort[0] = TRUE;
- aSortParam.nField[0] = aSortParam.nCol1;
+ aSortParam.nField[0] = nCol;
aSortParam.bAscending[0] = (nSlotId == SID_SORT_ASCENDING);
for ( USHORT i=1; i<MAXSORT; i++ )
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index fc5de4cbca97..b6cd29a7d714 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3783,7 +3783,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
if ( meDragInsertMode != INS_NONE )
{
// call with bApi = TRUE to avoid error messages in drop handler
- bDone = pDocSh->GetDocFunc().InsertCells( aDest, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
+ bDone = pDocSh->GetDocFunc().InsertCells( aDest, NULL, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
if ( bDone )
{
if ( nThisTab == nSourceTab )
@@ -3834,7 +3834,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
( eCmd == DEL_CELLSLEFT && nDestPosY == aSource.aStart.Row() ) )
{
// call with bApi = TRUE to avoid error messages in drop handler
- bDone = pDocSh->GetDocFunc().DeleteCells( aSource, eCmd, TRUE /*bRecord*/, TRUE /*bApi*/ );
+ bDone = pDocSh->GetDocFunc().DeleteCells( aSource, NULL, eCmd, TRUE /*bRecord*/, TRUE /*bApi*/ );
if ( bDone )
{
if ( eCmd == DEL_CELLSUP && nDestPosY > aSource.aEnd.Row() )
@@ -3920,7 +3920,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
if ( meDragInsertMode != INS_NONE )
{
// call with bApi = TRUE to avoid error messages in drop handler
- bDone = pDocSh->GetDocFunc().InsertCells( aDest, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
+ bDone = pDocSh->GetDocFunc().InsertCells( aDest, NULL, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
if ( bDone )
{
pDocSh->UpdateOle( pViewData );
@@ -3979,7 +3979,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
if ( meDragInsertMode != INS_NONE )
{
// call with bApi = TRUE to avoid error messages in drop handler
- bDone = pDocSh->GetDocFunc().InsertCells( aDest, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
+ bDone = pDocSh->GetDocFunc().InsertCells( aDest, NULL, meDragInsertMode, TRUE /*bRecord*/, TRUE /*bApi*/, TRUE /*bPartOfPaste*/ );
if ( bDone )
{
pDocSh->UpdateOle( pViewData );
@@ -4317,6 +4317,8 @@ void ScGridWindow::UpdateFormulas()
{
Invalidate( aChangedPoly );
}
+
+ CheckNeedsRepaint(); // #i90362# used to be called via Draw() - still needed here
}
void ScGridWindow::UpdateAutoFillMark(BOOL bMarked, const ScRange& rMarkRange)
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 0bfddff37567..19aacbef4681 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -56,9 +56,11 @@
#include "prevwsh.hxx"
#include "prevloc.hxx"
#include "docsh.hxx"
+#include "docfunc.hxx"
#include "printfun.hxx"
#include "printopt.hxx"
#include "stlpool.hxx"
+#include "undostyl.hxx"
#include "drwlayer.hxx"
#include "scmod.hxx"
#include "globstr.hrc"
@@ -224,14 +226,15 @@ void ScPreview::TestLastPage()
}
-void ScPreview::CalcPages( SCTAB nToWhichTab )
+void ScPreview::CalcPages( SCTAB /*nToWhichTab*/ )
{
WaitObject( this );
ScDocument* pDoc = pDocShell->GetDocument();
nTabCount = pDoc->GetTableCount();
- SCTAB nAnz = Min( nTabCount, SCTAB(nToWhichTab+1) );
+ //SCTAB nAnz = Min( nTabCount, SCTAB(nToWhichTab+1) );
+ SCTAB nAnz = nTabCount;
SCTAB nStart = nTabsTested;
if (!bValid)
{
@@ -962,6 +965,8 @@ void ScPreview::StaticInvalidate()
rBindings.Invalidate(SID_ATTR_ZOOM);
rBindings.Invalidate(SID_PREVIEW_ZOOMIN);
rBindings.Invalidate(SID_PREVIEW_ZOOMOUT);
+ rBindings.Invalidate(SID_PREVIEW_SCALINGFACTOR);
+ rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
}
IMPL_STATIC_LINK( ScPreview, InvalidateHdl, void*, EMPTYARG )
@@ -1100,51 +1105,74 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
BOOL bMoveRulerAction= TRUE;
ScDocument * pDoc = pDocShell->GetDocument();
+ String aOldName = pDoc->GetPageStyle( nTab );
+ BOOL bUndo( pDoc->IsUndoEnabled() );
ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
- SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE );
- SfxItemSet* pParamSet = NULL;
- if (pStyleSheet)
- pParamSet = &pStyleSheet->GetItemSet();
- SvxLRSpaceItem* pLRItem = ( SvxLRSpaceItem*) &pParamSet->Get( ATTR_LRSPACE );
-
- if(( bLeftRulerChange || bRightRulerChange ) && ( aButtonUpPt.X() <= ( 0 - aOffset.X() ) || aButtonUpPt.X() > nWidth * HMM_PER_TWIPS - aOffset.X() ) )
- {
- bMoveRulerAction = FALSE;
- Paint(Rectangle(0,0,10000,10000));
- }
- else if( bLeftRulerChange && ( aButtonUpPt.X() / HMM_PER_TWIPS > nWidth - pLRItem->GetRight() - aOffset.X() / HMM_PER_TWIPS ) )
- {
- bMoveRulerAction = FALSE;
- Paint(Rectangle(0,0,10000,10000));
- }
- else if( bRightRulerChange && ( aButtonUpPt.X() / HMM_PER_TWIPS < pLRItem->GetLeft() - aOffset.X() / HMM_PER_TWIPS ) )
+ if ( pStyleSheet )
{
- bMoveRulerAction = FALSE;
- Paint(Rectangle(0,0,10000,10000));
- }
- else if( aButtonDownPt.X() == aButtonUpPt.X() )
- {
- bMoveRulerAction = FALSE;
- DrawInvert( aButtonUpPt.X(), POINTER_HSIZEBAR );
- }
- if( bMoveRulerAction )
- {
- if( bLeftRulerChange && bLeftRulerMove )
- pLRItem->SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ), 100 );
- else if( bRightRulerChange && bRightRulerMove )
- pLRItem->SetRight( (long)( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ),100 );
+ ScStyleSaveData aOldData;
+ if( bUndo )
+ aOldData.InitFromStyle( pStyleSheet );
- if ( ValidTab( nTab ) )
+ SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
+
+ SvxLRSpaceItem aLRItem = ( const SvxLRSpaceItem& ) rStyleSet.Get( ATTR_LRSPACE );
+
+ if(( bLeftRulerChange || bRightRulerChange ) && ( aButtonUpPt.X() <= ( 0 - aOffset.X() ) || aButtonUpPt.X() > nWidth * HMM_PER_TWIPS - aOffset.X() ) )
{
- ScPrintFunc aPrintFunc( pDocShell, this, nTab );
- aPrintFunc.UpdatePages();
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( bLeftRulerChange && ( aButtonUpPt.X() / HMM_PER_TWIPS > nWidth - aLRItem.GetRight() - aOffset.X() / HMM_PER_TWIPS ) )
+ {
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( bRightRulerChange && ( aButtonUpPt.X() / HMM_PER_TWIPS < aLRItem.GetLeft() - aOffset.X() / HMM_PER_TWIPS ) )
+ {
+ bMoveRulerAction = FALSE;
+ Paint(Rectangle(0,0,10000,10000));
+ }
+ else if( aButtonDownPt.X() == aButtonUpPt.X() )
+ {
+ bMoveRulerAction = FALSE;
+ DrawInvert( aButtonUpPt.X(), POINTER_HSIZEBAR );
}
+ if( bMoveRulerAction )
+ {
+ if( bLeftRulerChange && bLeftRulerMove )
+ {
+ aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ));
+ rStyleSet.Put( aLRItem );
+ }
+ else if( bRightRulerChange && bRightRulerMove )
+ {
+ aLRItem.SetRight( (long)( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ));
+ rStyleSet.Put( aLRItem );
+ }
- Rectangle aRect(0,0,10000,10000);
- Paint( aRect );
- bLeftRulerChange = FALSE;
- bRightRulerChange = FALSE;
+ ScStyleSaveData aNewData;
+ aNewData.InitFromStyle( pStyleSheet );
+ if( bUndo )
+ {
+ pDocShell->GetUndoManager()->AddUndoAction(
+ new ScUndoModifyStyle( pDocShell, SFX_STYLE_FAMILY_PAGE,
+ aOldData, aNewData ) );
+ }
+
+ if ( ValidTab( nTab ) )
+ {
+ ScPrintFunc aPrintFunc( pDocShell, this, nTab );
+ aPrintFunc.UpdatePages();
+ }
+
+ Rectangle aRect(0,0,10000,10000);
+ Paint( aRect );
+ bLeftRulerChange = FALSE;
+ bRightRulerChange = FALSE;
+ }
}
bLeftRulerMove = FALSE;
bRightRulerMove = FALSE;
@@ -1168,47 +1196,68 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( bMoveRulerAction )
{
ScDocument * pDoc = pDocShell->GetDocument();
+ BOOL bUndo( pDoc->IsUndoEnabled() );
ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE );
DBG_ASSERT( pStyleSheet, "PageStyle not found" );
if ( pStyleSheet )
{
- SfxItemSet& rSet = pStyleSheet->GetItemSet();
- SvxULSpaceItem* pULItem = ( SvxULSpaceItem*) &rSet.Get( ATTR_ULSPACE );
+ ScStyleSaveData aOldData;
+ if( bUndo )
+ aOldData.InitFromStyle( pStyleSheet );
+
+ SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
+
+ SvxULSpaceItem aULItem = ( const SvxULSpaceItem&)rStyleSet.Get( ATTR_ULSPACE );
if( bTopRulerMove && bTopRulerChange )
- pULItem->SetUpper( (USHORT)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ {
+ aULItem.SetUpperValue( (USHORT)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) );
+ rStyleSet.Put( aULItem );
+ }
else if( bBottomRulerMove && bBottomRulerChange )
- pULItem->SetLower( (USHORT)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ), 100 );
+ {
+ aULItem.SetLowerValue( (USHORT)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) );
+ rStyleSet.Put( aULItem );
+ }
else if( bHeaderRulerMove && bHeaderRulerChange )
{
const SfxPoolItem* pItem = NULL;
- if ( rSet.GetItemState( ATTR_PAGE_HEADERSET, FALSE, &pItem ) == SFX_ITEM_SET )
+ if ( rStyleSet.GetItemState( ATTR_PAGE_HEADERSET, FALSE, &pItem ) == SFX_ITEM_SET )
{
SfxItemSet& pHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
Size aHeaderSize = ((const SvxSizeItem&)pHeaderSet.Get(ATTR_PAGE_SIZE)).GetSize();
- aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - pULItem->GetUpper());
+ aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper());
aHeaderSize.Height() = aHeaderSize.Height() * 100 / mnScale;
- SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
+ SvxSetItem aNewHeader( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_HEADERSET) );
aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
- rSet.Put( aNewHeader );
+ rStyleSet.Put( aNewHeader );
}
}
else if( bFooterRulerMove && bFooterRulerChange )
{
const SfxPoolItem* pItem = NULL;
- if( rSet.GetItemState( ATTR_PAGE_FOOTERSET, FALSE, &pItem ) == SFX_ITEM_SET )
+ if( rStyleSet.GetItemState( ATTR_PAGE_FOOTERSET, FALSE, &pItem ) == SFX_ITEM_SET )
{
SfxItemSet& pFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
Size aFooterSize = ((const SvxSizeItem&)pFooterSet.Get(ATTR_PAGE_SIZE)).GetSize();
- aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - pULItem->GetLower() );
+ aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() );
aFooterSize.Height() = aFooterSize.Height() * 100 / mnScale;
- SvxSetItem aNewFooter( (const SvxSetItem&)rSet.Get(ATTR_PAGE_FOOTERSET) );
+ SvxSetItem aNewFooter( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_FOOTERSET) );
aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) );
- rSet.Put( aNewFooter );
+ rStyleSet.Put( aNewFooter );
}
}
+ ScStyleSaveData aNewData;
+ aNewData.InitFromStyle( pStyleSheet );
+ if( bUndo )
+ {
+ pDocShell->GetUndoManager()->AddUndoAction(
+ new ScUndoModifyStyle( pDocShell, SFX_STYLE_FAMILY_PAGE,
+ aOldData, aNewData ) );
+ }
+
if ( ValidTab( nTab ) )
{
ScPrintFunc aPrintFunc( pDocShell, this, nTab );
@@ -1246,6 +1295,8 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( bMoveRulerAction )
{
long nNewColWidth = 0;
+ ScDocFunc aFunc(*pDocShell);
+ SCCOLROW nCols[2] = { nColNumberButttonDown, nColNumberButttonDown };
if( !bLayoutRTL )
{
@@ -1261,7 +1312,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( nNewColWidth >= 0 )
{
- pDocShell->GetDocument()->SetColWidth( nColNumberButttonDown, nTab, (USHORT)nNewColWidth );
+ aFunc.SetWidthOrHeight( TRUE, 1,nCols, nTab, SC_SIZE_DIRECT, (USHORT)nNewColWidth, TRUE, TRUE);
}
if ( ValidTab( nTab ) )
{
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 6f733caecd66..ae316bcee196 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -41,6 +41,7 @@
#include <sfx2/app.hxx>
#include <svx/sizeitem.hxx>
#include <svx/srchitem.hxx>
+#include <svx/zoomslideritem.hxx>
#include <svx/svdview.hxx>
//CHINA001 #include <svx/zoom.hxx>
#include <sfx2/dispatch.hxx>
@@ -51,12 +52,18 @@
#include <svtools/stritem.hxx>
#include <svtools/whiter.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
#include <tools/urlobj.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/printer.hxx>
+#ifndef _SVX_ZOOMSLIDERITEM_HXX
+#include <svx/zoomslideritem.hxx>
+#endif
#include "prevwsh.hxx"
#include "preview.hxx"
+#include "printfun.hxx"
+#include "attrib.hxx"
#include "scmod.hxx"
#include "inputhdl.hxx"
#include "docsh.hxx"
@@ -83,6 +90,8 @@
#include "scabstdlg.hxx" //CHINA001
// fuer Rad-Maus
#define SC_DELTA_ZOOM 10
+#define MINZOOM_SLIDER 10
+#define MAXZOOM_SLIDER 400
#define SC_USERDATA_SEP ';'
@@ -298,66 +307,145 @@ void ScPreviewShell::UpdateScrollBars()
Point aOfs = pPreview->GetOffset();
long nMaxPos;
- pHorScroll->SetRange( Range( 0, aPageSize.Width() ) );
- pHorScroll->SetLineSize( aWindowSize.Width() / 16 );
- pHorScroll->SetPageSize( aWindowSize.Width() );
- pHorScroll->SetVisibleSize( aWindowSize.Width() );
- nMaxPos = aPageSize.Width() - aWindowSize.Width();
- if (nMaxPos<0)
- {
- // page smaller than window -> center (but put scrollbar to 0)
- aOfs.X() = 0;
- pPreview->SetXOffset( nMaxPos / 2 );
- }
- else if (aOfs.X() < 0)
- {
- // page larger than window -> never use negative offset
- aOfs.X() = 0;
- pPreview->SetXOffset( 0 );
- }
- else if (aOfs.X() > nMaxPos)
- {
- // limit offset to align with right edge of window
- aOfs.X() = nMaxPos;
- pPreview->SetXOffset(nMaxPos);
- }
- pHorScroll->SetThumbPos( aOfs.X() );
-
- pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
- pVerScroll->SetLineSize( aWindowSize.Height() / 16 );
- pVerScroll->SetPageSize( aWindowSize.Height() );
- pVerScroll->SetVisibleSize( aWindowSize.Height() );
- nMaxPos = aPageSize.Height() - aWindowSize.Height();
- if (nMaxPos<0)
- {
- // page smaller than window -> center (but put scrollbar to 0)
- aOfs.Y() = 0;
- pPreview->SetYOffset( nMaxPos / 2 );
- }
- else if (aOfs.Y() < 0)
+ if( pHorScroll )
{
- // page larger than window -> never use negative offset
- aOfs.Y() = 0;
- pPreview->SetYOffset( 0 );
+ pHorScroll->SetRange( Range( 0, aPageSize.Width() ) );
+ pHorScroll->SetLineSize( aWindowSize.Width() / 16 );
+ pHorScroll->SetPageSize( aWindowSize.Width() );
+ pHorScroll->SetVisibleSize( aWindowSize.Width() );
+ nMaxPos = aPageSize.Width() - aWindowSize.Width();
+ if ( nMaxPos<0 )
+ {
+ // page smaller than window -> center (but put scrollbar to 0)
+ aOfs.X() = 0;
+ pPreview->SetXOffset( nMaxPos / 2 );
+ }
+ else if (aOfs.X() < 0)
+ {
+ // page larger than window -> never use negative offset
+ aOfs.X() = 0;
+ pPreview->SetXOffset( 0 );
+ }
+ else if (aOfs.X() > nMaxPos)
+ {
+ // limit offset to align with right edge of window
+ aOfs.X() = nMaxPos;
+ pPreview->SetXOffset(nMaxPos);
+ }
+ pHorScroll->SetThumbPos( aOfs.X() );
}
- else if (aOfs.Y() > nMaxPos)
+
+ if( pVerScroll )
{
- // limit offset to align with window bottom
- aOfs.Y() = nMaxPos;
- pPreview->SetYOffset(nMaxPos);
+ long nPageNo = pPreview->GetPageNo();
+ long nTotalPages = pPreview->GetTotalPages();
+
+ nMaxVertPos = aPageSize.Height() - aWindowSize.Height();
+ pVerScroll->SetLineSize( aWindowSize.Height() / 16 );
+ pVerScroll->SetPageSize( aWindowSize.Height() );
+ pVerScroll->SetVisibleSize( aWindowSize.Height() );
+ if ( nMaxVertPos < 0 )
+ {
+ // page smaller than window -> center (but put scrollbar to 0)
+ aOfs.Y() = 0;
+ pPreview->SetYOffset( nMaxVertPos / 2 );
+ pVerScroll->SetThumbPos( nPageNo * aWindowSize.Height() );
+ pVerScroll->SetRange( Range( 0, aWindowSize.Height() * nTotalPages ));
+ }
+ else if (aOfs.Y() < 0)
+ {
+ // page larger than window -> never use negative offset
+ pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
+ aOfs.Y() = 0;
+ pPreview->SetYOffset( 0 );
+ pVerScroll->SetThumbPos( aOfs.Y() );
+ }
+ else if (aOfs.Y() > nMaxVertPos )
+ {
+ // limit offset to align with window bottom
+ pVerScroll->SetRange( Range( 0, aPageSize.Height() ) );
+ aOfs.Y() = nMaxVertPos;
+ pPreview->SetYOffset( nMaxVertPos );
+ pVerScroll->SetThumbPos( aOfs.Y() );
+ }
}
- pVerScroll->SetThumbPos( aOfs.Y() );
}
IMPL_LINK (ScPreviewShell,ScrollHandler, ScrollBar* ,pScroll )
{
- long nPos = pScroll->GetThumbPos();
+ long nPos = pScroll->GetThumbPos();
+ long nDelta = pScroll->GetDelta();
+ long nMaxRange = pScroll->GetRangeMax();
+ long nTotalPages = pPreview->GetTotalPages();
+ long nPageNo = 0;
+ long nPerPageLength = 0;
+ BOOL bIsDivide = TRUE;
+
+ if( nTotalPages )
+ nPerPageLength = nMaxRange / nTotalPages;
+
+ if( nPerPageLength )
+ {
+ nPageNo = nPos / nPerPageLength;
+ if( nPos % nPerPageLength )
+ {
+ bIsDivide = FALSE;
+ nPageNo ++;
+ }
+ }
BOOL bHoriz = ( pScroll == pHorScroll );
- if (bHoriz)
+
+ if( bHoriz )
pPreview->SetXOffset( nPos );
else
- pPreview->SetYOffset( nPos );
+ {
+ if( nMaxVertPos > 0 )
+ pPreview->SetYOffset( nPos );
+ else
+ {
+ Point aMousePos = pScroll->OutputToNormalizedScreenPixel( pScroll->GetPointerPosPixel() );
+ Point aPos = pScroll->GetParent()->OutputToNormalizedScreenPixel( pScroll->GetPosPixel() );
+ String aHelpStr;
+ Rectangle aRect;
+ USHORT nAlign;
+
+ if( nDelta < 0 )
+ {
+ if ( nTotalPages && nPageNo > 0 && !bIsDivide )
+ pPreview->SetPageNo( nPageNo-1 );
+ if( bIsDivide )
+ pPreview->SetPageNo( nPageNo );
+
+ aHelpStr = ScGlobal::GetRscString( STR_PAGE );
+ aHelpStr += ' ';
+ aHelpStr += String::CreateFromInt32( nPageNo );
+
+ aHelpStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aHelpStr += String::CreateFromInt32( nTotalPages );
+ }
+ else if( nDelta > 0 )
+ {
+ BOOL bAllTested = pPreview->AllTested();
+ if ( nTotalPages && ( nPageNo < nTotalPages || !bAllTested ) )
+ pPreview->SetPageNo( nPageNo );
+
+ aHelpStr = ScGlobal::GetRscString( STR_PAGE );
+ aHelpStr += ' ';
+ aHelpStr += String::CreateFromInt32( nPageNo+1 );
+
+ aHelpStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aHelpStr += String::CreateFromInt32( nTotalPages );
+ }
+
+ aRect.Left() = aPos.X() - 8;
+ aRect.Top() = aMousePos.Y();
+ aRect.Right() = aRect.Left();
+ aRect.Top() = aRect.Top();
+ nAlign = QUICKHELP_BOTTOM|QUICKHELP_CENTER;
+ Help::ShowQuickHelp( pScroll->GetParent(), aRect, aHelpStr, nAlign );
+ }
+ }
return 0;
}
@@ -685,6 +773,42 @@ void __EXPORT ScPreviewShell::Execute( SfxRequest& rReq )
rReq.Done();
}
break;
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ const SfxPoolItem* pItem;
+ eZoom = SVX_ZOOM_PERCENT;
+ if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_ZOOMSLIDER, TRUE, &pItem ) )
+ {
+ const USHORT nCurrentZoom = ((const SvxZoomSliderItem*)pItem)->GetValue();
+ if( nCurrentZoom )
+ {
+ pPreview->SetZoom( nCurrentZoom );
+ rReq.Done();
+ }
+ }
+ }
+ break;
+ case SID_PREVIEW_SCALINGFACTOR:
+ {
+ const SfxPoolItem* pItem;
+ SCTAB nTab = pPreview->GetTab();
+ String aOldName = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() );
+ ScStyleSheetPool* pStylePool = pDocShell->GetDocument()->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE );
+ DBG_ASSERT( pStyleSheet, "PageStyle not found! :-/" );
+
+ if ( pReqArgs && pStyleSheet && SFX_ITEM_SET == pReqArgs->GetItemState( SID_PREVIEW_SCALINGFACTOR, TRUE, &pItem ) )
+ {
+ const USHORT nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
+ SfxItemSet& rSet = pStyleSheet->GetItemSet();
+ rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nCurrentZoom ) );
+ ScPrintFunc aPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab );
+ aPrintFunc.UpdatePages();
+ rReq.Done();
+ }
+ GetViewFrame()->GetBindings().Invalidate( nSlot );
+ }
+ break;
case SID_PRINTPREVIEW:
case SID_PREVIEW_CLOSE:
// print preview is now always in the same frame as the tab view
@@ -760,6 +884,40 @@ void __EXPORT ScPreviewShell::GetState( SfxItemSet& rSet )
rSet.Put( aZoom );
}
break;
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ SvxZoomSliderItem aZoomSliderItem( nZoom, MINZOOM, MAXZOOM, SID_ATTR_ZOOMSLIDER );
+ aZoomSliderItem.AddSnappingPoint( 100 );
+ rSet.Put( aZoomSliderItem );
+ }
+ break;
+ case SID_PREVIEW_SCALINGFACTOR:
+ {
+ if( pDocShell->IsReadOnly() )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ String aOldName = pDocShell->GetDocument()->GetPageStyle( pPreview->GetTab() );
+ ScStyleSheetPool* pStylePool = pDocShell->GetDocument()->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aOldName, SFX_STYLE_FAMILY_PAGE );
+ DBG_ASSERT( pStyleSheet, "PageStyle not found! :-/" );
+
+ if ( pStyleSheet )
+ {
+ SfxItemSet& rStyleSet = pStyleSheet->GetItemSet();
+ USHORT nCurrentZoom = ((const SfxUInt16Item&)rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue();
+ if( nCurrentZoom )
+ {
+ SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_SCALINGFACTOR );
+ aZoomSliderItem.AddSnappingPoint( 100 );
+ rSet.Put( aZoomSliderItem );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ }
+ }
+ }
+ break;
case SID_STATUS_DOCPOS:
rSet.Put( SfxStringItem( nWhich, pPreview->GetPosString() ) );
break;
@@ -891,10 +1049,42 @@ void ScPreviewShell::DoScroll( USHORT nMode )
switch( nMode )
{
case SID_CURSORUP:
- aCurPos.Y() -= nVLine;
+ if( nMaxVertPos<0 )
+ {
+ long nPage = pPreview->GetPageNo();
+
+ if( nPage>0 )
+ {
+ SfxViewFrame* pSfxViewFrame = GetViewFrame();
+ SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_PREVIOUS );
+ Execute( aSfxRequest );
+ }
+ }
+ else
+ aCurPos.Y() -= nVLine;
break;
case SID_CURSORDOWN:
- aCurPos.Y() += nVLine;
+ if( nMaxVertPos<0 )
+ {
+ long nPage = pPreview->GetPageNo();
+ long nTotal = pPreview->GetTotalPages();
+
+ // before testing for last page, make sure all page counts are calculated
+ if ( nPage+1 == nTotal && !pPreview->AllTested() )
+ {
+ pPreview->CalcAll();
+ nTotal = pPreview->GetTotalPages();
+ }
+
+ if( nPage<nTotal-1 )
+ {
+ SfxViewFrame* pSfxViewFrame = GetViewFrame();
+ SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_NEXT );
+ Execute( aSfxRequest );
+ }
+ }
+ else
+ aCurPos.Y() += nVLine;
break;
case SID_CURSORLEFT:
aCurPos.X() -= nHLine;
@@ -903,7 +1093,7 @@ void ScPreviewShell::DoScroll( USHORT nMode )
aCurPos.X() += nHLine;
break;
case SID_CURSORPAGEUP:
- if(nThumbPos==0)
+ if( nThumbPos==0 || nMaxVertPos<0 )
{
long nPage = pPreview->GetPageNo();
@@ -919,7 +1109,7 @@ void ScPreviewShell::DoScroll( USHORT nMode )
aCurPos.Y() -= nVPage;
break;
case SID_CURSORPAGEDOWN:
- if((abs(nVPage+nThumbPos-nRangeMax)<10)||(nVPage>nRangeMax))
+ if( (abs(nVPage+nThumbPos-nRangeMax)<10) || nMaxVertPos<0 )
{
long nPage = pPreview->GetPageNo();
long nTotal = pPreview->GetTotalPages();
@@ -930,7 +1120,6 @@ void ScPreviewShell::DoScroll( USHORT nMode )
pPreview->CalcAll();
nTotal = pPreview->GetTotalPages();
}
-
if( nPage<nTotal-1 )
{
SfxViewFrame* pSfxViewFrame = GetViewFrame();
@@ -943,26 +1132,63 @@ void ScPreviewShell::DoScroll( USHORT nMode )
aCurPos.Y() += nVPage;
break;
case SID_CURSORHOME:
- aCurPos.Y() = 0;
- aCurPos.X() = 0;
+ if( nMaxVertPos<0 )
+ {
+ long nPage = pPreview->GetPageNo();
+ long nTotal = pPreview->GetTotalPages();
+ if( nTotal && nPage != 0 )
+ {
+ SfxViewFrame* pSfxViewFrame = GetViewFrame();
+ SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_FIRST );
+ Execute( aSfxRequest );
+ }
+ }
+ else
+ {
+ aCurPos.Y() = 0;
+ aCurPos.X() = 0;
+ }
break;
case SID_CURSOREND:
- aCurPos.Y() = nVRange;
- aCurPos.X() = nHRange;
+ if( nMaxVertPos<0 )
+ {
+ if( !pPreview->AllTested() )
+ pPreview->CalcAll();
+ long nPage = pPreview->GetPageNo();
+ long nTotal = pPreview->GetTotalPages();
+ if( nTotal && nPage+1 != nTotal )
+ {
+ SfxViewFrame* pSfxViewFrame = GetViewFrame();
+ SfxRequest aSfxRequest( pSfxViewFrame, SID_PREVIEW_LAST );
+ Execute( aSfxRequest );
+ }
+ }
+ else
+ {
+ aCurPos.Y() = nVRange;
+ aCurPos.X() = nHRange;
+ }
break;
}
// nHRange-nHPage kann negativ sein, deshalb Abfrage auf < 0 hinterher
- if( aCurPos.Y() > (nVRange-nVPage) ) aCurPos.Y() = (nVRange-nVPage);
- if( aCurPos.Y() < 0 ) aCurPos.Y() = 0;
- if( aCurPos.X() > (nHRange-nHPage) ) aCurPos.X() = (nHRange-nHPage);
- if( aCurPos.X() < 0 ) aCurPos.X() = 0;
+ if( aCurPos.Y() > (nVRange-nVPage) )
+ aCurPos.Y() = (nVRange-nVPage);
+ if( aCurPos.Y() < 0 )
+ aCurPos.Y() = 0;
+ if( aCurPos.X() > (nHRange-nHPage) )
+ aCurPos.X() = (nHRange-nHPage);
+ if( aCurPos.X() < 0 )
+ aCurPos.X() = 0;
- if( aCurPos.Y() != aPrevPos.Y() )
+ if( nMaxVertPos>=0 )
{
- pVerScroll->SetThumbPos( aCurPos.Y() );
- pPreview->SetYOffset( aCurPos.Y() );
+ if( aCurPos.Y() != aPrevPos.Y() )
+ {
+ pVerScroll->SetThumbPos( aCurPos.Y() );
+ pPreview->SetYOffset( aCurPos.Y() );
+ }
}
if( aCurPos.X() != aPrevPos.X() )
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 85f60d312fa8..d37d9fa3e2dc 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -171,6 +171,11 @@ void ScTabControl::MouseButtonUp( const MouseEvent& rMEvt )
// mouse button down and up on same page?
if( nMouseClickPageId != GetPageId( aPos ) )
nMouseClickPageId = TAB_PAGE_NOTFOUND;
+ else if ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() )
+ {
+ SfxDispatcher* pDispatcher = pViewData->GetViewShell()->GetViewFrame()->GetDispatcher();
+ pDispatcher->Execute( FID_TAB_MENU_RENAME, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ }
if( nMouseClickPageId == 0 )
{
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 986de54aacdf..c7795a4223f7 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -908,8 +908,8 @@ void ScTabView::UpdateVarZoom()
PaintGrid();
PaintTop();
PaintLeft();
- aViewData.GetViewShell()->GetViewFrame()->GetBindings().
- Invalidate( SID_ATTR_ZOOM );
+ aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
bInZoomUpdate = FALSE;
}
@@ -1194,6 +1194,7 @@ BOOL ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
PaintTop();
PaintLeft();
aViewData.GetBindings().Invalidate( SID_ATTR_ZOOM );
+ aViewData.GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
}
bDone = TRUE;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index bcde44041299..5130062ad436 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2737,6 +2737,7 @@ void ScTabView::ZoomChanged()
SfxBindings& rBindings = aViewData.GetBindings();
rBindings.Invalidate( SID_ATTR_ZOOM );
+ rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
HideNoteMarker();
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 472eec58452e..dab177c97e8b 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -80,6 +80,7 @@
#define _SVSTDARR_ULONGS
#include <svtools/svstdarr.hxx>
+#include <svx/zoomslideritem.hxx>
#include <svx/svxdlg.hxx> //CHINA001
#include <svx/dialogs.hrc> //CHINA001
#include "scabstdlg.hxx" //CHINA001
@@ -752,6 +753,35 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
break;
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ const SfxPoolItem* pItem = NULL;
+ BOOL bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
+ if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, TRUE, &pItem) == SFX_ITEM_SET )
+ {
+ const USHORT nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
+ if( nCurrentZoom )
+ {
+ SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
+ if (!GetViewData()->IsPagebreakMode())
+ {
+ ScAppOptions aNewOpt = pScMod->GetAppOptions();
+ aNewOpt.SetZoom( nCurrentZoom );
+ aNewOpt.SetZoomType( GetZoomType() );
+ pScMod->SetAppOptions( aNewOpt );
+ }
+ Fraction aFract( nCurrentZoom,100 );
+ SetZoom( aFract, aFract, bSyncZoom );
+ PaintGrid();
+ PaintTop();
+ PaintLeft();
+ rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+ rReq.Done();
+ }
+ }
+ }
+ break;
+
//----------------------------------------------------------------
case FID_TAB_SELECTALL:
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 79505c373ac7..3ef2561bf2b3 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -44,6 +44,7 @@
#include <svx/boxitem.hxx>
#include <svx/numinf.hxx>
#include <svx/srchitem.hxx>
+#include <svx/zoomslideritem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
@@ -301,6 +302,25 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet )
}
break;
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ if ( bOle )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ const Fraction& rOldY = GetViewData()->GetZoomY();
+ USHORT nCurrentZoom = (USHORT)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
+
+ if( nCurrentZoom )
+ {
+ SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM, SID_ATTR_ZOOMSLIDER );
+ aZoomSliderItem.AddSnappingPoint( 100 );
+ rSet.Put( aZoomSliderItem );
+ }
+ }
+ }
+ break;
+
case FID_TOGGLESYNTAX:
rSet.Put(SfxBoolItem(nWhich, GetViewData()->IsSyntaxMode()));
break;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index dc6ddd86668e..4abb89d551de 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1559,7 +1559,8 @@ BOOL ScViewFunc::InsertCells( InsCellCmd eCmd, BOOL bRecord, BOOL bPartOfPaste )
if (GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE)
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
- BOOL bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, eCmd, bRecord, FALSE, bPartOfPaste );
+ const ScMarkData& rMark = GetViewData()->GetMarkData();
+ BOOL bSuccess = pDocSh->GetDocFunc().InsertCells( aRange, &rMark, eCmd, bRecord, FALSE, bPartOfPaste );
if (bSuccess)
{
pDocSh->UpdateOle(GetViewData());
@@ -1582,7 +1583,8 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, BOOL bRecord )
if ( GetViewData()->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
- pDocSh->GetDocFunc().DeleteCells( aRange, eCmd, bRecord, FALSE );
+ const ScMarkData& rMark = GetViewData()->GetMarkData();
+ pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, bRecord, FALSE );
pDocSh->UpdateOle(GetViewData());
CellContentChanged();
diff --git a/sc/uiconfig/scalc/statusbar/statusbar.xml b/sc/uiconfig/scalc/statusbar/statusbar.xml
index 52db7016c6e9..1ddff7a87433 100644
--- a/sc/uiconfig/scalc/statusbar/statusbar.xml
+++ b/sc/uiconfig/scalc/statusbar/statusbar.xml
@@ -3,10 +3,11 @@
<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
<statusbar:statusbaritem xlink:href=".uno:StatusDocPos" statusbar:align="left" statusbar:autosize="true" statusbar:width="58" statusbar:helpid="helpid:26114"/>
<statusbar:statusbaritem xlink:href=".uno:StatusPageStyle" statusbar:align="left" statusbar:autosize="true" statusbar:width="83" statusbar:helpid="helpid:26115"/>
- <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="40" statusbar:helpid="helpid:10000"/>
<statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="41" statusbar:helpid="helpid:10221"/>
<statusbar:statusbaritem xlink:href=".uno:StatusSelectionMode" statusbar:align="center" statusbar:width="34" statusbar:helpid="helpid:26116"/>
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="18" statusbar:helpid="helpid:5584"/>
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/>
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="212" statusbar:helpid="helpid:10224"/>
-</statusbar:statusbar> \ No newline at end of file
+ <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="140" statusbar:helpid="helpid:11065"/>
+ <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/>
+</statusbar:statusbar>
diff --git a/sc/uiconfig/scalc/toolbar/previewbar.xml b/sc/uiconfig/scalc/toolbar/previewbar.xml
index c17c2c9f707c..ef1acbe344ce 100644
--- a/sc/uiconfig/scalc/toolbar/previewbar.xml
+++ b/sc/uiconfig/scalc/toolbar/previewbar.xml
@@ -16,5 +16,7 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:Margins" toolbar:helpid="helpid:26504" />
<toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ScalingFactor" toolbar:helpid="helpid:26505" />
+ <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ClosePreview" toolbar:helpid="helpid:5325" />
-</toolbar:toolbar> \ No newline at end of file
+</toolbar:toolbar>