sc/source/ui/inc/namedlg.hxx | 5 +++-- sc/source/ui/inc/namemgrtable.hxx | 12 ++++++++++++ sc/source/ui/namedlg/namedlg.cxx | 17 +++++++---------- sc/source/ui/namedlg/namemgrtable.cxx | 14 ++++++++++++-- 4 files changed, 34 insertions(+), 14 deletions(-)
New commits: commit 83fe3fb4aa94a8d0e86e944546c277255db2c58c Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Tue Apr 8 14:34:13 2014 -0400 fdo#71729: Fill the range edit boxes after the table is fully initialized. Otherwise the range formula expression would not be available yet. (cherry picked from commit ffaaf35206b8f049bb9e9ffd7a85c8ebd758a21c) Conflicts: sc/source/ui/namedlg/namedlg.cxx Change-Id: If9c5040366f9038e8094fd5448ca5e4ee2e73edd Reviewed-on: https://gerrit.libreoffice.org/8896 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index b6ed196..020c88f 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -43,7 +43,7 @@ class ScDocument; //================================================================== //logic behind the manage names dialog -class ScNameDlg : public ScAnyRefDlg +class ScNameDlg : public ScAnyRefDlg, public ScRangeManagerTable::InitListener { private: Edit* m_pEdName; @@ -133,9 +133,10 @@ public: virtual void SetActive(); virtual sal_Bool Close(); + virtual void tableInitialized() SAL_OVERRIDE; + void GetRangeNames(boost::ptr_map<OUString, ScRangeName>& rRangeMap); void SetEntry(const OUString& rName, const OUString& rScope); - }; diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx index 5e5a8ca..a0341bc 100644 --- a/sc/source/ui/inc/namemgrtable.hxx +++ b/sc/source/ui/inc/namemgrtable.hxx @@ -35,6 +35,14 @@ struct ScRangeNameLine //Need some sort of a filter to handle several range names class SC_DLLPUBLIC ScRangeManagerTable : public SvSimpleTable { +public: + class InitListener + { + public: + virtual ~InitListener(); + virtual void tableInitialized() = 0; + }; + private: OUString maGlobalString; @@ -46,6 +54,8 @@ private: std::map<SvTreeListEntry*, bool> maCalculatedFormulaEntries; const ScAddress maPos; + InitListener* mpInitListener; + void GetLine(ScRangeNameLine& aLine, SvTreeListEntry* pEntry); void Init(); void CheckForFormulaString(); @@ -60,6 +70,8 @@ public: virtual void Resize(); virtual void StateChanged( StateChangedType nStateChange ); + void setInitListener( InitListener* pListener ); + void addEntry( const ScRangeNameLine& rLine, bool bSetCurEntry = true ); void DeleteSelectedEntries(); void SetEntry( const ScRangeNameLine& rLine ); diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index b013ba5..20a1db0 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -118,6 +118,7 @@ void ScNameDlg::Init() pCtrl->set_height_request(pCtrl->GetTextHeight()*12); m_pRangeManagerTable = new ScRangeManagerTable(*pCtrl, maRangeMap, maCursorPos); + m_pRangeManagerTable->setInitListener(this); m_pRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); m_pRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); @@ -145,15 +146,7 @@ void ScNameDlg::Init() m_pLbScope->InsertEntry(aTabName); } - - - if (m_pRangeManagerTable->GetSelectionCount()) - { - SelectionChanged(); - } - CheckForEmptyTable(); - } sal_Bool ScNameDlg::IsRefInputMode() const @@ -186,6 +179,12 @@ sal_Bool ScNameDlg::Close() return DoClose( ScNameDlgWrapper::GetChildWindowId() ); } +void ScNameDlg::tableInitialized() +{ + if (m_pRangeManagerTable->GetSelectionCount()) + SelectionChanged(); +} + void ScNameDlg::CheckForEmptyTable() { if (!m_pRangeManagerTable->GetEntryCount()) @@ -417,8 +416,6 @@ void ScNameDlg::NameModified() void ScNameDlg::SelectionChanged() { - - //don't update if we have just modified due to user input if (!mbNeedUpdate) { diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index e8f831e..c2666bc 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -33,11 +33,14 @@ static OUString createEntryString(const ScRangeNameLine& rLine) return aRet; } +ScRangeManagerTable::InitListener::~InitListener() {} + ScRangeManagerTable::ScRangeManagerTable( SvSimpleTableContainer& rParent, boost::ptr_map<OUString, ScRangeName>& rRangeMap, const ScAddress& rPos ): SvSimpleTable( rParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), maGlobalString( ScGlobal::GetRscString(STR_GLOBAL_SCOPE)), mrRangeMap( rRangeMap ), - maPos( rPos ) + maPos( rPos ), + mpInitListener(NULL) { static long aStaticTabs[] = {3, 0, 0, 0 }; SetTabs( &aStaticTabs[0], MAP_PIXEL ); @@ -80,6 +83,9 @@ void ScRangeManagerTable::StateChanged( StateChangedType nStateChange ) SetCurEntry(GetEntryOnPos(0)); CheckForFormulaString(); } + + if (mpInitListener) + mpInitListener->tableInitialized(); } } @@ -103,6 +109,11 @@ ScRangeManagerTable::~ScRangeManagerTable() Clear(); } +void ScRangeManagerTable::setInitListener( InitListener* pListener ) +{ + mpInitListener = pListener; +} + void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry) { SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); @@ -177,7 +188,6 @@ void ScRangeManagerTable::CheckForFormulaString() SetEntryText(aFormulaString, pEntry, 1); maCalculatedFormulaEntries.insert( std::pair<SvTreeListEntry*, bool>(pEntry, true) ); } - } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits