From f4dcec24a829cf4b6899ee2703ac4181cebb762f Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Fri, 13 Jul 2012 17:16:40 +0200 Subject: fpicker: moved + and - buttons in the places list control It is visually more logical to have them in the control than ouside it and it also avoids weird display when moving the splitter too far on the left. Change-Id: I1183b1e81eb0135d376dce5a728c6be9f4250b19 --- fpicker/source/office/PlacesListBox.cxx | 37 ++++++++++++++++++++++++++++++++- fpicker/source/office/PlacesListBox.hxx | 5 +++++ fpicker/source/office/iodlg.cxx | 37 +++++++++++++-------------------- fpicker/source/office/iodlg.hrc | 4 +--- fpicker/source/office/iodlg.hxx | 4 ++-- fpicker/source/office/iodlg.src | 18 +--------------- fpicker/source/office/iodlgimp.cxx | 4 ---- fpicker/source/office/iodlgimp.hxx | 2 -- 8 files changed, 59 insertions(+), 52 deletions(-) (limited to 'fpicker/source/office') diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index b870f7580171..efcf50670712 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -78,6 +78,8 @@ PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTit maPlaces( ), mpDlg( pFileDlg ), mpImpl( NULL ), + mpAddBtn( ), + mpDelBtn( ), mnNbEditables( 0 ), mbUpdated( false ), mbSelectionChanged( false ) @@ -86,11 +88,23 @@ PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTit mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) ); mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ; + + mpAddBtn = new ImageButton( this, 0 ); + mpAddBtn->SetText( rtl::OUString( "+" ) ); + mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 24, 24 ) ); + mpAddBtn->Show(); + + mpDelBtn = new ImageButton( this, 0 ); + mpDelBtn->SetText( rtl::OUString( "-" ) ); + mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 24, 24 ) ); + mpDelBtn->Show(); } PlacesListBox::~PlacesListBox( ) { delete mpImpl; + delete mpAddBtn; + delete mpDelBtn; } void PlacesListBox::AppendPlace( PlacePtr pPlace ) @@ -139,10 +153,31 @@ void PlacesListBox::RemoveSelectedPlace() { RemovePlace(mpImpl->GetCurrRow()); } +void PlacesListBox::SetAddHdl( const Link& rHdl ) +{ + mpAddBtn->SetClickHdl( rHdl ); +} + +void PlacesListBox::SetDelHdl( const Link& rHdl ) +{ + mpDelBtn->SetClickHdl( rHdl ); +} + +void PlacesListBox::SetDelEnabled( bool enabled ) +{ + mpDelBtn->Enable( enabled ); +} + void PlacesListBox::SetSizePixel( const Size& rNewSize ) { Control::SetSizePixel( rNewSize ); - mpImpl->SetSizePixel( rNewSize ); + Size aListSize( rNewSize ); + aListSize.Height() -= 26 + 18; + mpImpl->SetSizePixel( aListSize ); + + sal_Int32 nBtnY = rNewSize.Height() - 26; + mpAddBtn->SetPosPixel( Point( 3, nBtnY ) ); + mpDelBtn->SetPosPixel( Point( 6 + 24, nBtnY ) ); } Image PlacesListBox::getEntryIcon( PlacePtr pPlace ) diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index 26daca473fea..f115aba78c85 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -94,6 +94,8 @@ class PlacesListBox : public Control std::vector< PlacePtr > maPlaces; SvtFileDialog* mpDlg; PlacesListBox_Impl* mpImpl; + PushButton* mpAddBtn; + PushButton* mpDelBtn; sal_Int32 mnNbEditables; bool mbUpdated; bool mbSelectionChanged; @@ -109,6 +111,9 @@ class PlacesListBox : public Control bool IsUpdated(); const std::vector& GetPlaces(); + void SetAddHdl( const Link& rHdl ); + void SetDelHdl( const Link& rHdl ); + void SetDelEnabled( bool enabled ); void SetSizePixel( const Size& rNewSize ); void updateView( ); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 84b46e7d22e5..6b53152d9dc5 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -568,14 +568,6 @@ void SvtFileDialog::Init_Impl _pImp->_pBtnConnectToServer = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_CONNECT_TO_SERVER ) ); _pImp->_pBtnConnectToServer->SetAccessibleName( _pImp->_pBtnConnectToServer->GetQuickHelpText() ); - _pImp->_pBtnAddPlace = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_ADD_PLACE ) ); - _pImp->_pBtnAddPlace->SetAccessibleName( _pImp->_pBtnAddPlace->GetQuickHelpText() ); - _pImp->_pBtnAddPlace->SetClickHdl( STATIC_LINK ( this, SvtFileDialog, AddPlacePressed_Hdl ) ); - - _pImp->_pBtnRemovePlace = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_REMOVE_PLACE ) ); - _pImp->_pBtnRemovePlace->SetAccessibleName( _pImp->_pBtnRemovePlace->GetQuickHelpText() ); - _pImp->_pBtnRemovePlace->SetClickHdl( STATIC_LINK ( this, SvtFileDialog, RemovePlacePressed_Hdl ) ); - _pImp->_pBtnUp = new SvtUpButton_Impl( this, SvtResId( BTN_EXPLORERFILE_UP ) ); _pImp->_pBtnNewFolder = new ImageButton( this, SvtResId( BTN_EXPLORERFILE_NEWFOLDER ) ); _pImp->_pBtnNewFolder->SetStyle( _pImp->_pBtnNewFolder->GetStyle() | WB_NOPOINTERFOCUS ); @@ -1439,23 +1431,23 @@ IMPL_STATIC_LINK ( SvtFileDialog, ConnectToServerPressed_Hdl, void*, EMPTYARG ) //***************************************************************************** -IMPL_STATIC_LINK ( SvtFileDialog, AddPlacePressed_Hdl, void*, EMPTYARG ) +IMPL_LINK_NOARG ( SvtFileDialog, AddPlacePressed_Hdl ) { // Maybe open the PlacesDialog would have been a better idea // there is an ux choice to make we did not make... - INetURLObject aURLObj( pThis->_pFileView->GetViewURL() ); + INetURLObject aURLObj( _pFileView->GetViewURL() ); PlacePtr newPlace( new Place( aURLObj.GetLastName(INetURLObject::DECODE_WITH_CHARSET), - ::rtl::OUString(pThis->_pFileView->GetViewURL()), true)); - pThis->_pImp->_pPlaces->AppendPlace(newPlace); + ::rtl::OUString(_pFileView->GetViewURL()), true)); + _pImp->_pPlaces->AppendPlace(newPlace); return 0; } //***************************************************************************** -IMPL_STATIC_LINK ( SvtFileDialog, RemovePlacePressed_Hdl, void*, EMPTYARG ) +IMPL_LINK_NOARG ( SvtFileDialog, RemovePlacePressed_Hdl ) { - pThis->_pImp->_pPlaces->RemoveSelectedPlace(); + _pImp->_pPlaces->RemoveSelectedPlace(); return 0; } @@ -1986,10 +1978,7 @@ void SvtFileDialog::onAsyncOperationFinished() //----------------------------------------------------------------------------- void SvtFileDialog::RemovablePlaceSelected(bool enable) { - if(enable) - _pImp->_pBtnRemovePlace->Enable(); - else - _pImp->_pBtnRemovePlace->Disable(); + _pImp->_pPlaces->SetDelEnabled( enable ); } //------------------------------------------------------------------------- @@ -2514,7 +2503,7 @@ void SvtFileDialog::implArrangeControls() { _pImp->_pEdCurrentPath, _pImp->_pBtnConnectToServer, _pImp->_pBtnUp, _pImp->_pBtnNewFolder, // image buttons - _pImp->_pPlaces, _pImp->_pBtnAddPlace, _pImp->_pBtnRemovePlace, // list of places + _pImp->_pPlaces, // list of places _pFileView, // the file view _pImp->_pFtFileName, _pImp->_pEdFileName, _pImp->_pFtFileVersion, _pImp->_pLbFileVersion, @@ -2684,7 +2673,8 @@ void SvtFileDialog::Resize() splitterNewSize.Height() += nDeltaY; _pSplitter->SetSizePixel( splitterNewSize ); sal_Int32 nMinX = _pImp->_pPlaces->GetPosPixel( ).X( ); - _pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( aDlgSize ) ) ); + sal_Int32 nMaxX = _pFileView->GetPosPixel( ).X( ) + _pFileView->GetSizePixel( ).Width() - nMinX; + _pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( nMaxX, aDlgSize.Width() ) ) ); // Resize the places list box to fit the height of the FileView Size placesNewSize(_pImp->_pPlaces->GetSizePixel()); @@ -2705,8 +2695,7 @@ void SvtFileDialog::Resize() _pImp->_pFtFileName, _pImp->_pEdFileName, _pImp->_pFtFileVersion, _pImp->_pLbFileVersion, _pImp->_pFtTemplates, _pImp->_pLbTemplates, _pImp->_pFtImageTemplates, _pImp->_pLbImageTemplates, _pImp->_pFtFileType, _pImp->GetFilterListControl(), _pCbReadOnly, _pCbLinkBox, _pCbPreviewBox, - _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection, - _pImp->_pBtnAddPlace, _pImp->_pBtnRemovePlace + _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection }; Control** ppMoveControls = aMoveControlsVert; Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsVert ) / sizeof( aMoveControlsVert[0] ); @@ -3029,6 +3018,9 @@ void SvtFileDialog::AddControls_Impl( ) } _pImp->_pPlaces = new PlacesListBox( this, SVT_RESSTR(STR_PLACES_TITLE), SvtResId(LB_EXPLORERFILE_PLACES_LISTBOX) ); + _pImp->_pPlaces->SetAddHdl( LINK ( this, SvtFileDialog, AddPlacePressed_Hdl ) ); + _pImp->_pPlaces->SetDelHdl( LINK ( this, SvtFileDialog, RemovePlacePressed_Hdl ) ); + initDefaultPlaces(); } @@ -3393,7 +3385,6 @@ IMPL_LINK_NOARG( SvtFileDialog, Split_Hdl ) _pFileView->SetPosSizePixel( fileViewPos, fileViewSize ); _pSplitter->SetPosPixel( Point( nSplitPos, _pSplitter->GetPosPixel().Y() ) ); - Resize(); return 0; } diff --git a/fpicker/source/office/iodlg.hrc b/fpicker/source/office/iodlg.hrc index 3b2bc8600c17..3b7a3f0b2282 100644 --- a/fpicker/source/office/iodlg.hrc +++ b/fpicker/source/office/iodlg.hrc @@ -52,9 +52,7 @@ #define LB_EXPLORERFILE_PLACES_LISTBOX 50 #define BTN_EXPLORERFILE_CONNECT_TO_SERVER 51 -#define BTN_EXPLORERFILE_ADD_PLACE 52 -#define BTN_EXPLORERFILE_REMOVE_PLACE 53 -#define EXPLORERFILE_SPLITTER 54 +#define EXPLORERFILE_SPLITTER 52 // ----------------------------------------------- diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index cf5e5029be54..efc8f4afdb7b 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -129,8 +129,8 @@ private: DECL_STATIC_LINK( SvtFileDialog, URLBoxModifiedHdl_Impl, void* ); DECL_STATIC_LINK( SvtFileDialog, ConnectToServerPressed_Hdl, void* ); - DECL_STATIC_LINK( SvtFileDialog, AddPlacePressed_Hdl, void* ); - DECL_STATIC_LINK( SvtFileDialog, RemovePlacePressed_Hdl, void* ); + DECL_LINK ( AddPlacePressed_Hdl, void* ); + DECL_LINK ( RemovePlacePressed_Hdl, void* ); DECL_LINK ( Split_Hdl, void* ); void Init_Impl( WinBits nBits ); diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src index 11d01da98f25..64f5d3af5c08 100644 --- a/fpicker/source/office/iodlg.src +++ b/fpicker/source/office/iodlg.src @@ -90,7 +90,7 @@ ModalDialog DLG_FPICKER_EXPLORERFILE { HelpID = "fpicker:ListBox:DLG_SVT_EXPLORERFILE:LB_EXPLORERFILE_PLACES_LISTBOX"; Pos = MAP_APPFONT ( 6 , 26 ) ; - Size = MAP_APPFONT ( 50 , 75 ) ; + Size = MAP_APPFONT ( 50 , 85 ) ; Border = TRUE ; }; PushButton BTN_EXPLORERFILE_CONNECT_TO_SERVER @@ -101,22 +101,6 @@ ModalDialog DLG_FPICKER_EXPLORERFILE Text [ en-US ] = "..." ; QuickHelpText [ en-US ] = "Connect To Server" ; }; - PushButton BTN_EXPLORERFILE_ADD_PLACE - { - HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_ADD_PLACE"; - Pos = MAP_APPFONT ( 6 , 101 ) ; - Size = MAP_APPFONT ( 10 , 10 ) ; - Text [ en-US ] = "+" ; - QuickHelpText [ en-US ] = "Bookmark This Place" ; - }; - PushButton BTN_EXPLORERFILE_REMOVE_PLACE - { - HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_REMOVE_PLACE"; - Pos = MAP_APPFONT ( 19 , 101 ) ; - Size = MAP_APPFONT ( 10 , 10 ) ; - Text [ en-US ] = "-" ; - QuickHelpText [ en-US ] = "Remove Selected Bookmark" ; - }; Control CTL_EXPLORERFILE_FILELIST { TabStop = TRUE ; diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 0309f3aa97ba..63baec198474 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -257,8 +257,6 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) : _pCbOptions ( NULL ), _pPlaces ( NULL ), _pBtnConnectToServer( NULL ), - _pBtnAddPlace ( NULL ), - _pBtnRemovePlace ( NULL ), _nState ( FILEDLG_STATE_REMOTE ), _nStyle ( 0 ), _bDoubleClick ( sal_False ), @@ -297,8 +295,6 @@ SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl() delete _pFilter; delete _pPlaces; delete _pBtnConnectToServer; - delete _pBtnAddPlace; - delete _pBtnRemovePlace; } //***************************************************************************** diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index f2aa91b20165..edd75cedd724 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -160,8 +160,6 @@ public: PlacesListBox* _pPlaces; PushButton* _pBtnConnectToServer; - PushButton* _pBtnAddPlace; - PushButton* _pBtnRemovePlace; SvtFileDlgMode _eMode; SvtFileDlgType _eDlgType; -- cgit v1.2.3