summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/sc.hrc6
-rw-r--r--sc/sdi/cellsh.sdi6
-rw-r--r--sc/sdi/scalc.sdi26
-rw-r--r--sc/source/core/data/document.cxx48
-rw-r--r--sc/source/ui/inc/tabview.hxx5
-rw-r--r--sc/source/ui/unoobj/cursuno.cxx45
-rw-r--r--sc/source/ui/view/cellsh4.cxx8
-rw-r--r--sc/source/ui/view/tabview3.cxx15
9 files changed, 115 insertions, 50 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a56ccdcf6726..f24d22431b85 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.62 $
+ * $Revision: 1.63 $
*
- * last change: $Author: er $ $Date: 2002-11-27 21:09:38 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:54:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -612,6 +612,8 @@ public:
USHORT nEndCol, USHORT nEndRow,
const ScMarkData& rMark ) const;
+ BOOL GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
+
BOOL IsEmbedded() const;
void GetEmbedded( ScTripel& rStart, ScTripel& rEnd ) const;
void SetEmbedded( const ScTripel& rStart, const ScTripel& rEnd );
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index b6bc0fbc8e27..a8c1639f180d 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: sc.hrc,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: dr $ $Date: 2002-11-20 08:56:59 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:54:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -943,6 +943,8 @@
#define SID_CURSORENTERUP (SID_KEYFUNC_START + 37)
#define SID_CURSORENTERDOWN (SID_KEYFUNC_START + 38)
+#define SID_MARKARRAYFORMULA (SID_KEYFUNC_START + 39)
+
#define SID_KEYFUNC_END (SID_KEYFUNC_START + 50)
#define SID_NEW_SLOTS (SID_KEYFUNC_END)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index d13c875015e1..9cf29439a7f4 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -3,7 +3,7 @@
// StarCalc
//
// (C) 1994 StarDivision GmbH, Hamburg, Germany
- // $Author: mba $ $Date: 2002-08-29 14:19:09 $ $Revision: 1.10 $
+ // $Author: nn $ $Date: 2002-11-28 14:56:06 $ $Revision: 1.11 $
// $Logfile: T:/sc/sdi/cellsh.sdv $ $Workfile: cellsh.sdi $
//----------------------------------------------------------------------------
@@ -125,6 +125,7 @@ interface CellSelection : Selection
FID_FILL_SERIES [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
FID_FILL_AUTO [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
SID_MARKDATAAREA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
+ SID_MARKARRAYFORMULA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
SID_SETINPUTMODE [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
SID_FOCUS_INPUTLINE [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ]
SID_CUT [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
@@ -381,6 +382,9 @@ shell ScCellShell : ScFormatShell
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.10 2002/08/29 14:19:09 mba
+ #98951#: make sure that slot names are unique
+
Revision 1.9 2002/06/04 07:56:02 mba
#98570#: Recording of SearchDialog actions
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 4c2d6e152291..90161ed27eb1 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -7388,3 +7388,29 @@ ScProtectionAttr Protection SID_SCATTR_PROTECTION
GroupId = GID_FORMAT;
]
+//--------------------------------------------------------------------------
+SfxVoidItem SelectArrayFormula SID_MARKARRAYFORMULA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0c5351ca3ac5..030fb56f84b2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: dr $ $Date: 2002-11-27 15:08:07 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:58:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -3342,6 +3342,50 @@ BOOL ScDocument::HasSelectedBlockMatrixFragment( USHORT nStartCol, USHORT nStart
}
+BOOL ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix )
+{
+ // if rCell is part of a matrix formula, return its complete range
+
+ BOOL bRet = FALSE;
+ ScBaseCell* pCell = GetCell( rCellPos );
+ if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ ScAddress aOrigin = rCellPos;
+ if ( ((ScFormulaCell*)pCell)->GetMatrixOrigin( aOrigin ) )
+ {
+ if ( aOrigin != rCellPos )
+ pCell = GetCell( aOrigin );
+ if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ USHORT nSizeX, nSizeY;
+ ((ScFormulaCell*)pCell)->GetMatColsRows(nSizeX,nSizeY);
+ if ( !(nSizeX && nSizeY) )
+ {
+ // GetMatrixEdge computes also dimensions of the matrix
+ // if not already done (may occur if document is loaded
+ // from old file format).
+ // Needs an "invalid" initialized address.
+ aOrigin = UINT32(0xffffffff);
+ ((ScFormulaCell*)pCell)->GetMatrixEdge(aOrigin);
+ ((ScFormulaCell*)pCell)->GetMatColsRows(nSizeX,nSizeY);
+ }
+ if ( nSizeX && nSizeY )
+ {
+ ScAddress aEnd( aOrigin.Col() + nSizeX - 1,
+ aOrigin.Row() + nSizeY - 1,
+ aOrigin.Tab() );
+
+ rMatrix.aStart = aOrigin;
+ rMatrix.aEnd = aEnd;
+ bRet = TRUE;
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+
BOOL ScDocument::ExtendOverlapped( USHORT& rStartCol, USHORT& rStartRow,
USHORT nEndCol, USHORT nEndRow, USHORT nTab )
{
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 61e439cfeb19..a824b1ca987d 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabview.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dr $ $Date: 2002-09-25 15:21:55 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:58:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -479,6 +479,7 @@ public:
void MarkColumns();
void MarkRows();
void MarkDataArea( BOOL bIncludeCursor = TRUE );
+ void MarkMatrixFormula();
void Unmark();
void MarkRange( const ScRange& rRange, BOOL bSetCursor = TRUE, BOOL bContinue = FALSE );
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index 875364e01b2b..9ee6b160b26f 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cursuno.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: hr $ $Date: 2001-10-23 11:39:50 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:59:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,7 +76,6 @@
#include "hints.hxx"
#include "markdata.hxx"
#include "dociter.hxx"
-#include "cell.hxx"
#include "unoguard.hxx"
#include "miscuno.hxx"
@@ -184,46 +183,18 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentArray() throw(uno::RuntimeExcept
ScRange aRange = *rRanges.GetObject(0);
aRange.Justify();
- ScAddress aCursor = aRange.aStart; // bei Block immer den Start nehmen
- ScAddress aOrigin = aCursor;
- BOOL bFound = FALSE;
+ ScAddress aCursor = aRange.aStart; // use the start address of the range
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
ScDocument* pDoc = pDocSh->GetDocument();
- ScBaseCell* pCell = pDoc->GetCell( aCursor );
- if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ ScRange aMatrix;
+
+ // finding the matrix range is now in GetMatrixFormulaRange in the document
+ if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) )
{
- if ( ((ScFormulaCell*)pCell)->GetMatrixOrigin( aOrigin ) )
- {
- if ( aOrigin != aCursor )
- pCell = pDoc->GetCell( aOrigin );
- if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
- {
- USHORT nSizeX, nSizeY;
- ((ScFormulaCell*)pCell)->GetMatColsRows(nSizeX,nSizeY);
- if ( !(nSizeX && nSizeY) )
- {
- // GetMatrixEdge computes also dimensions of the matrix
- // if not already done (may occur if document is loaded
- // from old file format).
- // Needs an "invalid" initialized address.
- aOrigin = UINT32(0xffffffff);
- ((ScFormulaCell*)pCell)->GetMatrixEdge(aOrigin);
- ((ScFormulaCell*)pCell)->GetMatColsRows(nSizeX,nSizeY);
- }
- if ( nSizeX && nSizeY )
- {
- ScAddress aEnd( aOrigin.Col() + nSizeX - 1,
- aOrigin.Row() + nSizeY - 1,
- aOrigin.Tab() );
- ScRange aNew( aOrigin, aEnd );
- SetNewRange( aNew );
- bFound = TRUE;
- }
- }
- }
+ SetNewRange( aMatrix );
}
}
// thats a Bug, that this assertion comes; the API Reference says, that
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 59779955c0f8..f9c990bc401a 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cellsh4.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2002-08-30 15:09:12 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:59:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -291,6 +291,10 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq )
pTabViewShell->MarkDataArea();
break;
+ case SID_MARKARRAYFORMULA:
+ pTabViewShell->MarkMatrixFormula();
+ break;
+
case SID_SETINPUTMODE:
SC_MOD()->SetInputMode( SC_INPUT_TABLE );
break;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d6f30c851665..270f1adfb052 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabview3.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: nn $ $Date: 2002-10-16 16:27:05 $
+ * last change: $Author: nn $ $Date: 2002-11-28 14:59:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1448,6 +1448,17 @@ void ScTabView::MarkDataArea( BOOL bIncludeCursor )
SelectionChanged();
}
+void ScTabView::MarkMatrixFormula()
+{
+ ScDocument* pDoc = aViewData.GetDocument();
+ ScAddress aCursor( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
+ ScRange aMatrix;
+ if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) )
+ {
+ MarkRange( aMatrix, FALSE ); // cursor is already within the range
+ }
+}
+
void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinue )
{
USHORT nTab = rRange.aStart.Tab();