diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-09-23 19:12:31 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-09-23 20:37:55 +0200 |
commit | c7ac093eb5d8e60e565d00c7f1b62f52f6b0402e (patch) | |
tree | 1716c73b577419c4835064cda33aa9cb91ac85fe | |
parent | b848a2eb7ff2d58251d1f83356c6e6e7a74f23ea (diff) |
inital work for new "Manage Names" dialog
still missing:
* change the more button to something more modern
* change the position of the range options to the place below the more
button
* insert/paste button is missing
* last inserted item should be selected by default
additional future improvements:
* filters
* search bar
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/inc/namedlg.hrc | 27 | ||||
-rw-r--r-- | sc/source/ui/inc/namedlg.hxx | 136 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 794 | ||||
-rw-r--r-- | sc/source/ui/src/namedlg.src | 168 |
6 files changed, 674 insertions, 470 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index ca9806385e6c..30a3639989b4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -466,6 +466,7 @@ public: */ SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; SC_DLLPUBLIC void SetAllTabRangeNames(const ScRangeName::TabNameCopyMap& rRangeNames); + void GetTabRangeNameMap(std::map<rtl::OUString, ScRangeName*>& rRangeName); SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const; SC_DLLPUBLIC ScRangeName* GetRangeName() const; void SetRangeName(SCTAB nTab, ScRangeName* pNew); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 2a16408c4617..03884035006f 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -124,6 +124,24 @@ void ScDocument::SetAllTabRangeNames(const ScRangeName::TabNameCopyMap& rNames) SetRangeName(itr->first, new ScRangeName(*itr->second)); } +void ScDocument::GetTabRangeNameMap(std::map<rtl::OUString, ScRangeName*>& aRangeNameMap) +{ + for (SCTAB i = 0; i < static_cast<SCTAB>(maTabs.size()); ++i) + { + if (!maTabs[i]) + continue; + ScRangeName* p = maTabs[i]->GetRangeName(); + if (!p ) + { + p = new ScRangeName(); + SetRangeName(i, p); + } + rtl::OUString aTableName; + maTabs[i]->GetName(aTableName); + aRangeNameMap.insert(std::pair<rtl::OUString, ScRangeName*>(aTableName,p)); + } +} + ScRangeName* ScDocument::GetRangeName(SCTAB nTab) const { if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab]) diff --git a/sc/source/ui/inc/namedlg.hrc b/sc/source/ui/inc/namedlg.hrc index 1968d1d5fa74..5b1735f140ac 100644 --- a/sc/source/ui/inc/namedlg.hrc +++ b/sc/source/ui/inc/namedlg.hrc @@ -27,28 +27,37 @@ #include "sc.hrc" // -> RID_SCDLG_NAMES -#define BTN_OK 1 -#define BTN_CANCEL 2 #define BTN_ADD 3 -#define BTN_REMOVE 4 #define BTN_HELP 5 #define BTN_MORE 6 +#define BTN_MODIFY 55 +#define BTN_BACK 56 +#define BTN_DELETE 57 +#define BTN_CLOSE 62 #define FT_SCOPE 7 +#define FT_RANGE 58 +#define FT_NAME 59 +#define FL_DIV 60 #define LB_SCOPE 8 -#define FL_NAME 11 -#define ED_NAME 12 -#define FL_ASSIGN 13 +#define ED_NAME2 61 #define ED_ASSIGN 15 #define RB_ASSIGN 16 -#define STR_ADD 21 -#define STR_MODIFY 22 #define STR_INVALIDSYMBOL 23 #define STR_GLOBAL_SCOPE 24 +#define STR_MODIFYFAILED 72 #define BTN_CRITERIA 31 #define BTN_PRINTAREA 32 #define BTN_COLHEADER 33 #define BTN_ROWHEADER 34 -#define FL_TYPE 35 + +#define ED_NAME_LINE 63 +#define ED_EXPR_LINE 64 +#define ED_SCOPE_LINE 65 + +#define CTRL_MANAGENAMES 66 +#define STR_HEADER_NAME 69 +#define STR_HEADER_RANGE 70 +#define STR_HEADER_SCOPE 71 diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index 31a04834935d..bb6dd0799d24 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -34,15 +34,97 @@ #include <vcl/group.hxx> #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> +#include <vcl/ctrl.hxx> +#include <svtools/headbar.hxx> +#include <svtools/svtabbx.hxx> #include "rangenam.hxx" #include "anyrefdg.hxx" #include <boost/ptr_container/ptr_map.hpp> +#include <boost/ptr_container/ptr_set.hpp> + +#include <stack> +#include <map> class ScViewData; class ScDocument; struct ScNameDlgImpl; +struct ScRangeNameLine +{ + rtl::OUString aName; + rtl::OUString aExpression; + rtl::OUString aScope; +}; + +class ScRangeManagerTable : public SvTabListBox +{ +private: + HeaderBar maHeaderBar; + ScRangeName* mpGlobalRangeName; + std::map<rtl::OUString, ScRangeName*> maTabRangeNames; + rtl::OUString maGlobalString; +public: + ScRangeManagerTable( Window* pParent, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ); + ~ScRangeManagerTable() {}; + + SvLBoxEntry* addEntry( const ScRangeNameLine& rLine ); + + void GetCurrentLine(ScRangeNameLine& rLine); + void UpdateEntries(); +}; + +class ScRangeManagerCtrl : public Control +{ +public: + ScRangeManagerCtrl(Window* pParent, const ScResId& rResId): + Control( pParent, rResId) {} +}; + +//Undo Stack +class ScNameManagerUndo +{ +protected: +public: + virtual ~ScNameManagerUndo(); + virtual void Undo(); +}; + +class ScNameManagerUndoAdd : public ScNameManagerUndo +{ + ScRangeData* mpData; + ScRangeName* mpRangeName; +public: + ScNameManagerUndoAdd(ScRangeName* pRangeName, ScRangeData* pData): + mpData(pData), mpRangeName(pRangeName) {} + virtual ~ScNameManagerUndoAdd(); + virtual void Undo(); +}; + +class ScNameManagerUndoDelete : public ScNameManagerUndo +{ + ScRangeData* mpData; + ScRangeName* mpRangeName; +public: + ScNameManagerUndoDelete(ScRangeName* pRangeName, ScRangeData* pData): + mpData(pData), mpRangeName(pRangeName) {} + virtual ~ScNameManagerUndoDelete(); + virtual void Undo(); +}; + +class ScNameManagerUndoModify : public ScNameManagerUndo +{ + ScRangeData* mpOldData; + ScRangeData* mpNewData; + ScRangeName* mpOldRangeName; + ScRangeName* mpNewRangeName; +public: + ScNameManagerUndoModify(ScRangeName* pOldRangeName, ScRangeData* pOldData, ScRangeName* pNewRangeName, ScRangeData* pNewData): + mpOldData(pOldData), mpNewData(pNewData), mpOldRangeName(pOldRangeName), mpNewRangeName(pNewRangeName) {} + virtual ~ScNameManagerUndoModify(); + virtual void Undo(); +}; + //================================================================== class ScNameDlg : public ScAnyRefDlg @@ -50,68 +132,72 @@ class ScNameDlg : public ScAnyRefDlg private: typedef ::boost::ptr_map<SCTAB, ScRangeName> TabNameMapType; FixedText maFtScope; + FixedText maFtRange; + FixedText maFtName; ListBox maLbScope; - FixedLine aFlName; - ComboBox aEdName; - FixedLine aFlAssign; - formula::RefEdit aEdAssign; + formula::RefEdit maEdAssign; + Edit maEdName; formula::RefButton aRbAssign; - FixedLine aFlType; + FixedLine aFlDiv; CheckBox aBtnPrintArea; CheckBox aBtnColHeader; CheckBox aBtnCriteria; CheckBox aBtnRowHeader; - OKButton aBtnOk; - CancelButton aBtnCancel; + ScRangeManagerCtrl maNameMgrCtrl; + ScRangeManagerTable* mpRangeManagerTable; + HelpButton aBtnHelp; PushButton aBtnAdd; - PushButton aBtnRemove; + PushButton aBtnModify; + PushButton aBtnBack; + PushButton aBtnDelete; + PushButton aBtnClose; MoreButton aBtnMore; - sal_Bool bSaved; - const String aStrAdd; // "Hinzufuegen" - const String aStrModify; // "Aendern" const String errMsgInvalidSym; + const rtl::OUString maErrMsgModifiedFailed; const ::rtl::OUString maGlobalNameStr; ScViewData* pViewData; - ScDocument* pDoc; - ScRangeName maGlobalRangeName; - ScRangeName::TabNameMap maTabRangeNames; - ScRangeName* mpCurRangeName; //! range name set currently selected - const ScAddress theCursorPos; + ScDocument* mpDoc; + const ScAddress maCursorPos; Selection theCurSel; - ScNameDlgImpl* mpImpl; + std::stack<ScNameManagerUndo*> maUndoStack; private: void Init(); - void UpdateChecks(); + void UpdateChecks(ScRangeData* pData); + void ShowOptions(const ScRangeNameLine& rLine); void UpdateNames(); void CalcCurTableAssign( String& aAssign, ScRangeData* pRangeData ); - void SaveControlStates(); - void RestoreControlStates(); bool AddPushed(); void RemovePushed(); void OKPushed(); + void ModifiedPushed(); void NameSelected(); void ScopeChanged(); - void NameModified(Edit* pEd); + void NameModified(); + void BackPushed(); + + void SelectionChanged(); // Handler: - DECL_LINK( OkBtnHdl, void * ); - DECL_LINK( CancelBtnHdl, void * ); + DECL_LINK( CloseBtnHdl, void * ); DECL_LINK( AddBtnHdl, void * ); + DECL_LINK( ModifyBtnHdl, void * ); DECL_LINK( RemoveBtnHdl, void * ); - DECL_LINK( EdModifyHdl, Edit * ); + DECL_LINK( EdModifyHdl, void * ); DECL_LINK( NameSelectHdl, void * ); DECL_LINK( AssignGetFocusHdl, void * ); - DECL_LINK( ScopeChangedHdl, ListBox* ); + DECL_LINK( SelectionChangedHdl_Impl, void* ); + DECL_LINK( BackBtnHdl, void * ); + DECL_LINK( ScopeChangedHdl, void* ); protected: virtual void RefInputDone( sal_Bool bForced = sal_False ); diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 7bbec8da9fcb..4f6febfab50c 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -55,12 +55,167 @@ using ::std::auto_ptr; // defines ------------------------------------------------------------------- #define ABS_SREF SCA_VALID \ - | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE + | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE #define ABS_DREF ABS_SREF \ - | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE + | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE #define ABS_SREF3D ABS_SREF | SCA_TAB_3D #define ABS_DREF3D ABS_DREF | SCA_TAB_3D +//ScRangeManagerTable + +#define ITEMID_NAME 1 +#define ITEMID_RANGE 2 +#define ITEMID_SCOPE 3 + +namespace { + +ScRangeName* GetRangeName(const rtl::OUString& rTableName, ScDocument* pDoc) +{ + ScRangeName* pRangeName; + SCTAB nTab; + if ( pDoc->GetTable(rTableName, nTab)) + { + pRangeName = pDoc->GetRangeName(nTab); + } + else + { + pRangeName = pDoc->GetRangeName(); + } + return pRangeName; +} + +} + +String createEntryString(const ScRangeNameLine& rLine) +{ + String aRet(rLine.aName); + aRet += '\t'; + aRet += String(rLine.aExpression); + aRet += '\t'; + aRet += String(rLine.aScope); + return aRet; +} + +ScRangeManagerTable::ScRangeManagerTable( Window* pWindow, ScRangeName* pGlobalRangeName, std::map<rtl::OUString, ScRangeName*> aTabRangeNames ): + SvTabListBox( pWindow, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), + maHeaderBar( pWindow, WB_BUTTONSTYLE | WB_BOTTOMBORDER ), + mpGlobalRangeName( pGlobalRangeName ), + maTabRangeNames( aTabRangeNames ), + maGlobalString( ResId::toString(ScResId(STR_GLOBAL_SCOPE))) +{ + Size aBoxSize( pWindow->GetOutputSizePixel() ); + + maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) ); + + String aNameStr(ScResId(STR_HEADER_NAME)); + String aRangeStr(ScResId(STR_HEADER_RANGE)); + String aScopeStr(ScResId(STR_HEADER_SCOPE)); + + long nTabSize = aBoxSize.Width()/3; + maHeaderBar.InsertItem( ITEMID_NAME, aNameStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + maHeaderBar.InsertItem( ITEMID_SCOPE, aScopeStr, nTabSize, HIB_LEFT| HIB_VCENTER ); + + static long nTabs[] = {3, 0, nTabSize, 2*nTabSize }; + Size aHeadSize( maHeaderBar.GetSizePixel() ); + + //pParent->SetFocusControl( this ); + SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) ); + SetTabs( &nTabs[0], MAP_PIXEL ); + + Show(); + maHeaderBar.Show(); +} + +SvLBoxEntry* ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine) +{ + return InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); +} + +void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine) +{ + SvLBoxEntry* pCurrentEntry = GetCurEntry(); + rLine.aName = GetEntryText( pCurrentEntry, 0); + rLine.aExpression = GetEntryText(pCurrentEntry, 1); + rLine.aScope = GetEntryText(pCurrentEntry, 2); +} + +void ScRangeManagerTable::UpdateEntries() +{ + Clear(); + for (ScRangeName::iterator itr = mpGlobalRangeName->begin(); + itr != mpGlobalRangeName->end(); ++itr) + { + ScRangeNameLine aLine; + aLine.aName = itr->GetName(); + aLine.aScope = maGlobalString; + itr->GetSymbol(aLine.aExpression); + addEntry(aLine); + } + for (std::map<rtl::OUString, ScRangeName*>::iterator itr = maTabRangeNames.begin(); + itr != maTabRangeNames.end(); ++itr) + { + ScRangeName* pLocalRangeName = itr->second; + for (ScRangeName::iterator it = pLocalRangeName->begin(); + it != pLocalRangeName->end(); ++it) + { + ScRangeNameLine aLine; + aLine.aName = it->GetName(); + aLine.aScope = itr->first; + it->GetSymbol(aLine.aExpression); + addEntry(aLine); + } + } +} + +//undo +// +ScNameManagerUndo::~ScNameManagerUndo() +{ + +} + +void ScNameManagerUndo::Undo() +{ + //should never be called +} + +ScNameManagerUndoAdd::~ScNameManagerUndoAdd() +{ + delete mpData; +} + +void ScNameManagerUndoAdd::Undo() +{ + mpRangeName->erase(*mpData); +} + +ScNameManagerUndoDelete::~ScNameManagerUndoDelete() +{ + delete mpData; +} + +void ScNameManagerUndoDelete::Undo() +{ + mpRangeName->insert(mpData); + mpData = NULL; +} + +ScNameManagerUndoModify::~ScNameManagerUndoModify() +{ + delete mpOldData; + delete mpNewData; +} + +void ScNameManagerUndoModify::Undo() +{ + mpNewRangeName->erase(*mpNewData); + mpOldRangeName->insert(mpOldData);//takes ownership + mpOldData = NULL; +} + +//logic + struct ScNameDlgImpl { ScNameDlgImpl() : @@ -86,67 +241,61 @@ struct ScNameDlgImpl #define ERRORBOX(s) ErrorBox(this,WinBits(WB_OK|WB_DEF_OK),s).Execute(); ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, - ScViewData* ptrViewData, - const ScAddress& aCursorPos ) - - : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_NAMES ), - // - maFtScope( this, ScResId(FT_SCOPE) ), - maLbScope( this, ScResId(LB_SCOPE) ), - aFlName ( this, ScResId( FL_NAME ) ), - aEdName ( this, ScResId( ED_NAME ) ), - // - aFlAssign ( this, ScResId( FL_ASSIGN ) ), - aEdAssign ( this, this, ScResId( ED_ASSIGN ) ), - aRbAssign ( this, ScResId( RB_ASSIGN ), &aEdAssign, this ), - // - aFlType ( this, ScResId( FL_TYPE ) ), - aBtnPrintArea ( this, ScResId( BTN_PRINTAREA ) ), - aBtnColHeader ( this, ScResId( BTN_COLHEADER ) ), - aBtnCriteria ( this, ScResId( BTN_CRITERIA ) ), - aBtnRowHeader ( this, ScResId( BTN_ROWHEADER ) ), - // - aBtnOk ( this, ScResId( BTN_OK ) ), - aBtnCancel ( this, ScResId( BTN_CANCEL ) ), - aBtnHelp ( this, ScResId( BTN_HELP ) ), - aBtnAdd ( this, ScResId( BTN_ADD ) ), - aBtnRemove ( this, ScResId( BTN_REMOVE ) ), - aBtnMore ( this, ScResId( BTN_MORE ) ), - // - bSaved (false), - aStrAdd ( ScResId( STR_ADD ) ), - aStrModify ( ScResId( STR_MODIFY ) ), - errMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ), - maGlobalNameStr( ResId::toString(ScResId(STR_GLOBAL_SCOPE)) ), - // - pViewData ( ptrViewData ), - pDoc ( ptrViewData->GetDocument() ), - maGlobalRangeName(*pDoc->GetRangeName()), - mpCurRangeName(&maGlobalRangeName), - theCursorPos ( aCursorPos ), - mpImpl(new ScNameDlgImpl) -{ - // Copy sheet-local range names. - ScRangeName::TabNameCopyMap aOldNames; - pDoc->GetAllTabRangeNames(aOldNames); - ScRangeName::TabNameCopyMap::const_iterator itr = aOldNames.begin(), itrEnd = aOldNames.end(); - for (; itr != itrEnd; ++itr) - { - SAL_WNODEPRECATED_DECLARATIONS_PUSH - auto_ptr<ScRangeName> p(new ScRangeName(*itr->second)); - SAL_WNODEPRECATED_DECLARATIONS_POP - maTabRangeNames.insert(itr->first, p); - } + ScViewData* ptrViewData, + const ScAddress& aCursorPos ) + +: ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_NAMES ), + // + maFtScope( this, ScResId(FT_SCOPE) ), + maFtRange( this, ScResId(FT_RANGE) ), + maFtName( this, ScResId(FT_NAME) ), + maLbScope( this, ScResId(LB_SCOPE) ), + // + maEdAssign ( this, this, ScResId( ED_ASSIGN ) ), + maEdName ( this, ScResId( ED_NAME2 ) ), + aRbAssign ( this, ScResId( RB_ASSIGN ), &maEdAssign, this ), + // + aFlDiv ( this, ScResId( FL_DIV ) ), + aBtnPrintArea ( this, ScResId( BTN_PRINTAREA ) ), + aBtnColHeader ( this, ScResId( BTN_COLHEADER ) ), + aBtnCriteria ( this, ScResId( BTN_CRITERIA ) ), + aBtnRowHeader ( this, ScResId( BTN_ROWHEADER ) ), + // + maNameMgrCtrl ( this, ScResId( CTRL_MANAGENAMES ) ), + // + aBtnHelp ( this, ScResId( BTN_HELP ) ), + aBtnAdd ( this, ScResId( BTN_ADD ) ), + aBtnModify ( this, ScResId( BTN_MODIFY ) ), + aBtnBack ( this, ScResId( BTN_BACK ) ), + aBtnDelete ( this, ScResId( BTN_DELETE ) ), + aBtnClose ( this, ScResId( BTN_CLOSE ) ), + aBtnMore ( this, ScResId( BTN_MORE ) ), + // + errMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ), + maErrMsgModifiedFailed( ResId::toString(ScResId( STR_MODIFYFAILED ) ) ), + maGlobalNameStr( ResId::toString(ScResId(STR_GLOBAL_SCOPE)) ), + // + pViewData ( ptrViewData ), + mpDoc ( ptrViewData->GetDocument() ), + maCursorPos ( aCursorPos ) +{ + //init UI + std::map<rtl::OUString,ScRangeName*> aTabRangeNameMap; + mpDoc->GetTabRangeNameMap(aTabRangeNameMap); + mpRangeManagerTable = new ScRangeManagerTable(&maNameMgrCtrl, mpDoc->GetRangeName(), aTabRangeNameMap); + mpRangeManagerTable->SetSelectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); + mpRangeManagerTable->SetDeselectHdl( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) ); Init(); FreeResource(); - aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); + //aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); } ScNameDlg::~ScNameDlg() { - delete mpImpl; + delete mpRangeManagerTable; + //need to delete undo stack here } void ScNameDlg::Init() @@ -154,24 +303,25 @@ void ScNameDlg::Init() String aAreaStr; ScRange aRange; - OSL_ENSURE( pViewData && pDoc, "ViewData oder Document nicht gefunden!" ); + OSL_ENSURE( pViewData && mpDoc, "ViewData oder Document nicht gefunden!" ); - maLbScope.SetSelectHdl( LINK(this, ScNameDlg, ScopeChangedHdl) ); - aBtnOk.SetClickHdl ( LINK( this, ScNameDlg, OkBtnHdl ) ); - aBtnCancel.SetClickHdl ( LINK( this, ScNameDlg, CancelBtnHdl ) ); + aBtnClose.SetClickHdl ( LINK( this, ScNameDlg, CloseBtnHdl ) ); aBtnAdd.SetClickHdl ( LINK( this, ScNameDlg, AddBtnHdl ) ); - aBtnRemove.SetClickHdl ( LINK( this, ScNameDlg, RemoveBtnHdl ) ); - aEdAssign.SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) ); - aEdAssign.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) ); - aEdName.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) ); - aEdName.SetSelectHdl ( LINK( this, ScNameDlg, NameSelectHdl ) ); + aBtnBack.SetClickHdl ( LINK( this, ScNameDlg, BackBtnHdl ) ); + maEdAssign.SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) ); + maEdAssign.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) ); + maEdName.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) ); + maLbScope.SetSelectHdl( LINK(this, ScNameDlg, ScopeChangedHdl) ); + aBtnDelete.SetClickHdl ( LINK( this, ScNameDlg, RemoveBtnHdl ) ); + aBtnModify.SetClickHdl ( LINK( this, ScNameDlg, ModifyBtnHdl ) ); + + aBtnBack.Disable(); aBtnCriteria .Hide(); aBtnPrintArea.Hide(); aBtnColHeader.Hide(); aBtnRowHeader.Hide(); - aBtnMore.AddWindow( &aFlType ); aBtnMore.AddWindow( &aBtnCriteria ); aBtnMore.AddWindow( &aBtnPrintArea ); aBtnMore.AddWindow( &aBtnColHeader ); @@ -180,58 +330,50 @@ void ScNameDlg::Init() // Initialize scope list. maLbScope.InsertEntry(maGlobalNameStr); maLbScope.SelectEntryPos(0); - SCTAB n = pDoc->GetTableCount(); + SCTAB n = mpDoc->GetTableCount(); for (SCTAB i = 0; i < n; ++i) { rtl::OUString aTabName; - pDoc->GetName(i, aTabName); + mpDoc->GetName(i, aTabName); maLbScope.InsertEntry(aTabName); } UpdateNames(); pViewData->GetSimpleArea( aRange ); - aRange.Format( aAreaStr, ABS_DREF3D, pDoc, - ScAddress::Details(pDoc->GetAddressConvention(), 0, 0) ); + aRange.Format( aAreaStr, ABS_DREF3D, mpDoc, + ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) ); theCurSel = Selection( 0, SELECTION_MAX ); - aEdAssign.GrabFocus(); - aEdAssign.SetText( aAreaStr ); - aEdAssign.SetSelection( theCurSel ); - aEdName.GrabFocus(); - - aBtnAdd.Disable(); - aBtnRemove.Disable(); - if ( aEdName.GetEntryCount() > 0 ) - aBtnAdd.SetText( aStrAdd ); - UpdateChecks(); + maEdAssign.GrabFocus(); + maEdAssign.SetText( aAreaStr ); + maEdAssign.SetSelection( theCurSel ); + EdModifyHdl( 0 ); - bSaved=sal_True; - SaveControlStates(); } sal_Bool ScNameDlg::IsRefInputMode() const { - return aEdAssign.IsEnabled(); + return maEdAssign.IsEnabled(); } void ScNameDlg::RefInputDone( sal_Bool bForced) { ScAnyRefDlg::RefInputDone(bForced); - EdModifyHdl(&aEdAssign); + EdModifyHdl(&maEdAssign); } void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { - if ( aEdAssign.IsEnabled() ) + if ( maEdAssign.IsEnabled() ) { if ( rRef.aStart != rRef.aEnd ) - RefInputStart(&aEdAssign); + RefInputStart(&maEdAssign); String aRefStr; rRef.Format( aRefStr, ABS_DREF3D, pDocP, - ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) ); - aEdAssign.SetRefString( aRefStr ); + ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) ); + maEdAssign.SetRefString( aRefStr ); } } @@ -242,75 +384,25 @@ sal_Bool ScNameDlg::Close() void ScNameDlg::SetActive() { - aEdAssign.GrabFocus(); + maEdAssign.GrabFocus(); RefInputDone(); } -void ScNameDlg::UpdateChecks() +void ScNameDlg::UpdateChecks(ScRangeData* pData) { - const ScRangeData* pData = mpCurRangeName->findByName(aEdName.GetText()); - if (pData) - { - aBtnCriteria .Check( pData->HasType( RT_CRITERIA ) ); - aBtnPrintArea.Check( pData->HasType( RT_PRINTAREA ) ); - aBtnColHeader.Check( pData->HasType( RT_COLHEADER ) ); - aBtnRowHeader.Check( pData->HasType( RT_ROWHEADER ) ); - } - - if ( aEdName.GetText().Len() != 0 ) - { - if ( !aFlType.IsEnabled() ) - { - aFlType .Enable(); - aBtnCriteria .Enable(); - aBtnPrintArea.Enable(); - aBtnColHeader.Enable(); - aBtnRowHeader.Enable(); - aFlAssign .Enable(); - aEdAssign .Enable(); - aRbAssign .Enable(); - } - } - else if ( aFlType.IsEnabled() ) - { - aFlType .Disable(); - aBtnCriteria .Disable(); - aBtnPrintArea.Disable(); - aBtnColHeader.Disable(); - aBtnRowHeader.Disable(); - aFlAssign .Disable(); - aEdAssign .Disable(); - aRbAssign .Disable(); - } + aBtnCriteria .Check( pData->HasType( RT_CRITERIA ) ); + aBtnPrintArea.Check( pData->HasType( RT_PRINTAREA ) ); + aBtnColHeader.Check( pData->HasType( RT_COLHEADER ) ); + aBtnRowHeader.Check( pData->HasType( RT_ROWHEADER ) ); } void ScNameDlg::UpdateNames() { - aEdName.SetUpdateMode( false ); - sal_uInt16 nNamePos = aEdName.GetTopEntry(); - aEdName.Clear(); - - aEdAssign.SetText( EMPTY_STRING ); - - if (mpCurRangeName->empty()) - { - aBtnAdd.SetText( aStrAdd ); - aBtnAdd.Disable(); - aBtnRemove.Disable(); - } + mpRangeManagerTable->UpdateEntries(); + if (!maUndoStack.empty()) + aBtnBack.Enable(); else - { - ScRangeName::const_iterator itr = mpCurRangeName->begin(), itrEnd = mpCurRangeName->end(); - for (; itr != itrEnd; ++itr) - { - if (!itr->HasType(RT_DATABASE) && !itr->HasType(RT_SHARED)) - aEdName.InsertEntry(itr->GetName()); - } - } - - aEdName.SetUpdateMode( true ); - aEdName.SetTopEntry(nNamePos); - aEdName.Invalidate(); + aBtnBack.Disable(); } void ScNameDlg::CalcCurTableAssign( String& aAssign, ScRangeData* pRangeData ) @@ -318,7 +410,7 @@ void ScNameDlg::CalcCurTableAssign( String& aAssign, ScRangeData* pRangeData ) if ( pRangeData ) { rtl::OUStringBuffer sBuffer; - pRangeData->UpdateSymbol( sBuffer, theCursorPos ); + pRangeData->UpdateSymbol( sBuffer, maCursorPos ); aAssign = sBuffer; } else @@ -327,283 +419,222 @@ void ScNameDlg::CalcCurTableAssign( String& aAssign, ScRangeData* pRangeData ) } } -void ScNameDlg::SaveControlStates() +void ScNameDlg::ShowOptions(const ScRangeNameLine& rLine) { - mpImpl->aStrSymbol = aEdAssign.GetText(); - mpImpl->bCriteria = aBtnCriteria.IsChecked(); - mpImpl->bPrintArea = aBtnPrintArea.IsChecked(); - mpImpl->bColHeader = aBtnColHeader.IsChecked(); - mpImpl->bRowHeader = aBtnRowHeader.IsChecked(); - mpImpl->bDirty = true; -} - -void ScNameDlg::RestoreControlStates() -{ - if ( mpImpl->bDirty ) + ScRangeName* pRangeName = GetRangeName(rLine.aScope, mpDoc); + ScRangeData* pData = pRangeName->findByName(rLine.aName); + if (pData) { - aEdAssign.SetText( mpImpl->aStrSymbol ); - aBtnCriteria.Check( mpImpl->bCriteria ); - aBtnPrintArea.Check( mpImpl->bPrintArea ); - aBtnColHeader.Check( mpImpl->bColHeader ); - aBtnRowHeader.Check( mpImpl->bRowHeader ); - mpImpl->bDirty = false; + UpdateChecks(pData); } } + bool ScNameDlg::AddPushed() { - bool bAdded = false; - String aNewEntry = aEdName.GetText(); - sal_uInt16 nNamePos = aEdName.GetTopEntry(); - aNewEntry.EraseLeadingChars( ' ' ); - aNewEntry.EraseTrailingChars( ' ' ); + if (!mpDoc) + return false; - if ( aNewEntry.Len() > 0 ) + rtl::OUString aName = maEdName.GetText(); + aName = aName.trim(); + if (!aName.getLength()) + return false; + + if (!ScRangeData::IsNameValid( aName, mpDoc )) + { + ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME)); + return false; + } + + rtl::OUString aScope = maLbScope.GetSelectEntry(); + rtl::OUString aExpr = maEdAssign.GetText(); + ScRangeName* pRangeName = GetRangeName(aScope, mpDoc); + + RangeType nType = RT_NAME | + (aBtnRowHeader.IsChecked() ? RT_ROWHEADER : RangeType(0)) + |(aBtnColHeader.IsChecked() ? RT_COLHEADER : RangeType(0)) + |(aBtnPrintArea.IsChecked() ? RT_PRINTAREA : RangeType(0)) + |(aBtnCriteria.IsChecked() ? RT_CRITERIA : RangeType(0)); + + ScRangeData* pNewEntry = new ScRangeData( mpDoc, aName, aExpr, + maCursorPos, nType); + if ( 0 == pNewEntry->GetErrCode() ) { - if ( ScRangeData::IsNameValid( aNewEntry, pDoc ) ) + if (!pRangeName->insert( pNewEntry)) { - if ( pDoc ) - { - ScRangeData* pNewEntry = NULL; - RangeType nType = RT_NAME; - String theSymbol = aEdAssign.GetText(); - String aStrPos; - String aStrArea; - - pNewEntry = new ScRangeData( pDoc, - aNewEntry, - theSymbol, - theCursorPos, - nType ); - if (pNewEntry) - { - nType = nType - | (aBtnRowHeader .IsChecked() ? RT_ROWHEADER : RangeType(0)) - | (aBtnColHeader .IsChecked() ? RT_COLHEADER : RangeType(0)) - | (aBtnPrintArea .IsChecked() ? RT_PRINTAREA : RangeType(0)) - | (aBtnCriteria .IsChecked() ? RT_CRITERIA : RangeType(0)); - pNewEntry->AddType(nType); - } - - // theSymbol gueltig? - // (= konnte theSymbol im ScRangeData-Ctor - // in ein Token-Array uebersetzt werden?) - if ( 0 == pNewEntry->GetErrCode() ) - { - rtl::OUString aUpper( ScGlobal::pCharClass->upper( aNewEntry)); - ScRangeData* pData = mpCurRangeName->findByUpperName(aUpper); - if (pData) - { - pNewEntry->SetIndex(pData->GetIndex()); - mpCurRangeName->erase(*pData); - } - else - mpImpl->Clear(); - - if ( !mpCurRangeName->insert( pNewEntry ) ) - pNewEntry = NULL; - - UpdateNames(); - bSaved=false; - RestoreControlStates(); - aEdName.SetText(EMPTY_STRING); - aEdName.GrabFocus(); - UpdateChecks(); - aBtnAdd.SetText( aStrAdd ); - aBtnAdd.Disable(); - aBtnRemove.Disable(); - - bAdded = true; - } - else - { - delete pNewEntry; - ERRORBOX( errMsgInvalidSym ); - theCurSel = Selection( 0, SELECTION_MAX ); - aEdAssign.GrabFocus(); - } - } + pNewEntry = NULL; } else { - ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) ); - aEdName.SetSelection( Selection( 0, SELECTION_MAX ) ); - aEdName.GrabFocus(); + maEdName.SetText(EMPTY_STRING); + aBtnAdd.Disable(); + aBtnDelete.Disable(); + maUndoStack.push( new ScNameManagerUndoAdd( pRangeName, new ScRangeData(*pNewEntry) )); + UpdateNames(); } } - - aEdName.SetTopEntry(nNamePos); - return bAdded; + else + { + delete pNewEntry; + ERRORBOX( errMsgInvalidSym ); + } + return true; } void ScNameDlg::RemovePushed() { - const String aStrEntry = aEdName.GetText(); - ScRangeData* pData = mpCurRangeName->findByName(aStrEntry); + ScRangeNameLine aLine; + mpRangeManagerTable->GetCurrentLine(aLine); + rtl::OUString aName = aLine.aName; + rtl::OUString aScope = aLine.aScope; + rtl::OUString aExpr = aLine.aExpression; + ScRangeName* pRangeName = GetRangeName(aScope, mpDoc); + + ScRangeData* pData = pRangeName->findByName(aName); if (pData) { - String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY ); - String aMsg = aStrDelMsg.GetToken( 0, '#' ); - - aMsg += aStrEntry; - aMsg += aStrDelMsg.GetToken( 1, '#' ); - - if ( RET_YES == - QueryBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), aMsg ).Execute() ) + sal_Int32 nIndex = 0; + rtl::OUString aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY ); + rtl::OUStringBuffer aMsg = aStrDelMsg.getToken( 0, '#', nIndex ); + aMsg.append(aName); + aMsg.append(aStrDelMsg.getToken( 1, '#', nIndex)); + + if (RET_YES == + QueryBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), aMsg.makeStringAndClear() ).Execute() ) { - mpCurRangeName->erase(*pData); + maUndoStack.push( new ScNameManagerUndoDelete( pRangeName, new ScRangeData(*pData) )); + pRangeName->erase(*pData); UpdateNames(); - UpdateChecks(); - bSaved=false; - RestoreControlStates(); - theCurSel = Selection( 0, SELECTION_MAX ); - aBtnAdd.SetText( aStrAdd ); aBtnAdd.Disable(); - aBtnRemove.Disable(); } } } -void ScNameDlg::OKPushed() +void ScNameDlg::NameSelected() { - if ( aBtnAdd.IsEnabled() ) - AddPushed(); - if ( !aBtnAdd.IsEnabled() && !aBtnRemove.IsEnabled() ) - { - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocFunc aFunc(*pDocSh); - - // Store pointers to sheet local names instances. - ScRangeName::TabNameCopyMap aTabNames; - ScRangeName::copyLocalNames(maTabRangeNames, aTabNames); - aFunc.ModifyAllRangeNames(&maGlobalRangeName, aTabNames); - Close(); - } } -void ScNameDlg::NameSelected() +void ScNameDlg::NameModified() { - ScRangeData* pData = mpCurRangeName->findByName(aEdName.GetText()); - if (pData) + rtl::OUString aName = maEdName.GetText(); + aName = aName.trim(); + rtl::OUString aExpr = maEdAssign.GetText(); + rtl::OUString aScope = maLbScope.GetSelectEntry(); + + if (!aName.getLength() || !ScRangeData::IsNameValid(aName, mpDoc)) { - String aSymbol; - pData->GetSymbol( aSymbol ); - CalcCurTableAssign( aSymbol, pData ); - aEdAssign.SetText( aSymbol ); - aBtnAdd.SetText( aStrModify ); - theCurSel = Selection( 0, SELECTION_MAX ); + aBtnAdd.Disable(); + aBtnModify.Disable(); } - UpdateChecks(); -} - -void ScNameDlg::ScopeChanged() -{ - sal_uInt16 nPos = maLbScope.GetSelectEntryPos(); - if (nPos == 0) - // Global scope - mpCurRangeName = &maGlobalRangeName; else { - // Sheet scope - SCTAB nTab = static_cast<SCTAB>(nPos-1); - ScRangeName::TabNameMap::iterator itr = maTabRangeNames.find(nTab); - if (itr == maTabRangeNames.end()) + ScRangeName* pRangeName = GetRangeName(aScope, mpDoc); + if (pRangeName->findByName(aName)) { - SAL_WNODEPRECATED_DECLARATIONS_PUSH - auto_ptr<ScRangeName> p(new ScRangeName); - SAL_WNODEPRECATED_DECLARATIONS_POP - ::std::pair<ScRangeName::TabNameMap::iterator, bool> r = - maTabRangeNames.insert(nTab, p); - itr = r.first; + aBtnAdd.Disable(); } - mpCurRangeName = itr->second; + else + aBtnAdd.Enable(); + aBtnModify.Enable(); + } +} + +void ScNameDlg::SelectionChanged() +{ + ScRangeNameLine aLine; + mpRangeManagerTable->GetCurrentLine(aLine); + maEdAssign.SetText(aLine.aExpression); + maEdName.SetText(aLine.aName); + maLbScope.SelectEntry(aLine.aScope); + ShowOptions(aLine); +} + +void ScNameDlg::BackPushed() +{ + ScNameManagerUndo* aUndo = maUndoStack.top(); + aUndo->Undo(); + maUndoStack.pop(); + if (maUndoStack.empty()) + { + aBtnBack.Disable(); } - aEdName.SetText(rtl::OUString()); UpdateNames(); + NameModified(); } -void ScNameDlg::NameModified(Edit* pEd) +void ScNameDlg::ScopeChanged() { - String theName = aEdName.GetText(); - String theSymbol = aEdAssign.GetText(); - sal_Bool bNameFound = (COMBOBOX_ENTRY_NOTFOUND - != aEdName.GetEntryPos( theName )); + NameModified(); +} - if ( pEd == &aEdName ) +void ScNameDlg::ModifiedPushed() +{ + if (!mpDoc) + return; + + rtl::OUString aName = maEdName.GetText(); + aName = aName.trim(); + if (!aName.getLength()) + return; + + if (!ScRangeData::IsNameValid( aName, mpDoc )) { - if ( theName.Len() == 0 ) - { - if ( aBtnAdd.GetText() != aStrAdd ) - aBtnAdd.SetText( aStrAdd ); - aBtnAdd.Disable(); - aBtnRemove.Disable(); - aFlAssign.Disable(); - aEdAssign.Disable(); - aRbAssign.Disable(); - } - else - { - if ( bNameFound ) - { - if ( aBtnAdd.GetText() != aStrModify ) - aBtnAdd.SetText( aStrModify ); - - aBtnRemove.Enable(); - - if(!bSaved) - { - bSaved=true; - SaveControlStates(); - } - NameSelectHdl( 0 ); - } - else - { - if ( aBtnAdd.GetText() != aStrAdd ) - aBtnAdd.SetText( aStrAdd ); - aBtnRemove.Disable(); - - bSaved=false; - RestoreControlStates(); - } - theSymbol = aEdAssign.GetText(); - - if ( theSymbol.Len() > 0 ) - aBtnAdd.Enable(); - else - aBtnAdd.Disable(); - - aFlAssign.Enable(); - aEdAssign.Enable(); - aRbAssign.Enable(); - } - UpdateChecks(); - theCurSel = Selection( 0, SELECTION_MAX ); + ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME)); + return; } - else if ( pEd == &aEdAssign ) + + rtl::OUString aNewExpr = maEdAssign.GetText(); + rtl::OUString aNewScope = maLbScope.GetSelectEntry(); + ScRangeName* pNewRangeName = GetRangeName(aNewScope, mpDoc); + + ScRangeNameLine aLine; + mpRangeManagerTable->GetCurrentLine(aLine); + ScRangeName* pOldRangeName = GetRangeName(aLine.aScope, mpDoc); + + + + rtl::OUString aScope = maLbScope.GetSelectEntry(); + rtl::OUString aExpr = maEdAssign.GetText(); + + RangeType nType = RT_NAME | + (aBtnRowHeader.IsChecked() ? RT_ROWHEADER : RangeType(0)) + |(aBtnColHeader.IsChecked() ? RT_COLHEADER : RangeType(0)) + |(aBtnPrintArea.IsChecked() ? RT_PRINTAREA : RangeType(0)) + |(aBtnCriteria.IsChecked() ? RT_CRITERIA : RangeType(0)); + + ScRangeData* pNewEntry = new ScRangeData( mpDoc, aName, aExpr, + maCursorPos, nType); + if ( 0 == pNewEntry->GetErrCode() ) { - if ( (theName.Len()>0) && (theSymbol.Len()>0) ) + ScRangeData* pData = pOldRangeName->findByName(aLine.aName); + ScRangeData* pTemp = new ScRangeData(*pData); + pOldRangeName->erase(*pData); + if (!pNewRangeName->insert( pNewEntry)) { - aBtnAdd.Enable(); - if ( bNameFound ) - aBtnRemove.Enable(); + pOldRangeName->insert(pTemp); + pTemp = NULL; + pNewEntry = NULL; + ERRORBOX( maErrMsgModifiedFailed ); } else { + maEdName.SetText(EMPTY_STRING); aBtnAdd.Disable(); - aBtnRemove.Disable(); + aBtnDelete.Disable(); + maUndoStack.push( new ScNameManagerUndoModify( pOldRangeName, new ScRangeData(*pTemp), pNewRangeName, new ScRangeData(*pNewEntry) )); + UpdateNames(); } + delete pTemp; + } + else + { + delete pNewEntry; + ERRORBOX( errMsgInvalidSym ); } } -IMPL_LINK( ScNameDlg, OkBtnHdl, void *, EMPTYARG ) -{ - OKPushed(); - return 0; -} - -IMPL_LINK( ScNameDlg, CancelBtnHdl, void *, EMPTYARG ) +IMPL_LINK( ScNameDlg, CloseBtnHdl, void *, EMPTYARG ) { Close(); return 0; @@ -614,6 +645,13 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *, EMPTYARG ) return AddPushed(); } +IMPL_LINK( ScNameDlg, ModifyBtnHdl, void *, EMPTYARG ) +{ + ModifiedPushed(); + return 0; +} + + IMPL_LINK( ScNameDlg, RemoveBtnHdl, void *, EMPTYARG ) { RemovePushed(); @@ -626,19 +664,31 @@ IMPL_LINK( ScNameDlg, NameSelectHdl, void *, EMPTYARG ) return 0; } -IMPL_LINK( ScNameDlg, EdModifyHdl, Edit *, pEd ) +IMPL_LINK( ScNameDlg, EdModifyHdl, void *, EMPTYARG ) { - NameModified(pEd); + NameModified(); return 0; } IMPL_LINK( ScNameDlg, AssignGetFocusHdl, void *, EMPTYARG ) { - EdModifyHdl( &aEdAssign ); + EdModifyHdl( &maEdAssign ); + return 0; +} + +IMPL_LINK( ScNameDlg, SelectionChangedHdl_Impl, void *, EMPTYARG ) +{ + SelectionChanged(); + return 0; +} + +IMPL_LINK( ScNameDlg, BackBtnHdl, void*, EMPTYARG ) +{ + BackPushed(); return 0; } -IMPL_LINK( ScNameDlg, ScopeChangedHdl, ListBox*, EMPTYARG ) +IMPL_LINK( ScNameDlg, ScopeChangedHdl, void*, EMPTYARG ) { ScopeChanged(); return 0; diff --git a/sc/source/ui/src/namedlg.src b/sc/source/ui/src/namedlg.src index fa70f0bb9bce..be1c84c83e25 100644 --- a/sc/source/ui/src/namedlg.src +++ b/sc/source/ui/src/namedlg.src @@ -32,118 +32,123 @@ ModelessDialog RID_SCDLG_NAMES HelpId = CMD_FID_DEFINE_NAME ; Hide = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 222 , 165 ) ; - Text [ en-US ] = "Define Names" ; + Size = MAP_APPFONT ( 220 , 250 ) ; + Text [ en-US ] = "Manage Names" ; Moveable = TRUE ; - // Closeable = TRUE; // Dieser Dialog hat einen Cancel-Button ! - OKButton BTN_OK + Closeable = TRUE; + HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 166 , 6 ) ; + Pos = MAP_APPFONT ( 6 , 225 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; - CancelButton BTN_CANCEL + PushButton BTN_ADD { - Pos = MAP_APPFONT ( 166 , 23 ) ; + HelpID = "sc:PushButton:RID_SCDLG_NAMES:BTN_ADD"; + Pos = MAP_APPFONT ( 6 , 200 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Add" ; TabStop = TRUE ; + DefButton = TRUE ; }; - HelpButton BTN_HELP + PushButton BTN_MODIFY { - Pos = MAP_APPFONT ( 166 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT( 60, 200) ; + Size = MAP_APPFONT ( 50, 14 ) ; + Text [ en-US ] = "Modify" ; TabStop = TRUE ; }; - PushButton BTN_ADD + PushButton BTN_BACK { - HelpID = "sc:PushButton:RID_SCDLG_NAMES:BTN_ADD"; - Pos = MAP_APPFONT ( 166 , 74 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add" ; + Pos = MAP_APPFONT( 114, 200) ; + Size = MAP_APPFONT ( 50, 14 ) ; + Text [ en-US ] = "Back" ; TabStop = TRUE ; - DefButton = TRUE ; }; - PushButton BTN_REMOVE + PushButton BTN_DELETE { - HelpID = "sc:PushButton:RID_SCDLG_NAMES:BTN_REMOVE"; - Pos = MAP_APPFONT ( 166 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT( 168, 200) ; + Size = MAP_APPFONT ( 50, 14 ) ; Text [ en-US ] = "~Delete" ; TabStop = TRUE ; }; + PushButton BTN_CLOSE + { + Pos = MAP_APPFONT ( 168 , 225 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Close" ; + TabStop = TRUE ; + }; FixedText FT_SCOPE { - Pos = MAP_APPFONT( 6, 8 ); + Pos = MAP_APPFONT( 6, 170 ); Size = MAP_APPFONT( 40, 8 ); Text [ en-US ] = "Scope" ; }; - - ListBox LB_SCOPE + FixedText FT_RANGE { - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 7 ) ; - Size = MAP_APPFONT ( 100 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; + Pos = MAP_APPFONT( 6, 155 ); + Size = MAP_APPFONT( 40, 8 ); + Text [ en-US ] = "Range" ; }; - - FixedLine FL_NAME + FixedText FT_NAME { - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 154 , 8 ) ; + Pos = MAP_APPFONT( 6, 140 ); + Size = MAP_APPFONT( 40, 8 ); Text [ en-US ] = "Name" ; }; - ComboBox ED_NAME + + Edit ED_NAME2 { - HelpID = "sc:ComboBox:RID_SCDLG_NAMES:ED_NAME"; - Pos = MAP_APPFONT ( 12 , 37 ) ; - Size = MAP_APPFONT ( 145 , 92 ) ; + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 140 ) ; + Size = MAP_APPFONT ( 168 , 12 ) ; TabStop = TRUE ; - VScroll = TRUE ; - Sort = TRUE ; }; - FixedLine FL_ASSIGN + ListBox LB_SCOPE { - Pos = MAP_APPFONT ( 6 , 135 ) ; - Size = MAP_APPFONT ( 154 , 8 ) ; - Text [ en-US ] = "Assigned to" ; + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 170 ) ; + Size = MAP_APPFONT ( 168 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; }; + Edit ED_ASSIGN { HelpID = "sc:Edit:RID_SCDLG_NAMES:ED_ASSIGN"; Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 146 ) ; - Size = MAP_APPFONT ( 131 , 12 ) ; + Pos = MAP_APPFONT ( 50 , 155 ) ; + Size = MAP_APPFONT ( 155 , 12 ) ; TabStop = TRUE ; }; ImageButton RB_ASSIGN { HelpID = "sc:ImageButton:RID_SCDLG_NAMES:RB_ASSIGN"; - Pos = MAP_APPFONT ( 145 , 145 ) ; - Size = MAP_APPFONT ( 13 , 15 ) ; + Pos = MAP_APPFONT ( 205 , 155 ) ; + Size = MAP_APPFONT ( 13 , 12 ) ; TabStop = FALSE ; QuickHelpText [ en-US ] = "Shrink" ; }; MoreButton BTN_MORE { HelpID = "sc:MoreButton:RID_SCDLG_NAMES:BTN_MORE"; - Pos = MAP_APPFONT ( 166 , 146 ) ; + Pos = MAP_APPFONT ( 6 , 185 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; MapUnit = MAP_APPFONT ; Delta = 41 ; }; - FixedLine FL_TYPE + FixedLine FL_DIV { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 154 , 8 ) ; - Text [ en-US ] = "Area type" ; + Pos = MAP_APPFONT ( 0, 220 ) ; + Size = MAP_APPFONT ( 220, 2 ) ; }; CheckBox BTN_PRINTAREA { HelpID = "sc:CheckBox:RID_SCDLG_NAMES:BTN_PRINTAREA"; - Pos = MAP_APPFONT ( 12 , 179 ) ; + Pos = MAP_APPFONT ( 6 , 255 ) ; Size = MAP_APPFONT ( 60 , 10 ) ; Text [ en-US ] = "~Print range" ; TabStop = TRUE ; @@ -151,7 +156,7 @@ ModelessDialog RID_SCDLG_NAMES CheckBox BTN_CRITERIA { HelpID = "sc:CheckBox:RID_SCDLG_NAMES:BTN_CRITERIA"; - Pos = MAP_APPFONT ( 12 , 193 ) ; + Pos = MAP_APPFONT ( 6 , 270 ) ; Size = MAP_APPFONT ( 60 , 10 ) ; Text [ en-US ] = "~Filter" ; TabStop = TRUE ; @@ -159,7 +164,7 @@ ModelessDialog RID_SCDLG_NAMES CheckBox BTN_ROWHEADER { HelpID = "sc:CheckBox:RID_SCDLG_NAMES:BTN_ROWHEADER"; - Pos = MAP_APPFONT ( 75 , 193 ) ; + Pos = MAP_APPFONT ( 110, 270 ) ; Size = MAP_APPFONT ( 82 , 10 ) ; Text [ en-US ] = "Repeat ~row" ; TabStop = TRUE ; @@ -167,29 +172,64 @@ ModelessDialog RID_SCDLG_NAMES CheckBox BTN_COLHEADER { HelpID = "sc:CheckBox:RID_SCDLG_NAMES:BTN_COLHEADER"; - Pos = MAP_APPFONT ( 75 , 179 ) ; + Pos = MAP_APPFONT ( 110 , 255 ) ; Size = MAP_APPFONT ( 82 , 10 ) ; Text [ en-US ] = "Repeat ~column" ; TabStop = TRUE ; }; - String STR_ADD + String STR_INVALIDSYMBOL { - Text [ en-US ] = "~Add" ; + Text [ en-US ] = "Invalid expression" ; }; - - String STR_MODIFY + String STR_MODIFYFAILED + { + Text [en-US ] = "Modifying range name failed" ; + }; + String STR_GLOBAL_SCOPE { - Text [ en-US ] = "Mod~ify" ; + Text [ en-US ] = "Document (Global)" ; }; - String STR_INVALIDSYMBOL + FixedText ED_NAME_LINE { - Text [ en-US ] = "Invalid expression" ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 100 ) ; + Size = MAP_APPFONT ( 72 , 12 ) ; + TabStop = TRUE ; + }; + FixedText ED_EXPR_LINE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 78 , 100 ) ; + Size = MAP_APPFONT ( 70 , 12 ) ; + TabStop = TRUE ; + }; + FixedText ED_SCOPE_LINE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 70 , 100 ) ; + Size = MAP_APPFONT ( 148 , 12 ) ; + TabStop = TRUE ; }; - String STR_GLOBAL_SCOPE + Control CTRL_MANAGENAMES + { + Pos = MAP_APPFONT( 6, 20 ); + Size = MAP_APPFONT( 210, 100 ); + Border = TRUE; + DialogControl = TRUE; + }; + String STR_HEADER_NAME + { + Text [en-US] = "Name"; + }; + String STR_HEADER_RANGE + { + Text [en-US] = "Range"; + }; + String STR_HEADER_SCOPE { - Text [ en-US ] = "Document (Global)"; + Text [en-US] = "Scope"; }; }; |