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

Manage Names: fix an initialization problem

üst 648a9a48
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
class ScRangeName; class ScRangeName;
class ScDocument; class ScDocument;
class ScDocShell; class ScDocShell;
class ScViewData;
class ScNameDefDlg : public ScAnyRefDlg class ScNameDefDlg : public ScAnyRefDlg
{ {
...@@ -95,7 +96,7 @@ protected: ...@@ -95,7 +96,7 @@ protected:
public: public:
ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, 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); const ScAddress& aCursorPos, const bool bUndo);
virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
......
...@@ -68,7 +68,7 @@ private: ...@@ -68,7 +68,7 @@ private:
public: public:
ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames ); ScRangeManagerTable( Window* pParent, boost::ptr_map<rtl::OUString, ScRangeName>& aTabRangeNames );
~ScRangeManagerTable() {}; virtual ~ScRangeManagerTable();
void addEntry( const ScRangeNameLine& rLine ); void addEntry( const ScRangeNameLine& rLine );
void DeleteSelectedEntries(); void DeleteSelectedEntries();
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define ABS_DREF3D ABS_DREF | SCA_TAB_3D #define ABS_DREF3D ABS_DREF | SCA_TAB_3D
ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, 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 ) : const ScAddress& aCursorPos, const bool bUndo ) :
ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_NAMES_DEFINE ), ScAnyRefDlg( pB, pCW, pParent, RID_SCDLG_NAMES_DEFINE ),
maBtnAdd( this, ScResId( BTN_ADD ) ), maBtnAdd( this, ScResId( BTN_ADD ) ),
...@@ -39,8 +39,8 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen ...@@ -39,8 +39,8 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maBtnPrintArea( this, ScResId( BTN_PRINTAREA ) ), maBtnPrintArea( this, ScResId( BTN_PRINTAREA ) ),
maBtnCriteria( this, ScResId( BTN_CRITERIA ) ), maBtnCriteria( this, ScResId( BTN_CRITERIA ) ),
mbUndo( bUndo ), mbUndo( bUndo ),
mpDoc( pDocShell->GetDocument() ), mpDoc( pViewData->GetDocument() ),
mpDocShell ( pDocShell ), mpDocShell ( pViewData->GetDocShell() ),
maCursorPos( aCursorPos ), maCursorPos( aCursorPos ),
mErrMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ), mErrMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ),
...@@ -77,6 +77,18 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen ...@@ -77,6 +77,18 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maBtnPrintArea.Hide(); maBtnPrintArea.Hide();
FreeResource(); 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() void ScNameDefDlg::CancelPushed()
......
...@@ -123,7 +123,6 @@ ScNameDlg::~ScNameDlg() ...@@ -123,7 +123,6 @@ ScNameDlg::~ScNameDlg()
void ScNameDlg::Init() void ScNameDlg::Init()
{ {
String aAreaStr;
ScRange aRange; ScRange aRange;
OSL_ENSURE( mpViewData && mpDoc, "ViewData oder Document nicht gefunden!" ); OSL_ENSURE( mpViewData && mpDoc, "ViewData oder Document nicht gefunden!" );
...@@ -173,20 +172,12 @@ void ScNameDlg::Init() ...@@ -173,20 +172,12 @@ void ScNameDlg::Init()
maLbScope.InsertEntry(aTabName); 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 sal_Bool ScNameDlg::IsRefInputMode() const
......
...@@ -84,6 +84,13 @@ ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, boost::ptr_map<rtl::O ...@@ -84,6 +84,13 @@ ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, boost::ptr_map<rtl::O
maHeaderBar.Show(); maHeaderBar.Show();
SetSelectionMode(MULTIPLE_SELECTION); SetSelectionMode(MULTIPLE_SELECTION);
Init(rRangeMap); Init(rRangeMap);
if (GetEntryCount())
SetCurEntry(GetEntryOnPos(0));
}
ScRangeManagerTable::~ScRangeManagerTable()
{
Clear();
} }
void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine) void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine)
......
...@@ -122,7 +122,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( ...@@ -122,7 +122,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
std::cout << "tabvwsh" << std::endl; std::cout << "tabvwsh" << std::endl;
std::map<rtl::OUString, ScRangeName*> aRangeMap; std::map<rtl::OUString, ScRangeName*> aRangeMap;
pDoc->GetRangeNameMap(aRangeMap); pDoc->GetRangeNameMap(aRangeMap);
pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData()->GetDocShell(), aRangeMap, pResult = new ScNameDefDlg( pB, pCW, pParent, GetViewData(), aRangeMap,
ScAddress( GetViewData()->GetCurX(), ScAddress( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetCurY(),
GetViewData()->GetTabNo() ), true ); 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