summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx8
-rw-r--r--sc/source/ui/app/scmod.cxx4
-rw-r--r--sc/source/ui/inc/cellsh.hxx2
-rw-r--r--sc/source/ui/inc/inputhdl.hxx2
-rw-r--r--sc/source/ui/view/cellsh.cxx4
-rw-r--r--sc/source/ui/view/cellsh1.cxx37
6 files changed, 52 insertions, 5 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 78481fa0ab73..f1a3da8a254b 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2381,7 +2381,7 @@ void ScInputHandler::InvalidateAttribs()
// --------------- public Methoden --------------------------------------------
-void ScInputHandler::SetMode( ScInputMode eNewMode )
+void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText )
{
if ( eMode == eNewMode )
return;
@@ -2419,6 +2419,12 @@ void ScInputHandler::SetMode( ScInputMode eNewMode )
}
}
+ if (pInitText)
+ {
+ pEngine->SetText(*pInitText);
+ bModified = true;
+ }
+
sal_Int32 nPara = pEngine->GetParagraphCount()-1;
sal_Int32 nLen = pEngine->GetText(nPara).getLength();
sal_uInt16 nCount = pEngine->GetViewCount();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index ec2ce296e670..586686de142c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1427,11 +1427,11 @@ void ScModule::ViewShellChanged()
pShell->UpdateInputHandler();
}
-void ScModule::SetInputMode( ScInputMode eMode )
+void ScModule::SetInputMode( ScInputMode eMode, const OUString* pInitText )
{
ScInputHandler* pHdl = GetInputHdl();
if (pHdl)
- pHdl->SetMode( eMode );
+ pHdl->SetMode(eMode, pInitText);
}
bool ScModule::IsEditMode()
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index fa83707c6315..2318cf86acc5 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -61,6 +61,8 @@ private:
void ExecuteXMLSourceDialog();
void ExecuteSubtotals(SfxRequest& rReq);
+ void ExecuteFillSingleEdit();
+
DECL_LINK( ClipboardChanged, TransferableDataHelper* );
DECL_LINK( DialogClosed, void* );
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 231e9ad81bce..937313832e1a 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -164,7 +164,7 @@ public:
ScInputHandler();
virtual ~ScInputHandler();
- void SetMode( ScInputMode eNewMode );
+ void SetMode( ScInputMode eNewMode, const OUString* pInitText = NULL );
bool IsInputMode() const { return (eMode != SC_INPUT_NONE); }
bool IsEditMode() const { return (eMode != SC_INPUT_NONE &&
eMode != SC_INPUT_TYPE); }
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 498d17387541..2a5aa5b17230 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -199,7 +199,9 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
nCol2, nRow1, nCol2, nRow2, rMark ); // last column
}
break;
-
+ case FID_FILL_SINGLE_EDIT:
+ bDisable = false;
+ break;
case SID_CUT: // cut
case FID_INS_CELL: // insert cells, just simple selection
bDisable = (!bSimpleArea);
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 858d1abb30e9..e53be77d85b9 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -79,6 +79,10 @@
#include "scui_def.hxx"
#include <svx/dialogs.hrc>
#include "scabstdlg.hxx"
+#include <tokenstringcontext.hxx>
+#include <cellvalue.hxx>
+#include <tokenarray.hxx>
+#include <formulacell.hxx>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -901,6 +905,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
}
break;
+ case FID_FILL_SINGLE_EDIT:
+ ExecuteFillSingleEdit();
+ break;
case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
{
sal_uInt16 nId = ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
@@ -2771,6 +2778,36 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq)
delete pDlg;
}
+void ScCellShell::ExecuteFillSingleEdit()
+{
+ ScAddress aCurPos = GetViewData()->GetCurPos();
+
+ OUString aInit;
+
+ if (aCurPos.Row() > 0)
+ {
+ // Get the initial text value from the above cell.
+
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScRefCellValue aCell;
+ ScAddress aPrevPos = aCurPos;
+ aPrevPos.IncRow(-1);
+ aCell.assign(*pDoc, aPrevPos);
+
+ if (aCell.meType == CELLTYPE_FORMULA)
+ {
+ aInit = "=";
+ const ScTokenArray* pCode = aCell.mpFormula->GetCode();
+ sc::TokenStringContext aCxt(pDoc, pDoc->GetGrammar());
+ aInit += pCode->CreateString(aCxt, aCurPos);
+ }
+ else
+ aInit = aCell.getString(pDoc);
+ }
+
+ SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit);
+}
+
IMPL_LINK_NOARG(ScCellShell, DialogClosed)
{
OSL_ENSURE( pImpl->m_pLinkedDlg, "ScCellShell::DialogClosed(): invalid request" );