From ce26c58c7f5088a2982e0ce880b426771e55e234 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 19 Nov 2011 22:40:51 +0100 Subject: [PATCH] ManageNames: Paste names, initial layout without table --- sc/source/ui/inc/miscdlgs.hrc | 4 ++ sc/source/ui/inc/namepast.hxx | 12 ++---- sc/source/ui/inc/scui_def.hxx | 1 + sc/source/ui/namedlg/namepast.cxx | 67 ++++++------------------------- sc/source/ui/src/miscdlgs.src | 56 +++++++++----------------- 5 files changed, 41 insertions(+), 99 deletions(-) diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc index 3f1faa5492aa..a281ae91847e 100644 --- a/sc/source/ui/inc/miscdlgs.hrc +++ b/sc/source/ui/inc/miscdlgs.hrc @@ -91,6 +91,10 @@ #define FL_SEP1 51 #define FL_SEP2 52 +#define BTN_CLOSE 60 +#define BTN_PASTE 61 +#define BTN_PASTE_ALL 62 + // Tabelle einfuegen/loeschen #define FT_DEST 1 #define LB_DEST 2 diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx index 618201aead6c..c94e3dc0cf52 100644 --- a/sc/source/ui/inc/namepast.hxx +++ b/sc/source/ui/inc/namepast.hxx @@ -42,16 +42,12 @@ class ScRangeName; class ScNamePasteDlg : public ModalDialog { DECL_LINK( ButtonHdl, Button * ); - DECL_LINK( ListSelHdl, ListBox * ); - DECL_LINK( ListDblClickHdl, ListBox * ); protected: - FixedText aLabelText; - ListBox aNameList; - OKButton aOKButton; - CancelButton aCancelButton; - HelpButton aHelpButton; - PushButton aInsListButton; + HelpButton maHelpButton; + PushButton maBtnClose; + PushButton maBtnPaste; + PushButton maBtnPasteAll; public: ScNamePasteDlg( Window * pParent, const ScRangeName* pList, const ScRangeName* pLocalList, bool bInsList=true ); diff --git a/sc/source/ui/inc/scui_def.hxx b/sc/source/ui/inc/scui_def.hxx index 564b9f6eb362..e0311d22de56 100644 --- a/sc/source/ui/inc/scui_def.hxx +++ b/sc/source/ui/inc/scui_def.hxx @@ -50,6 +50,7 @@ #define BTN_PASTE_NAME 100 // from namepast.hxx #define BTN_PASTE_LIST 101 // from namepast.hxx +#define BTN_PASTE_CLOSE 102 // from namepast.hxx #define BTN_EXTEND_RANGE 150 #define BTN_CURRENT_SELECTION 151 diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 0480f01944b3..d0e1b3eba128 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -45,36 +45,15 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, const ScRangeName* pList, const ScRangeName* pLocalList, bool bInsList ) : ModalDialog( pParent, ScResId( RID_SCDLG_NAMES_PASTE ) ), - aLabelText ( this, ScResId( FT_LABEL ) ), - aNameList ( this, ScResId( LB_ENTRYLIST ) ), - aOKButton ( this, ScResId( BTN_OK ) ), - aCancelButton ( this, ScResId( BTN_CANCEL ) ), - aHelpButton ( this, ScResId( BTN_HELP ) ), - aInsListButton ( this, ScResId( BTN_ADD ) ) + maHelpButton ( this, ScResId( BTN_HELP ) ), + maBtnClose ( this, ScResId( BTN_CLOSE ) ), + maBtnPaste ( this, ScResId( BTN_PASTE ) ), + maBtnPasteAll ( this, ScResId( BTN_PASTE_ALL ) ) { - if( ! bInsList ) - aInsListButton.Disable(); - aInsListButton.SetClickHdl( LINK( this,ScNamePasteDlg,ButtonHdl) ); - aOKButton.SetClickHdl( LINK( this,ScNamePasteDlg,ButtonHdl) ); - aNameList.SetSelectHdl( LINK( this,ScNamePasteDlg,ListSelHdl) ); - aNameList.SetDoubleClickHdl( LINK( this,ScNamePasteDlg,ListDblClickHdl) ); - - ScRangeName::const_iterator itr = pLocalList->begin(), itrEnd = pLocalList->end(); - for (; itr != itrEnd; ++itr) - { - if (!itr->HasType(RT_DATABASE) && !itr->HasType(RT_SHARED)) - aNameList.InsertEntry(itr->GetName()); - } - - itr = pList->begin(), itrEnd = pList->end(); - for (; itr != itrEnd; ++itr) - { - if (!itr->HasType(RT_DATABASE) && !itr->HasType(RT_SHARED) && !pLocalList->findByName(itr->GetName())) - aNameList.InsertEntry(itr->GetName()); - } - - ListSelHdl( &aNameList ); + maBtnPaste.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl) ); + maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); + maBtnClose.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); FreeResource(); } @@ -83,49 +62,27 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, const ScRangeName* pList, cons IMPL_LINK( ScNamePasteDlg, ButtonHdl, Button *, pButton ) { - if( pButton == &aInsListButton ) + if( pButton == &maBtnPasteAll ) { EndDialog( BTN_PASTE_LIST ); } - else if( pButton == &aOKButton ) + else if( pButton == &maBtnPaste ) { EndDialog( BTN_PASTE_NAME ); } - return 0; -} - -//------------------------------------------------------------------ - -IMPL_LINK( ScNamePasteDlg, ListSelHdl, ListBox *, pListBox ) -{ - if( pListBox == &aNameList ) + else if( pButton == &maBtnClose ) { - if( aNameList.GetSelectEntryCount() ) - aOKButton.Enable(); - else - aOKButton.Disable(); + EndDialog( BTN_PASTE_CLOSE ); } return 0; } //------------------------------------------------------------------ -IMPL_LINK_INLINE_START( ScNamePasteDlg, ListDblClickHdl, ListBox *, pListBox ) -{ - if( pListBox == &aNameList ) - { - ButtonHdl( &aOKButton ); - } - return 0; -} -IMPL_LINK_INLINE_END( ScNamePasteDlg, ListDblClickHdl, ListBox *, pListBox ) - -//------------------------------------------------------------------ - std::vector ScNamePasteDlg::GetSelectedNames() const { std::vector aSelectedNames; - aSelectedNames.push_back(aNameList.GetSelectEntry()); + //aSelectedNames.push_back(aNameList.GetSelectEntry()); return aSelectedNames; } diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src index d0b5b3cb0d77..16e0a4703040 100644 --- a/sc/source/ui/src/miscdlgs.src +++ b/sc/source/ui/src/miscdlgs.src @@ -1413,52 +1413,36 @@ ModalDialog RID_SCDLG_NAMES_PASTE OutputSize = TRUE ; HelpId = CMD_FID_INSERT_NAME ; SVLook = TRUE ; - Size = MAP_APPFONT ( 228 , 85 ) ; + Size = MAP_APPFONT ( 228 , 140 ) ; Moveable = TRUE ; - FixedText FT_LABEL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 156 , 10 ) ; - Text [ en-US ] = "Insert name" ; - }; - ListBox LB_ENTRYLIST - { - HelpID = "sc:ListBox:RID_SCDLG_NAMES_PASTE:LB_ENTRYLIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 160 , 65 ) ; - TabStop = TRUE ; - VScroll = TRUE ; - Sort = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 172 , 4 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 172 , 21 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 172 , 41 ) ; + Pos = MAP_APPFONT ( 6, 120 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; - PushButton BTN_ADD + PushButton BTN_PASTE { - HelpID = "sc:PushButton:RID_SCDLG_NAMES_PASTE:BTN_ADD"; - Pos = MAP_APPFONT ( 172 , 66 ) ; + Pos = MAP_APPFONT ( 172 , 90 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - Text [ en-US ] = "Insert ~All" ; + Text [en-US] = "Paste"; }; - Text [ en-US ] = "Insert Name" ; + PushButton BTN_PASTE_ALL + { + Pos = MAP_APPFONT ( 6 , 90 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [en-US] = "Paste All"; + }; + PushButton BTN_CLOSE + { + Pos = MAP_APPFONT ( 172 , 120 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [en-US] = "Close"; + }; + Text [ en-US ] = "Paste Names" ; }; ModalDialog RID_SCDLG_CHARTCOLROW