Kaydet (Commit) 6f92d874 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

Manage Names: fix an initialization problem

üst 648a9a48
......@@ -38,6 +38,7 @@
class ScRangeName;
class ScDocument;
class ScDocShell;
class ScViewData;
class ScNameDefDlg : public ScAnyRefDlg
{
......@@ -95,7 +96,7 @@ protected:
public:
ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
ScDocShell* pDocShell, std::map<rtl::OUString, ScRangeName*> aRangeMap,
ScViewData* pViewData, std::map<rtl::OUString, ScRangeName*> aRangeMap,
const ScAddress& aCursorPos, const bool bUndo);
virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
......
......@@ -68,7 +68,7 @@ private:
public:
ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames );
~ScRangeManagerTable() {};
virtual ~ScRangeManagerTable();
void addEntry( const ScRangeNameLine& rLine );
void DeleteSelectedEntries();
......
......@@ -19,7 +19,7 @@
#define ABS_DREF3D ABS_DREF | SCA_TAB_3D
ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
ScDocShell* pDocShell, std::map<rtl::OUString, ScRangeName*> aRangeMap,
ScViewData* pViewData, std::map<rtl::OUString, ScRangeName*> aRangeMap,
const ScAddress& aCursorPos, const bool bUndo ) :
ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_NAMES_DEFINE ),
maBtnAdd( this, ScResId( BTN_ADD ) ),
......@@ -39,8 +39,8 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maBtnPrintArea( this, ScResId( BTN_PRINTAREA ) ),
maBtnCriteria( this, ScResId( BTN_CRITERIA ) ),
mbUndo( bUndo ),
mpDoc( pDocShell->GetDocument() ),
mpDocShell ( pDocShell ),
mpDoc( pViewData->GetDocument() ),
mpDocShell ( pViewData->GetDocShell() ),
maCursorPos( aCursorPos ),
mErrMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ),
......@@ -77,6 +77,18 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maBtnPrintArea.Hide();
FreeResource();
String aAreaStr;
ScRange aRange;
pViewData->GetSimpleArea( aRange );
aRange.Format( aAreaStr, ABS_DREF3D, mpDoc,
ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) );
Selection aCurSel = Selection( 0, SELECTION_MAX );
maEdRange.GrabFocus();
maEdRange.SetText( aAreaStr );
maEdRange.SetSelection( aCurSel );
}
void ScNameDefDlg::CancelPushed()
......
......@@ -123,7 +123,6 @@ ScNameDlg::~ScNameDlg()
void ScNameDlg::Init()
{
String aAreaStr;
ScRange aRange;
OSL_ENSURE( mpViewData && mpDoc, "ViewData oder Document nicht gefunden!" );
......@@ -173,20 +172,12 @@ void ScNameDlg::Init()
maLbScope.InsertEntry(aTabName);
}
UpdateNames();
IsNameValid();
mpViewData->GetSimpleArea( aRange );
aRange.Format( aAreaStr, ABS_DREF3D, mpDoc,
ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) );
maCurSel = Selection( 0, SELECTION_MAX );
maEdAssign.GrabFocus();
maEdAssign.SetText( aAreaStr );
maEdAssign.SetSelection( maCurSel );
EdModifyHdl( 0 );
if (mpRangeManagerTable->GetSelectionCount())
{
SelectionChanged();
}
}
sal_Bool ScNameDlg::IsRefInputMode() const
......
......@@ -84,6 +84,13 @@ ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, boost::ptr_map<rtl::O
maHeaderBar.Show();
SetSelectionMode(MULTIPLE_SELECTION);
Init(rRangeMap);
if (GetEntryCount())
SetCurEntry(GetEntryOnPos(0));
}
ScRangeManagerTable::~ScRangeManagerTable()
{
Clear();
}
void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine)
......
......@@ -122,7 +122,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
std::cout << "tabvwsh" << std::endl;
std::map<rtl::OUString, ScRangeName*> aRangeMap;
pDoc->GetRangeNameMap(aRangeMap);
pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData()->GetDocShell(), aRangeMap,
pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap,
ScAddress( GetViewData()->GetCurX(),
GetViewData()->GetCurY(),
GetViewData()->GetTabNo() ), true );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment