summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-11-19 04:37:03 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-11-23 06:25:32 +0100
commitb3d22ae4ca7ad191f6f807c72660b78d3ac6e833 (patch)
treea650871e7329c5af11996d387c36ffcf2c965e3f /sc/source
parent1e6ad2af4bfd14f96926cd976fb2edb626de3d10 (diff)
ManageNames: make Define Name dialog work again
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/app/scdll.cxx1
-rw-r--r--sc/source/ui/inc/namedefdlg.hxx9
-rw-r--r--sc/source/ui/inc/namemgrtable.hxx2
-rw-r--r--sc/source/ui/inc/reffact.hxx1
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx45
-rw-r--r--sc/source/ui/src/namedefdlg.src2
-rw-r--r--sc/source/ui/view/cellsh.cxx1
-rw-r--r--sc/source/ui/view/cellsh1.cxx11
-rw-r--r--sc/source/ui/view/formatsh.cxx1
-rw-r--r--sc/source/ui/view/reffact.cxx7
-rw-r--r--sc/source/ui/view/tabvwsh.cxx1
-rw-r--r--sc/source/ui/view/tabvwshc.cxx21
12 files changed, 97 insertions, 5 deletions
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index d1c56ec1ae77..86746ef5c9f2 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -265,6 +265,7 @@ void ScDLL::Init()
ScSolverDlgWrapper ::RegisterChildWindow(false, pMod);
ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
+ ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod);
ScTabOpDlgWrapper ::RegisterChildWindow(false, pMod);
ScFilterDlgWrapper ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx
index 33a1ae2cacbf..acb533403411 100644
--- a/sc/source/ui/inc/namedefdlg.hxx
+++ b/sc/source/ui/inc/namedefdlg.hxx
@@ -76,11 +76,20 @@ private:
DECL_LINK( CancelBtnHdl, void * );
DECL_LINK( AddBtnHdl, void* );
DECL_LINK( NameModifyHdl, void* );
+
+protected:
+ virtual void RefInputDone( sal_Bool bForced = sal_False );
+
public:
ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
ScDocument* pDoc, std::map<rtl::OUString, ScRangeName*> aRangeMap,
const ScAddress& aCursorPos, const bool bUndo);
+ virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
+ virtual sal_Bool IsRefInputMode() const;
+
+ virtual void SetActive();
+ virtual sal_Bool Close();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index 52d864f235e2..efe7bc297f49 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -39,7 +39,7 @@ struct ScRangeNameLine
//TODO: cache the lines for performance improvements
//otherwise handling of a large set of range names might get extremely slow
//Need some sort of a filter to handle several range names
-SC_DLLPUBLIC class ScRangeManagerTable : public SvTabListBox
+class SC_DLLPUBLIC ScRangeManagerTable : public SvTabListBox
{
private:
HeaderBar maHeaderBar;
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index fc30485dbe92..63e55ef769c2 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -45,6 +45,7 @@
//==================================================================
DECL_WRAPPER(ScNameDlgWrapper)
+DECL_WRAPPER(ScNameDefDlgWrapper)
DECL_WRAPPER(ScSolverDlgWrapper)
DECL_WRAPPER(ScOptSolverDlgWrapper)
DECL_WRAPPER(ScPivotLayoutWrapper)
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 3c26e5311762..47f3ddc381f4 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -6,6 +6,7 @@
#include "document.hxx"
#include "globalnames.hxx"
#include "rangenam.hxx"
+#include "reffact.hxx"
@@ -165,6 +166,50 @@ void ScNameDefDlg::AddPushed()
Close();
}
+sal_Bool ScNameDefDlg::IsRefInputMode() const
+{
+ /*
+ return maEdAssign.IsEnabled();
+ */
+ return true;
+}
+
+void ScNameDefDlg::RefInputDone( sal_Bool bForced)
+{
+ /*
+ ScAnyRefDlg::RefInputDone(bForced);
+ EdModifyHdl(&maEdAssign);
+ */
+}
+
+void ScNameDefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
+{
+ /**
+ if ( maEdAssign.IsEnabled() )
+ {
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart(&maEdAssign);
+ String aRefStr;
+ rRef.Format( aRefStr, ABS_DREF3D, pDocP,
+ ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) );
+ maEdAssign.SetRefString( aRefStr );
+ }
+ */
+}
+
+sal_Bool ScNameDefDlg::Close()
+{
+ return DoClose( ScNameDefDlgWrapper::GetChildWindowId() );
+}
+
+void ScNameDefDlg::SetActive()
+{
+ /*
+ maEdAssign.GrabFocus();
+ RefInputDone();
+ */
+}
+
IMPL_LINK( ScNameDefDlg, CancelBtnHdl, void*, EMPTYARG)
{
CancelPushed();
diff --git a/sc/source/ui/src/namedefdlg.src b/sc/source/ui/src/namedefdlg.src
index 4519c3747ca2..6f81ad007709 100644
--- a/sc/source/ui/src/namedefdlg.src
+++ b/sc/source/ui/src/namedefdlg.src
@@ -1,7 +1,7 @@
#include "namedefdlg.hrc"
-ModalDialog RID_SCDLG_NAMES_DEFINE
+ModelessDialog RID_SCDLG_NAMES_DEFINE
{
OutputSize = TRUE ;
HelpId = CMD_FID_ADD_NAME ;
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index ac2bdccfae55..e781ffa69ca7 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -979,6 +979,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_DEFINE_NAME:
case FID_INSERT_NAME:
+ case FID_ADD_NAME:
case SID_DEFINE_COLROWNAMERANGES:
{
if ( pDocSh && pDocSh->IsDocShared() )
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index ea4be5ef9659..a9ca03b794b7 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -143,6 +143,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
switch ( nSlot )
{
case FID_DEFINE_NAME:
+ case FID_ADD_NAME:
case FID_USE_NAME:
case FID_INSERT_NAME:
case SID_SPELL_DIALOG:
@@ -1744,6 +1745,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
}
break;
+ case FID_ADD_NAME:
+ {
+ std::cout << "temp" << std::endl;
+ sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId();
+ SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+ SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+
+ pScMod->SetRefDialog( nId, pWnd ? false : sal_True );
+ }
+ break;
case SID_DEFINE_COLROWNAMERANGES:
{
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index a4193f9d1b25..092a619e735c 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -929,6 +929,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
case SID_NUMBER_INCDEC:
case SID_NUMBER_DECDEC:
case FID_DEFINE_NAME:
+ case FID_ADD_NAME:
case FID_USE_NAME:
case FID_INSERT_NAME:
case SID_SPELL_DIALOG:
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 5d3a99226d05..17410c0cc46f 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -50,6 +50,7 @@
// -----------------------------------------------------------------------
SFX_IMPL_MODELESSDIALOG(ScNameDlgWrapper, FID_DEFINE_NAME )
+SFX_IMPL_MODELESSDIALOG(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOG(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
SFX_IMPL_MODELESSDIALOG(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
@@ -120,6 +121,12 @@ namespace { ScTabViewShell * lcl_GetTabViewShell( SfxBindings *pBindings ); }
//-------------------------------------------------------------------------
IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
+ //
+//-------------------------------------------------------------------------
+// ScNameDlgWrapper
+//-------------------------------------------------------------------------
+
+IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
//-------------------------------------------------------------------------
// ScSolverDlgWrapper
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 2c26815a01dc..f029ec75832c 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -70,6 +70,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(ScNameDefDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId());
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index b337a4269531..2dca9766a0ee 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -49,6 +49,7 @@
#include "uiitems.hxx"
#include "pivot.hxx"
#include "namedlg.hxx"
+#include "namedefdlg.hxx"
#include "solvrdlg.hxx"
#include "optsolver.hxx"
#include "tabopdlg.hxx"
@@ -70,6 +71,8 @@
#include "funcdesc.hxx"
#include "dpobject.hxx"
+#include <iostream>
+
//------------------------------------------------------------------
void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
@@ -109,9 +112,21 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
{
case FID_DEFINE_NAME:
pResult = new ScNameDlg( pB, pCW, pParent, GetViewData(),
- ScAddress( GetViewData()->GetCurX(),
- GetViewData()->GetCurY(),
- GetViewData()->GetTabNo() ) );
+ ScAddress( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(),
+ GetViewData()->GetTabNo() ) );
+ break;
+
+ case FID_ADD_NAME:
+ {
+ std::cout << "tabvwsh" << std::endl;
+ std::map<rtl::OUString, ScRangeName*> aRangeMap;
+ pDoc->GetRangeNameMap(aRangeMap);
+ pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData()->GetDocument(), aRangeMap,
+ ScAddress( GetViewData()->GetCurX(),
+ GetViewData()->GetCurY(),
+ GetViewData()->GetTabNo() ), true );
+ }
break;
case SID_DEFINE_COLROWNAMERANGES: